weapp-tailwindcss 5.5.8 → 5.5.10
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/vite/css-calc-stage.d.ts +8 -0
- package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer/css-scope-graph.d.ts +5 -0
- package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +1 -1
- package/dist/bundlers/vite/css-finalizer/options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-cache-task.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-result.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +3 -3
- package/dist/bundlers/vite/generate-bundle/scoped-generator-runtime-cache.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator-sources.d.ts +36 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +6 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/source-trace.d.ts +2 -0
- package/dist/bundlers/vite/runtime-class-set/cache.d.ts +14 -0
- package/dist/bundlers/vite/runtime-class-set/invalidation-plugin.d.ts +6 -0
- package/dist/bundlers/vite/runtime-class-set/lifecycle.d.ts +12 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +1 -0
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +1 -2
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +1 -0
- package/dist/{compiler-DbwS3329.cjs → compiler-TvqqdOMD.cjs} +50 -38
- package/dist/{compiler-CThodfGH.js → compiler-v9sYta8W.js} +35 -30
- package/dist/core/compiler/generation-cache.d.ts +4 -2
- package/dist/core/compiler/root-store.d.ts +1 -1
- package/dist/core/compiler/source.d.ts +7 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{scoped-generator-DlQrVbuC.js → css-cleanup-B3xP5Qph.js} +26 -23
- package/dist/{generated-css-marker-B0RyziOH.cjs → generated-css-marker-nqjR6ntO.cjs} +102 -26
- package/dist/generation/pipeline/style-context.d.ts +3 -0
- package/dist/{generator-CxauQbx3.cjs → generator-B1sYQpWu.cjs} +165 -90
- package/dist/{generator-oKZ5mCJ5.js → generator-LqofzXgr.js} +155 -92
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-DhddVxGA.js → gulp-BCV0gOMb.js} +4 -4
- package/dist/{gulp-CngHA9cU.cjs → gulp-DrX6QS3N.cjs} +5 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-Dc4c1VRg.cjs → hmr-timing-B56wp7y-.cjs} +4 -4
- package/dist/{hmr-timing-xPpat-km.js → hmr-timing-Bb54exB0.js} +102 -26
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-EUud9R2K.cjs → pipeline-helpers-DJ3VZ01J.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/project-sources/candidates/view-memo.d.ts +7 -0
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{scoped-generator-lbTwL6mD.cjs → scoped-generator-DqNb8nJG.cjs} +31 -24
- package/dist/{source-candidate-scan-signature-BjVQYL-C.js → source-candidate-scan-signature-BWLf4tuO.js} +2 -2
- package/dist/{source-candidate-scan-signature-nG-rg809.cjs → source-candidate-scan-signature-_ohG0ePd.cjs} +2 -2
- package/dist/tailwindcss/v4/rpx-theme-warning.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/raw-generation.d.ts +30 -0
- package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +3 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +2 -0
- package/dist/{tailwindcss-kSd0ykiX.js → tailwindcss-XNfJSlhp.js} +2 -2
- package/dist/{tailwindcss-U3KIUegn.cjs → tailwindcss-uf04Iolj.cjs} +2 -2
- package/dist/{transform-DVg4q8hh.cjs → transform-CxVM0PfA.cjs} +3 -3
- package/dist/{transform-BAon9ykq.js → transform-D0NXKPmD.js} +3 -3
- package/dist/utils/stable-serialize.d.ts +1 -0
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-IX83wh_L.cjs → vite-C3Zh6iYK.cjs} +434 -209
- package/dist/{vite-D-RGkmOE.js → vite-D6_FxvdM.js} +434 -209
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +5 -5
- package/dist/{web-DHfZ_KC9.cjs → web-BzeWG_XO.cjs} +442 -155
- package/dist/{web--kA4HUTm.js → web-K3qAX4sN.js} +431 -156
- package/dist/{webpack-Bhkd27Rs.js → webpack-BZBqKB4Y.js} +6 -6
- package/dist/{webpack-BetjemzT.cjs → webpack-Dbj2uykF.cjs} +8 -8
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +5 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as resolveTailwindV4CssSourceBase, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as source_scan_exports } from "./tailwindcss-
|
|
2
|
-
import { B as loadTailwindV4DesignSystem,
|
|
1
|
+
import { _ as resolveTailwindV4CssSourceBase, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as source_scan_exports } from "./tailwindcss-XNfJSlhp.js";
|
|
2
|
+
import { B as stableSerialize, F as transformTailwindV4CssByTarget, H as loadTailwindV4DesignSystem, N as hasCssCalcVariables, T as omitUndefined, a as resolveGeneratorRuntimeBranch, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions, p as resolveTailwindV4SourceOptionsFromRuntime, s as shouldUseMiniProgramCssBranch, u as resolveTailwindV4Source$1, z as filterUnsupportedMiniProgramTailwindV4Candidates } from "./generator-LqofzXgr.js";
|
|
3
3
|
import { o as transformCssMacroCss, r as hasCssMacroTailwindV4InternalAtRules, t as hasCssMacroStyleOptions } from "./auto-ENr4xzzw.js";
|
|
4
|
-
import { C as babelParse, H as getTailwindGenerationSessionPool, J as createCssFragment, K as mergeCompilationDependencyChanges, L as composeGenerationArtifact, N as createDebug, P as normalizeFrameworkStylePlatform, R as consumeCompilationScopeChanges, S as replaceWxml, T as traverse, U as getCompilationSessionPool, W as runCompilerOwnerActivity, Y as createGenerationArtifact, l as recordCompilerShadowReport, m as resolveStyleOptionsFromContext, o as completeCompilerShadowReportRun, q as md5Hash, r as createStylePlatformAdapter, s as getCompilerShadowRunRevision, u as getFrameworkCompilerSession, v as createAttributeMatcher } from "./compiler-
|
|
4
|
+
import { C as babelParse, H as getTailwindGenerationSessionPool, J as createCssFragment, K as mergeCompilationDependencyChanges, L as composeGenerationArtifact, N as createDebug, P as normalizeFrameworkStylePlatform, R as consumeCompilationScopeChanges, S as replaceWxml, T as traverse, U as getCompilationSessionPool, W as runCompilerOwnerActivity, Y as createGenerationArtifact, l as recordCompilerShadowReport, m as resolveStyleOptionsFromContext, o as completeCompilerShadowReportRun, q as md5Hash, r as createStylePlatformAdapter, s as getCompilerShadowRunRevision, u as getFrameworkCompilerSession, v as createAttributeMatcher } from "./compiler-v9sYta8W.js";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
@@ -500,6 +500,30 @@ function diffCandidateSets(previous, next) {
|
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
502
|
//#endregion
|
|
503
|
+
//#region src/project-sources/candidates/view-memo.ts
|
|
504
|
+
/** 按候选版本和来源范围缓存视图,限制历史版本的驻留数量。 */
|
|
505
|
+
function createCandidateViewMemo() {
|
|
506
|
+
const memo = /* @__PURE__ */ new Map();
|
|
507
|
+
return (kind, revision, entries, excludeEntries, collect) => {
|
|
508
|
+
if (entries === void 0 && !excludeEntries?.length) return collect();
|
|
509
|
+
const key = `${revision}\0${JSON.stringify(entries ?? null)}\0${JSON.stringify(excludeEntries ?? null)}`;
|
|
510
|
+
const cached = memo.get(key);
|
|
511
|
+
const view = cached?.[kind];
|
|
512
|
+
if (view) return view;
|
|
513
|
+
const result = collect();
|
|
514
|
+
const next = cached ?? {};
|
|
515
|
+
next[kind] = result;
|
|
516
|
+
memo.delete(key);
|
|
517
|
+
memo.set(key, next);
|
|
518
|
+
while (memo.size > 64) {
|
|
519
|
+
const oldest = memo.keys().next().value;
|
|
520
|
+
if (oldest === void 0) break;
|
|
521
|
+
memo.delete(oldest);
|
|
522
|
+
}
|
|
523
|
+
return result;
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
//#endregion
|
|
503
527
|
//#region src/project-sources/candidates/views.ts
|
|
504
528
|
function isIncludedFile(id, isActiveModule, entries, excludeEntries) {
|
|
505
529
|
if (entries !== void 0 && (isActiveModule ? (0, source_scan_exports.isFileExcludedByTailwindSourceEntries)(id, entries) : entries.length === 0 || !(0, source_scan_exports.isFileMatchedByTailwindSourceEntries)(id, entries))) return false;
|
|
@@ -559,6 +583,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
559
583
|
const moduleSourceById = /* @__PURE__ */ new Map();
|
|
560
584
|
const candidateCount = /* @__PURE__ */ new Map();
|
|
561
585
|
const fileCandidateMemo = /* @__PURE__ */ new Map();
|
|
586
|
+
const candidateViewMemo = createCandidateViewMemo();
|
|
562
587
|
let inlineIncludedCandidates = /* @__PURE__ */ new Set();
|
|
563
588
|
let inlineExcludedCandidates = /* @__PURE__ */ new Set();
|
|
564
589
|
let revision = 0;
|
|
@@ -767,22 +792,22 @@ function createSourceCandidateStore(options = {}) {
|
|
|
767
792
|
});
|
|
768
793
|
}
|
|
769
794
|
function valuesForEntries(entries, options = {}) {
|
|
770
|
-
return collectCandidateValues({
|
|
795
|
+
return candidateViewMemo("values", revision, entries, options.excludeEntries, () => collectCandidateValues({
|
|
771
796
|
candidatesById,
|
|
772
797
|
moduleCandidatesById,
|
|
773
798
|
candidateCount,
|
|
774
799
|
inlineIncludedCandidates,
|
|
775
800
|
inlineExcludedCandidates
|
|
776
|
-
}, entries, options.excludeEntries);
|
|
801
|
+
}, entries, options.excludeEntries));
|
|
777
802
|
}
|
|
778
803
|
function sourcesForEntries(entries, options = {}) {
|
|
779
|
-
return collectCandidateSources({
|
|
804
|
+
return candidateViewMemo("sources", revision, entries, options.excludeEntries, () => collectCandidateSources({
|
|
780
805
|
candidatesById,
|
|
781
806
|
moduleCandidatesById,
|
|
782
807
|
candidateCount,
|
|
783
808
|
inlineIncludedCandidates,
|
|
784
809
|
inlineExcludedCandidates
|
|
785
|
-
}, entries, options.excludeEntries);
|
|
810
|
+
}, entries, options.excludeEntries));
|
|
786
811
|
}
|
|
787
812
|
function clear() {
|
|
788
813
|
if (candidateCount.size > 0 || fileCandidateMemo.size > 0 || inlineIncludedCandidates.size > 0 || inlineExcludedCandidates.size > 0) revision++;
|
|
@@ -1389,15 +1414,24 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
1389
1414
|
if (generatedResults.length === 1) return firstGenerated;
|
|
1390
1415
|
const incrementalCssResults = generatedResults.map((item) => item.incrementalCss).filter((css) => typeof css === "string");
|
|
1391
1416
|
const incrementalRawCssResults = generatedResults.map((item) => item.incrementalRawCss).filter((css) => typeof css === "string");
|
|
1417
|
+
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
1418
|
+
const conflictingProperties = /* @__PURE__ */ new Set();
|
|
1419
|
+
for (const result of generatedResults) for (const [name, value] of result.customPropertyValues ?? []) {
|
|
1420
|
+
if (customPropertyValues.has(name) && customPropertyValues.get(name) !== value) conflictingProperties.add(name);
|
|
1421
|
+
customPropertyValues.set(name, value);
|
|
1422
|
+
}
|
|
1423
|
+
for (const name of conflictingProperties) customPropertyValues.delete(name);
|
|
1392
1424
|
return {
|
|
1393
1425
|
...firstGenerated,
|
|
1394
1426
|
css: deduplicateGeneratedCssRules(generatedResults.map((item) => item.css).join("\n")),
|
|
1395
1427
|
rawCss: deduplicateGeneratedCssRules(generatedResults.map((item) => item.rawCss).join("\n")),
|
|
1428
|
+
customPropertyContextCss: generatedResults.map((item) => item.customPropertyContextCss ?? item.rawCss).join("\n"),
|
|
1396
1429
|
incrementalCss: incrementalCssResults.length === generatedResults.length ? incrementalCssResults.filter(Boolean).join("\n") : void 0,
|
|
1397
1430
|
incrementalRawCss: incrementalRawCssResults.length === generatedResults.length ? incrementalRawCssResults.filter(Boolean).join("\n") : void 0,
|
|
1398
1431
|
classSet: new Set(generatedResults.flatMap((item) => [...item.classSet])),
|
|
1399
1432
|
dependencies: [...new Set(generatedResults.flatMap((item) => item.dependencies))],
|
|
1400
|
-
sources: generatedResults.flatMap((item) => item.sources)
|
|
1433
|
+
sources: generatedResults.flatMap((item) => item.sources),
|
|
1434
|
+
customPropertyValues
|
|
1401
1435
|
};
|
|
1402
1436
|
}
|
|
1403
1437
|
//#endregion
|
|
@@ -1462,12 +1496,12 @@ function collectRpxThemeRiskSources(sources) {
|
|
|
1462
1496
|
for (const css of new Set(sources)) for (const name of collectRpxThemeVariables(css)) variables.add(name);
|
|
1463
1497
|
return [...variables];
|
|
1464
1498
|
}
|
|
1465
|
-
function warnRpxThemeRisk(session, variables,
|
|
1499
|
+
function warnRpxThemeRisk(session, variables, generatedCss) {
|
|
1466
1500
|
if (warnedSessions.has(session) || variables.length === 0) return;
|
|
1467
|
-
const usage = inspectRpxCalcUsage(
|
|
1468
|
-
const
|
|
1501
|
+
const usage = inspectRpxCalcUsage(generatedCss, new Set(variables));
|
|
1502
|
+
const generationHint = usage === void 0 ? "当前生成阶段的 CSS 无法完成诊断,请检查最终 WXSS。" : usage.variables.length > 0 || usage.inlineRpx ? `当前生成阶段仍含 calc:${[...usage.variables, ...usage.inlineRpx ? ["内联 rpx"] : []].join(", ")};后续构建处理可能将其静态化,最终状态以 WXSS 为准。` : "当前生成阶段未检测到相关 calc;这不代表已验证最终产物、所有作用域和设备。";
|
|
1469
1503
|
warnedSessions.add(session);
|
|
1470
|
-
logger.warn(`[tailwindcss@4][rpx-theme] @theme 中使用 rpx 的主题变量:${variables.join(", ")}。${
|
|
1504
|
+
logger.warn(`[tailwindcss@4][rpx-theme] @theme 中使用 rpx 的主题变量:${variables.join(", ")}。${generationHint} 微信 WXSS 可能先独立换算或量化基数再乘法,造成尺寸偏差,具体取整算法尚未确认。固定像素尺寸优先使用 px,需要缩放时在构建期输出最终静态 rpx;偶数或较大 rpx 也不保证准确。请检查最终 WXSS 并在目标设备验证:https://tw.weapp.dev/docs/issues/spacing-rpx`);
|
|
1471
1505
|
}
|
|
1472
1506
|
//#endregion
|
|
1473
1507
|
//#region src/generation/framework-postcss.ts
|
|
@@ -2415,6 +2449,28 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2415
2449
|
//#endregion
|
|
2416
2450
|
//#region src/generation/source-resolver/resolve-sources.ts
|
|
2417
2451
|
async function resolveGeneratorResolvedSources(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
2452
|
+
const ownedSources = resolveCssHandlerSourceOptions(cssHandlerOptions)?.cssSources;
|
|
2453
|
+
if (ownedSources?.length) {
|
|
2454
|
+
const sourceOptions = {
|
|
2455
|
+
...resolveTailwindV4SourceOptionsFromRuntime(runtimeState.tailwindRuntime),
|
|
2456
|
+
cssEntries: [],
|
|
2457
|
+
cssSources: ownedSources
|
|
2458
|
+
};
|
|
2459
|
+
return Promise.all(ownedSources.map(async (source, index) => {
|
|
2460
|
+
const resolved = await resolveSingleTailwindV4CssSource(source, sourceOptions, {
|
|
2461
|
+
index,
|
|
2462
|
+
matched: true,
|
|
2463
|
+
primary: index === 0
|
|
2464
|
+
});
|
|
2465
|
+
return normalizeResolvedTailwindV4SourceConfig(withGeneratorSourceMetadata(generatorOptions?.config ? {
|
|
2466
|
+
...resolved,
|
|
2467
|
+
css: prependConfigDirective(resolved.css, generatorOptions.config)
|
|
2468
|
+
} : resolved, {
|
|
2469
|
+
...getGeneratorSourceMetadata(resolved),
|
|
2470
|
+
isolateCssSource: ownedSources.length > 1 || /source\(\s*none\s*\)/i.test(source.css)
|
|
2471
|
+
}), source.file, sourceOptions);
|
|
2472
|
+
}));
|
|
2473
|
+
}
|
|
2418
2474
|
const base = resolveCssSourceBase(file, cssHandlerOptions);
|
|
2419
2475
|
const cssEntrySource = resolveCssEntrySource$1(rawSource, base, {
|
|
2420
2476
|
importFallback: generatorOptions?.importFallback ?? false,
|
|
@@ -2549,17 +2605,8 @@ function setLimitedCacheValue(cache, key, value) {
|
|
|
2549
2605
|
}
|
|
2550
2606
|
cache.set(key, value);
|
|
2551
2607
|
}
|
|
2552
|
-
function createStableJson(value) {
|
|
2553
|
-
if (value === void 0) return "undefined";
|
|
2554
|
-
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
2555
|
-
if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
|
|
2556
|
-
return `{${Object.keys(value).sort().map((key) => {
|
|
2557
|
-
const record = value;
|
|
2558
|
-
return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
|
|
2559
|
-
}).join(",")}}`;
|
|
2560
|
-
}
|
|
2561
2608
|
function createLegacyCompatTransformCacheKey(source, options) {
|
|
2562
|
-
return `${
|
|
2609
|
+
return `${stableSerialize(options)}\0${source}`;
|
|
2563
2610
|
}
|
|
2564
2611
|
function resolveLegacyCompatCssSource(rawSource) {
|
|
2565
2612
|
const cached = legacyCompatSourceCache.get(rawSource);
|
|
@@ -2753,6 +2800,10 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
2753
2800
|
const rawCss = stripTailwindBanner(css);
|
|
2754
2801
|
const generationCss = generated.target === "weapp" && (hasCssMacroStyleOptions(generatorStyleOptions) || hasCssMacroTailwindV4InternalAtRules(rawCss)) ? await transformCssMacroCss(rawCss, generatorStyleOptions) : rawCss;
|
|
2755
2802
|
const normalizedCss = generated.target === "weapp" ? await normalizeMiniProgramGeneratedCssForPostcss(generationCss, {
|
|
2803
|
+
cssCalc: generatorStyleOptions.cssCalc,
|
|
2804
|
+
cssOptions: generatorStyleOptions.cssOptions,
|
|
2805
|
+
customPropertyValues: generatorStyleOptions.customPropertyValues,
|
|
2806
|
+
contextCss: generated.customPropertyContextCss ?? generated.rawCss,
|
|
2756
2807
|
preservePreflight: true,
|
|
2757
2808
|
preserveRawClassRules: true
|
|
2758
2809
|
}) : generationCss;
|
|
@@ -3161,8 +3212,9 @@ async function prepareGeneratorInputs(context) {
|
|
|
3161
3212
|
...source,
|
|
3162
3213
|
css: sourceCss
|
|
3163
3214
|
};
|
|
3215
|
+
const entryCssCandidates = Boolean(cssHandlerOptions.sourceOptions?.cssSources?.length) ? collectGeneratorCssCandidates(sourceMetadata.sourceCss ?? source.css) : currentCssCandidates;
|
|
3164
3216
|
const sourceEntries = getSourceCandidatesForEntries ? await resolveGeneratorSourceEntries(record, runtimeState) : void 0;
|
|
3165
|
-
const sourceScopedRuntime = sourceEntries && sourceEntries.length > 0 ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
3217
|
+
const sourceScopedRuntime = sourceEntries !== void 0 && (sourceEntries.length > 0 || sourceMetadata.isolateCssSource === true) ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
3166
3218
|
const scopedRuntime = resolveScopedRuntimeCandidates(options.sourceCandidates, sourceScopedRuntime);
|
|
3167
3219
|
const isolateCssSource = shouldIsolateScopedCssSource(majorVersion, record, sourceEntries, {
|
|
3168
3220
|
cssHandlerOptions,
|
|
@@ -3174,7 +3226,7 @@ async function prepareGeneratorInputs(context) {
|
|
|
3174
3226
|
return;
|
|
3175
3227
|
}
|
|
3176
3228
|
const sourceRuntime = scopedRuntime && (scopedRuntime.size > 0 || isolateCssSource) || isolateCssSource ? isolateCurrentCssCandidates ? runtimeWithCurrentCss : mergeScopedRuntimeWithCurrentRuntime(scopedRuntime ?? /* @__PURE__ */ new Set(), runtimeWithCurrentCss, {
|
|
3177
|
-
currentCssCandidates,
|
|
3229
|
+
currentCssCandidates: entryCssCandidates,
|
|
3178
3230
|
cssHandlerOptions,
|
|
3179
3231
|
isolateCssSource,
|
|
3180
3232
|
majorVersion,
|
|
@@ -3191,6 +3243,23 @@ async function prepareGeneratorInputs(context) {
|
|
|
3191
3243
|
};
|
|
3192
3244
|
}
|
|
3193
3245
|
//#endregion
|
|
3246
|
+
//#region src/generation/pipeline/style-context.ts
|
|
3247
|
+
/** 先确定同一输出的完整级联,再从原始声明生成兼容 CSS。 */
|
|
3248
|
+
async function mergeGeneratorResultsForOutput(results, options) {
|
|
3249
|
+
const merged = mergeGeneratorResults(results);
|
|
3250
|
+
if (!merged || results.length < 2 || merged.target === "tailwind" || !hasCssCalcVariables(options)) return merged;
|
|
3251
|
+
const css = await transformTailwindV4CssByTarget(merged.rawCss, merged.target, {
|
|
3252
|
+
...options,
|
|
3253
|
+
customPropertyContextCss: [options.customPropertyContextCss, merged.customPropertyContextCss].filter(Boolean).join("\n")
|
|
3254
|
+
});
|
|
3255
|
+
return {
|
|
3256
|
+
...merged,
|
|
3257
|
+
css,
|
|
3258
|
+
incrementalCss: void 0,
|
|
3259
|
+
incrementalRawCss: void 0
|
|
3260
|
+
};
|
|
3261
|
+
}
|
|
3262
|
+
//#endregion
|
|
3194
3263
|
//#region src/generation/pipeline/execution.ts
|
|
3195
3264
|
async function executeGeneratorPipeline(context) {
|
|
3196
3265
|
return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, getCompilationSessionPool(context.runtimeState), getTailwindGenerationSessionPool(context.runtimeState)));
|
|
@@ -3200,6 +3269,12 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3200
3269
|
await runtimeState.readyPromise;
|
|
3201
3270
|
const compilerSession = options.compilation?.enabled ? getFrameworkCompilerSession(runtimeState, opts) : void 0;
|
|
3202
3271
|
const { isolateCurrentCssCandidates, runtimeWithCurrentCss, generatorSourceRecords, generatorStyleOptions, configuredContainerCompat, sourceConcurrency, preparedGenerationInputs } = await prepareGeneratorInputs(context);
|
|
3272
|
+
if (hasCssCalcVariables(generatorStyleOptions)) generatorStyleOptions.customPropertyContextCss = [
|
|
3273
|
+
generatorStyleOptions.customPropertyContextCss,
|
|
3274
|
+
context.generatedUserCssRawSource,
|
|
3275
|
+
options.frameworkProcessedUserCss,
|
|
3276
|
+
...preparedGenerationInputs.map((input) => input.generatorSource.css)
|
|
3277
|
+
].filter(Boolean).join("\n");
|
|
3203
3278
|
const generatePreparedInputs = async (candidateSets) => {
|
|
3204
3279
|
return runWithConcurrency(preparedGenerationInputs.map((input) => async () => {
|
|
3205
3280
|
const projectedCandidates = candidateSets?.get(input.sourceId);
|
|
@@ -3245,7 +3320,7 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3245
3320
|
if (compilerSession && options.compilation?.changes) compilerSession.invalidate(options.compilation.changes.map((change) => change.id));
|
|
3246
3321
|
await compilerSession?.syncScope(options.compilation?.scope.id ?? options.outputFile ?? file, preparedGenerationInputs.map((input) => input.sourceId));
|
|
3247
3322
|
const results = await generatePreparedInputs(compilation.candidatesBySource);
|
|
3248
|
-
const merged =
|
|
3323
|
+
const merged = await mergeGeneratorResultsForOutput(results.map((result) => result.generated), generatorStyleOptions);
|
|
3249
3324
|
return merged ? {
|
|
3250
3325
|
classSet: merged.classSet,
|
|
3251
3326
|
dependenciesBySource: results.map((result) => [result.sourceId, resolveCompilationDependencies(result.generated.dependencies)]),
|
|
@@ -3266,8 +3341,9 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
3266
3341
|
snapshot: execution.value.snapshot
|
|
3267
3342
|
};
|
|
3268
3343
|
compilationRevision = execution.compilation.revision;
|
|
3269
|
-
} else generated =
|
|
3344
|
+
} else generated = await mergeGeneratorResultsForOutput((await generatePreparedInputs()).map((result) => result.generated), generatorStyleOptions);
|
|
3270
3345
|
if (!generated) return;
|
|
3346
|
+
if (generated.customPropertyContextCss) generatorStyleOptions.customPropertyContextCss = generated.customPropertyContextCss;
|
|
3271
3347
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
3272
3348
|
const hasMatchedCssSourceFile = generatorSourceRecords.some((record) => record.metadata.matchedCssSourceFile);
|
|
3273
3349
|
const hasExplicitCssSource = generatorSourceRecords.some(({ metadata }) => {
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_gulp = require("./gulp-
|
|
3
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
4
|
+
const require_gulp = require("./gulp-DrX6QS3N.cjs");
|
|
5
5
|
const require_postcss = require("./postcss.cjs");
|
|
6
|
-
const require_vite = require("./vite-
|
|
7
|
-
const require_webpack = require("./webpack-
|
|
6
|
+
const require_vite = require("./vite-C3Zh6iYK.cjs");
|
|
7
|
+
const require_webpack = require("./webpack-Dbj2uykF.cjs");
|
|
8
8
|
require("./webpack.cjs");
|
|
9
9
|
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
10
10
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.js";
|
|
2
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { t as createPlugins } from "./gulp-
|
|
2
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-LqofzXgr.js";
|
|
3
|
+
import { t as createPlugins } from "./gulp-BCV0gOMb.js";
|
|
4
4
|
import weappTailwindcssPostcssPlugin from "./postcss.js";
|
|
5
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
6
|
-
import { n as weappTailwindcssPackageDir } from "./webpack-
|
|
5
|
+
import { t as WeappTailwindcss } from "./vite-D6_FxvdM.js";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-BZBqKB4Y.js";
|
|
7
7
|
import "./webpack.js";
|
|
8
8
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss/transform";
|
|
9
9
|
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
const require_compiler = require("./compiler-
|
|
2
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
3
|
+
const require_compiler = require("./compiler-TvqqdOMD.cjs");
|
|
4
4
|
const require_defaults = require("./defaults-CyX5iO9y.cjs");
|
|
5
|
-
const require_generated_css_marker = require("./generated-css-marker-
|
|
5
|
+
const require_generated_css_marker = require("./generated-css-marker-nqjR6ntO.cjs");
|
|
6
6
|
require("./final-css-cleanup-B6FUJC3z.cjs");
|
|
7
7
|
require("./css-cleanup-B6FUJC3z.cjs");
|
|
8
8
|
let node_path = require("node:path");
|
package/dist/postcss.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_generator = require("./generator-
|
|
5
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
6
6
|
const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss/plugin").createWeappTailwindcssPostcssPlugin)({
|
|
7
7
|
compiledSourceScan: true,
|
|
8
8
|
createGenerator: (source) => {
|
package/dist/postcss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-
|
|
1
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-LqofzXgr.js";
|
|
2
2
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss/plugin";
|
|
3
3
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
4
4
|
compiledSourceScan: true,
|
package/dist/presets.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
3
3
|
const require_framework = require("./framework.cjs");
|
|
4
|
-
const require_generator = require("./generator-
|
|
4
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
5
5
|
require("./utils-CuKLf1Zv.cjs");
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-uf04Iolj.cjs");
|
|
7
7
|
require("./logger-TlKT3xmR.cjs");
|
|
8
8
|
let node_path = require("node:path");
|
|
9
9
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
package/dist/presets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
1
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-XNfJSlhp.js";
|
|
2
2
|
import { resolveTaroPlatform, resolveUniPlatformsFromEnv } from "./framework.js";
|
|
3
|
-
import { T as omitUndefined } from "./generator-
|
|
3
|
+
import { T as omitUndefined } from "./generator-LqofzXgr.js";
|
|
4
4
|
import { n as defuOverrideArray } from "./utils-MVwpU07P.js";
|
|
5
5
|
import { t as logger } from "./logger-BNzxZbZj.js";
|
|
6
6
|
import path from "node:path";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TailwindSourceEntry } from '../../tailwindcss/source-scan.js';
|
|
2
|
+
interface CandidateViews {
|
|
3
|
+
values: Set<string>;
|
|
4
|
+
sources: Map<string, Set<string>>;
|
|
5
|
+
}
|
|
6
|
+
export declare function createCandidateViewMemo(): <K extends keyof CandidateViews>(kind: K, revision: number, entries: TailwindSourceEntry[] | undefined, excludeEntries: TailwindSourceEntry[] | undefined, collect: () => CandidateViews[K]) => CandidateViews[K];
|
|
7
|
+
export {};
|
package/dist/rspack.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
3
|
-
const require_generated_css_marker = require("./generated-css-marker-
|
|
4
|
-
const require_webpack = require("./webpack-
|
|
3
|
+
const require_generated_css_marker = require("./generated-css-marker-nqjR6ntO.cjs");
|
|
4
|
+
const require_webpack = require("./webpack-Dbj2uykF.cjs");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
7
7
|
//#region src/bundlers/rspack/rule-match.ts
|
package/dist/rspack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as isSourceStyleRequest } from "./hmr-timing-
|
|
2
|
-
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { V as isSourceStyleRequest } from "./hmr-timing-Bb54exB0.js";
|
|
2
|
+
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-BZBqKB4Y.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region src/bundlers/rspack/rule-match.ts
|
|
5
5
|
const STYLE_RULE_PROBES = [
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
1
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
4
3
|
require("./auto-B1OyRrE8.cjs");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
6
|
-
const require_generated_css_marker = require("./generated-css-marker-
|
|
7
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
8
|
-
let
|
|
9
|
-
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-uf04Iolj.cjs");
|
|
5
|
+
const require_generated_css_marker = require("./generated-css-marker-nqjR6ntO.cjs");
|
|
6
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-_ohG0ePd.cjs");
|
|
7
|
+
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
8
|
+
let _weapp_tailwindcss_source_scan = require("@weapp-tailwindcss/source-scan");
|
|
10
9
|
let weapp_style_injector_vite = require("weapp-style-injector/vite");
|
|
11
10
|
let weapp_style_injector_vite_taro = require("weapp-style-injector/vite/taro");
|
|
12
11
|
let weapp_style_injector_vite_uni_app = require("weapp-style-injector/vite/uni-app");
|
|
@@ -14,7 +13,6 @@ let weapp_style_injector_webpack = require("weapp-style-injector/webpack");
|
|
|
14
13
|
let weapp_style_injector_webpack_mpx = require("weapp-style-injector/webpack/mpx");
|
|
15
14
|
let weapp_style_injector_webpack_taro = require("weapp-style-injector/webpack/taro");
|
|
16
15
|
let weapp_style_injector_webpack_uni_app = require("weapp-style-injector/webpack/uni-app");
|
|
17
|
-
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
18
16
|
//#region src/bundlers/framework-selector.ts
|
|
19
17
|
function resolveBundlerAppType(options) {
|
|
20
18
|
if (options.appType) return options.appType;
|
|
@@ -284,12 +282,15 @@ function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
|
284
282
|
}
|
|
285
283
|
//#endregion
|
|
286
284
|
//#region src/bundlers/vite/generate-bundle/scoped-generator.ts
|
|
287
|
-
function hasOwnSourceDirectives(rawSource) {
|
|
288
|
-
|
|
285
|
+
function hasOwnSourceDirectives(rawSource, scopeToSource = false) {
|
|
286
|
+
const analysis = (0, _weapp_tailwindcss_postcss_transform.analyzeTailwindV4EntrySource)(rawSource);
|
|
287
|
+
if (!analysis) return false;
|
|
288
|
+
const directives = analysis.getSourceDirectives();
|
|
289
|
+
return analysis.configRequests.length > 0 || scopeToSource && directives.hasSourceNone || Boolean(directives.importSourcePath) || directives.sourceRequests.length > 0 || directives.inlineCandidates.included.size > 0 || directives.inlineCandidates.excluded.size > 0;
|
|
289
290
|
}
|
|
290
291
|
function createLocalSourceEntries(sourceFile) {
|
|
291
292
|
return [{
|
|
292
|
-
base:
|
|
293
|
+
base: (0, _weapp_tailwindcss_source_scan.sourcePathApi)(sourceFile).dirname((0, _weapp_tailwindcss_source_scan.sourcePathApi)(sourceFile).resolve(sourceFile.replace(/[?#].*$/, ""))),
|
|
293
294
|
negated: false,
|
|
294
295
|
pattern: "**/*"
|
|
295
296
|
}];
|
|
@@ -307,36 +308,36 @@ function mergeCandidates(first, second) {
|
|
|
307
308
|
function canFallbackToOutputCandidates(rawSource, entries) {
|
|
308
309
|
return rawSource.includes("@source") && entries.length > 0 && entries.every((entry) => !entry.negated);
|
|
309
310
|
}
|
|
310
|
-
function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
|
|
311
|
-
if (!hasOwnSourceDirectives(rawSource)) return {
|
|
311
|
+
function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries, scopeToSource = false) {
|
|
312
|
+
if (!hasOwnSourceDirectives(rawSource, scopeToSource)) return {
|
|
312
313
|
entries: resolvedEntries,
|
|
313
314
|
localEntries: void 0
|
|
314
315
|
};
|
|
315
316
|
if (resolvedEntries !== void 0) return { entries: resolvedEntries };
|
|
316
317
|
return { entries: createLocalSourceEntries(sourceFile) };
|
|
317
318
|
}
|
|
318
|
-
async function resolveScopedGeneratorSourceEntries(rawSource, sourceFile) {
|
|
319
|
-
const sourceBase =
|
|
320
|
-
return resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, sourceBase))?.entries);
|
|
319
|
+
async function resolveScopedGeneratorSourceEntries(rawSource, sourceFile, scopeToSource = false) {
|
|
320
|
+
const sourceBase = (0, _weapp_tailwindcss_source_scan.sourcePathApi)(sourceFile).dirname((0, _weapp_tailwindcss_source_scan.sourcePathApi)(sourceFile).resolve(sourceFile.replace(/[?#].*$/, "")));
|
|
321
|
+
return resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, sourceBase))?.entries, scopeToSource);
|
|
321
322
|
}
|
|
322
323
|
async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
|
|
323
|
-
if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
|
|
324
|
-
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
|
|
324
|
+
if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource, options.scopeToSource)) return fallbackSignature;
|
|
325
|
+
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile, options.scopeToSource);
|
|
325
326
|
if (entries === void 0) return fallbackSignature;
|
|
326
327
|
const scopedSignature = createCandidateSignature(getSourceCandidatesForEntries(entries));
|
|
327
328
|
return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
|
|
328
329
|
}
|
|
329
|
-
async function createScopedGeneratorSourceTraceMap(rawSource, sourceFile, getSourceCandidateSourcesForEntries) {
|
|
330
|
-
if (!getSourceCandidateSourcesForEntries || !hasOwnSourceDirectives(rawSource)) return getSourceCandidateSourcesForEntries?.(void 0);
|
|
331
|
-
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
|
|
330
|
+
async function createScopedGeneratorSourceTraceMap(rawSource, sourceFile, getSourceCandidateSourcesForEntries, options = {}) {
|
|
331
|
+
if (!getSourceCandidateSourcesForEntries || !hasOwnSourceDirectives(rawSource, options.scopeToSource)) return getSourceCandidateSourcesForEntries?.(void 0);
|
|
332
|
+
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile, options.scopeToSource);
|
|
332
333
|
if (entries === void 0) return getSourceCandidateSourcesForEntries(void 0);
|
|
333
334
|
return getSourceCandidateSourcesForEntries(entries);
|
|
334
335
|
}
|
|
335
336
|
async function createScopedGeneratorRuntime(options) {
|
|
336
|
-
const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
|
|
337
|
+
const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopeToSource, scopedSourceCandidateGetter } = options;
|
|
337
338
|
if (getSourceCandidatesForEntries && rawSource && sourceFile) {
|
|
338
|
-
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
|
|
339
|
-
if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
|
|
339
|
+
const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile, scopeToSource);
|
|
340
|
+
if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource, scopeToSource))) {
|
|
340
341
|
const explicitCandidates = getSourceCandidatesForEntries(entries);
|
|
341
342
|
const outputCandidates = scopedSourceCandidateGetter?.(void 0);
|
|
342
343
|
const scopedCandidates = outputCandidates ? explicitCandidates.size === 0 && canFallbackToOutputCandidates(rawSource, entries) ? outputCandidates : intersectCandidates(explicitCandidates, outputCandidates) : explicitCandidates;
|
|
@@ -409,6 +410,12 @@ Object.defineProperty(exports, "getSnapshotHash", {
|
|
|
409
410
|
return getSnapshotHash;
|
|
410
411
|
}
|
|
411
412
|
});
|
|
413
|
+
Object.defineProperty(exports, "hasOwnSourceDirectives", {
|
|
414
|
+
enumerable: true,
|
|
415
|
+
get: function() {
|
|
416
|
+
return hasOwnSourceDirectives;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
412
419
|
Object.defineProperty(exports, "hasRuntimeAffectingSourceChanges", {
|
|
413
420
|
enumerable: true,
|
|
414
421
|
get: function() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as source_scan_exports } from "./tailwindcss-
|
|
2
|
-
import { T as omitUndefined } from "./generator-
|
|
1
|
+
import { v as source_scan_exports } from "./tailwindcss-XNfJSlhp.js";
|
|
2
|
+
import { T as omitUndefined } from "./generator-LqofzXgr.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/bundlers/vite/plugin-hook.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
2
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
3
|
+
const require_tailwindcss = require("./tailwindcss-uf04Iolj.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
6
|
let node_module = require("node:module");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { InternalUserDefinedOptions } from '../../types/index.js';
|
|
2
2
|
export declare function shouldCheckRpxThemeRisk(session: object, target: string, opts: Pick<InternalUserDefinedOptions, 'logLevel' | 'platform' | 'cssOptions' | 'appType'>, platform?: string): boolean;
|
|
3
3
|
export declare function collectRpxThemeRiskSources(sources: Iterable<string>): string[];
|
|
4
|
-
export declare function warnRpxThemeRisk(session: object, variables: readonly string[],
|
|
4
|
+
export declare function warnRpxThemeRisk(session: object, variables: readonly string[], generatedCss: string): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TailwindV4GenerateOptions, TailwindV4ResolvedSource } from '../types.js';
|
|
2
|
+
import type { TailwindV4NativeSessionPool } from './native-session.js';
|
|
3
|
+
export declare function generateRawArtifact(generationSessions: TailwindV4NativeSessionPool, generateSource: TailwindV4ResolvedSource, options?: TailwindV4GenerateOptions): Promise<{
|
|
4
|
+
classSet: Set<string>;
|
|
5
|
+
rawCandidates: Set<string>;
|
|
6
|
+
dependencies: string[];
|
|
7
|
+
root: "none" | {
|
|
8
|
+
base: string;
|
|
9
|
+
pattern: string;
|
|
10
|
+
} | null;
|
|
11
|
+
sources: import("@weapp-tailwindcss/engine").TailwindV4SourcePattern[];
|
|
12
|
+
rawCss: string;
|
|
13
|
+
target: import("../index.js").TailwindV4GenerateTarget;
|
|
14
|
+
styleContext: Partial<import("@weapp-tailwindcss/postcss").IStyleHandlerOptions> | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function transformGeneratedArtifact(artifact: Awaited<ReturnType<typeof generateRawArtifact>>): Promise<{
|
|
17
|
+
customPropertyValues?: Map<string, string>;
|
|
18
|
+
css: string;
|
|
19
|
+
customPropertyContextCss: string | undefined;
|
|
20
|
+
classSet: Set<string>;
|
|
21
|
+
rawCandidates: Set<string>;
|
|
22
|
+
dependencies: string[];
|
|
23
|
+
root: "none" | {
|
|
24
|
+
base: string;
|
|
25
|
+
pattern: string;
|
|
26
|
+
} | null;
|
|
27
|
+
sources: import("@weapp-tailwindcss/engine").TailwindV4SourcePattern[];
|
|
28
|
+
rawCss: string;
|
|
29
|
+
target: import("../index.js").TailwindV4GenerateTarget;
|
|
30
|
+
}>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
type GenerationStyleOptions = Partial<IStyleHandlerOptions>;
|
|
3
|
+
export declare function hasCssCalcVariables(options?: GenerationStyleOptions): boolean;
|
|
3
4
|
export declare function resolveGenerationStyleContext(sourceCss: string, generatedCss: string, options?: GenerationStyleOptions): GenerationStyleOptions | undefined;
|
|
5
|
+
export declare function resolveIncrementalStyleContext(sourceCss: string, generatedCss: string, options?: GenerationStyleOptions): GenerationStyleOptions;
|
|
6
|
+
export declare function hasChangedCssCalcContext(previousCss: string, nextCss: string, options?: GenerationStyleOptions): boolean;
|
|
4
7
|
export {};
|
|
@@ -30,6 +30,8 @@ export interface TailwindV4SourceOptionsWithSources extends TailwindV4SourceOpti
|
|
|
30
30
|
export interface TailwindV4GenerateResult extends Omit<EngineTailwindV4GenerateResult, 'css'> {
|
|
31
31
|
css: string;
|
|
32
32
|
rawCss: string;
|
|
33
|
+
customPropertyValues?: ReadonlyMap<string, string> | undefined;
|
|
34
|
+
customPropertyContextCss?: string | undefined;
|
|
33
35
|
incrementalCss?: string | undefined;
|
|
34
36
|
incrementalRawCss?: string | undefined;
|
|
35
37
|
target: TailwindV4GenerateTarget;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as normalizeStringListOption,
|
|
1
|
+
import { A as normalizeStringListOption, C as findWorkspacePackageDir, D as normalizeTailwindcssRuntimeOptions, E as normalizeExtendLengthUnits, H as loadTailwindV4DesignSystem, L as resolveCssMacroTailwindV4Source, O as resolveRuntimeBareArbitraryValues, S as findNearestPackageRoot, T as omitUndefined, b as isTailwindV4CssEntry, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, k as resolveTailwindcssOptions, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as groupCssEntriesByBase, w as findWorkspaceRoot, x as normalizeCssEntries, y as guessBasedirFromEntries } from "./generator-LqofzXgr.js";
|
|
2
2
|
import { n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
@@ -689,7 +689,7 @@ function includesToken(list, token) {
|
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
691
|
function ensureDefaultsIncluded(value) {
|
|
692
|
-
if (value === true) return
|
|
692
|
+
if (value === true) return true;
|
|
693
693
|
if (Array.isArray(value)) {
|
|
694
694
|
if (!DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.length) return value;
|
|
695
695
|
const missing = DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.filter((token) => !includesToken(value, token));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
3
3
|
require("./utils-CuKLf1Zv.cjs");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -666,7 +666,7 @@ function includesToken(list, token) {
|
|
|
666
666
|
});
|
|
667
667
|
}
|
|
668
668
|
function ensureDefaultsIncluded(value) {
|
|
669
|
-
if (value === true) return
|
|
669
|
+
if (value === true) return true;
|
|
670
670
|
if (Array.isArray(value)) {
|
|
671
671
|
if (!DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.length) return value;
|
|
672
672
|
const missing = DEFAULT_CSS_CALC_CUSTOM_PROPERTIES.filter((token) => !includesToken(value, token));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_generator = require("./generator-
|
|
2
|
-
const require_compiler = require("./compiler-
|
|
3
|
-
const require_vite = require("./vite-
|
|
1
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
2
|
+
const require_compiler = require("./compiler-TvqqdOMD.cjs");
|
|
3
|
+
const require_vite = require("./vite-C3Zh6iYK.cjs");
|
|
4
4
|
let _weapp_tailwindcss_engine = require("@weapp-tailwindcss/engine");
|
|
5
5
|
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
6
6
|
let _vue_compiler_dom = require("@vue/compiler-dom");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as babelParse, S as replaceWxml, T as traverse$1, _ as generateCode, b as analyzeSource, v as createAttributeMatcher, w as JsTokenUpdater, x as isClassContextLiteralPath } from "./compiler-
|
|
3
|
-
import { a as shouldEnablePageLocalStyle, i as shouldEnableComponentLocalStyle, n as injectBorderPreflightClass, r as shouldInjectBorderPreflight } from "./vite-
|
|
1
|
+
import { P as _defineProperty } from "./generator-LqofzXgr.js";
|
|
2
|
+
import { C as babelParse, S as replaceWxml, T as traverse$1, _ as generateCode, b as analyzeSource, v as createAttributeMatcher, w as JsTokenUpdater, x as isClassContextLiteralPath } from "./compiler-v9sYta8W.js";
|
|
3
|
+
import { a as shouldEnablePageLocalStyle, i as shouldEnableComponentLocalStyle, n as injectBorderPreflightClass, r as shouldInjectBorderPreflight } from "./vite-D6_FxvdM.js";
|
|
4
4
|
import { splitCandidateTokens } from "@weapp-tailwindcss/engine";
|
|
5
5
|
import { UNI_APP_X_IMPORTANT_APPLY_MARKER, isUniAppXStyleSourceEmpty, normalizeUniAppXImportantApplyForSass } from "@weapp-tailwindcss/postcss/transform";
|
|
6
6
|
import MagicString from "magic-string";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stableSerialize(value: unknown, stack?: WeakSet<object>): string;
|