weapp-tailwindcss 5.4.2 → 5.5.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 (89) hide show
  1. package/README.md +13 -1
  2. package/README.zh-CN.md +13 -1
  3. package/dist/bundlers/shared/v4-generation-core.d.ts +1 -0
  4. package/dist/bundlers/vite/capability-profile.d.ts +1 -0
  5. package/dist/bundlers/vite/css-finalizer/web-plugin.d.ts +3 -0
  6. package/dist/bundlers/vite/css-handler-options.d.ts +32 -0
  7. package/dist/bundlers/vite/{generate-bundle/css-output.d.ts → css-output.d.ts} +1 -1
  8. package/dist/bundlers/vite/frameworks/generic/web.d.ts +2 -0
  9. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +2 -32
  10. package/dist/bundlers/vite/generate-bundle/finalize/root-import-shell.d.ts +1 -1
  11. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +2 -2
  12. package/dist/bundlers/vite/generate-bundle/runtime.d.ts +1 -1
  13. package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +1 -1
  14. package/dist/bundlers/vite/generate-bundle.d.ts +1 -1
  15. package/dist/bundlers/vite/runtime-class-set.d.ts +1 -5
  16. package/dist/bundlers/vite/shared/create-css-only-plugins-runtime.d.ts +3 -0
  17. package/dist/cache-CBJFB1HN.cjs +223 -0
  18. package/dist/compiler/events.d.ts +32 -0
  19. package/dist/compiler/host.d.ts +13 -0
  20. package/dist/compiler/index.d.ts +3 -0
  21. package/dist/compiler/runtime-state.d.ts +17 -0
  22. package/dist/compiler-B0YSc0DY.js +4877 -0
  23. package/dist/{wxml-o-CUulAM.cjs → compiler-SwMb3lOX.cjs} +3649 -283
  24. package/dist/core.cjs +6 -3
  25. package/dist/core.d.ts +2 -0
  26. package/dist/core.js +4 -4
  27. package/dist/defaults-B5ep0ojb.js +120 -0
  28. package/dist/defaults-BI9j1znS.cjs +156 -0
  29. package/dist/defaults.cjs +5 -121
  30. package/dist/defaults.js +1 -116
  31. package/dist/final-css-cleanup-BMlUDzik.cjs +112 -0
  32. package/dist/final-css-cleanup-CmVYbXPr.js +282 -0
  33. package/dist/{generator-WlhrtNa3.cjs → generator-DsrQ9txU.cjs} +62 -5
  34. package/dist/{generator-BjK5PRR-.js → generator-DyXTBPmE.js} +47 -2
  35. package/dist/generator.cjs +1 -1
  36. package/dist/generator.js +1 -1
  37. package/dist/{gulp-D6LcfRz_.js → gulp-CVUiPXPy.js} +7 -7
  38. package/dist/{gulp-ChecVI6A.cjs → gulp-Dtc01FdI.cjs} +30 -28
  39. package/dist/gulp.cjs +1 -1
  40. package/dist/gulp.js +1 -1
  41. package/dist/{hmr-timing-afnWvy7u.cjs → hmr-timing-3SdRVfZx.cjs} +6 -229
  42. package/dist/{hmr-timing-CqDfjvqE.js → hmr-timing-DNxQm-bN.js} +6 -1258
  43. package/dist/index.cjs +4 -4
  44. package/dist/index.js +4 -4
  45. package/dist/{pipeline-helpers-DxPFMGxz.cjs → pipeline-helpers-DVrgv1HS.cjs} +6 -5
  46. package/dist/postcss.cjs +1 -1
  47. package/dist/postcss.js +1 -1
  48. package/dist/presets.cjs +4 -4
  49. package/dist/presets.js +2 -2
  50. package/dist/rspack.cjs +2 -2
  51. package/dist/rspack.js +2 -2
  52. package/dist/runtime-state-BBQcA0n5.cjs +54 -0
  53. package/dist/{source-candidate-scan-signature-FywFU3Rg.cjs → scoped-generator-B7thnzzm.cjs} +5 -123
  54. package/dist/{source-candidate-scan-signature-BVScymyM.js → scoped-generator-kRj_5Axx.js} +4 -92
  55. package/dist/source-candidate-scan-signature-B7cUxqqX.cjs +129 -0
  56. package/dist/source-candidate-scan-signature-CsP4BQNa.js +92 -0
  57. package/dist/style-injector/internal.d.ts +1 -1
  58. package/dist/style-injector/vite-web.d.ts +3 -0
  59. package/dist/{tailwindcss-9xmoCkaR.js → tailwindcss-BK9S7zuq.js} +1 -2
  60. package/dist/{tailwindcss-D3jltF7M.cjs → tailwindcss-C-jBBQfw.cjs} +8 -9
  61. package/dist/{transform-DQhgAarN.js → transform-C0rWZblB.js} +3 -3
  62. package/dist/{transform-C6k9zTQR.cjs → transform-C7QxW-fV.cjs} +27 -27
  63. package/dist/{v4-generation-core-CPKNwzjz.cjs → v4-generation-core-DuIVZvRz.cjs} +29 -1172
  64. package/dist/vite/web.cjs +27 -0
  65. package/dist/vite/web.d.ts +1 -0
  66. package/dist/vite/web.js +25 -0
  67. package/dist/{vite-D3aCtpmv.js → vite-0PsttwuR.js} +241 -3581
  68. package/dist/{vite-D-gmOkPN.cjs → vite-CJbO-7AQ.cjs} +494 -3794
  69. package/dist/vite-web.d.ts +4 -0
  70. package/dist/vite.cjs +1 -1
  71. package/dist/vite.js +1 -1
  72. package/dist/weapp-tw-css-generation-loader.cjs +1 -1
  73. package/dist/weapp-tw-css-import-rewrite-loader.cjs +5 -5
  74. package/dist/web-BFOkkJ-8.cjs +4357 -0
  75. package/dist/web-D8HSs56R.js +3792 -0
  76. package/dist/{webpack-yAne9ZYu.cjs → webpack-BWknqSDV.cjs} +51 -49
  77. package/dist/{webpack-B-6a8Z8F.js → webpack-DVtKeBq1.js} +13 -12
  78. package/dist/webpack.cjs +1 -1
  79. package/dist/webpack.js +1 -1
  80. package/package.json +12 -3
  81. package/dist/cache-options-DavPxrhC.cjs +0 -16
  82. package/dist/cache-options-DwBtLwQe.js +0 -5
  83. package/dist/compiler-B-m9VGqj.cjs +0 -2316
  84. package/dist/compiler-BgMj2E5l.js +0 -2051
  85. package/dist/local-style-matcher-DRpFEu1s.cjs +0 -34
  86. package/dist/local-style-matcher-DsiI2wIc.js +0 -17
  87. package/dist/object-B-8IHefx.js +0 -47
  88. package/dist/object-DbHtAXRk.cjs +0 -58
  89. package/dist/wxml-CvKyV69S.js +0 -1822
