weapp-tailwindcss 5.0.0-next.31 → 5.0.0-next.33
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/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/{bundle-state-Ct_8GcSR.js → bundle-state-Co_ksa-C.js} +3 -3
- package/dist/{bundle-state-Bi-cQua6.mjs → bundle-state-DUIidcox.mjs} +2 -2
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +1 -0
- package/dist/cli.js +3 -6
- package/dist/cli.mjs +4 -7
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +2 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{generator-CrU-Ghc1.js → generator-BEXaaUzP.js} +1 -1
- package/dist/{generator-Qw-tZ0Z2.mjs → generator-CpsHA4Wd.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +7 -7
- package/dist/gulp.mjs +6 -6
- package/dist/{incremental-runtime-class-set-FAOHZmzh.js → incremental-runtime-class-set-BE8RVbuz.js} +71 -9
- package/dist/{incremental-runtime-class-set-Boqi1QlB.mjs → incremental-runtime-class-set-BXYUYjCd.mjs} +70 -8
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-C6zOQqlL.mjs → postcss-BvkdIZr8.mjs} +3 -3
- package/dist/{postcss-DAWf9D3C.js → postcss-DN7IQzYb.js} +4 -4
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-D7gJSmJz.js → precheck-D_KT1pis.js} +8 -10
- package/dist/{precheck-D7K12zeX.mjs → precheck-mM9IVd1f.mjs} +8 -10
- package/dist/presets.js +4 -4
- package/dist/presets.mjs +3 -3
- package/dist/{source-candidates-DNM8iwXW.js → source-candidates-7Q-kTOSb.js} +1 -1
- package/dist/{source-candidates-CX2ozpKM.mjs → source-candidates-_x8bq0Mz.mjs} +1 -1
- package/dist/{tailwindcss-B-e2RiXr.js → tailwindcss-Cl7hUlYV.js} +3 -3
- package/dist/{tailwindcss-C7dJHZ0G.mjs → tailwindcss-udhXxMX9.mjs} +2 -2
- package/dist/{v3-engine-DcvCCHfs.mjs → v3-engine-C_KeUQG3.mjs} +6 -6
- package/dist/{v3-engine-CHItlVq5.js → v3-engine-DwY4Fixu.js} +7 -7
- package/dist/{vite-BgTPSkQS.js → vite-BVbIr2vs.js} +105 -44
- package/dist/{vite-fFRpSvyz.mjs → vite-C8vSTuBQ.mjs} +104 -43
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +127 -7
- package/dist/{webpack-BXSWVdXh.js → webpack-DlHo84RT.js} +8 -8
- package/dist/{webpack-Dx2AZpGU.mjs → webpack-dva53gYi.mjs} +7 -7
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +5 -5
- package/dist/auto-TH1jG2UW.js +0 -115
- package/dist/auto-XyKTOP7B.mjs +0 -78
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_auto = require("./auto-
|
|
2
|
+
const require_auto = require("./auto-dPpsm6FB.js");
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
node_fs = require_chunk.__toESM(node_fs);
|
|
5
5
|
let node_module = require("node:module");
|
|
6
6
|
let postcss = require("postcss");
|
|
7
7
|
postcss = require_chunk.__toESM(postcss);
|
|
8
|
-
let node_path = require("node:path");
|
|
9
|
-
node_path = require_chunk.__toESM(node_path);
|
|
10
8
|
let node_process = require("node:process");
|
|
11
9
|
node_process = require_chunk.__toESM(node_process);
|
|
10
|
+
let node_path = require("node:path");
|
|
11
|
+
node_path = require_chunk.__toESM(node_path);
|
|
12
12
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
13
13
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
14
14
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
@@ -755,7 +755,7 @@ function normalizeTailwindV4GeneratedUrlValues(css) {
|
|
|
755
755
|
});
|
|
756
756
|
}
|
|
757
757
|
async function transformTailwindV4CssToWeapp(css, options) {
|
|
758
|
-
const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
|
|
758
|
+
const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(require_auto.hasCssMacroStyleOptions(options) ? await require_auto.transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
|
|
759
759
|
const result = await defaultStyleHandler$1(protectedCss.css, {
|
|
760
760
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
761
761
|
cssRemoveHoverPseudoClass: true,
|
|
@@ -768,7 +768,7 @@ async function transformTailwindV4CssToWeapp(css, options) {
|
|
|
768
768
|
}
|
|
769
769
|
async function transformTailwindV4CssByTarget(css, target, options) {
|
|
770
770
|
if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
|
|
771
|
-
return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css) : css;
|
|
771
|
+
return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css, options) : css;
|
|
772
772
|
}
|
|
773
773
|
//#endregion
|
|
774
774
|
//#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
|
|
@@ -2832,7 +2832,7 @@ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
|
|
|
2832
2832
|
}
|
|
2833
2833
|
}
|
|
2834
2834
|
async function transformTailwindV3CssToWeapp(css, options) {
|
|
2835
|
-
const result = await defaultStyleHandler(css, {
|
|
2835
|
+
const result = await defaultStyleHandler(require_auto.hasCssMacroStyleOptions(options) ? await require_auto.transformCssMacroCss(css, options) : css, {
|
|
2836
2836
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
2837
2837
|
cssRemoveHoverPseudoClass: true,
|
|
2838
2838
|
isMainChunk: true,
|
|
@@ -2847,7 +2847,7 @@ async function transformTailwindV3CssToWeapp(css, options) {
|
|
|
2847
2847
|
}
|
|
2848
2848
|
async function transformTailwindV3CssByTarget(css, target, options) {
|
|
2849
2849
|
if (target === "weapp") return transformTailwindV3CssToWeapp(css, options);
|
|
2850
|
-
return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css) : css;
|
|
2850
|
+
return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css, options) : css;
|
|
2851
2851
|
}
|
|
2852
2852
|
//#endregion
|
|
2853
2853
|
//#region src/tailwindcss/v3-engine/generator.ts
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
|
|
3
|
+
const require_generator = require("./generator-BEXaaUzP.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-BE8RVbuz.js");
|
|
5
|
+
const require_precheck = require("./precheck-D_KT1pis.js");
|
|
6
6
|
const require_utils = require("./utils-D7Ygohep.js");
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_source_candidates = require("./source-candidates-
|
|
9
|
-
const require_bundle_state = require("./bundle-state-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-Cl7hUlYV.js");
|
|
8
|
+
const require_source_candidates = require("./source-candidates-7Q-kTOSb.js");
|
|
9
|
+
const require_bundle_state = require("./bundle-state-Co_ksa-C.js");
|
|
10
10
|
require("./logger-TlKT3xmR.js");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
node_fs = require_chunk.__toESM(node_fs);
|
|
13
13
|
let postcss = require("postcss");
|
|
14
14
|
postcss = require_chunk.__toESM(postcss);
|
|
15
|
-
let node_path = require("node:path");
|
|
16
|
-
node_path = require_chunk.__toESM(node_path);
|
|
17
15
|
let node_process = require("node:process");
|
|
18
16
|
node_process = require_chunk.__toESM(node_process);
|
|
17
|
+
let node_path = require("node:path");
|
|
18
|
+
node_path = require_chunk.__toESM(node_path);
|
|
19
19
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
20
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
20
21
|
let node_fs_promises = require("node:fs/promises");
|
|
21
22
|
let magic_string = require("magic-string");
|
|
22
23
|
magic_string = require_chunk.__toESM(magic_string);
|
|
23
|
-
let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
|
|
24
24
|
let _weapp_tailwindcss_postcss_html_transform = require("@weapp-tailwindcss/postcss/html-transform");
|
|
25
25
|
_weapp_tailwindcss_postcss_html_transform = require_chunk.__toESM(_weapp_tailwindcss_postcss_html_transform);
|
|
26
26
|
let comment_json = require("comment-json");
|
|
@@ -21916,14 +21916,11 @@ function createStableHash(input) {
|
|
|
21916
21916
|
return (hash >>> 0).toString(36);
|
|
21917
21917
|
}
|
|
21918
21918
|
function extractLiteralValue(path) {
|
|
21919
|
-
const allowDoubleQuotes = path.isTemplateElement();
|
|
21920
21919
|
if (path.isStringLiteral()) return {
|
|
21921
|
-
allowDoubleQuotes,
|
|
21922
21920
|
literal: path.node.value,
|
|
21923
21921
|
offset: 1
|
|
21924
21922
|
};
|
|
21925
21923
|
return {
|
|
21926
|
-
allowDoubleQuotes,
|
|
21927
21924
|
literal: typeof path.node.value === "string" ? path.node.value : path.node.value.raw,
|
|
21928
21925
|
offset: 0
|
|
21929
21926
|
};
|
|
@@ -21955,7 +21952,7 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
21955
21952
|
return alias;
|
|
21956
21953
|
}
|
|
21957
21954
|
rewriteLiteral(literal, shouldInclude) {
|
|
21958
|
-
const candidates = (0,
|
|
21955
|
+
const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
|
|
21959
21956
|
if (candidates.length === 0) return literal;
|
|
21960
21957
|
let rewritten = literal;
|
|
21961
21958
|
for (const candidate of candidates) {
|
|
@@ -21975,8 +21972,8 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
21975
21972
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
21976
21973
|
}), {}, void 0, false);
|
|
21977
21974
|
for (const path of analysis.targetPaths) {
|
|
21978
|
-
const { literal
|
|
21979
|
-
const candidates = (0,
|
|
21975
|
+
const { literal } = extractLiteralValue(path);
|
|
21976
|
+
const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
|
|
21980
21977
|
const classContext = options.wrapExpression || require_precheck.isClassContextLiteralPath(path);
|
|
21981
21978
|
for (const candidate of candidates) {
|
|
21982
21979
|
if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) continue;
|
|
@@ -21996,8 +21993,8 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
21996
21993
|
if (analysis.targetPaths.length === 0) return rawSource;
|
|
21997
21994
|
const updater = new require_precheck.JsTokenUpdater();
|
|
21998
21995
|
for (const path of analysis.targetPaths) {
|
|
21999
|
-
const { literal,
|
|
22000
|
-
const candidates = (0,
|
|
21996
|
+
const { literal, offset } = extractLiteralValue(path);
|
|
21997
|
+
const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
|
|
22001
21998
|
if (candidates.length === 0) continue;
|
|
22002
21999
|
let rewritten = literal;
|
|
22003
22000
|
let mutated = false;
|
|
@@ -22552,19 +22549,60 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
22552
22549
|
//#region src/bundlers/vite/generate-bundle/candidates.ts
|
|
22553
22550
|
const MUSTACHE_EXPRESSION_RE = /\{\{[\s\S]*?\}\}/g;
|
|
22554
22551
|
const QUOTED_LITERAL_RE = /'([^']*)'|"([^"]*)"|`([^`]*)`/g;
|
|
22552
|
+
const CLASS_ATTRIBUTE_RE = /\bclass\s*=\s*/g;
|
|
22553
|
+
const MUSTACHE_OPEN = "{{";
|
|
22554
|
+
const MUSTACHE_CLOSE = "}}";
|
|
22555
|
+
function isUrlLikeCandidate(candidate) {
|
|
22556
|
+
return candidate.startsWith("//") || candidate.startsWith("http://") || candidate.startsWith("https://");
|
|
22557
|
+
}
|
|
22555
22558
|
function isArbitraryValueCandidate(candidate) {
|
|
22556
|
-
return candidate.includes("[") && candidate.includes("]");
|
|
22559
|
+
return candidate.includes("[") && candidate.includes("]") && !isUrlLikeCandidate(candidate.trim());
|
|
22560
|
+
}
|
|
22561
|
+
function collectClassAttributeValues(source) {
|
|
22562
|
+
const values = [];
|
|
22563
|
+
CLASS_ATTRIBUTE_RE.lastIndex = 0;
|
|
22564
|
+
let matched = CLASS_ATTRIBUTE_RE.exec(source);
|
|
22565
|
+
while (matched !== null) {
|
|
22566
|
+
const quoteIndex = CLASS_ATTRIBUTE_RE.lastIndex;
|
|
22567
|
+
const quote = source[quoteIndex];
|
|
22568
|
+
if (quote !== "\"" && quote !== "'") {
|
|
22569
|
+
matched = CLASS_ATTRIBUTE_RE.exec(source);
|
|
22570
|
+
continue;
|
|
22571
|
+
}
|
|
22572
|
+
let expressionDepth = 0;
|
|
22573
|
+
for (let index = quoteIndex + 1; index < source.length; index++) {
|
|
22574
|
+
if (source.startsWith(MUSTACHE_OPEN, index)) {
|
|
22575
|
+
expressionDepth++;
|
|
22576
|
+
index += 1;
|
|
22577
|
+
continue;
|
|
22578
|
+
}
|
|
22579
|
+
if (expressionDepth > 0 && source.startsWith(MUSTACHE_CLOSE, index)) {
|
|
22580
|
+
expressionDepth--;
|
|
22581
|
+
index += 1;
|
|
22582
|
+
continue;
|
|
22583
|
+
}
|
|
22584
|
+
if (expressionDepth === 0 && source[index] === quote) {
|
|
22585
|
+
values.push(source.slice(quoteIndex + 1, index));
|
|
22586
|
+
CLASS_ATTRIBUTE_RE.lastIndex = index + 1;
|
|
22587
|
+
break;
|
|
22588
|
+
}
|
|
22589
|
+
}
|
|
22590
|
+
matched = CLASS_ATTRIBUTE_RE.exec(source);
|
|
22591
|
+
}
|
|
22592
|
+
return values;
|
|
22557
22593
|
}
|
|
22558
|
-
function collectUnescapedDynamicCandidates(source) {
|
|
22594
|
+
function collectUnescapedDynamicCandidates(source, allowedCandidates) {
|
|
22559
22595
|
const matches = /* @__PURE__ */ new Set();
|
|
22560
|
-
|
|
22596
|
+
const shouldFilterByAllowedCandidates = allowedCandidates !== void 0 && allowedCandidates.size > 0;
|
|
22597
|
+
for (const classValue of collectClassAttributeValues(source)) for (const expression of classValue.match(MUSTACHE_EXPRESSION_RE) ?? []) {
|
|
22561
22598
|
QUOTED_LITERAL_RE.lastIndex = 0;
|
|
22562
22599
|
let quoted = QUOTED_LITERAL_RE.exec(expression);
|
|
22563
22600
|
while (quoted !== null) {
|
|
22564
22601
|
const literal = quoted[1] ?? quoted[2] ?? quoted[3] ?? "";
|
|
22565
|
-
for (const candidate of (0,
|
|
22602
|
+
for (const candidate of (0, tailwindcss_patch.splitCandidateTokens)(literal)) {
|
|
22566
22603
|
const normalized = candidate.trim();
|
|
22567
22604
|
if (!normalized || !isArbitraryValueCandidate(normalized)) continue;
|
|
22605
|
+
if (shouldFilterByAllowedCandidates && !allowedCandidates.has(normalized)) continue;
|
|
22568
22606
|
matches.add(normalized);
|
|
22569
22607
|
}
|
|
22570
22608
|
quoted = QUOTED_LITERAL_RE.exec(expression);
|
|
@@ -22942,6 +22980,7 @@ function createGenerateBundleHook(context) {
|
|
|
22942
22980
|
const hasRuntimeAffectingChanges = hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
22943
22981
|
const useV3OxideSourceRuntime = runtimeState.twPatcher.majorVersion === 3 && sourceCandidates.size > 0 && hasCssAssetEntry && !forceRuntimeRefreshByEnv && !disableV3OxideSourceRuntime;
|
|
22944
22982
|
const runtimeStart = performance.now();
|
|
22983
|
+
const transformBaseRuntime = useV3OxideSourceRuntime ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv, { transformOnly: true }) : void 0;
|
|
22945
22984
|
const runtime = isWebGeneratorTarget && !shouldGenerateWebCssByGenerator ? /* @__PURE__ */ new Set() : useV3OxideSourceRuntime ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv, {
|
|
22946
22985
|
allowBaselineOnlyInitialSync: true,
|
|
22947
22986
|
baseClassSet: sourceCandidates
|
|
@@ -22950,8 +22989,8 @@ function createGenerateBundleHook(context) {
|
|
|
22950
22989
|
const shouldFilterTailwindV4MiniProgramCandidates = runtimeState.twPatcher.majorVersion === 4 && generatorOptions.target === "weapp";
|
|
22951
22990
|
const collectedGeneratorCandidates = new Set([...runtime, ...sourceCandidates]);
|
|
22952
22991
|
let generatorRuntime = collectLegacyContainerCompatCandidates(sourceCandidates, shouldFilterTailwindV4MiniProgramCandidates ? require_v3_engine.filterUnsupportedMiniProgramTailwindV4Candidates(collectedGeneratorCandidates) : collectedGeneratorCandidates);
|
|
22953
|
-
let transformRuntime = runtime;
|
|
22954
|
-
if (runtimeState.twPatcher.majorVersion === 3 && generatorRuntime.size > 0
|
|
22992
|
+
let transformRuntime = transformBaseRuntime ?? runtime;
|
|
22993
|
+
if (runtimeState.twPatcher.majorVersion === 3 && generatorRuntime.size > 0) {
|
|
22955
22994
|
const cssEntries = snapshot.entries.filter((entry) => entry.type === "css" && entry.output.type === "asset");
|
|
22956
22995
|
const mainCssEntry = cssEntries.find((entry) => getCssHandlerOptions(entry.file).isMainChunk) ?? cssEntries[0];
|
|
22957
22996
|
if (mainCssEntry) {
|
|
@@ -22979,6 +23018,11 @@ function createGenerateBundleHook(context) {
|
|
|
22979
23018
|
const generatorCandidatesChanged = state.generatorCandidateSignature !== generatorCandidateSignature;
|
|
22980
23019
|
const runtimeLinkedCssFiles = collectRuntimeLinkedCssFiles(snapshot);
|
|
22981
23020
|
recordGeneratorCandidates?.(generatorRuntime);
|
|
23021
|
+
const dynamicRetryCandidates = new Set([
|
|
23022
|
+
...sourceCandidates,
|
|
23023
|
+
...generatorRuntime,
|
|
23024
|
+
...transformRuntime
|
|
23025
|
+
]);
|
|
22982
23026
|
const defaultTemplateHandlerOptions = { runtimeSet: transformRuntime };
|
|
22983
23027
|
metrics.runtimeSet = measureElapsed(runtimeStart);
|
|
22984
23028
|
timingDetails["runtime"] = metrics.runtimeSet;
|
|
@@ -23025,11 +23069,18 @@ function createGenerateBundleHook(context) {
|
|
|
23025
23069
|
const start = performance.now();
|
|
23026
23070
|
let transformed = await templateHandler(rawSource, defaultTemplateHandlerOptions);
|
|
23027
23071
|
let unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed);
|
|
23072
|
+
let retryRuntimeSet;
|
|
23028
23073
|
if (unresolvedDynamicCandidates.length > 0) {
|
|
23029
|
-
|
|
23030
|
-
|
|
23031
|
-
|
|
23032
|
-
|
|
23074
|
+
const fullRuntimeSet = await context.ensureRuntimeClassSet(true);
|
|
23075
|
+
const allowedRetryCandidates = fullRuntimeSet.size === 0 ? unresolvedDynamicCandidates : unresolvedDynamicCandidates.filter((candidate) => dynamicRetryCandidates.has(candidate) || fullRuntimeSet.has(candidate));
|
|
23076
|
+
retryRuntimeSet = new Set([...fullRuntimeSet, ...allowedRetryCandidates]);
|
|
23077
|
+
unresolvedDynamicCandidates = unresolvedDynamicCandidates.filter((candidate) => retryRuntimeSet.has(candidate));
|
|
23078
|
+
}
|
|
23079
|
+
if (retryRuntimeSet && unresolvedDynamicCandidates.length > 0) {
|
|
23080
|
+
_weapp_tailwindcss_logger.logger.warn("检测到已提取 WXML 动态类名未完成转译,已回退到完整 runtimeSet 重试: %s -> %O", file, unresolvedDynamicCandidates);
|
|
23081
|
+
transformed = await templateHandler(rawSource, { runtimeSet: retryRuntimeSet });
|
|
23082
|
+
unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed, retryRuntimeSet);
|
|
23083
|
+
if (unresolvedDynamicCandidates.length > 0) _weapp_tailwindcss_logger.logger.warn("已提取 WXML 动态类名在完整 runtimeSet 重试后仍未完成转译: %s -> %O", file, unresolvedDynamicCandidates);
|
|
23033
23084
|
}
|
|
23034
23085
|
metrics.html.elapsed += measureElapsed(start);
|
|
23035
23086
|
metrics.html.transformed++;
|
|
@@ -23579,6 +23630,7 @@ function createViteRuntimeClassSet(options) {
|
|
|
23579
23630
|
refreshTailwindcssPatcher
|
|
23580
23631
|
};
|
|
23581
23632
|
const bundleRuntimeClassSetManager = require_incremental_runtime_class_set.createBundleRuntimeClassSetManager();
|
|
23633
|
+
const transformRuntimeClassSetManager = require_incremental_runtime_class_set.createBundleRuntimeClassSetManager();
|
|
23582
23634
|
let runtimeSet;
|
|
23583
23635
|
let runtimeSetPromise;
|
|
23584
23636
|
let runtimeRefreshSignature;
|
|
@@ -23646,6 +23698,7 @@ function createViteRuntimeClassSet(options) {
|
|
|
23646
23698
|
runtimeSet = void 0;
|
|
23647
23699
|
runtimeSetPromise = void 0;
|
|
23648
23700
|
await bundleRuntimeClassSetManager.reset();
|
|
23701
|
+
await transformRuntimeClassSetManager.reset();
|
|
23649
23702
|
}
|
|
23650
23703
|
if (runtimeState.twPatcher.majorVersion === 4 && !forceRuntimeRefresh) try {
|
|
23651
23704
|
const nextRuntimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, snapshot);
|
|
@@ -23655,22 +23708,30 @@ function createViteRuntimeClassSet(options) {
|
|
|
23655
23708
|
debug("incremental runtime set sync failed, fallback to full collect: %O", error);
|
|
23656
23709
|
await bundleRuntimeClassSetManager.reset();
|
|
23657
23710
|
}
|
|
23658
|
-
if (runtimeState.twPatcher.majorVersion === 3 && !forceRuntimeRefresh)
|
|
23659
|
-
|
|
23660
|
-
|
|
23661
|
-
|
|
23662
|
-
|
|
23663
|
-
|
|
23664
|
-
}
|
|
23665
|
-
|
|
23666
|
-
|
|
23667
|
-
|
|
23668
|
-
|
|
23669
|
-
|
|
23670
|
-
|
|
23671
|
-
|
|
23672
|
-
|
|
23673
|
-
|
|
23711
|
+
if (runtimeState.twPatcher.majorVersion === 3 && !forceRuntimeRefresh) {
|
|
23712
|
+
if (options.transformOnly) try {
|
|
23713
|
+
return await transformRuntimeClassSetManager.sync(runtimeState.twPatcher, snapshot);
|
|
23714
|
+
} catch (error) {
|
|
23715
|
+
debug("incremental transform runtime set sync failed, fallback to full collect: %O", error);
|
|
23716
|
+
await transformRuntimeClassSetManager.reset();
|
|
23717
|
+
}
|
|
23718
|
+
try {
|
|
23719
|
+
let baseClassSet = options.baseClassSet;
|
|
23720
|
+
if (!baseClassSet && (!runtimeSet || shouldRefreshPatcher)) baseClassSet = await require_precheck.collectRuntimeClassSet(runtimeState.twPatcher, {
|
|
23721
|
+
force: true,
|
|
23722
|
+
skipRefresh: shouldRefreshPatcher,
|
|
23723
|
+
clearCache: shouldRefreshPatcher
|
|
23724
|
+
});
|
|
23725
|
+
const nextRuntimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, snapshot, {
|
|
23726
|
+
baseClassSet: baseClassSet ?? (options.allowBaselineOnlyInitialSync === true ? runtimeSet : void 0),
|
|
23727
|
+
skipInitialFullScanWithBase: options.allowBaselineOnlyInitialSync === true && Boolean(runtimeSet)
|
|
23728
|
+
});
|
|
23729
|
+
runtimeSet = nextRuntimeSet;
|
|
23730
|
+
return nextRuntimeSet;
|
|
23731
|
+
} catch (error) {
|
|
23732
|
+
debug("incremental runtime set sync failed, fallback to full collect: %O", error);
|
|
23733
|
+
await bundleRuntimeClassSetManager.reset();
|
|
23734
|
+
}
|
|
23674
23735
|
}
|
|
23675
23736
|
if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) return runtimeSet;
|
|
23676
23737
|
const task = require_precheck.collectRuntimeClassSet(runtimeState.twPatcher, {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { C as __esmMin, S as __commonJSMin, _ as toCustomAttributesEntities, a as vitePluginName, c as createAttributeMatcher, d as _defineProperty, f as init_defineProperty, h as babelParse, l as analyzeSource, m as replaceWxml, n as getCompilerContext, p as isClassContextLiteralPath, s as generateCode, t as shouldSkipJsTransform, u as JsTokenUpdater, v as collectRuntimeClassSet, w as __require, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./precheck-
|
|
2
|
-
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-
|
|
3
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
4
|
-
import { a as validateCandidatesByGenerator, c as hasTailwindRootDirectives, d as hasTailwindGeneratedCssMarkers, i as generateCssByGenerator, l as hasTailwindSourceDirectives, n as createHmrTimingRecorder, o as mergeMarkedUserLayerComponentsCss, s as processCachedTask, t as createBundleRuntimeClassSetManager, u as normalizeTailwindSourceForGenerator } from "./incremental-runtime-class-set-
|
|
1
|
+
import { C as __esmMin, S as __commonJSMin, _ as toCustomAttributesEntities, a as vitePluginName, c as createAttributeMatcher, d as _defineProperty, f as init_defineProperty, h as babelParse, l as analyzeSource, m as replaceWxml, n as getCompilerContext, p as isClassContextLiteralPath, s as generateCode, t as shouldSkipJsTransform, u as JsTokenUpdater, v as collectRuntimeClassSet, w as __require, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./precheck-mM9IVd1f.mjs";
|
|
2
|
+
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-C_KeUQG3.mjs";
|
|
3
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-CpsHA4Wd.mjs";
|
|
4
|
+
import { a as validateCandidatesByGenerator, c as hasTailwindRootDirectives, d as hasTailwindGeneratedCssMarkers, i as generateCssByGenerator, l as hasTailwindSourceDirectives, n as createHmrTimingRecorder, o as mergeMarkedUserLayerComponentsCss, s as processCachedTask, t as createBundleRuntimeClassSetManager, u as normalizeTailwindSourceForGenerator } from "./incremental-runtime-class-set-BXYUYjCd.mjs";
|
|
5
5
|
import { o as resolveUniUtsPlatform } from "./utils-DsaS975I.mjs";
|
|
6
|
-
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
7
|
-
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-
|
|
8
|
-
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-
|
|
6
|
+
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-udhXxMX9.mjs";
|
|
7
|
+
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-_x8bq0Mz.mjs";
|
|
8
|
+
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-DUIidcox.mjs";
|
|
9
9
|
import { t as logger$1 } from "./logger-BNzxZbZj.mjs";
|
|
10
10
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
11
11
|
import postcss from "postcss";
|
|
12
|
-
import path from "node:path";
|
|
13
12
|
import process$1 from "node:process";
|
|
13
|
+
import path from "node:path";
|
|
14
14
|
import { logger } from "@weapp-tailwindcss/logger";
|
|
15
|
+
import { splitCandidateTokens } from "tailwindcss-patch";
|
|
15
16
|
import { readFile } from "node:fs/promises";
|
|
16
17
|
import MagicString from "magic-string";
|
|
17
|
-
import { splitCode } from "@weapp-tailwindcss/shared/extractors";
|
|
18
18
|
import postcssHtmlTransform from "@weapp-tailwindcss/postcss/html-transform";
|
|
19
19
|
import { parse } from "comment-json";
|
|
20
20
|
import postcssrc from "postcss-load-config";
|
|
@@ -21907,14 +21907,11 @@ function createStableHash(input) {
|
|
|
21907
21907
|
return (hash >>> 0).toString(36);
|
|
21908
21908
|
}
|
|
21909
21909
|
function extractLiteralValue(path) {
|
|
21910
|
-
const allowDoubleQuotes = path.isTemplateElement();
|
|
21911
21910
|
if (path.isStringLiteral()) return {
|
|
21912
|
-
allowDoubleQuotes,
|
|
21913
21911
|
literal: path.node.value,
|
|
21914
21912
|
offset: 1
|
|
21915
21913
|
};
|
|
21916
21914
|
return {
|
|
21917
|
-
allowDoubleQuotes,
|
|
21918
21915
|
literal: typeof path.node.value === "string" ? path.node.value : path.node.value.raw,
|
|
21919
21916
|
offset: 0
|
|
21920
21917
|
};
|
|
@@ -21946,7 +21943,7 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
21946
21943
|
return alias;
|
|
21947
21944
|
}
|
|
21948
21945
|
rewriteLiteral(literal, shouldInclude) {
|
|
21949
|
-
const candidates =
|
|
21946
|
+
const candidates = splitCandidateTokens(literal);
|
|
21950
21947
|
if (candidates.length === 0) return literal;
|
|
21951
21948
|
let rewritten = literal;
|
|
21952
21949
|
for (const candidate of candidates) {
|
|
@@ -21966,8 +21963,8 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
21966
21963
|
sourceType: options.wrapExpression ? "module" : "unambiguous"
|
|
21967
21964
|
}), {}, void 0, false);
|
|
21968
21965
|
for (const path of analysis.targetPaths) {
|
|
21969
|
-
const { literal
|
|
21970
|
-
const candidates =
|
|
21966
|
+
const { literal } = extractLiteralValue(path);
|
|
21967
|
+
const candidates = splitCandidateTokens(literal);
|
|
21971
21968
|
const classContext = options.wrapExpression || isClassContextLiteralPath(path);
|
|
21972
21969
|
for (const candidate of candidates) {
|
|
21973
21970
|
if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) continue;
|
|
@@ -21987,8 +21984,8 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
21987
21984
|
if (analysis.targetPaths.length === 0) return rawSource;
|
|
21988
21985
|
const updater = new JsTokenUpdater();
|
|
21989
21986
|
for (const path of analysis.targetPaths) {
|
|
21990
|
-
const { literal,
|
|
21991
|
-
const candidates =
|
|
21987
|
+
const { literal, offset } = extractLiteralValue(path);
|
|
21988
|
+
const candidates = splitCandidateTokens(literal);
|
|
21992
21989
|
if (candidates.length === 0) continue;
|
|
21993
21990
|
let rewritten = literal;
|
|
21994
21991
|
let mutated = false;
|
|
@@ -22543,19 +22540,60 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
22543
22540
|
//#region src/bundlers/vite/generate-bundle/candidates.ts
|
|
22544
22541
|
const MUSTACHE_EXPRESSION_RE = /\{\{[\s\S]*?\}\}/g;
|
|
22545
22542
|
const QUOTED_LITERAL_RE = /'([^']*)'|"([^"]*)"|`([^`]*)`/g;
|
|
22543
|
+
const CLASS_ATTRIBUTE_RE = /\bclass\s*=\s*/g;
|
|
22544
|
+
const MUSTACHE_OPEN = "{{";
|
|
22545
|
+
const MUSTACHE_CLOSE = "}}";
|
|
22546
|
+
function isUrlLikeCandidate(candidate) {
|
|
22547
|
+
return candidate.startsWith("//") || candidate.startsWith("http://") || candidate.startsWith("https://");
|
|
22548
|
+
}
|
|
22546
22549
|
function isArbitraryValueCandidate(candidate) {
|
|
22547
|
-
return candidate.includes("[") && candidate.includes("]");
|
|
22550
|
+
return candidate.includes("[") && candidate.includes("]") && !isUrlLikeCandidate(candidate.trim());
|
|
22551
|
+
}
|
|
22552
|
+
function collectClassAttributeValues(source) {
|
|
22553
|
+
const values = [];
|
|
22554
|
+
CLASS_ATTRIBUTE_RE.lastIndex = 0;
|
|
22555
|
+
let matched = CLASS_ATTRIBUTE_RE.exec(source);
|
|
22556
|
+
while (matched !== null) {
|
|
22557
|
+
const quoteIndex = CLASS_ATTRIBUTE_RE.lastIndex;
|
|
22558
|
+
const quote = source[quoteIndex];
|
|
22559
|
+
if (quote !== "\"" && quote !== "'") {
|
|
22560
|
+
matched = CLASS_ATTRIBUTE_RE.exec(source);
|
|
22561
|
+
continue;
|
|
22562
|
+
}
|
|
22563
|
+
let expressionDepth = 0;
|
|
22564
|
+
for (let index = quoteIndex + 1; index < source.length; index++) {
|
|
22565
|
+
if (source.startsWith(MUSTACHE_OPEN, index)) {
|
|
22566
|
+
expressionDepth++;
|
|
22567
|
+
index += 1;
|
|
22568
|
+
continue;
|
|
22569
|
+
}
|
|
22570
|
+
if (expressionDepth > 0 && source.startsWith(MUSTACHE_CLOSE, index)) {
|
|
22571
|
+
expressionDepth--;
|
|
22572
|
+
index += 1;
|
|
22573
|
+
continue;
|
|
22574
|
+
}
|
|
22575
|
+
if (expressionDepth === 0 && source[index] === quote) {
|
|
22576
|
+
values.push(source.slice(quoteIndex + 1, index));
|
|
22577
|
+
CLASS_ATTRIBUTE_RE.lastIndex = index + 1;
|
|
22578
|
+
break;
|
|
22579
|
+
}
|
|
22580
|
+
}
|
|
22581
|
+
matched = CLASS_ATTRIBUTE_RE.exec(source);
|
|
22582
|
+
}
|
|
22583
|
+
return values;
|
|
22548
22584
|
}
|
|
22549
|
-
function collectUnescapedDynamicCandidates(source) {
|
|
22585
|
+
function collectUnescapedDynamicCandidates(source, allowedCandidates) {
|
|
22550
22586
|
const matches = /* @__PURE__ */ new Set();
|
|
22551
|
-
|
|
22587
|
+
const shouldFilterByAllowedCandidates = allowedCandidates !== void 0 && allowedCandidates.size > 0;
|
|
22588
|
+
for (const classValue of collectClassAttributeValues(source)) for (const expression of classValue.match(MUSTACHE_EXPRESSION_RE) ?? []) {
|
|
22552
22589
|
QUOTED_LITERAL_RE.lastIndex = 0;
|
|
22553
22590
|
let quoted = QUOTED_LITERAL_RE.exec(expression);
|
|
22554
22591
|
while (quoted !== null) {
|
|
22555
22592
|
const literal = quoted[1] ?? quoted[2] ?? quoted[3] ?? "";
|
|
22556
|
-
for (const candidate of
|
|
22593
|
+
for (const candidate of splitCandidateTokens(literal)) {
|
|
22557
22594
|
const normalized = candidate.trim();
|
|
22558
22595
|
if (!normalized || !isArbitraryValueCandidate(normalized)) continue;
|
|
22596
|
+
if (shouldFilterByAllowedCandidates && !allowedCandidates.has(normalized)) continue;
|
|
22559
22597
|
matches.add(normalized);
|
|
22560
22598
|
}
|
|
22561
22599
|
quoted = QUOTED_LITERAL_RE.exec(expression);
|
|
@@ -22933,6 +22971,7 @@ function createGenerateBundleHook(context) {
|
|
|
22933
22971
|
const hasRuntimeAffectingChanges = hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
22934
22972
|
const useV3OxideSourceRuntime = runtimeState.twPatcher.majorVersion === 3 && sourceCandidates.size > 0 && hasCssAssetEntry && !forceRuntimeRefreshByEnv && !disableV3OxideSourceRuntime;
|
|
22935
22973
|
const runtimeStart = performance.now();
|
|
22974
|
+
const transformBaseRuntime = useV3OxideSourceRuntime ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv, { transformOnly: true }) : void 0;
|
|
22936
22975
|
const runtime = isWebGeneratorTarget && !shouldGenerateWebCssByGenerator ? /* @__PURE__ */ new Set() : useV3OxideSourceRuntime ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv, {
|
|
22937
22976
|
allowBaselineOnlyInitialSync: true,
|
|
22938
22977
|
baseClassSet: sourceCandidates
|
|
@@ -22941,8 +22980,8 @@ function createGenerateBundleHook(context) {
|
|
|
22941
22980
|
const shouldFilterTailwindV4MiniProgramCandidates = runtimeState.twPatcher.majorVersion === 4 && generatorOptions.target === "weapp";
|
|
22942
22981
|
const collectedGeneratorCandidates = new Set([...runtime, ...sourceCandidates]);
|
|
22943
22982
|
let generatorRuntime = collectLegacyContainerCompatCandidates(sourceCandidates, shouldFilterTailwindV4MiniProgramCandidates ? filterUnsupportedMiniProgramTailwindV4Candidates(collectedGeneratorCandidates) : collectedGeneratorCandidates);
|
|
22944
|
-
let transformRuntime = runtime;
|
|
22945
|
-
if (runtimeState.twPatcher.majorVersion === 3 && generatorRuntime.size > 0
|
|
22983
|
+
let transformRuntime = transformBaseRuntime ?? runtime;
|
|
22984
|
+
if (runtimeState.twPatcher.majorVersion === 3 && generatorRuntime.size > 0) {
|
|
22946
22985
|
const cssEntries = snapshot.entries.filter((entry) => entry.type === "css" && entry.output.type === "asset");
|
|
22947
22986
|
const mainCssEntry = cssEntries.find((entry) => getCssHandlerOptions(entry.file).isMainChunk) ?? cssEntries[0];
|
|
22948
22987
|
if (mainCssEntry) {
|
|
@@ -22970,6 +23009,11 @@ function createGenerateBundleHook(context) {
|
|
|
22970
23009
|
const generatorCandidatesChanged = state.generatorCandidateSignature !== generatorCandidateSignature;
|
|
22971
23010
|
const runtimeLinkedCssFiles = collectRuntimeLinkedCssFiles(snapshot);
|
|
22972
23011
|
recordGeneratorCandidates?.(generatorRuntime);
|
|
23012
|
+
const dynamicRetryCandidates = new Set([
|
|
23013
|
+
...sourceCandidates,
|
|
23014
|
+
...generatorRuntime,
|
|
23015
|
+
...transformRuntime
|
|
23016
|
+
]);
|
|
22973
23017
|
const defaultTemplateHandlerOptions = { runtimeSet: transformRuntime };
|
|
22974
23018
|
metrics.runtimeSet = measureElapsed(runtimeStart);
|
|
22975
23019
|
timingDetails["runtime"] = metrics.runtimeSet;
|
|
@@ -23016,11 +23060,18 @@ function createGenerateBundleHook(context) {
|
|
|
23016
23060
|
const start = performance.now();
|
|
23017
23061
|
let transformed = await templateHandler(rawSource, defaultTemplateHandlerOptions);
|
|
23018
23062
|
let unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed);
|
|
23063
|
+
let retryRuntimeSet;
|
|
23019
23064
|
if (unresolvedDynamicCandidates.length > 0) {
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23065
|
+
const fullRuntimeSet = await context.ensureRuntimeClassSet(true);
|
|
23066
|
+
const allowedRetryCandidates = fullRuntimeSet.size === 0 ? unresolvedDynamicCandidates : unresolvedDynamicCandidates.filter((candidate) => dynamicRetryCandidates.has(candidate) || fullRuntimeSet.has(candidate));
|
|
23067
|
+
retryRuntimeSet = new Set([...fullRuntimeSet, ...allowedRetryCandidates]);
|
|
23068
|
+
unresolvedDynamicCandidates = unresolvedDynamicCandidates.filter((candidate) => retryRuntimeSet.has(candidate));
|
|
23069
|
+
}
|
|
23070
|
+
if (retryRuntimeSet && unresolvedDynamicCandidates.length > 0) {
|
|
23071
|
+
logger.warn("检测到已提取 WXML 动态类名未完成转译,已回退到完整 runtimeSet 重试: %s -> %O", file, unresolvedDynamicCandidates);
|
|
23072
|
+
transformed = await templateHandler(rawSource, { runtimeSet: retryRuntimeSet });
|
|
23073
|
+
unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed, retryRuntimeSet);
|
|
23074
|
+
if (unresolvedDynamicCandidates.length > 0) logger.warn("已提取 WXML 动态类名在完整 runtimeSet 重试后仍未完成转译: %s -> %O", file, unresolvedDynamicCandidates);
|
|
23024
23075
|
}
|
|
23025
23076
|
metrics.html.elapsed += measureElapsed(start);
|
|
23026
23077
|
metrics.html.transformed++;
|
|
@@ -23570,6 +23621,7 @@ function createViteRuntimeClassSet(options) {
|
|
|
23570
23621
|
refreshTailwindcssPatcher
|
|
23571
23622
|
};
|
|
23572
23623
|
const bundleRuntimeClassSetManager = createBundleRuntimeClassSetManager();
|
|
23624
|
+
const transformRuntimeClassSetManager = createBundleRuntimeClassSetManager();
|
|
23573
23625
|
let runtimeSet;
|
|
23574
23626
|
let runtimeSetPromise;
|
|
23575
23627
|
let runtimeRefreshSignature;
|
|
@@ -23637,6 +23689,7 @@ function createViteRuntimeClassSet(options) {
|
|
|
23637
23689
|
runtimeSet = void 0;
|
|
23638
23690
|
runtimeSetPromise = void 0;
|
|
23639
23691
|
await bundleRuntimeClassSetManager.reset();
|
|
23692
|
+
await transformRuntimeClassSetManager.reset();
|
|
23640
23693
|
}
|
|
23641
23694
|
if (runtimeState.twPatcher.majorVersion === 4 && !forceRuntimeRefresh) try {
|
|
23642
23695
|
const nextRuntimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, snapshot);
|
|
@@ -23646,22 +23699,30 @@ function createViteRuntimeClassSet(options) {
|
|
|
23646
23699
|
debug("incremental runtime set sync failed, fallback to full collect: %O", error);
|
|
23647
23700
|
await bundleRuntimeClassSetManager.reset();
|
|
23648
23701
|
}
|
|
23649
|
-
if (runtimeState.twPatcher.majorVersion === 3 && !forceRuntimeRefresh)
|
|
23650
|
-
|
|
23651
|
-
|
|
23652
|
-
|
|
23653
|
-
|
|
23654
|
-
|
|
23655
|
-
}
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
|
|
23659
|
-
|
|
23660
|
-
|
|
23661
|
-
|
|
23662
|
-
|
|
23663
|
-
|
|
23664
|
-
|
|
23702
|
+
if (runtimeState.twPatcher.majorVersion === 3 && !forceRuntimeRefresh) {
|
|
23703
|
+
if (options.transformOnly) try {
|
|
23704
|
+
return await transformRuntimeClassSetManager.sync(runtimeState.twPatcher, snapshot);
|
|
23705
|
+
} catch (error) {
|
|
23706
|
+
debug("incremental transform runtime set sync failed, fallback to full collect: %O", error);
|
|
23707
|
+
await transformRuntimeClassSetManager.reset();
|
|
23708
|
+
}
|
|
23709
|
+
try {
|
|
23710
|
+
let baseClassSet = options.baseClassSet;
|
|
23711
|
+
if (!baseClassSet && (!runtimeSet || shouldRefreshPatcher)) baseClassSet = await collectRuntimeClassSet(runtimeState.twPatcher, {
|
|
23712
|
+
force: true,
|
|
23713
|
+
skipRefresh: shouldRefreshPatcher,
|
|
23714
|
+
clearCache: shouldRefreshPatcher
|
|
23715
|
+
});
|
|
23716
|
+
const nextRuntimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, snapshot, {
|
|
23717
|
+
baseClassSet: baseClassSet ?? (options.allowBaselineOnlyInitialSync === true ? runtimeSet : void 0),
|
|
23718
|
+
skipInitialFullScanWithBase: options.allowBaselineOnlyInitialSync === true && Boolean(runtimeSet)
|
|
23719
|
+
});
|
|
23720
|
+
runtimeSet = nextRuntimeSet;
|
|
23721
|
+
return nextRuntimeSet;
|
|
23722
|
+
} catch (error) {
|
|
23723
|
+
debug("incremental runtime set sync failed, fallback to full collect: %O", error);
|
|
23724
|
+
await bundleRuntimeClassSetManager.reset();
|
|
23725
|
+
}
|
|
23665
23726
|
}
|
|
23666
23727
|
if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) return runtimeSet;
|
|
23667
23728
|
const task = collectRuntimeClassSet(runtimeState.twPatcher, {
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-BVbIr2vs.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-C8vSTuBQ.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|