Skip to content

Commit d2f5bc6

Browse files
committed
chore: deps
1 parent 6b269b5 commit d2f5bc6

File tree

11 files changed

+161
-957
lines changed

11 files changed

+161
-957
lines changed

apps/next-app/next.config.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// import process from 'node:process'
2+
const process = require('node:process')
13
const utwm = require('unplugin-tailwindcss-mangle/webpack')
24
// import utwm from 'unplugin-tailwindcss-mangle'
35

@@ -6,13 +8,16 @@ const nextConfig = {
68
reactStrictMode: true,
79
webpack: (config) => {
810
// console.log(process.env.NODE_ENV)
9-
if (process.env.NODE_ENV === 'production') {
10-
config.plugins.push(utwm({
11-
classMapOutput: true
12-
}))
13-
}
11+
// if (process.env.NODE_ENV === 'production') {
12+
// config.plugins.push(utwm({
13+
// classMapOutput: true,
14+
// }))
15+
// }
16+
config.plugins.push(utwm({
17+
classMapOutput: true,
18+
}))
1419
return config
15-
}
20+
},
1621
}
1722

1823
module.exports = nextConfig

apps/next-app/tailwind.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ module.exports = {
1616
},
1717
plugins: [],
1818
corePlugins: {
19-
preflight: false
20-
}
19+
preflight: false,
20+
},
2121
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import { defineConfig } from 'tailwindcss-patch'
22

3-
export default defineConfig({})
3+
export default defineConfig({})

apps/next-app/tsconfig.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
22
"compilerOptions": {
3+
"incremental": true,
34
"target": "es5",
5+
"jsx": "preserve",
46
"lib": ["dom", "dom.iterable", "esnext"],
7+
"module": "esnext",
8+
"moduleResolution": "node",
9+
"paths": {
10+
"@/*": ["./*"]
11+
},
12+
"resolveJsonModule": true,
513
"allowJs": true,
6-
"skipLibCheck": true,
714
"strict": true,
8-
"forceConsistentCasingInFileNames": true,
915
"noEmit": true,
1016
"esModuleInterop": true,
11-
"module": "esnext",
12-
"moduleResolution": "node",
13-
"resolveJsonModule": true,
17+
"forceConsistentCasingInFileNames": true,
1418
"isolatedModules": true,
15-
"jsx": "preserve",
16-
"incremental": true,
17-
"paths": {
18-
"@/*": ["./*"]
19-
}
19+
"skipLibCheck": true
2020
},
2121
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
2222
"exclude": ["node_modules"]

apps/pnpm-lock.yaml

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

apps/remix-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@remix-run/node": "^2.9.2",
1515
"@remix-run/react": "^2.9.2",
1616
"@remix-run/serve": "^2.9.2",
17-
"isbot": "^5.1.9",
17+
"isbot": "^5.1.10",
1818
"react": "^18.3.1",
1919
"react-dom": "^18.3.1"
2020
},

