weapp-tailwindcss 5.1.13 → 5.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-2dg_uhEJ.mjs +13 -0
- package/dist/bundlers/gulp/frameworks/native/index.d.ts +2 -0
- package/dist/bundlers/gulp/index.d.ts +2 -0
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +2 -0
- package/dist/bundlers/shared/generated-css-marker.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/types.d.ts +5 -0
- package/dist/bundlers/shared/style-requests.d.ts +1 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -0
- package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +18 -0
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +7 -0
- package/dist/bundlers/vite/serve-css-generation.d.ts +3 -2
- package/dist/bundlers/vite/serve-root-import-shell.d.ts +8 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/source-candidates.d.ts +3 -0
- package/dist/bundlers/vite/watch-css-post.d.ts +10 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +4 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -0
- package/dist/{context-xSJE588m.mjs → context-BgGWVAmN.mjs} +5 -3
- package/dist/{context-DRRgW7i2.js → context-VeFq_8vW.js} +5 -3
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{generator-CS10c9g1.js → generator-CEnUsjed.js} +17 -3
- package/dist/{generator-BvPcmqxU.mjs → generator-CEo920So.mjs} +18 -4
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/{gulp-DNZZvUMq.js → gulp-3m1dAiig.js} +92 -54
- package/dist/{gulp-BEOzXrbp.mjs → gulp-DP71z1jG.mjs} +92 -54
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-hRhRAjYV.mjs → hmr-timing-1aS6--U7.mjs} +272 -56
- package/dist/{hmr-timing-DW1g3zjl.js → hmr-timing-B8p4f0ca.js} +323 -53
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/shared/mpx.d.ts +4 -1
- package/dist/{source-candidate-scan-signature-CMgu5bJk.js → source-candidate-scan-signature-BAahhiwb.js} +20 -139
- package/dist/{source-candidate-scan-signature-t4XKAQ04.mjs → source-candidate-scan-signature-Cf7259PR.mjs} +21 -104
- package/dist/tailwindcss/candidates.d.ts +4 -0
- package/dist/{tailwindcss-z9JMF-qU.js → tailwindcss-KBYPJ2DW.js} +1 -1
- package/dist/{tailwindcss-DZT_pWrd.mjs → tailwindcss-xs704TRw.mjs} +1 -1
- package/dist/{transform-D5JUgMpE.mjs → transform-B_KM9sLX.mjs} +47 -5
- package/dist/{transform-COFRlmDF.js → transform-CcYptivi.js} +47 -5
- package/dist/uni-app-x/component-local-style.d.ts +1 -0
- package/dist/uni-app-x/style-asset/style-value.d.ts +1 -1
- package/dist/{vite-DnkObu2L.js → vite-DUVjMduj.js} +807 -320
- package/dist/{vite-Tpgi77vE.mjs → vite-nXZEiwG0.mjs} +757 -270
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-generation-loader.js +12 -0
- package/dist/weapp-tw-css-import-rewrite-loader-DNk0IxAt.js +10198 -0
- package/dist/weapp-tw-css-import-rewrite-loader.js +6 -8209
- package/dist/{webpack-CTYm19zA.mjs → webpack-C_UUFRgj.mjs} +228 -58
- package/dist/{webpack-CzXjfvYS.js → webpack-nppysF4B.js} +240 -70
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +11 -3
- package/dist/auto-CrJJc5rK.mjs +0 -13
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
2
|
const require_framework = require("./framework.js");
|
|
3
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_generator = require("./generator-CEnUsjed.js");
|
|
4
4
|
const require_object = require("./object-COs_Mw6p.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
|
|
6
6
|
require("./utils-CuKLf1Zv.js");
|
|
7
7
|
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
8
|
-
const require_context = require("./context-
|
|
9
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
10
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
8
|
+
const require_context = require("./context-VeFq_8vW.js");
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-B8p4f0ca.js");
|
|
10
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-BAahhiwb.js");
|
|
11
11
|
require("./logger-TlKT3xmR.js");
|
|
12
12
|
let node_fs = require("node:fs");
|
|
13
13
|
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
@@ -196,8 +196,28 @@ function createStyleValueFromApplySources(sources, utilityStyles) {
|
|
|
196
196
|
}
|
|
197
197
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
199
|
+
function resolveReferencePaths(styleSource, sourceId) {
|
|
200
|
+
if (!sourceId || !styleSource.includes("@reference")) return styleSource;
|
|
201
|
+
let root;
|
|
202
|
+
try {
|
|
203
|
+
root = _weapp_tailwindcss_postcss.postcss.parse(styleSource);
|
|
204
|
+
} catch {
|
|
205
|
+
return styleSource;
|
|
206
|
+
}
|
|
207
|
+
const cleanSourceId = sourceId.replace(/\?.*$/, "");
|
|
208
|
+
root.walkAtRules("reference", (rule) => {
|
|
209
|
+
const quote = rule.params[0];
|
|
210
|
+
if (quote !== "\"" && quote !== "'") return;
|
|
211
|
+
const closingQuoteIndex = rule.params.indexOf(quote, 1);
|
|
212
|
+
if (closingQuoteIndex <= 1) return;
|
|
213
|
+
const referencePath = rule.params.slice(1, closingQuoteIndex);
|
|
214
|
+
if (!referencePath.startsWith(".")) return;
|
|
215
|
+
rule.params = `${quote}${node_path.default.resolve(node_path.default.dirname(cleanSourceId), referencePath)}${quote}${rule.params.slice(closingQuoteIndex + 1)}`;
|
|
216
|
+
});
|
|
217
|
+
return root.toString();
|
|
218
|
+
}
|
|
219
|
+
function collectUniAppXHarmonyApplyStyleSourcesFromSource(source, sourceId) {
|
|
220
|
+
return (source.includes("<style") ? [...source.matchAll(SFC_STYLE_BLOCK_RE$2)].map((styleBlock) => styleBlock[1] ?? "") : [source]).map((styleSource) => resolveReferencePaths(styleSource.trim(), sourceId)).filter((styleSource) => styleSource.length > 0 && styleSource.includes("@apply"));
|
|
201
221
|
}
|
|
202
222
|
function collectUniAppXHarmonyApplyUtilitiesFromSources(sources) {
|
|
203
223
|
const utilities = /* @__PURE__ */ new Set();
|
|
@@ -242,7 +262,18 @@ const STYLE_DECL_RE = /const\s+(_style_\d+)\s*=\s*\{/g;
|
|
|
242
262
|
const EXPORT_SFC_RE = /_export_sfc\(_sfc_main\s*,\s*\[/;
|
|
243
263
|
const UNI_APP_X_STYLE_PLACEHOLDER_VERSION = "uni-app-x-style-placeholder-v2";
|
|
244
264
|
function createUniAppXHarmonyApplyGeneratorSource(applyStyleSources, _applyUtilities) {
|
|
245
|
-
return applyStyleSources.
|
|
265
|
+
return applyStyleSources.map((source) => {
|
|
266
|
+
let root;
|
|
267
|
+
try {
|
|
268
|
+
root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
269
|
+
} catch {
|
|
270
|
+
return source;
|
|
271
|
+
}
|
|
272
|
+
root.walkAtRules("reference", (rule) => {
|
|
273
|
+
if (rule.params.match(/^(['"])(.+?)\1/)?.[2]?.startsWith(".")) rule.remove();
|
|
274
|
+
});
|
|
275
|
+
return root.toString();
|
|
276
|
+
}).join("\n");
|
|
246
277
|
}
|
|
247
278
|
function collectUniAppXHarmonyApplyUtilities(bundle) {
|
|
248
279
|
const utilities = /* @__PURE__ */ new Set();
|
|
@@ -471,6 +502,127 @@ function createUniAppXBundleAssetSourceGetter(bundle) {
|
|
|
471
502
|
};
|
|
472
503
|
}
|
|
473
504
|
//#endregion
|
|
505
|
+
//#region src/bundlers/vite/generate-bundle/transform-filter.ts
|
|
506
|
+
function toArray(value) {
|
|
507
|
+
return Array.isArray(value) ? value : value === void 0 ? [] : [value];
|
|
508
|
+
}
|
|
509
|
+
function normalizeSourceId(id) {
|
|
510
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
511
|
+
return node_path.default.isAbsolute(file) ? node_path.default.resolve(file) : void 0;
|
|
512
|
+
}
|
|
513
|
+
function collectChunkModuleIds$2(chunk) {
|
|
514
|
+
const ids = /* @__PURE__ */ new Set();
|
|
515
|
+
for (const id of chunk.moduleIds ?? []) {
|
|
516
|
+
const normalized = normalizeSourceId(id);
|
|
517
|
+
if (normalized) ids.add(normalized);
|
|
518
|
+
}
|
|
519
|
+
for (const id of Object.keys(chunk.modules ?? {})) {
|
|
520
|
+
const normalized = normalizeSourceId(id);
|
|
521
|
+
if (normalized) ids.add(normalized);
|
|
522
|
+
}
|
|
523
|
+
return ids;
|
|
524
|
+
}
|
|
525
|
+
function collectAssetSourceIds(asset, fallbackFile, rootDir) {
|
|
526
|
+
const ids = /* @__PURE__ */ new Set();
|
|
527
|
+
const sourceCandidates = [asset.originalFileName, ...asset.originalFileNames ?? []].filter((candidate) => typeof candidate === "string" && candidate.length > 0);
|
|
528
|
+
const candidates = sourceCandidates.length > 0 ? sourceCandidates : [fallbackFile];
|
|
529
|
+
for (const candidate of candidates) {
|
|
530
|
+
if (typeof candidate !== "string" || candidate.length === 0) continue;
|
|
531
|
+
const cleanCandidate = (0, _weapp_tailwindcss_shared.cleanUrl)(candidate);
|
|
532
|
+
const resolved = node_path.default.isAbsolute(cleanCandidate) ? node_path.default.resolve(cleanCandidate) : node_path.default.resolve(rootDir, cleanCandidate);
|
|
533
|
+
ids.add(resolved);
|
|
534
|
+
}
|
|
535
|
+
return ids;
|
|
536
|
+
}
|
|
537
|
+
function isStringRuleMatched(rule, id, rootDir) {
|
|
538
|
+
const normalizedId = require_source_candidate_scan_signature.slash(id);
|
|
539
|
+
const normalizedRule = require_source_candidate_scan_signature.slash(rule);
|
|
540
|
+
if (node_path.default.isAbsolute(rule)) return micromatch.default.isMatch(normalizedId, normalizedRule);
|
|
541
|
+
const relative = require_source_candidate_scan_signature.slash(node_path.default.relative(rootDir, id));
|
|
542
|
+
return relative.length > 0 && !relative.startsWith("../") && !node_path.default.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizedRule);
|
|
543
|
+
}
|
|
544
|
+
function isRuleMatched(rule, id, rootDir) {
|
|
545
|
+
if (typeof rule === "string") return isStringRuleMatched(rule, id, rootDir);
|
|
546
|
+
if (rule instanceof RegExp) {
|
|
547
|
+
rule.lastIndex = 0;
|
|
548
|
+
return rule.test(require_source_candidate_scan_signature.slash(id));
|
|
549
|
+
}
|
|
550
|
+
return rule(id) === true;
|
|
551
|
+
}
|
|
552
|
+
function createTransformMatcher(rules, rootDir) {
|
|
553
|
+
const normalizedRules = toArray(rules);
|
|
554
|
+
if (normalizedRules.length === 0) return;
|
|
555
|
+
return (id) => normalizedRules.some((rule) => isRuleMatched(rule, id, rootDir));
|
|
556
|
+
}
|
|
557
|
+
function shouldSkipSourceIds(sourceIds, filter) {
|
|
558
|
+
if (sourceIds.size === 0) return false;
|
|
559
|
+
if (filter.exclude) {
|
|
560
|
+
let excluded = true;
|
|
561
|
+
for (const id of sourceIds) if (!filter.exclude(id)) {
|
|
562
|
+
excluded = false;
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
if (excluded) return true;
|
|
566
|
+
}
|
|
567
|
+
if (filter.include) {
|
|
568
|
+
for (const id of sourceIds) if (filter.include(id)) return false;
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
function createTransformFilter(options, rootDir) {
|
|
574
|
+
const include = createTransformMatcher(options?.include, rootDir);
|
|
575
|
+
const exclude = createTransformMatcher(options?.exclude, rootDir);
|
|
576
|
+
if (!include && !exclude) return;
|
|
577
|
+
return {
|
|
578
|
+
include,
|
|
579
|
+
exclude
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function shouldSkipViteJsChunkTransform(chunk, filter) {
|
|
583
|
+
if (!filter) return false;
|
|
584
|
+
return shouldSkipSourceIds(collectChunkModuleIds$2(chunk), filter);
|
|
585
|
+
}
|
|
586
|
+
function shouldSkipViteAssetTransform(asset, file, rootDir, filter) {
|
|
587
|
+
if (!filter) return false;
|
|
588
|
+
return shouldSkipSourceIds(collectAssetSourceIds(asset, file, rootDir), filter);
|
|
589
|
+
}
|
|
590
|
+
function createRuleSignature(rules) {
|
|
591
|
+
return toArray(rules).map((rule) => {
|
|
592
|
+
if (typeof rule === "string") return `s:${rule}`;
|
|
593
|
+
if (rule instanceof RegExp) return `r:${rule.source}/${rule.flags}`;
|
|
594
|
+
return "f";
|
|
595
|
+
}).join("|") || "none";
|
|
596
|
+
}
|
|
597
|
+
function createTransformFilterSignature(options) {
|
|
598
|
+
return [`include:${createRuleSignature(options?.include)}`, `exclude:${createRuleSignature(options?.exclude)}`].join(";");
|
|
599
|
+
}
|
|
600
|
+
//#endregion
|
|
601
|
+
//#region src/bundlers/vite/generate-bundle/bundle-markup-candidates.ts
|
|
602
|
+
async function collectBundleMarkupCandidates(options) {
|
|
603
|
+
const { extractSourceCandidates, previousCandidatesByFile, preserveMissingFiles, resolveSourceCandidateFile, rootDir, snapshot, transformFilter } = options;
|
|
604
|
+
const candidatesByFile = preserveMissingFiles ? new Map([...previousCandidatesByFile ?? []].map(([file, candidates]) => [file, new Set(candidates)])) : /* @__PURE__ */ new Map();
|
|
605
|
+
await Promise.all(snapshot.entries.map(async (entry) => {
|
|
606
|
+
if (!extractSourceCandidates || entry.type !== "html" || entry.output.type !== "asset" || shouldSkipViteAssetTransform(entry.output, entry.file, rootDir, transformFilter)) return;
|
|
607
|
+
const sourceFile = resolveSourceCandidateFile(entry.file) ?? node_path.default.resolve(rootDir, entry.file);
|
|
608
|
+
candidatesByFile.set(sourceFile, await extractSourceCandidates(sourceFile, entry.source));
|
|
609
|
+
}));
|
|
610
|
+
const valuesForEntries = (entries, filterOptions = {}) => {
|
|
611
|
+
const values = /* @__PURE__ */ new Set();
|
|
612
|
+
for (const [file, candidates] of candidatesByFile) {
|
|
613
|
+
if (entries !== void 0 && !require_generator.isFileMatchedByTailwindSourceEntries(file, entries)) continue;
|
|
614
|
+
if (filterOptions.excludeEntries?.length && require_generator.isFileMatchedByTailwindSourceEntries(file, filterOptions.excludeEntries)) continue;
|
|
615
|
+
for (const candidate of candidates) values.add(candidate);
|
|
616
|
+
}
|
|
617
|
+
return values;
|
|
618
|
+
};
|
|
619
|
+
return {
|
|
620
|
+
candidatesByFile,
|
|
621
|
+
values: valuesForEntries(void 0),
|
|
622
|
+
valuesForEntries
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
//#endregion
|
|
474
626
|
//#region src/bundlers/vite/generate-bundle/configured-css-sources.ts
|
|
475
627
|
function collectConfiguredTailwindV4CssSources(opts) {
|
|
476
628
|
const runtimeCssSources = opts.tailwindcssRuntimeOptions?.tailwindcss?.v4?.cssSources ?? [];
|
|
@@ -554,7 +706,8 @@ function registerGeneratorDependencies$1(ctx, dependencies) {
|
|
|
554
706
|
//#region src/bundlers/vite/generate-bundle/css-assets.ts
|
|
555
707
|
function createCssAssetEmitter(context, bundle) {
|
|
556
708
|
return (fileName, source) => {
|
|
557
|
-
const
|
|
709
|
+
const fileNameKey = require_source_candidate_scan_signature.normalizeOutputPathKey(fileName);
|
|
710
|
+
const existing = bundle?.[fileName] ?? Object.entries(bundle ?? {}).find(([bundleFile, output]) => output != null && typeof output === "object" && "type" in output && output.type === "asset" && require_source_candidate_scan_signature.normalizeOutputPathKey("fileName" in output && typeof output.fileName === "string" ? output.fileName : bundleFile) === fileNameKey)?.[1];
|
|
558
711
|
if (existing && typeof existing === "object" && "type" in existing && existing.type === "asset") {
|
|
559
712
|
existing.source = source;
|
|
560
713
|
return existing;
|
|
@@ -651,8 +804,9 @@ function resolveMiniProgramStyleOutputExtension(options = {}) {
|
|
|
651
804
|
return resolveStyleOutputExtensionFromFiles(options.files, options.cssMatcher, options.stem) ?? resolveStyleOutputExtensionFromFiles(options.files, options.cssMatcher) ?? resolveStyleOutputExtensionFromMatcher(options.cssMatcher, options.stem) ?? normalizeStyleOutputExtension(options.fallback) ?? FALLBACK_STYLE_OUTPUT_EXTENSION;
|
|
652
805
|
}
|
|
653
806
|
function resolveReplayCssOutputFile(rootDir, file) {
|
|
654
|
-
const
|
|
655
|
-
|
|
807
|
+
const cleanFile = file.replace(/[?#].*$/, "");
|
|
808
|
+
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.isAbsolute(cleanFile) ? node_path.default.relative(resolveCssOutputRealPath(rootDir), resolveCssOutputRealPath(cleanFile)) : cleanFile);
|
|
809
|
+
if (normalizedFile.length === 0 || normalizedFile === "." || normalizedFile === ".." || normalizedFile.startsWith("../")) return require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.basename(cleanFile));
|
|
656
810
|
return normalizedFile;
|
|
657
811
|
}
|
|
658
812
|
function normalizeViteSourceRoot(rootDir, sourceRoot) {
|
|
@@ -668,9 +822,10 @@ function resolveReplayCssOutputFileFromSourceRoot(rootDir, file, sourceRoot) {
|
|
|
668
822
|
return outputFile;
|
|
669
823
|
}
|
|
670
824
|
function resolveViteCssOutputFile(file, opts, isWebGeneratorTarget, preserveCssExtension = false, styleOutputExtension, styleOutputFiles) {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
825
|
+
const cleanFile = file.replace(/[?#].*$/, "");
|
|
826
|
+
if (isWebGeneratorTarget || preserveCssExtension || opts.cssMatcher(cleanFile) || !CSS_SOURCE_OUTPUT_EXT_RE.test(cleanFile) || !require_source_candidate_scan_signature.isCSSRequest(file)) return cleanFile;
|
|
827
|
+
const stem = cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, "");
|
|
828
|
+
return cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, resolveMiniProgramStyleOutputExtension({
|
|
674
829
|
cssMatcher: opts.cssMatcher,
|
|
675
830
|
fallback: styleOutputExtension,
|
|
676
831
|
files: styleOutputFiles,
|
|
@@ -678,20 +833,40 @@ function resolveViteCssOutputFile(file, opts, isWebGeneratorTarget, preserveCssE
|
|
|
678
833
|
}));
|
|
679
834
|
}
|
|
680
835
|
function resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget = false, preserveCssExtension = false, sourceRoot, styleOutputExtension, styleOutputFiles) {
|
|
681
|
-
const
|
|
682
|
-
const cleanFile =
|
|
836
|
+
const sourceStyleRequest = require_source_candidate_scan_signature.isCSSRequest(file);
|
|
837
|
+
const cleanFile = resolveReplayCssOutputFileFromSourceRoot(rootDir, file, sourceRoot).replace(/[?#].*$/, "");
|
|
838
|
+
const sourceExtension = node_path.default.extname(cleanFile);
|
|
839
|
+
if (sourceStyleRequest && !isWebGeneratorTarget && !preserveCssExtension && sourceExtension.length > 0 && !CSS_SOURCE_OUTPUT_EXT_RE.test(cleanFile)) {
|
|
840
|
+
const stem = cleanFile.slice(0, -sourceExtension.length);
|
|
841
|
+
return `${stem}${resolveMiniProgramStyleOutputExtension({
|
|
842
|
+
cssMatcher: opts.cssMatcher,
|
|
843
|
+
fallback: styleOutputExtension,
|
|
844
|
+
files: styleOutputFiles,
|
|
845
|
+
stem
|
|
846
|
+
})}`;
|
|
847
|
+
}
|
|
683
848
|
const stem = cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, "");
|
|
684
849
|
const matchedStyleExtension = !isWebGeneratorTarget && !preserveCssExtension ? resolveStyleOutputExtensionFromFiles(styleOutputFiles, opts.cssMatcher, stem) : void 0;
|
|
685
|
-
if (matchedStyleExtension && CSS_SOURCE_OUTPUT_EXT_RE.test(cleanFile) &&
|
|
686
|
-
if (isWebGeneratorTarget || preserveCssExtension || opts.cssMatcher(
|
|
850
|
+
if (matchedStyleExtension && CSS_SOURCE_OUTPUT_EXT_RE.test(cleanFile) && sourceStyleRequest) return cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, matchedStyleExtension);
|
|
851
|
+
if (isWebGeneratorTarget || preserveCssExtension || opts.cssMatcher(cleanFile) || !CSS_SOURCE_OUTPUT_EXT_RE.test(cleanFile) || !sourceStyleRequest) return cleanFile;
|
|
687
852
|
const fallbackExtension = normalizeStyleOutputExtension(styleOutputExtension);
|
|
688
|
-
if (!fallbackExtension && !SOURCE_STYLE_OUTPUT_EXT_RE.test(
|
|
689
|
-
return
|
|
853
|
+
if (!fallbackExtension && !SOURCE_STYLE_OUTPUT_EXT_RE.test(cleanFile)) return cleanFile;
|
|
854
|
+
return cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, fallbackExtension ?? FALLBACK_STYLE_OUTPUT_EXTENSION);
|
|
690
855
|
}
|
|
691
856
|
function resolveViteCssPipelineOutputFileFromSourceFile(sourceFile, opts, rootDir, isWebGeneratorTarget = false, preserveCssExtension = false, sourceRoot, styleOutputExtension, styleOutputFiles) {
|
|
692
|
-
const
|
|
693
|
-
const cleanFile =
|
|
694
|
-
|
|
857
|
+
const sourceStyleRequest = require_source_candidate_scan_signature.isCSSRequest(sourceFile);
|
|
858
|
+
const cleanFile = resolveReplayCssOutputFileFromSourceRoot(rootDir, sourceFile, sourceRoot).replace(/[?#].*$/, "");
|
|
859
|
+
const sourceExtension = node_path.default.extname(cleanFile);
|
|
860
|
+
if (sourceStyleRequest && !isWebGeneratorTarget && !preserveCssExtension && sourceExtension.length > 0 && !CSS_SOURCE_OUTPUT_EXT_RE.test(cleanFile)) {
|
|
861
|
+
const stem = cleanFile.slice(0, -sourceExtension.length);
|
|
862
|
+
return resolveStyleOutputFileFromFiles(styleOutputFiles, opts.cssMatcher, stem) ?? `${stem}${resolveMiniProgramStyleOutputExtension({
|
|
863
|
+
cssMatcher: opts.cssMatcher,
|
|
864
|
+
fallback: styleOutputExtension,
|
|
865
|
+
files: styleOutputFiles,
|
|
866
|
+
stem
|
|
867
|
+
})}`;
|
|
868
|
+
}
|
|
869
|
+
if (isWebGeneratorTarget || preserveCssExtension || !CSS_SOURCE_OUTPUT_EXT_RE.test(cleanFile) || !sourceStyleRequest) return cleanFile;
|
|
695
870
|
const stem = cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, "");
|
|
696
871
|
const matchedStyleFile = resolveStyleOutputFileFromFiles(styleOutputFiles, opts.cssMatcher, stem);
|
|
697
872
|
if (matchedStyleFile) return matchedStyleFile;
|
|
@@ -701,7 +876,7 @@ function resolveViteCssPipelineOutputFileFromSourceFile(sourceFile, opts, rootDi
|
|
|
701
876
|
files: styleOutputFiles,
|
|
702
877
|
stem
|
|
703
878
|
}) ?? normalizeStyleOutputExtension(styleOutputExtension);
|
|
704
|
-
return
|
|
879
|
+
return cleanFile.replace(CSS_SOURCE_OUTPUT_EXT_RE, styleExtension);
|
|
705
880
|
}
|
|
706
881
|
function canProcessViteSourceStyleAsCss(source, file) {
|
|
707
882
|
if (SOURCE_STYLE_NON_CSS_SYNTAX_RE.test(source)) return false;
|
|
@@ -853,7 +1028,8 @@ function createCssHandlerOptionsCache(options) {
|
|
|
853
1028
|
const appType = options.getAppType();
|
|
854
1029
|
const isMainChunk = options.mainCssChunkMatcher(file, appType);
|
|
855
1030
|
const outputRoot = options.getOutputRoot?.();
|
|
856
|
-
const
|
|
1031
|
+
const sourceFile = require_hmr_timing.stripRequestQuery(file);
|
|
1032
|
+
const from = node_path.default.isAbsolute(sourceFile) ? sourceFile : outputRoot ? node_path.default.resolve(outputRoot, sourceFile) : sourceFile;
|
|
857
1033
|
const extraOptions = options.getExtraOptions?.(file) ?? {};
|
|
858
1034
|
const dynamicCssOptions = options.getDynamicCssOptions?.() ?? {};
|
|
859
1035
|
const cacheKey = `${majorVersion ?? "unknown"}:${appType ?? "unknown"}:${isMainChunk ? "1" : "0"}:${outputRoot ?? ""}:${file}:${JSON.stringify(extraOptions)}:${JSON.stringify(dynamicCssOptions)}`;
|
|
@@ -865,7 +1041,10 @@ function createCssHandlerOptionsCache(options) {
|
|
|
865
1041
|
...dynamicCssOptions,
|
|
866
1042
|
postcssOptions: { options: { from } },
|
|
867
1043
|
majorVersion: require_context.normalizeStyleHandlerMajorVersion(majorVersion),
|
|
868
|
-
sourceOptions: {
|
|
1044
|
+
sourceOptions: {
|
|
1045
|
+
outputRoot,
|
|
1046
|
+
...sourceFile === file ? {} : { requestFile: file }
|
|
1047
|
+
}
|
|
869
1048
|
};
|
|
870
1049
|
cssHandlerOptionsCache.set(cacheKey, created);
|
|
871
1050
|
return created;
|
|
@@ -905,6 +1084,21 @@ function createRelativeCssImportRequest$1(targetFile, importedFile) {
|
|
|
905
1084
|
function createCssImportShell$1(targetFile, importedFile) {
|
|
906
1085
|
return `@import "${createRelativeCssImportRequest$1(targetFile, importedFile)}";\n`;
|
|
907
1086
|
}
|
|
1087
|
+
function resolveSingleCssImportOutputFile(targetFile, css) {
|
|
1088
|
+
let importedFile;
|
|
1089
|
+
try {
|
|
1090
|
+
_weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules("import", (atRule) => {
|
|
1091
|
+
if (importedFile !== void 0) return;
|
|
1092
|
+
const request = require_generator.parseImportRequest(atRule.params);
|
|
1093
|
+
if (!request || /^(?:https?:)?\/\//i.test(request) || request.startsWith("data:")) return;
|
|
1094
|
+
const cleanRequest = request.replace(/[?#].*$/, "");
|
|
1095
|
+
if (!/\.(?:css|wxss|acss|ttss|qss|jxss|tyss)$/i.test(cleanRequest)) return;
|
|
1096
|
+
const targetDir = node_path.default.posix.dirname(require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile));
|
|
1097
|
+
importedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.posix.join(targetDir === "." ? "" : targetDir, cleanRequest));
|
|
1098
|
+
});
|
|
1099
|
+
} catch {}
|
|
1100
|
+
return importedFile;
|
|
1101
|
+
}
|
|
908
1102
|
function createRootMiniProgramOriginStyleOutputFile(file) {
|
|
909
1103
|
const normalized = require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
910
1104
|
if (/(?:^|\/)[^/]+-origin\.[^.]+$/i.test(normalized)) return normalized;
|
|
@@ -913,6 +1107,28 @@ function createRootMiniProgramOriginStyleOutputFile(file) {
|
|
|
913
1107
|
function shouldKeepRootMiniProgramStyleAsImportShell(enabled) {
|
|
914
1108
|
return enabled === true;
|
|
915
1109
|
}
|
|
1110
|
+
function shouldPreserveFrameworkRootMiniProgramImportShell(options) {
|
|
1111
|
+
return !options.isWebGeneratorTarget && options.matchesCss && isRootMiniProgramStyleOutputFile$1(options.file) && (0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(options.css) && shouldKeepRootMiniProgramStyleAsImportShell(options.shouldKeep());
|
|
1112
|
+
}
|
|
1113
|
+
function restoreFrameworkRootMiniProgramImportShellAssets(bundle, options) {
|
|
1114
|
+
if (options.isWebGeneratorTarget || options.targetByFile.size === 0) return 0;
|
|
1115
|
+
let restored = 0;
|
|
1116
|
+
for (const [sourceFile, targetFile] of options.targetByFile) {
|
|
1117
|
+
if (!options.matchesCss(sourceFile) || !options.matchesCss(targetFile) || !isRootMiniProgramStyleOutputFile$1(sourceFile) || !isRootMiniProgramStyleOutputFile$1(targetFile) || require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile)) continue;
|
|
1118
|
+
const output = Object.entries(bundle).find(([bundleFile, candidate]) => candidate.type === "asset" && require_source_candidate_scan_signature.normalizeOutputPathKey(candidate.fileName || bundleFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile))?.[1];
|
|
1119
|
+
if (output?.type !== "asset") continue;
|
|
1120
|
+
const rawSource = output.source.toString();
|
|
1121
|
+
if (!shouldKeepRootMiniProgramStyleAsImportShell(options.shouldKeep(sourceFile, rawSource))) continue;
|
|
1122
|
+
const nextSource = createCssImportShell$1(sourceFile, targetFile);
|
|
1123
|
+
if (rawSource === nextSource) continue;
|
|
1124
|
+
output.source = nextSource;
|
|
1125
|
+
options.recordCssAssetResult?.(sourceFile, nextSource);
|
|
1126
|
+
options.onUpdate?.(sourceFile, rawSource, nextSource);
|
|
1127
|
+
options.debug?.("restore framework root css import shell: %s -> %s", sourceFile, targetFile);
|
|
1128
|
+
restored++;
|
|
1129
|
+
}
|
|
1130
|
+
return restored;
|
|
1131
|
+
}
|
|
916
1132
|
function shouldMoveRootMiniProgramStyleToImportShellOrigin(enabled) {
|
|
917
1133
|
return enabled === true;
|
|
918
1134
|
}
|
|
@@ -931,7 +1147,8 @@ function shouldSkipRawSourceStyleAsset(outputFile, file, rawSource, assetSourceF
|
|
|
931
1147
|
const source = rawSource.trim();
|
|
932
1148
|
if (source.length === 0) return false;
|
|
933
1149
|
if (canProcessViteSourceStyleAsCss(source, file)) return false;
|
|
934
|
-
|
|
1150
|
+
if (SOURCE_STYLE_OUTPUT_EXT_RE.test(assetSourceFile.replace(/[?#].*$/, ""))) return true;
|
|
1151
|
+
const isKnownStyleSource = require_hmr_timing.isSourceStyleRequest(assetSourceFile) || cssMatcher?.(assetSourceFile) === true;
|
|
935
1152
|
return outputFile !== file || !isKnownStyleSource;
|
|
936
1153
|
}
|
|
937
1154
|
function resolveOutputFileFromMatchedCssSource(options) {
|
|
@@ -1499,6 +1716,10 @@ const SFC_STYLE_SOURCE_EXTENSIONS = [
|
|
|
1499
1716
|
const SFC_STYLE_BLOCK_RE$1 = /<style\b([^>]*)>([\s\S]*?)<\/style>/gi;
|
|
1500
1717
|
const SFC_SCOPED_STYLE_ATTR_RE = /(?:^|\s)scoped(?:\s|=|$)/i;
|
|
1501
1718
|
const SFC_LANG_STYLE_ATTR_RE = /(?:^|\s)lang(?:=(?:"([^"]+)"|'([^']+)'|([^\s"'=<>`]+)))?/i;
|
|
1719
|
+
function isSfcStyleSourceFile(file) {
|
|
1720
|
+
const normalizedFile = file.replace(/[?#].*$/, "");
|
|
1721
|
+
return SFC_STYLE_SOURCE_EXTENSIONS.some((extension) => normalizedFile.endsWith(extension));
|
|
1722
|
+
}
|
|
1502
1723
|
function extractSfcStyleBlocks(source) {
|
|
1503
1724
|
const styleSources = [];
|
|
1504
1725
|
SFC_STYLE_BLOCK_RE$1.lastIndex = 0;
|
|
@@ -1544,7 +1765,7 @@ function createSfcStyleRequest(sourceFile, styleBlock) {
|
|
|
1544
1765
|
if (lang) params.set("lang", lang);
|
|
1545
1766
|
return `${sourceFile}?${params.toString()}`;
|
|
1546
1767
|
}
|
|
1547
|
-
function resolveSfcStyleRequestFromKnownSource(sourceFile, sfcSource, styleSource) {
|
|
1768
|
+
function resolveSfcStyleRequestFromKnownSource(sourceFile, sfcSource, styleSource, currentRequest) {
|
|
1548
1769
|
if (!sfcSource) return sourceFile;
|
|
1549
1770
|
const styleBlocks = extractSfcStyleBlocks(sfcSource);
|
|
1550
1771
|
if (styleBlocks.length === 0) return sourceFile;
|
|
@@ -1553,7 +1774,8 @@ function resolveSfcStyleRequestFromKnownSource(sourceFile, sfcSource, styleSourc
|
|
|
1553
1774
|
const normalizedBlockSource = normalizeSfcStyleSourceForCompare(styleBlock.source);
|
|
1554
1775
|
return normalizedBlockSource === normalizedStyleSource || normalizedBlockSource.includes(normalizedStyleSource) || normalizedStyleSource.includes(normalizedBlockSource);
|
|
1555
1776
|
});
|
|
1556
|
-
const
|
|
1777
|
+
const requestIndex = currentRequest ? Number.parseInt(new URLSearchParams(currentRequest.split("?", 2)[1] ?? "").get("index") ?? "", 10) : NaN;
|
|
1778
|
+
const styleBlock = (Number.isInteger(requestIndex) ? styleBlocks.find((styleBlock) => styleBlock.index === requestIndex) : void 0) ?? (matchedBlocks.length === 1 ? matchedBlocks[0] : styleBlocks.length === 1 ? styleBlocks[0] : void 0);
|
|
1557
1779
|
return styleBlock ? createSfcStyleRequest(sourceFile, styleBlock) : sourceFile;
|
|
1558
1780
|
}
|
|
1559
1781
|
function hasTailwindGenerationSource(source, options = {}) {
|
|
@@ -1591,7 +1813,7 @@ async function resolveSfcStyleSourceFromOutputFile(outputFile, snapshot, outputR
|
|
|
1591
1813
|
function normalizeSfcSourceFileForCompare(file) {
|
|
1592
1814
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
1593
1815
|
}
|
|
1594
|
-
function collectChunkModuleIds$
|
|
1816
|
+
function collectChunkModuleIds$1(output) {
|
|
1595
1817
|
const moduleIds = Array.isArray(output.moduleIds) ? output.moduleIds : [];
|
|
1596
1818
|
return [
|
|
1597
1819
|
output.facadeModuleId,
|
|
@@ -1615,7 +1837,7 @@ function resolveSiblingJsChunkFile(outputFile, cssMatcher) {
|
|
|
1615
1837
|
}
|
|
1616
1838
|
function normalizeSfcModuleId(id) {
|
|
1617
1839
|
const file = id.replace(/[?#].*$/, "");
|
|
1618
|
-
if (!
|
|
1840
|
+
if (!isSfcStyleSourceFile(file)) return;
|
|
1619
1841
|
if (!node_path.default.isAbsolute(file)) return;
|
|
1620
1842
|
return node_path.default.resolve(file);
|
|
1621
1843
|
}
|
|
@@ -1631,7 +1853,7 @@ function resolveSfcStyleFileFromSiblingChunk(outputFile, snapshot, outputRoot, s
|
|
|
1631
1853
|
debug("sfc style sibling chunk skipped: missing chunk for %s -> %s", outputFile, siblingJsFile);
|
|
1632
1854
|
return;
|
|
1633
1855
|
}
|
|
1634
|
-
const sourceFiles = collectChunkModuleIds$
|
|
1856
|
+
const sourceFiles = collectChunkModuleIds$1(siblingChunk.output).map(normalizeSfcModuleId).filter((file, index, files) => Boolean(file) && files.indexOf(file) === index);
|
|
1635
1857
|
if (sourceFiles.length === 0) {
|
|
1636
1858
|
debug("sfc style sibling chunk skipped: no sfc modules for %s -> %s", outputFile, siblingJsFile);
|
|
1637
1859
|
return;
|
|
@@ -1662,7 +1884,7 @@ function resolveSourceStyleFileFromSiblingChunk(outputFile, snapshot, outputRoot
|
|
|
1662
1884
|
debug("source style sibling chunk skipped: missing chunk for %s -> %s", outputFile, siblingJsFile);
|
|
1663
1885
|
return;
|
|
1664
1886
|
}
|
|
1665
|
-
const sourceFiles = collectChunkModuleIds$
|
|
1887
|
+
const sourceFiles = collectChunkModuleIds$1(siblingChunk.output).map(normalizeSourceStyleModuleId).filter((file, index, files) => Boolean(file) && files.indexOf(file) === index);
|
|
1666
1888
|
if (sourceFiles.length === 0) {
|
|
1667
1889
|
debug("source style sibling chunk skipped: no source style modules for %s -> %s", outputFile, siblingJsFile);
|
|
1668
1890
|
return;
|
|
@@ -1781,7 +2003,7 @@ function collectMiniProgramSubpackageSourceEntries(snapshot, subpackageRoots, so
|
|
|
1781
2003
|
if (entry.output.type !== "chunk" || !isSubpackageOutputFile(entry.file, subpackageRoots)) continue;
|
|
1782
2004
|
const matchedSubpackageRoot = [...subpackageRoots].find((root) => isSubpackageOutputFile(entry.file, /* @__PURE__ */ new Set([root])));
|
|
1783
2005
|
if (!matchedSubpackageRoot) continue;
|
|
1784
|
-
for (const moduleId of collectChunkModuleIds$
|
|
2006
|
+
for (const moduleId of collectChunkModuleIds$1(entry.output)) {
|
|
1785
2007
|
if (!node_path.default.isAbsolute(moduleId.replace(/[?#].*$/, ""))) continue;
|
|
1786
2008
|
const sourceRoot = resolveSubpackageSourceRootFromModuleId(moduleId, matchedSubpackageRoot);
|
|
1787
2009
|
if (sourceRoot) sourceRoots.add(sourceRoot);
|
|
@@ -1945,13 +2167,13 @@ function isMatchingGeneratedCssMarkerFile(targetFile, markerFile, resolveVitePro
|
|
|
1945
2167
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(stripStyleExtension(targetFile)) === require_source_candidate_scan_signature.normalizeOutputPathKey(stripStyleExtension(normalizeMarkerOutputFile(markerFile, resolveViteProcessedCssOutputFile)));
|
|
1946
2168
|
}
|
|
1947
2169
|
function resolveViteProcessedCssAssetSource(file, rawSource, resolveViteProcessedCssOutputFile) {
|
|
1948
|
-
const blocks =
|
|
1949
|
-
if (blocks.length <= 1) return
|
|
2170
|
+
const blocks = require_hmr_timing.parseBundlerGeneratedCssMarkerBlocks(rawSource).filter((block) => block.bundler === "vite");
|
|
2171
|
+
if (blocks.length <= 1) return require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource);
|
|
1950
2172
|
const matchedCss = blocks.filter((block) => isMatchingGeneratedCssMarkerFile(file, block.file, resolveViteProcessedCssOutputFile)).map((block) => block.css);
|
|
1951
|
-
return matchedCss.length > 0 ? matchedCss.join("\n") :
|
|
2173
|
+
return matchedCss.length > 0 ? matchedCss.join("\n") : require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource);
|
|
1952
2174
|
}
|
|
1953
2175
|
function collectMatchingGeneratedCssMarkerFiles(file, rawSource, resolveViteProcessedCssOutputFile) {
|
|
1954
|
-
return
|
|
2176
|
+
return require_hmr_timing.parseBundlerGeneratedCssMarkerBlocks(rawSource).filter((block) => block.bundler === "vite").filter((block) => isMatchingGeneratedCssMarkerFile(file, block.file, resolveViteProcessedCssOutputFile)).map((block) => block.file).filter((markerFile) => typeof markerFile === "string" && markerFile.length > 0);
|
|
1955
2177
|
}
|
|
1956
2178
|
function collectRootStyleBundleCssSources(bundle, excludedFile) {
|
|
1957
2179
|
const sources = [];
|
|
@@ -1960,7 +2182,7 @@ function collectRootStyleBundleCssSources(bundle, excludedFile) {
|
|
|
1960
2182
|
if (output.type !== "asset") continue;
|
|
1961
2183
|
const file = require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile$1(bundleFile, output));
|
|
1962
2184
|
if (file === excludedFileKey || !isRootStyleOutputFile(file)) continue;
|
|
1963
|
-
const source =
|
|
2185
|
+
const source = require_hmr_timing.stripBundlerGeneratedCssMarkers(readAssetSource$2(output)).trim();
|
|
1964
2186
|
if (source.length > 0) sources.push(source);
|
|
1965
2187
|
}
|
|
1966
2188
|
return sources;
|
|
@@ -2013,7 +2235,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
2013
2235
|
if (output.type !== "asset") continue;
|
|
2014
2236
|
const file = getAssetFile$1(bundleFile, output);
|
|
2015
2237
|
if (!isCssOutputFile(file) || isMiniProgramStyleOutputFile(file) || !isLinkedStyleFile(file, linked)) continue;
|
|
2016
|
-
const source =
|
|
2238
|
+
const source = require_hmr_timing.stripBundlerGeneratedCssMarkers(readAssetSource$2(output)).trim();
|
|
2017
2239
|
if (source.length > 0) linkedSources.add(source);
|
|
2018
2240
|
}
|
|
2019
2241
|
if (linkedSources.size === 0) return 0;
|
|
@@ -2022,7 +2244,7 @@ function removeDuplicateUnlinkedRootCssAssetsReferencedByHtml(bundle, options =
|
|
|
2022
2244
|
if (output.type !== "asset") continue;
|
|
2023
2245
|
const file = getAssetFile$1(bundleFile, output);
|
|
2024
2246
|
if (!isRootStyleOutputFile(file) || isMiniProgramStyleOutputFile(file) || isLinkedStyleFile(file, linked)) continue;
|
|
2025
|
-
const source =
|
|
2247
|
+
const source = require_hmr_timing.stripBundlerGeneratedCssMarkers(readAssetSource$2(output)).trim();
|
|
2026
2248
|
if (!linkedSources.has(source)) continue;
|
|
2027
2249
|
delete bundle[bundleFile];
|
|
2028
2250
|
options.debug?.("remove duplicate unlinked root css asset referenced by html: %s", file);
|
|
@@ -2187,7 +2409,7 @@ function removeScopedTailwindPreflightCss(css) {
|
|
|
2187
2409
|
return removeScopedCssCoveredByRootStyleSources(css, []);
|
|
2188
2410
|
}
|
|
2189
2411
|
function collectSingleViteGeneratedCssMarkerFile(rawSource) {
|
|
2190
|
-
const blocks =
|
|
2412
|
+
const blocks = require_hmr_timing.parseBundlerGeneratedCssMarkerBlocks(rawSource).filter((block) => block.bundler === "vite");
|
|
2191
2413
|
if (blocks.length !== 1) return;
|
|
2192
2414
|
const file = blocks[0]?.file;
|
|
2193
2415
|
return typeof file === "string" && file.length > 0 ? file : void 0;
|
|
@@ -2263,11 +2485,17 @@ function isMiniProgramStyleOutputFile(file) {
|
|
|
2263
2485
|
}
|
|
2264
2486
|
function shouldPreserveMiniProgramImportShell(options, bundle, file, css) {
|
|
2265
2487
|
const context = createCssAssetPipelineContext(options, file, bundle);
|
|
2266
|
-
return context !== void 0 &&
|
|
2267
|
-
...context,
|
|
2488
|
+
return context !== void 0 && shouldPreserveFrameworkRootMiniProgramImportShell({
|
|
2268
2489
|
css,
|
|
2269
|
-
file
|
|
2270
|
-
|
|
2490
|
+
file,
|
|
2491
|
+
isWebGeneratorTarget: context.currentGeneratorBranch?.isWeb === true,
|
|
2492
|
+
matchesCss: options.opts.cssMatcher(file),
|
|
2493
|
+
shouldKeep: () => options.cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
2494
|
+
...context,
|
|
2495
|
+
css,
|
|
2496
|
+
file
|
|
2497
|
+
})
|
|
2498
|
+
});
|
|
2271
2499
|
}
|
|
2272
2500
|
function resolvePreservedImportShellInjectionTarget(options, bundle, file, css) {
|
|
2273
2501
|
const context = createCssAssetPipelineContext(options, file, bundle);
|
|
@@ -2366,7 +2594,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
|
|
|
2366
2594
|
}
|
|
2367
2595
|
function removeCssCoveredByImportedViteResults(css, importedCssSources) {
|
|
2368
2596
|
if (importedCssSources.length === 0) return css;
|
|
2369
|
-
const importedCss = importedCssSources.map((source) =>
|
|
2597
|
+
const importedCss = importedCssSources.map((source) => require_hmr_timing.stripBundlerGeneratedCssMarkers(source).trim()).filter(Boolean).join("\n");
|
|
2370
2598
|
if (importedCss.length === 0) return css;
|
|
2371
2599
|
return restoreCssImportAtRules(css, removeCssRulesCoveredBySources(css, [importedCss], { exactOnly: true }));
|
|
2372
2600
|
}
|
|
@@ -2678,7 +2906,7 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
2678
2906
|
if (!shouldInjectViteProcessedCssResult(options.opts, mainFileKey, record.file, record)) continue;
|
|
2679
2907
|
if (isViteProcessedCssResultImported(record, importedStyleFiles)) continue;
|
|
2680
2908
|
targetViteCssResults.push(record);
|
|
2681
|
-
let css = normalizeInjectableCssForTarget(
|
|
2909
|
+
let css = normalizeInjectableCssForTarget(require_hmr_timing.stripBundlerGeneratedCssMarkers(record.css).trim(), file).trim();
|
|
2682
2910
|
css = removeCssCoveredByImportedViteResults(css, importedCssSources).trim();
|
|
2683
2911
|
if (css.length === 0) continue;
|
|
2684
2912
|
const mergedLayerCss = require_hmr_timing.mergeMarkedUserLayerComponentsCss(nextCss, css);
|
|
@@ -3037,21 +3265,6 @@ function resolveRootMiniProgramOriginStyleFile(file) {
|
|
|
3037
3265
|
if (/(?:^|\/)[^/]+-origin\.[^.]+$/i.test(normalized)) return;
|
|
3038
3266
|
return normalized.replace(/(\.[^.]+)$/, "-origin$1");
|
|
3039
3267
|
}
|
|
3040
|
-
function resolveSingleCssImportOutputFile(targetFile, css) {
|
|
3041
|
-
let importedFile;
|
|
3042
|
-
try {
|
|
3043
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules("import", (atRule) => {
|
|
3044
|
-
if (importedFile !== void 0) return;
|
|
3045
|
-
const request = require_generator.parseImportRequest(atRule.params);
|
|
3046
|
-
if (!request || /^(?:https?:)?\/\//i.test(request) || request.startsWith("data:")) return;
|
|
3047
|
-
const cleanRequest = request.replace(/[?#].*$/, "");
|
|
3048
|
-
if (!/\.(?:css|wxss|acss|ttss|qss|jxss|tyss)$/i.test(cleanRequest)) return;
|
|
3049
|
-
const targetDir = node_path.default.posix.dirname(require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile));
|
|
3050
|
-
importedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.posix.join(targetDir === "." ? "" : targetDir, cleanRequest));
|
|
3051
|
-
});
|
|
3052
|
-
} catch {}
|
|
3053
|
-
return importedFile;
|
|
3054
|
-
}
|
|
3055
3268
|
function normalizeRootMiniProgramImportShellAssets(bundle, options) {
|
|
3056
3269
|
if (!options.enabled) return 0;
|
|
3057
3270
|
let updated = 0;
|
|
@@ -3321,11 +3534,12 @@ function collectUnescapedDynamicCandidates(source, allowedCandidates) {
|
|
|
3321
3534
|
//#region src/bundlers/vite/generate-bundle/html-processing.ts
|
|
3322
3535
|
function processHtmlBundleEntry(options) {
|
|
3323
3536
|
const { cache, context, debug, dynamicRetryCandidates, file, metrics, onUpdate, originalEntrySource, originalSource, rememberProcessCacheKey, resolveCurrentSourceCandidateSource, tasks, templateHandler, timeTask, transformRuntime, transformRuntimeSignature } = options;
|
|
3324
|
-
const
|
|
3325
|
-
const
|
|
3326
|
-
const
|
|
3537
|
+
const currentBundleSource = originalEntrySource;
|
|
3538
|
+
const candidateSource = resolveCurrentSourceCandidateSource(file) ?? currentBundleSource;
|
|
3539
|
+
const currentRawDynamicCandidates = /* @__PURE__ */ new Set([...collectUnescapedDynamicCandidates(candidateSource), ...collectUnescapedDynamicCandidates(currentBundleSource)]);
|
|
3540
|
+
const templateRuntime = currentRawDynamicCandidates.size > 0 ? /* @__PURE__ */ new Set([...transformRuntime, ...currentRawDynamicCandidates]) : transformRuntime;
|
|
3327
3541
|
const templateRuntimeSignature = templateRuntime === transformRuntime ? transformRuntimeSignature : require_source_candidate_scan_signature.createCandidateSignature(templateRuntime);
|
|
3328
|
-
const htmlProcessHash = `${cache.computeHash(
|
|
3542
|
+
const htmlProcessHash = `${cache.computeHash(currentBundleSource)}:${cache.computeHash(require_source_candidate_scan_signature.createRuntimeAffectingSourceSignature(currentBundleSource, "html"))}:${templateRuntimeSignature}`;
|
|
3329
3543
|
const cacheKey = `${file}:html:${htmlProcessHash}`;
|
|
3330
3544
|
const hashKey = cacheKey;
|
|
3331
3545
|
rememberProcessCacheKey(cacheKey, hashKey);
|
|
@@ -3343,7 +3557,7 @@ function processHtmlBundleEntry(options) {
|
|
|
3343
3557
|
},
|
|
3344
3558
|
async transform() {
|
|
3345
3559
|
const start = performance.now();
|
|
3346
|
-
let transformed = await templateHandler(
|
|
3560
|
+
let transformed = await templateHandler(currentBundleSource, { runtimeSet: templateRuntime });
|
|
3347
3561
|
let unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed);
|
|
3348
3562
|
let retryRuntimeSet;
|
|
3349
3563
|
if (unresolvedDynamicCandidates.length > 0) {
|
|
@@ -3354,13 +3568,13 @@ function processHtmlBundleEntry(options) {
|
|
|
3354
3568
|
}
|
|
3355
3569
|
if (retryRuntimeSet && unresolvedDynamicCandidates.length > 0) {
|
|
3356
3570
|
_weapp_tailwindcss_logger.logger.warn("检测到已提取 WXML 动态类名未完成转译,已回退到完整 runtimeSet 重试: %s -> %O", file, unresolvedDynamicCandidates);
|
|
3357
|
-
transformed = await templateHandler(
|
|
3571
|
+
transformed = await templateHandler(currentBundleSource, { runtimeSet: retryRuntimeSet });
|
|
3358
3572
|
unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed, retryRuntimeSet);
|
|
3359
3573
|
if (unresolvedDynamicCandidates.length > 0) _weapp_tailwindcss_logger.logger.warn("已提取 WXML 动态类名在完整 runtimeSet 重试后仍未完成转译: %s -> %O", file, unresolvedDynamicCandidates);
|
|
3360
3574
|
}
|
|
3361
3575
|
metrics.html.elapsed += measureElapsed(start);
|
|
3362
3576
|
metrics.html.transformed++;
|
|
3363
|
-
onUpdate(file,
|
|
3577
|
+
onUpdate(file, currentBundleSource, transformed);
|
|
3364
3578
|
debug("html handle: %s", file);
|
|
3365
3579
|
return { result: transformed };
|
|
3366
3580
|
}
|
|
@@ -3466,7 +3680,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
3466
3680
|
//#region src/uni-app-x/vite.ts
|
|
3467
3681
|
let transformUVuePromise;
|
|
3468
3682
|
function loadTransformUVue() {
|
|
3469
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
3683
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-CcYptivi.js")).then((mod) => mod.transformUVue));
|
|
3470
3684
|
return transformUVuePromise;
|
|
3471
3685
|
}
|
|
3472
3686
|
const preprocessorLangs = /* @__PURE__ */ new Set([
|
|
@@ -3507,8 +3721,8 @@ function createUniAppXPlugins(options) {
|
|
|
3507
3721
|
let componentLocalStyleEnabled;
|
|
3508
3722
|
const harmonyApplyStyleSources = /* @__PURE__ */ new Set();
|
|
3509
3723
|
const harmonyApplyUtilities = /* @__PURE__ */ new Set();
|
|
3510
|
-
function rememberHarmonyApplySource(code) {
|
|
3511
|
-
const styleSources = collectUniAppXHarmonyApplyStyleSourcesFromSource(code);
|
|
3724
|
+
function rememberHarmonyApplySource(code, id) {
|
|
3725
|
+
const styleSources = collectUniAppXHarmonyApplyStyleSourcesFromSource(code, id);
|
|
3512
3726
|
if (styleSources.length === 0) return;
|
|
3513
3727
|
for (const styleSource of styleSources) {
|
|
3514
3728
|
harmonyApplyStyleSources.add(styleSource);
|
|
@@ -3541,7 +3755,7 @@ function createUniAppXPlugins(options) {
|
|
|
3541
3755
|
if (require_source_candidate_scan_signature.isCSSRequest(id) || parsed.vue && parsed.type === "style") {
|
|
3542
3756
|
if (isCssModuleExport(code)) return;
|
|
3543
3757
|
const shouldGenerateCss = require_generator.hasTailwindSourceDirectives(code, { importFallback: true }) || require_generator.hasTailwindApplyDirective(code);
|
|
3544
|
-
rememberHarmonyApplySource(code);
|
|
3758
|
+
rememberHarmonyApplySource(code, id);
|
|
3545
3759
|
const generatedCss = shouldGenerateCss ? await generateCss?.(id, code, hookContext) : void 0;
|
|
3546
3760
|
const styleCode = typeof generatedCss === "string" && generatedCss.trim().length > 0 ? generatedCss : code;
|
|
3547
3761
|
const cacheKey = `${mainCssChunkMatcher(id, appType) ? "1" : "0"}:${id}`;
|
|
@@ -3601,7 +3815,7 @@ function createUniAppXPlugins(options) {
|
|
|
3601
3815
|
async transform(code, id) {
|
|
3602
3816
|
if (!isEnabled()) return;
|
|
3603
3817
|
if (!UVUE_NVUE_QUERY_RE.test(id)) return;
|
|
3604
|
-
rememberHarmonyApplySource(code);
|
|
3818
|
+
rememberHarmonyApplySource(code, id);
|
|
3605
3819
|
const resolvedConfig = getResolvedConfig();
|
|
3606
3820
|
const isServeCommand = resolvedConfig?.command === "serve";
|
|
3607
3821
|
const isWatchBuild = resolvedConfig?.command === "build" && !!resolvedConfig.build?.watch;
|
|
@@ -3610,13 +3824,19 @@ function createUniAppXPlugins(options) {
|
|
|
3610
3824
|
const transformUVue = await loadTransformUVue();
|
|
3611
3825
|
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
3612
3826
|
const enablePageLocalStyle = shouldEnableHarmonyPageLocalStyle();
|
|
3613
|
-
if (customAttributesEntities.length > 0 || disabledDefaultTemplateHandler || enableComponentLocalStyle || enablePageLocalStyle)
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3827
|
+
if (customAttributesEntities.length > 0 || disabledDefaultTemplateHandler || enableComponentLocalStyle || enablePageLocalStyle) {
|
|
3828
|
+
const result = transformUVue(code, id, jsHandler, currentRuntimeSet, require_object.omitUndefined({
|
|
3829
|
+
...customAttributesEntities.length > 0 ? { customAttributesEntities } : {},
|
|
3830
|
+
...disabledDefaultTemplateHandler ? { disabledDefaultTemplateHandler } : {},
|
|
3831
|
+
...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
|
|
3832
|
+
...enablePageLocalStyle ? { enablePageLocalStyle } : {}
|
|
3833
|
+
}));
|
|
3834
|
+
if (result?.code) rememberHarmonyApplySource(result.code, id);
|
|
3835
|
+
return result;
|
|
3836
|
+
}
|
|
3837
|
+
const result = transformUVue(code, id, jsHandler, currentRuntimeSet);
|
|
3838
|
+
if (result?.code) rememberHarmonyApplySource(result.code, id);
|
|
3839
|
+
return result;
|
|
3620
3840
|
},
|
|
3621
3841
|
async handleHotUpdate(ctx) {
|
|
3622
3842
|
if (!isEnabled()) return;
|
|
@@ -3646,7 +3866,7 @@ function createUniAppXPlugins(options) {
|
|
|
3646
3866
|
const getAssetSource = createUniAppXBundleAssetSourceGetter(bundle);
|
|
3647
3867
|
if (isHarmonyTarget) {
|
|
3648
3868
|
const cssSources = [];
|
|
3649
|
-
const applyStyleSources = [...harmonyApplyStyleSources
|
|
3869
|
+
const applyStyleSources = harmonyApplyStyleSources.size > 0 ? [...harmonyApplyStyleSources] : collectUniAppXHarmonyApplyStyleSources(bundle);
|
|
3650
3870
|
const applyUtilities = /* @__PURE__ */ new Set([...harmonyApplyUtilities, ...collectUniAppXHarmonyApplyUtilities(bundle)]);
|
|
3651
3871
|
if (applyStyleSources.length > 0 && applyUtilities.size > 0) {
|
|
3652
3872
|
const harmonyApplyCssFile = node_path.default.resolve(getResolvedConfig()?.root ?? node_process.default.cwd(), "uni-app-x-harmony-apply.css");
|
|
@@ -3867,7 +4087,7 @@ function findRememberedCssSources(sources, outputFile, file, originalSource, out
|
|
|
3867
4087
|
if (!sources) return [];
|
|
3868
4088
|
const rememberedSources = [...sources].map(([, remembered]) => remembered);
|
|
3869
4089
|
const source = typeof originalSource.source === "string" ? originalSource.source : originalSource.source.toString();
|
|
3870
|
-
const markerFiles = new Set(
|
|
4090
|
+
const markerFiles = new Set(require_hmr_timing.parseBundlerGeneratedCssMarkerBlocks(source).filter((block) => block.bundler === "vite" && typeof block.file === "string" && block.file.length > 0).map((block) => require_source_candidate_scan_signature.normalizeOutputPathKey(block.file)));
|
|
3871
4091
|
if (markerFiles.size > 0) {
|
|
3872
4092
|
const markerMatched = rememberedSources.filter((remembered) => markerFiles.has(normalizeRememberedSourceIdentity(remembered.sourceFile)));
|
|
3873
4093
|
if (markerMatched.length > 0) return selectBestRememberedCssSourceMatches(markerMatched, outputFile, outputRoot, sourceRoot);
|
|
@@ -3884,7 +4104,7 @@ function findRememberedCssSources(sources, outputFile, file, originalSource, out
|
|
|
3884
4104
|
}
|
|
3885
4105
|
const outputMatched = rememberedSources.filter((remembered) => require_source_candidate_scan_signature.normalizeOutputPathKey(remembered.outputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile));
|
|
3886
4106
|
if (outputMatched.length > 0) return outputMatched;
|
|
3887
|
-
if (!
|
|
4107
|
+
if (!require_hmr_timing.hasBundlerGeneratedCssMarker(source) && !hasTailwindGenerationSource(source)) return [];
|
|
3888
4108
|
const scoredMatches = selectBestRememberedCssSourceMatches(rememberedSources, outputFile, outputRoot, sourceRoot);
|
|
3889
4109
|
const strongScoredMatches = selectBestRememberedCssSourceMatches(rememberedSources, outputFile, outputRoot, sourceRoot, { minimumScore: 1e5 });
|
|
3890
4110
|
if (strongScoredMatches.length > 0 && strongScoredMatches.length < rememberedSources.length) return strongScoredMatches;
|
|
@@ -3924,17 +4144,25 @@ function collectRememberedCssReplayGroups(sources, opts, rootDir, isWebGenerator
|
|
|
3924
4144
|
}
|
|
3925
4145
|
//#endregion
|
|
3926
4146
|
//#region src/bundlers/vite/generate-bundle/remembered-css-replay.ts
|
|
4147
|
+
function shouldSkipRawRememberedCssSource(rawSource, sourceFile) {
|
|
4148
|
+
const cleanSourceFile = sourceFile.replace(/[?#].*$/, "");
|
|
4149
|
+
return SOURCE_STYLE_OUTPUT_EXT_RE.test(cleanSourceFile) && !canProcessViteSourceStyleAsCss(rawSource, sourceFile);
|
|
4150
|
+
}
|
|
3927
4151
|
async function processRememberedCssReplay(options) {
|
|
3928
|
-
const { addWatchFile, activeViteCssCacheFiles, bundleFiles, cache, changedCssFiles = /* @__PURE__ */ new Set(), createScopedGeneratorRuntime, createScopedSourceCandidateGetter, createScopedSourceCandidateSourceGetter, cssTaskFactories, debug, defaultStyleOutputExtension, emitOrReplayCssAsset, generatorRuntime, generatorPlatform, getCssHandlerOptions, getCssUserHandlerOptions, getRememberedCssSignature, getRememberedCssSources, isNativeAppStyleTarget, isWebGeneratorTarget, lastCssRawSourceHashByFile = /* @__PURE__ */ new Map(), lastCssResultByFile, lastCssSourceHashByFile, markCssAssetProcessed, metrics, normalizeViteCssCacheKey, onUpdate, opts, recordCssAssetResult, recordViteProcessedCssAssetResult, refreshRememberedCssSource, rootDir, runtimeState, setRememberedCssSignature, shouldInjectCssIntoMainFromOutput, shouldPreserveAppCssExtension, sourceRoot, styleHandler, timeTask, useIncrementalMode } = options;
|
|
4152
|
+
const { addWatchFile, activeViteCssCacheFiles, bundleFiles, cache, changedCssFiles = /* @__PURE__ */ new Set(), createScopedGeneratorRuntime, createScopedSourceCandidateGetter, createScopedSourceCandidateSourceGetter, cssTaskFactories, cssPipelineContext, cssPipelineStrategy, debug, defaultStyleOutputExtension, emitOrReplayCssAsset, generatorRuntime, generatorPlatform, getCssHandlerOptions, getCssUserHandlerOptions, getRememberedCssSignature, getRememberedCssSources, isNativeAppStyleTarget, isWebGeneratorTarget, lastCssRawSourceHashByFile = /* @__PURE__ */ new Map(), lastCssResultByFile, lastCssSourceHashByFile, markCssAssetProcessed, metrics, normalizeViteCssCacheKey, onUpdate, opts, recordCssAssetResult, recordViteProcessedCssAssetResult, refreshRememberedCssSource, rootDir, runtimeState, setRememberedCssSignature, shouldInjectCssIntoMainFromOutput, shouldPreserveAppCssExtension, sourceRoot, styleHandler, timeTask, useIncrementalMode } = options;
|
|
3929
4153
|
const rememberedReplayGroups = collectRememberedCssReplayGroups(getRememberedCssSources?.(), opts, rootDir, isWebGeneratorTarget, shouldPreserveAppCssExtension, sourceRoot, defaultStyleOutputExtension, bundleFiles);
|
|
3930
4154
|
for (const [outputFile, rememberedGroup] of rememberedReplayGroups) {
|
|
3931
4155
|
if (require_source_candidate_scan_signature.isHTMLRequest(outputFile) || options.opts.htmlMatcher(outputFile)) continue;
|
|
3932
|
-
const
|
|
4156
|
+
const replayableRememberedGroup = (await Promise.all(rememberedGroup.map(async (item) => ({
|
|
3933
4157
|
key: item.key,
|
|
3934
4158
|
remembered: await refreshRememberedCssSource?.(item.remembered) ?? item.remembered
|
|
3935
|
-
})))
|
|
3936
|
-
|
|
3937
|
-
|
|
4159
|
+
})))).filter(({ remembered }) => {
|
|
4160
|
+
const shouldSkip = shouldSkipRawRememberedCssSource(remembered.rawSource, remembered.sourceFile);
|
|
4161
|
+
if (shouldSkip) debug("css replay skip raw source style: %s -> %s", remembered.sourceFile, outputFile);
|
|
4162
|
+
return !shouldSkip;
|
|
4163
|
+
});
|
|
4164
|
+
const rememberedKeys = replayableRememberedGroup.map((item) => item.key);
|
|
4165
|
+
const rememberedCssSource = mergeRememberedCssSources(replayableRememberedGroup.map((item) => item.remembered), outputFile);
|
|
3938
4166
|
if (!rememberedCssSource) continue;
|
|
3939
4167
|
const { rawSource, sourceFile } = rememberedCssSource;
|
|
3940
4168
|
const generatorRawSource = isWebGeneratorTarget ? rawSource : require_hmr_timing.normalizeMiniProgramGeneratorCssSource(rawSource, outputFile);
|
|
@@ -3969,7 +4197,17 @@ async function processRememberedCssReplay(options) {
|
|
|
3969
4197
|
const shouldRecordRememberedReplayCss = useIncrementalMode || isNativeAppStyleTarget;
|
|
3970
4198
|
const shouldEmitRememberedReplayCssAsset = shouldRecordRememberedReplayCss;
|
|
3971
4199
|
if (!shouldRecordRememberedReplayCss) continue;
|
|
3972
|
-
if (
|
|
4200
|
+
if (shouldPreserveFrameworkRootMiniProgramImportShell({
|
|
4201
|
+
css: rawSource,
|
|
4202
|
+
file: outputFile,
|
|
4203
|
+
isWebGeneratorTarget,
|
|
4204
|
+
matchesCss: opts.cssMatcher(outputFile),
|
|
4205
|
+
shouldKeep: () => cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
4206
|
+
...cssPipelineContext,
|
|
4207
|
+
css: rawSource,
|
|
4208
|
+
file: outputFile
|
|
4209
|
+
})
|
|
4210
|
+
}) || !isRootMiniProgramStyleOutputFile$1(outputFile) && !isWebGeneratorTarget && (0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(rawSource)) {
|
|
3973
4211
|
cssTaskFactories.push(() => timeTask("css.replay", async () => {
|
|
3974
4212
|
const start = performance.now();
|
|
3975
4213
|
const css = annotateCss(require_hmr_timing.normalizeMiniProgramImportShell(rawSource));
|
|
@@ -4229,13 +4467,12 @@ function createSubpackageSourceCandidateScope(options) {
|
|
|
4229
4467
|
function normalizeSourceCandidatePathKey(file) {
|
|
4230
4468
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.resolve(file));
|
|
4231
4469
|
}
|
|
4232
|
-
function
|
|
4233
|
-
const { file,
|
|
4470
|
+
function createSourceCandidateFiles(options) {
|
|
4471
|
+
const { file, outDir, rootDir, sourceRoot } = options;
|
|
4234
4472
|
const cleanedFile = file.replace(/[?#].*$/, "");
|
|
4235
|
-
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(cleanedFile);
|
|
4236
4473
|
const absoluteFile = node_path.default.isAbsolute(cleanedFile) ? cleanedFile : node_path.default.resolve(rootDir, cleanedFile);
|
|
4237
4474
|
const relativeFromOutDir = require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.relative(outDir, absoluteFile));
|
|
4238
|
-
|
|
4475
|
+
return [
|
|
4239
4476
|
sourceRoot ? node_path.default.resolve(sourceRoot, file) : void 0,
|
|
4240
4477
|
node_path.default.resolve(rootDir, file),
|
|
4241
4478
|
node_path.default.resolve(node_path.default.dirname(outDir), file),
|
|
@@ -4244,6 +4481,33 @@ function resolveCurrentSourceCandidateSource(options) {
|
|
|
4244
4481
|
!node_path.default.isAbsolute(relativeFromOutDir) && !relativeFromOutDir.startsWith("../") ? node_path.default.resolve(node_path.default.dirname(outDir), relativeFromOutDir) : void 0,
|
|
4245
4482
|
file
|
|
4246
4483
|
];
|
|
4484
|
+
}
|
|
4485
|
+
function resolveCurrentSourceCandidateFile(options) {
|
|
4486
|
+
const sourceCandidates = createSourceCandidateFiles(options);
|
|
4487
|
+
for (const candidate of sourceCandidates) if (candidate && options.getSourceCandidateSource?.(candidate) !== void 0) return candidate;
|
|
4488
|
+
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(options.file.replace(/[?#].*$/, ""));
|
|
4489
|
+
let bestMatch;
|
|
4490
|
+
const normalizedSourceCandidates = sourceCandidates.filter((candidate) => Boolean(candidate)).map((candidate) => ({
|
|
4491
|
+
absolute: node_path.default.isAbsolute(candidate),
|
|
4492
|
+
key: normalizeSourceCandidatePathKey(candidate)
|
|
4493
|
+
}));
|
|
4494
|
+
for (const [sourceFile] of options.getSourceCandidateSources?.() ?? []) {
|
|
4495
|
+
const normalizedSourceFile = normalizeSourceCandidatePathKey(sourceFile);
|
|
4496
|
+
let score = normalizedSourceCandidates.reduce((current, candidate) => {
|
|
4497
|
+
return normalizedSourceFile === candidate.key ? Math.max(current, candidate.absolute ? 100 : 80) : current;
|
|
4498
|
+
}, 0);
|
|
4499
|
+
if (normalizedSourceFile.endsWith(`/${normalizedFile}`)) score = Math.max(score, 20);
|
|
4500
|
+
if (score > (bestMatch?.score ?? 0)) bestMatch = {
|
|
4501
|
+
file: sourceFile,
|
|
4502
|
+
score
|
|
4503
|
+
};
|
|
4504
|
+
}
|
|
4505
|
+
return bestMatch?.file;
|
|
4506
|
+
}
|
|
4507
|
+
function resolveCurrentSourceCandidateSource(options) {
|
|
4508
|
+
const { file, getSourceCandidateSource, getSourceCandidateSources } = options;
|
|
4509
|
+
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
4510
|
+
const sourceCandidates = createSourceCandidateFiles(options);
|
|
4247
4511
|
const explicitSource = sourceCandidates.reduce((source, candidate) => {
|
|
4248
4512
|
if (source || !candidate) return source;
|
|
4249
4513
|
return getSourceCandidateSource?.(candidate);
|
|
@@ -4502,102 +4766,6 @@ function createBundleTaskTimer(recordTimingDetail) {
|
|
|
4502
4766
|
};
|
|
4503
4767
|
}
|
|
4504
4768
|
//#endregion
|
|
4505
|
-
//#region src/bundlers/vite/generate-bundle/transform-filter.ts
|
|
4506
|
-
function toArray(value) {
|
|
4507
|
-
return Array.isArray(value) ? value : value === void 0 ? [] : [value];
|
|
4508
|
-
}
|
|
4509
|
-
function normalizeSourceId(id) {
|
|
4510
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
4511
|
-
return node_path.default.isAbsolute(file) ? node_path.default.resolve(file) : void 0;
|
|
4512
|
-
}
|
|
4513
|
-
function collectChunkModuleIds$1(chunk) {
|
|
4514
|
-
const ids = /* @__PURE__ */ new Set();
|
|
4515
|
-
for (const id of chunk.moduleIds ?? []) {
|
|
4516
|
-
const normalized = normalizeSourceId(id);
|
|
4517
|
-
if (normalized) ids.add(normalized);
|
|
4518
|
-
}
|
|
4519
|
-
for (const id of Object.keys(chunk.modules ?? {})) {
|
|
4520
|
-
const normalized = normalizeSourceId(id);
|
|
4521
|
-
if (normalized) ids.add(normalized);
|
|
4522
|
-
}
|
|
4523
|
-
return ids;
|
|
4524
|
-
}
|
|
4525
|
-
function collectAssetSourceIds(asset, fallbackFile, rootDir) {
|
|
4526
|
-
const ids = /* @__PURE__ */ new Set();
|
|
4527
|
-
const sourceCandidates = [asset.originalFileName, ...asset.originalFileNames ?? []].filter((candidate) => typeof candidate === "string" && candidate.length > 0);
|
|
4528
|
-
const candidates = sourceCandidates.length > 0 ? sourceCandidates : [fallbackFile];
|
|
4529
|
-
for (const candidate of candidates) {
|
|
4530
|
-
if (typeof candidate !== "string" || candidate.length === 0) continue;
|
|
4531
|
-
const cleanCandidate = (0, _weapp_tailwindcss_shared.cleanUrl)(candidate);
|
|
4532
|
-
const resolved = node_path.default.isAbsolute(cleanCandidate) ? node_path.default.resolve(cleanCandidate) : node_path.default.resolve(rootDir, cleanCandidate);
|
|
4533
|
-
ids.add(resolved);
|
|
4534
|
-
}
|
|
4535
|
-
return ids;
|
|
4536
|
-
}
|
|
4537
|
-
function isStringRuleMatched(rule, id, rootDir) {
|
|
4538
|
-
const normalizedId = require_source_candidate_scan_signature.slash(id);
|
|
4539
|
-
const normalizedRule = require_source_candidate_scan_signature.slash(rule);
|
|
4540
|
-
if (node_path.default.isAbsolute(rule)) return micromatch.default.isMatch(normalizedId, normalizedRule);
|
|
4541
|
-
const relative = require_source_candidate_scan_signature.slash(node_path.default.relative(rootDir, id));
|
|
4542
|
-
return relative.length > 0 && !relative.startsWith("../") && !node_path.default.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizedRule);
|
|
4543
|
-
}
|
|
4544
|
-
function isRuleMatched(rule, id, rootDir) {
|
|
4545
|
-
if (typeof rule === "string") return isStringRuleMatched(rule, id, rootDir);
|
|
4546
|
-
if (rule instanceof RegExp) {
|
|
4547
|
-
rule.lastIndex = 0;
|
|
4548
|
-
return rule.test(require_source_candidate_scan_signature.slash(id));
|
|
4549
|
-
}
|
|
4550
|
-
return rule(id) === true;
|
|
4551
|
-
}
|
|
4552
|
-
function createTransformMatcher(rules, rootDir) {
|
|
4553
|
-
const normalizedRules = toArray(rules);
|
|
4554
|
-
if (normalizedRules.length === 0) return;
|
|
4555
|
-
return (id) => normalizedRules.some((rule) => isRuleMatched(rule, id, rootDir));
|
|
4556
|
-
}
|
|
4557
|
-
function shouldSkipSourceIds(sourceIds, filter) {
|
|
4558
|
-
if (sourceIds.size === 0) return false;
|
|
4559
|
-
if (filter.exclude) {
|
|
4560
|
-
let excluded = true;
|
|
4561
|
-
for (const id of sourceIds) if (!filter.exclude(id)) {
|
|
4562
|
-
excluded = false;
|
|
4563
|
-
break;
|
|
4564
|
-
}
|
|
4565
|
-
if (excluded) return true;
|
|
4566
|
-
}
|
|
4567
|
-
if (filter.include) {
|
|
4568
|
-
for (const id of sourceIds) if (filter.include(id)) return false;
|
|
4569
|
-
return true;
|
|
4570
|
-
}
|
|
4571
|
-
return false;
|
|
4572
|
-
}
|
|
4573
|
-
function createTransformFilter(options, rootDir) {
|
|
4574
|
-
const include = createTransformMatcher(options?.include, rootDir);
|
|
4575
|
-
const exclude = createTransformMatcher(options?.exclude, rootDir);
|
|
4576
|
-
if (!include && !exclude) return;
|
|
4577
|
-
return {
|
|
4578
|
-
include,
|
|
4579
|
-
exclude
|
|
4580
|
-
};
|
|
4581
|
-
}
|
|
4582
|
-
function shouldSkipViteJsChunkTransform(chunk, filter) {
|
|
4583
|
-
if (!filter) return false;
|
|
4584
|
-
return shouldSkipSourceIds(collectChunkModuleIds$1(chunk), filter);
|
|
4585
|
-
}
|
|
4586
|
-
function shouldSkipViteAssetTransform(asset, file, rootDir, filter) {
|
|
4587
|
-
if (!filter) return false;
|
|
4588
|
-
return shouldSkipSourceIds(collectAssetSourceIds(asset, file, rootDir), filter);
|
|
4589
|
-
}
|
|
4590
|
-
function createRuleSignature(rules) {
|
|
4591
|
-
return toArray(rules).map((rule) => {
|
|
4592
|
-
if (typeof rule === "string") return `s:${rule}`;
|
|
4593
|
-
if (rule instanceof RegExp) return `r:${rule.source}/${rule.flags}`;
|
|
4594
|
-
return "f";
|
|
4595
|
-
}).join("|") || "none";
|
|
4596
|
-
}
|
|
4597
|
-
function createTransformFilterSignature(options) {
|
|
4598
|
-
return [`include:${createRuleSignature(options?.include)}`, `exclude:${createRuleSignature(options?.exclude)}`].join(";");
|
|
4599
|
-
}
|
|
4600
|
-
//#endregion
|
|
4601
4769
|
//#region src/bundlers/vite/weapp-vite-config.ts
|
|
4602
4770
|
function resolveSourceRootCandidate(root, value) {
|
|
4603
4771
|
if (typeof value !== "string" || value.trim().length === 0) return;
|
|
@@ -4680,6 +4848,7 @@ function createGenerateBundleHook(context) {
|
|
|
4680
4848
|
const lastCssResultByFile = /* @__PURE__ */ new Map();
|
|
4681
4849
|
const lastCssSourceHashByFile = /* @__PURE__ */ new Map();
|
|
4682
4850
|
const lastCssRawSourceHashByFile = /* @__PURE__ */ new Map();
|
|
4851
|
+
const frameworkRootImportShellTargetByFile = context.frameworkRootImportShellTargetByFile ?? /* @__PURE__ */ new Map();
|
|
4683
4852
|
let currentOutDir;
|
|
4684
4853
|
let currentSubpackageRoots;
|
|
4685
4854
|
const createInitialCssPipelineContext = (file) => {
|
|
@@ -4717,8 +4886,11 @@ function createGenerateBundleHook(context) {
|
|
|
4717
4886
|
})
|
|
4718
4887
|
});
|
|
4719
4888
|
return async function generateBundle(_opt, bundle) {
|
|
4889
|
+
if (context.shouldProcessBundle?.() === false) return;
|
|
4890
|
+
const processMarkupAndScripts = context.processMarkupAndScripts !== false;
|
|
4891
|
+
const processStyles = context.shouldProcessStyles?.() ?? context.processStyles !== false;
|
|
4720
4892
|
const addWatchFile = (id) => this.addWatchFile?.(id);
|
|
4721
|
-
const { opts, runtimeState, ensureBundleRuntimeClassSet, debug, getResolvedConfig, markCssAssetProcessed, isCssAssetProcessed, isViteProcessedCssAsset, recordCssAssetResult, recordViteProcessedCssAssetResult, getViteProcessedCssAssetResults, getViteProcessedCssAssetResult, getSourceCandidates, getSourceCandidateSource, getSourceCandidateSources, getSourceCandidatesForEntries, getSourceCandidateSourcesForEntries, waitForSourceCandidateSyncs, rememberCssSource, refreshRememberedCssSource, getRememberedCssSources, getRememberedCssSignature, setRememberedCssSignature, getKnownCssSource, getKnownSfcSource, recordGeneratorCandidates, pruneViteCssCaches, getViteCssCacheStats, hmrTimingRecorder } = context;
|
|
4893
|
+
const { opts, runtimeState, ensureBundleRuntimeClassSet, debug, getResolvedConfig, markCssAssetProcessed, isCssAssetProcessed, isViteProcessedCssAsset, recordCssAssetResult, recordViteProcessedCssAssetResult, getViteProcessedCssAssetResults, getViteProcessedCssAssetResult, getSourceCandidates, getSourceCandidateSource, getSourceCandidateSources, extractSourceCandidates, getSourceCandidatesForEntries, getSourceCandidateSourcesForEntries, waitForSourceCandidateSyncs, rememberCssSource, refreshRememberedCssSource, getRememberedCssSources, getRememberedCssSignature, setRememberedCssSignature, getKnownCssSource, getKnownSfcSource, getOriginalCssLayerSource, recordGeneratorCandidates, pruneViteCssCaches, getViteCssCacheStats, hmrTimingRecorder } = context;
|
|
4722
4894
|
const getBundlerSfcSource = (sourceFile) => {
|
|
4723
4895
|
const code = this.getModuleInfo?.(sourceFile)?.code;
|
|
4724
4896
|
return typeof code === "string" && hasSfcStyleSources(code) ? code : void 0;
|
|
@@ -4776,7 +4948,7 @@ function createGenerateBundleHook(context) {
|
|
|
4776
4948
|
await runtimeState.readyPromise;
|
|
4777
4949
|
debug("start");
|
|
4778
4950
|
onStart();
|
|
4779
|
-
const collectedBundlerGeneratedCssFiles = new Set(Object.entries(bundle).filter(([, output]) => output.type === "asset" &&
|
|
4951
|
+
const collectedBundlerGeneratedCssFiles = new Set(Object.entries(bundle).filter(([, output]) => output.type === "asset" && require_hmr_timing.hasBundlerGeneratedCssMarker(output.source)).map(([file]) => file));
|
|
4780
4952
|
const subpackageRoots = collectMiniProgramSubpackageRoots(bundle);
|
|
4781
4953
|
if (subpackageRoots) currentSubpackageRoots = subpackageRoots;
|
|
4782
4954
|
collectViteProcessedCssAssetResults(bundle, {
|
|
@@ -4803,16 +4975,38 @@ function createGenerateBundleHook(context) {
|
|
|
4803
4975
|
const envFlags = resolveGenerateBundleEnvFlags();
|
|
4804
4976
|
const bundleFiles = Object.keys(bundle);
|
|
4805
4977
|
const activeViteCssCacheFiles = new Set(bundleFiles.map(normalizeViteCssCacheKey));
|
|
4806
|
-
const
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4978
|
+
const normalizeSystemAliasPathKey = (file) => file.startsWith("/private/var/") ? file.slice(8) : file;
|
|
4979
|
+
const normalizeConfiguredCssSourceCacheKey = (file) => normalizeSystemAliasPathKey(require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.resolve(file.replace(/[?#].*$/, ""))));
|
|
4980
|
+
const runtimeTailwindcssOptions = require_generator.resolveTailwindcssOptions(opts.tailwindcssRuntimeOptions);
|
|
4981
|
+
const tailwindRuntimeOptions = require_generator.resolveTailwindcssOptions(runtimeState.tailwindRuntime.options);
|
|
4982
|
+
const configuredTailwindV4ExplicitCssEntryFiles = [...new Set([
|
|
4983
|
+
...Array.isArray(opts.cssEntries) ? opts.cssEntries : [],
|
|
4984
|
+
...Array.isArray(opts.tailwindcss?.v4?.cssEntries) ? opts.tailwindcss.v4.cssEntries : [],
|
|
4985
|
+
...Array.isArray(runtimeTailwindcssOptions?.v4?.cssEntries) ? runtimeTailwindcssOptions.v4.cssEntries : [],
|
|
4986
|
+
...Array.isArray(tailwindRuntimeOptions?.v4?.cssEntries) ? tailwindRuntimeOptions.v4.cssEntries : []
|
|
4987
|
+
].filter((file) => typeof file === "string" && file.length > 0))];
|
|
4988
|
+
const getConfiguredTailwindV4CssSourceEntries = () => {
|
|
4989
|
+
const collectedEntries = collectConfiguredTailwindV4CssSourceEntries({
|
|
4990
|
+
...opts,
|
|
4991
|
+
tailwindcssRuntimeOptions: {
|
|
4992
|
+
...opts.tailwindcssRuntimeOptions ?? {},
|
|
4993
|
+
tailwindcss: {
|
|
4994
|
+
...require_generator.resolveTailwindcssOptions(opts.tailwindcssRuntimeOptions) ?? {},
|
|
4995
|
+
...require_generator.resolveTailwindcssOptions(runtimeState.tailwindRuntime.options) ?? {}
|
|
4996
|
+
}
|
|
4813
4997
|
}
|
|
4814
|
-
}
|
|
4815
|
-
|
|
4998
|
+
}, opts.tailwindcssBasedir ?? rootDir);
|
|
4999
|
+
const cachedEntries = configuredTailwindV4ExplicitCssEntryFiles.flatMap((file) => {
|
|
5000
|
+
const resolvedFile = node_path.default.isAbsolute(file) ? node_path.default.resolve(file) : node_path.default.resolve(opts.tailwindcssBasedir ?? rootDir, file);
|
|
5001
|
+
const source = getCssSource(resolvedFile);
|
|
5002
|
+
return typeof source === "string" && source.length > 0 ? [{
|
|
5003
|
+
file: resolvedFile,
|
|
5004
|
+
source
|
|
5005
|
+
}] : [];
|
|
5006
|
+
});
|
|
5007
|
+
const cachedFileKeys = new Set(cachedEntries.map((entry) => normalizeConfiguredCssSourceCacheKey(entry.file)));
|
|
5008
|
+
return [...cachedEntries, ...collectedEntries.filter((entry) => !cachedFileKeys.has(normalizeConfiguredCssSourceCacheKey(entry.file)))];
|
|
5009
|
+
};
|
|
4816
5010
|
const normalizeGeneratorUserRawSource = (source, sourceFile, fallbackFile) => normalizeRelativeCssConfigDirectives(source, sourceFile || fallbackFile, outDir, opts);
|
|
4817
5011
|
const resolveMatchedCssSourceOutputFile = (sourceFile) => resolveOutputFileFromMatchedCssSource({
|
|
4818
5012
|
bundleFiles,
|
|
@@ -4833,20 +5027,12 @@ function createGenerateBundleHook(context) {
|
|
|
4833
5027
|
const snapshotStart = performance.now();
|
|
4834
5028
|
const snapshot = require_source_candidate_scan_signature.buildBundleSnapshot(bundle, opts, outDir, state, envFlags.disableDirtyOptimization || !useIncrementalMode, { hasOmittedKnownFiles });
|
|
4835
5029
|
const configuredTailwindV4CssSourceEntriesForScope = getConfiguredTailwindV4CssSourceEntries();
|
|
4836
|
-
const normalizeSystemAliasPathKey = (file) => file.startsWith("/private/var/") ? file.slice(8) : file;
|
|
4837
5030
|
const normalizeConfiguredTailwindV4CssEntryFileKey = (file) => {
|
|
4838
5031
|
const cleanFile = file.replace(/[?#].*$/, "");
|
|
4839
5032
|
return normalizeSystemAliasPathKey(require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.isAbsolute(cleanFile) ? node_path.default.resolve(cleanFile) : node_path.default.resolve(opts.tailwindcssBasedir ?? rootDir, cleanFile)));
|
|
4840
5033
|
};
|
|
4841
|
-
const runtimeTailwindcssOptions = require_generator.resolveTailwindcssOptions(opts.tailwindcssRuntimeOptions);
|
|
4842
|
-
const tailwindRuntimeOptions = require_generator.resolveTailwindcssOptions(runtimeState.tailwindRuntime.options);
|
|
4843
5034
|
const configuredTailwindV4CssSourceFileKeysForScope = new Set(configuredTailwindV4CssSourceEntriesForScope.map((entry) => normalizeConfiguredTailwindV4CssEntryFileKey(entry.file)));
|
|
4844
|
-
const configuredTailwindV4ExplicitCssEntryFileKeysForScope = new Set(
|
|
4845
|
-
...Array.isArray(opts.cssEntries) ? opts.cssEntries : [],
|
|
4846
|
-
...Array.isArray(opts.tailwindcss?.v4?.cssEntries) ? opts.tailwindcss.v4.cssEntries : [],
|
|
4847
|
-
...Array.isArray(runtimeTailwindcssOptions?.v4?.cssEntries) ? runtimeTailwindcssOptions.v4.cssEntries : [],
|
|
4848
|
-
...Array.isArray(tailwindRuntimeOptions?.v4?.cssEntries) ? tailwindRuntimeOptions.v4.cssEntries : []
|
|
4849
|
-
].filter((file) => typeof file === "string" && file.length > 0).map(normalizeConfiguredTailwindV4CssEntryFileKey));
|
|
5035
|
+
const configuredTailwindV4ExplicitCssEntryFileKeysForScope = new Set(configuredTailwindV4ExplicitCssEntryFiles.map(normalizeConfiguredTailwindV4CssEntryFileKey));
|
|
4850
5036
|
const isRootStyleOutputFile = (file) => {
|
|
4851
5037
|
const normalized = require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
4852
5038
|
return normalized.endsWith(".css") && !normalized.includes("/");
|
|
@@ -4876,9 +5062,11 @@ function createGenerateBundleHook(context) {
|
|
|
4876
5062
|
const selectConfiguredRootCssSourceEntry = (outputFile, entries, originalFileNames) => {
|
|
4877
5063
|
const matchedOriginalEntry = entries.find((entry) => originalFileNames?.some((originalFile) => normalizeConfiguredTailwindV4CssEntryFileKey(originalFile) === normalizeConfiguredTailwindV4CssEntryFileKey(entry.file)) === true);
|
|
4878
5064
|
if (matchedOriginalEntry && outputFile.replace(/[?#].*$/, "").endsWith(".css")) return matchedOriginalEntry;
|
|
4879
|
-
if (!shouldSelectConfiguredRootCssOutput(outputFile)) return;
|
|
4880
5065
|
const shouldRequireExplicitConfiguredEntry = !cssPipelineContext.currentGeneratorBranch.isWeb && opts.cssMatcher(outputFile) && isRootStyleOutputFile(outputFile);
|
|
4881
5066
|
const generationEntries = entries.filter((entry) => hasTailwindGenerationSource(entry.source) && (!shouldRequireExplicitConfiguredEntry || configuredTailwindV4ExplicitCssEntryFileKeysForScope.has(normalizeConfiguredTailwindV4CssEntryFileKey(entry.file))));
|
|
5067
|
+
const matchedOutputEntries = generationEntries.filter((entry) => require_source_candidate_scan_signature.normalizeOutputPathKey(resolveConfiguredTailwindV4CssEntryOutputFile(entry.file).replace(/[?#].*$/, "")) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile.replace(/[?#].*$/, "")));
|
|
5068
|
+
if (matchedOutputEntries.length === 1) return matchedOutputEntries[0];
|
|
5069
|
+
if (!shouldSelectConfiguredRootCssOutput(outputFile)) return;
|
|
4882
5070
|
if (generationEntries.length <= 1) return generationEntries[0];
|
|
4883
5071
|
const rootOutputEntries = generationEntries.filter((entry) => {
|
|
4884
5072
|
return !require_source_candidate_scan_signature.normalizeOutputPathKey(resolveConfiguredTailwindV4CssEntryOutputFile(entry.file).replace(/[?#].*$/, "")).includes("/");
|
|
@@ -4920,18 +5108,6 @@ function createGenerateBundleHook(context) {
|
|
|
4920
5108
|
return !require_source_candidate_scan_signature.normalizeOutputPathKey(entryOutputFile.replace(/[?#].*$/, "")).includes("/") || currentSubpackageRoots != null && !isSubpackageOutputFile(entryOutputFile, currentSubpackageRoots);
|
|
4921
5109
|
});
|
|
4922
5110
|
};
|
|
4923
|
-
const { createScopedSourceCandidateGetter, createScopedSourceCandidateSourceGetter, shouldExcludeSubpackageSourceCandidates, shouldInjectCssIntoMainFromOutput } = createSubpackageSourceCandidateScope({
|
|
4924
|
-
cssSourceFiles: configuredTailwindV4CssSourceEntriesForScope.map((entry) => entry.file),
|
|
4925
|
-
getSourceCandidateSourcesForEntries,
|
|
4926
|
-
getSourceCandidatesForEntries,
|
|
4927
|
-
projectRoot: opts.tailwindcssRuntimeOptions?.projectRoot,
|
|
4928
|
-
rootDir,
|
|
4929
|
-
snapshot,
|
|
4930
|
-
sourceRoot,
|
|
4931
|
-
subpackageRoots: currentSubpackageRoots,
|
|
4932
|
-
tailwindcssBasedir: opts.tailwindcssBasedir,
|
|
4933
|
-
useIncrementalMode
|
|
4934
|
-
});
|
|
4935
5111
|
recordTimingDetail("snapshot", snapshotStart);
|
|
4936
5112
|
const useBundleRuntimeClassSet = !isWebGeneratorTarget;
|
|
4937
5113
|
const forceRuntimeRefreshBySource = useIncrementalMode && require_source_candidate_scan_signature.hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
@@ -4945,11 +5121,41 @@ function createGenerateBundleHook(context) {
|
|
|
4945
5121
|
const sourceCandidateWaitStart = performance.now();
|
|
4946
5122
|
await waitForSourceCandidateSyncs?.();
|
|
4947
5123
|
recordTimingDetail("sourceCandidates.wait", sourceCandidateWaitStart);
|
|
4948
|
-
const
|
|
5124
|
+
const transformFilter = createTransformFilter(opts.transform, rootDir);
|
|
5125
|
+
const bundleMarkupCandidates = await collectBundleMarkupCandidates({
|
|
5126
|
+
extractSourceCandidates: processMarkupAndScripts && !isWebGeneratorTarget ? extractSourceCandidates : void 0,
|
|
5127
|
+
previousCandidatesByFile: useIncrementalMode ? state.bundleMarkupCandidatesByFile : void 0,
|
|
5128
|
+
preserveMissingFiles: useIncrementalMode && snapshot.hasOmittedKnownFiles,
|
|
5129
|
+
resolveSourceCandidateFile: (file) => resolveCurrentSourceCandidateFile({
|
|
5130
|
+
file,
|
|
5131
|
+
getSourceCandidateSource,
|
|
5132
|
+
getSourceCandidateSources,
|
|
5133
|
+
outDir,
|
|
5134
|
+
rootDir,
|
|
5135
|
+
sourceRoot
|
|
5136
|
+
}),
|
|
5137
|
+
rootDir,
|
|
5138
|
+
snapshot,
|
|
5139
|
+
transformFilter
|
|
5140
|
+
});
|
|
5141
|
+
const getCombinedSourceCandidatesForEntries = getSourceCandidatesForEntries || bundleMarkupCandidates.values.size > 0 ? (entries, options) => /* @__PURE__ */ new Set([...getSourceCandidatesForEntries?.(entries, options) ?? [], ...bundleMarkupCandidates.valuesForEntries(entries, options)]) : void 0;
|
|
5142
|
+
const sourceCandidates = /* @__PURE__ */ new Set([...getSourceCandidates?.() ?? [], ...bundleMarkupCandidates.values]);
|
|
5143
|
+
const { createScopedSourceCandidateGetter, createScopedSourceCandidateSourceGetter, shouldExcludeSubpackageSourceCandidates, shouldInjectCssIntoMainFromOutput } = createSubpackageSourceCandidateScope({
|
|
5144
|
+
cssSourceFiles: configuredTailwindV4CssSourceEntriesForScope.map((entry) => entry.file),
|
|
5145
|
+
getSourceCandidateSourcesForEntries,
|
|
5146
|
+
getSourceCandidatesForEntries: getCombinedSourceCandidatesForEntries,
|
|
5147
|
+
projectRoot: opts.tailwindcssRuntimeOptions?.projectRoot,
|
|
5148
|
+
rootDir,
|
|
5149
|
+
snapshot,
|
|
5150
|
+
sourceRoot,
|
|
5151
|
+
subpackageRoots: currentSubpackageRoots,
|
|
5152
|
+
tailwindcssBasedir: opts.tailwindcssBasedir,
|
|
5153
|
+
useIncrementalMode
|
|
5154
|
+
});
|
|
4949
5155
|
const createScopedGeneratorRuntime$1 = (outputFile, cssHandlerOptions, runtime, rawSource, sourceFile) => require_source_candidate_scan_signature.createScopedGeneratorRuntime({
|
|
4950
5156
|
cssHandlerOptions,
|
|
4951
5157
|
fallbackRuntime: runtime,
|
|
4952
|
-
getSourceCandidatesForEntries,
|
|
5158
|
+
getSourceCandidatesForEntries: getCombinedSourceCandidatesForEntries,
|
|
4953
5159
|
majorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
4954
5160
|
outputFile,
|
|
4955
5161
|
rawSource,
|
|
@@ -4959,7 +5165,6 @@ function createGenerateBundleHook(context) {
|
|
|
4959
5165
|
});
|
|
4960
5166
|
const jsEntries = snapshot.jsEntries;
|
|
4961
5167
|
const getJsEntry = createJsEntryResolver(jsEntries);
|
|
4962
|
-
const transformFilter = createTransformFilter(opts.transform, rootDir);
|
|
4963
5168
|
const transformFilterSignature = createTransformFilterSignature(opts.transform);
|
|
4964
5169
|
const moduleGraphOptions = require_source_candidate_scan_signature.createBundleModuleGraphOptions(outDir, jsEntries);
|
|
4965
5170
|
const hasRuntimeAffectingChanges = require_source_candidate_scan_signature.hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
@@ -5109,7 +5314,7 @@ function createGenerateBundleHook(context) {
|
|
|
5109
5314
|
const jsTaskFactories = [];
|
|
5110
5315
|
for (const entry of snapshot.entries) {
|
|
5111
5316
|
const { file, output: originalSource, source: originalEntrySource, type } = entry;
|
|
5112
|
-
if (type === "html" && originalSource.type === "asset") {
|
|
5317
|
+
if (processMarkupAndScripts && type === "html" && originalSource.type === "asset") {
|
|
5113
5318
|
metrics.html.total++;
|
|
5114
5319
|
if (isWebGeneratorTarget) {
|
|
5115
5320
|
debug("html skip web target: %s", file);
|
|
@@ -5148,14 +5353,59 @@ function createGenerateBundleHook(context) {
|
|
|
5148
5353
|
});
|
|
5149
5354
|
continue;
|
|
5150
5355
|
}
|
|
5151
|
-
if (type === "css" && originalSource.type === "asset") {
|
|
5356
|
+
if (processStyles && type === "css" && originalSource.type === "asset") {
|
|
5152
5357
|
metrics.css.total++;
|
|
5153
5358
|
const assetSourceFile = resolveAssetSourceFile(originalSource, file);
|
|
5154
5359
|
const rawSource = normalizeRelativeCssConfigDirectives(originalEntrySource, assetSourceFile, outDir, opts);
|
|
5360
|
+
const currentRawSourceHasExplicitScanContext = rawSource.includes("@source") || rawSource.includes("@config");
|
|
5155
5361
|
const cssPipelineContext = {
|
|
5156
5362
|
...createInitialCssPipelineContext(file),
|
|
5157
5363
|
bundle
|
|
5158
5364
|
};
|
|
5365
|
+
const rootImportShellOutputFile = resolveReplayCssOutputFile(outDir, originalSource.fileName || file);
|
|
5366
|
+
let rememberedFrameworkRootImportTarget = frameworkRootImportShellTargetByFile.get(rootImportShellOutputFile);
|
|
5367
|
+
const isCurrentFrameworkRootImportShell = shouldPreserveFrameworkRootMiniProgramImportShell({
|
|
5368
|
+
css: rawSource,
|
|
5369
|
+
file: rootImportShellOutputFile,
|
|
5370
|
+
isWebGeneratorTarget,
|
|
5371
|
+
matchesCss: opts.cssMatcher(rootImportShellOutputFile) || opts.cssMatcher(file),
|
|
5372
|
+
shouldKeep: () => context.cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
5373
|
+
...cssPipelineContext,
|
|
5374
|
+
css: rawSource,
|
|
5375
|
+
file: rootImportShellOutputFile
|
|
5376
|
+
})
|
|
5377
|
+
});
|
|
5378
|
+
if (isCurrentFrameworkRootImportShell) {
|
|
5379
|
+
const importedFile = resolveSingleCssImportOutputFile(rootImportShellOutputFile, rawSource);
|
|
5380
|
+
if (importedFile && isRootMiniProgramStyleOutputFile$1(importedFile)) frameworkRootImportShellTargetByFile.set(rootImportShellOutputFile, importedFile);
|
|
5381
|
+
}
|
|
5382
|
+
if (!rememberedFrameworkRootImportTarget && !isCurrentFrameworkRootImportShell && !isWebGeneratorTarget && isRootMiniProgramStyleOutputFile$1(rootImportShellOutputFile) && require_source_candidate_scan_signature.normalizeOutputPathKey(assetSourceFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(file) && opts.mainCssChunkMatcher(rootImportShellOutputFile, opts.appType) && shouldKeepRootMiniProgramStyleAsImportShell(context.cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
5383
|
+
...cssPipelineContext,
|
|
5384
|
+
css: rawSource,
|
|
5385
|
+
file: rootImportShellOutputFile
|
|
5386
|
+
})) && !shouldMoveRootMiniProgramStyleToImportShellOrigin(context.cssPipelineStrategy?.shouldMoveRootMiniProgramStyleToImportShellOrigin?.({
|
|
5387
|
+
...cssPipelineContext,
|
|
5388
|
+
file: rootImportShellOutputFile
|
|
5389
|
+
}))) {
|
|
5390
|
+
const rootGeneratedTargets = /* @__PURE__ */ new Set();
|
|
5391
|
+
for (const entry of getConfiguredTailwindV4CssSourceEntries()) {
|
|
5392
|
+
const targetFile = resolveMatchedCssSourceOutputFile(entry.file);
|
|
5393
|
+
if (targetFile && isRootMiniProgramStyleOutputFile$1(targetFile) && require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(rootImportShellOutputFile)) rootGeneratedTargets.add(targetFile);
|
|
5394
|
+
}
|
|
5395
|
+
for (const [, record] of getViteProcessedCssAssetResults?.() ?? []) {
|
|
5396
|
+
if (typeof record === "string" || record.injectIntoMain !== true || !record.outputFile) continue;
|
|
5397
|
+
const targetFile = resolveViteCssPipelineOutputFile(record.outputFile, opts, rootDir, isWebGeneratorTarget, shouldPreserveAppCssExtension, sourceRoot, defaultStyleOutputExtension, bundleFiles);
|
|
5398
|
+
if (isRootMiniProgramStyleOutputFile$1(targetFile) && require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(rootImportShellOutputFile)) rootGeneratedTargets.add(targetFile);
|
|
5399
|
+
}
|
|
5400
|
+
if (rootGeneratedTargets.size === 1) {
|
|
5401
|
+
const [targetFile] = rootGeneratedTargets;
|
|
5402
|
+
if (targetFile) {
|
|
5403
|
+
rememberedFrameworkRootImportTarget = targetFile;
|
|
5404
|
+
frameworkRootImportShellTargetByFile.set(rootImportShellOutputFile, targetFile);
|
|
5405
|
+
debug("css remember framework root generated target: %s -> %s", rootImportShellOutputFile, targetFile);
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5159
5409
|
let outputFile = resolveCssBundleOutputFile({
|
|
5160
5410
|
bundleFiles,
|
|
5161
5411
|
cssPipelineStrategy: context.cssPipelineStrategy,
|
|
@@ -5166,6 +5416,14 @@ function createGenerateBundleHook(context) {
|
|
|
5166
5416
|
pipelineContext: cssPipelineContext,
|
|
5167
5417
|
shouldPreserveAppCssExtension
|
|
5168
5418
|
});
|
|
5419
|
+
if (rememberedFrameworkRootImportTarget && !isWebGeneratorTarget && (opts.cssMatcher(rootImportShellOutputFile) || opts.cssMatcher(file)) && shouldKeepRootMiniProgramStyleAsImportShell(context.cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
5420
|
+
...cssPipelineContext,
|
|
5421
|
+
css: rawSource,
|
|
5422
|
+
file: rootImportShellOutputFile
|
|
5423
|
+
}))) {
|
|
5424
|
+
outputFile = rememberedFrameworkRootImportTarget;
|
|
5425
|
+
debug("css reuse framework root import shell target: %s -> %s", rootImportShellOutputFile, outputFile);
|
|
5426
|
+
}
|
|
5169
5427
|
const resolveMatchedOutputFileForCurrentAsset = createMatchedCssSourceOutputResolver({
|
|
5170
5428
|
assetSourceFile,
|
|
5171
5429
|
file,
|
|
@@ -5224,6 +5482,7 @@ function createGenerateBundleHook(context) {
|
|
|
5224
5482
|
return await refreshRememberedCssSource?.(remembered) ?? remembered;
|
|
5225
5483
|
}));
|
|
5226
5484
|
rememberedCssSources = rememberedCssSources.filter((remembered) => {
|
|
5485
|
+
if (currentRawSourceHasExplicitScanContext && !remembered.rawSource.includes("@source") && !remembered.rawSource.includes("@config")) return false;
|
|
5227
5486
|
if (hasExplicitConfiguredRootCssEntryForOutput(outputFile) && !configuredTailwindV4ExplicitCssEntryFileKeysForScope.has(normalizeConfiguredTailwindV4CssEntryFileKey(remembered.sourceFile))) return false;
|
|
5228
5487
|
if (!configuredTailwindV4CssSourceFileKeysForScope.has(normalizeConfiguredTailwindV4CssEntryFileKey(remembered.sourceFile))) return true;
|
|
5229
5488
|
const matchedOutputFile = resolveMatchedOutputFileForCurrentAsset(remembered.sourceFile);
|
|
@@ -5243,7 +5502,7 @@ function createGenerateBundleHook(context) {
|
|
|
5243
5502
|
let outputCssHandlerOptions = getCssHandlerOptions(outputFile);
|
|
5244
5503
|
const configuredRootSourceStyle = resolveConfiguredRootCssSourceStyle(outputFile, getConfiguredTailwindV4CssSourceEntries(), originalSource.originalFileNames);
|
|
5245
5504
|
const hasExplicitRememberedRootSource = rememberedCssSources.some((remembered) => configuredTailwindV4ExplicitCssEntryFileKeysForScope.has(normalizeConfiguredTailwindV4CssEntryFileKey(remembered.sourceFile)));
|
|
5246
|
-
if (configuredRootSourceStyle && (!hasUsableRememberedTailwindSource || !hasExplicitRememberedRootSource)) {
|
|
5505
|
+
if (configuredRootSourceStyle != null && (!currentRawSourceHasExplicitScanContext || hasTailwindGenerationSource(configuredRootSourceStyle.rawSource)) && (!hasUsableRememberedTailwindSource || !hasExplicitRememberedRootSource)) {
|
|
5247
5506
|
rememberedCssSources = [configuredRootSourceStyle];
|
|
5248
5507
|
hasUsableRememberedTailwindSource = true;
|
|
5249
5508
|
debug("source style source inferred from configured root tailwind v4 css source: %s -> %s", outputFile, configuredRootSourceStyle.sourceFile);
|
|
@@ -5358,6 +5617,12 @@ function createGenerateBundleHook(context) {
|
|
|
5358
5617
|
}
|
|
5359
5618
|
}
|
|
5360
5619
|
}
|
|
5620
|
+
if (currentRawSourceHasExplicitScanContext) rememberedCssSources = rememberedCssSources.filter((remembered) => remembered.rawSource.includes("@source") || remembered.rawSource.includes("@config"));
|
|
5621
|
+
rememberedCssSources = rememberedCssSources.filter((remembered) => {
|
|
5622
|
+
const shouldSkip = shouldSkipRawRememberedCssSource(remembered.rawSource, remembered.sourceFile);
|
|
5623
|
+
if (shouldSkip) debug("css skip raw remembered source style: %s -> %s", remembered.sourceFile, outputFile);
|
|
5624
|
+
return !shouldSkip;
|
|
5625
|
+
});
|
|
5361
5626
|
let rememberedCssSource = mergeRememberedCssSources(rememberedCssSources, outputFile);
|
|
5362
5627
|
if (rememberedCssSource && viteProcessedCssAsset && outputCssHandlerOptions.isMainChunk !== true && configuredTailwindV4CssSourceFileKeysForScope.has(normalizeConfiguredTailwindV4CssEntryFileKey(rememberedCssSource.sourceFile))) {
|
|
5363
5628
|
const matchedOutputFile = resolveMatchedOutputFileForCurrentAsset(rememberedCssSource.sourceFile);
|
|
@@ -5371,6 +5636,17 @@ function createGenerateBundleHook(context) {
|
|
|
5371
5636
|
};
|
|
5372
5637
|
}
|
|
5373
5638
|
}
|
|
5639
|
+
if (!isWebGeneratorTarget && isRootMiniProgramStyleOutputFile$1(rootImportShellOutputFile) && isRootMiniProgramStyleOutputFile$1(outputFile) && require_source_candidate_scan_signature.normalizeOutputPathKey(rootImportShellOutputFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile) && shouldKeepRootMiniProgramStyleAsImportShell(context.cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
5640
|
+
...cssPipelineContext,
|
|
5641
|
+
css: rawSource,
|
|
5642
|
+
file: rootImportShellOutputFile
|
|
5643
|
+
})) && !shouldMoveRootMiniProgramStyleToImportShellOrigin(context.cssPipelineStrategy?.shouldMoveRootMiniProgramStyleToImportShellOrigin?.({
|
|
5644
|
+
...cssPipelineContext,
|
|
5645
|
+
file: rootImportShellOutputFile
|
|
5646
|
+
}))) {
|
|
5647
|
+
frameworkRootImportShellTargetByFile.set(rootImportShellOutputFile, outputFile);
|
|
5648
|
+
debug("css remember framework root import shell target: %s -> %s", rootImportShellOutputFile, outputFile);
|
|
5649
|
+
}
|
|
5374
5650
|
const shouldKeepImportedCssShell = isCssImportOnlyBundleAsset(bundle, file, rawSource);
|
|
5375
5651
|
const useRememberedCssSource = !shouldKeepImportedCssShell && rememberedCssSource != null && (require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedCssSource.sourceFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file) || !hasTailwindGenerationSource(rawSource) && hasTailwindGenerationSource(rememberedCssSource.rawSource));
|
|
5376
5652
|
const vitePipelineCssAsset = viteProcessedCssAsset || useRememberedCssSource;
|
|
@@ -5391,6 +5667,8 @@ function createGenerateBundleHook(context) {
|
|
|
5391
5667
|
const hasSameOutputRememberedTailwindGenerationSource = hasRememberedTailwindGenerationSource && rememberedCssSource != null && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedCssSource.outputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
5392
5668
|
const hasStaleViteProcessedCssSource = vitePipelineCssAsset && hasDifferentRememberedCssSource && (hasCurrentTailwindGenerationDirective || hasRememberedApplyDirective || hasRememberedTailwindGenerationSource);
|
|
5393
5669
|
const generatorSourceFile = vitePipelineCssAsset ? rememberedCssSource?.sourceFile ?? assetSourceFile : assetSourceFile;
|
|
5670
|
+
const originalGeneratorLayerSource = vitePipelineCssAsset ? getOriginalCssLayerSource?.(generatorSourceFile) : void 0;
|
|
5671
|
+
const generatorUserLayerRawSource = originalGeneratorLayerSource && normalizeCssSourceForCompare(originalGeneratorLayerSource) !== normalizeCssSourceForCompare(generatorRawSource) && require_generator.hasUserCssLayerBlocks(originalGeneratorLayerSource) ? normalizeMiniProgramGeneratorRawSource(normalizeGeneratorUserRawSource(originalGeneratorLayerSource, generatorSourceFile, assetSourceFile), outputFile) : void 0;
|
|
5394
5672
|
const webviewRootCssInjectionTarget = vitePipelineCssAsset ? resolveConfiguredCssEntryRootInjectionTarget(generatorSourceFile, outputFile) : void 0;
|
|
5395
5673
|
const usesConfiguredTailwindV4FallbackSource = rememberedCssSource != null && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedCssSource.outputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile) && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedCssSource.sourceFile.replace(/[?#].*$/, "")) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
5396
5674
|
if (vitePipelineCssAsset && outputCssHandlerOptions.isMainChunk !== true && configuredTailwindV4CssSourceFileKeysForScope.has(normalizeConfiguredTailwindV4CssEntryFileKey(generatorSourceFile))) {
|
|
@@ -5432,14 +5710,14 @@ function createGenerateBundleHook(context) {
|
|
|
5432
5710
|
const cssRuntimeAffectingSignature = vitePipelineCssAsset ? require_source_candidate_scan_signature.createRuntimeAffectingSourceSignature(generatorRawSource, "css") : snapshot.runtimeAffectingSignatureByFile.get(file) ?? require_source_candidate_scan_signature.createRuntimeAffectingSourceSignature(generatorRawSource, "css");
|
|
5433
5711
|
const cssRuntimeAffectingHash = vitePipelineCssAsset ? cache.computeHash(cssRuntimeAffectingSignature) : snapshot.runtimeAffectingHashByFile.get(file) ?? cache.computeHash(cssRuntimeAffectingSignature);
|
|
5434
5712
|
const cssShareScope = createCssTransformShareScopeKey(opts, outputFile, generatorRawSource);
|
|
5435
|
-
const shouldRegenerateCollectedViteCss = viteProcessedCssAsset && useIncrementalMode && state.generatorCandidateSignature !== void 0 && generatorCandidatesChanged && (hasTailwindGenerationSource(generatorRawSource) ||
|
|
5713
|
+
const shouldRegenerateCollectedViteCss = viteProcessedCssAsset && useIncrementalMode && state.generatorCandidateSignature !== void 0 && generatorCandidatesChanged && (hasTailwindGenerationSource(generatorRawSource) || require_hmr_timing.hasBundlerGeneratedCssMarker(rawSource) || rememberedCssSource != null && hasTailwindGenerationSource(rememberedCssSource.rawSource));
|
|
5436
5714
|
const shouldRefreshViteProcessedCssByCandidates = viteProcessedCssAsset && useIncrementalMode && state.generatorCandidateSignature !== void 0 && generatorCandidatesChanged;
|
|
5437
5715
|
const vitePipelineCssInjectionOutputFile = webviewRootCssInjectionTarget ?? outputFile;
|
|
5438
5716
|
const shouldRecordVitePipelineCssByOutput = require_source_candidate_scan_signature.normalizeOutputPathKey(vitePipelineCssInjectionOutputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
5439
5717
|
const shouldInjectVitePipelineCssIntoMain = vitePipelineCssAsset && !resolvedFromConfiguredOriginalCssEntry && outputCssHandlerOptions.isMainChunk !== true && (webviewRootCssInjectionTarget != null || shouldInjectCssIntoMainFromOutput(outputFile, generatorSourceFile, outputCssHandlerOptions));
|
|
5440
5718
|
const shouldTrackGeneratorRuntime = hasStaleViteProcessedCssSource || shouldRegenerateMainPackageCssWithScopedCandidates || hasCurrentTailwindGenerationDirective || hasSameOutputRememberedTailwindGenerationSource || shouldProcessTailwindGeneration && (!useIncrementalMode || cssHandlerOptions.isMainChunk || processFiles.css.has(file) || runtimeLinkedCssFiles.has(file) || runtimeLinkedCssFiles.has(outputFile) || shouldRegenerateCollectedViteCss || hasRuntimeAffectingChanges && (alreadyProcessedCssAsset || vitePipelineCssAsset));
|
|
5441
|
-
const shouldPreserveCollectedViteCssAsset = !shouldRegenerateCollectedViteCss && (state.generatorCandidateSignature === void 0 || !generatorCandidatesChanged) && (collectedBundlerGeneratedCssFiles.has(file) ||
|
|
5442
|
-
const strippedViteProcessedCss =
|
|
5719
|
+
const shouldPreserveCollectedViteCssAsset = !shouldRegenerateCollectedViteCss && (state.generatorCandidateSignature === void 0 || !generatorCandidatesChanged) && (collectedBundlerGeneratedCssFiles.has(file) || require_hmr_timing.hasBundlerGeneratedCssMarker(rawSource));
|
|
5720
|
+
const strippedViteProcessedCss = require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource);
|
|
5443
5721
|
const shouldPreserveStaleGeneratedCssAsset = hasStaleViteProcessedCssSource && shouldPreserveCollectedViteCssAsset && strippedViteProcessedCss.trim().length > 0 && !strippedViteProcessedCss.includes("weapp-tailwindcss generator-placeholder") && !strippedViteProcessedCss.includes("vite-placeholder") && !hasTailwindGenerationSource(strippedViteProcessedCss) && !require_generator.hasTailwindApplyDirective(strippedViteProcessedCss);
|
|
5444
5722
|
if (alreadyProcessedCssAsset && !shouldRefreshViteProcessedCssByCandidates && (!hasStaleViteProcessedCssSource || shouldPreserveStaleGeneratedCssAsset) && !hasRememberedApplySource && !shouldRegenerateMainPackageCssWithScopedCandidates && (!shouldTrackGeneratorRuntime || shouldPreserveCollectedViteCssAsset)) {
|
|
5445
5723
|
const nextCss = removeRootCoveredCssFromScopedAsset(strippedViteProcessedCss);
|
|
@@ -5521,7 +5799,10 @@ function createGenerateBundleHook(context) {
|
|
|
5521
5799
|
const previousCss = !vitePipelineCssAsset && useIncrementalMode && !generatorCandidatesChanged && !hasRuntimeAffectingChanges && !snapshot.changedByType.css.has(file) ? getLastCssResult(lastCssResultByFile, outputFile, file) : void 0;
|
|
5522
5800
|
const generatorTransformRawSource = generatorRawSource;
|
|
5523
5801
|
const previousGeneratorCss = previousCss && !isWebGeneratorTarget ? normalizeMiniProgramGeneratorRawSource(previousCss, outputFile) : previousCss;
|
|
5524
|
-
const
|
|
5802
|
+
const shouldGenerateCssWithCore = hasTailwindGenerationSource(generatorTransformRawSource) || require_hmr_timing.hasBundlerGeneratedCssMarker(rawSource);
|
|
5803
|
+
const bundleUserRawSource = vitePipelineCssAsset && !require_hmr_timing.hasBundlerGeneratedCssMarker(rawSource) && normalizeCssSourceForCompare(rawSource) !== normalizeCssSourceForCompare(generatorRawSource) ? normalizeMiniProgramGeneratorRawSource(normalizeGeneratorUserRawSource(rawSource, generatorSourceFile, assetSourceFile), outputFile) : void 0;
|
|
5804
|
+
const generatorUserRawSource = [generatorUserLayerRawSource, bundleUserRawSource].filter((source) => typeof source === "string" && source.trim().length > 0).join("\n");
|
|
5805
|
+
const generated = shouldGenerateCssWithCore ? await require_source_candidate_scan_signature.generateTailwindV4Css({
|
|
5525
5806
|
opts,
|
|
5526
5807
|
runtimeState,
|
|
5527
5808
|
runtime: scopedGeneratorRuntime,
|
|
@@ -5536,7 +5817,7 @@ function createGenerateBundleHook(context) {
|
|
|
5536
5817
|
styleHandler,
|
|
5537
5818
|
debug,
|
|
5538
5819
|
previousCss: previousGeneratorCss,
|
|
5539
|
-
...
|
|
5820
|
+
...generatorUserRawSource ? { userRawSource: generatorUserRawSource } : {},
|
|
5540
5821
|
...usesConfiguredTailwindV4FallbackSource ? { restoreLocalCssImports: false } : {}
|
|
5541
5822
|
}) : void 0;
|
|
5542
5823
|
if (generated) {
|
|
@@ -5593,6 +5874,7 @@ function createGenerateBundleHook(context) {
|
|
|
5593
5874
|
continue;
|
|
5594
5875
|
}
|
|
5595
5876
|
if (type !== "js") continue;
|
|
5877
|
+
if (!processMarkupAndScripts) continue;
|
|
5596
5878
|
if (!shouldTransformJsBundle) {
|
|
5597
5879
|
debug("js skip web target: %s", file);
|
|
5598
5880
|
continue;
|
|
@@ -5626,7 +5908,7 @@ function createGenerateBundleHook(context) {
|
|
|
5626
5908
|
useIncrementalMode
|
|
5627
5909
|
});
|
|
5628
5910
|
}
|
|
5629
|
-
if (shouldProcessTailwindGeneration || useIncrementalMode || isNativeAppStyleTarget) await processRememberedCssReplay({
|
|
5911
|
+
if (processStyles && (shouldProcessTailwindGeneration || useIncrementalMode || isNativeAppStyleTarget)) await processRememberedCssReplay({
|
|
5630
5912
|
addWatchFile,
|
|
5631
5913
|
activeViteCssCacheFiles,
|
|
5632
5914
|
bundle,
|
|
@@ -5634,6 +5916,8 @@ function createGenerateBundleHook(context) {
|
|
|
5634
5916
|
cache,
|
|
5635
5917
|
changedCssFiles: snapshot.changedByType.css,
|
|
5636
5918
|
cssTaskFactories,
|
|
5919
|
+
cssPipelineContext,
|
|
5920
|
+
cssPipelineStrategy: context.cssPipelineStrategy,
|
|
5637
5921
|
createScopedGeneratorRuntime: createScopedGeneratorRuntime$1,
|
|
5638
5922
|
createScopedSourceCandidateGetter,
|
|
5639
5923
|
createScopedSourceCandidateSourceGetter,
|
|
@@ -5686,7 +5970,7 @@ function createGenerateBundleHook(context) {
|
|
|
5686
5970
|
generatorRuntime,
|
|
5687
5971
|
getCssHandlerOptions,
|
|
5688
5972
|
getSourceCandidateSourcesForEntries,
|
|
5689
|
-
getSourceCandidatesForEntries,
|
|
5973
|
+
getSourceCandidatesForEntries: getCombinedSourceCandidatesForEntries,
|
|
5690
5974
|
getViteCssCacheStats,
|
|
5691
5975
|
getViteProcessedCssAssetResults,
|
|
5692
5976
|
hmrTimingRecorder,
|
|
@@ -5726,6 +6010,7 @@ function createGenerateBundleHook(context) {
|
|
|
5726
6010
|
transformWebTargetCss,
|
|
5727
6011
|
useIncrementalMode
|
|
5728
6012
|
});
|
|
6013
|
+
state.bundleMarkupCandidatesByFile = bundleMarkupCandidates.candidatesByFile;
|
|
5729
6014
|
};
|
|
5730
6015
|
}
|
|
5731
6016
|
//#endregion
|
|
@@ -5798,7 +6083,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
5798
6083
|
generateBundle: {
|
|
5799
6084
|
order: "post",
|
|
5800
6085
|
async handler(_options, bundle) {
|
|
5801
|
-
const { opts, runtimeState, ensureRuntimeClassSet, cssPipelineStrategy, isCssAssetProcessed, markCssAssetProcessed, debug, getResolvedConfig, recordCssAssetResult, recordViteProcessedCssAssetResult, getViteProcessedCssAssetResults, getRecordedGeneratorCandidates, getSourceCandidates, getSourceCandidatesForEntries, getSourceCandidateSourcesForEntries, waitForSourceCandidateSyncs, rememberMainCssSource, getRememberedMainCssSource, isViteProcessedCssAsset } = context;
|
|
6086
|
+
const { opts, runtimeState, ensureRuntimeClassSet, cssPipelineStrategy, isCssAssetProcessed, markCssAssetProcessed, debug, getResolvedConfig, recordCssAssetResult, recordViteProcessedCssAssetResult, getViteProcessedCssAssetResults, getRecordedGeneratorCandidates, getSourceCandidates, getSourceCandidatesForEntries, getSourceCandidateSourcesForEntries, waitForSourceCandidateSyncs, rememberMainCssSource, getRememberedMainCssSource, isViteProcessedCssAsset, frameworkRootImportShellTargetByFile } = context;
|
|
5802
6087
|
const resolvedConfig = getResolvedConfig();
|
|
5803
6088
|
const uniUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
5804
6089
|
const generatorPlatform = opts.cssOptions?.platform ?? opts.platform ?? inferPlatformFromViteOutDir(resolvedConfig?.build?.outDir);
|
|
@@ -5831,6 +6116,19 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
5831
6116
|
const rootDir = resolvedConfig?.root ? node_path.default.resolve(resolvedConfig.root) : node_process.default.cwd();
|
|
5832
6117
|
const outDir = resolvedConfig?.build?.outDir ? node_path.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
5833
6118
|
const sourceRoot = resolveWeappViteSourceRoot(resolvedConfig, opts.appType) ?? resolveSourceRootFromBundleGraph(resolvedConfig, bundle);
|
|
6119
|
+
restoreFrameworkRootMiniProgramImportShellAssets(bundle, {
|
|
6120
|
+
debug,
|
|
6121
|
+
isWebGeneratorTarget,
|
|
6122
|
+
matchesCss: opts.cssMatcher,
|
|
6123
|
+
onUpdate: opts.onUpdate,
|
|
6124
|
+
recordCssAssetResult,
|
|
6125
|
+
shouldKeep: (file, css) => cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
6126
|
+
...createCssPipelineContext(file),
|
|
6127
|
+
css,
|
|
6128
|
+
file
|
|
6129
|
+
}),
|
|
6130
|
+
targetByFile: frameworkRootImportShellTargetByFile ?? /* @__PURE__ */ new Map()
|
|
6131
|
+
});
|
|
5834
6132
|
const sourceTraceTokenSources = getSourceCandidateSourcesForEntries ? require_hmr_timing.createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts) : void 0;
|
|
5835
6133
|
const annotateCss = (css) => require_hmr_timing.annotateCssSourceTrace(css, {
|
|
5836
6134
|
opts,
|
|
@@ -5932,10 +6230,15 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
5932
6230
|
const file = output.fileName || bundleFile;
|
|
5933
6231
|
const rawSource = output.source.toString();
|
|
5934
6232
|
if (isViteProcessedCssAsset?.(output, file)) {
|
|
5935
|
-
const
|
|
6233
|
+
const cleanRawSource = require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource);
|
|
6234
|
+
const cssHandlerOptions = createCssHandlerOptions(opts, runtimeState.tailwindRuntime.majorVersion, file, outDir, cssPipelineStrategy?.getCssHandlerExtraOptions?.({
|
|
6235
|
+
...createCssPipelineContext(file),
|
|
6236
|
+
file
|
|
6237
|
+
}) ?? {});
|
|
6238
|
+
const nextCss = annotateCss(generatorBranch.isWeb ? finalizeWebCss(cleanRawSource, {
|
|
5936
6239
|
...createCssPipelineContext(file),
|
|
5937
6240
|
file
|
|
5938
|
-
}, cssPipelineStrategy));
|
|
6241
|
+
}, cssPipelineStrategy) : (await opts.styleHandler(cleanRawSource, cssHandlerOptions)).css);
|
|
5939
6242
|
output.source = nextCss;
|
|
5940
6243
|
markCssAssetProcessed(output, file);
|
|
5941
6244
|
recordCssAssetResult?.(file, nextCss);
|
|
@@ -5950,7 +6253,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
5950
6253
|
...cssHandlerOptions,
|
|
5951
6254
|
isMainChunk: false
|
|
5952
6255
|
};
|
|
5953
|
-
const cleanRawSource =
|
|
6256
|
+
const cleanRawSource = require_hmr_timing.stripBundlerGeneratedCssMarkers(rawSource);
|
|
5954
6257
|
if (cleanRawSource !== rawSource && cleanRawSource.trim().length === 0) {
|
|
5955
6258
|
output.source = cleanRawSource;
|
|
5956
6259
|
markCssAssetProcessed(output, file);
|
|
@@ -6077,7 +6380,7 @@ function normalizeCssSourceIdentity(sourceFile) {
|
|
|
6077
6380
|
const { filename, query } = parseVueRequest(cleanSourceFile);
|
|
6078
6381
|
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(filename);
|
|
6079
6382
|
if (query.type === "style") return `${normalizedFile}?type=style&index=${query.index ?? 0}`;
|
|
6080
|
-
return require_source_candidate_scan_signature.normalizeOutputPathKey(
|
|
6383
|
+
return require_source_candidate_scan_signature.normalizeOutputPathKey(require_hmr_timing.stripRequestQuery(cleanSourceFile));
|
|
6081
6384
|
}
|
|
6082
6385
|
function hasSfcStyleBlocks(source) {
|
|
6083
6386
|
SFC_STYLE_BLOCK_RE.lastIndex = 0;
|
|
@@ -6180,19 +6483,19 @@ function createViteCssMemory(options) {
|
|
|
6180
6483
|
for (const [rememberedKey, remembered] of relatedRememberedEntries) refreshRememberedCssSourceEntry(rememberedKey, remembered, sourceFile, rawSource);
|
|
6181
6484
|
};
|
|
6182
6485
|
const resolveCachedStyleSource = (sourceFile) => {
|
|
6183
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(
|
|
6486
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(require_hmr_timing.stripRequestQuery(sourceFile));
|
|
6184
6487
|
if (SFC_COMPONENT_FILE_RE.test(file)) return getKnownSfcSource(file);
|
|
6185
|
-
if (
|
|
6488
|
+
if (require_hmr_timing.isSourceStyleRequest(file)) return options.getSourceCandidateSource(file);
|
|
6186
6489
|
};
|
|
6187
6490
|
const resolveCurrentStyleSource = async (sourceFile) => {
|
|
6188
6491
|
const cached = resolveCachedStyleSource(sourceFile);
|
|
6189
6492
|
if (cached != null) return cached;
|
|
6190
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(
|
|
6493
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(require_hmr_timing.stripRequestQuery(sourceFile));
|
|
6191
6494
|
const knownSource = knownCssSources.get(normalizeCssSourceIdentity(sourceFile));
|
|
6192
6495
|
if (knownSource != null) return knownSource;
|
|
6193
6496
|
const candidateSource = options.getSourceCandidateSource(file);
|
|
6194
6497
|
if (candidateSource != null) return candidateSource;
|
|
6195
|
-
if (!
|
|
6498
|
+
if (!require_hmr_timing.isSourceStyleRequest(file)) return;
|
|
6196
6499
|
try {
|
|
6197
6500
|
return await (0, node_fs_promises.readFile)(file, "utf8");
|
|
6198
6501
|
} catch (error) {
|
|
@@ -6203,7 +6506,7 @@ function createViteCssMemory(options) {
|
|
|
6203
6506
|
const refreshRememberedCssSourceByCurrentFile = async (sourceFile) => {
|
|
6204
6507
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(sourceFile);
|
|
6205
6508
|
const normalizedSourceFile = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
6206
|
-
const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => require_source_candidate_scan_signature.normalizeOutputPathKey(
|
|
6509
|
+
const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => require_source_candidate_scan_signature.normalizeOutputPathKey(require_hmr_timing.stripRequestQuery((0, _weapp_tailwindcss_shared.cleanUrl)(remembered.sourceFile))) === normalizedSourceFile);
|
|
6207
6510
|
if (matchedRememberedSources.length === 0) return;
|
|
6208
6511
|
const source = await resolveCurrentStyleSource(file);
|
|
6209
6512
|
if (source == null) {
|
|
@@ -6218,10 +6521,10 @@ function createViteCssMemory(options) {
|
|
|
6218
6521
|
}
|
|
6219
6522
|
return;
|
|
6220
6523
|
}
|
|
6221
|
-
if (
|
|
6524
|
+
if (require_hmr_timing.isSourceStyleRequest(file)) refreshRememberedCssSourceBySourceFile(file, source);
|
|
6222
6525
|
};
|
|
6223
6526
|
const refreshRememberedCssSource = async (remembered) => {
|
|
6224
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(
|
|
6527
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(require_hmr_timing.stripRequestQuery(remembered.sourceFile));
|
|
6225
6528
|
const rememberedKey = [...rememberedCssSources.entries()].find(([, entry]) => entry === remembered)?.[0];
|
|
6226
6529
|
if (!rememberedKey || !node_path.default.isAbsolute(file)) return;
|
|
6227
6530
|
const source = await resolveCurrentStyleSource(file);
|
|
@@ -6234,7 +6537,7 @@ function createViteCssMemory(options) {
|
|
|
6234
6537
|
const styleSource = extractSfcStyleSource(source, query.type === "style" ? query.index : void 0);
|
|
6235
6538
|
return styleSource === void 0 ? void 0 : refreshRememberedCssSourceEntry(rememberedKey, remembered, remembered.sourceFile, styleSource);
|
|
6236
6539
|
}
|
|
6237
|
-
if (
|
|
6540
|
+
if (require_hmr_timing.isSourceStyleRequest(file)) return refreshRememberedCssSourceEntry(rememberedKey, remembered, remembered.sourceFile, source);
|
|
6238
6541
|
};
|
|
6239
6542
|
const prune = (pruneOptions) => {
|
|
6240
6543
|
const activeFiles = new Set([...pruneOptions.activeFiles].map(require_source_candidate_scan_signature.normalizeOutputPathKey));
|
|
@@ -6290,7 +6593,7 @@ function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
|
6290
6593
|
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
6291
6594
|
const outDir = ctx.server.config?.build?.outDir ? normalizeAbsoluteFilePath(node_path.default.resolve(root, ctx.server.config.build.outDir)) : void 0;
|
|
6292
6595
|
const isHotSourceStyleModule = (id) => {
|
|
6293
|
-
if (!
|
|
6596
|
+
if (!require_hmr_timing.isSourceStyleRequest(id)) return false;
|
|
6294
6597
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
6295
6598
|
if (isRootMiniProgramStyleUrl(file) || !isAbsoluteFilePath(file) && !file.startsWith("/")) return false;
|
|
6296
6599
|
if (outDir && isAbsoluteFilePath(file)) {
|
|
@@ -6323,7 +6626,7 @@ function resolveHotSourceModules(ctx) {
|
|
|
6323
6626
|
const seenModules = /* @__PURE__ */ new Set();
|
|
6324
6627
|
const collectModule = (mod) => {
|
|
6325
6628
|
if (mod == null || seenModules.has(mod)) return;
|
|
6326
|
-
if (
|
|
6629
|
+
if (require_hmr_timing.isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
6327
6630
|
seenModules.add(mod);
|
|
6328
6631
|
modules.push(mod);
|
|
6329
6632
|
};
|
|
@@ -6381,7 +6684,7 @@ function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
|
6381
6684
|
}
|
|
6382
6685
|
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
6383
6686
|
return modules.some((mod) => {
|
|
6384
|
-
return !
|
|
6687
|
+
return !require_hmr_timing.isSourceStyleRequest(mod.id ?? mod.url) && mod.isSelfAccepting === true;
|
|
6385
6688
|
});
|
|
6386
6689
|
}
|
|
6387
6690
|
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = []) {
|
|
@@ -6389,7 +6692,7 @@ function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = []) {
|
|
|
6389
6692
|
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
6390
6693
|
const updates = [];
|
|
6391
6694
|
for (const id of fallbackCssIds) {
|
|
6392
|
-
if (!
|
|
6695
|
+
if (!require_hmr_timing.isSourceStyleRequest(id)) continue;
|
|
6393
6696
|
const hotUrl = resolveCssHotUrl(id, root);
|
|
6394
6697
|
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
6395
6698
|
seenUrls.add(hotUrl);
|
|
@@ -6527,7 +6830,7 @@ function joinPosixPath(base, subpath) {
|
|
|
6527
6830
|
function isCssLikeImporter(importer) {
|
|
6528
6831
|
if (!importer) return false;
|
|
6529
6832
|
const normalized = (0, _weapp_tailwindcss_shared.cleanUrl)(importer);
|
|
6530
|
-
return
|
|
6833
|
+
return require_hmr_timing.isSourceStyleRequest(importer) || require_source_candidate_scan_signature.isCSSRequest(normalized) || normalized.endsWith("/*");
|
|
6531
6834
|
}
|
|
6532
6835
|
function stripTailwindConfigDirectives(code) {
|
|
6533
6836
|
return code.replace(/^\s*@config\s+(?:"[^"]+"|'[^']+')[^;\n]*;\s*$/gm, "");
|
|
@@ -6746,57 +7049,79 @@ function replaceViteCssHmrModuleCss(code, css) {
|
|
|
6746
7049
|
return `${code.slice(0, extracted.start)}${encodeJsStringLiteral(css)}${code.slice(extracted.end)}`;
|
|
6747
7050
|
}
|
|
6748
7051
|
function isViteServeStyleRequest(id, command) {
|
|
6749
|
-
return command === "serve" &&
|
|
7052
|
+
return command === "serve" && require_hmr_timing.isSourceStyleRequest(id) && !SPECIAL_QUERY_RE$1.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
6750
7053
|
}
|
|
6751
7054
|
function isViteServeCssRootRequest(id, command) {
|
|
6752
|
-
return command === "serve" &&
|
|
7055
|
+
return command === "serve" && require_hmr_timing.isSourceStyleRequest(id) && !SPECIAL_QUERY_RE$1.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
7056
|
+
}
|
|
7057
|
+
function isViteBuildStyleRequest(id, command) {
|
|
7058
|
+
return command === "build" && require_hmr_timing.isSourceStyleRequest(id) && !SPECIAL_QUERY_RE$1.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
6753
7059
|
}
|
|
6754
7060
|
function isViteCssHmrModule(code, id, command) {
|
|
6755
7061
|
return isViteServeStyleRequest(id, command) && VITE_CSS_HMR_MODULE_RE.test(code) && (/[?&](?:direct|vue)(?:&|$)/.test(id) || DEFERRED_CSS_HMR_QUERY_RE.test(id));
|
|
6756
7062
|
}
|
|
6757
|
-
function
|
|
7063
|
+
function hasViteCssGenerationDirective(code) {
|
|
6758
7064
|
return require_generator.hasTailwindRootDirectives(code) || require_generator.hasTailwindSourceDirectives(code, { importFallback: true }) || require_generator.hasTailwindApplyDirective(code);
|
|
6759
7065
|
}
|
|
6760
7066
|
function hasViteServeCssRootDirective(code) {
|
|
6761
7067
|
return require_generator.hasTailwindRootDirectives(code);
|
|
6762
7068
|
}
|
|
6763
|
-
function
|
|
6764
|
-
return [
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
7069
|
+
function createViteCssGenerationPlugins(options) {
|
|
7070
|
+
return [
|
|
7071
|
+
{
|
|
7072
|
+
name: `${require_context.vitePluginName}:generate:serve`,
|
|
7073
|
+
apply: "serve",
|
|
7074
|
+
enforce: "pre",
|
|
7075
|
+
async transform(code, id) {
|
|
7076
|
+
if (!options.shouldGenerate() || !isViteServeCssRootRequest(id, options.getCommand())) return;
|
|
7077
|
+
if (!require_generator.hasTailwindRootDirectives(code)) return;
|
|
7078
|
+
if (DEFERRED_CSS_HMR_QUERY_RE.test(id)) return;
|
|
7079
|
+
await options.onTailwindRootCss?.(id, code);
|
|
7080
|
+
const generatedCss = await options.generateCss(id, code, this);
|
|
7081
|
+
if (generatedCss === void 0 || generatedCss === code) return;
|
|
7082
|
+
return {
|
|
7083
|
+
code: generatedCss,
|
|
7084
|
+
map: null
|
|
7085
|
+
};
|
|
7086
|
+
}
|
|
7087
|
+
},
|
|
7088
|
+
{
|
|
7089
|
+
name: `${require_context.vitePluginName}:generate:build`,
|
|
7090
|
+
apply: "build",
|
|
7091
|
+
enforce: "pre",
|
|
7092
|
+
async transform(code, id) {
|
|
7093
|
+
if (!options.shouldGenerate() || options.shouldGenerateBuild?.() === false || !isViteBuildStyleRequest(id, options.getCommand())) return;
|
|
7094
|
+
if (!hasViteCssGenerationDirective(code)) return;
|
|
7095
|
+
if (hasViteServeCssRootDirective(code)) await options.onTailwindRootCss?.(id, code);
|
|
7096
|
+
const generatedCss = await options.generateCss(id, code, this);
|
|
7097
|
+
if (generatedCss === void 0 || generatedCss === code) return;
|
|
7098
|
+
return {
|
|
7099
|
+
code: generatedCss,
|
|
7100
|
+
map: null
|
|
7101
|
+
};
|
|
7102
|
+
}
|
|
7103
|
+
},
|
|
7104
|
+
{
|
|
7105
|
+
name: `${require_context.vitePluginName}:generate:serve-hmr`,
|
|
7106
|
+
apply: "serve",
|
|
7107
|
+
enforce: "post",
|
|
7108
|
+
async transform(code, id) {
|
|
7109
|
+
if (!options.shouldGenerate() || !isViteCssHmrModule(code, id, options.getCommand())) return;
|
|
7110
|
+
const extracted = extractViteCssHmrModuleCss(code);
|
|
7111
|
+
if (!extracted) return;
|
|
7112
|
+
if (!hasViteCssGenerationDirective(extracted.css)) return;
|
|
7113
|
+
if (hasViteServeCssRootDirective(extracted.css)) await options.onTailwindRootCss?.(id, extracted.css);
|
|
7114
|
+
const generatedCss = await options.generateCss(id, extracted.css, this);
|
|
7115
|
+
if (generatedCss === void 0 || generatedCss === extracted.css) return;
|
|
7116
|
+
const nextCode = replaceViteCssHmrModuleCss(code, generatedCss);
|
|
7117
|
+
if (nextCode === void 0 || nextCode === code) return;
|
|
7118
|
+
return {
|
|
7119
|
+
code: nextCode,
|
|
7120
|
+
map: null
|
|
7121
|
+
};
|
|
7122
|
+
}
|
|
6798
7123
|
}
|
|
6799
|
-
|
|
7124
|
+
];
|
|
6800
7125
|
}
|
|
6801
7126
|
//#endregion
|
|
6802
7127
|
//#region src/bundlers/vite/serve-js-transform.ts
|
|
@@ -6825,6 +7150,22 @@ function createViteServeJsTransformPlugin(options) {
|
|
|
6825
7150
|
};
|
|
6826
7151
|
}
|
|
6827
7152
|
//#endregion
|
|
7153
|
+
//#region src/bundlers/vite/serve-root-import-shell.ts
|
|
7154
|
+
function resolveViteServeRootMiniProgramImportShell(options) {
|
|
7155
|
+
const { css, cssPipelineContext, cssPipelineStrategy, isWebGeneratorTarget, outputFile } = options;
|
|
7156
|
+
return shouldPreserveFrameworkRootMiniProgramImportShell({
|
|
7157
|
+
css,
|
|
7158
|
+
file: outputFile,
|
|
7159
|
+
isWebGeneratorTarget,
|
|
7160
|
+
matchesCss: cssPipelineContext.opts?.cssMatcher?.(outputFile) ?? true,
|
|
7161
|
+
shouldKeep: () => cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
7162
|
+
...cssPipelineContext,
|
|
7163
|
+
css,
|
|
7164
|
+
file: outputFile
|
|
7165
|
+
})
|
|
7166
|
+
}) ? require_hmr_timing.normalizeMiniProgramImportShell(css) : void 0;
|
|
7167
|
+
}
|
|
7168
|
+
//#endregion
|
|
6828
7169
|
//#region src/bundlers/vite/tailwind-basedir.ts
|
|
6829
7170
|
const PACKAGE_JSON_FILE = "package.json";
|
|
6830
7171
|
function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
@@ -6845,6 +7186,40 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
|
6845
7186
|
return resolvedRoot;
|
|
6846
7187
|
}
|
|
6847
7188
|
//#endregion
|
|
7189
|
+
//#region src/bundlers/vite/watch-css-post.ts
|
|
7190
|
+
const wrappedCssPostPlugins = /* @__PURE__ */ new WeakSet();
|
|
7191
|
+
function isWebOrNativeAppPlatform$1(platform) {
|
|
7192
|
+
return platform === "h5" || platform === "web" || platform?.startsWith("web-") === true || platform === "app" || platform === "app-plus" || platform?.startsWith("app-") === true;
|
|
7193
|
+
}
|
|
7194
|
+
function shouldAdaptFrameworkWatchCssBeforeCache(options) {
|
|
7195
|
+
return options.enabled && options.ownsTailwindGeneration && options.isWatchBuild && (options.platform ? !isWebOrNativeAppPlatform$1(options.platform) : !options.isWebGeneratorBranch);
|
|
7196
|
+
}
|
|
7197
|
+
function resolveTransformHandler(plugin) {
|
|
7198
|
+
const hook = plugin.transform;
|
|
7199
|
+
if (typeof hook === "function") return hook;
|
|
7200
|
+
if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
|
|
7201
|
+
}
|
|
7202
|
+
/**
|
|
7203
|
+
* 在框架的 CSS post hook 持久化样式前完成转换,保证 watch 重放缓存时不会重新输出原始 CSS。
|
|
7204
|
+
*/
|
|
7205
|
+
function wrapViteCssPostTransform(config, transformCss) {
|
|
7206
|
+
const plugin = config.plugins?.find((candidate) => candidate.name === "vite:css-post");
|
|
7207
|
+
if (!plugin || wrappedCssPostPlugins.has(plugin)) return false;
|
|
7208
|
+
const originalHandler = resolveTransformHandler(plugin);
|
|
7209
|
+
if (!originalHandler) return false;
|
|
7210
|
+
const wrappedHandler = async function(code, id, ...args) {
|
|
7211
|
+
const transformedCss = await transformCss(code, id);
|
|
7212
|
+
return originalHandler.call(this, transformedCss, id, ...args);
|
|
7213
|
+
};
|
|
7214
|
+
const originalHook = plugin.transform;
|
|
7215
|
+
plugin.transform = originalHook && typeof originalHook === "object" ? {
|
|
7216
|
+
...originalHook,
|
|
7217
|
+
handler: wrappedHandler
|
|
7218
|
+
} : wrappedHandler;
|
|
7219
|
+
wrappedCssPostPlugins.add(plugin);
|
|
7220
|
+
return true;
|
|
7221
|
+
}
|
|
7222
|
+
//#endregion
|
|
6848
7223
|
//#region src/bundlers/vite/shared/create-framework-plugins.ts
|
|
6849
7224
|
const debug = require_wxml.createDebug();
|
|
6850
7225
|
const weappTailwindcssPackageDir = require_source_candidate_scan_signature.resolvePackageDir("weapp-tailwindcss");
|
|
@@ -6977,6 +7352,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
6977
7352
|
cssEntries: opts.cssEntries ?? rawOptions.cssEntries
|
|
6978
7353
|
});
|
|
6979
7354
|
const autoCssSourceContent = /* @__PURE__ */ new Map();
|
|
7355
|
+
const frameworkRootImportShellTargetByFile = /* @__PURE__ */ new Map();
|
|
6980
7356
|
const transientAutoCssSources = /* @__PURE__ */ new Map();
|
|
6981
7357
|
let refreshRuntimeStateForAutoCssSources;
|
|
6982
7358
|
let autoCssSourcesRefresh;
|
|
@@ -7053,7 +7429,21 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7053
7429
|
};
|
|
7054
7430
|
const customAttributesEntities = require_context.toCustomAttributesEntities(customAttributes);
|
|
7055
7431
|
let recordedGeneratorCandidates;
|
|
7056
|
-
const sourceCandidateCollector = require_hmr_timing.createSourceCandidateCollector({
|
|
7432
|
+
const sourceCandidateCollector = require_hmr_timing.createSourceCandidateCollector({
|
|
7433
|
+
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
7434
|
+
customAttributesEntities,
|
|
7435
|
+
disabledDefaultTemplateHandler
|
|
7436
|
+
});
|
|
7437
|
+
const originalCssLayerSourceByFile = new lru_cache.LRUCache({ max: 128 });
|
|
7438
|
+
const rememberOriginalCssLayerSource = (id, code) => {
|
|
7439
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
7440
|
+
if (!require_source_candidate_scan_signature.isCSSRequest(file)) return;
|
|
7441
|
+
if (!require_generator.hasUserCssLayerBlocks(code)) {
|
|
7442
|
+
originalCssLayerSourceByFile.delete(file);
|
|
7443
|
+
return;
|
|
7444
|
+
}
|
|
7445
|
+
originalCssLayerSourceByFile.set(file, require_generator.splitUserCssLayerBlocks(code).layer);
|
|
7446
|
+
};
|
|
7057
7447
|
const sourceCandidateScanCache = new lru_cache.LRUCache({ max: SOURCE_CANDIDATE_SCAN_CACHE_MAX });
|
|
7058
7448
|
let sourceScanEntries;
|
|
7059
7449
|
let sourceScanMatcher;
|
|
@@ -7156,7 +7546,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7156
7546
|
const createViteSourceCandidateChange = (file, change, options = {}) => ({
|
|
7157
7547
|
...change,
|
|
7158
7548
|
file,
|
|
7159
|
-
runtimeAffecting: options.runtimeAffecting === true ||
|
|
7549
|
+
runtimeAffecting: options.runtimeAffecting === true || require_hmr_timing.isSourceStyleRequest(file) || hasWebHmrRuntimeAffectingDirectives(sourceCandidateCollector.source(file))
|
|
7160
7550
|
});
|
|
7161
7551
|
const clearPendingHmrCandidateChange = () => {
|
|
7162
7552
|
pendingHmrCandidateChange = void 0;
|
|
@@ -7188,7 +7578,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7188
7578
|
pendingFullHmrCssRegeneration = true;
|
|
7189
7579
|
};
|
|
7190
7580
|
const applySourceCandidateHmrState = (change) => {
|
|
7191
|
-
if (
|
|
7581
|
+
if (require_hmr_timing.isSourceStyleRequest(change.file)) {
|
|
7192
7582
|
clearPendingHmrCandidateChange();
|
|
7193
7583
|
return change;
|
|
7194
7584
|
}
|
|
@@ -7328,7 +7718,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7328
7718
|
if (sourceScanMatcher && !sourceScanMatcher(file)) {
|
|
7329
7719
|
const change = sourceCandidateCollector.remove(file);
|
|
7330
7720
|
cacheCurrentSourceCandidateScan();
|
|
7331
|
-
if (
|
|
7721
|
+
if (require_hmr_timing.isSourceStyleRequest(file)) return (0, node_fs_promises.readFile)(file, "utf8").then((source) => cssMemory.refreshRememberedCssSourceBySourceFile(file, source)).catch((error) => {
|
|
7332
7722
|
if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) !== "ENOENT") debug("remembered css source watch refresh failed: %s %O", file, error);
|
|
7333
7723
|
}).then(() => cssMemory.refreshRememberedCssSourceByCurrentFile(file)).then(() => applySourceCandidateHmrState(createViteSourceCandidateChange(file, change, { runtimeAffecting: true })));
|
|
7334
7724
|
return cssMemory.refreshRememberedCssSourceByCurrentFile(file).then(() => applySourceCandidateHmrState(createViteSourceCandidateChange(file, change, { runtimeAffecting: true })));
|
|
@@ -7400,7 +7790,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7400
7790
|
if (!shouldOwnTailwindGeneration) return;
|
|
7401
7791
|
tailwindRootCssModuleIds.add(id);
|
|
7402
7792
|
const cleanId = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
7403
|
-
if (
|
|
7793
|
+
if (require_hmr_timing.isSourceStyleRequest(cleanId)) tailwindRootCssModuleIds.add(cleanId);
|
|
7404
7794
|
};
|
|
7405
7795
|
const registerTailwindRootCss = async (id, code) => {
|
|
7406
7796
|
rememberTailwindRootCssModule(id);
|
|
@@ -7414,7 +7804,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7414
7804
|
return viteProcessedCssSourceFiles.has(normalized);
|
|
7415
7805
|
};
|
|
7416
7806
|
const isViteProcessedCssAsset = (asset, file) => {
|
|
7417
|
-
if (
|
|
7807
|
+
if (require_hmr_timing.hasBundlerGeneratedCssMarker(asset.source)) return true;
|
|
7418
7808
|
return [
|
|
7419
7809
|
file,
|
|
7420
7810
|
asset.originalFileName,
|
|
@@ -7439,12 +7829,23 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7439
7829
|
getMajorVersion: () => runtimeState.tailwindRuntime.majorVersion,
|
|
7440
7830
|
moduleGraph: void 0
|
|
7441
7831
|
});
|
|
7832
|
+
const shouldAdaptFrameworkWatchCss = () => {
|
|
7833
|
+
const platform = resolveViteStylePlatform();
|
|
7834
|
+
return shouldAdaptFrameworkWatchCssBeforeCache({
|
|
7835
|
+
enabled: frameworkBranch.adaptWatchCssBeforeFrameworkCache === true,
|
|
7836
|
+
ownsTailwindGeneration: shouldOwnTailwindGeneration,
|
|
7837
|
+
isWatchBuild: isWatchBuild(),
|
|
7838
|
+
isWebGeneratorBranch: resolveCurrentGeneratorBranch().isWeb,
|
|
7839
|
+
platform
|
|
7840
|
+
});
|
|
7841
|
+
};
|
|
7442
7842
|
const generateTailwindCssForVitePipeline = async (id, code, hookContext) => {
|
|
7443
7843
|
if (!shouldOwnTailwindGeneration) return;
|
|
7444
7844
|
await runtimeState.readyPromise;
|
|
7445
7845
|
await waitForSourceCandidateSyncs();
|
|
7446
7846
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
7447
|
-
const
|
|
7847
|
+
const inferredSfcStyleRequest = isSfcStyleSourceFile(file) ? resolveSfcStyleRequestFromKnownSource(file, cssMemory.getKnownSfcSource(file), code) : file;
|
|
7848
|
+
const requestFile = require_source_candidate_scan_signature.isCSSRequest(id) ? inferredSfcStyleRequest === file ? id : inferredSfcStyleRequest : inferredSfcStyleRequest;
|
|
7448
7849
|
if (!require_source_candidate_scan_signature.isCSSRequest(requestFile) || opts.htmlMatcher(file) || require_source_candidate_scan_signature.isHTMLRequest(file)) return;
|
|
7449
7850
|
const generatorCode = require_generator.normalizeEmptyTailwindCustomVariants(code);
|
|
7450
7851
|
const rootDir = resolvedConfig?.root ? node_path.default.resolve(resolvedConfig.root) : node_process.default.cwd();
|
|
@@ -7463,11 +7864,39 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7463
7864
|
const pendingHmrChange = resolvePendingHmrCandidateChange(generatorCode, file);
|
|
7464
7865
|
const forceFullHmrCssRegeneration = pendingFullHmrCssRegeneration || resolvedConfig?.command === "serve" && pendingHmrCandidateChange !== void 0 && pendingHmrChange === void 0;
|
|
7465
7866
|
const runtime = fullRuntime;
|
|
7867
|
+
const importShellCss = resolveViteServeRootMiniProgramImportShell({
|
|
7868
|
+
css: generatorTransformCode,
|
|
7869
|
+
cssPipelineContext,
|
|
7870
|
+
cssPipelineStrategy: frameworkCssPipelineStrategy,
|
|
7871
|
+
isWebGeneratorTarget: currentGeneratorBranch.isWeb,
|
|
7872
|
+
outputFile
|
|
7873
|
+
});
|
|
7874
|
+
if (importShellCss !== void 0) {
|
|
7875
|
+
cleanGeneratedCssByFile.set(fileKey, importShellCss);
|
|
7876
|
+
tracedGeneratedCssByFile.set(fileKey, importShellCss);
|
|
7877
|
+
generatedClassSetByFile.set(fileKey, /* @__PURE__ */ new Set());
|
|
7878
|
+
recordViteProcessedCssAssetResult(file, importShellCss, {
|
|
7879
|
+
injectIntoMain: false,
|
|
7880
|
+
outputFile
|
|
7881
|
+
});
|
|
7882
|
+
markViteProcessedCssSource(file);
|
|
7883
|
+
rememberTailwindRootCssModule(id);
|
|
7884
|
+
recordGeneratorCandidates(fullRuntime);
|
|
7885
|
+
if (pendingHmrChange) finishPendingHmrCssTargetFile(file);
|
|
7886
|
+
else if (!pendingHmrCandidateChange) clearPendingHmrCandidateChange();
|
|
7887
|
+
cssMemory.rememberCssSource({
|
|
7888
|
+
outputFile,
|
|
7889
|
+
rawSource: code,
|
|
7890
|
+
sourceFile: requestFile
|
|
7891
|
+
});
|
|
7892
|
+
debug("css preserved root mini-program import shell for vite postcss pipeline: %s bytes=%d", requestFile, importShellCss.length);
|
|
7893
|
+
return importShellCss;
|
|
7894
|
+
}
|
|
7466
7895
|
if (pendingHmrChange && currentGeneratorOptions.target === "weapp" && require_generator.filterUnsupportedMiniProgramTailwindV4Candidates(pendingHmrChange.addedCandidates).size === 0) {
|
|
7467
7896
|
const previousTracedCss = tracedGeneratedCssByFile.get(fileKey);
|
|
7468
7897
|
if (previousTracedCss !== void 0) {
|
|
7469
7898
|
finishPendingHmrCssTargetFile(file);
|
|
7470
|
-
return `${
|
|
7899
|
+
return `${require_hmr_timing.createBundlerGeneratedCssMarker("vite", normalizeViteProcessedCssFile(file))}\n${previousTracedCss}`;
|
|
7471
7900
|
}
|
|
7472
7901
|
}
|
|
7473
7902
|
const sourceCssHandlerOptions = transformCssHandlerOptions.getCssHandlerOptions(requestFile);
|
|
@@ -7486,7 +7915,9 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7486
7915
|
cssHandlerOptions,
|
|
7487
7916
|
generatorCode: generatorTransformCode
|
|
7488
7917
|
}) ?? true);
|
|
7489
|
-
const
|
|
7918
|
+
const previousCss = pendingHmrChange && !forceFullHmrCssRegeneration ? cleanGeneratedCssByFile.get(fileKey) : void 0;
|
|
7919
|
+
const previousGeneratorCss = previousCss && !currentGeneratorBranch.isWeb ? require_hmr_timing.normalizeMiniProgramGeneratorCssSource(previousCss, outputFile) : previousCss;
|
|
7920
|
+
const generated = await hmrTimingRecorder.measure(`generateCss.${resolvedConfig?.command ?? "unknown"}`, () => require_source_candidate_scan_signature.generateTailwindV4Css({
|
|
7490
7921
|
opts,
|
|
7491
7922
|
runtimeState,
|
|
7492
7923
|
runtime,
|
|
@@ -7500,7 +7931,10 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7500
7931
|
generatorPlatform: resolveGeneratorPlatform(),
|
|
7501
7932
|
styleHandler,
|
|
7502
7933
|
debug,
|
|
7934
|
+
previousCss: previousGeneratorCss,
|
|
7935
|
+
previousClassSet: pendingHmrChange && !forceFullHmrCssRegeneration ? generatedClassSetByFile.get(fileKey) : void 0,
|
|
7503
7936
|
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource,
|
|
7937
|
+
deferCssAdaptation: !currentGeneratorBranch.isWeb && !shouldAdaptFrameworkWatchCss(),
|
|
7504
7938
|
disableSourceScan: false,
|
|
7505
7939
|
restoreLocalCssImports: !currentGeneratorBranch.isWeb
|
|
7506
7940
|
}), {
|
|
@@ -7561,7 +7995,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7561
7995
|
sourceFile: requestFile
|
|
7562
7996
|
});
|
|
7563
7997
|
debug("css generated for vite postcss pipeline: %s bytes=%d", requestFile, tracedCss.length);
|
|
7564
|
-
return `${
|
|
7998
|
+
return `${require_hmr_timing.createBundlerGeneratedCssMarker("vite", normalizeViteProcessedCssFile(file))}\n${tracedCss}`;
|
|
7565
7999
|
};
|
|
7566
8000
|
const rewritePlugins = createRewriteCssImportsPlugins({
|
|
7567
8001
|
getAppType: () => opts.appType,
|
|
@@ -7576,7 +8010,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7576
8010
|
weappTailwindcssDirPosix
|
|
7577
8011
|
});
|
|
7578
8012
|
if (disabledOptions.plugin) return rewritePlugins.length ? rewritePlugins : void 0;
|
|
7579
|
-
const
|
|
8013
|
+
const generateBundleContext = {
|
|
7580
8014
|
opts,
|
|
7581
8015
|
runtimeState,
|
|
7582
8016
|
ensureRuntimeClassSet,
|
|
@@ -7593,6 +8027,11 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7593
8027
|
getSourceCandidates,
|
|
7594
8028
|
getSourceCandidateSource: (file) => sourceCandidateCollector.source(file),
|
|
7595
8029
|
getSourceCandidateSources: () => sourceCandidateCollector.sources(),
|
|
8030
|
+
extractSourceCandidates: (file, source) => require_hmr_timing.extractCandidatesFromSource(source, node_path.default.extname((0, _weapp_tailwindcss_shared.cleanUrl)(file)).slice(1) || "html", {
|
|
8031
|
+
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
8032
|
+
customAttributesEntities,
|
|
8033
|
+
disabledDefaultTemplateHandler
|
|
8034
|
+
}),
|
|
7596
8035
|
getSourceCandidatesForEntries,
|
|
7597
8036
|
getSourceCandidateSourcesForEntries,
|
|
7598
8037
|
waitForSourceCandidateSyncs,
|
|
@@ -7603,11 +8042,23 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7603
8042
|
setRememberedCssSignature: cssMemory.setRememberedCssSignature,
|
|
7604
8043
|
getKnownCssSource: cssMemory.getKnownCssSource,
|
|
7605
8044
|
getKnownSfcSource: cssMemory.getKnownSfcSource,
|
|
8045
|
+
getOriginalCssLayerSource: (file) => originalCssLayerSourceByFile.get((0, _weapp_tailwindcss_shared.cleanUrl)(file)),
|
|
7606
8046
|
recordGeneratorCandidates,
|
|
7607
8047
|
pruneViteCssCaches,
|
|
7608
8048
|
getViteCssCacheStats,
|
|
7609
8049
|
hmrTimingRecorder,
|
|
7610
|
-
cssPipelineStrategy: frameworkCssPipelineStrategy
|
|
8050
|
+
cssPipelineStrategy: frameworkCssPipelineStrategy,
|
|
8051
|
+
frameworkRootImportShellTargetByFile
|
|
8052
|
+
};
|
|
8053
|
+
const shouldSplitGenerateBundlePhases = () => opts.appType === "weapp-vite" && getResolvedConfig()?.mode !== "production";
|
|
8054
|
+
const preGenerateBundleHook = createGenerateBundleHook({
|
|
8055
|
+
...generateBundleContext,
|
|
8056
|
+
processMarkupAndScripts: false,
|
|
8057
|
+
shouldProcessBundle: shouldSplitGenerateBundlePhases
|
|
8058
|
+
});
|
|
8059
|
+
const generateBundleHook = createGenerateBundleHook({
|
|
8060
|
+
...generateBundleContext,
|
|
8061
|
+
shouldProcessStyles: () => !shouldSplitGenerateBundlePhases()
|
|
7611
8062
|
});
|
|
7612
8063
|
const cssFinalizerOutputPlugin = createViteCssFinalizerOutputPlugin({
|
|
7613
8064
|
opts,
|
|
@@ -7627,6 +8078,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7627
8078
|
getSourceCandidatesForEntries,
|
|
7628
8079
|
getSourceCandidateSourcesForEntries,
|
|
7629
8080
|
waitForSourceCandidateSyncs,
|
|
8081
|
+
frameworkRootImportShellTargetByFile,
|
|
7630
8082
|
rememberMainCssSource: (file, rawSource) => cssMemory.rememberCssSource({
|
|
7631
8083
|
outputFile: file,
|
|
7632
8084
|
rawSource,
|
|
@@ -7653,6 +8105,21 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7653
8105
|
styleHandler,
|
|
7654
8106
|
uniAppX
|
|
7655
8107
|
}) ?? [];
|
|
8108
|
+
const installFrameworkWatchCssCacheAdapter = async (config) => {
|
|
8109
|
+
if (!shouldAdaptFrameworkWatchCss()) return;
|
|
8110
|
+
if (wrapViteCssPostTransform(config, async (css, id) => {
|
|
8111
|
+
if (!require_source_candidate_scan_signature.isCSSRequest(id)) return css;
|
|
8112
|
+
if (require_hmr_timing.hasBundlerGeneratedCssMarker(css)) {
|
|
8113
|
+
debug("preserve adapted generated css before uni-app watch cache: %s", id);
|
|
8114
|
+
return css;
|
|
8115
|
+
}
|
|
8116
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
8117
|
+
const styleRequest = isSfcStyleSourceFile(file) ? resolveSfcStyleRequestFromKnownSource(file, cssMemory.getKnownSfcSource(file), css, id) : id;
|
|
8118
|
+
const transformedCss = (await styleHandler(css, transformCssHandlerOptions.getCssHandlerOptions(styleRequest))).css;
|
|
8119
|
+
debug("adapt css before uni-app watch cache: %s inputRaw=%s outputRaw=%s", id, css.includes("\\[") || css.includes("\\:"), transformedCss.includes("\\[") || transformedCss.includes("\\:"));
|
|
8120
|
+
return transformedCss;
|
|
8121
|
+
})) debug("adapt uni-app watch css before vite:css-post cache");
|
|
8122
|
+
};
|
|
7656
8123
|
const plugins = [
|
|
7657
8124
|
...rewritePlugins,
|
|
7658
8125
|
{
|
|
@@ -7662,6 +8129,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7662
8129
|
if (!shouldOwnTailwindGeneration || isWebOrNativeAppPlatform(resolveViteStylePlatform()) || !require_source_candidate_scan_signature.isCSSRequest(id) || !shouldCollectTransformedSourceCandidates(id)) return;
|
|
7663
8130
|
const rawCode = await (0, node_fs_promises.readFile)((0, _weapp_tailwindcss_shared.cleanUrl)(id), "utf8").catch(() => void 0);
|
|
7664
8131
|
if (typeof rawCode !== "string") return;
|
|
8132
|
+
rememberOriginalCssLayerSource(id, rawCode);
|
|
7665
8133
|
const transformedCode = transformEarlyMiniProgramCss(rawCode);
|
|
7666
8134
|
if (transformedCode === rawCode) return;
|
|
7667
8135
|
cssMemory.rememberKnownSfcSource(id, transformedCode);
|
|
@@ -7670,6 +8138,7 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7670
8138
|
transform: {
|
|
7671
8139
|
order: "pre",
|
|
7672
8140
|
async handler(code, id) {
|
|
8141
|
+
if (require_generator.hasUserCssLayerBlocks(code)) rememberOriginalCssLayerSource(id, code);
|
|
7673
8142
|
let transformedCode = code;
|
|
7674
8143
|
if (shouldOwnTailwindGeneration && !resolveCurrentGeneratorBranch().isWeb && require_source_candidate_scan_signature.isCSSRequest(id)) transformedCode = transformEarlyMiniProgramCss(code);
|
|
7675
8144
|
const shouldReturnTransformedCode = transformedCode !== code;
|
|
@@ -7718,24 +8187,25 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7718
8187
|
async handleHotUpdate(ctx) {
|
|
7719
8188
|
return hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
7720
8189
|
const isSourceCandidateHotUpdate = shouldOwnTailwindGeneration && require_hmr_timing.isSourceCandidateRequest(ctx.file);
|
|
7721
|
-
if (isSourceCandidateHotUpdate &&
|
|
8190
|
+
if (isSourceCandidateHotUpdate && require_hmr_timing.isSourceStyleRequest(ctx.file)) for (const mod of ctx.modules) {
|
|
7722
8191
|
if (mod.id) rememberTailwindRootCssModule(mod.id);
|
|
7723
8192
|
if (mod.url) rememberTailwindRootCssModule(mod.url);
|
|
7724
8193
|
if (mod.file) rememberTailwindRootCssModule(mod.file);
|
|
7725
8194
|
}
|
|
7726
8195
|
const canReadHotSource = typeof ctx.read === "function";
|
|
7727
8196
|
const hotSource = isSourceCandidateHotUpdate && canReadHotSource ? await ctx.read().catch(() => void 0) : void 0;
|
|
8197
|
+
if (typeof hotSource === "string" && require_source_candidate_scan_signature.isCSSRequest(ctx.file)) rememberOriginalCssLayerSource(ctx.file, hotSource);
|
|
7728
8198
|
const sourceCandidateChange = await syncChangedSourceCandidateFile(ctx.file, hotSource);
|
|
7729
8199
|
const isWebLikeHotUpdate = isCurrentWebLikeStylePlatform();
|
|
7730
8200
|
let canUseHmrCandidateAppend = false;
|
|
7731
8201
|
if (isSourceCandidateHotUpdate) {
|
|
7732
8202
|
invalidateRecordedGeneratorCandidates();
|
|
7733
8203
|
const preserveDeletedCssInHmr = resolveCurrentGeneratorOptions().hmr.preserveDeletedCss;
|
|
7734
|
-
canUseHmrCandidateAppend = preserveDeletedCssInHmr && !
|
|
8204
|
+
canUseHmrCandidateAppend = preserveDeletedCssInHmr && !require_hmr_timing.isSourceStyleRequest(ctx.file) && sourceCandidateChange !== void 0 && !sourceCandidateChange.runtimeAffecting;
|
|
7735
8205
|
if (!canUseHmrCandidateAppend) {
|
|
7736
8206
|
if (sourceCandidateChange === void 0) {
|
|
7737
8207
|
clearPendingHmrCandidateChange();
|
|
7738
|
-
if (!preserveDeletedCssInHmr && !
|
|
8208
|
+
if (!preserveDeletedCssInHmr && !require_hmr_timing.isSourceStyleRequest(ctx.file)) queueFullHmrCssRegeneration();
|
|
7739
8209
|
}
|
|
7740
8210
|
if (isWebLikeHotUpdate) {
|
|
7741
8211
|
await refreshRuntimeStateForAutoCssSources?.(true);
|
|
@@ -7745,22 +8215,22 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7745
8215
|
}
|
|
7746
8216
|
if (isSourceCandidateHotUpdate) await waitForSourceCandidateSyncs();
|
|
7747
8217
|
const cssModules = resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds);
|
|
7748
|
-
const sourceModules = isSourceCandidateHotUpdate && !
|
|
8218
|
+
const sourceModules = isSourceCandidateHotUpdate && !require_hmr_timing.isSourceStyleRequest(ctx.file) ? resolveHotSourceModules(ctx) : ctx.modules;
|
|
7749
8219
|
const hasHmrCandidateAppend = pendingHmrCandidateChange !== void 0 && !pendingHmrCandidateChange.runtimeAffecting && pendingHmrCandidateChange.addedCandidates.size > 0 || canUseHmrCandidateAppend && sourceCandidateChange !== void 0 && sourceCandidateChange.addedCandidates.size > 0;
|
|
7750
|
-
if (isSourceCandidateHotUpdate && !
|
|
8220
|
+
if (isSourceCandidateHotUpdate && !require_hmr_timing.isSourceStyleRequest(ctx.file) && !hasHmrCandidateAppend && !isWebLikeHotUpdate && (!hasSelfAcceptingNonStyleHotModule(sourceModules) && cssModules.length === 0 || cssModules.length > 0 && isUniViteProject())) {
|
|
7751
8221
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
7752
8222
|
return [];
|
|
7753
8223
|
}
|
|
7754
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
8224
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_hmr_timing.isSourceStyleRequest(ctx.file) && ctx.modules.some((mod) => isNuxtPageMacroHotModule(mod.id ?? mod.url))) {
|
|
7755
8225
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
7756
8226
|
return [];
|
|
7757
8227
|
}
|
|
7758
|
-
const shouldSendSupplementalCssHotUpdates = !(isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
8228
|
+
const shouldSendSupplementalCssHotUpdates = !(isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_hmr_timing.isSourceStyleRequest(ctx.file) && resolveCurrentGeneratorOptions().hmr.preserveDeletedCss && sourceCandidateChange !== void 0 && !sourceCandidateChange.runtimeAffecting && sourceCandidateChange.addedCandidates.size === 0 && sourceCandidateChange.removedCandidates.size > 0);
|
|
7759
8229
|
const supplementalCssFallbackIds = /* @__PURE__ */ new Set([...tailwindRootCssModuleIds, ...viteProcessedCssSourceFiles]);
|
|
7760
8230
|
if (hasHmrCandidateAppend) armPendingHmrCssTargetFiles(cssModules, supplementalCssFallbackIds);
|
|
7761
8231
|
if (shouldSendSupplementalCssHotUpdates) sendSupplementalCssHotUpdates(ctx, cssModules, supplementalCssFallbackIds);
|
|
7762
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !
|
|
7763
|
-
if (isSourceCandidateHotUpdate && !
|
|
8232
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_hmr_timing.isSourceStyleRequest(ctx.file)) return;
|
|
8233
|
+
if (isSourceCandidateHotUpdate && !require_hmr_timing.isSourceStyleRequest(ctx.file) && cssModules.length > 0) return [...sourceModules, ...cssModules];
|
|
7764
8234
|
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
7765
8235
|
}, { emit: false });
|
|
7766
8236
|
},
|
|
@@ -7768,13 +8238,15 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7768
8238
|
await hmrTimingRecorder.measure("sourceCandidates.buildStart", async () => {
|
|
7769
8239
|
await prepareTailwindGeneration();
|
|
7770
8240
|
}, { emit: false });
|
|
7771
|
-
}
|
|
8241
|
+
},
|
|
8242
|
+
generateBundle: preGenerateBundleHook
|
|
7772
8243
|
},
|
|
7773
|
-
...
|
|
8244
|
+
...createViteCssGenerationPlugins({
|
|
7774
8245
|
generateCss: generateTailwindCssForVitePipeline,
|
|
7775
8246
|
getCommand: () => resolvedConfig?.command,
|
|
7776
8247
|
onTailwindRootCss: registerTailwindRootCss,
|
|
7777
|
-
shouldGenerate: () => shouldOwnTailwindGeneration
|
|
8248
|
+
shouldGenerate: () => shouldOwnTailwindGeneration,
|
|
8249
|
+
shouldGenerateBuild: () => resolveCurrentGeneratorBranch().isWeb
|
|
7778
8250
|
}),
|
|
7779
8251
|
createViteServeJsTransformPlugin({
|
|
7780
8252
|
createHandlerOptions: (file) => serveJsHandlerOptions(file, frameworkCssPipelineStrategy?.getServeJsHandlerOptions?.({
|
|
@@ -7786,6 +8258,13 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7786
8258
|
shouldTransform: () => shouldOwnTailwindGeneration && (frameworkCssPipelineStrategy?.shouldTransformServeJs?.(createCssPipelineContext()) ?? !resolveCurrentGeneratorBranch().isWeb),
|
|
7787
8259
|
transformRuntime: ensureRuntimeClassSet
|
|
7788
8260
|
}),
|
|
8261
|
+
{
|
|
8262
|
+
name: `${require_context.vitePluginName}:watch-css-cache`,
|
|
8263
|
+
configResolved: {
|
|
8264
|
+
order: "post",
|
|
8265
|
+
handler: installFrameworkWatchCssCacheAdapter
|
|
8266
|
+
}
|
|
8267
|
+
},
|
|
7789
8268
|
{
|
|
7790
8269
|
name: `${require_context.vitePluginName}:post`,
|
|
7791
8270
|
enforce: "post",
|
|
@@ -7793,7 +8272,10 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7793
8272
|
if (!shouldOwnTailwindGeneration) return;
|
|
7794
8273
|
if (Array.isArray(config.plugins)) {
|
|
7795
8274
|
const removed = disableAndRemoveTailwindVitePlugins(config.plugins);
|
|
7796
|
-
if (removed > 0)
|
|
8275
|
+
if (removed > 0) {
|
|
8276
|
+
_weapp_tailwindcss_logger.logger.warn("检测到 @tailwindcss/vite,生成模式下已移除该插件以避免 Tailwind CSS 重复生成。");
|
|
8277
|
+
debug("disable official tailwind vite plugins in generator mode: %d", removed);
|
|
8278
|
+
}
|
|
7797
8279
|
}
|
|
7798
8280
|
const root = config.root ? node_path.default.resolve(config.root) : node_process.default.cwd();
|
|
7799
8281
|
const baseConfig = { resolve: { alias: [{
|
|
@@ -7847,7 +8329,10 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7847
8329
|
const postcssPlugins = config.css.postcss.plugins;
|
|
7848
8330
|
if (shouldOwnTailwindGeneration) {
|
|
7849
8331
|
const removed = (0, _weapp_tailwindcss_postcss.removeTailwindPostcssPlugins)(postcssPlugins);
|
|
7850
|
-
if (removed > 0)
|
|
8332
|
+
if (removed > 0) {
|
|
8333
|
+
_weapp_tailwindcss_logger.logger.warn("检测到 @tailwindcss/postcss,生成模式下已移除该插件以避免 Tailwind CSS 重复生成。");
|
|
8334
|
+
debug("remove official tailwind postcss plugins in generator mode: %d", removed);
|
|
8335
|
+
}
|
|
7851
8336
|
}
|
|
7852
8337
|
}
|
|
7853
8338
|
}, { emit: false });
|
|
@@ -7972,6 +8457,7 @@ const uniAppCssPipelineStrategy = {
|
|
|
7972
8457
|
function createUniAppVitePlugins(options = {}) {
|
|
7973
8458
|
return createViteFrameworkPlugins(options, {
|
|
7974
8459
|
frameworkName: "uni-app",
|
|
8460
|
+
adaptWatchCssBeforeFrameworkCache: true,
|
|
7975
8461
|
cssPipelineStrategy: uniAppCssPipelineStrategy,
|
|
7976
8462
|
styleInjectorDelegate: require_source_candidate_scan_signature.viteStyleInjectorDelegates.uniApp
|
|
7977
8463
|
});
|
|
@@ -8097,6 +8583,7 @@ const uniAppXCssPipelineStrategy = {
|
|
|
8097
8583
|
function createUniAppXVitePlugins(options = {}) {
|
|
8098
8584
|
return createViteFrameworkPlugins(options, {
|
|
8099
8585
|
frameworkName: "uni-app-x",
|
|
8586
|
+
adaptWatchCssBeforeFrameworkCache: true,
|
|
8100
8587
|
cssPipelineStrategy: uniAppXCssPipelineStrategy,
|
|
8101
8588
|
getExtraPluginPlatform: () => ({ isIosPlatform: require_generator.resolveUniUtsPlatform().isAppIos }),
|
|
8102
8589
|
styleInjectorDelegate: require_source_candidate_scan_signature.viteStyleInjectorDelegates.uniApp,
|