weapp-tailwindcss 4.7.6 → 4.7.8

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 (48) hide show
  1. package/dist/{chunk-G4SYITSG.mjs → chunk-6HQQYIBT.mjs} +2 -4
  2. package/dist/{chunk-36GNZBVS.js → chunk-6J63FRIY.js} +359 -155
  3. package/dist/{chunk-MEX4EXZX.mjs → chunk-6NAX73ZA.mjs} +2 -2
  4. package/dist/{chunk-EGX7MMTE.mjs → chunk-DMJK47DW.mjs} +1 -1
  5. package/dist/{chunk-VL24RIGE.mjs → chunk-G7MXWOBI.mjs} +332 -128
  6. package/dist/{chunk-SXYSWJRO.js → chunk-GCF5VD66.js} +11 -13
  7. package/dist/{chunk-RTOKUKLA.js → chunk-HPUZNQ4G.js} +4 -4
  8. package/dist/{chunk-6WB6H5P4.js → chunk-LJ5AQYTF.js} +6 -6
  9. package/dist/{chunk-UB5UEGVL.mjs → chunk-OQ5PKCFN.mjs} +1 -1
  10. package/dist/{chunk-XVJBQIVY.mjs → chunk-PYXTMD6B.mjs} +3 -1
  11. package/dist/{chunk-USAH2CX5.js → chunk-SMYOFNHJ.js} +3 -1
  12. package/dist/{chunk-3AAVIURI.js → chunk-UCPNYFTI.js} +2 -2
  13. package/dist/{chunk-JISOHATJ.js → chunk-ZSTADQDZ.js} +10 -10
  14. package/dist/cli.js +27 -13
  15. package/dist/cli.mjs +21 -7
  16. package/dist/core.js +10 -11
  17. package/dist/core.mjs +3 -4
  18. package/dist/css-macro/postcss.js +1 -1
  19. package/dist/css-macro/postcss.mjs +1 -1
  20. package/dist/css-macro.js +1 -1
  21. package/dist/css-macro.mjs +1 -1
  22. package/dist/defaults.js +3 -3
  23. package/dist/defaults.mjs +2 -2
  24. package/dist/escape.d.mts +4 -16
  25. package/dist/escape.d.ts +4 -16
  26. package/dist/escape.js +53 -9
  27. package/dist/escape.mjs +19 -5
  28. package/dist/gulp.js +6 -7
  29. package/dist/gulp.mjs +4 -5
  30. package/dist/index.js +8 -9
  31. package/dist/index.mjs +6 -7
  32. package/dist/postcss-html-transform.js +1 -1
  33. package/dist/postcss-html-transform.mjs +1 -1
  34. package/dist/presets.js +3 -3
  35. package/dist/presets.mjs +1 -1
  36. package/dist/types.d.mts +1 -5
  37. package/dist/types.d.ts +1 -5
  38. package/dist/types.js +1 -1
  39. package/dist/types.mjs +1 -1
  40. package/dist/vite.js +6 -7
  41. package/dist/vite.mjs +4 -5
  42. package/dist/webpack.js +6 -7
  43. package/dist/webpack.mjs +4 -5
  44. package/dist/webpack4.js +13 -14
  45. package/dist/webpack4.mjs +3 -4
  46. package/package.json +7 -5
  47. package/dist/chunk-DWAEHRHN.js +0 -21
  48. package/dist/chunk-VSRDBMDB.mjs +0 -21
@@ -16,10 +16,8 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
16
16
 
17
17
 
18
18
 
19
- var _chunk36GNZBVSjs = require('./chunk-36GNZBVS.js');
20
19
 
21
-
22
- var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
20
+ var _chunk6J63FRIYjs = require('./chunk-6J63FRIY.js');
23
21
 
24
22
 
25
23
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
@@ -51,7 +49,7 @@ function updateStaticAttribute(ms, prop) {
51
49
  const start = prop.value.loc.start.offset + 1;
52
50
  const end = prop.value.loc.end.offset - 1;
53
51
  if (start < end) {
54
- ms.update(start, end, _chunkDWAEHRHNjs.replaceWxml.call(void 0, prop.value.content));
52
+ ms.update(start, end, _chunk6J63FRIYjs.replaceWxml.call(void 0, prop.value.content));
55
53
  }
56
54
  }
