weapp-tailwindcss 5.0.0-next.15 → 5.0.0-next.17
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/{bundle-state-ClSg28Qk.js → bundle-state-DDgxuERW.js} +1 -1
- package/dist/{bundle-state-CrhkNTsw.mjs → bundle-state-YW-zLcsc.mjs} +1 -1
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/markers.d.ts +4 -0
- package/dist/bundlers/shared/generator-css.d.ts +1 -1
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-CImaTibB.js → generator-BIEhxFdv.js} +1 -1
- package/dist/{generator-DSMdL4vg.mjs → generator-Ber8UVgv.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-CH1L--wj.js → incremental-runtime-class-set-CfznDtJ0.js} +134 -21
- package/dist/{incremental-runtime-class-set-P-3ZoWW5.mjs → incremental-runtime-class-set-DC0RsBbK.mjs} +134 -21
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-k0BshZZQ.js → postcss-DCOUtuwI.js} +2 -2
- package/dist/{postcss-CgFCqilE.mjs → postcss-DW08tZXt.mjs} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-DMXLnfTN.mjs → precheck-CX-5VqM1.mjs} +2 -2
- package/dist/{precheck-GcUdX1BX.js → precheck-CZfnh4T6.js} +2 -2
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{source-candidates-ES3ttZPe.js → source-candidates-BDyoPviV.js} +1 -1
- package/dist/{source-candidates-om5-wQJ0.mjs → source-candidates-DGlDzkvf.mjs} +1 -1
- package/dist/{tailwindcss-CkTBauKa.js → tailwindcss-BVoa7vx-.js} +5 -3
- package/dist/{tailwindcss-fe0rGj7T.mjs → tailwindcss-D74Wk4ys.mjs} +5 -3
- package/dist/{v3-engine-v__n8_Sd.js → v3-engine-BRInt2DS.js} +92 -4
- package/dist/{v3-engine-qoWtwjIj.mjs → v3-engine-CCxDqZ8e.mjs} +93 -5
- package/dist/{vite-Bob_Mrva.js → vite-DnHdmHHD.js} +32 -15
- package/dist/{vite-cBjGYHFH.mjs → vite-bmU2kkO6.mjs} +32 -15
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +2 -1
- package/dist/{webpack-Cq45BZzs.mjs → webpack-BkBoEn4k.mjs} +5 -5
- package/dist/{webpack-BedfyGbF.js → webpack-SxEdWHlL.js} +5 -5
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -4
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { B as omitUndefined, E as removeUnsupportedCascadeLayers, F as createDebug, O as loadTailwindV4DesignSystem, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { l as replaceWxml } from "./precheck-
|
|
4
|
-
import { i as resolveUniAppXOptions } from "./tailwindcss-
|
|
1
|
+
import { B as omitUndefined, E as removeUnsupportedCascadeLayers, F as createDebug, O as loadTailwindV4DesignSystem, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-Ber8UVgv.mjs";
|
|
3
|
+
import { l as replaceWxml } from "./precheck-CX-5VqM1.mjs";
|
|
4
|
+
import { i as resolveUniAppXOptions } from "./tailwindcss-D74Wk4ys.mjs";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import postcss from "postcss";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
9
9
|
import { extractRawCandidatesWithPositions, extractValidCandidates } from "tailwindcss-patch";
|
|
10
|
+
import { normalizeModernColorValue } from "@weapp-tailwindcss/postcss";
|
|
10
11
|
//#region src/bundlers/shared/generator-css/markers.ts
|
|
11
12
|
const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
|
|
12
13
|
const TAILWIND_GENERATED_CSS_MARKER_RE = /\/\*!\s*tailwindcss v|@property\s+--tw-|--tw-|:not\(#\\#\)|\.[^,{]*(?:\\:|\\\[|\\#)|(?::host|page|\.tw-root|wx-root-portal-content)[^{]*\{[^}]*--(?:color|spacing|text|font-weight|radius)-/;
|
|
@@ -39,6 +40,20 @@ function splitTailwindV4GeneratedCssBySourceOrder(rawSource, rawTailwindCss) {
|
|
|
39
40
|
after: rawSource.slice(start + rawTailwindCss.length)
|
|
40
41
|
};
|
|
41
42
|
}
|
|
43
|
+
function splitGeneratorPlaceholderCssBySourceOrder(rawSource, rawTailwindCss) {
|
|
44
|
+
const match = GENERATOR_PLACEHOLDER_MARKER_RE.exec(rawSource);
|
|
45
|
+
if (!match || match.index === void 0) return;
|
|
46
|
+
let afterStart = match.index + match[0].length;
|
|
47
|
+
while (/\s/.test(rawSource[afterStart] ?? "")) afterStart++;
|
|
48
|
+
if (rawTailwindCss && rawSource.slice(afterStart).startsWith(rawTailwindCss)) {
|
|
49
|
+
afterStart += rawTailwindCss.length;
|
|
50
|
+
while (/\s/.test(rawSource[afterStart] ?? "")) afterStart++;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
before: rawSource.slice(0, match.index),
|
|
54
|
+
after: rawSource.slice(afterStart)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
42
57
|
function splitTailwindGeneratedCssByBanner(rawSource, start) {
|
|
43
58
|
const match = start === void 0 ? TAILWIND_BANNER_RE.exec(rawSource) : { index: start };
|
|
44
59
|
if (!match || match.index === void 0) return;
|
|
@@ -89,6 +104,7 @@ const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
|
|
|
89
104
|
const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|tailwind|config|custom-variant|plugin|source|theme|utility|variant)\b/;
|
|
90
105
|
const TAILWIND_EXTRACTABLE_DIRECTIVE_RE = /^\s*@(?:import|tailwind|config|source|reference|plugin)\b[\s\S]*?(?:;|$)/;
|
|
91
106
|
const TAILWIND_EXTRACTABLE_BLOCK_DIRECTIVE_RE = /^\s*@(?:theme|utility|variant|custom-variant)\b[\s\S]*$/;
|
|
107
|
+
const TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE = /^\s*@layer\s[^;{]+;\s*$/;
|
|
92
108
|
function parseImportRequest(params) {
|
|
93
109
|
return /^(?:url\(\s*)?(["']?)([^"')\s]+)\1\s*\)?/.exec(params.trim())?.[2];
|
|
94
110
|
}
|
|
@@ -145,7 +161,7 @@ function extractTailwindDirectiveLines(rawSource, options = {}) {
|
|
|
145
161
|
for (const line of stripGeneratorPlaceholderMarkers(rawSource).split(/\r?\n/)) {
|
|
146
162
|
const trimmed = line.trim();
|
|
147
163
|
if (!trimmed || trimmed.startsWith("//")) continue;
|
|
148
|
-
const directive = TAILWIND_EXTRACTABLE_DIRECTIVE_RE.exec(line)?.[0] ?? TAILWIND_EXTRACTABLE_BLOCK_DIRECTIVE_RE.exec(line)?.[0];
|
|
164
|
+
const directive = TAILWIND_EXTRACTABLE_DIRECTIVE_RE.exec(line)?.[0] ?? TAILWIND_EXTRACTABLE_BLOCK_DIRECTIVE_RE.exec(line)?.[0] ?? TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE.exec(line)?.[0];
|
|
149
165
|
if (!directive) continue;
|
|
150
166
|
const normalized = normalizeTailwindDirectiveLine(directive.trimEnd(), options);
|
|
151
167
|
const normalizedTrimmed = normalized.trim();
|
|
@@ -568,8 +584,19 @@ function removeDisplayP3Declarations(root) {
|
|
|
568
584
|
removeEmptyAtRuleAncestors(parent);
|
|
569
585
|
}
|
|
570
586
|
});
|
|
587
|
+
}
|
|
588
|
+
function removeUnsupportedModernColorDeclarations(root) {
|
|
589
|
+
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
571
590
|
root.walkDecls((decl) => {
|
|
572
|
-
if (
|
|
591
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
592
|
+
});
|
|
593
|
+
root.walkDecls((decl) => {
|
|
594
|
+
const normalized = normalizeModernColorValue(decl.value, customPropertyValues);
|
|
595
|
+
if (normalized.changed) {
|
|
596
|
+
decl.value = normalized.value;
|
|
597
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
598
|
+
}
|
|
599
|
+
if (normalized.hasUnsupported) removeDeclarationAndEmptyRule(decl);
|
|
573
600
|
});
|
|
574
601
|
}
|
|
575
602
|
//#endregion
|
|
@@ -584,6 +611,7 @@ const PREFLIGHT_RESET_PROPS = new Set([
|
|
|
584
611
|
"padding"
|
|
585
612
|
]);
|
|
586
613
|
const CONTENT_VAR_RE = /var\(\s*--tw-content\b/;
|
|
614
|
+
const HOIST_ANCHOR_COMMENT = "__weapp_tailwindcss_base_anchor__";
|
|
587
615
|
function isMiniProgramThemeScopeSelector$1(selectors) {
|
|
588
616
|
return selectors.length > 0 && selectors.every((selector) => MINI_PROGRAM_THEME_SCOPE_SELECTORS$1.has(selector));
|
|
589
617
|
}
|
|
@@ -701,11 +729,27 @@ function getTopDirectiveTail(root) {
|
|
|
701
729
|
}
|
|
702
730
|
return tail;
|
|
703
731
|
}
|
|
704
|
-
function
|
|
705
|
-
|
|
732
|
+
function createHoistInsertionAnchor(root) {
|
|
733
|
+
for (const node of root.nodes ?? []) if (isTailwindPreflightRule(node) || isMiniProgramThemeVariableRule(node)) {
|
|
734
|
+
const anchor = postcss.comment({ text: HOIST_ANCHOR_COMMENT });
|
|
735
|
+
node.before(anchor);
|
|
736
|
+
return anchor;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
function insertHoistedRules(root, rules, anchor) {
|
|
740
|
+
if (anchor && !anchor.parent) anchor = void 0;
|
|
741
|
+
if (rules.length === 0) {
|
|
742
|
+
anchor?.remove();
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
706
745
|
const topDirectiveTail = getTopDirectiveTail(root);
|
|
707
746
|
const firstRule = rules[0];
|
|
708
747
|
if (!firstRule) return;
|
|
748
|
+
if (anchor) {
|
|
749
|
+
firstRule.raws.before = anchor.raws.before;
|
|
750
|
+
anchor.replaceWith(rules);
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
709
753
|
firstRule.raws.before = topDirectiveTail ? "\n" : "";
|
|
710
754
|
if (topDirectiveTail) topDirectiveTail.after(rules);
|
|
711
755
|
else root.prepend(rules);
|
|
@@ -719,13 +763,15 @@ function finalizeMiniProgramCssRoot(root, options = {}) {
|
|
|
719
763
|
removeSpecificityPlaceholders(root);
|
|
720
764
|
removeUnsupportedBrowserSelectors(root);
|
|
721
765
|
removeDisplayP3Declarations(root);
|
|
766
|
+
removeUnsupportedModernColorDeclarations(root);
|
|
767
|
+
const hoistAnchor = createHoistInsertionAnchor(root);
|
|
722
768
|
const preflightRules = collectPreflightRules(root, options);
|
|
723
769
|
if (preflightRules.length === 0) {
|
|
724
770
|
const resetRule = createPreflightResetRule(options.cssPreflight);
|
|
725
771
|
if (resetRule) preflightRules.push(resetRule);
|
|
726
772
|
}
|
|
727
773
|
const themeRule = collectThemeVariableRule(root, options);
|
|
728
|
-
insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules);
|
|
774
|
+
insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules, hoistAnchor);
|
|
729
775
|
}
|
|
730
776
|
function unwrapTailwindSourceMedia(root) {
|
|
731
777
|
root.walkAtRules("media", (atRule) => {
|
|
@@ -1470,6 +1516,57 @@ function createStableJson(value) {
|
|
|
1470
1516
|
function createLegacyCompatTransformCacheKey(source, options) {
|
|
1471
1517
|
return `${createStableJson(options)}\0${source}`;
|
|
1472
1518
|
}
|
|
1519
|
+
function countUnclosedBlocks(source) {
|
|
1520
|
+
let depth = 0;
|
|
1521
|
+
let quote;
|
|
1522
|
+
let inComment = false;
|
|
1523
|
+
let escaped = false;
|
|
1524
|
+
for (let index = 0; index < source.length; index += 1) {
|
|
1525
|
+
const char = source[index];
|
|
1526
|
+
const next = source[index + 1];
|
|
1527
|
+
if (inComment) {
|
|
1528
|
+
if (char === "*" && next === "/") {
|
|
1529
|
+
inComment = false;
|
|
1530
|
+
index += 1;
|
|
1531
|
+
}
|
|
1532
|
+
continue;
|
|
1533
|
+
}
|
|
1534
|
+
if (quote) {
|
|
1535
|
+
if (escaped) {
|
|
1536
|
+
escaped = false;
|
|
1537
|
+
continue;
|
|
1538
|
+
}
|
|
1539
|
+
if (char === "\\") {
|
|
1540
|
+
escaped = true;
|
|
1541
|
+
continue;
|
|
1542
|
+
}
|
|
1543
|
+
if (char === quote) quote = void 0;
|
|
1544
|
+
continue;
|
|
1545
|
+
}
|
|
1546
|
+
if (char === "/" && next === "*") {
|
|
1547
|
+
inComment = true;
|
|
1548
|
+
index += 1;
|
|
1549
|
+
continue;
|
|
1550
|
+
}
|
|
1551
|
+
if (char === "\"" || char === "'") {
|
|
1552
|
+
quote = char;
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
if (char === "{") depth += 1;
|
|
1556
|
+
else if (char === "}" && depth > 0) depth -= 1;
|
|
1557
|
+
}
|
|
1558
|
+
return depth;
|
|
1559
|
+
}
|
|
1560
|
+
function closeTrailingUnclosedBlocks(source) {
|
|
1561
|
+
try {
|
|
1562
|
+
postcss.parse(source);
|
|
1563
|
+
return source;
|
|
1564
|
+
} catch (error) {
|
|
1565
|
+
if (error.reason !== "Unclosed block") return source;
|
|
1566
|
+
const unclosedBlocks = countUnclosedBlocks(source);
|
|
1567
|
+
return unclosedBlocks > 0 ? `${source}${"}".repeat(unclosedBlocks)}` : source;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1473
1570
|
function removeTailwindApplyRules(rawSource) {
|
|
1474
1571
|
try {
|
|
1475
1572
|
const root = postcss.parse(rawSource);
|
|
@@ -1491,7 +1588,7 @@ function removeTailwindApplyRules(rawSource) {
|
|
|
1491
1588
|
function resolveLegacyCompatCssSource(rawSource) {
|
|
1492
1589
|
const cached = legacyCompatSourceCache.get(rawSource);
|
|
1493
1590
|
if (cached !== void 0) return cached;
|
|
1494
|
-
const resolved = removeUnsupportedMiniProgramAtRules(removeTailwindApplyRules(removeTailwindSourceDirectives(stripTailwindBanners(rawSource))));
|
|
1591
|
+
const resolved = closeTrailingUnclosedBlocks(removeUnsupportedMiniProgramAtRules(removeTailwindApplyRules(removeTailwindSourceDirectives(closeTrailingUnclosedBlocks(stripTailwindBanners(rawSource))))));
|
|
1495
1592
|
setLimitedCacheValue(legacyCompatSourceCache, rawSource, resolved);
|
|
1496
1593
|
return resolved;
|
|
1497
1594
|
}
|
|
@@ -1606,10 +1703,10 @@ function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
|
|
|
1606
1703
|
//#region src/bundlers/shared/generator-css.ts
|
|
1607
1704
|
const SUPPORTED_GENERATOR_MAJOR_VERSIONS = new Set([3, 4]);
|
|
1608
1705
|
const REMOTE_IMPORT_RE = /^(?:https?:)?\/\//i;
|
|
1609
|
-
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight) {
|
|
1706
|
+
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight, options = {}) {
|
|
1610
1707
|
if (target !== "weapp") return css;
|
|
1611
1708
|
return finalizeMiniProgramCss(css, {
|
|
1612
|
-
cssPreflight: majorVersion === 4 ? cssPreflight : void 0,
|
|
1709
|
+
cssPreflight: majorVersion === 4 && options.injectPreflight !== false ? cssPreflight : void 0,
|
|
1613
1710
|
preservePseudoContentInit: majorVersion === 3
|
|
1614
1711
|
});
|
|
1615
1712
|
}
|
|
@@ -1657,6 +1754,20 @@ function isCommentOnlyCss(source) {
|
|
|
1657
1754
|
return false;
|
|
1658
1755
|
}
|
|
1659
1756
|
}
|
|
1757
|
+
function stripTailwindSourceMediaFragments(source) {
|
|
1758
|
+
return source.replace(/^\s*@media\s+source\([^)]*\)\s*\{\s*$/gm, "").replace(/^\s*\}\s*(?=@(?:source|theme|config|plugin|utility|variant|custom-variant)\b)/gm, "").replace(/^\s*\}\s*\/\*\s*source\([^)]*\)\s*\*\/\s*$/gm, "");
|
|
1759
|
+
}
|
|
1760
|
+
function stripLeadingTailwindSourceMediaCloseFragment(source) {
|
|
1761
|
+
return source.replace(/^\s*\}\s*(?:\n|$)/, "");
|
|
1762
|
+
}
|
|
1763
|
+
function stripUnmatchedTailwindSourceMediaCloseFragments(source) {
|
|
1764
|
+
try {
|
|
1765
|
+
postcss.parse(source);
|
|
1766
|
+
return source;
|
|
1767
|
+
} catch {
|
|
1768
|
+
return stripLeadingTailwindSourceMediaCloseFragment(source).replace(/\s*\}\s*$/, "");
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1660
1771
|
function createCssSourceOrderAppend(base, extra) {
|
|
1661
1772
|
if (!base) return extra;
|
|
1662
1773
|
if (!extra) return base;
|
|
@@ -1664,19 +1775,21 @@ function createCssSourceOrderAppend(base, extra) {
|
|
|
1664
1775
|
return `${base}\n${extra}`;
|
|
1665
1776
|
}
|
|
1666
1777
|
function splitRawSourceByGeneratedCssOrder(rawSource, rawTailwindCss) {
|
|
1778
|
+
const placeholderParts = splitGeneratorPlaceholderCssBySourceOrder(rawSource, rawTailwindCss);
|
|
1779
|
+
if (placeholderParts) return placeholderParts;
|
|
1667
1780
|
const exactParts = splitTailwindV4GeneratedCssBySourceOrder(rawSource, rawTailwindCss);
|
|
1668
1781
|
if (exactParts) return exactParts;
|
|
1669
1782
|
return splitTailwindGeneratedCssByBanner(rawSource);
|
|
1670
1783
|
}
|
|
1671
1784
|
async function transformGeneratorUserCss(source, options) {
|
|
1672
1785
|
if (source.trim().length === 0) return "";
|
|
1673
|
-
const cleanedSource = removeTailwindSourceDirectives(source, { importFallback: options.importFallback });
|
|
1786
|
+
const cleanedSource = removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(source)), { importFallback: options.importFallback });
|
|
1674
1787
|
if (cleanedSource.trim().length === 0) return "";
|
|
1675
|
-
const
|
|
1676
|
-
if (
|
|
1677
|
-
if (isCommentOnlyCss(
|
|
1678
|
-
if (options.generatorTarget !== "weapp") return
|
|
1679
|
-
const { css } = await options.styleHandler(
|
|
1788
|
+
const userSource = stripUnmatchedTailwindSourceMediaCloseFragments(removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(options.generatorTarget === "weapp" ? removeUnsupportedMiniProgramAtRules(cleanedSource) : cleanedSource)), { importFallback: options.importFallback }));
|
|
1789
|
+
if (userSource.trim().length === 0) return "";
|
|
1790
|
+
if (isCommentOnlyCss(userSource)) return userSource;
|
|
1791
|
+
if (options.generatorTarget !== "weapp") return userSource;
|
|
1792
|
+
const { css } = await options.styleHandler(userSource, {
|
|
1680
1793
|
...options.generatorStyleOptions,
|
|
1681
1794
|
...options.cssUserHandlerOptions
|
|
1682
1795
|
});
|
|
@@ -1738,7 +1851,7 @@ async function generateCssByGenerator(options) {
|
|
|
1738
1851
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, debug } = options;
|
|
1739
1852
|
const generatorOptions = normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
1740
1853
|
const majorVersion = runtimeState.twPatcher.majorVersion;
|
|
1741
|
-
const effectiveRawSource = normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback });
|
|
1854
|
+
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
1742
1855
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
1743
1856
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
1744
1857
|
css: generatorOptions.target === "weapp" ? removeUnsupportedMiniProgramAtRules(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
@@ -1796,7 +1909,7 @@ async function generateCssByGenerator(options) {
|
|
|
1796
1909
|
if (typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
1797
1910
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
1798
1911
|
return {
|
|
1799
|
-
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight)) : options.previousCss,
|
|
1912
|
+
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: false })) : options.previousCss,
|
|
1800
1913
|
target: generated.target,
|
|
1801
1914
|
source: "generator",
|
|
1802
1915
|
dependencies: generated.dependencies,
|
|
@@ -1832,7 +1945,7 @@ async function generateCssByGenerator(options) {
|
|
|
1832
1945
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
1833
1946
|
let css = stripTailwindBanner(generated.css);
|
|
1834
1947
|
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css, effectiveRawSource);
|
|
1835
|
-
if (hasMatchedCssSourceFile) return {
|
|
1948
|
+
if (hasMatchedCssSourceFile || generated.target === "web") return {
|
|
1836
1949
|
css: finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight),
|
|
1837
1950
|
target: generated.target,
|
|
1838
1951
|
source: "generator",
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-BIEhxFdv.js");
|
|
3
3
|
const require_gulp = require("./gulp.js");
|
|
4
|
-
const require_postcss = require("./postcss-
|
|
5
|
-
const require_vite = require("./vite-
|
|
6
|
-
const require_webpack = require("./webpack-
|
|
4
|
+
const require_postcss = require("./postcss-DCOUtuwI.js");
|
|
5
|
+
const require_vite = require("./vite-DnHdmHHD.js");
|
|
6
|
+
const require_webpack = require("./webpack-SxEdWHlL.js");
|
|
7
7
|
exports.UnifiedWebpackPluginV5 = require_webpack.UnifiedWebpackPluginV5;
|
|
8
8
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
9
9
|
exports.createPlugins = require_gulp.createPlugins;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-Ber8UVgv.mjs";
|
|
2
2
|
import { WeappTailwindcss as createPlugins } from "./gulp.mjs";
|
|
3
|
-
import { t as weappTailwindcssPostcssPlugin } from "./postcss-
|
|
4
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
5
|
-
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-
|
|
3
|
+
import { t as weappTailwindcssPostcssPlugin } from "./postcss-DW08tZXt.mjs";
|
|
4
|
+
import { t as WeappTailwindcss } from "./vite-bmU2kkO6.mjs";
|
|
5
|
+
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-BkBoEn4k.mjs";
|
|
6
6
|
export { UnifiedWebpackPluginV5, WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
|
+
const require_generator = require("./generator-BIEhxFdv.js");
|
|
4
4
|
let postcss = require("postcss");
|
|
5
5
|
postcss = require_chunk.__toESM(postcss);
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as createSourceScanPattern, L as readInstalledPackageMajorVersion, M as normalizeLegacyContentEntries, N as parseConfigParam, P as resolveCssSourceEntries, j as expandTailwindSourceEntries, k as collectCssInlineSourceCandidates, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { A as createSourceScanPattern, L as readInstalledPackageMajorVersion, M as normalizeLegacyContentEntries, N as parseConfigParam, P as resolveCssSourceEntries, j as expandTailwindSourceEntries, k as collectCssInlineSourceCandidates, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-Ber8UVgv.mjs";
|
|
3
3
|
import postcss from "postcss";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
package/dist/postcss.js
CHANGED
|
@@ -2,6 +2,6 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_postcss = require("./postcss-
|
|
5
|
+
const require_postcss = require("./postcss-DCOUtuwI.js");
|
|
6
6
|
exports.default = require_postcss.weappTailwindcssPostcssPlugin;
|
|
7
7
|
exports.weappTailwindcssPostcssPlugin = require_postcss.weappTailwindcssPostcssPlugin;
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as weappTailwindcssPostcssPlugin } from "./postcss-
|
|
1
|
+
import { t as weappTailwindcssPostcssPlugin } from "./postcss-DW08tZXt.mjs";
|
|
2
2
|
export { weappTailwindcssPostcssPlugin as default, weappTailwindcssPostcssPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as omitUndefined, C as createTailwindV4Engine, F as createDebug, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-
|
|
1
|
+
import { B as omitUndefined, C as createTailwindV4Engine, F as createDebug, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import { a as resolveDefaultCssPreflight, i as getDefaultOptions, o as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, s as HARD_PARSE_CACHE_MAX_ENTRIES } from "./defaults-B1igPF_e.mjs";
|
|
3
3
|
import { i as isMap, n as defuOverrideArray } from "./utils-CGBVVNm6.mjs";
|
|
4
|
-
import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, r as isUniAppXEnabled, t as createTailwindcssPatcherFromContext } from "./tailwindcss-
|
|
4
|
+
import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, r as isUniAppXEnabled, t as createTailwindcssPatcherFromContext } from "./tailwindcss-D74Wk4ys.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { logger, pc } from "@weapp-tailwindcss/logger";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
3
|
const require_defaults = require("./defaults-IHhYxNeU.js");
|
|
4
4
|
require("./utils-4ODFyoqD.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
6
6
|
let node_path = require("node:path");
|
|
7
7
|
node_path = require_chunk.__toESM(node_path);
|
|
8
8
|
let node_process = require("node:process");
|
package/dist/presets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
4
4
|
const require_utils = require("./utils-4ODFyoqD.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
6
6
|
require("./logger-EVNB9z7i.js");
|
|
7
7
|
let node_process = require("node:process");
|
|
8
8
|
node_process = require_chunk.__toESM(node_process);
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as omitUndefined } from "./v3-engine-
|
|
1
|
+
import { B as omitUndefined } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-CGBVVNm6.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-D74Wk4ys.mjs";
|
|
4
4
|
import { t as logger } from "./logger-CZUxvJJD.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { getPackageInfoSync } from "local-pkg";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as expandTailwindSourceEntries } from "./v3-engine-
|
|
1
|
+
import { j as expandTailwindSourceEntries } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { extractSourceCandidates } from "tailwindcss-patch";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
3
|
require("./utils-4ODFyoqD.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_module = require("node:module");
|
|
@@ -295,6 +295,8 @@ function isTailwindVersionMismatchError(error) {
|
|
|
295
295
|
function createPatcherForBase(baseDir, cssEntries, options) {
|
|
296
296
|
const { tailwindcss, tailwindcssPatcherOptions, supportCustomLengthUnitsPatch, bareArbitraryValues } = options;
|
|
297
297
|
const hasCssEntries = Boolean(cssEntries?.length);
|
|
298
|
+
const configuredV4Options = tailwindcss?.v4 ?? tailwindcssPatcherOptions?.tailwindcss?.v4;
|
|
299
|
+
const hasCssSources = Boolean(configuredV4Options?.cssSources?.length);
|
|
298
300
|
const defaultTailwindcssConfig = {
|
|
299
301
|
cwd: baseDir,
|
|
300
302
|
v2: { cwd: baseDir },
|
|
@@ -320,12 +322,12 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
320
322
|
const patchedOptions = overrideTailwindcssPatcherOptionsForBase(tailwindcssPatcherOptions, baseDir, cssEntries ?? []);
|
|
321
323
|
const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName;
|
|
322
324
|
const explicitTailwindVersion = resolveExplicitTailwindVersion(tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || mergedTailwindOptions.version, configuredPackageName);
|
|
323
|
-
const hasExplicitV4Signals = hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
|
|
325
|
+
const hasExplicitV4Signals = hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
|
|
324
326
|
const packageNameForVersionDetection = configuredPackageName ?? mergedTailwindOptions.packageName ?? "tailwindcss";
|
|
325
327
|
const installedTailwindVersion = require_v3_engine.readInstalledPackageMajorVersion(packageNameForVersionDetection, baseDir);
|
|
326
328
|
const resolvedTailwindVersion = installedTailwindVersion ?? explicitTailwindVersion;
|
|
327
329
|
const supportedResolvedTailwindVersion = resolvedTailwindVersion === 2 || resolvedTailwindVersion === 3 || resolvedTailwindVersion === 4 ? resolvedTailwindVersion : void 0;
|
|
328
|
-
const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
|
|
330
|
+
const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
|
|
329
331
|
const packageCandidates = /* @__PURE__ */ new Set();
|
|
330
332
|
if (shouldPatchV4PostcssPackage) packageCandidates.add("@tailwindcss/postcss");
|
|
331
333
|
packageCandidates.add(mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as omitUndefined, H as findWorkspacePackageDir, I as createTailwindcssPatcher, L as readInstalledPackageMajorVersion, U as findWorkspaceRoot, V as findNearestPackageRoot, f as runtimeSignaturePatchersSymbol } from "./v3-engine-
|
|
1
|
+
import { B as omitUndefined, H as findWorkspacePackageDir, I as createTailwindcssPatcher, L as readInstalledPackageMajorVersion, U as findWorkspaceRoot, V as findNearestPackageRoot, f as runtimeSignaturePatchersSymbol } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import { n as defuOverrideArray } from "./utils-CGBVVNm6.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -291,6 +291,8 @@ function isTailwindVersionMismatchError(error) {
|
|
|
291
291
|
function createPatcherForBase(baseDir, cssEntries, options) {
|
|
292
292
|
const { tailwindcss, tailwindcssPatcherOptions, supportCustomLengthUnitsPatch, bareArbitraryValues } = options;
|
|
293
293
|
const hasCssEntries = Boolean(cssEntries?.length);
|
|
294
|
+
const configuredV4Options = tailwindcss?.v4 ?? tailwindcssPatcherOptions?.tailwindcss?.v4;
|
|
295
|
+
const hasCssSources = Boolean(configuredV4Options?.cssSources?.length);
|
|
294
296
|
const defaultTailwindcssConfig = {
|
|
295
297
|
cwd: baseDir,
|
|
296
298
|
v2: { cwd: baseDir },
|
|
@@ -316,12 +318,12 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
316
318
|
const patchedOptions = overrideTailwindcssPatcherOptionsForBase(tailwindcssPatcherOptions, baseDir, cssEntries ?? []);
|
|
317
319
|
const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName;
|
|
318
320
|
const explicitTailwindVersion = resolveExplicitTailwindVersion(tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || mergedTailwindOptions.version, configuredPackageName);
|
|
319
|
-
const hasExplicitV4Signals = hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
|
|
321
|
+
const hasExplicitV4Signals = hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
|
|
320
322
|
const packageNameForVersionDetection = configuredPackageName ?? mergedTailwindOptions.packageName ?? "tailwindcss";
|
|
321
323
|
const installedTailwindVersion = readInstalledPackageMajorVersion(packageNameForVersionDetection, baseDir);
|
|
322
324
|
const resolvedTailwindVersion = installedTailwindVersion ?? explicitTailwindVersion;
|
|
323
325
|
const supportedResolvedTailwindVersion = resolvedTailwindVersion === 2 || resolvedTailwindVersion === 3 || resolvedTailwindVersion === 4 ? resolvedTailwindVersion : void 0;
|
|
324
|
-
const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
|
|
326
|
+
const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
|
|
325
327
|
const packageCandidates = /* @__PURE__ */ new Set();
|
|
326
328
|
if (shouldPatchV4PostcssPackage) packageCandidates.add("@tailwindcss/postcss");
|
|
327
329
|
packageCandidates.add(mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss");
|