Skip to content

Commit acbcd70

Browse files
committed
chore: use tsup instead of unbuild
1 parent cbb31d8 commit acbcd70

File tree

18 files changed

+71
-42
lines changed

18 files changed

+71
-42
lines changed

apps/vite-vue/.tw-patch/tw-class-list.json

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"before:rounded-full",
2525
"before:to-transparent",
2626
"before:w-[480px]",
27+
"bg-[#828282]",
28+
"bg-[#929292]",
2729
"bg-[#B91C1C]",
2830
"bg-gradient-to-b",
2931
"bg-gradient-to-t",

apps/vite-vue/src/components/HelloWorld.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const count = ref(0)
99
<template>
1010
<h1>{{ msg }}</h1>
1111

12-
<div class="card">
12+
<div class="card bg-[#828282]">
1313
<button type="button" @click="count++">count is {{ count }}</button>
1414
<p>
1515
Edit

apps/vite-vue/src/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ import './style.css'
33
import './index.scss'
44
import App from './App.vue'
55

6+
console.log('bg-[#929292]')
7+
68
createApp(App).mount('#app')

apps/vite-vue/tailwindcss-mangle.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { defineConfig } from 'tailwindcss-patch'
22

33
export default defineConfig({
44
mangle: {
5-
preserveFunction: ['twMerge']
6-
}
5+
preserveFunction: ['twMerge'],
6+
},
77
})

packages/config/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tailwindcss-mangle/config",
3-
"version": "2.2.2",
3+
"version": "3.0.0",
44
"description": "The config and load function of tailwindcss-mangle",
55
"author": "SonOfMagic <qq1324318532@gmail.com>",
66
"license": "MIT",
@@ -22,10 +22,10 @@
2222
".": {
2323
"types": "./dist/index.d.ts",
2424
"import": "./dist/index.mjs",
25-
"require": "./dist/index.cjs"
25+
"require": "./dist/index.js"
2626
}
2727
},
28-
"main": "./dist/index.cjs",
28+
"main": "./dist/index.js",
2929
"module": "./dist/index.mjs",
3030
"types": "./dist/index.d.ts",
3131
"typesVersions": {
@@ -40,8 +40,8 @@
4040
"dist"
4141
],
4242
"scripts": {
43-
"dev": "unbuild --sourcemap",
44-
"build": "unbuild",
43+
"dev": "tsup --watch --sourcemap",
44+
"build": "tsup",
4545
"test": "vitest run --coverage.enabled",
4646
"test:dev": "vitest"
4747
},

packages/config/src/defaults.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import process from 'node:process'
12
import { defaultMangleClassFilter } from '@tailwindcss-mangle/shared'
23
import type { MangleUserConfig, PatchUserConfig, UserConfig } from './types'
34

packages/config/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"src",
1313
"test"
1414
]
15-
}
15+
}

packages/config/tsup.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'tsup'
2+
3+
export default defineConfig({
4+
entry: [
5+
'src/index.ts',
6+
], // , 'src/cli.ts'],
7+
shims: true,
8+
format: ['cjs', 'esm'],
9+
clean: true,
10+
dts: true,
11+
})

