weapp-tailwindcss 5.2.5 → 5.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundlers/shared/final-css-cleanup.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +11 -4
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +8 -0
- package/dist/bundlers/vite/hot-css-modules.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +0 -1
- package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-tailwind-root-css.d.ts +19 -0
- package/dist/{gulp-Nhszi1kK.cjs → gulp-Bun9iCRE.cjs} +5 -5
- package/dist/{gulp-DSi73qr-.js → gulp-BydhuCbr.js} +4 -4
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-Cye_A4mI.cjs → hmr-timing-D607CWrq.cjs} +1 -1
- package/dist/{hmr-timing-WgN_3dIC.js → hmr-timing-Gs9P-QtZ.js} +120 -5
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/{pipeline-helpers-DMO0otI8.cjs → pipeline-helpers-BLpoT8fX.cjs} +2 -2
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{source-candidate-scan-signature-D4X_VprL.cjs → source-candidate-scan-signature-BGDNJE2r.cjs} +1 -1
- package/dist/{source-candidate-scan-signature-ZozKGBbH.js → source-candidate-scan-signature-CdjPWQqv.js} +1 -1
- package/dist/{v4-generation-core-CDI6ChiH.cjs → v4-generation-core-BrkM1vCs.cjs} +130 -3
- package/dist/{vite-Dafw4jK-.js → vite-DM-U-Ins.js} +129 -130
- package/dist/{vite-AB_sUPv9.cjs → vite-n0mRgEcF.cjs} +130 -131
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +2 -2
- package/dist/{webpack-B2ojv_HI.cjs → webpack-Bf8yJwTO.cjs} +4 -4
- package/dist/{webpack-Rx3u2_2x.js → webpack-BlUJf8Ru.js} +3 -3
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +1 -1
- package/dist/bundlers/vite/processed-css-assets/empty-at-rule.d.ts +0 -1
|
@@ -3,16 +3,16 @@ import { $ as hasTailwindSourceDirectives, B as stripMiniProgramCssSpecificityPl
|
|
|
3
3
|
import { t as omitUndefined } from "./object-Bvy6-w9r.js";
|
|
4
4
|
import { _ as resolveTailwindV4EntriesFromCssCached, a as findTailwindConfig, f as createSourceScanMatcher, h as resolveTailwindV4CssDependencies, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as resolveSourceScanEntries, r as isUniAppXEnabled } from "./tailwindcss-CTpCc_nd.js";
|
|
5
5
|
import "./utils-MVwpU07P.js";
|
|
6
|
-
import {
|
|
6
|
+
import { A as createCssSourceTraceCacheSignature, B as finalizeCompilerShadowRun, C as createBundlerGeneratedCssMarker, D as finalizeMiniProgramCssStructure, E as stripBundlerGeneratedCssMarkers, J as disposeCompilerOwner, K as updateRuntimeCompilationBuildState, L as isPureLocalCssImportWrapper, N as processCachedTask, O as hasEmptyAtRuleBlockCandidate, P as createRuntimeClassSetManager, S as stripRequestQuery, T as parseBundlerGeneratedCssMarkerBlocks, U as createRuntimeCompilationBuildState, V as buildRuntimeCompilationSnapshot, Y as beginCompilerShadowRun, Z as AssetEmissionPlan, a as extractMarkedUserLayerComponentsCss, at as extractCandidatesFromSource, d as normalizeMiniProgramGeneratorCssSource, et as recordCompilationDependencyChanges, f as normalizeMiniProgramImportShell, h as captureFrameworkPostcssOptions, i as validateCandidatesByGenerator, it as isSourceCandidateRequest, j as createCssTokenSourceMap, k as annotateCssSourceTrace, nt as createSourceCandidateCollector, o as mergeMarkedUserLayerComponentsCss, p as scoreTailwindV4CssSourceFileMatch, q as createRuntimeAffectingSourceSignature, r as generateTailwindV4Css, t as createHmrTimingRecorder, tt as createCompilationDependencyChanges, u as runWithConcurrency, w as hasBundlerGeneratedCssMarker, x as isSourceStyleRequest } from "./hmr-timing-Gs9P-QtZ.js";
|
|
7
7
|
import { h as createDebug, m as replaceWxml } from "./wxml-IBzZSaQC.js";
|
|
8
8
|
import { a as vitePluginName, c as collectRuntimeClassSet, d as refreshTailwindRuntimeState, f as normalizeFrameworkStylePlatform, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, s as toCustomAttributesEntities, t as getCompilerContext } from "./context-YAvTyPV2.js";
|
|
9
|
-
import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-
|
|
9
|
+
import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-CdjPWQqv.js";
|
|
10
10
|
import { t as logger$1 } from "./logger-BNzxZbZj.js";
|
|
11
11
|
import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
13
13
|
import process$1 from "node:process";
|
|
14
14
|
import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
15
|
-
import { collectCssImportRequestsRoot, compileCssMacroConditionalComments, containsCssAfterMinify, filterExistingCssRules, isMiniProgramLocalCssImportRequest, mergeCoveredCssRuleDeclarations, mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations, normalizeTailwindcssV4InfinityCalcCss, parseTailwindCssDirectiveRequest, postcss,
|
|
15
|
+
import { collectCssImportRequestsRoot, compileCssMacroConditionalComments, containsCssAfterMinify, filterExistingCssRules, isMiniProgramLocalCssImportRequest, mergeCoveredCssRuleDeclarations, mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations, normalizeTailwindcssV4InfinityCalcCss, parseTailwindCssDirectiveRequest, postcss, removeTailwindPostcssPlugins, removeTailwindSourceDirectivesRoot, removeUnsupportedMiniProgramCssImportsRoot, resolvePostcssConfig, transformWebCssCompat, transformWebCssSafeSelectors, unwrapUnsupportedCascadeLayers } from "@weapp-tailwindcss/postcss";
|
|
16
16
|
import { LRUCache } from "lru-cache";
|
|
17
17
|
import { readFile } from "node:fs/promises";
|
|
18
18
|
import micromatch from "micromatch";
|
|
@@ -1331,86 +1331,6 @@ const mix = (del = delimiter) => {
|
|
|
1331
1331
|
const posix = /* @__PURE__ */ mix(":");
|
|
1332
1332
|
const win32 = /* @__PURE__ */ mix(";");
|
|
1333
1333
|
//#endregion
|
|
1334
|
-
//#region src/bundlers/vite/processed-css-assets/empty-at-rule.ts
|
|
1335
|
-
function isAtRuleNameCharacter(code) {
|
|
1336
|
-
return code === 45 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
|
|
1337
|
-
}
|
|
1338
|
-
function isCssWhitespace(code) {
|
|
1339
|
-
return code === 9 || code === 10 || code === 12 || code === 13 || code === 32;
|
|
1340
|
-
}
|
|
1341
|
-
function findAtRuleBlockStart(css, start) {
|
|
1342
|
-
let parenthesisDepth = 0;
|
|
1343
|
-
let quote = 0;
|
|
1344
|
-
let squareBracketDepth = 0;
|
|
1345
|
-
for (let index = start; index < css.length; index++) {
|
|
1346
|
-
const code = css.charCodeAt(index);
|
|
1347
|
-
if (quote !== 0) {
|
|
1348
|
-
if (code === 92) index++;
|
|
1349
|
-
else if (code === quote) quote = 0;
|
|
1350
|
-
continue;
|
|
1351
|
-
}
|
|
1352
|
-
if (code === 34 || code === 39) {
|
|
1353
|
-
quote = code;
|
|
1354
|
-
continue;
|
|
1355
|
-
}
|
|
1356
|
-
if (code === 92) {
|
|
1357
|
-
index++;
|
|
1358
|
-
continue;
|
|
1359
|
-
}
|
|
1360
|
-
if (code === 47 && css.charCodeAt(index + 1) === 42) {
|
|
1361
|
-
const commentEnd = css.indexOf("*/", index + 2);
|
|
1362
|
-
if (commentEnd < 0) return -1;
|
|
1363
|
-
index = commentEnd + 1;
|
|
1364
|
-
continue;
|
|
1365
|
-
}
|
|
1366
|
-
if (code === 40) {
|
|
1367
|
-
parenthesisDepth++;
|
|
1368
|
-
continue;
|
|
1369
|
-
}
|
|
1370
|
-
if (code === 41 && parenthesisDepth > 0) {
|
|
1371
|
-
parenthesisDepth--;
|
|
1372
|
-
continue;
|
|
1373
|
-
}
|
|
1374
|
-
if (code === 91) {
|
|
1375
|
-
squareBracketDepth++;
|
|
1376
|
-
continue;
|
|
1377
|
-
}
|
|
1378
|
-
if (code === 93 && squareBracketDepth > 0) {
|
|
1379
|
-
squareBracketDepth--;
|
|
1380
|
-
continue;
|
|
1381
|
-
}
|
|
1382
|
-
if (code === 123 && parenthesisDepth === 0 && squareBracketDepth === 0) return index;
|
|
1383
|
-
if ((code === 59 || code === 125) && parenthesisDepth === 0 && squareBracketDepth === 0) return -1;
|
|
1384
|
-
}
|
|
1385
|
-
return -1;
|
|
1386
|
-
}
|
|
1387
|
-
function isEmptyAtRuleBody(css, blockStart) {
|
|
1388
|
-
for (let index = blockStart + 1; index < css.length; index++) {
|
|
1389
|
-
const code = css.charCodeAt(index);
|
|
1390
|
-
if (isCssWhitespace(code)) continue;
|
|
1391
|
-
if (code === 47 && css.charCodeAt(index + 1) === 42) {
|
|
1392
|
-
const commentEnd = css.indexOf("*/", index + 2);
|
|
1393
|
-
if (commentEnd < 0) return false;
|
|
1394
|
-
index = commentEnd + 1;
|
|
1395
|
-
continue;
|
|
1396
|
-
}
|
|
1397
|
-
return code === 125;
|
|
1398
|
-
}
|
|
1399
|
-
return false;
|
|
1400
|
-
}
|
|
1401
|
-
function hasEmptyAtRuleBlockCandidate(css) {
|
|
1402
|
-
let searchFrom = 0;
|
|
1403
|
-
while (searchFrom < css.length) {
|
|
1404
|
-
const atRuleStart = css.indexOf("@", searchFrom);
|
|
1405
|
-
if (atRuleStart < 0) return false;
|
|
1406
|
-
searchFrom = atRuleStart + 1;
|
|
1407
|
-
if (!isAtRuleNameCharacter(css.charCodeAt(searchFrom))) continue;
|
|
1408
|
-
const blockStart = findAtRuleBlockStart(css, searchFrom + 1);
|
|
1409
|
-
if (blockStart >= 0 && isEmptyAtRuleBody(css, blockStart)) return true;
|
|
1410
|
-
}
|
|
1411
|
-
return false;
|
|
1412
|
-
}
|
|
1413
|
-
//#endregion
|
|
1414
1334
|
//#region src/bundlers/vite/processed-css-assets/style-files.ts
|
|
1415
1335
|
const CSS_OUTPUT_FILE_RE = /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
1416
1336
|
function isCssOutputFile(file) {
|
|
@@ -1701,21 +1621,6 @@ function removeCommentOnlyAtRules(css) {
|
|
|
1701
1621
|
return css;
|
|
1702
1622
|
}
|
|
1703
1623
|
}
|
|
1704
|
-
function removeEmptyCssAtRules(css) {
|
|
1705
|
-
if (!hasEmptyAtRuleBlockCandidate(css)) return css;
|
|
1706
|
-
try {
|
|
1707
|
-
const root = postcss.parse(css);
|
|
1708
|
-
let removed = 0;
|
|
1709
|
-
let passRemoved = 0;
|
|
1710
|
-
do {
|
|
1711
|
-
passRemoved = removeEmptyAtRules(root);
|
|
1712
|
-
removed += passRemoved;
|
|
1713
|
-
} while (passRemoved > 0);
|
|
1714
|
-
return removed > 0 ? root.toString() : css;
|
|
1715
|
-
} catch {
|
|
1716
|
-
return css;
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
1624
|
function collectImportedBundleCssSources(bundle, importedStyleFiles) {
|
|
1720
1625
|
if (importedStyleFiles.size === 0) return [];
|
|
1721
1626
|
const importedFileNames = new Set([...importedStyleFiles].map((file) => posix.posix.basename(file)));
|
|
@@ -3036,7 +2941,10 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
3036
2941
|
const singleMarkerFile = collectSingleViteGeneratedCssMarkerFile(rawSource);
|
|
3037
2942
|
if (singleMarkerFile && (options.subpackageRoots == null || !isSubpackageOutputFile(file, options.subpackageRoots)) && shouldFilterRootGeneratedCssMarkerForScopedAsset(file, singleMarkerFile, options.resolveViteProcessedCssOutputFile)) nextCss = removeCssCoveredByRootStyleBundleSources(bundle, file, nextCss);
|
|
3038
2943
|
nextCss = options.transformCss?.(nextCss, file) ?? nextCss;
|
|
3039
|
-
if (nextCss !== rawSource)
|
|
2944
|
+
if (nextCss !== rawSource) {
|
|
2945
|
+
output.source = nextCss;
|
|
2946
|
+
options.onAssetWrite?.(file);
|
|
2947
|
+
}
|
|
3040
2948
|
options.markCssAssetProcessed?.(output, file);
|
|
3041
2949
|
options.recordCssAssetResult?.(file, nextCss);
|
|
3042
2950
|
const resolvedOutputFile = resolveViteGeneratedCssMarkerOutputFile(file, singleMarkerFile, existingAssetFiles, options.resolveViteProcessedCssOutputFile);
|
|
@@ -3049,6 +2957,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
3049
2957
|
const targetNextCss = appendCss$1(targetRawSource, filterExistingCssRules(targetRawSource, nextCss).trim());
|
|
3050
2958
|
if (targetNextCss !== targetRawSource) {
|
|
3051
2959
|
targetAsset.source = targetNextCss;
|
|
2960
|
+
options.onAssetWrite?.(resolvedOutputFile);
|
|
3052
2961
|
options.markCssAssetProcessed?.(targetAsset, resolvedOutputFile);
|
|
3053
2962
|
options.recordCssAssetResult?.(resolvedOutputFile, targetNextCss);
|
|
3054
2963
|
}
|
|
@@ -4823,9 +4732,10 @@ function resolveViteCssTransformCachePlan(options) {
|
|
|
4823
4732
|
const cssRuntimeSignature = createCssRuntimeSignature(options.runtimeSignature, options.scopedGeneratorCandidateSignature);
|
|
4824
4733
|
const rememberedCssRuntimeSignature = createRememberedCssRuntimeSignature(cssRuntimeSignature, options.cssRuntimeAffectingHash);
|
|
4825
4734
|
const tailwindcssMajorVersion = options.tailwindcssMajorVersion ?? "unknown";
|
|
4735
|
+
const cssCacheKey = `${options.outputFile}:css:${cssRuntimeSignature}:${tailwindcssMajorVersion}`;
|
|
4826
4736
|
return {
|
|
4827
|
-
cssCacheKey
|
|
4828
|
-
cssHashKey:
|
|
4737
|
+
cssCacheKey,
|
|
4738
|
+
cssHashKey: cssCacheKey,
|
|
4829
4739
|
cssRuntimeSignature,
|
|
4830
4740
|
cssSharedCacheKey: [
|
|
4831
4741
|
options.cssShareScope,
|
|
@@ -4962,6 +4872,31 @@ function readAssetSource$1(output) {
|
|
|
4962
4872
|
function shouldFinalizeMiniProgramCssAsset(source) {
|
|
4963
4873
|
return source.includes(":hover") || source.includes("does-not-exist") || hasMiniProgramCssSpecificityPlaceholders(source);
|
|
4964
4874
|
}
|
|
4875
|
+
function finalizeMiniProgramCssAssetStructures(bundle, options) {
|
|
4876
|
+
if (options.isWebGeneratorTarget) return 0;
|
|
4877
|
+
const plan = new AssetEmissionPlan();
|
|
4878
|
+
const writeTargets = /* @__PURE__ */ new Map();
|
|
4879
|
+
let updated = 0;
|
|
4880
|
+
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
4881
|
+
if (output.type !== "asset") continue;
|
|
4882
|
+
const file = output.fileName || bundleFile;
|
|
4883
|
+
if (!options.cssMatcher(file) || options.files && !options.files.has(file)) continue;
|
|
4884
|
+
const rawSource = readAssetSource$1(output);
|
|
4885
|
+
const outputCss = finalizeMiniProgramCssStructure(rawSource);
|
|
4886
|
+
if (outputCss === rawSource) continue;
|
|
4887
|
+
plan.write(file, outputCss);
|
|
4888
|
+
writeTargets.set(file, output);
|
|
4889
|
+
options.recordCssAssetResult?.(file, outputCss);
|
|
4890
|
+
options.onUpdate(file, rawSource, outputCss);
|
|
4891
|
+
options.debug?.("remove final empty mini-program css at-rules: %s bytes=%d", file, outputCss.length);
|
|
4892
|
+
updated++;
|
|
4893
|
+
}
|
|
4894
|
+
applyViteAssetEmissionPlan(plan, {
|
|
4895
|
+
bundle,
|
|
4896
|
+
writeTargets
|
|
4897
|
+
});
|
|
4898
|
+
return updated;
|
|
4899
|
+
}
|
|
4965
4900
|
async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
4966
4901
|
if (options.isWebGeneratorTarget) return 0;
|
|
4967
4902
|
const plan = new AssetEmissionPlan();
|
|
@@ -4974,7 +4909,7 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
4974
4909
|
const rawSource = readAssetSource$1(output);
|
|
4975
4910
|
if (rawSource.trim().length === 0) continue;
|
|
4976
4911
|
if (options.lastCssResultByFile?.has(file)) {
|
|
4977
|
-
const outputCss = stripMiniProgramCssSpecificityPlaceholders(
|
|
4912
|
+
const outputCss = stripMiniProgramCssSpecificityPlaceholders(finalizeMiniProgramCssStructure(rawSource));
|
|
4978
4913
|
if (outputCss !== rawSource) {
|
|
4979
4914
|
plan.write(file, outputCss);
|
|
4980
4915
|
writeTargets.set(file, output);
|
|
@@ -4986,7 +4921,7 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
4986
4921
|
continue;
|
|
4987
4922
|
}
|
|
4988
4923
|
if (!shouldFinalizeMiniProgramCssAsset(rawSource)) {
|
|
4989
|
-
const structurallyCleanSource =
|
|
4924
|
+
const structurallyCleanSource = finalizeMiniProgramCssStructure(rawSource);
|
|
4990
4925
|
if (structurallyCleanSource !== rawSource) {
|
|
4991
4926
|
plan.write(file, structurallyCleanSource);
|
|
4992
4927
|
writeTargets.set(file, output);
|
|
@@ -5008,7 +4943,7 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
5008
4943
|
},
|
|
5009
4944
|
cssPresetEnv: {}
|
|
5010
4945
|
});
|
|
5011
|
-
const outputCss = stripMiniProgramCssSpecificityPlaceholders(
|
|
4946
|
+
const outputCss = stripMiniProgramCssSpecificityPlaceholders(finalizeMiniProgramCssStructure(css));
|
|
5012
4947
|
if (outputCss === rawSource) continue;
|
|
5013
4948
|
plan.write(file, outputCss);
|
|
5014
4949
|
writeTargets.set(file, output);
|
|
@@ -5751,6 +5686,7 @@ function createUniAppXHarmonyApplyExpander(options) {
|
|
|
5751
5686
|
function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
5752
5687
|
const modules = [];
|
|
5753
5688
|
const seenModules = /* @__PURE__ */ new Set();
|
|
5689
|
+
const seenModuleIds = /* @__PURE__ */ new Set();
|
|
5754
5690
|
const root = ctx.server.config?.root ?? process$1.cwd();
|
|
5755
5691
|
const outDir = ctx.server.config?.build?.outDir ? normalizeAbsoluteFilePath(path.resolve(root, ctx.server.config.build.outDir)) : void 0;
|
|
5756
5692
|
const isHotSourceStyleModule = (id) => {
|
|
@@ -5772,13 +5708,13 @@ function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
|
5772
5708
|
modules.push(mod);
|
|
5773
5709
|
};
|
|
5774
5710
|
for (const id of tailwindRootCssModuleIds) {
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
...ctx.server.moduleGraph.getModulesByFile(
|
|
5780
|
-
|
|
5781
|
-
|
|
5711
|
+
if (typeof id !== "string" || id.length === 0) continue;
|
|
5712
|
+
for (const moduleId of [id, cleanUrl(id)]) {
|
|
5713
|
+
if (moduleId.length === 0 || seenModuleIds.has(moduleId)) continue;
|
|
5714
|
+
seenModuleIds.add(moduleId);
|
|
5715
|
+
const candidates = [ctx.server.moduleGraph.getModuleById(moduleId), ...ctx.server.moduleGraph.getModulesByFile(moduleId) ?? []];
|
|
5716
|
+
for (const mod of candidates) collectModule(mod);
|
|
5717
|
+
}
|
|
5782
5718
|
}
|
|
5783
5719
|
return modules;
|
|
5784
5720
|
}
|
|
@@ -7797,11 +7733,16 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7797
7733
|
const rootDir = resolvedConfig?.root ? path.resolve(resolvedConfig.root) : process$1.cwd();
|
|
7798
7734
|
const outDir = resolvedConfig?.build?.outDir ? path.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
7799
7735
|
const sourceRoot = resolveWeappViteSourceRoot(resolvedConfig, opts.appType) ?? resolveSourceRootFromBundleGraph(resolvedConfig, bundle);
|
|
7736
|
+
const finalCssAssetFiles = /* @__PURE__ */ new Set();
|
|
7737
|
+
const trackFinalCssAssetUpdate = (file, original, generated) => {
|
|
7738
|
+
finalCssAssetFiles.add(file);
|
|
7739
|
+
opts.onUpdate(file, original, generated);
|
|
7740
|
+
};
|
|
7800
7741
|
restoreFrameworkRootMiniProgramImportShellAssets(bundle, {
|
|
7801
7742
|
debug,
|
|
7802
7743
|
isWebGeneratorTarget,
|
|
7803
7744
|
matchesCss: opts.cssMatcher,
|
|
7804
|
-
onUpdate:
|
|
7745
|
+
onUpdate: trackFinalCssAssetUpdate,
|
|
7805
7746
|
recordCssAssetResult,
|
|
7806
7747
|
shouldKeep: (file, css) => cssPipelineStrategy?.shouldKeepRootMiniProgramStyleAsImportShell?.({
|
|
7807
7748
|
...createCssPipelineContext(file),
|
|
@@ -7824,6 +7765,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7824
7765
|
markCssAssetProcessed,
|
|
7825
7766
|
recordCssAssetResult,
|
|
7826
7767
|
recordViteProcessedCssAssetResult,
|
|
7768
|
+
onAssetWrite: (file) => finalCssAssetFiles.add(file),
|
|
7827
7769
|
resolveViteProcessedCssOutputFile: (file) => resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget, isNativeAppStyleTarget, sourceRoot, resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) }), Object.keys(bundle)),
|
|
7828
7770
|
transformCss: (css, file) => finalizeWebCss(css, {
|
|
7829
7771
|
...createCssPipelineContext(file),
|
|
@@ -7845,7 +7787,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7845
7787
|
file
|
|
7846
7788
|
}, cssPipelineStrategy),
|
|
7847
7789
|
debug,
|
|
7848
|
-
onUpdate:
|
|
7790
|
+
onUpdate: trackFinalCssAssetUpdate
|
|
7849
7791
|
});
|
|
7850
7792
|
};
|
|
7851
7793
|
collectViteProcessedCssAssets();
|
|
@@ -7898,6 +7840,14 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7898
7840
|
cssMatcher: opts.cssMatcher,
|
|
7899
7841
|
debug,
|
|
7900
7842
|
enabled: cssPipelineStrategy?.shouldNormalizeRootMiniProgramImportShell?.(createCssPipelineContext("")) === true,
|
|
7843
|
+
onUpdate: trackFinalCssAssetUpdate,
|
|
7844
|
+
recordCssAssetResult
|
|
7845
|
+
});
|
|
7846
|
+
finalizeMiniProgramCssAssetStructures(bundle, {
|
|
7847
|
+
cssMatcher: opts.cssMatcher,
|
|
7848
|
+
debug,
|
|
7849
|
+
files: finalCssAssetFiles,
|
|
7850
|
+
isWebGeneratorTarget,
|
|
7901
7851
|
onUpdate: opts.onUpdate,
|
|
7902
7852
|
recordCssAssetResult
|
|
7903
7853
|
});
|
|
@@ -7913,6 +7863,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
7913
7863
|
const writeTargets = /* @__PURE__ */ new Map();
|
|
7914
7864
|
const writeCssAsset = (file, output, source) => {
|
|
7915
7865
|
emissionPlan.write(file, source);
|
|
7866
|
+
finalCssAssetFiles.add(file);
|
|
7916
7867
|
writeTargets.set(file, output);
|
|
7917
7868
|
};
|
|
7918
7869
|
await Promise.all(entries.map(async ([bundleFile, output]) => {
|
|
@@ -8017,6 +7968,14 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
8017
7968
|
cssMatcher: opts.cssMatcher,
|
|
8018
7969
|
debug,
|
|
8019
7970
|
enabled: cssPipelineStrategy?.shouldNormalizeRootMiniProgramImportShell?.(createCssPipelineContext("")) === true,
|
|
7971
|
+
onUpdate: trackFinalCssAssetUpdate,
|
|
7972
|
+
recordCssAssetResult
|
|
7973
|
+
});
|
|
7974
|
+
finalizeMiniProgramCssAssetStructures(bundle, {
|
|
7975
|
+
cssMatcher: opts.cssMatcher,
|
|
7976
|
+
debug,
|
|
7977
|
+
files: finalCssAssetFiles,
|
|
7978
|
+
isWebGeneratorTarget,
|
|
8020
7979
|
onUpdate: opts.onUpdate,
|
|
8021
7980
|
recordCssAssetResult
|
|
8022
7981
|
});
|
|
@@ -9074,20 +9033,30 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9074
9033
|
options.hmrCandidateState.apply(options.hmrCandidateState.createChange(file, sourceCandidateChange, { runtimeAffecting: options.sourceScanSession.isDependency(file) }));
|
|
9075
9034
|
return;
|
|
9076
9035
|
}
|
|
9077
|
-
|
|
9036
|
+
const changedSource = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(id) && isCSSRequest(id) ? await readFile(cleanUrl(id), "utf8").catch(() => void 0) : void 0;
|
|
9037
|
+
if (typeof changedSource === "string") {
|
|
9038
|
+
options.rememberOriginalCssLayerSource(id, changedSource);
|
|
9039
|
+
await options.refreshTailwindRootCssSource(id, changedSource);
|
|
9040
|
+
}
|
|
9041
|
+
await options.sourceScanSession.syncChangedFile(id, changedSource);
|
|
9078
9042
|
}, { emit: false });
|
|
9079
9043
|
},
|
|
9080
9044
|
async handleHotUpdate(ctx) {
|
|
9081
9045
|
recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl(ctx.file))]));
|
|
9082
9046
|
return options.hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
9083
9047
|
const isSourceCandidateHotUpdate = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(ctx.file);
|
|
9084
|
-
if (isSourceCandidateHotUpdate && isSourceStyleRequest(ctx.file))
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9048
|
+
if (isSourceCandidateHotUpdate && isSourceStyleRequest(ctx.file)) {
|
|
9049
|
+
for (const mod of ctx.modules) for (const id of [
|
|
9050
|
+
mod.id,
|
|
9051
|
+
mod.url,
|
|
9052
|
+
mod.file
|
|
9053
|
+
]) if (typeof id === "string" && id.length > 0) options.rememberTailwindRootCssModule(id);
|
|
9088
9054
|
}
|
|
9089
9055
|
const hotSource = isSourceCandidateHotUpdate && typeof ctx.read === "function" ? await ctx.read().catch(() => void 0) : void 0;
|
|
9090
|
-
if (typeof hotSource === "string" && isCSSRequest(ctx.file))
|
|
9056
|
+
if (typeof hotSource === "string" && isCSSRequest(ctx.file)) {
|
|
9057
|
+
options.rememberOriginalCssLayerSource(ctx.file, hotSource);
|
|
9058
|
+
await options.refreshTailwindRootCssSource(ctx.file, hotSource);
|
|
9059
|
+
}
|
|
9091
9060
|
const sourceCandidateChange = await options.sourceScanSession.syncChangedFile(ctx.file, hotSource);
|
|
9092
9061
|
const isWebLikeHotUpdate = options.isCurrentWebLikeStylePlatform();
|
|
9093
9062
|
let canUseHmrCandidateAppend = false;
|
|
@@ -9295,6 +9264,39 @@ function createFrameworkSourceScanSession(options) {
|
|
|
9295
9264
|
};
|
|
9296
9265
|
}
|
|
9297
9266
|
//#endregion
|
|
9267
|
+
//#region src/bundlers/vite/shared/framework-tailwind-root-css.ts
|
|
9268
|
+
function createFrameworkTailwindRootCss(options) {
|
|
9269
|
+
const hotSourceByFile = /* @__PURE__ */ new Map();
|
|
9270
|
+
const moduleIds = /* @__PURE__ */ new Set();
|
|
9271
|
+
const normalizeSourceFile = (id) => path.normalize(path.resolve(cleanUrl(id)));
|
|
9272
|
+
const rememberModule = (id) => {
|
|
9273
|
+
if (!options.shouldOwnTailwindGeneration || typeof id !== "string" || id.length === 0) return;
|
|
9274
|
+
moduleIds.add(id);
|
|
9275
|
+
const cleanId = cleanUrl(id);
|
|
9276
|
+
if (isSourceStyleRequest(cleanId)) moduleIds.add(cleanId);
|
|
9277
|
+
};
|
|
9278
|
+
const register = async (id, code) => {
|
|
9279
|
+
rememberModule(id);
|
|
9280
|
+
const hotSource = hotSourceByFile.get(normalizeSourceFile(id));
|
|
9281
|
+
await options.registerAutoCssSource(id, hotSource ?? code);
|
|
9282
|
+
};
|
|
9283
|
+
const refreshSource = async (id, code) => {
|
|
9284
|
+
const file = cleanUrl(id);
|
|
9285
|
+
if (!moduleIds.has(id) && !moduleIds.has(file) && !hasTailwindRootDirectives(code, { importFallback: options.getImportFallback() })) return;
|
|
9286
|
+
hotSourceByFile.set(normalizeSourceFile(id), code);
|
|
9287
|
+
await register(id, code);
|
|
9288
|
+
options.sourceScanSession.invalidate();
|
|
9289
|
+
await options.refreshRuntimeState(true);
|
|
9290
|
+
await options.sourceScanSession.sync({ force: true });
|
|
9291
|
+
};
|
|
9292
|
+
return {
|
|
9293
|
+
refreshSource,
|
|
9294
|
+
register,
|
|
9295
|
+
rememberModule,
|
|
9296
|
+
moduleIds
|
|
9297
|
+
};
|
|
9298
|
+
}
|
|
9299
|
+
//#endregion
|
|
9298
9300
|
//#region src/bundlers/vite/shared/create-framework-plugins-runtime.ts
|
|
9299
9301
|
const debug = createDebug();
|
|
9300
9302
|
const weappTailwindcssPackageDir = resolvePackageDir("weapp-tailwindcss");
|
|
@@ -9519,7 +9521,6 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
9519
9521
|
debug,
|
|
9520
9522
|
getSourceCandidateSource: (file) => sourceCandidateCollector.source(file)
|
|
9521
9523
|
});
|
|
9522
|
-
const tailwindRootCssModuleIds = /* @__PURE__ */ new Set();
|
|
9523
9524
|
const { runtimeState, refreshRuntimeState, ensureRuntimeClassSet, ensureBundleRuntimeClassSet } = createViteRuntimeClassSet({
|
|
9524
9525
|
opts,
|
|
9525
9526
|
initialTailwindRuntime,
|
|
@@ -9590,6 +9591,13 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
9590
9591
|
shouldOwnTailwindGeneration,
|
|
9591
9592
|
sourceCandidateCollector
|
|
9592
9593
|
});
|
|
9594
|
+
const { moduleIds: tailwindRootCssModuleIds, refreshSource: refreshTailwindRootCssSource, register: registerTailwindRootCss, rememberModule: rememberTailwindRootCssModule } = createFrameworkTailwindRootCss({
|
|
9595
|
+
getImportFallback: () => resolveCurrentGeneratorOptions().importFallback,
|
|
9596
|
+
refreshRuntimeState,
|
|
9597
|
+
registerAutoCssSource,
|
|
9598
|
+
shouldOwnTailwindGeneration,
|
|
9599
|
+
sourceScanSession
|
|
9600
|
+
});
|
|
9593
9601
|
const recordCssAssetResult = (file, css) => {
|
|
9594
9602
|
touchMapEntry(cleanGeneratedCssByFile, normalizeVitePersistentCacheKey(file), css);
|
|
9595
9603
|
};
|
|
@@ -9616,16 +9624,6 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
9616
9624
|
};
|
|
9617
9625
|
const normalizeViteProcessedCssFile = (file) => path.resolve(cleanUrl(file));
|
|
9618
9626
|
const markViteProcessedCssSource = processedCssRegistry.markSource;
|
|
9619
|
-
const rememberTailwindRootCssModule = (id) => {
|
|
9620
|
-
if (!shouldOwnTailwindGeneration) return;
|
|
9621
|
-
tailwindRootCssModuleIds.add(id);
|
|
9622
|
-
const cleanId = cleanUrl(id);
|
|
9623
|
-
if (isSourceStyleRequest(cleanId)) tailwindRootCssModuleIds.add(cleanId);
|
|
9624
|
-
};
|
|
9625
|
-
const registerTailwindRootCss = async (id, code) => {
|
|
9626
|
-
rememberTailwindRootCssModule(id);
|
|
9627
|
-
await registerAutoCssSource(id, code);
|
|
9628
|
-
};
|
|
9629
9627
|
const isUniViteProject = () => {
|
|
9630
9628
|
return resolvedConfig?.plugins?.some((plugin) => plugin.name.includes("uni")) ?? false;
|
|
9631
9629
|
};
|
|
@@ -9967,6 +9965,7 @@ ${tracedCss}`;
|
|
|
9967
9965
|
prepareTailwindGeneration,
|
|
9968
9966
|
preGenerateBundleHook,
|
|
9969
9967
|
refreshRuntimeStateForAutoCssSources,
|
|
9968
|
+
refreshTailwindRootCssSource,
|
|
9970
9969
|
rememberOriginalCssLayerSource,
|
|
9971
9970
|
rememberTailwindRootCssModule,
|
|
9972
9971
|
resolveCurrentGeneratorBranch,
|