weapp-tailwindcss 5.2.11 → 5.2.13
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/shared/generator-css/user-css/source-fragments.d.ts +6 -0
- package/dist/bundlers/shared/generator-css/user-css.d.ts +1 -1
- package/dist/bundlers/shared/hmr-timing.d.ts +1 -0
- package/dist/bundlers/shared/source-candidates/scan-root.d.ts +2 -0
- package/dist/bundlers/vite/css-finalizer/generic-web-fast-path.d.ts +16 -0
- package/dist/bundlers/vite/css-finalizer/options.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
- package/dist/bundlers/vite/shared/generic-web-production-fast-path.d.ts +28 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -0
- package/dist/cli.cjs +372 -293
- package/dist/cli.js +20 -11
- package/dist/{context-DbL0d-zB.js → context-CKQKq4Mv.js} +19 -8
- package/dist/{context-C3TryIjF.cjs → context-vWlNv-Cf.cjs} +17 -11
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{css-imports-DfNC3e6a.cjs → css-imports-BFMU7Hpd.cjs} +1 -1
- package/dist/css-macro/postcss.cjs +1 -1
- package/dist/css-macro.cjs +1 -1
- package/dist/defaults.cjs +2 -0
- package/dist/defaults.js +2 -0
- package/dist/framework.cjs +1 -1
- package/dist/{generator-BLpOsd5O.js → generator-BP4WmgIo.js} +36 -15
- package/dist/{generator-B0dCFlP1.cjs → generator-BXrWA7Sj.cjs} +43 -22
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-DSrcDQsA.cjs → gulp-DxKLSgXX.cjs} +16 -13
- package/dist/{gulp-BLaGc0MJ.js → gulp-G--cGMcR.js} +12 -9
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-BnGBBJ6S.cjs → hmr-timing-BtqnyxAO.cjs} +5 -5
- package/dist/{hmr-timing-DXyGw6jp.js → hmr-timing-iTua_Z55.js} +47 -16
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{object-Bvy6-w9r.js → object-B-8IHefx.js} +4 -4
- package/dist/{object-C_Vr6_S5.cjs → object-DbHtAXRk.cjs} +4 -4
- package/dist/{options-zpZez7qe.cjs → options-DbYws6lr.cjs} +8 -17
- package/dist/{pipeline-helpers-B5CzvTUJ.cjs → pipeline-helpers-DnYpfbat.cjs} +25 -10
- package/dist/postcss-html-transform.cjs +1 -1
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +6 -5
- package/dist/presets.js +4 -3
- package/dist/reset.cjs +1 -1
- package/dist/{rolldown-runtime-CVvi-lCc.cjs → rolldown-runtime-Ctb5zv51.cjs} +1 -1
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +1 -1
- package/dist/{runtime-registry-Y7NrD2WH.cjs → runtime-registry-BlIjpImP.cjs} +10 -0
- package/dist/{source-candidate-scan-signature-GjsLzP8Z.cjs → source-candidate-scan-signature-Ggn8fzkT.cjs} +6 -5
- package/dist/{source-candidate-scan-signature-xgmxO8_F.js → source-candidate-scan-signature-TKJIs7VF.js} +5 -4
- package/dist/{style-options-COpQc8fr.cjs → style-options-Cta1OP3i.cjs} +9 -4
- package/dist/{tailwindcss-2zdmASlM.js → tailwindcss-C2K-vjJv.js} +20 -20
- package/dist/{tailwindcss-LtnGCxF0.cjs → tailwindcss-D1M2xj5O.cjs} +17 -13
- package/dist/{transform-BlsDWgjt.js → transform-52FLRu-0.js} +2 -2
- package/dist/{transform-9wbmvHcC.cjs → transform-BiHG42Rp.cjs} +2 -2
- package/dist/types/user-defined-options/general.d.ts +2 -0
- package/dist/{v4-generation-core-D4zQcQqW.cjs → v4-generation-core-D-zVR2mt.cjs} +53 -16
- package/dist/{vite-BWmBFzgf.js → vite-B577QMUl.js} +317 -82
- package/dist/{vite-DTDbD-95.cjs → vite-BFWJAH16.cjs} +322 -87
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/{watch-dependencies-BZGubvuJ.cjs → watch-dependencies-DLZDrWdH.cjs} +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +14 -12
- package/dist/weapp-tw-runtime-classset-loader.cjs +5 -4
- package/dist/{webpack-CtUyQNqC.js → webpack-DLJkStre.js} +41 -22
- package/dist/{webpack-Bpovb6YE.cjs → webpack-DTqFKvcE.cjs} +46 -36
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/{wxml-CWJc0yY-.js → wxml-B7OAVpXJ.js} +10 -6
- package/dist/{wxml-DUIdXCVa.cjs → wxml-CQmBCjOR.cjs} +386 -311
- package/package.json +6 -6
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_object = require("./object-
|
|
5
|
-
const require_options = require("./options-
|
|
3
|
+
const require_generator = require("./generator-BXrWA7Sj.cjs");
|
|
4
|
+
const require_object = require("./object-DbHtAXRk.cjs");
|
|
5
|
+
const require_options = require("./options-DbYws6lr.cjs");
|
|
6
6
|
require("./utils-CuKLf1Zv.cjs");
|
|
7
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
8
|
-
const require_wxml = require("./wxml-
|
|
9
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
10
|
-
const require_context = require("./context-
|
|
11
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
12
|
-
const require_style_options = require("./style-options-
|
|
13
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
7
|
+
const require_v4_generation_core = require("./v4-generation-core-D-zVR2mt.cjs");
|
|
8
|
+
const require_wxml = require("./wxml-CQmBCjOR.cjs");
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-BtqnyxAO.cjs");
|
|
10
|
+
const require_context = require("./context-vWlNv-Cf.cjs");
|
|
11
|
+
const require_tailwindcss = require("./tailwindcss-D1M2xj5O.cjs");
|
|
12
|
+
const require_style_options = require("./style-options-Cta1OP3i.cjs");
|
|
13
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-Ggn8fzkT.cjs");
|
|
14
14
|
require("./logger-TlKT3xmR.cjs");
|
|
15
|
-
const require_css_imports = require("./css-imports-
|
|
15
|
+
const require_css_imports = require("./css-imports-BFMU7Hpd.cjs");
|
|
16
16
|
let node_fs = require("node:fs");
|
|
17
17
|
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
18
18
|
let node_path = require("node:path");
|
|
@@ -181,7 +181,13 @@ function createViteCssAssetIdentityResolver(options) {
|
|
|
181
181
|
kind: "generator-placeholder",
|
|
182
182
|
sourceFile: placeholderSourceFile
|
|
183
183
|
};
|
|
184
|
-
else
|
|
184
|
+
else {
|
|
185
|
+
const processedSourceFile = candidates.find(options.isKnownProcessedSource);
|
|
186
|
+
identity = processedSourceFile ? {
|
|
187
|
+
kind: "bundler-generated",
|
|
188
|
+
sourceFile: processedSourceFile
|
|
189
|
+
} : { kind: "user" };
|
|
190
|
+
}
|
|
185
191
|
identityByAsset.set(asset, identity);
|
|
186
192
|
return identity;
|
|
187
193
|
};
|
|
@@ -982,7 +988,7 @@ let _lazyMatch = () => {
|
|
|
982
988
|
}
|
|
983
989
|
return u >= e;
|
|
984
990
|
})));
|
|
985
|
-
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0,
|
|
991
|
+
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
986
992
|
const n = r.map(v);
|
|
987
993
|
return g(_(M((a) => {
|
|
988
994
|
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
|
|
@@ -1366,7 +1372,7 @@ function createCssAssetPipelineContext(options, file, bundle) {
|
|
|
1366
1372
|
function getAssetFile$1(bundleFile, asset) {
|
|
1367
1373
|
return asset.fileName || bundleFile;
|
|
1368
1374
|
}
|
|
1369
|
-
function readAssetSource$
|
|
1375
|
+
function readAssetSource$3(asset) {
|
|
1370
1376
|
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
1371
1377
|
}
|
|
1372
1378
|
function clearAssetSource(asset) {
|
|
@@ -1424,7 +1430,8 @@ function removeUnsupportedMiniProgramCssImportsFallback(css, file) {
|
|
|
1424
1430
|
return css.split(/\r?\n/).filter((line) => {
|
|
1425
1431
|
const trimmed = line.trim();
|
|
1426
1432
|
if (!trimmed.startsWith("@import")) return true;
|
|
1427
|
-
const
|
|
1433
|
+
const params = trimmed.slice(7).trim().replace(/;$/, "").trim();
|
|
1434
|
+
const request = (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
|
|
1428
1435
|
return request === void 0 || (0, _weapp_tailwindcss_postcss.isMiniProgramLocalCssImportRequest)(request);
|
|
1429
1436
|
}).join("\n");
|
|
1430
1437
|
}
|
|
@@ -1510,7 +1517,7 @@ function collectRootStyleBundleCssSources(bundle, excludedFile) {
|
|
|
1510
1517
|
if (output.type !== "asset") continue;
|
|
1511
1518
|
const file = require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile$1(bundleFile, output));
|
|
1512
1519
|
if (file === excludedFileKey || !isRootStyleOutputFile(file)) continue;
|
|
1513
|
-
const source = require_v4_generation_core.stripBundlerGeneratedCssMarkers(readAssetSource$
|
|
1520
|
+
const source = require_v4_generation_core.stripBundlerGeneratedCssMarkers(readAssetSource$3(output)).trim();
|
|
1514
1521
|
if (source.length > 0) sources.push(source);
|
|
1515
1522
|
}
|
|
1516
1523
|
return sources;
|
|
@@ -1536,7 +1543,7 @@ function collectHtmlLinkedStyleFiles(bundle) {
|
|
|
1536
1543
|
if (output.type !== "asset") continue;
|
|
1537
1544
|
const htmlFile = getAssetFile$1(bundleFile, output);
|
|
1538
1545
|
if (!isHtmlOutputFile(htmlFile)) continue;
|
|
1539
|
-
const html = readAssetSource$
|
|
1546
|
+
const html = readAssetSource$3(output);
|
|
1540
1547
|
for (const match of html.matchAll(linkHrefRE)) {
|
|
1541
1548
|
const href = match[2];
|
|
1542
1549
|
if (!href) continue;
|
|
@@ -1563,7 +1570,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
1563
1570
|
if (output.type !== "asset") continue;
|
|
1564
1571
|
const file = getAssetFile$1(bundleFile, output);
|
|
1565
1572
|
if (!isCssOutputFile(file) || isMiniProgramStyleOutputFile(file) || !isLinkedStyleFile(file, linked)) continue;
|
|
1566
|
-
const source = require_v4_generation_core.stripBundlerGeneratedCssMarkers(readAssetSource$
|
|
1573
|
+
const source = require_v4_generation_core.stripBundlerGeneratedCssMarkers(readAssetSource$3(output)).trim();
|
|
1567
1574
|
if (source.length > 0) linkedSources.add(source);
|
|
1568
1575
|
}
|
|
1569
1576
|
if (linkedSources.size === 0) return 0;
|
|
@@ -1572,7 +1579,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
1572
1579
|
if (output.type !== "asset") continue;
|
|
1573
1580
|
const file = getAssetFile$1(bundleFile, output);
|
|
1574
1581
|
if (!isRootStyleOutputFile(file) || isMiniProgramStyleOutputFile(file) || isLinkedStyleFile(file, linked)) continue;
|
|
1575
|
-
const source = require_v4_generation_core.stripBundlerGeneratedCssMarkers(readAssetSource$
|
|
1582
|
+
const source = require_v4_generation_core.stripBundlerGeneratedCssMarkers(readAssetSource$3(output)).trim();
|
|
1576
1583
|
if (!linkedSources.has(source)) continue;
|
|
1577
1584
|
delete bundle[bundleFile];
|
|
1578
1585
|
options.debug?.("remove duplicate unlinked root css asset referenced by html: %s", file);
|
|
@@ -1600,7 +1607,8 @@ function collectCssImportAtRuleCss(css) {
|
|
|
1600
1607
|
function parseCssImportRequest(importCss) {
|
|
1601
1608
|
const trimmed = importCss.trim();
|
|
1602
1609
|
if (!trimmed.startsWith("@import")) return;
|
|
1603
|
-
|
|
1610
|
+
const params = trimmed.slice(7).trim().replace(/;$/, "").trim();
|
|
1611
|
+
return (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
|
|
1604
1612
|
}
|
|
1605
1613
|
function shouldRestoreCssImportAtRule(importCss, file) {
|
|
1606
1614
|
if (file === void 0 || !isMiniProgramStyleOutputFile(file)) return true;
|
|
@@ -1640,7 +1648,7 @@ function collectImportedBundleCssSources(bundle, importedStyleFiles) {
|
|
|
1640
1648
|
if (output.type !== "asset") continue;
|
|
1641
1649
|
const file = require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile$1(bundleFile, output));
|
|
1642
1650
|
if (!(importedStyleFiles.has(file) || !file.includes("/") && importedFileNames.has(posix.posix.basename(file)))) continue;
|
|
1643
|
-
importedSources.push(readAssetSource$
|
|
1651
|
+
importedSources.push(readAssetSource$3(output));
|
|
1644
1652
|
}
|
|
1645
1653
|
return importedSources;
|
|
1646
1654
|
}
|
|
@@ -1857,7 +1865,8 @@ function resolveMiniProgramStyleOutputExtension(options = {}) {
|
|
|
1857
1865
|
}
|
|
1858
1866
|
function resolveReplayCssOutputFile(rootDir, file) {
|
|
1859
1867
|
const cleanFile = file.replace(/[?#].*$/, "");
|
|
1860
|
-
const
|
|
1868
|
+
const nextFile = node_path.default.isAbsolute(cleanFile) ? node_path.default.relative(resolveCssOutputRealPath(rootDir), resolveCssOutputRealPath(cleanFile)) : cleanFile;
|
|
1869
|
+
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(nextFile);
|
|
1861
1870
|
if (normalizedFile.length === 0 || normalizedFile === "." || normalizedFile === ".." || normalizedFile.startsWith("../")) return require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.basename(cleanFile));
|
|
1862
1871
|
return normalizedFile;
|
|
1863
1872
|
}
|
|
@@ -2674,7 +2683,7 @@ function removeCssCoveredByRootStyleAssets(bundle, options) {
|
|
|
2674
2683
|
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
2675
2684
|
if (output.type !== "asset") continue;
|
|
2676
2685
|
const file = getAssetFile$1(bundleFile, output);
|
|
2677
|
-
const rawSource = readAssetSource$
|
|
2686
|
+
const rawSource = readAssetSource$3(output);
|
|
2678
2687
|
const hasScopedCss = hasVueScopedAttr(rawSource);
|
|
2679
2688
|
const hasTailwindGeneratedCss = /tailwindcss v\d/i.test(rawSource);
|
|
2680
2689
|
const shouldIncludeTailwindGeneratedCssAsset = options.includeTailwindGeneratedCssAssets === true && hasTailwindGeneratedCss && isCssOutputFile(file) && !isMiniProgramStyleOutputFile(file);
|
|
@@ -2897,7 +2906,7 @@ function isViteProcessedRootStyleImportingTargets(bundle, file, targetFiles) {
|
|
|
2897
2906
|
const targetFileSet = new Set(targetFiles.map(require_source_candidate_scan_signature.normalizeOutputPathKey));
|
|
2898
2907
|
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
2899
2908
|
if (output.type !== "asset" || require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile$1(bundleFile, output)) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file)) continue;
|
|
2900
|
-
return [...collectImportedStyleFiles(readAssetSource$
|
|
2909
|
+
return [...collectImportedStyleFiles(readAssetSource$3(output), file)].some((importedFile) => targetFileSet.has(require_source_candidate_scan_signature.normalizeOutputPathKey(importedFile)));
|
|
2901
2910
|
}
|
|
2902
2911
|
return false;
|
|
2903
2912
|
}
|
|
@@ -2927,7 +2936,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
|
|
|
2927
2936
|
if (candidateKey === targetFileKey || !isCssOutputFile(candidateKey)) continue;
|
|
2928
2937
|
const candidateIsRootWebStyle = isRootStyleOutputFile(candidateKey) && !isMiniProgramStyleOutputFile(candidateKey);
|
|
2929
2938
|
if (candidateIsRootWebStyle && !targetIsRootWebStyle) continue;
|
|
2930
|
-
const candidateSource = readAssetSource$
|
|
2939
|
+
const candidateSource = readAssetSource$3(candidateOutput).trim();
|
|
2931
2940
|
if (!(recordFileKeys.has(candidateKey) || candidateSource.length > 0 && (recordCss.has(candidateSource) || (0, _weapp_tailwindcss_postcss.containsCssAfterMinify)(targetCss, candidateSource) || targetIsRootWebStyle && candidateIsRootWebStyle && !hasNonCommentCss((0, _weapp_tailwindcss_postcss.filterExistingCssRules)(targetCss, candidateSource).trim())))) continue;
|
|
2932
2941
|
if (candidateIsRootWebStyle) delete bundle[candidateFile];
|
|
2933
2942
|
else clearAssetSource(candidateOutput);
|
|
@@ -2966,7 +2975,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
2966
2975
|
if (output.type !== "asset") continue;
|
|
2967
2976
|
const file = getAssetFile$1(bundleFile, output);
|
|
2968
2977
|
if (!isCssOutputFile(file) || !options.isViteProcessedCssAsset?.(output, file)) continue;
|
|
2969
|
-
const rawSource = readAssetSource$
|
|
2978
|
+
const rawSource = readAssetSource$3(output);
|
|
2970
2979
|
let nextCss = resolveViteProcessedCssAssetSource(file, rawSource, options.resolveViteProcessedCssOutputFile);
|
|
2971
2980
|
const singleMarkerFile = collectSingleViteGeneratedCssMarkerFile(rawSource);
|
|
2972
2981
|
if (singleMarkerFile && (options.subpackageRoots == null || !isSubpackageOutputFile(file, options.subpackageRoots)) && shouldFilterRootGeneratedCssMarkerForScopedAsset(file, singleMarkerFile, options.resolveViteProcessedCssOutputFile)) nextCss = removeCssCoveredByRootStyleBundleSources(bundle, file, nextCss);
|
|
@@ -2983,7 +2992,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
2983
2992
|
if (singleMarkerFile && require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedOutputFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file) && !isRootStyleOutputFile(resolvedOutputFile) && existingAssetFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedOutputFile))) {
|
|
2984
2993
|
const targetAsset = findBundleAssetByOutputFile(bundle, resolvedOutputFile);
|
|
2985
2994
|
if (targetAsset) {
|
|
2986
|
-
const targetRawSource = readAssetSource$
|
|
2995
|
+
const targetRawSource = readAssetSource$3(targetAsset);
|
|
2987
2996
|
const targetNextCss = appendCss$1(targetRawSource, (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(targetRawSource, nextCss).trim());
|
|
2988
2997
|
if (targetNextCss !== targetRawSource) {
|
|
2989
2998
|
targetAsset.source = targetNextCss;
|
|
@@ -3061,7 +3070,7 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
3061
3070
|
if (output.type !== "asset") continue;
|
|
3062
3071
|
let file = getAssetFile$1(bundleFile, output);
|
|
3063
3072
|
if (!options.opts.cssMatcher(file) || !shouldUseCssAssetAsMainInjectionTarget(options.opts, file, viteCssResults, options, bundle)) continue;
|
|
3064
|
-
let originalSource = readAssetSource$
|
|
3073
|
+
let originalSource = readAssetSource$3(output);
|
|
3065
3074
|
if (shouldPreserveMiniProgramImportShell(options, bundle, file, originalSource)) {
|
|
3066
3075
|
const importedTargetFile = resolvePreservedImportShellInjectionTarget(options, bundle, file, originalSource);
|
|
3067
3076
|
if (typeof importedTargetFile === "string") {
|
|
@@ -3070,7 +3079,7 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
3070
3079
|
if (importedOutput?.type === "asset") {
|
|
3071
3080
|
output = importedOutput;
|
|
3072
3081
|
file = importedTargetFile;
|
|
3073
|
-
originalSource = readAssetSource$
|
|
3082
|
+
originalSource = readAssetSource$3(output);
|
|
3074
3083
|
} else continue;
|
|
3075
3084
|
} else {
|
|
3076
3085
|
options.debug?.("preserve mini-program css import shell asset: %s", file);
|
|
@@ -3534,7 +3543,8 @@ function collectRememberedCssReplayGroups(sources, opts, rootDir, isWebGenerator
|
|
|
3534
3543
|
const cleanSourceFile = remembered.sourceFile.replace(/[?#].*$/, "");
|
|
3535
3544
|
const resolvedOutputFile = CSS_SOURCE_OUTPUT_EXT_RE.test(cleanSourceFile) ? resolveViteCssPipelineOutputFileFromSourceFile(remembered.sourceFile, opts, rootDir, isWebGeneratorTarget, preserveCssExtension, sourceRoot, styleOutputExtension, styleOutputFiles) : resolveViteCssPipelineOutputFileFromSourceFile(remembered.outputFile, opts, rootDir, isWebGeneratorTarget, preserveCssExtension, sourceRoot, styleOutputExtension, styleOutputFiles);
|
|
3536
3545
|
const rememberedOutputFile = remembered.outputFile.replace(/[?#].*$/, "");
|
|
3537
|
-
const
|
|
3546
|
+
const outputFile = opts.cssMatcher(rememberedOutputFile) && !require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedOutputFile).includes("/") && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedOutputFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedOutputFile.replace(/[?#].*$/, "")) ? remembered.outputFile : resolvedOutputFile;
|
|
3547
|
+
const outputKey = require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
3538
3548
|
const group = groups.get(outputKey) ?? [];
|
|
3539
3549
|
group.push({
|
|
3540
3550
|
key,
|
|
@@ -4896,7 +4906,7 @@ function resolveGenerateBundleEnvFlags() {
|
|
|
4896
4906
|
}
|
|
4897
4907
|
//#endregion
|
|
4898
4908
|
//#region src/bundlers/vite/generate-bundle/final-css-assets.ts
|
|
4899
|
-
function readAssetSource$
|
|
4909
|
+
function readAssetSource$2(output) {
|
|
4900
4910
|
return typeof output.source === "string" ? output.source : output.source.toString();
|
|
4901
4911
|
}
|
|
4902
4912
|
function shouldFinalizeMiniProgramCssAsset(source) {
|
|
@@ -4911,7 +4921,7 @@ function finalizeMiniProgramCssAssetStructures(bundle, options) {
|
|
|
4911
4921
|
if (output.type !== "asset") continue;
|
|
4912
4922
|
const file = output.fileName || bundleFile;
|
|
4913
4923
|
if (!options.cssMatcher(file) || options.files && !options.files.has(file)) continue;
|
|
4914
|
-
const rawSource = readAssetSource$
|
|
4924
|
+
const rawSource = readAssetSource$2(output);
|
|
4915
4925
|
const outputCss = require_v4_generation_core.finalizeMiniProgramCssStructure(rawSource);
|
|
4916
4926
|
if (outputCss === rawSource) continue;
|
|
4917
4927
|
plan.write(file, outputCss);
|
|
@@ -4936,10 +4946,11 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
4936
4946
|
if (output.type !== "asset") continue;
|
|
4937
4947
|
const file = output.fileName || bundleFile;
|
|
4938
4948
|
if (!options.cssMatcher(file)) continue;
|
|
4939
|
-
const rawSource = readAssetSource$
|
|
4949
|
+
const rawSource = readAssetSource$2(output);
|
|
4940
4950
|
if (rawSource.trim().length === 0) continue;
|
|
4941
4951
|
if (options.lastCssResultByFile?.has(file)) {
|
|
4942
|
-
const
|
|
4952
|
+
const structurallyCleanSource = require_v4_generation_core.finalizeMiniProgramCssStructure(rawSource);
|
|
4953
|
+
const outputCss = (0, _weapp_tailwindcss_postcss.stripMiniProgramCssSpecificityPlaceholders)(structurallyCleanSource);
|
|
4943
4954
|
if (outputCss !== rawSource) {
|
|
4944
4955
|
plan.write(file, outputCss);
|
|
4945
4956
|
writeTargets.set(file, output);
|
|
@@ -4973,7 +4984,8 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
4973
4984
|
},
|
|
4974
4985
|
cssPresetEnv: {}
|
|
4975
4986
|
});
|
|
4976
|
-
const
|
|
4987
|
+
const structurallyCleanCss = require_v4_generation_core.finalizeMiniProgramCssStructure(css);
|
|
4988
|
+
const outputCss = (0, _weapp_tailwindcss_postcss.stripMiniProgramCssSpecificityPlaceholders)(structurallyCleanCss);
|
|
4977
4989
|
if (outputCss === rawSource) continue;
|
|
4978
4990
|
plan.write(file, outputCss);
|
|
4979
4991
|
writeTargets.set(file, output);
|
|
@@ -5176,7 +5188,7 @@ async function handleUniAppXPostCssTasks(options) {
|
|
|
5176
5188
|
}
|
|
5177
5189
|
//#endregion
|
|
5178
5190
|
//#region src/bundlers/vite/generate-bundle/finalize/root-import-shell.ts
|
|
5179
|
-
function readAssetSource(asset) {
|
|
5191
|
+
function readAssetSource$1(asset) {
|
|
5180
5192
|
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
5181
5193
|
}
|
|
5182
5194
|
function getAssetFile(bundleFile, asset) {
|
|
@@ -5192,7 +5204,7 @@ function finalizeWebviewCssCompat(bundle, options) {
|
|
|
5192
5204
|
if (output.type !== "asset") continue;
|
|
5193
5205
|
const file = getAssetFile(bundleFile, output);
|
|
5194
5206
|
if (!options.opts.cssMatcher(file) || !/\.css(?:$|[?#])/i.test(file)) continue;
|
|
5195
|
-
const rawSource = readAssetSource(output);
|
|
5207
|
+
const rawSource = readAssetSource$1(output);
|
|
5196
5208
|
const nextCss = (0, _weapp_tailwindcss_postcss.transformWebCssSafeSelectors)((0, _weapp_tailwindcss_postcss.transformWebCssCompat)(rawSource, generatorOptions.webCompat ?? true), { escapeMap: options.opts.escapeMap });
|
|
5197
5209
|
if (nextCss === rawSource) continue;
|
|
5198
5210
|
plan.write(file, nextCss);
|
|
@@ -5242,7 +5254,7 @@ function normalizeRootMiniProgramImportShellAssets(bundle, options) {
|
|
|
5242
5254
|
if (!originFile || !options.cssMatcher(originFile)) continue;
|
|
5243
5255
|
const originOutput = Object.entries(bundle).find(([bundleFile, output]) => output.type === "asset" && require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile(bundleFile, output)) === require_source_candidate_scan_signature.normalizeOutputPathKey(originFile))?.[1];
|
|
5244
5256
|
if (originOutput?.type !== "asset") continue;
|
|
5245
|
-
const rootSource = readAssetSource(rootOutput);
|
|
5257
|
+
const rootSource = readAssetSource$1(rootOutput);
|
|
5246
5258
|
const importedRootFile = resolveSingleCssImportOutputFile(rootFile, rootSource);
|
|
5247
5259
|
if (importedRootFile && require_source_candidate_scan_signature.normalizeOutputPathKey(importedRootFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(originFile)) {
|
|
5248
5260
|
const nextRootSource = createCssImportShell(rootFile, originFile);
|
|
@@ -5256,7 +5268,7 @@ function normalizeRootMiniProgramImportShellAssets(bundle, options) {
|
|
|
5256
5268
|
continue;
|
|
5257
5269
|
}
|
|
5258
5270
|
if ((0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(rootSource)) continue;
|
|
5259
|
-
const originSource = readAssetSource(originOutput);
|
|
5271
|
+
const originSource = readAssetSource$1(originOutput);
|
|
5260
5272
|
if ((0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(originSource)) {
|
|
5261
5273
|
const importedFile = resolveSingleCssImportOutputFile(originFile, originSource);
|
|
5262
5274
|
if (importedFile && require_source_candidate_scan_signature.normalizeOutputPathKey(importedFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(rootFile)) continue;
|
|
@@ -5286,7 +5298,8 @@ async function finalizeGenerateBundle(options) {
|
|
|
5286
5298
|
const { activeProcessCacheKeys, activeProcessHashKeys, activeViteCssCacheFiles, bundle, bundleFiles, cache, cssTaskFactories, cssPipelineStrategy, createCssPipelineContext, debug, defaultStyleOutputExtension, formatIteration, generatorCandidateSignature, generatorRuntime, getCssHandlerOptions, getSourceCandidateSourcesForEntries, getSourceCandidatesForEntries, getViteCssCacheStats, getViteProcessedCssAssetResults, hmrTimingRecorder, hmrTimingStartedAt, isHarmonyAppStyleTarget, isNativeAppStyleTarget, isViteProcessedCssAsset, isWebGeneratorTarget, jsAfterCss, jsTaskFactories, lastCssResultByFile, lastCssSourceHashByFile, linkedByEntry, markCssAssetProcessed, metrics, onEnd, onUpdate, opts, outDir, pendingLinkedUpdates, pendingRememberedCssReplayUpdates, prepareJsTransformRuntime, pruneViteCssCaches, recordCssAssetResult, recordTimingDetail, recordViteProcessedCssAssetResult, rootDir, runtime, runtimeState, shouldPreserveAppCssExtension, snapshot, sourceCandidates, sourceRoot, state, styleHandler, tasks, timingDetails, transformRuntime, transformWebTargetCss, useIncrementalMode } = options;
|
|
5287
5299
|
const tasksStart = performance.now();
|
|
5288
5300
|
if (cssTaskFactories.length > 0) {
|
|
5289
|
-
const
|
|
5301
|
+
const cssConcurrency = resolveViteCssTaskConcurrency(useIncrementalMode, runtimeState.tailwindRuntime.majorVersion);
|
|
5302
|
+
const cssTask = require_v4_generation_core.runWithConcurrency(cssTaskFactories, cssConcurrency).then(() => void 0);
|
|
5290
5303
|
if (jsAfterCss) await cssTask;
|
|
5291
5304
|
else tasks.push(cssTask);
|
|
5292
5305
|
}
|
|
@@ -5686,7 +5699,8 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
5686
5699
|
const manifestPath = node_path.default.join(normalizedRoot, "manifest.json");
|
|
5687
5700
|
let enabled = false;
|
|
5688
5701
|
try {
|
|
5689
|
-
|
|
5702
|
+
const raw = node_fs.default.readFileSync(manifestPath, "utf8");
|
|
5703
|
+
enabled = `${(0, comment_json.parse)(raw)["uni-app-x"]?.styleIsolationVersion ?? ""}` === "2";
|
|
5690
5704
|
} catch {
|
|
5691
5705
|
enabled = false;
|
|
5692
5706
|
}
|
|
@@ -5958,12 +5972,13 @@ async function resolveHotSourceModulesByIds(ctx, ids) {
|
|
|
5958
5972
|
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
5959
5973
|
const sourceIds = new Set(ids);
|
|
5960
5974
|
for (const id of ids) {
|
|
5961
|
-
if (typeof id !== "string" || !/\.(?:uvue|nvue)(?:$|[?#])/i.test(id)) continue;
|
|
5975
|
+
if (typeof id !== "string" || !/\.(?:uvue|nvue|vue|tsx?|jsx?)(?:$|[?#])/i.test(id)) continue;
|
|
5962
5976
|
const identity = resolveViteModuleIdentity(id, root);
|
|
5963
5977
|
for (const lookupId of identity.lookupIds) if (!/[?&]import(?:[=&]|$)/.test(lookupId)) sourceIds.add(`${(0, _weapp_tailwindcss_shared.cleanUrl)(lookupId)}?import`);
|
|
5964
5978
|
}
|
|
5965
5979
|
return resolveHotModulesByIds(ctx, sourceIds, (mod) => {
|
|
5966
|
-
|
|
5980
|
+
const modId = mod.id ?? mod.url;
|
|
5981
|
+
return !require_v4_generation_core.isSourceStyleRequest(modId);
|
|
5967
5982
|
});
|
|
5968
5983
|
}
|
|
5969
5984
|
async function resolveHotSourceModules(ctx) {
|
|
@@ -5971,7 +5986,8 @@ async function resolveHotSourceModules(ctx) {
|
|
|
5971
5986
|
const seenModules = /* @__PURE__ */ new Set();
|
|
5972
5987
|
const collectModule = (mod) => {
|
|
5973
5988
|
if (mod == null || seenModules.has(mod)) return;
|
|
5974
|
-
|
|
5989
|
+
const modId = mod.id ?? mod.url;
|
|
5990
|
+
if (require_v4_generation_core.isSourceStyleRequest(modId)) return;
|
|
5975
5991
|
seenModules.add(mod);
|
|
5976
5992
|
modules.push(mod);
|
|
5977
5993
|
};
|
|
@@ -6055,7 +6071,8 @@ function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
|
6055
6071
|
}
|
|
6056
6072
|
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
6057
6073
|
return modules.some((mod) => {
|
|
6058
|
-
|
|
6074
|
+
const modId = mod.id ?? mod.url;
|
|
6075
|
+
return !require_v4_generation_core.isSourceStyleRequest(modId) && mod.isSelfAccepting === true;
|
|
6059
6076
|
});
|
|
6060
6077
|
}
|
|
6061
6078
|
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = [], fallbackSourceIds = []) {
|
|
@@ -6189,7 +6206,7 @@ function resolvePreprocessorTransform(code, id, lang, options) {
|
|
|
6189
6206
|
//#region src/uni-app-x/vite.ts
|
|
6190
6207
|
let transformUVuePromise;
|
|
6191
6208
|
function loadTransformUVue() {
|
|
6192
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
6209
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-BiHG42Rp.cjs")).then((mod) => mod.transformUVue));
|
|
6193
6210
|
return transformUVuePromise;
|
|
6194
6211
|
}
|
|
6195
6212
|
const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
@@ -6431,11 +6448,12 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
6431
6448
|
const { cache, hashKey, createHandlerOptions, debug, getAssetSource, getCssSources, injectStylePlaceholder = true, jsHandler, onUpdate, runtimeSet, applyLinkedResults } = options;
|
|
6432
6449
|
const absoluteFile = require_source_candidate_scan_signature.toAbsoluteOutputPath(file, outDir);
|
|
6433
6450
|
const rawSource = originalSource.source.toString();
|
|
6451
|
+
const rawHashSource = options.hashSalt ? `${rawSource}\n/*${options.hashSalt}*/` : rawSource;
|
|
6434
6452
|
await require_hmr_timing.processCachedTask({
|
|
6435
6453
|
cache,
|
|
6436
6454
|
cacheKey: file,
|
|
6437
6455
|
hashKey,
|
|
6438
|
-
rawSource:
|
|
6456
|
+
rawSource: rawHashSource,
|
|
6439
6457
|
applyResult(source) {
|
|
6440
6458
|
originalSource.source = source;
|
|
6441
6459
|
},
|
|
@@ -6665,16 +6683,18 @@ async function processRememberedCssReplay(options) {
|
|
|
6665
6683
|
const allRememberedSignaturesFresh = rememberedKeys.length > 0 && rememberedKeys.every((key) => getRememberedCssSignature?.(key) === rememberedCssRuntimeSignature);
|
|
6666
6684
|
if (bundleFiles.includes(rememberedOutputFile) || bundleFiles.includes(sourceFile)) continue;
|
|
6667
6685
|
const shouldMergeReplayIntoFrameworkRootTarget = outputFile !== rememberedOutputFile && normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile));
|
|
6668
|
-
if (allRememberedSignaturesFresh)
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6686
|
+
if (allRememberedSignaturesFresh) {
|
|
6687
|
+
if (!shouldMergeReplayIntoFrameworkRootTarget) continue;
|
|
6688
|
+
else {
|
|
6689
|
+
const cachedCss = getLastCssResult(lastCssResultByFile, outputFile);
|
|
6690
|
+
if (cachedCss != null) {
|
|
6691
|
+
pendingRememberedCssReplayUpdates.push(...createRememberedCssReplayUpdates(cachedCss, sourceFile, outputFile, true));
|
|
6692
|
+
metrics.css.cacheHits++;
|
|
6693
|
+
debug("css replay cached result into framework root target: %s", outputFile);
|
|
6694
|
+
continue;
|
|
6695
|
+
}
|
|
6696
|
+
debug("css replay framework root target cache miss, regenerate: %s", outputFile);
|
|
6676
6697
|
}
|
|
6677
|
-
debug("css replay framework root target cache miss, regenerate: %s", outputFile);
|
|
6678
6698
|
}
|
|
6679
6699
|
const sourceTraceSources = scopedSourceCandidateSourceGetter ? await require_source_candidate_scan_signature.createScopedGeneratorSourceTraceMap(generatorRawSource, sourceFile, scopedSourceCandidateSourceGetter) : void 0;
|
|
6680
6700
|
const sourceTraceTokenSources = sourceTraceSources ? require_v4_generation_core.createCssTokenSourceMap(sourceTraceSources, opts) : void 0;
|
|
@@ -7149,7 +7169,8 @@ function resolveCurrentSourceCandidateFile(options) {
|
|
|
7149
7169
|
}
|
|
7150
7170
|
function resolveCurrentSourceCandidateSource(options) {
|
|
7151
7171
|
const { file, getSourceCandidateSource, getSourceCandidateSources } = options;
|
|
7152
|
-
const
|
|
7172
|
+
const cleanedFile = file.replace(/[?#].*$/, "");
|
|
7173
|
+
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(cleanedFile);
|
|
7153
7174
|
const sourceCandidates = createSourceCandidateFiles(options);
|
|
7154
7175
|
const explicitSource = sourceCandidates.reduce((source, candidate) => {
|
|
7155
7176
|
if (source || !candidate) return source;
|
|
@@ -7328,7 +7349,10 @@ function createGenerateBundleHook$1(context) {
|
|
|
7328
7349
|
})
|
|
7329
7350
|
});
|
|
7330
7351
|
return async function generateBundle(_opt, bundle) {
|
|
7331
|
-
if (context.shouldProcessBundle?.() === false)
|
|
7352
|
+
if (context.shouldProcessBundle?.() === false) {
|
|
7353
|
+
await context.onSkipProcessBundle?.();
|
|
7354
|
+
return;
|
|
7355
|
+
}
|
|
7332
7356
|
const processMarkupAndScripts = context.processMarkupAndScripts !== false;
|
|
7333
7357
|
const processStyles = context.shouldProcessStyles?.() ?? context.processStyles !== false;
|
|
7334
7358
|
const addWatchFile = (id) => this.addWatchFile?.(id);
|
|
@@ -7998,6 +8022,41 @@ function createGenerateBundleHook(context) {
|
|
|
7998
8022
|
};
|
|
7999
8023
|
}
|
|
8000
8024
|
//#endregion
|
|
8025
|
+
//#region src/bundlers/vite/shared/generic-web-production-fast-path.ts
|
|
8026
|
+
/**
|
|
8027
|
+
* Generic Web 生产构建的 CSS 已在 Vite transform 阶段生成时,不需要再建立面向小程序的完整产物快照。
|
|
8028
|
+
*/
|
|
8029
|
+
function shouldUseGenericWebProductionFastPath(options) {
|
|
8030
|
+
return options.frameworkName === "generic" && options.command === "build" && options.watch == null && options.isWebGeneratorTarget && options.hasProcessedCss;
|
|
8031
|
+
}
|
|
8032
|
+
/**
|
|
8033
|
+
* Finalizer fast path 只处理无小程序结构语义的 Generic Web 生产产物。
|
|
8034
|
+
*/
|
|
8035
|
+
function shouldUseGenericWebFinalizerFastPath(options) {
|
|
8036
|
+
return shouldUseGenericWebProductionFastPath(options) && !options.hasFrameworkRootImportShells && !options.isHarmonyAppStyleTarget && !options.isNativeAppStyleTarget;
|
|
8037
|
+
}
|
|
8038
|
+
/**
|
|
8039
|
+
* 将 Generic Web fast path 的判定和跳过生命周期集中起来,供 generateBundle hook 直接消费。
|
|
8040
|
+
*/
|
|
8041
|
+
function createGenericWebProductionBundleHooks(options) {
|
|
8042
|
+
return {
|
|
8043
|
+
onSkipProcessBundle: () => {
|
|
8044
|
+
options.onStart();
|
|
8045
|
+
options.onEnd();
|
|
8046
|
+
},
|
|
8047
|
+
shouldProcessBundle: () => {
|
|
8048
|
+
const config = options.getResolvedConfig();
|
|
8049
|
+
return !shouldUseGenericWebProductionFastPath({
|
|
8050
|
+
command: config?.command,
|
|
8051
|
+
frameworkName: options.frameworkName,
|
|
8052
|
+
hasProcessedCss: options.getHasProcessedCss(),
|
|
8053
|
+
isWebGeneratorTarget: options.getIsWebGeneratorTarget(),
|
|
8054
|
+
watch: config?.build?.watch
|
|
8055
|
+
});
|
|
8056
|
+
}
|
|
8057
|
+
};
|
|
8058
|
+
}
|
|
8059
|
+
//#endregion
|
|
8001
8060
|
//#region src/bundlers/vite/css-finalizer/options.ts
|
|
8002
8061
|
function inferPlatformFromViteOutDir(outDir) {
|
|
8003
8062
|
const segment = outDir ? node_path.default.basename(node_path.default.normalize(outDir)) : void 0;
|
|
@@ -8061,6 +8120,95 @@ function finalizeWebCss(css, context, cssPipelineStrategy) {
|
|
|
8061
8120
|
}) ?? (shouldApplyWebCssCompat ? defaultWebCssCompat(css) : css);
|
|
8062
8121
|
}
|
|
8063
8122
|
//#endregion
|
|
8123
|
+
//#region src/bundlers/vite/css-finalizer/generic-web-fast-path.ts
|
|
8124
|
+
function readAssetSource(asset) {
|
|
8125
|
+
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
8126
|
+
}
|
|
8127
|
+
function collectCssAssets(bundle, context) {
|
|
8128
|
+
const assets = /* @__PURE__ */ new Map();
|
|
8129
|
+
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
8130
|
+
if (output.type !== "asset") continue;
|
|
8131
|
+
const file = output.fileName || bundleFile;
|
|
8132
|
+
if (!context.opts.cssMatcher(file) || context.opts.htmlMatcher(file)) continue;
|
|
8133
|
+
assets.set(require_source_candidate_scan_signature.normalizeOutputPathKey(file), {
|
|
8134
|
+
asset: output,
|
|
8135
|
+
file,
|
|
8136
|
+
original: readAssetSource(output)
|
|
8137
|
+
});
|
|
8138
|
+
}
|
|
8139
|
+
return assets;
|
|
8140
|
+
}
|
|
8141
|
+
function resolveProcessedCssOutputFile(file, options, bundleFiles) {
|
|
8142
|
+
return resolveViteCssPipelineOutputFile(file, options.context.opts, options.rootDir, true, false, options.sourceRoot, ".css", bundleFiles);
|
|
8143
|
+
}
|
|
8144
|
+
function resolveProcessedCssAssets(cssAssets, records, options, bundleFiles) {
|
|
8145
|
+
const assetBySourceFile = /* @__PURE__ */ new Map();
|
|
8146
|
+
for (const output of cssAssets.values()) {
|
|
8147
|
+
const identity = options.context.resolveCssAssetIdentity?.(output.asset, output.file);
|
|
8148
|
+
if (identity?.kind === "bundler-generated" && identity.sourceFile) assetBySourceFile.set(require_source_candidate_scan_signature.normalizeOutputPathKey(identity.sourceFile), output);
|
|
8149
|
+
for (const sourceFile of collectMatchingGeneratedCssMarkerFiles(output.file, output.original, (file) => resolveProcessedCssOutputFile(file, options, bundleFiles))) assetBySourceFile.set(require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile), output);
|
|
8150
|
+
}
|
|
8151
|
+
const processedAssets = /* @__PURE__ */ new Map();
|
|
8152
|
+
const htmlOwnedAssets = [...cssAssets.values()].filter((output) => [output.asset.originalFileName, ...output.asset.originalFileNames ?? []].some((file) => typeof file === "string" && /\.html(?:$|[?#])/i.test(file)));
|
|
8153
|
+
for (const [file, record] of records) {
|
|
8154
|
+
const recordCss = typeof record === "string" ? record : record.css;
|
|
8155
|
+
const outputFile = typeof record === "string" ? resolveProcessedCssOutputFile(file, options, bundleFiles) : record.outputFile ?? resolveProcessedCssOutputFile(file, options, bundleFiles);
|
|
8156
|
+
let output = assetBySourceFile.get(require_source_candidate_scan_signature.normalizeOutputPathKey(file)) ?? (outputFile ? cssAssets.get(require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile)) : void 0);
|
|
8157
|
+
if (!output) {
|
|
8158
|
+
const matchingAssets = [...cssAssets.values()].filter((candidate) => options.context.isCssAssetProcessed(candidate.asset, candidate.file) && resolveViteProcessedCssAssetSource(candidate.file, candidate.original, (sourceFile) => resolveProcessedCssOutputFile(sourceFile, options, bundleFiles)) === recordCss);
|
|
8159
|
+
if (matchingAssets.length === 1) output = matchingAssets[0];
|
|
8160
|
+
}
|
|
8161
|
+
if (!output && records.length === 1 && htmlOwnedAssets.length === 1) output = htmlOwnedAssets[0];
|
|
8162
|
+
if (!output) return;
|
|
8163
|
+
const existingCss = processedAssets.get(output);
|
|
8164
|
+
if (existingCss !== void 0 && existingCss !== recordCss) return;
|
|
8165
|
+
processedAssets.set(output, recordCss);
|
|
8166
|
+
}
|
|
8167
|
+
return processedAssets;
|
|
8168
|
+
}
|
|
8169
|
+
/**
|
|
8170
|
+
* Generic Web 的 transform 结果能唯一映射到最终 CSS asset 时,只做一次 marker 清理和 Web 兼容收尾。
|
|
8171
|
+
*/
|
|
8172
|
+
function tryFinalizeGenericWebCss(options) {
|
|
8173
|
+
const { bundle, context } = options;
|
|
8174
|
+
const resolvedConfig = context.getResolvedConfig();
|
|
8175
|
+
const collectStartedAt = performance.now();
|
|
8176
|
+
const processedCssResults = [...context.getViteProcessedCssAssetResults?.() ?? []];
|
|
8177
|
+
if (!shouldUseGenericWebFinalizerFastPath({
|
|
8178
|
+
command: resolvedConfig?.command,
|
|
8179
|
+
frameworkName: context.frameworkName ?? "",
|
|
8180
|
+
hasFrameworkRootImportShells: (context.frameworkRootImportShellTargetByFile?.size ?? 0) > 0,
|
|
8181
|
+
hasProcessedCss: processedCssResults.length > 0,
|
|
8182
|
+
isHarmonyAppStyleTarget: options.isHarmonyAppStyleTarget,
|
|
8183
|
+
isNativeAppStyleTarget: options.isNativeAppStyleTarget,
|
|
8184
|
+
isWebGeneratorTarget: options.isWebGeneratorTarget,
|
|
8185
|
+
watch: resolvedConfig?.build?.watch
|
|
8186
|
+
})) return false;
|
|
8187
|
+
const enumerateStartedAt = performance.now();
|
|
8188
|
+
const cssAssets = collectCssAssets(bundle, context);
|
|
8189
|
+
const bundleFiles = [...cssAssets.values()].map((item) => item.file);
|
|
8190
|
+
options.recordTiming("assets.enumerate", enumerateStartedAt);
|
|
8191
|
+
const processedAssets = resolveProcessedCssAssets(cssAssets, processedCssResults, options, bundleFiles);
|
|
8192
|
+
options.recordTiming("processedCss.collect", collectStartedAt);
|
|
8193
|
+
if (!processedAssets) return false;
|
|
8194
|
+
const writeStartedAt = performance.now();
|
|
8195
|
+
for (const [{ asset, file, original }, processedCss] of processedAssets) {
|
|
8196
|
+
const finalizeStartedAt = performance.now();
|
|
8197
|
+
const generated = finalizeWebCss(require_v4_generation_core.stripBundlerGeneratedCssMarkers(processedCss), {
|
|
8198
|
+
...options.createCssPipelineContext(file),
|
|
8199
|
+
file
|
|
8200
|
+
}, context.cssPipelineStrategy);
|
|
8201
|
+
options.recordTiming("finalizeWebCss", finalizeStartedAt);
|
|
8202
|
+
asset.source = generated;
|
|
8203
|
+
context.markCssAssetProcessed(asset, file);
|
|
8204
|
+
context.recordCssAssetResult?.(file, generated);
|
|
8205
|
+
if (generated !== original) context.opts.onUpdate(file, original, generated);
|
|
8206
|
+
}
|
|
8207
|
+
options.recordTiming("processedCss.inject", performance.now());
|
|
8208
|
+
options.recordTiming("assets.markerCleanupWrite", writeStartedAt);
|
|
8209
|
+
return true;
|
|
8210
|
+
}
|
|
8211
|
+
//#endregion
|
|
8064
8212
|
//#region src/bundlers/vite/css-finalizer/plugin.ts
|
|
8065
8213
|
function createViteCssFinalizerOutputPlugin(context) {
|
|
8066
8214
|
return {
|
|
@@ -8103,12 +8251,45 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8103
8251
|
resolvedConfig,
|
|
8104
8252
|
resolveStylePlatform: () => generatorPlatform
|
|
8105
8253
|
});
|
|
8254
|
+
const timingDetails = {};
|
|
8255
|
+
const recordTiming = (phase, startedAt) => {
|
|
8256
|
+
timingDetails[phase] = (timingDetails[phase] ?? 0) + Math.max(0, performance.now() - startedAt);
|
|
8257
|
+
};
|
|
8258
|
+
const finishTiming = () => {
|
|
8259
|
+
context.hmrTimingRecorder?.record("cssFinalizer", performance.now() - finalizerStartedAt, { timingDetails });
|
|
8260
|
+
context.hmrTimingRecorder?.emitTotal();
|
|
8261
|
+
};
|
|
8262
|
+
const finalizeWebCssAsset = (css, file) => {
|
|
8263
|
+
const startedAt = performance.now();
|
|
8264
|
+
const finalized = finalizeWebCss(css, {
|
|
8265
|
+
...createCssPipelineContext(file),
|
|
8266
|
+
file
|
|
8267
|
+
}, cssPipelineStrategy);
|
|
8268
|
+
recordTiming("finalizeWebCss", startedAt);
|
|
8269
|
+
return finalized;
|
|
8270
|
+
};
|
|
8106
8271
|
const isHarmonyAppStyleTarget = cssPipelineStrategy?.isHarmonyAppStyleTarget?.(createCssPipelineContext("")) === true;
|
|
8107
8272
|
const isNativeAppStyleTarget = cssPipelineStrategy?.isNativeAppStyleTarget?.(createCssPipelineContext("")) === true;
|
|
8108
8273
|
if (resolvedConfig?.command !== "build" && !isNativeAppStyleTarget) return;
|
|
8109
8274
|
const rootDir = resolvedConfig?.root ? node_path.default.resolve(resolvedConfig.root) : node_process.default.cwd();
|
|
8110
8275
|
const outDir = resolvedConfig?.build?.outDir ? node_path.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
8111
8276
|
const sourceRoot = resolveWeappViteSourceRoot(resolvedConfig, opts.appType) ?? resolveSourceRootFromBundleGraph(resolvedConfig, bundle);
|
|
8277
|
+
const finalizerStartedAt = performance.now();
|
|
8278
|
+
if (tryFinalizeGenericWebCss({
|
|
8279
|
+
bundle,
|
|
8280
|
+
context,
|
|
8281
|
+
createCssPipelineContext,
|
|
8282
|
+
isHarmonyAppStyleTarget,
|
|
8283
|
+
isNativeAppStyleTarget,
|
|
8284
|
+
isWebGeneratorTarget,
|
|
8285
|
+
recordTiming,
|
|
8286
|
+
rootDir,
|
|
8287
|
+
sourceRoot
|
|
8288
|
+
})) {
|
|
8289
|
+
require_hmr_timing.finalizeCompilerShadowRun(runtimeState);
|
|
8290
|
+
finishTiming();
|
|
8291
|
+
return;
|
|
8292
|
+
}
|
|
8112
8293
|
const finalCssAssetFiles = /* @__PURE__ */ new Set();
|
|
8113
8294
|
const trackFinalCssAssetUpdate = (file, original, generated) => {
|
|
8114
8295
|
finalCssAssetFiles.add(file);
|
|
@@ -8133,6 +8314,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8133
8314
|
tokenSources: sourceTraceTokenSources
|
|
8134
8315
|
});
|
|
8135
8316
|
const collectViteProcessedCssAssets = () => {
|
|
8317
|
+
const startedAt = performance.now();
|
|
8136
8318
|
collectViteProcessedCssAssetResults(bundle, {
|
|
8137
8319
|
opts,
|
|
8138
8320
|
cssPipelineStrategy,
|
|
@@ -8143,28 +8325,26 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8143
8325
|
recordViteProcessedCssAssetResult,
|
|
8144
8326
|
onAssetWrite: (file) => finalCssAssetFiles.add(file),
|
|
8145
8327
|
resolveViteProcessedCssOutputFile: (file) => resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget, isNativeAppStyleTarget, sourceRoot, resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) }), Object.keys(bundle)),
|
|
8146
|
-
transformCss:
|
|
8147
|
-
...createCssPipelineContext(file),
|
|
8148
|
-
file
|
|
8149
|
-
}, cssPipelineStrategy),
|
|
8328
|
+
transformCss: finalizeWebCssAsset,
|
|
8150
8329
|
debug
|
|
8151
8330
|
});
|
|
8331
|
+
recordTiming("processedCss.collect", startedAt);
|
|
8152
8332
|
};
|
|
8153
8333
|
const injectViteProcessedCssIntoMainCss = () => {
|
|
8154
|
-
|
|
8334
|
+
const startedAt = performance.now();
|
|
8335
|
+
const injected = injectViteProcessedCssIntoMainCssAssets(bundle, {
|
|
8155
8336
|
opts,
|
|
8156
8337
|
cssPipelineStrategy,
|
|
8157
8338
|
createCssPipelineContext,
|
|
8158
8339
|
getViteProcessedCssAssetResults,
|
|
8159
8340
|
markCssAssetProcessed,
|
|
8160
8341
|
recordCssAssetResult,
|
|
8161
|
-
transformCss:
|
|
8162
|
-
...createCssPipelineContext(file),
|
|
8163
|
-
file
|
|
8164
|
-
}, cssPipelineStrategy),
|
|
8342
|
+
transformCss: finalizeWebCssAsset,
|
|
8165
8343
|
debug,
|
|
8166
8344
|
onUpdate: trackFinalCssAssetUpdate
|
|
8167
8345
|
});
|
|
8346
|
+
recordTiming("processedCss.inject", startedAt);
|
|
8347
|
+
return injected;
|
|
8168
8348
|
};
|
|
8169
8349
|
collectViteProcessedCssAssets();
|
|
8170
8350
|
const createHarmonyBundleStyleSources = async () => {
|
|
@@ -8207,7 +8387,9 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8207
8387
|
const fileName = output.fileName || bundleFile;
|
|
8208
8388
|
return output.type === "asset" && opts.cssMatcher(fileName) && !opts.htmlMatcher(fileName) && !isHTMLRequest(fileName) && !isCssAssetProcessed(output, fileName);
|
|
8209
8389
|
};
|
|
8390
|
+
const enumerateStartedAt = performance.now();
|
|
8210
8391
|
const entries = Object.entries(bundle).filter(isCssOutputAssetEntry);
|
|
8392
|
+
recordTiming("assets.enumerate", enumerateStartedAt);
|
|
8211
8393
|
if (entries.length === 0) {
|
|
8212
8394
|
await injectHarmonyBundleStyles(getRecordedGeneratorCandidates?.() ?? getSourceCandidates?.() ?? await ensureRuntimeClassSet());
|
|
8213
8395
|
collectViteProcessedCssAssets();
|
|
@@ -8228,6 +8410,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8228
8410
|
recordCssAssetResult
|
|
8229
8411
|
});
|
|
8230
8412
|
require_hmr_timing.finalizeCompilerShadowRun(runtimeState);
|
|
8413
|
+
finishTiming();
|
|
8231
8414
|
return;
|
|
8232
8415
|
}
|
|
8233
8416
|
await runtimeState.readyPromise;
|
|
@@ -8251,10 +8434,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8251
8434
|
...createCssPipelineContext(file),
|
|
8252
8435
|
file
|
|
8253
8436
|
}) ?? {});
|
|
8254
|
-
const nextCss = annotateCss(generatorBranch.isWeb ?
|
|
8255
|
-
...createCssPipelineContext(file),
|
|
8256
|
-
file
|
|
8257
|
-
}, cssPipelineStrategy) : (await opts.styleHandler(cleanRawSource, cssHandlerOptions)).css);
|
|
8437
|
+
const nextCss = annotateCss(generatorBranch.isWeb ? finalizeWebCssAsset(cleanRawSource, file) : (await opts.styleHandler(cleanRawSource, cssHandlerOptions)).css);
|
|
8258
8438
|
writeCssAsset(file, output, nextCss);
|
|
8259
8439
|
markCssAssetProcessed(output, file);
|
|
8260
8440
|
recordCssAssetResult?.(file, nextCss);
|
|
@@ -8318,10 +8498,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8318
8498
|
debug("css finalizer preserve mini-program import shell: %s", file);
|
|
8319
8499
|
return;
|
|
8320
8500
|
}
|
|
8321
|
-
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ?
|
|
8322
|
-
...createCssPipelineContext(file),
|
|
8323
|
-
file
|
|
8324
|
-
}, cssPipelineStrategy) : (await opts.styleHandler(generatorTransformRawSource, cssHandlerOptions)).css));
|
|
8501
|
+
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ? finalizeWebCssAsset(cleanRawSource, file) : (await opts.styleHandler(generatorTransformRawSource, cssHandlerOptions)).css));
|
|
8325
8502
|
if (generated) {
|
|
8326
8503
|
registerGeneratorDependencies(this, generated.dependencies);
|
|
8327
8504
|
debug("css finalizer generated result: %s bytes=%d", file, nextCss.length);
|
|
@@ -8333,6 +8510,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8333
8510
|
opts.onUpdate(file, rawSource, nextCss);
|
|
8334
8511
|
debug("css finalizer handle: %s", file);
|
|
8335
8512
|
}));
|
|
8513
|
+
const writeStartedAt = performance.now();
|
|
8336
8514
|
applyViteAssetEmissionPlan(emissionPlan, {
|
|
8337
8515
|
bundle,
|
|
8338
8516
|
writeTargets
|
|
@@ -8356,6 +8534,8 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8356
8534
|
recordCssAssetResult
|
|
8357
8535
|
});
|
|
8358
8536
|
require_hmr_timing.finalizeCompilerShadowRun(runtimeState);
|
|
8537
|
+
recordTiming("assets.write", writeStartedAt);
|
|
8538
|
+
finishTiming();
|
|
8359
8539
|
}
|
|
8360
8540
|
}
|
|
8361
8541
|
};
|
|
@@ -9363,12 +9543,36 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9363
9543
|
const request = mod.url ?? mod.id;
|
|
9364
9544
|
return typeof request === "string" && /\.(?:uvue|nvue)(?:\?import)?$/i.test(request);
|
|
9365
9545
|
});
|
|
9546
|
+
const sendSupplementalSourceHotUpdates = (ctx, modules) => {
|
|
9547
|
+
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
9548
|
+
const updates = modules.flatMap((mod) => [mod, ...mod.importedModules ?? []]).filter((mod) => !require_v4_generation_core.isSourceStyleRequest(mod.id ?? mod.url)).map((mod) => {
|
|
9549
|
+
let hotPath;
|
|
9550
|
+
if (typeof mod.id === "string" && node_path.default.isAbsolute(mod.id)) {
|
|
9551
|
+
const relative = typeof mod.url === "string" && mod.url.startsWith("/pages/") ? node_path.default.relative(node_path.default.dirname(root), mod.id) : node_path.default.relative(root, mod.id);
|
|
9552
|
+
if (relative && !relative.startsWith("..") && !node_path.default.isAbsolute(relative)) hotPath = `/${relative.split(node_path.default.sep).join("/")}`;
|
|
9553
|
+
}
|
|
9554
|
+
hotPath ?? (hotPath = mod.url ?? (typeof mod.id === "string" && mod.id.startsWith("/") ? mod.id : void 0));
|
|
9555
|
+
return hotPath ? {
|
|
9556
|
+
acceptedPath: hotPath,
|
|
9557
|
+
explicitImportRequired: false,
|
|
9558
|
+
isWithinCircularImport: false,
|
|
9559
|
+
path: hotPath,
|
|
9560
|
+
timestamp: ctx.timestamp,
|
|
9561
|
+
type: "js-update"
|
|
9562
|
+
} : void 0;
|
|
9563
|
+
}).filter((update) => update !== void 0);
|
|
9564
|
+
if (updates.length > 0) ctx.server.ws?.send?.({
|
|
9565
|
+
type: "update",
|
|
9566
|
+
updates
|
|
9567
|
+
});
|
|
9568
|
+
};
|
|
9366
9569
|
return {
|
|
9367
9570
|
name: `${require_context.vitePluginName}:source-candidates`,
|
|
9368
9571
|
enforce: "pre",
|
|
9369
9572
|
async load(id) {
|
|
9370
9573
|
if (!options.shouldOwnTailwindGeneration || options.isWebOrNativeAppPlatform(options.resolveViteStylePlatform()) || !isCSSRequest(id) || !shouldCollectTransformedSourceCandidates(id)) return;
|
|
9371
|
-
const
|
|
9574
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
9575
|
+
const rawCode = await (0, node_fs_promises.readFile)(file, "utf8").catch(() => void 0);
|
|
9372
9576
|
if (typeof rawCode !== "string") return;
|
|
9373
9577
|
options.rememberOriginalCssLayerSource(id, rawCode);
|
|
9374
9578
|
const transformedCode = options.transformEarlyMiniProgramCss(rawCode);
|
|
@@ -9397,7 +9601,10 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9397
9601
|
if (!options.sourceScanSession.matches(file)) {
|
|
9398
9602
|
options.sourceCandidateCollector.remove(file);
|
|
9399
9603
|
options.sourceScanSession.cacheCurrent();
|
|
9400
|
-
return
|
|
9604
|
+
return shouldReturnTransformedCode ? {
|
|
9605
|
+
code: transformedCode,
|
|
9606
|
+
map: null
|
|
9607
|
+
} : void 0;
|
|
9401
9608
|
}
|
|
9402
9609
|
await options.sourceCandidateCollector.merge(id, transformedCode);
|
|
9403
9610
|
options.sourceScanSession.cacheCurrent();
|
|
@@ -9470,12 +9677,22 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9470
9677
|
const cssModules = await resolveHotTailwindCssModules(ctx, require_v4_generation_core.isSourceStyleRequest(ctx.file) ? [ctx.file] : options.tailwindRootCssModuleIds);
|
|
9471
9678
|
const hotRoot = ctx.server.config?.root ?? node_process.default.cwd();
|
|
9472
9679
|
const sourceModules = isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) ? await resolveHotSourceModules(ctx) : ctx.modules;
|
|
9680
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file)) {
|
|
9681
|
+
sendSupplementalSourceHotUpdates(ctx, sourceModules);
|
|
9682
|
+
if (sourceModules.some((mod) => {
|
|
9683
|
+
const id = mod.id ?? mod.url;
|
|
9684
|
+
return typeof id === "string" && /[?&]macro=true(?:&|$)/.test(id) === false && typeof mod.url === "string" && mod.url.startsWith("/pages/") && /\.vue(?:$|[?#])/i.test(id);
|
|
9685
|
+
})) {
|
|
9686
|
+
queueMicrotask(() => sendFullReloadForUnresolvedHotUpdate(ctx));
|
|
9687
|
+
return [];
|
|
9688
|
+
}
|
|
9689
|
+
}
|
|
9473
9690
|
const hasHmrCandidateAppend = options.hmrCandidateState.hasPendingCandidateAppend() || canUseHmrCandidateAppend && sourceCandidateChange !== void 0 && sourceCandidateChange.addedCandidates.size > 0;
|
|
9474
9691
|
if (isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) && !hasHmrCandidateAppend && !isWebLikeHotUpdate && (!hasSelfAcceptingNonStyleHotModule(sourceModules) && cssModules.length === 0 || cssModules.length > 0 && options.isUniViteProject())) {
|
|
9475
9692
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
9476
9693
|
return [];
|
|
9477
9694
|
}
|
|
9478
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) && sourceModules.some((mod) => options.
|
|
9695
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) && sourceModules.some((mod) => options.isNuxtPageHotModule?.(mod.id ?? mod.url))) {
|
|
9479
9696
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
9480
9697
|
return [];
|
|
9481
9698
|
}
|
|
@@ -9586,9 +9803,12 @@ function createFrameworkSourceScanSession(options) {
|
|
|
9586
9803
|
});
|
|
9587
9804
|
sourceScanEntries = sourceScan?.entries;
|
|
9588
9805
|
sourceScanExplicit = sourceScan?.explicit ?? false;
|
|
9589
|
-
sourceScanMatcher = require_options.createSourceScanMatcher(sourceScanEntries);
|
|
9590
9806
|
sourceScanDependencies = new Set((sourceScan?.dependencies ?? []).map(normalizeDependency));
|
|
9591
9807
|
const roots = collectRoots(root, sourceScanEntries);
|
|
9808
|
+
sourceScanMatcher = require_v4_generation_core.createSourceCandidateEligibilityMatcher(roots.map((scanRoot) => ({
|
|
9809
|
+
...scanRoot,
|
|
9810
|
+
outDir
|
|
9811
|
+
})));
|
|
9592
9812
|
const nextScanSignature = require_source_candidate_scan_signature.createSourceCandidateScanSignature({
|
|
9593
9813
|
inlineCandidates: sourceScan?.inlineCandidates,
|
|
9594
9814
|
outDir,
|
|
@@ -10004,9 +10224,11 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
10004
10224
|
const platform = resolveViteStylePlatform();
|
|
10005
10225
|
return platform ? isWebOrNativeAppPlatform(platform) : resolveCurrentGeneratorBranch().isWeb;
|
|
10006
10226
|
};
|
|
10007
|
-
const
|
|
10008
|
-
if (typeof id !== "string"
|
|
10009
|
-
const cleanId = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
10227
|
+
const isNuxtPageHotModule = (id) => {
|
|
10228
|
+
if (typeof id !== "string") return false;
|
|
10229
|
+
const cleanId = (0, _weapp_tailwindcss_shared.cleanUrl)(id).replace(/%2F/gi, "/");
|
|
10230
|
+
if (cleanId.includes("virtual:nuxt:") && /(?:^|\/)routes\.mjs$/.test(cleanId)) return true;
|
|
10231
|
+
if (!/[?&]macro=true(?:&|$)/.test(id)) return false;
|
|
10010
10232
|
return cleanId.includes("/pages/") && /\.(?:vue|tsx?|jsx?)$/.test(cleanId);
|
|
10011
10233
|
};
|
|
10012
10234
|
const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey((0, _weapp_tailwindcss_shared.cleanUrl)(file));
|
|
@@ -10331,6 +10553,14 @@ ${tracedCss}`;
|
|
|
10331
10553
|
});
|
|
10332
10554
|
const generateBundleHook = createGenerateBundleHook({
|
|
10333
10555
|
...generateBundleContext,
|
|
10556
|
+
...createGenericWebProductionBundleHooks({
|
|
10557
|
+
frameworkName: frameworkBranch.frameworkName,
|
|
10558
|
+
getHasProcessedCss: () => processedCssRegistry.getStats().viteProcessedCssAssetResults > 0,
|
|
10559
|
+
getIsWebGeneratorTarget: () => resolveCurrentGeneratorBranch().isWeb,
|
|
10560
|
+
getResolvedConfig,
|
|
10561
|
+
onEnd: opts.onEnd,
|
|
10562
|
+
onStart: opts.onStart
|
|
10563
|
+
}),
|
|
10334
10564
|
shouldProcessStyles: () => !shouldSplitGenerateBundlePhases()
|
|
10335
10565
|
});
|
|
10336
10566
|
const cssFinalizerOutputPlugin = createViteCssFinalizerOutputPlugin({
|
|
@@ -10339,10 +10569,13 @@ ${tracedCss}`;
|
|
|
10339
10569
|
ensureRuntimeClassSet,
|
|
10340
10570
|
cssPipelineStrategy: frameworkCssPipelineStrategy,
|
|
10341
10571
|
debug,
|
|
10572
|
+
frameworkName: frameworkBranch.frameworkName,
|
|
10342
10573
|
getResolvedConfig,
|
|
10574
|
+
hmrTimingRecorder,
|
|
10343
10575
|
markCssAssetProcessed,
|
|
10344
10576
|
isCssAssetProcessed,
|
|
10345
10577
|
isViteProcessedCssAsset,
|
|
10578
|
+
resolveCssAssetIdentity,
|
|
10346
10579
|
recordCssAssetResult,
|
|
10347
10580
|
recordViteProcessedCssAssetResult,
|
|
10348
10581
|
getViteProcessedCssAssetResults,
|
|
@@ -10406,7 +10639,7 @@ ${tracedCss}`;
|
|
|
10406
10639
|
hmrTimingRecorder,
|
|
10407
10640
|
invalidateRecordedGeneratorCandidates,
|
|
10408
10641
|
isCurrentWebLikeStylePlatform,
|
|
10409
|
-
|
|
10642
|
+
isNuxtPageHotModule,
|
|
10410
10643
|
isUniViteProject,
|
|
10411
10644
|
isWebOrNativeAppPlatform,
|
|
10412
10645
|
prepareTailwindGeneration,
|
|
@@ -10720,17 +10953,19 @@ function withUniAppXWebPreflightReset(css, enabled) {
|
|
|
10720
10953
|
//#region src/bundlers/vite/uni-app-x-css-options.ts
|
|
10721
10954
|
function resolveUniAppXNativeCssHandlerOptions(opts) {
|
|
10722
10955
|
const uniUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
10723
|
-
|
|
10956
|
+
const branch = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
10724
10957
|
appType: opts.appType,
|
|
10725
10958
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
10726
10959
|
uniAppX: require_options.resolveUniAppXOptions(opts.uniAppX),
|
|
10727
10960
|
uniUtsPlatform
|
|
10728
|
-
})
|
|
10961
|
+
});
|
|
10962
|
+
const runtimeBranch = require_generator.resolveGeneratorRuntimeBranch(branch, {
|
|
10729
10963
|
appType: opts.appType,
|
|
10730
10964
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
10731
10965
|
uniAppX: require_options.resolveUniAppXOptions(opts.uniAppX),
|
|
10732
10966
|
uniUtsPlatform
|
|
10733
|
-
})
|
|
10967
|
+
});
|
|
10968
|
+
if (!require_generator.shouldUseNativeAppCssBranch(runtimeBranch) || !require_options.isUniAppXEnabled(opts.uniAppX)) return {};
|
|
10734
10969
|
return {
|
|
10735
10970
|
uniAppX: true,
|
|
10736
10971
|
uniAppXCssTarget: "uvue",
|