57
55
  function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
@@ -63,7 +61,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
63
61
  if (start >= end) {
64
62
  return;
65
63
  }
66
- const generated = _chunk36GNZBVSjs.generateCode.call(void 0, prop.exp.content, {
64
+ const generated = _chunk6J63FRIYjs.generateCode.call(void 0, prop.exp.content, {
67
65
  jsHandler,
68
66
  runtimeSet,
69
67
  wrapExpression: true
@@ -92,7 +90,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
92
90
  return;
93
91
  }
94
92
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
95
- const matchCustomAttribute = _chunk36GNZBVSjs.createAttributeMatcher.call(void 0, customAttributesEntities);
93
+ const matchCustomAttribute = _chunk6J63FRIYjs.createAttributeMatcher.call(void 0, customAttributesEntities);
96
94
  const ms = new (0, _magicstring2.default)(code);
97
95
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
98
96
  if (errors.length === 0) {
@@ -215,7 +213,7 @@ async function formatPostcssSourceMap(rawMap, file) {
215
213
  }
216
214
 
217
215
  // src/bundlers/vite/index.ts
218
- var debug = _chunk36GNZBVSjs.createDebug.call(void 0, );
216
+ var debug = _chunk6J63FRIYjs.createDebug.call(void 0, );
219
217
  function readOutputEntry(entry) {
220
218
  if (entry.output.type === "chunk") {
221
219
  return entry.output.code;
@@ -282,7 +280,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
282
280
  }
283
281
  }
284
282
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
285
- const opts = _chunk36GNZBVSjs.getCompilerContext.call(void 0, options);
283
+ const opts = _chunk6J63FRIYjs.getCompilerContext.call(void 0, options);
286
284
  const {
287
285
  disabled,
288
286
  customAttributes,
@@ -304,17 +302,17 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
304
302
  if (disabled) {
305
303
  return;
306
304
  }
307
- const customAttributesEntities = _chunk36GNZBVSjs.toCustomAttributesEntities.call(void 0, customAttributes);
305
+ const customAttributesEntities = _chunk6J63FRIYjs.toCustomAttributesEntities.call(void 0, customAttributes);
308
306
  const runtimeState = {
309
307
  twPatcher: initialTwPatcher,
310
- patchPromise: _chunk36GNZBVSjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
308
+ patchPromise: _chunk6J63FRIYjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
311
309
  refreshTailwindcssPatcher
312
310
  };
313
311
  let runtimeSet;
314
312
  let runtimeSetPromise;
315
313
  let resolvedConfig;
316
314
  async function refreshRuntimeState(force) {
317
- const refreshed = await _chunk36GNZBVSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
315
+ const refreshed = await _chunk6J63FRIYjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
318
316
  if (refreshed) {
319
317
  runtimeSet = void 0;
320
318
  runtimeSetPromise = void 0;
@@ -327,7 +325,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
327
325
  return runtimeSet;
328
326
  }
329
327
  if (force || !runtimeSetPromise) {
330
- const task2 = _chunk36GNZBVSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
328
+ const task2 = _chunk6J63FRIYjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
331
329
  force: force || !runtimeSet,
332
330
  skipRefresh: force
333
331
  });
@@ -346,7 +344,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
346
344
  onLoad();
347
345
  const plugins = [
348
346
  {
349
- name: `${_chunk36GNZBVSjs.vitePluginName}:post`,
347
+ name: `${_chunk6J63FRIYjs.vitePluginName}:post`,
350
348
  enforce: "post",
351
349
  configResolved(config) {
352
350
  resolvedConfig = config;
@@ -3,7 +3,7 @@
3
3
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
4
4
 
5
5
 
6
- var _chunk3AAVIURIjs = require('./chunk-3AAVIURI.js');
6
+ var _chunkUCPNYFTIjs = require('./chunk-UCPNYFTI.js');
7
7
 
8
8
  // src/context/tailwindcss.ts
9
9
  var _module = require('module');
@@ -46,7 +46,7 @@ function resolveModuleFromPaths(specifier, paths) {
46
46
  return void 0;
47
47
  }
48
48
  try {
49
- const req = _module.createRequire.call(void 0, _chunk3AAVIURIjs.importMetaUrl);
49
+ const req = _module.createRequire.call(void 0, _chunkUCPNYFTIjs.importMetaUrl);
50
50
  return req.resolve(specifier, { paths });
51
51
  } catch (e) {
52
52
  return void 0;
@@ -163,11 +163,11 @@ function createDefaultResolvePaths(basedir) {
163
163
  const cwd = _process2.default.cwd();
164
164
  appendNodeModules(paths, cwd);
165
165
  try {
166
- const modulePath = _url.fileURLToPath.call(void 0, _chunk3AAVIURIjs.importMetaUrl);
166
+ const modulePath = _url.fileURLToPath.call(void 0, _chunkUCPNYFTIjs.importMetaUrl);
167
167
  const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
168
168
  paths.add(candidate);
169
169
  } catch (e2) {
170
- paths.add(_chunk3AAVIURIjs.importMetaUrl);
170
+ paths.add(_chunkUCPNYFTIjs.importMetaUrl);
171
171
  }
172
172
  if (paths.size === 0) {
173
173
  fallbackCandidates = fallbackCandidates.filter(Boolean);
@@ -7,7 +7,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
7
7
 
8
8
 
9
9
 
10
- var _chunk36GNZBVSjs = require('./chunk-36GNZBVS.js');
10
+ var _chunk6J63FRIYjs = require('./chunk-6J63FRIY.js');
11
11
 
12
12
  // src/bundlers/gulp/index.ts
13
13
  var _buffer = require('buffer');
@@ -15,21 +15,21 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
15
15
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
16
16
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
17
17
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
18
- var debug = _chunk36GNZBVSjs.createDebug.call(void 0, );
18
+ var debug = _chunk6J63FRIYjs.createDebug.call(void 0, );
19
19
  var Transform = _stream2.default.Transform;
20
20
  function createPlugins(options = {}) {
21
- const opts = _chunk36GNZBVSjs.getCompilerContext.call(void 0, options);
21
+ const opts = _chunk6J63FRIYjs.getCompilerContext.call(void 0, options);
22
22
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
23
23
  let runtimeSet = /* @__PURE__ */ new Set();
24
24
  const runtimeState = {
25
25
  twPatcher: initialTwPatcher,
26
- patchPromise: _chunk36GNZBVSjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
26
+ patchPromise: _chunk6J63FRIYjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
27
27
  refreshTailwindcssPatcher
28
28
  };
29
29
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
30
30
  let runtimeSetInitialized = false;
31
31
  async function refreshRuntimeState(force) {
32
- await _chunk36GNZBVSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
32
+ await _chunk6J63FRIYjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
33
33
  }
34
34
  async function refreshRuntimeSet(force = false) {
35
35
  await refreshRuntimeState(force);
@@ -37,7 +37,7 @@ function createPlugins(options = {}) {
37
37
  if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
38
38
  return runtimeSet;
39
39
  }
40
- runtimeSet = await _chunk36GNZBVSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
40
+ runtimeSet = await _chunk6J63FRIYjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
41
41
  runtimeSetInitialized = true;
42
42
  return runtimeSet;
43
43
  }
@@ -7,7 +7,7 @@ import {
7
7
  createTailwindPatchPromise,
8
8
  getCompilerContext,
9
9
  refreshTailwindRuntimeState
10
- } from "./chunk-VL24RIGE.mjs";
10
+ } from "./chunk-G7MXWOBI.mjs";
11
11
 
12
12
  // src/bundlers/gulp/index.ts
13
13
  import { Buffer } from "buffer";
@@ -93,7 +93,9 @@ function getDefaultOptions() {
93
93
  },
94
94
  babelParserOptions: {
95
95
  sourceType: "unambiguous",
96
- cache: true
96
+ cache: true,
97
+ // 预计算好的 cacheKey,避免重复对选项进行 JSON.stringify
98
+ cacheKey: "st:unambiguous"
97
99
  },
98
100
  postcssOptions: {},
99
101
  // 开发版本微信小程序工具和小米13手机上 @property 是有效果的
@@ -93,7 +93,9 @@ function getDefaultOptions() {
93
93
  },
94
94
  babelParserOptions: {
95
95
  sourceType: "unambiguous",
96
- cache: true
96
+ cache: true,
97
+ // 预计算好的 cacheKey,避免重复对选项进行 JSON.stringify
98
+ cacheKey: "st:unambiguous"
97
99
  },
98
100
  postcssOptions: {},
99
101
  // 开发版本微信小程序工具和小米13手机上 @property 是有效果的
@@ -5,8 +5,8 @@
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
- // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.10.0__@swc+core@1.15.0_@swc+h_70727109299a4b8f070696769bd0e0a9/node_modules/tsup/assets/cjs_shims.js
9
- var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
8
+ // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.1_@swc+h_d92aa008e7d0cb6e2dab5bcd2ea8592f/node_modules/tsup/assets/cjs_shims.js
9
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
10
10
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
11
11
 
12
12
 
@@ -16,7 +16,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
16
16
 
17
17
 
18
18
 
19
- var _chunk36GNZBVSjs = require('./chunk-36GNZBVS.js');
19
+ var _chunk6J63FRIYjs = require('./chunk-6J63FRIY.js');
20
20
 
21
21
 
22
22
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
@@ -25,10 +25,10 @@ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
25
25
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
26
26
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
27
27
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
28
- var debug = _chunk36GNZBVSjs.createDebug.call(void 0, );
28
+ var debug = _chunk6J63FRIYjs.createDebug.call(void 0, );
29
29
  var UnifiedWebpackPluginV5 = class {
30
30
  constructor(options = {}) {
31
- this.options = _chunk36GNZBVSjs.getCompilerContext.call(void 0, options);
31
+ this.options = _chunk6J63FRIYjs.getCompilerContext.call(void 0, options);
32
32
  this.appType = this.options.appType;
33
33
  }
34
34
  apply(compiler) {
@@ -52,18 +52,18 @@ var UnifiedWebpackPluginV5 = class {
52
52
  }
53
53
  const runtimeState = {
54
54
  twPatcher: initialTwPatcher,
55
- patchPromise: _chunk36GNZBVSjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
55
+ patchPromise: _chunk6J63FRIYjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
56
56
  refreshTailwindcssPatcher
57
57
  };
58
58
  const refreshRuntimeState = async (force) => {
59
- await _chunk36GNZBVSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
59
+ await _chunk6J63FRIYjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
60
60
  };
61
61
  const { Compilation, sources, NormalModule } = compiler.webpack;
62
62
  const { ConcatSource } = sources;
63
63
  async function getClassSetInLoader() {
64
64
  await refreshRuntimeState(true);
65
65
  await runtimeState.patchPromise;
66
- await _chunk36GNZBVSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
66
+ await _chunk6J63FRIYjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
67
67
  }
68
68
  onLoad();
69
69
  const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
@@ -76,8 +76,8 @@ var UnifiedWebpackPluginV5 = class {
76
76
  ident: null,
77
77
  type: null
78
78
  };
79
- compiler.hooks.compilation.tap(_chunk36GNZBVSjs.pluginName, (compilation) => {
80
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunk36GNZBVSjs.pluginName, (_loaderContext, module) => {
79
+ compiler.hooks.compilation.tap(_chunk6J63FRIYjs.pluginName, (compilation) => {
80
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunk6J63FRIYjs.pluginName, (_loaderContext, module) => {
81
81
  if (isExisted) {
82
82
  const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
83
83
  if (idx > -1) {
@@ -87,7 +87,7 @@ var UnifiedWebpackPluginV5 = class {
87
87
  });
88
88
  compilation.hooks.processAssets.tapPromise(
89
89
  {
90
- name: _chunk36GNZBVSjs.pluginName,
90
+ name: _chunk6J63FRIYjs.pluginName,
91
91
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
92
92
  },
93
93
  async (assets) => {
@@ -156,7 +156,7 @@ var UnifiedWebpackPluginV5 = class {
156
156
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
157
157
  await refreshRuntimeState(true);
158
158
  await runtimeState.patchPromise;
159
- const runtimeSet = await _chunk36GNZBVSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
159
+ const runtimeSet = await _chunk6J63FRIYjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
160
160
  debug("get runtimeSet, class count: %d", runtimeSet.size);
161
161
  const tasks = [];
162
162
  if (Array.isArray(groupedEntries.html)) {
package/dist/cli.js CHANGED
@@ -4,17 +4,19 @@ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
4
4
 
5
5
 
6
6
 
7
- var _chunk36GNZBVSjs = require('./chunk-36GNZBVS.js');
8
- require('./chunk-DWAEHRHN.js');
9
- require('./chunk-RTOKUKLA.js');
10
- require('./chunk-USAH2CX5.js');
7
+
8
+
9
+
10
+ var _chunk6J63FRIYjs = require('./chunk-6J63FRIY.js');
11
+ require('./chunk-HPUZNQ4G.js');
12
+ require('./chunk-SMYOFNHJ.js');
11
13
 
12
14
 
13
15
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
14
16
 
15
17
 
16
18
 
17
- var _chunk3AAVIURIjs = require('./chunk-3AAVIURI.js');
19
+ var _chunkUCPNYFTIjs = require('./chunk-UCPNYFTI.js');
18
20
 
19
21
  // src/cli.ts
20
22
  var _promises = require('fs/promises');
@@ -32,12 +34,12 @@ function getNodeRequire() {
32
34
  if (cachedRequire) {
33
35
  return cachedRequire;
34
36
  }
35
- if (typeof _chunk3AAVIURIjs.__require === "function") {
36
- cachedRequire = _chunk3AAVIURIjs.__require;
37
+ if (typeof _chunkUCPNYFTIjs.__require === "function") {
38
+ cachedRequire = _chunkUCPNYFTIjs.__require;
37
39
  return cachedRequire;
38
40
  }
39
41
  try {
40
- cachedRequire = _module.createRequire.call(void 0, _chunk3AAVIURIjs.importMetaUrl);
42
+ cachedRequire = _module.createRequire.call(void 0, _chunkUCPNYFTIjs.importMetaUrl);
41
43
  } catch (e) {
42
44
  cachedRequire = void 0;
43
45
  }
@@ -122,7 +124,7 @@ function createCliContext(overrides, resolvedCwd) {
122
124
  current
123
125
  );
124
126
  }
125
- return _chunk36GNZBVSjs.getCompilerContext.call(void 0, userOptions);
127
+ return _chunk6J63FRIYjs.getCompilerContext.call(void 0, userOptions);
126
128
  }
127
129
  function formatOutputPath(target, baseDir) {
128
130
  const root = _nullishCoalesce(baseDir, () => ( _process2.default.cwd()));
@@ -287,18 +289,30 @@ function logTokenPreview(report, format, groupKey) {
287
289
 
288
290
  // src/cli.ts
289
291
  _process2.default.title = "node (weapp-tailwindcss)";
290
- if (_semver2.default.lt(_process2.default.versions.node, _chunk36GNZBVSjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
292
+ if (_semver2.default.lt(_process2.default.versions.node, _chunk6J63FRIYjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
291
293
  _chunkOXASK55Qjs.logger.warn(
292
- `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunk36GNZBVSjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
294
+ `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunk6J63FRIYjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
293
295
  );
294
296
  }
295
297
  var cli = _cac2.default.call(void 0, "weapp-tailwindcss");
296
- cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").action(
298
+ cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").option("--record-target", "Write tailwindcss target metadata (.tw-patch/tailwindcss-target.json)").option("--clear-cache", "Clear tailwindcss-patch cache before patch (opt-in)").action(
297
299
  commandAction(async (options) => {
298
300
  const resolvedCwd = resolveCliCwd(options.cwd);
299
301
  const ctx = createCliContext(void 0, resolvedCwd);
302
+ const shouldClearCache = toBoolean(options.clearCache, false);
303
+ if (shouldClearCache) {
304
+ await _chunk6J63FRIYjs.clearTailwindcssPatcherCache.call(void 0, ctx.twPatcher, { removeDirectory: true });
305
+ }
306
+ _chunk6J63FRIYjs.logTailwindcssTarget.call(void 0, "cli", ctx.twPatcher, ctx.tailwindcssBasedir);
300
307
  await ctx.twPatcher.patch();
301
- _chunkOXASK55Qjs.logger.success("Tailwind CSS runtime patched successfully.");
308
+ const shouldRecordTarget = toBoolean(options.recordTarget, false);
309
+ if (shouldRecordTarget) {
310
+ const recordPath = await _chunk6J63FRIYjs.saveCliPatchTargetRecord.call(void 0, ctx.tailwindcssBasedir, ctx.twPatcher);
311
+ if (recordPath) {
312
+ _chunkOXASK55Qjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, resolvedCwd)}`);
313
+ }
314
+ }
315
+ _chunkOXASK55Qjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
302
316
  })
303
317
  );
304
318
  cli.command("extract", "Collect generated class names into a cache file").option("--cwd <dir>", "Working directory").option("--output <file>", "Override output file path").option("--format <format>", "Output format (json|lines)").option("--css <file>", "Tailwind CSS entry CSS when using v4").option("--no-write", "Skip writing to disk").action(
package/dist/cli.mjs CHANGED
@@ -3,17 +3,19 @@ import {
3
3
  } from "./chunk-PMF2CCKK.mjs";
4
4
  import {
5
5
  WEAPP_TW_REQUIRED_NODE_VERSION,
6
- getCompilerContext
7
- } from "./chunk-VL24RIGE.mjs";
8
- import "./chunk-VSRDBMDB.mjs";
6
+ clearTailwindcssPatcherCache,
7
+ getCompilerContext,
8
+ logTailwindcssTarget,
9
+ saveCliPatchTargetRecord
10
+ } from "./chunk-G7MXWOBI.mjs";
9
11
  import "./chunk-SHMBWMDV.mjs";
10
- import "./chunk-XVJBQIVY.mjs";
12
+ import "./chunk-PYXTMD6B.mjs";
11
13
  import {
12
14
  defuOverrideArray
13
15
  } from "./chunk-ZNKIYZRQ.mjs";
14
16
  import {
15
17
  __require
16
- } from "./chunk-EGX7MMTE.mjs";
18
+ } from "./chunk-DMJK47DW.mjs";
17
19
 
18
20
  // src/cli.ts
19
21
  import { writeFile } from "fs/promises";
@@ -292,12 +294,24 @@ if (semver.lt(process3.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
292
294
  );
293
295
  }
294
296
  var cli = cac("weapp-tailwindcss");
295
- cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").action(
297
+ cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").option("--cwd <dir>", "Working directory").option("--record-target", "Write tailwindcss target metadata (.tw-patch/tailwindcss-target.json)").option("--clear-cache", "Clear tailwindcss-patch cache before patch (opt-in)").action(
296
298
  commandAction(async (options) => {
297
299
  const resolvedCwd = resolveCliCwd(options.cwd);
298
300
  const ctx = createCliContext(void 0, resolvedCwd);
301
+ const shouldClearCache = toBoolean(options.clearCache, false);
302
+ if (shouldClearCache) {
303
+ await clearTailwindcssPatcherCache(ctx.twPatcher, { removeDirectory: true });
304
+ }
305
+ logTailwindcssTarget("cli", ctx.twPatcher, ctx.tailwindcssBasedir);
299
306
  await ctx.twPatcher.patch();
300
- logger.success("Tailwind CSS runtime patched successfully.");
307
+ const shouldRecordTarget = toBoolean(options.recordTarget, false);
308
+ if (shouldRecordTarget) {
309
+ const recordPath = await saveCliPatchTargetRecord(ctx.tailwindcssBasedir, ctx.twPatcher);
310
+ if (recordPath) {
311
+ logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, resolvedCwd)}`);
312
+ }
313
+ }
314
+ logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
301
315
  })
302
316
  );
303
317
  cli.command("extract", "Collect generated class names into a cache file").option("--cwd <dir>", "Working directory").option("--output <file>", "Override output file path").option("--format <format>", "Output format (json|lines)").option("--css <file>", "Tailwind CSS entry CSS when using v4").option("--no-write", "Skip writing to disk").action(
package/dist/core.js CHANGED
@@ -3,26 +3,25 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk36GNZBVSjs = require('./chunk-36GNZBVS.js');
7
- require('./chunk-DWAEHRHN.js');
8
- require('./chunk-RTOKUKLA.js');
9
- require('./chunk-USAH2CX5.js');
6
+ var _chunk6J63FRIYjs = require('./chunk-6J63FRIY.js');
7
+ require('./chunk-HPUZNQ4G.js');
8
+ require('./chunk-SMYOFNHJ.js');
10
9
  require('./chunk-UW3WHSZ5.js');
11
- require('./chunk-3AAVIURI.js');
10
+ require('./chunk-UCPNYFTI.js');
12
11
 
13
12
  // src/core.ts
14
13
  var _shared = require('@weapp-tailwindcss/shared');
15
14
  function createContext(options = {}) {
16
- const opts = _chunk36GNZBVSjs.getCompilerContext.call(void 0, options);
15
+ const opts = _chunk6J63FRIYjs.getCompilerContext.call(void 0, options);
17
16
  const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
18
17
  let runtimeSet = /* @__PURE__ */ new Set();
19
18
  const runtimeState = {
20
19
  twPatcher: initialTwPatcher,
21
- patchPromise: _chunk36GNZBVSjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
20
+ patchPromise: _chunk6J63FRIYjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
22
21
  refreshTailwindcssPatcher
23
22
  };
24
23
  async function refreshRuntimeState(force) {
25
- await _chunk36GNZBVSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
24
+ await _chunk6J63FRIYjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
26
25
  }
27
26
  async function transformWxss(rawCss, options2) {
28
27
  await runtimeState.patchPromise;
@@ -31,7 +30,7 @@ function createContext(options = {}) {
31
30
  }));
32
31
  await refreshRuntimeState(true);
33
32
  await runtimeState.patchPromise;
34
- runtimeSet = await _chunk36GNZBVSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
33
+ runtimeSet = await _chunk6J63FRIYjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
35
34
  return result;
36
35
  }
37
36
  async function transformJs(rawJs, options2 = {}) {
@@ -41,7 +40,7 @@ function createContext(options = {}) {
41
40
  } else {
42
41
  await refreshRuntimeState(true);
43
42
  await runtimeState.patchPromise;
44
- runtimeSet = await _chunk36GNZBVSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
43
+ runtimeSet = await _chunk6J63FRIYjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
45
44
  }
46
45
  return await jsHandler(rawJs, runtimeSet, options2);
47
46
  }
@@ -50,7 +49,7 @@ function createContext(options = {}) {
50
49
  if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
51
50
  await refreshRuntimeState(true);
52
51
  await runtimeState.patchPromise;
53
- runtimeSet = await _chunk36GNZBVSjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
52
+ runtimeSet = await _chunk6J63FRIYjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
54
53
  }
55
54
  return templateHandler(rawWxml, _shared.defuOverrideArray.call(void 0, options2, {
56
55
  runtimeSet
package/dist/core.mjs CHANGED
@@ -3,12 +3,11 @@ import {
3
3
  createTailwindPatchPromise,
4
4
  getCompilerContext,
5
5
  refreshTailwindRuntimeState
6
- } from "./chunk-VL24RIGE.mjs";
7
- import "./chunk-VSRDBMDB.mjs";
6
+ } from "./chunk-G7MXWOBI.mjs";
8
7
  import "./chunk-SHMBWMDV.mjs";
9
- import "./chunk-XVJBQIVY.mjs";
8
+ import "./chunk-PYXTMD6B.mjs";
10
9
  import "./chunk-ZNKIYZRQ.mjs";
11
- import "./chunk-EGX7MMTE.mjs";
10
+ import "./chunk-DMJK47DW.mjs";
12
11
 
13
12
  // src/core.ts
14
13
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  var _chunkNS3NEDWDjs = require('../chunk-NS3NEDWD.js');
6
- require('../chunk-3AAVIURI.js');
6
+ require('../chunk-UCPNYFTI.js');
7
7
 
8
8
  // src/css-macro/postcss.ts
9
9
  var creator = () => {
@@ -3,7 +3,7 @@ import {
3
3
  ifndef,
4
4
  matchCustomPropertyFromValue
5
5
  } from "../chunk-RGXLY3HG.mjs";
6
- import "../chunk-EGX7MMTE.mjs";
6
+ import "../chunk-DMJK47DW.mjs";
7
7
 
8
8
  // src/css-macro/postcss.ts
9
9
  var creator = () => {
package/dist/css-macro.js CHANGED
@@ -5,7 +5,7 @@ var _chunkNS3NEDWDjs = require('./chunk-NS3NEDWD.js');
5
5
 
6
6
 
7
7
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
8
- require('./chunk-3AAVIURI.js');
8
+ require('./chunk-UCPNYFTI.js');
9
9
 
10
10
  // src/css-macro/index.ts
11
11
  var _plugin = require('tailwindcss/plugin'); var _plugin2 = _interopRequireDefault(_plugin);
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  defu
7
7
  } from "./chunk-ZNKIYZRQ.mjs";
8
- import "./chunk-EGX7MMTE.mjs";
8
+ import "./chunk-DMJK47DW.mjs";
9
9
 
10
10
  // src/css-macro/index.ts
11
11
  import plugin from "tailwindcss/plugin";
package/dist/defaults.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkUSAH2CX5js = require('./chunk-USAH2CX5.js');
3
+ var _chunkSMYOFNHJjs = require('./chunk-SMYOFNHJ.js');
4
4
  require('./chunk-UW3WHSZ5.js');
5
- require('./chunk-3AAVIURI.js');
5
+ require('./chunk-UCPNYFTI.js');
6
6
 
7
7
 
8
- exports.getDefaultOptions = _chunkUSAH2CX5js.getDefaultOptions;
8
+ exports.getDefaultOptions = _chunkSMYOFNHJjs.getDefaultOptions;
package/dist/defaults.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getDefaultOptions
3
- } from "./chunk-XVJBQIVY.mjs";
3
+ } from "./chunk-PYXTMD6B.mjs";
4
4
  import "./chunk-ZNKIYZRQ.mjs";
5
- import "./chunk-EGX7MMTE.mjs";
5
+ import "./chunk-DMJK47DW.mjs";
6
6
  export {
7
7
  getDefaultOptions
8
8
  };
package/dist/escape.d.mts CHANGED
@@ -1,18 +1,6 @@
1
- import { ITemplateHandlerOptions } from './types.mjs';
2
- export { isAllowedClassName } from '@weapp-core/escape';
3
- import '@babel/parser';
4
- import '@weapp-tailwindcss/postcss';
5
- import 'magic-string';
6
- import 'postcss';
7
- import 'tailwindcss-patch';
8
- import 'node:buffer';
9
- import 'webpack';
10
- import 'lru-cache';
1
+ import type { ITemplateHandlerOptions } from './types.mjs';
11
2
 
12
- declare function replaceWxml(original: string, options?: ITemplateHandlerOptions): string;
3
+ export declare const weappTwIgnore: typeof String.raw;
4
+ export declare function escape(original: string, options?: ITemplateHandlerOptions): string;
13
5
 
14
- declare const weappTwIgnore: (template: {
15
- raw: readonly string[] | ArrayLike<string>;
16
- }, ...substitutions: any[]) => string;
17
-
18
- export { replaceWxml as escape, weappTwIgnore };
6
+ export { isAllowedClassName, unescape } from '@weapp-core/escape';
package/dist/escape.d.ts CHANGED
@@ -1,18 +1,6 @@
1
- import { ITemplateHandlerOptions } from './types.js';
2
- export { isAllowedClassName } from '@weapp-core/escape';
3
- import '@babel/parser';
4
- import '@weapp-tailwindcss/postcss';
5
- import 'magic-string';
6
- import 'postcss';
7
- import 'tailwindcss-patch';
8
- import 'node:buffer';
9
- import 'webpack';
10
- import 'lru-cache';
1
+ import type { ITemplateHandlerOptions } from './types.js';
11
2
 
12
- declare function replaceWxml(original: string, options?: ITemplateHandlerOptions): string;
3
+ export declare const weappTwIgnore: typeof String.raw;
4
+ export declare function escape(original: string, options?: ITemplateHandlerOptions): string;
13
5
 
14
- declare const weappTwIgnore: (template: {
15
- raw: readonly string[] | ArrayLike<string>;
16
- }, ...substitutions: any[]) => string;
17
-
18
- export { replaceWxml as escape, weappTwIgnore };
6
+ export { isAllowedClassName, unescape } from '@weapp-core/escape';