@@ -1,10 +1,12 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
- const require_generator = require("./generator-WlhrtNa3.cjs");
3
- const require_tailwindcss = require("./tailwindcss-D3jltF7M.cjs");
4
- const require_v4_generation_core = require("./v4-generation-core-CPKNwzjz.cjs");
5
- const require_wxml = require("./wxml-o-CUulAM.cjs");
6
- const require_compiler = require("./compiler-B-m9VGqj.cjs");
7
- const require_hmr_timing = require("./hmr-timing-afnWvy7u.cjs");
2
+ const require_generator = require("./generator-DsrQ9txU.cjs");
3
+ const require_tailwindcss = require("./tailwindcss-C-jBBQfw.cjs");
4
+ const require_v4_generation_core = require("./v4-generation-core-DuIVZvRz.cjs");
5
+ const require_compiler = require("./compiler-SwMb3lOX.cjs");
6
+ const require_runtime_state = require("./runtime-state-BBQcA0n5.cjs");
7
+ const require_cache = require("./cache-CBJFB1HN.cjs");
8
+ const require_hmr_timing = require("./hmr-timing-3SdRVfZx.cjs");
9
+ const require_final_css_cleanup = require("./final-css-cleanup-BMlUDzik.cjs");
8
10
  let node_fs = require("node:fs");
9
11
  node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
10
12
  let node_path = require("node:path");
@@ -74,9 +76,9 @@ function createGulpRuntimeSnapshot(runtimeSourcesByFile, state, computeHash, opt
74
76
  source: entry.source,
75
77
  type: entry.type
76
78
  }));
