weapp-tailwindcss 5.5.8 → 5.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundlers/vite/css-calc-stage.d.ts +8 -0
- package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer/css-scope-graph.d.ts +5 -0
- package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +1 -1
- package/dist/bundlers/vite/css-finalizer/options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-cache-task.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-result.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +3 -3
- package/dist/bundlers/vite/generate-bundle/scoped-generator-runtime-cache.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator-sources.d.ts +36 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +6 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/source-trace.d.ts +2 -0
- package/dist/bundlers/vite/runtime-class-set/cache.d.ts +14 -0
- package/dist/bundlers/vite/runtime-class-set/invalidation-plugin.d.ts +6 -0
- package/dist/bundlers/vite/runtime-class-set/lifecycle.d.ts +12 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +1 -0
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +1 -2
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +1 -0
- package/dist/{compiler-DbwS3329.cjs → compiler-TvqqdOMD.cjs} +50 -38
- package/dist/{compiler-CThodfGH.js → compiler-v9sYta8W.js} +35 -30
- package/dist/core/compiler/generation-cache.d.ts +4 -2
- package/dist/core/compiler/root-store.d.ts +1 -1
- package/dist/core/compiler/source.d.ts +7 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{scoped-generator-DlQrVbuC.js → css-cleanup-B3xP5Qph.js} +26 -23
- package/dist/{generated-css-marker-B0RyziOH.cjs → generated-css-marker-nqjR6ntO.cjs} +102 -26
- package/dist/generation/pipeline/style-context.d.ts +3 -0
- package/dist/{generator-CxauQbx3.cjs → generator-B1sYQpWu.cjs} +165 -90
- package/dist/{generator-oKZ5mCJ5.js → generator-LqofzXgr.js} +155 -92
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-DhddVxGA.js → gulp-BCV0gOMb.js} +4 -4
- package/dist/{gulp-CngHA9cU.cjs → gulp-DrX6QS3N.cjs} +5 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-Dc4c1VRg.cjs → hmr-timing-B56wp7y-.cjs} +4 -4
- package/dist/{hmr-timing-xPpat-km.js → hmr-timing-Bb54exB0.js} +102 -26
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-EUud9R2K.cjs → pipeline-helpers-DJ3VZ01J.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/project-sources/candidates/view-memo.d.ts +7 -0
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{scoped-generator-lbTwL6mD.cjs → scoped-generator-DqNb8nJG.cjs} +31 -24
- package/dist/{source-candidate-scan-signature-BjVQYL-C.js → source-candidate-scan-signature-BWLf4tuO.js} +2 -2
- package/dist/{source-candidate-scan-signature-nG-rg809.cjs → source-candidate-scan-signature-_ohG0ePd.cjs} +2 -2
- package/dist/tailwindcss/v4/rpx-theme-warning.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/raw-generation.d.ts +30 -0
- package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +3 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +2 -0
- package/dist/{tailwindcss-kSd0ykiX.js → tailwindcss-XNfJSlhp.js} +2 -2
- package/dist/{tailwindcss-U3KIUegn.cjs → tailwindcss-uf04Iolj.cjs} +2 -2
- package/dist/{transform-DVg4q8hh.cjs → transform-CxVM0PfA.cjs} +3 -3
- package/dist/{transform-BAon9ykq.js → transform-D0NXKPmD.js} +3 -3
- package/dist/utils/stable-serialize.d.ts +1 -0
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-IX83wh_L.cjs → vite-C3Zh6iYK.cjs} +434 -209
- package/dist/{vite-D-RGkmOE.js → vite-D6_FxvdM.js} +434 -209
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +5 -5
- package/dist/{web-DHfZ_KC9.cjs → web-BzeWG_XO.cjs} +442 -155
- package/dist/{web--kA4HUTm.js → web-K3qAX4sN.js} +431 -156
- package/dist/{webpack-Bhkd27Rs.js → webpack-BZBqKB4Y.js} +6 -6
- package/dist/{webpack-BetjemzT.cjs → webpack-Dbj2uykF.cjs} +8 -8
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +5 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
4
4
|
require("./utils-CuKLf1Zv.cjs");
|
|
5
|
-
const require_compiler = require("./compiler-
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_generated_css_marker = require("./generated-css-marker-
|
|
5
|
+
const require_compiler = require("./compiler-TvqqdOMD.cjs");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-uf04Iolj.cjs");
|
|
7
|
+
const require_generated_css_marker = require("./generated-css-marker-nqjR6ntO.cjs");
|
|
8
8
|
const require_cache = require("./cache-CzvIGfwS.cjs");
|
|
9
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-B56wp7y-.cjs");
|
|
10
10
|
require("./final-css-cleanup-B6FUJC3z.cjs");
|
|
11
|
-
const require_scoped_generator = require("./scoped-generator-
|
|
12
|
-
const require_web = require("./web-
|
|
13
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
11
|
+
const require_scoped_generator = require("./scoped-generator-DqNb8nJG.cjs");
|
|
12
|
+
const require_web = require("./web-BzeWG_XO.cjs");
|
|
13
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-_ohG0ePd.cjs");
|
|
14
14
|
require("./css-cleanup-B6FUJC3z.cjs");
|
|
15
15
|
require("./logger-TlKT3xmR.cjs");
|
|
16
16
|
let node_fs = require("node:fs");
|
|
@@ -22,6 +22,7 @@ node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
|
22
22
|
let _weapp_tailwindcss_engine = require("@weapp-tailwindcss/engine");
|
|
23
23
|
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
24
24
|
let lru_cache = require("lru-cache");
|
|
25
|
+
let _weapp_tailwindcss_source_scan = require("@weapp-tailwindcss/source-scan");
|
|
25
26
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
26
27
|
let node_buffer = require("node:buffer");
|
|
27
28
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1605,7 +1606,7 @@ async function collectBundleMarkupCandidates(options) {
|
|
|
1605
1606
|
const valuesForEntries = (entries, filterOptions = {}) => {
|
|
1606
1607
|
const values = /* @__PURE__ */ new Set();
|
|
1607
1608
|
for (const { sourceFile: file, candidates } of candidatesByFile.values()) {
|
|
1608
|
-
if (entries !== void 0 && !(0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(file, entries)) continue;
|
|
1609
|
+
if (entries !== void 0 && (entries.length === 0 || !(0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(file, entries))) continue;
|
|
1609
1610
|
if (filterOptions.excludeEntries?.length && (0, require_tailwindcss.source_scan_exports.isFileMatchedByTailwindSourceEntries)(file, filterOptions.excludeEntries)) continue;
|
|
1610
1611
|
for (const candidate of candidates) values.add(candidate);
|
|
1611
1612
|
}
|
|
@@ -1720,6 +1721,7 @@ function pruneLastCssResults(resultByFile, sourceHashByFile, activeFiles) {
|
|
|
1720
1721
|
//#region src/bundlers/vite/generate-bundle/css-cache-task.ts
|
|
1721
1722
|
function applyViteCssCacheResult(options, source) {
|
|
1722
1723
|
options.applyCssResult(source);
|
|
1724
|
+
options.recordCssResult?.(source);
|
|
1723
1725
|
rememberLastCssResult(options.lastCssResultByFile, options.lastCssSourceHashByFile, options.outputFile, source, options.cssRuntimeAffectingHash);
|
|
1724
1726
|
options.markCssAssetProcessed?.(options.originalSource, options.outputFile);
|
|
1725
1727
|
if (options.rememberedSourcesCount <= 1) options.rememberCssSource?.({
|
|
@@ -1834,6 +1836,47 @@ function collectRememberedCssReplayGroups(sources, opts, rootDir, isWebGenerator
|
|
|
1834
1836
|
return groups;
|
|
1835
1837
|
}
|
|
1836
1838
|
//#endregion
|
|
1839
|
+
//#region src/bundlers/vite/generate-bundle/source-trace.ts
|
|
1840
|
+
/** 来源标注沿用各入口的扫描目录,合并时保留同一候选的全部文件。 */
|
|
1841
|
+
async function createMergedCssSourceTraceMap(sources, resolve) {
|
|
1842
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1843
|
+
for (const map of await Promise.all(sources.map(resolve))) for (const [candidate, files] of map ?? []) {
|
|
1844
|
+
const existing = merged.get(candidate) ?? /* @__PURE__ */ new Set();
|
|
1845
|
+
for (const file of files) existing.add(file);
|
|
1846
|
+
merged.set(candidate, existing);
|
|
1847
|
+
}
|
|
1848
|
+
return merged;
|
|
1849
|
+
}
|
|
1850
|
+
//#endregion
|
|
1851
|
+
//#region src/bundlers/vite/generate-bundle/scoped-generator-sources.ts
|
|
1852
|
+
function hasScopedSourceDirectives(sources) {
|
|
1853
|
+
return sources.length > 1 && sources.some((source) => require_scoped_generator.hasOwnSourceDirectives(source.rawSource, true));
|
|
1854
|
+
}
|
|
1855
|
+
function getSignatureSources(rememberedCssSources, generatorRawSource, generatorSourceFile) {
|
|
1856
|
+
return hasScopedSourceDirectives(rememberedCssSources) ? rememberedCssSources : [{
|
|
1857
|
+
rawSource: generatorRawSource,
|
|
1858
|
+
sourceFile: generatorSourceFile
|
|
1859
|
+
}];
|
|
1860
|
+
}
|
|
1861
|
+
async function createScopedGeneratorSourceData(options) {
|
|
1862
|
+
const { createScopedGeneratorRuntime, createScopedGeneratorSourceTraceMap, generatorCssHandlerOptions, generatorRawSource, generatorRuntime, generatorSourceFile, rememberedCssSources, scopedSourceCandidateSourceGetter, outputFile } = options;
|
|
1863
|
+
const signatureSources = getSignatureSources(rememberedCssSources, generatorRawSource, generatorSourceFile);
|
|
1864
|
+
const sourceTraceSources = scopedSourceCandidateSourceGetter ? signatureSources.length > 1 ? await createMergedCssSourceTraceMap(signatureSources, (source) => createScopedGeneratorSourceTraceMap(source.rawSource, source.sourceFile, { scopeToSource: true })) : await createScopedGeneratorSourceTraceMap(generatorRawSource, generatorSourceFile, { scopeToSource: hasScopedSourceDirectives(rememberedCssSources) }) : void 0;
|
|
1865
|
+
return {
|
|
1866
|
+
scopedGeneratorRuntime: hasScopedSourceDirectives(rememberedCssSources) ? new Set((await Promise.all(rememberedCssSources.map((source) => createScopedGeneratorRuntime(outputFile, generatorCssHandlerOptions, generatorRuntime, source.rawSource, source.sourceFile, true)))).flatMap((candidates) => [...candidates])) : await createScopedGeneratorRuntime(outputFile, generatorCssHandlerOptions, generatorRuntime, generatorRawSource, generatorSourceFile),
|
|
1867
|
+
signatureSources,
|
|
1868
|
+
sourceTraceSources
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
async function createScopedGeneratorCandidateSignatureForSources(options) {
|
|
1872
|
+
const { createScopedGeneratorCandidateSignature, generatorCssHandlerOptions, majorVersion, scopedSourceCandidateGetter, signatureSources, trackedGeneratorCandidateSignature } = options;
|
|
1873
|
+
return JSON.stringify(await Promise.all(signatureSources.map(async (source) => [source.sourceFile, await createScopedGeneratorCandidateSignature(source.rawSource, source.sourceFile, trackedGeneratorCandidateSignature, scopedSourceCandidateGetter, {
|
|
1874
|
+
includeFallbackSignature: generatorCssHandlerOptions.isMainChunk,
|
|
1875
|
+
majorVersion,
|
|
1876
|
+
scopeToSource: true
|
|
1877
|
+
})])));
|
|
1878
|
+
}
|
|
1879
|
+
//#endregion
|
|
1837
1880
|
//#region src/bundlers/vite/generate-bundle/css-composition-plan.ts
|
|
1838
1881
|
function resolveViteCssCompositionPlan(options) {
|
|
1839
1882
|
const rememberedSources = options.rememberedSources.filter((source) => !options.shouldSkipRememberedSource(source));
|
|
@@ -1878,6 +1921,7 @@ function resolveViteCssCompositionPlan(options) {
|
|
|
1878
1921
|
const isExplicitGeneratorCssEntry = options.explicitSourceFileKeys.has(generatorSourceFileKey);
|
|
1879
1922
|
const shouldUsePipelineSourceAsCssEntry = !isExplicitGeneratorCssEntry && vitePipelineCssAsset && options.cssMatcher(generatorSourceFile) && require_web.hasTailwindGenerationSource(generatorRawSource);
|
|
1880
1923
|
const generatorCssEntries = isExplicitGeneratorCssEntry || shouldUsePipelineSourceAsCssEntry ? [generatorSourceFile] : options.cssEntries;
|
|
1924
|
+
const hasScopedSources = hasScopedSourceDirectives(rememberedSources);
|
|
1881
1925
|
return {
|
|
1882
1926
|
cssHandlerOptions,
|
|
1883
1927
|
generatorCssHandlerOptions: {
|
|
@@ -1885,7 +1929,12 @@ function resolveViteCssCompositionPlan(options) {
|
|
|
1885
1929
|
sourceOptions: {
|
|
1886
1930
|
...cssHandlerOptions.sourceOptions,
|
|
1887
1931
|
sourceFile: generatorSourceFile,
|
|
1888
|
-
cssEntries: generatorCssEntries
|
|
1932
|
+
cssEntries: hasScopedSources ? rememberedSources.map((source) => source.sourceFile) : generatorCssEntries,
|
|
1933
|
+
...hasScopedSources ? { cssSources: rememberedSources.map((source) => ({
|
|
1934
|
+
file: source.sourceFile,
|
|
1935
|
+
base: (0, _weapp_tailwindcss_source_scan.sourcePathApi)(source.sourceFile).dirname(source.sourceFile),
|
|
1936
|
+
css: source.rawSource
|
|
1937
|
+
})) } : {}
|
|
1889
1938
|
}
|
|
1890
1939
|
},
|
|
1891
1940
|
generatorRawSource,
|
|
@@ -2015,6 +2064,33 @@ function normalizeRelativeCssConfigDirectives(source, file, outputRoot, opts) {
|
|
|
2015
2064
|
});
|
|
2016
2065
|
}
|
|
2017
2066
|
//#endregion
|
|
2067
|
+
//#region src/bundlers/vite/generate-bundle/css-transform-result.ts
|
|
2068
|
+
function applyViteCssTransformTaskResult(options) {
|
|
2069
|
+
const { result } = options;
|
|
2070
|
+
registerGeneratorDependencies({ addWatchFile: options.addWatchFile }, result.dependencies);
|
|
2071
|
+
if (options.debugCssDiff && result.diffSource != null) options.debug("css diff %s: %s", options.generatorSourceFile, require_scoped_generator.summarizeStringDiff(result.diffSource, result.css));
|
|
2072
|
+
if (result.shouldRecordCssAsset) options.recordCssAssetResult?.(options.outputFile, result.css);
|
|
2073
|
+
if (result.kind === "tailwind") {
|
|
2074
|
+
options.debug("css generated result: %s bytes=%d", options.file, result.css.length);
|
|
2075
|
+
for (const candidate of result.classSet ?? []) options.transformRuntime.add(candidate);
|
|
2076
|
+
recordViteCssContribution(options, result.css);
|
|
2077
|
+
options.debug("css handle via tailwind v%s engine(%s): %s", options.tailwindcssMajorVersion, result.generatorTarget, options.outputFile);
|
|
2078
|
+
} else if (result.kind === "web") options.debug("css preserve web target: %s", options.outputFile);
|
|
2079
|
+
else if (result.kind === "import-shell") options.debug("css preserve mini-program import shell: %s", options.outputFile);
|
|
2080
|
+
return result.css;
|
|
2081
|
+
}
|
|
2082
|
+
/** 新生成与缓存回放共同提交样式贡献,避免回滚后注入记录仍指向上一轮。 */
|
|
2083
|
+
function recordViteCssContribution(options, css) {
|
|
2084
|
+
if (options.shouldRecordVitePipelineCssByOutput) options.recordViteProcessedCssAssetResult?.(options.vitePipelineCssInjectionOutputFile, css, {
|
|
2085
|
+
injectIntoMain: options.outputIsMainChunk ? false : options.shouldInjectVitePipelineCssIntoMain,
|
|
2086
|
+
outputFile: options.vitePipelineCssInjectionOutputFile
|
|
2087
|
+
});
|
|
2088
|
+
if (options.vitePipelineCssAsset && options.shouldInjectVitePipelineCssIntoMain) options.recordViteProcessedCssAssetResult?.(options.file, css, {
|
|
2089
|
+
injectIntoMain: true,
|
|
2090
|
+
outputFile: options.vitePipelineCssInjectionOutputFile
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
//#endregion
|
|
2018
2094
|
//#region src/bundlers/vite/generate-bundle/transform-scheduling.ts
|
|
2019
2095
|
function scheduleViteCssTransform(options) {
|
|
2020
2096
|
const { addWatchFile, annotateCss, applyCssResult, applyViteCssCacheResult, applyViteCssTransformTaskResult, assetSourceFile, cache, cssCacheKey, cssHandlerOptions, cssHashKey, cssRuntimeAffectingHash, cssSharedCacheKey, cssTaskFactories, cssTaskHash, debug, envFlags, executeViteCssTransformTask, file, generatorCandidatesChanged, generatorCssHandlerOptions, generatorCssUserHandlerOptions, generatorPlatform, generatorRawSource, generatorSourceFile, generatorUserLayerRawSource, getLastCssResult, hasRuntimeAffectingChanges, isWebGeneratorTarget, lastCssResultByFile, lastCssSourceHashByFile, markCssAssetProcessed, measureElapsed, metrics, normalizeGeneratorUserRawSource, normalizeMiniProgramGeneratorRawSource, onUpdate, opts, originalSource, outputCssHandlerOptions, outputFile, processViteCssCacheTask, rawSource, recordCssAssetResult, recordViteProcessedCssAssetResult, rememberedCssRuntimeSignature, rememberedCssSources, rememberCssSource, removeRootCoveredCssFromScopedAsset, runtimeState, scopedGeneratorRuntime, scopedSourceCandidateGetter, sharedCssResultCache, shouldInjectVitePipelineCssIntoMain, shouldRecordVitePipelineCssByOutput, snapshot, styleHandler, timeTask, transformRuntime, transformWebTargetCss, useIncrementalMode, usesConfiguredTailwindV4FallbackSource, vitePipelineCssAsset, vitePipelineCssInjectionOutputFile } = options;
|
|
@@ -2074,6 +2150,18 @@ function scheduleViteCssTransform(options) {
|
|
|
2074
2150
|
applyResult(source) {
|
|
2075
2151
|
applyViteCssCacheResult({
|
|
2076
2152
|
applyCssResult,
|
|
2153
|
+
recordCssResult: vitePipelineCssAsset ? (css) => {
|
|
2154
|
+
recordCssAssetResult?.(outputFile, css);
|
|
2155
|
+
recordViteCssContribution({
|
|
2156
|
+
file,
|
|
2157
|
+
outputIsMainChunk: outputCssHandlerOptions.isMainChunk === true,
|
|
2158
|
+
recordViteProcessedCssAssetResult,
|
|
2159
|
+
shouldRecordVitePipelineCssByOutput,
|
|
2160
|
+
shouldInjectVitePipelineCssIntoMain,
|
|
2161
|
+
vitePipelineCssAsset,
|
|
2162
|
+
vitePipelineCssInjectionOutputFile
|
|
2163
|
+
}, css);
|
|
2164
|
+
} : void 0,
|
|
2077
2165
|
cssRuntimeAffectingHash,
|
|
2078
2166
|
generatorRawSource,
|
|
2079
2167
|
generatorSourceFile,
|
|
@@ -2169,6 +2257,7 @@ async function processViteCssBundleEntry(options) {
|
|
|
2169
2257
|
normalizeConfiguredSourceFile: normalizeConfiguredTailwindV4CssEntryFileKey,
|
|
2170
2258
|
opts,
|
|
2171
2259
|
originalFileNames: originalSource.originalFileNames,
|
|
2260
|
+
ownedSourceFiles: (0, _weapp_tailwindcss_postcss_transform.readDeferredCssSourceMarkers)(rawSource),
|
|
2172
2261
|
pipelineContext: cssPipelineContext2,
|
|
2173
2262
|
resolveOutputFileFromMatchedCssSource: resolveMatchedCssSourceOutputFile,
|
|
2174
2263
|
rootImportShellOutputFile,
|
|
@@ -2315,6 +2404,8 @@ async function processViteCssBundleEntry(options) {
|
|
|
2315
2404
|
viteProcessedCssAsset
|
|
2316
2405
|
});
|
|
2317
2406
|
outputFile = cssCompositionPlan.outputFile;
|
|
2407
|
+
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
2408
|
+
activeViteCssCacheFiles.add(`planned:${normalizeViteCssCacheKey(outputFile)}`);
|
|
2318
2409
|
outputCssHandlerOptions = cssCompositionPlan.outputCssHandlerOptions;
|
|
2319
2410
|
rememberedCssSources = cssCompositionPlan.rememberedSources;
|
|
2320
2411
|
const rememberedCssSource = cssCompositionPlan.rememberedSource;
|
|
@@ -2336,12 +2427,21 @@ async function processViteCssBundleEntry(options) {
|
|
|
2336
2427
|
temporaryCssAssetSourceResolver.markUsed(cssCompositionPlan.usedConfiguredSourceFile);
|
|
2337
2428
|
}
|
|
2338
2429
|
const { cssHandlerOptions: cssHandlerOptions2, generatorCssHandlerOptions, generatorRawSource, generatorSourceFile, generatorUserLayerRawSource, hasCurrentTailwindGenerationDirective, hasRememberedApplySource, hasSameOutputRememberedTailwindGenerationSource, hasStaleViteProcessedCssSource, usesConfiguredTailwindV4FallbackSource, vitePipelineCssAsset, webviewRootCssInjectionTarget } = cssCompositionPlan;
|
|
2339
|
-
const scopedSourceCandidateGetter = createScopedSourceCandidateGetter(outputFile, generatorCssHandlerOptions);
|
|
2340
|
-
const scopedSourceCandidateSourceGetter = createScopedSourceCandidateSourceGetter(outputFile, generatorCssHandlerOptions);
|
|
2341
|
-
const
|
|
2430
|
+
const scopedSourceCandidateGetter = createScopedSourceCandidateGetter(outputFile, generatorCssHandlerOptions, generatorSourceFile);
|
|
2431
|
+
const scopedSourceCandidateSourceGetter = createScopedSourceCandidateSourceGetter(outputFile, generatorCssHandlerOptions, generatorSourceFile);
|
|
2432
|
+
const { scopedGeneratorRuntime, signatureSources, sourceTraceSources } = await createScopedGeneratorSourceData({
|
|
2433
|
+
createScopedGeneratorRuntime,
|
|
2434
|
+
createScopedGeneratorSourceTraceMap: (source, file, options) => createScopedGeneratorSourceTraceMap(source, file, scopedSourceCandidateSourceGetter, options),
|
|
2435
|
+
generatorCssHandlerOptions,
|
|
2436
|
+
generatorRawSource,
|
|
2437
|
+
generatorRuntime,
|
|
2438
|
+
generatorSourceFile,
|
|
2439
|
+
rememberedCssSources,
|
|
2440
|
+
scopedSourceCandidateSourceGetter,
|
|
2441
|
+
outputFile
|
|
2442
|
+
});
|
|
2342
2443
|
const sourceTraceTokenSources = sourceTraceSources ? createCssTokenSourceMap(sourceTraceSources, opts) : void 0;
|
|
2343
2444
|
const sourceTraceSignature = createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
2344
|
-
const scopedGeneratorRuntime = await createScopedGeneratorRuntime(outputFile, generatorCssHandlerOptions, generatorRuntime, generatorRawSource, generatorSourceFile);
|
|
2345
2445
|
const annotateCss = (css) => annotateCssSourceTrace(css, {
|
|
2346
2446
|
opts,
|
|
2347
2447
|
tokenSources: sourceTraceTokenSources
|
|
@@ -2392,7 +2492,7 @@ async function processViteCssBundleEntry(options) {
|
|
|
2392
2492
|
rawSource: generatorRawSource,
|
|
2393
2493
|
sourceFile: generatorSourceFile
|
|
2394
2494
|
});
|
|
2395
|
-
if (shouldRecordVitePipelineCssByOutput) recordViteProcessedCssAssetResult?.(vitePipelineCssInjectionOutputFile, nextCss, {
|
|
2495
|
+
if (vitePipelineCssAsset && shouldRecordVitePipelineCssByOutput) recordViteProcessedCssAssetResult?.(vitePipelineCssInjectionOutputFile, nextCss, {
|
|
2396
2496
|
injectIntoMain: outputCssHandlerOptions.isMainChunk ? false : shouldInjectVitePipelineCssIntoMain,
|
|
2397
2497
|
outputFile: vitePipelineCssInjectionOutputFile
|
|
2398
2498
|
});
|
|
@@ -2405,7 +2505,14 @@ async function processViteCssBundleEntry(options) {
|
|
|
2405
2505
|
return;
|
|
2406
2506
|
}
|
|
2407
2507
|
const trackedGeneratorCandidateSignature = shouldTrackGeneratorRuntime ? createCandidateSignature(scopedGeneratorRuntime) : "generator:stable";
|
|
2408
|
-
const scopedGeneratorCandidateSignature = shouldTrackGeneratorRuntime ?
|
|
2508
|
+
const scopedGeneratorCandidateSignature = shouldTrackGeneratorRuntime ? signatureSources.length > 1 ? await createScopedGeneratorCandidateSignatureForSources({
|
|
2509
|
+
createScopedGeneratorCandidateSignature,
|
|
2510
|
+
generatorCssHandlerOptions,
|
|
2511
|
+
majorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
2512
|
+
scopedSourceCandidateGetter,
|
|
2513
|
+
signatureSources,
|
|
2514
|
+
trackedGeneratorCandidateSignature
|
|
2515
|
+
}) : await createScopedGeneratorCandidateSignature(generatorRawSource, generatorSourceFile, trackedGeneratorCandidateSignature, scopedSourceCandidateGetter, {
|
|
2409
2516
|
includeFallbackSignature: generatorCssHandlerOptions.isMainChunk,
|
|
2410
2517
|
majorVersion: runtimeState.tailwindRuntime.majorVersion
|
|
2411
2518
|
}) : trackedGeneratorCandidateSignature;
|
|
@@ -2415,7 +2522,7 @@ async function processViteCssBundleEntry(options) {
|
|
|
2415
2522
|
runtimeAffectingSignatureByFile: snapshot.runtimeAffectingSignatureByFile
|
|
2416
2523
|
}) : "";
|
|
2417
2524
|
const { cssCacheKey, cssHashKey, cssSharedCacheKey, cssTaskHash, rememberedCssRuntimeSignature } = resolveViteCssTransformCachePlan({
|
|
2418
|
-
cssBundleSourceHash:
|
|
2525
|
+
cssBundleSourceHash: cache.computeHash(rawSource),
|
|
2419
2526
|
cssIsMainChunk: cssHandlerOptions2.isMainChunk === true,
|
|
2420
2527
|
cssRuntimeAffectingHash,
|
|
2421
2528
|
cssShareScope,
|
|
@@ -2504,6 +2611,135 @@ async function processViteCssBundleEntry(options) {
|
|
|
2504
2611
|
});
|
|
2505
2612
|
}
|
|
2506
2613
|
//#endregion
|
|
2614
|
+
//#region src/bundlers/vite/generate-bundle/tailwind-v4-css-source.ts
|
|
2615
|
+
function collectTailwindV4SourceFingerprint(source) {
|
|
2616
|
+
return (0, _weapp_tailwindcss_postcss_transform.analyzeTailwindV4Source)(source, node_path.default.basename).getFingerprint();
|
|
2617
|
+
}
|
|
2618
|
+
function scoreSourceFingerprints(rawTokens, entryTokens) {
|
|
2619
|
+
let score = 0;
|
|
2620
|
+
for (const token of entryTokens) if (rawTokens.has(token)) score += token.startsWith("config:") ? 100 : 1;
|
|
2621
|
+
return score;
|
|
2622
|
+
}
|
|
2623
|
+
function scoreConfiguredTailwindV4SourceForRawSource(rawSource, entrySource) {
|
|
2624
|
+
if (!rawSource) return 0;
|
|
2625
|
+
const rawTokens = collectTailwindV4SourceFingerprint(rawSource);
|
|
2626
|
+
if (rawTokens.size === 0) return 0;
|
|
2627
|
+
return scoreSourceFingerprints(rawTokens, collectTailwindV4SourceFingerprint(entrySource));
|
|
2628
|
+
}
|
|
2629
|
+
function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSource, options = {}) {
|
|
2630
|
+
const generationSources = entries.filter((entry) => require_web.hasTailwindGenerationSource(entry.source));
|
|
2631
|
+
if (generationSources.length <= 1) return generationSources[0];
|
|
2632
|
+
const analyses = /* @__PURE__ */ new Map();
|
|
2633
|
+
const analyze = (source) => {
|
|
2634
|
+
let analysis = analyses.get(source);
|
|
2635
|
+
if (!analysis) {
|
|
2636
|
+
analysis = (0, _weapp_tailwindcss_postcss_transform.analyzeTailwindV4Source)(source, node_path.default.basename);
|
|
2637
|
+
analyses.set(source, analysis);
|
|
2638
|
+
}
|
|
2639
|
+
return analysis;
|
|
2640
|
+
};
|
|
2641
|
+
const canMatchByOutputPath = Boolean(options.cwd || options.outputRoot || options.projectRoot);
|
|
2642
|
+
const selectByOutputPath = (candidates, shouldUseScore = (score) => score > 0) => {
|
|
2643
|
+
if (!canMatchByOutputPath) return;
|
|
2644
|
+
const scoredSources = candidates.map((entry) => ({
|
|
2645
|
+
entry,
|
|
2646
|
+
score: require_generated_css_marker.scoreTailwindV4CssSourceFileMatch(outputFile, entry.file, {
|
|
2647
|
+
cwd: options.cwd,
|
|
2648
|
+
outputRoot: options.outputRoot,
|
|
2649
|
+
projectRoot: options.projectRoot
|
|
2650
|
+
})
|
|
2651
|
+
})).filter((item) => shouldUseScore(item.score)).sort((a, b) => b.score - a.score);
|
|
2652
|
+
const bestScore = scoredSources[0]?.score;
|
|
2653
|
+
const bestSources = bestScore ? scoredSources.filter((item) => item.score === bestScore) : [];
|
|
2654
|
+
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
2655
|
+
};
|
|
2656
|
+
const selectByRawSourceFingerprint = (candidates) => {
|
|
2657
|
+
if (!rawSource) return;
|
|
2658
|
+
const rawTokens = analyze(rawSource).getFingerprint();
|
|
2659
|
+
if (rawTokens.size === 0) return;
|
|
2660
|
+
const scoredSources = candidates.map((entry) => ({
|
|
2661
|
+
entry,
|
|
2662
|
+
score: scoreSourceFingerprints(rawTokens, analyze(entry.source).getFingerprint())
|
|
2663
|
+
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score);
|
|
2664
|
+
const bestScore = scoredSources[0]?.score;
|
|
2665
|
+
const bestSources = bestScore ? scoredSources.filter((item) => item.score === bestScore) : [];
|
|
2666
|
+
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
2667
|
+
};
|
|
2668
|
+
const explicitSources = generationSources.filter((entry) => analyze(entry.source).hasExplicitDirectives);
|
|
2669
|
+
const candidates = explicitSources.length === 1 ? explicitSources : generationSources;
|
|
2670
|
+
const directoryIndexOutputPathMatched = selectByOutputPath(candidates, (score) => score >= 25e3 && score < 5e4);
|
|
2671
|
+
if (directoryIndexOutputPathMatched) return directoryIndexOutputPathMatched;
|
|
2672
|
+
const rawSourceMatched = selectByRawSourceFingerprint(generationSources);
|
|
2673
|
+
if (rawSourceMatched) return rawSourceMatched;
|
|
2674
|
+
const outputPathMatched = selectByOutputPath(candidates);
|
|
2675
|
+
if (outputPathMatched) return outputPathMatched;
|
|
2676
|
+
if (candidates.length === 1) return candidates[0];
|
|
2677
|
+
return selectByRawSourceFingerprint(candidates);
|
|
2678
|
+
}
|
|
2679
|
+
//#endregion
|
|
2680
|
+
//#region src/bundlers/vite/generate-bundle/temporary-css-assets.ts
|
|
2681
|
+
function shouldQueueTemporarySource(entry, options) {
|
|
2682
|
+
return require_source_candidate_scan_signature.normalizeOutputPathKey(entry.outputFile).includes("/") || options.explicitSourceFileKeys.has(options.normalizeConfiguredSourceFile(entry.file)) && options.shouldSelectConfiguredRootOutput(entry.outputFile);
|
|
2683
|
+
}
|
|
2684
|
+
function collectTemporaryCssSourceEntries(options) {
|
|
2685
|
+
const runtimeLinkedEntries = [...options.runtimeLinkedCssFiles].map((file) => options.resolveRuntimeLinkedSource(file)).filter((entry) => entry != null && options.currentSubpackageRoots != null && shouldQueueTemporarySource(entry, options));
|
|
2686
|
+
const rememberedEntries = options.rememberedEntries.filter((entry) => shouldQueueTemporarySource(entry, options));
|
|
2687
|
+
const configuredEntries = options.configuredEntries.filter((entry) => require_source_candidate_scan_signature.normalizeOutputPathKey(entry.outputFile).includes("/") || shouldQueueTemporarySource(entry, options));
|
|
2688
|
+
const scopedEntries = options.currentSubpackageRoots ? options.configuredScopeEntries.filter((entry) => options.isSubpackageOutputFile(entry.outputFile, options.currentSubpackageRoots)) : [];
|
|
2689
|
+
return [
|
|
2690
|
+
...runtimeLinkedEntries,
|
|
2691
|
+
...rememberedEntries,
|
|
2692
|
+
...configuredEntries,
|
|
2693
|
+
...scopedEntries
|
|
2694
|
+
];
|
|
2695
|
+
}
|
|
2696
|
+
function isTemporaryCssAssetFile(file) {
|
|
2697
|
+
const normalized = require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
2698
|
+
return /\.css$/i.test(normalized) && !normalized.includes("/");
|
|
2699
|
+
}
|
|
2700
|
+
function normalizeCssSourceKey(file) {
|
|
2701
|
+
return require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
2702
|
+
}
|
|
2703
|
+
function createTemporaryCssAssetSourceResolver(entries) {
|
|
2704
|
+
const seenEntryFiles = /* @__PURE__ */ new Set();
|
|
2705
|
+
const queuedEntries = entries.filter((entry) => {
|
|
2706
|
+
const entryFile = normalizeCssSourceKey(entry.file);
|
|
2707
|
+
if (normalizeCssSourceKey(entry.outputFile) === entryFile || seenEntryFiles.has(entryFile)) return false;
|
|
2708
|
+
seenEntryFiles.add(entryFile);
|
|
2709
|
+
return true;
|
|
2710
|
+
});
|
|
2711
|
+
const usedEntryFiles = /* @__PURE__ */ new Set();
|
|
2712
|
+
return {
|
|
2713
|
+
entries: queuedEntries,
|
|
2714
|
+
markUsed(sourceFile) {
|
|
2715
|
+
if (!sourceFile) return;
|
|
2716
|
+
usedEntryFiles.add(normalizeCssSourceKey(sourceFile));
|
|
2717
|
+
},
|
|
2718
|
+
resolve(outputFile, rawSource) {
|
|
2719
|
+
if (!isTemporaryCssAssetFile(outputFile)) return;
|
|
2720
|
+
const outputFileKey = normalizeCssSourceKey(outputFile);
|
|
2721
|
+
const unusedEntries = queuedEntries.filter((item) => !usedEntryFiles.has(normalizeCssSourceKey(item.file)));
|
|
2722
|
+
const matchedOutputEntries = unusedEntries.filter((item) => normalizeCssSourceKey(item.outputFile) === outputFileKey);
|
|
2723
|
+
const usesMatchedOutputEntries = matchedOutputEntries.length > 0;
|
|
2724
|
+
const availableEntries = matchedOutputEntries.length > 0 ? matchedOutputEntries : unusedEntries.filter((item) => normalizeCssSourceKey(item.outputFile).includes("/"));
|
|
2725
|
+
const scoredEntries = rawSource ? availableEntries.map((entry) => ({
|
|
2726
|
+
entry,
|
|
2727
|
+
score: scoreConfiguredTailwindV4SourceForRawSource(rawSource, entry.source)
|
|
2728
|
+
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score) : [];
|
|
2729
|
+
const bestScore = scoredEntries[0]?.score;
|
|
2730
|
+
const bestEntries = bestScore ? scoredEntries.filter((item) => item.score === bestScore) : [];
|
|
2731
|
+
const entry = bestEntries.length === 1 ? bestEntries[0]?.entry : usesMatchedOutputEntries || rawSource == null ? availableEntries.find((item) => require_web.hasTailwindGenerationSource(item.source)) : void 0;
|
|
2732
|
+
if (!entry) return;
|
|
2733
|
+
usedEntryFiles.add(normalizeCssSourceKey(entry.file));
|
|
2734
|
+
return {
|
|
2735
|
+
outputFile: entry.outputFile,
|
|
2736
|
+
rawSource: entry.source,
|
|
2737
|
+
sourceFile: entry.file
|
|
2738
|
+
};
|
|
2739
|
+
}
|
|
2740
|
+
};
|
|
2741
|
+
}
|
|
2742
|
+
//#endregion
|
|
2507
2743
|
//#region src/bundlers/vite/generate-bundle/css-output-helpers.ts
|
|
2508
2744
|
function resolveCssBundleOutputFile(options) {
|
|
2509
2745
|
const { bundleFiles, defaultStyleOutputExtension, file, isWebGeneratorTarget, opts, pipelineContext, cssPipelineStrategy, shouldPreserveAppCssExtension } = options;
|
|
@@ -2530,15 +2766,16 @@ function resolveOutputFileFromMatchedCssSource(options) {
|
|
|
2530
2766
|
return opts.cssMatcher(outputFile) ? outputFile : void 0;
|
|
2531
2767
|
}
|
|
2532
2768
|
function createMatchedCssSourceOutputResolver(options) {
|
|
2533
|
-
const { assetSourceFile, file, originalFileNames, resolveOutputFileFromMatchedCssSource } = options;
|
|
2769
|
+
const { assetSourceFile, file, originalFileNames, ownedSourceFiles, resolveOutputFileFromMatchedCssSource } = options;
|
|
2534
2770
|
return (sourceFile) => {
|
|
2535
2771
|
if (!sourceFile) return;
|
|
2536
2772
|
const cleanAssetSourceFile = assetSourceFile.replace(/[?#].*$/, "");
|
|
2537
2773
|
const cleanSourceFile = sourceFile.replace(/[?#].*$/, "");
|
|
2538
2774
|
const sourceHasQuery = cleanSourceFile !== sourceFile;
|
|
2539
2775
|
const resolvedSourceOutputFile = resolveOutputFileFromMatchedCssSource(sourceFile);
|
|
2540
|
-
|
|
2541
|
-
|
|
2776
|
+
const ownsDeferredSource = isTemporaryCssAssetFile(file) && ownedSourceFiles?.some((originalFile) => require_source_candidate_scan_signature.normalizeOutputPathKey(originalFile.replace(/[?#].*$/, "")) === require_source_candidate_scan_signature.normalizeOutputPathKey(cleanSourceFile)) === true;
|
|
2777
|
+
if (require_source_candidate_scan_signature.normalizeOutputPathKey(cleanAssetSourceFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(cleanSourceFile) || ownsDeferredSource || originalFileNames?.some((originalFile) => require_source_candidate_scan_signature.normalizeOutputPathKey(originalFile.replace(/[?#].*$/, "")) === require_source_candidate_scan_signature.normalizeOutputPathKey(cleanSourceFile))) {
|
|
2778
|
+
if (!sourceHasQuery && !ownsDeferredSource && require_source_candidate_scan_signature.normalizeOutputPathKey(cleanAssetSourceFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(cleanSourceFile) && typeof resolvedSourceOutputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedSourceOutputFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file)) return resolvedSourceOutputFile;
|
|
2542
2779
|
return file;
|
|
2543
2780
|
}
|
|
2544
2781
|
return resolvedSourceOutputFile;
|
|
@@ -2555,6 +2792,7 @@ function resolveCssAssetOutputPlan(options) {
|
|
|
2555
2792
|
assetSourceFile: options.assetSourceFile,
|
|
2556
2793
|
file: options.file,
|
|
2557
2794
|
originalFileNames: options.originalFileNames,
|
|
2795
|
+
ownedSourceFiles: options.ownedSourceFiles,
|
|
2558
2796
|
resolveOutputFileFromMatchedCssSource: options.resolveOutputFileFromMatchedCssSource
|
|
2559
2797
|
});
|
|
2560
2798
|
const configuredOriginalSourceEntry = outputFile.replace(/[?#].*$/, "").endsWith(".css") ? options.configuredEntries.find((entry) => options.originalFileNames?.some((originalFile) => options.normalizeConfiguredSourceFile(originalFile) === options.normalizeConfiguredSourceFile(entry.file)) === true) : void 0;
|
|
@@ -2686,72 +2924,6 @@ async function resolveRememberedCssSourcePlan(options) {
|
|
|
2686
2924
|
};
|
|
2687
2925
|
}
|
|
2688
2926
|
//#endregion
|
|
2689
|
-
//#region src/bundlers/vite/generate-bundle/tailwind-v4-css-source.ts
|
|
2690
|
-
function collectTailwindV4SourceFingerprint(source) {
|
|
2691
|
-
return (0, _weapp_tailwindcss_postcss_transform.analyzeTailwindV4Source)(source, node_path.default.basename).getFingerprint();
|
|
2692
|
-
}
|
|
2693
|
-
function scoreSourceFingerprints(rawTokens, entryTokens) {
|
|
2694
|
-
let score = 0;
|
|
2695
|
-
for (const token of entryTokens) if (rawTokens.has(token)) score += token.startsWith("config:") ? 100 : 1;
|
|
2696
|
-
return score;
|
|
2697
|
-
}
|
|
2698
|
-
function scoreConfiguredTailwindV4SourceForRawSource(rawSource, entrySource) {
|
|
2699
|
-
if (!rawSource) return 0;
|
|
2700
|
-
const rawTokens = collectTailwindV4SourceFingerprint(rawSource);
|
|
2701
|
-
if (rawTokens.size === 0) return 0;
|
|
2702
|
-
return scoreSourceFingerprints(rawTokens, collectTailwindV4SourceFingerprint(entrySource));
|
|
2703
|
-
}
|
|
2704
|
-
function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSource, options = {}) {
|
|
2705
|
-
const generationSources = entries.filter((entry) => require_web.hasTailwindGenerationSource(entry.source));
|
|
2706
|
-
if (generationSources.length <= 1) return generationSources[0];
|
|
2707
|
-
const analyses = /* @__PURE__ */ new Map();
|
|
2708
|
-
const analyze = (source) => {
|
|
2709
|
-
let analysis = analyses.get(source);
|
|
2710
|
-
if (!analysis) {
|
|
2711
|
-
analysis = (0, _weapp_tailwindcss_postcss_transform.analyzeTailwindV4Source)(source, node_path.default.basename);
|
|
2712
|
-
analyses.set(source, analysis);
|
|
2713
|
-
}
|
|
2714
|
-
return analysis;
|
|
2715
|
-
};
|
|
2716
|
-
const canMatchByOutputPath = Boolean(options.cwd || options.outputRoot || options.projectRoot);
|
|
2717
|
-
const selectByOutputPath = (candidates, shouldUseScore = (score) => score > 0) => {
|
|
2718
|
-
if (!canMatchByOutputPath) return;
|
|
2719
|
-
const scoredSources = candidates.map((entry) => ({
|
|
2720
|
-
entry,
|
|
2721
|
-
score: require_generated_css_marker.scoreTailwindV4CssSourceFileMatch(outputFile, entry.file, {
|
|
2722
|
-
cwd: options.cwd,
|
|
2723
|
-
outputRoot: options.outputRoot,
|
|
2724
|
-
projectRoot: options.projectRoot
|
|
2725
|
-
})
|
|
2726
|
-
})).filter((item) => shouldUseScore(item.score)).sort((a, b) => b.score - a.score);
|
|
2727
|
-
const bestScore = scoredSources[0]?.score;
|
|
2728
|
-
const bestSources = bestScore ? scoredSources.filter((item) => item.score === bestScore) : [];
|
|
2729
|
-
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
2730
|
-
};
|
|
2731
|
-
const selectByRawSourceFingerprint = (candidates) => {
|
|
2732
|
-
if (!rawSource) return;
|
|
2733
|
-
const rawTokens = analyze(rawSource).getFingerprint();
|
|
2734
|
-
if (rawTokens.size === 0) return;
|
|
2735
|
-
const scoredSources = candidates.map((entry) => ({
|
|
2736
|
-
entry,
|
|
2737
|
-
score: scoreSourceFingerprints(rawTokens, analyze(entry.source).getFingerprint())
|
|
2738
|
-
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score);
|
|
2739
|
-
const bestScore = scoredSources[0]?.score;
|
|
2740
|
-
const bestSources = bestScore ? scoredSources.filter((item) => item.score === bestScore) : [];
|
|
2741
|
-
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
2742
|
-
};
|
|
2743
|
-
const explicitSources = generationSources.filter((entry) => analyze(entry.source).hasExplicitDirectives);
|
|
2744
|
-
const candidates = explicitSources.length === 1 ? explicitSources : generationSources;
|
|
2745
|
-
const directoryIndexOutputPathMatched = selectByOutputPath(candidates, (score) => score >= 25e3 && score < 5e4);
|
|
2746
|
-
if (directoryIndexOutputPathMatched) return directoryIndexOutputPathMatched;
|
|
2747
|
-
const rawSourceMatched = selectByRawSourceFingerprint(generationSources);
|
|
2748
|
-
if (rawSourceMatched) return rawSourceMatched;
|
|
2749
|
-
const outputPathMatched = selectByOutputPath(candidates);
|
|
2750
|
-
if (outputPathMatched) return outputPathMatched;
|
|
2751
|
-
if (candidates.length === 1) return candidates[0];
|
|
2752
|
-
return selectByRawSourceFingerprint(candidates);
|
|
2753
|
-
}
|
|
2754
|
-
//#endregion
|
|
2755
2927
|
//#region src/bundlers/vite/generate-bundle/css-source-plan.ts
|
|
2756
2928
|
function hasTailwindPluginDirective(source) {
|
|
2757
2929
|
return /@plugin\b/.test(source);
|
|
@@ -2778,6 +2950,30 @@ function finalizeSourcePlan(plan, options) {
|
|
|
2778
2950
|
};
|
|
2779
2951
|
}
|
|
2780
2952
|
async function resolveViteCssSourcePlan(options) {
|
|
2953
|
+
const markedSources = options.rawSource.includes("weapp-tailwindcss deferred-source:") ? (0, _weapp_tailwindcss_postcss_transform.readDeferredCssSourceMarkers)(options.rawSource).map((file) => {
|
|
2954
|
+
const source = options.getSourceStyleSource?.(file);
|
|
2955
|
+
if (source === void 0) throw new Error(`Missing transformed CSS source for deferred generation: ${file}`);
|
|
2956
|
+
return {
|
|
2957
|
+
sourceFile: file,
|
|
2958
|
+
rawSource: source,
|
|
2959
|
+
outputFile: options.temporaryOutput || !options.isCurrentRootMiniProgramStyleOutput ? options.outputFile : options.resolveMatchedOutputFile(file) ?? options.outputFile
|
|
2960
|
+
};
|
|
2961
|
+
}) : [];
|
|
2962
|
+
if (markedSources.length > 0) {
|
|
2963
|
+
options.debug("deferred css source markers: %O", markedSources.map((source) => ({
|
|
2964
|
+
sourceFile: source.sourceFile,
|
|
2965
|
+
outputFile: source.outputFile
|
|
2966
|
+
})));
|
|
2967
|
+
return {
|
|
2968
|
+
forceNonMainChunk: false,
|
|
2969
|
+
hasUsableTailwindSource: true,
|
|
2970
|
+
outputFile: markedSources[0]?.outputFile ?? options.outputFile,
|
|
2971
|
+
resolution: "remembered",
|
|
2972
|
+
resolvedFromTemporarySource: false,
|
|
2973
|
+
sources: markedSources,
|
|
2974
|
+
usedConfiguredSourceFiles: markedSources.map((source) => options.normalizeConfiguredSourceFile(source.sourceFile))
|
|
2975
|
+
};
|
|
2976
|
+
}
|
|
2781
2977
|
const rememberedPlan = await resolveRememberedCssSourcePlan(options);
|
|
2782
2978
|
if (rememberedPlan.hasUsableTailwindSource) return finalizeSourcePlan({
|
|
2783
2979
|
...rememberedPlan,
|
|
@@ -2916,29 +3112,6 @@ function resolveViteCssLinkedImpactSignature(options) {
|
|
|
2916
3112
|
return [...[...options.changedHtmlFiles].sort().map((file) => options.runtimeAffectingSignatureByFile.get(file) ?? ""), ...[...options.changedJsFiles].sort().map((file) => options.runtimeAffectingSignatureByFile.get(file) ?? "")].join(":");
|
|
2917
3113
|
}
|
|
2918
3114
|
//#endregion
|
|
2919
|
-
//#region src/bundlers/vite/generate-bundle/css-transform-result.ts
|
|
2920
|
-
function applyViteCssTransformTaskResult(options) {
|
|
2921
|
-
const { result } = options;
|
|
2922
|
-
registerGeneratorDependencies({ addWatchFile: options.addWatchFile }, result.dependencies);
|
|
2923
|
-
if (options.debugCssDiff && result.diffSource != null) options.debug("css diff %s: %s", options.generatorSourceFile, require_scoped_generator.summarizeStringDiff(result.diffSource, result.css));
|
|
2924
|
-
if (result.shouldRecordCssAsset) options.recordCssAssetResult?.(options.outputFile, result.css);
|
|
2925
|
-
if (result.kind === "tailwind") {
|
|
2926
|
-
options.debug("css generated result: %s bytes=%d", options.file, result.css.length);
|
|
2927
|
-
for (const candidate of result.classSet ?? []) options.transformRuntime.add(candidate);
|
|
2928
|
-
if (options.shouldRecordVitePipelineCssByOutput) options.recordViteProcessedCssAssetResult?.(options.vitePipelineCssInjectionOutputFile, result.css, {
|
|
2929
|
-
injectIntoMain: options.outputIsMainChunk ? false : options.shouldInjectVitePipelineCssIntoMain,
|
|
2930
|
-
outputFile: options.vitePipelineCssInjectionOutputFile
|
|
2931
|
-
});
|
|
2932
|
-
if (options.vitePipelineCssAsset && options.shouldInjectVitePipelineCssIntoMain) options.recordViteProcessedCssAssetResult?.(options.file, result.css, {
|
|
2933
|
-
injectIntoMain: true,
|
|
2934
|
-
outputFile: options.vitePipelineCssInjectionOutputFile
|
|
2935
|
-
});
|
|
2936
|
-
options.debug("css handle via tailwind v%s engine(%s): %s", options.tailwindcssMajorVersion, result.generatorTarget, options.outputFile);
|
|
2937
|
-
} else if (result.kind === "web") options.debug("css preserve web target: %s", options.outputFile);
|
|
2938
|
-
else if (result.kind === "import-shell") options.debug("css preserve mini-program import shell: %s", options.outputFile);
|
|
2939
|
-
return result.css;
|
|
2940
|
-
}
|
|
2941
|
-
//#endregion
|
|
2942
3115
|
//#region src/bundlers/vite/generate-bundle/web-css-module.ts
|
|
2943
3116
|
function replaceWebCssModule(source, sourceFile, generated) {
|
|
2944
3117
|
const sourceKey = require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile.replace(/[?#].*$/, ""));
|
|
@@ -2979,7 +3152,7 @@ async function executeViteCssTransformTask(options) {
|
|
|
2979
3152
|
const css = options.removeRootCoveredCssFromScopedAsset(options.annotateCss(options.transformWebTargetCss(options.isWebGeneratorTarget ? replaceWebCssModule(options.rawSource, options.generatorSourceFile, generated.css) ?? generated.css : generated.css)));
|
|
2980
3153
|
return {
|
|
2981
3154
|
classSet: generated.classSet,
|
|
2982
|
-
css,
|
|
3155
|
+
css: (0, _weapp_tailwindcss_postcss_transform.stripDeferredCssSourceMarkers)(css),
|
|
2983
3156
|
dependencies: generated.dependencies,
|
|
2984
3157
|
diffSource: options.generatorRawSource,
|
|
2985
3158
|
generatorTarget: generated.target,
|
|
@@ -3918,12 +4091,12 @@ function createUniAppXNativeHmrReloader(options) {
|
|
|
3918
4091
|
return runtimeClassSet;
|
|
3919
4092
|
}
|
|
3920
4093
|
async function refreshBaseline() {
|
|
3921
|
-
return remember(await options.ensureRuntimeClassSet(
|
|
4094
|
+
return remember(await options.ensureRuntimeClassSet());
|
|
3922
4095
|
}
|
|
3923
4096
|
async function handleHotUpdate(ctx) {
|
|
3924
4097
|
if (!options.isNativeAppBuildTarget(ctx.file)) return;
|
|
3925
4098
|
await options.syncSourceCandidates?.(ctx);
|
|
3926
|
-
const currentRuntimeClassSet = await options.ensureRuntimeClassSet(
|
|
4099
|
+
const currentRuntimeClassSet = await options.ensureRuntimeClassSet();
|
|
3927
4100
|
const hasRuntimeClassChange = previousRuntimeClassSet !== void 0 && (currentRuntimeClassSet.size !== previousRuntimeClassSet.size || [...currentRuntimeClassSet].some((candidate) => !previousRuntimeClassSet.has(candidate)));
|
|
3928
4101
|
remember(currentRuntimeClassSet);
|
|
3929
4102
|
const cssModules = ctx.server?.moduleGraph ? await require_web.resolveHotTailwindCssModules(ctx, /* @__PURE__ */ new Set([...options.tailwindRootCssModuleIds, ...options.viteProcessedCssSourceFiles])) : [];
|
|
@@ -4176,7 +4349,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
4176
4349
|
//#region src/uni-app-x/vite.ts
|
|
4177
4350
|
let transformUVuePromise;
|
|
4178
4351
|
function loadTransformUVue() {
|
|
4179
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
4352
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-CxVM0PfA.cjs")).then((mod) => mod.transformUVue));
|
|
4180
4353
|
return transformUVuePromise;
|
|
4181
4354
|
}
|
|
4182
4355
|
const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
@@ -4343,10 +4516,8 @@ function createUniAppXPlugins(options) {
|
|
|
4343
4516
|
harmonyApply.rememberSource(code, id, true);
|
|
4344
4517
|
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
4345
4518
|
const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
|
|
4346
|
-
const
|
|
4347
|
-
const
|
|
4348
|
-
const moduleGraphCandidates = enableComponentLocalStyle || enablePageLocalStyle ? await registerModuleGraphCandidates?.(id, code) : void 0;
|
|
4349
|
-
const runtimeSet = await ensureRuntimeClassSet(shouldForceRefresh);
|
|
4519
|
+
const moduleGraphCandidates = await registerModuleGraphCandidates?.(id, code);
|
|
4520
|
+
const runtimeSet = await ensureRuntimeClassSet();
|
|
4350
4521
|
const currentRuntimeSet = moduleGraphCandidates?.size ? /* @__PURE__ */ new Set([...runtimeSet, ...moduleGraphCandidates]) : runtimeSet;
|
|
4351
4522
|
nativeHmrReloader.remember(currentRuntimeSet);
|
|
4352
4523
|
const transformUVue = await loadTransformUVue();
|
|
@@ -4380,9 +4551,10 @@ function createUniAppXPlugins(options) {
|
|
|
4380
4551
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
4381
4552
|
const pending = transformSfc(code, id, context);
|
|
4382
4553
|
pendingSfcTransforms.set(file, pending);
|
|
4383
|
-
|
|
4554
|
+
const cleanup = () => {
|
|
4384
4555
|
if (pendingSfcTransforms.get(file) === pending) pendingSfcTransforms.delete(file);
|
|
4385
|
-
}
|
|
4556
|
+
};
|
|
4557
|
+
pending.then(cleanup, cleanup);
|
|
4386
4558
|
return pending;
|
|
4387
4559
|
}
|
|
4388
4560
|
const nvuePlugin = {
|
|
@@ -4411,13 +4583,6 @@ function createUniAppXPlugins(options) {
|
|
|
4411
4583
|
return webLocalStyle.handleHotUpdate(ctx) ?? nativeHmrReloader.handleHotUpdate(ctx);
|
|
4412
4584
|
}
|
|
4413
4585
|
},
|
|
4414
|
-
async watchChange(id) {
|
|
4415
|
-
if (!isEnabled()) return;
|
|
4416
|
-
const resolvedConfig = getResolvedConfig();
|
|
4417
|
-
if (resolvedConfig?.command !== "build" || !resolvedConfig.build?.watch) return;
|
|
4418
|
-
if (!UVUE_NVUE_QUERY_RE.test(id)) return;
|
|
4419
|
-
await ensureRuntimeClassSet(true);
|
|
4420
|
-
},
|
|
4421
4586
|
buildEnd() {
|
|
4422
4587
|
if (isWebGeneratorTarget()) webCssEntryDiagnostics?.flush();
|
|
4423
4588
|
},
|
|
@@ -4627,6 +4792,14 @@ function logBundleProcessPlan(options) {
|
|
|
4627
4792
|
}
|
|
4628
4793
|
//#endregion
|
|
4629
4794
|
//#region src/bundlers/vite/generate-bundle/remembered-css-replay.ts
|
|
4795
|
+
function dedupeRememberedCssReplayGroup(group) {
|
|
4796
|
+
const bySourceAndOutput = /* @__PURE__ */ new Map();
|
|
4797
|
+
for (const item of group) {
|
|
4798
|
+
const sourceKey = `${require_source_candidate_scan_signature.normalizeOutputPathKey(item.remembered.sourceFile)}\0${require_source_candidate_scan_signature.normalizeOutputPathKey(item.remembered.outputFile)}`;
|
|
4799
|
+
bySourceAndOutput.set(sourceKey, item);
|
|
4800
|
+
}
|
|
4801
|
+
return [...bySourceAndOutput.values()];
|
|
4802
|
+
}
|
|
4630
4803
|
function shouldSkipRawRememberedCssSource(rawSource, sourceFile) {
|
|
4631
4804
|
const cleanSourceFile = sourceFile.replace(/[?#].*$/, "");
|
|
4632
4805
|
return (require_web.SOURCE_STYLE_OUTPUT_EXT_RE.test(cleanSourceFile) || require_generated_css_marker.isSourcePreprocessorRequest(sourceFile)) && !require_web.canProcessViteSourceStyleAsCss(rawSource, sourceFile);
|
|
@@ -4659,7 +4832,7 @@ async function processRememberedCssReplay(options) {
|
|
|
4659
4832
|
const outputFile = resolveRememberedCssReplayOutputFile(rememberedOutputFile, frameworkRootImportShellTargetByFile);
|
|
4660
4833
|
if (outputFile !== rememberedOutputFile) debug("css replay use framework root import shell target: %s -> %s", rememberedOutputFile, outputFile);
|
|
4661
4834
|
if (require_web.isHTMLRequest(outputFile) || options.opts.htmlMatcher(outputFile)) continue;
|
|
4662
|
-
const replayableRememberedGroup = rememberedGroup.filter(({ remembered }) => {
|
|
4835
|
+
const replayableRememberedGroup = (rememberedGroup.length > 1 ? dedupeRememberedCssReplayGroup(rememberedGroup) : rememberedGroup).filter(({ remembered }) => {
|
|
4663
4836
|
const shouldSkip = shouldSkipRawRememberedCssSource(remembered.rawSource, remembered.sourceFile);
|
|
4664
4837
|
if (shouldSkip) debug("css replay skip raw source style: %s -> %s", remembered.sourceFile, outputFile);
|
|
4665
4838
|
return !shouldSkip;
|
|
@@ -4668,7 +4841,7 @@ async function processRememberedCssReplay(options) {
|
|
|
4668
4841
|
const rememberedCssSource = mergeRememberedCssSources(replayableRememberedGroup.map((item) => item.remembered), outputFile);
|
|
4669
4842
|
if (!rememberedCssSource) continue;
|
|
4670
4843
|
const { sourceFile } = rememberedCssSource;
|
|
4671
|
-
if (normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedOutputFile)) || normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile)) || bundleFiles.includes(rememberedOutputFile) || bundleFiles.includes(sourceFile)) continue;
|
|
4844
|
+
if (activeViteCssCacheFiles.has(`planned:${normalizeViteCssCacheKey?.(outputFile) ?? require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile)}`) || normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedOutputFile)) || normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile)) || bundleFiles.includes(rememberedOutputFile) || bundleFiles.includes(sourceFile)) continue;
|
|
4672
4845
|
const rawSource = isWebGeneratorTarget ? rememberedCssSource.rawSource : (0, _weapp_tailwindcss_postcss_transform.normalizeMiniProgramImportShell)(rememberedCssSource.rawSource, {
|
|
4673
4846
|
cssOnly: true,
|
|
4674
4847
|
outputFile,
|
|
@@ -4678,17 +4851,38 @@ async function processRememberedCssReplay(options) {
|
|
|
4678
4851
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
4679
4852
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(sourceFile));
|
|
4680
4853
|
const outputCssHandlerOptions = getCssHandlerOptions(rememberedOutputFile);
|
|
4854
|
+
const ownedSources = replayableRememberedGroup.map((item) => item.remembered);
|
|
4855
|
+
const hasScopedSources = hasScopedSourceDirectives(ownedSources);
|
|
4681
4856
|
const cssHandlerOptions = {
|
|
4682
4857
|
...getCssHandlerOptions(sourceFile),
|
|
4683
|
-
isMainChunk: outputCssHandlerOptions.isMainChunk
|
|
4858
|
+
isMainChunk: outputCssHandlerOptions.isMainChunk,
|
|
4859
|
+
...hasScopedSources ? { sourceOptions: {
|
|
4860
|
+
...getCssHandlerOptions(sourceFile).sourceOptions,
|
|
4861
|
+
cssEntries: ownedSources.map((source) => source.sourceFile),
|
|
4862
|
+
cssSources: ownedSources.map((source) => ({
|
|
4863
|
+
file: source.sourceFile,
|
|
4864
|
+
base: (0, _weapp_tailwindcss_source_scan.sourcePathApi)(source.sourceFile).dirname(source.sourceFile),
|
|
4865
|
+
css: source.rawSource
|
|
4866
|
+
}))
|
|
4867
|
+
} } : {}
|
|
4684
4868
|
};
|
|
4685
|
-
const scopedSourceCandidateGetter = createScopedSourceCandidateGetter(outputFile, cssHandlerOptions);
|
|
4686
|
-
const scopedSourceCandidateSourceGetter = createScopedSourceCandidateSourceGetter(outputFile, cssHandlerOptions);
|
|
4687
|
-
const
|
|
4688
|
-
|
|
4869
|
+
const scopedSourceCandidateGetter = createScopedSourceCandidateGetter(outputFile, cssHandlerOptions, sourceFile);
|
|
4870
|
+
const scopedSourceCandidateSourceGetter = createScopedSourceCandidateSourceGetter(outputFile, cssHandlerOptions, sourceFile);
|
|
4871
|
+
const signatureSources = hasScopedSources ? ownedSources : [{
|
|
4872
|
+
rawSource: generatorRawSource,
|
|
4873
|
+
sourceFile
|
|
4874
|
+
}];
|
|
4875
|
+
const scopedGeneratorRuntime = hasScopedSources ? new Set((await Promise.all(signatureSources.map((source) => createScopedGeneratorRuntime(outputFile, cssHandlerOptions, generatorRuntime, source.rawSource, source.sourceFile, true)))).flatMap((candidates) => [...candidates])) : await createScopedGeneratorRuntime(outputFile, cssHandlerOptions, generatorRuntime, generatorRawSource, sourceFile);
|
|
4876
|
+
const candidateSignatures = hasScopedSources ? await Promise.all(signatureSources.map(async (source) => [source.sourceFile, await require_scoped_generator.createScopedGeneratorCandidateSignature(source.rawSource, source.sourceFile, require_scoped_generator.createCandidateSignature(scopedGeneratorRuntime), scopedSourceCandidateGetter, {
|
|
4877
|
+
includeFallbackSignature: cssHandlerOptions.isMainChunk,
|
|
4878
|
+
majorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
4879
|
+
scopeToSource: true
|
|
4880
|
+
})])) : void 0;
|
|
4881
|
+
const scopedGeneratorCandidateSignature = hasScopedSources ? JSON.stringify(candidateSignatures) : await require_scoped_generator.createScopedGeneratorCandidateSignature(generatorRawSource, sourceFile, require_scoped_generator.createCandidateSignature(scopedGeneratorRuntime), scopedSourceCandidateGetter, {
|
|
4689
4882
|
includeFallbackSignature: cssHandlerOptions.isMainChunk,
|
|
4690
4883
|
majorVersion: runtimeState.tailwindRuntime.majorVersion
|
|
4691
|
-
})
|
|
4884
|
+
});
|
|
4885
|
+
const cssRuntimeSignature = createCssRuntimeSignature(require_scoped_generator.createCandidateSignature(scopedGeneratorRuntime), scopedGeneratorCandidateSignature);
|
|
4692
4886
|
const cssRuntimeAffectingHash = cache.computeHash(require_compiler.createRuntimeAffectingSourceSignature(rawSource, "css"));
|
|
4693
4887
|
const rememberedCssRuntimeSignature = createRememberedCssRuntimeSignature(cssRuntimeSignature, cssRuntimeAffectingHash);
|
|
4694
4888
|
const rawSourceHash = cache.computeHash(rawSource);
|
|
@@ -4701,7 +4895,7 @@ async function processRememberedCssReplay(options) {
|
|
|
4701
4895
|
activeViteCssCacheFiles.add(generatedReplayKey);
|
|
4702
4896
|
const cachedGeneratedReplayCss = allRememberedSignaturesFresh && shouldMergeReplayIntoFrameworkRootTarget ? lastCssResultByFile.get(generatedReplayKey) : void 0;
|
|
4703
4897
|
if (allRememberedSignaturesFresh && !shouldMergeReplayIntoFrameworkRootTarget) continue;
|
|
4704
|
-
const sourceTraceSources = scopedSourceCandidateSourceGetter ? await require_scoped_generator.createScopedGeneratorSourceTraceMap(generatorRawSource, sourceFile, scopedSourceCandidateSourceGetter) : void 0;
|
|
4898
|
+
const sourceTraceSources = scopedSourceCandidateSourceGetter ? hasScopedSources ? await createMergedCssSourceTraceMap(signatureSources, (source) => require_scoped_generator.createScopedGeneratorSourceTraceMap(source.rawSource, source.sourceFile, scopedSourceCandidateSourceGetter, { scopeToSource: true })) : await require_scoped_generator.createScopedGeneratorSourceTraceMap(generatorRawSource, sourceFile, scopedSourceCandidateSourceGetter) : void 0;
|
|
4705
4899
|
const sourceTraceTokenSources = sourceTraceSources ? require_generated_css_marker.createCssTokenSourceMap(sourceTraceSources, opts) : void 0;
|
|
4706
4900
|
const annotateCss = (css) => require_generated_css_marker.annotateCssSourceTrace(css, {
|
|
4707
4901
|
opts,
|
|
@@ -5012,6 +5206,26 @@ function rememberRuntimeLinkedCssSources(options) {
|
|
|
5012
5206
|
}
|
|
5013
5207
|
}
|
|
5014
5208
|
//#endregion
|
|
5209
|
+
//#region src/bundlers/vite/generate-bundle/scoped-generator-runtime-cache.ts
|
|
5210
|
+
/** 缓存仅属于单轮 generateBundle,不跨候选或配置更新复用。 */
|
|
5211
|
+
function memoizeScopedGeneratorRuntime(resolve) {
|
|
5212
|
+
const byRuntime = /* @__PURE__ */ new WeakMap();
|
|
5213
|
+
return (outputFile, options, runtime, rawSource, sourceFile, scopeToSource) => {
|
|
5214
|
+
if (rawSource === void 0 || sourceFile === void 0) return resolve(outputFile, options, runtime, rawSource, sourceFile, scopeToSource);
|
|
5215
|
+
let cache = byRuntime.get(runtime);
|
|
5216
|
+
if (!cache) {
|
|
5217
|
+
cache = /* @__PURE__ */ new Map();
|
|
5218
|
+
byRuntime.set(runtime, cache);
|
|
5219
|
+
}
|
|
5220
|
+
const key = `${outputFile}\0${sourceFile}\0${options.isMainChunk === true ? "main" : "scoped"}\0${scopeToSource === true ? "source" : "runtime"}\0${rawSource}`;
|
|
5221
|
+
const cached = cache.get(key);
|
|
5222
|
+
if (cached) return cached;
|
|
5223
|
+
const pending = resolve(outputFile, options, runtime, rawSource, sourceFile, scopeToSource);
|
|
5224
|
+
cache.set(key, pending);
|
|
5225
|
+
return pending;
|
|
5226
|
+
};
|
|
5227
|
+
}
|
|
5228
|
+
//#endregion
|
|
5015
5229
|
//#region src/bundlers/vite/generate-bundle/source-candidate-scope.ts
|
|
5016
5230
|
function intersectCandidateSets(left, right) {
|
|
5017
5231
|
if (left.size === 0 || right.size === 0) return /* @__PURE__ */ new Set();
|
|
@@ -5088,9 +5302,14 @@ function createSubpackageSourceCandidateScope(options) {
|
|
|
5088
5302
|
}];
|
|
5089
5303
|
};
|
|
5090
5304
|
const shouldExcludeSubpackageSourceCandidates = (outputFile, cssHandlerOptions) => cssHandlerOptions.isMainChunk === true && subpackageSourceExcludeEntries.length > 0 && isMainPackageStyleOutputFile(outputFile);
|
|
5091
|
-
const
|
|
5305
|
+
const resolveScopedOutputFile = (outputFile, sourceFile) => {
|
|
5306
|
+
if (!options.subpackageRoots || isSubpackageOutputFile(outputFile, options.subpackageRoots)) return outputFile;
|
|
5307
|
+
return sourceFile && isSubpackageOutputFile(sourceFile, options.subpackageRoots) ? sourceFile : outputFile;
|
|
5308
|
+
};
|
|
5309
|
+
const createScopedSourceCandidateGetter = (outputFile, cssHandlerOptions, sourceFile) => {
|
|
5092
5310
|
if (!options.getSourceCandidatesForEntries) return;
|
|
5093
|
-
const
|
|
5311
|
+
const scopedOutputFile = resolveScopedOutputFile(outputFile, sourceFile);
|
|
5312
|
+
const subpackageEntries = resolveSubpackageOutputSourceEntries(scopedOutputFile);
|
|
5094
5313
|
if (subpackageEntries) return (entries, filterOptions) => {
|
|
5095
5314
|
if (entries !== void 0) {
|
|
5096
5315
|
const scopedCandidates = options.getSourceCandidatesForEntries?.(entries, filterOptions) ?? /* @__PURE__ */ new Set();
|
|
@@ -5108,9 +5327,10 @@ function createSubpackageSourceCandidateScope(options) {
|
|
|
5108
5327
|
excludeEntries: [...filterOptions?.excludeEntries ?? [], ...subpackageSourceExcludeEntries]
|
|
5109
5328
|
}) ?? /* @__PURE__ */ new Set();
|
|
5110
5329
|
};
|
|
5111
|
-
const createScopedSourceCandidateSourceGetter = (outputFile, cssHandlerOptions) => {
|
|
5330
|
+
const createScopedSourceCandidateSourceGetter = (outputFile, cssHandlerOptions, sourceFile) => {
|
|
5112
5331
|
if (!options.getSourceCandidateSourcesForEntries) return;
|
|
5113
|
-
const
|
|
5332
|
+
const scopedOutputFile = resolveScopedOutputFile(outputFile, sourceFile);
|
|
5333
|
+
const subpackageEntries = resolveSubpackageOutputSourceEntries(scopedOutputFile);
|
|
5114
5334
|
if (subpackageEntries) return (entries, filterOptions) => {
|
|
5115
5335
|
if (entries !== void 0) {
|
|
5116
5336
|
const scopedSources = options.getSourceCandidateSourcesForEntries?.(entries, filterOptions) ?? /* @__PURE__ */ new Map();
|
|
@@ -5218,69 +5438,6 @@ function resolveCurrentSourceCandidateSource(options) {
|
|
|
5218
5438
|
return bestSource?.source;
|
|
5219
5439
|
}
|
|
5220
5440
|
//#endregion
|
|
5221
|
-
//#region src/bundlers/vite/generate-bundle/temporary-css-assets.ts
|
|
5222
|
-
function shouldQueueTemporarySource(entry, options) {
|
|
5223
|
-
return require_source_candidate_scan_signature.normalizeOutputPathKey(entry.outputFile).includes("/") || options.explicitSourceFileKeys.has(options.normalizeConfiguredSourceFile(entry.file)) && options.shouldSelectConfiguredRootOutput(entry.outputFile);
|
|
5224
|
-
}
|
|
5225
|
-
function collectTemporaryCssSourceEntries(options) {
|
|
5226
|
-
const runtimeLinkedEntries = [...options.runtimeLinkedCssFiles].map((file) => options.resolveRuntimeLinkedSource(file)).filter((entry) => entry != null && options.currentSubpackageRoots != null && shouldQueueTemporarySource(entry, options));
|
|
5227
|
-
const rememberedEntries = options.rememberedEntries.filter((entry) => shouldQueueTemporarySource(entry, options));
|
|
5228
|
-
const configuredEntries = options.configuredEntries.filter((entry) => require_source_candidate_scan_signature.normalizeOutputPathKey(entry.outputFile).includes("/") || shouldQueueTemporarySource(entry, options));
|
|
5229
|
-
const scopedEntries = options.currentSubpackageRoots ? options.configuredScopeEntries.filter((entry) => options.isSubpackageOutputFile(entry.outputFile, options.currentSubpackageRoots)) : [];
|
|
5230
|
-
return [
|
|
5231
|
-
...runtimeLinkedEntries,
|
|
5232
|
-
...rememberedEntries,
|
|
5233
|
-
...configuredEntries,
|
|
5234
|
-
...scopedEntries
|
|
5235
|
-
];
|
|
5236
|
-
}
|
|
5237
|
-
function isTemporaryCssAssetFile(file) {
|
|
5238
|
-
const normalized = require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
5239
|
-
return /\.css$/i.test(normalized) && !normalized.includes("/");
|
|
5240
|
-
}
|
|
5241
|
-
function normalizeCssSourceKey(file) {
|
|
5242
|
-
return require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
5243
|
-
}
|
|
5244
|
-
function createTemporaryCssAssetSourceResolver(entries) {
|
|
5245
|
-
const seenEntryFiles = /* @__PURE__ */ new Set();
|
|
5246
|
-
const queuedEntries = entries.filter((entry) => {
|
|
5247
|
-
const entryFile = normalizeCssSourceKey(entry.file);
|
|
5248
|
-
if (normalizeCssSourceKey(entry.outputFile) === entryFile || seenEntryFiles.has(entryFile)) return false;
|
|
5249
|
-
seenEntryFiles.add(entryFile);
|
|
5250
|
-
return true;
|
|
5251
|
-
});
|
|
5252
|
-
const usedEntryFiles = /* @__PURE__ */ new Set();
|
|
5253
|
-
return {
|
|
5254
|
-
entries: queuedEntries,
|
|
5255
|
-
markUsed(sourceFile) {
|
|
5256
|
-
if (!sourceFile) return;
|
|
5257
|
-
usedEntryFiles.add(normalizeCssSourceKey(sourceFile));
|
|
5258
|
-
},
|
|
5259
|
-
resolve(outputFile, rawSource) {
|
|
5260
|
-
if (!isTemporaryCssAssetFile(outputFile)) return;
|
|
5261
|
-
const outputFileKey = normalizeCssSourceKey(outputFile);
|
|
5262
|
-
const unusedEntries = queuedEntries.filter((item) => !usedEntryFiles.has(normalizeCssSourceKey(item.file)));
|
|
5263
|
-
const matchedOutputEntries = unusedEntries.filter((item) => normalizeCssSourceKey(item.outputFile) === outputFileKey);
|
|
5264
|
-
const usesMatchedOutputEntries = matchedOutputEntries.length > 0;
|
|
5265
|
-
const availableEntries = matchedOutputEntries.length > 0 ? matchedOutputEntries : unusedEntries.filter((item) => normalizeCssSourceKey(item.outputFile).includes("/"));
|
|
5266
|
-
const scoredEntries = rawSource ? availableEntries.map((entry) => ({
|
|
5267
|
-
entry,
|
|
5268
|
-
score: scoreConfiguredTailwindV4SourceForRawSource(rawSource, entry.source)
|
|
5269
|
-
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score) : [];
|
|
5270
|
-
const bestScore = scoredEntries[0]?.score;
|
|
5271
|
-
const bestEntries = bestScore ? scoredEntries.filter((item) => item.score === bestScore) : [];
|
|
5272
|
-
const entry = bestEntries.length === 1 ? bestEntries[0]?.entry : usesMatchedOutputEntries || rawSource == null ? availableEntries.find((item) => require_web.hasTailwindGenerationSource(item.source)) : void 0;
|
|
5273
|
-
if (!entry) return;
|
|
5274
|
-
usedEntryFiles.add(normalizeCssSourceKey(entry.file));
|
|
5275
|
-
return {
|
|
5276
|
-
outputFile: entry.outputFile,
|
|
5277
|
-
rawSource: entry.source,
|
|
5278
|
-
sourceFile: entry.file
|
|
5279
|
-
};
|
|
5280
|
-
}
|
|
5281
|
-
};
|
|
5282
|
-
}
|
|
5283
|
-
//#endregion
|
|
5284
5441
|
//#region src/bundlers/vite/generate-bundle/timing.ts
|
|
5285
5442
|
function createBundleTaskTimer(recordTimingDetail) {
|
|
5286
5443
|
return async (name, task) => {
|
|
@@ -5541,17 +5698,18 @@ function createGenerateBundleHook$1(context) {
|
|
|
5541
5698
|
tailwindcssBasedir: opts.tailwindcssBasedir,
|
|
5542
5699
|
useIncrementalMode
|
|
5543
5700
|
});
|
|
5544
|
-
const createScopedGeneratorRuntime$1 = (outputFile, cssHandlerOptions2, runtime2, rawSource, sourceFile) => require_scoped_generator.createScopedGeneratorRuntime({
|
|
5701
|
+
const createScopedGeneratorRuntime$1 = memoizeScopedGeneratorRuntime((outputFile, cssHandlerOptions2, runtime2, rawSource, sourceFile, scopeToSource) => require_scoped_generator.createScopedGeneratorRuntime({
|
|
5545
5702
|
cssHandlerOptions: cssHandlerOptions2,
|
|
5546
5703
|
fallbackRuntime: runtime2,
|
|
5547
5704
|
getSourceCandidatesForEntries: getCombinedSourceCandidatesForEntries,
|
|
5548
5705
|
majorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
5549
5706
|
outputFile,
|
|
5550
5707
|
rawSource,
|
|
5708
|
+
scopeToSource,
|
|
5551
5709
|
shouldExcludeSubpackageSourceCandidates,
|
|
5552
5710
|
sourceFile,
|
|
5553
|
-
scopedSourceCandidateGetter: createScopedSourceCandidateGetter(outputFile, cssHandlerOptions2)
|
|
5554
|
-
});
|
|
5711
|
+
scopedSourceCandidateGetter: createScopedSourceCandidateGetter(outputFile, cssHandlerOptions2, sourceFile)
|
|
5712
|
+
}));
|
|
5555
5713
|
const jsEntries = snapshot.jsEntries;
|
|
5556
5714
|
const getJsEntry = createJsEntryResolver(jsEntries);
|
|
5557
5715
|
const transformFilterSignature = createTransformFilterSignature(opts.transform);
|
|
@@ -6114,7 +6272,7 @@ function linkEntryChunkStyles(bundle, options) {
|
|
|
6114
6272
|
//#endregion
|
|
6115
6273
|
//#region src/bundlers/vite/css-finalizer/final-assets.ts
|
|
6116
6274
|
/** 按生成目标统一收尾已组装的 CSS 资产,供空资产和常规分支复用。 */
|
|
6117
|
-
function finalizeCssAssets(bundle, context, isWebGeneratorTarget, files) {
|
|
6275
|
+
async function finalizeCssAssets(bundle, context, isWebGeneratorTarget, files) {
|
|
6118
6276
|
if (isWebGeneratorTarget) return require_web.finalizeWebCssCalc(bundle, context);
|
|
6119
6277
|
finalizeMiniProgramCssAssetStructures(bundle, {
|
|
6120
6278
|
cssMatcher: context.opts.cssMatcher,
|
|
@@ -6124,6 +6282,7 @@ function finalizeCssAssets(bundle, context, isWebGeneratorTarget, files) {
|
|
|
6124
6282
|
onUpdate: context.opts.onUpdate,
|
|
6125
6283
|
recordCssAssetResult: context.recordCssAssetResult
|
|
6126
6284
|
});
|
|
6285
|
+
await require_web.finalizeCssCalc(bundle, context, true);
|
|
6127
6286
|
}
|
|
6128
6287
|
//#endregion
|
|
6129
6288
|
//#region src/bundlers/vite/css-finalizer/plugin.ts
|
|
@@ -6465,6 +6624,42 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
6465
6624
|
};
|
|
6466
6625
|
}
|
|
6467
6626
|
//#endregion
|
|
6627
|
+
//#region src/bundlers/vite/runtime-class-set/invalidation-plugin.ts
|
|
6628
|
+
/** 在框架的前置 SFC HMR 转换之前标记变更,刷新由下一次集合读取合并执行。 */
|
|
6629
|
+
function createRuntimeClassSetInvalidationPlugin(options) {
|
|
6630
|
+
const invalidate = (id) => {
|
|
6631
|
+
if (options.isEnabled() && options.isRelevant(id)) options.invalidate();
|
|
6632
|
+
};
|
|
6633
|
+
return {
|
|
6634
|
+
name: "weapp-tailwindcss:runtime-invalidation",
|
|
6635
|
+
enforce: "pre",
|
|
6636
|
+
watchChange: invalidate,
|
|
6637
|
+
handleHotUpdate: {
|
|
6638
|
+
order: "pre",
|
|
6639
|
+
handler(ctx) {
|
|
6640
|
+
invalidate(ctx.file);
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
};
|
|
6644
|
+
}
|
|
6645
|
+
//#endregion
|
|
6646
|
+
//#region src/bundlers/vite/runtime-class-set/lifecycle.ts
|
|
6647
|
+
/** 将失效通知放在框架前置钩子之前,释放钩子放在框架插件之后。 */
|
|
6648
|
+
function installRuntimeClassSetLifecycle(options) {
|
|
6649
|
+
if (options.uniAppX) options.plugins.unshift(createRuntimeClassSetInvalidationPlugin(options));
|
|
6650
|
+
options.plugins.push({
|
|
6651
|
+
name: "weapp-tailwindcss:runtime-dispose",
|
|
6652
|
+
closeWatcher: options.dispose,
|
|
6653
|
+
closeBundle() {
|
|
6654
|
+
const config = options.getResolvedConfig();
|
|
6655
|
+
if (!config?.build?.watch && config?.command !== "serve") options.dispose();
|
|
6656
|
+
},
|
|
6657
|
+
configureServer(server) {
|
|
6658
|
+
server.httpServer?.once("close", options.dispose);
|
|
6659
|
+
}
|
|
6660
|
+
});
|
|
6661
|
+
}
|
|
6662
|
+
//#endregion
|
|
6468
6663
|
//#region src/bundlers/vite/serve-js-transform.ts
|
|
6469
6664
|
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
6470
6665
|
function isViteServeJsRequest(id, command) {
|
|
@@ -6729,6 +6924,7 @@ function resolveFrameworkStylePlatform(opts, outDir) {
|
|
|
6729
6924
|
//#endregion
|
|
6730
6925
|
//#region src/bundlers/vite/shared/framework-source-candidates-plugin.ts
|
|
6731
6926
|
function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
6927
|
+
let previousBuildConsumedTailwindCss = false;
|
|
6732
6928
|
const shouldSkipSourceCandidateState = () => options.shouldSkipSourceCandidateState?.() === true;
|
|
6733
6929
|
const hasDifferentHotModules = (left, right) => left.length !== right.length || left.some((mod, index) => mod !== right[index]);
|
|
6734
6930
|
const hasTemplateHotSourceModule = (modules) => modules.some((mod) => {
|
|
@@ -6933,9 +7129,26 @@ function createFrameworkSourceCandidatesPlugin(options, apply) {
|
|
|
6933
7129
|
async buildStart() {
|
|
6934
7130
|
if (shouldSkipSourceCandidateState()) return;
|
|
6935
7131
|
await options.hmrTimingRecorder.measure("sourceCandidates.buildStart", options.prepareTailwindGeneration, { emit: false });
|
|
7132
|
+
if (previousBuildConsumedTailwindCss) for (const file of options.sourceScanSession.getWatchFiles?.() ?? []) this.addWatchFile(file);
|
|
7133
|
+
},
|
|
7134
|
+
async moduleParsed(module) {
|
|
7135
|
+
if (shouldSkipSourceCandidateState()) return;
|
|
7136
|
+
if (options.tailwindRootCssModuleIds?.has(module.id)) {
|
|
7137
|
+
await options.prepareTailwindGeneration();
|
|
7138
|
+
for (const file of options.sourceScanSession.getWatchFiles?.() ?? []) this.addWatchFile(file);
|
|
7139
|
+
}
|
|
7140
|
+
},
|
|
7141
|
+
async shouldTransformCachedModule(module) {
|
|
7142
|
+
if (!shouldSkipSourceCandidateState() && options.tailwindRootCssModuleIds?.has(module.id)) {
|
|
7143
|
+
await options.prepareTailwindGeneration();
|
|
7144
|
+
for (const file of options.sourceScanSession.getWatchFiles?.() ?? []) this.addWatchFile(file);
|
|
7145
|
+
}
|
|
7146
|
+
return null;
|
|
6936
7147
|
},
|
|
6937
7148
|
async generateBundle(...args) {
|
|
6938
7149
|
if (shouldSkipSourceCandidateState()) return;
|
|
7150
|
+
const roots = options.tailwindRootCssModuleIds;
|
|
7151
|
+
previousBuildConsumedTailwindCss = Boolean(roots && [...roots].some((id) => this.getModuleInfo?.(id) != null));
|
|
6939
7152
|
return options.preGenerateBundleHook?.apply(this, args);
|
|
6940
7153
|
}
|
|
6941
7154
|
};
|
|
@@ -6957,7 +7170,10 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
6957
7170
|
...options,
|
|
6958
7171
|
__internalDeferMissingCssEntriesWarning: true
|
|
6959
7172
|
};
|
|
6960
|
-
|
|
7173
|
+
let resolvedConfig;
|
|
7174
|
+
const originalOpts = isInternalUserDefinedOptions(options) ? options : require_compiler.getCompilerContext(deferredOptions);
|
|
7175
|
+
const cssCalcStage = require_web.createViteCssCalcStage(originalOpts, () => resolvedConfig?.command === "build", () => resolveFrameworkStylePlatform(originalOpts, resolvedConfig?.build?.outDir));
|
|
7176
|
+
const opts = cssCalcStage.options;
|
|
6961
7177
|
const syncCssEntriesFromAnchor = createFrameworkCssEntrySync(opts, rawCssEntries);
|
|
6962
7178
|
syncCssEntriesFromAnchor(opts.tailwindcssBasedir);
|
|
6963
7179
|
const { disabled, customAttributes, onLoad, mainCssChunkMatcher, styleHandler, jsHandler, tailwindRuntime, refreshTailwindcssRuntime, uniAppX, disabledDefaultTemplateHandler, styleInjector } = opts;
|
|
@@ -6970,7 +7186,6 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
6970
7186
|
const tailwindcssMajorVersion = initialTailwindRuntime.majorVersion ?? 0;
|
|
6971
7187
|
if (!disabledOptions.plugin && tailwindcssMajorVersion !== 4) throw new Error("weapp-tailwindcss/vite 新生成管线仅支持 Tailwind CSS v4,请升级 tailwindcss 或停留在旧版 weapp-tailwindcss。");
|
|
6972
7188
|
const shouldRewriteCssImports = opts.rewriteCssImports === true;
|
|
6973
|
-
let resolvedConfig;
|
|
6974
7189
|
const { observer: webCssEntryDiagnostics, plugin: webCssEntryObserverPlugin } = createConfiguredCssEntryDiagnostics({
|
|
6975
7190
|
getEntries: () => opts.cssEntries,
|
|
6976
7191
|
getRoot: () => resolvedConfig?.root,
|
|
@@ -7122,7 +7337,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
7122
7337
|
debug,
|
|
7123
7338
|
getSourceCandidateSource: (file) => sourceCandidateCollector.source(file)
|
|
7124
7339
|
});
|
|
7125
|
-
const { runtimeState, refreshRuntimeState, ensureRuntimeClassSet, ensureBundleRuntimeClassSet } = require_web.createViteRuntimeClassSet({
|
|
7340
|
+
const { runtimeState, refreshRuntimeState, invalidateRuntimeClassSet, ensureRuntimeClassSet, ensureBundleRuntimeClassSet } = require_web.createViteRuntimeClassSet({
|
|
7126
7341
|
opts,
|
|
7127
7342
|
initialTailwindRuntime,
|
|
7128
7343
|
refreshTailwindcssRuntime: refreshTailwindRuntime,
|
|
@@ -7515,6 +7730,7 @@ ${tracedCss}${currentGeneratorBranch.isWeb ? `\n${(0, _weapp_tailwindcss_postcss
|
|
|
7515
7730
|
});
|
|
7516
7731
|
const cssFinalizerContext = {
|
|
7517
7732
|
opts,
|
|
7733
|
+
getFinalCssCalcOptions: cssCalcStage.getFinalOptions,
|
|
7518
7734
|
runtimeState,
|
|
7519
7735
|
ensureRuntimeClassSet,
|
|
7520
7736
|
cssPipelineStrategy: frameworkCssPipelineStrategy,
|
|
@@ -7690,6 +7906,15 @@ ${tracedCss}${currentGeneratorBranch.isWeb ? `\n${(0, _weapp_tailwindcss_postcss
|
|
|
7690
7906
|
}],
|
|
7691
7907
|
postPlugin
|
|
7692
7908
|
];
|
|
7909
|
+
installRuntimeClassSetLifecycle({
|
|
7910
|
+
plugins,
|
|
7911
|
+
uniAppX: frameworkBranch.frameworkName === "uni-app-x",
|
|
7912
|
+
invalidate: invalidateRuntimeClassSet,
|
|
7913
|
+
isEnabled: shouldEnableFrameworkExtraPlugins,
|
|
7914
|
+
isRelevant: (id) => sourceScanSession.isDependency(id) || require_generated_css_marker.isSourceCandidateRequest(id),
|
|
7915
|
+
dispose: runtimeState.dispose,
|
|
7916
|
+
getResolvedConfig
|
|
7917
|
+
});
|
|
7693
7918
|
plugins.push(cssFinalizerOutputPlugin);
|
|
7694
7919
|
plugins.push(require_web.createViteHmrCssModuleVersionFilterPlugin(hmrCssModuleVersions));
|
|
7695
7920
|
if (capability.styleInjector) plugins.push(...capability.cssOnly && typeof options.__internalViteWebStyleInjectorFactory === "function" ? options.__internalViteWebStyleInjectorFactory(styleInjector) : require_scoped_generator.createBuiltinViteStyleInjectorPlugins(styleInjector, () => frameworkBranch.styleInjectorDelegate));
|