weapp-tailwindcss 5.5.8 → 5.5.10
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.
- package/dist/bundlers/vite/css-calc-stage.d.ts +8 -0
- package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer/css-scope-graph.d.ts +5 -0
- package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +1 -1
- package/dist/bundlers/vite/css-finalizer/options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-cache-task.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-result.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +3 -3
- package/dist/bundlers/vite/generate-bundle/scoped-generator-runtime-cache.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator-sources.d.ts +36 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +6 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/source-trace.d.ts +2 -0
- package/dist/bundlers/vite/runtime-class-set/cache.d.ts +14 -0
- package/dist/bundlers/vite/runtime-class-set/invalidation-plugin.d.ts +6 -0
- package/dist/bundlers/vite/runtime-class-set/lifecycle.d.ts +12 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +1 -0
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +1 -2
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +1 -0
- package/dist/{compiler-DbwS3329.cjs → compiler-TvqqdOMD.cjs} +50 -38
- package/dist/{compiler-CThodfGH.js → compiler-v9sYta8W.js} +35 -30
- package/dist/core/compiler/generation-cache.d.ts +4 -2
- package/dist/core/compiler/root-store.d.ts +1 -1
- package/dist/core/compiler/source.d.ts +7 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{scoped-generator-DlQrVbuC.js → css-cleanup-B3xP5Qph.js} +26 -23
- package/dist/{generated-css-marker-B0RyziOH.cjs → generated-css-marker-nqjR6ntO.cjs} +102 -26
- package/dist/generation/pipeline/style-context.d.ts +3 -0
- package/dist/{generator-CxauQbx3.cjs → generator-B1sYQpWu.cjs} +165 -90
- package/dist/{generator-oKZ5mCJ5.js → generator-LqofzXgr.js} +155 -92
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-DhddVxGA.js → gulp-BCV0gOMb.js} +4 -4
- package/dist/{gulp-CngHA9cU.cjs → gulp-DrX6QS3N.cjs} +5 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-Dc4c1VRg.cjs → hmr-timing-B56wp7y-.cjs} +4 -4
- package/dist/{hmr-timing-xPpat-km.js → hmr-timing-Bb54exB0.js} +102 -26
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-EUud9R2K.cjs → pipeline-helpers-DJ3VZ01J.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/project-sources/candidates/view-memo.d.ts +7 -0
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{scoped-generator-lbTwL6mD.cjs → scoped-generator-DqNb8nJG.cjs} +31 -24
- package/dist/{source-candidate-scan-signature-BjVQYL-C.js → source-candidate-scan-signature-BWLf4tuO.js} +2 -2
- package/dist/{source-candidate-scan-signature-nG-rg809.cjs → source-candidate-scan-signature-_ohG0ePd.cjs} +2 -2
- package/dist/tailwindcss/v4/rpx-theme-warning.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/raw-generation.d.ts +30 -0
- package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +3 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +2 -0
- package/dist/{tailwindcss-kSd0ykiX.js → tailwindcss-XNfJSlhp.js} +2 -2
- package/dist/{tailwindcss-U3KIUegn.cjs → tailwindcss-uf04Iolj.cjs} +2 -2
- package/dist/{transform-DVg4q8hh.cjs → transform-CxVM0PfA.cjs} +3 -3
- package/dist/{transform-BAon9ykq.js → transform-D0NXKPmD.js} +3 -3
- package/dist/utils/stable-serialize.d.ts +1 -0
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-IX83wh_L.cjs → vite-C3Zh6iYK.cjs} +434 -209
- package/dist/{vite-D-RGkmOE.js → vite-D6_FxvdM.js} +434 -209
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +5 -5
- package/dist/{web-DHfZ_KC9.cjs → web-BzeWG_XO.cjs} +442 -155
- package/dist/{web--kA4HUTm.js → web-K3qAX4sN.js} +431 -156
- package/dist/{webpack-Bhkd27Rs.js → webpack-BZBqKB4Y.js} +6 -6
- package/dist/{webpack-BetjemzT.cjs → webpack-Dbj2uykF.cjs} +8 -8
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +5 -4
|
@@ -56,6 +56,23 @@ function inferGeneratorTargetFromEnv() {
|
|
|
56
56
|
return inferGeneratorTargetFromExplicitEnv() ?? (shouldUseWebGeneratorTargetFromEnv() ? "web" : "weapp");
|
|
57
57
|
}
|
|
58
58
|
//#endregion
|
|
59
|
+
//#region src/utils/stable-serialize.ts
|
|
60
|
+
/** 统一生成缓存的配置身份;映射顺序和正则游标不改变配置语义。 */
|
|
61
|
+
function stableSerialize(value, stack = /* @__PURE__ */ new WeakSet()) {
|
|
62
|
+
if (value == null || typeof value === "number" || typeof value === "boolean" || typeof value === "string") return JSON.stringify(value);
|
|
63
|
+
if (typeof value === "function") return `[Function:${value.name}]`;
|
|
64
|
+
if (typeof value !== "object") return String(value);
|
|
65
|
+
if (stack.has(value)) return "[Circular]";
|
|
66
|
+
if (value instanceof RegExp) return `RegExp(${JSON.stringify(value.source)},${JSON.stringify(value.flags)})`;
|
|
67
|
+
stack.add(value);
|
|
68
|
+
let serialized;
|
|
69
|
+
if (value instanceof Map) serialized = `Map(${[...value].map(([key, item]) => `[${stableSerialize(key, stack)},${stableSerialize(item, stack)}]`).sort().join(",")})`;
|
|
70
|
+
else if (Array.isArray(value)) serialized = `[${value.map((item) => stableSerialize(item, stack)).join(",")}]`;
|
|
71
|
+
else serialized = `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableSerialize(value[key], stack)}`).join(",")}}`;
|
|
72
|
+
stack.delete(value);
|
|
73
|
+
return serialized;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
59
76
|
//#region src/tailwindcss/v4-engine/candidates.ts
|
|
60
77
|
const UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE = /(?:^|:)(?:has-)?(?:group|peer|in|not-in)-[^\s:]*\/|(?:^|:)(?:has-)?(?:in|not-in)-\[/;
|
|
61
78
|
function isUnsupportedMiniProgramTailwindV4Candidate(candidate) {
|
|
@@ -76,15 +93,6 @@ function hasRemovedCandidates(previousCandidates, nextCandidates) {
|
|
|
76
93
|
for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
|
|
77
94
|
return false;
|
|
78
95
|
}
|
|
79
|
-
function createStableJson(value) {
|
|
80
|
-
if (value === void 0) return "undefined";
|
|
81
|
-
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
82
|
-
if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
|
|
83
|
-
return `{${Object.keys(value).sort().map((key) => {
|
|
84
|
-
const record = value;
|
|
85
|
-
return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
|
|
86
|
-
}).join(",")}}`;
|
|
87
|
-
}
|
|
88
96
|
function createDependencyFingerprint(files) {
|
|
89
97
|
return files.map((file) => {
|
|
90
98
|
try {
|
|
@@ -99,7 +107,7 @@ function createTailwindV4SourceCacheKey(source) {
|
|
|
99
107
|
return [
|
|
100
108
|
source.projectRoot,
|
|
101
109
|
source.base,
|
|
102
|
-
|
|
110
|
+
stableSerialize(source.baseFallbacks),
|
|
103
111
|
source.css,
|
|
104
112
|
createDependencyFingerprint(source.dependencies)
|
|
105
113
|
].join("\0");
|
|
@@ -108,7 +116,7 @@ function createIncrementalGenerateCacheKey(source, target, styleOptions) {
|
|
|
108
116
|
return [
|
|
109
117
|
createTailwindV4SourceCacheKey(source),
|
|
110
118
|
target,
|
|
111
|
-
|
|
119
|
+
stableSerialize(styleOptions)
|
|
112
120
|
].join("\0");
|
|
113
121
|
}
|
|
114
122
|
function createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources) {
|
|
@@ -141,7 +149,7 @@ function resolveTargetCandidates(candidates, target) {
|
|
|
141
149
|
return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
|
|
142
150
|
}
|
|
143
151
|
function collectSeenCandidates(generated) {
|
|
144
|
-
return new Set(generated.classSet);
|
|
152
|
+
return /* @__PURE__ */ new Set([...generated.rawCandidates, ...generated.classSet]);
|
|
145
153
|
}
|
|
146
154
|
function createIncrementalStyleOptions(styleOptions) {
|
|
147
155
|
return {
|
|
@@ -175,8 +183,7 @@ function shouldAdmitIncrementalEntry(requestedCandidates, generated) {
|
|
|
175
183
|
function seedIncrementalGenerateCache(options) {
|
|
176
184
|
if (!shouldAdmitIncrementalEntry(options.requestedCandidates, options.generated)) return false;
|
|
177
185
|
const cacheKey = createIncrementalGenerateCacheKey(options.compatibleSource, options.target, options.styleOptions);
|
|
178
|
-
const customPropertyValues =
|
|
179
|
-
(0, _weapp_tailwindcss_postcss_transform.mergeCustomPropertyValues)(customPropertyValues, options.generated.css);
|
|
186
|
+
const customPropertyValues = new Map(options.generated.customPropertyValues ?? []);
|
|
180
187
|
incrementalGenerateCache.set(cacheKey, {
|
|
181
188
|
seenCandidates: collectSeenCandidates(options.generated),
|
|
182
189
|
classSet: new Set(options.generated.classSet),
|
|
@@ -785,91 +792,133 @@ function resolveCompiledSourceRoot(source) {
|
|
|
785
792
|
}
|
|
786
793
|
//#endregion
|
|
787
794
|
//#region src/tailwindcss/v4-engine/generator/style-context.ts
|
|
788
|
-
function
|
|
795
|
+
function hasCssCalcVariables(options) {
|
|
789
796
|
const calc = options?.cssOptions?.cssCalc ?? options?.cssCalc;
|
|
790
797
|
const include = Array.isArray(calc) ? calc : calc && typeof calc === "object" ? calc.includeCustomProperties : void 0;
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
798
|
+
return calc === true || Boolean(include?.length);
|
|
799
|
+
}
|
|
800
|
+
function resolveGenerationStyleContext(sourceCss, generatedCss, options) {
|
|
801
|
+
if (!hasCssCalcVariables(options)) return options;
|
|
795
802
|
return {
|
|
796
803
|
...options,
|
|
797
|
-
|
|
804
|
+
customPropertyContextCss: [
|
|
805
|
+
options?.customPropertyContextCss,
|
|
806
|
+
sourceCss,
|
|
807
|
+
generatedCss
|
|
808
|
+
].filter(Boolean).join("\n")
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
/** 增量 utility 不带主题声明;兼容转换单独补齐主题值,不能将其升级成 calc 常量。 */
|
|
812
|
+
function resolveIncrementalStyleContext(sourceCss, generatedCss, options) {
|
|
813
|
+
const customPropertyCompatibilityValues = (0, _weapp_tailwindcss_postcss_transform.collectCustomPropertyValues)(sourceCss);
|
|
814
|
+
(0, _weapp_tailwindcss_postcss_transform.mergeCustomPropertyValues)(customPropertyCompatibilityValues, generatedCss);
|
|
815
|
+
return {
|
|
816
|
+
...resolveGenerationStyleContext(sourceCss, generatedCss, options),
|
|
817
|
+
customPropertyCompatibilityValues
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
/** 新增候选改变静态变量资格时,需要重算已有规则,不能只追加新 CSS。 */
|
|
821
|
+
function hasChangedCssCalcContext(previousCss, nextCss, options) {
|
|
822
|
+
if (!hasCssCalcVariables(options)) return false;
|
|
823
|
+
const calc = options?.cssOptions?.cssCalc ?? options?.cssCalc;
|
|
824
|
+
const include = Array.isArray(calc) ? calc : calc && typeof calc === "object" ? calc.includeCustomProperties : void 0;
|
|
825
|
+
const selected = (name) => calc === true || (0, _weapp_tailwindcss_postcss_transform.isCssCalcCustomPropertySelected)(name, include);
|
|
826
|
+
const values = (css) => {
|
|
827
|
+
const context = [options?.customPropertyContextCss, css].filter(Boolean).join("\n");
|
|
828
|
+
return new Map([...(0, _weapp_tailwindcss_postcss_transform.analyzeCssCalcContext)(context, options?.customPropertyValues ?? (calc && typeof calc === "object" && !Array.isArray(calc) ? calc.customPropertyValues : void 0)).customPropertyValues].filter(([name]) => selected(name)));
|
|
798
829
|
};
|
|
830
|
+
const previous = values(previousCss);
|
|
831
|
+
const next = values(nextCss);
|
|
832
|
+
return previous.size !== next.size || [...previous].some(([name, value]) => next.get(name) !== value);
|
|
799
833
|
}
|
|
800
834
|
//#endregion
|
|
801
|
-
//#region src/tailwindcss/v4-engine/generator/
|
|
835
|
+
//#region src/tailwindcss/v4-engine/generator/raw-generation.ts
|
|
802
836
|
function isCssSyntaxError(error) {
|
|
803
837
|
return error instanceof Error && error.name === "CssSyntaxError";
|
|
804
838
|
}
|
|
839
|
+
/** 原生生成会话负责按当前候选产出完整主题、utility 和运行时依赖。 */
|
|
840
|
+
async function generateRawArtifact(generationSessions, generateSource, options = {}) {
|
|
841
|
+
const { scanSources = true, styleOptions, target = "weapp", ...patchOptions } = options;
|
|
842
|
+
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
843
|
+
const compatibleSource = createCompatibleSource(resolveCssMacroTailwindV4Source(generateSource), target);
|
|
844
|
+
const compiledScan = options.scanMode === "compiled";
|
|
845
|
+
const resolvedScanSources = compiledScan ? void 0 : await resolveScanSources(generateSource, scanSources);
|
|
846
|
+
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, _weapp_tailwindcss_engine.extractRawCandidates)(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
|
|
847
|
+
const resolvedCandidates = resolveTargetCandidates(/* @__PURE__ */ new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target);
|
|
848
|
+
let normalizedCandidates = normalizeTargetRpxLengthCandidates(resolvedCandidates, target, resolvedStyleOptions);
|
|
849
|
+
const sourceId = compatibleSource.dependencies[0] ?? compatibleSource.base;
|
|
850
|
+
const generationRequest = {
|
|
851
|
+
...compiledScan ? {
|
|
852
|
+
scanSources,
|
|
853
|
+
excludeFiles: options.excludeFiles ?? [],
|
|
854
|
+
prepareCandidates: (candidates) => {
|
|
855
|
+
normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(candidates, target), target, resolvedStyleOptions);
|
|
856
|
+
return normalizedCandidates.candidates;
|
|
857
|
+
}
|
|
858
|
+
} : {},
|
|
859
|
+
...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues },
|
|
860
|
+
...patchOptions.sources === void 0 ? {} : { sourceEntries: createEngineSourceEntries(patchOptions.sources, sourceId) },
|
|
861
|
+
candidates: compiledScan ? resolvedCandidates : normalizedCandidates.candidates
|
|
862
|
+
};
|
|
863
|
+
let generatedCss;
|
|
864
|
+
let classSet;
|
|
865
|
+
let rawCandidates;
|
|
866
|
+
let dependencies;
|
|
867
|
+
try {
|
|
868
|
+
const artifact = await generationSessions.generate(target, createTailwindV4SourceCacheKey(compatibleSource), compatibleSource, generationRequest);
|
|
869
|
+
generatedCss = serializeTailwindGenerationArtifact(artifact);
|
|
870
|
+
classSet = artifact.classSet;
|
|
871
|
+
rawCandidates = artifact.rawCandidates;
|
|
872
|
+
dependencies = artifact.dependencies;
|
|
873
|
+
} catch (error) {
|
|
874
|
+
if (compiledScan || !isCssSyntaxError(error)) throw error;
|
|
875
|
+
const legacyEngine = (0, _weapp_tailwindcss_engine.createTailwindV4Engine)(compatibleSource);
|
|
876
|
+
try {
|
|
877
|
+
const legacyResult = await legacyEngine.generate({
|
|
878
|
+
...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues },
|
|
879
|
+
...patchOptions.sources === void 0 ? {} : { sources: patchOptions.sources },
|
|
880
|
+
candidates: normalizedCandidates.candidates,
|
|
881
|
+
scanSources: false
|
|
882
|
+
});
|
|
883
|
+
generatedCss = legacyResult.css;
|
|
884
|
+
classSet = legacyResult.classSet;
|
|
885
|
+
rawCandidates = legacyResult.rawCandidates;
|
|
886
|
+
dependencies = legacyResult.dependencies;
|
|
887
|
+
} finally {
|
|
888
|
+
legacyEngine.dispose?.();
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
const sources = Array.isArray(resolvedScanSources) ? resolvedScanSources : [];
|
|
892
|
+
const rawCss = (0, _weapp_tailwindcss_postcss_transform.restoreRpxLengthCssSelectors)(generatedCss, normalizedCandidates.restoreCandidates);
|
|
893
|
+
return {
|
|
894
|
+
classSet: (0, _weapp_tailwindcss_postcss_transform.restoreRpxLengthCandidates)(classSet, normalizedCandidates.restoreCandidates),
|
|
895
|
+
rawCandidates: (0, _weapp_tailwindcss_postcss_transform.restoreRpxLengthCandidates)(rawCandidates, normalizedCandidates.restoreCandidates),
|
|
896
|
+
dependencies,
|
|
897
|
+
root: resolveCompiledSourceRoot(compatibleSource),
|
|
898
|
+
sources,
|
|
899
|
+
rawCss,
|
|
900
|
+
target,
|
|
901
|
+
styleContext: resolveGenerationStyleContext(compatibleSource.css, rawCss, resolvedStyleOptions)
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
async function transformGeneratedArtifact(artifact) {
|
|
905
|
+
const { styleContext, ...generated } = artifact;
|
|
906
|
+
const css = await transformTailwindV4CssByTarget(generated.rawCss, generated.target, styleContext);
|
|
907
|
+
return {
|
|
908
|
+
...generated,
|
|
909
|
+
css,
|
|
910
|
+
customPropertyContextCss: styleContext?.customPropertyContextCss,
|
|
911
|
+
...styleContext?.customPropertyValues ? { customPropertyValues: new Map(styleContext.customPropertyValues) } : {}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
//#endregion
|
|
915
|
+
//#region src/tailwindcss/v4-engine/generator/engine.ts
|
|
805
916
|
function createTailwindV4Engine(source) {
|
|
806
917
|
const generationSessions = new TailwindV4NativeSessionPool();
|
|
807
918
|
const incrementalCacheKeys = /* @__PURE__ */ new Set();
|
|
808
919
|
const validationEngine = (0, _weapp_tailwindcss_engine.createTailwindV4Engine)(source);
|
|
809
920
|
async function generateOnce(generateSource, options = {}) {
|
|
810
|
-
|
|
811
|
-
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
812
|
-
const compatibleSource = createCompatibleSource(resolveCssMacroTailwindV4Source(generateSource), target);
|
|
813
|
-
const compiledScan = options.scanMode === "compiled";
|
|
814
|
-
const resolvedScanSources = compiledScan ? void 0 : await resolveScanSources(generateSource, scanSources);
|
|
815
|
-
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, _weapp_tailwindcss_engine.extractRawCandidates)(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
|
|
816
|
-
const resolvedCandidates = resolveTargetCandidates(/* @__PURE__ */ new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target);
|
|
817
|
-
let normalizedCandidates = normalizeTargetRpxLengthCandidates(resolvedCandidates, target, resolvedStyleOptions);
|
|
818
|
-
const sourceId = compatibleSource.dependencies[0] ?? compatibleSource.base;
|
|
819
|
-
const generationRequest = {
|
|
820
|
-
...compiledScan ? {
|
|
821
|
-
scanSources,
|
|
822
|
-
excludeFiles: options.excludeFiles ?? [],
|
|
823
|
-
prepareCandidates: (candidates) => {
|
|
824
|
-
normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(candidates, target), target, resolvedStyleOptions);
|
|
825
|
-
return normalizedCandidates.candidates;
|
|
826
|
-
}
|
|
827
|
-
} : {},
|
|
828
|
-
...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues },
|
|
829
|
-
...patchOptions.sources === void 0 ? {} : { sourceEntries: createEngineSourceEntries(patchOptions.sources, sourceId) },
|
|
830
|
-
candidates: compiledScan ? resolvedCandidates : normalizedCandidates.candidates
|
|
831
|
-
};
|
|
832
|
-
let generatedCss;
|
|
833
|
-
let classSet;
|
|
834
|
-
let rawCandidates;
|
|
835
|
-
let dependencies;
|
|
836
|
-
try {
|
|
837
|
-
const artifact = await generationSessions.generate(target, createTailwindV4SourceCacheKey(compatibleSource), compatibleSource, generationRequest);
|
|
838
|
-
generatedCss = serializeTailwindGenerationArtifact(artifact);
|
|
839
|
-
classSet = artifact.classSet;
|
|
840
|
-
rawCandidates = artifact.rawCandidates;
|
|
841
|
-
dependencies = artifact.dependencies;
|
|
842
|
-
} catch (error) {
|
|
843
|
-
if (compiledScan || !isCssSyntaxError(error)) throw error;
|
|
844
|
-
const legacyEngine = (0, _weapp_tailwindcss_engine.createTailwindV4Engine)(compatibleSource);
|
|
845
|
-
try {
|
|
846
|
-
const legacyResult = await legacyEngine.generate({
|
|
847
|
-
...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues },
|
|
848
|
-
...patchOptions.sources === void 0 ? {} : { sources: patchOptions.sources },
|
|
849
|
-
candidates: normalizedCandidates.candidates,
|
|
850
|
-
scanSources: false
|
|
851
|
-
});
|
|
852
|
-
generatedCss = legacyResult.css;
|
|
853
|
-
classSet = legacyResult.classSet;
|
|
854
|
-
rawCandidates = legacyResult.rawCandidates;
|
|
855
|
-
dependencies = legacyResult.dependencies;
|
|
856
|
-
} finally {
|
|
857
|
-
legacyEngine.dispose?.();
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
const sources = Array.isArray(resolvedScanSources) ? resolvedScanSources : [];
|
|
861
|
-
const rawCss = (0, _weapp_tailwindcss_postcss_transform.restoreRpxLengthCssSelectors)(generatedCss, normalizedCandidates.restoreCandidates);
|
|
862
|
-
const css = await transformTailwindV4CssByTarget(rawCss, target, resolveGenerationStyleContext(compatibleSource.css, rawCss, resolvedStyleOptions));
|
|
863
|
-
return {
|
|
864
|
-
classSet: (0, _weapp_tailwindcss_postcss_transform.restoreRpxLengthCandidates)(classSet, normalizedCandidates.restoreCandidates),
|
|
865
|
-
rawCandidates: (0, _weapp_tailwindcss_postcss_transform.restoreRpxLengthCandidates)(rawCandidates, normalizedCandidates.restoreCandidates),
|
|
866
|
-
dependencies,
|
|
867
|
-
root: resolveCompiledSourceRoot(compatibleSource),
|
|
868
|
-
sources,
|
|
869
|
-
css,
|
|
870
|
-
rawCss,
|
|
871
|
-
target
|
|
872
|
-
};
|
|
921
|
+
return transformGeneratedArtifact(await generateRawArtifact(generationSessions, generateSource, options));
|
|
873
922
|
}
|
|
874
923
|
async function generateWithIncrementalCache(options = {}) {
|
|
875
924
|
const target = options.target ?? "weapp";
|
|
@@ -912,6 +961,8 @@ function createTailwindV4Engine(source) {
|
|
|
912
961
|
incrementalRawCss: "",
|
|
913
962
|
classSet: new Set(cached.classSet),
|
|
914
963
|
rawCandidates: new Set(cached.seenCandidates),
|
|
964
|
+
customPropertyValues: new Map(cached.customPropertyValues),
|
|
965
|
+
customPropertyContextCss: resolveGenerationStyleContext(compatibleSource.css, cached.rawCss, styleOptions)?.customPropertyContextCss,
|
|
915
966
|
dependencies: cached.dependencies,
|
|
916
967
|
sources: cached.sources,
|
|
917
968
|
root: cached.root,
|
|
@@ -944,15 +995,25 @@ function createTailwindV4Engine(source) {
|
|
|
944
995
|
}
|
|
945
996
|
}
|
|
946
997
|
const rawCss = rawCssParts.join("\n");
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
998
|
+
const fullRawCss = [cached.rawCss, rawCss].filter(Boolean).join("\n");
|
|
999
|
+
const artifact = await generateRawArtifact(generationSessions, cssMacroSource, options);
|
|
1000
|
+
if ((0, _weapp_tailwindcss_postcss_transform.createCssRuntimeAffectingSignature)(fullRawCss) !== (0, _weapp_tailwindcss_postcss_transform.createCssRuntimeAffectingSignature)(artifact.rawCss) || hasChangedCssCalcContext(cached.rawCss, artifact.rawCss, styleOptions)) {
|
|
1001
|
+
const generated = await transformGeneratedArtifact(artifact);
|
|
1002
|
+
if (!seedIncrementalGenerateCache({
|
|
1003
|
+
compatibleSource,
|
|
1004
|
+
generated,
|
|
1005
|
+
requestedCandidates,
|
|
1006
|
+
styleOptions,
|
|
1007
|
+
target
|
|
1008
|
+
})) incrementalGenerateCache.delete(cacheKey);
|
|
1009
|
+
return generated;
|
|
1010
|
+
}
|
|
1011
|
+
const styleContext = target === "weapp" ? resolveIncrementalStyleContext(compatibleSource.css, fullRawCss, styleOptions) : resolveGenerationStyleContext(compatibleSource.css, fullRawCss, styleOptions);
|
|
1012
|
+
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, { ...createIncrementalStyleOptions(styleContext) }) : "";
|
|
951
1013
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
952
1014
|
for (const className of classSet) cached.classSet.add(className);
|
|
953
1015
|
cached.css = [cached.css, incrementalCss].filter(Boolean).join("\n");
|
|
954
|
-
cached.rawCss =
|
|
955
|
-
(0, _weapp_tailwindcss_postcss_transform.mergeCustomPropertyValues)(cached.customPropertyValues, incrementalCss);
|
|
1016
|
+
cached.rawCss = fullRawCss;
|
|
956
1017
|
return {
|
|
957
1018
|
css: cached.css,
|
|
958
1019
|
rawCss: cached.rawCss,
|
|
@@ -960,6 +1021,8 @@ function createTailwindV4Engine(source) {
|
|
|
960
1021
|
incrementalRawCss: rawCss,
|
|
961
1022
|
classSet: new Set(cached.classSet),
|
|
962
1023
|
rawCandidates: new Set(cached.seenCandidates),
|
|
1024
|
+
customPropertyValues: new Map(cached.customPropertyValues),
|
|
1025
|
+
customPropertyContextCss: styleContext?.customPropertyContextCss,
|
|
963
1026
|
dependencies: cached.dependencies,
|
|
964
1027
|
sources: cached.sources,
|
|
965
1028
|
root: cached.root,
|
|
@@ -1716,6 +1779,12 @@ Object.defineProperty(exports, "hasConfiguredTailwindV4CssRoots", {
|
|
|
1716
1779
|
return hasConfiguredTailwindV4CssRoots;
|
|
1717
1780
|
}
|
|
1718
1781
|
});
|
|
1782
|
+
Object.defineProperty(exports, "hasCssCalcVariables", {
|
|
1783
|
+
enumerable: true,
|
|
1784
|
+
get: function() {
|
|
1785
|
+
return hasCssCalcVariables;
|
|
1786
|
+
}
|
|
1787
|
+
});
|
|
1719
1788
|
Object.defineProperty(exports, "isTailwindV4CssEntry", {
|
|
1720
1789
|
enumerable: true,
|
|
1721
1790
|
get: function() {
|
|
@@ -1854,6 +1923,12 @@ Object.defineProperty(exports, "shouldUseUniAppWebRpxCompatibility", {
|
|
|
1854
1923
|
return shouldUseUniAppWebRpxCompatibility;
|
|
1855
1924
|
}
|
|
1856
1925
|
});
|
|
1926
|
+
Object.defineProperty(exports, "stableSerialize", {
|
|
1927
|
+
enumerable: true,
|
|
1928
|
+
get: function() {
|
|
1929
|
+
return stableSerialize;
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1857
1932
|
Object.defineProperty(exports, "transformTailwindV4CssByTarget", {
|
|
1858
1933
|
enumerable: true,
|
|
1859
1934
|
get: function() {
|