weapp-tailwindcss 5.5.8 → 5.5.9
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/{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/{generated-css-marker-B0RyziOH.cjs → generated-css-marker-C21q8hGM.cjs} +48 -20
- 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-CngHA9cU.cjs → gulp-BhQhrDCx.cjs} +5 -5
- package/dist/{gulp-DhddVxGA.js → gulp-ComuY3KW.js} +4 -4
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-xPpat-km.js → hmr-timing-CNo2hmaX.js} +48 -20
- package/dist/{hmr-timing-Dc4c1VRg.cjs → hmr-timing-CXBDn0dl.cjs} +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-EUud9R2K.cjs → pipeline-helpers-B9ZqLXma.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/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{scoped-generator-lbTwL6mD.cjs → scoped-generator-BAiZDC_4.cjs} +4 -4
- package/dist/{scoped-generator-DlQrVbuC.js → scoped-generator-CF0ROe7B.js} +4 -4
- 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-DJkkjruV.cjs} +3 -3
- package/dist/{transform-BAon9ykq.js → transform-I-mzwoiv.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-BVcj7Ht9.cjs} +18 -14
- package/dist/{vite-D-RGkmOE.js → vite-Bd-Ig5Dy.js} +17 -13
- 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--kA4HUTm.js → web-BsFZOq3g.js} +296 -85
- package/dist/{web-DHfZ_KC9.cjs → web-Dq2PzKKQ.cjs} +307 -84
- package/dist/{webpack-BetjemzT.cjs → webpack-CWMoTWzF.cjs} +8 -8
- package/dist/{webpack-Bhkd27Rs.js → webpack-DtAZoEth.js} +6 -6
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { InternalUserDefinedOptions } from '../../types/index.js';
|
|
3
|
+
export interface ViteCssCalcStage {
|
|
4
|
+
options: InternalUserDefinedOptions;
|
|
5
|
+
getFinalOptions: () => Partial<IStyleHandlerOptions> | undefined;
|
|
6
|
+
shouldDefer: () => boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function createViteCssCalcStage(original: InternalUserDefinedOptions, isBuild: () => boolean, getPlatform?: () => string | undefined): ViteCssCalcStage;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { OutputBundle } from 'rollup';
|
|
2
2
|
import type { CssFinalizerContext } from './options.js';
|
|
3
|
+
export declare function finalizeCssCalc(bundle: OutputBundle, context: CssFinalizerContext, convertUnits?: boolean): Promise<void>;
|
|
3
4
|
export declare function finalizeWebCssCalc(bundle: OutputBundle, context: CssFinalizerContext): Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { OutputBundle } from 'rollup';
|
|
2
2
|
import type { CssFinalizerContext } from './options.js';
|
|
3
|
-
export declare function finalizeCssAssets(bundle: OutputBundle, context: CssFinalizerContext, isWebGeneratorTarget: boolean, files: ReadonlySet<string>): Promise<void
|
|
3
|
+
export declare function finalizeCssAssets(bundle: OutputBundle, context: CssFinalizerContext, isWebGeneratorTarget: boolean, files: ReadonlySet<string>): Promise<void>;
|
|
@@ -13,6 +13,7 @@ interface RememberedMainCssSource {
|
|
|
13
13
|
export interface CssFinalizerContext {
|
|
14
14
|
frameworkName?: string | undefined;
|
|
15
15
|
opts: InternalUserDefinedOptions;
|
|
16
|
+
getFinalCssCalcOptions?: (() => Partial<IStyleHandlerOptions> | undefined) | undefined;
|
|
16
17
|
runtimeState: {
|
|
17
18
|
tailwindRuntime: InternalUserDefinedOptions['tailwindRuntime'];
|
|
18
19
|
readyPromise: Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
4
4
|
require("./utils-CuKLf1Zv.cjs");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-uf04Iolj.cjs");
|
|
6
6
|
const require_defaults = require("./defaults-CyX5iO9y.cjs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -59,21 +59,11 @@ function createGenerationArtifact(fragments, options) {
|
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/core/compiler/source-fingerprint.ts
|
|
62
|
-
function stableSerialize(value, stack = /* @__PURE__ */ new WeakSet()) {
|
|
63
|
-
if (value == null || typeof value === "number" || typeof value === "boolean" || typeof value === "string") return JSON.stringify(value);
|
|
64
|
-
if (typeof value === "function") return `[Function:${value.name}]`;
|
|
65
|
-
if (typeof value !== "object") return String(value);
|
|
66
|
-
if (stack.has(value)) return "[Circular]";
|
|
67
|
-
stack.add(value);
|
|
68
|
-
const serialized = Array.isArray(value) ? `[${value.map((item) => stableSerialize(item, stack)).join(",")}]` : `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableSerialize(value[key], stack)}`).join(",")}}`;
|
|
69
|
-
stack.delete(value);
|
|
70
|
-
return serialized;
|
|
71
|
-
}
|
|
72
62
|
function createSourceFingerprint(source) {
|
|
73
63
|
return createCompilerValueFingerprint(source);
|
|
74
64
|
}
|
|
75
65
|
function createCompilerValueFingerprint(value) {
|
|
76
|
-
return (0, _weapp_tailwindcss_shared_node.md5)(stableSerialize(value));
|
|
66
|
+
return (0, _weapp_tailwindcss_shared_node.md5)(require_generator.stableSerialize(value));
|
|
77
67
|
}
|
|
78
68
|
//#endregion
|
|
79
69
|
//#region src/compiler/candidate-index.ts
|
|
@@ -871,10 +861,10 @@ var AssetEmissionPlan = class {
|
|
|
871
861
|
//#region src/core/compiler/generation-cache.ts
|
|
872
862
|
function createCompilerGenerationCacheKey(request, candidates, target) {
|
|
873
863
|
return {
|
|
874
|
-
bareArbitraryValues: request.bareArbitraryValues,
|
|
864
|
+
bareArbitraryValuesFingerprint: request.bareArbitraryValues === void 0 ? void 0 : createCompilerValueFingerprint(request.bareArbitraryValues),
|
|
875
865
|
candidateSignature: [...candidates].sort().join("\0"),
|
|
876
866
|
incrementalCache: request.incrementalCache,
|
|
877
|
-
scanSources: request.scanSources,
|
|
867
|
+
scanSourcesFingerprint: request.scanSources === void 0 ? void 0 : createCompilerValueFingerprint(request.scanSources),
|
|
878
868
|
scanMode: request.scanMode,
|
|
879
869
|
excludeFilesFingerprint: request.excludeFiles === void 0 ? void 0 : createCompilerValueFingerprint(request.excludeFiles),
|
|
880
870
|
sourcesFingerprint: request.sources === void 0 ? void 0 : createCompilerValueFingerprint(request.sources),
|
|
@@ -883,7 +873,7 @@ function createCompilerGenerationCacheKey(request, candidates, target) {
|
|
|
883
873
|
};
|
|
884
874
|
}
|
|
885
875
|
function isSameCompilerGenerationCacheKey(left, right) {
|
|
886
|
-
return left.
|
|
876
|
+
return left.bareArbitraryValuesFingerprint === right.bareArbitraryValuesFingerprint && left.candidateSignature === right.candidateSignature && left.incrementalCache === right.incrementalCache && left.scanSourcesFingerprint === right.scanSourcesFingerprint && left.scanMode === right.scanMode && left.excludeFilesFingerprint === right.excludeFilesFingerprint && left.sourcesFingerprint === right.sourcesFingerprint && left.styleOptionsFingerprint === right.styleOptionsFingerprint && left.target === right.target;
|
|
887
877
|
}
|
|
888
878
|
function reuseCompilerGenerationResult(result) {
|
|
889
879
|
return {
|
|
@@ -1051,7 +1041,7 @@ var CompilerRootStore = class {
|
|
|
1051
1041
|
entry.generationCache = void 0;
|
|
1052
1042
|
entry.latestSnapshot = void 0;
|
|
1053
1043
|
entry.source = void 0;
|
|
1054
|
-
entry.
|
|
1044
|
+
entry.sourceInputFingerprint = void 0;
|
|
1055
1045
|
entry.sourceFingerprint = void 0;
|
|
1056
1046
|
entry.sources = [];
|
|
1057
1047
|
if (notifyEvicted) this.onRootEvicted?.(id);
|
|
@@ -1229,6 +1219,28 @@ function createImmutableSet(values) {
|
|
|
1229
1219
|
return new ImmutableSetView(values);
|
|
1230
1220
|
}
|
|
1231
1221
|
//#endregion
|
|
1222
|
+
//#region src/core/compiler/source.ts
|
|
1223
|
+
async function resolveCompilerSource(entry, request, invalidation) {
|
|
1224
|
+
if (request.source && request.sourceOptions) throw new Error("generate() 的 source 与 sourceOptions 互斥。");
|
|
1225
|
+
if (!request.source && !request.sourceOptions) throw new Error("generate() 必须提供 source 或 sourceOptions。");
|
|
1226
|
+
const input = structuredClone(request.source ? { source: request.source } : {
|
|
1227
|
+
sourceOptions: request.sourceOptions,
|
|
1228
|
+
cwd: node_process.default.cwd()
|
|
1229
|
+
});
|
|
1230
|
+
const sourceInputFingerprint = createCompilerValueFingerprint(input);
|
|
1231
|
+
if (entry.source !== void 0 && entry.sourceFingerprint !== void 0 && entry.sourceInputFingerprint === sourceInputFingerprint && entry.appliedInvalidation === invalidation) return {
|
|
1232
|
+
source: entry.source,
|
|
1233
|
+
sourceFingerprint: entry.sourceFingerprint,
|
|
1234
|
+
sourceInputFingerprint
|
|
1235
|
+
};
|
|
1236
|
+
const source = input.source ?? await require_generator.resolveTailwindV4Source(input.sourceOptions);
|
|
1237
|
+
return {
|
|
1238
|
+
source,
|
|
1239
|
+
sourceFingerprint: createSourceFingerprint(source),
|
|
1240
|
+
sourceInputFingerprint
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
//#endregion
|
|
1232
1244
|
//#region src/cache/index.ts
|
|
1233
1245
|
function isProcessResult(value) {
|
|
1234
1246
|
return typeof value === "object" && value !== null && "result" in value;
|
|
@@ -35863,7 +35875,7 @@ function babelParse(code, opts = {}) {
|
|
|
35863
35875
|
return result;
|
|
35864
35876
|
}
|
|
35865
35877
|
//#endregion
|
|
35866
|
-
//#region ../../node_modules/.pnpm/magic-string@1.4.
|
|
35878
|
+
//#region ../../node_modules/.pnpm/magic-string@1.4.2/node_modules/magic-string/dist/index.mjs
|
|
35867
35879
|
var BitSet = class BitSet {
|
|
35868
35880
|
constructor(arg) {
|
|
35869
35881
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
@@ -35957,7 +35969,7 @@ var Chunk = class Chunk {
|
|
|
35957
35969
|
this.outro = "";
|
|
35958
35970
|
this.end = index;
|
|
35959
35971
|
if (this.edited) {
|
|
35960
|
-
newChunk.edit("", false);
|
|
35972
|
+
newChunk.edit("", false, true);
|
|
35961
35973
|
this.content = "";
|
|
35962
35974
|
} else this.content = originalBefore;
|
|
35963
35975
|
newChunk.next = this.next;
|
|
@@ -36919,7 +36931,7 @@ var MagicString = class MagicString {
|
|
|
36919
36931
|
* Content appended or prepended at positions strictly inside the range is removed with it, while
|
|
36920
36932
|
* content attached at `start` or `end` is preserved — use `s.overwrite(start, end, '')` to remove
|
|
36921
36933
|
* the range including its edge inserts.
|
|
36922
|
-
*
|
|
36934
|
+
* Repeated removals and removals with partially overlapping ranges are allowed.
|
|
36923
36935
|
*/
|
|
36924
36936
|
remove(start, end) {
|
|
36925
36937
|
start = start + this.offset;
|
|
@@ -37201,10 +37213,16 @@ var MagicString = class MagicString {
|
|
|
37201
37213
|
* @internal
|
|
37202
37214
|
*/
|
|
37203
37215
|
_hasRemovedContent(start, end) {
|
|
37204
|
-
let chunk = this.
|
|
37205
|
-
|
|
37206
|
-
|
|
37207
|
-
|
|
37216
|
+
let chunk = this.byStart.get(start);
|
|
37217
|
+
if (!chunk) {
|
|
37218
|
+
chunk = this.lastSearchedChunk;
|
|
37219
|
+
const searchForward = start >= chunk.end;
|
|
37220
|
+
while (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
|
|
37221
|
+
if (chunk) this.lastSearchedChunk = chunk;
|
|
37222
|
+
}
|
|
37223
|
+
while (chunk && chunk.start < end) {
|
|
37224
|
+
if (chunk.content === "") return true;
|
|
37225
|
+
chunk = this.byStart.get(chunk.end);
|
|
37208
37226
|
}
|
|
37209
37227
|
return false;
|
|
37210
37228
|
}
|
|
@@ -37268,6 +37286,7 @@ var MagicString = class MagicString {
|
|
|
37268
37286
|
const stringLength = string.length;
|
|
37269
37287
|
if (stringLength === 0) {
|
|
37270
37288
|
for (let index = 0; index <= original.length; index += 1) {
|
|
37289
|
+
if (this._hasRemovedContent(index, index)) continue;
|
|
37271
37290
|
const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
|
|
37272
37291
|
if (_replacement !== "") this.appendRight(index, _replacement);
|
|
37273
37292
|
}
|
|
@@ -41312,20 +41331,10 @@ function createCompiler(options = {}) {
|
|
|
41312
41331
|
track,
|
|
41313
41332
|
userOptions
|
|
41314
41333
|
});
|
|
41315
|
-
async function resolveRequestSource(entry, request) {
|
|
41316
|
-
if (request.source && request.sourceOptions) throw new Error("generate() 的 source 与 sourceOptions 互斥。");
|
|
41317
|
-
if (!request.source && !request.sourceOptions) throw new Error("generate() 必须提供 source 或 sourceOptions。");
|
|
41318
|
-
const sourceInput = request.source ?? request.sourceOptions;
|
|
41319
|
-
return {
|
|
41320
|
-
source: entry.source !== void 0 && entry.sourceInput === sourceInput && entry.appliedInvalidation === entry.invalidation ? entry.source : request.source ?? await require_generator.resolveTailwindV4Source(request.sourceOptions),
|
|
41321
|
-
sourceInput
|
|
41322
|
-
};
|
|
41323
|
-
}
|
|
41324
41334
|
async function runGenerate(entry, request) {
|
|
41325
41335
|
if (!entry.active) throw new Error(`Compiler root 已被移除:${entry.id}`);
|
|
41326
41336
|
const invalidation = entry.invalidation;
|
|
41327
|
-
const { source,
|
|
41328
|
-
const sourceFingerprint = entry.sourceInput === sourceInput && entry.sourceFingerprint !== void 0 && entry.appliedInvalidation === invalidation ? entry.sourceFingerprint : createSourceFingerprint(source);
|
|
41337
|
+
const { source, sourceFingerprint, sourceInputFingerprint } = await resolveCompilerSource(entry, request, invalidation);
|
|
41329
41338
|
const sourceReused = entry.sourceFingerprint === sourceFingerprint;
|
|
41330
41339
|
const engineReused = sourceReused && entry.generator !== void 0 && entry.appliedInvalidation === invalidation;
|
|
41331
41340
|
const generator = engineReused ? entry.generator : require_generator.createWeappTailwindcssGenerator(source);
|
|
@@ -41372,15 +41381,18 @@ function createCompiler(options = {}) {
|
|
|
41372
41381
|
entry.generator = generator;
|
|
41373
41382
|
entry.generationCache = {
|
|
41374
41383
|
key: generationCacheKey,
|
|
41375
|
-
result:
|
|
41384
|
+
result: {
|
|
41385
|
+
...generated,
|
|
41386
|
+
sources: [...snapshot.sources]
|
|
41387
|
+
}
|
|
41376
41388
|
};
|
|
41377
41389
|
entry.source = source;
|
|
41378
41390
|
entry.sourceFingerprint = sourceFingerprint;
|
|
41379
|
-
entry.
|
|
41391
|
+
entry.sourceInputFingerprint = sourceInputFingerprint;
|
|
41380
41392
|
entry.appliedInvalidation = invalidation;
|
|
41381
41393
|
entry.latestSnapshot = snapshot;
|
|
41382
41394
|
rootStore.attachDependencies(entry, dependencies);
|
|
41383
|
-
rootStore.attachSources(entry, sources);
|
|
41395
|
+
rootStore.attachSources(entry, snapshot.sources);
|
|
41384
41396
|
if (!engineReused && previousGenerator !== generator) previousGenerator?.dispose?.();
|
|
41385
41397
|
const css = target === "tailwind" ? generated.rawCss : generated.css;
|
|
41386
41398
|
const incrementalCss = target === "tailwind" ? generated.incrementalRawCss : generated.incrementalCss;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources, v as source_scan_exports } from "./tailwindcss-
|
|
1
|
+
import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources, v as source_scan_exports } from "./tailwindcss-XNfJSlhp.js";
|
|
2
2
|
import { resolveMpxPlatform } from "./framework.js";
|
|
3
|
-
import { B as loadTailwindV4DesignSystem,
|
|
3
|
+
import { B as stableSerialize, H as loadTailwindV4DesignSystem, L as resolveCssMacroTailwindV4Source, M as createTailwindV4Engine$1, O as resolveRuntimeBareArbitraryValues, P as _defineProperty, T as omitUndefined, U as resolveValidTailwindV4Candidates$1, V as shouldUseUniAppWebRpxCompatibility, a as resolveGeneratorRuntimeBranch, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions, j as resolveBooleanObjectOption, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source$1 } from "./generator-LqofzXgr.js";
|
|
4
4
|
import { i as isMap, n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
|
|
5
5
|
import { a as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, i as resolveDefaultCssPreflight, o as HARD_PARSE_CACHE_MAX_ENTRIES, r as getDefaultOptions } from "./defaults-AQuvJS-h.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
@@ -59,16 +59,6 @@ function createGenerationArtifact(fragments, options) {
|
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/core/compiler/source-fingerprint.ts
|
|
62
|
-
function stableSerialize(value, stack = /* @__PURE__ */ new WeakSet()) {
|
|
63
|
-
if (value == null || typeof value === "number" || typeof value === "boolean" || typeof value === "string") return JSON.stringify(value);
|
|
64
|
-
if (typeof value === "function") return `[Function:${value.name}]`;
|
|
65
|
-
if (typeof value !== "object") return String(value);
|
|
66
|
-
if (stack.has(value)) return "[Circular]";
|
|
67
|
-
stack.add(value);
|
|
68
|
-
const serialized = Array.isArray(value) ? `[${value.map((item) => stableSerialize(item, stack)).join(",")}]` : `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableSerialize(value[key], stack)}`).join(",")}}`;
|
|
69
|
-
stack.delete(value);
|
|
70
|
-
return serialized;
|
|
71
|
-
}
|
|
72
62
|
function createSourceFingerprint(source) {
|
|
73
63
|
return createCompilerValueFingerprint(source);
|
|
74
64
|
}
|
|
@@ -895,10 +885,10 @@ function createCompilationEventBus() {
|
|
|
895
885
|
//#region src/core/compiler/generation-cache.ts
|
|
896
886
|
function createCompilerGenerationCacheKey(request, candidates, target) {
|
|
897
887
|
return {
|
|
898
|
-
bareArbitraryValues: request.bareArbitraryValues,
|
|
888
|
+
bareArbitraryValuesFingerprint: request.bareArbitraryValues === void 0 ? void 0 : createCompilerValueFingerprint(request.bareArbitraryValues),
|
|
899
889
|
candidateSignature: [...candidates].sort().join("\0"),
|
|
900
890
|
incrementalCache: request.incrementalCache,
|
|
901
|
-
scanSources: request.scanSources,
|
|
891
|
+
scanSourcesFingerprint: request.scanSources === void 0 ? void 0 : createCompilerValueFingerprint(request.scanSources),
|
|
902
892
|
scanMode: request.scanMode,
|
|
903
893
|
excludeFilesFingerprint: request.excludeFiles === void 0 ? void 0 : createCompilerValueFingerprint(request.excludeFiles),
|
|
904
894
|
sourcesFingerprint: request.sources === void 0 ? void 0 : createCompilerValueFingerprint(request.sources),
|
|
@@ -907,7 +897,7 @@ function createCompilerGenerationCacheKey(request, candidates, target) {
|
|
|
907
897
|
};
|
|
908
898
|
}
|
|
909
899
|
function isSameCompilerGenerationCacheKey(left, right) {
|
|
910
|
-
return left.
|
|
900
|
+
return left.bareArbitraryValuesFingerprint === right.bareArbitraryValuesFingerprint && left.candidateSignature === right.candidateSignature && left.incrementalCache === right.incrementalCache && left.scanSourcesFingerprint === right.scanSourcesFingerprint && left.scanMode === right.scanMode && left.excludeFilesFingerprint === right.excludeFilesFingerprint && left.sourcesFingerprint === right.sourcesFingerprint && left.styleOptionsFingerprint === right.styleOptionsFingerprint && left.target === right.target;
|
|
911
901
|
}
|
|
912
902
|
function reuseCompilerGenerationResult(result) {
|
|
913
903
|
return {
|
|
@@ -1075,7 +1065,7 @@ var CompilerRootStore = class {
|
|
|
1075
1065
|
entry.generationCache = void 0;
|
|
1076
1066
|
entry.latestSnapshot = void 0;
|
|
1077
1067
|
entry.source = void 0;
|
|
1078
|
-
entry.
|
|
1068
|
+
entry.sourceInputFingerprint = void 0;
|
|
1079
1069
|
entry.sourceFingerprint = void 0;
|
|
1080
1070
|
entry.sources = [];
|
|
1081
1071
|
if (notifyEvicted) this.onRootEvicted?.(id);
|
|
@@ -1253,6 +1243,28 @@ function createImmutableSet(values) {
|
|
|
1253
1243
|
return new ImmutableSetView(values);
|
|
1254
1244
|
}
|
|
1255
1245
|
//#endregion
|
|
1246
|
+
//#region src/core/compiler/source.ts
|
|
1247
|
+
async function resolveCompilerSource(entry, request, invalidation) {
|
|
1248
|
+
if (request.source && request.sourceOptions) throw new Error("generate() 的 source 与 sourceOptions 互斥。");
|
|
1249
|
+
if (!request.source && !request.sourceOptions) throw new Error("generate() 必须提供 source 或 sourceOptions。");
|
|
1250
|
+
const input = structuredClone(request.source ? { source: request.source } : {
|
|
1251
|
+
sourceOptions: request.sourceOptions,
|
|
1252
|
+
cwd: process.cwd()
|
|
1253
|
+
});
|
|
1254
|
+
const sourceInputFingerprint = createCompilerValueFingerprint(input);
|
|
1255
|
+
if (entry.source !== void 0 && entry.sourceFingerprint !== void 0 && entry.sourceInputFingerprint === sourceInputFingerprint && entry.appliedInvalidation === invalidation) return {
|
|
1256
|
+
source: entry.source,
|
|
1257
|
+
sourceFingerprint: entry.sourceFingerprint,
|
|
1258
|
+
sourceInputFingerprint
|
|
1259
|
+
};
|
|
1260
|
+
const source = input.source ?? await resolveTailwindV4Source$1(input.sourceOptions);
|
|
1261
|
+
return {
|
|
1262
|
+
source,
|
|
1263
|
+
sourceFingerprint: createSourceFingerprint(source),
|
|
1264
|
+
sourceInputFingerprint
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
//#endregion
|
|
1256
1268
|
//#region src/cache/index.ts
|
|
1257
1269
|
function isProcessResult(value) {
|
|
1258
1270
|
return typeof value === "object" && value !== null && "result" in value;
|
|
@@ -4427,20 +4439,10 @@ function createCompiler(options = {}) {
|
|
|
4427
4439
|
track,
|
|
4428
4440
|
userOptions
|
|
4429
4441
|
});
|
|
4430
|
-
async function resolveRequestSource(entry, request) {
|
|
4431
|
-
if (request.source && request.sourceOptions) throw new Error("generate() 的 source 与 sourceOptions 互斥。");
|
|
4432
|
-
if (!request.source && !request.sourceOptions) throw new Error("generate() 必须提供 source 或 sourceOptions。");
|
|
4433
|
-
const sourceInput = request.source ?? request.sourceOptions;
|
|
4434
|
-
return {
|
|
4435
|
-
source: entry.source !== void 0 && entry.sourceInput === sourceInput && entry.appliedInvalidation === entry.invalidation ? entry.source : request.source ?? await resolveTailwindV4Source$1(request.sourceOptions),
|
|
4436
|
-
sourceInput
|
|
4437
|
-
};
|
|
4438
|
-
}
|
|
4439
4442
|
async function runGenerate(entry, request) {
|
|
4440
4443
|
if (!entry.active) throw new Error(`Compiler root 已被移除:${entry.id}`);
|
|
4441
4444
|
const invalidation = entry.invalidation;
|
|
4442
|
-
const { source,
|
|
4443
|
-
const sourceFingerprint = entry.sourceInput === sourceInput && entry.sourceFingerprint !== void 0 && entry.appliedInvalidation === invalidation ? entry.sourceFingerprint : createSourceFingerprint(source);
|
|
4445
|
+
const { source, sourceFingerprint, sourceInputFingerprint } = await resolveCompilerSource(entry, request, invalidation);
|
|
4444
4446
|
const sourceReused = entry.sourceFingerprint === sourceFingerprint;
|
|
4445
4447
|
const engineReused = sourceReused && entry.generator !== void 0 && entry.appliedInvalidation === invalidation;
|
|
4446
4448
|
const generator = engineReused ? entry.generator : createWeappTailwindcssGenerator(source);
|
|
@@ -4487,15 +4489,18 @@ function createCompiler(options = {}) {
|
|
|
4487
4489
|
entry.generator = generator;
|
|
4488
4490
|
entry.generationCache = {
|
|
4489
4491
|
key: generationCacheKey,
|
|
4490
|
-
result:
|
|
4492
|
+
result: {
|
|
4493
|
+
...generated,
|
|
4494
|
+
sources: [...snapshot.sources]
|
|
4495
|
+
}
|
|
4491
4496
|
};
|
|
4492
4497
|
entry.source = source;
|
|
4493
4498
|
entry.sourceFingerprint = sourceFingerprint;
|
|
4494
|
-
entry.
|
|
4499
|
+
entry.sourceInputFingerprint = sourceInputFingerprint;
|
|
4495
4500
|
entry.appliedInvalidation = invalidation;
|
|
4496
4501
|
entry.latestSnapshot = snapshot;
|
|
4497
4502
|
rootStore.attachDependencies(entry, dependencies);
|
|
4498
|
-
rootStore.attachSources(entry, sources);
|
|
4503
|
+
rootStore.attachSources(entry, snapshot.sources);
|
|
4499
4504
|
if (!engineReused && previousGenerator !== generator) previousGenerator?.dispose?.();
|
|
4500
4505
|
const css = target === "tailwind" ? generated.rawCss : generated.css;
|
|
4501
4506
|
const incrementalCss = target === "tailwind" ? generated.incrementalRawCss : generated.incrementalCss;
|
|
@@ -5,10 +5,10 @@ export interface CompilerGenerationCacheEntry {
|
|
|
5
5
|
result: WeappTailwindcssGenerateResult;
|
|
6
6
|
}
|
|
7
7
|
interface CompilerGenerationCacheKey {
|
|
8
|
-
|
|
8
|
+
bareArbitraryValuesFingerprint: string | undefined;
|
|
9
9
|
candidateSignature: string;
|
|
10
10
|
incrementalCache: CompilerGenerateRequest['incrementalCache'];
|
|
11
|
-
|
|
11
|
+
scanSourcesFingerprint: string | undefined;
|
|
12
12
|
scanMode: CompilerGenerateRequest['scanMode'];
|
|
13
13
|
excludeFilesFingerprint: string | undefined;
|
|
14
14
|
sourcesFingerprint: string | undefined;
|
|
@@ -22,6 +22,8 @@ export declare function reuseCompilerGenerationResult(result: WeappTailwindcssGe
|
|
|
22
22
|
incrementalRawCss: string;
|
|
23
23
|
css: string;
|
|
24
24
|
rawCss: string;
|
|
25
|
+
customPropertyValues?: ReadonlyMap<string, string> | undefined;
|
|
26
|
+
customPropertyContextCss?: string | undefined;
|
|
25
27
|
target: "weapp" | "web";
|
|
26
28
|
root: import("@weapp-tailwindcss/engine").TailwindV4CompiledSourceRoot;
|
|
27
29
|
sources: import("@weapp-tailwindcss/engine").TailwindV4SourcePattern[];
|
|
@@ -20,7 +20,7 @@ export interface CompilerRootSession {
|
|
|
20
20
|
pendingCount: number;
|
|
21
21
|
source?: TailwindV4ResolvedSource | undefined;
|
|
22
22
|
sourceFingerprint?: string | undefined;
|
|
23
|
-
|
|
23
|
+
sourceInputFingerprint?: string | undefined;
|
|
24
24
|
sources: CompilerSourcePattern[];
|
|
25
25
|
}
|
|
26
26
|
export declare class CompilerRootStore {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CompilerRootSession } from './root-store.js';
|
|
2
|
+
import type { CompilerGenerateRequest } from './types.js';
|
|
3
|
+
export declare function resolveCompilerSource(entry: CompilerRootSession, request: CompilerGenerateRequest, invalidation: number): Promise<{
|
|
4
|
+
source: import("../../generator/index.js").TailwindV4ResolvedSource;
|
|
5
|
+
sourceFingerprint: string;
|
|
6
|
+
sourceInputFingerprint: string;
|
|
7
|
+
}>;
|
package/dist/core.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_compiler = require("./compiler-
|
|
2
|
+
const require_compiler = require("./compiler-TvqqdOMD.cjs");
|
|
3
3
|
const require_runtime_state = require("./runtime-state-BOzuVoKl.cjs");
|
|
4
4
|
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
5
5
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as createTailwindRuntimeReadyPromise, F as createCompilationEventBus, d as createCompiler, f as getCompilerContext, j as ensureRuntimeClassSet, t as createCompilerRuntimeState, y as shouldSkipJsTransform } from "./compiler-
|
|
1
|
+
import { A as createTailwindRuntimeReadyPromise, F as createCompilationEventBus, d as createCompiler, f as getCompilerContext, j as ensureRuntimeClassSet, t as createCompilerRuntimeState, y as shouldSkipJsTransform } from "./compiler-v9sYta8W.js";
|
|
2
2
|
import { finalizeMiniProgramCss, finalizeMiniProgramCssRoot, postcss, removeTailwindSourceDirectivesRoot } from "@weapp-tailwindcss/postcss/transform";
|
|
3
3
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
4
4
|
import { performance } from "node:perf_hooks";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
3
3
|
require("./auto-B1OyRrE8.cjs");
|
|
4
|
-
const require_compiler = require("./compiler-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
4
|
+
const require_compiler = require("./compiler-TvqqdOMD.cjs");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-uf04Iolj.cjs");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -1171,15 +1171,24 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
1171
1171
|
if (generatedResults.length === 1) return firstGenerated;
|
|
1172
1172
|
const incrementalCssResults = generatedResults.map((item) => item.incrementalCss).filter((css) => typeof css === "string");
|
|
1173
1173
|
const incrementalRawCssResults = generatedResults.map((item) => item.incrementalRawCss).filter((css) => typeof css === "string");
|
|
1174
|
+
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
1175
|
+
const conflictingProperties = /* @__PURE__ */ new Set();
|
|
1176
|
+
for (const result of generatedResults) for (const [name, value] of result.customPropertyValues ?? []) {
|
|
1177
|
+
if (customPropertyValues.has(name) && customPropertyValues.get(name) !== value) conflictingProperties.add(name);
|
|
1178
|
+
customPropertyValues.set(name, value);
|
|
1179
|
+
}
|
|
1180
|
+
for (const name of conflictingProperties) customPropertyValues.delete(name);
|
|
1174
1181
|
return {
|
|
1175
1182
|
...firstGenerated,
|
|
1176
1183
|
css: (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(generatedResults.map((item) => item.css).join("\n")),
|
|
1177
1184
|
rawCss: (0, _weapp_tailwindcss_postcss_transform.deduplicateGeneratedCssRules)(generatedResults.map((item) => item.rawCss).join("\n")),
|
|
1185
|
+
customPropertyContextCss: generatedResults.map((item) => item.customPropertyContextCss ?? item.rawCss).join("\n"),
|
|
1178
1186
|
incrementalCss: incrementalCssResults.length === generatedResults.length ? incrementalCssResults.filter(Boolean).join("\n") : void 0,
|
|
1179
1187
|
incrementalRawCss: incrementalRawCssResults.length === generatedResults.length ? incrementalRawCssResults.filter(Boolean).join("\n") : void 0,
|
|
1180
1188
|
classSet: new Set(generatedResults.flatMap((item) => [...item.classSet])),
|
|
1181
1189
|
dependencies: [...new Set(generatedResults.flatMap((item) => item.dependencies))],
|
|
1182
|
-
sources: generatedResults.flatMap((item) => item.sources)
|
|
1190
|
+
sources: generatedResults.flatMap((item) => item.sources),
|
|
1191
|
+
customPropertyValues
|
|
1183
1192
|
};
|
|
1184
1193
|
}
|
|
1185
1194
|
//#endregion
|
|
@@ -1244,12 +1253,12 @@ function collectRpxThemeRiskSources(sources) {
|
|
|
1244
1253
|
for (const css of new Set(sources)) for (const name of (0, _weapp_tailwindcss_postcss_transform.collectRpxThemeVariables)(css)) variables.add(name);
|
|
1245
1254
|
return [...variables];
|
|
1246
1255
|
}
|
|
1247
|
-
function warnRpxThemeRisk(session, variables,
|
|
1256
|
+
function warnRpxThemeRisk(session, variables, generatedCss) {
|
|
1248
1257
|
if (warnedSessions.has(session) || variables.length === 0) return;
|
|
1249
|
-
const usage = (0, _weapp_tailwindcss_postcss_transform.inspectRpxCalcUsage)(
|
|
1250
|
-
const
|
|
1258
|
+
const usage = (0, _weapp_tailwindcss_postcss_transform.inspectRpxCalcUsage)(generatedCss, new Set(variables));
|
|
1259
|
+
const generationHint = usage === void 0 ? "当前生成阶段的 CSS 无法完成诊断,请检查最终 WXSS。" : usage.variables.length > 0 || usage.inlineRpx ? `当前生成阶段仍含 calc:${[...usage.variables, ...usage.inlineRpx ? ["内联 rpx"] : []].join(", ")};后续构建处理可能将其静态化,最终状态以 WXSS 为准。` : "当前生成阶段未检测到相关 calc;这不代表已验证最终产物、所有作用域和设备。";
|
|
1251
1260
|
warnedSessions.add(session);
|
|
1252
|
-
_weapp_tailwindcss_logger.logger.warn(`[tailwindcss@4][rpx-theme] @theme 中使用 rpx 的主题变量:${variables.join(", ")}。${
|
|
1261
|
+
_weapp_tailwindcss_logger.logger.warn(`[tailwindcss@4][rpx-theme] @theme 中使用 rpx 的主题变量:${variables.join(", ")}。${generationHint} 微信 WXSS 可能先独立换算或量化基数再乘法,造成尺寸偏差,具体取整算法尚未确认。固定像素尺寸优先使用 px,需要缩放时在构建期输出最终静态 rpx;偶数或较大 rpx 也不保证准确。请检查最终 WXSS 并在目标设备验证:https://tw.weapp.dev/docs/issues/spacing-rpx`);
|
|
1253
1262
|
}
|
|
1254
1263
|
//#endregion
|
|
1255
1264
|
//#region src/generation/framework-postcss.ts
|
|
@@ -2331,17 +2340,8 @@ function setLimitedCacheValue(cache, key, value) {
|
|
|
2331
2340
|
}
|
|
2332
2341
|
cache.set(key, value);
|
|
2333
2342
|
}
|
|
2334
|
-
function createStableJson(value) {
|
|
2335
|
-
if (value === void 0) return "undefined";
|
|
2336
|
-
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
2337
|
-
if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
|
|
2338
|
-
return `{${Object.keys(value).sort().map((key) => {
|
|
2339
|
-
const record = value;
|
|
2340
|
-
return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
|
|
2341
|
-
}).join(",")}}`;
|
|
2342
|
-
}
|
|
2343
2343
|
function createLegacyCompatTransformCacheKey(source, options) {
|
|
2344
|
-
return `${
|
|
2344
|
+
return `${require_generator.stableSerialize(options)}\0${source}`;
|
|
2345
2345
|
}
|
|
2346
2346
|
function resolveLegacyCompatCssSource(rawSource) {
|
|
2347
2347
|
const cached = legacyCompatSourceCache.get(rawSource);
|
|
@@ -2535,6 +2535,10 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
2535
2535
|
const rawCss = (0, _weapp_tailwindcss_postcss_transform.stripTailwindBanner)(css);
|
|
2536
2536
|
const generationCss = generated.target === "weapp" && ((0, _weapp_tailwindcss_postcss_transform.hasCssMacroStyleOptions)(generatorStyleOptions) || (0, _weapp_tailwindcss_postcss_transform.hasCssMacroTailwindV4InternalAtRules)(rawCss)) ? await (0, _weapp_tailwindcss_postcss_transform.transformCssMacroCss)(rawCss, generatorStyleOptions) : rawCss;
|
|
2537
2537
|
const normalizedCss = generated.target === "weapp" ? await (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramGeneratedCssForPostcss)(generationCss, {
|
|
2538
|
+
cssCalc: generatorStyleOptions.cssCalc,
|
|
2539
|
+
cssOptions: generatorStyleOptions.cssOptions,
|
|
2540
|
+
customPropertyValues: generatorStyleOptions.customPropertyValues,
|
|
2541
|
+
contextCss: generated.customPropertyContextCss ?? generated.rawCss,
|
|
2538
2542
|
preservePreflight: true,
|
|
2539
2543
|
preserveRawClassRules: true
|
|
2540
2544
|
}) : generationCss;
|
|
@@ -2973,6 +2977,23 @@ async function prepareGeneratorInputs(context) {
|
|
|
2973
2977
|
};
|
|
2974
2978
|
}
|
|
2975
2979
|
//#endregion
|
|
2980
|
+
//#region src/generation/pipeline/style-context.ts
|
|
2981
|
+
/** 先确定同一输出的完整级联,再从原始声明生成兼容 CSS。 */
|
|
2982
|
+
async function mergeGeneratorResultsForOutput(results, options) {
|
|
2983
|
+
const merged = mergeGeneratorResults(results);
|
|
2984
|
+
if (!merged || results.length < 2 || merged.target === "tailwind" || !require_generator.hasCssCalcVariables(options)) return merged;
|
|
2985
|
+
const css = await require_generator.transformTailwindV4CssByTarget(merged.rawCss, merged.target, {
|
|
2986
|
+
...options,
|
|
2987
|
+
customPropertyContextCss: [options.customPropertyContextCss, merged.customPropertyContextCss].filter(Boolean).join("\n")
|
|
2988
|
+
});
|
|
2989
|
+
return {
|
|
2990
|
+
...merged,
|
|
2991
|
+
css,
|
|
2992
|
+
incrementalCss: void 0,
|
|
2993
|
+
incrementalRawCss: void 0
|
|
2994
|
+
};
|
|
2995
|
+
}
|
|
2996
|
+
//#endregion
|
|
2976
2997
|
//#region src/generation/pipeline/execution.ts
|
|
2977
2998
|
async function executeGeneratorPipeline(context) {
|
|
2978
2999
|
return require_compiler.runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, require_compiler.getCompilationSessionPool(context.runtimeState), require_compiler.getTailwindGenerationSessionPool(context.runtimeState)));
|
|
@@ -2982,6 +3003,12 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
2982
3003
|
await runtimeState.readyPromise;
|
|
2983
3004
|
const compilerSession = options.compilation?.enabled ? require_compiler.getFrameworkCompilerSession(runtimeState, opts) : void 0;
|
|
2984
3005
|
const { isolateCurrentCssCandidates, runtimeWithCurrentCss, generatorSourceRecords, generatorStyleOptions, configuredContainerCompat, sourceConcurrency, preparedGenerationInputs } = await prepareGeneratorInputs(context);
|
|
3006
|
+
if (require_generator.hasCssCalcVariables(generatorStyleOptions)) generatorStyleOptions.customPropertyContextCss = [
|
|
3007
|
+
generatorStyleOptions.customPropertyContextCss,
|
|
3008
|
+
context.generatedUserCssRawSource,
|
|
3009
|
+
options.frameworkProcessedUserCss,
|
|
3010
|
+
...preparedGenerationInputs.map((input) => input.generatorSource.css)
|
|
3011
|
+
].filter(Boolean).join("\n");
|
|
2985
3012
|
const generatePreparedInputs = async (candidateSets) => {
|
|
2986
3013
|
return runWithConcurrency(preparedGenerationInputs.map((input) => async () => {
|
|
2987
3014
|
const projectedCandidates = candidateSets?.get(input.sourceId);
|
|
@@ -3027,7 +3054,7 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3027
3054
|
if (compilerSession && options.compilation?.changes) compilerSession.invalidate(options.compilation.changes.map((change) => change.id));
|
|
3028
3055
|
await compilerSession?.syncScope(options.compilation?.scope.id ?? options.outputFile ?? file, preparedGenerationInputs.map((input) => input.sourceId));
|
|
3029
3056
|
const results = await generatePreparedInputs(compilation.candidatesBySource);
|
|
3030
|
-
const merged =
|
|
3057
|
+
const merged = await mergeGeneratorResultsForOutput(results.map((result) => result.generated), generatorStyleOptions);
|
|
3031
3058
|
return merged ? {
|
|
3032
3059
|
classSet: merged.classSet,
|
|
3033
3060
|
dependenciesBySource: results.map((result) => [result.sourceId, resolveCompilationDependencies(result.generated.dependencies)]),
|
|
@@ -3048,8 +3075,9 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3048
3075
|
snapshot: execution.value.snapshot
|
|
3049
3076
|
};
|
|
3050
3077
|
compilationRevision = execution.compilation.revision;
|
|
3051
|
-
} else generated =
|
|
3078
|
+
} else generated = await mergeGeneratorResultsForOutput((await generatePreparedInputs()).map((result) => result.generated), generatorStyleOptions);
|
|
3052
3079
|
if (!generated) return;
|
|
3080
|
+
if (generated.customPropertyContextCss) generatorStyleOptions.customPropertyContextCss = generated.customPropertyContextCss;
|
|
3053
3081
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
3054
3082
|
const hasMatchedCssSourceFile = generatorSourceRecords.some((record) => record.metadata.matchedCssSourceFile);
|
|
3055
3083
|
const hasExplicitCssSource = generatorSourceRecords.some(({ metadata }) => {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { GeneratorResult } from '../generation-helpers/results.js';
|
|
3
|
+
export declare function mergeGeneratorResultsForOutput(results: GeneratorResult[], options: Partial<IStyleHandlerOptions>): Promise<GeneratorResult | undefined>;
|