apps/vite-svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"autoprefixer": "^10.4.19",
1818
"postcss": "^8.4.38",
1919
"svelte": "^4.2.18",
20-
"svelte-check": "^3.8.1",
20+
"svelte-check": "^3.8.2",
2121
"tailwindcss": "^3.4.4",
2222
"tslib": "^2.6.3",
2323
"typescript": "^5.5.2",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"devDependencies": {
2727
"@changesets/changelog-github": "^0.5.0",
28-
"@changesets/cli": "^2.27.5",
28+
"@changesets/cli": "^2.27.6",
2929
"@icebreakers/eslint-config": "^0.3.9",
3030
"@rollup/pluginutils": "^5.1.0",
3131
"@tailwindcss-mangle/core": "workspace:*",

packages/core/src/css/index.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ import type { ICssHandlerOptions, IHandlerTransformResult } from '@/types'
55
export async function cssHandler(rawSource: string, options: ICssHandlerOptions): Promise<IHandlerTransformResult> {
66
const acceptedPlugins = [transformSelectorPostcssPlugin(options)]
77
const { id } = options
8-
const { css: code, map } = await postcss(acceptedPlugins).process(rawSource, {
9-
from: id,
10-
to: id,
11-
})
12-
return {
13-
code,
14-
// @ts-ignore
15-
map,
8+
try {
9+
const { css: code, map } = await postcss(acceptedPlugins).process(rawSource, {
10+
from: id,
11+
to: id,
12+
})
13+
return {
14+
code,
15+
// @ts-ignore
16+
map,
17+
}
18+
}
19+
catch (error) {
20+
return {
21+
code: rawSource,
22+
}
1623
}
1724
}

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

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import { Context, cssHandler, htmlHandler, jsHandler } from '@tailwindcss-mangle
33
import type { MangleUserConfig } from '@tailwindcss-mangle/config'
44
import { isCSSRequest } from 'is-css-request'
55
import { createFilter } from '@rollup/pluginutils'
6+
import type { OutputAsset } from 'rollup'
67
import { pluginName } from '@/constants'
8+
import { getGroupedEntries } from '@/utils'
79

8-
const factory: UnpluginFactory<MangleUserConfig | undefined> = (options) => {
10+
const factory: UnpluginFactory<MangleUserConfig | undefined> = (options, { framework }) => {
911
const ctx = new Context()
1012
let filter = (_id: string) => true
1113
return [
1214
{
1315
name: `${pluginName}:pre`,
14-
// enforce: 'pre',
16+
enforce: 'pre',
1517
async buildStart() {
1618
await ctx.initConfig({
1719
mangleOptions: options,
@@ -56,6 +58,80 @@ const factory: UnpluginFactory<MangleUserConfig | undefined> = (options) => {
5658
const { code } = htmlHandler(html, { ctx })
5759
return code
5860
},
61+
// generateBundle: {
62+
// async handler(options, bundle) {
63+
// const groupedEntries = getGroupedEntries(Object.entries(bundle))
64+
65+
// if (Array.isArray(groupedEntries.css) && groupedEntries.css.length > 0) {
66+
// for (let i = 0; i < groupedEntries.css.length; i++) {
67+
// const [id, cssSource] = groupedEntries.css[i] as [string, OutputAsset]
68+
69+
// const { code } = await cssHandler(cssSource.source.toString(), {
70+
// id,
71+
// ctx,
72+
// })
73+
// cssSource.source = code
74+
// }
75+
// }
76+
// },
77+
// },
78+
},
79+
webpack(compiler) {
80+
const { Compilation, sources } = compiler.webpack
81+
const { ConcatSource } = sources
82+
83+
compiler.hooks.compilation.tap(pluginName, (compilation) => {
84+
compilation.hooks.processAssets.tapPromise(
85+
{
86+
name: pluginName,
87+
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
88+
},
89+
async (assets) => {
90+
const groupedEntries = getGroupedEntries(Object.entries(assets))
91+
92+
// if (groupedEntries.js.length > 0) {
93+
// for (let i = 0; i < groupedEntries.js.length; i++) {
94+
// const [file, chunk] = groupedEntries.js[i]
95+
96+
// const code = jsHandler(chunk.source().toString(), {
97+
// ctx,
98+
// }).code
99+
// if (code) {
100+
// const source = new ConcatSource(code)
101+
// compilation.updateAsset(file, source)
102+
// }
103+
// }
104+
// }
105+
106+
if (groupedEntries.css.length > 0) {
107+
for (let i = 0; i < groupedEntries.css.length; i++) {
108+
const [id, cssSource] = groupedEntries.css[i]
109+
110+
const { code } = await cssHandler(cssSource.source().toString(), {
111+
id,
112+
ctx,
113+
})
114+
115+
const source = new ConcatSource(code)
116+
117+
compilation.updateAsset(id, source)
118+
}
119+
}
120+
121+
// if (groupedEntries.html.length > 0) {
122+
// for (let i = 0; i < groupedEntries.html.length; i++) {
123+
// const [file, asset] = groupedEntries.html[i]
124+
125+
// const { code } = htmlHandler(asset.source().toString(), {
126+
// ctx,
127+
// })
128+
// const source = new ConcatSource(code)
129+
// compilation.updateAsset(file, source)
130+
// }
131+
// }
132+
},
133+
)
134+
})
59135
},
60136
writeBundle() {
61137
ctx.dump()

0 commit comments

Comments
 (0)