weapp-tailwindcss 5.1.5 → 5.1.6
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/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/bundlers/shared/generator-css/types.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/user-css.d.ts +4 -1
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +7 -0
- package/dist/{context-rrYZuUBU.mjs → context-3GGqW9vw.mjs} +3 -3
- package/dist/{context-BziwyWy1.js → context-BCSk_YnL.js} +3 -3
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-24-HgU9F.mjs → generator-CoT5vu9w.mjs} +2 -2
- package/dist/{generator-CilgHtxb.js → generator-CqWzj2Z1.js} +2 -2
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-ygWfmOqh.mjs → gulp-Bss4wJ8t.mjs} +4 -4
- package/dist/{gulp-CuVsZdO9.js → gulp-hXE1U4Cu.js} +4 -4
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-Dh_nn3w5.mjs → hmr-timing-Cfu-4Bnf.mjs} +24 -511
- package/dist/{hmr-timing-BKdCeIrn.js → hmr-timing-Df4203aI.js} +48 -565
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets.js +6 -3
- package/dist/presets.mjs +6 -3
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/runtime-branch/generator-target-env.d.ts +1 -0
- package/dist/{source-candidate-scan-signature-DIj9m4wB.js → source-candidate-scan-signature-5Uk6U72B.js} +3 -3
- package/dist/{source-candidate-scan-signature-DATRnS1X.mjs → source-candidate-scan-signature-BbCmW975.mjs} +3 -3
- package/dist/{tailwindcss-C-uM4rB8.mjs → tailwindcss-Bjr3aphG.mjs} +15 -2
- package/dist/{tailwindcss-BwoNQ3t8.js → tailwindcss-DYJ3HZD2.js} +15 -2
- package/dist/{transform-DHLemtaX.mjs → transform--155BmeJ.mjs} +1 -1
- package/dist/{transform-KLD1tJdb.js → transform-B6_y_yCB.js} +1 -1
- package/dist/{v4-engine-CKtsdKxK.js → v4-engine-C9cmNlP8.js} +610 -3
- package/dist/{v4-engine-BuuYDXt1.mjs → v4-engine-DRQaCFMm.mjs} +529 -6
- package/dist/{vite-Yp14HNyS.js → vite-Baw9qNrc.js} +560 -112
- package/dist/{vite-cH0tTMHc.mjs → vite-PdxjaqhO.mjs} +561 -113
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +2994 -2958
- package/dist/{webpack-DBhmJ-_P.mjs → webpack-BffTDmod.mjs} +12 -13
- package/dist/{webpack-DN3tgLbF.js → webpack-C9u7mfGE.js} +18 -19
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as resolveGeneratorRuntimeBranch, i as normalizeWeappTailwindcssGeneratorOptions, s as shouldUseMiniProgramCssBranch, t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { S as createDebug, g as traverse, h as babelParse, m as replaceWxml, r as resolveStyleOptionsFromContext, w as md5Hash } from "./context-
|
|
4
|
-
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as includesTailwindV4PreflightDirective } from "./tailwindcss-
|
|
1
|
+
import { $ as hasTailwindGeneratedCssMarkers, A as stripTailwindSourceMediaFragments, C as isCommentOnlyCss, D as removeTailwindV4GeneratorAtRules, E as removeTailwindV4GeneratedUserCssArtifacts, Et as omitUndefined, H as hasTailwindSourceDirectives, I as removeUnsupportedMiniProgramAtRules, J as resolveCssEntrySource, K as parseImportRequest, M as transformGeneratorUserCss, N as finalizeMiniProgramCss, O as shouldFilterApplyOnlyGeneratedCss, Q as hasTailwindGeneratedCss, S as hasUserCssLayerBlocks, St as toPosixPath$1, Tt as filterUnsupportedMiniProgramTailwindV4Candidates, V as hasTailwindRootDirectives, W as normalizeTailwindSourceDirectives, X as VITE_MARKER_RE, Y as GENERATOR_PLACEHOLDER_MARKER_RE, Z as createCssAppend, at as stripTailwindBanners, b as extractGeneratedCssForUserLayerSelectors, bt as resolveSourceScanPath, et as splitGeneratorPlaceholderCssBySourceOrder, ft as FULL_SOURCE_SCAN_EXTENSION_RE, gt as isFileMatchedByTailwindSourceEntries, i as resolveTailwindV4SourceOptionsFromRuntime, it as stripTailwindBanner, j as stripUnmatchedTailwindSourceMediaCloseFragments, k as splitUserCssLayerBlocks, kt as loadTailwindV4DesignSystem, n as resolveTailwindV4SourceFromRuntime, nt as splitTailwindV4GeneratedCssBySourceOrder, ot as normalizeConfigDirective, q as removeTailwindSourceDirectives, rt as stripGeneratorPlaceholderMarkers, st as prependConfigDirective, t as resolveTailwindV4Source$1, tt as splitTailwindGeneratedCssByBanner, w as normalizeEmptyTailwindCustomVariants, x as filterApplyOnlyGeneratedCss, xt as resolveTailwindV4CssSourceBase, z as hasTailwindApplyDirective } from "./v4-engine-DRQaCFMm.mjs";
|
|
2
|
+
import { a as resolveGeneratorRuntimeBranch, i as normalizeWeappTailwindcssGeneratorOptions, s as shouldUseMiniProgramCssBranch, t as createWeappTailwindcssGenerator } from "./generator-CoT5vu9w.mjs";
|
|
3
|
+
import { S as createDebug, g as traverse, h as babelParse, m as replaceWxml, r as resolveStyleOptionsFromContext, w as md5Hash } from "./context-3GGqW9vw.mjs";
|
|
4
|
+
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as includesTailwindV4PreflightDirective } from "./tailwindcss-Bjr3aphG.mjs";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { extractRawCandidatesWithPositions, extractSourceCandidates, extractValidCandidates, resolveProjectSourceFiles, resolveValidTailwindV4Candidates, splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
9
|
-
import { cleanLocalCssImportWrapperTailwindDirectives, cleanLocalCssImportWrapperTailwindDirectivesRoot, filterExistingCssRules,
|
|
9
|
+
import { cleanLocalCssImportWrapperTailwindDirectives, cleanLocalCssImportWrapperTailwindDirectivesRoot, filterExistingCssRules, isPureLocalCssImportWrapper, isPureLocalCssImportWrapperRoot, postcss, restoreLocalCssImports, rewriteLocalCssImportRequestsForOutput, splitLocalCssImports, splitLocalCssImportsRoot, transformWebCssCompat } from "@weapp-tailwindcss/postcss";
|
|
10
10
|
import { LRUCache } from "lru-cache";
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
12
12
|
import { MappingChars2String, unescape } from "@weapp-core/escape";
|
|
@@ -181,8 +181,11 @@ function isVueScopedStyleSource(from) {
|
|
|
181
181
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
182
182
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
183
183
|
}
|
|
184
|
+
function isMiniProgramGeneratorTarget(target) {
|
|
185
|
+
return target !== "web";
|
|
186
|
+
}
|
|
184
187
|
function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPreflight, options = {}) {
|
|
185
|
-
if (target
|
|
188
|
+
if (!isMiniProgramGeneratorTarget(target)) return css;
|
|
186
189
|
if (isVueScopedStyleSource(options.styleOptions?.postcssOptions?.options?.from)) return finalizeMiniProgramCss(css, {
|
|
187
190
|
cssPreflight: false,
|
|
188
191
|
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
@@ -1381,501 +1384,6 @@ async function resolveGeneratorSourceEntries(source, runtimeState) {
|
|
|
1381
1384
|
return resolved?.entries;
|
|
1382
1385
|
}
|
|
1383
1386
|
//#endregion
|
|
1384
|
-
//#region src/bundlers/shared/generator-css/user-css.ts
|
|
1385
|
-
const TAILWIND_V4_GENERATOR_AT_RULES = /* @__PURE__ */ new Set([
|
|
1386
|
-
"config",
|
|
1387
|
-
"custom-variant",
|
|
1388
|
-
"plugin",
|
|
1389
|
-
"source",
|
|
1390
|
-
"theme",
|
|
1391
|
-
"utility",
|
|
1392
|
-
"variant"
|
|
1393
|
-
]);
|
|
1394
|
-
function removeBalancedAtRuleBlock(source, atRuleStart) {
|
|
1395
|
-
const blockStart = source.indexOf("{", atRuleStart);
|
|
1396
|
-
if (blockStart === -1) {
|
|
1397
|
-
const semicolon = source.indexOf(";", atRuleStart);
|
|
1398
|
-
return semicolon === -1 ? source.slice(0, atRuleStart) : `${source.slice(0, atRuleStart)}${source.slice(semicolon + 1)}`;
|
|
1399
|
-
}
|
|
1400
|
-
let depth = 0;
|
|
1401
|
-
for (let index = blockStart; index < source.length; index++) {
|
|
1402
|
-
const char = source[index];
|
|
1403
|
-
if (char === "{") {
|
|
1404
|
-
depth++;
|
|
1405
|
-
continue;
|
|
1406
|
-
}
|
|
1407
|
-
if (char !== "}") continue;
|
|
1408
|
-
depth--;
|
|
1409
|
-
if (depth === 0) return `${source.slice(0, atRuleStart)}${source.slice(index + 1)}`;
|
|
1410
|
-
}
|
|
1411
|
-
return source.slice(0, atRuleStart);
|
|
1412
|
-
}
|
|
1413
|
-
function removeTailwindV4GeneratorAtRulesFallback(source) {
|
|
1414
|
-
let next = source;
|
|
1415
|
-
let changed = false;
|
|
1416
|
-
const sourceMediaRE = /@media\s+source\([^)]*\)\s*\{/g;
|
|
1417
|
-
for (;;) {
|
|
1418
|
-
sourceMediaRE.lastIndex = 0;
|
|
1419
|
-
const match = sourceMediaRE.exec(next);
|
|
1420
|
-
if (!match) break;
|
|
1421
|
-
next = removeBalancedAtRuleBlock(next, match.index);
|
|
1422
|
-
changed = true;
|
|
1423
|
-
}
|
|
1424
|
-
const atRuleRE = /@(?:config|custom-variant|plugin|source|theme|utility|variant)\b/g;
|
|
1425
|
-
for (;;) {
|
|
1426
|
-
atRuleRE.lastIndex = 0;
|
|
1427
|
-
const match = atRuleRE.exec(next);
|
|
1428
|
-
if (!match) break;
|
|
1429
|
-
next = removeBalancedAtRuleBlock(next, match.index);
|
|
1430
|
-
changed = true;
|
|
1431
|
-
}
|
|
1432
|
-
return changed ? next : source;
|
|
1433
|
-
}
|
|
1434
|
-
function isTailwindGeneratedPreflightComment(text) {
|
|
1435
|
-
return text.includes("cssremedy") || text.includes("Use the user's configured") || text.includes("tailwindlabs/tailwindcss") || text.includes("Prevent padding and border from affecting element width") || text.includes("Remove default margins and padding") || text.includes("Deprecated") || text.includes("Reset all borders") || text.includes("Add the correct text decoration") || text.includes("Make elements with the HTML hidden attribute stay hidden") || text.includes("Inherit font styles in all browsers") || text.includes("Add the correct height in Firefox") || text.includes("Remove the default font size and weight for headings") || text.includes("Reset links to optimize for opt-in styling") || text.includes("Add the correct font weight in Edge and Safari") || text.includes("Use the user's configured `mono` font-family") || text.includes("Add the correct font size in all browsers") || text.includes("Prevent `sub` and `sup` elements from affecting the line height") || text.includes("Remove text indentation from table contents") || text.includes("Use the modern Firefox focus style") || text.includes("Add the correct vertical alignment") || text.includes("Add the correct display") || text.includes("Make lists unstyled by default") || text.includes("Make replaced elements `display: block` by default") || text.includes("Constrain images and videos to the parent width") || text.includes("Restore default font weight") || text.includes("Restore indentation") || text.includes("Restore space after button") || text.includes("Prevent resizing textareas horizontally") || text.includes("Remove the inner padding in Chrome and Safari") || text.includes("Ensure date/time inputs have the same height") || text.includes("Prevent height from changing on date/time inputs") || text.includes("Remove excess padding from pseudo-elements") || text.includes("Center dropdown marker shown on inputs") || text.includes("Remove the additional `:invalid` styles") || text.includes("Correct the inability to style the border radius") || text.includes("Correct the cursor style of increment and decrement buttons");
|
|
1436
|
-
}
|
|
1437
|
-
function isTailwindGeneratedThemeRule(selector, node) {
|
|
1438
|
-
if (!/(?:^|,)\s*(?::host|page|\.tw-root|wx-root-portal-content)\b/.test(selector)) return false;
|
|
1439
|
-
return node.nodes?.some((child) => child.type === "decl" && /^--(?:color|spacing|text|font|default|radius|tw-)/.test(child.prop)) ?? false;
|
|
1440
|
-
}
|
|
1441
|
-
function isTailwindGeneratedPreflightRule(selector, node) {
|
|
1442
|
-
if (selector === "view,text,::after,::before" || selector === "view, text, ::after, ::before" || selector === "*" || selector === "::after" || selector === "::before" || selector === "::backdrop" || selector === ":host" || selector === "[hidden]:not([hidden=\"until-found\"])" || selector === "[hidden]:not([hidden='until-found'])" || selector === "button,input[type=\"button\"],input[type=\"reset\"],input[type=\"submit\"]" || selector === "button, input[type=\"button\"], input[type=\"reset\"], input[type=\"submit\"]" || selector === "button,input[type='button'],input[type='reset'],input[type='submit']" || selector === "button, input[type='button'], input[type='reset'], input[type='submit']") return true;
|
|
1443
|
-
if (selector === "abbr[title]") return node.nodes?.some((child) => child.type === "decl" && child.prop === "text-decoration") ?? false;
|
|
1444
|
-
if (selector === ":host") return node.nodes?.some((child) => child.type === "decl" && child.value?.includes("--theme(")) ?? false;
|
|
1445
|
-
return false;
|
|
1446
|
-
}
|
|
1447
|
-
function removeTailwindV4GeneratedUserCssArtifacts(source) {
|
|
1448
|
-
try {
|
|
1449
|
-
const root = postcss.parse(source);
|
|
1450
|
-
let changed = false;
|
|
1451
|
-
root.walkComments((comment) => {
|
|
1452
|
-
if (!isTailwindGeneratedPreflightComment(comment.text)) return;
|
|
1453
|
-
comment.remove();
|
|
1454
|
-
changed = true;
|
|
1455
|
-
});
|
|
1456
|
-
root.walkRules((rule) => {
|
|
1457
|
-
const selector = rule.selector.replace(/\s+/g, " ").trim();
|
|
1458
|
-
if (isTailwindGeneratedThemeRule(selector, rule) || isTailwindGeneratedPreflightRule(selector, rule)) {
|
|
1459
|
-
rule.remove();
|
|
1460
|
-
changed = true;
|
|
1461
|
-
}
|
|
1462
|
-
});
|
|
1463
|
-
root.walkAtRules((rule) => {
|
|
1464
|
-
if (rule.nodes !== void 0 && rule.nodes.length === 0) {
|
|
1465
|
-
rule.remove();
|
|
1466
|
-
changed = true;
|
|
1467
|
-
}
|
|
1468
|
-
});
|
|
1469
|
-
return changed ? root.toString() : source;
|
|
1470
|
-
} catch {
|
|
1471
|
-
return source;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
function removeTailwindSourceMediaBlocks(source) {
|
|
1475
|
-
let next = source;
|
|
1476
|
-
let changed = false;
|
|
1477
|
-
const sourceMediaRE = /@media\s+source\([^)]*\)\s*\{/g;
|
|
1478
|
-
for (;;) {
|
|
1479
|
-
sourceMediaRE.lastIndex = 0;
|
|
1480
|
-
const match = sourceMediaRE.exec(next);
|
|
1481
|
-
if (!match) break;
|
|
1482
|
-
const blockStart = next.indexOf("{", match.index);
|
|
1483
|
-
if (blockStart === -1) break;
|
|
1484
|
-
let depth = 0;
|
|
1485
|
-
let blockEnd = -1;
|
|
1486
|
-
for (let index = blockStart; index < next.length; index++) {
|
|
1487
|
-
const char = next[index];
|
|
1488
|
-
if (char === "{") {
|
|
1489
|
-
depth++;
|
|
1490
|
-
continue;
|
|
1491
|
-
}
|
|
1492
|
-
if (char !== "}") continue;
|
|
1493
|
-
depth--;
|
|
1494
|
-
if (depth === 0) {
|
|
1495
|
-
blockEnd = index;
|
|
1496
|
-
break;
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
if (blockEnd === -1) break;
|
|
1500
|
-
next = `${next.slice(0, match.index)}${next.slice(blockEnd + 1)}`;
|
|
1501
|
-
changed = true;
|
|
1502
|
-
}
|
|
1503
|
-
for (;;) {
|
|
1504
|
-
const atRuleStart = findTailwindSourceWrapperBlockStart(next);
|
|
1505
|
-
if (atRuleStart === -1) break;
|
|
1506
|
-
next = removeBalancedAtRuleBlock(next, atRuleStart);
|
|
1507
|
-
changed = true;
|
|
1508
|
-
}
|
|
1509
|
-
return changed ? next : source;
|
|
1510
|
-
}
|
|
1511
|
-
function terminateTailwindSourceAtRulesBeforeNextDirective(source) {
|
|
1512
|
-
if (!source.includes("@source")) return source;
|
|
1513
|
-
let next = "";
|
|
1514
|
-
let searchIndex = 0;
|
|
1515
|
-
for (;;) {
|
|
1516
|
-
const atRuleStart = source.indexOf("@source", searchIndex);
|
|
1517
|
-
if (atRuleStart === -1) {
|
|
1518
|
-
next += source.slice(searchIndex);
|
|
1519
|
-
break;
|
|
1520
|
-
}
|
|
1521
|
-
const nextChar = source[atRuleStart + 7];
|
|
1522
|
-
if (nextChar && /[\w-]/.test(nextChar)) {
|
|
1523
|
-
next += source.slice(searchIndex, atRuleStart + 7);
|
|
1524
|
-
searchIndex = atRuleStart + 7;
|
|
1525
|
-
continue;
|
|
1526
|
-
}
|
|
1527
|
-
next += source.slice(searchIndex, atRuleStart);
|
|
1528
|
-
let quote;
|
|
1529
|
-
let parenDepth = 0;
|
|
1530
|
-
let terminated = false;
|
|
1531
|
-
let index = atRuleStart + 7;
|
|
1532
|
-
for (; index < source.length; index++) {
|
|
1533
|
-
const char = source[index];
|
|
1534
|
-
if (quote) {
|
|
1535
|
-
if (char === "\\") {
|
|
1536
|
-
index++;
|
|
1537
|
-
continue;
|
|
1538
|
-
}
|
|
1539
|
-
if (char === quote) quote = void 0;
|
|
1540
|
-
continue;
|
|
1541
|
-
}
|
|
1542
|
-
if (char === "\"" || char === "'") {
|
|
1543
|
-
quote = char;
|
|
1544
|
-
continue;
|
|
1545
|
-
}
|
|
1546
|
-
if (char === "(") {
|
|
1547
|
-
parenDepth++;
|
|
1548
|
-
continue;
|
|
1549
|
-
}
|
|
1550
|
-
if (char === ")" && parenDepth > 0) {
|
|
1551
|
-
parenDepth--;
|
|
1552
|
-
continue;
|
|
1553
|
-
}
|
|
1554
|
-
if (parenDepth > 0) continue;
|
|
1555
|
-
if (char === ";" || char === "{") {
|
|
1556
|
-
terminated = true;
|
|
1557
|
-
index++;
|
|
1558
|
-
break;
|
|
1559
|
-
}
|
|
1560
|
-
if (char === "@" && /^(?:config|custom-variant|plugin|source|theme|utility|variant)\b/.test(source.slice(index + 1))) break;
|
|
1561
|
-
}
|
|
1562
|
-
const segment = source.slice(atRuleStart, index);
|
|
1563
|
-
const trimmedSegment = segment.trimEnd();
|
|
1564
|
-
next += terminated || trimmedSegment.endsWith(";") || trimmedSegment.endsWith("{") ? segment : `${trimmedSegment};${segment.slice(trimmedSegment.length)}`;
|
|
1565
|
-
searchIndex = index;
|
|
1566
|
-
}
|
|
1567
|
-
return next;
|
|
1568
|
-
}
|
|
1569
|
-
function findTailwindSourceWrapperBlockStart(source) {
|
|
1570
|
-
let searchIndex = 0;
|
|
1571
|
-
for (;;) {
|
|
1572
|
-
const atRuleStart = source.indexOf("@source", searchIndex);
|
|
1573
|
-
if (atRuleStart === -1) return -1;
|
|
1574
|
-
const nextChar = source[atRuleStart + 7];
|
|
1575
|
-
if (nextChar && /[\w-]/.test(nextChar)) {
|
|
1576
|
-
searchIndex = atRuleStart + 7;
|
|
1577
|
-
continue;
|
|
1578
|
-
}
|
|
1579
|
-
let quote;
|
|
1580
|
-
let parenDepth = 0;
|
|
1581
|
-
for (let index = atRuleStart + 7; index < source.length; index++) {
|
|
1582
|
-
const char = source[index];
|
|
1583
|
-
if (quote) {
|
|
1584
|
-
if (char === "\\") {
|
|
1585
|
-
index++;
|
|
1586
|
-
continue;
|
|
1587
|
-
}
|
|
1588
|
-
if (char === quote) quote = void 0;
|
|
1589
|
-
continue;
|
|
1590
|
-
}
|
|
1591
|
-
if (char === "\"" || char === "'") {
|
|
1592
|
-
quote = char;
|
|
1593
|
-
continue;
|
|
1594
|
-
}
|
|
1595
|
-
if (char === "(") {
|
|
1596
|
-
parenDepth++;
|
|
1597
|
-
continue;
|
|
1598
|
-
}
|
|
1599
|
-
if (char === ")" && parenDepth > 0) {
|
|
1600
|
-
parenDepth--;
|
|
1601
|
-
continue;
|
|
1602
|
-
}
|
|
1603
|
-
if (parenDepth > 0) continue;
|
|
1604
|
-
if (char === ";") {
|
|
1605
|
-
searchIndex = index + 1;
|
|
1606
|
-
break;
|
|
1607
|
-
}
|
|
1608
|
-
if (char === "{") return atRuleStart;
|
|
1609
|
-
}
|
|
1610
|
-
if (searchIndex <= atRuleStart) return -1;
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
function removeTailwindApplyAtRules(source) {
|
|
1614
|
-
if (!source.includes("@apply")) return source;
|
|
1615
|
-
try {
|
|
1616
|
-
const root = postcss.parse(source);
|
|
1617
|
-
let changed = false;
|
|
1618
|
-
root.walkAtRules("apply", (rule) => {
|
|
1619
|
-
rule.remove();
|
|
1620
|
-
changed = true;
|
|
1621
|
-
});
|
|
1622
|
-
root.walk((node) => {
|
|
1623
|
-
if ("nodes" in node && node.nodes?.length === 0) node.remove();
|
|
1624
|
-
});
|
|
1625
|
-
return changed ? root.toString() : source;
|
|
1626
|
-
} catch {
|
|
1627
|
-
return source;
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
function removeTailwindV4GeneratorAtRules(source) {
|
|
1631
|
-
try {
|
|
1632
|
-
const root = postcss.parse(source);
|
|
1633
|
-
let changed = false;
|
|
1634
|
-
root.walkAtRules((rule) => {
|
|
1635
|
-
if (rule.name === "media" && /^source\(/.test(rule.params.trim())) {
|
|
1636
|
-
rule.remove();
|
|
1637
|
-
changed = true;
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
if (!TAILWIND_V4_GENERATOR_AT_RULES.has(rule.name)) return;
|
|
1641
|
-
rule.remove();
|
|
1642
|
-
changed = true;
|
|
1643
|
-
});
|
|
1644
|
-
return changed ? root.toString() : source;
|
|
1645
|
-
} catch {
|
|
1646
|
-
return removeTailwindV4GeneratorAtRulesFallback(source);
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
function isCommentOnlyCss(source) {
|
|
1650
|
-
try {
|
|
1651
|
-
const root = postcss.parse(source);
|
|
1652
|
-
return root.nodes.length > 0 && root.nodes.every((node) => node.type === "comment");
|
|
1653
|
-
} catch {
|
|
1654
|
-
return false;
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
function removeMiniProgramHoverSelectors(source, enabled = true) {
|
|
1658
|
-
if (!enabled || !source.includes(":hover")) return source;
|
|
1659
|
-
try {
|
|
1660
|
-
const root = postcss.parse(source);
|
|
1661
|
-
let changed = false;
|
|
1662
|
-
root.walkRules((rule) => {
|
|
1663
|
-
const selectors = rule.selectors ?? [rule.selector];
|
|
1664
|
-
const keptSelectors = selectors.filter((selector) => !selector.includes(":hover"));
|
|
1665
|
-
if (keptSelectors.length === selectors.length) return;
|
|
1666
|
-
changed = true;
|
|
1667
|
-
if (keptSelectors.length === 0) {
|
|
1668
|
-
rule.remove();
|
|
1669
|
-
return;
|
|
1670
|
-
}
|
|
1671
|
-
rule.selectors = keptSelectors;
|
|
1672
|
-
});
|
|
1673
|
-
root.walk((node) => {
|
|
1674
|
-
if ("nodes" in node && node.nodes?.length === 0) {
|
|
1675
|
-
node.remove();
|
|
1676
|
-
changed = true;
|
|
1677
|
-
}
|
|
1678
|
-
});
|
|
1679
|
-
return changed ? root.toString() : source;
|
|
1680
|
-
} catch {
|
|
1681
|
-
return source;
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
function removeProcessedMiniProgramUnsupportedCss(source, options) {
|
|
1685
|
-
return removeMiniProgramHoverSelectors(removeUnsupportedMiniProgramAtRules(source), options.cssRemoveHoverPseudoClass);
|
|
1686
|
-
}
|
|
1687
|
-
function unwrapMiniProgramCascadeLayers(source) {
|
|
1688
|
-
if (!source.includes("@layer")) return source;
|
|
1689
|
-
try {
|
|
1690
|
-
const root = postcss.parse(source);
|
|
1691
|
-
removeUnsupportedCascadeLayers(root);
|
|
1692
|
-
return root.toString();
|
|
1693
|
-
} catch {
|
|
1694
|
-
return source;
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
function stripTailwindSourceMediaFragments(source) {
|
|
1698
|
-
let removedSourceMediaStart = false;
|
|
1699
|
-
return terminateTailwindSourceAtRulesBeforeNextDirective(removeTailwindSourceMediaBlocks(source)).split(/\r?\n/).filter((line) => {
|
|
1700
|
-
if (/^\s*@media\s+source\([^)]*\)\s*\{\s*$/.test(line)) {
|
|
1701
|
-
removedSourceMediaStart = true;
|
|
1702
|
-
return false;
|
|
1703
|
-
}
|
|
1704
|
-
if (/^\s*\}\s*\/\*\s*source\([^)]*\)\s*\*\/\s*$/.test(line)) return false;
|
|
1705
|
-
if (removedSourceMediaStart && /^\s*\}\s*$/.test(line)) {
|
|
1706
|
-
removedSourceMediaStart = false;
|
|
1707
|
-
return false;
|
|
1708
|
-
}
|
|
1709
|
-
return true;
|
|
1710
|
-
}).join("\n");
|
|
1711
|
-
}
|
|
1712
|
-
function stripLeadingTailwindSourceMediaCloseFragment(source) {
|
|
1713
|
-
return source.replace(/^\s*\}\s*(?:\n|$)/, "");
|
|
1714
|
-
}
|
|
1715
|
-
function stripUnmatchedTailwindSourceMediaCloseFragments(source) {
|
|
1716
|
-
try {
|
|
1717
|
-
postcss.parse(source);
|
|
1718
|
-
return source;
|
|
1719
|
-
} catch {
|
|
1720
|
-
return stripLeadingTailwindSourceMediaCloseFragment(source).replace(/\s*\}\s*$/, "");
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
function splitUserCssLayerBlocks(source) {
|
|
1724
|
-
if (!source.includes("@layer")) return {
|
|
1725
|
-
layer: "",
|
|
1726
|
-
rest: source
|
|
1727
|
-
};
|
|
1728
|
-
try {
|
|
1729
|
-
const root = postcss.parse(source);
|
|
1730
|
-
const layerRoot = postcss.root();
|
|
1731
|
-
const restRoot = postcss.root();
|
|
1732
|
-
for (const node of root.nodes) (node.type === "atrule" && node.name === "layer" && node.nodes?.length ? layerRoot : restRoot).append(node.clone());
|
|
1733
|
-
return {
|
|
1734
|
-
layer: layerRoot.toString(),
|
|
1735
|
-
rest: restRoot.toString()
|
|
1736
|
-
};
|
|
1737
|
-
} catch {
|
|
1738
|
-
return {
|
|
1739
|
-
layer: source,
|
|
1740
|
-
rest: ""
|
|
1741
|
-
};
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
function hasUserCssLayerBlocks(source) {
|
|
1745
|
-
if (!source.includes("@layer")) return false;
|
|
1746
|
-
try {
|
|
1747
|
-
let hasLayerBlock = false;
|
|
1748
|
-
postcss.parse(source).walkAtRules("layer", (node) => {
|
|
1749
|
-
if (node.nodes?.length) hasLayerBlock = true;
|
|
1750
|
-
});
|
|
1751
|
-
return hasLayerBlock;
|
|
1752
|
-
} catch {
|
|
1753
|
-
return true;
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
function collectUserLayerSelectors(source) {
|
|
1757
|
-
const selectors = /* @__PURE__ */ new Set();
|
|
1758
|
-
try {
|
|
1759
|
-
postcss.parse(source).walkRules((rule) => {
|
|
1760
|
-
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
1761
|
-
const normalized = selector.trim();
|
|
1762
|
-
if (normalized) selectors.add(normalized);
|
|
1763
|
-
}
|
|
1764
|
-
});
|
|
1765
|
-
} catch {}
|
|
1766
|
-
return selectors;
|
|
1767
|
-
}
|
|
1768
|
-
function matchesUserLayerSelector(selector, userLayerSelector) {
|
|
1769
|
-
if (selector === userLayerSelector) return true;
|
|
1770
|
-
if (!selector.startsWith(userLayerSelector)) return false;
|
|
1771
|
-
const next = selector[userLayerSelector.length];
|
|
1772
|
-
return next === ":" || next === "[";
|
|
1773
|
-
}
|
|
1774
|
-
function extractGeneratedCssForUserLayerSelectors(css, userLayerSource) {
|
|
1775
|
-
const selectors = collectUserLayerSelectors(userLayerSource);
|
|
1776
|
-
if (selectors.size === 0) return {
|
|
1777
|
-
layer: "",
|
|
1778
|
-
rest: css
|
|
1779
|
-
};
|
|
1780
|
-
try {
|
|
1781
|
-
const root = postcss.parse(css);
|
|
1782
|
-
const layerRoot = postcss.root();
|
|
1783
|
-
const selectorList = [...selectors];
|
|
1784
|
-
root.walkRules((rule) => {
|
|
1785
|
-
if ((rule.selectors ?? [rule.selector]).some((selector) => selectorList.some((userSelector) => matchesUserLayerSelector(selector.trim(), userSelector)))) {
|
|
1786
|
-
layerRoot.append(rule.clone());
|
|
1787
|
-
rule.remove();
|
|
1788
|
-
}
|
|
1789
|
-
});
|
|
1790
|
-
return {
|
|
1791
|
-
layer: layerRoot.toString(),
|
|
1792
|
-
rest: root.toString()
|
|
1793
|
-
};
|
|
1794
|
-
} catch {
|
|
1795
|
-
return {
|
|
1796
|
-
layer: "",
|
|
1797
|
-
rest: css
|
|
1798
|
-
};
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
function normalizeGeneratedSelector(selector) {
|
|
1802
|
-
return selector.replace(/:not\(#\\#\)/g, "").trim();
|
|
1803
|
-
}
|
|
1804
|
-
function collectApplyOnlySourceSelectors(source) {
|
|
1805
|
-
const selectors = /* @__PURE__ */ new Set();
|
|
1806
|
-
try {
|
|
1807
|
-
postcss.parse(source).walkRules((rule) => {
|
|
1808
|
-
if (!rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) return;
|
|
1809
|
-
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
1810
|
-
const normalized = normalizeGeneratedSelector(selector);
|
|
1811
|
-
if (normalized) selectors.add(normalized);
|
|
1812
|
-
}
|
|
1813
|
-
});
|
|
1814
|
-
} catch {}
|
|
1815
|
-
return selectors;
|
|
1816
|
-
}
|
|
1817
|
-
function hasOnlyApplyBackedSourceRules(source) {
|
|
1818
|
-
let hasApplyRule = false;
|
|
1819
|
-
let hasNonApplyRule = false;
|
|
1820
|
-
try {
|
|
1821
|
-
postcss.parse(source).walkRules((rule) => {
|
|
1822
|
-
if (rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) hasApplyRule = true;
|
|
1823
|
-
else hasNonApplyRule = true;
|
|
1824
|
-
});
|
|
1825
|
-
} catch {
|
|
1826
|
-
return false;
|
|
1827
|
-
}
|
|
1828
|
-
return hasApplyRule && !hasNonApplyRule;
|
|
1829
|
-
}
|
|
1830
|
-
function filterApplyOnlyGeneratedCss(css, source) {
|
|
1831
|
-
const selectors = collectApplyOnlySourceSelectors(source);
|
|
1832
|
-
if (selectors.size === 0) return css;
|
|
1833
|
-
const selectorList = [...selectors];
|
|
1834
|
-
try {
|
|
1835
|
-
const root = postcss.parse(css);
|
|
1836
|
-
root.walkRules((rule) => {
|
|
1837
|
-
const isApplySelector = (rule.selectors ?? [rule.selector]).some((selector) => {
|
|
1838
|
-
const normalized = normalizeGeneratedSelector(selector);
|
|
1839
|
-
return selectorList.some((sourceSelector) => {
|
|
1840
|
-
if (normalized === sourceSelector) return true;
|
|
1841
|
-
if (!normalized.startsWith(sourceSelector)) return false;
|
|
1842
|
-
const next = normalized[sourceSelector.length];
|
|
1843
|
-
return next === ":" || next === "[" || next === ".";
|
|
1844
|
-
});
|
|
1845
|
-
});
|
|
1846
|
-
const isVariableRule = rule.nodes?.some((node) => node.type === "decl" && node.prop.startsWith("--"));
|
|
1847
|
-
if (!isApplySelector && !isVariableRule) rule.remove();
|
|
1848
|
-
});
|
|
1849
|
-
root.walkAtRules((rule) => {
|
|
1850
|
-
if (rule.nodes !== void 0 && rule.nodes.length === 0) rule.remove();
|
|
1851
|
-
});
|
|
1852
|
-
return root.toString();
|
|
1853
|
-
} catch {
|
|
1854
|
-
return css;
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
function shouldFilterApplyOnlyGeneratedCss(_majorVersion, target, source, options) {
|
|
1858
|
-
return target === "weapp" && hasTailwindApplyDirective(source) && !hasTailwindRootDirectives(source) && !options.hasGeneratedCss && !options.hasGeneratedMarkers && collectApplyOnlySourceSelectors(source).size > 0 && hasOnlyApplyBackedSourceRules(source);
|
|
1859
|
-
}
|
|
1860
|
-
async function transformGeneratorUserCss(source, options) {
|
|
1861
|
-
if (source.trim().length === 0) return "";
|
|
1862
|
-
if (options.processed) return stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(removeTailwindV4GeneratorAtRules(options.generatorTarget === "weapp" ? removeTailwindV4GeneratedUserCssArtifacts(removeProcessedMiniProgramUnsupportedCss(source, {
|
|
1863
|
-
...options.generatorStyleOptions,
|
|
1864
|
-
...options.cssUserHandlerOptions
|
|
1865
|
-
})) : source)));
|
|
1866
|
-
const cleanedSource = removeTailwindSourceDirectives(removeTailwindV4GeneratorAtRules(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(source))), { importFallback: options.importFallback });
|
|
1867
|
-
if (cleanedSource.trim().length === 0) return "";
|
|
1868
|
-
const userSource = stripUnmatchedTailwindSourceMediaCloseFragments(removeTailwindApplyAtRules(removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(options.generatorTarget === "weapp" ? removeTailwindV4GeneratedUserCssArtifacts(removeUnsupportedMiniProgramAtRules(unwrapMiniProgramCascadeLayers(cleanedSource))) : cleanedSource)), { importFallback: options.importFallback })));
|
|
1869
|
-
if (userSource.trim().length === 0) return "";
|
|
1870
|
-
if (isCommentOnlyCss(userSource)) return userSource;
|
|
1871
|
-
if (options.generatorTarget !== "weapp") return userSource;
|
|
1872
|
-
const { css } = await options.styleHandler(userSource, {
|
|
1873
|
-
...options.generatorStyleOptions,
|
|
1874
|
-
...options.cssUserHandlerOptions
|
|
1875
|
-
});
|
|
1876
|
-
return removeTailwindV4GeneratedUserCssArtifacts(removeUnsupportedMiniProgramAtRules(css));
|
|
1877
|
-
}
|
|
1878
|
-
//#endregion
|
|
1879
1387
|
//#region src/bundlers/shared/generator-css/legacy-compat.ts
|
|
1880
1388
|
const LEGACY_CONTAINER_COMPAT_CSS = [
|
|
1881
1389
|
".container {",
|
|
@@ -2380,11 +1888,12 @@ function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
|
2380
1888
|
return target === "web" ? transformWebCssCompat(css, webCompat) : css;
|
|
2381
1889
|
}
|
|
2382
1890
|
async function generateCssByGenerator(options) {
|
|
2383
|
-
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
1891
|
+
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, generatorPlatform, userRawSource, userRawSourceProcessed, debug } = options;
|
|
1892
|
+
const platform = generatorPlatform ?? opts.cssOptions?.platform ?? opts.platform;
|
|
2384
1893
|
const generatorOptions = {
|
|
2385
1894
|
...normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
2386
1895
|
appType: opts.appType,
|
|
2387
|
-
platform
|
|
1896
|
+
platform,
|
|
2388
1897
|
tailwindcssMajorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
2389
1898
|
uniAppX: opts.uniAppX
|
|
2390
1899
|
}),
|
|
@@ -2392,13 +1901,13 @@ async function generateCssByGenerator(options) {
|
|
|
2392
1901
|
};
|
|
2393
1902
|
const generatorBranch = resolveGeneratorRuntimeBranch(generatorOptions, {
|
|
2394
1903
|
appType: opts.appType,
|
|
2395
|
-
platform
|
|
1904
|
+
platform,
|
|
2396
1905
|
tailwindcssMajorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
2397
1906
|
uniAppX: opts.uniAppX
|
|
2398
1907
|
});
|
|
2399
1908
|
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
2400
1909
|
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
2401
|
-
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
1910
|
+
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeEmptyTailwindCustomVariants(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback }))));
|
|
2402
1911
|
const effectiveRawSourceRoot = parseCssSourceRoot(effectiveRawSource);
|
|
2403
1912
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
2404
1913
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
@@ -2416,10 +1925,10 @@ async function generateCssByGenerator(options) {
|
|
|
2416
1925
|
const localImportParts = splitLocalCssImportsFromParsedRoot(effectiveRawSource, effectiveRawSourceRoot);
|
|
2417
1926
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
2418
1927
|
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
2419
|
-
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
1928
|
+
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports, { outputFile: file }), target, generatorOptions.webCompat);
|
|
2420
1929
|
};
|
|
2421
1930
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
2422
|
-
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
1931
|
+
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeEmptyTailwindCustomVariants(normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback }))));
|
|
2423
1932
|
const userSource = (rawUserSource === generatorRawSource ? void 0 : splitLocalCssImports(rawUserSource))?.source ?? rawUserSource;
|
|
2424
1933
|
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
2425
1934
|
const generatedUserCssOrderSource = hasTailwindGeneratedCss(userSource) ? splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
@@ -2429,6 +1938,10 @@ async function generateCssByGenerator(options) {
|
|
|
2429
1938
|
const hasGeneratedCss = hasTailwindGeneratedCss(generatorRawSource);
|
|
2430
1939
|
const hasSourceDirectives = hasTailwindSourceDirectives(generatorRawSource, { importFallback: generatorOptions.importFallback });
|
|
2431
1940
|
const hasGeneratedMarkers = hasTailwindGeneratedCssMarkers(generatorRawSource);
|
|
1941
|
+
const normalizedCssSources = options.cssSources?.map((source) => ({
|
|
1942
|
+
...source,
|
|
1943
|
+
css: normalizeEmptyTailwindCustomVariants(source.css)
|
|
1944
|
+
}));
|
|
2432
1945
|
if (!shouldUseGeneratorForCurrentCss(majorVersion, cssHandlerOptions, {
|
|
2433
1946
|
forceGenerator: options.forceGenerator,
|
|
2434
1947
|
hasGeneratedCss,
|
|
@@ -2450,7 +1963,7 @@ async function generateCssByGenerator(options) {
|
|
|
2450
1963
|
const runtimeWithCurrentCss = createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates);
|
|
2451
1964
|
const sources = await resolveGeneratorSources(majorVersion, runtimeState, generatorRawSource, file, cssHandlerOptions, generatorOptions, {
|
|
2452
1965
|
cssEntries: cssHandlerOptions.sourceOptions?.cssEntries ?? opts.cssEntries,
|
|
2453
|
-
cssSources:
|
|
1966
|
+
cssSources: normalizedCssSources,
|
|
2454
1967
|
getSourceCandidatesForEntries,
|
|
2455
1968
|
runtime: runtimeWithCurrentCss
|
|
2456
1969
|
});
|
|
@@ -2496,7 +2009,7 @@ async function generateCssByGenerator(options) {
|
|
|
2496
2009
|
const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2497
2010
|
injectPreflight: false,
|
|
2498
2011
|
styleOptions: generatorStyleOptions
|
|
2499
|
-
})) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
|
|
2012
|
+
})) : options.previousCss, localImports, { outputFile: file }), generated.target, generatorOptions.webCompat);
|
|
2500
2013
|
return {
|
|
2501
2014
|
css: finalCss,
|
|
2502
2015
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2516,7 +2029,7 @@ async function generateCssByGenerator(options) {
|
|
|
2516
2029
|
hasGeneratedMarkers
|
|
2517
2030
|
});
|
|
2518
2031
|
const generatedCssSource = generated.target === "web" ? generated.css : stripTailwindBanner(generated.css);
|
|
2519
|
-
const generatedCss = shouldFilterApplyOnlyCss ? filterApplyOnlyGeneratedCss(generatedCssSource, generatorRawSource) : generatedCssSource;
|
|
2032
|
+
const generatedCss = shouldFilterApplyOnlyCss ? filterApplyOnlyGeneratedCss(generatedCssSource, generatorRawSource, { preserveVariables: generated.target !== "web" }) : generatedCssSource;
|
|
2520
2033
|
const hasMatchedCssSourceFile = sources.some((source) => source.__weappTailwindcssMeta?.matchedCssSourceFile);
|
|
2521
2034
|
const hasExplicitCssSource = sources.some((source) => {
|
|
2522
2035
|
const metadata = source.__weappTailwindcssMeta;
|
|
@@ -3557,4 +3070,4 @@ function createHmrTimingRecorder(bundler) {
|
|
|
3557
3070
|
};
|
|
3558
3071
|
}
|
|
3559
3072
|
//#endregion
|
|
3560
|
-
export {
|
|
3073
|
+
export { hasMiniProgramTailwindV4PreflightReset as C, isCssSourceTraceEnabled as D, createCssTokenSourceMap as E, processCachedTask as O, createCssSourceOrderAppend$1 as S, createCssSourceTraceCacheSignature as T, isPureLocalCssImportWrapper as _, isSourceCandidateRequest as a, scoreTailwindV4CssSourceFileMatch as b, collectStrictEscapedRuntimeCandidates as c, validateCandidatesByGenerator as d, pushConcurrentTaskFactories as f, mergeMarkedUserLayerComponentsCss as g, extractMarkedUserLayerComponentsCss as h, createSourceCandidateStore as i, createEscapeFragments as l, runWithConcurrency as m, emitHmrTiming as n, resolveSourceCandidateScanFiles as o, resolveTaskConcurrency as p, createSourceCandidateCollector as r, createBundleRuntimeClassSetManager as s, createHmrTimingRecorder as t, generateCssByGenerator as u, rewriteLocalCssImportRequestsForOutput as v, annotateCssSourceTrace as w, removeGeneratedSelectorCompatCss as x, splitLocalCssImports as y };
|