weapp-tailwindcss 5.1.11 → 5.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache-options-DavPxrhC.js +16 -0
- package/dist/cache-options-DwBtLwQe.mjs +5 -0
- package/dist/cli.js +10 -6
- package/dist/cli.mjs +10 -6
- package/dist/context-DRRgW7i2.js +1311 -0
- package/dist/context-xSJE588m.mjs +1234 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +119 -5
- package/dist/defaults.mjs +114 -1
- package/dist/{generator-ROzBodj6.mjs → generator-BvPcmqxU.mjs} +9 -139
- package/dist/{generator-Bz94KTkH.js → generator-CS10c9g1.js} +18 -154
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/{gulp-BKqMb_Ds.mjs → gulp-BEOzXrbp.mjs} +5 -4
- package/dist/{gulp-DfOLvYLs.js → gulp-DNZZvUMq.js} +6 -5
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DOTdH18A.js → hmr-timing-DW1g3zjl.js} +17 -15
- package/dist/{hmr-timing-DwtYJdwb.mjs → hmr-timing-hRhRAjYV.mjs} +5 -3
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/object-BJSWl-E5.mjs +9 -0
- package/dist/object-COs_Mw6p.js +14 -0
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/presets.js +5 -5
- package/dist/presets.mjs +3 -3
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/{source-candidate-scan-signature-BrWuBTjY.js → source-candidate-scan-signature-CMgu5bJk.js} +6 -6
- package/dist/{source-candidate-scan-signature-CQ04hiox.mjs → source-candidate-scan-signature-t4XKAQ04.mjs} +3 -3
- package/dist/{tailwindcss-hzy_WaC9.mjs → tailwindcss-DZT_pWrd.mjs} +132 -2
- package/dist/{tailwindcss-Dn5DVlkI.js → tailwindcss-z9JMF-qU.js} +140 -10
- package/dist/{transform-DZQETx51.js → transform-COFRlmDF.js} +13 -13
- package/dist/{transform-BgnNYkIG.mjs → transform-D5JUgMpE.mjs} +1 -1
- package/dist/{utils-D3h8j7Mk.js → utils-CuKLf1Zv.js} +0 -15
- package/dist/{utils-DodxWHGz.mjs → utils-MVwpU07P.mjs} +1 -8
- package/dist/{vite-DODC15Fr.js → vite-DnkObu2L.js} +60 -45
- package/dist/{vite-oI2ReOic.mjs → vite-Tpgi77vE.mjs} +45 -30
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +6 -2
- package/dist/{webpack-CCapGlNg.mjs → webpack-CTYm19zA.mjs} +22 -16
- package/dist/{webpack-XxBCIrBp.js → webpack-CzXjfvYS.js} +28 -22
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/dist/{context-y2BGCok4.js → wxml-Ce10eREX.js} +37 -1286
- package/dist/{context-DzkSFEVL.mjs → wxml-DdGdeqaH.mjs} +13 -1235
- package/package.json +2 -2
- package/dist/defaults-9B6aMyZb.mjs +0 -118
- package/dist/defaults-nsf4VNMX.js +0 -154
|
@@ -1,11 +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-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
3
|
+
const require_generator = require("./generator-CS10c9g1.js");
|
|
4
|
+
const require_object = require("./object-COs_Mw6p.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-z9JMF-qU.js");
|
|
6
|
+
require("./utils-CuKLf1Zv.js");
|
|
7
|
+
const require_wxml = require("./wxml-Ce10eREX.js");
|
|
8
|
+
const require_context = require("./context-DRRgW7i2.js");
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-DW1g3zjl.js");
|
|
10
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-CMgu5bJk.js");
|
|
9
11
|
require("./logger-TlKT3xmR.js");
|
|
10
12
|
let node_fs = require("node:fs");
|
|
11
13
|
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
@@ -141,7 +143,7 @@ function cssToStyleExport(source) {
|
|
|
141
143
|
result[match[1]] = { "": declarations };
|
|
142
144
|
const className = unescapeCssClassSelector(match[1]);
|
|
143
145
|
result[className] = { "": declarations };
|
|
144
|
-
result[
|
|
146
|
+
result[require_wxml.replaceWxml(className)] = { "": declarations };
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
});
|
|
@@ -179,14 +181,14 @@ function createStyleValueFromApplySources(sources, utilityStyles) {
|
|
|
179
181
|
if (!className) continue;
|
|
180
182
|
const declarations = {};
|
|
181
183
|
for (const applyRule of applyRules) for (const utility of (0, _tailwindcss_mangle_engine.splitCandidateTokens)(applyRule.params)) {
|
|
182
|
-
const utilityDeclarations = utilityStyles[utility]?.[""] ?? utilityStyles[
|
|
184
|
+
const utilityDeclarations = utilityStyles[utility]?.[""] ?? utilityStyles[require_wxml.replaceWxml(utility)]?.[""];
|
|
183
185
|
if (utilityDeclarations) Object.assign(declarations, utilityDeclarations);
|
|
184
186
|
}
|
|
185
187
|
if (Object.keys(declarations).length > 0) {
|
|
186
188
|
const unescapedClassName = unescapeCssClassSelector(className);
|
|
187
189
|
result[className] = { "": declarations };
|
|
188
190
|
result[unescapedClassName] = { "": declarations };
|
|
189
|
-
result[
|
|
191
|
+
result[require_wxml.replaceWxml(unescapedClassName)] = { "": declarations };
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
194
|
});
|
|
@@ -482,15 +484,19 @@ function collectExplicitTailwindV4CssEntries(opts) {
|
|
|
482
484
|
];
|
|
483
485
|
return [...new Set(entries.filter((entry) => typeof entry === "string" && entry.length > 0))];
|
|
484
486
|
}
|
|
487
|
+
function shouldKeepSingleExplicitCssEntrySource(source) {
|
|
488
|
+
return /@plugin\b/.test(source);
|
|
489
|
+
}
|
|
485
490
|
function collectConfiguredTailwindV4CssSourceEntries(opts, fallbackBase) {
|
|
486
491
|
const entries = [];
|
|
487
492
|
const seen = /* @__PURE__ */ new Set();
|
|
488
493
|
const explicitCssEntries = collectExplicitTailwindV4CssEntries(opts);
|
|
489
|
-
for (const cssEntry of explicitCssEntries
|
|
494
|
+
for (const cssEntry of explicitCssEntries) {
|
|
490
495
|
if (typeof cssEntry !== "string" || cssEntry.length === 0) continue;
|
|
491
496
|
const resolvedFile = node_path.default.isAbsolute(cssEntry) ? node_path.default.resolve(cssEntry) : node_path.default.resolve(fallbackBase, cssEntry);
|
|
492
497
|
if (!(0, node_fs.existsSync)(resolvedFile)) continue;
|
|
493
498
|
const source = (0, node_fs.readFileSync)(resolvedFile, "utf8");
|
|
499
|
+
if (explicitCssEntries.length <= 1 && !shouldKeepSingleExplicitCssEntrySource(source)) continue;
|
|
494
500
|
const key = `${resolvedFile}\0${source}`;
|
|
495
501
|
if (seen.has(key)) continue;
|
|
496
502
|
seen.add(key);
|
|
@@ -3460,7 +3466,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
3460
3466
|
//#region src/uni-app-x/vite.ts
|
|
3461
3467
|
let transformUVuePromise;
|
|
3462
3468
|
function loadTransformUVue() {
|
|
3463
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
3469
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-COFRlmDF.js")).then((mod) => mod.transformUVue));
|
|
3464
3470
|
return transformUVuePromise;
|
|
3465
3471
|
}
|
|
3466
3472
|
const preprocessorLangs = /* @__PURE__ */ new Set([
|
|
@@ -3494,7 +3500,7 @@ function isCssModuleExport(code) {
|
|
|
3494
3500
|
function createUniAppXPlugins(options) {
|
|
3495
3501
|
const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, runtimeState, styleHandler, generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, uniAppX } = options;
|
|
3496
3502
|
const resolvedUniAppXOptions = require_tailwindcss.resolveUniAppXOptions(uniAppX);
|
|
3497
|
-
const utsPlatform =
|
|
3503
|
+
const utsPlatform = require_generator.resolveUniUtsPlatform();
|
|
3498
3504
|
const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
|
|
3499
3505
|
const isHarmonyPlatform = utsPlatform.isAppHarmony;
|
|
3500
3506
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
@@ -3527,7 +3533,7 @@ function createUniAppXPlugins(options) {
|
|
|
3527
3533
|
return isHarmonyPlatform && resolvedUniAppXOptions.componentLocalStyles.enabled;
|
|
3528
3534
|
}
|
|
3529
3535
|
function isHarmonyBuildTarget() {
|
|
3530
|
-
if (
|
|
3536
|
+
if (require_generator.resolveUniUtsPlatform().isAppHarmony) return true;
|
|
3531
3537
|
return isUniAppXHarmonyOutDir(getResolvedConfig()?.build?.outDir);
|
|
3532
3538
|
}
|
|
3533
3539
|
async function transformStyle(code, id, query, hookContext) {
|
|
@@ -3541,7 +3547,7 @@ function createUniAppXPlugins(options) {
|
|
|
3541
3547
|
const cacheKey = `${mainCssChunkMatcher(id, appType) ? "1" : "0"}:${id}`;
|
|
3542
3548
|
let styleHandlerOptions = cssHandlerOptionsCache.get(cacheKey);
|
|
3543
3549
|
if (!styleHandlerOptions) {
|
|
3544
|
-
styleHandlerOptions =
|
|
3550
|
+
styleHandlerOptions = require_object.omitUndefined({
|
|
3545
3551
|
isMainChunk: mainCssChunkMatcher(id, appType),
|
|
3546
3552
|
uniAppXCssTarget: resolveUniAppXCssTarget(id),
|
|
3547
3553
|
uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
|
|
@@ -3604,7 +3610,7 @@ function createUniAppXPlugins(options) {
|
|
|
3604
3610
|
const transformUVue = await loadTransformUVue();
|
|
3605
3611
|
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
3606
3612
|
const enablePageLocalStyle = shouldEnableHarmonyPageLocalStyle();
|
|
3607
|
-
if (customAttributesEntities.length > 0 || disabledDefaultTemplateHandler || enableComponentLocalStyle || enablePageLocalStyle) return transformUVue(code, id, jsHandler, currentRuntimeSet,
|
|
3613
|
+
if (customAttributesEntities.length > 0 || disabledDefaultTemplateHandler || enableComponentLocalStyle || enablePageLocalStyle) return transformUVue(code, id, jsHandler, currentRuntimeSet, require_object.omitUndefined({
|
|
3608
3614
|
...customAttributesEntities.length > 0 ? { customAttributesEntities } : {},
|
|
3609
3615
|
...disabledDefaultTemplateHandler ? { disabledDefaultTemplateHandler } : {},
|
|
3610
3616
|
...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
|
|
@@ -3633,7 +3639,7 @@ function createUniAppXPlugins(options) {
|
|
|
3633
3639
|
order: "post",
|
|
3634
3640
|
async handler(_options, bundle) {
|
|
3635
3641
|
if (!isEnabled()) return;
|
|
3636
|
-
const currentUtsPlatform =
|
|
3642
|
+
const currentUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
3637
3643
|
const canInferHarmonyTarget = !currentUtsPlatform.normalized || currentUtsPlatform.isApp;
|
|
3638
3644
|
const isHarmonyTarget = currentUtsPlatform.isAppHarmony || canInferHarmonyTarget && isHarmonyBuildTarget();
|
|
3639
3645
|
if (!currentUtsPlatform.isApp && !isHarmonyTarget) return;
|
|
@@ -3806,7 +3812,8 @@ function processJsBundleEntry(options) {
|
|
|
3806
3812
|
return;
|
|
3807
3813
|
}
|
|
3808
3814
|
const currentSource = originalEntrySource;
|
|
3809
|
-
const
|
|
3815
|
+
const absoluteFile = node_path.default.resolve(outDir, file);
|
|
3816
|
+
const precheckOptions = createHandlerOptions(absoluteFile, {
|
|
3810
3817
|
uniAppX: resolveUniAppXJsTransformEnabled$1(uniAppX),
|
|
3811
3818
|
babelParserOptions: {
|
|
3812
3819
|
plugins: ["typescript"],
|
|
@@ -4665,6 +4672,9 @@ function inferPlatformFromViteOutDir$1(outDir) {
|
|
|
4665
4672
|
const normalized = segment.trim().toLowerCase();
|
|
4666
4673
|
if (normalized === "h5" || normalized === "web" || normalized === "app" || normalized === "app-plus" || normalized.startsWith("app-") || normalized.startsWith("mp-") || normalized.startsWith("quickapp-webview")) return normalized;
|
|
4667
4674
|
}
|
|
4675
|
+
function hasTailwindPluginDirective(source) {
|
|
4676
|
+
return /@plugin\b/.test(source);
|
|
4677
|
+
}
|
|
4668
4678
|
function createGenerateBundleHook(context) {
|
|
4669
4679
|
const state = require_source_candidate_scan_signature.createBundleBuildState();
|
|
4670
4680
|
const lastCssResultByFile = /* @__PURE__ */ new Map();
|
|
@@ -4717,7 +4727,7 @@ function createGenerateBundleHook(context) {
|
|
|
4717
4727
|
const getCssSource = (sourceFile) => getKnownCssSource?.(sourceFile) ?? getSourceCandidateSource?.(sourceFile);
|
|
4718
4728
|
const { cache, onEnd, onStart, onUpdate, styleHandler, templateHandler, jsHandler, uniAppX } = opts;
|
|
4719
4729
|
const resolvedConfig = getResolvedConfig();
|
|
4720
|
-
const uniUtsPlatform =
|
|
4730
|
+
const uniUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
4721
4731
|
const generatorPlatform = opts.cssOptions?.platform ?? opts.platform ?? inferPlatformFromViteOutDir$1(resolvedConfig?.build?.outDir);
|
|
4722
4732
|
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
4723
4733
|
appType: opts.appType,
|
|
@@ -5262,8 +5272,9 @@ function createGenerateBundleHook(context) {
|
|
|
5262
5272
|
if (!hasUsableRememberedTailwindSource) {
|
|
5263
5273
|
const configuredTailwindV4CssSourceEntries = getConfiguredTailwindV4CssSourceEntries();
|
|
5264
5274
|
const isCurrentRootMiniProgramStyleOutput = opts.cssMatcher(outputFile) && isMiniProgramStyleOutputFile(outputFile) && !require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile.replace(/[?#].*$/, "")).includes("/");
|
|
5265
|
-
|
|
5266
|
-
|
|
5275
|
+
const configuredEntriesForCurrentRootMiniProgramStyle = isCurrentRootMiniProgramStyleOutput && !hasTailwindGenerationSource(rawSource) ? configuredTailwindV4CssSourceEntries.filter((entry) => hasTailwindPluginDirective(entry.source)) : configuredTailwindV4CssSourceEntries;
|
|
5276
|
+
if (isCurrentRootMiniProgramStyleOutput && (hasTailwindGenerationSource(rawSource) || configuredEntriesForCurrentRootMiniProgramStyle.length > 0)) {
|
|
5277
|
+
const configuredGenerationSource = selectTailwindV4GenerationCssSourceForOutput(outputFile, configuredEntriesForCurrentRootMiniProgramStyle, rawSource, {
|
|
5267
5278
|
cwd: opts.tailwindcssBasedir,
|
|
5268
5279
|
outputRoot: outDir,
|
|
5269
5280
|
projectRoot: sourceRoot ?? rootDir
|
|
@@ -5507,7 +5518,7 @@ function createGenerateBundleHook(context) {
|
|
|
5507
5518
|
const runTransform = async () => {
|
|
5508
5519
|
const start = performance.now();
|
|
5509
5520
|
await runtimeState.readyPromise;
|
|
5510
|
-
const previousCss = !vitePipelineCssAsset && useIncrementalMode && !hasRuntimeAffectingChanges && !snapshot.changedByType.css.has(file) ? getLastCssResult(lastCssResultByFile, outputFile, file) : void 0;
|
|
5521
|
+
const previousCss = !vitePipelineCssAsset && useIncrementalMode && !generatorCandidatesChanged && !hasRuntimeAffectingChanges && !snapshot.changedByType.css.has(file) ? getLastCssResult(lastCssResultByFile, outputFile, file) : void 0;
|
|
5511
5522
|
const generatorTransformRawSource = generatorRawSource;
|
|
5512
5523
|
const previousGeneratorCss = previousCss && !isWebGeneratorTarget ? normalizeMiniProgramGeneratorRawSource(previousCss, outputFile) : previousCss;
|
|
5513
5524
|
const generated = hasTailwindGenerationSource(generatorTransformRawSource) || require_source_candidate_scan_signature.hasBundlerGeneratedCssMarker(rawSource) ? await require_source_candidate_scan_signature.generateTailwindV4Css({
|
|
@@ -5529,7 +5540,8 @@ function createGenerateBundleHook(context) {
|
|
|
5529
5540
|
...usesConfiguredTailwindV4FallbackSource ? { restoreLocalCssImports: false } : {}
|
|
5530
5541
|
}) : void 0;
|
|
5531
5542
|
if (generated) {
|
|
5532
|
-
const
|
|
5543
|
+
const outputCss = transformWebTargetCss(generated.css);
|
|
5544
|
+
const tracedCss = removeRootCoveredCssFromScopedAsset(annotateCss(outputCss));
|
|
5533
5545
|
registerGeneratorDependencies$1({ addWatchFile }, generated.dependencies);
|
|
5534
5546
|
if (envFlags.debugCssDiff) debug("css diff %s: %s", generatorSourceFile, require_source_candidate_scan_signature.summarizeStringDiff(generatorRawSource, tracedCss));
|
|
5535
5547
|
debug("css generated result: %s bytes=%d", file, tracedCss.length);
|
|
@@ -5788,7 +5800,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
5788
5800
|
async handler(_options, bundle) {
|
|
5789
5801
|
const { opts, runtimeState, ensureRuntimeClassSet, cssPipelineStrategy, isCssAssetProcessed, markCssAssetProcessed, debug, getResolvedConfig, recordCssAssetResult, recordViteProcessedCssAssetResult, getViteProcessedCssAssetResults, getRecordedGeneratorCandidates, getSourceCandidates, getSourceCandidatesForEntries, getSourceCandidateSourcesForEntries, waitForSourceCandidateSyncs, rememberMainCssSource, getRememberedMainCssSource, isViteProcessedCssAsset } = context;
|
|
5790
5802
|
const resolvedConfig = getResolvedConfig();
|
|
5791
|
-
const uniUtsPlatform =
|
|
5803
|
+
const uniUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
5792
5804
|
const generatorPlatform = opts.cssOptions?.platform ?? opts.platform ?? inferPlatformFromViteOutDir(resolvedConfig?.build?.outDir);
|
|
5793
5805
|
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
5794
5806
|
appType: opts.appType,
|
|
@@ -6289,7 +6301,8 @@ function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
|
6289
6301
|
};
|
|
6290
6302
|
const collectModule = (mod) => {
|
|
6291
6303
|
if (mod == null || seenModules.has(mod)) return;
|
|
6292
|
-
|
|
6304
|
+
const modId = mod.id ?? mod.url;
|
|
6305
|
+
if (!isHotSourceStyleModule(modId)) return;
|
|
6293
6306
|
seenModules.add(mod);
|
|
6294
6307
|
ctx.server.moduleGraph.invalidateModule(mod);
|
|
6295
6308
|
modules.push(mod);
|
|
@@ -6618,8 +6631,9 @@ function createViteRuntimeClassSet(options) {
|
|
|
6618
6631
|
}
|
|
6619
6632
|
async function refreshRuntimeState(force) {
|
|
6620
6633
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
6634
|
+
const shouldRefresh = force || invalidation.changed;
|
|
6621
6635
|
const refreshed = await require_context.refreshTailwindRuntimeState(runtimeState, {
|
|
6622
|
-
force:
|
|
6636
|
+
force: shouldRefresh,
|
|
6623
6637
|
clearCache: force || invalidation.changed
|
|
6624
6638
|
});
|
|
6625
6639
|
if (invalidation.changed) debug("runtime signature changed, refresh triggered. signature: %s", invalidation.signature);
|
|
@@ -6832,7 +6846,7 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
|
6832
6846
|
}
|
|
6833
6847
|
//#endregion
|
|
6834
6848
|
//#region src/bundlers/vite/shared/create-framework-plugins.ts
|
|
6835
|
-
const debug =
|
|
6849
|
+
const debug = require_wxml.createDebug();
|
|
6836
6850
|
const weappTailwindcssPackageDir = require_source_candidate_scan_signature.resolvePackageDir("weapp-tailwindcss");
|
|
6837
6851
|
const weappTailwindcssDirPosix = require_source_candidate_scan_signature.slash(weappTailwindcssPackageDir);
|
|
6838
6852
|
const SOURCE_CANDIDATE_SCAN_CACHE_MAX = 8;
|
|
@@ -7025,11 +7039,12 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7025
7039
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) continue;
|
|
7026
7040
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
7027
7041
|
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
7042
|
+
const resolved = await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(sourceCss, sourceBase);
|
|
7028
7043
|
changed = require_generator.upsertTailwindV4CssSource(opts, {
|
|
7029
7044
|
file: sourceFile,
|
|
7030
7045
|
base: sourceBase,
|
|
7031
7046
|
css: sourceCss,
|
|
7032
|
-
dependencies:
|
|
7047
|
+
dependencies: resolved?.dependencies ?? []
|
|
7033
7048
|
}) || changed;
|
|
7034
7049
|
}
|
|
7035
7050
|
if (!changed) return;
|
|
@@ -7114,7 +7129,8 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7114
7129
|
let pendingHmrCandidateChange;
|
|
7115
7130
|
let pendingHmrCssTargetFiles;
|
|
7116
7131
|
let pendingFullHmrCssRegeneration = false;
|
|
7117
|
-
const
|
|
7132
|
+
const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey((0, _weapp_tailwindcss_shared.cleanUrl)(file));
|
|
7133
|
+
const normalizeHmrCssTargetFile = normalizeGeneratedCssCacheFile;
|
|
7118
7134
|
const collectPendingHmrCssTargetFiles = (cssModules, fallbackCssIds) => {
|
|
7119
7135
|
const targets = /* @__PURE__ */ new Set();
|
|
7120
7136
|
const addTarget = (file) => {
|
|
@@ -7187,7 +7203,8 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7187
7203
|
return change;
|
|
7188
7204
|
};
|
|
7189
7205
|
const resolvePendingHmrCandidateChange = (generatorCode, file) => {
|
|
7190
|
-
|
|
7206
|
+
const fileKey = normalizeGeneratedCssCacheFile(file);
|
|
7207
|
+
if (resolvedConfig?.command !== "serve" || !pendingHmrCandidateChange || pendingHmrCandidateChange.runtimeAffecting || pendingHmrCandidateChange.addedCandidates.size === 0 || resolveCurrentGeneratorOptions().target === "weapp" && require_generator.hasUserCssLayerBlocks(generatorCode) || !cleanGeneratedCssByFile.has(fileKey) || !generatedClassSetByFile.has(fileKey) || pendingHmrCssTargetFiles !== void 0 && !pendingHmrCssTargetFiles.has(fileKey)) return;
|
|
7191
7208
|
return pendingHmrCandidateChange;
|
|
7192
7209
|
};
|
|
7193
7210
|
const finishPendingHmrCssTargetFile = (file) => {
|
|
@@ -7342,9 +7359,10 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7342
7359
|
const recordViteProcessedCssAssetResult = (file, css, options = {}) => {
|
|
7343
7360
|
const key = normalizeVitePersistentCacheKey(file);
|
|
7344
7361
|
const previous = viteProcessedCssAssetResults.get(key);
|
|
7362
|
+
const injectIntoMain = previous?.injectIntoMain === true ? true : options.injectIntoMain ?? previous?.injectIntoMain;
|
|
7345
7363
|
touchMapEntry(viteProcessedCssAssetResults, key, {
|
|
7346
7364
|
css,
|
|
7347
|
-
injectIntoMain
|
|
7365
|
+
injectIntoMain,
|
|
7348
7366
|
outputFile: options.outputFile ?? previous?.outputFile
|
|
7349
7367
|
});
|
|
7350
7368
|
};
|
|
@@ -7440,12 +7458,13 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7440
7458
|
const sourceRoot = resolveWeappViteSourceRoot(resolvedConfig, opts.appType);
|
|
7441
7459
|
const outputFile = resolveViteCssPipelineOutputFile(requestFile, opts, rootDir, currentGeneratorBranch.isWeb, shouldPreserveStyleOutputExtension, sourceRoot);
|
|
7442
7460
|
const generatorTransformCode = currentGeneratorBranch.isWeb ? generatorCode : require_hmr_timing.normalizeMiniProgramGeneratorCssSource(generatorCode, outputFile);
|
|
7461
|
+
const fileKey = normalizeGeneratedCssCacheFile(file);
|
|
7443
7462
|
const fullRuntime = getSourceCandidates() ?? getRecordedGeneratorCandidates() ?? await ensureRuntimeClassSet();
|
|
7444
7463
|
const pendingHmrChange = resolvePendingHmrCandidateChange(generatorCode, file);
|
|
7445
7464
|
const forceFullHmrCssRegeneration = pendingFullHmrCssRegeneration || resolvedConfig?.command === "serve" && pendingHmrCandidateChange !== void 0 && pendingHmrChange === void 0;
|
|
7446
|
-
const runtime =
|
|
7465
|
+
const runtime = fullRuntime;
|
|
7447
7466
|
if (pendingHmrChange && currentGeneratorOptions.target === "weapp" && require_generator.filterUnsupportedMiniProgramTailwindV4Candidates(pendingHmrChange.addedCandidates).size === 0) {
|
|
7448
|
-
const previousTracedCss = tracedGeneratedCssByFile.get(
|
|
7467
|
+
const previousTracedCss = tracedGeneratedCssByFile.get(fileKey);
|
|
7449
7468
|
if (previousTracedCss !== void 0) {
|
|
7450
7469
|
finishPendingHmrCssTargetFile(file);
|
|
7451
7470
|
return `${require_source_candidate_scan_signature.createBundlerGeneratedCssMarker("vite", normalizeViteProcessedCssFile(file))}\n${previousTracedCss}`;
|
|
@@ -7467,8 +7486,6 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7467
7486
|
cssHandlerOptions,
|
|
7468
7487
|
generatorCode: generatorTransformCode
|
|
7469
7488
|
}) ?? true);
|
|
7470
|
-
const previousCss = pendingHmrChange && !forceFullHmrCssRegeneration ? cleanGeneratedCssByFile.get(file) : void 0;
|
|
7471
|
-
const previousGeneratorCss = previousCss && !currentGeneratorBranch.isWeb ? require_hmr_timing.normalizeMiniProgramGeneratorCssSource(previousCss, outputFile) : previousCss;
|
|
7472
7489
|
const generated = await hmrTimingRecorder.measure("generateCss.serve", () => require_source_candidate_scan_signature.generateTailwindV4Css({
|
|
7473
7490
|
opts,
|
|
7474
7491
|
runtimeState,
|
|
@@ -7483,15 +7500,13 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7483
7500
|
generatorPlatform: resolveGeneratorPlatform(),
|
|
7484
7501
|
styleHandler,
|
|
7485
7502
|
debug,
|
|
7486
|
-
previousCss: previousGeneratorCss,
|
|
7487
|
-
previousClassSet: pendingHmrChange && !forceFullHmrCssRegeneration ? generatedClassSetByFile.get(file) : void 0,
|
|
7488
7503
|
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource,
|
|
7489
|
-
disableSourceScan:
|
|
7504
|
+
disableSourceScan: false,
|
|
7490
7505
|
restoreLocalCssImports: !currentGeneratorBranch.isWeb
|
|
7491
7506
|
}), {
|
|
7492
7507
|
file,
|
|
7493
7508
|
memoryDebug: {
|
|
7494
|
-
cleanCacheHit: cleanGeneratedCssByFile.has(
|
|
7509
|
+
cleanCacheHit: cleanGeneratedCssByFile.has(fileKey),
|
|
7495
7510
|
forceFullHmrCssRegeneration,
|
|
7496
7511
|
pendingAddedCandidates: pendingHmrCandidateChange?.addedCandidates.size ?? 0,
|
|
7497
7512
|
pendingCssTargets: pendingHmrCssTargetFiles?.size ?? 0,
|
|
@@ -7518,9 +7533,9 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7518
7533
|
tokenSources: require_hmr_timing.createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts)
|
|
7519
7534
|
});
|
|
7520
7535
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
7521
|
-
cleanGeneratedCssByFile.set(
|
|
7522
|
-
tracedGeneratedCssByFile.set(
|
|
7523
|
-
generatedClassSetByFile.set(
|
|
7536
|
+
cleanGeneratedCssByFile.set(fileKey, outputCss);
|
|
7537
|
+
tracedGeneratedCssByFile.set(fileKey, tracedCss);
|
|
7538
|
+
generatedClassSetByFile.set(fileKey, new Set(generated.classSet));
|
|
7524
7539
|
const shouldInjectGeneratedCssIntoMain = mainCssChunkMatcher(outputFile, opts.appType) || require_generator.hasTailwindRootDirectives(generatorTransformCode, { importFallback: currentGeneratorOptions.importFallback }) && !require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile).includes("/");
|
|
7525
7540
|
recordViteProcessedCssAssetResult(file, tracedCss, {
|
|
7526
7541
|
injectIntoMain: shouldInjectGeneratedCssIntoMain,
|
|
@@ -8026,7 +8041,7 @@ function withUniAppXWebPreflightReset(css, enabled) {
|
|
|
8026
8041
|
//#endregion
|
|
8027
8042
|
//#region src/bundlers/vite/uni-app-x-css-options.ts
|
|
8028
8043
|
function resolveUniAppXNativeCssHandlerOptions(opts) {
|
|
8029
|
-
const uniUtsPlatform =
|
|
8044
|
+
const uniUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
8030
8045
|
if (!require_generator.shouldUseNativeAppCssBranch(require_generator.resolveGeneratorRuntimeBranch(require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
8031
8046
|
appType: opts.appType,
|
|
8032
8047
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
@@ -8047,10 +8062,10 @@ function resolveUniAppXNativeCssHandlerOptions(opts) {
|
|
|
8047
8062
|
//#endregion
|
|
8048
8063
|
//#region src/bundlers/vite/frameworks/uni-app-x/index.ts
|
|
8049
8064
|
function isUniAppXNativeAppStyleTarget() {
|
|
8050
|
-
return
|
|
8065
|
+
return require_generator.resolveUniUtsPlatform().isApp;
|
|
8051
8066
|
}
|
|
8052
8067
|
function isUniAppXHarmonyAppStyleTarget(context) {
|
|
8053
|
-
const uniUtsPlatform =
|
|
8068
|
+
const uniUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
8054
8069
|
const canInferHarmonyAppStyleTarget = !uniUtsPlatform.normalized || uniUtsPlatform.isApp;
|
|
8055
8070
|
return uniUtsPlatform.isAppHarmony || canInferHarmonyAppStyleTarget && (context.bundle != null && isUniAppXHarmonyBundle(context.bundle) || isUniAppXHarmonyOutDir(context.resolvedConfig?.build?.outDir));
|
|
8056
8071
|
}
|
|
@@ -8083,7 +8098,7 @@ function createUniAppXVitePlugins(options = {}) {
|
|
|
8083
8098
|
return createViteFrameworkPlugins(options, {
|
|
8084
8099
|
frameworkName: "uni-app-x",
|
|
8085
8100
|
cssPipelineStrategy: uniAppXCssPipelineStrategy,
|
|
8086
|
-
getExtraPluginPlatform: () => ({ isIosPlatform:
|
|
8101
|
+
getExtraPluginPlatform: () => ({ isIosPlatform: require_generator.resolveUniUtsPlatform().isAppIos }),
|
|
8087
8102
|
styleInjectorDelegate: require_source_candidate_scan_signature.viteStyleInjectorDelegates.uniApp,
|
|
8088
8103
|
isRuntimeClassSetFeatureEnabled: () => true,
|
|
8089
8104
|
createExtraPlugins: (context) => createUniAppXPlugins({
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { resolveImplicitAppTypeFromViteRoot } from "./framework.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { At as resolveTailwindV4CssSourceBase, E as resolveTailwindcssOptions, J as hasTailwindApplyDirective, K as stripMiniProgramCssSpecificityPlaceholders, N as normalizeEmptyTailwindCustomVariants, Nt as filterUnsupportedMiniProgramTailwindV4Candidates, Q as normalizeTailwindConfigDirectives, U as hasMiniProgramCssSpecificityPlaceholders, X as hasTailwindRootDirectives, Y as hasTailwindNonRootGenerationDirectives, Z as hasTailwindSourceDirectives, a as resolveGeneratorRuntimeBranch, b as normalizeCssEntries, c as shouldUseNativeAppCssBranch, ct as hasTailwindGeneratedCssMarkers, et as normalizeTailwindSourceForGenerator, ft as stripGeneratorPlaceholderMarkers, g as upsertTailwindV4CssSource, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, j as hasUserCssLayerBlocks, l as resolveUniUtsPlatform, m as filterTailwindV4CssSourceRoots, nt as removeTailwindSourceDirectives, q as hasLocalCssImport, s as shouldUseMiniProgramCssBranch, tt as parseImportRequest, vt as getTailwindV4IncrementalGenerateCacheStats, x as findNearestPackageRoot, y as isTailwindV4CssEntry } from "./generator-BvPcmqxU.mjs";
|
|
3
|
+
import { t as omitUndefined } from "./object-BJSWl-E5.mjs";
|
|
4
|
+
import { _ as resolveViteTailwindV4CssDependencies, a as findTailwindConfig, f as createViteSourceScanMatcher, g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as resolveViteSourceScanEntries, r as isUniAppXEnabled } from "./tailwindcss-DZT_pWrd.mjs";
|
|
5
|
+
import "./utils-MVwpU07P.mjs";
|
|
6
|
+
import { g as replaceWxml, y as createDebug } from "./wxml-DdGdeqaH.mjs";
|
|
7
|
+
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-xSJE588m.mjs";
|
|
8
|
+
import { A as processCachedTask, D as createCssSourceTraceCacheSignature, E as annotateCssSourceTrace, O as createCssTokenSourceMap, S as scoreTailwindV4CssSourceFileMatch, _ as normalizeMiniProgramGeneratorCssSource, a as isSourceCandidateRequest, d as validateCandidatesByGenerator, g as mergeMarkedUserLayerComponentsCss, h as extractMarkedUserLayerComponentsCss, m as runWithConcurrency, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, t as createHmrTimingRecorder, v as normalizeMiniProgramImportShell, y as isPureLocalCssImportWrapper } from "./hmr-timing-hRhRAjYV.mjs";
|
|
9
|
+
import { A as createBundlerGeneratedCssMarker, B as resolveViteFrameworkProfile, C as createBundleModuleGraphOptions, D as normalizeOutputPathKey, E as stripRequestQuery, F as resolvePluginDisabledState, I as createBuiltinViteStyleInjectorPlugins, M as parseBundlerGeneratedCssMarkerBlocks, N as stripBundlerGeneratedCssMarkers, P as resolvePackageDir, R as viteStyleInjectorDelegates, S as applyLinkedResults, T as isSourceStyleRequest, _ as isCSSRequest, a as createCandidateSignature, b as slash, c as getSnapshotHash, d as buildBundleSnapshot, g as formatPostcssSourceMap, h as cleanUrl, i as createScopedGeneratorSourceTraceMap, j as hasBundlerGeneratedCssMarker, k as toAbsoluteOutputPath, l as hasRuntimeAffectingSourceChanges, m as updateBundleBuildState, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as createBundleBuildState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, v as isHTMLRequest, w as generateTailwindV4Css, x as createRuntimeAffectingSourceSignature, y as normalizePath } from "./source-candidate-scan-signature-t4XKAQ04.mjs";
|
|
8
10
|
import { t as logger$1 } from "./logger-BNzxZbZj.mjs";
|
|
9
11
|
import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
10
12
|
import path from "node:path";
|
|
@@ -476,15 +478,19 @@ function collectExplicitTailwindV4CssEntries(opts) {
|
|
|
476
478
|
];
|
|
477
479
|
return [...new Set(entries.filter((entry) => typeof entry === "string" && entry.length > 0))];
|
|
478
480
|
}
|
|
481
|
+
function shouldKeepSingleExplicitCssEntrySource(source) {
|
|
482
|
+
return /@plugin\b/.test(source);
|
|
483
|
+
}
|
|
479
484
|
function collectConfiguredTailwindV4CssSourceEntries(opts, fallbackBase) {
|
|
480
485
|
const entries = [];
|
|
481
486
|
const seen = /* @__PURE__ */ new Set();
|
|
482
487
|
const explicitCssEntries = collectExplicitTailwindV4CssEntries(opts);
|
|
483
|
-
for (const cssEntry of explicitCssEntries
|
|
488
|
+
for (const cssEntry of explicitCssEntries) {
|
|
484
489
|
if (typeof cssEntry !== "string" || cssEntry.length === 0) continue;
|
|
485
490
|
const resolvedFile = path.isAbsolute(cssEntry) ? path.resolve(cssEntry) : path.resolve(fallbackBase, cssEntry);
|
|
486
491
|
if (!existsSync(resolvedFile)) continue;
|
|
487
492
|
const source = readFileSync(resolvedFile, "utf8");
|
|
493
|
+
if (explicitCssEntries.length <= 1 && !shouldKeepSingleExplicitCssEntrySource(source)) continue;
|
|
488
494
|
const key = `${resolvedFile}\0${source}`;
|
|
489
495
|
if (seen.has(key)) continue;
|
|
490
496
|
seen.add(key);
|
|
@@ -3454,7 +3460,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
3454
3460
|
//#region src/uni-app-x/vite.ts
|
|
3455
3461
|
let transformUVuePromise;
|
|
3456
3462
|
function loadTransformUVue() {
|
|
3457
|
-
transformUVuePromise ?? (transformUVuePromise = import("./transform-
|
|
3463
|
+
transformUVuePromise ?? (transformUVuePromise = import("./transform-D5JUgMpE.mjs").then((mod) => mod.transformUVue));
|
|
3458
3464
|
return transformUVuePromise;
|
|
3459
3465
|
}
|
|
3460
3466
|
const preprocessorLangs = /* @__PURE__ */ new Set([
|
|
@@ -3800,7 +3806,8 @@ function processJsBundleEntry(options) {
|
|
|
3800
3806
|
return;
|
|
3801
3807
|
}
|
|
3802
3808
|
const currentSource = originalEntrySource;
|
|
3803
|
-
const
|
|
3809
|
+
const absoluteFile = path.resolve(outDir, file);
|
|
3810
|
+
const precheckOptions = createHandlerOptions(absoluteFile, {
|
|
3804
3811
|
uniAppX: resolveUniAppXJsTransformEnabled$1(uniAppX),
|
|
3805
3812
|
babelParserOptions: {
|
|
3806
3813
|
plugins: ["typescript"],
|
|
@@ -4659,6 +4666,9 @@ function inferPlatformFromViteOutDir$1(outDir) {
|
|
|
4659
4666
|
const normalized = segment.trim().toLowerCase();
|
|
4660
4667
|
if (normalized === "h5" || normalized === "web" || normalized === "app" || normalized === "app-plus" || normalized.startsWith("app-") || normalized.startsWith("mp-") || normalized.startsWith("quickapp-webview")) return normalized;
|
|
4661
4668
|
}
|
|
4669
|
+
function hasTailwindPluginDirective(source) {
|
|
4670
|
+
return /@plugin\b/.test(source);
|
|
4671
|
+
}
|
|
4662
4672
|
function createGenerateBundleHook(context) {
|
|
4663
4673
|
const state = createBundleBuildState();
|
|
4664
4674
|
const lastCssResultByFile = /* @__PURE__ */ new Map();
|
|
@@ -5256,8 +5266,9 @@ function createGenerateBundleHook(context) {
|
|
|
5256
5266
|
if (!hasUsableRememberedTailwindSource) {
|
|
5257
5267
|
const configuredTailwindV4CssSourceEntries = getConfiguredTailwindV4CssSourceEntries();
|
|
5258
5268
|
const isCurrentRootMiniProgramStyleOutput = opts.cssMatcher(outputFile) && isMiniProgramStyleOutputFile(outputFile) && !normalizeOutputPathKey(outputFile.replace(/[?#].*$/, "")).includes("/");
|
|
5259
|
-
|
|
5260
|
-
|
|
5269
|
+
const configuredEntriesForCurrentRootMiniProgramStyle = isCurrentRootMiniProgramStyleOutput && !hasTailwindGenerationSource(rawSource) ? configuredTailwindV4CssSourceEntries.filter((entry) => hasTailwindPluginDirective(entry.source)) : configuredTailwindV4CssSourceEntries;
|
|
5270
|
+
if (isCurrentRootMiniProgramStyleOutput && (hasTailwindGenerationSource(rawSource) || configuredEntriesForCurrentRootMiniProgramStyle.length > 0)) {
|
|
5271
|
+
const configuredGenerationSource = selectTailwindV4GenerationCssSourceForOutput(outputFile, configuredEntriesForCurrentRootMiniProgramStyle, rawSource, {
|
|
5261
5272
|
cwd: opts.tailwindcssBasedir,
|
|
5262
5273
|
outputRoot: outDir,
|
|
5263
5274
|
projectRoot: sourceRoot ?? rootDir
|
|
@@ -5501,7 +5512,7 @@ function createGenerateBundleHook(context) {
|
|
|
5501
5512
|
const runTransform = async () => {
|
|
5502
5513
|
const start = performance.now();
|
|
5503
5514
|
await runtimeState.readyPromise;
|
|
5504
|
-
const previousCss = !vitePipelineCssAsset && useIncrementalMode && !hasRuntimeAffectingChanges && !snapshot.changedByType.css.has(file) ? getLastCssResult(lastCssResultByFile, outputFile, file) : void 0;
|
|
5515
|
+
const previousCss = !vitePipelineCssAsset && useIncrementalMode && !generatorCandidatesChanged && !hasRuntimeAffectingChanges && !snapshot.changedByType.css.has(file) ? getLastCssResult(lastCssResultByFile, outputFile, file) : void 0;
|
|
5505
5516
|
const generatorTransformRawSource = generatorRawSource;
|
|
5506
5517
|
const previousGeneratorCss = previousCss && !isWebGeneratorTarget ? normalizeMiniProgramGeneratorRawSource(previousCss, outputFile) : previousCss;
|
|
5507
5518
|
const generated = hasTailwindGenerationSource(generatorTransformRawSource) || hasBundlerGeneratedCssMarker(rawSource) ? await generateTailwindV4Css({
|
|
@@ -5523,7 +5534,8 @@ function createGenerateBundleHook(context) {
|
|
|
5523
5534
|
...usesConfiguredTailwindV4FallbackSource ? { restoreLocalCssImports: false } : {}
|
|
5524
5535
|
}) : void 0;
|
|
5525
5536
|
if (generated) {
|
|
5526
|
-
const
|
|
5537
|
+
const outputCss = transformWebTargetCss(generated.css);
|
|
5538
|
+
const tracedCss = removeRootCoveredCssFromScopedAsset(annotateCss(outputCss));
|
|
5527
5539
|
registerGeneratorDependencies$1({ addWatchFile }, generated.dependencies);
|
|
5528
5540
|
if (envFlags.debugCssDiff) debug("css diff %s: %s", generatorSourceFile, summarizeStringDiff(generatorRawSource, tracedCss));
|
|
5529
5541
|
debug("css generated result: %s bytes=%d", file, tracedCss.length);
|
|
@@ -6283,7 +6295,8 @@ function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
|
6283
6295
|
};
|
|
6284
6296
|
const collectModule = (mod) => {
|
|
6285
6297
|
if (mod == null || seenModules.has(mod)) return;
|
|
6286
|
-
|
|
6298
|
+
const modId = mod.id ?? mod.url;
|
|
6299
|
+
if (!isHotSourceStyleModule(modId)) return;
|
|
6287
6300
|
seenModules.add(mod);
|
|
6288
6301
|
ctx.server.moduleGraph.invalidateModule(mod);
|
|
6289
6302
|
modules.push(mod);
|
|
@@ -6612,8 +6625,9 @@ function createViteRuntimeClassSet(options) {
|
|
|
6612
6625
|
}
|
|
6613
6626
|
async function refreshRuntimeState(force) {
|
|
6614
6627
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
6628
|
+
const shouldRefresh = force || invalidation.changed;
|
|
6615
6629
|
const refreshed = await refreshTailwindRuntimeState(runtimeState, {
|
|
6616
|
-
force:
|
|
6630
|
+
force: shouldRefresh,
|
|
6617
6631
|
clearCache: force || invalidation.changed
|
|
6618
6632
|
});
|
|
6619
6633
|
if (invalidation.changed) debug("runtime signature changed, refresh triggered. signature: %s", invalidation.signature);
|
|
@@ -7019,11 +7033,12 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7019
7033
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) continue;
|
|
7020
7034
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
7021
7035
|
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
7036
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(sourceCss, sourceBase);
|
|
7022
7037
|
changed = upsertTailwindV4CssSource(opts, {
|
|
7023
7038
|
file: sourceFile,
|
|
7024
7039
|
base: sourceBase,
|
|
7025
7040
|
css: sourceCss,
|
|
7026
|
-
dependencies:
|
|
7041
|
+
dependencies: resolved?.dependencies ?? []
|
|
7027
7042
|
}) || changed;
|
|
7028
7043
|
}
|
|
7029
7044
|
if (!changed) return;
|
|
@@ -7108,7 +7123,8 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7108
7123
|
let pendingHmrCandidateChange;
|
|
7109
7124
|
let pendingHmrCssTargetFiles;
|
|
7110
7125
|
let pendingFullHmrCssRegeneration = false;
|
|
7111
|
-
const
|
|
7126
|
+
const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey(cleanUrl(file));
|
|
7127
|
+
const normalizeHmrCssTargetFile = normalizeGeneratedCssCacheFile;
|
|
7112
7128
|
const collectPendingHmrCssTargetFiles = (cssModules, fallbackCssIds) => {
|
|
7113
7129
|
const targets = /* @__PURE__ */ new Set();
|
|
7114
7130
|
const addTarget = (file) => {
|
|
@@ -7181,7 +7197,8 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7181
7197
|
return change;
|
|
7182
7198
|
};
|
|
7183
7199
|
const resolvePendingHmrCandidateChange = (generatorCode, file) => {
|
|
7184
|
-
|
|
7200
|
+
const fileKey = normalizeGeneratedCssCacheFile(file);
|
|
7201
|
+
if (resolvedConfig?.command !== "serve" || !pendingHmrCandidateChange || pendingHmrCandidateChange.runtimeAffecting || pendingHmrCandidateChange.addedCandidates.size === 0 || resolveCurrentGeneratorOptions().target === "weapp" && hasUserCssLayerBlocks(generatorCode) || !cleanGeneratedCssByFile.has(fileKey) || !generatedClassSetByFile.has(fileKey) || pendingHmrCssTargetFiles !== void 0 && !pendingHmrCssTargetFiles.has(fileKey)) return;
|
|
7185
7202
|
return pendingHmrCandidateChange;
|
|
7186
7203
|
};
|
|
7187
7204
|
const finishPendingHmrCssTargetFile = (file) => {
|
|
@@ -7336,9 +7353,10 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7336
7353
|
const recordViteProcessedCssAssetResult = (file, css, options = {}) => {
|
|
7337
7354
|
const key = normalizeVitePersistentCacheKey(file);
|
|
7338
7355
|
const previous = viteProcessedCssAssetResults.get(key);
|
|
7356
|
+
const injectIntoMain = previous?.injectIntoMain === true ? true : options.injectIntoMain ?? previous?.injectIntoMain;
|
|
7339
7357
|
touchMapEntry(viteProcessedCssAssetResults, key, {
|
|
7340
7358
|
css,
|
|
7341
|
-
injectIntoMain
|
|
7359
|
+
injectIntoMain,
|
|
7342
7360
|
outputFile: options.outputFile ?? previous?.outputFile
|
|
7343
7361
|
});
|
|
7344
7362
|
};
|
|
@@ -7434,12 +7452,13 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7434
7452
|
const sourceRoot = resolveWeappViteSourceRoot(resolvedConfig, opts.appType);
|
|
7435
7453
|
const outputFile = resolveViteCssPipelineOutputFile(requestFile, opts, rootDir, currentGeneratorBranch.isWeb, shouldPreserveStyleOutputExtension, sourceRoot);
|
|
7436
7454
|
const generatorTransformCode = currentGeneratorBranch.isWeb ? generatorCode : normalizeMiniProgramGeneratorCssSource(generatorCode, outputFile);
|
|
7455
|
+
const fileKey = normalizeGeneratedCssCacheFile(file);
|
|
7437
7456
|
const fullRuntime = getSourceCandidates() ?? getRecordedGeneratorCandidates() ?? await ensureRuntimeClassSet();
|
|
7438
7457
|
const pendingHmrChange = resolvePendingHmrCandidateChange(generatorCode, file);
|
|
7439
7458
|
const forceFullHmrCssRegeneration = pendingFullHmrCssRegeneration || resolvedConfig?.command === "serve" && pendingHmrCandidateChange !== void 0 && pendingHmrChange === void 0;
|
|
7440
|
-
const runtime =
|
|
7459
|
+
const runtime = fullRuntime;
|
|
7441
7460
|
if (pendingHmrChange && currentGeneratorOptions.target === "weapp" && filterUnsupportedMiniProgramTailwindV4Candidates(pendingHmrChange.addedCandidates).size === 0) {
|
|
7442
|
-
const previousTracedCss = tracedGeneratedCssByFile.get(
|
|
7461
|
+
const previousTracedCss = tracedGeneratedCssByFile.get(fileKey);
|
|
7443
7462
|
if (previousTracedCss !== void 0) {
|
|
7444
7463
|
finishPendingHmrCssTargetFile(file);
|
|
7445
7464
|
return `${createBundlerGeneratedCssMarker("vite", normalizeViteProcessedCssFile(file))}\n${previousTracedCss}`;
|
|
@@ -7461,8 +7480,6 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7461
7480
|
cssHandlerOptions,
|
|
7462
7481
|
generatorCode: generatorTransformCode
|
|
7463
7482
|
}) ?? true);
|
|
7464
|
-
const previousCss = pendingHmrChange && !forceFullHmrCssRegeneration ? cleanGeneratedCssByFile.get(file) : void 0;
|
|
7465
|
-
const previousGeneratorCss = previousCss && !currentGeneratorBranch.isWeb ? normalizeMiniProgramGeneratorCssSource(previousCss, outputFile) : previousCss;
|
|
7466
7483
|
const generated = await hmrTimingRecorder.measure("generateCss.serve", () => generateTailwindV4Css({
|
|
7467
7484
|
opts,
|
|
7468
7485
|
runtimeState,
|
|
@@ -7477,15 +7494,13 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7477
7494
|
generatorPlatform: resolveGeneratorPlatform(),
|
|
7478
7495
|
styleHandler,
|
|
7479
7496
|
debug,
|
|
7480
|
-
previousCss: previousGeneratorCss,
|
|
7481
|
-
previousClassSet: pendingHmrChange && !forceFullHmrCssRegeneration ? generatedClassSetByFile.get(file) : void 0,
|
|
7482
7497
|
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource,
|
|
7483
|
-
disableSourceScan:
|
|
7498
|
+
disableSourceScan: false,
|
|
7484
7499
|
restoreLocalCssImports: !currentGeneratorBranch.isWeb
|
|
7485
7500
|
}), {
|
|
7486
7501
|
file,
|
|
7487
7502
|
memoryDebug: {
|
|
7488
|
-
cleanCacheHit: cleanGeneratedCssByFile.has(
|
|
7503
|
+
cleanCacheHit: cleanGeneratedCssByFile.has(fileKey),
|
|
7489
7504
|
forceFullHmrCssRegeneration,
|
|
7490
7505
|
pendingAddedCandidates: pendingHmrCandidateChange?.addedCandidates.size ?? 0,
|
|
7491
7506
|
pendingCssTargets: pendingHmrCssTargetFiles?.size ?? 0,
|
|
@@ -7512,9 +7527,9 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
|
|
|
7512
7527
|
tokenSources: createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts)
|
|
7513
7528
|
});
|
|
7514
7529
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
7515
|
-
cleanGeneratedCssByFile.set(
|
|
7516
|
-
tracedGeneratedCssByFile.set(
|
|
7517
|
-
generatedClassSetByFile.set(
|
|
7530
|
+
cleanGeneratedCssByFile.set(fileKey, outputCss);
|
|
7531
|
+
tracedGeneratedCssByFile.set(fileKey, tracedCss);
|
|
7532
|
+
generatedClassSetByFile.set(fileKey, new Set(generated.classSet));
|
|
7518
7533
|
const shouldInjectGeneratedCssIntoMain = mainCssChunkMatcher(outputFile, opts.appType) || hasTailwindRootDirectives(generatorTransformCode, { importFallback: currentGeneratorOptions.importFallback }) && !normalizeOutputPathKey(outputFile).includes("/");
|
|
7519
7534
|
recordViteProcessedCssAssetResult(file, tracedCss, {
|
|
7520
7535
|
injectIntoMain: shouldInjectGeneratedCssIntoMain,
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-DnkObu2L.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-Tpgi77vE.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -7086,7 +7086,8 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
7086
7086
|
return false;
|
|
7087
7087
|
};
|
|
7088
7088
|
const resolvesMemberExpressionToIgnore = (path, seen) => {
|
|
7089
|
-
|
|
7089
|
+
const propertyPath = path.get("property");
|
|
7090
|
+
if (propertyMatches(propertyPath)) return true;
|
|
7090
7091
|
const objectPath = path.get("object");
|
|
7091
7092
|
if (objectPath.isIdentifier()) {
|
|
7092
7093
|
const binding = (objectPath?.scope)?.getBinding?.(objectPath.node.name);
|
|
@@ -7153,7 +7154,10 @@ function createTaggedTemplateIgnore({ matcher, names }) {
|
|
|
7153
7154
|
return current;
|
|
7154
7155
|
};
|
|
7155
7156
|
const evaluateTagPath = (tagPath, seen) => {
|
|
7156
|
-
if (tagPath.isCallExpression?.() || tagPath.node.type === "CallExpression")
|
|
7157
|
+
if (tagPath.isCallExpression?.() || tagPath.node.type === "CallExpression") {
|
|
7158
|
+
const calleePath = tagPath.get("callee");
|
|
7159
|
+
return evaluateTagPath(calleePath, seen);
|
|
7160
|
+
}
|
|
7157
7161
|
if (tagPath.isIdentifier()) {
|
|
7158
7162
|
if (matchesIgnoreName(tagPath.node.name)) return true;
|
|
7159
7163
|
const binding = tagPath?.scope?.getBinding?.(tagPath.node.name);
|