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
@@ -1,22 +1,22 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkDEIJXHGJjs = require('./chunk-DEIJXHGJ.js');
4
+ var _chunkG5NLM3ALjs = require('./chunk-G5NLM3AL.js');
5
5
 
6
6
 
7
- var _chunkRYC23C3Kjs = require('./chunk-RYC23C3K.js');
7
+ var _chunk4LPOQMFSjs = require('./chunk-4LPOQMFS.js');
8
8
 
9
9
  // src/tailwindcss/recorder.ts
10
10
  function setupPatchRecorder(patcher, baseDir, options) {
11
- const recorder = _chunkDEIJXHGJjs.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
11
+ const recorder = _chunkG5NLM3ALjs.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
12
12
  if (_optionalChain([recorder, 'optionalAccess', _ => _.message]) && _optionalChain([options, 'optionalAccess', _2 => _2.logMessage]) !== false) {
13
13
  const prefix = _optionalChain([options, 'optionalAccess', _3 => _3.messagePrefix]) ? `${options.messagePrefix} ` : "";
14
- _chunkRYC23C3Kjs.logger.info("%s%s", prefix, recorder.message);
14
+ _chunk4LPOQMFSjs.logger.info("%s%s", prefix, recorder.message);
15
15
  }
16
16
  const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _4 => _4.onPatched]) ? async () => {
17
17
  await recorder.onPatched();
18
18
  } : void 0;
19
- const patchPromise = patcher ? _chunkDEIJXHGJjs.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
19
+ const patchPromise = patcher ? _chunkG5NLM3ALjs.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
20
20
  return {
21
21
  recorder,
22
22
  patchPromise,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.10.13__@swc+core@1.15.13_@swc_3c7849ff4c0b6c5a62dfcd4f04ae2c69/node_modules/tsup/assets/cjs_shims.js
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.12.0__@swc+core@1.15.18_@swc+_6ff00797e53d4229106048f969f94f55/node_modules/tsup/assets/cjs_shims.js
2
2
  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;
3
3
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
4
4
 
@@ -6,13 +6,16 @@ function createMediaQuery(value) {
6
6
  function createNegativeMediaQuery(value) {
7
7
  return `@media not screen and (${queryKey}:"${value}"){&}`;
8
8
  }
9
+ var UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
10
+ var WHITESPACE_RE = /\s+/g;
11
+ var LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
9
12
  function normalComment(text) {
10
13
  if (typeof text === "string") {
11
- const normalized = text.replaceAll(/(?<!\\)_/g, " ").replaceAll(/\s+/g, " ").trim();
14
+ const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
12
15
  if (normalized.includes("\\")) {
13
16
  return normalized;
14
17
  }
15
- return normalized.replaceAll(/\s*(\|\||&&)\s*/g, " $1 ").replaceAll(/\s+/g, " ").trim();
18
+ return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
16
19
  }
17
20
  return text;
18
21
  }
@@ -28,11 +31,12 @@ function ifndef(text) {
28
31
  end: `#endif`
29
32
  };
30
33
  }
34
+ var QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
31
35
  function matchCustomPropertyFromValue(str, cb) {
32
36
  let arr;
33
37
  let index = 0;
34
- const regex = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
35
- while ((arr = regex.exec(str)) !== null) {
38
+ QUERY_KEY_REGEX.lastIndex = 0;
39
+ while ((arr = QUERY_KEY_REGEX.exec(str)) !== null) {
36
40
  cb(arr, index);
37
41
  index++;
38
42
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createPatchTargetRecorder,
3
3
  createTailwindPatchPromise
4
- } from "./chunk-E7775SFS.mjs";
4
+ } from "./chunk-FZNYV7VH.mjs";
5
5
  import {
6
6
  logger
7
- } from "./chunk-QOTLDKI4.mjs";
7
+ } from "./chunk-IEZ5RBMG.mjs";
8
8
 
9
9
  // src/tailwindcss/recorder.ts
10
10
  function setupPatchRecorder(patcher, baseDir, options) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-F2CKKG6Q.mjs";
4
4
  import {
5
5
  pluginName
6
- } from "./chunk-E7775SFS.mjs";
6
+ } from "./chunk-FZNYV7VH.mjs";
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  import path2 from "path";
@@ -90,6 +90,7 @@ function setupMpxTailwindcssRedirect(pkgDir, enabled) {
90
90
  installTailwindcssCssRedirect(pkgDir);
91
91
  }
