weapp-tailwindcss 5.3.2 → 5.3.3
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/source-candidates/types-and-cache.d.ts +3 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +15 -0
- package/dist/{context-Kvr3lLEC.js → context-4ittVpgt.js} +1 -1
- package/dist/{context-CB4Ef9U0.cjs → context-Ulhcd5lF.cjs} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{gulp-vz36-uQP.js → gulp-8V2aiU52.js} +3 -3
- package/dist/{gulp-QJ_oz-06.cjs → gulp-CsssU4xB.cjs} +6 -6
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-HGlM4hX3.js → hmr-timing-CTpjCpQh.js} +42 -13
- package/dist/{hmr-timing-W3kro20F.cjs → hmr-timing-DyiiYupC.cjs} +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/local-style-matcher-DRpFEu1s.cjs +34 -0
- package/dist/local-style-matcher-DsiI2wIc.js +17 -0
- package/dist/{options-CKZW99r4.cjs → options-BJrtIQbH.cjs} +3 -1
- package/dist/{pipeline-helpers-t95KPu4O.cjs → pipeline-helpers-Cda0Ox3K.cjs} +2 -2
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +1 -1
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{source-candidate-scan-signature-BHCPQVoD.js → source-candidate-scan-signature--r31NK5J.js} +2 -2
- package/dist/{source-candidate-scan-signature-BSad7bMQ.cjs → source-candidate-scan-signature-bJFr7L8T.cjs} +2 -2
- package/dist/{style-options-PCgz2ywM.cjs → style-options-DW30H5PV.cjs} +1 -1
- package/dist/{tailwindcss-jKzY37Sk.cjs → tailwindcss-CexDJBhx.cjs} +1 -1
- package/dist/{tailwindcss-BSEdWieh.js → tailwindcss-ChnpCv25.js} +3 -1
- package/dist/{component-local-style-CNhEhd2B.cjs → transform-BQjg2T2T.cjs} +201 -27
- package/dist/{component-local-style-C2wC8o9F.js → transform-Cp4KybBy.js} +207 -16
- package/dist/types/user-defined-options/important.d.ts +2 -0
- package/dist/uni-app-x/component-local-style.d.ts +6 -4
- package/dist/uni-app-x/local-style-matcher.d.ts +4 -0
- package/dist/uni-app-x/options.d.ts +2 -0
- package/dist/uni-app-x/style-asset/harmony-global.d.ts +2 -0
- package/dist/uni-app-x/transform.d.ts +2 -0
- package/dist/uni-app-x/vite/plugin-options.d.ts +1 -0
- package/dist/{v4-generation-core-BfeXEc6R.cjs → v4-generation-core-8YMXikPd.cjs} +42 -13
- package/dist/{vite-Dy6THt54.cjs → vite-CeyMHgzQ.cjs} +68 -15
- package/dist/{vite-CVr0vIgh.js → vite-kY-WXrd6.js} +121 -68
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +4 -4
- package/dist/{webpack-DwtdWqwr.js → webpack-BN2kLWW_.js} +4 -4
- package/dist/{webpack-Cf5RnhXt.cjs → webpack-Bfj63Wt1.cjs} +8 -8
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +3 -3
- package/dist/transform-CgohToUV.cjs +0 -200
- package/dist/transform-DSRPiBWz.js +0 -201
|
@@ -2,9 +2,9 @@ const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
|
2
2
|
const require_generator = require("./generator-DKiYbTFR.cjs");
|
|
3
3
|
require("./auto-DtU6f3X6.cjs");
|
|
4
4
|
const require_object = require("./object-DbHtAXRk.cjs");
|
|
5
|
-
const require_options = require("./options-
|
|
5
|
+
const require_options = require("./options-BJrtIQbH.cjs");
|
|
6
6
|
const require_wxml = require("./wxml-CQmBCjOR.cjs");
|
|
7
|
-
const require_style_options = require("./style-options-
|
|
7
|
+
const require_style_options = require("./style-options-DW30H5PV.cjs");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
let node_path = require("node:path");
|
|
10
10
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -312,9 +312,11 @@ function createSourceCandidateStore(options = {}) {
|
|
|
312
312
|
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
313
313
|
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
314
314
|
const cssCandidatesById = /* @__PURE__ */ new Map();
|
|
315
|
+
const moduleCandidatesById = /* @__PURE__ */ new Map();
|
|
315
316
|
const scanSourceById = /* @__PURE__ */ new Map();
|
|
316
317
|
const transformSourceById = /* @__PURE__ */ new Map();
|
|
317
318
|
const cssSourceById = /* @__PURE__ */ new Map();
|
|
319
|
+
const moduleSourceById = /* @__PURE__ */ new Map();
|
|
318
320
|
const candidateCount = /* @__PURE__ */ new Map();
|
|
319
321
|
let inlineIncludedCandidates = /* @__PURE__ */ new Set();
|
|
320
322
|
let inlineExcludedCandidates = /* @__PURE__ */ new Set();
|
|
@@ -345,6 +347,13 @@ function createSourceCandidateStore(options = {}) {
|
|
|
345
347
|
cssSourceById.set(normalizedId, source);
|
|
346
348
|
replaceCssLayer(normalizedId, await resolveCandidates(source, "css"));
|
|
347
349
|
}
|
|
350
|
+
async function syncModuleSource(id, source) {
|
|
351
|
+
const normalizedId = cleanUrl(id);
|
|
352
|
+
moduleSourceById.set(normalizedId, source);
|
|
353
|
+
const candidates = await resolveCandidates(source, resolveSourceCandidateExtension(normalizedId));
|
|
354
|
+
replaceModuleLayer(normalizedId, candidates);
|
|
355
|
+
return new Set(candidates);
|
|
356
|
+
}
|
|
348
357
|
async function merge(id, source) {
|
|
349
358
|
const normalizedId = cleanUrl(id);
|
|
350
359
|
transformSourceById.set(normalizedId, source);
|
|
@@ -372,8 +381,10 @@ function createSourceCandidateStore(options = {}) {
|
|
|
372
381
|
if (extension !== "css") {
|
|
373
382
|
transformCandidatesById.delete(normalizedId);
|
|
374
383
|
cssCandidatesById.delete(normalizedId);
|
|
384
|
+
moduleCandidatesById.delete(normalizedId);
|
|
375
385
|
transformSourceById.delete(normalizedId);
|
|
376
386
|
cssSourceById.delete(normalizedId);
|
|
387
|
+
moduleSourceById.delete(normalizedId);
|
|
377
388
|
}
|
|
378
389
|
scanSourceById.set(normalizedId, source);
|
|
379
390
|
replaceScanLayer(normalizedId, nextCandidates);
|
|
@@ -431,12 +442,19 @@ function createSourceCandidateStore(options = {}) {
|
|
|
431
442
|
else cssCandidatesById.set(normalizedId, nextCandidates);
|
|
432
443
|
recompute(normalizedId);
|
|
433
444
|
}
|
|
445
|
+
function replaceModuleLayer(id, nextCandidates) {
|
|
446
|
+
const normalizedId = cleanUrl(id);
|
|
447
|
+
if (nextCandidates.size === 0) moduleCandidatesById.delete(normalizedId);
|
|
448
|
+
else moduleCandidatesById.set(normalizedId, nextCandidates);
|
|
449
|
+
recompute(normalizedId);
|
|
450
|
+
}
|
|
434
451
|
function recompute(id) {
|
|
435
452
|
const normalizedId = cleanUrl(id);
|
|
436
453
|
replaceFinal(normalizedId, /* @__PURE__ */ new Set([
|
|
437
454
|
...scanCandidatesById.get(normalizedId) ?? [],
|
|
438
455
|
...transformCandidatesById.get(normalizedId) ?? [],
|
|
439
|
-
...cssCandidatesById.get(normalizedId) ?? []
|
|
456
|
+
...cssCandidatesById.get(normalizedId) ?? [],
|
|
457
|
+
...moduleCandidatesById.get(normalizedId) ?? []
|
|
440
458
|
]));
|
|
441
459
|
}
|
|
442
460
|
function syncInline(inlineCandidates) {
|
|
@@ -450,9 +468,11 @@ function createSourceCandidateStore(options = {}) {
|
|
|
450
468
|
scanCandidatesById.delete(normalizedId);
|
|
451
469
|
transformCandidatesById.delete(normalizedId);
|
|
452
470
|
cssCandidatesById.delete(normalizedId);
|
|
471
|
+
moduleCandidatesById.delete(normalizedId);
|
|
453
472
|
scanSourceById.delete(normalizedId);
|
|
454
473
|
transformSourceById.delete(normalizedId);
|
|
455
474
|
cssSourceById.delete(normalizedId);
|
|
475
|
+
moduleSourceById.delete(normalizedId);
|
|
456
476
|
const previousCandidates = candidatesById.get(normalizedId);
|
|
457
477
|
if (!previousCandidates) return diffCandidateSets(previousVisibleCandidates, /* @__PURE__ */ new Set());
|
|
458
478
|
removeCandidateSet(candidateCount, previousCandidates);
|
|
@@ -461,7 +481,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
461
481
|
}
|
|
462
482
|
function source(id) {
|
|
463
483
|
const normalizedId = cleanUrl(id);
|
|
464
|
-
return scanSourceById.get(normalizedId) ?? cssSourceById.get(normalizedId) ?? transformSourceById.get(normalizedId);
|
|
484
|
+
return scanSourceById.get(normalizedId) ?? cssSourceById.get(normalizedId) ?? transformSourceById.get(normalizedId) ?? moduleSourceById.get(normalizedId);
|
|
465
485
|
}
|
|
466
486
|
function sources() {
|
|
467
487
|
return mergeSourcesByPriority().entries();
|
|
@@ -475,10 +495,10 @@ function createSourceCandidateStore(options = {}) {
|
|
|
475
495
|
if (entries === void 0) {
|
|
476
496
|
if (!options.excludeEntries?.length) return values();
|
|
477
497
|
}
|
|
478
|
-
if (entries?.length === 0) return new Set(inlineIncludedCandidates);
|
|
479
498
|
const filtered = /* @__PURE__ */ new Set();
|
|
480
499
|
for (const [id, candidates] of candidatesById) {
|
|
481
|
-
|
|
500
|
+
const isActiveModule = moduleCandidatesById.has(id);
|
|
501
|
+
if (entries !== void 0 && (isActiveModule ? require_generator.isFileExcludedByTailwindSourceEntries(id, entries) : entries.length === 0 || !require_generator.isFileMatchedByTailwindSourceEntries(id, entries))) continue;
|
|
482
502
|
if (options.excludeEntries?.length && require_generator.isFileMatchedByTailwindSourceEntries(id, options.excludeEntries)) continue;
|
|
483
503
|
for (const candidate of candidates) filtered.add(candidate);
|
|
484
504
|
}
|
|
@@ -496,13 +516,9 @@ function createSourceCandidateStore(options = {}) {
|
|
|
496
516
|
}
|
|
497
517
|
if (id) candidateSources.add(id);
|
|
498
518
|
};
|
|
499
|
-
if (entries?.length === 0) {
|
|
500
|
-
for (const candidate of inlineIncludedCandidates) addCandidateSource(candidate, void 0);
|
|
501
|
-
for (const candidate of inlineExcludedCandidates) sources.delete(candidate);
|
|
502
|
-
return sources;
|
|
503
|
-
}
|
|
504
519
|
for (const [id, candidates] of candidatesById) {
|
|
505
|
-
|
|
520
|
+
const isActiveModule = moduleCandidatesById.has(id);
|
|
521
|
+
if (entries !== void 0 && (isActiveModule ? require_generator.isFileExcludedByTailwindSourceEntries(id, entries) : entries.length === 0 || !require_generator.isFileMatchedByTailwindSourceEntries(id, entries))) continue;
|
|
506
522
|
if (options.excludeEntries?.length && require_generator.isFileMatchedByTailwindSourceEntries(id, options.excludeEntries)) continue;
|
|
507
523
|
for (const candidate of candidates) addCandidateSource(candidate, id);
|
|
508
524
|
}
|
|
@@ -515,9 +531,11 @@ function createSourceCandidateStore(options = {}) {
|
|
|
515
531
|
scanCandidatesById.clear();
|
|
516
532
|
transformCandidatesById.clear();
|
|
517
533
|
cssCandidatesById.clear();
|
|
534
|
+
moduleCandidatesById.clear();
|
|
518
535
|
scanSourceById.clear();
|
|
519
536
|
transformSourceById.clear();
|
|
520
537
|
cssSourceById.clear();
|
|
538
|
+
moduleSourceById.clear();
|
|
521
539
|
candidateCount.clear();
|
|
522
540
|
inlineIncludedCandidates.clear();
|
|
523
541
|
inlineExcludedCandidates.clear();
|
|
@@ -539,6 +557,8 @@ function createSourceCandidateStore(options = {}) {
|
|
|
539
557
|
candidatesById: [...candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
540
558
|
cssCandidatesById: [...cssCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
541
559
|
cssSourceById: [...cssSourceById.entries()],
|
|
560
|
+
moduleCandidatesById: [...moduleCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
561
|
+
moduleSourceById: [...moduleSourceById.entries()],
|
|
542
562
|
scanCandidatesById: [...scanCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
543
563
|
scanSourceById: [...scanSourceById.entries()],
|
|
544
564
|
sourceById: [...mergeSourcesByPriority().entries()],
|
|
@@ -568,13 +588,20 @@ function createSourceCandidateStore(options = {}) {
|
|
|
568
588
|
if (candidateSet.size === 0) continue;
|
|
569
589
|
cssCandidatesById.set(id, candidateSet);
|
|
570
590
|
}
|
|
591
|
+
for (const [id, candidates] of snapshot.moduleCandidatesById ?? []) {
|
|
592
|
+
const candidateSet = new Set(candidates);
|
|
593
|
+
if (candidateSet.size === 0) continue;
|
|
594
|
+
moduleCandidatesById.set(id, candidateSet);
|
|
595
|
+
}
|
|
571
596
|
for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
|
|
572
597
|
for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
|
|
573
598
|
for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
|
|
599
|
+
for (const [id, source] of snapshot.moduleSourceById ?? []) moduleSourceById.set(id, source);
|
|
574
600
|
const ids = /* @__PURE__ */ new Set([
|
|
575
601
|
...scanCandidatesById.keys(),
|
|
576
602
|
...transformCandidatesById.keys(),
|
|
577
|
-
...cssCandidatesById.keys()
|
|
603
|
+
...cssCandidatesById.keys(),
|
|
604
|
+
...moduleCandidatesById.keys()
|
|
578
605
|
]);
|
|
579
606
|
for (const id of ids) recompute(id);
|
|
580
607
|
}
|
|
@@ -582,6 +609,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
582
609
|
syncSource: sync,
|
|
583
610
|
sync,
|
|
584
611
|
syncCss,
|
|
612
|
+
syncModuleSource,
|
|
585
613
|
merge,
|
|
586
614
|
syncFile,
|
|
587
615
|
syncCurrentSource,
|
|
@@ -603,6 +631,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
603
631
|
};
|
|
604
632
|
function mergeSourcesByPriority() {
|
|
605
633
|
const sources = /* @__PURE__ */ new Map();
|
|
634
|
+
for (const [id, source] of moduleSourceById) sources.set(id, source);
|
|
606
635
|
for (const [id, source] of transformSourceById) sources.set(id, source);
|
|
607
636
|
for (const [id, source] of cssSourceById) sources.set(id, source);
|
|
608
637
|
for (const [id, source] of scanSourceById) sources.set(id, source);
|
|
@@ -2,17 +2,17 @@ const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
3
|
const require_generator = require("./generator-DKiYbTFR.cjs");
|
|
4
4
|
const require_object = require("./object-DbHtAXRk.cjs");
|
|
5
|
-
const require_options = require("./options-
|
|
5
|
+
const require_options = require("./options-BJrtIQbH.cjs");
|
|
6
6
|
require("./utils-CuKLf1Zv.cjs");
|
|
7
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
7
|
+
const require_v4_generation_core = require("./v4-generation-core-8YMXikPd.cjs");
|
|
8
8
|
const require_wxml = require("./wxml-CQmBCjOR.cjs");
|
|
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-
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-DyiiYupC.cjs");
|
|
10
|
+
const require_context = require("./context-Ulhcd5lF.cjs");
|
|
11
|
+
const require_tailwindcss = require("./tailwindcss-CexDJBhx.cjs");
|
|
12
|
+
const require_style_options = require("./style-options-DW30H5PV.cjs");
|
|
13
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-bJFr7L8T.cjs");
|
|
14
|
+
const require_local_style_matcher = require("./local-style-matcher-DRpFEu1s.cjs");
|
|
14
15
|
require("./logger-TlKT3xmR.cjs");
|
|
15
|
-
const require_component_local_style = require("./component-local-style-CNhEhd2B.cjs");
|
|
16
16
|
const require_css_imports = require("./css-imports-BFMU7Hpd.cjs");
|
|
17
17
|
let node_fs = require("node:fs");
|
|
18
18
|
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
@@ -507,6 +507,18 @@ const APP_JS_RE$1 = /(?:^|\/)App\.js$/;
|
|
|
507
507
|
const COMPONENT_JS_RE = /(?:^|\/)components\/.+\.js$/;
|
|
508
508
|
const STYLE_DECL_RE = /const\s+(_style_\d+)\s*=\s*\{/g;
|
|
509
509
|
const EXPORT_SFC_RE = /_export_sfc\(_sfc_main\s*,\s*\[/;
|
|
510
|
+
function resolveSfcSourceId(code) {
|
|
511
|
+
const match = code.match(/\[\s*["']__file["']\s*,\s*(["'])(.*?)\1\s*\]/);
|
|
512
|
+
return match?.[2] ? require_local_style_matcher.normalizeUniAppXLocalStyleId(match[2]) : void 0;
|
|
513
|
+
}
|
|
514
|
+
function shouldExcludeComponent(file, code, options) {
|
|
515
|
+
if (!options.excludeComponents) return false;
|
|
516
|
+
const sourceId = resolveSfcSourceId(code);
|
|
517
|
+
if (sourceId) return require_local_style_matcher.shouldEnableComponentLocalStyle(sourceId, options.componentMatcher);
|
|
518
|
+
const normalizedFile = require_local_style_matcher.normalizeUniAppXLocalStyleId(file);
|
|
519
|
+
if (options.componentMatcher?.(normalizedFile)) return true;
|
|
520
|
+
return COMPONENT_JS_RE.test(normalizedFile);
|
|
521
|
+
}
|
|
510
522
|
function resolveStyleAssetFile(file) {
|
|
511
523
|
if (!UVUE_TS_RE.test(file)) return;
|
|
512
524
|
return file.replace(/\.uvue\.ts$/, ".uvue");
|
|
@@ -610,7 +622,7 @@ function injectStyleOption(code, styleVarName) {
|
|
|
610
622
|
}
|
|
611
623
|
function injectUniAppXHarmonyGlobalStyles(file, code, getBundleSource, options = {}) {
|
|
612
624
|
if (!JS_RE.test(file) || APP_JS_RE$1.test(file)) return code;
|
|
613
|
-
if (
|
|
625
|
+
if (shouldExcludeComponent(file, code, options)) return code;
|
|
614
626
|
const appSource = getBundleSource?.("assets/App.js") ?? getBundleSource?.("App.js");
|
|
615
627
|
const appStyle = appSource ? mergeStyleValues(...findStyleObjectDecls(appSource).map((decl) => parseStyleObject(decl.objectText))) : void 0;
|
|
616
628
|
const parseableLocalStyles = findStyleObjectDecls(code).flatMap((decl) => {
|
|
@@ -6315,7 +6327,7 @@ function createUniAppXWebLocalStyleBridge(isEnabled) {
|
|
|
6315
6327
|
//#region src/uni-app-x/vite.ts
|
|
6316
6328
|
let transformUVuePromise;
|
|
6317
6329
|
function loadTransformUVue() {
|
|
6318
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
6330
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-BQjg2T2T.cjs")).then((mod) => mod.transformUVue));
|
|
6319
6331
|
return transformUVuePromise;
|
|
6320
6332
|
}
|
|
6321
6333
|
const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
@@ -6324,7 +6336,7 @@ function resolveUniAppXJsTransformEnabled(uniAppX) {
|
|
|
6324
6336
|
return uniAppX === void 0 ? true : require_options.isUniAppXEnabled(uniAppX);
|
|
6325
6337
|
}
|
|
6326
6338
|
function createUniAppXPlugins(options) {
|
|
6327
|
-
const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, runtimeState, styleHandler, syncSourceCandidatesForHotUpdate, tailwindRootCssModuleIds = [], generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, isNativeAppStyleTarget = () => false, isWebGeneratorTarget = () => require_generator.resolveUniUtsPlatform().isWeb, uniAppX, viteProcessedCssSourceFiles = [] } = options;
|
|
6339
|
+
const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, registerModuleGraphCandidates, runtimeState, styleHandler, syncSourceCandidatesForHotUpdate, tailwindRootCssModuleIds = [], generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, isNativeAppStyleTarget = () => false, isWebGeneratorTarget = () => require_generator.resolveUniUtsPlatform().isWeb, uniAppX, viteProcessedCssSourceFiles = [] } = options;
|
|
6328
6340
|
const resolvedUniAppXOptions = require_options.resolveUniAppXOptions(uniAppX);
|
|
6329
6341
|
const utsPlatform = require_generator.resolveUniUtsPlatform();
|
|
6330
6342
|
const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
|
|
@@ -6356,7 +6368,7 @@ function createUniAppXPlugins(options) {
|
|
|
6356
6368
|
return componentLocalStyleEnabled;
|
|
6357
6369
|
}
|
|
6358
6370
|
function shouldEnablePageLocalStyleForFile(id) {
|
|
6359
|
-
return resolvedUniAppXOptions.componentLocalStyles.enabled && (isNativeAppBuildTarget(id) ||
|
|
6371
|
+
return resolvedUniAppXOptions.componentLocalStyles.enabled && (isNativeAppBuildTarget(id) || require_local_style_matcher.shouldEnablePageLocalStyle(id, resolvedUniAppXOptions.componentLocalStyles.pageMatcher));
|
|
6360
6372
|
}
|
|
6361
6373
|
function isHarmonyBuildTarget() {
|
|
6362
6374
|
if (require_generator.resolveUniUtsPlatform().isAppHarmony) return true;
|
|
@@ -6461,18 +6473,22 @@ function createUniAppXPlugins(options) {
|
|
|
6461
6473
|
nativeLocalStyleModuleIds.add((0, _weapp_tailwindcss_shared.cleanUrl)(id));
|
|
6462
6474
|
}
|
|
6463
6475
|
harmonyApply.rememberSource(code, id, true);
|
|
6476
|
+
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
6477
|
+
const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
|
|
6464
6478
|
const resolvedConfig = getResolvedConfig();
|
|
6465
6479
|
const shouldForceRefresh = resolvedConfig?.command === "serve" || resolvedConfig?.command === "build";
|
|
6466
|
-
const
|
|
6480
|
+
const moduleGraphCandidates = enableComponentLocalStyle || enablePageLocalStyle ? await registerModuleGraphCandidates?.(id, code) : void 0;
|
|
6481
|
+
const runtimeSet = await ensureRuntimeClassSet(shouldForceRefresh);
|
|
6482
|
+
const currentRuntimeSet = moduleGraphCandidates?.size ? /* @__PURE__ */ new Set([...runtimeSet, ...moduleGraphCandidates]) : runtimeSet;
|
|
6467
6483
|
nativeHmrReloader.remember(currentRuntimeSet);
|
|
6468
6484
|
const transformUVue = await loadTransformUVue();
|
|
6469
|
-
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
6470
|
-
const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
|
|
6471
6485
|
const transformOptions = require_object.omitUndefined({
|
|
6486
|
+
componentMatcher: resolvedUniAppXOptions.componentLocalStyles.componentMatcher,
|
|
6472
6487
|
...customAttributesEntities.length > 0 ? { customAttributesEntities } : {},
|
|
6473
6488
|
...disabledDefaultTemplateHandler ? { disabledDefaultTemplateHandler } : {},
|
|
6474
6489
|
...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
|
|
6475
6490
|
...enablePageLocalStyle ? { enablePageLocalStyle } : {},
|
|
6491
|
+
pageMatcher: resolvedUniAppXOptions.componentLocalStyles.pageMatcher,
|
|
6476
6492
|
...isWebGeneratorTarget() && customAttributesEntities.length > 0 ? { webCustomAttributeDeep: true } : {},
|
|
6477
6493
|
...isWebGeneratorTarget() ? { onWebLocalStyleRules: (rules) => webLocalStyle.remember(id, rules) } : {}
|
|
6478
6494
|
});
|
|
@@ -6545,6 +6561,7 @@ function createUniAppXPlugins(options) {
|
|
|
6545
6561
|
}
|
|
6546
6562
|
injectUniAppXHarmonyBundleStyles(bundle, {
|
|
6547
6563
|
cssSources,
|
|
6564
|
+
componentMatcher: resolvedUniAppXOptions.componentLocalStyles.componentMatcher,
|
|
6548
6565
|
excludeComponents: shouldEnableComponentLocalStyle()
|
|
6549
6566
|
});
|
|
6550
6567
|
}
|
|
@@ -9476,6 +9493,29 @@ function createViteHmrCandidateState(options) {
|
|
|
9476
9493
|
};
|
|
9477
9494
|
}
|
|
9478
9495
|
//#endregion
|
|
9496
|
+
//#region src/bundlers/vite/shared/framework-module-candidates.ts
|
|
9497
|
+
function createFrameworkModuleCandidateRegistrar(options) {
|
|
9498
|
+
return async (id, source) => {
|
|
9499
|
+
await options.runtimeState.readyPromise;
|
|
9500
|
+
const candidates = await options.sourceCandidateCollector.syncModuleSource(id, source);
|
|
9501
|
+
options.invalidateRecordedGeneratorCandidates();
|
|
9502
|
+
options.cacheCurrent();
|
|
9503
|
+
const cssHandlerOptions = options.getCssHandlerOptions(id);
|
|
9504
|
+
return require_v4_generation_core.validateCandidatesByGenerator({
|
|
9505
|
+
candidates,
|
|
9506
|
+
cssHandlerOptions,
|
|
9507
|
+
cssUserHandlerOptions: cssHandlerOptions,
|
|
9508
|
+
debug: options.debug,
|
|
9509
|
+
file: (0, _weapp_tailwindcss_shared.cleanUrl)(id),
|
|
9510
|
+
generatorPlatform: options.getGeneratorPlatform(),
|
|
9511
|
+
opts: options.opts,
|
|
9512
|
+
rawSource: "",
|
|
9513
|
+
runtimeState: options.runtimeState,
|
|
9514
|
+
styleHandler: options.styleHandler
|
|
9515
|
+
});
|
|
9516
|
+
};
|
|
9517
|
+
}
|
|
9518
|
+
//#endregion
|
|
9479
9519
|
//#region src/bundlers/vite/shared/framework-plugin-order.ts
|
|
9480
9520
|
function orderFrameworkSourceCandidatePlugins(extraPlugins, rewritePlugins, sourceCandidatesPlugin, beforeExtraPlugin) {
|
|
9481
9521
|
const anchor = beforeExtraPlugin ? extraPlugins.findIndex(beforeExtraPlugin) : -1;
|
|
@@ -10783,6 +10823,17 @@ ${tracedCss}`;
|
|
|
10783
10823
|
});
|
|
10784
10824
|
const extraPluginPlatform = frameworkBranch.getExtraPluginPlatform?.() ?? {};
|
|
10785
10825
|
const syncSourceCandidatesForHotUpdate = (ctx) => syncFrameworkSourceCandidatesForHotUpdate(sourceScanSession, ctx);
|
|
10826
|
+
const registerModuleGraphCandidates = createFrameworkModuleCandidateRegistrar({
|
|
10827
|
+
cacheCurrent: sourceScanSession.cacheCurrent,
|
|
10828
|
+
debug,
|
|
10829
|
+
getCssHandlerOptions: transformCssHandlerOptions.getCssHandlerOptions,
|
|
10830
|
+
getGeneratorPlatform: resolveGeneratorPlatform,
|
|
10831
|
+
invalidateRecordedGeneratorCandidates,
|
|
10832
|
+
opts,
|
|
10833
|
+
runtimeState,
|
|
10834
|
+
sourceCandidateCollector,
|
|
10835
|
+
styleHandler
|
|
10836
|
+
});
|
|
10786
10837
|
const prepareTailwindGeneration = async () => {
|
|
10787
10838
|
if (sourceScanSession.shouldDiscoverAutoCssSources(autoCssSourcesDiscovered)) await discoverAndRegisterAutoCssSources();
|
|
10788
10839
|
await sourceScanSession.sync();
|
|
@@ -10799,6 +10850,7 @@ ${tracedCss}`;
|
|
|
10799
10850
|
isWebGeneratorTarget: () => resolveCurrentGeneratorBranch().isWeb,
|
|
10800
10851
|
jsHandler,
|
|
10801
10852
|
mainCssChunkMatcher,
|
|
10853
|
+
registerModuleGraphCandidates,
|
|
10802
10854
|
runtimeState,
|
|
10803
10855
|
styleHandler,
|
|
10804
10856
|
syncSourceCandidatesForHotUpdate,
|
|
@@ -11220,6 +11272,7 @@ function createUniAppXVitePlugins(options = {}) {
|
|
|
11220
11272
|
isWebGeneratorTarget: context.isWebGeneratorTarget,
|
|
11221
11273
|
jsHandler: context.jsHandler,
|
|
11222
11274
|
mainCssChunkMatcher: context.mainCssChunkMatcher,
|
|
11275
|
+
registerModuleGraphCandidates: context.registerModuleGraphCandidates,
|
|
11223
11276
|
runtimeState: context.runtimeState,
|
|
11224
11277
|
styleHandler: context.styleHandler,
|
|
11225
11278
|
syncSourceCandidatesForHotUpdate: context.syncSourceCandidatesForHotUpdate,
|