weapp-tailwindcss 5.1.3 → 5.1.4
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/local-imports.d.ts +1 -10
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets.d.ts +1 -0
- package/dist/{context-B07Vf584.mjs → context-Bkpmt3ja.mjs} +31 -5
- package/dist/{context-D75pwtBW.js → context-DCVMkTRj.js} +36 -4
- 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.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-aQMZ0M7c.mjs → gulp-0RsqkF_d.mjs} +4 -4
- package/dist/{gulp-B_u8NjQL.js → gulp-Bogfnoki.js} +7 -6
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DLYQTCDb.mjs → hmr-timing-BRNaz8Od.mjs} +41 -148
- package/dist/{hmr-timing-DOoHun3i.js → hmr-timing-BV6nFPoT.js} +41 -166
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- 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-BB1hvW68.mjs} +12 -6
- package/dist/{source-candidate-scan-signature-DzwebZrf.js → source-candidate-scan-signature-CaDT0gkj.js} +13 -6
- package/dist/tailwindcss/v4-engine/css-macro-source.d.ts +2 -0
- package/dist/{tailwindcss-BwV3_Ryc.mjs → tailwindcss-D0JF0fuZ.mjs} +4 -4
- package/dist/{tailwindcss-BSCvrs1p.js → tailwindcss-D2xs4OEu.js} +4 -4
- package/dist/{transform-Clj7R818.mjs → transform-BP86eSZp.mjs} +1 -1
- package/dist/{transform-fin-OTVD.js → transform-CXCQ28Tc.js} +1 -1
- 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-5Wn0PIzJ.mjs → vite-B1SlBmqO.mjs} +212 -44
- package/dist/{vite-CkVMSDDp.js → vite-BYgT1ir9.js} +214 -46
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +89 -191
- package/dist/{webpack-DEag6ueE.mjs → webpack-Bg6pefpb.mjs} +49 -6
- package/dist/{webpack-hvSFaicc.js → webpack-khSwkXP5.js} +50 -7
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +3 -3
- 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-DCVMkTRj.js");
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-D2xs4OEu.js");
|
|
8
|
+
const require_hmr_timing = require("./hmr-timing-BV6nFPoT.js");
|
|
9
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-CaDT0gkj.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-CXCQ28Tc.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];
|
|
@@ -2133,6 +2142,7 @@ function shouldInjectViteProcessedCssResult(opts, targetFile, sourceFile, option
|
|
|
2133
2142
|
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
2143
|
if (options.injectIntoMain === false) return false;
|
|
2135
2144
|
const targetFileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(targetFile);
|
|
2145
|
+
if (typeof options.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(options.outputFile) === targetFileKey) return true;
|
|
2136
2146
|
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
2147
|
}
|
|
2138
2148
|
function shouldReplayViteProcessedCssIntoMainCss(opts, file, sourceFile, outputFile, subpackageRoots) {
|
|
@@ -2151,7 +2161,7 @@ function isMiniProgramStyleOutputFile(file) {
|
|
|
2151
2161
|
return /\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
2152
2162
|
}
|
|
2153
2163
|
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) &&
|
|
2164
|
+
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
2165
|
}
|
|
2156
2166
|
function resolvePreservedImportShellInjectionTarget(opts, bundle, file, css) {
|
|
2157
2167
|
if (opts.appType !== "taro") return;
|
|
@@ -2168,7 +2178,7 @@ function resolvePreservedImportShellInjectionTarget(opts, bundle, file, css) {
|
|
|
2168
2178
|
}
|
|
2169
2179
|
function shouldUseCssAssetAsMainInjectionTarget(opts, file, records) {
|
|
2170
2180
|
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
|
|
2181
|
+
if (!isRootStyleOutputFile(file) && records.some((record) => typeof record.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(record.outputFile) === fileKey)) return true;
|
|
2172
2182
|
if (!isRootStyleOutputFile(file)) return records.some((record) => record.injectIntoMain === true && typeof record.outputFile === "string" && require_source_candidate_scan_signature.normalizeOutputPathKey(record.outputFile) === fileKey);
|
|
2173
2183
|
if (records.some((record) => {
|
|
2174
2184
|
if (record.injectIntoMain !== true) return false;
|
|
@@ -2216,6 +2226,12 @@ function collectBundleAssetFiles(bundle) {
|
|
|
2216
2226
|
}
|
|
2217
2227
|
return files;
|
|
2218
2228
|
}
|
|
2229
|
+
function findBundleAssetByOutputFile(bundle, file) {
|
|
2230
|
+
const fileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
2231
|
+
return Object.entries(bundle).find(([bundleFile, output]) => {
|
|
2232
|
+
return output.type === "asset" && require_source_candidate_scan_signature.normalizeOutputPathKey(getAssetFile$1(bundleFile, output)) === fileKey;
|
|
2233
|
+
})?.[1];
|
|
2234
|
+
}
|
|
2219
2235
|
function isCssImportOnlyBundleAsset(bundle, file, css) {
|
|
2220
2236
|
const importedStyleFiles = collectImportedStyleFiles(css, file);
|
|
2221
2237
|
if (importedStyleFiles.size === 0) return false;
|
|
@@ -2235,6 +2251,13 @@ function isCoveredViteGeneratedSourceAsset(file, existingAssetFiles, resolveVite
|
|
|
2235
2251
|
const resolvedOutputFile = require_source_candidate_scan_signature.normalizeOutputPathKey(resolveViteProcessedCssOutputFile?.(file) ?? file);
|
|
2236
2252
|
return resolvedOutputFile !== require_source_candidate_scan_signature.normalizeOutputPathKey(file) && existingAssetFiles.has(resolvedOutputFile);
|
|
2237
2253
|
}
|
|
2254
|
+
function resolveViteGeneratedCssMarkerOutputFile(file, markerFile, existingAssetFiles, resolveViteProcessedCssOutputFile) {
|
|
2255
|
+
const resolvedFromFile = require_source_candidate_scan_signature.normalizeOutputPathKey(resolveViteProcessedCssOutputFile?.(file) ?? file);
|
|
2256
|
+
if (!markerFile) return resolvedFromFile;
|
|
2257
|
+
const resolvedFromMarker = require_source_candidate_scan_signature.normalizeOutputPathKey(resolveViteProcessedCssOutputFile?.(markerFile) ?? markerFile);
|
|
2258
|
+
if (resolvedFromMarker !== resolvedFromFile && existingAssetFiles.has(resolvedFromMarker)) return resolvedFromMarker;
|
|
2259
|
+
return resolvedFromFile;
|
|
2260
|
+
}
|
|
2238
2261
|
function isSourceRootPrefixedOutputFile(file, outputFile) {
|
|
2239
2262
|
const fileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(file);
|
|
2240
2263
|
const outputFileKey = require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
@@ -2251,10 +2274,30 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
2251
2274
|
let nextCss = resolveViteProcessedCssAssetSource(file, rawSource, options.resolveViteProcessedCssOutputFile);
|
|
2252
2275
|
const singleMarkerFile = collectSingleViteGeneratedCssMarkerFile(rawSource);
|
|
2253
2276
|
if (singleMarkerFile && (options.subpackageRoots == null || !isSubpackageOutputFile(file, options.subpackageRoots)) && shouldFilterRootGeneratedCssMarkerForScopedAsset(file, singleMarkerFile, options.resolveViteProcessedCssOutputFile)) nextCss = removeCssCoveredByRootStyleBundleSources(bundle, file, nextCss);
|
|
2277
|
+
nextCss = options.transformCss?.(nextCss, file) ?? nextCss;
|
|
2254
2278
|
if (nextCss !== rawSource) output.source = nextCss;
|
|
2255
2279
|
options.markCssAssetProcessed?.(output, file);
|
|
2256
2280
|
options.recordCssAssetResult?.(file, nextCss);
|
|
2257
|
-
const resolvedOutputFile = options.resolveViteProcessedCssOutputFile
|
|
2281
|
+
const resolvedOutputFile = resolveViteGeneratedCssMarkerOutputFile(file, singleMarkerFile, existingAssetFiles, options.resolveViteProcessedCssOutputFile);
|
|
2282
|
+
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))) {
|
|
2283
|
+
const targetAsset = findBundleAssetByOutputFile(bundle, resolvedOutputFile);
|
|
2284
|
+
if (targetAsset) {
|
|
2285
|
+
const targetRawSource = readAssetSource$2(targetAsset);
|
|
2286
|
+
const targetNextCss = appendCss$1(targetRawSource, (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(targetRawSource, nextCss).trim());
|
|
2287
|
+
if (targetNextCss !== targetRawSource) {
|
|
2288
|
+
targetAsset.source = targetNextCss;
|
|
2289
|
+
options.markCssAssetProcessed?.(targetAsset, resolvedOutputFile);
|
|
2290
|
+
options.recordCssAssetResult?.(resolvedOutputFile, targetNextCss);
|
|
2291
|
+
}
|
|
2292
|
+
clearAssetSource(output);
|
|
2293
|
+
options.recordCssAssetResult?.(file, "");
|
|
2294
|
+
options.recordViteProcessedCssAssetResult?.(resolvedOutputFile, targetNextCss, { outputFile: resolvedOutputFile });
|
|
2295
|
+
if (isCoveredViteGeneratedSourceAsset(file, existingAssetFiles, options.resolveViteProcessedCssOutputFile)) delete bundle[bundleFile];
|
|
2296
|
+
options.debug?.("move vite-generated css asset by marker source: %s -> %s bytes=%d", file, resolvedOutputFile, nextCss.length);
|
|
2297
|
+
collected++;
|
|
2298
|
+
continue;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2258
2301
|
const shouldReplayIntoMainCss = options.opts != null && shouldReplayViteProcessedCssIntoMainCss(options.opts, file, singleMarkerFile, resolvedOutputFile, options.subpackageRoots);
|
|
2259
2302
|
options.recordViteProcessedCssAssetResult?.(file, nextCss, {
|
|
2260
2303
|
injectIntoMain: shouldReplayIntoMainCss || void 0,
|
|
@@ -2713,9 +2756,9 @@ function normalizeTaroRootImportShellAssets(bundle, options) {
|
|
|
2713
2756
|
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
2757
|
if (originOutput?.type !== "asset") continue;
|
|
2715
2758
|
const rootSource = readAssetSource(rootOutput);
|
|
2716
|
-
if (
|
|
2759
|
+
if ((0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(rootSource)) continue;
|
|
2717
2760
|
const originSource = readAssetSource(originOutput);
|
|
2718
|
-
if (
|
|
2761
|
+
if ((0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(originSource)) {
|
|
2719
2762
|
const importedFile = resolveSingleCssImportOutputFile(originFile, originSource);
|
|
2720
2763
|
if (importedFile && require_source_candidate_scan_signature.normalizeOutputPathKey(importedFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(rootFile)) continue;
|
|
2721
2764
|
} else if (originSource.trim().length > 0 && originSource.trim() !== rootSource.trim()) continue;
|
|
@@ -3551,6 +3594,14 @@ function resolveCurrentSourceCandidateSource(options) {
|
|
|
3551
3594
|
}
|
|
3552
3595
|
//#endregion
|
|
3553
3596
|
//#region src/bundlers/vite/generate-bundle/tailwind-v4-css-source.ts
|
|
3597
|
+
function createStableTextSignature(input) {
|
|
3598
|
+
let hash = 2166136261;
|
|
3599
|
+
for (let i = 0; i < input.length; i++) {
|
|
3600
|
+
hash ^= input.charCodeAt(i);
|
|
3601
|
+
hash = Math.imul(hash, 16777619);
|
|
3602
|
+
}
|
|
3603
|
+
return (hash >>> 0).toString(36);
|
|
3604
|
+
}
|
|
3554
3605
|
function collectTailwindV4SourceFingerprint(source) {
|
|
3555
3606
|
const tokens = /* @__PURE__ */ new Set();
|
|
3556
3607
|
const add = (prefix, value) => {
|
|
@@ -3562,6 +3613,22 @@ function collectTailwindV4SourceFingerprint(source) {
|
|
|
3562
3613
|
add("config-request", configRequest.replace(/\\/g, "/"));
|
|
3563
3614
|
}
|
|
3564
3615
|
for (const match of source.matchAll(/@source\s+(not\s+)?(["'])(.+?)\2\s*;?/g)) add(match[1] ? "source:not" : "source", match[3]);
|
|
3616
|
+
for (const match of source.matchAll(/@plugin\s+(["'])(.+?)\1\s*(?:\{([\s\S]*?)\}|;)/g)) {
|
|
3617
|
+
const request = match[2];
|
|
3618
|
+
const optionBlock = match[3];
|
|
3619
|
+
add("plugin", request);
|
|
3620
|
+
add("plugin-request", request.replace(/\\/g, "/"));
|
|
3621
|
+
if (optionBlock !== void 0) add("plugin-options", `${request}:${createStableTextSignature(optionBlock)}`);
|
|
3622
|
+
}
|
|
3623
|
+
try {
|
|
3624
|
+
_weapp_tailwindcss_postcss.postcss.parse(source).walkAtRules("plugin", (rule) => {
|
|
3625
|
+
const request = /^(['"])(.+?)\1/.exec(rule.params.trim())?.[2];
|
|
3626
|
+
if (!request || !rule.nodes?.length) return;
|
|
3627
|
+
rule.walkDecls((decl) => {
|
|
3628
|
+
add("plugin-option", `${request}:${decl.prop}:${decl.value}`);
|
|
3629
|
+
});
|
|
3630
|
+
});
|
|
3631
|
+
} catch {}
|
|
3565
3632
|
for (const match of source.matchAll(/@custom-variant\s+([^{\s]+)/g)) add("custom-variant", match[1]);
|
|
3566
3633
|
for (const match of source.matchAll(/@(?:theme|utility|variant|layer)\s+([^{;\s]+)/g)) add("directive", match[1]);
|
|
3567
3634
|
for (const match of source.matchAll(/--[\w-]+(?=\s*:)/g)) add("theme-token", match[0]);
|
|
@@ -3623,7 +3690,7 @@ function createTemporaryCssAssetSourceResolver(entries) {
|
|
|
3623
3690
|
const queuedEntries = entries.filter((entry) => {
|
|
3624
3691
|
const entryFile = normalizeCssSourceKey(entry.file);
|
|
3625
3692
|
const outputFile = normalizeCssSourceKey(entry.outputFile);
|
|
3626
|
-
if (
|
|
3693
|
+
if (outputFile === entryFile || !outputFile.includes("/") || seenEntryFiles.has(entryFile)) return false;
|
|
3627
3694
|
seenEntryFiles.add(entryFile);
|
|
3628
3695
|
return true;
|
|
3629
3696
|
});
|
|
@@ -3634,9 +3701,16 @@ function createTemporaryCssAssetSourceResolver(entries) {
|
|
|
3634
3701
|
if (!sourceFile) return;
|
|
3635
3702
|
usedEntryFiles.add(normalizeCssSourceKey(sourceFile));
|
|
3636
3703
|
},
|
|
3637
|
-
resolve(outputFile) {
|
|
3704
|
+
resolve(outputFile, rawSource) {
|
|
3638
3705
|
if (!isTemporaryCssAssetFile(outputFile)) return;
|
|
3639
|
-
const
|
|
3706
|
+
const availableEntries = queuedEntries.filter((item) => !usedEntryFiles.has(normalizeCssSourceKey(item.file)));
|
|
3707
|
+
const scoredEntries = rawSource ? availableEntries.map((entry) => ({
|
|
3708
|
+
entry,
|
|
3709
|
+
score: scoreConfiguredTailwindV4SourceForRawSource(rawSource, entry.source)
|
|
3710
|
+
})).filter((item) => item.score > 0).sort((a, b) => b.score - a.score) : [];
|
|
3711
|
+
const bestScore = scoredEntries[0]?.score;
|
|
3712
|
+
const bestEntries = bestScore ? scoredEntries.filter((item) => item.score === bestScore) : [];
|
|
3713
|
+
const entry = bestEntries.length === 1 ? bestEntries[0]?.entry : availableEntries.find((item) => hasTailwindGenerationSource(item.source));
|
|
3640
3714
|
if (!entry) return;
|
|
3641
3715
|
usedEntryFiles.add(normalizeCssSourceKey(entry.file));
|
|
3642
3716
|
return {
|
|
@@ -4052,7 +4126,7 @@ function createGenerateBundleHook(context) {
|
|
|
4052
4126
|
...[...runtimeLinkedCssFiles].filter((file) => !snapshot.sourceHashByFile.has(file)).map((file) => {
|
|
4053
4127
|
const outputFile = resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget, shouldPreserveAppCssExtension, sourceRoot, defaultStyleOutputExtension, bundleFiles);
|
|
4054
4128
|
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
|
|
4129
|
+
return inferredSourceStyle && currentSubpackageRoots ? {
|
|
4056
4130
|
file: inferredSourceStyle.sourceFile,
|
|
4057
4131
|
outputFile,
|
|
4058
4132
|
source: inferredSourceStyle.rawSource
|
|
@@ -4063,6 +4137,14 @@ function createGenerateBundleHook(context) {
|
|
|
4063
4137
|
outputFile: remembered.outputFile,
|
|
4064
4138
|
source: remembered.rawSource
|
|
4065
4139
|
})),
|
|
4140
|
+
...getConfiguredTailwindV4CssSourceEntries().map((entry) => {
|
|
4141
|
+
const outputFile = resolveMatchedCssSourceOutputFile(entry.file);
|
|
4142
|
+
return outputFile ? {
|
|
4143
|
+
file: entry.file,
|
|
4144
|
+
outputFile,
|
|
4145
|
+
source: entry.source
|
|
4146
|
+
} : void 0;
|
|
4147
|
+
}).filter((entry) => entry != null),
|
|
4066
4148
|
...configuredTailwindV4CssSourceEntriesForScope.map((entry) => {
|
|
4067
4149
|
const outputFile = resolveMatchedCssSourceOutputFile(entry.file);
|
|
4068
4150
|
return outputFile && currentSubpackageRoots && isSubpackageOutputFile(outputFile, currentSubpackageRoots) ? {
|
|
@@ -4224,7 +4306,7 @@ function createGenerateBundleHook(context) {
|
|
|
4224
4306
|
hasUsableRememberedTailwindSource = false;
|
|
4225
4307
|
}
|
|
4226
4308
|
if (isTemporaryCssAssetFile(outputFile) && hasTailwindGenerationSource(rawSource)) {
|
|
4227
|
-
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile);
|
|
4309
|
+
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile, rawSource);
|
|
4228
4310
|
if (resolvedTemporarySource) {
|
|
4229
4311
|
outputFile = resolveMatchedOutputFileForCurrentAsset(resolvedTemporarySource.sourceFile) ?? resolvedTemporarySource.outputFile;
|
|
4230
4312
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
@@ -4256,7 +4338,7 @@ function createGenerateBundleHook(context) {
|
|
|
4256
4338
|
outputFile
|
|
4257
4339
|
}];
|
|
4258
4340
|
} else if (isTemporaryCssAssetFile(outputFile) && configuredTailwindV4CssSourceEntries.length > 1) {
|
|
4259
|
-
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile);
|
|
4341
|
+
const resolvedTemporarySource = temporaryCssAssetSourceResolver.resolve(outputFile, rawSource);
|
|
4260
4342
|
if (resolvedTemporarySource) {
|
|
4261
4343
|
outputFile = resolveMatchedOutputFileForCurrentAsset(resolvedTemporarySource.sourceFile) ?? resolvedTemporarySource.outputFile;
|
|
4262
4344
|
activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
|
|
@@ -4642,6 +4724,7 @@ function registerGeneratorDependencies(ctx, dependencies) {
|
|
|
4642
4724
|
function createCssHandlerOptions(opts, majorVersion, file) {
|
|
4643
4725
|
return {
|
|
4644
4726
|
...resolveUniAppXNativeCssHandlerOptions(opts),
|
|
4727
|
+
cssPreflight: opts.cssPreflight,
|
|
4645
4728
|
isMainChunk: opts.mainCssChunkMatcher(file, opts.appType),
|
|
4646
4729
|
postcssOptions: { options: { from: file } },
|
|
4647
4730
|
...require_context.normalizeStyleHandlerMajorVersion(majorVersion) === void 0 ? {} : { majorVersion: 4 }
|
|
@@ -4665,6 +4748,9 @@ function shouldFinalizeProcessedCssAsset(opts, file) {
|
|
|
4665
4748
|
function collectViteProcessedCssSources(getViteProcessedCssAssetResults) {
|
|
4666
4749
|
return [...getViteProcessedCssAssetResults?.() ?? []].map(([, record]) => typeof record === "string" ? record : record.css);
|
|
4667
4750
|
}
|
|
4751
|
+
function finalizeWebCss(css, enabled, webCompat) {
|
|
4752
|
+
return enabled ? (0, _weapp_tailwindcss_postcss.transformWebCssCompat)(css, webCompat) : css;
|
|
4753
|
+
}
|
|
4668
4754
|
function createViteCssFinalizerOutputPlugin(context) {
|
|
4669
4755
|
return {
|
|
4670
4756
|
name: "weapp-tailwindcss:adaptor:css-finalizer",
|
|
@@ -4675,13 +4761,14 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4675
4761
|
const { opts, runtimeState, ensureRuntimeClassSet, isCssAssetProcessed, markCssAssetProcessed, debug, getResolvedConfig, recordCssAssetResult, recordViteProcessedCssAssetResult, getViteProcessedCssAssetResults, getRecordedGeneratorCandidates, getSourceCandidates, getSourceCandidatesForEntries, getSourceCandidateSourcesForEntries, waitForSourceCandidateSyncs, rememberMainCssSource, getRememberedMainCssSource, isViteProcessedCssAsset } = context;
|
|
4676
4762
|
const resolvedConfig = getResolvedConfig();
|
|
4677
4763
|
const uniUtsPlatform = require_utils.resolveUniUtsPlatform();
|
|
4678
|
-
const
|
|
4764
|
+
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
4679
4765
|
appType: opts.appType,
|
|
4680
4766
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
4681
4767
|
tailwindcssMajorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
4682
4768
|
uniAppX: opts.uniAppX,
|
|
4683
4769
|
uniUtsPlatform
|
|
4684
|
-
})
|
|
4770
|
+
});
|
|
4771
|
+
const generatorBranch = require_generator.resolveGeneratorRuntimeBranch(generatorOptions, {
|
|
4685
4772
|
appType: opts.appType,
|
|
4686
4773
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
4687
4774
|
tailwindcssMajorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
@@ -4708,6 +4795,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4708
4795
|
recordCssAssetResult,
|
|
4709
4796
|
recordViteProcessedCssAssetResult,
|
|
4710
4797
|
resolveViteProcessedCssOutputFile: (file) => resolveViteCssPipelineOutputFile(file, opts, rootDir, isWebGeneratorTarget, isNativeAppStyleTarget, sourceRoot, resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) }), Object.keys(bundle)),
|
|
4798
|
+
transformCss: (css) => finalizeWebCss(css, generatorBranch.isWeb, generatorOptions.webCompat),
|
|
4711
4799
|
debug
|
|
4712
4800
|
});
|
|
4713
4801
|
};
|
|
@@ -4780,7 +4868,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4780
4868
|
const file = output.fileName || bundleFile;
|
|
4781
4869
|
const rawSource = output.source.toString();
|
|
4782
4870
|
if (isViteProcessedCssAsset?.(output, file)) {
|
|
4783
|
-
const nextCss = annotateCss(require_source_candidate_scan_signature.stripBundlerGeneratedCssMarkers(rawSource));
|
|
4871
|
+
const nextCss = annotateCss(finalizeWebCss(require_source_candidate_scan_signature.stripBundlerGeneratedCssMarkers(rawSource), generatorBranch.isWeb, generatorOptions.webCompat));
|
|
4784
4872
|
output.source = nextCss;
|
|
4785
4873
|
markCssAssetProcessed(output, file);
|
|
4786
4874
|
recordCssAssetResult?.(file, nextCss);
|
|
@@ -4814,7 +4902,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
4814
4902
|
styleHandler: opts.styleHandler,
|
|
4815
4903
|
debug
|
|
4816
4904
|
}) : void 0;
|
|
4817
|
-
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ? rawSource : (await opts.styleHandler(rawSource, cssHandlerOptions)).css));
|
|
4905
|
+
const nextCss = annotateCss(generated?.css ?? (generatorBranch.isWeb ? finalizeWebCss(rawSource, true, generatorOptions.webCompat) : (await opts.styleHandler(rawSource, cssHandlerOptions)).css));
|
|
4818
4906
|
if (generated) {
|
|
4819
4907
|
registerGeneratorDependencies(this, generated.dependencies);
|
|
4820
4908
|
debug("css finalizer generated result: %s bytes=%d", file, nextCss.length);
|
|
@@ -5585,6 +5673,30 @@ const weappTailwindcssPackageDir = require_source_candidate_scan_signature.resol
|
|
|
5585
5673
|
const weappTailwindcssDirPosix = require_source_candidate_scan_signature.slash(weappTailwindcssPackageDir);
|
|
5586
5674
|
const SOURCE_CANDIDATE_SCAN_CACHE_MAX = 8;
|
|
5587
5675
|
const sourceCandidateScanSnapshotCache = new lru_cache.LRUCache({ max: SOURCE_CANDIDATE_SCAN_CACHE_MAX });
|
|
5676
|
+
const ENV_PLATFORM_KEYS = [
|
|
5677
|
+
"UNI_PLATFORM",
|
|
5678
|
+
"UNI_UTS_PLATFORM",
|
|
5679
|
+
"TARO_ENV",
|
|
5680
|
+
"MPX_CURRENT_TARGET_MODE",
|
|
5681
|
+
"MPX_CLI_MODE"
|
|
5682
|
+
];
|
|
5683
|
+
function sameStringList(first, second) {
|
|
5684
|
+
if (first === second) return true;
|
|
5685
|
+
if (!first || !second || first.length !== second.length) return false;
|
|
5686
|
+
return first.every((item, index) => item === second[index]);
|
|
5687
|
+
}
|
|
5688
|
+
function normalizeViteStylePlatform(value, appType) {
|
|
5689
|
+
return require_context.normalizeFrameworkStylePlatform(value, appType);
|
|
5690
|
+
}
|
|
5691
|
+
function inferPlatformFromOutDir(outDir) {
|
|
5692
|
+
const segment = outDir ? node_path.default.basename(node_path.default.normalize(outDir)) : void 0;
|
|
5693
|
+
if (!segment) return;
|
|
5694
|
+
const normalized = segment.trim().toLowerCase();
|
|
5695
|
+
if (normalized === "h5" || normalized === "web" || normalized === "app" || normalized === "app-plus" || normalized.startsWith("app-") || normalized.startsWith("mp-") || normalized.startsWith("quickapp-webview")) return normalized;
|
|
5696
|
+
}
|
|
5697
|
+
function isWebOrNativeAppPlatform(platform) {
|
|
5698
|
+
return platform === "h5" || platform === "web" || platform?.startsWith("web-") === true || platform === "app" || platform === "app-plus" || platform?.startsWith("app-") === true;
|
|
5699
|
+
}
|
|
5588
5700
|
/**
|
|
5589
5701
|
* @name WeappTailwindcss
|
|
5590
5702
|
* @description uni-app vite / uni-app-x 版本插件
|
|
@@ -5593,18 +5705,25 @@ const sourceCandidateScanSnapshotCache = new lru_cache.LRUCache({ max: SOURCE_CA
|
|
|
5593
5705
|
function WeappTailwindcss(options = {}) {
|
|
5594
5706
|
const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
|
|
5595
5707
|
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
5708
|
+
const rawCssEntries = Array.isArray(options.cssEntries) ? [...options.cssEntries] : void 0;
|
|
5596
5709
|
const opts = require_context.getCompilerContext({
|
|
5597
5710
|
...options,
|
|
5598
5711
|
__internalDeferMissingCssEntriesWarning: true
|
|
5599
5712
|
});
|
|
5600
|
-
const
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5713
|
+
const syncCssEntriesFromAnchor = (anchor) => {
|
|
5714
|
+
var _opts$tailwindcss;
|
|
5715
|
+
const normalizedCssEntries = require_v4_engine.normalizeCssEntries(rawCssEntries, anchor ?? node_process.default.cwd());
|
|
5716
|
+
if (!normalizedCssEntries) return false;
|
|
5717
|
+
const changed = !sameStringList(opts.cssEntries, normalizedCssEntries);
|
|
5718
|
+
opts.cssEntries = normalizedCssEntries;
|
|
5604
5719
|
opts.tailwindcss ?? (opts.tailwindcss = {});
|
|
5605
5720
|
(_opts$tailwindcss = opts.tailwindcss).v4 ?? (_opts$tailwindcss.v4 = {});
|
|
5606
|
-
|
|
5607
|
-
|
|
5721
|
+
opts.tailwindcss.v4.cssEntries = normalizedCssEntries;
|
|
5722
|
+
if (opts.tailwindcssRuntimeOptions?.tailwindcss?.v4) opts.tailwindcssRuntimeOptions.tailwindcss.v4.cssEntries = normalizedCssEntries;
|
|
5723
|
+
if (opts.tailwindRuntime?.options?.tailwindcss?.v4) opts.tailwindRuntime.options.tailwindcss.v4.cssEntries = normalizedCssEntries;
|
|
5724
|
+
return changed;
|
|
5725
|
+
};
|
|
5726
|
+
syncCssEntriesFromAnchor(opts.tailwindcssBasedir);
|
|
5608
5727
|
const { disabled, customAttributes, onLoad, mainCssChunkMatcher, styleHandler, jsHandler, tailwindRuntime, refreshTailwindcssRuntime, uniAppX, disabledDefaultTemplateHandler } = opts;
|
|
5609
5728
|
const initialTailwindRuntime = tailwindRuntime;
|
|
5610
5729
|
const refreshTailwindRuntime = refreshTailwindcssRuntime;
|
|
@@ -5626,6 +5745,28 @@ function WeappTailwindcss(options = {}) {
|
|
|
5626
5745
|
tailwindcssMajorVersion,
|
|
5627
5746
|
uniAppX
|
|
5628
5747
|
});
|
|
5748
|
+
const resolveViteStylePlatform = () => {
|
|
5749
|
+
const explicit = normalizeViteStylePlatform(opts.cssOptions?.platform ?? opts.platform, opts.appType);
|
|
5750
|
+
if (explicit) return explicit;
|
|
5751
|
+
for (const key of ENV_PLATFORM_KEYS) {
|
|
5752
|
+
const envPlatform = normalizeViteStylePlatform(node_process.default.env[key], opts.appType);
|
|
5753
|
+
if (envPlatform) return envPlatform;
|
|
5754
|
+
}
|
|
5755
|
+
return inferPlatformFromOutDir(resolvedConfig?.build?.outDir);
|
|
5756
|
+
};
|
|
5757
|
+
const transformEarlyMiniProgramCss = (code) => {
|
|
5758
|
+
const platform = resolveViteStylePlatform();
|
|
5759
|
+
if (!shouldOwnTailwindGeneration || (platform ? isWebOrNativeAppPlatform(platform) : generatorBranch.isWeb)) return code;
|
|
5760
|
+
let transformedCode = code;
|
|
5761
|
+
if (transformedCode.includes("#if")) transformedCode = (0, _weapp_tailwindcss_postcss.compileCssMacroConditionalComments)(transformedCode, { platform: resolveViteStylePlatform() });
|
|
5762
|
+
if (transformedCode.includes("@layer")) transformedCode = (0, _weapp_tailwindcss_postcss.unwrapUnsupportedCascadeLayers)(transformedCode);
|
|
5763
|
+
return transformedCode;
|
|
5764
|
+
};
|
|
5765
|
+
const finalizeViteMiniProgramCss = (css) => {
|
|
5766
|
+
const platform = resolveViteStylePlatform();
|
|
5767
|
+
if (!shouldOwnTailwindGeneration || (platform ? isWebOrNativeAppPlatform(platform) : generatorBranch.isWeb)) return css;
|
|
5768
|
+
return (0, _weapp_tailwindcss_postcss.unwrapUnsupportedCascadeLayers)(css);
|
|
5769
|
+
};
|
|
5629
5770
|
const shouldInferAppType = !hasExplicitAppType && !generatorBranch.isWeb;
|
|
5630
5771
|
const hasInitialTailwindCssRoots = require_v4_engine.hasConfiguredTailwindV4CssRoots({
|
|
5631
5772
|
...options,
|
|
@@ -5961,7 +6102,8 @@ function WeappTailwindcss(options = {}) {
|
|
|
5961
6102
|
getExtraOptions: (file) => ({
|
|
5962
6103
|
...resolveViteCssHandlerExtraOptions(file),
|
|
5963
6104
|
...resolveUniAppXNativeCssHandlerOptions(opts)
|
|
5964
|
-
})
|
|
6105
|
+
}),
|
|
6106
|
+
getDynamicCssOptions: () => ({ cssPreflight: opts.cssPreflight })
|
|
5965
6107
|
});
|
|
5966
6108
|
const serveJsHandlerOptions = createJsHandlerOptionsFactory({
|
|
5967
6109
|
getMajorVersion: () => runtimeState.tailwindRuntime.majorVersion,
|
|
@@ -6008,7 +6150,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
6008
6150
|
deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource
|
|
6009
6151
|
});
|
|
6010
6152
|
if (!generated) return;
|
|
6011
|
-
const tracedCss = require_hmr_timing.annotateCssSourceTrace(generated.css, {
|
|
6153
|
+
const tracedCss = require_hmr_timing.annotateCssSourceTrace(finalizeViteMiniProgramCss(generated.css), {
|
|
6012
6154
|
opts,
|
|
6013
6155
|
tokenSources: require_hmr_timing.createCssTokenSourceMap(getSourceCandidateSourcesForEntries(void 0), opts)
|
|
6014
6156
|
});
|
|
@@ -6132,20 +6274,45 @@ function WeappTailwindcss(options = {}) {
|
|
|
6132
6274
|
{
|
|
6133
6275
|
name: `${require_context.vitePluginName}:source-candidates`,
|
|
6134
6276
|
enforce: "pre",
|
|
6135
|
-
async
|
|
6136
|
-
if (shouldOwnTailwindGeneration)
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6277
|
+
async load(id) {
|
|
6278
|
+
if (!shouldOwnTailwindGeneration || isWebOrNativeAppPlatform(resolveViteStylePlatform()) || !require_source_candidate_scan_signature.isCSSRequest(id) || !shouldCollectTransformedSourceCandidates(id)) return;
|
|
6279
|
+
const rawCode = await (0, node_fs_promises.readFile)((0, _weapp_tailwindcss_shared.cleanUrl)(id), "utf8").catch(() => void 0);
|
|
6280
|
+
if (typeof rawCode !== "string") return;
|
|
6281
|
+
const transformedCode = transformEarlyMiniProgramCss(rawCode);
|
|
6282
|
+
if (transformedCode === rawCode) return;
|
|
6283
|
+
cssMemory.rememberKnownSfcSource(id, transformedCode);
|
|
6284
|
+
return transformedCode;
|
|
6285
|
+
},
|
|
6286
|
+
transform: {
|
|
6287
|
+
order: "pre",
|
|
6288
|
+
async handler(code, id) {
|
|
6289
|
+
let transformedCode = code;
|
|
6290
|
+
if (shouldOwnTailwindGeneration && !generatorBranch.isWeb && require_source_candidate_scan_signature.isCSSRequest(id)) transformedCode = transformEarlyMiniProgramCss(code);
|
|
6291
|
+
const shouldReturnTransformedCode = transformedCode !== code;
|
|
6292
|
+
if (shouldOwnTailwindGeneration) cssMemory.rememberKnownSfcSource(id, transformedCode);
|
|
6293
|
+
if (!shouldOwnTailwindGeneration || !require_hmr_timing.isSourceCandidateRequest(id) || !shouldCollectTransformedSourceCandidates(id)) {
|
|
6294
|
+
if (shouldReturnTransformedCode) return {
|
|
6295
|
+
code: transformedCode,
|
|
6296
|
+
map: null
|
|
6297
|
+
};
|
|
6144
6298
|
return;
|
|
6145
6299
|
}
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6300
|
+
return hmrTimingRecorder.measure("sourceCandidates.transform", async () => {
|
|
6301
|
+
invalidateRecordedGeneratorCandidates();
|
|
6302
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
6303
|
+
if (sourceScanMatcher && !sourceScanMatcher(file)) {
|
|
6304
|
+
sourceCandidateCollector.remove(file);
|
|
6305
|
+
cacheCurrentSourceCandidateScan();
|
|
6306
|
+
return;
|
|
6307
|
+
}
|
|
6308
|
+
await sourceCandidateCollector.merge(id, transformedCode);
|
|
6309
|
+
cacheCurrentSourceCandidateScan();
|
|
6310
|
+
if (shouldReturnTransformedCode) return {
|
|
6311
|
+
code: transformedCode,
|
|
6312
|
+
map: null
|
|
6313
|
+
};
|
|
6314
|
+
}, { emit: false });
|
|
6315
|
+
}
|
|
6149
6316
|
},
|
|
6150
6317
|
async watchChange(id, change) {
|
|
6151
6318
|
await hmrTimingRecorder.measure("sourceCandidates.watchChange", async () => {
|
|
@@ -6233,6 +6400,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
6233
6400
|
if (opts.tailwindcssBasedir !== nextTailwindcssBasedir) {
|
|
6234
6401
|
const previousBasedir = opts.tailwindcssBasedir;
|
|
6235
6402
|
opts.tailwindcssBasedir = nextTailwindcssBasedir;
|
|
6403
|
+
shouldRefreshRuntime = syncCssEntriesFromAnchor(nextTailwindcssBasedir) || shouldRefreshRuntime;
|
|
6236
6404
|
debug("align tailwindcss basedir with vite root: %s -> %s", previousBasedir ?? "undefined", nextTailwindcssBasedir);
|
|
6237
6405
|
shouldRefreshRuntime = true;
|
|
6238
6406
|
}
|
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-BYgT1ir9.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-B1SlBmqO.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|