weapp-tailwindcss 4.9.0 → 4.9.2-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 (40) hide show
  1. package/dist/{chunk-IGTIMGCP.js → chunk-2QR4UOHA.js} +5 -5
  2. package/dist/{chunk-SZOXLSNK.mjs → chunk-3LRQLHOG.mjs} +25 -9
  3. package/dist/{chunk-A2OSQ5CV.js → chunk-D2ZOXBOU.js} +14 -14
  4. package/dist/chunk-DYLQ6UOI.js +71 -0
  5. package/dist/{chunk-QZJTOS3U.js → chunk-EOCBETCN.js} +3 -3
  6. package/dist/{chunk-YJ4NK2AE.mjs → chunk-FAUL26KB.mjs} +4 -4
  7. package/dist/{chunk-6R4BK6D6.js → chunk-FYYBY3VK.js} +5 -5
  8. package/dist/{chunk-GIUNRP65.mjs → chunk-GKFJPK5V.mjs} +2 -2
  9. package/dist/{chunk-RMTGZQHJ.js → chunk-HNNJH4ZX.js} +7 -7
  10. package/dist/{chunk-TFOTUR4L.mjs → chunk-HWF5U4CI.mjs} +1 -1
  11. package/dist/{chunk-4FB4YO6F.js → chunk-IC2XBOKV.js} +80 -57
  12. package/dist/{chunk-4Z6MHSEO.mjs → chunk-IK5SFZ6A.mjs} +4 -4
  13. package/dist/{chunk-NNYRZ4FL.js → chunk-O2XZFBRS.js} +24 -24
  14. package/dist/{chunk-RR5HCKVQ.mjs → chunk-OOHJLO5M.mjs} +26 -0
  15. package/dist/{chunk-6OOJ46QK.mjs → chunk-OU6P3233.mjs} +60 -37
  16. package/dist/{chunk-QJTJC5UT.mjs → chunk-VZLUWOGQ.mjs} +1 -1
  17. package/dist/{chunk-3M464H7S.mjs → chunk-W3Z55EVM.mjs} +2 -2
  18. package/dist/{chunk-PT4IJT3Q.js → chunk-Y4A76SWP.js} +27 -11
  19. package/dist/cli.js +40 -40
  20. package/dist/cli.mjs +4 -4
  21. package/dist/core.js +11 -11
  22. package/dist/core.mjs +5 -5
  23. package/dist/css-macro.js +2 -2
  24. package/dist/css-macro.mjs +1 -1
  25. package/dist/defaults.js +3 -3
  26. package/dist/defaults.mjs +2 -2
  27. package/dist/gulp.js +7 -7
  28. package/dist/gulp.mjs +6 -6
  29. package/dist/index.js +10 -10
  30. package/dist/index.mjs +9 -9
  31. package/dist/presets.js +12 -8
  32. package/dist/presets.mjs +8 -4
  33. package/dist/vite.js +7 -7
  34. package/dist/vite.mjs +6 -6
  35. package/dist/webpack.js +8 -8
  36. package/dist/webpack.mjs +7 -7
  37. package/dist/webpack4.js +27 -27
  38. package/dist/webpack4.mjs +6 -6
  39. package/package.json +1 -1
  40. package/dist/chunk-FMBPNII7.js +0 -45
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-RRHPTTCP.mjs";
13
13
  import {
14
14
  setupPatchRecorder
15
- } from "./chunk-GIUNRP65.mjs";
15
+ } from "./chunk-GKFJPK5V.mjs";
16
16
  import {
17
17
  collectRuntimeClassSet,
18
18
  createAttributeMatcher,
@@ -23,10 +23,11 @@ import {
23
23
  replaceWxml,
24
24
  toCustomAttributesEntities,
25
25
  vitePluginName
26
- } from "./chunk-4Z6MHSEO.mjs";
26
+ } from "./chunk-IK5SFZ6A.mjs";
27
27
  import {
28
- getGroupedEntries
29
- } from "./chunk-RR5HCKVQ.mjs";
28
+ getGroupedEntries,
29
+ resolveUniUtsPlatform
30
+ } from "./chunk-OOHJLO5M.mjs";
30
31
 
31
32
  // src/bundlers/vite/index.ts
32
33
  import { Buffer } from "buffer";
