weapp-tailwindcss 4.11.1 → 4.12.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 (67) hide show
  1. package/README.md +38 -0
  2. package/dist/{chunk-VOCOKTZW.js → chunk-4LBAL3RE.js} +117 -119
  3. package/dist/{chunk-ZUV5AZRB.mjs → chunk-5CF3HTTN.mjs} +1 -1
  4. package/dist/{chunk-OMARW5NC.mjs → chunk-AYJ4HLWZ.mjs} +4 -2
  5. package/dist/{chunk-SV55AOBL.mjs → chunk-C2E5ZLNI.mjs} +12 -7
  6. package/dist/{chunk-6YV5WADN.js → chunk-CAZQZPMY.js} +45 -40
  7. package/dist/{chunk-Q2HTQFI4.js → chunk-CTGWJGKJ.js} +5 -5
  8. package/dist/{chunk-7LKMJZD2.js → chunk-GMKSBLNY.js} +2 -2
  9. package/dist/{chunk-EFBQ4SQR.mjs → chunk-HL3US2OT.mjs} +1 -1
  10. package/dist/{chunk-Y6JUVWRU.js → chunk-IUYO6NQO.js} +10 -6
  11. package/dist/{chunk-WSMWD4MC.mjs → chunk-JRLWGMVZ.mjs} +6 -2
  12. package/dist/{chunk-QK6VNNNL.js → chunk-NIS74SI6.js} +8 -6
  13. package/dist/{chunk-CRDOWYG4.js → chunk-ONLKZIRQ.js} +1 -1
  14. package/dist/{chunk-SSASUP5F.js → chunk-RQWWSU4U.js} +187 -82
  15. package/dist/{chunk-KX2JVTVM.mjs → chunk-V34LWQTS.mjs} +49 -51
  16. package/dist/{chunk-4O2J5ZM6.mjs → chunk-ZABCOAAS.mjs} +195 -90
  17. package/dist/cli.js +121 -81
  18. package/dist/cli.mjs +121 -81
  19. package/dist/core.d.mts +1 -1
  20. package/dist/core.d.ts +1 -1
  21. package/dist/core.js +14 -9
  22. package/dist/core.mjs +10 -5
  23. package/dist/css-macro/postcss.js +1 -1
  24. package/dist/css-macro/postcss.mjs +1 -1
  25. package/dist/css-macro.js +1 -1
  26. package/dist/css-macro.mjs +1 -1
  27. package/dist/defaults.d.mts +1 -1
  28. package/dist/defaults.d.ts +1 -1
  29. package/dist/defaults.js +1 -1
  30. package/dist/defaults.mjs +1 -1
  31. package/dist/gulp.d.mts +1 -1
  32. package/dist/gulp.d.ts +1 -1
  33. package/dist/gulp.js +5 -5
  34. package/dist/gulp.mjs +4 -4
  35. package/dist/{index-CoXntW_P.d.mts → index-BXrmQelt.d.mts} +29 -1
  36. package/dist/{index-CoXntW_P.d.ts → index-BXrmQelt.d.ts} +29 -1
  37. package/dist/index.d.mts +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.js +9 -9
  40. package/dist/index.mjs +7 -7
  41. package/dist/postcss-html-transform.js +1 -1
  42. package/dist/postcss-html-transform.mjs +1 -1
  43. package/dist/presets.d.mts +8 -1
  44. package/dist/presets.d.ts +8 -1
  45. package/dist/presets.js +7 -6
  46. package/dist/presets.mjs +3 -2
  47. package/dist/reset.d.mts +1 -31
  48. package/dist/reset.d.ts +3 -32
  49. package/dist/reset.js +3 -160
  50. package/dist/reset.mjs +3 -160
  51. package/dist/types.d.mts +2 -2
  52. package/dist/types.d.ts +2 -2
  53. package/dist/types.js +1 -1
  54. package/dist/types.mjs +1 -1
  55. package/dist/vite.d.mts +1 -1
  56. package/dist/vite.d.ts +1 -1
  57. package/dist/vite.js +6 -6
  58. package/dist/vite.mjs +4 -4
  59. package/dist/webpack.d.mts +1 -1
  60. package/dist/webpack.d.ts +1 -1
  61. package/dist/webpack.js +7 -7
  62. package/dist/webpack.mjs +5 -5
  63. package/dist/webpack4.d.mts +1 -1
  64. package/dist/webpack4.d.ts +1 -1
  65. package/dist/webpack4.js +41 -36
  66. package/dist/webpack4.mjs +12 -7
  67. package/package.json +8 -4
package/dist/cli.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  // src/cli.ts
2
- import process17 from "process";
2
+ import process18 from "process";
3
3
  import semver from "semver";
