weapp-tailwindcss 5.2.10 → 5.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +6 -0
- package/dist/bundlers/shared/generator-css/user-css.d.ts +1 -1
- package/dist/cli.cjs +372 -293
- package/dist/cli.js +20 -11
- package/dist/{context-DbL0d-zB.js → context-DW4ukjx4.js} +19 -8
- package/dist/{context-C3TryIjF.cjs → context-zWINV_E2.cjs} +17 -11
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{css-imports-DfNC3e6a.cjs → css-imports-BFMU7Hpd.cjs} +1 -1
- package/dist/css-macro/postcss.cjs +1 -1
- package/dist/css-macro.cjs +1 -1
- package/dist/defaults.cjs +2 -0
- package/dist/defaults.js +2 -0
- package/dist/framework.cjs +1 -1
- package/dist/{generator-BLpOsd5O.js → generator-C2UFjlZ1.js} +36 -11
- package/dist/{generator-B0dCFlP1.cjs → generator-CwMI20jy.cjs} +37 -12
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-G6af_vyo.cjs → gulp-CWFxs2lE.cjs} +16 -13
- package/dist/{gulp-CB_GZky7.js → gulp-CltYkglj.js} +12 -9
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-gbPzjYTj.cjs → hmr-timing-BjOxhci8.cjs} +5 -5
- package/dist/{hmr-timing-CZu2ITV8.js → hmr-timing-D6JKLBCD.js} +35 -20
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{object-Bvy6-w9r.js → object-B-8IHefx.js} +4 -4
- package/dist/{object-C_Vr6_S5.cjs → object-DbHtAXRk.cjs} +4 -4
- package/dist/{options-zpZez7qe.cjs → options-CSqLm6U2.cjs} +2 -2
- package/dist/{pipeline-helpers-CtIXw85G.cjs → pipeline-helpers-Cj9ZzHaY.cjs} +25 -10
- package/dist/postcss-html-transform.cjs +1 -1
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +6 -5
- package/dist/presets.js +4 -3
- package/dist/reset.cjs +1 -1
- package/dist/{rolldown-runtime-CVvi-lCc.cjs → rolldown-runtime-Ctb5zv51.cjs} +1 -1
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +1 -1
- package/dist/{source-candidate-scan-signature-DFZlYd3t.js → source-candidate-scan-signature-DQZ_DkgW.js} +5 -4
- package/dist/{source-candidate-scan-signature-CTX7eBJX.cjs → source-candidate-scan-signature-uRHl5Ne9.cjs} +6 -5
- package/dist/{style-options-COpQc8fr.cjs → style-options-D0NukP02.cjs} +9 -4
- package/dist/{tailwindcss-LtnGCxF0.cjs → tailwindcss-B3lqgbln.cjs} +17 -13
- package/dist/{tailwindcss-2zdmASlM.js → tailwindcss-vbApajUH.js} +13 -10
- package/dist/{transform-BlsDWgjt.js → transform-52FLRu-0.js} +2 -2
- package/dist/{transform-9wbmvHcC.cjs → transform-BiHG42Rp.cjs} +2 -2
- package/dist/types/user-defined-options/general.d.ts +2 -0
- package/dist/{v4-generation-core-BVd_4348.cjs → v4-generation-core-2AuNMweK.cjs} +36 -21
- package/dist/{vite-DjU_5LY6.cjs → vite-BLB7vjKQ.cjs} +99 -46
- package/dist/{vite-cIvaBul_.js → vite-q3ilYV7x.js} +94 -41
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/{watch-dependencies-BZGubvuJ.cjs → watch-dependencies-DLZDrWdH.cjs} +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +10 -9
- package/dist/weapp-tw-runtime-classset-loader.cjs +4 -3
- package/dist/{webpack-CvKV7U7L.js → webpack-DExB8tzB.js} +36 -18
- package/dist/{webpack-B9lRT1no.cjs → webpack-Jn4FJT6y.cjs} +40 -31
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/{wxml-CWJc0yY-.js → wxml-B7OAVpXJ.js} +10 -6
- package/dist/{wxml-DUIdXCVa.cjs → wxml-CQmBCjOR.cjs} +386 -311
- package/package.json +6 -6
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_object = require("./object-
|
|
5
|
-
const require_options = require("./options-
|
|
3
|
+
const require_generator = require("./generator-CwMI20jy.cjs");
|
|
4
|
+
const require_object = require("./object-DbHtAXRk.cjs");
|
|
5
|
+
const require_options = require("./options-CSqLm6U2.cjs");
|
|
6
6
|
require("./utils-CuKLf1Zv.cjs");
|
|
7
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
8
|
-
const require_wxml = require("./wxml-
|
|
9
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
10
|
-
const require_context = require("./context-
|
|
11
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
12
|
-
const require_style_options = require("./style-options-
|
|
13
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
7
|
+
const require_v4_generation_core = require("./v4-generation-core-2AuNMweK.cjs");
|
|
8
|
+
const require_wxml = require("./wxml-CQmBCjOR.cjs");
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-BjOxhci8.cjs");
|
|
10
|
+
const require_context = require("./context-zWINV_E2.cjs");
|
|
11
|
+
const require_tailwindcss = require("./tailwindcss-B3lqgbln.cjs");
|
|
12
|
+
const require_style_options = require("./style-options-D0NukP02.cjs");
|
|
13
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-uRHl5Ne9.cjs");
|
|
14
14
|
require("./logger-TlKT3xmR.cjs");
|
|
15
|
-
const require_css_imports = require("./css-imports-
|
|
15
|
+
const require_css_imports = require("./css-imports-BFMU7Hpd.cjs");
|
|
16
16
|
let node_fs = require("node:fs");
|
|
17
17
|
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
18
18
|
let node_path = require("node:path");
|
|
@@ -982,7 +982,7 @@ let _lazyMatch = () => {
|
|
|
982
982
|
}
|
|
983
983
|
return u >= e;
|
|
984
984
|
})));
|
|
985
|
-
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0,
|
|
985
|
+
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
986
986
|
const n = r.map(v);
|
|
987
987
|
return g(_(M((a) => {
|
|
988
988
|
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
|
|
@@ -1424,7 +1424,8 @@ function removeUnsupportedMiniProgramCssImportsFallback(css, file) {
|
|
|
1424
1424
|
return css.split(/\r?\n/).filter((line) => {
|
|
1425
1425
|
const trimmed = line.trim();
|
|
1426
1426
|
if (!trimmed.startsWith("@import")) return true;
|
|
1427
|
-
const
|
|
1427
|
+
const params = trimmed.slice(7).trim().replace(/;$/, "").trim();
|
|
1428
|
+
const request = (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
|
|
1428
1429
|
return request === void 0 || (0, _weapp_tailwindcss_postcss.isMiniProgramLocalCssImportRequest)(request);
|
|
1429
1430
|
}).join("\n");
|
|
1430
1431
|
}
|
|
@@ -1600,7 +1601,8 @@ function collectCssImportAtRuleCss(css) {
|
|
|
1600
1601
|
function parseCssImportRequest(importCss) {
|
|
1601
1602
|
const trimmed = importCss.trim();
|
|
1602
1603
|
if (!trimmed.startsWith("@import")) return;
|
|
1603
|
-
|
|
1604
|
+
const params = trimmed.slice(7).trim().replace(/;$/, "").trim();
|
|
1605
|
+
return (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
|
|
1604
1606
|
}
|
|
1605
1607
|
function shouldRestoreCssImportAtRule(importCss, file) {
|
|
1606
1608
|
if (file === void 0 || !isMiniProgramStyleOutputFile(file)) return true;
|
|
@@ -1857,7 +1859,8 @@ function resolveMiniProgramStyleOutputExtension(options = {}) {
|
|
|
1857
1859
|
}
|
|
1858
1860
|
function resolveReplayCssOutputFile(rootDir, file) {
|
|
1859
1861
|
const cleanFile = file.replace(/[?#].*$/, "");
|
|
1860
|
-
const
|
|
1862
|
+
const nextFile = node_path.default.isAbsolute(cleanFile) ? node_path.default.relative(resolveCssOutputRealPath(rootDir), resolveCssOutputRealPath(cleanFile)) : cleanFile;
|
|
1863
|
+
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(nextFile);
|
|
1861
1864
|
if (normalizedFile.length === 0 || normalizedFile === "." || normalizedFile === ".." || normalizedFile.startsWith("../")) return require_source_candidate_scan_signature.normalizeOutputPathKey(node_path.default.basename(cleanFile));
|
|
1862
1865
|
return normalizedFile;
|
|
1863
1866
|
}
|
|
@@ -3534,7 +3537,8 @@ function collectRememberedCssReplayGroups(sources, opts, rootDir, isWebGenerator
|
|
|
3534
3537
|
const cleanSourceFile = remembered.sourceFile.replace(/[?#].*$/, "");
|
|
3535
3538
|
const resolvedOutputFile = CSS_SOURCE_OUTPUT_EXT_RE.test(cleanSourceFile) ? resolveViteCssPipelineOutputFileFromSourceFile(remembered.sourceFile, opts, rootDir, isWebGeneratorTarget, preserveCssExtension, sourceRoot, styleOutputExtension, styleOutputFiles) : resolveViteCssPipelineOutputFileFromSourceFile(remembered.outputFile, opts, rootDir, isWebGeneratorTarget, preserveCssExtension, sourceRoot, styleOutputExtension, styleOutputFiles);
|
|
3536
3539
|
const rememberedOutputFile = remembered.outputFile.replace(/[?#].*$/, "");
|
|
3537
|
-
const
|
|
3540
|
+
const outputFile = opts.cssMatcher(rememberedOutputFile) && !require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedOutputFile).includes("/") && require_source_candidate_scan_signature.normalizeOutputPathKey(rememberedOutputFile) !== require_source_candidate_scan_signature.normalizeOutputPathKey(resolvedOutputFile.replace(/[?#].*$/, "")) ? remembered.outputFile : resolvedOutputFile;
|
|
3541
|
+
const outputKey = require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile);
|
|
3538
3542
|
const group = groups.get(outputKey) ?? [];
|
|
3539
3543
|
group.push({
|
|
3540
3544
|
key,
|
|
@@ -4939,7 +4943,8 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
4939
4943
|
const rawSource = readAssetSource$1(output);
|
|
4940
4944
|
if (rawSource.trim().length === 0) continue;
|
|
4941
4945
|
if (options.lastCssResultByFile?.has(file)) {
|
|
4942
|
-
const
|
|
4946
|
+
const structurallyCleanSource = require_v4_generation_core.finalizeMiniProgramCssStructure(rawSource);
|
|
4947
|
+
const outputCss = (0, _weapp_tailwindcss_postcss.stripMiniProgramCssSpecificityPlaceholders)(structurallyCleanSource);
|
|
4943
4948
|
if (outputCss !== rawSource) {
|
|
4944
4949
|
plan.write(file, outputCss);
|
|
4945
4950
|
writeTargets.set(file, output);
|
|
@@ -4973,7 +4978,8 @@ async function finalizeMiniProgramCssAssets(bundle, options) {
|
|
|
4973
4978
|
},
|
|
4974
4979
|
cssPresetEnv: {}
|
|
4975
4980
|
});
|
|
4976
|
-
const
|
|
4981
|
+
const structurallyCleanCss = require_v4_generation_core.finalizeMiniProgramCssStructure(css);
|
|
4982
|
+
const outputCss = (0, _weapp_tailwindcss_postcss.stripMiniProgramCssSpecificityPlaceholders)(structurallyCleanCss);
|
|
4977
4983
|
if (outputCss === rawSource) continue;
|
|
4978
4984
|
plan.write(file, outputCss);
|
|
4979
4985
|
writeTargets.set(file, output);
|
|
@@ -5286,7 +5292,8 @@ async function finalizeGenerateBundle(options) {
|
|
|
5286
5292
|
const { activeProcessCacheKeys, activeProcessHashKeys, activeViteCssCacheFiles, bundle, bundleFiles, cache, cssTaskFactories, cssPipelineStrategy, createCssPipelineContext, debug, defaultStyleOutputExtension, formatIteration, generatorCandidateSignature, generatorRuntime, getCssHandlerOptions, getSourceCandidateSourcesForEntries, getSourceCandidatesForEntries, getViteCssCacheStats, getViteProcessedCssAssetResults, hmrTimingRecorder, hmrTimingStartedAt, isHarmonyAppStyleTarget, isNativeAppStyleTarget, isViteProcessedCssAsset, isWebGeneratorTarget, jsAfterCss, jsTaskFactories, lastCssResultByFile, lastCssSourceHashByFile, linkedByEntry, markCssAssetProcessed, metrics, onEnd, onUpdate, opts, outDir, pendingLinkedUpdates, pendingRememberedCssReplayUpdates, prepareJsTransformRuntime, pruneViteCssCaches, recordCssAssetResult, recordTimingDetail, recordViteProcessedCssAssetResult, rootDir, runtime, runtimeState, shouldPreserveAppCssExtension, snapshot, sourceCandidates, sourceRoot, state, styleHandler, tasks, timingDetails, transformRuntime, transformWebTargetCss, useIncrementalMode } = options;
|
|
5287
5293
|
const tasksStart = performance.now();
|
|
5288
5294
|
if (cssTaskFactories.length > 0) {
|
|
5289
|
-
const
|
|
5295
|
+
const cssConcurrency = resolveViteCssTaskConcurrency(useIncrementalMode, runtimeState.tailwindRuntime.majorVersion);
|
|
5296
|
+
const cssTask = require_v4_generation_core.runWithConcurrency(cssTaskFactories, cssConcurrency).then(() => void 0);
|
|
5290
5297
|
if (jsAfterCss) await cssTask;
|
|
5291
5298
|
else tasks.push(cssTask);
|
|
5292
5299
|
}
|
|
@@ -5686,7 +5693,8 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
5686
5693
|
const manifestPath = node_path.default.join(normalizedRoot, "manifest.json");
|
|
5687
5694
|
let enabled = false;
|
|
5688
5695
|
try {
|
|
5689
|
-
|
|
5696
|
+
const raw = node_fs.default.readFileSync(manifestPath, "utf8");
|
|
5697
|
+
enabled = `${(0, comment_json.parse)(raw)["uni-app-x"]?.styleIsolationVersion ?? ""}` === "2";
|
|
5690
5698
|
} catch {
|
|
5691
5699
|
enabled = false;
|
|
5692
5700
|
}
|
|
@@ -5958,12 +5966,13 @@ async function resolveHotSourceModulesByIds(ctx, ids) {
|
|
|
5958
5966
|
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
5959
5967
|
const sourceIds = new Set(ids);
|
|
5960
5968
|
for (const id of ids) {
|
|
5961
|
-
if (typeof id !== "string" || !/\.(?:uvue|nvue)(?:$|[?#])/i.test(id)) continue;
|
|
5969
|
+
if (typeof id !== "string" || !/\.(?:uvue|nvue|vue|tsx?|jsx?)(?:$|[?#])/i.test(id)) continue;
|
|
5962
5970
|
const identity = resolveViteModuleIdentity(id, root);
|
|
5963
5971
|
for (const lookupId of identity.lookupIds) if (!/[?&]import(?:[=&]|$)/.test(lookupId)) sourceIds.add(`${(0, _weapp_tailwindcss_shared.cleanUrl)(lookupId)}?import`);
|
|
5964
5972
|
}
|
|
5965
5973
|
return resolveHotModulesByIds(ctx, sourceIds, (mod) => {
|
|
5966
|
-
|
|
5974
|
+
const modId = mod.id ?? mod.url;
|
|
5975
|
+
return !require_v4_generation_core.isSourceStyleRequest(modId);
|
|
5967
5976
|
});
|
|
5968
5977
|
}
|
|
5969
5978
|
async function resolveHotSourceModules(ctx) {
|
|
@@ -5971,7 +5980,8 @@ async function resolveHotSourceModules(ctx) {
|
|
|
5971
5980
|
const seenModules = /* @__PURE__ */ new Set();
|
|
5972
5981
|
const collectModule = (mod) => {
|
|
5973
5982
|
if (mod == null || seenModules.has(mod)) return;
|
|
5974
|
-
|
|
5983
|
+
const modId = mod.id ?? mod.url;
|
|
5984
|
+
if (require_v4_generation_core.isSourceStyleRequest(modId)) return;
|
|
5975
5985
|
seenModules.add(mod);
|
|
5976
5986
|
modules.push(mod);
|
|
5977
5987
|
};
|
|
@@ -6055,7 +6065,8 @@ function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
|
6055
6065
|
}
|
|
6056
6066
|
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
6057
6067
|
return modules.some((mod) => {
|
|
6058
|
-
|
|
6068
|
+
const modId = mod.id ?? mod.url;
|
|
6069
|
+
return !require_v4_generation_core.isSourceStyleRequest(modId) && mod.isSelfAccepting === true;
|
|
6059
6070
|
});
|
|
6060
6071
|
}
|
|
6061
6072
|
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = [], fallbackSourceIds = []) {
|
|
@@ -6189,7 +6200,7 @@ function resolvePreprocessorTransform(code, id, lang, options) {
|
|
|
6189
6200
|
//#region src/uni-app-x/vite.ts
|
|
6190
6201
|
let transformUVuePromise;
|
|
6191
6202
|
function loadTransformUVue() {
|
|
6192
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
6203
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-BiHG42Rp.cjs")).then((mod) => mod.transformUVue));
|
|
6193
6204
|
return transformUVuePromise;
|
|
6194
6205
|
}
|
|
6195
6206
|
const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
@@ -6431,11 +6442,12 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
6431
6442
|
const { cache, hashKey, createHandlerOptions, debug, getAssetSource, getCssSources, injectStylePlaceholder = true, jsHandler, onUpdate, runtimeSet, applyLinkedResults } = options;
|
|
6432
6443
|
const absoluteFile = require_source_candidate_scan_signature.toAbsoluteOutputPath(file, outDir);
|
|
6433
6444
|
const rawSource = originalSource.source.toString();
|
|
6445
|
+
const rawHashSource = options.hashSalt ? `${rawSource}\n/*${options.hashSalt}*/` : rawSource;
|
|
6434
6446
|
await require_hmr_timing.processCachedTask({
|
|
6435
6447
|
cache,
|
|
6436
6448
|
cacheKey: file,
|
|
6437
6449
|
hashKey,
|
|
6438
|
-
rawSource:
|
|
6450
|
+
rawSource: rawHashSource,
|
|
6439
6451
|
applyResult(source) {
|
|
6440
6452
|
originalSource.source = source;
|
|
6441
6453
|
},
|
|
@@ -6665,16 +6677,18 @@ async function processRememberedCssReplay(options) {
|
|
|
6665
6677
|
const allRememberedSignaturesFresh = rememberedKeys.length > 0 && rememberedKeys.every((key) => getRememberedCssSignature?.(key) === rememberedCssRuntimeSignature);
|
|
6666
6678
|
if (bundleFiles.includes(rememberedOutputFile) || bundleFiles.includes(sourceFile)) continue;
|
|
6667
6679
|
const shouldMergeReplayIntoFrameworkRootTarget = outputFile !== rememberedOutputFile && normalizedBundleFiles.has(require_source_candidate_scan_signature.normalizeOutputPathKey(outputFile));
|
|
6668
|
-
if (allRememberedSignaturesFresh)
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6680
|
+
if (allRememberedSignaturesFresh) {
|
|
6681
|
+
if (!shouldMergeReplayIntoFrameworkRootTarget) continue;
|
|
6682
|
+
else {
|
|
6683
|
+
const cachedCss = getLastCssResult(lastCssResultByFile, outputFile);
|
|
6684
|
+
if (cachedCss != null) {
|
|
6685
|
+
pendingRememberedCssReplayUpdates.push(...createRememberedCssReplayUpdates(cachedCss, sourceFile, outputFile, true));
|
|
6686
|
+
metrics.css.cacheHits++;
|
|
6687
|
+
debug("css replay cached result into framework root target: %s", outputFile);
|
|
6688
|
+
continue;
|
|
6689
|
+
}
|
|
6690
|
+
debug("css replay framework root target cache miss, regenerate: %s", outputFile);
|
|
6676
6691
|
}
|
|
6677
|
-
debug("css replay framework root target cache miss, regenerate: %s", outputFile);
|
|
6678
6692
|
}
|
|
6679
6693
|
const sourceTraceSources = scopedSourceCandidateSourceGetter ? await require_source_candidate_scan_signature.createScopedGeneratorSourceTraceMap(generatorRawSource, sourceFile, scopedSourceCandidateSourceGetter) : void 0;
|
|
6680
6694
|
const sourceTraceTokenSources = sourceTraceSources ? require_v4_generation_core.createCssTokenSourceMap(sourceTraceSources, opts) : void 0;
|
|
@@ -7149,7 +7163,8 @@ function resolveCurrentSourceCandidateFile(options) {
|
|
|
7149
7163
|
}
|
|
7150
7164
|
function resolveCurrentSourceCandidateSource(options) {
|
|
7151
7165
|
const { file, getSourceCandidateSource, getSourceCandidateSources } = options;
|
|
7152
|
-
const
|
|
7166
|
+
const cleanedFile = file.replace(/[?#].*$/, "");
|
|
7167
|
+
const normalizedFile = require_source_candidate_scan_signature.normalizeOutputPathKey(cleanedFile);
|
|
7153
7168
|
const sourceCandidates = createSourceCandidateFiles(options);
|
|
7154
7169
|
const explicitSource = sourceCandidates.reduce((source, candidate) => {
|
|
7155
7170
|
if (source || !candidate) return source;
|
|
@@ -9363,12 +9378,36 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9363
9378
|
const request = mod.url ?? mod.id;
|
|
9364
9379
|
return typeof request === "string" && /\.(?:uvue|nvue)(?:\?import)?$/i.test(request);
|
|
9365
9380
|
});
|
|
9381
|
+
const sendSupplementalSourceHotUpdates = (ctx, modules) => {
|
|
9382
|
+
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
9383
|
+
const updates = modules.flatMap((mod) => [mod, ...mod.importedModules ?? []]).filter((mod) => !require_v4_generation_core.isSourceStyleRequest(mod.id ?? mod.url)).map((mod) => {
|
|
9384
|
+
let hotPath;
|
|
9385
|
+
if (typeof mod.id === "string" && node_path.default.isAbsolute(mod.id)) {
|
|
9386
|
+
const relative = typeof mod.url === "string" && mod.url.startsWith("/pages/") ? node_path.default.relative(node_path.default.dirname(root), mod.id) : node_path.default.relative(root, mod.id);
|
|
9387
|
+
if (relative && !relative.startsWith("..") && !node_path.default.isAbsolute(relative)) hotPath = `/${relative.split(node_path.default.sep).join("/")}`;
|
|
9388
|
+
}
|
|
9389
|
+
hotPath ?? (hotPath = mod.url ?? (typeof mod.id === "string" && mod.id.startsWith("/") ? mod.id : void 0));
|
|
9390
|
+
return hotPath ? {
|
|
9391
|
+
acceptedPath: hotPath,
|
|
9392
|
+
explicitImportRequired: false,
|
|
9393
|
+
isWithinCircularImport: false,
|
|
9394
|
+
path: hotPath,
|
|
9395
|
+
timestamp: ctx.timestamp,
|
|
9396
|
+
type: "js-update"
|
|
9397
|
+
} : void 0;
|
|
9398
|
+
}).filter((update) => update !== void 0);
|
|
9399
|
+
if (updates.length > 0) ctx.server.ws?.send?.({
|
|
9400
|
+
type: "update",
|
|
9401
|
+
updates
|
|
9402
|
+
});
|
|
9403
|
+
};
|
|
9366
9404
|
return {
|
|
9367
9405
|
name: `${require_context.vitePluginName}:source-candidates`,
|
|
9368
9406
|
enforce: "pre",
|
|
9369
9407
|
async load(id) {
|
|
9370
9408
|
if (!options.shouldOwnTailwindGeneration || options.isWebOrNativeAppPlatform(options.resolveViteStylePlatform()) || !isCSSRequest(id) || !shouldCollectTransformedSourceCandidates(id)) return;
|
|
9371
|
-
const
|
|
9409
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
9410
|
+
const rawCode = await (0, node_fs_promises.readFile)(file, "utf8").catch(() => void 0);
|
|
9372
9411
|
if (typeof rawCode !== "string") return;
|
|
9373
9412
|
options.rememberOriginalCssLayerSource(id, rawCode);
|
|
9374
9413
|
const transformedCode = options.transformEarlyMiniProgramCss(rawCode);
|
|
@@ -9470,12 +9509,22 @@ function createFrameworkSourceCandidatesPlugin(options) {
|
|
|
9470
9509
|
const cssModules = await resolveHotTailwindCssModules(ctx, require_v4_generation_core.isSourceStyleRequest(ctx.file) ? [ctx.file] : options.tailwindRootCssModuleIds);
|
|
9471
9510
|
const hotRoot = ctx.server.config?.root ?? node_process.default.cwd();
|
|
9472
9511
|
const sourceModules = isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) ? await resolveHotSourceModules(ctx) : ctx.modules;
|
|
9512
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file)) {
|
|
9513
|
+
sendSupplementalSourceHotUpdates(ctx, sourceModules);
|
|
9514
|
+
if (sourceModules.some((mod) => {
|
|
9515
|
+
const id = mod.id ?? mod.url;
|
|
9516
|
+
return typeof id === "string" && /[?&]macro=true(?:&|$)/.test(id) === false && typeof mod.url === "string" && mod.url.startsWith("/pages/") && /\.vue(?:$|[?#])/i.test(id);
|
|
9517
|
+
})) {
|
|
9518
|
+
queueMicrotask(() => sendFullReloadForUnresolvedHotUpdate(ctx));
|
|
9519
|
+
return [];
|
|
9520
|
+
}
|
|
9521
|
+
}
|
|
9473
9522
|
const hasHmrCandidateAppend = options.hmrCandidateState.hasPendingCandidateAppend() || canUseHmrCandidateAppend && sourceCandidateChange !== void 0 && sourceCandidateChange.addedCandidates.size > 0;
|
|
9474
9523
|
if (isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) && !hasHmrCandidateAppend && !isWebLikeHotUpdate && (!hasSelfAcceptingNonStyleHotModule(sourceModules) && cssModules.length === 0 || cssModules.length > 0 && options.isUniViteProject())) {
|
|
9475
9524
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
9476
9525
|
return [];
|
|
9477
9526
|
}
|
|
9478
|
-
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) && sourceModules.some((mod) => options.
|
|
9527
|
+
if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !require_v4_generation_core.isSourceStyleRequest(ctx.file) && sourceModules.some((mod) => options.isNuxtPageHotModule?.(mod.id ?? mod.url))) {
|
|
9479
9528
|
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
9480
9529
|
return [];
|
|
9481
9530
|
}
|
|
@@ -10004,9 +10053,11 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
|
|
|
10004
10053
|
const platform = resolveViteStylePlatform();
|
|
10005
10054
|
return platform ? isWebOrNativeAppPlatform(platform) : resolveCurrentGeneratorBranch().isWeb;
|
|
10006
10055
|
};
|
|
10007
|
-
const
|
|
10008
|
-
if (typeof id !== "string"
|
|
10009
|
-
const cleanId = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
10056
|
+
const isNuxtPageHotModule = (id) => {
|
|
10057
|
+
if (typeof id !== "string") return false;
|
|
10058
|
+
const cleanId = (0, _weapp_tailwindcss_shared.cleanUrl)(id).replace(/%2F/gi, "/");
|
|
10059
|
+
if (cleanId.includes("virtual:nuxt:") && /(?:^|\/)routes\.mjs$/.test(cleanId)) return true;
|
|
10060
|
+
if (!/[?&]macro=true(?:&|$)/.test(id)) return false;
|
|
10010
10061
|
return cleanId.includes("/pages/") && /\.(?:vue|tsx?|jsx?)$/.test(cleanId);
|
|
10011
10062
|
};
|
|
10012
10063
|
const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey((0, _weapp_tailwindcss_shared.cleanUrl)(file));
|
|
@@ -10406,7 +10457,7 @@ ${tracedCss}`;
|
|
|
10406
10457
|
hmrTimingRecorder,
|
|
10407
10458
|
invalidateRecordedGeneratorCandidates,
|
|
10408
10459
|
isCurrentWebLikeStylePlatform,
|
|
10409
|
-
|
|
10460
|
+
isNuxtPageHotModule,
|
|
10410
10461
|
isUniViteProject,
|
|
10411
10462
|
isWebOrNativeAppPlatform,
|
|
10412
10463
|
prepareTailwindGeneration,
|
|
@@ -10720,17 +10771,19 @@ function withUniAppXWebPreflightReset(css, enabled) {
|
|
|
10720
10771
|
//#region src/bundlers/vite/uni-app-x-css-options.ts
|
|
10721
10772
|
function resolveUniAppXNativeCssHandlerOptions(opts) {
|
|
10722
10773
|
const uniUtsPlatform = require_generator.resolveUniUtsPlatform();
|
|
10723
|
-
|
|
10774
|
+
const branch = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
10724
10775
|
appType: opts.appType,
|
|
10725
10776
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
10726
10777
|
uniAppX: require_options.resolveUniAppXOptions(opts.uniAppX),
|
|
10727
10778
|
uniUtsPlatform
|
|
10728
|
-
})
|
|
10779
|
+
});
|
|
10780
|
+
const runtimeBranch = require_generator.resolveGeneratorRuntimeBranch(branch, {
|
|
10729
10781
|
appType: opts.appType,
|
|
10730
10782
|
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
10731
10783
|
uniAppX: require_options.resolveUniAppXOptions(opts.uniAppX),
|
|
10732
10784
|
uniUtsPlatform
|
|
10733
|
-
})
|
|
10785
|
+
});
|
|
10786
|
+
if (!require_generator.shouldUseNativeAppCssBranch(runtimeBranch) || !require_options.isUniAppXEnabled(opts.uniAppX)) return {};
|
|
10734
10787
|
return {
|
|
10735
10788
|
uniAppX: true,
|
|
10736
10789
|
uniAppXCssTarget: "uvue",
|