weapp-tailwindcss 4.10.3 → 4.11.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/{chunk-3XVUGMTY.mjs → chunk-2LH6PZH3.mjs} +8 -4
  2. package/dist/{chunk-3WUHHFLF.mjs → chunk-35EI5JMK.mjs} +4 -2
  3. package/dist/{chunk-RYC23C3K.js → chunk-4LPOQMFS.js} +203 -198
  4. package/dist/{chunk-5U24PLVV.js → chunk-ACTJYB33.js} +4 -2
  5. package/dist/chunk-CZLXTEHN.js +1936 -0
  6. package/dist/{chunk-TNYEOBAC.mjs → chunk-DOH7FULQ.mjs} +1 -1
  7. package/dist/{chunk-E7775SFS.mjs → chunk-FZNYV7VH.mjs} +914 -334
  8. package/dist/{chunk-6Z4GEN2Y.js → chunk-G3G437UE.js} +2 -2
  9. package/dist/{chunk-DEIJXHGJ.js → chunk-G5NLM3AL.js} +978 -398
  10. package/dist/{chunk-W2N6G2QQ.js → chunk-GWDHNCL2.js} +60 -46
  11. package/dist/{chunk-QOTLDKI4.mjs → chunk-IEZ5RBMG.mjs} +197 -192
  12. package/dist/{chunk-RM3SY4S4.mjs → chunk-JBM3HGHP.mjs} +52 -12
  13. package/dist/{chunk-WXT2GI5R.mjs → chunk-KKT2DKMW.mjs} +30 -16
  14. package/dist/chunk-LD7LZ4IK.mjs +1933 -0
  15. package/dist/{chunk-GCRL3ZYP.js → chunk-NOKJXG3W.js} +5 -5
  16. package/dist/{chunk-YUTKX7JZ.js → chunk-OV7FX6XR.js} +1 -1
  17. package/dist/{chunk-SR4GC2F4.js → chunk-OYSABARD.js} +8 -4
  18. package/dist/{chunk-LICQ6EGN.mjs → chunk-QYZCRG7F.mjs} +2 -2
  19. package/dist/{chunk-UYTCZXNE.mjs → chunk-R6KEYO3F.mjs} +6 -5
  20. package/dist/{chunk-WF636Q5E.js → chunk-SQG2MOFQ.js} +10 -9
  21. package/dist/{chunk-L7OBNTRI.js → chunk-W2EMGF7H.js} +57 -17
  22. package/dist/cli.js +45 -42
  23. package/dist/cli.mjs +9 -6
  24. package/dist/core.d.mts +4 -3
  25. package/dist/core.d.ts +4 -3
  26. package/dist/core.js +124 -30
  27. package/dist/core.mjs +119 -25
  28. package/dist/css-macro/postcss.js +6 -5
  29. package/dist/css-macro/postcss.mjs +4 -3
  30. package/dist/css-macro.js +5 -5
  31. package/dist/css-macro.mjs +2 -2
  32. package/dist/defaults.js +3 -3
  33. package/dist/defaults.mjs +2 -2
  34. package/dist/escape.js +2 -1
  35. package/dist/escape.mjs +2 -1
  36. package/dist/gulp.d.mts +1 -1
  37. package/dist/gulp.d.ts +1 -1
  38. package/dist/gulp.js +8 -7
  39. package/dist/gulp.mjs +8 -7
  40. package/dist/index.js +11 -11
  41. package/dist/index.mjs +9 -9
  42. package/dist/postcss-html-transform.js +1 -1
  43. package/dist/postcss-html-transform.mjs +1 -1
  44. package/dist/presets.js +5 -5
  45. package/dist/presets.mjs +2 -2
  46. package/dist/reset.js +1 -1
  47. package/dist/reset.mjs +1 -1
  48. package/dist/types.js +1 -1
  49. package/dist/types.mjs +1 -1
  50. package/dist/vite.d.mts +1 -1
  51. package/dist/vite.d.ts +1 -1
  52. package/dist/vite.js +9 -8
  53. package/dist/vite.mjs +8 -7
  54. package/dist/webpack.d.mts +1 -1
  55. package/dist/webpack.d.ts +1 -1
  56. package/dist/webpack.js +10 -9
  57. package/dist/webpack.mjs +8 -7
  58. package/dist/webpack4.d.mts +1 -1
  59. package/dist/webpack4.d.ts +1 -1
  60. package/dist/webpack4.js +64 -49
  61. package/dist/webpack4.mjs +33 -18
  62. package/package.json +7 -7
  63. package/dist/chunk-PALDKVKG.mjs +0 -1291
  64. package/dist/chunk-YJSFFRNZ.js +0 -1291
