weapp-tailwindcss 5.0.0-next.32 → 5.0.0-next.35
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/{bundle-state-C4ib5xPG.js → bundle-state-8w8DM8Lw.js} +1 -1
- package/dist/{bundle-state-BIsgsoNW.mjs → bundle-state-Bsr05EFW.mjs} +1 -1
- package/dist/bundlers/shared/cache.d.ts +3 -1
- 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 +9 -10
- package/dist/cli.mjs +10 -11
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-BEXaaUzP.js → generator-BtpQoQEH.js} +1 -1
- package/dist/{generator-CpsHA4Wd.mjs → generator-CmLpVJgw.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-D2fsgk5t.mjs → incremental-runtime-class-set-W61zZU00.mjs} +72 -10
- package/dist/{incremental-runtime-class-set-CLP1Qv8F.js → incremental-runtime-class-set-vqTU-eph.js} +77 -9
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/replacement-cache.d.ts +5 -0
- package/dist/{postcss-BvkdIZr8.mjs → postcss-DGprmeke.mjs} +2 -2
- package/dist/{postcss-DN7IQzYb.js → postcss-DSvNrY0J.js} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-CQeqnfo5.js → precheck-Bp-V1T_Q.js} +12 -12
- package/dist/{precheck-nITnYBDn.mjs → precheck-nPDKYr8V.mjs} +13 -13
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{source-candidates-7Q-kTOSb.js → source-candidates-BjB4wSga.js} +1 -1
- package/dist/{source-candidates-_x8bq0Mz.mjs → source-candidates-l12JBkKU.mjs} +1 -1
- package/dist/{tailwindcss-udhXxMX9.mjs → tailwindcss-D6zEhnyE.mjs} +1 -1
- package/dist/{tailwindcss-Cl7hUlYV.js → tailwindcss-bNXguXhC.js} +1 -1
- package/dist/{v3-engine-C_KeUQG3.mjs → v3-engine-BYcGCWUY.mjs} +33 -0
- package/dist/{v3-engine-DwY4Fixu.js → v3-engine-KDOfD-6F.js} +33 -0
- package/dist/{vite-BAHjBu8j.mjs → vite-C8SUICPv.mjs} +103 -42
- package/dist/{vite-CYkkJZ3Q.js → vite-CMzi0wR2.js} +103 -42
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +33 -1
- package/dist/{webpack-CPwDaKy3.js → webpack-2v1sQKyZ.js} +65 -29
- package/dist/{webpack-xxmiRxcy.mjs → webpack-pdpdIv_X.mjs} +65 -29
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +6 -6
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
|
|
3
3
|
const require_defaults = require("./defaults-zKUH2mDe.js");
|
|
4
4
|
require("./utils-D7Ygohep.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-bNXguXhC.js");
|
|
6
6
|
let node_process = require("node:process");
|
|
7
7
|
node_process = require_chunk.__toESM(node_process);
|
|
8
8
|
let node_path = require("node:path");
|
|
9
9
|
node_path = require_chunk.__toESM(node_path);
|
|
10
10
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
11
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
11
12
|
let node_fs_promises = require("node:fs/promises");
|
|
12
13
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
13
14
|
let node_buffer = require("node:buffer");
|
|
@@ -20,7 +21,6 @@ let _babel_parser = require("@babel/parser");
|
|
|
20
21
|
let magic_string = require("magic-string");
|
|
21
22
|
magic_string = require_chunk.__toESM(magic_string);
|
|
22
23
|
let _ast_core_escape = require("@ast-core/escape");
|
|
23
|
-
let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
|
|
24
24
|
let _babel_types = require("@babel/types");
|
|
25
25
|
_babel_types = require_chunk.__toESM(_babel_types);
|
|
26
26
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
@@ -888,12 +888,9 @@ function isClassContextLiteralPath(path) {
|
|
|
888
888
|
return false;
|
|
889
889
|
}
|
|
890
890
|
//#endregion
|
|
891
|
-
//#region src/js/
|
|
892
|
-
const debug = require_v3_engine.createDebug("[js:handlers] ");
|
|
891
|
+
//#region src/js/replacement-cache.ts
|
|
893
892
|
const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
|
|
894
893
|
const defaultReplacementCache = /* @__PURE__ */ new Map();
|
|
895
|
-
const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
|
|
896
|
-
const IGNORE_MARKER = "ignore";
|
|
897
894
|
function getReplacementCacheStore(escapeMap) {
|
|
898
895
|
if (!escapeMap) return defaultReplacementCache;
|
|
899
896
|
let store = replacementCacheByEscapeMap.get(escapeMap);
|
|
@@ -911,6 +908,11 @@ function getReplacement(candidate, escapeMap, store = getReplacementCacheStore(e
|
|
|
911
908
|
}
|
|
912
909
|
return cached;
|
|
913
910
|
}
|
|
911
|
+
//#endregion
|
|
912
|
+
//#region src/js/handlers.ts
|
|
913
|
+
const debug = require_v3_engine.createDebug("[js:handlers] ");
|
|
914
|
+
const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
|
|
915
|
+
const IGNORE_MARKER = "ignore";
|
|
914
916
|
function hasIgnoreComment(node) {
|
|
915
917
|
const { leadingComments } = node;
|
|
916
918
|
if (!Array.isArray(leadingComments) || leadingComments.length === 0) return false;
|
|
@@ -920,8 +922,7 @@ function hasIgnoreComment(node) {
|
|
|
920
922
|
}
|
|
921
923
|
return false;
|
|
922
924
|
}
|
|
923
|
-
function extractLiteralValue(path, { unescapeUnicode
|
|
924
|
-
const allowDoubleQuotes = arbitraryValues?.allowDoubleQuotes;
|
|
925
|
+
function extractLiteralValue(path, { unescapeUnicode }) {
|
|
925
926
|
const { node } = path;
|
|
926
927
|
let offset = 0;
|
|
927
928
|
let original;
|
|
@@ -933,7 +934,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
|
|
|
933
934
|
let literal = original;
|
|
934
935
|
if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
|
|
935
936
|
return {
|
|
936
|
-
allowDoubleQuotes,
|
|
937
937
|
literal,
|
|
938
938
|
offset,
|
|
939
939
|
original
|
|
@@ -987,8 +987,8 @@ function replaceHandleValue(path, options) {
|
|
|
987
987
|
const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
|
|
988
988
|
if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
|
|
989
989
|
if (hasIgnoreComment(path.node)) return;
|
|
990
|
-
const { literal, original,
|
|
991
|
-
const candidates = (0,
|
|
990
|
+
const { literal, original, offset } = extractLiteralValue(path, options);
|
|
991
|
+
const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
|
|
992
992
|
if (candidates.length === 0) return;
|
|
993
993
|
const debugEnabled = debug.enabled;
|
|
994
994
|
const classContext = options.wrapExpression || isClassContextLiteralPath(path);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { B as createDebug, C as createTailwindV4Engine, K as resolveBooleanObjectOption, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, q as omitUndefined, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-
|
|
1
|
+
import { B as createDebug, C as createTailwindV4Engine$1, K as resolveBooleanObjectOption, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, q as omitUndefined, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-BYcGCWUY.mjs";
|
|
2
2
|
import { a as resolveDefaultCssPreflight, i as getDefaultOptions, o as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, s as HARD_PARSE_CACHE_MAX_ENTRIES } from "./defaults-8xrgzxFY.mjs";
|
|
3
3
|
import { i as isMap, n as defuOverrideArray } from "./utils-DsaS975I.mjs";
|
|
4
|
-
import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, t as createTailwindcssPatcherFromContext } from "./tailwindcss-
|
|
4
|
+
import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, t as createTailwindcssPatcherFromContext } from "./tailwindcss-D6zEhnyE.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { logger, pc } from "@weapp-tailwindcss/logger";
|
|
9
|
+
import { splitCandidateTokens } from "tailwindcss-patch";
|
|
9
10
|
import { rm } from "node:fs/promises";
|
|
10
11
|
import { createStyleHandler } from "@weapp-tailwindcss/postcss";
|
|
11
12
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
@@ -16,7 +17,6 @@ import _babelTraverse from "@babel/traverse";
|
|
|
16
17
|
import { parse, parseExpression } from "@babel/parser";
|
|
17
18
|
import MagicString from "magic-string";
|
|
18
19
|
import { jsStringEscape } from "@ast-core/escape";
|
|
19
|
-
import { splitCode } from "@weapp-tailwindcss/shared/extractors";
|
|
20
20
|
import * as t from "@babel/types";
|
|
21
21
|
//#region \0rolldown/runtime.js
|
|
22
22
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -207,7 +207,7 @@ function tryGetRuntimeClassSetSync(twPatcher) {
|
|
|
207
207
|
}
|
|
208
208
|
async function collectTailwindV4GeneratorClassSet(twPatcher) {
|
|
209
209
|
try {
|
|
210
|
-
const generated = await createTailwindV4Engine(await resolveTailwindV4SourceFromPatcher(twPatcher)).generate({
|
|
210
|
+
const generated = await createTailwindV4Engine$1(await resolveTailwindV4SourceFromPatcher(twPatcher)).generate({
|
|
211
211
|
scanSources: true,
|
|
212
212
|
target: "tailwind"
|
|
213
213
|
});
|
|
@@ -887,12 +887,9 @@ function isClassContextLiteralPath(path) {
|
|
|
887
887
|
return false;
|
|
888
888
|
}
|
|
889
889
|
//#endregion
|
|
890
|
-
//#region src/js/
|
|
891
|
-
const debug = createDebug("[js:handlers] ");
|
|
890
|
+
//#region src/js/replacement-cache.ts
|
|
892
891
|
const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
|
|
893
892
|
const defaultReplacementCache = /* @__PURE__ */ new Map();
|
|
894
|
-
const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
|
|
895
|
-
const IGNORE_MARKER = "ignore";
|
|
896
893
|
function getReplacementCacheStore(escapeMap) {
|
|
897
894
|
if (!escapeMap) return defaultReplacementCache;
|
|
898
895
|
let store = replacementCacheByEscapeMap.get(escapeMap);
|
|
@@ -910,6 +907,11 @@ function getReplacement(candidate, escapeMap, store = getReplacementCacheStore(e
|
|
|
910
907
|
}
|
|
911
908
|
return cached;
|
|
912
909
|
}
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/js/handlers.ts
|
|
912
|
+
const debug = createDebug("[js:handlers] ");
|
|
913
|
+
const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
|
|
914
|
+
const IGNORE_MARKER = "ignore";
|
|
913
915
|
function hasIgnoreComment(node) {
|
|
914
916
|
const { leadingComments } = node;
|
|
915
917
|
if (!Array.isArray(leadingComments) || leadingComments.length === 0) return false;
|
|
@@ -919,8 +921,7 @@ function hasIgnoreComment(node) {
|
|
|
919
921
|
}
|
|
920
922
|
return false;
|
|
921
923
|
}
|
|
922
|
-
function extractLiteralValue(path, { unescapeUnicode
|
|
923
|
-
const allowDoubleQuotes = arbitraryValues?.allowDoubleQuotes;
|
|
924
|
+
function extractLiteralValue(path, { unescapeUnicode }) {
|
|
924
925
|
const { node } = path;
|
|
925
926
|
let offset = 0;
|
|
926
927
|
let original;
|
|
@@ -932,7 +933,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
|
|
|
932
933
|
let literal = original;
|
|
933
934
|
if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
|
|
934
935
|
return {
|
|
935
|
-
allowDoubleQuotes,
|
|
936
936
|
literal,
|
|
937
937
|
offset,
|
|
938
938
|
original
|
|
@@ -986,8 +986,8 @@ function replaceHandleValue(path, options) {
|
|
|
986
986
|
const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
|
|
987
987
|
if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
|
|
988
988
|
if (hasIgnoreComment(path.node)) return;
|
|
989
|
-
const { literal, original,
|
|
990
|
-
const candidates =
|
|
989
|
+
const { literal, original, offset } = extractLiteralValue(path, options);
|
|
990
|
+
const candidates = splitCandidateTokens(literal);
|
|
991
991
|
if (candidates.length === 0) return;
|
|
992
992
|
const debugEnabled = debug.enabled;
|
|
993
993
|
const classContext = options.wrapExpression || isClassContextLiteralPath(path);
|
package/dist/presets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
|
|
4
4
|
const require_utils = require("./utils-D7Ygohep.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-bNXguXhC.js");
|
|
6
6
|
require("./logger-TlKT3xmR.js");
|
|
7
7
|
let node_process = require("node:process");
|
|
8
8
|
node_process = require_chunk.__toESM(node_process);
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { q as omitUndefined } from "./v3-engine-
|
|
1
|
+
import { q as omitUndefined } from "./v3-engine-BYcGCWUY.mjs";
|
|
2
2
|
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-DsaS975I.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-D6zEhnyE.mjs";
|
|
4
4
|
import { t as logger } from "./logger-BNzxZbZj.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import path from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-
|
|
1
|
+
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-BYcGCWUY.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { extractSourceCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-
|
|
1
|
+
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-BYcGCWUY.mjs";
|
|
2
2
|
import { n as defuOverrideArray } from "./utils-DsaS975I.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-KDOfD-6F.js");
|
|
3
3
|
require("./utils-D7Ygohep.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_module = require("node:module");
|
|
@@ -1547,6 +1547,10 @@ function applyMiniProgramTailwindV4DefaultColorCss(css) {
|
|
|
1547
1547
|
function collectCandidates$1(candidates) {
|
|
1548
1548
|
return new Set(candidates ?? []);
|
|
1549
1549
|
}
|
|
1550
|
+
function hasRemovedCandidates$1(previousCandidates, nextCandidates) {
|
|
1551
|
+
for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
|
|
1552
|
+
return false;
|
|
1553
|
+
}
|
|
1550
1554
|
function normalizeRpxTextCandidate(candidate) {
|
|
1551
1555
|
return candidate.replace(BARE_RPX_TEXT_CANDIDATE_RE, "$1text-[length:$2]$3");
|
|
1552
1556
|
}
|
|
@@ -1859,6 +1863,18 @@ function createTailwindV4Engine$1(source) {
|
|
|
1859
1863
|
});
|
|
1860
1864
|
const cached = incrementalGenerateCache$1.get(cacheKey);
|
|
1861
1865
|
if (cached) {
|
|
1866
|
+
if (hasRemovedCandidates$1(cached.seenCandidates, requestedCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1867
|
+
const generated = await generateOnce(source, options);
|
|
1868
|
+
seedIncrementalGenerateCache({
|
|
1869
|
+
compatibleSource,
|
|
1870
|
+
generated,
|
|
1871
|
+
requestedCandidates,
|
|
1872
|
+
styleOptions,
|
|
1873
|
+
tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
|
|
1874
|
+
target
|
|
1875
|
+
});
|
|
1876
|
+
return generated;
|
|
1877
|
+
});
|
|
1862
1878
|
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
1863
1879
|
if (missingCandidates.length === 0) return {
|
|
1864
1880
|
css: cached.css,
|
|
@@ -2870,6 +2886,10 @@ function createChangedContentEntries(candidates, sources) {
|
|
|
2870
2886
|
function collectCandidates(candidates) {
|
|
2871
2887
|
return new Set(candidates ?? []);
|
|
2872
2888
|
}
|
|
2889
|
+
function hasRemovedCandidates(previousCandidates, nextCandidates) {
|
|
2890
|
+
for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
|
|
2891
|
+
return false;
|
|
2892
|
+
}
|
|
2873
2893
|
function collectApplyCandidatesFromCss(css) {
|
|
2874
2894
|
if (!css.includes("@apply")) return [];
|
|
2875
2895
|
const candidates = /* @__PURE__ */ new Set();
|
|
@@ -3174,6 +3194,19 @@ function createTailwindV3Engine(source) {
|
|
|
3174
3194
|
const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions);
|
|
3175
3195
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
3176
3196
|
if (cached) {
|
|
3197
|
+
if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) {
|
|
3198
|
+
const generated = await generateOnce(source, options);
|
|
3199
|
+
incrementalGenerateCache.set(cacheKey, {
|
|
3200
|
+
context: generated.context,
|
|
3201
|
+
seenCandidates: new Set(requestedCandidates),
|
|
3202
|
+
classSet: new Set(generated.classSet),
|
|
3203
|
+
css: generated.css,
|
|
3204
|
+
rawCss: generated.rawCss,
|
|
3205
|
+
dependencies: generated.dependencies,
|
|
3206
|
+
target: generated.target
|
|
3207
|
+
});
|
|
3208
|
+
return generated;
|
|
3209
|
+
}
|
|
3177
3210
|
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
3178
3211
|
if (missingCandidates.length === 0) return {
|
|
3179
3212
|
css: cached.css,
|
|
@@ -1555,6 +1555,10 @@ function applyMiniProgramTailwindV4DefaultColorCss(css) {
|
|
|
1555
1555
|
function collectCandidates$1(candidates) {
|
|
1556
1556
|
return new Set(candidates ?? []);
|
|
1557
1557
|
}
|
|
1558
|
+
function hasRemovedCandidates$1(previousCandidates, nextCandidates) {
|
|
1559
|
+
for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
|
|
1560
|
+
return false;
|
|
1561
|
+
}
|
|
1558
1562
|
function normalizeRpxTextCandidate(candidate) {
|
|
1559
1563
|
return candidate.replace(BARE_RPX_TEXT_CANDIDATE_RE, "$1text-[length:$2]$3");
|
|
1560
1564
|
}
|
|
@@ -1867,6 +1871,18 @@ function createTailwindV4Engine(source) {
|
|
|
1867
1871
|
});
|
|
1868
1872
|
const cached = incrementalGenerateCache$1.get(cacheKey);
|
|
1869
1873
|
if (cached) {
|
|
1874
|
+
if (hasRemovedCandidates$1(cached.seenCandidates, requestedCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1875
|
+
const generated = await generateOnce(source, options);
|
|
1876
|
+
seedIncrementalGenerateCache({
|
|
1877
|
+
compatibleSource,
|
|
1878
|
+
generated,
|
|
1879
|
+
requestedCandidates,
|
|
1880
|
+
styleOptions,
|
|
1881
|
+
tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
|
|
1882
|
+
target
|
|
1883
|
+
});
|
|
1884
|
+
return generated;
|
|
1885
|
+
});
|
|
1870
1886
|
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
1871
1887
|
if (missingCandidates.length === 0) return {
|
|
1872
1888
|
css: cached.css,
|
|
@@ -2878,6 +2894,10 @@ function createChangedContentEntries(candidates, sources) {
|
|
|
2878
2894
|
function collectCandidates(candidates) {
|
|
2879
2895
|
return new Set(candidates ?? []);
|
|
2880
2896
|
}
|
|
2897
|
+
function hasRemovedCandidates(previousCandidates, nextCandidates) {
|
|
2898
|
+
for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
|
|
2899
|
+
return false;
|
|
2900
|
+
}
|
|
2881
2901
|
function collectApplyCandidatesFromCss(css) {
|
|
2882
2902
|
if (!css.includes("@apply")) return [];
|
|
2883
2903
|
const candidates = /* @__PURE__ */ new Set();
|
|
@@ -3182,6 +3202,19 @@ function createTailwindV3Engine(source) {
|
|
|
3182
3202
|
const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions);
|
|
3183
3203
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
3184
3204
|
if (cached) {
|
|
3205
|
+
if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) {
|
|
3206
|
+
const generated = await generateOnce(source, options);
|
|
3207
|
+
incrementalGenerateCache.set(cacheKey, {
|
|
3208
|
+
context: generated.context,
|
|
3209
|
+
seenCandidates: new Set(requestedCandidates),
|
|
3210
|
+
classSet: new Set(generated.classSet),
|
|
3211
|
+
css: generated.css,
|
|
3212
|
+
rawCss: generated.rawCss,
|
|
3213
|
+
dependencies: generated.dependencies,
|
|
3214
|
+
target: generated.target
|
|
3215
|
+
});
|
|
3216
|
+
return generated;
|
|
3217
|
+
}
|
|
3185
3218
|
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
3186
3219
|
if (missingCandidates.length === 0) return {
|
|
3187
3220
|
css: cached.css,
|
|
@@ -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,
|
|
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-nPDKYr8V.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-BYcGCWUY.mjs";
|
|
3
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-CmLpVJgw.mjs";
|
|
4
|
+
import { a as validateCandidatesByGenerator, c as hasTailwindRootDirectives, f 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-W61zZU00.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-D6zEhnyE.mjs";
|
|
7
|
+
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-l12JBkKU.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-Bsr05EFW.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
12
|
import process$1 from "node:process";
|
|
13
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());
|
|
22548
22551
|
}
|
|
22549
|
-
function
|
|
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;
|
|
22584
|
+
}
|
|
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, {
|