4
4
  import { createTailwindcssPatchCli } from "tailwindcss-patch";
5
5
 
6
6
  // src/cli/context.ts
7
7
  import path12 from "path";
8
- import process11 from "process";
8
+ import process12 from "process";
9
9
 
10
10
  // src/context/index.ts
11
11
  import { rm } from "fs/promises";
12
- import { logger as logger10, pc } from "@weapp-tailwindcss/logger";
12
+ import { logger as logger11 } from "@weapp-tailwindcss/logger";
13
13
 
14
14
  // src/cache/index.ts
15
15
  import { LRUCache } from "lru-cache";
@@ -53,9 +53,38 @@ import { statSync } from "fs";
53
53
  // src/tailwindcss/runtime.ts
54
54
  var debug = createDebug("[tailwindcss:runtime] ");
55
55
 
56
+ // src/tailwindcss/runtime-logs.ts
57
+ import process3 from "process";
58
+ import { logger, pc } from "@weapp-tailwindcss/logger";
59
+ var runtimeLogDedupeHolder = globalThis;
60
+ var runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
61
+ function createRuntimeLogKey(category, baseDir, rootPath, version) {
62
+ return JSON.stringify([
63
+ category,
64
+ baseDir ?? process3.cwd(),
65
+ rootPath ?? "",
66
+ version ?? ""
67
+ ]);
68
+ }
69
+ function markRuntimeLog(category, baseDir, rootPath, version) {
70
+ const key = createRuntimeLogKey(category, baseDir, rootPath, version);
71
+ if (runtimeLogDedupe.has(key)) {
72
+ return false;
73
+ }
74
+ runtimeLogDedupe.add(key);
75
+ return true;
76
+ }
77
+ function logRuntimeTailwindcssTarget(baseDir, rootPath, version) {
78
+ if (!markRuntimeLog("target", baseDir, rootPath, version)) {
79
+ return;
80
+ }
81
+ const versionText = version ? ` (v${version})` : "";
82
+ logger.info("%s \u4F7F\u7528 Tailwind CSS%s", "Weapp-tailwindcss", versionText);
83
+ }
84
+
56
85
  // src/tailwindcss/targets.ts
57
- import process5 from "process";
58
- import { logger as logger2 } from "@weapp-tailwindcss/logger";
86
+ import process6 from "process";
87
+ import { logger as logger3 } from "@weapp-tailwindcss/logger";
59
88
 
60
89
  // src/tailwindcss/targets/paths.ts
61
90
  import { existsSync as existsSync2 } from "fs";