packages/core/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tailwindcss-mangle/core",
3-
"version": "2.3.0",
3+
"version": "3.0.0",
44
"description": "The core of tailwindcss-mangle",
55
"author": "SonOfMagic <qq1324318532@gmail.com>",
66
"license": "MIT",
@@ -22,10 +22,10 @@
2222
".": {
2323
"types": "./dist/index.d.ts",
2424
"import": "./dist/index.mjs",
25-
"require": "./dist/index.cjs"
25+
"require": "./dist/index.js"
2626
}
2727
},
28-
"main": "./dist/index.cjs",
28+
"main": "./dist/index.js",
2929
"module": "./dist/index.mjs",
3030
"types": "./dist/index.d.ts",
3131
"typesVersions": {
@@ -40,8 +40,8 @@
4040
"dist"
4141
],
4242
"scripts": {
43-
"dev": "unbuild --sourcemap",
44-
"build": "unbuild",
43+
"dev": "tsup --watch --sourcemap",
44+
"build": "tsup",
4545
"test": "vitest run --coverage.enabled",
4646
"test:dev": "vitest",
4747
"coverage": "vitest run --coverage"

packages/core/tsup.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'tsup'
2+
3+
export default defineConfig({
4+
entry: [
5+
'src/index.ts',
6+
], // , 'src/cli.ts'],
7+
shims: true,
8+
format: ['cjs', 'esm'],
9+
clean: true,
10+
dts: true,
11+
})

packages/shared/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tailwindcss-mangle/shared",
3-
"version": "2.2.2",
3+
"version": "3.0.0",
44
"description": "The shared utils of tailwindcss-mangle",
55
"author": "SonOfMagic <qq1324318532@gmail.com>",
66
"license": "MIT",
@@ -21,10 +21,10 @@
2121
".": {
2222
"types": "./dist/index.d.ts",
2323
"import": "./dist/index.mjs",
24-
"require": "./dist/index.cjs"
24+
"require": "./dist/index.js"
2525
}
2626
},
27-
"main": "./dist/index.cjs",
27+
"main": "./dist/index.js",
2828
"module": "./dist/index.mjs",
2929
"types": "./dist/index.d.ts",
3030
"typesVersions": {
@@ -39,8 +39,8 @@
3939
"dist"
4040
],
4141
"scripts": {
42-
"dev": "unbuild --sourcemap",
43-
"build": "unbuild",
42+
"dev": "tsup --watch --sourcemap",
43+
"build": "tsup",
4444
"test": "vitest run --coverage.enabled",
4545
"test:dev": "vitest"
4646
},

packages/shared/src/classGenerator.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ class ClassGenerator implements IClassGenerator {
5959
transformCssClass(className: string): string {
6060
const key = stripEscapeSequence(className)
6161
const cn = this.newClassMap[key]
62-
if (cn) { return cn.name }
62+
if (cn) {
63+
return cn.name
64+
}
6365
return className
6466
}
6567

@@ -68,7 +70,9 @@ class ClassGenerator implements IClassGenerator {
6870

6971
original = stripEscapeSequence(original)
7072
const cn = this.newClassMap[original]
71-
if (cn) { return cn }
73+
if (cn) {
74+
return cn
75+
}
7276

7377
let newClassName
7478
if (opts.customGenerate && typeof opts.customGenerate === 'function') {

packages/shared/tsup.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'tsup'
2+
3+
export default defineConfig({
4+
entry: [
5+
'src/index.ts',
6+
], // , 'src/cli.ts'],
7+
shims: true,
8+
format: ['cjs', 'esm'],
9+
clean: true,
10+
dts: true,
11+
})
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env node
22
const fs = require('node:fs')
33
const path = require('node:path')
4-
const cliPath = path.resolve(__dirname, '../dist/cli.cjs')
4+
5+
const cliPath = path.resolve(__dirname, '../dist/cli.js')
56
if (fs.existsSync(cliPath)) {
67
require(cliPath)
78
}

packages/tailwindcss-patch/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"extract",
1919
"class"
2020
],
21-
"main": "./dist/index.cjs",
21+
"main": "./dist/index.js",
22+
"module": "./dist/index.mjs",
2223
"types": "./dist/index.d.ts",
2324
"bin": {
2425
"tw-patch": "bin/tw-patch.js",
@@ -29,8 +30,8 @@
2930
"dist"
3031
],
3132
"scripts": {
32-
"dev": "unbuild --sourcemap",
33-
"build": "unbuild",
33+
"dev": "tsup --watch --sourcemap",
34+
"build": "tsup",
3435
"test": "vitest run --coverage.enabled",
3536
"test:dev": "vitest",
3637
"patch": "node bin/tw-patch.js install"

packages/tailwindcss-patch/tsup.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export default defineConfig({
55
shims: true,
66
sourcemap: false,
77
clean: true,
8-
format: ['cjs'], // , 'esm'
8+
format: ['cjs', 'esm'], // , 'esm'
99
dts: true,
1010
})

packages/unplugin-tailwind-merge/package.json

-15
This file was deleted.

packages/unplugin-tailwindcss-mangle/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unplugin-tailwindcss-mangle",
3-
"version": "2.3.0",
3+
"version": "3.0.0",
44
"description": "mangle tailwindcss utilities class plugin. support vite and webpack!",
55
"author": "SonOfMagic <qq1324318532@gmail.com>",
66
"license": "MIT",

0 commit comments

Comments
 (0)