package/dist/webpack4.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  isMpx,
11
11
  patchMpxLoaderResolve,
12
12
  setupMpxTailwindcssRedirect
13
- } from "./chunk-UYTCZXNE.mjs";
13
+ } from "./chunk-R6KEYO3F.mjs";
14
14
  import {
15
15
  pushConcurrentTaskFactories,
16
16
  resolveDisabledOptions,
@@ -23,22 +23,22 @@ import {
23
23
  } from "./chunk-RRHPTTCP.mjs";
24
24
  import {
25
25
  setupPatchRecorder
26
- } from "./chunk-LICQ6EGN.mjs";
26
+ } from "./chunk-QYZCRG7F.mjs";
27
27
  import {
28
28
  createDebug,
29
29
  ensureRuntimeClassSet,
30
30
  getCompilerContext,
31
31
  getRuntimeClassSetSignature,
32
32
  pluginName
33
- } from "./chunk-E7775SFS.mjs";
34
- import "./chunk-QOTLDKI4.mjs";
35
- import "./chunk-3WUHHFLF.mjs";
33
+ } from "./chunk-FZNYV7VH.mjs";
34
+ import "./chunk-IEZ5RBMG.mjs";
35
+ import "./chunk-35EI5JMK.mjs";
36
36
  import {
37
37
  getGroupedEntries
38
38
  } from "./chunk-OOHJLO5M.mjs";
39
39
  import {
40
40
  __dirname
41
- } from "./chunk-TNYEOBAC.mjs";
41
+ } from "./chunk-DOH7FULQ.mjs";
42
42
 
43
43
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
44
44
  import process3 from "process";
@@ -61,6 +61,7 @@ function setupWebpackV4EmitHook(options) {
61
61
  runtimeState,
62
62
  debug: debug2
63
63
  } = options;
