Skip to content

Commit 23badf9

Browse files
committed
chore: unplugin-tailwindcss-mangle esm
1 parent 57f8ce3 commit 23badf9

File tree

12 files changed

+81
-85
lines changed

12 files changed

+81
-85
lines changed

.changeset/clever-peaches-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"unplugin-tailwindcss-mangle": major
3+
---
4+
5+
feat: prefer esm

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,4 +1556,4 @@
15561556
"z-30",
15571557
"z-40",
15581558
"z-50"
1559-
]
1559+
]

apps/vite-react/tsconfig.node.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"compilerOptions": {
33
"composite": true,
4+
"target": "ESNext",
45
"module": "ESNext",
5-
"moduleResolution": "Node",
6+
"moduleResolution": "Bundler",
67
"allowSyntheticDefaultImports": true
78
},
89
"include": ["vite.config.ts"]

apps/vite-react/vite.config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
import react from '@vitejs/plugin-react'
2-
import utwm from 'unplugin-tailwindcss-mangle/vite'
2+
import { register } from 'tsx/esm/api'
33
import { defineConfig } from 'vite'
4-
// https://vitejs.dev/config/
4+
5+
register()
6+
const { default: utwm } = await import('unplugin-tailwindcss-mangle/vite')
7+
58
export default defineConfig({
69
plugins: [
710
react(),
811
utwm({
912
classMapOutput: true,
1013
}),
1114
],
15+
css: {
16+
preprocessorOptions: {
17+
scss: {
18+
silenceDeprecations: ['legacy-js-api'],
19+
},
20+
},
21+
},
1222
})

apps/vite-vue/tsconfig.node.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"compilerOptions": {
33
"composite": true,
4+
"target": "ESNext",
45
"module": "ESNext",
5-
"moduleResolution": "Node",
6+
"moduleResolution": "Bundler",
67
"allowSyntheticDefaultImports": true
78
},
89
"include": ["vite.config.ts"]

apps/vite-vue/vite.config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import vue from '@vitejs/plugin-vue'
2-
import utwm from 'unplugin-tailwindcss-mangle/vite'
2+
import { register } from 'tsx/esm/api'
33
import { defineConfig } from 'vite'
4+
5+
register()
6+
const { default: utwm } = await import('unplugin-tailwindcss-mangle/vite')
47
// https://vitejs.dev/config/
58
export default defineConfig({
69
plugins: [
@@ -9,4 +12,11 @@ export default defineConfig({
912
classMapOutput: true,
1013
}),
1114
],
15+
css: {
16+
preprocessorOptions: {
17+
scss: {
18+
silenceDeprecations: ['legacy-js-api'],
19+
},
20+
},
21+
},
1222
})

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@commitlint/prompt-cli": "^19.5.0",
4040
"@commitlint/types": "^19.5.0",
4141
"@icebreakers/eslint-config": "^0.6.1",
42-
"@icebreakers/monorepo": "^0.6.11",
42+
"@icebreakers/monorepo": "^0.6.12",
4343
"@icebreakers/stylelint-config": "^0.1.2",
4444
"@rollup/pluginutils": "^5.1.3",
4545
"@tailwindcss-mangle/core": "workspace:*",
@@ -71,7 +71,7 @@
7171
"defu": "^6.1.4",
7272
"del": "^8.0.0",
7373
"eslint": "^9.13.0",
74-
"execa": "^9.4.1",
74+
"execa": "^9.5.0",
7575
"fast-glob": "^3.3.2",
7676
"fs-extra": "^11.2.0",
7777
"get-value": "^3.0.1",

packages/unplugin-tailwindcss-mangle/build.config.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/unplugin-tailwindcss-mangle/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@
2121
"exports": {
2222
".": {
2323
"types": "./dist/index.d.ts",
24-
"import": "./dist/index.mjs",
24+
"import": "./dist/index.js",
2525
"require": "./dist/index.cjs"
2626
},
2727
"./vite": {
2828
"types": "./dist/vite.d.ts",
29-
"import": "./dist/vite.mjs",
29+
"import": "./dist/vite.js",
3030
"require": "./dist/vite.cjs"
3131
},
3232
"./webpack": {
3333
"types": "./dist/webpack.d.ts",
34-
"import": "./dist/webpack.mjs",
34+
"import": "./dist/webpack.js",
3535
"require": "./dist/webpack.cjs"
3636
},
3737
"./rollup": {
3838
"types": "./dist/rollup.d.ts",
39-
"import": "./dist/rollup.mjs",
39+
"import": "./dist/rollup.js",
4040
"require": "./dist/rollup.cjs"
4141
},
4242
"./esbuild": {
4343
"types": "./dist/esbuild.d.ts",
44-
"import": "./dist/esbuild.mjs",
44+
"import": "./dist/esbuild.js",
4545
"require": "./dist/esbuild.cjs"
4646
},
4747
"./*": "./*"
4848
},
4949
"main": "./dist/index.cjs",
50-
"module": "./dist/index.mjs",
50+
"module": "./dist/index.js",
5151
"types": "./dist/index.d.ts",
5252
"typesVersions": {
5353
"*": {
@@ -61,8 +61,8 @@
6161
"dist"
6262
],
6363
"scripts": {
64-
"dev": "unbuild --sourcemap",
65-
"build": "unbuild",
64+
"dev": "tsup --watch --sourcemap",
65+
"build": "tsup",
6666
"test": "vitest run --coverage.enabled",
6767
"test:dev": "vitest"
6868
},

packages/unplugin-tailwindcss-mangle/src/core/factory.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { MangleUserConfig } from '@tailwindcss-mangle/config'
22
import type { UnpluginFactory } from 'unplugin'
3-
import path from 'pathe'
4-
import { pluginName } from '@/constants'
53
import { getGroupedEntries } from '@/utils'
64
import { createFilter } from '@rollup/pluginutils'
75
import { Context, cssHandler, htmlHandler, jsHandler } from '@tailwindcss-mangle/core'
86
import { isCSSRequest } from 'is-css-request'
7+
import path from 'pathe'
8+
import { pluginName } from '../constants'
99

1010
const WEBPACK_LOADER = path.resolve(__dirname, __DEV__ ? '../../dist/core/loader.cjs' : 'core/loader.cjs')
1111

12-
const factory: UnpluginFactory<MangleUserConfig | undefined> = (options, { framework }) => {
12+
const factory: UnpluginFactory<MangleUserConfig | undefined> = (options) => {
1313
const ctx = new Context()
1414
let filter = (_id: string) => true
1515
return [

packages/unplugin-tailwindcss-mangle/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'node:fs/promises'
2-
import path from 'pathe'
32
import process from 'node:process'
43
import { groupBy } from '@tailwindcss-mangle/shared'
4+
import path from 'pathe'
55
import { pluginName } from './constants'
66

77
export function escapeStringRegexp(str: string) {

pnpm-lock.yaml

Lines changed: 34 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)