92
92
  }
93
+ var CSS_EXT_RE = /\.css$/i;
93
94
  function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
94
95
  var _a;
95
96
  if (!loader) {
@@ -110,14 +111,14 @@ function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
110
111
  moduleOptions.rules.unshift(
111
112
  createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }),
112
113
  createRule({
113
- test: /\.css$/i,
114
+ test: CSS_EXT_RE,
114
115
  resourceQuery: (query) => !isMpxStyleResourceQuery(query)
115
116
  })
116
117
  );
117
118
  }
118
119
 
119
120
  // src/bundlers/webpack/shared/css-imports.ts
120
- var CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
121
+ var CSS_EXT_RE2 = /\.(?:css|scss|sass|less|styl|pcss)$/i;
121
122
  function stripResourceQuery(file) {
122
123
  let idx = file.indexOf("?");
123
124
  if (idx === -1) {
@@ -141,7 +142,7 @@ function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
141
142
  return;
142
143
  }
143
144
  const normalizedIssuer = stripResourceQuery(issuer);
144
- if (!CSS_EXT_RE.test(normalizedIssuer)) {
145
+ if (!CSS_EXT_RE2.test(normalizedIssuer)) {
145
146
  return;
146
147
  }
147
148
  const resolved = resolveTailwindcssImport(request, pkgDir, { appType });
@@ -206,7 +207,7 @@ function toChunkFiles(files) {
206
207
  if (Array.isArray(files)) {
207
208
  return files;
208
209
  }
209
- return Array.from(files);
210
+ return [...files];
210
211
  }
211
212
  function createAssetHashByChunkMap(chunks) {
212
213
  const partsByFile = /* @__PURE__ */ new Map();
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunk6Z4GEN2Yjs = require('./chunk-6Z4GEN2Y.js');
3
+ var _chunkG3G437UEjs = require('./chunk-G3G437UE.js');
4
4
 
5
5
 
6
- var _chunkDEIJXHGJjs = require('./chunk-DEIJXHGJ.js');
6
+ var _chunkG5NLM3ALjs = require('./chunk-G5NLM3AL.js');
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -90,6 +90,7 @@ function setupMpxTailwindcssRedirect(pkgDir, enabled) {
90
90
  installTailwindcssCssRedirect(pkgDir);
91
91
  }
92
92
  }
93
+ var CSS_EXT_RE = /\.css$/i;
93
94
  function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
94
95
  var _a;
95
96
  if (!loader) {
@@ -110,14 +111,14 @@ function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
110
111
  moduleOptions.rules.unshift(
111
112
  createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }),
112
113
  createRule({
113
- test: /\.css$/i,
114
+ test: CSS_EXT_RE,
114
115
  resourceQuery: (query) => !isMpxStyleResourceQuery(query)
115
116
  })
116
117
  );
117
118
  }
118
119
 
119
120
  // src/bundlers/webpack/shared/css-imports.ts
