weapp-tailwindcss 4.12.0-next.0 → 4.12.0

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/bin/weapp-tailwindcss.js +21 -1
  2. package/dist/{chunk-GMKSBLNY.js → chunk-24AGZQVR.js} +15 -7
  3. package/dist/{chunk-F2CKKG6Q.mjs → chunk-3VQKDHGP.mjs} +12 -4
  4. package/dist/{chunk-F5XJWJYO.mjs → chunk-57SOQCAU.mjs} +5 -5
  5. package/dist/{chunk-GD4SQMVF.mjs → chunk-5ZYHNDEK.mjs} +98 -37
  6. package/dist/{chunk-FMK6SFQQ.js → chunk-DUHYLR2R.js} +7 -7
  7. package/dist/{chunk-OYSABARD.js → chunk-E7I5TW5K.js} +3 -2
  8. package/dist/{chunk-WSS26HZS.js → chunk-FS2NOOEB.js} +5 -5
  9. package/dist/{chunk-GC7WXUOW.js → chunk-HVNGIKLS.js} +55 -31
  10. package/dist/{chunk-LVSUBDJC.js → chunk-JZQBZHN5.js} +39 -39
  11. package/dist/{chunk-QNRJCEZN.mjs → chunk-KGTVD4EP.mjs} +66 -42
  12. package/dist/{chunk-HL3US2OT.mjs → chunk-NNOQDMUP.mjs} +1 -1
  13. package/dist/{chunk-5ONE75V7.js → chunk-OFB2KBRP.js} +175 -114
  14. package/dist/{chunk-AYJ4HLWZ.mjs → chunk-PCDYXXSK.mjs} +11 -4
  15. package/dist/{chunk-ONLKZIRQ.js → chunk-RKISS72P.js} +1 -1
  16. package/dist/{chunk-ZR3KN3FG.mjs → chunk-RRQZL7FQ.mjs} +2 -2
  17. package/dist/{chunk-UUJWDME4.mjs → chunk-XZP3MREK.mjs} +1 -1
  18. package/dist/{chunk-NIS74SI6.js → chunk-ZAA5ZG3D.js} +60 -53
  19. package/dist/{chunk-2LH6PZH3.mjs → chunk-ZCH4YINE.mjs} +3 -2
  20. package/dist/cli.js +2241 -169
  21. package/dist/cli.mjs +2246 -174
  22. package/dist/core.js +9 -9
  23. package/dist/core.mjs +3 -3
  24. package/dist/css-macro/postcss.js +4 -4
  25. package/dist/css-macro/postcss.mjs +2 -2
  26. package/dist/css-macro.js +5 -5
  27. package/dist/css-macro.mjs +2 -2
  28. package/dist/defaults.js +1 -1
  29. package/dist/defaults.mjs +1 -1
  30. package/dist/gulp.js +5 -5
  31. package/dist/gulp.mjs +4 -4
  32. package/dist/index.js +9 -9
  33. package/dist/index.mjs +8 -8
  34. package/dist/postcss-html-transform.js +1 -1
  35. package/dist/postcss-html-transform.mjs +1 -1
  36. package/dist/presets.js +6 -6
  37. package/dist/presets.mjs +2 -2
  38. package/dist/reset.js +1 -1
  39. package/dist/reset.mjs +1 -1
  40. package/dist/types.js +1 -1
  41. package/dist/types.mjs +1 -1
  42. package/dist/vite.js +6 -6
  43. package/dist/vite.mjs +5 -5
  44. package/dist/weapp-tw-css-import-rewrite-loader.js +10 -5
  45. package/dist/weapp-tw-runtime-classset-loader.js +9 -4
  46. package/dist/webpack.js +7 -7
  47. package/dist/webpack.mjs +6 -6
  48. package/dist/webpack4.js +59 -55
  49. package/dist/webpack4.mjs +28 -24
  50. package/package.json +11 -10
  51. package/scripts/postinstall.mjs +59 -0
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkNIS74SI6js = require('./chunk-NIS74SI6.js');
12
+ var _chunkZAA5ZG3Djs = require('./chunk-ZAA5ZG3D.js');
13
13
 
14
14
 
15
15
  var _chunkA5PB4KZTjs = require('./chunk-A5PB4KZT.js');
@@ -40,7 +40,7 @@ var debug = createDebug("[tailwindcss:runtime] ");
40
40
  var refreshTailwindcssPatcherSymbol = /* @__PURE__ */ Symbol.for("weapp-tailwindcss.refreshTailwindcssPatcher");
