weapp-tailwindcss 4.10.0-beta.2 → 4.10.0-beta.3

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 (51) hide show
  1. package/dist/{chunk-GFJYJ6WV.js → chunk-2BHX22WT.js} +27 -27
  2. package/dist/{chunk-D3I6GQUV.mjs → chunk-2VVKFR3W.mjs} +13 -3
  3. package/dist/{chunk-YS2V3XY2.js → chunk-4EMVQ5H2.js} +15 -15
  4. package/dist/{chunk-3RGU475C.js → chunk-5APD2MNV.js} +163 -77
  5. package/dist/{chunk-UCDOKKRH.js → chunk-AAVDJYEE.js} +24 -14
  6. package/dist/{chunk-F7FBGRWS.js → chunk-NDRBH7DO.js} +7 -7
  7. package/dist/{chunk-AGF55OIE.mjs → chunk-PBA2SZ3H.mjs} +2 -2
  8. package/dist/{chunk-FIJF6OL7.mjs → chunk-Q6NT6TZQ.mjs} +2 -2
  9. package/dist/{chunk-7D27E7TU.mjs → chunk-QOTLDKI4.mjs} +131 -45
  10. package/dist/{chunk-QOWSZHYT.js → chunk-RHQJLGBF.js} +3 -3
  11. package/dist/{chunk-2KAM7AAG.mjs → chunk-SLXV5ZYJ.mjs} +2 -2
  12. package/dist/{chunk-Q7TIBSU2.mjs → chunk-TIZBA67F.mjs} +1 -1
  13. package/dist/{chunk-7ATL22KK.mjs → chunk-TYYAOYEJ.mjs} +3 -3
  14. package/dist/{chunk-FLJBD5TW.js → chunk-VEJYEJ4V.js} +5 -5
  15. package/dist/cli.js +45 -45
  16. package/dist/cli.mjs +9 -9
  17. package/dist/core.d.mts +1 -1
  18. package/dist/core.d.ts +1 -1
  19. package/dist/core.js +8 -8
  20. package/dist/core.mjs +3 -3
  21. package/dist/defaults.d.mts +1 -1
  22. package/dist/defaults.d.ts +1 -1
  23. package/dist/gulp.d.mts +1 -1
  24. package/dist/gulp.d.ts +1 -1
  25. package/dist/gulp.js +5 -5
  26. package/dist/gulp.mjs +4 -4
  27. package/dist/{index-vGuAfNvT.d.mts → index-v0opId0x.d.mts} +1 -1
  28. package/dist/{index-vGuAfNvT.d.ts → index-v0opId0x.d.ts} +1 -1
  29. package/dist/index.d.mts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +8 -8
  32. package/dist/index.mjs +7 -7
  33. package/dist/presets.d.mts +1 -1
  34. package/dist/presets.d.ts +1 -1
  35. package/dist/presets.js +8 -8
  36. package/dist/presets.mjs +5 -5
  37. package/dist/types.d.mts +2 -2
  38. package/dist/types.d.ts +2 -2
  39. package/dist/vite.d.mts +1 -1
  40. package/dist/vite.d.ts +1 -1
  41. package/dist/vite.js +5 -5
  42. package/dist/vite.mjs +4 -4
  43. package/dist/webpack.d.mts +1 -1
  44. package/dist/webpack.d.ts +1 -1
  45. package/dist/webpack.js +6 -6
  46. package/dist/webpack.mjs +5 -5
  47. package/dist/webpack4.d.mts +1 -1
  48. package/dist/webpack4.d.ts +1 -1
  49. package/dist/webpack4.js +27 -27
  50. package/dist/webpack4.mjs +4 -4
  51. package/package.json +3 -3
@@ -79,6 +79,9 @@ function hasConfiguredCssEntries(ctx) {
79
79
  }
80
80
  const patcherOptions = ctx.tailwindcssPatcherOptions;