77
- return require_hmr_timing.buildRuntimeCompilationSnapshot(entries, state, {
79
+ return require_cache.buildRuntimeCompilationSnapshot(entries, state, {
78
80
  computeHash,
79
- createRuntimeAffectingSignature: require_v4_generation_core.createRuntimeAffectingSourceSignature,
81
+ createRuntimeAffectingSignature: require_compiler.createRuntimeAffectingSourceSignature,
80
82
  removedFiles: options.removedFiles
81
83
  });
82
84
  }
@@ -156,7 +158,7 @@ function applyGulpAssetEmissionPlan(plan, options) {
156
158
  }
157
159
  }
158
160
  function writeGulpFileAsset(file, source) {
159
- const plan = new require_v4_generation_core.AssetEmissionPlan();
161
+ const plan = new require_compiler.AssetEmissionPlan();
160
162
  plan.write(file.path, source);
161
163
  applyGulpAssetEmissionPlan(plan, {
162
164
  deleteAsset(assetId) {
@@ -220,7 +222,7 @@ function createGulpFileTransforms(context) {
220
222
  rememberCompilationScope(file.path, compilationScope.id);
221
223
  const compilationDependencyRevision = getCompilationDependencyRevision(compilationScope.id);
222
224
  const outputSignature = `${styleOutputExtension ? `gulp-output:1:${stage}:${styleOutputExtension}` : `gulp-output:0:${stage}`}:compiler-dependencies:${compilationDependencyRevision}`;
223
- await require_hmr_timing.processCachedTask({
225
+ await require_cache.processCachedTask({
224
226
  cache,
225
227
  cacheKey: file.path,
226
228
  hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
@@ -260,7 +262,7 @@ function createGulpFileTransforms(context) {
260
262
  const generatedCss = stage === "generate" && generated ? `${require_v4_generation_core.createBundlerGeneratedCssMarker("gulp", file.path)}\n${css}` : css;
261
263
  const outputCss = stage === "generate" ? generatedCss : (0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(generatedCss, { styleOutputExtension });
262
264
  debug("css handle: %s", file.path);
263
- return { result: stage === "transform" ? require_v4_generation_core.finalizeMiniProgramCssStructure(outputCss) : outputCss };
265
+ return { result: stage === "transform" ? require_final_css_cleanup.finalizeMiniProgramCssStructure(outputCss) : outputCss };
264
266
  }
265
267
  });
266
268
  rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
@@ -284,7 +286,7 @@ function createGulpFileTransforms(context) {
284
286
  styleOptions: cssHandlerOptions
285
287
  }) : handled.css;
286
288
  const outputCss = (0, _weapp_tailwindcss_postcss.rewriteLocalCssImportRequestsForOutput)(finalized, { styleOutputExtension });
287
- writeGulpFileAsset(file, require_v4_generation_core.finalizeMiniProgramCssStructure(outputCss));
289
+ writeGulpFileAsset(file, require_final_css_cleanup.finalizeMiniProgramCssStructure(outputCss));
288
290
  debug("css adapt: %s", file.path);
289
291
  }, () => resolveGulpTransformTimingDetails("css:adapt"));
290
292
  const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
@@ -305,7 +307,7 @@ function createGulpFileTransforms(context) {
305
307
  }
306
308
  };
307
309
  if (runtimeState.tailwindRuntime.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.tailwindRuntime.majorVersion;
308
- await require_hmr_timing.processCachedTask({
310
+ await require_cache.processCachedTask({
309
311
  cache,
310
312
  cacheKey: file.path,
311
313
  rawSource,
@@ -335,7 +337,7 @@ function createGulpFileTransforms(context) {
335
337
  const rawSource = file.contents.toString();
336
338
  await refreshRuntimeSetForSource(file, rawSource, "html");
337
339
  await runtimeState.readyPromise;
338
- await require_hmr_timing.processCachedTask({
340
+ await require_cache.processCachedTask({
339
341
  cache,
340
342
  cacheKey: file.path,
341
343
  rawSource,
@@ -365,7 +367,7 @@ function createGulpFileTransforms(context) {
365
367
  }
366
368
  //#endregion
367
369
  //#region src/bundlers/gulp/shared/create-native-framework-plugins.ts
368
- const debug = require_wxml.createDebug();
370
+ const debug = require_compiler.createDebug();
369
371
  const GULP_COMPILATION_SCOPE_CACHE_MAX = 512;
370
372
  /**
371
373
  * @name weapp-tw-gulp
@@ -383,11 +385,11 @@ function createNativeGulpPlugins(options = {}) {
383
385
  const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
384
386
  const readyPromise = require_compiler.createTailwindRuntimeReadyPromise(initialTailwindRuntime);
385
387
  let runtimeSet = /* @__PURE__ */ new Set();
386
- const runtimeState = {
388
+ const runtimeState = require_runtime_state.createCompilerRuntimeState({
387
389
  tailwindRuntime: initialTailwindRuntime,
388
390
  readyPromise,
389
391
  refreshTailwindcssRuntime
390
- };
392
+ });
391
393
  const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
392
394
  let cachedDefaultTemplateHandlerOptions;
393
395
  let cachedDefaultTemplateRuntimeSet;
@@ -397,7 +399,7 @@ function createNativeGulpPlugins(options = {}) {
397
399
  let runtimeSetInitialized = false;
398
400
  let runtimeSetDirty = false;
399
401
  const runtimeSourcesByFile = /* @__PURE__ */ new Map();
400
- const runtimeSnapshotState = require_hmr_timing.createRuntimeCompilationBuildState();
402
+ const runtimeSnapshotState = require_cache.createRuntimeCompilationBuildState();
401
403
  const generatedCssPreflightModeByFile = /* @__PURE__ */ new Map();
402
404
  const compilationScopeBySourceFile = /* @__PURE__ */ new Map();
403
405
  let cachedGulpSourceCandidateSignature;
@@ -434,10 +436,10 @@ function createNativeGulpPlugins(options = {}) {
434
436
  source: rawSource,
435
437
  type
436
438
  });
437
- require_hmr_timing.removeRuntimeCompilationBuildStateFiles(runtimeSnapshotState, pruneGulpRuntimeSourceCaches(runtimeSourcesByFile));
439
+ require_cache.removeRuntimeCompilationBuildStateFiles(runtimeSnapshotState, pruneGulpRuntimeSourceCaches(runtimeSourcesByFile));
438
440
  const snapshot = createGulpRuntimeSnapshot(runtimeSourcesByFile, runtimeSnapshotState, (source) => cache.computeHash(source));
439
441
  const changed = snapshot.changedByType[type].has(filename);
440
- require_hmr_timing.updateRuntimeCompilationBuildState(runtimeSnapshotState, snapshot, /* @__PURE__ */ new Map());
442
+ require_cache.updateRuntimeCompilationBuildState(runtimeSnapshotState, snapshot, /* @__PURE__ */ new Map());
441
443
  if (changed) invalidateGulpSourceCandidates();
442
444
  if (!changed && runtimeSetInitialized) return runtimeSet;
443
445
  if (!runtimeSetDirty) try {
@@ -606,19 +608,19 @@ function createNativeGulpPlugins(options = {}) {
606
608
  }
607
609
  /** 记录 Gulp watcher 提交的源码或生成依赖变化。 */
608
610
  async function watchChange(id, change = { event: "update" }) {
609
- require_v4_generation_core.beginCompilerShadowRun(runtimeState);
611
+ require_compiler.beginCompilerShadowRun(runtimeState);
610
612
  const file = node_path.default.resolve(id);
611
- const affectedScopes = require_v4_generation_core.recordCompilationDependencyChanges(runtimeState, require_v4_generation_core.createCompilationDependencyChanges([file]));
613
+ const affectedScopes = require_compiler.recordCompilationDependencyChanges(runtimeState, require_compiler.createCompilationDependencyChanges([file]));
612
614
  invalidateGulpSourceCandidates();
613
615
  if (change.event === "delete") {
614
616
  const removedRuntimeSource = runtimeSourcesByFile.delete(file);
615
617
  const removedCssSource = require_generator.removeTailwindV4CssSource(opts, file);
616
618
  const removedScopeId = compilationScopeBySourceFile.get(file);
617
619
  if (removedScopeId) {
618
- require_v4_generation_core.invalidateCompilationScope(runtimeState, removedScopeId);
620
+ require_compiler.invalidateCompilationScope(runtimeState, removedScopeId);
619
621
  compilationScopeBySourceFile.delete(file);
620
622
  }
621
- require_hmr_timing.removeRuntimeCompilationBuildStateFiles(runtimeSnapshotState, [file]);
623
+ require_cache.removeRuntimeCompilationBuildStateFiles(runtimeSnapshotState, [file]);
622
624
  generatedCssPreflightModeByFile.delete(file);
623
625
  gulpProcessCacheKeys.delete(file);
624
626
  cache.instance.delete(file);
@@ -637,7 +639,7 @@ function createNativeGulpPlugins(options = {}) {
637
639
  createRuntimeSetHash,
638
640
  debug,
639
641
  generatedCssPreflightModeByFile,
640
- getCompilationDependencyRevision: (scopeId) => require_v4_generation_core.getCompilationScopeDependencyRevision(runtimeState, scopeId),
642
+ getCompilationDependencyRevision: (scopeId) => require_compiler.getCompilationScopeDependencyRevision(runtimeState, scopeId),
641
643
  getSourceCandidateGetter: () => cachedGulpSourceCandidateGetter,
642
644
  getSourceCandidateSourceGetter: () => cachedGulpSourceCandidateSourceGetter,
643
645
  getRuntimeSet: () => runtimeSet,
@@ -656,13 +658,13 @@ function createNativeGulpPlugins(options = {}) {
656
658
  resolveWxssUserHandlerOptions,
657
659
  runtimeState
658
660
  }),
659
- beginCompilerShadowRun: () => require_v4_generation_core.beginCompilerShadowRun(runtimeState),
661
+ beginCompilerShadowRun: () => require_compiler.beginCompilerShadowRun(runtimeState),
660
662
  completeCompilerShadowRun: (revision) => require_hmr_timing.finalizeCompilerShadowRun(runtimeState, { revision }),
661
663
  async dispose() {
662
- await require_v4_generation_core.disposeCompilerOwner(runtimeState);
664
+ await require_compiler.disposeCompilerOwner(runtimeState);
663
665
  await bundleRuntimeClassSetManager.reset();
664
666
  },
665
- getCompilerShadowRunSnapshot: () => require_v4_generation_core.getCompilerShadowRunSnapshot(runtimeState),
667
+ getCompilerShadowRunSnapshot: () => require_compiler.getCompilerShadowRunSnapshot(runtimeState),
666
668
  watchChange
667
669
  };
668
670
  }
package/dist/gulp.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_gulp = require("./gulp-ChecVI6A.cjs");
2
+ const require_gulp = require("./gulp-Dtc01FdI.cjs");
3
3
  exports.WeappTailwindcss = require_gulp.createPlugins;
4
4
  exports.createPlugins = require_gulp.createPlugins;
5
5
  exports.weappTailwindcss = require_gulp.createPlugins;
package/dist/gulp.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as createPlugins } from "./gulp-D6LcfRz_.js";
1
+ import { t as createPlugins } from "./gulp-CVUiPXPy.js";
2
2
  export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
@@ -1,174 +1,12 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
- const require_generator = require("./generator-WlhrtNa3.cjs");
3
- const require_tailwindcss = require("./tailwindcss-D3jltF7M.cjs");
4
- const require_v4_generation_core = require("./v4-generation-core-CPKNwzjz.cjs");
5
- const require_wxml = require("./wxml-o-CUulAM.cjs");
2
+ const require_generator = require("./generator-DsrQ9txU.cjs");
3
+ const require_tailwindcss = require("./tailwindcss-C-jBBQfw.cjs");
4
+ const require_v4_generation_core = require("./v4-generation-core-DuIVZvRz.cjs");
5
+ const require_compiler = require("./compiler-SwMb3lOX.cjs");
6
6
  let node_process = require("node:process");
7
7
  node_process = require_rolldown_runtime.__toESM(node_process, 1);
8
8
  let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
9
9
  let _weapp_core_escape = require("@weapp-core/escape");
10
- //#region src/compiler/runtime-build-state.ts
11
- function invertLinkedByEntry(linkedByEntry) {
12
- const dependentsByLinkedFile = /* @__PURE__ */ new Map();
13
- for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
14
- let dependents = dependentsByLinkedFile.get(linkedFile);
15
- if (!dependents) {
16
- dependents = /* @__PURE__ */ new Set();
17
- dependentsByLinkedFile.set(linkedFile, dependents);
18
- }
19
- dependents.add(entryFile);
20
- }
21
- return dependentsByLinkedFile;
22
- }
23
- function replaceMapEntries(target, source) {
24
- target.clear();
25
- for (const [key, value] of source) target.set(key, value);
26
- return target;
27
- }
28
- function mergeMapEntries(target, source) {
29
- for (const [key, value] of source) target.set(key, value);
30
- return target;
31
- }
32
- function createRuntimeCompilationBuildState() {
33
- return {
34
- iteration: 0,
35
- sourceHashByFile: /* @__PURE__ */ new Map(),
36
- runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
37
- runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
38
- linkedByEntry: /* @__PURE__ */ new Map(),
39
- dependentsByLinkedFile: /* @__PURE__ */ new Map(),
40
- bundleMarkupCandidatesByFile: /* @__PURE__ */ new Map(),
41
- generatorCandidateSignature: void 0
42
- };
43
- }
44
- function updateRuntimeCompilationBuildState(state, snapshot, linkedByEntry, options = {}) {
45
- const incremental = options.incremental === true;
46
- removeRuntimeCompilationBuildStateFiles(state, snapshot.removedFiles);
47
- state.iteration += 1;
48
- state.sourceHashByFile = incremental ? mergeMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile) : replaceMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile);
49
- state.runtimeAffectingSignatureByFile.clear();
50
- state.runtimeAffectingHashByFile = incremental ? mergeMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile) : replaceMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile);
51
- state.linkedByEntry = incremental ? mergeMapEntries(state.linkedByEntry, linkedByEntry) : replaceMapEntries(state.linkedByEntry, linkedByEntry);
52
- state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
53
- }
54
- function removeRuntimeCompilationBuildStateFiles(state, files) {
55
- const removedFiles = new Set(files);
56
- if (removedFiles.size === 0) return;
57
- for (const file of removedFiles) {
58
- state.sourceHashByFile.delete(file);
59
- state.runtimeAffectingSignatureByFile.delete(file);
60
- state.runtimeAffectingHashByFile.delete(file);
61
- state.bundleMarkupCandidatesByFile.delete(file);
62
- state.linkedByEntry.delete(file);
63
- }
64
- for (const linkedFiles of state.linkedByEntry.values()) for (const file of removedFiles) linkedFiles.delete(file);
65
- state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
66
- }
67
- function resetRuntimeCompilationBuildState(state) {
68
- state.iteration = 0;
69
- state.sourceHashByFile.clear();
70
- state.runtimeAffectingSignatureByFile.clear();
71
- state.runtimeAffectingHashByFile.clear();
72
- state.linkedByEntry.clear();
73
- state.dependentsByLinkedFile.clear();
74
- state.bundleMarkupCandidatesByFile.clear();
75
- state.generatorCandidateSignature = void 0;
76
- }
77
- function createRuntimeCompilationAffectingSignature(snapshot, computeHash) {
78
- const entries = [...snapshot.runtimeAffectingHashByFile].sort(([first], [second]) => first.localeCompare(second)).map(([file, hash]) => `${file}:${hash}`);
79
- return entries.length === 0 ? "runtime-affecting:0" : `runtime-affecting:1:${computeHash(entries.join("\n"))}`;
80
- }
81
- //#endregion
82
- //#region src/compiler/runtime-snapshot.ts
83
- function createChangedByType() {
84
- return {
85
- html: /* @__PURE__ */ new Set(),
86
- js: /* @__PURE__ */ new Set(),
87
- css: /* @__PURE__ */ new Set(),
88
- other: /* @__PURE__ */ new Set()
89
- };
90
- }
91
- function createProcessFiles() {
92
- return {
93
- html: /* @__PURE__ */ new Set(),
94
- js: /* @__PURE__ */ new Set(),
95
- css: /* @__PURE__ */ new Set()
96
- };
97
- }
98
- function markProcessFile(type, file, processFiles) {
99
- if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
100
- }
101
- function markFilesByEntryType(files, entriesByFile, target) {
102
- for (const file of files ?? []) {
103
- const entry = entriesByFile.get(file);
104
- if (entry) target[entry.type].add(file);
105
- }
106
- }
107
- function createRuntimeCompilationSnapshot(entries, options = {}) {
108
- const changedByType = createChangedByType();
109
- const runtimeAffectingChangedByType = createChangedByType();
110
- const processFiles = createProcessFiles();
111
- const entriesByFile = new Map(entries.map((entry) => [entry.file, entry]));
112
- markFilesByEntryType(options.changedFiles, entriesByFile, changedByType);
113
- markFilesByEntryType(options.runtimeAffectingChangedFiles, entriesByFile, runtimeAffectingChangedByType);
114
- for (const file of options.processFiles ?? []) {
115
- const entry = entriesByFile.get(file);
116
- if (entry) markProcessFile(entry.type, file, processFiles);
117
- }
118
- return {
119
- entries,
120
- sourceHashByFile: /* @__PURE__ */ new Map(),
121
- runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
122
- runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
123
- hasOmittedKnownFiles: options.hasOmittedKnownFiles === true,
124
- removedFiles: new Set([...options.removedFiles ?? []].filter((file) => !entriesByFile.has(file))),
125
- changedByType,
126
- runtimeAffectingChangedByType,
127
- processFiles,
128
- linkedImpactsByEntry: /* @__PURE__ */ new Map()
129
- };
130
- }
131
- function buildRuntimeCompilationSnapshot(entries, state, options) {
132
- const snapshot = createRuntimeCompilationSnapshot(entries, {
133
- hasOmittedKnownFiles: options.hasOmittedKnownFiles,
134
- removedFiles: options.removedFiles
135
- });
136
- const firstRun = state.iteration === 0 && state.sourceHashByFile.size === 0;
137
- for (const entry of entries) {
138
- const { file, source, type } = entry;
139
- const hash = options.computeHash(source);
140
- snapshot.sourceHashByFile.set(file, hash);
141
- const previousHash = state.sourceHashByFile.get(file);
142
- const changed = previousHash == null || previousHash !== hash;
143
- const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
144
- const runtimeAffectingHash = !changed && previousRuntimeAffectingHash != null ? previousRuntimeAffectingHash : (() => {
145
- const signature = options.createRuntimeAffectingSignature(source, type);
146
- snapshot.runtimeAffectingSignatureByFile.set(file, signature);
147
- return options.computeHash(signature);
148
- })();
149
- snapshot.runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
150
- if (changed) snapshot.changedByType[type].add(file);
151
- if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) snapshot.runtimeAffectingChangedByType[type].add(file);
152
- if (options.forceAll || firstRun) markProcessFile(type, file, snapshot.processFiles);
153
- else if (type === "html") snapshot.processFiles.html.add(file);
154
- else if (changed && (type === "js" || type === "css")) snapshot.processFiles[type].add(file);
155
- }
156
- if (!options.forceAll && !firstRun) for (const changedFile of snapshot.changedByType.js) {
157
- const dependents = state.dependentsByLinkedFile.get(changedFile);
158
- if (!dependents) continue;
159
- for (const entryFile of dependents) {
160
- snapshot.processFiles.js.add(entryFile);
161
- let impacts = snapshot.linkedImpactsByEntry.get(entryFile);
162
- if (!impacts) {
163
- impacts = /* @__PURE__ */ new Set();
164
- snapshot.linkedImpactsByEntry.set(entryFile, impacts);
165
- }
166
- impacts.add(changedFile);
167
- }
168
- }
169
- return snapshot;
170
- }
171
- //#endregion
172
10
  //#region src/compiler/shadow-gate.ts
173
11
  const COMPILER_SHADOW_GATE_ENV = "WEAPP_TAILWINDCSS_COMPILER_SHADOW_GATE";
174
12
  function resolveCompilerShadowGateMode(env = node_process.default.env) {
@@ -193,7 +31,7 @@ function emitCompilerShadowGateResult(payload) {
193
31
  function finalizeCompilerShadowRun(owner, options = {}) {
194
32
  const env = options.env ?? node_process.default.env;
195
33
  if (require_v4_generation_core.resolveCompilerMode(env) !== "shadow") return;
196
- const snapshot = require_v4_generation_core.completeCompilerShadowReportRun(owner, options.revision);
34
+ const snapshot = require_compiler.completeCompilerShadowReportRun(owner, options.revision);
197
35
  if (!snapshot) return;
198
36
  const result = evaluateCompilerShadowGate(snapshot, resolveCompilerShadowGateMode(env));
199
37
  if (result.mode !== "off") {
@@ -227,7 +65,7 @@ function resolveEntryExtension(entry) {
227
65
  }
228
66
  //#endregion
229
67
  //#region src/bundlers/shared/runtime-class-set.ts
230
- const debug = require_wxml.createDebug("[runtime-set] ");
68
+ const debug = require_compiler.createDebug("[runtime-set] ");
231
69
  function createExtractOptions(context, source, bareArbitraryValues) {
232
70
  return {
233
71
  cwd: context.projectRoot,
@@ -390,25 +228,6 @@ function createRuntimeClassSetManager(options = {}) {
390
228
  };
391
229
  }
392
230
  //#endregion
393
- //#region src/bundlers/shared/cache.ts
394
- async function processCachedTask({ cache, cacheKey, hashKey = cacheKey, rawSource, hash, readCache, applyResult, transform, onCacheHit }) {
395
- let cacheHit = false;
396
- const result = await cache.process({
397
- key: cacheKey,
398
- hashKey,
399
- rawSource,
400
- hash,
401
- resolveCache: readCache,
402
- async onCacheHit(value) {
403
- cacheHit = true;
404
- await applyResult(value, { cacheHit: true });
405
- onCacheHit?.();
406
- },
407
- transform
408
- });
409
- if (!cacheHit) await applyResult(result, { cacheHit: false });
410
- }
411
- //#endregion
412
231
  //#region src/bundlers/shared/hmr-timing.ts
413
232
  function shouldEmitHmrTiming() {
414
233
  return node_process.default.env["WEAPP_TW_WATCH_REGRESSION"] === "1" || node_process.default.env["WEAPP_TW_HMR_TIMING"] === "1";
@@ -487,12 +306,6 @@ function createHmrTimingRecorder(bundler) {
487
306
  };
488
307
  }
489
308
  //#endregion
490
- Object.defineProperty(exports, "buildRuntimeCompilationSnapshot", {
491
- enumerable: true,
492
- get: function() {
493
- return buildRuntimeCompilationSnapshot;
494
- }
495
- });
496
309
  Object.defineProperty(exports, "createHmrTimingRecorder", {
497
310
  enumerable: true,
498
311
  get: function() {
@@ -505,18 +318,6 @@ Object.defineProperty(exports, "createRuntimeClassSetManager", {
505
318
  return createRuntimeClassSetManager;
506
319
  }
507
320
  });
508
- Object.defineProperty(exports, "createRuntimeCompilationAffectingSignature", {
509
- enumerable: true,
510
- get: function() {
511
- return createRuntimeCompilationAffectingSignature;
512
- }
513
- });
514
- Object.defineProperty(exports, "createRuntimeCompilationBuildState", {
515
- enumerable: true,
516
- get: function() {
517
- return createRuntimeCompilationBuildState;
518
- }
519
- });
520
321
  Object.defineProperty(exports, "emitHmrTiming", {
521
322
  enumerable: true,
522
323
  get: function() {
@@ -529,27 +330,3 @@ Object.defineProperty(exports, "finalizeCompilerShadowRun", {
529
330
  return finalizeCompilerShadowRun;
530
331
  }
531
332
  });
532
- Object.defineProperty(exports, "processCachedTask", {
533
- enumerable: true,
534
- get: function() {
535
- return processCachedTask;
536
- }
537
- });
538
- Object.defineProperty(exports, "removeRuntimeCompilationBuildStateFiles", {
539
- enumerable: true,
540
- get: function() {
541
- return removeRuntimeCompilationBuildStateFiles;
542
- }
543
- });
544
- Object.defineProperty(exports, "resetRuntimeCompilationBuildState", {
545
- enumerable: true,
546
- get: function() {
547
- return resetRuntimeCompilationBuildState;
548
- }
549
- });
550
- Object.defineProperty(exports, "updateRuntimeCompilationBuildState", {
551
- enumerable: true,
552
- get: function() {
553
- return updateRuntimeCompilationBuildState;
554
- }
555
- });