tailwindcss-patch 8.7.4-alpha.0 → 9.0.0-alpha.1
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.md +45 -5
- package/dist/{chunk-6ZDYMYHE.mjs → chunk-SWLOK2S6.mjs} +231 -239
- package/dist/{chunk-ZXW4S356.js → chunk-Z6OMJZTU.js} +267 -275
- package/dist/cli.js +4 -4
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +12 -108
- package/dist/index.d.ts +12 -108
- package/dist/index.js +5 -3
- package/dist/index.mjs +4 -2
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
|
20
20
|
// package.json
|
|
21
21
|
var package_default = {
|
|
22
22
|
name: "tailwindcss-patch",
|
|
23
|
-
version: "
|
|
23
|
+
version: "9.0.0-alpha.1",
|
|
24
24
|
description: "patch tailwindcss for exposing context and extract classes",
|
|
25
25
|
author: "ice breaker <1324318532@qq.com>",
|
|
26
26
|
license: "MIT",
|
|
@@ -41,17 +41,17 @@ var package_default = {
|
|
|
41
41
|
],
|
|
42
42
|
exports: {
|
|
43
43
|
".": {
|
|
44
|
-
types: "./
|
|
45
|
-
import: "./
|
|
46
|
-
require: "./
|
|
44
|
+
types: "./src/index.ts",
|
|
45
|
+
import: "./src/index.ts",
|
|
46
|
+
require: "./src/index.ts"
|
|
47
47
|
},
|
|
48
48
|
"./migration-report.schema.json": "./schema/migration-report.schema.json",
|
|
49
49
|
"./restore-result.schema.json": "./schema/restore-result.schema.json",
|
|
50
50
|
"./validate-result.schema.json": "./schema/validate-result.schema.json"
|
|
51
51
|
},
|
|
52
|
-
main: "./
|
|
53
|
-
module: "./
|
|
54
|
-
types: "./
|
|
52
|
+
main: "./src/index.ts",
|
|
53
|
+
module: "./src/index.ts",
|
|
54
|
+
types: "./src/index.ts",
|
|
55
55
|
bin: {
|
|
56
56
|
"tw-patch": "dev/bin.ts",
|
|
57
57
|
"tailwindcss-patch": "dev/bin.ts"
|
|
@@ -1516,14 +1516,6 @@ ${Date.now()}`, { flag: "wx" });
|
|
|
1516
1516
|
|
|
1517
1517
|
|
|
1518
1518
|
|
|
1519
|
-
var hasWarnedDeprecatedOptions = false;
|
|
1520
|
-
var deprecatedOptionMapping = {
|
|
1521
|
-
cwd: "projectRoot",
|
|
1522
|
-
overwrite: "apply.overwrite",
|
|
1523
|
-
tailwind: "tailwindcss",
|
|
1524
|
-
features: "apply",
|
|
1525
|
-
output: "extract"
|
|
1526
|
-
};
|
|
1527
1519
|
function resolveRealpathSafe(value) {
|
|
1528
1520
|
const resolved = _pathe2.default.resolve(value);
|
|
1529
1521
|
try {
|
|
@@ -1668,66 +1660,32 @@ function normalizeTailwindOptions(tailwind, projectRoot) {
|
|
|
1668
1660
|
v4
|
|
1669
1661
|
};
|
|
1670
1662
|
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
const
|
|
1680
|
-
const pretty = _nullishCoalesce(_optionalChain([options, 'access', _64 => _64.extract, 'optionalAccess', _65 => _65.pretty]), () => ( _optionalChain([options, 'access', _66 => _66.output, 'optionalAccess', _67 => _67.pretty])));
|
|
1681
|
-
const removeUniversalSelector = _nullishCoalesce(_optionalChain([options, 'access', _68 => _68.extract, 'optionalAccess', _69 => _69.removeUniversalSelector]), () => ( _optionalChain([options, 'access', _70 => _70.output, 'optionalAccess', _71 => _71.removeUniversalSelector])));
|
|
1682
|
-
const extract = {
|
|
1683
|
-
...write === void 0 ? {} : { write },
|
|
1684
|
-
...file === void 0 ? {} : { file },
|
|
1685
|
-
...format === void 0 ? {} : { format },
|
|
1686
|
-
...pretty === void 0 ? {} : { pretty },
|
|
1687
|
-
...removeUniversalSelector === void 0 ? {} : { removeUniversalSelector }
|
|
1688
|
-
};
|
|
1689
|
-
return {
|
|
1690
|
-
...projectRoot === void 0 ? {} : { projectRoot },
|
|
1691
|
-
...overwrite === void 0 ? {} : { overwrite },
|
|
1692
|
-
...tailwind === void 0 ? {} : { tailwind },
|
|
1693
|
-
...Object.keys(extract).length === 0 ? {} : { extract },
|
|
1694
|
-
...exposeContext === void 0 ? {} : { exposeContext },
|
|
1695
|
-
...extendLengthUnits === void 0 ? {} : { extendLengthUnits }
|
|
1696
|
-
};
|
|
1697
|
-
}
|
|
1698
|
-
function findUsedDeprecatedOptions(options) {
|
|
1699
|
-
const result = [];
|
|
1700
|
-
for (const key of Object.keys(deprecatedOptionMapping)) {
|
|
1701
|
-
if (options[key] !== void 0) {
|
|
1702
|
-
result.push(key);
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
return result;
|
|
1706
|
-
}
|
|
1707
|
-
function warnDeprecatedOptionsIfNeeded(options) {
|
|
1708
|
-
if (hasWarnedDeprecatedOptions) {
|
|
1709
|
-
return;
|
|
1710
|
-
}
|
|
1711
|
-
const used = findUsedDeprecatedOptions(options);
|
|
1663
|
+
var deprecatedOptionMapping = {
|
|
1664
|
+
cwd: "projectRoot",
|
|
1665
|
+
overwrite: "apply.overwrite",
|
|
1666
|
+
tailwind: "tailwindcss",
|
|
1667
|
+
features: "apply",
|
|
1668
|
+
output: "extract"
|
|
1669
|
+
};
|
|
1670
|
+
function assertNoDeprecatedOptions(options) {
|
|
1671
|
+
const used = Object.keys(deprecatedOptionMapping).filter((key) => Object.prototype.hasOwnProperty.call(options, key));
|
|
1712
1672
|
if (used.length === 0) {
|
|
1713
1673
|
return;
|
|
1714
1674
|
}
|
|
1715
|
-
hasWarnedDeprecatedOptions = true;
|
|
1716
1675
|
const mapping = used.map((key) => `${key} -> ${deprecatedOptionMapping[key]}`).join(", ");
|
|
1717
|
-
|
|
1718
|
-
`
|
|
1676
|
+
throw new Error(
|
|
1677
|
+
`Legacy TailwindcssPatcher options are no longer supported: ${used.join(", ")}. Use the modern fields instead: ${mapping}.`
|
|
1719
1678
|
);
|
|
1720
1679
|
}
|
|
1721
1680
|
function normalizeOptions(options = {}) {
|
|
1722
|
-
|
|
1723
|
-
const
|
|
1724
|
-
const
|
|
1725
|
-
const
|
|
1726
|
-
const output = normalizeOutputOptions(resolved.extract);
|
|
1681
|
+
assertNoDeprecatedOptions(options);
|
|
1682
|
+
const projectRoot = resolveRealpathSafe(options.projectRoot ? _pathe2.default.resolve(options.projectRoot) : _process2.default.cwd());
|
|
1683
|
+
const overwrite = _nullishCoalesce(_optionalChain([options, 'access', _42 => _42.apply, 'optionalAccess', _43 => _43.overwrite]), () => ( true));
|
|
1684
|
+
const output = normalizeOutputOptions(options.extract);
|
|
1727
1685
|
const cache = normalizeCacheOptions(options.cache, projectRoot);
|
|
1728
|
-
const tailwind = normalizeTailwindOptions(
|
|
1729
|
-
const exposeContext = normalizeExposeContextOptions(
|
|
1730
|
-
const extendLengthUnits = normalizeExtendLengthUnitsOptions(
|
|
1686
|
+
const tailwind = normalizeTailwindOptions(options.tailwindcss, projectRoot);
|
|
1687
|
+
const exposeContext = normalizeExposeContextOptions(_optionalChain([options, 'access', _44 => _44.apply, 'optionalAccess', _45 => _45.exposeContext]));
|
|
1688
|
+
const extendLengthUnits = normalizeExtendLengthUnitsOptions(_optionalChain([options, 'access', _46 => _46.apply, 'optionalAccess', _47 => _47.extendLengthUnits]));
|
|
1731
1689
|
const filter = (className) => {
|
|
1732
1690
|
if (output.removeUniversalSelector && className === "*") {
|
|
1733
1691
|
return false;
|
|
@@ -1752,122 +1710,70 @@ function normalizeOptions(options = {}) {
|
|
|
1752
1710
|
}
|
|
1753
1711
|
|
|
1754
1712
|
// src/options/legacy.ts
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1713
|
+
var deprecatedRegistryMapping = {
|
|
1714
|
+
output: "extract",
|
|
1715
|
+
tailwind: "tailwindcss"
|
|
1716
|
+
};
|
|
1717
|
+
var deprecatedTailwindMapping = {
|
|
1718
|
+
package: "packageName",
|
|
1719
|
+
legacy: "v2",
|
|
1720
|
+
classic: "v3",
|
|
1721
|
+
next: "v4"
|
|
1722
|
+
};
|
|
1723
|
+
function assertNoDeprecatedRegistryOptions(registry) {
|
|
1724
|
+
const usedRegistryKeys = Object.keys(deprecatedRegistryMapping).filter((key) => Object.prototype.hasOwnProperty.call(registry, key));
|
|
1725
|
+
if (usedRegistryKeys.length > 0) {
|
|
1726
|
+
const mapping = usedRegistryKeys.map((key) => `${key} -> ${deprecatedRegistryMapping[key]}`).join(", ");
|
|
1727
|
+
throw new Error(
|
|
1728
|
+
`Legacy registry fields are no longer supported: ${usedRegistryKeys.join(", ")}. Use the modern fields instead: ${mapping}.`
|
|
1729
|
+
);
|
|
1770
1730
|
}
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1731
|
+
const tailwind = registry.tailwindcss;
|
|
1732
|
+
if (!tailwind) {
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
const usedTailwindKeys = Object.keys(deprecatedTailwindMapping).filter((key) => Object.prototype.hasOwnProperty.call(tailwind, key));
|
|
1736
|
+
if (usedTailwindKeys.length > 0) {
|
|
1737
|
+
const mapping = usedTailwindKeys.map((key) => `${key} -> tailwindcss.${deprecatedTailwindMapping[key]}`).join(", ");
|
|
1738
|
+
throw new Error(
|
|
1739
|
+
`Legacy "registry.tailwindcss" fields are no longer supported: ${usedTailwindKeys.join(", ")}. Use the modern fields instead: ${mapping}.`
|
|
1740
|
+
);
|
|
1779
1741
|
}
|
|
1780
|
-
const patch = options.patch;
|
|
1781
|
-
const features = normalizeLegacyFeatures(patch);
|
|
1782
|
-
const output = _optionalChain([patch, 'optionalAccess', _76 => _76.output]);
|
|
1783
|
-
const tailwindConfig = _optionalChain([patch, 'optionalAccess', _77 => _77.tailwindcss]);
|
|
1784
|
-
const tailwindVersion = _optionalChain([tailwindConfig, 'optionalAccess', _78 => _78.version]);
|
|
1785
|
-
const tailwindV2 = _optionalChain([tailwindConfig, 'optionalAccess', _79 => _79.v2]);
|
|
1786
|
-
const tailwindV3 = _optionalChain([tailwindConfig, 'optionalAccess', _80 => _80.v3]);
|
|
1787
|
-
const tailwindV4 = _optionalChain([tailwindConfig, 'optionalAccess', _81 => _81.v4]);
|
|
1788
|
-
const tailwindConfigPath = _nullishCoalesce(_optionalChain([tailwindV3, 'optionalAccess', _82 => _82.config]), () => ( _optionalChain([tailwindV2, 'optionalAccess', _83 => _83.config])));
|
|
1789
|
-
const tailwindCwd = _nullishCoalesce(_nullishCoalesce(_optionalChain([tailwindV3, 'optionalAccess', _84 => _84.cwd]), () => ( _optionalChain([tailwindV2, 'optionalAccess', _85 => _85.cwd]))), () => ( _optionalChain([patch, 'optionalAccess', _86 => _86.cwd])));
|
|
1790
|
-
const normalizedExtract = output ? {
|
|
1791
|
-
...output.filename === void 0 ? {} : { file: output.filename },
|
|
1792
|
-
pretty: output.loose ? 2 : false,
|
|
1793
|
-
...output.removeUniversalSelector === void 0 ? {} : { removeUniversalSelector: output.removeUniversalSelector }
|
|
1794
|
-
} : void 0;
|
|
1795
|
-
const normalizedTailwindcss = {
|
|
1796
|
-
..._optionalChain([patch, 'optionalAccess', _87 => _87.packageName]) === void 0 ? {} : { packageName: patch.packageName },
|
|
1797
|
-
...tailwindVersion === void 0 ? {} : { version: tailwindVersion },
|
|
1798
|
-
..._optionalChain([patch, 'optionalAccess', _88 => _88.resolve]) === void 0 ? {} : { resolve: patch.resolve },
|
|
1799
|
-
...tailwindConfigPath === void 0 ? {} : { config: tailwindConfigPath },
|
|
1800
|
-
...tailwindCwd === void 0 ? {} : { cwd: tailwindCwd },
|
|
1801
|
-
...tailwindV2 === void 0 ? {} : { v2: tailwindV2 },
|
|
1802
|
-
...tailwindV3 === void 0 ? {} : { v3: tailwindV3 },
|
|
1803
|
-
...tailwindV4 === void 0 ? {} : { v4: tailwindV4 }
|
|
1804
|
-
};
|
|
1805
|
-
const normalizedCache = typeof options.cache === "boolean" ? options.cache : options.cache ? {
|
|
1806
|
-
...options.cache,
|
|
1807
|
-
enabled: _nullishCoalesce(options.cache.enabled, () => ( true))
|
|
1808
|
-
} : void 0;
|
|
1809
|
-
const normalizedApply = {
|
|
1810
|
-
..._optionalChain([patch, 'optionalAccess', _89 => _89.overwrite]) === void 0 ? {} : { overwrite: patch.overwrite },
|
|
1811
|
-
exposeContext: features.exposeContext,
|
|
1812
|
-
extendLengthUnits: features.extendLengthUnits
|
|
1813
|
-
};
|
|
1814
|
-
return {
|
|
1815
|
-
..._optionalChain([patch, 'optionalAccess', _90 => _90.cwd]) === void 0 ? {} : { projectRoot: patch.cwd },
|
|
1816
|
-
..._optionalChain([patch, 'optionalAccess', _91 => _91.filter]) === void 0 ? {} : { filter: patch.filter },
|
|
1817
|
-
...normalizedCache === void 0 ? {} : { cache: normalizedCache },
|
|
1818
|
-
...normalizedExtract === void 0 ? {} : { extract: normalizedExtract },
|
|
1819
|
-
...Object.keys(normalizedTailwindcss).length === 0 ? {} : { tailwindcss: normalizedTailwindcss },
|
|
1820
|
-
apply: normalizedApply
|
|
1821
|
-
};
|
|
1822
1742
|
}
|
|
1823
1743
|
function fromUnifiedConfig(registry) {
|
|
1824
1744
|
if (!registry) {
|
|
1825
1745
|
return {};
|
|
1826
1746
|
}
|
|
1827
|
-
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
}
|
|
1835
|
-
if (typeof value === "boolean") {
|
|
1836
|
-
return value ? 2 : false;
|
|
1837
|
-
}
|
|
1838
|
-
return value;
|
|
1839
|
-
})();
|
|
1840
|
-
const removeUniversalSelector = _nullishCoalesce(_optionalChain([modernExtract, 'optionalAccess', _94 => _94.removeUniversalSelector]), () => ( _optionalChain([legacyOutput, 'optionalAccess', _95 => _95.stripUniversalSelector])));
|
|
1841
|
-
const outputFile = _nullishCoalesce(_optionalChain([modernExtract, 'optionalAccess', _96 => _96.file]), () => ( _optionalChain([legacyOutput, 'optionalAccess', _97 => _97.file])));
|
|
1842
|
-
const normalizedExtract = modernExtract || legacyOutput ? {
|
|
1843
|
-
..._optionalChain([modernExtract, 'optionalAccess', _98 => _98.write]) === void 0 ? {} : { write: modernExtract.write },
|
|
1844
|
-
...outputFile === void 0 ? {} : { file: outputFile },
|
|
1845
|
-
...pretty === void 0 ? {} : { pretty },
|
|
1846
|
-
...removeUniversalSelector === void 0 ? {} : { removeUniversalSelector },
|
|
1847
|
-
..._optionalChain([modernExtract, 'optionalAccess', _99 => _99.format]) === void 0 ? {} : { format: modernExtract.format }
|
|
1747
|
+
assertNoDeprecatedRegistryOptions(registry);
|
|
1748
|
+
const extract = registry.extract ? {
|
|
1749
|
+
...registry.extract.write === void 0 ? {} : { write: registry.extract.write },
|
|
1750
|
+
...registry.extract.file === void 0 ? {} : { file: registry.extract.file },
|
|
1751
|
+
...registry.extract.format === void 0 ? {} : { format: registry.extract.format },
|
|
1752
|
+
...registry.extract.pretty === void 0 ? {} : { pretty: registry.extract.pretty },
|
|
1753
|
+
...registry.extract.removeUniversalSelector === void 0 ? {} : { removeUniversalSelector: registry.extract.removeUniversalSelector }
|
|
1848
1754
|
} : void 0;
|
|
1849
|
-
const
|
|
1850
|
-
...
|
|
1851
|
-
...
|
|
1852
|
-
...
|
|
1853
|
-
...
|
|
1854
|
-
...
|
|
1855
|
-
...
|
|
1856
|
-
...
|
|
1857
|
-
...
|
|
1755
|
+
const tailwindcss = registry.tailwindcss ? {
|
|
1756
|
+
...registry.tailwindcss.version === void 0 ? {} : { version: registry.tailwindcss.version },
|
|
1757
|
+
...registry.tailwindcss.packageName === void 0 ? {} : { packageName: registry.tailwindcss.packageName },
|
|
1758
|
+
...registry.tailwindcss.resolve === void 0 ? {} : { resolve: registry.tailwindcss.resolve },
|
|
1759
|
+
...registry.tailwindcss.config === void 0 ? {} : { config: registry.tailwindcss.config },
|
|
1760
|
+
...registry.tailwindcss.cwd === void 0 ? {} : { cwd: registry.tailwindcss.cwd },
|
|
1761
|
+
...registry.tailwindcss.v2 === void 0 ? {} : { v2: registry.tailwindcss.v2 },
|
|
1762
|
+
...registry.tailwindcss.v3 === void 0 ? {} : { v3: registry.tailwindcss.v3 },
|
|
1763
|
+
...registry.tailwindcss.v4 === void 0 ? {} : { v4: registry.tailwindcss.v4 }
|
|
1858
1764
|
} : void 0;
|
|
1859
|
-
const
|
|
1765
|
+
const apply = registry.apply ? {
|
|
1860
1766
|
...registry.apply.overwrite === void 0 ? {} : { overwrite: registry.apply.overwrite },
|
|
1861
1767
|
...registry.apply.exposeContext === void 0 ? {} : { exposeContext: registry.apply.exposeContext },
|
|
1862
1768
|
...registry.apply.extendLengthUnits === void 0 ? {} : { extendLengthUnits: registry.apply.extendLengthUnits }
|
|
1863
1769
|
} : void 0;
|
|
1864
1770
|
return {
|
|
1865
1771
|
...registry.projectRoot === void 0 ? {} : { projectRoot: registry.projectRoot },
|
|
1866
|
-
...
|
|
1772
|
+
...apply === void 0 ? {} : { apply },
|
|
1867
1773
|
...registry.cache === void 0 ? {} : { cache: registry.cache },
|
|
1868
1774
|
...registry.filter === void 0 ? {} : { filter: registry.filter },
|
|
1869
|
-
...
|
|
1870
|
-
...
|
|
1775
|
+
...extract === void 0 ? {} : { extract },
|
|
1776
|
+
...tailwindcss === void 0 ? {} : { tailwindcss }
|
|
1871
1777
|
};
|
|
1872
1778
|
}
|
|
1873
1779
|
|
|
@@ -1879,19 +1785,22 @@ var defuPromise;
|
|
|
1879
1785
|
function isNodeError(error) {
|
|
1880
1786
|
return !!error && typeof error === "object" && ("code" in error || "message" in error);
|
|
1881
1787
|
}
|
|
1882
|
-
function
|
|
1883
|
-
if (!isNodeError(error)
|
|
1788
|
+
function isMissingModuleError(error, pkgName2) {
|
|
1789
|
+
if (!isNodeError(error)) {
|
|
1884
1790
|
return false;
|
|
1885
1791
|
}
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1888
|
-
}
|
|
1889
|
-
function isMissingSharedModuleError(error) {
|
|
1890
|
-
if (!isNodeError(error) || error.code !== "MODULE_NOT_FOUND") {
|
|
1792
|
+
const code = error.code;
|
|
1793
|
+
if (code !== "MODULE_NOT_FOUND" && code !== "ERR_MODULE_NOT_FOUND") {
|
|
1891
1794
|
return false;
|
|
1892
1795
|
}
|
|
1893
1796
|
const message = _nullishCoalesce(error.message, () => ( ""));
|
|
1894
|
-
return message.includes(
|
|
1797
|
+
return message.includes(pkgName2) || message.includes(`${pkgName2}/dist/`);
|
|
1798
|
+
}
|
|
1799
|
+
function isMissingConfigModuleError(error) {
|
|
1800
|
+
return isMissingModuleError(error, "@tailwindcss-mangle/config");
|
|
1801
|
+
}
|
|
1802
|
+
function isMissingSharedModuleError(error) {
|
|
1803
|
+
return isMissingModuleError(error, "@tailwindcss-mangle/shared");
|
|
1895
1804
|
}
|
|
1896
1805
|
async function loadWorkspaceConfigModule() {
|
|
1897
1806
|
if (!configModulePromise) {
|
|
@@ -1922,8 +1831,10 @@ async function loadPatchOptionsForWorkspace(cwd, overrides) {
|
|
|
1922
1831
|
const merge = await loadWorkspaceDefu();
|
|
1923
1832
|
const configModule = await loadWorkspaceConfigModule();
|
|
1924
1833
|
const { config } = await configModule.getConfig(cwd);
|
|
1925
|
-
|
|
1926
|
-
|
|
1834
|
+
if (config && typeof config === "object" && "patch" in config && config.patch !== void 0) {
|
|
1835
|
+
throw new Error('Legacy workspace config field "patch" is no longer supported. Move patcher options under "registry".');
|
|
1836
|
+
}
|
|
1837
|
+
const base = _optionalChain([config, 'optionalAccess', _48 => _48.registry]) ? fromUnifiedConfig(config.registry) : {};
|
|
1927
1838
|
const merged = merge(_nullishCoalesce(overrides, () => ( {})), base);
|
|
1928
1839
|
return merged;
|
|
1929
1840
|
}
|
|
@@ -2064,7 +1975,7 @@ async function extractValidCandidates(options) {
|
|
|
2064
1975
|
return validCandidates;
|
|
2065
1976
|
}
|
|
2066
1977
|
function normalizeSources(sources, cwd) {
|
|
2067
|
-
const baseSources = _optionalChain([sources, 'optionalAccess',
|
|
1978
|
+
const baseSources = _optionalChain([sources, 'optionalAccess', _49 => _49.length]) ? sources : [
|
|
2068
1979
|
{
|
|
2069
1980
|
base: cwd,
|
|
2070
1981
|
pattern: "**/*",
|
|
@@ -2129,8 +2040,8 @@ function toRelativeFile(cwd, filename) {
|
|
|
2129
2040
|
return relative === "" ? _pathe2.default.basename(filename) : relative;
|
|
2130
2041
|
}
|
|
2131
2042
|
async function extractProjectCandidatesWithPositions(options) {
|
|
2132
|
-
const cwd = _optionalChain([options, 'optionalAccess',
|
|
2133
|
-
const normalizedSources = normalizeSources(_optionalChain([options, 'optionalAccess',
|
|
2043
|
+
const cwd = _optionalChain([options, 'optionalAccess', _50 => _50.cwd]) ? _pathe2.default.resolve(options.cwd) : _process2.default.cwd();
|
|
2044
|
+
const normalizedSources = normalizeSources(_optionalChain([options, 'optionalAccess', _51 => _51.sources]), cwd);
|
|
2134
2045
|
const { Scanner } = await getOxideModule();
|
|
2135
2046
|
const scanner = new Scanner({
|
|
2136
2047
|
sources: normalizedSources
|
|
@@ -2184,8 +2095,8 @@ async function extractProjectCandidatesWithPositions(options) {
|
|
|
2184
2095
|
};
|
|
2185
2096
|
}
|
|
2186
2097
|
function groupTokensByFile(report, options) {
|
|
2187
|
-
const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2188
|
-
const stripAbsolute = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2098
|
+
const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _52 => _52.key]), () => ( "relative"));
|
|
2099
|
+
const stripAbsolute = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _53 => _53.stripAbsolutePaths]), () => ( key !== "absolute"));
|
|
2189
2100
|
return report.entries.reduce((acc, entry) => {
|
|
2190
2101
|
const bucketKey = key === "absolute" ? entry.file : entry.relativeFile;
|
|
2191
2102
|
if (!acc[bucketKey]) {
|
|
@@ -2261,7 +2172,7 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
2261
2172
|
const resolvedConfiguredBase = toAbsolute(v4Options.configuredBase);
|
|
2262
2173
|
const resolvedDefaultBase = _nullishCoalesce(toAbsolute(v4Options.base), () => ( _process2.default.cwd()));
|
|
2263
2174
|
const resolveSources = (base) => {
|
|
2264
|
-
if (!_optionalChain([v4Options, 'access',
|
|
2175
|
+
if (!_optionalChain([v4Options, 'access', _54 => _54.sources, 'optionalAccess', _55 => _55.length])) {
|
|
2265
2176
|
return void 0;
|
|
2266
2177
|
}
|
|
2267
2178
|
return v4Options.sources.map((source) => ({
|
|
@@ -2396,18 +2307,18 @@ function clearTailwindV3RuntimeState(pluginName) {
|
|
|
2396
2307
|
if (!_fsextra2.default.pathExistsSync(sharedStatePath)) {
|
|
2397
2308
|
return;
|
|
2398
2309
|
}
|
|
2399
|
-
const sharedState = _optionalChain([require3, 'access',
|
|
2400
|
-
_optionalChain([sharedState, 'optionalAccess',
|
|
2401
|
-
_optionalChain([sharedState, 'optionalAccess',
|
|
2402
|
-
_optionalChain([sharedState, 'optionalAccess',
|
|
2403
|
-
_optionalChain([sharedState, 'optionalAccess',
|
|
2310
|
+
const sharedState = _optionalChain([require3, 'access', _56 => _56.cache, 'access', _57 => _57[sharedStatePath], 'optionalAccess', _58 => _58.exports]);
|
|
2311
|
+
_optionalChain([sharedState, 'optionalAccess', _59 => _59.contextMap, 'optionalAccess', _60 => _60.clear, 'call', _61 => _61()]);
|
|
2312
|
+
_optionalChain([sharedState, 'optionalAccess', _62 => _62.configContextMap, 'optionalAccess', _63 => _63.clear, 'call', _64 => _64()]);
|
|
2313
|
+
_optionalChain([sharedState, 'optionalAccess', _65 => _65.contextSourcesMap, 'optionalAccess', _66 => _66.clear, 'call', _67 => _67()]);
|
|
2314
|
+
_optionalChain([sharedState, 'optionalAccess', _68 => _68.sourceHashMap, 'optionalAccess', _69 => _69.clear, 'call', _70 => _70()]);
|
|
2404
2315
|
for (const candidate of ["lib/plugin.js", "lib/index.js"]) {
|
|
2405
2316
|
const runtimeEntry = _pathe2.default.join(root, candidate);
|
|
2406
2317
|
if (!_fsextra2.default.pathExistsSync(runtimeEntry)) {
|
|
2407
2318
|
continue;
|
|
2408
2319
|
}
|
|
2409
|
-
const runtimeModule = _optionalChain([require3, 'access',
|
|
2410
|
-
_optionalChain([runtimeModule, 'optionalAccess',
|
|
2320
|
+
const runtimeModule = _optionalChain([require3, 'access', _71 => _71.cache, 'access', _72 => _72[runtimeEntry], 'optionalAccess', _73 => _73.exports]);
|
|
2321
|
+
_optionalChain([runtimeModule, 'optionalAccess', _74 => _74.contextRef, 'optionalAccess', _75 => _75.value, 'optionalAccess', _76 => _76.splice, 'call', _77 => _77(0, runtimeModule.contextRef.value.length)]);
|
|
2411
2322
|
break;
|
|
2412
2323
|
}
|
|
2413
2324
|
} catch (e10) {
|
|
@@ -2489,7 +2400,7 @@ function transformProcessTailwindFeaturesReturnContextV2(content) {
|
|
|
2489
2400
|
traverse(ast, {
|
|
2490
2401
|
FunctionDeclaration(path18) {
|
|
2491
2402
|
const node = path18.node;
|
|
2492
|
-
if (_optionalChain([node, 'access',
|
|
2403
|
+
if (_optionalChain([node, 'access', _78 => _78.id, 'optionalAccess', _79 => _79.name]) !== "processTailwindFeatures" || node.body.body.length !== 1 || !t.isReturnStatement(node.body.body[0])) {
|
|
2493
2404
|
return;
|
|
2494
2405
|
}
|
|
2495
2406
|
const returnStatement3 = node.body.body[0];
|
|
@@ -2522,7 +2433,7 @@ function transformPostcssPluginV2(content, options) {
|
|
|
2522
2433
|
Program(path18) {
|
|
2523
2434
|
const program = path18.node;
|
|
2524
2435
|
const index = program.body.findIndex((statement) => {
|
|
2525
|
-
return t.isFunctionDeclaration(statement) && _optionalChain([statement, 'access',
|
|
2436
|
+
return t.isFunctionDeclaration(statement) && _optionalChain([statement, 'access', _80 => _80.id, 'optionalAccess', _81 => _81.name]) === "_default";
|
|
2526
2437
|
});
|
|
2527
2438
|
if (index === -1) {
|
|
2528
2439
|
return;
|
|
@@ -2559,7 +2470,7 @@ function transformPostcssPluginV2(content, options) {
|
|
|
2559
2470
|
return;
|
|
2560
2471
|
}
|
|
2561
2472
|
const fn = path18.node;
|
|
2562
|
-
if (_optionalChain([fn, 'access',
|
|
2473
|
+
if (_optionalChain([fn, 'access', _82 => _82.id, 'optionalAccess', _83 => _83.name]) !== "_default") {
|
|
2563
2474
|
return;
|
|
2564
2475
|
}
|
|
2565
2476
|
if (fn.body.body.length !== 1 || !t.isReturnStatement(fn.body.body[0])) {
|
|
@@ -2649,7 +2560,7 @@ function transformProcessTailwindFeaturesReturnContext(content) {
|
|
|
2649
2560
|
traverse(ast, {
|
|
2650
2561
|
FunctionDeclaration(path18) {
|
|
2651
2562
|
const node = path18.node;
|
|
2652
|
-
if (_optionalChain([node, 'access',
|
|
2563
|
+
if (_optionalChain([node, 'access', _84 => _84.id, 'optionalAccess', _85 => _85.name]) !== "processTailwindFeatures" || node.body.body.length !== 1) {
|
|
2653
2564
|
return;
|
|
2654
2565
|
}
|
|
2655
2566
|
const [returnStatement3] = node.body.body;
|
|
@@ -2683,7 +2594,7 @@ function transformPostcssPlugin(content, { refProperty }) {
|
|
|
2683
2594
|
Program(path18) {
|
|
2684
2595
|
const program = path18.node;
|
|
2685
2596
|
const index = program.body.findIndex((statement) => {
|
|
2686
|
-
return t2.isExpressionStatement(statement) && t2.isAssignmentExpression(statement.expression) && t2.isMemberExpression(statement.expression.left) && t2.isFunctionExpression(statement.expression.right) && _optionalChain([statement, 'access',
|
|
2597
|
+
return t2.isExpressionStatement(statement) && t2.isAssignmentExpression(statement.expression) && t2.isMemberExpression(statement.expression.left) && t2.isFunctionExpression(statement.expression.right) && _optionalChain([statement, 'access', _86 => _86.expression, 'access', _87 => _87.right, 'access', _88 => _88.id, 'optionalAccess', _89 => _89.name]) === "tailwindcss";
|
|
2687
2598
|
});
|
|
2688
2599
|
if (index === -1) {
|
|
2689
2600
|
return;
|
|
@@ -2724,7 +2635,7 @@ function transformPostcssPlugin(content, { refProperty }) {
|
|
|
2724
2635
|
return;
|
|
2725
2636
|
}
|
|
2726
2637
|
const fn = path18.node;
|
|
2727
|
-
if (_optionalChain([fn, 'access',
|
|
2638
|
+
if (_optionalChain([fn, 'access', _90 => _90.id, 'optionalAccess', _91 => _91.name]) !== "tailwindcss" || fn.body.body.length !== 1) {
|
|
2728
2639
|
return;
|
|
2729
2640
|
}
|
|
2730
2641
|
const [returnStatement3] = fn.body.body;
|
|
@@ -3121,7 +3032,7 @@ function checkExtendLengthUnitsPatch(context) {
|
|
|
3121
3032
|
function getPatchStatusReport(context) {
|
|
3122
3033
|
return {
|
|
3123
3034
|
package: {
|
|
3124
|
-
name: _nullishCoalesce(context.packageInfo.name, () => ( _optionalChain([context, 'access',
|
|
3035
|
+
name: _nullishCoalesce(context.packageInfo.name, () => ( _optionalChain([context, 'access', _92 => _92.packageInfo, 'access', _93 => _93.packageJson, 'optionalAccess', _94 => _94.name]))),
|
|
3125
3036
|
version: context.packageInfo.version,
|
|
3126
3037
|
root: context.packageInfo.rootPath
|
|
3127
3038
|
},
|
|
@@ -3241,7 +3152,7 @@ function applyTailwindPatches(context) {
|
|
|
3241
3152
|
majorVersion
|
|
3242
3153
|
});
|
|
3243
3154
|
}
|
|
3244
|
-
if (_optionalChain([options, 'access',
|
|
3155
|
+
if (_optionalChain([options, 'access', _95 => _95.features, 'access', _96 => _96.extendLengthUnits, 'optionalAccess', _97 => _97.enabled])) {
|
|
3245
3156
|
if (majorVersion === 3) {
|
|
3246
3157
|
results.extendLengthUnits = applyExtendLengthUnitsPatchV3(
|
|
3247
3158
|
packageInfo.rootPath,
|
|
@@ -3257,25 +3168,7 @@ function applyTailwindPatches(context) {
|
|
|
3257
3168
|
return results;
|
|
3258
3169
|
}
|
|
3259
3170
|
|
|
3260
|
-
// src/
|
|
3261
|
-
function resolveMajorVersion(version, hint) {
|
|
3262
|
-
if (hint && [2, 3, 4].includes(hint)) {
|
|
3263
|
-
return hint;
|
|
3264
|
-
}
|
|
3265
|
-
if (version) {
|
|
3266
|
-
const coerced = _semver.coerce.call(void 0, version);
|
|
3267
|
-
if (coerced) {
|
|
3268
|
-
const major = coerced.major;
|
|
3269
|
-
if (major === 2 || major === 3 || major === 4) {
|
|
3270
|
-
return major;
|
|
3271
|
-
}
|
|
3272
|
-
if (major >= 4) {
|
|
3273
|
-
return 4;
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
|
-
return 3;
|
|
3278
|
-
}
|
|
3171
|
+
// src/runtime/collector.ts
|
|
3279
3172
|
function resolveTailwindExecutionOptions(normalized, majorVersion) {
|
|
3280
3173
|
const base = normalized.tailwind;
|
|
3281
3174
|
if (majorVersion === 2 && base.v2) {
|
|
@@ -3298,6 +3191,128 @@ function resolveTailwindExecutionOptions(normalized, majorVersion) {
|
|
|
3298
3191
|
postcssPlugin: base.postcssPlugin
|
|
3299
3192
|
};
|
|
3300
3193
|
}
|
|
3194
|
+
var BaseCollector = class {
|
|
3195
|
+
constructor(packageInfo, options, majorVersion) {
|
|
3196
|
+
this.packageInfo = packageInfo;
|
|
3197
|
+
this.options = options;
|
|
3198
|
+
this.majorVersion = majorVersion;
|
|
3199
|
+
}
|
|
3200
|
+
async patch() {
|
|
3201
|
+
return applyTailwindPatches({
|
|
3202
|
+
packageInfo: this.packageInfo,
|
|
3203
|
+
options: this.options,
|
|
3204
|
+
majorVersion: this.majorVersion
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
async getPatchStatus() {
|
|
3208
|
+
return getPatchStatusReport({
|
|
3209
|
+
packageInfo: this.packageInfo,
|
|
3210
|
+
options: this.options,
|
|
3211
|
+
majorVersion: this.majorVersion
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3214
|
+
getContexts() {
|
|
3215
|
+
return loadRuntimeContexts(
|
|
3216
|
+
this.packageInfo,
|
|
3217
|
+
this.majorVersion,
|
|
3218
|
+
this.options.features.exposeContext.refProperty
|
|
3219
|
+
);
|
|
3220
|
+
}
|
|
3221
|
+
};
|
|
3222
|
+
var RuntimeCollector = class extends BaseCollector {
|
|
3223
|
+
constructor(packageInfo, options, majorVersion, snapshotFactory) {
|
|
3224
|
+
super(packageInfo, options, majorVersion);
|
|
3225
|
+
this.snapshotFactory = snapshotFactory;
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
async collectClassSet() {
|
|
3229
|
+
const contexts = this.getContexts();
|
|
3230
|
+
return collectClassesFromContexts(contexts, this.options.filter);
|
|
3231
|
+
}
|
|
3232
|
+
getPatchSnapshot() {
|
|
3233
|
+
return this.snapshotFactory();
|
|
3234
|
+
}
|
|
3235
|
+
async runTailwindBuildIfNeeded() {
|
|
3236
|
+
if (this.inFlightBuild) {
|
|
3237
|
+
return this.inFlightBuild;
|
|
3238
|
+
}
|
|
3239
|
+
const executionOptions = resolveTailwindExecutionOptions(this.options, this.majorVersion);
|
|
3240
|
+
const buildOptions = {
|
|
3241
|
+
cwd: executionOptions.cwd,
|
|
3242
|
+
majorVersion: this.majorVersion,
|
|
3243
|
+
...executionOptions.config === void 0 ? {} : { config: executionOptions.config },
|
|
3244
|
+
...executionOptions.postcssPlugin === void 0 ? {} : { postcssPlugin: executionOptions.postcssPlugin }
|
|
3245
|
+
};
|
|
3246
|
+
this.inFlightBuild = runTailwindBuild(buildOptions).then(() => void 0);
|
|
3247
|
+
try {
|
|
3248
|
+
await this.inFlightBuild;
|
|
3249
|
+
} finally {
|
|
3250
|
+
this.inFlightBuild = void 0;
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
};
|
|
3254
|
+
var TailwindV4Collector = class extends BaseCollector {
|
|
3255
|
+
constructor(packageInfo, options, snapshotFactory) {
|
|
3256
|
+
super(packageInfo, options, 4);
|
|
3257
|
+
this.snapshotFactory = snapshotFactory;
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3260
|
+
async collectClassSet() {
|
|
3261
|
+
return collectClassesFromTailwindV4(this.options);
|
|
3262
|
+
}
|
|
3263
|
+
getPatchSnapshot() {
|
|
3264
|
+
return this.snapshotFactory();
|
|
3265
|
+
}
|
|
3266
|
+
};
|
|
3267
|
+
|
|
3268
|
+
// src/api/tailwindcss-patcher.ts
|
|
3269
|
+
function resolveInstalledMajorVersion(version) {
|
|
3270
|
+
if (!version) {
|
|
3271
|
+
return void 0;
|
|
3272
|
+
}
|
|
3273
|
+
const coerced = _semver.coerce.call(void 0, version);
|
|
3274
|
+
if (!coerced) {
|
|
3275
|
+
return void 0;
|
|
3276
|
+
}
|
|
3277
|
+
const major = coerced.major;
|
|
3278
|
+
if (major === 2 || major === 3 || major === 4) {
|
|
3279
|
+
return major;
|
|
3280
|
+
}
|
|
3281
|
+
if (major >= 4) {
|
|
3282
|
+
return 4;
|
|
3283
|
+
}
|
|
3284
|
+
return void 0;
|
|
3285
|
+
}
|
|
3286
|
+
function validateInstalledVersion(packageVersion, expectedMajor, packageName) {
|
|
3287
|
+
const installedMajor = resolveInstalledMajorVersion(packageVersion);
|
|
3288
|
+
if (installedMajor === void 0) {
|
|
3289
|
+
return;
|
|
3290
|
+
}
|
|
3291
|
+
if (installedMajor !== expectedMajor) {
|
|
3292
|
+
throw new Error(
|
|
3293
|
+
`Configured tailwindcss.version=${expectedMajor}, but resolved package "${packageName}" is version ${packageVersion}. Update the configuration or resolve the correct package.`
|
|
3294
|
+
);
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
function resolveMajorVersionOrThrow(configuredMajor, packageVersion, packageName) {
|
|
3298
|
+
if (configuredMajor !== void 0) {
|
|
3299
|
+
validateInstalledVersion(packageVersion, configuredMajor, packageName);
|
|
3300
|
+
return configuredMajor;
|
|
3301
|
+
}
|
|
3302
|
+
const installedMajor = resolveInstalledMajorVersion(packageVersion);
|
|
3303
|
+
if (installedMajor !== void 0) {
|
|
3304
|
+
return installedMajor;
|
|
3305
|
+
}
|
|
3306
|
+
throw new Error(
|
|
3307
|
+
`Unable to infer Tailwind CSS major version from resolved package "${packageName}" (${_nullishCoalesce(packageVersion, () => ( "unknown"))}). Set "tailwindcss.version" to 2, 3, or 4 explicitly.`
|
|
3308
|
+
);
|
|
3309
|
+
}
|
|
3310
|
+
function createCollector(packageInfo, options, majorVersion, snapshotFactory) {
|
|
3311
|
+
if (majorVersion === 4) {
|
|
3312
|
+
return new TailwindV4Collector(packageInfo, options, snapshotFactory);
|
|
3313
|
+
}
|
|
3314
|
+
return new RuntimeCollector(packageInfo, options, majorVersion, snapshotFactory);
|
|
3315
|
+
}
|
|
3301
3316
|
var TailwindcssPatcher = (_class2 = class {
|
|
3302
3317
|
|
|
3303
3318
|
|
|
@@ -3307,8 +3322,7 @@ var TailwindcssPatcher = (_class2 = class {
|
|
|
3307
3322
|
|
|
3308
3323
|
|
|
3309
3324
|
constructor(options = {}) {;_class2.prototype.__init4.call(this);
|
|
3310
|
-
|
|
3311
|
-
this.options = normalizeOptions(resolvedOptions);
|
|
3325
|
+
this.options = normalizeOptions(options);
|
|
3312
3326
|
const packageInfo = _localpkg.getPackageInfoSync.call(void 0,
|
|
3313
3327
|
this.options.tailwind.packageName,
|
|
3314
3328
|
this.options.tailwind.resolve
|
|
@@ -3317,9 +3331,10 @@ var TailwindcssPatcher = (_class2 = class {
|
|
|
3317
3331
|
throw new Error(`Unable to locate Tailwind CSS package "${this.options.tailwind.packageName}".`);
|
|
3318
3332
|
}
|
|
3319
3333
|
this.packageInfo = packageInfo;
|
|
3320
|
-
this.majorVersion =
|
|
3334
|
+
this.majorVersion = resolveMajorVersionOrThrow(
|
|
3335
|
+
this.options.tailwind.versionHint,
|
|
3321
3336
|
this.packageInfo.version,
|
|
3322
|
-
this.options.tailwind.
|
|
3337
|
+
this.options.tailwind.packageName
|
|
3323
3338
|
);
|
|
3324
3339
|
this.cacheContext = createCacheContextDescriptor(
|
|
3325
3340
|
this.options,
|
|
@@ -3327,56 +3342,30 @@ var TailwindcssPatcher = (_class2 = class {
|
|
|
3327
3342
|
this.majorVersion
|
|
3328
3343
|
);
|
|
3329
3344
|
this.cacheStore = new CacheStore(this.options.cache, this.cacheContext);
|
|
3345
|
+
this.collector = createCollector(
|
|
3346
|
+
this.packageInfo,
|
|
3347
|
+
this.options,
|
|
3348
|
+
this.majorVersion,
|
|
3349
|
+
() => this.createPatchSnapshot()
|
|
3350
|
+
);
|
|
3330
3351
|
}
|
|
3331
3352
|
async patch() {
|
|
3332
|
-
const snapshot = this.
|
|
3353
|
+
const snapshot = this.collector.getPatchSnapshot();
|
|
3333
3354
|
if (this.patchMemo && this.patchMemo.snapshot === snapshot) {
|
|
3334
3355
|
return this.patchMemo.result;
|
|
3335
3356
|
}
|
|
3336
|
-
const result =
|
|
3337
|
-
packageInfo: this.packageInfo,
|
|
3338
|
-
options: this.options,
|
|
3339
|
-
majorVersion: this.majorVersion
|
|
3340
|
-
});
|
|
3357
|
+
const result = await this.collector.patch();
|
|
3341
3358
|
this.patchMemo = {
|
|
3342
3359
|
result,
|
|
3343
|
-
snapshot: this.
|
|
3360
|
+
snapshot: this.collector.getPatchSnapshot()
|
|
3344
3361
|
};
|
|
3345
3362
|
return result;
|
|
3346
3363
|
}
|
|
3347
3364
|
async getPatchStatus() {
|
|
3348
|
-
return
|
|
3349
|
-
packageInfo: this.packageInfo,
|
|
3350
|
-
options: this.options,
|
|
3351
|
-
majorVersion: this.majorVersion
|
|
3352
|
-
});
|
|
3365
|
+
return this.collector.getPatchStatus();
|
|
3353
3366
|
}
|
|
3354
3367
|
getContexts() {
|
|
3355
|
-
return
|
|
3356
|
-
this.packageInfo,
|
|
3357
|
-
this.majorVersion,
|
|
3358
|
-
this.options.features.exposeContext.refProperty
|
|
3359
|
-
);
|
|
3360
|
-
}
|
|
3361
|
-
async runTailwindBuildIfNeeded() {
|
|
3362
|
-
if (this.majorVersion === 2 || this.majorVersion === 3) {
|
|
3363
|
-
if (this.inFlightBuild) {
|
|
3364
|
-
return this.inFlightBuild;
|
|
3365
|
-
}
|
|
3366
|
-
const executionOptions = resolveTailwindExecutionOptions(this.options, this.majorVersion);
|
|
3367
|
-
const buildOptions = {
|
|
3368
|
-
cwd: executionOptions.cwd,
|
|
3369
|
-
majorVersion: this.majorVersion,
|
|
3370
|
-
...executionOptions.config === void 0 ? {} : { config: executionOptions.config },
|
|
3371
|
-
...executionOptions.postcssPlugin === void 0 ? {} : { postcssPlugin: executionOptions.postcssPlugin }
|
|
3372
|
-
};
|
|
3373
|
-
this.inFlightBuild = runTailwindBuild(buildOptions).then(() => void 0);
|
|
3374
|
-
try {
|
|
3375
|
-
await this.inFlightBuild;
|
|
3376
|
-
} finally {
|
|
3377
|
-
this.inFlightBuild = void 0;
|
|
3378
|
-
}
|
|
3379
|
-
}
|
|
3368
|
+
return this.collector.getContexts();
|
|
3380
3369
|
}
|
|
3381
3370
|
createPatchSnapshot() {
|
|
3382
3371
|
const entries = [];
|
|
@@ -3400,7 +3389,7 @@ var TailwindcssPatcher = (_class2 = class {
|
|
|
3400
3389
|
}
|
|
3401
3390
|
}
|
|
3402
3391
|
}
|
|
3403
|
-
if (_optionalChain([this, 'access',
|
|
3392
|
+
if (_optionalChain([this, 'access', _98 => _98.options, 'access', _99 => _99.features, 'access', _100 => _100.extendLengthUnits, 'optionalAccess', _101 => _101.enabled])) {
|
|
3404
3393
|
if (this.majorVersion === 3) {
|
|
3405
3394
|
const target = _nullishCoalesce(this.options.features.extendLengthUnits.lengthUnitsFilePath, () => ( "lib/util/dataTypes.js"));
|
|
3406
3395
|
pushSnapshot(_pathe2.default.resolve(this.packageInfo.rootPath, target));
|
|
@@ -3420,20 +3409,23 @@ var TailwindcssPatcher = (_class2 = class {
|
|
|
3420
3409
|
}
|
|
3421
3410
|
async collectClassSet() {
|
|
3422
3411
|
if (this.majorVersion === 4) {
|
|
3423
|
-
return
|
|
3412
|
+
return this.collector.collectClassSet();
|
|
3424
3413
|
}
|
|
3425
3414
|
const contexts = this.getContexts();
|
|
3426
3415
|
return collectClassesFromContexts(contexts, this.options.filter);
|
|
3427
3416
|
}
|
|
3417
|
+
async runTailwindBuildIfNeeded() {
|
|
3418
|
+
await _optionalChain([this, 'access', _102 => _102.collector, 'access', _103 => _103.runTailwindBuildIfNeeded, 'optionalCall', _104 => _104()]);
|
|
3419
|
+
}
|
|
3428
3420
|
debugCacheRead(meta) {
|
|
3429
3421
|
if (meta.hit) {
|
|
3430
3422
|
logger_default.debug(
|
|
3431
|
-
`[cache] hit fingerprint=${_nullishCoalesce(_optionalChain([meta, 'access',
|
|
3423
|
+
`[cache] hit fingerprint=${_nullishCoalesce(_optionalChain([meta, 'access', _105 => _105.fingerprint, 'optionalAccess', _106 => _106.slice, 'call', _107 => _107(0, 12)]), () => ( "n/a"))} schema=${_nullishCoalesce(meta.schemaVersion, () => ( "legacy"))} ${meta.details.join("; ")}`
|
|
3432
3424
|
);
|
|
3433
3425
|
return;
|
|
3434
3426
|
}
|
|
3435
3427
|
logger_default.debug(
|
|
3436
|
-
`[cache] miss reason=${meta.reason} fingerprint=${_nullishCoalesce(_optionalChain([meta, 'access',
|
|
3428
|
+
`[cache] miss reason=${meta.reason} fingerprint=${_nullishCoalesce(_optionalChain([meta, 'access', _108 => _108.fingerprint, 'optionalAccess', _109 => _109.slice, 'call', _110 => _110(0, 12)]), () => ( "n/a"))} schema=${_nullishCoalesce(meta.schemaVersion, () => ( "legacy"))} ${meta.details.join("; ")}`
|
|
3437
3429
|
);
|
|
3438
3430
|
}
|
|
3439
3431
|
async mergeWithCache(set) {
|
|
@@ -3517,7 +3509,7 @@ var TailwindcssPatcher = (_class2 = class {
|
|
|
3517
3509
|
return merged;
|
|
3518
3510
|
}
|
|
3519
3511
|
async extract(options) {
|
|
3520
|
-
const shouldWrite = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3512
|
+
const shouldWrite = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _111 => _111.write]), () => ( this.options.output.enabled));
|
|
3521
3513
|
const classSet = await this.getClassSet();
|
|
3522
3514
|
const classList = Array.from(classSet);
|
|
3523
3515
|
const result = {
|
|
@@ -3553,19 +3545,19 @@ var TailwindcssPatcher = (_class2 = class {
|
|
|
3553
3545
|
__init4() {this.extractValidCandidates = exports.extractValidCandidates = extractValidCandidates}
|
|
3554
3546
|
async collectContentTokens(options) {
|
|
3555
3547
|
return extractProjectCandidatesWithPositions({
|
|
3556
|
-
cwd: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3557
|
-
sources: _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3548
|
+
cwd: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _112 => _112.cwd]), () => ( this.options.projectRoot)),
|
|
3549
|
+
sources: _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _113 => _113.sources]), () => ( _optionalChain([this, 'access', _114 => _114.options, 'access', _115 => _115.tailwind, 'access', _116 => _116.v4, 'optionalAccess', _117 => _117.sources]))), () => ( []))
|
|
3558
3550
|
});
|
|
3559
3551
|
}
|
|
3560
3552
|
async collectContentTokensByFile(options) {
|
|
3561
3553
|
const collectContentOptions = {
|
|
3562
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3563
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3554
|
+
..._optionalChain([options, 'optionalAccess', _118 => _118.cwd]) === void 0 ? {} : { cwd: options.cwd },
|
|
3555
|
+
..._optionalChain([options, 'optionalAccess', _119 => _119.sources]) === void 0 ? {} : { sources: options.sources }
|
|
3564
3556
|
};
|
|
3565
3557
|
const report = await this.collectContentTokens(collectContentOptions);
|
|
3566
3558
|
const groupOptions = {
|
|
3567
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3568
|
-
..._optionalChain([options, 'optionalAccess',
|
|
3559
|
+
..._optionalChain([options, 'optionalAccess', _120 => _120.key]) === void 0 ? {} : { key: options.key },
|
|
3560
|
+
..._optionalChain([options, 'optionalAccess', _121 => _121.stripAbsolutePaths]) === void 0 ? {} : { stripAbsolutePaths: options.stripAbsolutePaths }
|
|
3569
3561
|
};
|
|
3570
3562
|
return groupTokensByFile(report, groupOptions);
|
|
3571
3563
|
}
|
|
@@ -4458,10 +4450,10 @@ function addPrefixIfMissing(value, prefix) {
|
|
|
4458
4450
|
return `${prefix}${value}`;
|
|
4459
4451
|
}
|
|
4460
4452
|
function resolveCommandNames(command, mountOptions, prefix) {
|
|
4461
|
-
const override = _optionalChain([mountOptions, 'access',
|
|
4462
|
-
const baseName = _nullishCoalesce(_optionalChain([override, 'optionalAccess',
|
|
4453
|
+
const override = _optionalChain([mountOptions, 'access', _122 => _122.commandOptions, 'optionalAccess', _123 => _123[command]]);
|
|
4454
|
+
const baseName = _nullishCoalesce(_optionalChain([override, 'optionalAccess', _124 => _124.name]), () => ( command));
|
|
4463
4455
|
const name = addPrefixIfMissing(baseName, prefix);
|
|
4464
|
-
const aliases = (_nullishCoalesce(_optionalChain([override, 'optionalAccess',
|
|
4456
|
+
const aliases = (_nullishCoalesce(_optionalChain([override, 'optionalAccess', _125 => _125.aliases]), () => ( []))).map((alias) => addPrefixIfMissing(alias, prefix));
|
|
4465
4457
|
return { name, aliases };
|
|
4466
4458
|
}
|
|
4467
4459
|
function resolveOptionDefinitions(defaults, override) {
|
|
@@ -4481,8 +4473,8 @@ function resolveOptionDefinitions(defaults, override) {
|
|
|
4481
4473
|
function resolveCommandMetadata(command, mountOptions, prefix, defaults) {
|
|
4482
4474
|
const names = resolveCommandNames(command, mountOptions, prefix);
|
|
4483
4475
|
const definition = defaults[command];
|
|
4484
|
-
const override = _optionalChain([mountOptions, 'access',
|
|
4485
|
-
const description = _nullishCoalesce(_optionalChain([override, 'optionalAccess',
|
|
4476
|
+
const override = _optionalChain([mountOptions, 'access', _126 => _126.commandOptions, 'optionalAccess', _127 => _127[command]]);
|
|
4477
|
+
const description = _nullishCoalesce(_optionalChain([override, 'optionalAccess', _128 => _128.description]), () => ( definition.description));
|
|
4486
4478
|
const optionDefs = resolveOptionDefinitions(definition.optionDefs, override);
|
|
4487
4479
|
return { ...names, description, optionDefs };
|
|
4488
4480
|
}
|
|
@@ -4564,7 +4556,7 @@ function runWithCommandHandler(cli, command, commandName, args, handler, default
|
|
|
4564
4556
|
|
|
4565
4557
|
var DEFAULT_CONFIG_NAME = "tailwindcss-mangle";
|
|
4566
4558
|
async function installCommandDefaultHandler(_ctx) {
|
|
4567
|
-
const patcher =
|
|
4559
|
+
const patcher = await _ctx.createPatcher();
|
|
4568
4560
|
await patcher.patch();
|
|
4569
4561
|
logger_default.success("Tailwind CSS runtime patched successfully.");
|
|
4570
4562
|
}
|
|
@@ -5001,7 +4993,7 @@ function registerTailwindcssPatchCommand(cli, commandName, options, prefix, defa
|
|
|
5001
4993
|
command,
|
|
5002
4994
|
commandName,
|
|
5003
4995
|
args,
|
|
5004
|
-
_optionalChain([options, 'access',
|
|
4996
|
+
_optionalChain([options, 'access', _129 => _129.commandHandlers, 'optionalAccess', _130 => _130[commandName]]),
|
|
5005
4997
|
defaultCommandHandlers[commandName]
|
|
5006
4998
|
);
|
|
5007
4999
|
});
|