weapp-tailwindcss 4.7.6 → 4.7.7

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 (44) hide show
  1. package/dist/{chunk-36GNZBVS.js → chunk-2WZP7EXP.js} +269 -130
  2. package/dist/{chunk-G4SYITSG.mjs → chunk-APVOYXRF.mjs} +2 -4
  3. package/dist/{chunk-MEX4EXZX.mjs → chunk-FZNEB7RC.mjs} +2 -2
  4. package/dist/{chunk-VL24RIGE.mjs → chunk-KGKHHXRC.mjs} +243 -104
  5. package/dist/{chunk-SXYSWJRO.js → chunk-MGHX7SCL.js} +11 -13
  6. package/dist/{chunk-3AAVIURI.js → chunk-MMBZHHNL.js} +1 -1
  7. package/dist/{chunk-EGX7MMTE.mjs → chunk-MNKR7BNZ.mjs} +1 -1
  8. package/dist/{chunk-6WB6H5P4.js → chunk-PP6KHC2I.js} +6 -6
  9. package/dist/{chunk-RTOKUKLA.js → chunk-VLM4KUZA.js} +4 -4
  10. package/dist/{chunk-UB5UEGVL.mjs → chunk-VPQLMV42.mjs} +1 -1
  11. package/dist/{chunk-JISOHATJ.js → chunk-X5SXNF7I.js} +10 -10
  12. package/dist/cli.js +23 -12
  13. package/dist/cli.mjs +17 -6
  14. package/dist/core.js +9 -10
  15. package/dist/core.mjs +2 -3
  16. package/dist/css-macro/postcss.js +1 -1
  17. package/dist/css-macro/postcss.mjs +1 -1
  18. package/dist/css-macro.js +1 -1
  19. package/dist/css-macro.mjs +1 -1
  20. package/dist/defaults.js +1 -1
  21. package/dist/defaults.mjs +1 -1
  22. package/dist/escape.d.mts +4 -16
  23. package/dist/escape.d.ts +4 -16
  24. package/dist/escape.js +53 -9
  25. package/dist/escape.mjs +19 -5
  26. package/dist/gulp.js +5 -6
  27. package/dist/gulp.mjs +3 -4
  28. package/dist/index.js +7 -8
  29. package/dist/index.mjs +5 -6
  30. package/dist/postcss-html-transform.js +1 -1
  31. package/dist/postcss-html-transform.mjs +1 -1
  32. package/dist/presets.js +3 -3
  33. package/dist/presets.mjs +1 -1
  34. package/dist/types.js +1 -1
  35. package/dist/types.mjs +1 -1
  36. package/dist/vite.js +5 -6
  37. package/dist/vite.mjs +3 -4
  38. package/dist/webpack.js +5 -6
  39. package/dist/webpack.mjs +3 -4
  40. package/dist/webpack4.js +12 -13
  41. package/dist/webpack4.mjs +2 -3
  42. package/package.json +5 -5
  43. package/dist/chunk-DWAEHRHN.js +0 -21
  44. 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 _chunk2WZP7EXPjs = require('./chunk-2WZP7EXP.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, _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.toCustomAttributesEntities.call(void 0, customAttributes);
308
306
  const runtimeState = {
309
307
  twPatcher: initialTwPatcher,
310
- patchPromise: _chunk36GNZBVSjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
308
+ patchPromise: _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.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: `${_chunk2WZP7EXPjs.vitePluginName}:post`,
350
348
  enforce: "post",
351
349
  configResolved(config) {
352
350
  resolvedConfig = config;
@@ -5,7 +5,7 @@
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
8
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.10.0__@swc+core@1.15.1_@swc+h_3fe5c4e8fa32c241b2852efe4eb59e56/node_modules/tsup/assets/cjs_shims.js
9
9
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
10
10
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
11
11
 
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
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/esm_shims.js
8
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.10.0__@swc+core@1.15.1_@swc+h_3fe5c4e8fa32c241b2852efe4eb59e56/node_modules/tsup/assets/esm_shims.js
9
9
  import path from "path";
10
10
  import { fileURLToPath } from "url";
11
11
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -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 _chunk2WZP7EXPjs = require('./chunk-2WZP7EXP.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 = _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.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: _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
41
41
  runtimeSetInitialized = true;
42
42
  return runtimeSet;
43
43
  }
@@ -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 _chunkMMBZHHNLjs = require('./chunk-MMBZHHNL.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, _chunkMMBZHHNLjs.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, _chunkMMBZHHNLjs.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(_chunkMMBZHHNLjs.importMetaUrl);
171
171
  }
172
172
  if (paths.size === 0) {
173
173
  fallbackCandidates = fallbackCandidates.filter(Boolean);
@@ -7,7 +7,7 @@ import {
7
7
  createTailwindPatchPromise,
8
8
  getCompilerContext,
9
9
  refreshTailwindRuntimeState
10
- } from "./chunk-VL24RIGE.mjs";
10
+ } from "./chunk-KGKHHXRC.mjs";
11
11
 
12
12
  // src/bundlers/gulp/index.ts
13
13
  import { Buffer } from "buffer";
@@ -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 _chunk2WZP7EXPjs = require('./chunk-2WZP7EXP.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 = _chunk2WZP7EXPjs.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 = _chunk2WZP7EXPjs.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: _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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(_chunk2WZP7EXPjs.pluginName, (compilation) => {
80
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunk2WZP7EXPjs.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: _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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,9 +4,11 @@ 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');
7
+
8
+
9
+
10
+ var _chunk2WZP7EXPjs = require('./chunk-2WZP7EXP.js');
11
+ require('./chunk-VLM4KUZA.js');
10
12
  require('./chunk-USAH2CX5.js');
11
13
 
12
14
 
@@ -14,7 +16,7 @@ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
14
16
 
15
17
 
16
18
 
17
- var _chunk3AAVIURIjs = require('./chunk-3AAVIURI.js');
19
+ var _chunkMMBZHHNLjs = require('./chunk-MMBZHHNL.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 _chunkMMBZHHNLjs.__require === "function") {
38
+ cachedRequire = _chunkMMBZHHNLjs.__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, _chunkMMBZHHNLjs.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 _chunk2WZP7EXPjs.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,27 @@ 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, _chunk2WZP7EXPjs.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${_chunk2WZP7EXPjs.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)").action(
297
299
  commandAction(async (options) => {
298
300
  const resolvedCwd = resolveCliCwd(options.cwd);
299
301
  const ctx = createCliContext(void 0, resolvedCwd);
302
+ await _chunk2WZP7EXPjs.clearTailwindcssPatcherCache.call(void 0, ctx.twPatcher, { removeDirectory: true });
303
+ _chunk2WZP7EXPjs.logTailwindcssTarget.call(void 0, "cli", ctx.twPatcher, ctx.tailwindcssBasedir);
300
304
  await ctx.twPatcher.patch();
301
- _chunkOXASK55Qjs.logger.success("Tailwind CSS runtime patched successfully.");
305
+ const shouldRecordTarget = toBoolean(options.recordTarget, false);
306
+ if (shouldRecordTarget) {
307
+ const recordPath = await _chunk2WZP7EXPjs.saveCliPatchTargetRecord.call(void 0, ctx.tailwindcssBasedir, ctx.twPatcher);
308
+ if (recordPath) {
309
+ _chunkOXASK55Qjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, resolvedCwd)}`);
310
+ }
311
+ }
312
+ _chunkOXASK55Qjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
302
313
  })
303
314
  );
304
315
  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,9 +3,11 @@ 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-KGKHHXRC.mjs";
9
11
  import "./chunk-SHMBWMDV.mjs";
10
12
  import "./chunk-XVJBQIVY.mjs";
11
13
  import {
@@ -13,7 +15,7 @@ import {
13
15
  } from "./chunk-ZNKIYZRQ.mjs";
14
16
  import {
15
17
  __require
16
- } from "./chunk-EGX7MMTE.mjs";
18
+ } from "./chunk-MNKR7BNZ.mjs";
17
19
 
18
20
  // src/cli.ts
19
21
  import { writeFile } from "fs/promises";
@@ -292,12 +294,21 @@ 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)").action(
296
298
  commandAction(async (options) => {
297
299
  const resolvedCwd = resolveCliCwd(options.cwd);
298
300
  const ctx = createCliContext(void 0, resolvedCwd);
301
+ await clearTailwindcssPatcherCache(ctx.twPatcher, { removeDirectory: true });
302
+ logTailwindcssTarget("cli", ctx.twPatcher, ctx.tailwindcssBasedir);
299
303
  await ctx.twPatcher.patch();
300
- logger.success("Tailwind CSS runtime patched successfully.");
304
+ const shouldRecordTarget = toBoolean(options.recordTarget, false);
305
+ if (shouldRecordTarget) {
306
+ const recordPath = await saveCliPatchTargetRecord(ctx.tailwindcssBasedir, ctx.twPatcher);
307
+ if (recordPath) {
308
+ logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, resolvedCwd)}`);
309
+ }
310
+ }
311
+ logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
301
312
  })
302
313
  );
303
314
  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');
6
+ var _chunk2WZP7EXPjs = require('./chunk-2WZP7EXP.js');
7
+ require('./chunk-VLM4KUZA.js');
9
8
  require('./chunk-USAH2CX5.js');
10
9
  require('./chunk-UW3WHSZ5.js');
11
- require('./chunk-3AAVIURI.js');
10
+ require('./chunk-MMBZHHNL.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 = _chunk2WZP7EXPjs.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: _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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 _chunk2WZP7EXPjs.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-KGKHHXRC.mjs";
8
7
  import "./chunk-SHMBWMDV.mjs";
9
8
  import "./chunk-XVJBQIVY.mjs";
10
9
  import "./chunk-ZNKIYZRQ.mjs";
11
- import "./chunk-EGX7MMTE.mjs";
10
+ import "./chunk-MNKR7BNZ.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-MMBZHHNL.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-MNKR7BNZ.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-MMBZHHNL.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-MNKR7BNZ.mjs";
9
9
 
10
10
  // src/css-macro/index.ts
11
11
  import plugin from "tailwindcss/plugin";
package/dist/defaults.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _chunkUSAH2CX5js = require('./chunk-USAH2CX5.js');
4
4
  require('./chunk-UW3WHSZ5.js');
5
- require('./chunk-3AAVIURI.js');
5
+ require('./chunk-MMBZHHNL.js');
6
6
 
7
7
 
8
8
  exports.getDefaultOptions = _chunkUSAH2CX5js.getDefaultOptions;
package/dist/defaults.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  getDefaultOptions
3
3
  } from "./chunk-XVJBQIVY.mjs";
4
4
  import "./chunk-ZNKIYZRQ.mjs";
5
- import "./chunk-EGX7MMTE.mjs";
5
+ import "./chunk-MNKR7BNZ.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';
package/dist/escape.js CHANGED
@@ -1,13 +1,57 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
4
- require('./chunk-3AAVIURI.js');
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
5
19
 
6
20
  // src/escape.ts
7
- var _escape = require('@weapp-core/escape');
8
- var weappTwIgnore = String.raw;
9
-
21
+ var escape_exports = {};
22
+ __export(escape_exports, {
23
+ escape: () => replaceWxml,
24
+ isAllowedClassName: () => import_escape2.isAllowedClassName,
25
+ unescape: () => import_escape2.unescape,
26
+ weappTwIgnore: () => weappTwIgnore
27
+ });
28
+ module.exports = __toCommonJS(escape_exports);
10
29
 
30
+ // src/wxml/shared.ts
31
+ var import_escape = require("@weapp-core/escape");
32
+ function replaceWxml(original, options = {
33
+ keepEOL: false,
34
+ escapeMap: import_escape.MappingChars2String
35
+ }) {
36
+ const { keepEOL, escapeMap, ignoreHead } = options;
37
+ let res = original;
38
+ if (!keepEOL) {
39
+ res = res.replaceAll(/[\n\r]+/g, "");
40
+ }
41
+ res = (0, import_escape.escape)(res, {
42
+ map: escapeMap,
43
+ ignoreHead
44
+ });
45
+ return res;
46
+ }
11
47
 
12
-
13
- exports.escape = _chunkDWAEHRHNjs.replaceWxml; exports.isAllowedClassName = _escape.isAllowedClassName; exports.weappTwIgnore = weappTwIgnore;
48
+ // src/escape.ts
49
+ var import_escape2 = require("@weapp-core/escape");
50
+ var weappTwIgnore = String.raw;
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ escape,
54
+ isAllowedClassName,
55
+ unescape,
56
+ weappTwIgnore
57
+ });