weapp-tailwindcss 5.4.2 → 5.5.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 (91) hide show
  1. package/README.md +13 -1
  2. package/README.zh-CN.md +13 -1
  3. package/dist/bundlers/shared/final-css-cleanup.d.ts +1 -1
  4. package/dist/bundlers/shared/v4-generation-core.d.ts +1 -0
  5. package/dist/bundlers/vite/capability-profile.d.ts +1 -0
  6. package/dist/bundlers/vite/css-finalizer/web-plugin.d.ts +3 -0
  7. package/dist/bundlers/vite/css-handler-options.d.ts +32 -0
  8. package/dist/bundlers/vite/{generate-bundle/css-output.d.ts → css-output.d.ts} +1 -1
  9. package/dist/bundlers/vite/frameworks/generic/web.d.ts +2 -0
  10. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +2 -32
  11. package/dist/bundlers/vite/generate-bundle/finalize/root-import-shell.d.ts +1 -1
  12. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +2 -2
  13. package/dist/bundlers/vite/generate-bundle/runtime.d.ts +1 -1
  14. package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +1 -1
  15. package/dist/bundlers/vite/generate-bundle.d.ts +1 -1
  16. package/dist/bundlers/vite/runtime-class-set.d.ts +1 -5
  17. package/dist/bundlers/vite/shared/create-css-only-plugins-runtime.d.ts +3 -0
  18. package/dist/cache-CBJFB1HN.cjs +223 -0
  19. package/dist/compiler/events.d.ts +32 -0
  20. package/dist/compiler/host.d.ts +13 -0
  21. package/dist/compiler/index.d.ts +3 -0
  22. package/dist/compiler/runtime-state.d.ts +17 -0
  23. package/dist/compiler-B0YSc0DY.js +4877 -0
  24. package/dist/{wxml-o-CUulAM.cjs → compiler-D2ZJc3uA.cjs} +3649 -283
  25. package/dist/core.cjs +6 -3
  26. package/dist/core.d.ts +2 -0
  27. package/dist/core.js +4 -4
  28. package/dist/defaults-B5ep0ojb.js +120 -0
  29. package/dist/defaults-BI9j1znS.cjs +156 -0
  30. package/dist/defaults.cjs +5 -121
  31. package/dist/defaults.js +1 -116
  32. package/dist/final-css-cleanup-B0HUBtiE.js +308 -0
  33. package/dist/final-css-cleanup-DSjczga3.cjs +138 -0
  34. package/dist/{generator-WlhrtNa3.cjs → generator-DsrQ9txU.cjs} +62 -5
  35. package/dist/{generator-BjK5PRR-.js → generator-DyXTBPmE.js} +47 -2
  36. package/dist/generator.cjs +1 -1
  37. package/dist/generator.js +1 -1
  38. package/dist/{gulp-ChecVI6A.cjs → gulp-C9ENAx3f.cjs} +30 -28
  39. package/dist/{gulp-D6LcfRz_.js → gulp-DXeQfvVC.js} +7 -7
  40. package/dist/gulp.cjs +1 -1
  41. package/dist/gulp.js +1 -1
  42. package/dist/{hmr-timing-afnWvy7u.cjs → hmr-timing-Cz4IesEM.cjs} +6 -229
  43. package/dist/{hmr-timing-CqDfjvqE.js → hmr-timing-DNxQm-bN.js} +6 -1258
  44. package/dist/index.cjs +4 -4
  45. package/dist/index.js +4 -4
  46. package/dist/{pipeline-helpers-DxPFMGxz.cjs → pipeline-helpers-CSGnR5gh.cjs} +6 -5
  47. package/dist/postcss.cjs +1 -1
  48. package/dist/postcss.js +1 -1
  49. package/dist/presets.cjs +4 -4
  50. package/dist/presets.js +2 -2
  51. package/dist/rspack.cjs +2 -2
  52. package/dist/rspack.js +2 -2
  53. package/dist/runtime-state-BBQcA0n5.cjs +54 -0
  54. package/dist/{source-candidate-scan-signature-FywFU3Rg.cjs → scoped-generator-TVjEaOeP.cjs} +5 -123
  55. package/dist/{source-candidate-scan-signature-BVScymyM.js → scoped-generator-kRj_5Axx.js} +4 -92
  56. package/dist/source-candidate-scan-signature-B7cUxqqX.cjs +129 -0
  57. package/dist/source-candidate-scan-signature-CsP4BQNa.js +92 -0
  58. package/dist/style-injector/internal.d.ts +1 -1
  59. package/dist/style-injector/vite-web.d.ts +3 -0
  60. package/dist/{tailwindcss-9xmoCkaR.js → tailwindcss-BK9S7zuq.js} +1 -2
  61. package/dist/{tailwindcss-D3jltF7M.cjs → tailwindcss-C-jBBQfw.cjs} +8 -9
  62. package/dist/{transform-DQhgAarN.js → transform-CfOzh007.js} +3 -3
  63. package/dist/{transform-C6k9zTQR.cjs → transform-DUPOPZ54.cjs} +27 -27
  64. package/dist/uni-app-x/vite/style-source.d.ts +11 -0
  65. package/dist/{v4-generation-core-CPKNwzjz.cjs → v4-generation-core-CRNUU_Rr.cjs} +29 -1172
  66. package/dist/vite/web.cjs +27 -0
  67. package/dist/vite/web.d.ts +1 -0
  68. package/dist/vite/web.js +25 -0
  69. package/dist/{vite-D3aCtpmv.js → vite-BXe-axax.js} +263 -3587
  70. package/dist/{vite-D-gmOkPN.cjs → vite-D_mAIfTU.cjs} +514 -3798
  71. package/dist/vite-web.d.ts +4 -0
  72. package/dist/vite.cjs +1 -1
  73. package/dist/vite.js +1 -1
  74. package/dist/weapp-tw-css-generation-loader.cjs +1 -1
  75. package/dist/weapp-tw-css-import-rewrite-loader.cjs +5 -5
  76. package/dist/web-B2Ea9K4B.cjs +4361 -0
  77. package/dist/web-Cv7ualrU.js +3796 -0
  78. package/dist/{webpack-B-6a8Z8F.js → webpack-7Um2GFtx.js} +13 -12
  79. package/dist/{webpack-yAne9ZYu.cjs → webpack-Ce04-btG.cjs} +51 -49
  80. package/dist/webpack.cjs +1 -1
  81. package/dist/webpack.js +1 -1
  82. package/package.json +13 -4
  83. package/dist/cache-options-DavPxrhC.cjs +0 -16
  84. package/dist/cache-options-DwBtLwQe.js +0 -5
  85. package/dist/compiler-B-m9VGqj.cjs +0 -2316
  86. package/dist/compiler-BgMj2E5l.js +0 -2051
  87. package/dist/local-style-matcher-DRpFEu1s.cjs +0 -34
  88. package/dist/local-style-matcher-DsiI2wIc.js +0 -17
  89. package/dist/object-B-8IHefx.js +0 -47
  90. package/dist/object-DbHtAXRk.cjs +0 -58
  91. package/dist/wxml-CvKyV69S.js +0 -1822
@@ -1,10 +1,8 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
- const require_generator = require("./generator-WlhrtNa3.cjs");
2
+ const require_generator = require("./generator-DsrQ9txU.cjs");
3
3
  require("./auto-DtU6f3X6.cjs");
4
- const require_object = require("./object-DbHtAXRk.cjs");
5
- const require_tailwindcss = require("./tailwindcss-D3jltF7M.cjs");
6
- const require_wxml = require("./wxml-o-CUulAM.cjs");
7
- const require_compiler = require("./compiler-B-m9VGqj.cjs");
4
+ const require_tailwindcss = require("./tailwindcss-C-jBBQfw.cjs");
5
+ const require_compiler = require("./compiler-D2ZJc3uA.cjs");
8
6
  let node_fs = require("node:fs");
9
7
  let node_path = require("node:path");
10
8
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
@@ -15,7 +13,6 @@ let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
15
13
  let lru_cache = require("lru-cache");
16
14
  let node_fs_promises = require("node:fs/promises");
17
15
  let _weapp_core_escape = require("@weapp-core/escape");
18
- let node_buffer = require("node:buffer");
19
16
  let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
20
17
  //#region src/bundlers/shared/source-candidates/scan-root.ts