64
+ const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
64
65
  compiler.hooks.emit.tapPromise(pluginName, async (compilation) => {
65
66
  await runtimeState.patchPromise;
66
67
  compilerOptions.onStart();
@@ -126,6 +127,26 @@ function setupWebpackV4EmitHook(options) {
126
127
  }
127
128
  };
128
129
  const groupedEntries = getGroupedEntries(entries, compilerOptions);
130
+ const getCssHandlerOptions = (file) => {
131
+ const majorVersion = runtimeState.twPatcher.majorVersion;
132
+ const isMainChunk = compilerOptions.mainCssChunkMatcher(file, appType);
133
+ const cacheKey = `${majorVersion ?? "unknown"}:${isMainChunk ? "1" : "0"}:${file}`;
134
+ const cached = cssHandlerOptionsCache.get(cacheKey);
135
+ if (cached) {
136
+ return cached;
137
+ }
138
+ const created = {
139
+ isMainChunk,
140
+ postcssOptions: {
141
+ options: {
142
+ from: file
143
+ }
144
+ },
145
+ majorVersion
146
+ };
147
+ cssHandlerOptionsCache.set(cacheKey, created);
148
+ return created;
149
+ };
129
150
  const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
130
151
  const runtimeSet = await ensureRuntimeClassSet(runtimeState, {
131
152
  // webpack 的 script-only 热更新可能不会触发 runtime classset loader,
@@ -133,6 +154,9 @@ function setupWebpackV4EmitHook(options) {
133
154
  forceCollect: true,
134
155
  allowEmpty: false
135
156
  });
157
+ const defaultTemplateHandlerOptions = {
158
+ runtimeSet
159
+ };
136
160
  debug2("get runtimeSet, class count: %d", runtimeSet.size);
137
161
  const tasks = [];
138
162
  if (Array.isArray(groupedEntries.html)) {
@@ -155,9 +179,7 @@ function setupWebpackV4EmitHook(options) {
155
179
  debug2("html cache hit: %s", file);
156
180
  },
157
181
  transform: async () => {
158
- const wxml = await compilerOptions.templateHandler(rawSource, {
159
- runtimeSet
160
- });
182
+ const wxml = await compilerOptions.templateHandler(rawSource, defaultTemplateHandlerOptions);
161
183
  const source = new ConcatSource(wxml);
162
184
  compilerOptions.onUpdate(file, rawSource, wxml);
163
185
  debug2("html handle: %s", file);
@@ -240,15 +262,7 @@ function setupWebpackV4EmitHook(options) {
240
262
  },
241
263
  transform: async () => {
242
264
  await runtimeState.patchPromise;
243
- const { css } = await compilerOptions.styleHandler(rawSource, {
244
- isMainChunk: compilerOptions.mainCssChunkMatcher(file, appType),
245
- postcssOptions: {
246
- options: {
247
- from: file
248
- }
249
- },
250
- majorVersion: runtimeState.twPatcher.majorVersion
251
- });
265
+ const { css } = await compilerOptions.styleHandler(rawSource, getCssHandlerOptions(file));
252
266
  const source = new ConcatSource(css);
253
267
  compilerOptions.onUpdate(file, rawSource, css);
254
268
  debug2("css handle: %s", file);
@@ -467,5 +481,6 @@ var UnifiedWebpackPluginV4 = class {
467
481
  };
468
482
  export {
469
483
  UnifiedWebpackPluginV4,
484
+ UnifiedWebpackPluginV4 as weappTailwindcss,
470
485
  weappTailwindcssPackageDir
471
486
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "4.10.3",
3
+ "version": "4.11.0-alpha.1",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -168,8 +168,8 @@
168
168
  "@babel/traverse": "~7.29.0",
169
169
  "@babel/types": "~7.29.0",
170
170
  "@tailwindcss-mangle/config": "^6.1.3",
171
- "@vue/compiler-dom": "^3.5.28",
172
- "@vue/compiler-sfc": "^3.5.28",
171
+ "@vue/compiler-dom": "^3.5.30",
172
+ "@vue/compiler-sfc": "^3.5.30",
173
173
  "@weapp-core/escape": "~7.0.0",
174
174
  "@weapp-core/regex": "~1.0.1",
175
175
  "cac": "^6.7.14",
@@ -184,9 +184,9 @@
184
184
  "tailwindcss-patch": "^8.7.3",
185
185
  "webpack-sources": "3.3.4",
186
186
  "yaml": "^2.8.2",
187
- "@weapp-tailwindcss/postcss": "2.1.5",
188
- "@weapp-tailwindcss/shared": "1.1.2",
189
- "@weapp-tailwindcss/logger": "1.1.0"
187
+ "@weapp-tailwindcss/logger": "1.1.0",
188
+ "@weapp-tailwindcss/postcss": "2.1.6-alpha.0",
189
+ "@weapp-tailwindcss/shared": "1.1.3-alpha.0"
190
190
  },
191
191
  "scripts": {
192
192
  "dev": "tsup --watch --sourcemap",
@@ -214,6 +214,6 @@
214
214
  "lint:fix": "eslint ./src --fix",
215
215
  "postinstall": "node bin/weapp-tailwindcss.js patch",
216
216
  "bench:vite-dev-hmr": "tsx scripts/vite-dev-hmr-bench.ts",
217
- "test:watch-hmr": "tsx scripts/watch-hmr-regression/index.ts"
217
+ "test:watch-hmr": "node --import tsx scripts/watch-hmr-regression/index.ts"
218
218
  }
219
219
  }