120
- var CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
121
+ var CSS_EXT_RE2 = /\.(?:css|scss|sass|less|styl|pcss)$/i;
121
122
  function stripResourceQuery(file) {
122
123
  let idx = file.indexOf("?");
123
124
  if (idx === -1) {
@@ -141,10 +142,10 @@ function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
141
142
  return;
142
143
  }
143
144
  const normalizedIssuer = stripResourceQuery(issuer);
144
- if (!CSS_EXT_RE.test(normalizedIssuer)) {
145
+ if (!CSS_EXT_RE2.test(normalizedIssuer)) {
145
146
  return;
146
147
  }
147
- const resolved = _chunk6Z4GEN2Yjs.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
148
+ const resolved = _chunkG3G437UEjs.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
148
149
  if (!resolved) {
149
150
  return;
150
151
  }
@@ -154,8 +155,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
154
155
  if (!options.enabled) {
155
156
  return;
156
157
  }
157
- compiler.hooks.normalModuleFactory.tap(_chunkDEIJXHGJjs.pluginName, (factory) => {
158
- factory.hooks.beforeResolve.tap(_chunkDEIJXHGJjs.pluginName, (data) => {
158
+ compiler.hooks.normalModuleFactory.tap(_chunkG5NLM3ALjs.pluginName, (factory) => {
159
+ factory.hooks.beforeResolve.tap(_chunkG5NLM3ALjs.pluginName, (data) => {
159
160
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
160
161
  });
161
162
  });
@@ -206,7 +207,7 @@ function toChunkFiles(files) {
206
207
  if (Array.isArray(files)) {
207
208
  return files;
208
209
  }
209
- return Array.from(files);
210
+ return [...files];
210
211
  }
211
212
  function createAssetHashByChunkMap(chunks) {
212
213
  const partsByFile = /* @__PURE__ */ new Map();
@@ -3,13 +3,13 @@
3
3
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
4
4
 
5
5
 
6
- var _chunkGCRL3ZYPjs = require('./chunk-GCRL3ZYP.js');
6
+ var _chunkNOKJXG3Wjs = require('./chunk-NOKJXG3W.js');
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunkDEIJXHGJjs = require('./chunk-DEIJXHGJ.js');
12
+ var _chunkG5NLM3ALjs = require('./chunk-G5NLM3AL.js');
13
13
 
14
14
  // src/bundlers/gulp/index.ts
15
15
  var _buffer = require('buffer');
@@ -17,12 +17,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
17
17
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
18
18
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
19
19
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
20
- var debug = _chunkDEIJXHGJjs.createDebug.call(void 0, );
20
+ var debug = _chunkG5NLM3ALjs.createDebug.call(void 0, );
21
21
  var Transform = _stream2.default.Transform;
22
22
  function createPlugins(options = {}) {
23
- const opts = _chunkDEIJXHGJjs.getCompilerContext.call(void 0, options);
23
+ const opts = _chunkG5NLM3ALjs.getCompilerContext.call(void 0, options);
24
24
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
25
- const patchRecorderState = _chunkGCRL3ZYPjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
25
+ const patchRecorderState = _chunkNOKJXG3Wjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
26
26
  source: "runtime",
27
27
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
28
28
  });
@@ -33,16 +33,20 @@ function createPlugins(options = {}) {
33
33
  refreshTailwindcssPatcher,
34
34
  onPatchCompleted: patchRecorderState.onPatchCompleted
35
35
  };
36
+ const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
37
+ let cachedDefaultTemplateHandlerOptions;
38
+ let cachedDefaultTemplateRuntimeSet;
39
+ let cachedDefaultModuleGraphOptions;
36
40
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
37
41
  let runtimeSetInitialized = false;
38
42
  async function refreshRuntimeState(force) {
39
- await _chunkDEIJXHGJjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
43
+ await _chunkG5NLM3ALjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
40
44
  }
41
45
  async function refreshRuntimeSet(force = false) {
42
46
  if (!force && runtimeSetInitialized) {
43
47
  return runtimeSet;
44
48
  }
45
- runtimeSet = await _chunkDEIJXHGJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
49
+ runtimeSet = await _chunkG5NLM3ALjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
46
50
  forceRefresh: force,
47
51
  forceCollect: force,
48
52
  clearCache: force,
@@ -108,6 +112,15 @@ function createPlugins(options = {}) {
108
112
  }
109
113
  };
110
114
  }
115
+ function resolveModuleGraphOptions(moduleGraph) {
116
+ if (moduleGraph) {
117
+ return moduleGraph;
118
+ }
119
+ if (!cachedDefaultModuleGraphOptions) {
120
+ cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
121
+ }
122
+ return cachedDefaultModuleGraphOptions;
123
+ }
111
124
  function createVinylTransform(handler) {
112
125
  return new Transform({
113
126
  objectMode: true,
@@ -121,6 +134,40 @@ function createPlugins(options = {}) {
121
134
  }
122
135
  });
123
136
  }
137
+ function resolveWxssHandlerOptions(options2) {
138
+ const majorVersion = _nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown"));
139
+ if (!options2 || Object.keys(options2).length === 0) {
140
+ let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
141
+ if (!cached) {
142
+ cached = {
143
+ isMainChunk: true,
144
+ majorVersion: runtimeState.twPatcher.majorVersion
145
+ };
146
+ defaultStyleHandlerOptionsCache.set(majorVersion, cached);
147
+ }
148
+ return cached;
149
+ }
150
+ return {
151
+ isMainChunk: true,
152
+ majorVersion: runtimeState.twPatcher.majorVersion,
153
+ ...options2
154
+ };
155
+ }
156
+ function resolveWxmlHandlerOptions(options2) {
157
+ if (!options2 || Object.keys(options2).length === 0) {
158
+ if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
159
+ cachedDefaultTemplateRuntimeSet = runtimeSet;
160
+ cachedDefaultTemplateHandlerOptions = {
161
+ runtimeSet
162
+ };
163
+ }
164
+ return cachedDefaultTemplateHandlerOptions;
165
+ }
166
+ return {
167
+ runtimeSet,
168
+ ...options2
169
+ };
170
+ }
124
171
  const transformWxss = (options2 = {}) => createVinylTransform(async (file) => {
125
172
  if (!file.contents) {
126
173
  return;
@@ -140,11 +187,7 @@ function createPlugins(options = {}) {
140
187
  },
141
188
  async transform() {
142
189
  await runtimeState.patchPromise;
143
- const { css } = await styleHandler(rawSource, {
144
- isMainChunk: true,
145
- majorVersion: runtimeState.twPatcher.majorVersion,
146
- ...options2
147
- });
190
+ const { css } = await styleHandler(rawSource, resolveWxssHandlerOptions(options2));
148
191
  debug("css handle: %s", file.path);
149
192
  return {
150
193
  result: css
@@ -159,7 +202,7 @@ function createPlugins(options = {}) {
159
202
  await refreshRuntimeSet(false);
160
203
  await runtimeState.patchPromise;
161
204
  const filename = _path2.default.resolve(file.path);
162
- const moduleGraph = _nullishCoalesce(options2.moduleGraph, () => ( createModuleGraphOptionsFor()));
205
+ const moduleGraph = resolveModuleGraphOptions(options2.moduleGraph);
163
206
  const handlerOptions = {
164
207
  ...options2,
165
208
  filename,
@@ -211,10 +254,7 @@ function createPlugins(options = {}) {
211
254
  },
212
255
  async transform() {
213
256
  await runtimeState.patchPromise;
214
- const code = await templateHandler(rawSource, {
215
- runtimeSet,
216
- ...options2
217
- });
257
+ const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options2));
218
258
  debug("html handle: %s", file.path);
219
259
  return {
220
260
  result: code
package/dist/cli.js CHANGED
@@ -3,14 +3,14 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkDEIJXHGJjs = require('./chunk-DEIJXHGJ.js');
6
+ var _chunkG5NLM3ALjs = require('./chunk-G5NLM3AL.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkRYC23C3Kjs = require('./chunk-RYC23C3K.js');
11
- require('./chunk-5U24PLVV.js');
10
+ var _chunk4LPOQMFSjs = require('./chunk-4LPOQMFS.js');
11
+ require('./chunk-ACTJYB33.js');
12
12
  require('./chunk-DYLQ6UOI.js');
13
- require('./chunk-YUTKX7JZ.js');
13
+ require('./chunk-OV7FX6XR.js');
14
14
 
15
15
  // src/cli.ts
16
16
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
@@ -134,7 +134,7 @@ function resolvePatchDefaultCwd(currentCwd = _process2.default.cwd()) {
134
134
  if (explicitCwd) {
135
135
  return explicitCwd;
136
136
  }
137
- const workspaceRoot = _chunkRYC23C3Kjs.findWorkspaceRoot.call(void 0, baseDir);
137
+ const workspaceRoot = _chunk4LPOQMFSjs.findWorkspaceRoot.call(void 0, baseDir);
138
138
  const initCwd = normalizeCandidatePath(baseDir, _process2.default.env.INIT_CWD);
139
139
  const localPrefix = normalizeCandidatePath(baseDir, _process2.default.env.npm_config_local_prefix);
140
140
  const candidates = [
@@ -156,12 +156,12 @@ async function ensureDir(dir) {
156
156
  }
157
157
  function handleCliError(error) {
158
158
  if (error instanceof Error) {
159
- _chunkRYC23C3Kjs.logger.error(error.message);
159
+ _chunk4LPOQMFSjs.logger.error(error.message);
160
160
  if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
161
- _chunkRYC23C3Kjs.logger.error(error.stack);
161
+ _chunk4LPOQMFSjs.logger.error(error.stack);
162
162
  }
163
163
  } else {
164
- _chunkRYC23C3Kjs.logger.error(String(error));
164
+ _chunk4LPOQMFSjs.logger.error(String(error));
165
165
  }
166
166
  }
167
167
  function commandAction(handler) {
@@ -192,27 +192,27 @@ function logPatchStatusReport(report) {
192
192
  (entry) => entry.status === "skipped" || entry.status === "unsupported"
193
193
  );
194
194
  const packageLabel = `${_nullishCoalesce(report.package.name, () => ( "tailwindcss"))}@${_nullishCoalesce(report.package.version, () => ( "unknown"))}`;
195
- _chunkRYC23C3Kjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
195
+ _chunk4LPOQMFSjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
196
196
  if (applied.length) {
197
- _chunkRYC23C3Kjs.logger.success("Applied:");
197
+ _chunk4LPOQMFSjs.logger.success("Applied:");
198
198
  applied.forEach((entry) => {
199
- _chunkRYC23C3Kjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
199
+ _chunk4LPOQMFSjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
200
200
  });
201
201
  }
202
202
  if (pending.length) {
203
- _chunkRYC23C3Kjs.logger.warn("Needs attention:");
203
+ _chunk4LPOQMFSjs.logger.warn("Needs attention:");
204
204
  pending.forEach((entry) => {
205
205
  const details = entry.reason ? ` - ${entry.reason}` : "";
206
- _chunkRYC23C3Kjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
206
+ _chunk4LPOQMFSjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
207
207
  });
208
208
  } else {
209
- _chunkRYC23C3Kjs.logger.success("All applicable patches are applied.");
209
+ _chunk4LPOQMFSjs.logger.success("All applicable patches are applied.");
210
210
  }
211
211
  if (skipped.length) {
212
- _chunkRYC23C3Kjs.logger.info("Skipped:");
212
+ _chunk4LPOQMFSjs.logger.info("Skipped:");
213
213
  skipped.forEach((entry) => {
214
214
  const details = entry.reason ? ` - ${entry.reason}` : "";
215
- _chunkRYC23C3Kjs.logger.info(` - ${entry.name}${details}`);
215
+ _chunk4LPOQMFSjs.logger.info(` - ${entry.name}${details}`);
216
216
  });
217
217
  }
218
218
  }
@@ -330,6 +330,8 @@ function parseImportersFromLock(workspaceRoot) {
330
330
  }
331
331
 
332
332
  // src/cli/workspace/package-dirs.ts
333
+ var BACKSLASH_RE = /\\/g;
334
+ var TRAILING_SLASH_RE = /\/+$/;
333
335
  async function resolveWorkspacePackageDirs(workspaceRoot) {
334
336
  const dirs = /* @__PURE__ */ new Set();
335
337
  for (const importerDir of parseImportersFromLock(workspaceRoot)) {
@@ -342,7 +344,7 @@ async function resolveWorkspacePackageDirs(workspaceRoot) {
342
344
  }
343
345
  if (globs.length > 0) {
344
346
  const patterns = globs.map((pattern) => {
345
- const normalized = pattern.replace(/\\/g, "/").replace(/\/+$/, "");
347
+ const normalized = pattern.replace(BACKSLASH_RE, "/").replace(TRAILING_SLASH_RE, "");
346
348
  return normalized.endsWith("package.json") ? normalized : `${normalized}/package.json`;
347
349
  });
348
350
  const packageJsonFiles = await _fastglob2.default.call(void 0, patterns, {
@@ -377,7 +379,7 @@ function summarizeWorkspaceResults(results) {
377
379
  const patched = results.filter((result) => result.status === "patched").length;
378
380
  const skipped = results.filter((result) => result.status === "skipped").length;
379
381
  const failed = results.filter((result) => result.status === "failed").length;
380
- _chunkRYC23C3Kjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
382
+ _chunk4LPOQMFSjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
381
383
  }
382
384
 
383
385
  // src/cli/workspace/patch-package.ts
@@ -393,7 +395,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
393
395
  const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
394
396
  const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
395
397
  if (!_optionalChain([tailwindInfo, 'optionalAccess', _11 => _11.rootPath])) {
396
- _chunkRYC23C3Kjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
398
+ _chunk4LPOQMFSjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
397
399
  return {
398
400
  dir,
399
401
  name: pkgName,
@@ -404,23 +406,23 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
404
406
  try {
405
407
  const patcher = createWorkspacePatcher(dir);
406
408
  if (options.clearCache) {
407
- await _chunkDEIJXHGJjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
409
+ await _chunkG5NLM3ALjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
408
410
  }
409
- const recorder = _chunkDEIJXHGJjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
411
+ const recorder = _chunkG5NLM3ALjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
410
412
  source: "cli",
411
413
  cwd: dir,
412
414
  recordTarget: options.recordTarget !== false,
413
415
  alwaysRecord: true
414
416
  });
415
417
  if (_optionalChain([recorder, 'optionalAccess', _12 => _12.message])) {
416
- _chunkRYC23C3Kjs.logger.info("[workspace] %s %s", displayName, recorder.message);
418
+ _chunk4LPOQMFSjs.logger.info("[workspace] %s %s", displayName, recorder.message);
417
419
  }
418
- _chunkDEIJXHGJjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
420
+ _chunkG5NLM3ALjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
419
421
  await patcher.patch();
420
422
  if (_optionalChain([recorder, 'optionalAccess', _13 => _13.onPatched])) {
421
423
  await recorder.onPatched();
422
424
  }
423
- _chunkRYC23C3Kjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
425
+ _chunk4LPOQMFSjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
424
426
  return {
425
427
  dir,
426
428
  name: pkgName,
@@ -431,7 +433,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
431
433
  const reason = error instanceof Error ? error.message : String(error);
432
434
  const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
433
435
  const message = `${reason}\uFF0C${suggestion}`;
434
- _chunkRYC23C3Kjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
436
+ _chunk4LPOQMFSjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
435
437
  return {
436
438
  dir,
437
439
  name: pkgName,
@@ -444,10 +446,10 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
444
446
  // src/cli/workspace.ts
445
447
  async function patchWorkspace(options) {
446
448
  const cwd = _nullishCoalesce(options.cwd, () => ( _process2.default.cwd()));
447
- const workspaceRoot = _nullishCoalesce(_chunkRYC23C3Kjs.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
449
+ const workspaceRoot = _nullishCoalesce(_chunk4LPOQMFSjs.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
448
450
  const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
449
451
  if (packageDirs.length === 0) {
450
- _chunkRYC23C3Kjs.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
452
+ _chunk4LPOQMFSjs.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
451
453
  return;
452
454
  }
453
455
  const results = [];
@@ -462,12 +464,12 @@ async function patchWorkspace(options) {
462
464
  // src/cli/mount-options.ts
463
465
  function handleCliError2(error) {
464
466
  if (error instanceof Error) {
465
- _chunkRYC23C3Kjs.logger.error(error.message);
467
+ _chunk4LPOQMFSjs.logger.error(error.message);
466
468
  if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
467
- _chunkRYC23C3Kjs.logger.error(error.stack);
469
+ _chunk4LPOQMFSjs.logger.error(error.stack);
468
470
  }
469
471
  } else {
470
- _chunkRYC23C3Kjs.logger.error(String(error));
472
+ _chunk4LPOQMFSjs.logger.error(String(error));
471
473
  }
472
474
  }
473
475
  function withCommandErrorHandling(handler) {
@@ -546,26 +548,26 @@ var mountOptions = {
546
548
  }
547
549
  const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
548
550
  if (shouldClearCache) {
549
- await _chunkDEIJXHGJjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
551
+ await _chunkG5NLM3ALjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
550
552
  }
551
- const recorder = _chunkDEIJXHGJjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
553
+ const recorder = _chunkG5NLM3ALjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
552
554
  source: "cli",
553
555
  cwd: ctx.cwd,
554
556
  recordTarget: shouldRecordTarget,
555
557
  alwaysRecord: true
556
558
  });
557
559
  if (_optionalChain([recorder, 'optionalAccess', _15 => _15.message])) {
558
- _chunkRYC23C3Kjs.logger.info(recorder.message);
560
+ _chunk4LPOQMFSjs.logger.info(recorder.message);
559
561
  }
560
- _chunkDEIJXHGJjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
562
+ _chunkG5NLM3ALjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
561
563
  await patcher.patch();
562
564
  if (_optionalChain([recorder, 'optionalAccess', _16 => _16.onPatched])) {
563
565
  const recordPath = await recorder.onPatched();
564
566
  if (recordPath) {
565
- _chunkRYC23C3Kjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
567
+ _chunk4LPOQMFSjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
566
568
  }
567
569
  }
568
- _chunkRYC23C3Kjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
570
+ _chunk4LPOQMFSjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
569
571
  }),
570
572
  extract: withCommandErrorHandling(async (_ctx, next) => next()),
571
573
  tokens: withCommandErrorHandling(async (_ctx, next) => next()),
@@ -574,7 +576,7 @@ var mountOptions = {
574
576
  const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
575
577
  const report = await patcher.getPatchStatus();
576
578
  if (ctx.args.json) {
577
- _chunkRYC23C3Kjs.logger.log(JSON.stringify(report, null, 2));
579
+ _chunk4LPOQMFSjs.logger.log(JSON.stringify(report, null, 2));
578
580
  return report;
579
581
  }
580
582
  logPatchStatusReport(report);
@@ -597,8 +599,9 @@ var DEFAULT_VSCODE_SOURCES = [
597
599
  ];
598
600
  var SINGLE_QUOTE = "'";
599
601
  var DOUBLE_QUOTE = '"';
602
+ var BACKSLASH_RE2 = /\\/g;
600
603
  function toPosixPath(filepath) {
601
- return filepath.replace(/\\/g, "/");
604
+ return filepath.replace(BACKSLASH_RE2, "/");
602
605
  }
603
606
  async function assertFileExists(filepath) {
604
607
  try {
@@ -705,9 +708,9 @@ async function generateVscodeIntellisenseEntry(options) {
705
708
 
706
709
  // src/cli.ts
707
710
  _process2.default.title = "node (weapp-tailwindcss)";
708
- if (_semver2.default.lt(_process2.default.versions.node, _chunkDEIJXHGJjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
709
- _chunkRYC23C3Kjs.logger.warn(
710
- `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkDEIJXHGJjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
711
+ if (_semver2.default.lt(_process2.default.versions.node, _chunkG5NLM3ALjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
712
+ _chunk4LPOQMFSjs.logger.warn(
713
+ `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkG5NLM3ALjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
711
714
  );
712
715
  }
713
716
  var cli = _tailwindcsspatch.createTailwindcssPatchCli.call(void 0, {
@@ -732,7 +735,7 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
732
735
  sources,
733
736
  force
734
737
  });
735
- _chunkRYC23C3Kjs.logger.success(
738
+ _chunk4LPOQMFSjs.logger.success(
736
739
  `VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
737
740
  );
738
741
  })
package/dist/cli.mjs CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  clearTailwindcssPatcherCache,
4
4
  createPatchTargetRecorder,
5
5
  logTailwindcssTarget
6
- } from "./chunk-E7775SFS.mjs";
6
+ } from "./chunk-FZNYV7VH.mjs";
7
7
  import {
8
8
  findWorkspaceRoot,
9
9
  logger
10
- } from "./chunk-QOTLDKI4.mjs";
11
- import "./chunk-3WUHHFLF.mjs";
10
+ } from "./chunk-IEZ5RBMG.mjs";
11
+ import "./chunk-35EI5JMK.mjs";
12
12
  import "./chunk-OOHJLO5M.mjs";
13
- import "./chunk-TNYEOBAC.mjs";
13
+ import "./chunk-DOH7FULQ.mjs";
14
14
 
15
15
  // src/cli.ts
16
16
  import process7 from "process";
@@ -330,6 +330,8 @@ function parseImportersFromLock(workspaceRoot) {
330
330
  }
331
331
 
332
332
  // src/cli/workspace/package-dirs.ts
333
+ var BACKSLASH_RE = /\\/g;
334
+ var TRAILING_SLASH_RE = /\/+$/;
333
335
  async function resolveWorkspacePackageDirs(workspaceRoot) {
334
336
  const dirs = /* @__PURE__ */ new Set();
335
337
  for (const importerDir of parseImportersFromLock(workspaceRoot)) {
@@ -342,7 +344,7 @@ async function resolveWorkspacePackageDirs(workspaceRoot) {
342
344
  }
343
345
  if (globs.length > 0) {
344
346
  const patterns = globs.map((pattern) => {
345
- const normalized = pattern.replace(/\\/g, "/").replace(/\/+$/, "");
347
+ const normalized = pattern.replace(BACKSLASH_RE, "/").replace(TRAILING_SLASH_RE, "");
346
348
  return normalized.endsWith("package.json") ? normalized : `${normalized}/package.json`;
347
349
  });
348
350
  const packageJsonFiles = await fg(patterns, {
@@ -597,8 +599,9 @@ var DEFAULT_VSCODE_SOURCES = [
597
599
  ];
598
600
  var SINGLE_QUOTE = "'";
599
601
  var DOUBLE_QUOTE = '"';
602
+ var BACKSLASH_RE2 = /\\/g;
600
603
  function toPosixPath(filepath) {
601
- return filepath.replace(/\\/g, "/");
604
+ return filepath.replace(BACKSLASH_RE2, "/");
602
605
  }
603
606
  async function assertFileExists(filepath) {
604
607
  try {