@@ -227,16 +228,22 @@ async function formatPostcssSourceMap(rawMap, file) {
227
228
  // src/uni-app-x/vite.ts
228
229
  var preprocessorLangs = /* @__PURE__ */ new Set(["scss", "sass", "less", "styl", "stylus"]);
229
230
  function isPreprocessorRequest(id, lang) {
230
- if (lang && preprocessorLangs.has(lang)) {
231
+ const normalizedLang = lang?.toLowerCase();
232
+ if (normalizedLang && preprocessorLangs.has(normalizedLang)) {
231
233
  return true;
232
234
  }
233
- return /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/.test(id);
235
+ const inlineLangMatch = id.match(/lang\.([a-z]+)/i);
236
+ if (inlineLangMatch && preprocessorLangs.has(inlineLangMatch[1].toLowerCase())) {
237
+ return true;
238
+ }
239
+ return /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i.test(id);
234
240
  }
235
241
  function createUniAppXPlugins(options) {
236
242
  const {
237
243
  appType,
238
244
  customAttributesEntities,
239
245
  disabledDefaultTemplateHandler,
246
+ isIosPlatform: providedIosPlatform,
240
247
  mainCssChunkMatcher,
241
248
  runtimeState,
242
249
  styleHandler,
@@ -244,44 +251,57 @@ function createUniAppXPlugins(options) {
244
251
  ensureRuntimeClassSet,
245
252
  getResolvedConfig
246
253
  } = options;
247
- const cssPlugins = [void 0, "pre"].map((enforce) => ({
248
- name: `weapp-tailwindcss:uni-app-x:css${enforce ? `:${enforce}` : ""}`,
249
- enforce,
254
+ const isIosPlatform = providedIosPlatform ?? resolveUniUtsPlatform().isAppIos;
255
+ async function transformStyle(code, id, query) {
256
+ const parsed = query ?? parseVueRequest(id).query;
257
+ if (isCSSRequest(id) || parsed.vue && parsed.type === "style") {
258
+ const postcssResult = await styleHandler(code, {
259
+ isMainChunk: mainCssChunkMatcher(id, appType),
260
+ postcssOptions: {
261
+ options: {
262
+ from: id,
263
+ map: {
264
+ inline: false,
265
+ annotation: false,
266
+ // PostCSS 可能返回虚拟文件,因此需要启用这一项以获取源内容
267
+ sourcesContent: true
268
+ // 若上游预处理器已经生成 source map,sources 中可能出现重复条目
269
+ }
270
+ }
271
+ }
272
+ });
273
+ const rawPostcssMap = postcssResult.map.toJSON();
274
+ const postcssMap = await formatPostcssSourceMap(
275
+ rawPostcssMap,
276
+ cleanUrl(id)
277
+ );
278
+ return {
279
+ code: postcssResult.css,
280
+ map: postcssMap
281
+ };
282
+ }
283
+ }
284
+ const cssPrePlugin = {
285
+ name: "weapp-tailwindcss:uni-app-x:css:pre",
286
+ enforce: "pre",
250
287
  async transform(code, id) {
251
288
  await runtimeState.patchPromise;
252
289
  const { query } = parseVueRequest(id);
253
290
  const lang = query.lang;
254
- if (enforce === "pre" && isPreprocessorRequest(id, lang)) {
291
+ if (isIosPlatform && isPreprocessorRequest(id, lang)) {
255
292
  return;
256
293
  }
257
- if (isCSSRequest(id) || query.vue && query.type === "style") {
258
- const postcssResult = await styleHandler(code, {
259
- isMainChunk: mainCssChunkMatcher(id, appType),
260
- postcssOptions: {
261
- options: {
262
- from: id,
263
- map: {
264
- inline: false,
265
- annotation: false,
266
- // PostCSS 可能返回虚拟文件,因此需要启用这一项以获取源内容
267
- sourcesContent: true
268
- // 若上游预处理器已经生成 source map,sources 中可能出现重复条目
269
- }
270
- }
271
- }
272
- });
273
- const rawPostcssMap = postcssResult.map.toJSON();
274
- const postcssMap = await formatPostcssSourceMap(
275
- rawPostcssMap,
276
- cleanUrl(id)
277
- );
278
- return {
279
- code: postcssResult.css,
280
- map: postcssMap
281
- };
282
- }
294
+ return transformStyle(code, id, query);
283
295
  }
284
- }));
296
+ };
297
+ const cssPlugin = {
298
+ name: "weapp-tailwindcss:uni-app-x:css",
299
+ async transform(code, id) {
300
+ await runtimeState.patchPromise;
301
+ return transformStyle(code, id);
302
+ }
303
+ };
304
+ const cssPlugins = [cssPlugin, cssPrePlugin];
285
305
  const nvuePlugin = {
286
306
  name: "weapp-tailwindcss:uni-app-x:nvue",
287
307
  enforce: "pre",
@@ -574,10 +594,13 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
574
594
  }
575
595
  onLoad();
576
596
  const getResolvedConfig = () => resolvedConfig;
597
+ const utsPlatform = resolveUniUtsPlatform();
598
+ const isIosPlatform = utsPlatform.isAppIos;
577
599
  const uniAppXPlugins = uniAppX ? createUniAppXPlugins({
578
600
  appType,
579
601
  customAttributesEntities,
580
602
  disabledDefaultTemplateHandler,
603
+ isIosPlatform,
581
604
  mainCssChunkMatcher,
582
605
  runtimeState,
583
606
  styleHandler,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-3SKEY32E.mjs";
4
4
  import {
5
5
  pluginName
6
- } from "./chunk-4Z6MHSEO.mjs";
6
+ } from "./chunk-IK5SFZ6A.mjs";
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  import path2 from "path";
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-RRHPTTCP.mjs";
4
4
  import {
5
5
  setupPatchRecorder
6
- } from "./chunk-GIUNRP65.mjs";
6
+ } from "./chunk-GKFJPK5V.mjs";
7
7
  import {
8
8
  collectRuntimeClassSet,
9
9
  createDebug,
10
10
  getCompilerContext,
11
11
  refreshTailwindRuntimeState
12
- } from "./chunk-4Z6MHSEO.mjs";
12
+ } from "./chunk-IK5SFZ6A.mjs";
13
13
 
14
14
  // src/bundlers/gulp/index.ts
15
15
  import { Buffer } from "buffer";
@@ -1,6 +1,6 @@
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 _chunkFMBPNII7js = require('./chunk-FMBPNII7.js');
3
+ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
4
4
 
5
5
 
6
6
  var _chunkMB4BR57Ejs = require('./chunk-MB4BR57E.js');
@@ -692,6 +692,7 @@ function createPatcherForBase(baseDir, cssEntries, options) {
692
692
  tailwindcssPatcherOptions,
693
693
  supportCustomLengthUnitsPatch
694
694
  } = options;
695
+ const hasCssEntries = Boolean(_optionalChain([cssEntries, 'optionalAccess', _40 => _40.length]));
695
696
  const defaultTailwindcssConfig = {
696
697
  cwd: baseDir,
697
698
  v2: {
@@ -700,29 +701,35 @@ function createPatcherForBase(baseDir, cssEntries, options) {
700
701
  v3: {
701
702
  cwd: baseDir
702
703
  },
703
- v4: {
704
+ v4: hasCssEntries ? { cssEntries } : {
704
705
  base: baseDir,
705
706
  cssEntries
706
707
  }
707
708
  };
708
- if (_optionalChain([cssEntries, 'optionalAccess', _40 => _40.length]) && (tailwindcss == null || tailwindcss.version == null)) {
709
+ if (hasCssEntries && (tailwindcss == null || tailwindcss.version == null)) {
709
710
  defaultTailwindcssConfig.version = 4;
710
711
  }
711
- const mergedTailwindOptions = _chunkFMBPNII7js.defuOverrideArray.call(void 0,
712
+ const mergedTailwindOptions = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
712
713
  _nullishCoalesce(tailwindcss, () => ( {})),
713
714
  defaultTailwindcssConfig
714
715
  );
715
716
  if (!mergedTailwindOptions.v4) {
716
- mergedTailwindOptions.v4 = {
717
+ mergedTailwindOptions.v4 = hasCssEntries ? { cssEntries: _nullishCoalesce(cssEntries, () => ( [])) } : {
717
718
  base: baseDir,
718
719
  cssEntries: _nullishCoalesce(cssEntries, () => ( []))
719
720
  };
720
721
  } else {
721
- mergedTailwindOptions.v4.base = baseDir;
722
- if (_optionalChain([cssEntries, 'optionalAccess', _41 => _41.length])) {
723
- mergedTailwindOptions.v4.cssEntries = cssEntries;
722
+ if (!hasCssEntries && !mergedTailwindOptions.v4.base) {
723
+ mergedTailwindOptions.v4.base = baseDir;
724
+ }
725
+ if (hasCssEntries) {
726
+ if (_optionalChain([cssEntries, 'optionalAccess', _41 => _41.length])) {
727
+ mergedTailwindOptions.v4.cssEntries = cssEntries;
728
+ } else if (!mergedTailwindOptions.v4.cssEntries) {
729
+ mergedTailwindOptions.v4.cssEntries = [];
730
+ }
724
731
  } else if (!mergedTailwindOptions.v4.cssEntries) {
725
- mergedTailwindOptions.v4.cssEntries = [];
732
+ mergedTailwindOptions.v4.cssEntries = _nullishCoalesce(cssEntries, () => ( []));
726
733
  }
727
734
  }
728
735
  const patchedOptions = overrideTailwindcssPatcherOptionsForBase(
@@ -765,6 +772,7 @@ function createMultiTailwindcssPatcher(patchers) {
765
772
  }
766
773
  const [first] = patchers;
767
774
  const multiPatcher = {
775
+ ...first,
768
776
  packageInfo: _optionalChain([first, 'optionalAccess', _54 => _54.packageInfo]),
769
777
  majorVersion: _optionalChain([first, 'optionalAccess', _55 => _55.majorVersion]),
770
778
  options: _optionalChain([first, 'optionalAccess', _56 => _56.options]),
@@ -1090,8 +1098,16 @@ function createTailwindcssPatcherFromContext(ctx) {
1090
1098
  if (normalizedCssEntries) {
1091
1099
  ctx.cssEntries = normalizedCssEntries;
1092
1100
  }
1101
+ const shouldAttachBase = Boolean(ctx.tailwindcssBasedir && _optionalChain([normalizedCssEntries, 'optionalAccess', _64 => _64.length]));
1102
+ const tailwindcssWithBase = shouldAttachBase && _optionalChain([tailwindcss, 'optionalAccess', _65 => _65.v4]) !== null ? {
1103
+ ..._nullishCoalesce(tailwindcss, () => ( {})),
1104
+ v4: {
1105
+ ..._nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess', _66 => _66.v4]), () => ( {})),
1106
+ base: _nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess', _67 => _67.v4, 'optionalAccess', _68 => _68.base]), () => ( resolvedTailwindcssBasedir))
1107
+ }
1108
+ } : tailwindcss;
1093
1109
  const patcherOptions = {
1094
- tailwindcss,
1110
+ tailwindcss: tailwindcssWithBase,
1095
1111
  tailwindcssPatcherOptions,
1096
1112
  supportCustomLengthUnitsPatch,
1097
1113
  appType
@@ -1105,7 +1121,7 @@ function createTailwindcssPatcherFromContext(ctx) {
1105
1121
  if (multiPatcher) {
1106
1122
  return multiPatcher;
1107
1123
  }
1108
- if (_optionalChain([groupedCssEntries, 'optionalAccess', _64 => _64.size]) === 1) {
1124
+ if (_optionalChain([groupedCssEntries, 'optionalAccess', _69 => _69.size]) === 1) {
1109
1125
  const firstGroup = groupedCssEntries.entries().next().value;
1110
1126
  if (firstGroup) {
1111
1127
  const [baseDir, entries] = firstGroup;
package/dist/cli.js CHANGED
@@ -3,13 +3,13 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkA2OSQ5CVjs = require('./chunk-A2OSQ5CV.js');
6
+ var _chunkD2ZOXBOUjs = require('./chunk-D2ZOXBOU.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkPT4IJT3Qjs = require('./chunk-PT4IJT3Q.js');
11
- require('./chunk-6R4BK6D6.js');
12
- require('./chunk-FMBPNII7.js');
10
+ var _chunkY4A76SWPjs = require('./chunk-Y4A76SWP.js');
11
+ require('./chunk-FYYBY3VK.js');
12
+ require('./chunk-DYLQ6UOI.js');
13
13
  require('./chunk-MB4BR57E.js');
14
14
 
15
15
  // src/cli.ts
@@ -125,7 +125,7 @@ function resolvePatchDefaultCwd(currentCwd = _process2.default.cwd()) {
125
125
  if (explicitCwd) {
126
126
  return explicitCwd;
127
127
  }
128
- const workspaceRoot = _chunkPT4IJT3Qjs.findWorkspaceRoot.call(void 0, baseDir);
128
+ const workspaceRoot = _chunkY4A76SWPjs.findWorkspaceRoot.call(void 0, baseDir);
129
129
  const initCwd = normalizeCandidatePath(baseDir, _process2.default.env.INIT_CWD);
130
130
  const localPrefix = normalizeCandidatePath(baseDir, _process2.default.env.npm_config_local_prefix);
131
131
  const candidates = [
@@ -145,12 +145,12 @@ async function ensureDir(dir) {
145
145
  }
146
146
  function handleCliError(error) {
147
147
  if (error instanceof Error) {
148
- _chunkPT4IJT3Qjs.logger.error(error.message);
148
+ _chunkY4A76SWPjs.logger.error(error.message);
149
149
  if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
150
- _chunkPT4IJT3Qjs.logger.error(error.stack);
150
+ _chunkY4A76SWPjs.logger.error(error.stack);
151
151
  }
152
152
  } else {
153
- _chunkPT4IJT3Qjs.logger.error(String(error));
153
+ _chunkY4A76SWPjs.logger.error(String(error));
154
154
  }
155
155
  }
156
156
  function commandAction(handler) {
@@ -309,10 +309,10 @@ function formatDisplayName(workspaceRoot, dir, name) {
309
309
  }
310
310
  async function patchWorkspace(options) {
311
311
  const cwd = _nullishCoalesce(options.cwd, () => ( _process2.default.cwd()));
312
- const workspaceRoot = _nullishCoalesce(_chunkPT4IJT3Qjs.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
312
+ const workspaceRoot = _nullishCoalesce(_chunkY4A76SWPjs.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
313
313
  const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
314
314
  if (packageDirs.length === 0) {
315
- _chunkPT4IJT3Qjs.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
315
+ _chunkY4A76SWPjs.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
316
316
  return;
317
317
  }
318
318
  const results = [];
@@ -328,24 +328,24 @@ async function patchWorkspace(options) {
328
328
  status: "skipped",
329
329
  message: "tailwindcss \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u3002"
330
330
  });
331
- _chunkPT4IJT3Qjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
331
+ _chunkY4A76SWPjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
332
332
  continue;
333
333
  }
334
334
  try {
335
335
  const patcher = createWorkspacePatcher(dir);
336
336
  if (options.clearCache) {
337
- await _chunkA2OSQ5CVjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
337
+ await _chunkD2ZOXBOUjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
338
338
  }
339
- const recorder = _chunkA2OSQ5CVjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
339
+ const recorder = _chunkD2ZOXBOUjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
340
340
  source: "cli",
341
341
  cwd: dir,
342
342
  recordTarget: options.recordTarget !== false,
343
343
  alwaysRecord: true
344
344
  });
345
345
  if (_optionalChain([recorder, 'optionalAccess', _13 => _13.message])) {
346
- _chunkPT4IJT3Qjs.logger.info("[workspace] %s %s", displayName, recorder.message);
346
+ _chunkY4A76SWPjs.logger.info("[workspace] %s %s", displayName, recorder.message);
347
347
  }
348
- _chunkA2OSQ5CVjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
348
+ _chunkD2ZOXBOUjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
349
349
  await patcher.patch();
350
350
  if (_optionalChain([recorder, 'optionalAccess', _14 => _14.onPatched])) {
351
351
  await recorder.onPatched();
@@ -356,7 +356,7 @@ async function patchWorkspace(options) {
356
356
  status: "patched",
357
357
  message: "\u5DF2\u5B8C\u6210 patch\u3002"
358
358
  });
359
- _chunkPT4IJT3Qjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
359
+ _chunkY4A76SWPjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
360
360
  } catch (error) {
361
361
  const reason = error instanceof Error ? error.message : String(error);
362
362
  const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
@@ -367,24 +367,24 @@ async function patchWorkspace(options) {
367
367
  status: "failed",
368
368
  message
369
369
  });
370
- _chunkPT4IJT3Qjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
370
+ _chunkY4A76SWPjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
371
371
  }
372
372
  }
373
373
  const patched = results.filter((result) => result.status === "patched").length;
374
374
  const skipped = results.filter((result) => result.status === "skipped").length;
375
375
  const failed = results.filter((result) => result.status === "failed").length;
376
- _chunkPT4IJT3Qjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
376
+ _chunkY4A76SWPjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
377
377
  }
378
378
 
379
379
  // src/cli/mount-options.ts
380
380
  function handleCliError2(error) {
381
381
  if (error instanceof Error) {
382
- _chunkPT4IJT3Qjs.logger.error(error.message);
382
+ _chunkY4A76SWPjs.logger.error(error.message);
383
383
  if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
384
- _chunkPT4IJT3Qjs.logger.error(error.stack);
384
+ _chunkY4A76SWPjs.logger.error(error.stack);
385
385
  }
386
386
  } else {
387
- _chunkPT4IJT3Qjs.logger.error(String(error));
387
+ _chunkY4A76SWPjs.logger.error(String(error));
388
388
  }
389
389
  }
390
390
  function withCommandErrorHandling(handler) {
@@ -419,27 +419,27 @@ function logPatchStatusReport(report) {
419
419
  (entry) => entry.status === "skipped" || entry.status === "unsupported"
420
420
  );
421
421
  const packageLabel = `${_nullishCoalesce(report.package.name, () => ( "tailwindcss"))}@${_nullishCoalesce(report.package.version, () => ( "unknown"))}`;
422
- _chunkPT4IJT3Qjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
422
+ _chunkY4A76SWPjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
423
423
  if (applied.length) {
424
- _chunkPT4IJT3Qjs.logger.success("Applied:");
424
+ _chunkY4A76SWPjs.logger.success("Applied:");
425
425
  applied.forEach((entry) => {
426
- _chunkPT4IJT3Qjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
426
+ _chunkY4A76SWPjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
427
427
  });
428
428
  }
429
429
  if (pending.length) {
430
- _chunkPT4IJT3Qjs.logger.warn("Needs attention:");
430
+ _chunkY4A76SWPjs.logger.warn("Needs attention:");
431
431
  pending.forEach((entry) => {
432
432
  const details = entry.reason ? ` - ${entry.reason}` : "";
433
- _chunkPT4IJT3Qjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
433
+ _chunkY4A76SWPjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
434
434
  });
435
435
  } else {
436
- _chunkPT4IJT3Qjs.logger.success("All applicable patches are applied.");
436
+ _chunkY4A76SWPjs.logger.success("All applicable patches are applied.");
437
437
  }
438
438
  if (skipped.length) {
439
- _chunkPT4IJT3Qjs.logger.info("Skipped:");
439
+ _chunkY4A76SWPjs.logger.info("Skipped:");
440
440
  skipped.forEach((entry) => {
441
441
  const details = entry.reason ? ` - ${entry.reason}` : "";
442
- _chunkPT4IJT3Qjs.logger.info(` - ${entry.name}${details}`);
442
+ _chunkY4A76SWPjs.logger.info(` - ${entry.name}${details}`);
443
443
  });
444
444
  }
445
445
  }
@@ -500,26 +500,26 @@ var mountOptions = {
500
500
  }
501
501
  const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
502
502
  if (shouldClearCache) {
503
- await _chunkA2OSQ5CVjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
503
+ await _chunkD2ZOXBOUjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
504
504
  }
505
- const recorder = _chunkA2OSQ5CVjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
505
+ const recorder = _chunkD2ZOXBOUjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
506
506
  source: "cli",
507
507
  cwd: ctx.cwd,
508
508
  recordTarget: shouldRecordTarget,
509
509
  alwaysRecord: true
510
510
  });
511
511
  if (_optionalChain([recorder, 'optionalAccess', _18 => _18.message])) {
512
- _chunkPT4IJT3Qjs.logger.info(recorder.message);
512
+ _chunkY4A76SWPjs.logger.info(recorder.message);
513
513
  }
514
- _chunkA2OSQ5CVjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
514
+ _chunkD2ZOXBOUjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
515
515
  await patcher.patch();
516
516
  if (_optionalChain([recorder, 'optionalAccess', _19 => _19.onPatched])) {
517
517
  const recordPath = await recorder.onPatched();
518
518
  if (recordPath) {
519
- _chunkPT4IJT3Qjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
519
+ _chunkY4A76SWPjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
520
520
  }
521
521
  }
522
- _chunkPT4IJT3Qjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
522
+ _chunkY4A76SWPjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
523
523
  }),
524
524
  extract: withCommandErrorHandling(async (_ctx, next) => next()),
525
525
  tokens: withCommandErrorHandling(async (_ctx, next) => next()),
@@ -528,7 +528,7 @@ var mountOptions = {
528
528
  const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
529
529
  const report = await patcher.getPatchStatus();
530
530
  if (ctx.args.json) {
531
- _chunkPT4IJT3Qjs.logger.log(JSON.stringify(report, null, 2));
531
+ _chunkY4A76SWPjs.logger.log(JSON.stringify(report, null, 2));
532
532
  return report;
533
533
  }
534
534
  logPatchStatusReport(report);
@@ -659,9 +659,9 @@ async function generateVscodeIntellisenseEntry(options) {
659
659
 
660
660
  // src/cli.ts
661
661
  _process2.default.title = "node (weapp-tailwindcss)";
662
- if (_semver2.default.lt(_process2.default.versions.node, _chunkA2OSQ5CVjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
663
- _chunkPT4IJT3Qjs.logger.warn(
664
- `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkA2OSQ5CVjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
662
+ if (_semver2.default.lt(_process2.default.versions.node, _chunkD2ZOXBOUjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
663
+ _chunkY4A76SWPjs.logger.warn(
664
+ `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkD2ZOXBOUjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
665
665
  );
666
666
  }
667
667
  var cli = _tailwindcsspatch.createTailwindcssPatchCli.call(void 0, {
@@ -686,7 +686,7 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
686
686
  sources,
687
687
  force
688
688
  });
689
- _chunkPT4IJT3Qjs.logger.success(
689
+ _chunkY4A76SWPjs.logger.success(
690
690
  `VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
691
691
  );
692
692
  })
package/dist/cli.mjs CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  clearTailwindcssPatcherCache,
4
4
  createPatchTargetRecorder,
5
5
  logTailwindcssTarget
6
- } from "./chunk-4Z6MHSEO.mjs";
6
+ } from "./chunk-IK5SFZ6A.mjs";
7
7
  import {
8
8
  findWorkspaceRoot,
9
9
  logger
10
- } from "./chunk-SZOXLSNK.mjs";
11
- import "./chunk-TFOTUR4L.mjs";
12
- import "./chunk-RR5HCKVQ.mjs";
10
+ } from "./chunk-3LRQLHOG.mjs";
11
+ import "./chunk-HWF5U4CI.mjs";
12
+ import "./chunk-OOHJLO5M.mjs";
13
13
  import "./chunk-SM5V25IN.mjs";
14
14
 
15
15
  // src/cli.ts
package/dist/core.js CHANGED
@@ -1,23 +1,23 @@
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 _chunkIGTIMGCPjs = require('./chunk-IGTIMGCP.js');
3
+ var _chunk2QR4UOHAjs = require('./chunk-2QR4UOHA.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkA2OSQ5CVjs = require('./chunk-A2OSQ5CV.js');
9
- require('./chunk-PT4IJT3Q.js');
10
- require('./chunk-6R4BK6D6.js');
11
- require('./chunk-FMBPNII7.js');
8
+ var _chunkD2ZOXBOUjs = require('./chunk-D2ZOXBOU.js');
9
+ require('./chunk-Y4A76SWP.js');
10
+ require('./chunk-FYYBY3VK.js');
11
+ require('./chunk-DYLQ6UOI.js');
12
12
  require('./chunk-MB4BR57E.js');
13
13
 
14
14
  // src/core.ts
15
15
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
16
16
  var _shared = require('@weapp-tailwindcss/shared');
17
17
  function createContext(options = {}) {
18
- const opts = _chunkA2OSQ5CVjs.getCompilerContext.call(void 0, options);
18
+ const opts = _chunkD2ZOXBOUjs.getCompilerContext.call(void 0, options);
19
19
  const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
20
- const patchRecorderState = _chunkIGTIMGCPjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
20
+ const patchRecorderState = _chunk2QR4UOHAjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
21
21
  source: "runtime",
22
22
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
23
23
  });
@@ -29,7 +29,7 @@ function createContext(options = {}) {
29
29
  onPatchCompleted: patchRecorderState.onPatchCompleted
30
30
  };
31
31
  async function refreshRuntimeState(force) {
32
- await _chunkA2OSQ5CVjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
32
+ await _chunkD2ZOXBOUjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
33
33
  }
34
34
  async function transformWxss(rawCss, options2) {
35
35
  await runtimeState.patchPromise;
@@ -38,7 +38,7 @@ function createContext(options = {}) {
38
38
  }));
39
39
  await refreshRuntimeState(true);
40
40
  await runtimeState.patchPromise;
41
- runtimeSet = await _chunkA2OSQ5CVjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
41
+ runtimeSet = await _chunkD2ZOXBOUjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
42
42
  return result;
43
43
  }
44
44
  async function transformJs(rawJs, options2 = {}) {
@@ -48,7 +48,7 @@ function createContext(options = {}) {
48
48
  } else {
49
49
  await refreshRuntimeState(true);
50
50
  await runtimeState.patchPromise;
51
- runtimeSet = await _chunkA2OSQ5CVjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
51
+ runtimeSet = await _chunkD2ZOXBOUjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
52
52
  }
53
53
  return await jsHandler(rawJs, runtimeSet, options2);
54
54
  }
@@ -57,7 +57,7 @@ function createContext(options = {}) {
57
57
  if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
58
58
  await refreshRuntimeState(true);
59
59
  await runtimeState.patchPromise;
60
- runtimeSet = await _chunkA2OSQ5CVjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
60
+ runtimeSet = await _chunkD2ZOXBOUjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
61
61
  }
62
62
  return templateHandler(rawWxml, _shared.defuOverrideArray.call(void 0, options2, {
63
63
  runtimeSet
package/dist/core.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  setupPatchRecorder
3
- } from "./chunk-GIUNRP65.mjs";
3
+ } from "./chunk-GKFJPK5V.mjs";
4
4
  import {
5
5
  collectRuntimeClassSet,
6
6
  getCompilerContext,
7
7
  refreshTailwindRuntimeState
8
- } from "./chunk-4Z6MHSEO.mjs";
9
- import "./chunk-SZOXLSNK.mjs";
10
- import "./chunk-TFOTUR4L.mjs";
11
- import "./chunk-RR5HCKVQ.mjs";
8
+ } from "./chunk-IK5SFZ6A.mjs";
9
+ import "./chunk-3LRQLHOG.mjs";
10
+ import "./chunk-HWF5U4CI.mjs";
11
+ import "./chunk-OOHJLO5M.mjs";
12
12
  import "./chunk-SM5V25IN.mjs";
13
13
 
14
14
  // src/core.ts
package/dist/css-macro.js CHANGED
@@ -4,7 +4,7 @@
4
4
  var _chunkNS3NEDWDjs = require('./chunk-NS3NEDWD.js');
5
5
 
6
6
 
7
- var _chunkFMBPNII7js = require('./chunk-FMBPNII7.js');
7
+ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
8
8
  require('./chunk-MB4BR57E.js');
9
9
 
10
10
  // src/css-macro/index.ts
@@ -14,7 +14,7 @@ var defaultOptions = {
14
14
  variantsMap: {}
15
15
  };
16
16
  var cssMacro = _plugin2.default.withOptions((options) => {
17
- const { dynamic, variantsMap } = _chunkFMBPNII7js.defu.call(void 0, _nullishCoalesce(options, () => ( {})), defaultOptions);
17
+ const { dynamic, variantsMap } = _chunkDYLQ6UOIjs.defu.call(void 0, _nullishCoalesce(options, () => ( {})), defaultOptions);
18
18
  const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
19
19
  if (typeof config === "string") {
20
20
  return {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-RGXLY3HG.mjs";
5
5
  import {
6
6
  defu
7
- } from "./chunk-RR5HCKVQ.mjs";
7
+ } from "./chunk-OOHJLO5M.mjs";
8
8
  import "./chunk-SM5V25IN.mjs";
9
9
 
10
10
  // src/css-macro/index.ts
package/dist/defaults.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk6R4BK6D6js = require('./chunk-6R4BK6D6.js');
4
- require('./chunk-FMBPNII7.js');
3
+ var _chunkFYYBY3VKjs = require('./chunk-FYYBY3VK.js');
4
+ require('./chunk-DYLQ6UOI.js');
5
5
  require('./chunk-MB4BR57E.js');
6
6
 
7
7
 
8
- exports.getDefaultOptions = _chunk6R4BK6D6js.getDefaultOptions;
8
+ exports.getDefaultOptions = _chunkFYYBY3VKjs.getDefaultOptions;
package/dist/defaults.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDefaultOptions
3
- } from "./chunk-TFOTUR4L.mjs";
4
- import "./chunk-RR5HCKVQ.mjs";
3
+ } from "./chunk-HWF5U4CI.mjs";
4
+ import "./chunk-OOHJLO5M.mjs";
5
5
  import "./chunk-SM5V25IN.mjs";
6
6
  export {
7
7
  getDefaultOptions