weapp-tailwindcss 5.1.3 → 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/auto-CrJJc5rK.mjs +13 -0
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +8 -2
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +6 -3
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +1 -1
- package/dist/bundlers/vite/hot-css-modules.d.ts +1 -0
- package/dist/bundlers/vite/processed-css-assets.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-D75pwtBW.js → context-BziwyWy1.js} +56 -9
- package/dist/{context-B07Vf584.mjs → context-rrYZuUBU.mjs} +48 -7
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +1 -1
- package/dist/css-macro/index.d.ts +2 -1
- package/dist/css-macro.mjs +1 -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/framework/platform.d.ts +2 -0
- package/dist/{generator-DNs6ekoC.mjs → generator-24-HgU9F.mjs} +5 -3
- package/dist/{generator-CV_0irKO.js → generator-CilgHtxb.js} +5 -3
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-B_u8NjQL.js → gulp-CuVsZdO9.js} +7 -6
- package/dist/{gulp-aQMZ0M7c.mjs → gulp-ygWfmOqh.mjs} +4 -4
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DOoHun3i.js → hmr-timing-BKdCeIrn.js} +244 -229
- package/dist/{hmr-timing-DLYQTCDb.mjs → hmr-timing-Dh_nn3w5.mjs} +244 -211
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/js-string-escape.d.ts +1 -0
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/{source-candidate-scan-signature-pS87mdHZ.mjs → source-candidate-scan-signature-DATRnS1X.mjs} +165 -8
- package/dist/{source-candidate-scan-signature-DzwebZrf.js → source-candidate-scan-signature-DIj9m4wB.js} +177 -7
- 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/v4-engine/css-macro-source.d.ts +2 -0
- package/dist/{tailwindcss-BSCvrs1p.js → tailwindcss-BwoNQ3t8.js} +56 -16
- package/dist/{tailwindcss-BwV3_Ryc.mjs → tailwindcss-C-uM4rB8.mjs} +51 -17
- package/dist/{transform-Clj7R818.mjs → transform-DHLemtaX.mjs} +1 -1
- package/dist/{transform-fin-OTVD.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/{v4-engine-BklH3CpJ.mjs → v4-engine-BuuYDXt1.mjs} +54 -114
- package/dist/{v4-engine-CKbS27-o.js → v4-engine-CKtsdKxK.js} +57 -111
- package/dist/{vite-CkVMSDDp.js → vite-Yp14HNyS.js} +310 -78
- package/dist/{vite-5Wn0PIzJ.mjs → vite-cH0tTMHc.mjs} +308 -76
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +363 -272
- package/dist/{webpack-DEag6ueE.mjs → webpack-DBhmJ-_P.mjs} +107 -20
- package/dist/{webpack-hvSFaicc.js → webpack-DN3tgLbF.js} +107 -20
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +16 -5
- package/dist/auto-Ba6hDrse.mjs +0 -13
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
2
|
const require_framework = require("./framework.js");
|
|
3
|
-
const require_v4_engine = require("./v4-engine-
|
|
4
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
|
|
4
|
+
const require_generator = require("./generator-CilgHtxb.js");
|
|
5
5
|
const require_utils = require("./utils-D3h8j7Mk.js");
|
|
6
|
-
const require_context = require("./context-
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
9
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
6
|
+
const require_context = require("./context-BziwyWy1.js");
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-BwoNQ3t8.js");
|
|
8
|
+
const require_hmr_timing = require("./hmr-timing-BKdCeIrn.js");
|
|
9
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-DIj9m4wB.js");
|
|
10
10
|
require("./logger-TlKT3xmR.js");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
@@ -515,7 +515,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
515
515
|
//#region src/uni-app-x/vite.ts
|
|
516
516
|
let transformUVuePromise;
|
|
517
517
|
function loadTransformUVue() {
|
|
518
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
518
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-KLD1tJdb.js")).then((mod) => mod.transformUVue));
|
|
519
519
|
return transformUVuePromise;
|
|
520
520
|
}
|
|
521
521
|
const preprocessorLangs = /* @__PURE__ */ new Set([
|
|
@@ -1125,12 +1125,14 @@ function createCssHandlerOptionsCache(options) {
|
|
|
1125
1125
|
const outputRoot = options.getOutputRoot?.();
|
|
1126
1126
|
const from = node_path.default.isAbsolute(file) ? file : outputRoot ? node_path.default.resolve(outputRoot, file) : file;
|
|
1127
1127
|
const extraOptions = options.getExtraOptions?.(file) ?? {};
|
|
1128
|
-
const
|
|
1128
|
+
const dynamicCssOptions = options.getDynamicCssOptions?.() ?? {};
|
|
1129
|
+
const cacheKey = `${majorVersion ?? "unknown"}:${appType ?? "unknown"}:${isMainChunk ? "1" : "0"}:${outputRoot ?? ""}:${file}:${JSON.stringify(extraOptions)}:${JSON.stringify(dynamicCssOptions)}`;
|
|
1129
1130
|
const cached = cssHandlerOptionsCache.get(cacheKey);
|
|
1130
1131
|
if (cached) return cached;
|
|
1131
1132
|
const created = {
|
|
1132
1133
|
isMainChunk,
|
|
1133
1134
|
...extraOptions,
|
|
1135
|
+
...dynamicCssOptions,
|
|
1134
1136
|
postcssOptions: { options: { from } },
|
|
1135
1137
|
majorVersion: require_context.normalizeStyleHandlerMajorVersion(majorVersion),
|
|
1136
1138
|
sourceOptions: { outputRoot }
|
|
@@ -1210,8 +1212,15 @@ function createMatchedCssSourceOutputResolver(options) {
|
|
|
1210
1212
|
const { assetSourceFile, file, originalFileNames, resolveOutputFileFromMatchedCssSource } = options;
|
|
1211
1213
|
return (sourceFile) => {
|
|
1212
1214
|
if (!sourceFile) return;
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
+
const cleanAssetSourceFile = assetSourceFile.replace(/[?#].*$/, "");
|
|
1216
|
+
const cleanSourceFile = sourceFile.replace(/[?#].*$/, "");
|
|
1217
|
+
const sourceHasQuery = cleanSourceFile !== sourceFile;
|
|
1218
|
+
const resolvedSourceOutputFile = resolveOutputFileFromMatchedCssSource(sourceFile);
|
|
1219
|
+
if (require_source_candidate_scan_signature.normalizeOutputPathKey(cleanAssetSourceFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(cleanSourceFile) || originalFileNames?.some((originalFile) => require_source_candidate_scan_signature.normalizeOutputPathKey(originalFile.replace(/[?#].*$/, "")) === require_source_candidate_scan_signature.normalizeOutputPathKey(cleanSourceFile))) {
|
|
1220
|
+
if (!sourceHasQuery && require_source_candidate_scan_signature.normalizeOutputPathKey(cleanAssetSourceFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(cleanSourceFile) && typeof resolvedSourceOutputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedSourceOutputFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file)) return resolvedSourceOutputFile;
|
|
1221
|
+
return file;
|
|
1222
|
+
}
|
|
1223
|
+
return resolvedSourceOutputFile;
|
|
1215
1224
|
};
|
|
1216
1225
|
}
|
|
1217
1226
|
function hasViteProcessedCssResultForSource(sourceFile, getViteProcessedCssAssetResults) {
|
|
@@ -1233,7 +1242,7 @@ function applyCssResultToBundle(options) {
|
|
|
1233
1242
|
const replayAsset = emitOrReplayCssAsset(outputFile, source);
|
|
1234
1243
|
if (replayAsset) bundle[outputFile] = replayAsset;
|
|
1235
1244
|
}
|
|
1236
|
-
originalSource.source = importShellSource ??
|
|
1245
|
+
originalSource.source = importShellSource ?? "";
|
|
1237
1246
|
return;
|
|
1238
1247
|
}
|
|
1239
1248
|
const existingOutput = bundle[outputFile];
|
|
@@ -1919,8 +1928,14 @@ function resolveSourceStyleSourceFromOutputFile(outputFile, snapshot, outputRoot
|
|
|
1919
1928
|
//#endregion
|
|
1920
1929
|
//#region src/bundlers/vite/generate-bundle/subpackages.ts
|
|
1921
1930
|
function readBundleAssetSource(output) {
|
|
1922
|
-
if (output.type !== "asset") return;
|
|
1923
|
-
|
|
1931
|
+
if ("type" in output && output.type !== "asset") return;
|
|
1932
|
+
const source = output.source;
|
|
1933
|
+
if (typeof source === "string") return source;
|
|
1934
|
+
if (typeof source === "function") {
|
|
1935
|
+
const value = source.call(output);
|
|
1936
|
+
return typeof value === "string" ? value : value?.toString();
|
|
1937
|
+
}
|
|
1938
|
+
if (source != null && typeof source.toString === "function") return source.toString();
|
|
1924
1939
|
}
|
|
1925
1940
|
function normalizePackageRoot(root) {
|
|
1926
1941
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(root).replace(/\/+$/, "");
|
|
@@ -2133,6 +2148,7 @@ function shouldInjectViteProcessedCssResult(opts, targetFile, sourceFile, option
|
|
|
2133
2148
|
if (options.injectIntoMain === true) return isRootStyleOutputFile(targetFile) || typeof options.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(options.outputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile);
|
|
2134
2149
|
if (options.injectIntoMain === false) return false;
|
|
2135
2150
|
const targetFileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile);
|
|
2151
|
+
if (typeof options.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(options.outputFile) === targetFileKey) return true;
|
|
2136
2152
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(sourceFile) !== targetFileKey && (opts.mainCssChunkMatcher(sourceFile, opts.appType) || typeof options.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(options.outputFile) !== targetFileKey && opts.mainCssChunkMatcher(options.outputFile, opts.appType));
|
|
2137
2153
|
}
|
|
2138
2154
|
function shouldReplayViteProcessedCssIntoMainCss(opts, file, sourceFile, outputFile, subpackageRoots) {
|
|
@@ -2151,7 +2167,7 @@ function isMiniProgramStyleOutputFile(file) {
|
|
|
2151
2167
|
return /\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
2152
2168
|
}
|
|
2153
2169
|
function shouldPreserveMiniProgramImportShell(opts, file, css) {
|
|
2154
|
-
return (opts.appType === "taro" || opts.appType === "uni-app-vite" || opts.appType === "uni-app-x") && isMiniProgramStyleOutputFile(file) && opts.cssMatcher(file) &&
|
|
2170
|
+
return (opts.appType === "taro" || opts.appType === "uni-app-vite" || opts.appType === "uni-app-x") && isMiniProgramStyleOutputFile(file) && opts.cssMatcher(file) && (0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(css);
|
|
2155
2171
|
}
|
|
2156
2172
|
function resolvePreservedImportShellInjectionTarget(opts, bundle, file, css) {
|
|
2157
2173
|
if (opts.appType !== "taro") return;
|
|
@@ -2168,7 +2184,7 @@ function resolvePreservedImportShellInjectionTarget(opts, bundle, file, css) {
|
|
|
2168
2184
|
}
|
|
2169
2185
|
function shouldUseCssAssetAsMainInjectionTarget(opts, file, records) {
|
|
2170
2186
|
const fileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
2171
|
-
if (!isRootStyleOutputFile(file) && records.some((record) => typeof record.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(record.outputFile) === fileKey)) return
|
|
2187
|
+
if (!isRootStyleOutputFile(file) && records.some((record) => typeof record.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(record.outputFile) === fileKey)) return true;
|
|
2172
2188
|
if (!isRootStyleOutputFile(file)) return records.some((record) => record.injectIntoMain === true && typeof record.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(record.outputFile) === fileKey);
|
|
2173
2189
|
if (records.some((record) => {
|
|
2174
2190
|
if (record.injectIntoMain !== true) return false;
|
|
@@ -2216,6 +2232,12 @@ function collectBundleAssetFiles(bundle) {
|
|
|
2216
2232
|
}
|
|
2217
2233
|
return files;
|
|
2218
2234
|
}
|
|
2235
|
+
function findBundleAssetByOutputFile(bundle, file) {
|
|
2236
|
+
const fileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
2237
|
+
return Object.entries(bundle).find(([bundleFile, output]) => {
|
|
2238
|
+
return output.type === "asset" && require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile$1(bundleFile, output)) === fileKey;
|
|
2239
|
+
})?.[1];
|
|
2240
|
+
}
|
|
2219
2241
|
function isCssImportOnlyBundleAsset(bundle, file, css) {
|
|
2220
2242
|
const importedStyleFiles = collectImportedStyleFiles(css, file);
|
|
2221
2243
|
if (importedStyleFiles.size === 0) return false;
|
|
@@ -2235,6 +2257,13 @@ function isCoveredViteGeneratedSourceAsset(file, existingAssetFiles, resolveVite
|
|
|
2235
2257
|
const resolvedOutputFile = require_source_candidate_scan_signature.normalizeOutputPathKey(resolveViteProcessedCssOutputFile?.(file) ?? file);
|
|
2236
2258
|
return resolvedOutputFile !== require_source_candidate_scan_signature.normalizeOutputPathKey(file) && existingAssetFiles.has(resolvedOutputFile);
|
|
2237
2259
|
}
|
|
2260
|
+
function resolveViteGeneratedCssMarkerOutputFile(file, markerFile, existingAssetFiles, resolveViteProcessedCssOutputFile) {
|
|
2261
|
+
const resolvedFromFile = require_source_candidate_scan_signature.normalizeOutputPathKey(resolveViteProcessedCssOutputFile?.(file) ?? file);
|
|
2262
|
+
if (!markerFile) return resolvedFromFile;
|
|
2263
|
+
const resolvedFromMarker = require_source_candidate_scan_signature.normalizeOutputPathKey(resolveViteProcessedCssOutputFile?.(markerFile) ?? markerFile);
|
|
2264
|
+
if (resolvedFromMarker !== resolvedFromFile && existingAssetFiles.has(resolvedFromMarker)) return resolvedFromMarker;
|
|
2265
|
+
return resolvedFromFile;
|
|
2266
|
+
}
|
|
2238
2267
|
function isSourceRootPrefixedOutputFile(file, outputFile) {
|
|
2239
2268
|
const fileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
2240
2269
|
const outputFileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
@@ -2251,10 +2280,30 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
2251
2280
|
let nextCss = resolveViteProcessedCssAssetSource(file, rawSource, options.resolveViteProcessedCssOutputFile);
|
|
2252
2281
|
const singleMarkerFile = collectSingleViteGeneratedCssMarkerFile(rawSource);
|
|
2253
2282
|
if (singleMarkerFile && (options.subpackageRoots == null || !isSubpackageOutputFile(file, options.subpackageRoots)) && shouldFilterRootGeneratedCssMarkerForScopedAsset(file, singleMarkerFile, options.resolveViteProcessedCssOutputFile)) nextCss = removeCssCoveredByRootStyleBundleSources(bundle, file, nextCss);
|
|
2283
|
+
nextCss = options.transformCss?.(nextCss, file) ?? nextCss;
|
|
2254
2284
|
if (nextCss !== rawSource) output.source = nextCss;
|
|
2255
2285
|
options.markCssAssetProcessed?.(output, file);
|
|
2256
2286
|
options.recordCssAssetResult?.(file, nextCss);
|
|
2257
|
-
const resolvedOutputFile = options.resolveViteProcessedCssOutputFile
|
|
2287
|
+
const resolvedOutputFile = resolveViteGeneratedCssMarkerOutputFile(file, singleMarkerFile, existingAssetFiles, options.resolveViteProcessedCssOutputFile);
|
|
2288
|
+
if (singleMarkerFile && require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedOutputFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file) && !isRootStyleOutputFile(resolvedOutputFile) && existingAssetFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedOutputFile))) {
|
|
2289
|
+
const targetAsset = findBundleAssetByOutputFile(bundle, resolvedOutputFile);
|
|
2290
|
+
if (targetAsset) {
|
|
2291
|
+
const targetRawSource = readAssetSource$2(targetAsset);
|
|
2292
|
+
const targetNextCss = appendCss$1(targetRawSource, (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(targetRawSource, nextCss).trim());
|
|
2293
|
+
if (targetNextCss !== targetRawSource) {
|
|
2294
|
+
targetAsset.source = targetNextCss;
|
|
2295
|
+
options.markCssAssetProcessed?.(targetAsset, resolvedOutputFile);
|
|
2296
|
+
options.recordCssAssetResult?.(resolvedOutputFile, targetNextCss);
|
|
2297
|
+
}
|
|
2298
|
+
clearAssetSource(output);
|
|
2299
|
+
options.recordCssAssetResult?.(file, "");
|
|
2300
|
+
options.recordViteProcessedCssAssetResult?.(resolvedOutputFile, targetNextCss, { outputFile: resolvedOutputFile });
|
|
2301
|
+
if (isCoveredViteGeneratedSourceAsset(file, existingAssetFiles, options.resolveViteProcessedCssOutputFile)) delete bundle[bundleFile];
|
|
2302
|
+
options.debug?.("move vite-generated css asset by marker source: %s -> %s bytes=%d", file, resolvedOutputFile, nextCss.length);
|
|
2303
|
+
collected++;
|
|
2304
|
+
continue;
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2258
2307
|
const shouldReplayIntoMainCss = options.opts != null && shouldReplayViteProcessedCssIntoMainCss(options.opts, file, singleMarkerFile, resolvedOutputFile, options.subpackageRoots);
|
|
2259
2308
|
options.recordViteProcessedCssAssetResult?.(file, nextCss, {
|
|
2260
2309
|
injectIntoMain: shouldReplayIntoMainCss || void 0,
|
|
@@ -2713,9 +2762,9 @@ function normalizeTaroRootImportShellAssets(bundle, options) {
|
|
|
2713
2762
|
const originOutput = Object.entries(bundle).find(([bundleFile, output]) => output.type === "asset" && require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile(bundleFile, output)) === require_source_candidate_scan_signature.normalizeOutputPathKey(originFile))?.[1];
|
|
2714
2763
|
if (originOutput?.type !== "asset") continue;
|
|
2715
2764
|
const rootSource = readAssetSource(rootOutput);
|
|
2716
|
-
if (
|
|
2765
|
+
if ((0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(rootSource)) continue;
|
|
2717
2766
|
const originSource = readAssetSource(originOutput);
|
|
2718
|
-
if (
|
|
2767
|
+
if ((0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(originSource)) {
|
|
2719
2768
|
const importedFile = resolveSingleCssImportOutputFile(originFile, originSource);
|
|
2720
2769
|
if (importedFile && require_source_candidate_scan_signature.normalizeOutputPathKey(importedFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(rootFile)) continue;
|
|
2721
2770
|
} else if (originSource.trim().length > 0 && originSource.trim() !== rootSource.trim()) continue;
|
|
@@ -3171,13 +3220,15 @@ function createRememberedCssRuntimeSignature(cssRuntimeSignature, cssRuntimeAffe
|
|
|
3171
3220
|
function normalizeRememberedSourceIdentity(file) {
|
|
3172
3221
|
return require_source_candidate_scan_signature.normalizeOutputPathKey(file.replace(/[?#].*$/, ""));
|
|
3173
3222
|
}
|
|
3174
|
-
function selectBestRememberedCssSourceMatches(sources, outputFile, outputRoot, sourceRoot) {
|
|
3175
|
-
|
|
3223
|
+
function selectBestRememberedCssSourceMatches(sources, outputFile, outputRoot, sourceRoot, options = {}) {
|
|
3224
|
+
const minimumScore = options.minimumScore ?? (options.requirePositiveScore ? 1 : 0);
|
|
3176
3225
|
const scoredMatches = sources.map((remembered) => ({
|
|
3177
3226
|
remembered,
|
|
3178
3227
|
score: Math.max(scoreMatchingStyleFileBase(outputFile, remembered.sourceFile, outputRoot, sourceRoot), scoreMatchingStyleFileBase(outputFile, remembered.outputFile, outputRoot, sourceRoot))
|
|
3179
|
-
})).filter((match) => match.score > 0).sort((a, b) => b.score - a.score);
|
|
3228
|
+
})).filter((match) => match.score >= minimumScore && match.score > 0).sort((a, b) => b.score - a.score);
|
|
3180
3229
|
const bestScore = scoredMatches[0]?.score;
|
|
3230
|
+
if (!bestScore && minimumScore > 0) return [];
|
|
3231
|
+
if (sources.length <= 1) return sources;
|
|
3181
3232
|
return bestScore ? scoredMatches.filter((match) => match.score === bestScore).map((match) => match.remembered) : sources;
|
|
3182
3233
|
}
|
|
3183
3234
|
function findRememberedCssSources(sources, outputFile, file, originalSource, outputRoot, sourceRoot) {
|
|
@@ -3195,11 +3246,16 @@ function findRememberedCssSources(sources, outputFile, file, originalSource, out
|
|
|
3195
3246
|
...originalSource.originalFileNames ?? []
|
|
3196
3247
|
].filter((item) => typeof item === "string" && item.length > 0);
|
|
3197
3248
|
const sourceMatched = rememberedSources.filter((remembered) => originalFiles.some((originalFile) => normalizeRememberedSourceIdentity(remembered.sourceFile) === normalizeRememberedSourceIdentity(originalFile)));
|
|
3198
|
-
if (sourceMatched.length > 0)
|
|
3249
|
+
if (sourceMatched.length > 0) {
|
|
3250
|
+
const scoredSourceMatched = selectBestRememberedCssSourceMatches(sourceMatched, outputFile, outputRoot, sourceRoot, { requirePositiveScore: true });
|
|
3251
|
+
if (scoredSourceMatched.length > 0) return scoredSourceMatched;
|
|
3252
|
+
}
|
|
3199
3253
|
const outputMatched = rememberedSources.filter((remembered) => require_source_candidate_scan_signature.normalizeOutputPathKey(remembered.outputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile));
|
|
3200
3254
|
if (outputMatched.length > 0) return outputMatched;
|
|
3201
3255
|
if (!require_source_candidate_scan_signature.hasBundlerGeneratedCssMarker(source) && !hasTailwindGenerationSource(source)) return [];
|
|
3202
3256
|
const scoredMatches = selectBestRememberedCssSourceMatches(rememberedSources, outputFile, outputRoot, sourceRoot);
|
|
3257
|
+
const strongScoredMatches = selectBestRememberedCssSourceMatches(rememberedSources, outputFile, outputRoot, sourceRoot, { minimumScore: 1e5 });
|
|
3258
|
+
if (strongScoredMatches.length > 0 && strongScoredMatches.length < rememberedSources.length) return strongScoredMatches;
|
|
3203
3259
|
return scoredMatches.length === rememberedSources.length ? [] : scoredMatches;
|
|
3204
3260
|
}
|
|
3205
3261
|
function mergeRememberedCssSources(sources, outputFile) {
|
|
@@ -3551,6 +3607,14 @@ function resolveCurrentSourceCandidateSource(options) {
|
|
|
3551
3607
|
}
|
|
3552
3608
|
//#endregion
|
|
3553
3609
|
//#region src/bundlers/vite/generate-bundle/tailwind-v4-css-source.ts
|
|
3610
|
+
function createStableTextSignature(input) {
|
|
3611
|
+
let hash = 2166136261;
|
|
3612
|
+
for (let i = 0; i < input.length; i++) {
|
|
3613
|
+
hash ^= input.charCodeAt(i);
|
|
3614
|
+
hash = Math.imul(hash, 16777619);
|
|
3615
|
+
}
|
|
3616
|
+
return (hash >>> 0).toString(36);
|
|
3617
|
+
}
|
|
3554
3618
|
function collectTailwindV4SourceFingerprint(source) {
|
|
3555
3619
|
const tokens = /* @__PURE__ */ new Set();
|
|
3556
3620
|
const add = (prefix, value) => {
|
|
@@ -3562,6 +3626,22 @@ function collectTailwindV4SourceFingerprint(source) {
|
|
|
3562
3626
|
add("config-request", configRequest.replace(/\\/g, "/"));
|
|
3563
3627
|
}
|
|
3564
3628
|
for (const match of source.matchAll(/@source\s+(not\s+)?(["'])(.+?)\2\s*;?/g)) add(match[1] ? "source:not" : "source", match[3]);
|
|
3629
|
+
for (const match of source.matchAll(/@plugin\s+(["'])(.+?)\1\s*(?:\{([\s\S]*?)\}|;)/g)) {
|
|
3630
|
+
const request = match[2];
|
|
3631
|
+
const optionBlock = match[3];
|
|
3632
|
+
add("plugin", request);
|
|
3633
|
+
add("plugin-request", request.replace(/\\/g, "/"));
|
|
3634
|
+
if (optionBlock !== void 0) add("plugin-options", `${request}:${createStableTextSignature(optionBlock)}`);
|
|
3635
|
+
}
|
|
3636
|
+
try {
|
|
3637
|
+
_weapp_tailwindcss_postcss.postcss.parse(source).walkAtRules("plugin", (rule) => {
|
|
3638
|
+
const request = /^(['"])(.+?)\1/.exec(rule.params.trim())?.[2];
|
|
3639
|
+
if (!request || !rule.nodes?.length) return;
|
|
3640
|
+
rule.walkDecls((decl) => {
|
|
3641
|
+
add("plugin-option", `${request}:${decl.prop}:${decl.value}`);
|
|
3642
|
+
});
|
|
3643
|
+
});
|
|
3644
|
+
} catch {}
|
|
3565
3645
|
for (const match of source.matchAll(/@custom-variant\s+([^{\s]+)/g)) add("custom-variant", match[1]);
|
|
3566
3646
|
for (const match of source.matchAll(/@(?:theme|utility|variant|layer)\s+([^{;\s]+)/g)) add("directive", match[1]);
|
|
3567
3647
|
for (const match of source.matchAll(/--[\w-]+(?=\s*:)/g)) add("theme-token", match[0]);
|
|
@@ -3577,16 +3657,24 @@ function scoreConfiguredTailwindV4SourceForRawSource(rawSource, entrySource) {
|
|
|
3577
3657
|
for (const token of entryTokens) if (rawTokens.has(token)) score += token.startsWith("config:") ? 100 : 1;
|
|
3578
3658
|
return score;
|
|
3579
3659
|
}
|
|
3580
|
-
function
|
|
3581
|
-
if (!file || !subpackageRoots) return;
|
|
3582
|
-
return [...subpackageRoots].find((root) => isSubpackageOutputFile(file, /* @__PURE__ */ new Set([root])));
|
|
3583
|
-
}
|
|
3584
|
-
function isSameSubpackageScope(outputFile, sourceFile, subpackageRoots) {
|
|
3585
|
-
return resolveSubpackageRootForFile(outputFile, subpackageRoots) === resolveSubpackageRootForFile(sourceFile, subpackageRoots);
|
|
3586
|
-
}
|
|
3587
|
-
function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSource, subpackageRoots) {
|
|
3660
|
+
function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSource, options = {}) {
|
|
3588
3661
|
const generationSources = entries.filter((entry) => hasTailwindGenerationSource(entry.source));
|
|
3589
3662
|
if (generationSources.length <= 1) return generationSources[0];
|
|
3663
|
+
const canMatchByOutputPath = Boolean(options.cwd || options.outputRoot || options.projectRoot);
|
|
3664
|
+
const selectByOutputPath = (candidates) => {
|
|
3665
|
+
if (!canMatchByOutputPath) return;
|
|
3666
|
+
const scoredSources = candidates.map((entry) => ({
|
|
3667
|
+
entry,
|
|
3668
|
+
score: require_hmr_timing.scoreTailwindV4CssSourceFileMatch(outputFile, entry.file, {
|
|
3669
|
+
cwd: options.cwd,
|
|
3670
|
+
outputRoot: options.outputRoot,
|
|
3671
|
+
projectRoot: options.projectRoot
|
|
3672
|
+
})
|
|
3673
|
+
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score);
|
|
3674
|
+
const bestScore = scoredSources[0]?.score;
|
|
3675
|
+
const bestSources = bestScore ? scoredSources.filter((item) => item.score === bestScore) : [];
|
|
3676
|
+
return bestSources.length === 1 ? bestSources[0]?.entry : void 0;
|
|
3677
|
+
};
|
|
3590
3678
|
const selectByRawSourceFingerprint = (candidates) => {
|
|
3591
3679
|
const scoredSources = candidates.map((entry) => ({
|
|
3592
3680
|
entry,
|
|
@@ -3598,14 +3686,10 @@ function selectTailwindV4GenerationCssSourceForOutput(outputFile, entries, rawSo
|
|
|
3598
3686
|
};
|
|
3599
3687
|
const rawSourceMatched = selectByRawSourceFingerprint(generationSources);
|
|
3600
3688
|
if (rawSourceMatched) return rawSourceMatched;
|
|
3601
|
-
const
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
return sourceMatchesSubpackage && [...subpackageRoots].some((root) => isSubpackageOutputFile(outputFile, /* @__PURE__ */ new Set([root])) && isSubpackageOutputFile(entry.file, /* @__PURE__ */ new Set([root])));
|
|
3606
|
-
}) : generationSources;
|
|
3607
|
-
const explicitSources = scopedSources.filter((entry) => /@(?:config|source|plugin|custom-variant|theme|utility|variant|apply)\b/.test(entry.source));
|
|
3608
|
-
const candidates = explicitSources.length === 1 ? explicitSources : scopedSources;
|
|
3689
|
+
const explicitSources = generationSources.filter((entry) => /@(?:config|source|plugin|custom-variant|theme|utility|variant|apply)\b/.test(entry.source));
|
|
3690
|
+
const candidates = explicitSources.length === 1 ? explicitSources : generationSources;
|
|
3691
|
+
const outputPathMatched = selectByOutputPath(candidates);
|
|
3692
|
+
if (outputPathMatched) return outputPathMatched;
|
|
3609
3693
|
if (candidates.length === 1) return candidates[0];
|
|
3610
3694
|
return selectByRawSourceFingerprint(candidates);
|
|
3611
3695
|
}
|
|
@@ -3623,7 +3707,7 @@ function createTemporaryCssAssetSourceResolver(entries) {
|
|
|
3623
3707
|
const queuedEntries = entries.filter((entry) => {
|
|
3624
3708
|
const entryFile = normalizeCssSourceKey(entry.file);
|
|
3625
3709
|
const outputFile = normalizeCssSourceKey(entry.outputFile);
|
|
3626
|
-
if (
|
|
3710
|
+
if (outputFile === entryFile || !outputFile.includes("/") || seenEntryFiles.has(entryFile)) return false;
|
|
3627
3711
|
seenEntryFiles.add(entryFile);
|
|
3628
3712
|
return true;
|
|
3629
3713
|
});
|
|
@@ -3634,9 +3718,16 @@ function createTemporaryCssAssetSourceResolver(entries) {
|
|
|
3634
3718
|
if (!sourceFile) return;
|
|
3635
3719
|
usedEntryFiles.add(normalizeCssSourceKey(sourceFile));
|
|
3636
3720
|
},
|
|
3637
|
-
resolve(outputFile) {
|
|
3721
|
+
resolve(outputFile, rawSource) {
|
|
3638
3722
|
if (!isTemporaryCssAssetFile(outputFile)) return;
|
|
3639
|
-
const
|
|
3723
|
+
const availableEntries = queuedEntries.filter((item) => !usedEntryFiles.has(normalizeCssSourceKey(item.file)));
|
|
3724
|
+
const scoredEntries = rawSource ? availableEntries.map((entry) => ({
|
|
3725
|
+
entry,
|
|
3726
|
+
score: scoreConfiguredTailwindV4SourceForRawSource(rawSource, entry.source)
|
|
3727
|
+
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score) : [];
|
|
3728
|
+
const bestScore = scoredEntries[0]?.score;
|
|
3729
|
+
const bestEntries = bestScore ? scoredEntries.filter((item) => item.score === bestScore) : [];
|
|
3730
|
+
const entry = bestEntries.length === 1 ? bestEntries[0]?.entry : availableEntries.find((item) => hasTailwindGenerationSource(item.source));
|
|
3640
3731
|
if (!entry) return;
|
|
3641
3732
|
usedEntryFiles.add(normalizeCssSourceKey(entry.file));
|
|
3642
3733
|
return {
|
|
@@ -4052,7 +4143,7 @@ function createGenerateBundleHook(context) {
|
|
|
4052
4143
|
...[...runtimeLinkedCssFiles].filter((file) => !snapshot.sourceHashByFile.has(file)).map((file) => {
|
|
4053
4144
|
const outputFile = resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget, shouldPreserveAppCssExtension, sourceRoot, defaultStyleOutputExtension, bundleFiles);
|
|
4054
4145
|
const inferredSourceStyle = resolveSourceStyleSourceFromOutputFile(outputFile, snapshot, outDir, sourceRoot, getCssSource, jsImportedCssFiles.has(file) ? getSourceCandidateSources : void 0, getConfiguredTailwindV4CssSourceEntries().map((entry) => [entry.file, entry.source]), debug);
|
|
4055
|
-
return inferredSourceStyle && currentSubpackageRoots
|
|
4146
|
+
return inferredSourceStyle && currentSubpackageRoots ? {
|
|
4056
4147
|
file: inferredSourceStyle.sourceFile,
|
|
4057
4148
|
outputFile,
|
|
4058
4149
|
source: inferredSourceStyle.rawSource
|
|
@@ -4063,6 +4154,14 @@ function createGenerateBundleHook(context) {
|
|
|
4063
4154
|
outputFile: remembered.outputFile,
|
|
4064
4155
|
source: remembered.rawSource
|
|
4065
4156
|
})),
|
|
4157
|
+
...getConfiguredTailwindV4CssSourceEntries().map((entry) => {
|
|
4158
|
+
const outputFile = resolveMatchedCssSourceOutputFile(entry.file);
|
|
4159
|
+
return outputFile ? {
|
|
4160
|
+
file: entry.file,
|
|
4161
|
+
outputFile,
|
|
4162
|
+
source: entry.source
|
|
4163
|
+
} : void 0;
|
|
4164
|
+
}).filter((entry) => entry != null),
|
|
4066
4165
|
...configuredTailwindV4CssSourceEntriesForScope.map((entry) => {
|
|
4067
4166
|
const outputFile = resolveMatchedCssSourceOutputFile(entry.file);
|
|
4068
4167
|
return outputFile && currentSubpackageRoots && isSubpackageOutputFile(outputFile, currentSubpackageRoots) ? {
|
|
@@ -4207,6 +4306,11 @@ function createGenerateBundleHook(context) {
|
|
|
4207
4306
|
if (rememberedCssSources.length > 0) rememberedCssSources = await Promise.all(rememberedCssSources.map(async (remembered) => {
|
|
4208
4307
|
return await refreshRememberedCssSource?.(remembered) ?? remembered;
|
|
4209
4308
|
}));
|
|
4309
|
+
rememberedCssSources = rememberedCssSources.filter((remembered) => {
|
|
4310
|
+
if (!configuredTailwindV4CssSourceFileKeysForScope.has(require_source_candidate_scan_signature.normalizeOutputPathKey(remembered.sourceFile.replace(/[?#].*$/, "")))) return true;
|
|
4311
|
+
const matchedOutputFile = resolveMatchedOutputFileForCurrentAsset(remembered.sourceFile);
|
|
4312
|
+
return !matchedOutputFile || require_source_candidate_scan_signature.normalizeOutputPathKey(matchedOutputFile) === require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
4313
|
+
});
|
|
4210
4314
|
let hasUsableRememberedTailwindSource = rememberedCssSources.some((remembered) => hasTailwindGenerationSource(remembered.rawSource) && require_source_candidate_scan_signature.normalizeOutputPathKey(remembered.sourceFile.replace(/[?#].*$/, "")) !== require_source_candidate_scan_signature.normalizeOutputPathKey(file));
|
|
4211
4315
|
const inferredSfcStyleSource = await resolveSfcStyleSourceFromOutputFile(outputFile, snapshot, outDir, opts.tailwindcssBasedir, opts.cssMatcher, getSfcSource, debug);
|
|
4212
4316
|
if (inferredSfcStyleSource) {
|
|
@@ -4219,12 +4323,8 @@ function createGenerateBundleHook(context) {
|
|
|
4219
4323
|
hasUsableRememberedTailwindSource = false;
|
|
4220
4324
|
}
|
|
4221
4325
|
let outputCssHandlerOptions = getCssHandlerOptions(outputFile);
|
|
4222
|
-
if (currentSubpackageRoots && rememberedCssSources.length > 0 && rememberedCssSources.some((remembered) => configuredTailwindV4CssSourceFileKeysForScope.has(require_source_candidate_scan_signature.normalizeOutputPathKey(remembered.sourceFile.replace(/[?#].*$/, ""))) && !isSameSubpackageScope(outputFile, remembered.sourceFile, currentSubpackageRoots))) {
|
|
4223
|
-
rememberedCssSources = [];
|
|
4224
|
-
hasUsableRememberedTailwindSource = false;
|
|
4225
|
-
}
|
|
4226
4326
|
if (isTemporaryCssAssetFile(outputFile) && hasTailwindGenerationSource(rawSource)) {
|
|
4227
|
-
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile);
|
|
4327
|
+
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile, rawSource);
|
|
4228
4328
|
if (resolvedTemporarySource) {
|
|
4229
4329
|
outputFile = resolveMatchedOutputFileForCurrentAsset(resolvedTemporarySource.sourceFile) ?? resolvedTemporarySource.outputFile;
|
|
4230
4330
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
@@ -4256,7 +4356,7 @@ function createGenerateBundleHook(context) {
|
|
|
4256
4356
|
outputFile
|
|
4257
4357
|
}];
|
|
4258
4358
|
} else if (isTemporaryCssAssetFile(outputFile) && configuredTailwindV4CssSourceEntries.length > 1) {
|
|
4259
|
-
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile);
|
|
4359
|
+
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile, rawSource);
|
|
4260
4360
|
if (resolvedTemporarySource) {
|
|
4261
4361
|
outputFile = resolveMatchedOutputFileForCurrentAsset(resolvedTemporarySource.sourceFile) ?? resolvedTemporarySource.outputFile;
|
|
4262
4362
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
@@ -4276,7 +4376,11 @@ function createGenerateBundleHook(context) {
|
|
|
4276
4376
|
}
|
|
4277
4377
|
} else if (hasTailwindGenerationSource(rawSource) && (originalSource.originalFileNames?.length ?? 0) === 0) {
|
|
4278
4378
|
const availableConfiguredTailwindV4CssSourceEntries = configuredTailwindV4CssSourceEntries.filter((entry) => !usedConfiguredTailwindV4CssSourceFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(entry.file)));
|
|
4279
|
-
const configuredGenerationSource = selectTailwindV4GenerationCssSourceForOutput(outputFile, availableConfiguredTailwindV4CssSourceEntries, rawSource,
|
|
4379
|
+
const configuredGenerationSource = selectTailwindV4GenerationCssSourceForOutput(outputFile, availableConfiguredTailwindV4CssSourceEntries, rawSource, {
|
|
4380
|
+
cwd: opts.tailwindcssBasedir,
|
|
4381
|
+
outputRoot: outDir,
|
|
4382
|
+
projectRoot: sourceRoot ?? rootDir
|
|
4383
|
+
});
|
|
4280
4384
|
if (configuredGenerationSource && !hasViteProcessedCssResultForSource(configuredGenerationSource.file, getViteProcessedCssAssetResults)) {
|
|
4281
4385
|
outputFile = resolveMatchedOutputFileForCurrentAsset(configuredGenerationSource.file) ?? outputFile;
|
|
4282
4386
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
@@ -4333,12 +4437,13 @@ function createGenerateBundleHook(context) {
|
|
|
4333
4437
|
...getCssHandlerOptions(generatorSourceFile),
|
|
4334
4438
|
isMainChunk: resolvedFromTemporaryCssAsset ? false : outputCssHandlerOptions.isMainChunk
|
|
4335
4439
|
} : getCssHandlerOptions(file);
|
|
4440
|
+
const generatorCssEntries = configuredTailwindV4CssSourceFileKeysForScope.has(require_source_candidate_scan_signature.normalizeOutputPathKey(generatorSourceFile.replace(/[?#].*$/, ""))) ? [generatorSourceFile] : opts.cssEntries;
|
|
4336
4441
|
const generatorCssHandlerOptions = {
|
|
4337
4442
|
...cssHandlerOptions,
|
|
4338
4443
|
sourceOptions: {
|
|
4339
4444
|
...cssHandlerOptions.sourceOptions ?? {},
|
|
4340
4445
|
sourceFile: generatorSourceFile,
|
|
4341
|
-
cssEntries:
|
|
4446
|
+
cssEntries: generatorCssEntries
|
|
4342
4447
|
}
|
|
4343
4448
|
};
|
|
4344
4449
|
const scopedSourceCandidateGetter = createScopedSourceCandidateGetter(outputFile, generatorCssHandlerOptions);
|
|
@@ -4642,6 +4747,7 @@ function registerGeneratorDependencies(ctx, dependencies) {
|
|
|
4642
4747
|
function createCssHandlerOptions(opts, majorVersion, file) {
|
|
4643
4748
|
return {
|
|
4644
4749
|
...resolveUniAppXNativeCssHandlerOptions(opts),
|
|
4750
|
+
cssPreflight: opts.cssPreflight,
|
|
4645
4751
|
isMainChunk: opts.mainCssChunkMatcher(file, opts.appType),
|
|
4646
4752
|
postcssOptions: { options: { from: file } },
|
|
4647
4753
|
...require_context.normalizeStyleHandlerMajorVersion(majorVersion) === void 0 ? {} : { majorVersion: 4 }
|
|
@@ -4665,6 +4771,9 @@ function shouldFinalizeProcessedCssAsset(opts, file) {
|
|
|
4665
4771
|
function collectViteProcessedCssSources(getViteProcessedCssAssetResults) {
|
|
4666
4772
|
return [...getViteProcessedCssAssetResults?.() ?? []].map(([, record]) => typeof record === "string" ? record : record.css);
|
|
4667
4773
|
}
|
|
4774
|
+
function finalizeWebCss(css, enabled, webCompat) {
|
|
4775
|
+
return enabled ? (0, _weapp_tailwindcss_postcss.transformWebCssCompat)(css, webCompat) : css;
|
|
4776
|
+
}
|
|
4668
4777
|
function createViteCssFinalizerOutputPlugin(context) {
|
|
4669
4778
|
return {
|
|
4670
4779
|
name: "weapp-tailwindcss:adaptor:css-finalizer",
|
|
@@ -4675,13 +4784,14 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4675
4784
|
const { opts, runtimeState, ensureRuntimeClassSet, isCssAssetProcessed, markCssAssetProcessed, debug, getResolvedConfig, recordCssAssetResult, recordViteProcessedCssAssetResult, getViteProcessedCssAssetResults, getRecordedGeneratorCandidates, getSourceCandidates, getSourceCandidatesForEntries, getSourceCandidateSourcesForEntries, waitForSourceCandidateSyncs, rememberMainCssSource, getRememberedMainCssSource, isViteProcessedCssAsset } = context;
|
|
4676
4785
|
const resolvedConfig = getResolvedConfig();
|
|
4677
4786
|
const uniUtsPlatform = require_utils.resolveUniUtsPlatform();
|
|
4678
|
-
const
|
|
4787
|
+
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
4679
4788
|
appType: opts.appType,
|
|
4680
4789
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
4681
4790
|
tailwindcssMajorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
4682
4791
|
uniAppX: opts.uniAppX,
|
|
4683
4792
|
uniUtsPlatform
|
|
4684
|
-
})
|
|
4793
|
+
});
|
|
4794
|
+
const generatorBranch = require_generator.resolveGeneratorRuntimeBranch(generatorOptions, {
|
|
4685
4795
|
appType: opts.appType,
|
|
4686
4796
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
4687
4797
|
tailwindcssMajorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
@@ -4708,6 +4818,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4708
4818
|
recordCssAssetResult,
|
|
4709
4819
|
recordViteProcessedCssAssetResult,
|
|
4710
4820
|
resolveViteProcessedCssOutputFile: (file) => resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget, isNativeAppStyleTarget, sourceRoot, resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) }), Object.keys(bundle)),
|
|
4821
|
+
transformCss: (css) => finalizeWebCss(css, generatorBranch.isWeb, generatorOptions.webCompat),
|
|
4711
4822
|
debug
|
|
4712
4823
|
});
|
|
4713
4824
|
};
|
|
@@ -4780,7 +4891,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4780
4891
|
const file = output.fileName || bundleFile;
|
|
4781
4892
|
const rawSource = output.source.toString();
|
|
4782
4893
|
if (isViteProcessedCssAsset?.(output, file)) {
|
|
4783
|
-
const nextCss = annotateCss(require_source_candidate_scan_signature.stripBundlerGeneratedCssMarkers(rawSource));
|
|
4894
|
+
const nextCss = annotateCss(finalizeWebCss(require_source_candidate_scan_signature.stripBundlerGeneratedCssMarkers(rawSource), generatorBranch.isWeb, generatorOptions.webCompat));
|
|
4784
4895
|
output.source = nextCss;
|
|
4785
4896
|
markCssAssetProcessed(output, file);
|
|
4786
4897
|
recordCssAssetResult?.(file, nextCss);
|
|
@@ -4814,7 +4925,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4814
4925
|
styleHandler: opts.styleHandler,
|
|
4815
4926
|
debug
|
|
4816
4927
|
}) : void 0;
|
|
4817
|
-
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ? rawSource : (await opts.styleHandler(rawSource, cssHandlerOptions)).css));
|
|
4928
|
+
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ? finalizeWebCss(rawSource, true, generatorOptions.webCompat) : (await opts.styleHandler(rawSource, cssHandlerOptions)).css));
|
|
4818
4929
|
if (generated) {
|
|
4819
4930
|
registerGeneratorDependencies(this, generated.dependencies);
|
|
4820
4931
|
debug("css finalizer generated result: %s bytes=%d", file, nextCss.length);
|
|
@@ -5117,6 +5228,22 @@ function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
|
5117
5228
|
}
|
|
5118
5229
|
return modules;
|
|
5119
5230
|
}
|
|
5231
|
+
function resolveHotSourceModules(ctx) {
|
|
5232
|
+
const modules = [];
|
|
5233
|
+
const seenModules = /* @__PURE__ */ new Set();
|
|
5234
|
+
const collectModule = (mod) => {
|
|
5235
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
5236
|
+
if (require_source_candidate_scan_signature.isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
5237
|
+
seenModules.add(mod);
|
|
5238
|
+
modules.push(mod);
|
|
5239
|
+
};
|
|
5240
|
+
for (const mod of ctx.modules) collectModule(mod);
|
|
5241
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile(ctx.file) ?? []) collectModule(mod);
|
|
5242
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file)) ?? []) collectModule(mod);
|
|
5243
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.(ctx.file));
|
|
5244
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file)));
|
|
5245
|
+
return modules;
|
|
5246
|
+
}
|
|
5120
5247
|
function resolveModuleHotUrl(mod) {
|
|
5121
5248
|
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
5122
5249
|
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
@@ -5585,6 +5712,30 @@ const weappTailwindcssPackageDir = require_source_candidate_scan_signature.resol
|
|
|
5585
5712
|
const weappTailwindcssDirPosix = require_source_candidate_scan_signature.slash(weappTailwindcssPackageDir);
|
|
5586
5713
|
const SOURCE_CANDIDATE_SCAN_CACHE_MAX = 8;
|
|
5587
5714
|
const sourceCandidateScanSnapshotCache = new lru_cache.LRUCache({ max: SOURCE_CANDIDATE_SCAN_CACHE_MAX });
|
|
5715
|
+
const ENV_PLATFORM_KEYS = [
|
|
5716
|
+
"UNI_PLATFORM",
|
|
5717
|
+
"UNI_UTS_PLATFORM",
|
|
5718
|
+
"TARO_ENV",
|
|
5719
|
+
"MPX_CURRENT_TARGET_MODE",
|
|
5720
|
+
"MPX_CLI_MODE"
|
|
5721
|
+
];
|
|
5722
|
+
function sameStringList(first, second) {
|
|
5723
|
+
if (first === second) return true;
|
|
5724
|
+
if (!first || !second || first.length !== second.length) return false;
|
|
5725
|
+
return first.every((item, index) => item === second[index]);
|
|
5726
|
+
}
|
|
5727
|
+
function normalizeViteStylePlatform(value, appType) {
|
|
5728
|
+
return require_context.normalizeFrameworkStylePlatform(value, appType);
|
|
5729
|
+
}
|
|
5730
|
+
function inferPlatformFromOutDir(outDir) {
|
|
5731
|
+
const segment = outDir ? node_path.default.basename(node_path.default.normalize(outDir)) : void 0;
|
|
5732
|
+
if (!segment) return;
|
|
5733
|
+
const normalized = segment.trim().toLowerCase();
|
|
5734
|
+
if (normalized === "h5" || normalized === "web" || normalized === "app" || normalized === "app-plus" || normalized.startsWith("app-") || normalized.startsWith("mp-") || normalized.startsWith("quickapp-webview")) return normalized;
|
|
5735
|
+
}
|
|
5736
|
+
function isWebOrNativeAppPlatform(platform) {
|
|
5737
|
+
return platform === "h5" || platform === "web" || platform?.startsWith("web-") === true || platform === "app" || platform === "app-plus" || platform?.startsWith("app-") === true;
|
|
5738
|
+
}
|
|
5588
5739
|
/**
|
|
5589
5740
|
* @name WeappTailwindcss
|
|
5590
5741
|
* @description uni-app vite / uni-app-x 版本插件
|
|
@@ -5593,19 +5744,26 @@ const sourceCandidateScanSnapshotCache = new lru_cache.LRUCache({ max: SOURCE_CA
|
|
|
5593
5744
|
function WeappTailwindcss(options = {}) {
|
|
5594
5745
|
const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
|
|
5595
5746
|
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
5747
|
+
const rawCssEntries = Array.isArray(options.cssEntries) ? [...options.cssEntries] : void 0;
|
|
5596
5748
|
const opts = require_context.getCompilerContext({
|
|
5597
5749
|
...options,
|
|
5598
5750
|
__internalDeferMissingCssEntriesWarning: true
|
|
5599
5751
|
});
|
|
5600
|
-
const
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5752
|
+
const syncCssEntriesFromAnchor = (anchor) => {
|
|
5753
|
+
var _opts$tailwindcss;
|
|
5754
|
+
const normalizedCssEntries = require_v4_engine.normalizeCssEntries(rawCssEntries, anchor ?? node_process.default.cwd());
|
|
5755
|
+
if (!normalizedCssEntries) return false;
|
|
5756
|
+
const changed = !sameStringList(opts.cssEntries, normalizedCssEntries);
|
|
5757
|
+
opts.cssEntries = normalizedCssEntries;
|
|
5604
5758
|
opts.tailwindcss ?? (opts.tailwindcss = {});
|
|
5605
5759
|
(_opts$tailwindcss = opts.tailwindcss).v4 ?? (_opts$tailwindcss.v4 = {});
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5760
|
+
opts.tailwindcss.v4.cssEntries = normalizedCssEntries;
|
|
5761
|
+
if (opts.tailwindcssRuntimeOptions?.tailwindcss?.v4) opts.tailwindcssRuntimeOptions.tailwindcss.v4.cssEntries = normalizedCssEntries;
|
|
5762
|
+
if (opts.tailwindRuntime?.options?.tailwindcss?.v4) opts.tailwindRuntime.options.tailwindcss.v4.cssEntries = normalizedCssEntries;
|
|
5763
|
+
return changed;
|
|
5764
|
+
};
|
|
5765
|
+
syncCssEntriesFromAnchor(opts.tailwindcssBasedir);
|
|
5766
|
+
const { disabled, customAttributes, onLoad, mainCssChunkMatcher, styleHandler, jsHandler, tailwindRuntime, refreshTailwindcssRuntime, uniAppX, disabledDefaultTemplateHandler, styleInjector } = opts;
|
|
5609
5767
|
const initialTailwindRuntime = tailwindRuntime;
|
|
5610
5768
|
const refreshTailwindRuntime = refreshTailwindcssRuntime;
|
|
5611
5769
|
const uniAppXEnabled = require_tailwindcss.isUniAppXEnabled(uniAppX);
|
|
@@ -5626,6 +5784,28 @@ function WeappTailwindcss(options = {}) {
|
|
|
5626
5784
|
tailwindcssMajorVersion,
|
|
5627
5785
|
uniAppX
|
|
5628
5786
|
});
|
|
5787
|
+
const resolveViteStylePlatform = () => {
|
|
5788
|
+
const explicit = normalizeViteStylePlatform(opts.cssOptions?.platform ?? opts.platform, opts.appType);
|
|
5789
|
+
if (explicit) return explicit;
|
|
5790
|
+
for (const key of ENV_PLATFORM_KEYS) {
|
|
5791
|
+
const envPlatform = normalizeViteStylePlatform(node_process.default.env[key], opts.appType);
|
|
5792
|
+
if (envPlatform) return envPlatform;
|
|
5793
|
+
}
|
|
5794
|
+
return inferPlatformFromOutDir(resolvedConfig?.build?.outDir);
|
|
5795
|
+
};
|
|
5796
|
+
const transformEarlyMiniProgramCss = (code) => {
|
|
5797
|
+
const platform = resolveViteStylePlatform();
|
|
5798
|
+
if (!shouldOwnTailwindGeneration || (platform ? isWebOrNativeAppPlatform(platform) : generatorBranch.isWeb)) return code;
|
|
5799
|
+
let transformedCode = code;
|
|
5800
|
+
if (transformedCode.includes("#if")) transformedCode = (0, _weapp_tailwindcss_postcss.compileCssMacroConditionalComments)(transformedCode, { platform: resolveViteStylePlatform() });
|
|
5801
|
+
if (transformedCode.includes("@layer")) transformedCode = (0, _weapp_tailwindcss_postcss.unwrapUnsupportedCascadeLayers)(transformedCode);
|
|
5802
|
+
return transformedCode;
|
|
5803
|
+
};
|
|
5804
|
+
const finalizeViteMiniProgramCss = (css) => {
|
|
5805
|
+
const platform = resolveViteStylePlatform();
|
|
5806
|
+
if (!shouldOwnTailwindGeneration || (platform ? isWebOrNativeAppPlatform(platform) : generatorBranch.isWeb)) return css;
|
|
5807
|
+
return (0, _weapp_tailwindcss_postcss.unwrapUnsupportedCascadeLayers)(css);
|
|
5808
|
+
};
|
|
5629
5809
|
const shouldInferAppType = !hasExplicitAppType && !generatorBranch.isWeb;
|
|
5630
5810
|
const hasInitialTailwindCssRoots = require_v4_engine.hasConfiguredTailwindV4CssRoots({
|
|
5631
5811
|
...options,
|
|
@@ -5762,6 +5942,15 @@ function WeappTailwindcss(options = {}) {
|
|
|
5762
5942
|
const getSourceCandidateSourcesForEntries = (entries, options) => sourceCandidateCollector.sourcesForEntries(entries, options);
|
|
5763
5943
|
const isWatchBuild = () => resolvedConfig?.command === "build" && resolvedConfig.build.watch != null;
|
|
5764
5944
|
const isWatchLikeBuild = () => isWatchBuild() || resolvedConfig?.command === "serve" || node_process.default.env["WEAPP_TW_WATCH_REGRESSION"] === "1" || node_process.default.env["WEAPP_TW_HMR_TIMING"] === "1";
|
|
5945
|
+
const isCurrentWebLikeStylePlatform = () => {
|
|
5946
|
+
const platform = resolveViteStylePlatform();
|
|
5947
|
+
return platform ? isWebOrNativeAppPlatform(platform) : generatorBranch.isWeb;
|
|
5948
|
+
};
|
|
5949
|
+
const isNuxtPageMacroHotModule = (id) => {
|
|
5950
|
+
if (typeof id !== "string" || !/[?&]macro=true(?:&|$)/.test(id)) return false;
|
|
5951
|
+
const cleanId = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
5952
|
+
return cleanId.includes("/pages/") && /\.(?:vue|tsx?|jsx?)$/.test(cleanId);
|
|
5953
|
+
};
|
|
5765
5954
|
const hasSourceCandidateScanState = () => sourceCandidateScanSignature !== void 0;
|
|
5766
5955
|
const normalizeSourceScanDependency = (file) => node_path.default.normalize(node_path.default.resolve((0, _weapp_tailwindcss_shared.cleanUrl)(file)));
|
|
5767
5956
|
const isSourceScanDependency = (file) => sourceScanDependencies.has(normalizeSourceScanDependency(file));
|
|
@@ -5961,7 +6150,8 @@ function WeappTailwindcss(options = {}) {
|
|
|
5961
6150
|
getExtraOptions: (file) => ({
|
|
5962
6151
|
...resolveViteCssHandlerExtraOptions(file),
|
|
5963
6152
|
...resolveUniAppXNativeCssHandlerOptions(opts)
|
|
5964
|
-
})
|
|
6153
|
+
}),
|
|
6154
|
+
getDynamicCssOptions: () => ({ cssPreflight: opts.cssPreflight })
|
|
5965
6155
|
});
|
|
5966
6156
|
const serveJsHandlerOptions = createJsHandlerOptionsFactory({
|
|
5967
6157
|
getMajorVersion: () => runtimeState.tailwindRuntime.majorVersion,
|
|
@@ -6005,10 +6195,11 @@ function WeappTailwindcss(options = {}) {
|
|
|
6005
6195
|
styleHandler,
|
|
6006
6196
|
debug,
|
|
6007
6197
|
previousCss: viteGeneratedCssByFile.get(file),
|
|
6008
|
-
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource
|
|
6198
|
+
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource,
|
|
6199
|
+
restoreLocalCssImports: !generatorBranch.isWeb
|
|
6009
6200
|
});
|
|
6010
6201
|
if (!generated) return;
|
|
6011
|
-
const tracedCss = require_hmr_timing.annotateCssSourceTrace(generated.css, {
|
|
6202
|
+
const tracedCss = require_hmr_timing.annotateCssSourceTrace(finalizeViteMiniProgramCss(generated.css), {
|
|
6012
6203
|
opts,
|
|
6013
6204
|
tokenSources: require_hmr_timing.createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts)
|
|
6014
6205
|
});
|
|
@@ -6132,20 +6323,45 @@ function WeappTailwindcss(options = {}) {
|
|
|
6132
6323
|
{
|
|
6133
6324
|
name: `${require_context.vitePluginName}:source-candidates`,
|
|
6134
6325
|
enforce: "pre",
|
|
6135
|
-
async
|
|
6136
|
-
if (shouldOwnTailwindGeneration)
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6326
|
+
async load(id) {
|
|
6327
|
+
if (!shouldOwnTailwindGeneration || isWebOrNativeAppPlatform(resolveViteStylePlatform()) || !require_source_candidate_scan_signature.isCSSRequest(id) || !shouldCollectTransformedSourceCandidates(id)) return;
|
|
6328
|
+
const rawCode = await (0, node_fs_promises.readFile)((0, _weapp_tailwindcss_shared.cleanUrl)(id), "utf8").catch(() => void 0);
|
|
6329
|
+
if (typeof rawCode !== "string") return;
|
|
6330
|
+
const transformedCode = transformEarlyMiniProgramCss(rawCode);
|
|
6331
|
+
if (transformedCode === rawCode) return;
|
|
6332
|
+
cssMemory.rememberKnownSfcSource(id, transformedCode);
|
|
6333
|
+
return transformedCode;
|
|
6334
|
+
},
|
|
6335
|
+
transform: {
|
|
6336
|
+
order: "pre",
|
|
6337
|
+
async handler(code, id) {
|
|
6338
|
+
let transformedCode = code;
|
|
6339
|
+
if (shouldOwnTailwindGeneration && !generatorBranch.isWeb && require_source_candidate_scan_signature.isCSSRequest(id)) transformedCode = transformEarlyMiniProgramCss(code);
|
|
6340
|
+
const shouldReturnTransformedCode = transformedCode !== code;
|
|
6341
|
+
if (shouldOwnTailwindGeneration) cssMemory.rememberKnownSfcSource(id, transformedCode);
|
|
6342
|
+
if (!shouldOwnTailwindGeneration || !require_hmr_timing.isSourceCandidateRequest(id) || !shouldCollectTransformedSourceCandidates(id)) {
|
|
6343
|
+
if (shouldReturnTransformedCode) return {
|
|
6344
|
+
code: transformedCode,
|
|
6345
|
+
map: null
|
|
6346
|
+
};
|
|
6144
6347
|
return;
|
|
6145
6348
|
}
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6349
|
+
return hmrTimingRecorder.measure("sourceCandidates.transform", async () => {
|
|
6350
|
+
invalidateRecordedGeneratorCandidates();
|
|
6351
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
6352
|
+
if (sourceScanMatcher && !sourceScanMatcher(file)) {
|
|
6353
|
+
sourceCandidateCollector.remove(file);
|
|
6354
|
+
cacheCurrentSourceCandidateScan();
|
|
6355
|
+
return;
|
|
6356
|
+
}
|
|
6357
|
+
await sourceCandidateCollector.merge(id, transformedCode);
|
|
6358
|
+
cacheCurrentSourceCandidateScan();
|
|
6359
|
+
if (shouldReturnTransformedCode) return {
|
|
6360
|
+
code: transformedCode,
|
|
6361
|
+
map: null
|
|
6362
|
+
};
|
|
6363
|
+
}, { emit: false });
|
|
6364
|
+
}
|
|
6149
6365
|
},
|
|
6150
6366
|
async watchChange(id, change) {
|
|
6151
6367
|
await hmrTimingRecorder.measure("sourceCandidates.watchChange", async () => {
|
|
@@ -6163,13 +6379,27 @@ function WeappTailwindcss(options = {}) {
|
|
|
6163
6379
|
return hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
6164
6380
|
const isSourceCandidateHotUpdate = shouldOwnTailwindGeneration && require_hmr_timing.isSourceCandidateRequest(ctx.file);
|
|
6165
6381
|
await syncChangedSourceCandidateFile(ctx.file);
|
|
6166
|
-
|
|
6382
|
+
const isWebLikeHotUpdate = isCurrentWebLikeStylePlatform();
|
|
6383
|
+
if (isSourceCandidateHotUpdate) {
|
|
6384
|
+
invalidateRecordedGeneratorCandidates();
|
|
6385
|
+
if (isWebLikeHotUpdate) {
|
|
6386
|
+
await refreshRuntimeStateForAutoCssSources?.(true);
|
|
6387
|
+
await syncSourceCandidateScan({ force: true });
|
|
6388
|
+
}
|
|
6389
|
+
}
|
|
6167
6390
|
const cssModules = resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds);
|
|
6168
|
-
|
|
6391
|
+
const sourceModules = isSourceCandidateHotUpdate && !require_source_candidate_scan_signature.isSourceStyleRequest(ctx.file) ? resolveHotSourceModules(ctx) : ctx.modules;
|
|
6392
|
+
if (isSourceCandidateHotUpdate && !require_source_candidate_scan_signature.isSourceStyleRequest(ctx.file) && !isWebLikeHotUpdate && (!hasSelfAcceptingNonStyleHotModule(sourceModules) && cssModules.length === 0 || cssModules.length > 0 && isUniViteProject())) {
|
|
6393
|
+
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
6394
|
+
return [];
|
|
6395
|
+
}
|
|
6396
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_source_candidate_scan_signature.isSourceStyleRequest(ctx.file) && ctx.modules.some((mod) => isNuxtPageMacroHotModule(mod.id ?? mod.url))) {
|
|
6169
6397
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
6170
6398
|
return [];
|
|
6171
6399
|
}
|
|
6172
6400
|
sendSupplementalCssHotUpdates(ctx, cssModules);
|
|
6401
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_source_candidate_scan_signature.isSourceStyleRequest(ctx.file)) return;
|
|
6402
|
+
if (isSourceCandidateHotUpdate && !require_source_candidate_scan_signature.isSourceStyleRequest(ctx.file) && cssModules.length > 0) return [...sourceModules, ...cssModules];
|
|
6173
6403
|
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
6174
6404
|
}, { emit: false });
|
|
6175
6405
|
},
|
|
@@ -6233,6 +6463,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
6233
6463
|
if (opts.tailwindcssBasedir !== nextTailwindcssBasedir) {
|
|
6234
6464
|
const previousBasedir = opts.tailwindcssBasedir;
|
|
6235
6465
|
opts.tailwindcssBasedir = nextTailwindcssBasedir;
|
|
6466
|
+
shouldRefreshRuntime = syncCssEntriesFromAnchor(nextTailwindcssBasedir) || shouldRefreshRuntime;
|
|
6236
6467
|
debug("align tailwindcss basedir with vite root: %s -> %s", previousBasedir ?? "undefined", nextTailwindcssBasedir);
|
|
6237
6468
|
shouldRefreshRuntime = true;
|
|
6238
6469
|
}
|
|
@@ -6265,6 +6496,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
6265
6496
|
];
|
|
6266
6497
|
if (uniAppXPlugins) plugins.push(...uniAppXPlugins);
|
|
6267
6498
|
plugins.push(cssFinalizerOutputPlugin);
|
|
6499
|
+
plugins.push(...require_source_candidate_scan_signature.createBuiltinViteStyleInjectorPlugins(styleInjector, () => opts.appType));
|
|
6268
6500
|
return plugins;
|
|
6269
6501
|
}
|
|
6270
6502
|
//#endregion
|