weapp-tailwindcss 5.2.12 → 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/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/{context-DW4ukjx4.js → context-CKQKq4Mv.js} +2 -2
- package/dist/{context-zWINV_E2.cjs → context-vWlNv-Cf.cjs} +5 -5
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{generator-C2UFjlZ1.js → generator-BP4WmgIo.js} +1 -5
- package/dist/{generator-CwMI20jy.cjs → generator-BXrWA7Sj.cjs} +6 -10
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-CWFxs2lE.cjs → gulp-DxKLSgXX.cjs} +7 -7
- package/dist/{gulp-CltYkglj.js → gulp-G--cGMcR.js} +4 -4
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-BjOxhci8.cjs → hmr-timing-BtqnyxAO.cjs} +3 -3
- package/dist/{hmr-timing-D6JKLBCD.js → hmr-timing-iTua_Z55.js} +25 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{options-CSqLm6U2.cjs → options-DbYws6lr.cjs} +7 -16
- package/dist/{pipeline-helpers-Cj9ZzHaY.cjs → pipeline-helpers-DnYpfbat.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{runtime-registry-Y7NrD2WH.cjs → runtime-registry-BlIjpImP.cjs} +10 -0
- package/dist/{source-candidate-scan-signature-uRHl5Ne9.cjs → source-candidate-scan-signature-Ggn8fzkT.cjs} +3 -3
- package/dist/{source-candidate-scan-signature-DQZ_DkgW.js → source-candidate-scan-signature-TKJIs7VF.js} +3 -3
- package/dist/{style-options-D0NukP02.cjs → style-options-Cta1OP3i.cjs} +2 -2
- package/dist/{tailwindcss-vbApajUH.js → tailwindcss-C2K-vjJv.js} +8 -11
- package/dist/{tailwindcss-B3lqgbln.cjs → tailwindcss-D1M2xj5O.cjs} +2 -2
- package/dist/{v4-generation-core-2AuNMweK.cjs → v4-generation-core-D-zVR2mt.cjs} +30 -3
- package/dist/{vite-q3ilYV7x.js → vite-B577QMUl.js} +228 -46
- package/dist/{vite-BLB7vjKQ.cjs → vite-BFWJAH16.cjs} +231 -49
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +9 -8
- package/dist/weapp-tw-runtime-classset-loader.cjs +1 -1
- package/dist/{webpack-DExB8tzB.js → webpack-DLJkStre.js} +11 -10
- package/dist/{webpack-Jn4FJT6y.cjs → webpack-DTqFKvcE.cjs} +15 -14
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { resolveImplicitAppTypeFromViteRoot } from "./framework.js";
|
|
2
|
-
import { $ as hasTailwindSourceDirectives, B as stripMiniProgramCssSpecificityPlaceholders, D as resolveTailwindcssOptions, Ft as filterUnsupportedMiniProgramTailwindV4Candidates, K as hasUserCssLayerBlocks, L as hasMiniProgramCssSpecificityPlaceholders, Pt as getTailwindV4IncrementalGenerateCacheStats, Q as hasTailwindRootDirectives, S as findNearestPackageRoot, U as normalizeEmptyTailwindCustomVariants, X as hasTailwindApplyDirective, Y as hasLocalCssImport, Z as hasTailwindNonRootGenerationDirectives, _ as upsertTailwindV4CssSource, a as resolveGeneratorRuntimeBranch, b as isTailwindV4CssEntry, c as shouldUseNativeAppCssBranch, et as normalizeTailwindConfigDirectives, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, it as removeTailwindSourceDirectives, kt as resolveTailwindV4CssSourceBase, l as resolveUniUtsPlatform, m as filterTailwindV4CssSourceRoots, mt as stripGeneratorPlaceholderMarkers, nt as normalizeTailwindSourceForGenerator, q as splitUserCssLayerBlocks, rt as parseImportRequest, s as shouldUseMiniProgramCssBranch, ut as hasTailwindGeneratedCssMarkers, wt as isFileMatchedByTailwindSourceEntries, x as normalizeCssEntries } from "./generator-
|
|
2
|
+
import { $ as hasTailwindSourceDirectives, B as stripMiniProgramCssSpecificityPlaceholders, D as resolveTailwindcssOptions, Ft as filterUnsupportedMiniProgramTailwindV4Candidates, K as hasUserCssLayerBlocks, L as hasMiniProgramCssSpecificityPlaceholders, Pt as getTailwindV4IncrementalGenerateCacheStats, Q as hasTailwindRootDirectives, S as findNearestPackageRoot, U as normalizeEmptyTailwindCustomVariants, X as hasTailwindApplyDirective, Y as hasLocalCssImport, Z as hasTailwindNonRootGenerationDirectives, _ as upsertTailwindV4CssSource, a as resolveGeneratorRuntimeBranch, b as isTailwindV4CssEntry, c as shouldUseNativeAppCssBranch, et as normalizeTailwindConfigDirectives, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, it as removeTailwindSourceDirectives, kt as resolveTailwindV4CssSourceBase, l as resolveUniUtsPlatform, m as filterTailwindV4CssSourceRoots, mt as stripGeneratorPlaceholderMarkers, nt as normalizeTailwindSourceForGenerator, q as splitUserCssLayerBlocks, rt as parseImportRequest, s as shouldUseMiniProgramCssBranch, ut as hasTailwindGeneratedCssMarkers, wt as isFileMatchedByTailwindSourceEntries, x as normalizeCssEntries } from "./generator-BP4WmgIo.js";
|
|
3
3
|
import { t as omitUndefined } from "./object-B-8IHefx.js";
|
|
4
|
-
import {
|
|
4
|
+
import { a as findTailwindConfig, f as resolveSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as resolveTailwindV4CssDependencies, p as discoverTailwindV4CssEntries, r as isUniAppXEnabled } from "./tailwindcss-C2K-vjJv.js";
|
|
5
5
|
import "./utils-MVwpU07P.js";
|
|
6
|
-
import { A as annotateCssSourceTrace, C as stripRequestQuery, D as stripBundlerGeneratedCssMarkers, E as parseBundlerGeneratedCssMarkerBlocks, F as createRuntimeClassSetManager, H as buildRuntimeCompilationSnapshot, J as createRuntimeAffectingSourceSignature, M as createCssTokenSourceMap, O as finalizeMiniProgramCssStructure, P as processCachedTask, Q as AssetEmissionPlan, R as isPureLocalCssImportWrapper, S as isSourceStyleRequest, T as hasBundlerGeneratedCssMarker, V as finalizeCompilerShadowRun, W as createRuntimeCompilationBuildState, X as beginCompilerShadowRun, Y as disposeCompilerOwner, a as extractMarkedUserLayerComponentsCss, at as isSourceCandidateRequest, d as runWithConcurrency, f as normalizeMiniProgramGeneratorCssSource, g as captureFrameworkPostcssOptions, i as validateCandidatesByGenerator, j as createCssSourceTraceCacheSignature, k as hasEmptyAtRuleBlockCandidate, m as scoreTailwindV4CssSourceFileMatch, nt as createCompilationDependencyChanges, o as mergeMarkedUserLayerComponentsCss, ot as extractCandidatesFromSource, p as normalizeMiniProgramImportShell, q as updateRuntimeCompilationBuildState, r as generateTailwindV4Css, rt as createSourceCandidateCollector, s as collectGeneratedRawSourceCandidatesFromCss, t as createHmrTimingRecorder, tt as recordCompilationDependencyChanges, w as createBundlerGeneratedCssMarker } from "./hmr-timing-
|
|
6
|
+
import { A as annotateCssSourceTrace, C as stripRequestQuery, D as stripBundlerGeneratedCssMarkers, E as parseBundlerGeneratedCssMarkerBlocks, F as createRuntimeClassSetManager, H as buildRuntimeCompilationSnapshot, J as createRuntimeAffectingSourceSignature, M as createCssTokenSourceMap, O as finalizeMiniProgramCssStructure, P as processCachedTask, Q as AssetEmissionPlan, R as isPureLocalCssImportWrapper, S as isSourceStyleRequest, T as hasBundlerGeneratedCssMarker, V as finalizeCompilerShadowRun, W as createRuntimeCompilationBuildState, X as beginCompilerShadowRun, Y as disposeCompilerOwner, a as extractMarkedUserLayerComponentsCss, at as isSourceCandidateRequest, d as runWithConcurrency, f as normalizeMiniProgramGeneratorCssSource, g as captureFrameworkPostcssOptions, i as validateCandidatesByGenerator, j as createCssSourceTraceCacheSignature, k as hasEmptyAtRuleBlockCandidate, m as scoreTailwindV4CssSourceFileMatch, nt as createCompilationDependencyChanges, o as mergeMarkedUserLayerComponentsCss, ot as extractCandidatesFromSource, p as normalizeMiniProgramImportShell, q as updateRuntimeCompilationBuildState, r as generateTailwindV4Css, rt as createSourceCandidateCollector, s as collectGeneratedRawSourceCandidatesFromCss, st as createSourceCandidateEligibilityMatcher, t as createHmrTimingRecorder, tt as recordCompilationDependencyChanges, w as createBundlerGeneratedCssMarker } from "./hmr-timing-iTua_Z55.js";
|
|
7
7
|
import { m as createDebug, p as replaceWxml } from "./wxml-B7OAVpXJ.js";
|
|
8
|
-
import { a as vitePluginName, c as collectRuntimeClassSet, d as refreshTailwindRuntimeState, f as normalizeFrameworkStylePlatform, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, s as toCustomAttributesEntities, t as getCompilerContext } from "./context-
|
|
9
|
-
import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-
|
|
8
|
+
import { a as vitePluginName, c as collectRuntimeClassSet, d as refreshTailwindRuntimeState, f as normalizeFrameworkStylePlatform, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, s as toCustomAttributesEntities, t as getCompilerContext } from "./context-CKQKq4Mv.js";
|
|
9
|
+
import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-TKJIs7VF.js";
|
|
10
10
|
import { t as logger$1 } from "./logger-BNzxZbZj.js";
|
|
11
11
|
import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
@@ -172,7 +172,13 @@ function createViteCssAssetIdentityResolver(options) {
|
|
|
172
172
|
kind: "generator-placeholder",
|
|
173
173
|
sourceFile: placeholderSourceFile
|
|
174
174
|
};
|
|
175
|
-
else
|
|
175
|
+
else {
|
|
176
|
+
const processedSourceFile = candidates.find(options.isKnownProcessedSource);
|
|
177
|
+
identity = processedSourceFile ? {
|
|
178
|
+
kind: "bundler-generated",
|
|
179
|
+
sourceFile: processedSourceFile
|
|
180
|
+
} : { kind: "user" };
|
|
181
|
+
}
|
|
176
182
|
identityByAsset.set(asset, identity);
|
|
177
183
|
return identity;
|
|
178
184
|
};
|
|
@@ -1357,7 +1363,7 @@ function createCssAssetPipelineContext(options, file, bundle) {
|
|
|
1357
1363
|
function getAssetFile$1(bundleFile, asset) {
|
|
1358
1364
|
return asset.fileName || bundleFile;
|
|
1359
1365
|
}
|
|
1360
|
-
function readAssetSource$
|
|
1366
|
+
function readAssetSource$3(asset) {
|
|
1361
1367
|
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
1362
1368
|
}
|
|
1363
1369
|
function clearAssetSource(asset) {
|
|
@@ -1502,7 +1508,7 @@ function collectRootStyleBundleCssSources(bundle, excludedFile) {
|
|
|
1502
1508
|
if (output.type !== "asset") continue;
|
|
1503
1509
|
const file = normalizeOutputPathKey(getAssetFile$1(bundleFile, output));
|
|
1504
1510
|
if (file === excludedFileKey || !isRootStyleOutputFile(file)) continue;
|
|
1505
|
-
const source = stripBundlerGeneratedCssMarkers(readAssetSource$
|
|
1511
|
+
const source = stripBundlerGeneratedCssMarkers(readAssetSource$3(output)).trim();
|
|
1506
1512
|
if (source.length > 0) sources.push(source);
|
|
1507
1513
|
}
|
|
1508
1514
|
return sources;
|
|
@@ -1528,7 +1534,7 @@ function collectHtmlLinkedStyleFiles(bundle) {
|
|
|
1528
1534
|
if (output.type !== "asset") continue;
|
|
1529
1535
|
const htmlFile = getAssetFile$1(bundleFile, output);
|
|
1530
1536
|
if (!isHtmlOutputFile(htmlFile)) continue;
|
|
1531
|
-
const html = readAssetSource$
|
|
1537
|
+
const html = readAssetSource$3(output);
|
|
1532
1538
|
for (const match of html.matchAll(linkHrefRE)) {
|
|
1533
1539
|
const href = match[2];
|
|
1534
1540
|
if (!href) continue;
|
|
@@ -1555,7 +1561,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
1555
1561
|
if (output.type !== "asset") continue;
|
|
1556
1562
|
const file = getAssetFile$1(bundleFile, output);
|
|
1557
1563
|
if (!isCssOutputFile(file) || isMiniProgramStyleOutputFile(file) || !isLinkedStyleFile(file, linked)) continue;
|
|
1558
|
-
const source = stripBundlerGeneratedCssMarkers(readAssetSource$
|
|
1564
|
+
const source = stripBundlerGeneratedCssMarkers(readAssetSource$3(output)).trim();
|
|
1559
1565
|
if (source.length > 0) linkedSources.add(source);
|
|
1560
1566
|
}
|
|
1561
1567
|
if (linkedSources.size === 0) return 0;
|
|
@@ -1564,7 +1570,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
1564
1570
|
if (output.type !== "asset") continue;
|
|
1565
1571
|
const file = getAssetFile$1(bundleFile, output);
|
|
1566
1572
|
if (!isRootStyleOutputFile(file) || isMiniProgramStyleOutputFile(file) || isLinkedStyleFile(file, linked)) continue;
|
|
1567
|
-
const source = stripBundlerGeneratedCssMarkers(readAssetSource$
|
|
1573
|
+
const source = stripBundlerGeneratedCssMarkers(readAssetSource$3(output)).trim();
|
|
1568
1574
|
if (!linkedSources.has(source)) continue;
|
|
1569
1575
|
delete bundle[bundleFile];
|
|
1570
1576
|
options.debug?.("remove duplicate unlinked root css asset referenced by html: %s", file);
|
|
@@ -1633,7 +1639,7 @@ function collectImportedBundleCssSources(bundle, importedStyleFiles) {
|
|
|
1633
1639
|
if (output.type !== "asset") continue;
|
|
1634
1640
|
const file = normalizeOutputPathKey(getAssetFile$1(bundleFile, output));
|
|
1635
1641
|
if (!(importedStyleFiles.has(file) || !file.includes("/") && importedFileNames.has(posix.posix.basename(file)))) continue;
|
|
1636
|
-
importedSources.push(readAssetSource$
|
|
1642
|
+
importedSources.push(readAssetSource$3(output));
|
|
1637
1643
|
}
|
|
1638
1644
|
return importedSources;
|
|
1639
1645
|
}
|
|
@@ -2668,7 +2674,7 @@ function removeCssCoveredByRootStyleAssets(bundle, options) {
|
|
|
2668
2674
|
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
2669
2675
|
if (output.type !== "asset") continue;
|
|
2670
2676
|
const file = getAssetFile$1(bundleFile, output);
|
|
2671
|
-
const rawSource = readAssetSource$
|
|
2677
|
+
const rawSource = readAssetSource$3(output);
|
|
2672
2678
|
const hasScopedCss = hasVueScopedAttr(rawSource);
|
|
2673
2679
|
const hasTailwindGeneratedCss = /tailwindcss v\d/i.test(rawSource);
|
|
2674
2680
|
const shouldIncludeTailwindGeneratedCssAsset = options.includeTailwindGeneratedCssAssets === true && hasTailwindGeneratedCss && isCssOutputFile(file) && !isMiniProgramStyleOutputFile(file);
|
|
@@ -2891,7 +2897,7 @@ function isViteProcessedRootStyleImportingTargets(bundle, file, targetFiles) {
|
|
|
2891
2897
|
const targetFileSet = new Set(targetFiles.map(normalizeOutputPathKey));
|
|
2892
2898
|
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
2893
2899
|
if (output.type !== "asset" || normalizeOutputPathKey(getAssetFile$1(bundleFile, output)) !== normalizeOutputPathKey(file)) continue;
|
|
2894
|
-
return [...collectImportedStyleFiles(readAssetSource$
|
|
2900
|
+
return [...collectImportedStyleFiles(readAssetSource$3(output), file)].some((importedFile) => targetFileSet.has(normalizeOutputPathKey(importedFile)));
|
|
2895
2901
|
}
|
|
2896
2902
|
return false;
|
|
2897
2903
|
}
|
|
@@ -2921,7 +2927,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
|
|
|
2921
2927
|
if (candidateKey === targetFileKey || !isCssOutputFile(candidateKey)) continue;
|
|
2922
2928
|
const candidateIsRootWebStyle = isRootStyleOutputFile(candidateKey) && !isMiniProgramStyleOutputFile(candidateKey);
|
|
2923
2929
|
if (candidateIsRootWebStyle && !targetIsRootWebStyle) continue;
|
|
2924
|
-
const candidateSource = readAssetSource$
|
|
2930
|
+
const candidateSource = readAssetSource$3(candidateOutput).trim();
|
|
2925
2931
|
if (!(recordFileKeys.has(candidateKey) || candidateSource.length > 0 && (recordCss.has(candidateSource) || containsCssAfterMinify(targetCss, candidateSource) || targetIsRootWebStyle && candidateIsRootWebStyle && !hasNonCommentCss(filterExistingCssRules(targetCss, candidateSource).trim())))) continue;
|
|
2926
2932
|
if (candidateIsRootWebStyle) delete bundle[candidateFile];
|
|
2927
2933
|
else clearAssetSource(candidateOutput);
|
|
@@ -2960,7 +2966,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
2960
2966
|
if (output.type !== "asset") continue;
|
|
2961
2967
|
const file = getAssetFile$1(bundleFile, output);
|
|
2962
2968
|
if (!isCssOutputFile(file) || !options.isViteProcessedCssAsset?.(output, file)) continue;
|
|
2963
|
-
const rawSource = readAssetSource$
|
|
2969
|
+
const rawSource = readAssetSource$3(output);
|
|
2964
2970
|
let nextCss = resolveViteProcessedCssAssetSource(file, rawSource, options.resolveViteProcessedCssOutputFile);
|
|
2965
2971
|
const singleMarkerFile = collectSingleViteGeneratedCssMarkerFile(rawSource);
|
|
2966
2972
|
if (singleMarkerFile && (options.subpackageRoots == null || !isSubpackageOutputFile(file, options.subpackageRoots)) && shouldFilterRootGeneratedCssMarkerForScopedAsset(file, singleMarkerFile, options.resolveViteProcessedCssOutputFile)) nextCss = removeCssCoveredByRootStyleBundleSources(bundle, file, nextCss);
|
|
@@ -2977,7 +2983,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
2977
2983
|
if (singleMarkerFile && normalizeOutputPathKey(resolvedOutputFile) !== normalizeOutputPathKey(file) && !isRootStyleOutputFile(resolvedOutputFile) && existingAssetFiles.has(normalizeOutputPathKey(resolvedOutputFile))) {
|
|
2978
2984
|
const targetAsset = findBundleAssetByOutputFile(bundle, resolvedOutputFile);
|
|
2979
2985
|
if (targetAsset) {
|
|
2980
|
-
const targetRawSource = readAssetSource$
|
|
2986
|
+
const targetRawSource = readAssetSource$3(targetAsset);
|
|
2981
2987
|
const targetNextCss = appendCss$1(targetRawSource, filterExistingCssRules(targetRawSource, nextCss).trim());
|
|
2982
2988
|
if (targetNextCss !== targetRawSource) {
|
|
2983
2989
|
targetAsset.source = targetNextCss;
|
|
@@ -3055,7 +3061,7 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
3055
3061
|
if (output.type !== "asset") continue;
|
|
3056
3062
|
let file = getAssetFile$1(bundleFile, output);
|
|
3057
3063
|
if (!options.opts.cssMatcher(file) || !shouldUseCssAssetAsMainInjectionTarget(options.opts, file, viteCssResults, options, bundle)) continue;
|
|
3058
|
-
let originalSource = readAssetSource$
|
|
3064
|
+
let originalSource = readAssetSource$3(output);
|
|
3059
3065
|
if (shouldPreserveMiniProgramImportShell(options, bundle, file, originalSource)) {
|
|
3060
3066
|
const importedTargetFile = resolvePreservedImportShellInjectionTarget(options, bundle, file, originalSource);
|
|
3061
3067
|
if (typeof importedTargetFile === "string") {
|
|
@@ -3064,7 +3070,7 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
3064
3070
|
if (importedOutput?.type === "asset") {
|
|
3065
3071
|
output = importedOutput;
|
|
3066
3072
|
file = importedTargetFile;
|
|
3067
|
-
originalSource = readAssetSource$
|
|
3073
|
+
originalSource = readAssetSource$3(output);
|
|
3068
3074
|
} else continue;
|
|
3069
3075
|
} else {
|
|
3070
3076
|
options.debug?.("preserve mini-program css import shell asset: %s", file);
|
|
@@ -4891,7 +4897,7 @@ function resolveGenerateBundleEnvFlags() {
|
|
|
4891
4897
|
}
|
|
4892
4898
|
//#endregion
|
|
4893
4899
|
//#region src/bundlers/vite/generate-bundle/final-css-assets.ts
|
|
4894
|
-
function readAssetSource$
|
|
4900
|
+
function readAssetSource$2(output) {
|
|
4895
4901
|
return typeof output.source === "string" ? output.source : output.source.toString();
|
|
4896
4902
|
}
|
|
4897
4903
|
function shouldFinalizeMiniProgramCssAsset(source) {
|
|
@@ -4906,7 +4912,7 @@ function finalizeMiniProgramCssAssetStructures(bundle, options) {
|
|
|
4906
4912
|
if (output.type !== "asset") continue;
|
|
4907
4913
|
const file = output.fileName || bundleFile;
|
|
4908
4914
|
if (!options.cssMatcher(file) || options.files && !options.files.has(file)) continue;
|
|
4909
|
-
const rawSource = readAssetSource$
|
|
4915
|
+
const rawSource = readAssetSource$2(output);
|
|
4910
4916
|
const outputCss = finalizeMiniProgramCssStructure(rawSource);
|
|
4911
4917
|
if (outputCss === rawSource) continue;
|
|
4912
4918
|
plan.write(file, outputCss);
|
|
@@ -4931,7 +4937,7 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
4931
4937
|
if (output.type !== "asset") continue;
|
|
4932
4938
|
const file = output.fileName || bundleFile;
|
|
4933
4939
|
if (!options.cssMatcher(file)) continue;
|
|
4934
|
-
const rawSource = readAssetSource$
|
|
4940
|
+
const rawSource = readAssetSource$2(output);
|
|
4935
4941
|
if (rawSource.trim().length === 0) continue;
|
|
4936
4942
|
if (options.lastCssResultByFile?.has(file)) {
|
|
4937
4943
|
const structurallyCleanSource = finalizeMiniProgramCssStructure(rawSource);
|
|
@@ -5173,7 +5179,7 @@ async function handleUniAppXPostCssTasks(options) {
|
|
|
5173
5179
|
}
|
|
5174
5180
|
//#endregion
|
|
5175
5181
|
//#region src/bundlers/vite/generate-bundle/finalize/root-import-shell.ts
|
|
5176
|
-
function readAssetSource(asset) {
|
|
5182
|
+
function readAssetSource$1(asset) {
|
|
5177
5183
|
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
5178
5184
|
}
|
|
5179
5185
|
function getAssetFile(bundleFile, asset) {
|
|
@@ -5189,7 +5195,7 @@ function finalizeWebviewCssCompat(bundle, options) {
|
|
|
5189
5195
|
if (output.type !== "asset") continue;
|
|
5190
5196
|
const file = getAssetFile(bundleFile, output);
|
|
5191
5197
|
if (!options.opts.cssMatcher(file) || !/\.css(?:$|[?#])/i.test(file)) continue;
|
|
5192
|
-
const rawSource = readAssetSource(output);
|
|
5198
|
+
const rawSource = readAssetSource$1(output);
|
|
5193
5199
|
const nextCss = transformWebCssSafeSelectors(transformWebCssCompat(rawSource, generatorOptions.webCompat ?? true), { escapeMap: options.opts.escapeMap });
|
|
5194
5200
|
if (nextCss === rawSource) continue;
|
|
5195
5201
|
plan.write(file, nextCss);
|
|
@@ -5239,7 +5245,7 @@ function normalizeRootMiniProgramImportShellAssets(bundle, options) {
|
|
|
5239
5245
|
if (!originFile || !options.cssMatcher(originFile)) continue;
|
|
5240
5246
|
const originOutput = Object.entries(bundle).find(([bundleFile, output]) => output.type === "asset" && normalizeOutputPathKey(getAssetFile(bundleFile, output)) === normalizeOutputPathKey(originFile))?.[1];
|
|
5241
5247
|
if (originOutput?.type !== "asset") continue;
|
|
5242
|
-
const rootSource = readAssetSource(rootOutput);
|
|
5248
|
+
const rootSource = readAssetSource$1(rootOutput);
|
|
5243
5249
|
const importedRootFile = resolveSingleCssImportOutputFile(rootFile, rootSource);
|
|
5244
5250
|
if (importedRootFile && normalizeOutputPathKey(importedRootFile) === normalizeOutputPathKey(originFile)) {
|
|
5245
5251
|
const nextRootSource = createCssImportShell(rootFile, originFile);
|
|
@@ -5253,7 +5259,7 @@ function normalizeRootMiniProgramImportShellAssets(bundle, options) {
|
|
|
5253
5259
|
continue;
|
|
5254
5260
|
}
|
|
5255
5261
|
if (isPureLocalCssImportWrapper(rootSource)) continue;
|
|
5256
|
-
const originSource = readAssetSource(originOutput);
|
|
5262
|
+
const originSource = readAssetSource$1(originOutput);
|
|
5257
5263
|
if (isPureLocalCssImportWrapper(originSource)) {
|
|
5258
5264
|
const importedFile = resolveSingleCssImportOutputFile(originFile, originSource);
|
|
5259
5265
|
if (importedFile && normalizeOutputPathKey(importedFile) !== normalizeOutputPathKey(rootFile)) continue;
|
|
@@ -7334,7 +7340,10 @@ function createGenerateBundleHook$1(context) {
|
|
|
7334
7340
|
})
|
|
7335
7341
|
});
|
|
7336
7342
|
return async function generateBundle(_opt, bundle) {
|
|
7337
|
-
if (context.shouldProcessBundle?.() === false)
|
|
7343
|
+
if (context.shouldProcessBundle?.() === false) {
|
|
7344
|
+
await context.onSkipProcessBundle?.();
|
|
7345
|
+
return;
|
|
7346
|
+
}
|
|
7338
7347
|
const processMarkupAndScripts = context.processMarkupAndScripts !== false;
|
|
7339
7348
|
const processStyles = context.shouldProcessStyles?.() ?? context.processStyles !== false;
|
|
7340
7349
|
const addWatchFile = (id) => this.addWatchFile?.(id);
|
|
@@ -8004,6 +8013,41 @@ function createGenerateBundleHook(context) {
|
|
|
8004
8013
|
};
|
|
8005
8014
|
}
|
|
8006
8015
|
//#endregion
|
|
8016
|
+
//#region src/bundlers/vite/shared/generic-web-production-fast-path.ts
|
|
8017
|
+
/**
|
|
8018
|
+
* Generic Web 生产构建的 CSS 已在 Vite transform 阶段生成时,不需要再建立面向小程序的完整产物快照。
|
|
8019
|
+
*/
|
|
8020
|
+
function shouldUseGenericWebProductionFastPath(options) {
|
|
8021
|
+
return options.frameworkName === "generic" && options.command === "build" && options.watch == null && options.isWebGeneratorTarget && options.hasProcessedCss;
|
|
8022
|
+
}
|
|
8023
|
+
/**
|
|
8024
|
+
* Finalizer fast path 只处理无小程序结构语义的 Generic Web 生产产物。
|
|
8025
|
+
*/
|
|
8026
|
+
function shouldUseGenericWebFinalizerFastPath(options) {
|
|
8027
|
+
return shouldUseGenericWebProductionFastPath(options) && !options.hasFrameworkRootImportShells && !options.isHarmonyAppStyleTarget && !options.isNativeAppStyleTarget;
|
|
8028
|
+
}
|
|
8029
|
+
/**
|
|
8030
|
+
* 将 Generic Web fast path 的判定和跳过生命周期集中起来,供 generateBundle hook 直接消费。
|
|
8031
|
+
*/
|
|
8032
|
+
function createGenericWebProductionBundleHooks(options) {
|
|
8033
|
+
return {
|
|
8034
|
+
onSkipProcessBundle: () => {
|
|
8035
|
+
options.onStart();
|
|
8036
|
+
options.onEnd();
|
|
8037
|
+
},
|
|
8038
|
+
shouldProcessBundle: () => {
|
|
8039
|
+
const config = options.getResolvedConfig();
|
|
8040
|
+
return !shouldUseGenericWebProductionFastPath({
|
|
8041
|
+
command: config?.command,
|
|
8042
|
+
frameworkName: options.frameworkName,
|
|
8043
|
+
hasProcessedCss: options.getHasProcessedCss(),
|
|
8044
|
+
isWebGeneratorTarget: options.getIsWebGeneratorTarget(),
|
|
8045
|
+
watch: config?.build?.watch
|
|
8046
|
+
});
|
|
8047
|
+
}
|
|
8048
|
+
};
|
|
8049
|
+
}
|
|
8050
|
+
//#endregion
|
|
8007
8051
|
//#region src/bundlers/vite/css-finalizer/options.ts
|
|
8008
8052
|
function inferPlatformFromViteOutDir(outDir) {
|
|
8009
8053
|
const segment = outDir ? path.basename(path.normalize(outDir)) : void 0;
|
|
@@ -8067,6 +8111,95 @@ function finalizeWebCss(css, context, cssPipelineStrategy) {
|
|
|
8067
8111
|
}) ?? (shouldApplyWebCssCompat ? defaultWebCssCompat(css) : css);
|
|
8068
8112
|
}
|
|
8069
8113
|
//#endregion
|
|
8114
|
+
//#region src/bundlers/vite/css-finalizer/generic-web-fast-path.ts
|
|
8115
|
+
function readAssetSource(asset) {
|
|
8116
|
+
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
8117
|
+
}
|
|
8118
|
+
function collectCssAssets(bundle, context) {
|
|
8119
|
+
const assets = /* @__PURE__ */ new Map();
|
|
8120
|
+
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
8121
|
+
if (output.type !== "asset") continue;
|
|
8122
|
+
const file = output.fileName || bundleFile;
|
|
8123
|
+
if (!context.opts.cssMatcher(file) || context.opts.htmlMatcher(file)) continue;
|
|
8124
|
+
assets.set(normalizeOutputPathKey(file), {
|
|
8125
|
+
asset: output,
|
|
8126
|
+
file,
|
|
8127
|
+
original: readAssetSource(output)
|
|
8128
|
+
});
|
|
8129
|
+
}
|
|
8130
|
+
return assets;
|
|
8131
|
+
}
|
|
8132
|
+
function resolveProcessedCssOutputFile(file, options, bundleFiles) {
|
|
8133
|
+
return resolveViteCssPipelineOutputFile(file, options.context.opts, options.rootDir, true, false, options.sourceRoot, ".css", bundleFiles);
|
|
8134
|
+
}
|
|
8135
|
+
function resolveProcessedCssAssets(cssAssets, records, options, bundleFiles) {
|
|
8136
|
+
const assetBySourceFile = /* @__PURE__ */ new Map();
|
|
8137
|
+
for (const output of cssAssets.values()) {
|
|
8138
|
+
const identity = options.context.resolveCssAssetIdentity?.(output.asset, output.file);
|
|
8139
|
+
if (identity?.kind === "bundler-generated" && identity.sourceFile) assetBySourceFile.set(normalizeOutputPathKey(identity.sourceFile), output);
|
|
8140
|
+
for (const sourceFile of collectMatchingGeneratedCssMarkerFiles(output.file, output.original, (file) => resolveProcessedCssOutputFile(file, options, bundleFiles))) assetBySourceFile.set(normalizeOutputPathKey(sourceFile), output);
|
|
8141
|
+
}
|
|
8142
|
+
const processedAssets = /* @__PURE__ */ new Map();
|
|
8143
|
+
const htmlOwnedAssets = [...cssAssets.values()].filter((output) => [output.asset.originalFileName, ...output.asset.originalFileNames ?? []].some((file) => typeof file === "string" && /\.html(?:$|[?#])/i.test(file)));
|
|
8144
|
+
for (const [file, record] of records) {
|
|
8145
|
+
const recordCss = typeof record === "string" ? record : record.css;
|
|
8146
|
+
const outputFile = typeof record === "string" ? resolveProcessedCssOutputFile(file, options, bundleFiles) : record.outputFile ?? resolveProcessedCssOutputFile(file, options, bundleFiles);
|
|
8147
|
+
let output = assetBySourceFile.get(normalizeOutputPathKey(file)) ?? (outputFile ? cssAssets.get(normalizeOutputPathKey(outputFile)) : void 0);
|
|
8148
|
+
if (!output) {
|
|
8149
|
+
const matchingAssets = [...cssAssets.values()].filter((candidate) => options.context.isCssAssetProcessed(candidate.asset, candidate.file) && resolveViteProcessedCssAssetSource(candidate.file, candidate.original, (sourceFile) => resolveProcessedCssOutputFile(sourceFile, options, bundleFiles)) === recordCss);
|
|
8150
|
+
if (matchingAssets.length === 1) output = matchingAssets[0];
|
|
8151
|
+
}
|
|
8152
|
+
if (!output && records.length === 1 && htmlOwnedAssets.length === 1) output = htmlOwnedAssets[0];
|
|
8153
|
+
if (!output) return;
|
|
8154
|
+
const existingCss = processedAssets.get(output);
|
|
8155
|
+
if (existingCss !== void 0 && existingCss !== recordCss) return;
|
|
8156
|
+
processedAssets.set(output, recordCss);
|
|
8157
|
+
}
|
|
8158
|
+
return processedAssets;
|
|
8159
|
+
}
|
|
8160
|
+
/**
|
|
8161
|
+
* Generic Web 的 transform 结果能唯一映射到最终 CSS asset 时,只做一次 marker 清理和 Web 兼容收尾。
|
|
8162
|
+
*/
|
|
8163
|
+
function tryFinalizeGenericWebCss(options) {
|
|
8164
|
+
const { bundle, context } = options;
|
|
8165
|
+
const resolvedConfig = context.getResolvedConfig();
|
|
8166
|
+
const collectStartedAt = performance.now();
|
|
8167
|
+
const processedCssResults = [...context.getViteProcessedCssAssetResults?.() ?? []];
|
|
8168
|
+
if (!shouldUseGenericWebFinalizerFastPath({
|
|
8169
|
+
command: resolvedConfig?.command,
|
|
8170
|
+
frameworkName: context.frameworkName ?? "",
|
|
8171
|
+
hasFrameworkRootImportShells: (context.frameworkRootImportShellTargetByFile?.size ?? 0) > 0,
|
|
8172
|
+
hasProcessedCss: processedCssResults.length > 0,
|
|
8173
|
+
isHarmonyAppStyleTarget: options.isHarmonyAppStyleTarget,
|
|
8174
|
+
isNativeAppStyleTarget: options.isNativeAppStyleTarget,
|
|
8175
|
+
isWebGeneratorTarget: options.isWebGeneratorTarget,
|
|
8176
|
+
watch: resolvedConfig?.build?.watch
|
|
8177
|
+
})) return false;
|
|
8178
|
+
const enumerateStartedAt = performance.now();
|
|
8179
|
+
const cssAssets = collectCssAssets(bundle, context);
|
|
8180
|
+
const bundleFiles = [...cssAssets.values()].map((item) => item.file);
|
|
8181
|
+
options.recordTiming("assets.enumerate", enumerateStartedAt);
|
|
8182
|
+
const processedAssets = resolveProcessedCssAssets(cssAssets, processedCssResults, options, bundleFiles);
|
|
8183
|
+
options.recordTiming("processedCss.collect", collectStartedAt);
|
|
8184
|
+
if (!processedAssets) return false;
|
|
8185
|
+
const writeStartedAt = performance.now();
|
|
8186
|
+
for (const [{ asset, file, original }, processedCss] of processedAssets) {
|
|
8187
|
+
const finalizeStartedAt = performance.now();
|
|
8188
|
+
const generated = finalizeWebCss(stripBundlerGeneratedCssMarkers(processedCss), {
|
|
8189
|
+
...options.createCssPipelineContext(file),
|
|
8190
|
+
file
|
|
8191
|
+
}, context.cssPipelineStrategy);
|
|
8192
|
+
options.recordTiming("finalizeWebCss", finalizeStartedAt);
|
|
8193
|
+
asset.source = generated;
|
|
8194
|
+
context.markCssAssetProcessed(asset, file);
|
|
8195
|
+
context.recordCssAssetResult?.(file, generated);
|
|
8196
|
+
if (generated !== original) context.opts.onUpdate(file, original, generated);
|
|
8197
|
+
}
|
|
8198
|
+
options.recordTiming("processedCss.inject", performance.now());
|
|
8199
|
+
options.recordTiming("assets.markerCleanupWrite", writeStartedAt);
|
|
8200
|
+
return true;
|
|
8201
|
+
}
|
|
8202
|
+
//#endregion
|
|
8070
8203
|
//#region src/bundlers/vite/css-finalizer/plugin.ts
|
|
8071
8204
|
function createViteCssFinalizerOutputPlugin(context) {
|
|
8072
8205
|
return {
|
|
@@ -8109,12 +8242,45 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8109
8242
|
resolvedConfig,
|
|
8110
8243
|
resolveStylePlatform: () => generatorPlatform
|
|
8111
8244
|
});
|
|
8245
|
+
const timingDetails = {};
|
|
8246
|
+
const recordTiming = (phase, startedAt) => {
|
|
8247
|
+
timingDetails[phase] = (timingDetails[phase] ?? 0) + Math.max(0, performance.now() - startedAt);
|
|
8248
|
+
};
|
|
8249
|
+
const finishTiming = () => {
|
|
8250
|
+
context.hmrTimingRecorder?.record("cssFinalizer", performance.now() - finalizerStartedAt, { timingDetails });
|
|
8251
|
+
context.hmrTimingRecorder?.emitTotal();
|
|
8252
|
+
};
|
|
8253
|
+
const finalizeWebCssAsset = (css, file) => {
|
|
8254
|
+
const startedAt = performance.now();
|
|
8255
|
+
const finalized = finalizeWebCss(css, {
|
|
8256
|
+
...createCssPipelineContext(file),
|
|
8257
|
+
file
|
|
8258
|
+
}, cssPipelineStrategy);
|
|
8259
|
+
recordTiming("finalizeWebCss", startedAt);
|
|
8260
|
+
return finalized;
|
|
8261
|
+
};
|
|
8112
8262
|
const isHarmonyAppStyleTarget = cssPipelineStrategy?.isHarmonyAppStyleTarget?.(createCssPipelineContext("")) === true;
|
|
8113
8263
|
const isNativeAppStyleTarget = cssPipelineStrategy?.isNativeAppStyleTarget?.(createCssPipelineContext("")) === true;
|
|
8114
8264
|
if (resolvedConfig?.command !== "build" && !isNativeAppStyleTarget) return;
|
|
8115
8265
|
const rootDir = resolvedConfig?.root ? path.resolve(resolvedConfig.root) : process$1.cwd();
|
|
8116
8266
|
const outDir = resolvedConfig?.build?.outDir ? path.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
8117
8267
|
const sourceRoot = resolveWeappViteSourceRoot(resolvedConfig, opts.appType) ?? resolveSourceRootFromBundleGraph(resolvedConfig, bundle);
|
|
8268
|
+
const finalizerStartedAt = performance.now();
|
|
8269
|
+
if (tryFinalizeGenericWebCss({
|
|
8270
|
+
bundle,
|
|
8271
|
+
context,
|
|
8272
|
+
createCssPipelineContext,
|
|
8273
|
+
isHarmonyAppStyleTarget,
|
|
8274
|
+
isNativeAppStyleTarget,
|
|
8275
|
+
isWebGeneratorTarget,
|
|
8276
|
+
recordTiming,
|
|
8277
|
+
rootDir,
|
|
8278
|
+
sourceRoot
|
|
8279
|
+
})) {
|
|
8280
|
+
finalizeCompilerShadowRun(runtimeState);
|
|
8281
|
+
finishTiming();
|
|
8282
|
+
return;
|
|
8283
|
+
}
|
|
8118
8284
|
const finalCssAssetFiles = /* @__PURE__ */ new Set();
|
|
8119
8285
|
const trackFinalCssAssetUpdate = (file, original, generated) => {
|
|
8120
8286
|
finalCssAssetFiles.add(file);
|
|
@@ -8139,6 +8305,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8139
8305
|
tokenSources: sourceTraceTokenSources
|
|
8140
8306
|
});
|
|
8141
8307
|
const collectViteProcessedCssAssets = () => {
|
|
8308
|
+
const startedAt = performance.now();
|
|
8142
8309
|
collectViteProcessedCssAssetResults(bundle, {
|
|
8143
8310
|
opts,
|
|
8144
8311
|
cssPipelineStrategy,
|
|
@@ -8149,28 +8316,26 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8149
8316
|
recordViteProcessedCssAssetResult,
|
|
8150
8317
|
onAssetWrite: (file) => finalCssAssetFiles.add(file),
|
|
8151
8318
|
resolveViteProcessedCssOutputFile: (file) => resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget, isNativeAppStyleTarget, sourceRoot, resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) }), Object.keys(bundle)),
|
|
8152
|
-
transformCss:
|
|
8153
|
-
...createCssPipelineContext(file),
|
|
8154
|
-
file
|
|
8155
|
-
}, cssPipelineStrategy),
|
|
8319
|
+
transformCss: finalizeWebCssAsset,
|
|
8156
8320
|
debug
|
|
8157
8321
|
});
|
|
8322
|
+
recordTiming("processedCss.collect", startedAt);
|
|
8158
8323
|
};
|
|
8159
8324
|
const injectViteProcessedCssIntoMainCss = () => {
|
|
8160
|
-
|
|
8325
|
+
const startedAt = performance.now();
|
|
8326
|
+
const injected = injectViteProcessedCssIntoMainCssAssets(bundle, {
|
|
8161
8327
|
opts,
|
|
8162
8328
|
cssPipelineStrategy,
|
|
8163
8329
|
createCssPipelineContext,
|
|
8164
8330
|
getViteProcessedCssAssetResults,
|
|
8165
8331
|
markCssAssetProcessed,
|
|
8166
8332
|
recordCssAssetResult,
|
|
8167
|
-
transformCss:
|
|
8168
|
-
...createCssPipelineContext(file),
|
|
8169
|
-
file
|
|
8170
|
-
}, cssPipelineStrategy),
|
|
8333
|
+
transformCss: finalizeWebCssAsset,
|
|
8171
8334
|
debug,
|
|
8172
8335
|
onUpdate: trackFinalCssAssetUpdate
|
|
8173
8336
|
});
|
|
8337
|
+
recordTiming("processedCss.inject", startedAt);
|
|
8338
|
+
return injected;
|
|
8174
8339
|
};
|
|
8175
8340
|
collectViteProcessedCssAssets();
|
|
8176
8341
|
const createHarmonyBundleStyleSources = async () => {
|
|
@@ -8213,7 +8378,9 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8213
8378
|
const fileName = output.fileName || bundleFile;
|
|
8214
8379
|
return output.type === "asset" && opts.cssMatcher(fileName) && !opts.htmlMatcher(fileName) && !isHTMLRequest(fileName) && !isCssAssetProcessed(output, fileName);
|
|
8215
8380
|
};
|
|
8381
|
+
const enumerateStartedAt = performance.now();
|
|
8216
8382
|
const entries = Object.entries(bundle).filter(isCssOutputAssetEntry);
|
|
8383
|
+
recordTiming("assets.enumerate", enumerateStartedAt);
|
|
8217
8384
|
if (entries.length === 0) {
|
|
8218
8385
|
await injectHarmonyBundleStyles(getRecordedGeneratorCandidates?.() ?? getSourceCandidates?.() ?? await ensureRuntimeClassSet());
|
|
8219
8386
|
collectViteProcessedCssAssets();
|
|
@@ -8234,6 +8401,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8234
8401
|
recordCssAssetResult
|
|
8235
8402
|
});
|
|
8236
8403
|
finalizeCompilerShadowRun(runtimeState);
|
|
8404
|
+
finishTiming();
|
|
8237
8405
|
return;
|
|
8238
8406
|
}
|
|
8239
8407
|
await runtimeState.readyPromise;
|
|
@@ -8257,10 +8425,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8257
8425
|
...createCssPipelineContext(file),
|
|
8258
8426
|
file
|
|
8259
8427
|
}) ?? {});
|
|
8260
|
-
const nextCss = annotateCss(generatorBranch.isWeb ?
|
|
8261
|
-
...createCssPipelineContext(file),
|
|
8262
|
-
file
|
|
8263
|
-
}, cssPipelineStrategy) : (await opts.styleHandler(cleanRawSource, cssHandlerOptions)).css);
|
|
8428
|
+
const nextCss = annotateCss(generatorBranch.isWeb ? finalizeWebCssAsset(cleanRawSource, file) : (await opts.styleHandler(cleanRawSource, cssHandlerOptions)).css);
|
|
8264
8429
|
writeCssAsset(file, output, nextCss);
|
|
8265
8430
|
markCssAssetProcessed(output, file);
|
|
8266
8431
|
recordCssAssetResult?.(file, nextCss);
|
|
@@ -8324,10 +8489,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8324
8489
|
debug("css finalizer preserve mini-program import shell: %s", file);
|
|
8325
8490
|
return;
|
|
8326
8491
|
}
|
|
8327
|
-
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ?
|
|
8328
|
-
...createCssPipelineContext(file),
|
|
8329
|
-
file
|
|
8330
|
-
}, cssPipelineStrategy) : (await opts.styleHandler(generatorTransformRawSource, cssHandlerOptions)).css));
|
|
8492
|
+
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ? finalizeWebCssAsset(cleanRawSource, file) : (await opts.styleHandler(generatorTransformRawSource, cssHandlerOptions)).css));
|
|
8331
8493
|
if (generated) {
|
|
8332
8494
|
registerGeneratorDependencies(this, generated.dependencies);
|
|
8333
8495
|
debug("css finalizer generated result: %s bytes=%d", file, nextCss.length);
|
|
@@ -8339,6 +8501,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8339
8501
|
opts.onUpdate(file, rawSource, nextCss);
|
|
8340
8502
|
debug("css finalizer handle: %s", file);
|
|
8341
8503
|
}));
|
|
8504
|
+
const writeStartedAt = performance.now();
|
|
8342
8505
|
applyViteAssetEmissionPlan(emissionPlan, {
|
|
8343
8506
|
bundle,
|
|
8344
8507
|
writeTargets
|
|
@@ -8362,6 +8525,8 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8362
8525
|
recordCssAssetResult
|
|
8363
8526
|
});
|
|
8364
8527
|
finalizeCompilerShadowRun(runtimeState);
|
|
8528
|
+
recordTiming("assets.write", writeStartedAt);
|
|
8529
|
+
finishTiming();
|
|
8365
8530
|
}
|
|
8366
8531
|
}
|
|
8367
8532
|
};
|
|
@@ -9455,7 +9620,10 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9455
9620
|
if (!options.sourceScanSession.matches(file)) {
|
|
9456
9621
|
options.sourceCandidateCollector.remove(file);
|
|
9457
9622
|
options.sourceScanSession.cacheCurrent();
|
|
9458
|
-
return
|
|
9623
|
+
return shouldReturnTransformedCode ? {
|
|
9624
|
+
code: transformedCode,
|
|
9625
|
+
map: null
|
|
9626
|
+
} : void 0;
|
|
9459
9627
|
}
|
|
9460
9628
|
await options.sourceCandidateCollector.merge(id, transformedCode);
|
|
9461
9629
|
options.sourceScanSession.cacheCurrent();
|
|
@@ -9654,9 +9822,12 @@ function createFrameworkSourceScanSession(options) {
|
|
|
9654
9822
|
});
|
|
9655
9823
|
sourceScanEntries = sourceScan?.entries;
|
|
9656
9824
|
sourceScanExplicit = sourceScan?.explicit ?? false;
|
|
9657
|
-
sourceScanMatcher = createSourceScanMatcher(sourceScanEntries);
|
|
9658
9825
|
sourceScanDependencies = new Set((sourceScan?.dependencies ?? []).map(normalizeDependency));
|
|
9659
9826
|
const roots = collectRoots(root, sourceScanEntries);
|
|
9827
|
+
sourceScanMatcher = createSourceCandidateEligibilityMatcher(roots.map((scanRoot) => ({
|
|
9828
|
+
...scanRoot,
|
|
9829
|
+
outDir
|
|
9830
|
+
})));
|
|
9660
9831
|
const nextScanSignature = createSourceCandidateScanSignature({
|
|
9661
9832
|
inlineCandidates: sourceScan?.inlineCandidates,
|
|
9662
9833
|
outDir,
|
|
@@ -10401,6 +10572,14 @@ ${tracedCss}`;
|
|
|
10401
10572
|
});
|
|
10402
10573
|
const generateBundleHook = createGenerateBundleHook({
|
|
10403
10574
|
...generateBundleContext,
|
|
10575
|
+
...createGenericWebProductionBundleHooks({
|
|
10576
|
+
frameworkName: frameworkBranch.frameworkName,
|
|
10577
|
+
getHasProcessedCss: () => processedCssRegistry.getStats().viteProcessedCssAssetResults > 0,
|
|
10578
|
+
getIsWebGeneratorTarget: () => resolveCurrentGeneratorBranch().isWeb,
|
|
10579
|
+
getResolvedConfig,
|
|
10580
|
+
onEnd: opts.onEnd,
|
|
10581
|
+
onStart: opts.onStart
|
|
10582
|
+
}),
|
|
10404
10583
|
shouldProcessStyles: () => !shouldSplitGenerateBundlePhases()
|
|
10405
10584
|
});
|
|
10406
10585
|
const cssFinalizerOutputPlugin = createViteCssFinalizerOutputPlugin({
|
|
@@ -10409,10 +10588,13 @@ ${tracedCss}`;
|
|
|
10409
10588
|
ensureRuntimeClassSet,
|
|
10410
10589
|
cssPipelineStrategy: frameworkCssPipelineStrategy,
|
|
10411
10590
|
debug,
|
|
10591
|
+
frameworkName: frameworkBranch.frameworkName,
|
|
10412
10592
|
getResolvedConfig,
|
|
10593
|
+
hmrTimingRecorder,
|
|
10413
10594
|
markCssAssetProcessed,
|
|
10414
10595
|
isCssAssetProcessed,
|
|
10415
10596
|
isViteProcessedCssAsset,
|
|
10597
|
+
resolveCssAssetIdentity,
|
|
10416
10598
|
recordCssAssetResult,
|
|
10417
10599
|
recordViteProcessedCssAssetResult,
|
|
10418
10600
|
getViteProcessedCssAssetResults,
|