@@ -149,13 +178,13 @@ function getRecordFileCandidates(baseDir) {
149
178
  import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
150
179
  import { mkdir, writeFile } from "fs/promises";
151
180
  import path4 from "path";
152
- import process3 from "process";
153
- import { logger } from "@weapp-tailwindcss/logger";
181
+ import process4 from "process";
182
+ import { logger as logger2 } from "@weapp-tailwindcss/logger";
154
183
 
155
184
  // package.json
156
185
  var package_default = {
157
186
  name: "weapp-tailwindcss",
158
- version: "4.11.1",
187
+ version: "4.12.0-alpha.1",
159
188
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
160
189
  author: "ice breaker <1324318532@qq.com>",
161
190
  license: "MIT",
@@ -357,6 +386,7 @@ var package_default = {
357
386
  "@weapp-core/regex": "~1.0.1",
358
387
  "@weapp-tailwindcss/logger": "workspace:*",
359
388
  "@weapp-tailwindcss/postcss": "workspace:*",
389
+ "@weapp-tailwindcss/reset": "workspace:*",
360
390
  "@weapp-tailwindcss/shared": "workspace:*",
361
391
  cac: "6.7.14",
362
392
  "comment-json": "^4.6.2",
@@ -371,6 +401,9 @@ var package_default = {
371
401
  "tailwindcss-patch": "catalog:tailwindcssPatch",
372
402
  "webpack-sources": "3.3.4",
373
403
  yaml: "^2.8.3"
404
+ },
405
+ devDependencies: {
406
+ "fast-check": "^4.7.0"
374
407
  }
375
408
  };
376
409
 
@@ -387,9 +420,9 @@ function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
387
420
  }
388
421
  loggedInvalidPatchRecords.add(normalizedPath);
389
422
  const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
390
- const baseDisplay = formatRelativeToBase(path4.normalize(baseDir), process3.cwd());
423
+ const baseDisplay = formatRelativeToBase(path4.normalize(baseDir), process4.cwd());
391
424
  const reasonMessage = reason ? `\uFF1A${reason}` : "";
392
- logger.warn(
425
+ logger2.warn(
393
426
  `\u68C0\u6D4B\u5230\u635F\u574F\u7684 Tailwind CSS \u76EE\u6807\u8BB0\u5F55 ${fileDisplay}${reasonMessage}\u3002\u8BF7\u5728 ${baseDisplay} \u91CD\u65B0\u6267\u884C "weapp-tw patch --record-target" \u6216\u5220\u9664\u8BE5\u6587\u4EF6\u540E\u518D\u8FD0\u884C\u3002`
394
427
  );
395
428
  }
@@ -446,23 +479,23 @@ async function saveCliPatchTargetRecord(baseDir, patcher, options) {
446
479
  `, "utf8");
447
480
  return recordPath;
448
481
  } catch (error) {
449
- const baseDisplay = formatRelativeToBase(normalizedBase, process3.cwd());
450
- logger.warn(
482
+ const baseDisplay = formatRelativeToBase(normalizedBase, process4.cwd());
483
+ logger2.warn(
451
484
  '\u81EA\u52A8\u66F4\u65B0 Tailwind CSS \u8865\u4E01\u8BB0\u5F55\u5931\u8D25\uFF0C\u8BF7\u5728 %s \u8FD0\u884C "weapp-tw patch --cwd %s"\u3002',
452
485
  baseDisplay,
453
486
  normalizedBase
454
487
  );
455
- logger.debug("failed to persist patch target record %s: %O", recordPath, error);
488
+ logger2.debug("failed to persist patch target record %s: %O", recordPath, error);
456
489
  return void 0;
457
490
  }
458
491
  }
459
492
 
460
493
  // src/tailwindcss/targets/recorder.ts
461
494
  import path5 from "path";
462
- import process4 from "process";
495
+ import process5 from "process";
463
496
  function findPatchTargetRecord(baseDir) {
464
497
  const visited = /* @__PURE__ */ new Set();
465
- const fallback = baseDir ?? process4.cwd();
498
+ const fallback = baseDir ?? process5.cwd();
466
499
  let current = path5.resolve(fallback);
467
500
  while (!visited.has(current)) {
468
501
  const record = readPatchTargetRecord(current);
@@ -540,30 +573,34 @@ function createPatchTargetRecorder(baseDir, patcher, options) {
540
573
  // src/tailwindcss/targets.ts
541
574
  function logTailwindcssTarget(kind, patcher, baseDir) {
542
575
  const packageInfo = patcher?.packageInfo;
543
- const label = kind === "cli" ? "weapp-tw patch" : "tailwindcss-patcher";
576
+ const label = kind === "cli" ? "weapp-tw patch" : "Weapp-tailwindcss";
544
577
  if (!packageInfo?.rootPath) {
545
- logger2.warn(
578
+ logger3.warn(
546
579
  "%s \u672A\u627E\u5230 Tailwind CSS \u4F9D\u8D56\uFF0C\u8BF7\u68C0\u67E5\u5728 %s \u662F\u5426\u5DF2\u5B89\u88C5 tailwindcss",
547
580
  label,
548
- baseDir ?? process5.cwd()
581
+ baseDir ?? process6.cwd()
549
582
  );
550
583
  return;
551
584
  }
552
585
  const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
553
586
  const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
554
- logger2.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
587
+ if (kind === "runtime") {
588
+ logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
589
+ return;
590
+ }
591
+ logger3.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
555
592
  }
556
593
 
557
594
  // src/tailwindcss/v4/config.ts
558
- import { logger as logger3 } from "@weapp-tailwindcss/logger";
595
+ import { logger as logger4 } from "@weapp-tailwindcss/logger";
559
596
 
560
597
  // src/tailwindcss/v4/patcher.ts
561
- import { logger as logger5 } from "@weapp-tailwindcss/logger";
598
+ import { logger as logger6 } from "@weapp-tailwindcss/logger";
562
599
 
563
600
  // src/tailwindcss/patcher.ts
564
601
  import path7 from "path";
565
- import process7 from "process";
566
- import { logger as logger4 } from "@weapp-tailwindcss/logger";
602
+ import process8 from "process";
603
+ import { logger as logger5 } from "@weapp-tailwindcss/logger";
567
604
  import { defuOverrideArray as defuOverrideArray2 } from "@weapp-tailwindcss/shared";
568
605
  import { TailwindcssPatcher } from "tailwindcss-patch";
569
606
 
@@ -571,7 +608,7 @@ import { TailwindcssPatcher } from "tailwindcss-patch";
571
608
  import { existsSync as existsSync4 } from "fs";
572
609
  import { createRequire } from "module";
573
610
  import path6 from "path";
574
- import process6 from "process";
611
+ import process7 from "process";
575
612
  import { fileURLToPath } from "url";
576
613
 
577
614
  // src/tailwindcss/v4/css-entries.ts
@@ -580,14 +617,17 @@ import path8 from "path";
580
617
  // src/context/compiler-context-cache.ts
581
618
  import { Buffer } from "buffer";
582
619
  import path9 from "path";
583
- import process8 from "process";
584
- import { logger as logger6 } from "@weapp-tailwindcss/logger";
620
+ import process9 from "process";
621
+ import { logger as logger7 } from "@weapp-tailwindcss/logger";
585
622
  var globalCacheHolder = globalThis;
586
623
  var compilerContextCache = globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
587
624
 
588
625
  // src/context/handlers.ts
589
626
  import { createStyleHandler } from "@weapp-tailwindcss/postcss";
590
627
 
628
+ // src/js/index.ts
629
+ import { LRUCache as LRUCache3 } from "lru-cache";
630
+
591
631
  // src/babel/index.ts
592
632
  import _babelTraverse from "@babel/traverse";
593
633
  import { parse, parseExpression } from "@babel/parser";
@@ -788,22 +828,22 @@ var Tokenizer = class {
788
828
  var sharedTokenizer = new Tokenizer();
789
829
 
790
830
  // src/context/logger.ts
791
- import { logger as logger7 } from "@weapp-tailwindcss/logger";
831
+ import { logger as logger8 } from "@weapp-tailwindcss/logger";
792
832
 
793
833
  // src/context/tailwindcss.ts
794
- import { logger as logger9 } from "@weapp-tailwindcss/logger";
834
+ import { logger as logger10 } from "@weapp-tailwindcss/logger";
795
835
 
796
836
  // src/context/tailwindcss/basedir.ts
797
837
  import { createRequire as createRequire2 } from "module";
798
838
  import path10 from "path";
799
- import process9 from "process";
839
+ import process10 from "process";
800
840
  import { fileURLToPath as fileURLToPath2 } from "url";
801
- import { logger as logger8 } from "@weapp-tailwindcss/logger";
841
+ import { logger as logger9 } from "@weapp-tailwindcss/logger";
802
842
 
803
843
  // src/context/tailwindcss/rax.ts
804
844
  import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
805
845
  import path11 from "path";
806
- import process10 from "process";
846
+ import process11 from "process";
807
847
 
808
848
  // src/context/index.ts
809
849
  async function clearTailwindcssPatcherCache(patcher, options) {
@@ -818,7 +858,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
818
858
  try {
819
859
  await patcher.clearCache({ scope: "all" });
820
860
  } catch (error) {
821
- logger10.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
861
+ logger11.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
822
862
  }
823
863
  }
824
864
  if (!options?.removeDirectory) {
@@ -847,14 +887,14 @@ async function clearTailwindcssPatcherCache(patcher, options) {
847
887
  if (err?.code === "ENOENT") {
848
888
  continue;
849
889
  }
850
- logger10.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
890
+ logger11.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
851
891
  }
852
892
  }
853
893
  }
854
894
 
855
895
  // src/cli/context.ts
856
896
  function formatOutputPath(target, baseDir) {
857
- const root = baseDir ?? process11.cwd();
897
+ const root = baseDir ?? process12.cwd();
858
898
  const relative = path12.relative(root, target);
859
899
  if (!relative) {
860
900
  return ".";
@@ -867,10 +907,10 @@ function formatOutputPath(target, baseDir) {
867
907
 
868
908
  // src/cli/helpers.ts
869
909
  import { mkdir as mkdir2 } from "fs/promises";
870
- import process14 from "process";
910
+ import process15 from "process";
871
911
 
872
912
  // src/logger/index.ts
873
- import { logger as logger11 } from "@weapp-tailwindcss/logger";
913
+ import { logger as logger12 } from "@weapp-tailwindcss/logger";
874
914
 
875
915
  // src/cli/helpers/options/parse.ts
876
916
  function readStringOption(flag, value) {
@@ -926,18 +966,18 @@ function toBoolean(value, fallback) {
926
966
 
927
967
  // src/cli/helpers/options/resolve.ts
928
968
  import path13 from "path";
929
- import process12 from "process";
969
+ import process13 from "process";
930
970
  function resolveCliCwd(value) {
931
971
  const raw = readStringOption("cwd", value);
932
972
  if (!raw) {
933
973
  return void 0;
934
974
  }
935
- return path13.isAbsolute(raw) ? path13.normalize(raw) : path13.resolve(process12.cwd(), raw);
975
+ return path13.isAbsolute(raw) ? path13.normalize(raw) : path13.resolve(process13.cwd(), raw);
936
976
  }
937
977
 
938
978
  // src/cli/helpers/patch-cwd.ts
939
979
  import path14 from "path";
940
- import process13 from "process";
980
+ import process14 from "process";
941
981
 
942
982
  // src/tailwindcss/index.ts
943
983
  import { getPackageInfoSync } from "local-pkg";
@@ -964,15 +1004,15 @@ function detectTailwindWorkspace(paths) {
964
1004
  }
965
1005
  return void 0;
966
1006
  }
967
- function resolvePatchDefaultCwd(currentCwd = process13.cwd()) {
1007
+ function resolvePatchDefaultCwd(currentCwd = process14.cwd()) {
968
1008
  const baseDir = path14.normalize(currentCwd);
969
- const explicitCwd = normalizeCandidatePath(baseDir, process13.env.WEAPP_TW_PATCH_CWD);
1009
+ const explicitCwd = normalizeCandidatePath(baseDir, process14.env.WEAPP_TW_PATCH_CWD);
970
1010
  if (explicitCwd) {
971
1011
  return explicitCwd;
972
1012
  }
973
1013
  const workspaceRoot = findWorkspaceRoot(baseDir);
974
- const initCwd = normalizeCandidatePath(baseDir, process13.env.INIT_CWD);
975
- const localPrefix = normalizeCandidatePath(baseDir, process13.env.npm_config_local_prefix);
1014
+ const initCwd = normalizeCandidatePath(baseDir, process14.env.INIT_CWD);
1015
+ const localPrefix = normalizeCandidatePath(baseDir, process14.env.npm_config_local_prefix);
976
1016
  const candidates = [
977
1017
  baseDir,
978
1018
  workspaceRoot,
@@ -992,12 +1032,12 @@ async function ensureDir(dir) {
992
1032
  }
993
1033
  function handleCliError(error) {
994
1034
  if (error instanceof Error) {
995
- logger11.error(error.message);
996
- if (error.stack && process14.env.WEAPP_TW_DEBUG === "1") {
997
- logger11.error(error.stack);
1035
+ logger12.error(error.message);
1036
+ if (error.stack && process15.env.WEAPP_TW_DEBUG === "1") {
1037
+ logger12.error(error.stack);
998
1038
  }
999
1039
  } else {
1000
- logger11.error(String(error));
1040
+ logger12.error(String(error));
1001
1041
  }
1002
1042
  }
1003
1043
  function commandAction(handler) {
@@ -1006,13 +1046,13 @@ function commandAction(handler) {
1006
1046
  await handler(...args);
1007
1047
  } catch (error) {
1008
1048
  handleCliError(error);
1009
- process14.exitCode = 1;
1049
+ process15.exitCode = 1;
1010
1050
  }
1011
1051
  };
1012
1052
  }
1013
1053
 
1014
1054
  // src/cli/mount-options.ts
1015
- import process16 from "process";
1055
+ import process17 from "process";
1016
1056
 
1017
1057
  // src/cli/mount-options/patch-status.ts
1018
1058
  function formatStatusFilesHint(files) {
@@ -1028,27 +1068,27 @@ function logPatchStatusReport(report) {
1028
1068
  (entry) => entry.status === "skipped" || entry.status === "unsupported"
1029
1069
  );
1030
1070
  const packageLabel = `${report.package.name ?? "tailwindcss"}@${report.package.version ?? "unknown"}`;
1031
- logger11.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
1071
+ logger12.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
1032
1072
  if (applied.length) {
1033
- logger11.success("Applied:");
1073
+ logger12.success("Applied:");
1034
1074
  applied.forEach((entry) => {
1035
- logger11.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
1075
+ logger12.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
1036
1076
  });
1037
1077
  }
1038
1078
  if (pending.length) {
1039
- logger11.warn("Needs attention:");
1079
+ logger12.warn("Needs attention:");
1040
1080
  pending.forEach((entry) => {
1041
1081
  const details = entry.reason ? ` - ${entry.reason}` : "";
1042
- logger11.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
1082
+ logger12.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
1043
1083
  });
1044
1084
  } else {
1045
- logger11.success("All applicable patches are applied.");
1085
+ logger12.success("All applicable patches are applied.");
1046
1086
  }
1047
1087
  if (skipped.length) {
1048
- logger11.info("Skipped:");
1088
+ logger12.info("Skipped:");
1049
1089
  skipped.forEach((entry) => {
1050
1090
  const details = entry.reason ? ` - ${entry.reason}` : "";
1051
- logger11.info(` - ${entry.name}${details}`);
1091
+ logger12.info(` - ${entry.name}${details}`);
1052
1092
  });
1053
1093
  }
1054
1094
  }
@@ -1088,7 +1128,7 @@ function buildExtendLengthUnitsOverride(options) {
1088
1128
 
1089
1129
  // src/cli/workspace.ts
1090
1130
  import path19 from "path";
1091
- import process15 from "process";
1131
+ import process16 from "process";
1092
1132
 
1093
1133
  // src/cli/workspace/package-dirs.ts
1094
1134
  import { existsSync as existsSync8 } from "fs";
@@ -1215,7 +1255,7 @@ function summarizeWorkspaceResults(results) {
1215
1255
  const patched = results.filter((result) => result.status === "patched").length;
1216
1256
  const skipped = results.filter((result) => result.status === "skipped").length;
1217
1257
  const failed = results.filter((result) => result.status === "failed").length;
1218
- logger11.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
1258
+ logger12.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
1219
1259
  }
1220
1260
 
1221
1261
  // src/cli/workspace/patch-package.ts
@@ -1231,7 +1271,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
1231
1271
  const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
1232
1272
  const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
1233
1273
  if (!tailwindInfo?.rootPath) {
1234
- logger11.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
1274
+ logger12.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
1235
1275
  return {
1236
1276
  dir,
1237
1277
  name: pkgName,
@@ -1251,14 +1291,14 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
1251
1291
  alwaysRecord: true
1252
1292
  });
1253
1293
  if (recorder?.message) {
1254
- logger11.info("[workspace] %s %s", displayName, recorder.message);
1294
+ logger12.info("[workspace] %s %s", displayName, recorder.message);
1255
1295
  }
1256
1296
  logTailwindcssTarget("cli", patcher, dir);
1257
1297
  await patcher.patch();
1258
1298
  if (recorder?.onPatched) {
1259
1299
  await recorder.onPatched();
1260
1300
  }
1261
- logger11.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
1301
+ logger12.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
1262
1302
  return {
1263
1303
  dir,
1264
1304
  name: pkgName,
@@ -1269,7 +1309,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
1269
1309
  const reason = error instanceof Error ? error.message : String(error);
1270
1310
  const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
1271
1311
  const message = `${reason}\uFF0C${suggestion}`;
1272
- logger11.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
1312
+ logger12.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
1273
1313
  return {
1274
1314
  dir,
1275
1315
  name: pkgName,
@@ -1281,11 +1321,11 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
1281
1321
 
1282
1322
  // src/cli/workspace.ts
1283
1323
  async function patchWorkspace(options) {
1284
- const cwd = options.cwd ?? process15.cwd();
1324
+ const cwd = options.cwd ?? process16.cwd();
1285
1325
  const workspaceRoot = findWorkspaceRoot(cwd) ?? cwd;
1286
1326
  const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
1287
1327
  if (packageDirs.length === 0) {
1288
- logger11.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
1328
+ logger12.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
1289
1329
  return;
1290
1330
  }
1291
1331
  const results = [];
@@ -1300,12 +1340,12 @@ async function patchWorkspace(options) {
1300
1340
  // src/cli/mount-options.ts
1301
1341
  function handleCliError2(error) {
1302
1342
  if (error instanceof Error) {
1303
- logger11.error(error.message);
1304
- if (error.stack && process16.env.WEAPP_TW_DEBUG === "1") {
1305
- logger11.error(error.stack);
1343
+ logger12.error(error.message);
1344
+ if (error.stack && process17.env.WEAPP_TW_DEBUG === "1") {
1345
+ logger12.error(error.stack);
1306
1346
  }
1307
1347
  } else {
1308
- logger11.error(String(error));
1348
+ logger12.error(String(error));
1309
1349
  }
1310
1350
  }
1311
1351
  function withCommandErrorHandling(handler) {
@@ -1314,7 +1354,7 @@ function withCommandErrorHandling(handler) {
1314
1354
  return await handler(ctx, next);
1315
1355
  } catch (error) {
1316
1356
  handleCliError2(error);
1317
- process16.exitCode = 1;
1357
+ process17.exitCode = 1;
1318
1358
  return void 0;
1319
1359
  }
1320
1360
  });
@@ -1393,17 +1433,17 @@ var mountOptions = {
1393
1433
  alwaysRecord: true
1394
1434
  });
1395
1435
  if (recorder?.message) {
1396
- logger11.info(recorder.message);
1436
+ logger12.info(recorder.message);
1397
1437
  }
1398
1438
  logTailwindcssTarget("cli", patcher, ctx.cwd);
1399
1439
  await patcher.patch();
1400
1440
  if (recorder?.onPatched) {
1401
1441
  const recordPath = await recorder.onPatched();
1402
1442
  if (recordPath) {
1403
- logger11.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
1443
+ logger12.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
1404
1444
  }
1405
1445
  }
1406
- logger11.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
1446
+ logger12.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
1407
1447
  }),
1408
1448
  extract: withCommandErrorHandling(async (_ctx, next) => next()),
1409
1449
  tokens: withCommandErrorHandling(async (_ctx, next) => next()),
@@ -1412,7 +1452,7 @@ var mountOptions = {
1412
1452
  const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
1413
1453
  const report = await patcher.getPatchStatus();
1414
1454
  if (ctx.args.json) {
1415
- logger11.log(JSON.stringify(report, null, 2));
1455
+ logger12.log(JSON.stringify(report, null, 2));
1416
1456
  return report;
1417
1457
  }
1418
1458
  logPatchStatusReport(report);
@@ -1543,10 +1583,10 @@ async function generateVscodeIntellisenseEntry(options) {
1543
1583
  }
1544
1584
 
1545
1585
  // src/cli.ts
1546
- process17.title = "node (weapp-tailwindcss)";
1547
- if (semver.lt(process17.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
1548
- logger11.warn(
1549
- `You are using Node.js ${process17.versions.node}. For weapp-tailwindcss, Node.js version >= v${WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
1586
+ process18.title = "node (weapp-tailwindcss)";
1587
+ if (semver.lt(process18.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
1588
+ logger12.warn(
1589
+ `You are using Node.js ${process18.versions.node}. For weapp-tailwindcss, Node.js version >= v${WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
1550
1590
  );
1551
1591
  }
1552
1592
  var cli = createTailwindcssPatchCli({
@@ -1556,7 +1596,7 @@ var cli = createTailwindcssPatchCli({
1556
1596
  cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliSense").option("--cwd <dir>", "Working directory").option("--css <file>", "Path to the CSS file that imports weapp-tailwindcss (required)").option("--output <file>", `Helper output path. Defaults to ${DEFAULT_VSCODE_ENTRY_OUTPUT}`).option("--source <pattern>", "Additional @source glob (can be repeated)").option("--force", "Overwrite the helper file when it already exists").action(
1557
1597
  commandAction(async (options) => {
1558
1598
  const resolvedCwd = resolveCliCwd(options.cwd);
1559
- const baseDir = resolvedCwd ?? process17.cwd();
1599
+ const baseDir = resolvedCwd ?? process18.cwd();
1560
1600
  const cssEntry = readStringOption("css", options.css);
1561
1601
  if (!cssEntry) {
1562
1602
  throw new Error('Option "--css" is required.');
@@ -1571,11 +1611,11 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
1571
1611
  sources,
1572
1612
  force
1573
1613
  });
1574
- logger11.success(
1614
+ logger12.success(
1575
1615
  `VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
1576
1616
  );
1577
1617
  })
1578
1618
  );
1579
1619
  cli.help();
1580
- cli.version(process17.env.npm_package_version ?? "0.0.0");
1620
+ cli.version(process18.env.npm_package_version ?? "0.0.0");
1581
1621
  cli.parse();
package/dist/core.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ITemplateHandlerOptions, CreateJsHandlerOptions, JsHandlerResult } from './types.mjs';
2
2
  import * as postcss from 'postcss';
3
- import { e as UserDefinedOptions } from './index-CoXntW_P.mjs';
3
+ import { e as UserDefinedOptions } from './index-BXrmQelt.mjs';
4
4
  import { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
5
5
  import '@babel/parser';
6
6
  import 'magic-string';
package/dist/core.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ITemplateHandlerOptions, CreateJsHandlerOptions, JsHandlerResult } from './types.js';
2
2
  import * as postcss from 'postcss';
3
- import { e as UserDefinedOptions } from './index-CoXntW_P.js';
3
+ import { e as UserDefinedOptions } from './index-BXrmQelt.js';
4
4
  import { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
5
5
  import '@babel/parser';
6
6
  import 'magic-string';
package/dist/core.js CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkSSASUP5Fjs = require('./chunk-SSASUP5F.js');
6
- require('./chunk-QK6VNNNL.js');
5
+
6
+ var _chunkRQWWSU4Ujs = require('./chunk-RQWWSU4U.js');
7
+ require('./chunk-NIS74SI6.js');
7
8
  require('./chunk-A5PB4KZT.js');
8
9
  require('./chunk-DYLQ6UOI.js');
9
- require('./chunk-CRDOWYG4.js');
10
+ require('./chunk-ONLKZIRQ.js');
10
11
 
11
12
  // src/core.ts
12
13
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
@@ -24,9 +25,9 @@ function resolveTransformWxssOptions(options) {
24
25
  return _shared.defuOverrideArray.call(void 0, options, DEFAULT_MAIN_CHUNK_STYLE_OPTIONS);
25
26
  }
26
27
  function createContext(options = {}) {
27
- const opts = _chunkSSASUP5Fjs.getCompilerContext.call(void 0, options);
28
+ const opts = _chunkRQWWSU4Ujs.getCompilerContext.call(void 0, options);
28
29
  const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
29
- const patchRecorderState = _chunkSSASUP5Fjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
30
+ const patchRecorderState = _chunkRQWWSU4Ujs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
30
31
  source: "runtime",
31
32
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
32
33
  });
@@ -143,7 +144,7 @@ function createContext(options = {}) {
143
144
  async function transformWxss(rawCss, options2) {
144
145
  await runtimeState.patchPromise;
145
146
  const result = await styleHandler(rawCss, resolveTransformWxssOptions(options2));
146
- runtimeSet = await _chunkSSASUP5Fjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
147
+ runtimeSet = await _chunkRQWWSU4Ujs.ensureRuntimeClassSet.call(void 0, runtimeState, {
147
148
  forceRefresh: true,
148
149
  forceCollect: true
149
150
  });
@@ -154,16 +155,20 @@ function createContext(options = {}) {
154
155
  if (_optionalChain([options2, 'optionalAccess', _ => _.runtimeSet])) {
155
156
  runtimeSet = options2.runtimeSet;
156
157
  } else if (runtimeSet.size === 0) {
157
- runtimeSet = await _chunkSSASUP5Fjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
158
+ runtimeSet = await _chunkRQWWSU4Ujs.ensureRuntimeClassSet.call(void 0, runtimeState, {
158
159
  forceCollect: true
159
160
  });
160
161
  }
161
- return await jsHandler(rawJs, runtimeSet, resolveTransformJsOptions(options2));
162
+ const resolvedOptions = resolveTransformJsOptions(options2);
163
+ if (_chunkRQWWSU4Ujs.shouldSkipJsTransform.call(void 0, rawJs, resolvedOptions)) {
164
+ return { code: rawJs };
165
+ }
166
+ return await jsHandler(rawJs, runtimeSet, resolvedOptions);
162
167
  }
163
168
  async function transformWxml(rawWxml, options2) {
164
169
  await runtimeState.patchPromise;
165
170
  if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
166
- runtimeSet = await _chunkSSASUP5Fjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
171
+ runtimeSet = await _chunkRQWWSU4Ujs.ensureRuntimeClassSet.call(void 0, runtimeState, {
167
172
  forceCollect: true
168
173
  });
169
174
  }
package/dist/core.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  ensureRuntimeClassSet,
3
3
  getCompilerContext,
4
- setupPatchRecorder
5
- } from "./chunk-4O2J5ZM6.mjs";
6
- import "./chunk-OMARW5NC.mjs";
4
+ setupPatchRecorder,
5
+ shouldSkipJsTransform
6
+ } from "./chunk-ZABCOAAS.mjs";
7
+ import "./chunk-AYJ4HLWZ.mjs";
7
8
  import "./chunk-XAKAD2CR.mjs";
8
9
  import "./chunk-OOHJLO5M.mjs";
9
- import "./chunk-EFBQ4SQR.mjs";
10
+ import "./chunk-HL3US2OT.mjs";
10
11
 
11
12
  // src/core.ts
12
13
  import process from "process";
@@ -158,7 +159,11 @@ function createContext(options = {}) {
158
159
  forceCollect: true
159
160
  });
160
161
  }
161
- return await jsHandler(rawJs, runtimeSet, resolveTransformJsOptions(options2));
162
+ const resolvedOptions = resolveTransformJsOptions(options2);
163
+ if (shouldSkipJsTransform(rawJs, resolvedOptions)) {
164
+ return { code: rawJs };
165
+ }
166
+ return await jsHandler(rawJs, runtimeSet, resolvedOptions);
162
167
  }
163
168
  async function transformWxml(rawWxml, options2) {
164
169
  await runtimeState.patchPromise;
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  var _chunkOYSABARDjs = require('../chunk-OYSABARD.js');
6
- require('../chunk-CRDOWYG4.js');
6
+ require('../chunk-ONLKZIRQ.js');
7
7
 
8
8
  // src/css-macro/postcss.ts
9
9
  var IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
@@ -3,7 +3,7 @@ import {
3
3
  ifndef,
4
4
  matchCustomPropertyFromValue
5
5
  } from "../chunk-2LH6PZH3.mjs";
6
- import "../chunk-EFBQ4SQR.mjs";
6
+ import "../chunk-HL3US2OT.mjs";
7
7
 
8
8
  // src/css-macro/postcss.ts
9
9
  var IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;