81
81
  if (patcherOptions) {
82
+ if (normalizeCssEntriesConfig(patcherOptions.tailwindcss?.v4?.cssEntries)) {
83
+ return true;
84
+ }
82
85
  if (normalizeCssEntriesConfig(patcherOptions.tailwind?.v4?.cssEntries)) {
83
86
  return true;
84
87
  }
@@ -232,8 +235,10 @@ function normalizeTailwindcssPatcherOptions(options) {
232
235
  if (cache !== void 0) {
233
236
  normalized.cache = cache;
234
237
  }
238
+ const apply = {};
239
+ const extract = {};
235
240
  if (patch?.overwrite !== void 0) {
236
- normalized.overwrite = patch.overwrite;
241
+ apply.overwrite = patch.overwrite;
237
242
  }
238
243
  if (patch?.filter) {
239
244
  normalized.filter = patch.filter;
@@ -241,14 +246,12 @@ function normalizeTailwindcssPatcherOptions(options) {
241
246
  const extendLengthUnits = normalizeExtendLengthUnits(patch?.applyPatches?.extendLengthUnits);
242
247
  const exposeContext = patch?.applyPatches?.exportContext;
243
248
  if (extendLengthUnits !== void 0 || exposeContext !== void 0) {
244
- normalized.features = {
245
- exposeContext,
246
- extendLengthUnits
247
- };
249
+ apply.exposeContext = exposeContext;
250
+ apply.extendLengthUnits = extendLengthUnits;
248
251
  }
249
252
  const cwd = patch?.cwd ?? patch?.basedir;
250
253
  if (cwd) {
251
- normalized.cwd = cwd;
254
+ normalized.projectRoot = cwd;
252
255
  }
253
256
  const tailwindOptions = patch?.tailwindcss ? { ...patch.tailwindcss } : void 0;
254
257
  const legacyResolve = patch?.resolve;
@@ -269,14 +272,92 @@ function normalizeTailwindcssPatcherOptions(options) {
269
272
  ...resolveOptions ?? {},
270
273
  ...legacyResolve ?? {}
271
274
  } : void 0;
272
- normalized.tailwind = {
275
+ normalized.tailwindcss = {
273
276
  ...nextTailwindOptions ?? {},
274
277
  ...mergedResolve ? { resolve: mergedResolve } : {}
275
278
  };
276
279
  }
277
- return normalized;
280
+ if (patch?.output) {
281
+ if (patch.output.filename !== void 0) {
282
+ extract.file = patch.output.filename;
283
+ }
284
+ if (patch.output.loose !== void 0) {
285
+ extract.pretty = patch.output.loose ? 2 : false;
286
+ }
287
+ if (patch.output.removeUniversalSelector !== void 0) {
288
+ extract.removeUniversalSelector = patch.output.removeUniversalSelector;
289
+ }
290
+ }
291
+ if (Object.keys(apply).length > 0) {
292
+ normalized.apply = apply;
293
+ }
294
+ if (Object.keys(extract).length > 0) {
295
+ normalized.extract = extract;
296
+ }
297
+ return toModernTailwindcssPatchOptions(normalized);
298
+ }
299
+ return toModernTailwindcssPatchOptions(options);
300
+ }
301
+ function toModernTailwindcssPatchOptions(options) {
302
+ if (!options) {
303
+ return void 0;
304
+ }
305
+ const normalized = {};
306
+ if (options.cache !== void 0) {
307
+ normalized.cache = options.cache;
308
+ }
309
+ if (options.filter) {
310
+ normalized.filter = options.filter;
311
+ }
312
+ const projectRoot = options.projectRoot ?? options.cwd;
313
+ if (projectRoot) {
314
+ normalized.projectRoot = projectRoot;
315
+ }
316
+ const tailwindcss = options.tailwindcss ?? options.tailwind;
317
+ if (tailwindcss) {
318
+ normalized.tailwindcss = {
319
+ ...tailwindcss
320
+ };
321
+ }
322
+ const apply = {
323
+ ...options.apply ?? {}
324
+ };
325
+ if (apply.overwrite === void 0 && options.overwrite !== void 0) {
326
+ apply.overwrite = options.overwrite;
327
+ }
328
+ if (apply.exposeContext === void 0 && options.features?.exposeContext !== void 0) {
329
+ apply.exposeContext = options.features.exposeContext;
330
+ }
331
+ if (apply.extendLengthUnits === void 0 && options.features?.extendLengthUnits !== void 0) {
332
+ apply.extendLengthUnits = options.features.extendLengthUnits;
333
+ }
334
+ if (Object.keys(apply).length > 0) {
335
+ normalized.apply = apply;
336
+ }
337
+ const extract = {
338
+ ...options.extract ?? {}
339
+ };
340
+ if (options.output) {
341
+ if (extract.write === void 0 && options.output.enabled !== void 0) {
342
+ extract.write = options.output.enabled;
343
+ }
344
+ if (extract.file === void 0 && options.output.file !== void 0) {
345
+ extract.file = options.output.file;
346
+ }
347
+ if (extract.format === void 0 && options.output.format !== void 0) {
348
+ extract.format = options.output.format;
349
+ }
350
+ if (extract.pretty === void 0 && options.output.pretty !== void 0) {
351
+ extract.pretty = options.output.pretty;
352
+ }
353
+ if (extract.removeUniversalSelector === void 0 && options.output.removeUniversalSelector !== void 0) {
354
+ extract.removeUniversalSelector = options.output.removeUniversalSelector;
355
+ }
356
+ }
357
+ if (Object.keys(extract).length > 0) {
358
+ normalized.extract = extract;
278
359
  }
279
- return options;
360
+ return normalized;
280
361
  }
281
362
 
282
363
  // src/tailwindcss/patcher-resolve.ts
@@ -479,71 +560,74 @@ function createTailwindcssPatcher(options) {
479
560
  }
480
561
  }
481
562
  const baseOptions = {
482
- cwd: normalizedBasedir,
563
+ projectRoot: normalizedBasedir,
483
564
  cache,
484
- tailwind: baseTailwindOptions,
485
- features: {
565
+ tailwindcss: baseTailwindOptions,
566
+ apply: {
486
567
  exposeContext: true,
487
568
  extendLengthUnits
488
569
  }
489
570
  };
490
- const resolvedOptions = defuOverrideArray2(
571
+ const mergedOptions = defuOverrideArray2(
491
572
  normalizedUserOptions ?? {},
492
573
  baseOptions
493
574
  );
494
- if (resolvedOptions.tailwind) {
495
- const existingResolve = resolvedOptions.tailwind.resolve ?? {};
575
+ const resolvedOptions = toModernTailwindcssPatchOptions(mergedOptions) ?? {};
576
+ const resolvedTailwindOptions = resolvedOptions.tailwindcss;
577
+ if (resolvedTailwindOptions) {
578
+ const existingResolve = resolvedTailwindOptions.resolve ?? {};
496
579
  const customPaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0;
497
580
  const sourcePaths = customPaths ? existingResolve.paths : resolvePaths;
498
- resolvedOptions.tailwind.resolve = {
581
+ resolvedTailwindOptions.resolve = {
499
582
  ...existingResolve,
500
583
  paths: Array.from(new Set(sourcePaths))
501
584
  };
502
585
  logger3.debug("Tailwind resolve config %O", {
503
- packageName: resolvedOptions.tailwind.packageName,
504
- version: resolvedOptions.tailwind.version,
505
- resolve: resolvedOptions.tailwind.resolve,
506
- cwd: resolvedOptions.tailwind.cwd
586
+ packageName: resolvedTailwindOptions.packageName,
587
+ version: resolvedTailwindOptions.version,
588
+ resolve: resolvedTailwindOptions.resolve,
589
+ cwd: resolvedTailwindOptions.cwd
507
590
  });
508
- if (typeof resolvedOptions.tailwind.postcssPlugin === "string") {
591
+ if (typeof resolvedTailwindOptions.postcssPlugin === "string") {
509
592
  const resolvedPlugin = resolveModuleFromPaths(
510
- resolvedOptions.tailwind.postcssPlugin,
511
- resolvedOptions.tailwind.resolve?.paths ?? resolvePaths
593
+ resolvedTailwindOptions.postcssPlugin,
594
+ resolvedTailwindOptions.resolve?.paths ?? resolvePaths
512
595
  );
513
596
  if (resolvedPlugin) {
514
- resolvedOptions.tailwind.postcssPlugin = resolvedPlugin;
597
+ resolvedTailwindOptions.postcssPlugin = resolvedPlugin;
515
598
  }
516
599
  }
517
600
  const searchRoots = /* @__PURE__ */ new Set();
518
- if (resolvedOptions.tailwind.cwd) {
519
- searchRoots.add(resolvedOptions.tailwind.cwd);
601
+ if (resolvedTailwindOptions.cwd) {
602
+ searchRoots.add(resolvedTailwindOptions.cwd);
520
603
  }
521
- for (const resolvePath of resolvedOptions.tailwind.resolve?.paths ?? []) {
604
+ for (const resolvePath of resolvedTailwindOptions.resolve?.paths ?? []) {
522
605
  const parentDir = path3.dirname(resolvePath);
523
606
  searchRoots.add(parentDir);
524
607
  }
525
608
  const configPath = findTailwindConfig(searchRoots);
526
- if (!resolvedOptions.tailwind.config) {
609
+ if (!resolvedTailwindOptions.config) {
527
610
  if (configPath) {
528
- resolvedOptions.tailwind.config = configPath;
611
+ resolvedTailwindOptions.config = configPath;
529
612
  } else {
530
613
  const fallbackConfig = resolveTailwindConfigFallback(
531
- resolvedOptions.tailwind.packageName,
532
- resolvedOptions.tailwind.resolve.paths ?? resolvePaths
614
+ resolvedTailwindOptions.packageName,
615
+ resolvedTailwindOptions.resolve.paths ?? resolvePaths
533
616
  );
534
617
  if (fallbackConfig) {
535
- resolvedOptions.tailwind.config = fallbackConfig;
618
+ resolvedTailwindOptions.config = fallbackConfig;
536
619
  }
537
620
  }
538
621
  }
539
- if (!resolvedOptions.tailwind.cwd && configPath) {
540
- resolvedOptions.tailwind.cwd = path3.dirname(configPath);
622
+ if (!resolvedTailwindOptions.cwd && configPath) {
623
+ resolvedTailwindOptions.cwd = path3.dirname(configPath);
541
624
  }
625
+ resolvedOptions.tailwindcss = resolvedTailwindOptions;
542
626
  }
543
627
  try {
544
628
  return new TailwindcssPatcher(resolvedOptions);
545
629
  } catch (error) {
546
- const searchPaths = resolvedOptions.tailwind?.resolve?.paths;
630
+ const searchPaths = resolvedOptions.tailwindcss?.resolve?.paths;
547
631
  if (error instanceof Error && /tailwindcss not found/i.test(error.message)) {
548
632
  if (!hasLoggedMissingTailwind) {
549
633
  logger3.warn("Tailwind CSS \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7 Tailwind \u76F8\u5173\u8865\u4E01\u3002\u82E5\u9700\u4F7F\u7528 Tailwind \u80FD\u529B\uFF0C\u8BF7\u5B89\u88C5 tailwindcss\u3002");
@@ -552,7 +636,7 @@ function createTailwindcssPatcher(options) {
552
636
  return createFallbackTailwindcssPatcher();
553
637
  }
554
638
  if (error instanceof Error && /unable to locate tailwind css package/i.test(error.message)) {
555
- logger3.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', resolvedOptions.tailwind?.packageName, searchPaths);
639
+ logger3.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', resolvedOptions.tailwindcss?.packageName, searchPaths);
556
640
  }
557
641
  throw error;
558
642
  }
@@ -694,17 +778,19 @@ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries)
694
778
  if (!isModernTailwindcssPatchOptions(options)) {
695
779
  return options;
696
780
  }
697
- if (!options.tailwind) {
781
+ const modernTailwind = options.tailwindcss ?? options.tailwind;
782
+ if (!modernTailwind) {
698
783
  return options;
699
784
  }
785
+ const { tailwind: _legacyTailwind, ...rest } = options;
700
786
  return {
701
- ...options,
702
- tailwind: {
703
- ...options.tailwind,
787
+ ...rest,
788
+ tailwindcss: {
789
+ ...modernTailwind,
704
790
  v4: {
705
- ...options.tailwind.v4 ?? {},
706
- ...hasCssEntries ? {} : { base: options.tailwind.v4?.base ?? baseDir },
707
- cssEntries: hasCssEntries ? cssEntries : options.tailwind.v4?.cssEntries ?? cssEntries
791
+ ...modernTailwind.v4 ?? {},
792
+ ...hasCssEntries ? {} : { base: modernTailwind.v4?.base ?? baseDir },
793
+ cssEntries: hasCssEntries ? cssEntries : modernTailwind.v4?.cssEntries ?? cssEntries
708
794
  }
709
795
  }
710
796
  };
@@ -843,8 +929,8 @@ function createPatcherForBase(baseDir, cssEntries, options) {
843
929
  baseDir,
844
930
  cssEntries ?? []
845
931
  );
846
- const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwind?.packageName || tailwindcssPatcherOptions?.patch?.tailwindcss?.packageName;
847
- const configuredVersion = tailwindcss?.version || tailwindcssPatcherOptions?.tailwind?.version || tailwindcssPatcherOptions?.patch?.tailwindcss?.version || mergedTailwindOptions.version;
932
+ const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwind?.packageName || tailwindcssPatcherOptions?.patch?.tailwindcss?.packageName;
933
+ const configuredVersion = tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || tailwindcssPatcherOptions?.tailwind?.version || tailwindcssPatcherOptions?.patch?.tailwindcss?.version || mergedTailwindOptions.version;
848
934
  const isTailwindcss4Package = (packageName) => Boolean(
849
935
  packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4"))
850
936
  );
@@ -3,7 +3,7 @@
3
3
  var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
4
4
 
5
5
 
6
- var _chunkUCDOKKRHjs = require('./chunk-UCDOKKRH.js');
6
+ var _chunkAAVDJYEEjs = require('./chunk-AAVDJYEE.js');
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -154,8 +154,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
154
154
  if (!options.enabled) {
155
155
  return;
156
156
  }
157
- compiler.hooks.normalModuleFactory.tap(_chunkUCDOKKRHjs.pluginName, (factory) => {
158
- factory.hooks.beforeResolve.tap(_chunkUCDOKKRHjs.pluginName, (data) => {
157
+ compiler.hooks.normalModuleFactory.tap(_chunkAAVDJYEEjs.pluginName, (factory) => {
158
+ factory.hooks.beforeResolve.tap(_chunkAAVDJYEEjs.pluginName, (data) => {
159
159
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
160
160
  });
161
161
  });
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-RRHPTTCP.mjs";
13
13
  import {
14
14
  setupPatchRecorder
15
- } from "./chunk-AGF55OIE.mjs";
15
+ } from "./chunk-PBA2SZ3H.mjs";
16
16
  import {
17
17
  collectRuntimeClassSet,
18
18
  createAttributeMatcher,
@@ -24,7 +24,7 @@ import {
24
24
  replaceWxml,
25
25
  toCustomAttributesEntities,
26
26
  vitePluginName
27
- } from "./chunk-D3I6GQUV.mjs";
27
+ } from "./chunk-2VVKFR3W.mjs";
28
28
  import {
29
29
  resolveUniUtsPlatform
30
30
  } from "./chunk-OOHJLO5M.mjs";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-F2CKKG6Q.mjs";
4
4
  import {
5
5
  pluginName
6
- } from "./chunk-D3I6GQUV.mjs";
6
+ } from "./chunk-2VVKFR3W.mjs";
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  import path2 from "path";
@@ -10,7 +10,7 @@ import {
10
10
  isMpx,
11
11
  patchMpxLoaderResolve,
12
12
  setupMpxTailwindcssRedirect
13
- } from "./chunk-Q7TIBSU2.mjs";
13
+ } from "./chunk-TIZBA67F.mjs";
14
14
  import {
15
15
  pushConcurrentTaskFactories,
16
16
  resolveDisabledOptions,
@@ -23,14 +23,14 @@ import {
23
23
  } from "./chunk-RRHPTTCP.mjs";
24
24
  import {
25
25
  setupPatchRecorder
26
- } from "./chunk-AGF55OIE.mjs";
26
+ } from "./chunk-PBA2SZ3H.mjs";
27
27
  import {
28
28
  createDebug,
29
29
  ensureRuntimeClassSet,
30
30
  getCompilerContext,
31
31
  getRuntimeClassSetSignature,
32
32
  pluginName
33
- } from "./chunk-D3I6GQUV.mjs";
33
+ } from "./chunk-2VVKFR3W.mjs";
34
34
  import {
35
35
  getGroupedEntries
36
36
  } from "./chunk-OOHJLO5M.mjs";
@@ -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 _chunkUCDOKKRHjs = require('./chunk-UCDOKKRH.js');
4
+ var _chunkAAVDJYEEjs = require('./chunk-AAVDJYEE.js');
5
5
 
6
6
 
7
- var _chunk3RGU475Cjs = require('./chunk-3RGU475C.js');
7
+ var _chunk5APD2MNVjs = require('./chunk-5APD2MNV.js');
8
8
 
9
9
  // src/tailwindcss/recorder.ts
10
10
  function setupPatchRecorder(patcher, baseDir, options) {
11
- const recorder = _chunkUCDOKKRHjs.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
11
+ const recorder = _chunkAAVDJYEEjs.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
- _chunk3RGU475Cjs.logger.info("%s%s", prefix, recorder.message);
14
+ _chunk5APD2MNVjs.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 ? _chunkUCDOKKRHjs.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
19
+ const patchPromise = patcher ? _chunkAAVDJYEEjs.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
20
20
  return {
21
21
  recorder,
22
22
  patchPromise,
package/dist/cli.js CHANGED
@@ -3,11 +3,11 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkUCDOKKRHjs = require('./chunk-UCDOKKRH.js');
6
+ var _chunkAAVDJYEEjs = require('./chunk-AAVDJYEE.js');
7
7
 
8
8
 
9
9
 
10
- var _chunk3RGU475Cjs = require('./chunk-3RGU475C.js');
10
+ var _chunk5APD2MNVjs = require('./chunk-5APD2MNV.js');
11
11
  require('./chunk-LBZCKOMT.js');
12
12
  require('./chunk-DYLQ6UOI.js');
13
13
  require('./chunk-DBAAU4LK.js');
@@ -134,7 +134,7 @@ function resolvePatchDefaultCwd(currentCwd = _process2.default.cwd()) {
134
134
  if (explicitCwd) {
135
135
  return explicitCwd;
136
136
  }
137
- const workspaceRoot = _chunk3RGU475Cjs.findWorkspaceRoot.call(void 0, baseDir);
137
+ const workspaceRoot = _chunk5APD2MNVjs.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
- _chunk3RGU475Cjs.logger.error(error.message);
159
+ _chunk5APD2MNVjs.logger.error(error.message);
160
160
  if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
161
- _chunk3RGU475Cjs.logger.error(error.stack);
161
+ _chunk5APD2MNVjs.logger.error(error.stack);
162
162
  }
163
163
  } else {
164
- _chunk3RGU475Cjs.logger.error(String(error));
164
+ _chunk5APD2MNVjs.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
- _chunk3RGU475Cjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
195
+ _chunk5APD2MNVjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
196
196
  if (applied.length) {
197
- _chunk3RGU475Cjs.logger.success("Applied:");
197
+ _chunk5APD2MNVjs.logger.success("Applied:");
198
198
  applied.forEach((entry) => {
199
- _chunk3RGU475Cjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
199
+ _chunk5APD2MNVjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
200
200
  });
201
201
  }
202
202
  if (pending.length) {
203
- _chunk3RGU475Cjs.logger.warn("Needs attention:");
203
+ _chunk5APD2MNVjs.logger.warn("Needs attention:");
204
204
  pending.forEach((entry) => {
205
205
  const details = entry.reason ? ` - ${entry.reason}` : "";
206
- _chunk3RGU475Cjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
206
+ _chunk5APD2MNVjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
207
207
  });
208
208
  } else {
209
- _chunk3RGU475Cjs.logger.success("All applicable patches are applied.");
209
+ _chunk5APD2MNVjs.logger.success("All applicable patches are applied.");
210
210
  }
211
211
  if (skipped.length) {
212
- _chunk3RGU475Cjs.logger.info("Skipped:");
212
+ _chunk5APD2MNVjs.logger.info("Skipped:");
213
213
  skipped.forEach((entry) => {
214
214
  const details = entry.reason ? ` - ${entry.reason}` : "";
215
- _chunk3RGU475Cjs.logger.info(` - ${entry.name}${details}`);
215
+ _chunk5APD2MNVjs.logger.info(` - ${entry.name}${details}`);
216
216
  });
217
217
  }
218
218
  }
@@ -225,12 +225,12 @@ var DEFAULT_EXTEND_LENGTH_UNITS_FEATURE = {
225
225
  };
226
226
  function withDefaultExtendLengthUnits(options) {
227
227
  const normalized = _nullishCoalesce(options, () => ( {}));
228
- const extendLengthUnits = _optionalChain([normalized, 'access', _3 => _3.features, 'optionalAccess', _4 => _4.extendLengthUnits]);
228
+ const extendLengthUnits = _optionalChain([normalized, 'access', _3 => _3.apply, 'optionalAccess', _4 => _4.extendLengthUnits]);
229
229
  if (extendLengthUnits == null) {
230
230
  return {
231
231
  ...normalized,
232
- features: {
233
- ..._nullishCoalesce(normalized.features, () => ( {})),
232
+ apply: {
233
+ ..._nullishCoalesce(normalized.apply, () => ( {})),
234
234
  extendLengthUnits: DEFAULT_EXTEND_LENGTH_UNITS_FEATURE
235
235
  }
236
236
  };
@@ -238,11 +238,11 @@ function withDefaultExtendLengthUnits(options) {
238
238
  return normalized;
239
239
  }
240
240
  function buildExtendLengthUnitsOverride(options) {
241
- const extendLengthUnits = _optionalChain([options, 'optionalAccess', _5 => _5.features, 'optionalAccess', _6 => _6.extendLengthUnits]);
241
+ const extendLengthUnits = _optionalChain([options, 'optionalAccess', _5 => _5.apply, 'optionalAccess', _6 => _6.extendLengthUnits]);
242
242
  if (extendLengthUnits == null) {
243
243
  return {
244
- features: {
245
- ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _7 => _7.features]), () => ( {})),
244
+ apply: {
245
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _7 => _7.apply]), () => ( {})),
246
246
  extendLengthUnits: DEFAULT_EXTEND_LENGTH_UNITS_FEATURE
247
247
  }
248
248
  };
@@ -377,14 +377,14 @@ function summarizeWorkspaceResults(results) {
377
377
  const patched = results.filter((result) => result.status === "patched").length;
378
378
  const skipped = results.filter((result) => result.status === "skipped").length;
379
379
  const failed = results.filter((result) => result.status === "failed").length;
380
- _chunk3RGU475Cjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
380
+ _chunk5APD2MNVjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
381
381
  }
382
382
 
383
383
  // src/cli/workspace/patch-package.ts
384
384
  function createWorkspacePatcher(cwd) {
385
385
  const normalized = _tailwindcsspatch.normalizeOptions.call(void 0,
386
386
  withDefaultExtendLengthUnits({
387
- cwd
387
+ projectRoot: cwd
388
388
  })
389
389
  );
390
390
  return new (0, _tailwindcsspatch.TailwindcssPatcher)(normalized);
@@ -393,7 +393,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
393
393
  const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
394
394
  const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
395
395
  if (!_optionalChain([tailwindInfo, 'optionalAccess', _11 => _11.rootPath])) {
396
- _chunk3RGU475Cjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
396
+ _chunk5APD2MNVjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
397
397
  return {
398
398
  dir,
399
399
  name: pkgName,
@@ -404,23 +404,23 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
404
404
  try {
405
405
  const patcher = createWorkspacePatcher(dir);
406
406
  if (options.clearCache) {
407
- await _chunkUCDOKKRHjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
407
+ await _chunkAAVDJYEEjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
408
408
  }
409
- const recorder = _chunkUCDOKKRHjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
409
+ const recorder = _chunkAAVDJYEEjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
410
410
  source: "cli",
411
411
  cwd: dir,
412
412
  recordTarget: options.recordTarget !== false,
413
413
  alwaysRecord: true
414
414
  });
415
415
  if (_optionalChain([recorder, 'optionalAccess', _12 => _12.message])) {
416
- _chunk3RGU475Cjs.logger.info("[workspace] %s %s", displayName, recorder.message);
416
+ _chunk5APD2MNVjs.logger.info("[workspace] %s %s", displayName, recorder.message);
417
417
  }
418
- _chunkUCDOKKRHjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
418
+ _chunkAAVDJYEEjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
419
419
  await patcher.patch();
420
420
  if (_optionalChain([recorder, 'optionalAccess', _13 => _13.onPatched])) {
421
421
  await recorder.onPatched();
422
422
  }
423
- _chunk3RGU475Cjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
423
+ _chunk5APD2MNVjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
424
424
  return {
425
425
  dir,
426
426
  name: pkgName,
@@ -431,7 +431,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
431
431
  const reason = error instanceof Error ? error.message : String(error);
432
432
  const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
433
433
  const message = `${reason}\uFF0C${suggestion}`;
434
- _chunk3RGU475Cjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
434
+ _chunk5APD2MNVjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
435
435
  return {
436
436
  dir,
437
437
  name: pkgName,
@@ -444,10 +444,10 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
444
444
  // src/cli/workspace.ts
445
445
  async function patchWorkspace(options) {
446
446
  const cwd = _nullishCoalesce(options.cwd, () => ( _process2.default.cwd()));
447
- const workspaceRoot = _nullishCoalesce(_chunk3RGU475Cjs.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
447
+ const workspaceRoot = _nullishCoalesce(_chunk5APD2MNVjs.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
448
448
  const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
449
449
  if (packageDirs.length === 0) {
450
- _chunk3RGU475Cjs.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
450
+ _chunk5APD2MNVjs.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
451
451
  return;
452
452
  }
453
453
  const results = [];
@@ -462,12 +462,12 @@ async function patchWorkspace(options) {
462
462
  // src/cli/mount-options.ts
463
463
  function handleCliError2(error) {
464
464
  if (error instanceof Error) {
465
- _chunk3RGU475Cjs.logger.error(error.message);
465
+ _chunk5APD2MNVjs.logger.error(error.message);
466
466
  if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
467
- _chunk3RGU475Cjs.logger.error(error.stack);
467
+ _chunk5APD2MNVjs.logger.error(error.stack);
468
468
  }
469
469
  } else {
470
- _chunk3RGU475Cjs.logger.error(String(error));
470
+ _chunk5APD2MNVjs.logger.error(String(error));
471
471
  }
472
472
  }
473
473
  function withCommandErrorHandling(handler) {
@@ -546,26 +546,26 @@ var mountOptions = {
546
546
  }
547
547
  const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
548
548
  if (shouldClearCache) {
549
- await _chunkUCDOKKRHjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
549
+ await _chunkAAVDJYEEjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
550
550
  }
551
- const recorder = _chunkUCDOKKRHjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
551
+ const recorder = _chunkAAVDJYEEjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
552
552
  source: "cli",
553
553
  cwd: ctx.cwd,
554
554
  recordTarget: shouldRecordTarget,
555
555
  alwaysRecord: true
556
556
  });
557
557
  if (_optionalChain([recorder, 'optionalAccess', _15 => _15.message])) {
558
- _chunk3RGU475Cjs.logger.info(recorder.message);
558
+ _chunk5APD2MNVjs.logger.info(recorder.message);
559
559
  }
560
- _chunkUCDOKKRHjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
560
+ _chunkAAVDJYEEjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
561
561
  await patcher.patch();
562
562
  if (_optionalChain([recorder, 'optionalAccess', _16 => _16.onPatched])) {
563
563
  const recordPath = await recorder.onPatched();
564
564
  if (recordPath) {
565
- _chunk3RGU475Cjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
565
+ _chunk5APD2MNVjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
566
566
  }
567
567
  }
568
- _chunk3RGU475Cjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
568
+ _chunk5APD2MNVjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
569
569
  }),
570
570
  extract: withCommandErrorHandling(async (_ctx, next) => next()),
571
571
  tokens: withCommandErrorHandling(async (_ctx, next) => next()),
@@ -574,7 +574,7 @@ var mountOptions = {
574
574
  const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
575
575
  const report = await patcher.getPatchStatus();
576
576
  if (ctx.args.json) {
577
- _chunk3RGU475Cjs.logger.log(JSON.stringify(report, null, 2));
577
+ _chunk5APD2MNVjs.logger.log(JSON.stringify(report, null, 2));
578
578
  return report;
579
579
  }
580
580
  logPatchStatusReport(report);
@@ -705,9 +705,9 @@ async function generateVscodeIntellisenseEntry(options) {
705
705
 
706
706
  // src/cli.ts
707
707
  _process2.default.title = "node (weapp-tailwindcss)";
708
- if (_semver2.default.lt(_process2.default.versions.node, _chunkUCDOKKRHjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
709
- _chunk3RGU475Cjs.logger.warn(
710
- `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkUCDOKKRHjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
708
+ if (_semver2.default.lt(_process2.default.versions.node, _chunkAAVDJYEEjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
709
+ _chunk5APD2MNVjs.logger.warn(
710
+ `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkAAVDJYEEjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
711
711
  );
712
712
  }
713
713
  var cli = _tailwindcsspatch.createTailwindcssPatchCli.call(void 0, {
@@ -732,7 +732,7 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
732
732
  sources,
733
733
  force
734
734
  });
735
- _chunk3RGU475Cjs.logger.success(
735
+ _chunk5APD2MNVjs.logger.success(
736
736
  `VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
737
737
  );
738
738
  })