weapp-tailwindcss 5.1.4 → 5.1.5
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/generator-css/generation-helpers.d.ts +8 -2
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +6 -3
- package/dist/bundlers/vite/hot-css-modules.d.ts +1 -0
- package/dist/bundlers/vite/source-scan/css-entries.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -1
- package/dist/cli.js +18 -3
- package/dist/cli.mjs +16 -1
- package/dist/{context-DCVMkTRj.js → context-BziwyWy1.js} +21 -6
- package/dist/{context-Bkpmt3ja.mjs → context-rrYZuUBU.mjs} +18 -3
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/index.d.ts +2 -1
- package/dist/{defaults-BhE26nSw.mjs → defaults-9B6aMyZb.mjs} +2 -2
- package/dist/{defaults-DQhgnnn-.js → defaults-nsf4VNMX.js} +2 -2
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/{gulp-Bogfnoki.js → gulp-CuVsZdO9.js} +3 -3
- package/dist/{gulp-0RsqkF_d.mjs → gulp-ygWfmOqh.mjs} +3 -3
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BV6nFPoT.js → hmr-timing-BKdCeIrn.js} +207 -67
- package/dist/{hmr-timing-BRNaz8Od.mjs → hmr-timing-Dh_nn3w5.mjs} +207 -67
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/js/js-string-escape.d.ts +1 -0
- 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/{source-candidate-scan-signature-BB1hvW68.mjs → source-candidate-scan-signature-DATRnS1X.mjs} +157 -6
- package/dist/{source-candidate-scan-signature-CaDT0gkj.js → source-candidate-scan-signature-DIj9m4wB.js} +168 -5
- package/dist/style-injector/internal.d.ts +7 -0
- package/dist/style-injector/options.d.ts +25 -0
- package/dist/tailwindcss/v4/preflight.d.ts +4 -0
- package/dist/{tailwindcss-D2xs4OEu.js → tailwindcss-BwoNQ3t8.js} +52 -12
- package/dist/{tailwindcss-D0JF0fuZ.mjs → tailwindcss-C-uM4rB8.mjs} +47 -13
- package/dist/{transform-BP86eSZp.mjs → transform-DHLemtaX.mjs} +1 -1
- package/dist/{transform-CXCQ28Tc.js → transform-KLD1tJdb.js} +1 -1
- package/dist/typedoc.export.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/user-defined-options/general.d.ts +2 -0
- package/dist/{vite-BYgT1ir9.js → vite-Yp14HNyS.js} +101 -37
- package/dist/{vite-B1SlBmqO.mjs → vite-cH0tTMHc.mjs} +101 -37
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +276 -83
- package/dist/{webpack-Bg6pefpb.mjs → webpack-DBhmJ-_P.mjs} +62 -18
- package/dist/{webpack-khSwkXP5.js → webpack-DN3tgLbF.js} +61 -17
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +16 -5
|
@@ -2,10 +2,10 @@ import { resolveImplicitAppTypeFromViteRoot } from "./framework.mjs";
|
|
|
2
2
|
import { C as hasTailwindRootDirectives, D as normalizeTailwindSourceForGenerator, F as hasTailwindGeneratedCssMarkers, G as getTailwindV4IncrementalGenerateCacheStats, O as parseImportRequest, S as hasTailwindNonRootGenerationDirectives, T as normalizeTailwindConfigDirectives, _ as resolveTailwindcssOptions, a as filterTailwindV4CssSourceRoots, b as hasLocalCssImport, ct as omitUndefined, d as normalizeCssEntries, f as findNearestPackageRoot, k as removeTailwindSourceDirectives, o as hasConfiguredTailwindV4CssRoots, rt as resolveTailwindV4CssSourceBase, s as upsertTailwindV4CssSource, st as filterUnsupportedMiniProgramTailwindV4Candidates, u as isTailwindV4CssEntry, w as hasTailwindSourceDirectives, x as hasTailwindApplyDirective } from "./v4-engine-BuuYDXt1.mjs";
|
|
3
3
|
import { a as resolveGeneratorRuntimeBranch, c as shouldUseNativeAppCssBranch, i as normalizeWeappTailwindcssGeneratorOptions, s as shouldUseMiniProgramCssBranch } from "./generator-24-HgU9F.mjs";
|
|
4
4
|
import { o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
|
|
5
|
-
import { C as normalizeFrameworkStylePlatform, S as createDebug, _ as toCustomAttributesEntities, a as vitePluginName, l as shouldSkipJsTransform, m as replaceWxml, n as normalizeStyleHandlerMajorVersion, t as getCompilerContext, v as collectRuntimeClassSet, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./context-
|
|
6
|
-
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-
|
|
7
|
-
import { A as hasMiniProgramCssSpecificityPlaceholders, F as createCssTokenSourceMap, L as processCachedTask, M as stripMiniProgramCssSpecificityPlaceholders, N as annotateCssSourceTrace, P as createCssSourceTraceCacheSignature, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, d as validateCandidatesByGenerator, g as mergeMarkedUserLayerComponentsCss, h as extractMarkedUserLayerComponentsCss, m as runWithConcurrency, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, t as createHmrTimingRecorder } from "./hmr-timing-
|
|
8
|
-
import { A as isSourceStyleRequest, C as resolvePluginDisabledState, D as isHTMLRequest, E as isCSSRequest, M as normalizeOutputPathKey, O as normalizePath, P as toAbsoluteOutputPath, S as resolvePackageDir, T as formatPostcssSourceMap, _ as generateTailwindV4Css, a as createJsHashSalt, b as parseBundlerGeneratedCssMarkerBlocks, c as hasRuntimeAffectingSourceChanges, f as createBundleBuildState, g as createBundleModuleGraphOptions, h as applyLinkedResults, i as createCandidateSignature, j as stripRequestQuery, k as slash, l as summarizeStringDiff, m as createRuntimeAffectingSourceSignature, n as createScopedGeneratorCandidateSignature, o as createLinkedImpactSignature, p as updateBundleBuildState, r as createScopedGeneratorRuntime, s as getSnapshotHash, t as createSourceCandidateScanSignature, u as buildBundleSnapshot, v as createBundlerGeneratedCssMarker, w as cleanUrl, x as stripBundlerGeneratedCssMarkers, y as hasBundlerGeneratedCssMarker } from "./source-candidate-scan-signature-
|
|
5
|
+
import { C as normalizeFrameworkStylePlatform, S as createDebug, _ as toCustomAttributesEntities, a as vitePluginName, l as shouldSkipJsTransform, m as replaceWxml, n as normalizeStyleHandlerMajorVersion, t as getCompilerContext, v as collectRuntimeClassSet, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./context-rrYZuUBU.mjs";
|
|
6
|
+
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-C-uM4rB8.mjs";
|
|
7
|
+
import { A as hasMiniProgramCssSpecificityPlaceholders, F as createCssTokenSourceMap, L as processCachedTask, M as stripMiniProgramCssSpecificityPlaceholders, N as annotateCssSourceTrace, P as createCssSourceTraceCacheSignature, T as scoreTailwindV4CssSourceFileMatch, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, d as validateCandidatesByGenerator, g as mergeMarkedUserLayerComponentsCss, h as extractMarkedUserLayerComponentsCss, m as runWithConcurrency, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, t as createHmrTimingRecorder } from "./hmr-timing-Dh_nn3w5.mjs";
|
|
8
|
+
import { A as isSourceStyleRequest, C as resolvePluginDisabledState, D as isHTMLRequest, E as isCSSRequest, F as createBuiltinViteStyleInjectorPlugins, M as normalizeOutputPathKey, O as normalizePath, P as toAbsoluteOutputPath, S as resolvePackageDir, T as formatPostcssSourceMap, _ as generateTailwindV4Css, a as createJsHashSalt, b as parseBundlerGeneratedCssMarkerBlocks, c as hasRuntimeAffectingSourceChanges, f as createBundleBuildState, g as createBundleModuleGraphOptions, h as applyLinkedResults, i as createCandidateSignature, j as stripRequestQuery, k as slash, l as summarizeStringDiff, m as createRuntimeAffectingSourceSignature, n as createScopedGeneratorCandidateSignature, o as createLinkedImpactSignature, p as updateBundleBuildState, r as createScopedGeneratorRuntime, s as getSnapshotHash, t as createSourceCandidateScanSignature, u as buildBundleSnapshot, v as createBundlerGeneratedCssMarker, w as cleanUrl, x as stripBundlerGeneratedCssMarkers, y as hasBundlerGeneratedCssMarker } from "./source-candidate-scan-signature-DATRnS1X.mjs";
|
|
9
9
|
import { t as logger$1 } from "./logger-BNzxZbZj.mjs";
|
|
10
10
|
import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
11
11
|
import path from "node:path";
|
|
@@ -509,7 +509,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
509
509
|
//#region src/uni-app-x/vite.ts
|
|
510
510
|
let transformUVuePromise;
|
|
511
511
|
function loadTransformUVue() {
|
|
512
|
-
transformUVuePromise ?? (transformUVuePromise = import("./transform-
|
|
512
|
+
transformUVuePromise ?? (transformUVuePromise = import("./transform-DHLemtaX.mjs").then((mod) => mod.transformUVue));
|
|
513
513
|
return transformUVuePromise;
|
|
514
514
|
}
|
|
515
515
|
const preprocessorLangs = /* @__PURE__ */ new Set([
|
|
@@ -1922,8 +1922,14 @@ function resolveSourceStyleSourceFromOutputFile(outputFile, snapshot, outputRoot
|
|
|
1922
1922
|
//#endregion
|
|
1923
1923
|
//#region src/bundlers/vite/generate-bundle/subpackages.ts
|
|
1924
1924
|
function readBundleAssetSource(output) {
|
|
1925
|
-
if (output.type !== "asset") return;
|
|
1926
|
-
|
|
1925
|
+
if ("type" in output && output.type !== "asset") return;
|
|
1926
|
+
const source = output.source;
|
|
1927
|
+
if (typeof source === "string") return source;
|
|
1928
|
+
if (typeof source === "function") {
|
|
1929
|
+
const value = source.call(output);
|
|
1930
|
+
return typeof value === "string" ? value : value?.toString();
|
|
1931
|
+
}
|
|
1932
|
+
if (source != null && typeof source.toString === "function") return source.toString();
|
|
1927
1933
|
}
|
|
1928
1934
|
function normalizePackageRoot(root) {
|
|
1929
1935
|
return normalizeOutputPathKey(root).replace(/\/+$/, "");
|
|
@@ -3208,13 +3214,15 @@ function createRememberedCssRuntimeSignature(cssRuntimeSignature, cssRuntimeAffe
|
|
|
3208
3214
|
function normalizeRememberedSourceIdentity(file) {
|
|
3209
3215
|
return normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
3210
3216
|
}
|
|
3211
|
-
function selectBestRememberedCssSourceMatches(sources, outputFile, outputRoot, sourceRoot) {
|
|
3212
|
-
|
|
3217
|
+
function selectBestRememberedCssSourceMatches(sources, outputFile, outputRoot, sourceRoot, options = {}) {
|
|
3218
|
+
const minimumScore = options.minimumScore ?? (options.requirePositiveScore ? 1 : 0);
|
|
3213
3219
|
const scoredMatches = sources.map((remembered) => ({
|
|
3214
3220
|
remembered,
|
|
3215
3221
|
score: Math.max(scoreMatchingStyleFileBase(outputFile, remembered.sourceFile, outputRoot, sourceRoot), scoreMatchingStyleFileBase(outputFile, remembered.outputFile, outputRoot, sourceRoot))
|
|
3216
|
-
})).filter((match) => match.score > 0).sort((a, b) => b.score - a.score);
|
|
3222
|
+
})).filter((match) => match.score >= minimumScore && match.score > 0).sort((a, b) => b.score - a.score);
|
|
3217
3223
|
const bestScore = scoredMatches[0]?.score;
|
|
3224
|
+
if (!bestScore && minimumScore > 0) return [];
|
|
3225
|
+
if (sources.length <= 1) return sources;
|
|
3218
3226
|
return bestScore ? scoredMatches.filter((match) => match.score === bestScore).map((match) => match.remembered) : sources;
|
|
3219
3227
|
}
|
|
3220
3228
|
function findRememberedCssSources(sources, outputFile, file, originalSource, outputRoot, sourceRoot) {
|
|
@@ -3232,11 +3240,16 @@ function findRememberedCssSources(sources, outputFile, file, originalSource, out
|
|
|
3232
3240
|
...originalSource.originalFileNames ?? []
|
|
3233
3241
|
].filter((item) => typeof item === "string" && item.length > 0);
|
|
3234
3242
|
const sourceMatched = rememberedSources.filter((remembered) => originalFiles.some((originalFile) => normalizeRememberedSourceIdentity(remembered.sourceFile) === normalizeRememberedSourceIdentity(originalFile)));
|
|
3235
|
-
if (sourceMatched.length > 0)
|
|
3243
|
+
if (sourceMatched.length > 0) {
|
|
3244
|
+
const scoredSourceMatched = selectBestRememberedCssSourceMatches(sourceMatched, outputFile, outputRoot, sourceRoot, { requirePositiveScore: true });
|
|
3245
|
+
if (scoredSourceMatched.length > 0) return scoredSourceMatched;
|
|
3246
|
+
}
|
|
3236
3247
|
const outputMatched = rememberedSources.filter((remembered) => normalizeOutputPathKey(remembered.outputFile) === normalizeOutputPathKey(outputFile));
|
|
3237
3248
|
if (outputMatched.length > 0) return outputMatched;
|
|
3238
3249
|
if (!hasBundlerGeneratedCssMarker(source) && !hasTailwindGenerationSource(source)) return [];
|
|
3239
3250
|
const scoredMatches = selectBestRememberedCssSourceMatches(rememberedSources, outputFile, outputRoot, sourceRoot);
|
|
3251
|
+
const strongScoredMatches = selectBestRememberedCssSourceMatches(rememberedSources, outputFile, outputRoot, sourceRoot, { minimumScore: 1e5 });
|
|
3252
|
+
if (strongScoredMatches.length > 0 && strongScoredMatches.length < rememberedSources.length) return strongScoredMatches;
|
|
3240
3253
|
return scoredMatches.length === rememberedSources.length ? [] : scoredMatches;
|
|
3241
3254
|
}
|
|
3242
3255
|
function mergeRememberedCssSources(sources, outputFile) {
|
|
@@ -3638,16 +3651,24 @@ function scoreConfiguredTailwindV4SourceForRawSource(rawSource, entrySource) {
|
|
|
3638
3651
|
for (const token of entryTokens) if (rawTokens.has(token)) score += token.startsWith("config:") ? 100 : 1;
|
|
3639
3652
|
return score;
|
|
3640
3653
|
}
|
|
3641
|
-
function
|
|
3642
|
-
if (!file || !subpackageRoots) return;
|
|
3643
|
-
return [...subpackageRoots].find((root) => isSubpackageOutputFile(file, /* @__PURE__ */ new Set([root])));
|
|
3644
|
-
}
|
|
3645
|
-
function isSameSubpackageScope(outputFile, sourceFile, subpackageRoots) {
|
|
3646
|
-
return resolveSubpackageRootForFile(outputFile, subpackageRoots) === resolveSubpackageRootForFile(sourceFile, subpackageRoots);
|
|
3647
|
-
}
|
|
3648
|
-
function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSource, subpackageRoots) {
|
|
3654
|
+
function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSource, options = {}) {
|
|
3649
3655
|
const generationSources = entries.filter((entry) => hasTailwindGenerationSource(entry.source));
|
|
3650
3656
|
if (generationSources.length <= 1) return generationSources[0];
|
|
3657
|
+
const canMatchByOutputPath = Boolean(options.cwd || options.outputRoot || options.projectRoot);
|
|
3658
|
+
const selectByOutputPath = (candidates) => {
|
|
3659
|
+
if (!canMatchByOutputPath) return;
|
|
3660
|
+
const scoredSources = candidates.map((entry) => ({
|
|
3661
|
+
entry,
|
|
3662
|
+
score: scoreTailwindV4CssSourceFileMatch(outputFile, entry.file, {
|
|
3663
|
+
cwd: options.cwd,
|
|
3664
|
+
outputRoot: options.outputRoot,
|
|
3665
|
+
projectRoot: options.projectRoot
|
|
3666
|
+
})
|
|
3667
|
+
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score);
|
|
3668
|
+
const bestScore = scoredSources[0]?.score;
|
|
3669
|
+
const bestSources = bestScore ? scoredSources.filter((item) => item.score === bestScore) : [];
|
|
3670
|
+
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
3671
|
+
};
|
|
3651
3672
|
const selectByRawSourceFingerprint = (candidates) => {
|
|
3652
3673
|
const scoredSources = candidates.map((entry) => ({
|
|
3653
3674
|
entry,
|
|
@@ -3659,14 +3680,10 @@ function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSo
|
|
|
3659
3680
|
};
|
|
3660
3681
|
const rawSourceMatched = selectByRawSourceFingerprint(generationSources);
|
|
3661
3682
|
if (rawSourceMatched) return rawSourceMatched;
|
|
3662
|
-
const
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
return sourceMatchesSubpackage && [...subpackageRoots].some((root) => isSubpackageOutputFile(outputFile, /* @__PURE__ */ new Set([root])) && isSubpackageOutputFile(entry.file, /* @__PURE__ */ new Set([root])));
|
|
3667
|
-
}) : generationSources;
|
|
3668
|
-
const explicitSources = scopedSources.filter((entry) => /@(?:config|source|plugin|custom-variant|theme|utility|variant|apply)\b/.test(entry.source));
|
|
3669
|
-
const candidates = explicitSources.length === 1 ? explicitSources : scopedSources;
|
|
3683
|
+
const explicitSources = generationSources.filter((entry) => /@(?:config|source|plugin|custom-variant|theme|utility|variant|apply)\b/.test(entry.source));
|
|
3684
|
+
const candidates = explicitSources.length === 1 ? explicitSources : generationSources;
|
|
3685
|
+
const outputPathMatched = selectByOutputPath(candidates);
|
|
3686
|
+
if (outputPathMatched) return outputPathMatched;
|
|
3670
3687
|
if (candidates.length === 1) return candidates[0];
|
|
3671
3688
|
return selectByRawSourceFingerprint(candidates);
|
|
3672
3689
|
}
|
|
@@ -4283,6 +4300,11 @@ function createGenerateBundleHook(context) {
|
|
|
4283
4300
|
if (rememberedCssSources.length > 0) rememberedCssSources = await Promise.all(rememberedCssSources.map(async (remembered) => {
|
|
4284
4301
|
return await refreshRememberedCssSource?.(remembered) ?? remembered;
|
|
4285
4302
|
}));
|
|
4303
|
+
rememberedCssSources = rememberedCssSources.filter((remembered) => {
|
|
4304
|
+
if (!configuredTailwindV4CssSourceFileKeysForScope.has(normalizeOutputPathKey(remembered.sourceFile.replace(/[?#].*$/, "")))) return true;
|
|
4305
|
+
const matchedOutputFile = resolveMatchedOutputFileForCurrentAsset(remembered.sourceFile);
|
|
4306
|
+
return !matchedOutputFile || normalizeOutputPathKey(matchedOutputFile) === normalizeOutputPathKey(outputFile);
|
|
4307
|
+
});
|
|
4286
4308
|
let hasUsableRememberedTailwindSource = rememberedCssSources.some((remembered) => hasTailwindGenerationSource(remembered.rawSource) && normalizeOutputPathKey(remembered.sourceFile.replace(/[?#].*$/, "")) !== normalizeOutputPathKey(file));
|
|
4287
4309
|
const inferredSfcStyleSource = await resolveSfcStyleSourceFromOutputFile(outputFile, snapshot, outDir, opts.tailwindcssBasedir, opts.cssMatcher, getSfcSource, debug);
|
|
4288
4310
|
if (inferredSfcStyleSource) {
|
|
@@ -4295,10 +4317,6 @@ function createGenerateBundleHook(context) {
|
|
|
4295
4317
|
hasUsableRememberedTailwindSource = false;
|
|
4296
4318
|
}
|
|
4297
4319
|
let outputCssHandlerOptions = getCssHandlerOptions(outputFile);
|
|
4298
|
-
if (currentSubpackageRoots && rememberedCssSources.length > 0 && rememberedCssSources.some((remembered) => configuredTailwindV4CssSourceFileKeysForScope.has(normalizeOutputPathKey(remembered.sourceFile.replace(/[?#].*$/, ""))) && !isSameSubpackageScope(outputFile, remembered.sourceFile, currentSubpackageRoots))) {
|
|
4299
|
-
rememberedCssSources = [];
|
|
4300
|
-
hasUsableRememberedTailwindSource = false;
|
|
4301
|
-
}
|
|
4302
4320
|
if (isTemporaryCssAssetFile(outputFile) && hasTailwindGenerationSource(rawSource)) {
|
|
4303
4321
|
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile, rawSource);
|
|
4304
4322
|
if (resolvedTemporarySource) {
|
|
@@ -4352,7 +4370,11 @@ function createGenerateBundleHook(context) {
|
|
|
4352
4370
|
}
|
|
4353
4371
|
} else if (hasTailwindGenerationSource(rawSource) && (originalSource.originalFileNames?.length ?? 0) === 0) {
|
|
4354
4372
|
const availableConfiguredTailwindV4CssSourceEntries = configuredTailwindV4CssSourceEntries.filter((entry) => !usedConfiguredTailwindV4CssSourceFiles.has(normalizeOutputPathKey(entry.file)));
|
|
4355
|
-
const configuredGenerationSource = selectTailwindV4GenerationCssSourceForOutput(outputFile, availableConfiguredTailwindV4CssSourceEntries, rawSource,
|
|
4373
|
+
const configuredGenerationSource = selectTailwindV4GenerationCssSourceForOutput(outputFile, availableConfiguredTailwindV4CssSourceEntries, rawSource, {
|
|
4374
|
+
cwd: opts.tailwindcssBasedir,
|
|
4375
|
+
outputRoot: outDir,
|
|
4376
|
+
projectRoot: sourceRoot ?? rootDir
|
|
4377
|
+
});
|
|
4356
4378
|
if (configuredGenerationSource && !hasViteProcessedCssResultForSource(configuredGenerationSource.file, getViteProcessedCssAssetResults)) {
|
|
4357
4379
|
outputFile = resolveMatchedOutputFileForCurrentAsset(configuredGenerationSource.file) ?? outputFile;
|
|
4358
4380
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
@@ -4409,12 +4431,13 @@ function createGenerateBundleHook(context) {
|
|
|
4409
4431
|
...getCssHandlerOptions(generatorSourceFile),
|
|
4410
4432
|
isMainChunk: resolvedFromTemporaryCssAsset ? false : outputCssHandlerOptions.isMainChunk
|
|
4411
4433
|
} : getCssHandlerOptions(file);
|
|
4434
|
+
const generatorCssEntries = configuredTailwindV4CssSourceFileKeysForScope.has(normalizeOutputPathKey(generatorSourceFile.replace(/[?#].*$/, ""))) ? [generatorSourceFile] : opts.cssEntries;
|
|
4412
4435
|
const generatorCssHandlerOptions = {
|
|
4413
4436
|
...cssHandlerOptions,
|
|
4414
4437
|
sourceOptions: {
|
|
4415
4438
|
...cssHandlerOptions.sourceOptions ?? {},
|
|
4416
4439
|
sourceFile: generatorSourceFile,
|
|
4417
|
-
cssEntries:
|
|
4440
|
+
cssEntries: generatorCssEntries
|
|
4418
4441
|
}
|
|
4419
4442
|
};
|
|
4420
4443
|
const scopedSourceCandidateGetter = createScopedSourceCandidateGetter(outputFile, generatorCssHandlerOptions);
|
|
@@ -5199,6 +5222,22 @@ function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
|
5199
5222
|
}
|
|
5200
5223
|
return modules;
|
|
5201
5224
|
}
|
|
5225
|
+
function resolveHotSourceModules(ctx) {
|
|
5226
|
+
const modules = [];
|
|
5227
|
+
const seenModules = /* @__PURE__ */ new Set();
|
|
5228
|
+
const collectModule = (mod) => {
|
|
5229
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
5230
|
+
if (isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
5231
|
+
seenModules.add(mod);
|
|
5232
|
+
modules.push(mod);
|
|
5233
|
+
};
|
|
5234
|
+
for (const mod of ctx.modules) collectModule(mod);
|
|
5235
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile(ctx.file) ?? []) collectModule(mod);
|
|
5236
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile(cleanUrl(ctx.file)) ?? []) collectModule(mod);
|
|
5237
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.(ctx.file));
|
|
5238
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.(cleanUrl(ctx.file)));
|
|
5239
|
+
return modules;
|
|
5240
|
+
}
|
|
5202
5241
|
function resolveModuleHotUrl(mod) {
|
|
5203
5242
|
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
5204
5243
|
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
@@ -5718,7 +5757,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
5718
5757
|
return changed;
|
|
5719
5758
|
};
|
|
5720
5759
|
syncCssEntriesFromAnchor(opts.tailwindcssBasedir);
|
|
5721
|
-
const { disabled, customAttributes, onLoad, mainCssChunkMatcher, styleHandler, jsHandler, tailwindRuntime, refreshTailwindcssRuntime, uniAppX, disabledDefaultTemplateHandler } = opts;
|
|
5760
|
+
const { disabled, customAttributes, onLoad, mainCssChunkMatcher, styleHandler, jsHandler, tailwindRuntime, refreshTailwindcssRuntime, uniAppX, disabledDefaultTemplateHandler, styleInjector } = opts;
|
|
5722
5761
|
const initialTailwindRuntime = tailwindRuntime;
|
|
5723
5762
|
const refreshTailwindRuntime = refreshTailwindcssRuntime;
|
|
5724
5763
|
const uniAppXEnabled = isUniAppXEnabled(uniAppX);
|
|
@@ -5897,6 +5936,15 @@ function WeappTailwindcss(options = {}) {
|
|
|
5897
5936
|
const getSourceCandidateSourcesForEntries = (entries, options) => sourceCandidateCollector.sourcesForEntries(entries, options);
|
|
5898
5937
|
const isWatchBuild = () => resolvedConfig?.command === "build" && resolvedConfig.build.watch != null;
|
|
5899
5938
|
const isWatchLikeBuild = () => isWatchBuild() || resolvedConfig?.command === "serve" || process$1.env["WEAPP_TW_WATCH_REGRESSION"] === "1" || process$1.env["WEAPP_TW_HMR_TIMING"] === "1";
|
|
5939
|
+
const isCurrentWebLikeStylePlatform = () => {
|
|
5940
|
+
const platform = resolveViteStylePlatform();
|
|
5941
|
+
return platform ? isWebOrNativeAppPlatform(platform) : generatorBranch.isWeb;
|
|
5942
|
+
};
|
|
5943
|
+
const isNuxtPageMacroHotModule = (id) => {
|
|
5944
|
+
if (typeof id !== "string" || !/[?&]macro=true(?:&|$)/.test(id)) return false;
|
|
5945
|
+
const cleanId = cleanUrl(id);
|
|
5946
|
+
return cleanId.includes("/pages/") && /\.(?:vue|tsx?|jsx?)$/.test(cleanId);
|
|
5947
|
+
};
|
|
5900
5948
|
const hasSourceCandidateScanState = () => sourceCandidateScanSignature !== void 0;
|
|
5901
5949
|
const normalizeSourceScanDependency = (file) => path.normalize(path.resolve(cleanUrl(file)));
|
|
5902
5950
|
const isSourceScanDependency = (file) => sourceScanDependencies.has(normalizeSourceScanDependency(file));
|
|
@@ -6141,7 +6189,8 @@ function WeappTailwindcss(options = {}) {
|
|
|
6141
6189
|
styleHandler,
|
|
6142
6190
|
debug,
|
|
6143
6191
|
previousCss: viteGeneratedCssByFile.get(file),
|
|
6144
|
-
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource
|
|
6192
|
+
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource,
|
|
6193
|
+
restoreLocalCssImports: !generatorBranch.isWeb
|
|
6145
6194
|
});
|
|
6146
6195
|
if (!generated) return;
|
|
6147
6196
|
const tracedCss = annotateCssSourceTrace(finalizeViteMiniProgramCss(generated.css), {
|
|
@@ -6324,13 +6373,27 @@ function WeappTailwindcss(options = {}) {
|
|
|
6324
6373
|
return hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
6325
6374
|
const isSourceCandidateHotUpdate = shouldOwnTailwindGeneration && isSourceCandidateRequest(ctx.file);
|
|
6326
6375
|
await syncChangedSourceCandidateFile(ctx.file);
|
|
6327
|
-
|
|
6376
|
+
const isWebLikeHotUpdate = isCurrentWebLikeStylePlatform();
|
|
6377
|
+
if (isSourceCandidateHotUpdate) {
|
|
6378
|
+
invalidateRecordedGeneratorCandidates();
|
|
6379
|
+
if (isWebLikeHotUpdate) {
|
|
6380
|
+
await refreshRuntimeStateForAutoCssSources?.(true);
|
|
6381
|
+
await syncSourceCandidateScan({ force: true });
|
|
6382
|
+
}
|
|
6383
|
+
}
|
|
6328
6384
|
const cssModules = resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds);
|
|
6329
|
-
|
|
6385
|
+
const sourceModules = isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) ? resolveHotSourceModules(ctx) : ctx.modules;
|
|
6386
|
+
if (isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && !isWebLikeHotUpdate && (!hasSelfAcceptingNonStyleHotModule(sourceModules) && cssModules.length === 0 || cssModules.length > 0 && isUniViteProject())) {
|
|
6387
|
+
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
6388
|
+
return [];
|
|
6389
|
+
}
|
|
6390
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && ctx.modules.some((mod) => isNuxtPageMacroHotModule(mod.id ?? mod.url))) {
|
|
6330
6391
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
6331
6392
|
return [];
|
|
6332
6393
|
}
|
|
6333
6394
|
sendSupplementalCssHotUpdates(ctx, cssModules);
|
|
6395
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file)) return;
|
|
6396
|
+
if (isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && cssModules.length > 0) return [...sourceModules, ...cssModules];
|
|
6334
6397
|
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
6335
6398
|
}, { emit: false });
|
|
6336
6399
|
},
|
|
@@ -6427,6 +6490,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
6427
6490
|
];
|
|
6428
6491
|
if (uniAppXPlugins) plugins.push(...uniAppXPlugins);
|
|
6429
6492
|
plugins.push(cssFinalizerOutputPlugin);
|
|
6493
|
+
plugins.push(...createBuiltinViteStyleInjectorPlugins(styleInjector, () => opts.appType));
|
|
6430
6494
|
return plugins;
|
|
6431
6495
|
}
|
|
6432
6496
|
//#endregion
|
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-Yp14HNyS.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-cH0tTMHc.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|