21
18
  const TAILWIND_V4_IGNORED_CONTENT_DIRS = [
@@ -250,11 +247,11 @@ async function extractTemplateAttributeCandidates(source, extension, options) {
250
247
  if (!TEMPLATE_SOURCE_CANDIDATE_EXTENSIONS.has(extension)) return [];
251
248
  if (!options.customAttributesEntities?.length) return [];
252
249
  const candidates = /* @__PURE__ */ new Set();
253
- const matchCustomAttribute = require_wxml.createAttributeMatcher(options.customAttributesEntities);
250
+ const matchCustomAttribute = require_compiler.createAttributeMatcher(options.customAttributesEntities);
254
251
  const defaultTemplateHandlerEnabled = !options.disabledDefaultTemplateHandler;
255
252
  let tag = "";
256
253
  const tasks = [];
257
- const parser = new require_wxml.Parser({
254
+ const parser = new require_compiler.Parser({
258
255
  onopentagname(name) {
259
256
  tag = name;
260
257
  },
@@ -280,13 +277,13 @@ async function extractScriptStringCandidates(source, extension, options) {
280
277
  if (!SCRIPT_SOURCE_CANDIDATE_EXTENSIONS.has(extension)) return [];
281
278
  const values = /* @__PURE__ */ new Set();
282
279
  try {
283
- const ast = require_wxml.babelParse(source, {
280
+ const ast = require_compiler.babelParse(source, {
284
281
  cache: true,
285
282
  cacheKey: `source-candidates:${extension}`,
286
283
  plugins: ["jsx", "typescript"],
287
284
  sourceType: "unambiguous"
288
285
  });
289
- require_wxml.traverse(ast, {
286
+ require_compiler.traverse(ast, {
290
287
  noScope: true,
291
288
  StringLiteral(path) {
292
289
  values.add(path.node.value);
@@ -744,730 +741,6 @@ function createSourceCandidateCollector(options = {}) {
744
741
  return createSourceCandidateStore(options);
745
742
  }
746
743
  //#endregion
747
- //#region src/compiler/artifact.ts
748
- function createCssFragment(options) {
749
- return {
750
- id: options.id,
751
- kind: options.kind,
752
- root: _weapp_tailwindcss_postcss.postcss.parse(options.css, { from: options.sourceId }),
753
- sourceId: options.sourceId,
754
- scope: options.scope,
755
- order: options.order ?? 0,
756
- stage: options.stage ?? "raw"
757
- };
758
- }
759
- function cloneCssFragment(fragment) {
760
- return {
761
- ...fragment,
762
- root: fragment.root.clone(),
763
- scope: { ...fragment.scope }
764
- };
765
- }
766
- function cloneGenerationArtifact(artifact) {
767
- return {
768
- fragments: artifact.fragments.map(cloneCssFragment),
769
- classSet: new Set(artifact.classSet),
770
- rawCandidates: new Set(artifact.rawCandidates),
771
- dependencies: [...artifact.dependencies],
772
- sourceEntries: [...artifact.sourceEntries],
773
- ...artifact.revision === void 0 ? {} : { revision: artifact.revision }
774
- };
775
- }
776
- function createGenerationArtifact(fragments, options) {
777
- return cloneGenerationArtifact({
778
- fragments,
779
- ...options
780
- });
781
- }
782
- //#endregion
783
- //#region src/compiler/compilation-scope-graph.ts
784
- function sourceNodeId(sourceId) {
785
- return `source:${sourceId}`;
786
- }
787
- function dependencyNodeId(dependencyId) {
788
- return `dependency:${dependencyId}`;
789
- }
790
- function createCompilationDependencyChanges(dependencyIds, type = "dependency-changed") {
791
- return [...new Set(dependencyIds)].map((id) => ({
792
- id,
793
- type
794
- }));
795
- }
796
- function mergeCompilationDependencyChanges(...groups) {
797
- const changes = /* @__PURE__ */ new Map();
798
- for (const group of groups) for (const change of group ?? []) {
799
- const previous = changes.get(change.id);
800
- changes.set(change.id, {
801
- id: change.id,
802
- type: previous?.type === "config-changed" ? previous.type : change.type
803
- });
804
- }
805
- return [...changes.values()];
806
- }
807
- function mergeCompilationScopeDependencies(...groups) {
808
- const dependencies = /* @__PURE__ */ new Map();
809
- for (const group of groups) for (const dependency of group ?? []) {
810
- const previous = dependencies.get(dependency.id);
811
- if (previous && previous.kind !== dependency.kind) throw new Error(`同一个依赖不能对应不同类型:${dependency.id}`);
812
- dependencies.set(dependency.id, { ...dependency });
813
- }
814
- return [...dependencies.values()];
815
- }
816
- function dependencySignature(source) {
817
- return mergeCompilationScopeDependencies(source.dependencies).map((dependency) => `${dependency.kind}\0${dependency.id}`).sort().join("\0");
818
- }
819
- function createCompilationScopeGraph(scope, outputId, sources) {
820
- const normalizedSources = [...sources].map((source) => ({
821
- ...source,
822
- dependencies: mergeCompilationScopeDependencies(source.dependencies)
823
- }));
824
- const dependencies = mergeCompilationScopeDependencies(...normalizedSources.map((source) => source.dependencies));
825
- const outputNodeId = `asset:${outputId}`;
826
- return {
827
- nodes: [
828
- ...normalizedSources.map((source) => ({
829
- id: sourceNodeId(source.id),
830
- kind: source.kind,
831
- scope: { ...scope },
832
- ...source.content === void 0 ? {} : { content: source.content }
833
- })),
834
- ...dependencies.map((dependency) => ({
835
- id: dependencyNodeId(dependency.id),
836
- kind: dependency.kind,
837
- scope: { ...scope }
838
- })),
839
- {
840
- id: outputNodeId,
841
- kind: "asset",
842
- scope: { ...scope }
843
- }
844
- ],
845
- edges: normalizedSources.flatMap((source) => [{
846
- from: sourceNodeId(source.id),
847
- to: outputNodeId,
848
- kind: "emits-to"
849
- }, ...source.dependencies.map((dependency) => ({
850
- from: sourceNodeId(source.id),
851
- to: dependencyNodeId(dependency.id),
852
- kind: "depends-on"
853
- }))])
854
- };
855
- }
856
- function createCompilationScopeSnapshot(scope, outputId, sources, options = {}) {
857
- const normalizedSources = [...sources];
858
- return {
859
- ...createCompilationScopeGraph(scope, outputId, normalizedSources),
860
- candidatesBySource: normalizedSources.map((source) => [sourceNodeId(source.id), source.candidates]),
861
- ...options.changes === void 0 ? {} : { changes: options.changes },
862
- ...options.preserveDeletedCss === void 0 ? {} : { preserveDeletedCss: options.preserveDeletedCss },
863
- ...options.validatedClassSet === void 0 ? {} : { validatedClassSet: options.validatedClassSet }
864
- };
865
- }
866
- //#endregion
867
- //#region src/compiler/compilation-dependency-state.ts
868
- var CompilationDependencyState = class {
869
- constructor() {
870
- require_object._defineProperty(this, "revisions", /* @__PURE__ */ new Map());
871
- }
872
- getAffectedScopes(entries, changes) {
873
- return new Set(this.getAffectedScopeChanges(entries, changes).keys());
874
- }
875
- getAffectedScopeChanges(entries, changes) {
876
- const changesByNodeId = new Map([...changes].map((change) => [dependencyNodeId(change.id), change]));
877
- const affectedScopeChanges = /* @__PURE__ */ new Map();
878
- for (const entry of entries) {
879
- const scopeChanges = entry.latest?.graphNodes.map((node) => changesByNodeId.get(node.id)).filter((change) => change !== void 0);
880
- if (scopeChanges && scopeChanges.length > 0) affectedScopeChanges.set(entry.scope.id, scopeChanges.map((change) => ({ ...change })));
881
- }
882
- return affectedScopeChanges;
883
- }
884
- record(entries, changes) {
885
- const affectedScopes = this.getAffectedScopes(entries, changes);
886
- this.recordScopes(affectedScopes);
887
- return affectedScopes;
888
- }
889
- recordScopes(scopeIds) {
890
- for (const scopeId of scopeIds) this.revisions.set(scopeId, (this.revisions.get(scopeId) ?? 0) + 1);
891
- }
892
- getRevision(scopeId) {
893
- return this.revisions.get(scopeId) ?? 0;
894
- }
895
- delete(scopeId) {
896
- this.revisions.delete(scopeId);
897
- }
898
- clear() {
899
- this.revisions.clear();
900
- }
901
- };
902
- //#endregion
903
- //#region src/compiler/compiler-owner-state.ts
904
- const compilerOwnerDisposals = /* @__PURE__ */ new WeakMap();
905
- const compilerOwnerActivities = /* @__PURE__ */ new WeakMap();
906
- function ensureCompilerOwnerActive(owner) {
907
- if (compilerOwnerDisposals.has(owner)) throw new Error("Compiler owner 正在释放,不能创建新的编译状态。");
908
- }
909
- function acquireCompilerOwnerActivity(owner) {
910
- const currentDisposal = compilerOwnerDisposals.get(owner);
911
- if (currentDisposal) return currentDisposal.then(() => acquireCompilerOwnerActivity(owner));
912
- let state = compilerOwnerActivities.get(owner);
913
- if (!state) {
914
- state = {
915
- active: 0,
916
- idleWaiters: /* @__PURE__ */ new Set()
917
- };
918
- compilerOwnerActivities.set(owner, state);
919
- }
920
- state.active += 1;
921
- let released = false;
922
- return () => {
923
- if (released) return;
924
- released = true;
925
- state.active -= 1;
926
- if (state.active > 0) return;
927
- compilerOwnerActivities.delete(owner);
928
- for (const resolve of state.idleWaiters) resolve();
929
- state.idleWaiters.clear();
930
- };
931
- }
932
- function waitForCompilerOwnerIdle(owner) {
933
- const state = compilerOwnerActivities.get(owner);
934
- if (!state || state.active === 0) return Promise.resolve();
935
- return new Promise((resolve) => {
936
- state.idleWaiters.add(resolve);
937
- });
938
- }
939
- function runCompilerOwnerActivity(owner, activity) {
940
- const acquired = acquireCompilerOwnerActivity(owner);
941
- if (typeof acquired !== "function") return acquired.then((release) => runCompilerOwnerActivityWithRelease(activity, release));
942
- return runCompilerOwnerActivityWithRelease(activity, acquired);
943
- }
944
- function runCompilerOwnerActivityWithRelease(activity, release) {
945
- try {
946
- return Promise.resolve(activity()).finally(release);
947
- } catch (error) {
948
- release();
949
- return Promise.reject(error);
950
- }
951
- }
952
- function runCompilerOwnerDisposal(owner, dispose) {
953
- const currentDisposal = compilerOwnerDisposals.get(owner);
954
- if (currentDisposal) return currentDisposal;
955
- const disposal = Promise.resolve().then(async () => {
956
- await waitForCompilerOwnerIdle(owner);
957
- await dispose();
958
- }).finally(() => {
959
- if (compilerOwnerDisposals.get(owner) === disposal) compilerOwnerDisposals.delete(owner);
960
- });
961
- compilerOwnerDisposals.set(owner, disposal);
962
- return disposal;
963
- }
964
- //#endregion
965
- //#region src/compiler/compilation-session-pool.ts
966
- const COMPILATION_SCOPE_CACHE_MAX = 128;
967
- function cloneScopeSource(source) {
968
- return {
969
- ...source,
970
- candidates: new Set(source.candidates),
971
- dependencies: source.dependencies?.map((dependency) => ({ ...dependency }))
972
- };
973
- }
974
- var CompilationSessionPool = class {
975
- constructor() {
976
- require_object._defineProperty(this, "dependencyState", new CompilationDependencyState());
977
- require_object._defineProperty(this, "entries", /* @__PURE__ */ new Map());
978
- require_object._defineProperty(this, "disposed", false);
979
- }
980
- run(request, compile) {
981
- const entry = this.getEntry(request.scope);
982
- const execution = this.runEntry(entry, request, compile);
983
- entry.executions.add(execution);
984
- execution.then(() => entry.executions.delete(execution), () => entry.executions.delete(execution));
985
- return execution;
986
- }
987
- invalidateScope(scopeId) {
988
- const entry = this.entries.get(scopeId);
989
- if (!entry) return;
990
- entry.active = false;
991
- this.disposeEntry(entry);
992
- this.entries.delete(scopeId);
993
- this.dependencyState.delete(scopeId);
994
- }
995
- dispose() {
996
- if (this.disposed) return Promise.resolve();
997
- this.disposed = true;
998
- const entries = [...this.entries.values()];
999
- for (const entry of entries) entry.active = false;
1000
- this.entries.clear();
1001
- this.dependencyState.clear();
1002
- return Promise.all(entries.map((entry) => this.disposeEntry(entry))).then(() => void 0);
1003
- }
1004
- get size() {
1005
- return this.entries.size;
1006
- }
1007
- getAffectedScopes(changes) {
1008
- return this.dependencyState.getAffectedScopes(this.entries.values(), changes);
1009
- }
1010
- getAffectedScopeChanges(changes) {
1011
- return this.dependencyState.getAffectedScopeChanges(this.entries.values(), changes);
1012
- }
1013
- recordDependencyChanges(changes) {
1014
- return this.dependencyState.record(this.entries.values(), changes);
1015
- }
1016
- recordAffectedScopes(scopeIds) {
1017
- this.dependencyState.recordScopes(scopeIds);
1018
- }
1019
- getScopeDependencyRevision(scopeId) {
1020
- return this.dependencyState.getRevision(scopeId);
1021
- }
1022
- getEntry(scope) {
1023
- if (this.disposed) throw new Error("CompilationSessionPool 已释放。");
1024
- const cached = this.entries.get(scope.id);
1025
- if (cached) {
1026
- if (cached.scope.kind !== scope.kind) throw new Error(`同一个 scope id 不能对应不同类型:${scope.id}`);
1027
- this.entries.delete(scope.id);
1028
- this.entries.set(scope.id, cached);
1029
- return cached;
1030
- }
1031
- const entry = {
1032
- active: true,
1033
- executions: /* @__PURE__ */ new Set(),
1034
- pending: Promise.resolve(),
1035
- scope: { ...scope },
1036
- session: new require_compiler.DefaultCompilationSession(),
1037
- generatedDependencies: /* @__PURE__ */ new Map(),
1038
- sources: /* @__PURE__ */ new Map()
1039
- };
1040
- this.entries.set(scope.id, entry);
1041
- while (this.entries.size > COMPILATION_SCOPE_CACHE_MAX) {
1042
- const oldestScopeId = this.entries.keys().next().value;
1043
- if (oldestScopeId === void 0 || oldestScopeId === scope.id) break;
1044
- this.invalidateScope(oldestScopeId);
1045
- }
1046
- return entry;
1047
- }
1048
- async disposeEntry(entry) {
1049
- await Promise.allSettled([...entry.executions]);
1050
- await entry.pending;
1051
- entry.session.dispose();
1052
- }
1053
- async runEntry(entry, request, compile) {
1054
- const prepared = await this.enqueue(entry, () => this.prepareEntry(entry, request));
1055
- const value = await compile(prepared.compilation);
1056
- const validatedClassSet = request.preserveDeletedCss ? /* @__PURE__ */ new Set([...prepared.compilation.validatedClassSet, ...value?.classSet ?? []]) : new Set(value?.classSet ?? []);
1057
- const generatedDependencies = value?.dependenciesBySource === void 0 ? void 0 : this.normalizeGeneratedDependencies(value.dependenciesBySource, prepared.sources);
1058
- let committed = false;
1059
- let committedCompilation;
1060
- await this.enqueue(entry, () => {
1061
- if (!entry.active || entry.latest?.revision !== prepared.compilation.revision) return;
1062
- if (generatedDependencies) entry.generatedDependencies = generatedDependencies;
1063
- entry.latest = entry.session.commitValidation(prepared.compilation.revision, validatedClassSet, createCompilationScopeGraph(request.scope, request.outputId, this.createGraphSources(prepared.sources, entry.generatedDependencies)));
1064
- committedCompilation = this.toScopeState(entry.latest, prepared.sources);
1065
- committed = true;
1066
- });
1067
- const compilation = committedCompilation ?? {
1068
- ...prepared.compilation,
1069
- validatedClassSet
1070
- };
1071
- return committed ? {
1072
- committed,
1073
- compilation,
1074
- value
1075
- } : {
1076
- committed,
1077
- compilation
1078
- };
1079
- }
1080
- prepareEntry(entry, request) {
1081
- const nextSources = new Map(request.sources.map((source) => [source.id, cloneScopeSource(source)]));
1082
- const changes = [...request.changes ?? []].map((change) => ({
1083
- sourceId: dependencyNodeId(change.id),
1084
- type: change.type
1085
- }));
1086
- for (const sourceId of entry.sources.keys()) if (!nextSources.has(sourceId)) changes.push({
1087
- sourceId: sourceNodeId(sourceId),
1088
- type: "source-removed"
1089
- });
1090
- for (const [sourceId, source] of nextSources) {
1091
- const previous = entry.sources.get(sourceId);
1092
- if (previous && (previous.content !== source.content || dependencySignature(previous) !== dependencySignature(source))) changes.push({
1093
- sourceId: sourceNodeId(sourceId),
1094
- type: "dependency-changed"
1095
- });
1096
- }
1097
- entry.sources = nextSources;
1098
- entry.generatedDependencies = new Map([...entry.generatedDependencies].filter(([sourceId]) => nextSources.has(sourceId)));
1099
- entry.latest = entry.session.update(createCompilationScopeSnapshot(request.scope, request.outputId, this.createGraphSources(nextSources, entry.generatedDependencies), {
1100
- changes,
1101
- preserveDeletedCss: request.preserveDeletedCss
1102
- }));
1103
- return {
1104
- compilation: this.toScopeState(entry.latest, nextSources),
1105
- sources: nextSources
1106
- };
1107
- }
1108
- createGraphSources(sources, generatedDependencies) {
1109
- return [...sources.values()].map((source) => ({
1110
- ...source,
1111
- dependencies: mergeCompilationScopeDependencies(source.dependencies, generatedDependencies.get(source.id))
1112
- }));
1113
- }
1114
- normalizeGeneratedDependencies(dependenciesBySource, sources) {
1115
- const normalized = /* @__PURE__ */ new Map();
1116
- for (const [sourceId, dependencies] of dependenciesBySource) {
1117
- if (!sources.has(sourceId)) throw new Error(`生成结果引用了未知 source:${sourceId}`);
1118
- normalized.set(sourceId, mergeCompilationScopeDependencies(normalized.get(sourceId), dependencies));
1119
- }
1120
- return normalized;
1121
- }
1122
- enqueue(entry, task) {
1123
- const execution = entry.pending.then(task);
1124
- entry.pending = execution.then(() => void 0, () => void 0);
1125
- return execution;
1126
- }
1127
- toScopeState(compilation, sources) {
1128
- return {
1129
- ...compilation,
1130
- candidatesBySource: new Map([...sources.keys()].map((sourceId) => [sourceId, compilation.candidatesBySource.get(sourceNodeId(sourceId)) ?? /* @__PURE__ */ new Set()]))
1131
- };
1132
- }
1133
- };
1134
- const compilationSessionPools = /* @__PURE__ */ new WeakMap();
1135
- function getCompilationSessionPool(owner) {
1136
- ensureCompilerOwnerActive(owner);
1137
- let pool = compilationSessionPools.get(owner);
1138
- if (!pool) {
1139
- pool = new CompilationSessionPool();
1140
- compilationSessionPools.set(owner, pool);
1141
- }
1142
- return pool;
1143
- }
1144
- function disposeCompilationSessionPool(owner) {
1145
- const pool = compilationSessionPools.get(owner);
1146
- if (!pool) return Promise.resolve();
1147
- compilationSessionPools.delete(owner);
1148
- return pool.dispose();
1149
- }
1150
- //#endregion
1151
- //#region src/compiler/tailwind-generation-session-pool.ts
1152
- const SESSION_ENGINE_CACHE_MAX = 32;
1153
- function createSourceKey(source) {
1154
- return (0, _weapp_tailwindcss_shared_node.md5)([
1155
- source.projectRoot,
1156
- source.base,
1157
- source.baseFallbacks.join("\0"),
1158
- source.css,
1159
- source.dependencies.join("\0")
1160
- ].join("\0"));
1161
- }
1162
- function disposeGenerator(generator) {
1163
- generator?.dispose?.();
1164
- }
1165
- var TailwindGenerationSessionPool = class {
1166
- constructor() {
1167
- require_object._defineProperty(this, "generators", /* @__PURE__ */ new Map());
1168
- require_object._defineProperty(this, "disposed", false);
1169
- }
1170
- async generate(source, options) {
1171
- return this.getGenerator(source).generate(options);
1172
- }
1173
- async validateCandidates(source, candidates) {
1174
- return this.getGenerator(source).validateCandidates(candidates);
1175
- }
1176
- invalidate(change) {
1177
- if (change.type === "all" || change.type === "dependencies") {
1178
- for (const generator of this.generators.values()) disposeGenerator(generator);
1179
- this.generators.clear();
1180
- return;
1181
- }
1182
- const key = createSourceKey(change.source);
1183
- disposeGenerator(this.generators.get(key));
1184
- this.generators.delete(key);
1185
- }
1186
- dispose() {
1187
- for (const generator of this.generators.values()) disposeGenerator(generator);
1188
- this.generators.clear();
1189
- this.disposed = true;
1190
- }
1191
- get size() {
1192
- return this.generators.size;
1193
- }
1194
- getGenerator(source) {
1195
- if (this.disposed) throw new Error("TailwindGenerationSessionPool 已释放。");
1196
- const key = createSourceKey(source);
1197
- const cached = this.generators.get(key);
1198
- if (cached) {
1199
- this.generators.delete(key);
1200
- this.generators.set(key, cached);
1201
- return cached;
1202
- }
1203
- const generator = require_generator.createWeappTailwindcssGenerator(source);
1204
- this.generators.set(key, generator);
1205
- while (this.generators.size > SESSION_ENGINE_CACHE_MAX) {
1206
- const oldest = this.generators.keys().next().value;
1207
- if (oldest === void 0) break;
1208
- disposeGenerator(this.generators.get(oldest));
1209
- this.generators.delete(oldest);
1210
- }
1211
- return generator;
1212
- }
1213
- };
1214
- const sessionPools = /* @__PURE__ */ new WeakMap();
1215
- function getTailwindGenerationSessionPool(owner) {
1216
- ensureCompilerOwnerActive(owner);
1217
- let pool = sessionPools.get(owner);
1218
- if (!pool) {
1219
- pool = new TailwindGenerationSessionPool();
1220
- sessionPools.set(owner, pool);
1221
- }
1222
- return pool;
1223
- }
1224
- function disposeTailwindGenerationSessionPool(owner) {
1225
- const pool = sessionPools.get(owner);
1226
- if (!pool) return;
1227
- sessionPools.delete(owner);
1228
- pool.dispose();
1229
- }
1230
- //#endregion
1231
- //#region src/compiler/compilation-change-coordinator.ts
1232
- var CompilationChangeCoordinator = class {
1233
- constructor(compilationPool, generationPool) {
1234
- this.compilationPool = compilationPool;
1235
- this.generationPool = generationPool;
1236
- require_object._defineProperty(this, "pendingChangesByScope", /* @__PURE__ */ new Map());
1237
- require_object._defineProperty(this, "disposed", false);
1238
- }
1239
- record(changes) {
1240
- this.ensureActive();
1241
- const normalizedChanges = mergeCompilationDependencyChanges(changes);
1242
- if (normalizedChanges.length === 0) return /* @__PURE__ */ new Set();
1243
- const affectedScopeChanges = this.compilationPool.getAffectedScopeChanges(normalizedChanges);
1244
- const affectedScopes = new Set(affectedScopeChanges.keys());
1245
- const newlyPendingScopes = /* @__PURE__ */ new Set();
1246
- const invalidatedPaths = /* @__PURE__ */ new Set();
1247
- for (const [scopeId, scopeChanges] of affectedScopeChanges) {
1248
- let pendingChanges = this.pendingChangesByScope.get(scopeId);
1249
- if (!pendingChanges) {
1250
- pendingChanges = /* @__PURE__ */ new Map();
1251
- this.pendingChangesByScope.set(scopeId, pendingChanges);
1252
- newlyPendingScopes.add(scopeId);
1253
- }
1254
- for (const change of scopeChanges) {
1255
- const previous = pendingChanges.get(change.id);
1256
- const mergedChange = mergeCompilationDependencyChanges(previous ? [previous] : void 0, [change])[0];
1257
- if (!previous || previous.type !== mergedChange.type) {
1258
- pendingChanges.set(change.id, mergedChange);
1259
- invalidatedPaths.add(change.id);
1260
- }
1261
- }
1262
- }
1263
- if (newlyPendingScopes.size > 0) this.compilationPool.recordAffectedScopes(newlyPendingScopes);
1264
- if (invalidatedPaths.size > 0) this.generationPool.invalidate({
1265
- type: "dependencies",
1266
- paths: invalidatedPaths
1267
- });
1268
- return affectedScopes;
1269
- }
1270
- consume(scopeId) {
1271
- this.ensureActive();
1272
- const pendingChanges = this.pendingChangesByScope.get(scopeId);
1273
- if (!pendingChanges) return;
1274
- this.pendingChangesByScope.delete(scopeId);
1275
- return [...pendingChanges.values()].map((change) => ({ ...change }));
1276
- }
1277
- invalidateScope(scopeId) {
1278
- this.ensureActive();
1279
- this.pendingChangesByScope.delete(scopeId);
1280
- this.compilationPool.invalidateScope(scopeId);
1281
- }
1282
- getScopeDependencyRevision(scopeId) {
1283
- this.ensureActive();
1284
- return this.compilationPool.getScopeDependencyRevision(scopeId);
1285
- }
1286
- dispose() {
1287
- this.pendingChangesByScope.clear();
1288
- this.disposed = true;
1289
- }
1290
- ensureActive() {
1291
- if (this.disposed) throw new Error("CompilationChangeCoordinator 已释放。");
1292
- }
1293
- };
1294
- const compilationChangeCoordinators = /* @__PURE__ */ new WeakMap();
1295
- function getCompilationChangeCoordinator(owner) {
1296
- ensureCompilerOwnerActive(owner);
1297
- let coordinator = compilationChangeCoordinators.get(owner);
1298
- if (!coordinator) {
1299
- coordinator = new CompilationChangeCoordinator(getCompilationSessionPool(owner), getTailwindGenerationSessionPool(owner));
1300
- compilationChangeCoordinators.set(owner, coordinator);
1301
- }
1302
- return coordinator;
1303
- }
1304
- function recordCompilationDependencyChanges(owner, changes) {
1305
- return getCompilationChangeCoordinator(owner).record(changes);
1306
- }
1307
- function consumeCompilationScopeChanges(owner, scopeId) {
1308
- return getCompilationChangeCoordinator(owner).consume(scopeId);
1309
- }
1310
- function getCompilationScopeDependencyRevision(owner, scopeId) {
1311
- return getCompilationChangeCoordinator(owner).getScopeDependencyRevision(scopeId);
1312
- }
1313
- function invalidateCompilationScope(owner, scopeId) {
1314
- getCompilationChangeCoordinator(owner).invalidateScope(scopeId);
1315
- }
1316
- function disposeCompilationChangeCoordinator(owner) {
1317
- const coordinator = compilationChangeCoordinators.get(owner);
1318
- if (!coordinator) return;
1319
- compilationChangeCoordinators.delete(owner);
1320
- coordinator.dispose();
1321
- }
1322
- //#endregion
1323
- //#region src/compiler/composition.ts
1324
- function orderCssFragments(fragments) {
1325
- return [...fragments].sort((left, right) => left.order - right.order || left.id.localeCompare(right.id));
1326
- }
1327
- function composeGenerationArtifact(artifact) {
1328
- const cloned = cloneGenerationArtifact(artifact);
1329
- const root = _weapp_tailwindcss_postcss.postcss.root();
1330
- for (const fragment of orderCssFragments(cloned.fragments)) root.append(fragment.root.nodes.map((node) => node.clone()));
1331
- return {
1332
- artifact: cloned,
1333
- root,
1334
- css: root.toString()
1335
- };
1336
- }
1337
- //#endregion
1338
- //#region src/compiler/emission-plan.ts
1339
- var AssetEmissionPlan = class {
1340
- constructor() {
1341
- require_object._defineProperty(this, "emissions", /* @__PURE__ */ new Map());
1342
- require_object._defineProperty(this, "assetOperations", []);
1343
- }
1344
- upsert(assetId, artifact) {
1345
- this.emissions.set(assetId, cloneGenerationArtifact(artifact));
1346
- }
1347
- get(assetId) {
1348
- const artifact = this.emissions.get(assetId);
1349
- return artifact ? cloneGenerationArtifact(artifact) : void 0;
1350
- }
1351
- entries() {
1352
- return [...this.emissions].map(([assetId, artifact]) => ({
1353
- assetId,
1354
- artifact: cloneGenerationArtifact(artifact)
1355
- }));
1356
- }
1357
- write(assetId, source) {
1358
- this.assetOperations.push({
1359
- assetId,
1360
- kind: "write",
1361
- source
1362
- });
1363
- }
1364
- remove(assetId) {
1365
- this.assetOperations.push({
1366
- assetId,
1367
- kind: "delete"
1368
- });
1369
- }
1370
- operations() {
1371
- return this.assetOperations.map((operation) => ({ ...operation }));
1372
- }
1373
- clear() {
1374
- this.emissions.clear();
1375
- this.assetOperations.length = 0;
1376
- }
1377
- };
1378
- //#endregion
1379
- //#region src/compiler/framework-compiler-session.ts
1380
- /**
1381
- * 官方 bundler 共享的 compiler 生命周期边界。
1382
- *
1383
- * bundler 继续拥有模块图和 scope 投影;本层只负责把逻辑 source root
1384
- * 映射到一个长期复用的 compiler,并保证 root 删除与 owner 释放可等待。
1385
- */
1386
- var FrameworkCompilerSession = class {
1387
- constructor(options) {
1388
- require_object._defineProperty(this, "compiler", void 0);
1389
- require_object._defineProperty(this, "scopeRoots", /* @__PURE__ */ new Map());
1390
- require_object._defineProperty(this, "activeRoots", /* @__PURE__ */ new Set());
1391
- require_object._defineProperty(this, "transactionId", 0);
1392
- require_object._defineProperty(this, "disposed", false);
1393
- this.compiler = require_compiler.createCompiler(options);
1394
- }
1395
- rootId(scopeId, sourceId) {
1396
- return `framework:${this.encode(scopeId)}:${this.encode(sourceId)}`;
1397
- }
1398
- async generate(scopeId, sourceId, source, request) {
1399
- if (this.disposed) throw new Error("FrameworkCompilerSession 已释放。");
1400
- const stableId = this.rootId(scopeId, sourceId);
1401
- const id = this.activeRoots.has(stableId) ? `${stableId}:transaction-${++this.transactionId}` : stableId;
1402
- let roots = this.scopeRoots.get(scopeId);
1403
- if (!roots) {
1404
- roots = /* @__PURE__ */ new Set();
1405
- this.scopeRoots.set(scopeId, roots);
1406
- }
1407
- roots.add(stableId);
1408
- this.activeRoots.add(stableId);
1409
- try {
1410
- return await this.compiler.generate({
1411
- ...request,
1412
- id,
1413
- source: {
1414
- ...source,
1415
- dependencies: source.dependencies ?? []
1416
- }
1417
- });
1418
- } finally {
1419
- this.activeRoots.delete(stableId);
1420
- if (id !== stableId) await this.compiler.remove(id);
1421
- }
1422
- }
1423
- async syncScope(scopeId, sourceIds) {
1424
- if (this.disposed) return;
1425
- const roots = this.scopeRoots.get(scopeId);
1426
- if (!roots) return;
1427
- const active = new Set([...sourceIds].map((sourceId) => this.rootId(scopeId, sourceId)));
1428
- const removed = [...roots].filter((rootId) => !active.has(rootId));
1429
- await Promise.all(removed.map((rootId) => this.compiler.remove(rootId)));
1430
- for (const rootId of removed) roots.delete(rootId);
1431
- if (roots.size === 0) this.scopeRoots.delete(scopeId);
1432
- }
1433
- async removeScope(scopeId) {
1434
- const roots = this.scopeRoots.get(scopeId);
1435
- if (!roots) return;
1436
- this.scopeRoots.delete(scopeId);
1437
- await Promise.all([...roots].map((rootId) => this.compiler.remove(rootId)));
1438
- }
1439
- invalidate(ids) {
1440
- return this.compiler.invalidate(ids);
1441
- }
1442
- mergeSnapshots(snapshots) {
1443
- return this.compiler.mergeSnapshots(snapshots);
1444
- }
1445
- dispose() {
1446
- if (this.disposed) return Promise.resolve();
1447
- this.disposed = true;
1448
- this.scopeRoots.clear();
1449
- return this.compiler.dispose();
1450
- }
1451
- encode(value) {
1452
- return node_buffer.Buffer.from(value, "utf8").toString("base64url");
1453
- }
1454
- };
1455
- const frameworkCompilerSessions = /* @__PURE__ */ new WeakMap();
1456
- function getFrameworkCompilerSession(owner, options) {
1457
- let session = frameworkCompilerSessions.get(owner);
1458
- if (!session) {
1459
- session = new FrameworkCompilerSession(options);
1460
- frameworkCompilerSessions.set(owner, session);
1461
- }
1462
- return session;
1463
- }
1464
- function disposeFrameworkCompilerSession(owner) {
1465
- const session = frameworkCompilerSessions.get(owner);
1466
- if (!session) return Promise.resolve();
1467
- frameworkCompilerSessions.delete(owner);
1468
- return session.dispose();
1469
- }
1470
- //#endregion
1471
744
  //#region src/compiler/mode.ts
1472
745
  const COMPILER_MODE_ENV = "WEAPP_TAILWINDCSS_COMPILER";
1473
746
  function resolveCompilerMode(env = node_process.default.env) {
@@ -1475,252 +748,6 @@ function resolveCompilerMode(env = node_process.default.env) {
1475
748
  return value === "legacy" || value === "shadow" || value === "graph" ? value : "graph";
1476
749
  }
1477
750
  //#endregion
1478
- //#region src/compiler/shadow-report-session.ts
1479
- const COMPILER_SHADOW_REPORT_CACHE_MAX = 512;
1480
- function cloneSemanticValue(value) {
1481
- if (Array.isArray(value)) return value.map(cloneSemanticValue);
1482
- if (typeof value === "object" && value !== null) return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, cloneSemanticValue(entry)]));
1483
- return value;
1484
- }
1485
- function cloneCompilerShadowReport(report) {
1486
- return {
1487
- file: report.file,
1488
- scopeId: report.scopeId,
1489
- equal: report.equal,
1490
- differences: report.differences.map((difference) => ({
1491
- kind: difference.kind,
1492
- path: difference.path,
1493
- ..."left" in difference ? { left: cloneSemanticValue(difference.left) } : {},
1494
- ..."right" in difference ? { right: cloneSemanticValue(difference.right) } : {}
1495
- })),
1496
- truncated: report.truncated,
1497
- legacy: { ...report.legacy },
1498
- graph: { ...report.graph }
1499
- };
1500
- }
1501
- var CompilerShadowReportSession = class {
1502
- constructor(maxReports = COMPILER_SHADOW_REPORT_CACHE_MAX) {
1503
- this.maxReports = maxReports;
1504
- require_object._defineProperty(this, "reportsByScope", /* @__PURE__ */ new Map());
1505
- require_object._defineProperty(this, "revision", 0);
1506
- require_object._defineProperty(this, "dropped", 0);
1507
- require_object._defineProperty(this, "completed", false);
1508
- require_object._defineProperty(this, "disposed", false);
1509
- if (!Number.isInteger(maxReports) || maxReports <= 0) throw new Error("CompilerShadowReportSession 的 maxReports 必须是正整数。");
1510
- }
1511
- beginRun() {
1512
- this.ensureActive();
1513
- this.revision += 1;
1514
- this.reportsByScope.clear();
1515
- this.dropped = 0;
1516
- this.completed = false;
1517
- return this.revision;
1518
- }
1519
- record(report, revision = this.revision) {
1520
- this.ensureActive();
1521
- if (revision !== this.revision || this.completed) return false;
1522
- const cloned = cloneCompilerShadowReport(report);
1523
- this.reportsByScope.delete(cloned.scopeId);
1524
- this.reportsByScope.set(cloned.scopeId, cloned);
1525
- while (this.reportsByScope.size > this.maxReports) {
1526
- const oldestScopeId = this.reportsByScope.keys().next().value;
1527
- if (oldestScopeId === void 0) break;
1528
- this.reportsByScope.delete(oldestScopeId);
1529
- this.dropped += 1;
1530
- }
1531
- return true;
1532
- }
1533
- getRevision() {
1534
- this.ensureActive();
1535
- return this.revision;
1536
- }
1537
- completeRun(revision = this.revision) {
1538
- this.ensureActive();
1539
- if (revision !== this.revision) return;
1540
- this.completed = true;
1541
- return this.snapshot();
1542
- }
1543
- snapshot() {
1544
- this.ensureActive();
1545
- const reports = [...this.reportsByScope.values()].sort((left, right) => left.scopeId.localeCompare(right.scopeId)).map(cloneCompilerShadowReport);
1546
- return {
1547
- revision: this.revision,
1548
- completed: this.completed,
1549
- reports,
1550
- summary: {
1551
- total: reports.length,
1552
- matched: reports.filter((report) => report.equal).length,
1553
- mismatched: reports.filter((report) => !report.equal).length,
1554
- truncated: reports.filter((report) => report.truncated).length,
1555
- dropped: this.dropped
1556
- }
1557
- };
1558
- }
1559
- dispose() {
1560
- this.reportsByScope.clear();
1561
- this.dropped = 0;
1562
- this.completed = true;
1563
- this.disposed = true;
1564
- }
1565
- ensureActive() {
1566
- if (this.disposed) throw new Error("CompilerShadowReportSession 已释放。");
1567
- }
1568
- };
1569
- const compilerShadowReportSessions = /* @__PURE__ */ new WeakMap();
1570
- function getCompilerShadowReportSession(owner) {
1571
- ensureCompilerOwnerActive(owner);
1572
- let session = compilerShadowReportSessions.get(owner);
1573
- if (!session) {
1574
- session = new CompilerShadowReportSession();
1575
- compilerShadowReportSessions.set(owner, session);
1576
- }
1577
- return session;
1578
- }
1579
- function beginCompilerShadowRun(owner) {
1580
- return getCompilerShadowReportSession(owner).beginRun();
1581
- }
1582
- function getCompilerShadowRunRevision(owner) {
1583
- return getCompilerShadowReportSession(owner).getRevision();
1584
- }
1585
- function recordCompilerShadowReport(owner, report, revision) {
1586
- return getCompilerShadowReportSession(owner).record(report, revision);
1587
- }
1588
- function getCompilerShadowRunSnapshot(owner) {
1589
- return getCompilerShadowReportSession(owner).snapshot();
1590
- }
1591
- function completeCompilerShadowReportRun(owner, revision) {
1592
- return getCompilerShadowReportSession(owner).completeRun(revision);
1593
- }
1594
- function disposeCompilerShadowReportSession(owner) {
1595
- const session = compilerShadowReportSessions.get(owner);
1596
- if (!session) return;
1597
- compilerShadowReportSessions.delete(owner);
1598
- session.dispose();
1599
- }
1600
- //#endregion
1601
- //#region src/compiler/owner-lifecycle.ts
1602
- async function disposeCompilerOwnerResources(owner) {
1603
- disposeCompilationChangeCoordinator(owner);
1604
- await disposeCompilationSessionPool(owner);
1605
- await disposeFrameworkCompilerSession(owner);
1606
- disposeTailwindGenerationSessionPool(owner);
1607
- disposeCompilerShadowReportSession(owner);
1608
- }
1609
- function disposeCompilerOwner(owner) {
1610
- return runCompilerOwnerDisposal(owner, () => disposeCompilerOwnerResources(owner));
1611
- }
1612
- //#endregion
1613
- //#region src/compiler/platform-adapter.ts
1614
- function createStylePlatformAdapter(options) {
1615
- return {
1616
- id: options.id,
1617
- prepare(request) {
1618
- return {
1619
- ...request,
1620
- candidates: new Set(request.candidates),
1621
- scope: { ...request.scope }
1622
- };
1623
- },
1624
- async transform(artifact, context) {
1625
- const transformed = cloneGenerationArtifact(artifact);
1626
- for (const fragment of transformed.fragments) {
1627
- fragment.root = (await options.styleHandler.transformRoot(fragment.root, options.styleOptions)).root.clone();
1628
- fragment.stage = context.stage;
1629
- }
1630
- return transformed;
1631
- }
1632
- };
1633
- }
1634
- //#endregion
1635
- //#region src/compiler/runtime-affecting-signature.ts
1636
- const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
1637
- const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
1638
- const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
1639
- const CSS_WHITESPACE_RE = /\s+/g;
1640
- const JS_RUNTIME_AFFECTING_TEXT_HINT_RE = /["'`/]/;
1641
- const JS_INCOMPLETE_TRAILING_OPERATOR_RE = /(?:=>|[=+\-*%&|^!~?:,.({[\]])\s*$/;
1642
- const JS_AST_IGNORED_KEYS = /* @__PURE__ */ new Set([
1643
- "comments",
1644
- "errors",
1645
- "extra",
1646
- "innerComments",
1647
- "leadingComments",
1648
- "loc",
1649
- "tokens",
1650
- "trailingComments"
1651
- ]);
1652
- function isAstNode(value) {
1653
- return Boolean(value && typeof value === "object" && typeof value.type === "string");
1654
- }
1655
- function createHtmlRuntimeAffectingSignature(source) {
1656
- try {
1657
- const parts = [];
1658
- const parser = new require_wxml.Parser({
1659
- onattribute(name, value) {
1660
- parts.push(`a:${name}=${value}`);
1661
- },
1662
- oncomment(data) {
1663
- parts.push(`c:${data}`);
1664
- },
1665
- ontext(data) {
1666
- const value = data.trim();
1667
- if (value.length > 0) parts.push(`t:${value}`);
1668
- }
1669
- }, { xmlMode: true });
1670
- parser.write(source);
1671
- parser.end();
1672
- return parts.join("\n");
1673
- } catch {
1674
- return source;
1675
- }
1676
- }
1677
- function createJsRuntimeAffectingSignature(source) {
1678
- if (!JS_RUNTIME_AFFECTING_TEXT_HINT_RE.test(source) && !JS_INCOMPLETE_TRAILING_OPERATOR_RE.test(source)) return "";
1679
- try {
1680
- const ast = require_wxml.babelParse(source, {
1681
- cache: true,
1682
- cacheKey: "st:unambiguous",
1683
- plugins: ["jsx", "typescript"],
1684
- sourceType: "unambiguous"
1685
- });
1686
- const parts = [];
1687
- const stack = [ast];
1688
- while (stack.length > 0) {
1689
- const node = stack.pop();
1690
- if (node.type === "StringLiteral" && typeof node.value === "string") parts.push(`s:${node.value}`);
1691
- else if (node.type === "TemplateElement" && node.value && typeof node.value === "object" && "raw" in node.value && typeof node.value.raw === "string") parts.push(`t:${node.value.raw}`);
1692
- else if (node.type === "JSXText" && typeof node.value === "string") {
1693
- const value = node.value.trim();
1694
- if (value.length > 0) parts.push(`x:${value}`);
1695
- }
1696
- const children = [];
1697
- for (const [key, value] of Object.entries(node)) {
1698
- if (JS_AST_IGNORED_KEYS.has(key)) continue;
1699
- if (Array.isArray(value)) {
1700
- for (const item of value) if (isAstNode(item)) children.push(item);
1701
- } else if (isAstNode(value)) children.push(value);
1702
- }
1703
- for (let index = children.length - 1; index >= 0; index--) stack.push(children[index]);
1704
- }
1705
- const comments = ast.comments;
1706
- if (Array.isArray(comments)) {
1707
- for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
1708
- }
1709
- return parts.join("\n");
1710
- } catch {
1711
- return source;
1712
- }
1713
- }
1714
- function createCssRuntimeAffectingSignature(source) {
1715
- return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
1716
- }
1717
- function createRuntimeAffectingSourceSignature(source, type) {
1718
- if (type === "html") return createHtmlRuntimeAffectingSignature(source);
1719
- if (type === "js") return createJsRuntimeAffectingSignature(source);
1720
- if (type === "css") return createCssRuntimeAffectingSignature(source);
1721
- return source;
1722
- }
1723
- //#endregion
1724
751
  //#region src/compiler/semantic-css.ts
1725
752
  const defaultMaxDifferences = 50;
1726
753
  function isSemanticCssNode(node) {
@@ -2064,7 +1091,7 @@ function createCssTokenSourceMap(sourcesByToken, opts) {
2064
1091
  sources: [...sources].map((file) => normalizeSourcePath(file, root)).sort()
2065
1092
  };
2066
1093
  tokenSources.set(token, source);
2067
- const escaped = require_wxml.replaceWxml(token, { escapeMap: opts.escapeMap });
1094
+ const escaped = require_compiler.replaceWxml(token, { escapeMap: opts.escapeMap });
2068
1095
  tokenSources.set(escaped, source);
2069
1096
  tokenSources.set(escaped.replaceAll("\\", ""), source);
2070
1097
  }
@@ -2133,104 +1160,6 @@ function annotateCssSourceTrace(css, options) {
2133
1160
  }
2134
1161
  }
2135
1162
  //#endregion
2136
- //#region src/bundlers/shared/final-css-cleanup.ts
2137
- function isAtRuleNameCharacter(code) {
2138
- return code === 45 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
2139
- }
2140
- function isCssWhitespace(code) {
2141
- return code === 9 || code === 10 || code === 12 || code === 13 || code === 32;
2142
- }
2143
- function findAtRuleBlockStart(css, start) {
2144
- let parenthesisDepth = 0;
2145
- let quote = 0;
2146
- let squareBracketDepth = 0;
2147
- for (let index = start; index < css.length; index++) {
2148
- const code = css.charCodeAt(index);
2149
- if (quote !== 0) {
2150
- if (code === 92) index++;
2151
- else if (code === quote) quote = 0;
2152
- continue;
2153
- }
2154
- if (code === 34 || code === 39) {
2155
- quote = code;
2156
- continue;
2157
- }
2158
- if (code === 92) {
2159
- index++;
2160
- continue;
2161
- }
2162
- if (code === 47 && css.charCodeAt(index + 1) === 42) {
2163
- const commentEnd = css.indexOf("*/", index + 2);
2164
- if (commentEnd < 0) return -1;
2165
- index = commentEnd + 1;
2166
- continue;
2167
- }
2168
- if (code === 40) {
2169
- parenthesisDepth++;
2170
- continue;
2171
- }
2172
- if (code === 41 && parenthesisDepth > 0) {
2173
- parenthesisDepth--;
2174
- continue;
2175
- }
2176
- if (code === 91) {
2177
- squareBracketDepth++;
2178
- continue;
2179
- }
2180
- if (code === 93 && squareBracketDepth > 0) {
2181
- squareBracketDepth--;
2182
- continue;
2183
- }
2184
- if (code === 123 && parenthesisDepth === 0 && squareBracketDepth === 0) return index;
2185
- if ((code === 59 || code === 125) && parenthesisDepth === 0 && squareBracketDepth === 0) return -1;
2186
- }
2187
- return -1;
2188
- }
2189
- function isEmptyAtRuleBody(css, blockStart) {
2190
- for (let index = blockStart + 1; index < css.length; index++) {
2191
- const code = css.charCodeAt(index);
2192
- if (isCssWhitespace(code)) continue;
2193
- if (code === 47 && css.charCodeAt(index + 1) === 42) {
2194
- const commentEnd = css.indexOf("*/", index + 2);
2195
- if (commentEnd < 0) return false;
2196
- index = commentEnd + 1;
2197
- continue;
2198
- }
2199
- return code === 125;
2200
- }
2201
- return false;
2202
- }
2203
- function hasEmptyAtRuleBlockCandidate(css) {
2204
- let searchFrom = 0;
2205
- while (searchFrom < css.length) {
2206
- const atRuleStart = css.indexOf("@", searchFrom);
2207
- if (atRuleStart < 0) return false;
2208
- searchFrom = atRuleStart + 1;
2209
- if (!isAtRuleNameCharacter(css.charCodeAt(searchFrom))) continue;
2210
- const blockStart = findAtRuleBlockStart(css, searchFrom + 1);
2211
- if (blockStart >= 0 && isEmptyAtRuleBody(css, blockStart)) return true;
2212
- }
2213
- return false;
2214
- }
2215
- /**
2216
- * 在小程序样式进入最终产物图时递归清理空的块级 at-rule。
2217
- */
2218
- function finalizeMiniProgramCssStructure(css) {
2219
- if (!hasEmptyAtRuleBlockCandidate(css)) return css;
2220
- try {
2221
- const root = _weapp_tailwindcss_postcss.postcss.parse(css);
2222
- let removed = 0;
2223
- let passRemoved = 0;
2224
- do {
2225
- passRemoved = (0, _weapp_tailwindcss_postcss.removeEmptyAtRules)(root);
2226
- removed += passRemoved;
2227
- } while (passRemoved > 0);
2228
- return removed > 0 ? root.toString() : css;
2229
- } catch {
2230
- return css;
2231
- }
2232
- }
2233
- //#endregion
2234
1163
  //#region src/bundlers/shared/generated-css-marker.ts
2235
1164
  const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
2236
1165
  const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
@@ -2709,7 +1638,7 @@ function createFrameworkReplayArtifact(generated, options) {
2709
1638
  id: generated.metadata?.outputFile ?? sourceId,
2710
1639
  kind: options.cssHandlerOptions.isMainChunk ? "global" : "component"
2711
1640
  };
2712
- return createGenerationArtifact([createCssFragment({
1641
+ return require_compiler.createGenerationArtifact([require_compiler.createCssFragment({
2713
1642
  id: `${scope.id}:framework-replay`,
2714
1643
  kind: "tailwind",
2715
1644
  css: generated.css,
@@ -2738,13 +1667,13 @@ async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options)
2738
1667
  async function adaptGeneratedCssWithFrameworkRootPipeline(owner, generated, options) {
2739
1668
  const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
2740
1669
  const replayArtifact = createFrameworkReplayArtifact(generated, options);
2741
- const handled = options.compiler && options.snapshot ? composeGenerationArtifact(await (async () => {
1670
+ const handled = options.compiler && options.snapshot ? require_compiler.composeGenerationArtifact(await (async () => {
2742
1671
  for (const fragment of replayArtifact.fragments) {
2743
1672
  fragment.root = (await options.compiler.transformCssRoot(fragment.root, options.snapshot, handlerOptions)).root.clone();
2744
1673
  fragment.stage = "framework-processed";
2745
1674
  }
2746
1675
  return replayArtifact;
2747
- })()) : typeof options.styleHandler.transformRoot === "function" ? composeGenerationArtifact(await createStylePlatformAdapter({
1676
+ })()) : typeof options.styleHandler.transformRoot === "function" ? require_compiler.composeGenerationArtifact(await require_compiler.createStylePlatformAdapter({
2748
1677
  id: generated.target === "web" ? "web" : "mini-program",
2749
1678
  styleHandler: options.styleHandler,
2750
1679
  styleOptions: handlerOptions
@@ -2881,7 +1810,7 @@ function escapeCompatSelectorClasses(selector) {
2881
1810
  end += 1;
2882
1811
  }
2883
1812
  if (className.includes("\\")) {
2884
- result += `.${require_wxml.replaceWxml(unescapeSimpleCssIdent(className))}`;
1813
+ result += `.${require_compiler.replaceWxml(unescapeSimpleCssIdent(className))}`;
2885
1814
  changed = true;
2886
1815
  } else result += `.${className}`;
2887
1816
  index = end;
@@ -3514,7 +2443,7 @@ function resolveUniqueTailwindV4CssConfig(sourceOptions) {
3514
2443
  return configs.size === 1 ? configs.values().next().value : void 0;
3515
2444
  }
3516
2445
  function createSingleTailwindV4SourceOptions(sourceOptions, options) {
3517
- return require_object.omitUndefined({
2446
+ return require_generator.omitUndefined({
3518
2447
  projectRoot: sourceOptions.projectRoot,
3519
2448
  baseFallbacks: sourceOptions.baseFallbacks,
3520
2449
  packageName: sourceOptions.packageName,
@@ -3526,7 +2455,7 @@ function createSingleTailwindV4SourceOptions(sourceOptions, options) {
3526
2455
  async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions, options = {}) {
3527
2456
  const { cssEntries: _cssEntries, cssSources: _cssSources, ...singleEntrySourceOptions } = sourceOptions;
3528
2457
  if (!(0, node_fs.existsSync)(cssEntry)) return withGeneratorSourceMetadata(await require_generator.resolveTailwindV4Source({
3529
- ...require_object.omitUndefined(singleEntrySourceOptions),
2458
+ ...require_generator.omitUndefined(singleEntrySourceOptions),
3530
2459
  cssEntries: [cssEntry]
3531
2460
  }), {
3532
2461
  candidateMatchedCssSource: options.candidateMatched,
@@ -3542,7 +2471,7 @@ async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions, options
3542
2471
  sourceFile: sourceOptions.sourceFile ?? cssEntry
3543
2472
  });
3544
2473
  return withGeneratorSourceMetadata(await require_generator.resolveTailwindV4Source({
3545
- ...require_object.omitUndefined(singleEntrySourceOptions),
2474
+ ...require_generator.omitUndefined(singleEntrySourceOptions),
3546
2475
  base,
3547
2476
  css: require_generator.normalizeConfigDirective(css, config),
3548
2477
  cssEntries: [cssEntry]
@@ -3738,7 +2667,7 @@ function createTailwindV4CssSourceResolver(sourceOptions, generatorOptions) {
3738
2667
  }
3739
2668
  async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourceOptions, generatorOptions, file, currentCss) {
3740
2669
  if (!resolvedEntrySource) return;
3741
- const resolvedSourceOptions = require_object.omitUndefined(sourceOptions);
2670
+ const resolvedSourceOptions = require_generator.omitUndefined(sourceOptions);
3742
2671
  const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, {
3743
2672
  ...resolvedSourceOptions,
3744
2673
  sourceFile: resolvedEntrySource.file
@@ -3834,7 +2763,7 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
3834
2763
  css: rawSource
3835
2764
  } : void 0;
3836
2765
  const sourceOptions = tryResolveTailwindV4SourceOptions(runtimeState);
3837
- const resolvedSourceOptions = sourceOptions ? require_object.omitUndefined({
2766
+ const resolvedSourceOptions = sourceOptions ? require_generator.omitUndefined({
3838
2767
  ...sourceOptions,
3839
2768
  sourceFile: sourceOptions.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions),
3840
2769
  ...resolveCssHandlerSourceOptions(cssHandlerOptions),
@@ -3882,7 +2811,7 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
3882
2811
  css: require_generator.prependConfigDirective(source.css, generatorOptions.config)
3883
2812
  } : source;
3884
2813
  }
3885
- const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, require_object.omitUndefined({
2814
+ const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, require_generator.omitUndefined({
3886
2815
  ...resolvedSourceOptions ?? {},
3887
2816
  sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
3888
2817
  }));
@@ -3910,7 +2839,7 @@ async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSo
3910
2839
  const sourceOptionsFromRuntime = require_generator.resolveTailwindV4SourceOptionsFromRuntime(runtimeState.tailwindRuntime);
3911
2840
  const cssEntries = selectionOptions?.cssEntries ?? sourceOptionsFromRuntime.cssEntries;
3912
2841
  const runtimeCssSources = selectionOptions?.cssEntries ? void 0 : sourceOptionsFromRuntime.cssSources;
3913
- sourceOptions = require_object.omitUndefined({
2842
+ sourceOptions = require_generator.omitUndefined({
3914
2843
  ...sourceOptionsFromRuntime,
3915
2844
  sourceFile: resolvePostcssSourceFile(cssHandlerOptions),
3916
2845
  ...resolveCssHandlerSourceOptions(cssHandlerOptions),
@@ -4385,7 +3314,7 @@ function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
4385
3314
  if (selectors.size === 0) return /* @__PURE__ */ new Set();
4386
3315
  const matched = /* @__PURE__ */ new Set();
4387
3316
  for (const candidate of candidates) {
4388
- const escaped = normalizeCssClassSelector(require_wxml.replaceWxml(candidate, { escapeMap }));
3317
+ const escaped = normalizeCssClassSelector(require_compiler.replaceWxml(candidate, { escapeMap }));
4389
3318
  if (selectors.has(candidate) || selectors.has(escaped)) matched.add(candidate);
4390
3319
  }
4391
3320
  return matched;
@@ -4939,12 +3868,12 @@ function resolveCompilationDependencies(dependencies) {
4939
3868
  }));
4940
3869
  }
4941
3870
  async function executeGeneratorPipeline(context) {
4942
- return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, getCompilationSessionPool(context.runtimeState), getTailwindGenerationSessionPool(context.runtimeState)));
3871
+ return require_compiler.runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, require_compiler.getCompilationSessionPool(context.runtimeState), require_compiler.getTailwindGenerationSessionPool(context.runtimeState)));
4943
3872
  }
4944
3873
  async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
4945
3874
  const { cssHandlerOptions, debug, file, generatorBranch, generatorOptions, generatorRawSource, getSourceCandidatesForEntries, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, normalizeGeneratorSource, normalizedCssSources, options, opts, runtime, runtimeState, useMiniProgramCssBranch } = context;
4946
3875
  await runtimeState.readyPromise;
4947
- const compilerSession = options.compilation?.enabled ? getFrameworkCompilerSession(runtimeState, opts) : void 0;
3876
+ const compilerSession = options.compilation?.enabled ? require_compiler.getFrameworkCompilerSession(runtimeState, opts) : void 0;
4948
3877
  const currentCssCandidates = collectGeneratorCssCandidates(generatorRawSource);
4949
3878
  const isolateCurrentCssCandidates = shouldIsolateCurrentTailwindV4CssCandidates(majorVersion, cssHandlerOptions, {
4950
3879
  hasGeneratedCss,
@@ -5305,7 +4234,7 @@ async function generateCssByGenerator(options) {
5305
4234
  //#endregion
5306
4235
  //#region src/bundlers/shared/generator-css/validate.ts
5307
4236
  async function validateCandidatesByGenerator(options) {
5308
- return runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options, getTailwindGenerationSessionPool(options.runtimeState)));
4237
+ return require_compiler.runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options, require_compiler.getTailwindGenerationSessionPool(options.runtimeState)));
5309
4238
  }
5310
4239
  async function validateCandidatesByGeneratorWithOwner(options, generationSession) {
5311
4240
  const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState } = options;
@@ -5344,7 +4273,7 @@ function resolveGenerationOptions(options, mode) {
5344
4273
  };
5345
4274
  if (mode === "legacy") return normalizedOptions;
5346
4275
  const scopeId = normalizedOptions.scope?.id ?? normalizedOptions.outputFile ?? normalizedOptions.file;
5347
- const compilationChanges = mergeCompilationDependencyChanges(normalizedOptions.compilationChanges, consumeCompilationScopeChanges(normalizedOptions.runtimeState, scopeId));
4276
+ const compilationChanges = require_compiler.mergeCompilationDependencyChanges(normalizedOptions.compilationChanges, require_compiler.consumeCompilationScopeChanges(normalizedOptions.runtimeState, scopeId));
5348
4277
  if (compilationChanges.length === 0) return normalizedOptions;
5349
4278
  return {
5350
4279
  ...normalizedOptions,
@@ -5360,7 +4289,7 @@ function createCoreArtifact(generated, css, options) {
5360
4289
  id: scopeId,
5361
4290
  kind: options.cssHandlerOptions.isMainChunk ? "global" : "component"
5362
4291
  };
5363
- return createGenerationArtifact([createCssFragment({
4292
+ return require_compiler.createGenerationArtifact([require_compiler.createCssFragment({
5364
4293
  id: `${scopeId}:generated`,
5365
4294
  kind: "tailwind",
5366
4295
  css,
@@ -5416,7 +4345,7 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
5416
4345
  rawCandidates: options.runtime,
5417
4346
  styleHandler: options.styleHandler,
5418
4347
  ...implementation.frameworkAdapter === "graph" && generated.snapshot ? {
5419
- compiler: getFrameworkCompilerSession(options.runtimeState, options.opts).compiler,
4348
+ compiler: require_compiler.getFrameworkCompilerSession(options.runtimeState, options.opts).compiler,
5420
4349
  snapshot: generated.snapshot
5421
4350
  } : {}
5422
4351
  }) : generated.css;
@@ -5437,7 +4366,7 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
5437
4366
  };
5438
4367
  }
5439
4368
  async function generateTailwindV4Css(options) {
5440
- const mode = resolveCompilerMode();
4369
+ const mode = options.compilerMode ?? resolveCompilerMode();
5441
4370
  const generationOptions = resolveGenerationOptions(options, mode);
5442
4371
  if (mode === "legacy") return generateTailwindV4CssWithImplementation(generationOptions, {
5443
4372
  emitArtifact: false,
@@ -5447,7 +4376,7 @@ async function generateTailwindV4Css(options) {
5447
4376
  emitArtifact: true,
5448
4377
  frameworkAdapter: "graph"
5449
4378
  });
5450
- const shadowRunRevision = getCompilerShadowRunRevision(generationOptions.runtimeState);
4379
+ const shadowRunRevision = require_compiler.getCompilerShadowRunRevision(generationOptions.runtimeState);
5451
4380
  const legacy = await generateTailwindV4CssWithImplementation(generationOptions, {
5452
4381
  emitArtifact: true,
5453
4382
  frameworkAdapter: "legacy"
@@ -5457,7 +4386,7 @@ async function generateTailwindV4Css(options) {
5457
4386
  frameworkAdapter: "graph"
5458
4387
  });
5459
4388
  const report = createCompilerShadowReport(generationOptions.file, legacy?.artifact, graph?.artifact, { scopeId: generationOptions.scope?.id ?? generationOptions.outputFile ?? generationOptions.file });
5460
- recordCompilerShadowReport(generationOptions.runtimeState, report, shadowRunRevision);
4389
+ require_compiler.recordCompilerShadowReport(generationOptions.runtimeState, report, shadowRunRevision);
5461
4390
  generationOptions.onCompilerShadowReport?.(report);
5462
4391
  if (!report.equal) {
5463
4392
  generationOptions.debug("compiler shadow semantic mismatch: %s", generationOptions.file);
@@ -5466,24 +4395,12 @@ async function generateTailwindV4Css(options) {
5466
4395
  return legacy;
5467
4396
  }
5468
4397
  //#endregion
5469
- Object.defineProperty(exports, "AssetEmissionPlan", {
5470
- enumerable: true,
5471
- get: function() {
5472
- return AssetEmissionPlan;
5473
- }
5474
- });
5475
4398
  Object.defineProperty(exports, "annotateCssSourceTrace", {
5476
4399
  enumerable: true,
5477
4400
  get: function() {
5478
4401
  return annotateCssSourceTrace;
5479
4402
  }
5480
4403
  });
5481
- Object.defineProperty(exports, "beginCompilerShadowRun", {
5482
- enumerable: true,
5483
- get: function() {
5484
- return beginCompilerShadowRun;
5485
- }
5486
- });
5487
4404
  Object.defineProperty(exports, "captureFrameworkPostcssOptions", {
5488
4405
  enumerable: true,
5489
4406
  get: function() {
@@ -5526,24 +4443,12 @@ Object.defineProperty(exports, "collectStrictEscapedRuntimeCandidates", {
5526
4443
  return collectStrictEscapedRuntimeCandidates;
5527
4444
  }
5528
4445
  });
5529
- Object.defineProperty(exports, "completeCompilerShadowReportRun", {
5530
- enumerable: true,
5531
- get: function() {
5532
- return completeCompilerShadowReportRun;
5533
- }
5534
- });
5535
4446
  Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
5536
4447
  enumerable: true,
5537
4448
  get: function() {
5538
4449
  return createBundlerGeneratedCssMarker;
5539
4450
  }
5540
4451
  });
5541
- Object.defineProperty(exports, "createCompilationDependencyChanges", {
5542
- enumerable: true,
5543
- get: function() {
5544
- return createCompilationDependencyChanges;
5545
- }
5546
- });
5547
4452
  Object.defineProperty(exports, "createCssSourceOrderAppend", {
5548
4453
  enumerable: true,
5549
4454
  get: function() {
@@ -5568,12 +4473,6 @@ Object.defineProperty(exports, "createEscapeFragments", {
5568
4473
  return createEscapeFragments;
5569
4474
  }
5570
4475
  });
5571
- Object.defineProperty(exports, "createRuntimeAffectingSourceSignature", {
5572
- enumerable: true,
5573
- get: function() {
5574
- return createRuntimeAffectingSourceSignature;
5575
- }
5576
- });
5577
4476
  Object.defineProperty(exports, "createSourceCandidateCollector", {
5578
4477
  enumerable: true,
5579
4478
  get: function() {
@@ -5592,12 +4491,6 @@ Object.defineProperty(exports, "createSourceCandidateStore", {
5592
4491
  return createSourceCandidateStore;
5593
4492
  }
5594
4493
  });
5595
- Object.defineProperty(exports, "disposeCompilerOwner", {
5596
- enumerable: true,
5597
- get: function() {
5598
- return disposeCompilerOwner;
5599
- }
5600
- });
5601
4494
  Object.defineProperty(exports, "extractCandidatesFromSource", {
5602
4495
  enumerable: true,
5603
4496
  get: function() {
@@ -5610,12 +4503,6 @@ Object.defineProperty(exports, "extractMarkedUserLayerComponentsCss", {
5610
4503
  return extractMarkedUserLayerComponentsCss;
5611
4504
  }
5612
4505
  });
5613
- Object.defineProperty(exports, "finalizeMiniProgramCssStructure", {
5614
- enumerable: true,
5615
- get: function() {
5616
- return finalizeMiniProgramCssStructure;
5617
- }
5618
- });
5619
4506
  Object.defineProperty(exports, "finalizeMiniProgramGeneratorCss", {
5620
4507
  enumerable: true,
5621
4508
  get: function() {
@@ -5628,42 +4515,18 @@ Object.defineProperty(exports, "generateTailwindV4Css", {
5628
4515
  return generateTailwindV4Css;
5629
4516
  }
5630
4517
  });
5631
- Object.defineProperty(exports, "getCompilationScopeDependencyRevision", {
5632
- enumerable: true,
5633
- get: function() {
5634
- return getCompilationScopeDependencyRevision;
5635
- }
5636
- });
5637
- Object.defineProperty(exports, "getCompilerShadowRunSnapshot", {
5638
- enumerable: true,
5639
- get: function() {
5640
- return getCompilerShadowRunSnapshot;
5641
- }
5642
- });
5643
4518
  Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
5644
4519
  enumerable: true,
5645
4520
  get: function() {
5646
4521
  return hasBundlerGeneratedCssMarker;
5647
4522
  }
5648
4523
  });
5649
- Object.defineProperty(exports, "hasEmptyAtRuleBlockCandidate", {
5650
- enumerable: true,
5651
- get: function() {
5652
- return hasEmptyAtRuleBlockCandidate;
5653
- }
5654
- });
5655
4524
  Object.defineProperty(exports, "hasMiniProgramTailwindV4PreflightReset", {
5656
4525
  enumerable: true,
5657
4526
  get: function() {
5658
4527
  return hasMiniProgramTailwindV4PreflightReset;
5659
4528
  }
5660
4529
  });
5661
- Object.defineProperty(exports, "invalidateCompilationScope", {
5662
- enumerable: true,
5663
- get: function() {
5664
- return invalidateCompilationScope;
5665
- }
5666
- });
5667
4530
  Object.defineProperty(exports, "isCssSourceTraceEnabled", {
5668
4531
  enumerable: true,
5669
4532
  get: function() {
@@ -5718,12 +4581,6 @@ Object.defineProperty(exports, "pushConcurrentTaskFactories", {
5718
4581
  return pushConcurrentTaskFactories;
5719
4582
  }
5720
4583
  });
5721
- Object.defineProperty(exports, "recordCompilationDependencyChanges", {
5722
- enumerable: true,
5723
- get: function() {
5724
- return recordCompilationDependencyChanges;
5725
- }
5726
- });
5727
4584
  Object.defineProperty(exports, "removeGeneratedSelectorCompatCss", {
5728
4585
  enumerable: true,
5729
4586
  get: function() {