41
41
  function createTailwindPatchPromise(twPatcher, onPatched) {
42
42
  return Promise.resolve(twPatcher.patch()).then(async () => {
43
- _chunkNIS74SI6js.invalidateRuntimeClassSet.call(void 0, twPatcher);
43
+ _chunkZAA5ZG3Djs.invalidateRuntimeClassSet.call(void 0, twPatcher);
44
44
  if (onPatched) {
45
45
  try {
46
46
  await onPatched();
@@ -95,7 +95,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
95
95
  }
96
96
  await state.patchPromise;
97
97
  const entry = getRuntimeClassSetStateEntry(state);
98
- const signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
98
+ const signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
99
99
  const signatureChanged = entry.signature !== signature;
100
100
  const shouldForceCollect = forceCollect || forceRefresh || signatureChanged;
101
101
  if (!shouldForceCollect) {
@@ -130,7 +130,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
130
130
  try {
131
131
  const runtimeSet = await task;
132
132
  entry.value = runtimeSet;
133
- entry.signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
133
+ entry.signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
134
134
  return runtimeSet;
135
135
  } finally {
136
136
  if (entry.promise === task) {
@@ -187,8 +187,8 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
187
187
  }
188
188
  }
189
189
  }
190
- const entry = _chunkNIS74SI6js.getRuntimeClassSetCacheEntry.call(void 0, activePatcher);
191
- const signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, activePatcher);
190
+ const entry = _chunkZAA5ZG3Djs.getRuntimeClassSetCacheEntry.call(void 0, activePatcher);
191
+ const signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, activePatcher);
192
192
  if (!options.force) {
193
193
  if (entry.value && entry.signature === signature) {
194
194
  return entry.value;
@@ -414,22 +414,25 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
414
414
  var PATCH_INFO_FILENAME = "tailwindcss-target.json";
415
415
  var PATCH_INFO_CACHE_RELATIVE_PATH = _path2.default.join("node_modules", ".cache", "weapp-tailwindcss", PATCH_INFO_FILENAME);
416
416
  var PATCH_INFO_LEGACY_RELATIVE_PATH = _path2.default.join(".tw-patch", PATCH_INFO_FILENAME);
417
+ function toDisplayPath(value) {
418
+ return _path2.default.normalize(value).replace(/\\/g, "/");
419
+ }
417
420
  function formatRelativeToBase(targetPath, baseDir) {
418
421
  if (!baseDir) {
419
- return _path2.default.normalize(targetPath);
422
+ return toDisplayPath(targetPath);
420
423
  }
421
424
  const relative = _path2.default.relative(baseDir, targetPath);
422
425
  if (!relative || relative === ".") {
423
426
  return ".";
424
427
  }
425
428
  if (relative.startsWith("..")) {
426
- return _path2.default.normalize(targetPath);
429
+ return toDisplayPath(targetPath);
427
430
  }
428
- return _path2.default.join(".", relative);
431
+ return toDisplayPath(_path2.default.join(".", relative));
429
432
  }
430
433
  function resolveRecordLocation(baseDir) {
431
434
  const normalizedBase = _path2.default.normalize(baseDir);
432
- const packageRoot = _nullishCoalesce(_chunkNIS74SI6js.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
435
+ const packageRoot = _nullishCoalesce(_chunkZAA5ZG3Djs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
433
436
  const packageJsonPath = _path2.default.join(packageRoot, "package.json");
434
437
  const hasPackageJson = _fs.existsSync.call(void 0, packageJsonPath);
435
438
  const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
@@ -466,7 +469,7 @@ function getRecordFileCandidates(baseDir) {
466
469
  // package.json
467
470
  var package_default = {
468
471
  name: "weapp-tailwindcss",
469
- version: "4.12.0-next.0",
472
+ version: "4.12.0",
470
473
  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!",
471
474
  author: "ice breaker <1324318532@qq.com>",
472
475
  license: "MIT",
@@ -616,13 +619,14 @@ var package_default = {
616
619
  "dist",
617
620
  "index.css",
618
621
  "preflight.css",
622
+ "scripts/postinstall.mjs",
619
623
  "theme.css",
620
624
  "uni-app-x.css",
621
625
  "utilities.css",
622
626
  "with-layer.css"
623
627
  ],
624
628
  engines: {
625
- node: "^18.17.0 || >=20.5.0"
629
+ node: "^20.19.0 || >=22.12.0"
626
630
  },
627
631
  scripts: {
628
632
  dev: "tsup --watch --sourcemap",
@@ -631,7 +635,7 @@ var package_default = {
631
635
  "build:cli": "cd plugins/cli && pnpm run build",
632
636
  "build:css": "tsx scripts/build-css.ts",
633
637
  "build:weapp-theme": "tsx scripts/build-weapp-theme.ts",
634
- test: "npm run postinstall && vitest run",
638
+ test: "pnpm run cli:patch && vitest run",
635
639
  "test:dev": "vitest",
636
640
  "test:ui": "vitest --ui",
637
641
  bench: "vitest bench --config ./vitest.config.ts",
@@ -648,7 +652,7 @@ var package_default = {
648
652
  release: "tsx scripts/release.ts",
649
653
  lint: "eslint .",
650
654
  "lint:fix": "eslint ./src --fix",
651
- postinstall: "node bin/weapp-tailwindcss.js patch",
655
+ postinstall: "node scripts/postinstall.mjs",
652
656
  "bench:vite-dev-hmr": "tsx scripts/vite-dev-hmr-bench.ts",
653
657
  "test:watch-hmr": "node --import tsx scripts/watch-hmr-regression/index.ts"
654
658
  },
@@ -658,10 +662,10 @@ var package_default = {
658
662
  },
659
663
  dependencies: {
660
664
  "@ast-core/escape": "~1.0.1",
661
- "@babel/parser": "~7.29.2",
665
+ "@babel/parser": "~7.29.3",
662
666
  "@babel/traverse": "~7.29.0",
663
667
  "@babel/types": "~7.29.0",
664
- "@tailwindcss-mangle/config": "^7.0.0",
668
+ "@tailwindcss-mangle/config": "^7.0.1",
665
669
  "@vue/compiler-dom": "catalog:vue3",
666
670
  "@vue/compiler-sfc": "catalog:vue3",
667
671
  "@weapp-core/escape": "~7.0.0",
@@ -682,7 +686,7 @@ var package_default = {
682
686
  semver: "~7.7.4",
683
687
  "tailwindcss-patch": "catalog:tailwindcssPatch",
684
688
  "webpack-sources": "3.3.4",
685
- yaml: "^2.8.3"
689
+ yaml: "^2.8.4"
686
690
  },
687
691
  devDependencies: {
688
692
  "fast-check": "^4.7.0"
@@ -1564,7 +1568,7 @@ function isClassLikeCallExpression(path5, valuePath) {
1564
1568
  if (!helperName || !CLASS_HELPER_IDENTIFIERS.has(normalizeKeyword(helperName))) {
1565
1569
  return false;
1566
1570
  }
1567
- return path5.get("arguments").includes(valuePath);
1571
+ return path5.get("arguments").some((argumentPath) => argumentPath.node === valuePath.node);
1568
1572
  }
1569
1573
  function isClassContextLiteralPath(path5) {
1570
1574
  let current = path5;
@@ -2066,6 +2070,7 @@ function walkEvalExpression(path5, options, updater, handler) {
2066
2070
  for (const q of n.quasis) {
2067
2071
  const stub = {
2068
2072
  node: q,
2073
+ isStringLiteral: () => false,
2069
2074
  isTemplateElement: () => true
2070
2075
  };
2071
2076
  handleEvalTemplateElement(stub, templateHandlerOptions, updater, handler);
@@ -2810,6 +2815,7 @@ var EMPTY_IMPORT_DECLARATIONS = /* @__PURE__ */ new Set();
2810
2815
  var EMPTY_EXPORT_DECLARATIONS = /* @__PURE__ */ new Set();
2811
2816
  var EMPTY_REQUIRE_CALL_PATHS = [];
2812
2817
  var ignoredTaggedTemplateMatcherCache = /* @__PURE__ */ new WeakMap();
2818
+ var defaultEvalHandler;
2813
2819
  function getIgnoredTaggedTemplateMatcher(options) {
2814
2820
  const cached = ignoredTaggedTemplateMatcherCache.get(options);
2815
2821
  if (cached) {
@@ -2819,6 +2825,12 @@ function getIgnoredTaggedTemplateMatcher(options) {
2819
2825
  ignoredTaggedTemplateMatcherCache.set(options, created);
2820
2826
  return created;
2821
2827
  }
2828
+ function getDefaultEvalHandler() {
2829
+ if (!defaultEvalHandler) {
2830
+ throw new Error("Default JS eval handler is not initialized.");
2831
+ }
2832
+ return defaultEvalHandler;
2833
+ }
2822
2834
  function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
2823
2835
  const jsTokenUpdater = new JsTokenUpdater();
2824
2836
  const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
@@ -2846,7 +2858,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
2846
2858
  const importDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_IMPORT_DECLARATIONS;
2847
2859
  const exportDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_EXPORT_DECLARATIONS;
2848
2860
  const requireCallPaths = collectModuleMetadata ? [] : EMPTY_REQUIRE_CALL_PATHS;
2849
- const evalHandler = _nullishCoalesce(handler, () => ( jsHandler));
2861
+ const evalHandler = _nullishCoalesce(handler, () => ( getDefaultEvalHandler()));
2850
2862
  const templateElementEnter = hasTaggedTemplateIgnoreIdentifiers ? (p) => {
2851
2863
  const pp = p.parentPath;
2852
2864
  if (pp.isTemplateLiteral()) {
@@ -2987,9 +2999,11 @@ function jsHandler(rawSource, options) {
2987
2999
  }
2988
3000
  return result;
2989
3001
  }
3002
+ defaultEvalHandler = jsHandler;
2990
3003
 
2991
3004
  // src/js/index.ts
2992
3005
  var RESULT_CACHE_MAX = 512;
3006
+ var CACHEABLE_SOURCE_MAX_LENGTH = 512;
2993
3007
  var classNameSetIds = /* @__PURE__ */ new WeakMap();
2994
3008
  var nextClassNameSetId = 0;
2995
3009
  function getClassNameSetId(set) {
@@ -3043,6 +3057,15 @@ function hasDefinedOverrides(options) {
3043
3057
  }
3044
3058
  return false;
3045
3059
  }
3060
+ function shouldCacheJsResult(rawSource, options) {
3061
+ if (rawSource.length === 0 || rawSource.length > CACHEABLE_SOURCE_MAX_LENGTH) {
3062
+ return false;
3063
+ }
3064
+ if (options.moduleGraph || options.filename) {
3065
+ return false;
3066
+ }
3067
+ return true;
3068
+ }
3046
3069
  function createJsHandler(options) {
3047
3070
  const defaults = {
3048
3071
  escapeMap: options.escapeMap,
@@ -3087,14 +3110,14 @@ function createJsHandler(options) {
3087
3110
  return created;
3088
3111
  }
3089
3112
  function getCachedJsResult(rawSource, resolvedOptions) {
3090
- if (rawSource.length === 0) {
3113
+ if (!shouldCacheJsResult(rawSource, resolvedOptions)) {
3091
3114
  return void 0;
3092
3115
  }
3093
3116
  const key = `${getOptionsFingerprint(resolvedOptions)}:${_node.md5.call(void 0, rawSource)}`;
3094
3117
  return resultCache.get(key);
3095
3118
  }
3096
3119
  function setCachedJsResult(rawSource, resolvedOptions, result) {
3097
- if (rawSource.length === 0 || result.error || result.linked) {
3120
+ if (!shouldCacheJsResult(rawSource, resolvedOptions) || result.error || result.linked) {
3098
3121
  return result;
3099
3122
  }
3100
3123
  const key = `${getOptionsFingerprint(resolvedOptions)}:${_node.md5.call(void 0, rawSource)}`;
@@ -3499,7 +3522,7 @@ function handleEachClassFragment(ms, tokens, options = {}) {
3499
3522
  previousEnd = token.end;
3500
3523
  }
3501
3524
  if (tokens.length > 0) {
3502
- const lastToken = tokens.at(-1);
3525
+ const lastToken = tokens[tokens.length - 1];
3503
3526
  if (lastToken.end < ms.original.length) {
3504
3527
  updateWhitespaceGap(ms, lastToken.end, ms.original.length, options);
3505
3528
  }
@@ -3680,8 +3703,8 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
3680
3703
  disabledDefaultTemplateHandler,
3681
3704
  replaceRuntimePackages
3682
3705
  } = ctx;
3683
- const uniAppXEnabled = _chunkNIS74SI6js.isUniAppXEnabled.call(void 0, uniAppX);
3684
- const resolvedUniAppXOptions = _chunkNIS74SI6js.resolveUniAppXOptions.call(void 0, uniAppX);
3706
+ const uniAppXEnabled = _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
3707
+ const resolvedUniAppXOptions = _chunkZAA5ZG3Djs.resolveUniAppXOptions.call(void 0, uniAppX);
3685
3708
  const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
3686
3709
  const styleHandler = _postcss.createStyleHandler.call(void 0, {
3687
3710
  cssPreflight,
@@ -3797,15 +3820,15 @@ function createInternalCompilerContext(opts) {
3797
3820
  );
3798
3821
  ctx.escapeMap = ctx.customReplaceDictionary;
3799
3822
  applyLoggerLevel(ctx.logLevel);
3800
- const twPatcher = _chunkNIS74SI6js.createTailwindcssPatcherFromContext.call(void 0, ctx);
3823
+ const twPatcher = _chunkZAA5ZG3Djs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3801
3824
  logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
3802
3825
  logRuntimeTailwindcssVersion(
3803
3826
  ctx.tailwindcssBasedir,
3804
3827
  _optionalChain([twPatcher, 'access', _120 => _120.packageInfo, 'optionalAccess', _121 => _121.rootPath]),
3805
3828
  _optionalChain([twPatcher, 'access', _122 => _122.packageInfo, 'optionalAccess', _123 => _123.version])
3806
3829
  );
3807
- _chunkNIS74SI6js.warnMissingCssEntries.call(void 0, ctx, twPatcher);
3808
- const cssCalcOptions = _chunkNIS74SI6js.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
3830
+ _chunkZAA5ZG3Djs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
3831
+ const cssCalcOptions = _chunkZAA5ZG3Djs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
3809
3832
  ctx.cssCalc = cssCalcOptions;
3810
3833
  const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
3811
3834
  const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
@@ -3824,8 +3847,8 @@ function createInternalCompilerContext(opts) {
3824
3847
  if (_optionalChain([options, 'optionalAccess', _124 => _124.clearCache]) !== false) {
3825
3848
  await clearTailwindcssPatcherCache(previousPatcher);
3826
3849
  }
3827
- _chunkNIS74SI6js.invalidateRuntimeClassSet.call(void 0, previousPatcher);
3828
- const nextPatcher = _chunkNIS74SI6js.createTailwindcssPatcherFromContext.call(void 0, ctx);
3850
+ _chunkZAA5ZG3Djs.invalidateRuntimeClassSet.call(void 0, previousPatcher);
3851
+ const nextPatcher = _chunkZAA5ZG3Djs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3829
3852
  Object.assign(previousPatcher, nextPatcher);
3830
3853
  ctx.twPatcher = previousPatcher;
3831
3854
  return previousPatcher;
@@ -3842,10 +3865,11 @@ function getCompilerContext(opts) {
3842
3865
  }
3843
3866
 
3844
3867
  // src/js/precheck.ts
3868
+
3845
3869
  var FAST_JS_TRANSFORM_HINT_RE = /className\b|class\s*=|classList\.|\b(?:twMerge|clsx|classnames|cn|cva)\b|\[["'`]class["'`]\]|text-\[|bg-\[|\b(?:[whpm]|px|py|mx|my|rounded|flex|grid|gap)-/;
3846
3870
  var DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
3847
3871
  function shouldSkipJsTransform(rawSource, options) {
3848
- if (process.env.WEAPP_TW_DISABLE_JS_PRECHECK === "1") {
3872
+ if (_process2.default.env.WEAPP_TW_DISABLE_JS_PRECHECK === "1") {
3849
3873
  return false;
3850
3874
  }
3851
3875
  if (!rawSource) {
@@ -3871,7 +3895,7 @@ function setupPatchRecorder(patcher, baseDir, options) {
3871
3895
  const recorder = createPatchTargetRecorder(baseDir, patcher, options);
3872
3896
  if (_optionalChain([recorder, 'optionalAccess', _128 => _128.message]) && _optionalChain([options, 'optionalAccess', _129 => _129.logMessage]) !== false) {
3873
3897
  const prefix = _optionalChain([options, 'optionalAccess', _130 => _130.messagePrefix]) ? `${options.messagePrefix} ` : "";
3874
- _chunkNIS74SI6js.logger.info("%s%s", prefix, recorder.message);
3898
+ _chunkZAA5ZG3Djs.logger.info("%s%s", prefix, recorder.message);
3875
3899
  }
3876
3900
  const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _131 => _131.onPatched]) ? async () => {
3877
3901
  await recorder.onPatched();
@@ -11,14 +11,14 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkWSS26HZSjs = require('./chunk-WSS26HZS.js');
14
+ var _chunkFS2NOOEBjs = require('./chunk-FS2NOOEB.js');
15
15
 
16
16
 
17
17
 
18
18
 
19
19
 
20
20
 
21
- var _chunkGMKSBLNYjs = require('./chunk-GMKSBLNY.js');
21
+ var _chunk24AGZQVRjs = require('./chunk-24AGZQVR.js');
22
22
 
23
23
 
24
24
  var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
@@ -29,11 +29,11 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
29
29
 
30
30
 
31
31
 
32
- var _chunkGC7WXUOWjs = require('./chunk-GC7WXUOW.js');
32
+ var _chunkHVNGIKLSjs = require('./chunk-HVNGIKLS.js');
33
33
 
34
34
 
35
35
 
36
- var _chunkNIS74SI6js = require('./chunk-NIS74SI6.js');
36
+ var _chunkZAA5ZG3Djs = require('./chunk-ZAA5ZG3D.js');
37
37
 
38
38
 
39
39
  var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
@@ -64,10 +64,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
64
64
  const { Compilation, sources } = compiler.webpack;
65
65
  const { ConcatSource } = sources;
66
66
  const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
67
- compiler.hooks.compilation.tap(_chunkGC7WXUOWjs.pluginName, (compilation) => {
67
+ compiler.hooks.compilation.tap(_chunkHVNGIKLSjs.pluginName, (compilation) => {
68
68
  compilation.hooks.processAssets.tapPromise(
69
69
  {
70
- name: _chunkGC7WXUOWjs.pluginName,
70
+ name: _chunkHVNGIKLSjs.pluginName,
71
71
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
72
72
  },
73
73
  async (assets) => {
@@ -79,20 +79,20 @@ function setupWebpackV5ProcessAssetsHook(options) {
79
79
  compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
80
80
  }
81
81
  }
82
- const assetHashByChunk = _chunkWSS26HZSjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
82
+ const assetHashByChunk = _chunkFS2NOOEBjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
83
83
  const entries = Object.entries(assets);
84
84
  const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
85
85
  const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
86
86
  const jsAssets = /* @__PURE__ */ new Map();
87
87
  for (const [file] of entries) {
88
88
  if (compilerOptions.jsMatcher(file) || compilerOptions.wxsMatcher(file)) {
89
- const absolute = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
89
+ const absolute = _chunk24AGZQVRjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
90
90
  jsAssets.set(absolute, file);
91
91
  }
92
92
  }
93
93
  const moduleGraphOptions = {
94
94
  resolve(specifier, importer) {
95
- return _chunkGMKSBLNYjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
95
+ return _chunk24AGZQVRjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
96
96
  },
97
97
  load: (id) => {
98
98
  const assetName = jsAssets.get(id);
@@ -158,7 +158,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
158
158
  const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
159
159
  const forceRuntimeRefresh = getRuntimeRefreshRequirement();
160
160
  debug2("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, _nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown")));
161
- const runtimeSet = await _chunkGC7WXUOWjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
161
+ const runtimeSet = await _chunkHVNGIKLSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
162
162
  forceRefresh: forceRuntimeRefresh,
163
163
  // webpack 的 script-only 热更新可能不会触发 runtime classset loader,
164
164
  // 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
@@ -208,12 +208,12 @@ function setupWebpackV5ProcessAssetsHook(options) {
208
208
  const jsTaskFactories = [];
209
209
  if (Array.isArray(groupedEntries.js)) {
210
210
  for (const [file] of groupedEntries.js) {
211
- const cacheKey = _chunkWSS26HZSjs.getCacheKey.call(void 0, file);
211
+ const cacheKey = _chunkFS2NOOEBjs.getCacheKey.call(void 0, file);
212
212
  const asset = compilation.getAsset(file);
213
213
  if (!asset) {
214
214
  continue;
215
215
  }
216
- const absoluteFile = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
216
+ const absoluteFile = _chunk24AGZQVRjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
217
217
  const initialSource = asset.source.source();
218
218
  const initialRawSource = typeof initialSource === "string" ? initialSource : initialSource.toString();
219
219
  const chunkHash = assetHashByChunk.get(file);
@@ -243,7 +243,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
243
243
  sourceFilename: absoluteFile
244
244
  }
245
245
  };
246
- if (_chunkGC7WXUOWjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
246
+ if (_chunkHVNGIKLSjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
247
247
  return { result: new ConcatSource(currentSource) };
248
248
  }
249
249
  const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, handlerOptions);
@@ -292,7 +292,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
292
292
  );
293
293
  }
294
294
  }
295
- _chunkGMKSBLNYjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
295
+ _chunk24AGZQVRjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
296
296
  await Promise.all(tasks);
297
297
  debug2("end");
298
298
  compilerOptions.onEnd();
@@ -318,9 +318,9 @@ function setupWebpackV5Loaders(options) {
318
318
  getRuntimeWatchDependencies,
319
319
  debug: debug2
320
320
  } = options;
321
- const isMpxApp = _chunkWSS26HZSjs.isMpx.call(void 0, appType);
321
+ const isMpxApp = _chunkFS2NOOEBjs.isMpx.call(void 0, appType);
322
322
  if (shouldRewriteCssImports && isMpxApp) {
323
- _chunkWSS26HZSjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
323
+ _chunkFS2NOOEBjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
324
324
  }
325
325
  const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
326
326
  const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
@@ -334,12 +334,12 @@ function setupWebpackV5Loaders(options) {
334
334
  getClassSet: getClassSetInLoader,
335
335
  getWatchDependencies: getRuntimeWatchDependencies
336
336
  };
337
- const { findRewriteAnchor, findClassSetAnchor } = _chunkWSS26HZSjs.createLoaderAnchorFinders.call(void 0, appType);
337
+ const { findRewriteAnchor, findClassSetAnchor } = _chunkFS2NOOEBjs.createLoaderAnchorFinders.call(void 0, appType);
338
338
  const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
339
339
  rewriteCssImports: runtimeLoaderRewriteOptions
340
340
  } : void 0;
341
341
  if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
342
- _chunkWSS26HZSjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
342
+ _chunkFS2NOOEBjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
343
343
  }
344
344
  const createRuntimeClassSetLoaderEntry = () => ({
345
345
  loader: runtimeClassSetLoader,
@@ -359,17 +359,17 @@ function setupWebpackV5Loaders(options) {
359
359
  };
360
360
  };
361
361
  const { NormalModule } = compiler.webpack;
362
- compiler.hooks.compilation.tap(_chunkGC7WXUOWjs.pluginName, (compilation) => {
363
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkGC7WXUOWjs.pluginName, (_loaderContext, module) => {
362
+ compiler.hooks.compilation.tap(_chunkHVNGIKLSjs.pluginName, (compilation) => {
363
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkHVNGIKLSjs.pluginName, (_loaderContext, module) => {
364
364
  const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
365
365
  if (!hasRuntimeLoader) {
366
366
  return;
367
367
  }
368
- _chunkWSS26HZSjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
368
+ _chunkFS2NOOEBjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
369
369
  const loaderEntries = module.loaders || [];
370
370
  let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
371
371
  const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
372
- const isCssModule = _chunkWSS26HZSjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
372
+ const isCssModule = _chunkFS2NOOEBjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
373
373
  if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
374
374
  debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
375
375
  }
@@ -401,7 +401,7 @@ function setupWebpackV5Loaders(options) {
401
401
  rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
402
402
  }
403
403
  }
404
- if (runtimeClassSetLoaderExists && !_chunkWSS26HZSjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
404
+ if (runtimeClassSetLoaderExists && !_chunkFS2NOOEBjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
405
405
  const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
406
406
  const anchorIndex = findClassSetAnchor(loaderEntries);
407
407
  if (anchorIndex === -1) {
@@ -416,11 +416,11 @@ function setupWebpackV5Loaders(options) {
416
416
  }
417
417
 
418
418
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
419
- var debug = _chunkGC7WXUOWjs.createDebug.call(void 0, );
420
- var weappTailwindcssPackageDir = _chunkGMKSBLNYjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
419
+ var debug = _chunkHVNGIKLSjs.createDebug.call(void 0, );
420
+ var weappTailwindcssPackageDir = _chunk24AGZQVRjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
421
421
  var UnifiedWebpackPluginV5 = class {
422
422
  constructor(options = {}) {
423
- this.options = _chunkGC7WXUOWjs.getCompilerContext.call(void 0, options);
423
+ this.options = _chunkHVNGIKLSjs.getCompilerContext.call(void 0, options);
424
424
  this.appType = this.options.appType;
425
425
  }
426
426
  apply(compiler) {
@@ -433,22 +433,22 @@ var UnifiedWebpackPluginV5 = class {
433
433
  twPatcher: initialTwPatcher,
434
434
  refreshTailwindcssPatcher
435
435
  } = this.options;
436
- const disabledOptions = _chunkGMKSBLNYjs.resolveDisabledOptions.call(void 0, disabled);
436
+ const disabledOptions = _chunk24AGZQVRjs.resolveDisabledOptions.call(void 0, disabled);
437
437
  const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
438
438
  const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
439
- const isMpxApp = _chunkWSS26HZSjs.isMpx.call(void 0, this.appType);
439
+ const isMpxApp = _chunkFS2NOOEBjs.isMpx.call(void 0, this.appType);
440
440
  if (shouldRewriteCssImports) {
441
- _chunkWSS26HZSjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
441
+ _chunkFS2NOOEBjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
442
442
  pkgDir: weappTailwindcssPackageDir,
443
443
  enabled: true,
444
444
  appType: this.appType
445
445
  });
446
- _chunkWSS26HZSjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
446
+ _chunkFS2NOOEBjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
447
447
  }
448
448
  if (disabledOptions.plugin) {
449
449
  return;
450
450
  }
451
- const patchRecorderState = _chunkGC7WXUOWjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
451
+ const patchRecorderState = _chunkHVNGIKLSjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
452
452
  source: "runtime",
453
453
  cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
454
454
  });
@@ -467,7 +467,7 @@ var UnifiedWebpackPluginV5 = class {
467
467
  const updateRuntimeWatchDependencies = async () => {
468
468
  runtimeWatchDependencyFiles.clear();
469
469
  runtimeWatchDependencyContexts.clear();
470
- const tailwindOptions = _chunkNIS74SI6js.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options);
470
+ const tailwindOptions = _chunkZAA5ZG3Djs.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options);
471
471
  if (_optionalChain([tailwindOptions, 'optionalAccess', _13 => _13.config])) {
472
472
  runtimeWatchDependencyFiles.add(tailwindOptions.config);
473
473
  }
@@ -506,31 +506,31 @@ var UnifiedWebpackPluginV5 = class {
506
506
  runtimeMetadataPrepared = true;
507
507
  };
508
508
  const syncRuntimeRefreshRequirement = () => {
509
- runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || _chunkWSS26HZSjs.hasWatchChanges.call(void 0, compiler);
509
+ runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || _chunkFS2NOOEBjs.hasWatchChanges.call(void 0, compiler);
510
510
  };
511
511
  const resetRuntimePreparation = () => {
512
512
  runtimeSetPrepared = false;
513
513
  runtimeMetadataPrepared = false;
514
514
  syncRuntimeRefreshRequirement();
515
515
  };
516
- _optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(_chunkGC7WXUOWjs.pluginName, () => {
516
+ _optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(_chunkHVNGIKLSjs.pluginName, () => {
517
517
  runtimeRefreshRequiredForCompilation = true;
518
518
  })]);
519
- _optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(_chunkGC7WXUOWjs.pluginName, syncRuntimeRefreshRequirement)]);
519
+ _optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(_chunkHVNGIKLSjs.pluginName, syncRuntimeRefreshRequirement)]);
520
520
  if (_optionalChain([compiler, 'access', _28 => _28.hooks, 'access', _29 => _29.thisCompilation, 'optionalAccess', _30 => _30.tap])) {
521
- compiler.hooks.thisCompilation.tap(_chunkGC7WXUOWjs.pluginName, resetRuntimePreparation);
521
+ compiler.hooks.thisCompilation.tap(_chunkHVNGIKLSjs.pluginName, resetRuntimePreparation);
522
522
  } else if (_optionalChain([compiler, 'access', _31 => _31.hooks, 'access', _32 => _32.compilation, 'optionalAccess', _33 => _33.tap])) {
523
- compiler.hooks.compilation.tap(_chunkGC7WXUOWjs.pluginName, resetRuntimePreparation);
523
+ compiler.hooks.compilation.tap(_chunkHVNGIKLSjs.pluginName, resetRuntimePreparation);
524
524
  }
525
525
  async function getClassSetInLoader() {
526
526
  if (runtimeSetPrepared) {
527
527
  return;
528
528
  }
529
- const signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
529
+ const signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
530
530
  const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
531
531
  debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
532
532
  runtimeSetPrepared = true;
533
- await _chunkGC7WXUOWjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
533
+ await _chunkHVNGIKLSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
534
534
  forceRefresh,
535
535
  forceCollect: true,
536
536
  clearCache: forceRefresh,