tailwindcss-patch 9.0.1 → 9.1.0

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.
@@ -12,6 +12,8 @@ let node_crypto = require("node:crypto");
12
12
  let consola = require("consola");
13
13
  let node_url = require("node:url");
14
14
  let node_fs = require("node:fs");
15
+ let postcss = require("postcss");
16
+ postcss = require_chunk.__toESM(postcss);
15
17
  let _babel_types = require("@babel/types");
16
18
  _babel_types = require_chunk.__toESM(_babel_types);
17
19
  let _babel_generator = require("@babel/generator");
@@ -19,11 +21,9 @@ _babel_generator = require_chunk.__toESM(_babel_generator);
19
21
  let _babel_traverse = require("@babel/traverse");
20
22
  _babel_traverse = require_chunk.__toESM(_babel_traverse);
21
23
  let _babel_parser = require("@babel/parser");
22
- let postcss = require("postcss");
23
- postcss = require_chunk.__toESM(postcss);
24
24
  let tailwindcss_config = require("tailwindcss-config");
25
25
  //#region package.json
26
- var version = "9.0.1";
26
+ var version = "9.1.0";
27
27
  //#endregion
28
28
  //#region src/constants.ts
29
29
  const pkgName = "tailwindcss-patch";
@@ -1447,57 +1447,242 @@ async function loadPatchOptionsForWorkspace(cwd, overrides) {
1447
1447
  return merge(overrides ?? {}, base, { projectRoot: cwd });
1448
1448
  }
1449
1449
  //#endregion
1450
- //#region src/extraction/candidate-extractor.ts
1451
- let nodeImportPromise;
1452
- let oxideImportPromise;
1450
+ //#region src/v4/candidates.ts
1451
+ function resolveValidTailwindV4Candidates(designSystem, candidates) {
1452
+ const validCandidates = /* @__PURE__ */ new Set();
1453
+ const parsedCandidates = [];
1454
+ for (const candidate of candidates) {
1455
+ if (!candidate || parsedCandidates.includes(candidate)) continue;
1456
+ if (designSystem.parseCandidate(candidate).length > 0) parsedCandidates.push(candidate);
1457
+ }
1458
+ if (parsedCandidates.length === 0) return validCandidates;
1459
+ const cssByCandidate = designSystem.candidatesToCss(parsedCandidates);
1460
+ for (let index = 0; index < parsedCandidates.length; index++) {
1461
+ const candidate = parsedCandidates[index];
1462
+ const candidateCss = cssByCandidate[index];
1463
+ if (candidate && typeof candidateCss === "string" && candidateCss.trim().length > 0) validCandidates.add(candidate);
1464
+ }
1465
+ return validCandidates;
1466
+ }
1467
+ function splitTopLevel(value, separator) {
1468
+ const result = [];
1469
+ let start = 0;
1470
+ let depth = 0;
1471
+ let quote;
1472
+ for (let index = 0; index < value.length; index++) {
1473
+ const character = value[index];
1474
+ if (character === "\\") {
1475
+ index++;
1476
+ continue;
1477
+ }
1478
+ if (quote) {
1479
+ if (character === quote) quote = void 0;
1480
+ continue;
1481
+ }
1482
+ if (character === "\"" || character === "'") {
1483
+ quote = character;
1484
+ continue;
1485
+ }
1486
+ if (character === "(" || character === "[" || character === "{") {
1487
+ depth++;
1488
+ continue;
1489
+ }
1490
+ if (character === ")" || character === "]" || character === "}") {
1491
+ depth = Math.max(0, depth - 1);
1492
+ continue;
1493
+ }
1494
+ if (depth === 0 && character === separator) {
1495
+ const item = value.slice(start, index).trim();
1496
+ if (item) result.push(item);
1497
+ start = index + 1;
1498
+ }
1499
+ }
1500
+ const item = value.slice(start).trim();
1501
+ if (item) result.push(item);
1502
+ return result;
1503
+ }
1504
+ const sequencePattern = /^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/;
1505
+ function expandSequence(value) {
1506
+ const match = value.match(sequencePattern);
1507
+ if (!match) return [value];
1508
+ const [, startValue, endValue, stepValue] = match;
1509
+ if (startValue === void 0 || endValue === void 0) return [value];
1510
+ const start = Number.parseInt(startValue, 10);
1511
+ const end = Number.parseInt(endValue, 10);
1512
+ let step = stepValue === void 0 ? start <= end ? 1 : -1 : Number.parseInt(stepValue, 10);
1513
+ if (step === 0) throw new Error("Step cannot be zero in Tailwind CSS v4 inline source sequence.");
1514
+ const ascending = start < end;
1515
+ if (ascending && step < 0) step = -step;
1516
+ if (!ascending && step > 0) step = -step;
1517
+ const result = [];
1518
+ for (let current = start; ascending ? current <= end : current >= end; current += step) result.push(current.toString());
1519
+ return result;
1520
+ }
1521
+ function expandInlinePattern(pattern) {
1522
+ const openIndex = pattern.indexOf("{");
1523
+ if (openIndex === -1) return [pattern];
1524
+ const prefix = pattern.slice(0, openIndex);
1525
+ const rest = pattern.slice(openIndex);
1526
+ let depth = 0;
1527
+ let closeIndex = -1;
1528
+ for (let index = 0; index < rest.length; index++) {
1529
+ const character = rest[index];
1530
+ if (character === "{") depth++;
1531
+ else if (character === "}") {
1532
+ depth--;
1533
+ if (depth === 0) {
1534
+ closeIndex = index;
1535
+ break;
1536
+ }
1537
+ }
1538
+ }
1539
+ if (closeIndex === -1) throw new Error(`The Tailwind CSS v4 inline source pattern "${pattern}" is not balanced.`);
1540
+ const body = rest.slice(1, closeIndex);
1541
+ const suffix = rest.slice(closeIndex + 1);
1542
+ const parts = sequencePattern.test(body) ? expandSequence(body) : splitTopLevel(body, ",").flatMap((part) => expandInlinePattern(part));
1543
+ const suffixes = expandInlinePattern(suffix);
1544
+ const result = [];
1545
+ for (const part of parts) for (const expandedSuffix of suffixes) result.push(`${prefix}${part}${expandedSuffix}`);
1546
+ return result;
1547
+ }
1548
+ function unquoteCssString(value) {
1549
+ const quote = value[0];
1550
+ if (quote !== "\"" && quote !== "'" || value[value.length - 1] !== quote) return;
1551
+ let result = "";
1552
+ for (let index = 1; index < value.length - 1; index++) {
1553
+ const character = value[index];
1554
+ if (character === "\\") {
1555
+ index++;
1556
+ result += value[index] ?? "";
1557
+ continue;
1558
+ }
1559
+ result += character;
1560
+ }
1561
+ return result;
1562
+ }
1563
+ function extractTailwindV4InlineSourceCandidates(css) {
1564
+ const included = /* @__PURE__ */ new Set();
1565
+ const excluded = /* @__PURE__ */ new Set();
1566
+ postcss.default.parse(css).walkAtRules("source", (rule) => {
1567
+ let params = rule.params.trim();
1568
+ if (!params) return;
1569
+ let negated = false;
1570
+ if (params.startsWith("not ")) {
1571
+ negated = true;
1572
+ params = params.slice(4).trim();
1573
+ }
1574
+ if (!params.startsWith("inline(") || !params.endsWith(")")) return;
1575
+ const inlineValue = unquoteCssString(params.slice(7, -1).trim());
1576
+ if (inlineValue === void 0) return;
1577
+ const target = negated ? excluded : included;
1578
+ for (const part of splitTopLevel(inlineValue, " ")) for (const candidate of expandInlinePattern(part)) target.add(candidate);
1579
+ });
1580
+ return {
1581
+ included,
1582
+ excluded
1583
+ };
1584
+ }
1585
+ //#endregion
1586
+ //#region src/v4/node-adapter.ts
1587
+ const nodeModulePromiseCache = /* @__PURE__ */ new Map();
1453
1588
  const designSystemPromiseCache = /* @__PURE__ */ new Map();
1454
- const designSystemCandidateCache = /* @__PURE__ */ new Map();
1455
- async function importNode() {
1456
- return import("@tailwindcss/node");
1589
+ function unique(values) {
1590
+ return Array.from(new Set(Array.from(values).filter(Boolean).map((value) => pathe.default.resolve(value))));
1457
1591
  }
1458
- async function importOxide() {
1459
- return import("@tailwindcss/oxide");
1592
+ function createRequireBase(base) {
1593
+ return pathe.default.join(base, "package.json");
1460
1594
  }
1461
- function getNodeModule() {
1462
- nodeImportPromise ??= importNode();
1463
- return nodeImportPromise;
1595
+ async function importResolvedModule(resolved) {
1596
+ return import((0, node_url.pathToFileURL)(resolved).href);
1464
1597
  }
1465
- function getOxideModule() {
1466
- oxideImportPromise ??= importOxide();
1467
- return oxideImportPromise;
1598
+ async function importTailwindNodeFromBase(base) {
1599
+ try {
1600
+ return await importResolvedModule((0, node_module.createRequire)(createRequireBase(base)).resolve("@tailwindcss/node"));
1601
+ } catch {
1602
+ return;
1603
+ }
1604
+ }
1605
+ async function importFallbackTailwindNode() {
1606
+ return import("@tailwindcss/node");
1607
+ }
1608
+ async function loadTailwindV4NodeModule(baseCandidates) {
1609
+ const bases = unique(baseCandidates);
1610
+ const cacheKey = JSON.stringify(bases);
1611
+ const cached = nodeModulePromiseCache.get(cacheKey);
1612
+ if (cached) return cached;
1613
+ const promise = (async () => {
1614
+ for (const base of bases) {
1615
+ const loaded = await importTailwindNodeFromBase(base);
1616
+ if (loaded) return loaded;
1617
+ }
1618
+ return importFallbackTailwindNode();
1619
+ })();
1620
+ nodeModulePromiseCache.set(cacheKey, promise);
1621
+ promise.catch(() => {
1622
+ if (nodeModulePromiseCache.get(cacheKey) === promise) nodeModulePromiseCache.delete(cacheKey);
1623
+ });
1624
+ return promise;
1468
1625
  }
1469
1626
  function createDesignSystemCacheKey(css, bases) {
1470
1627
  return JSON.stringify({
1471
1628
  css,
1472
- bases: Array.from(new Set(bases.filter(Boolean)))
1629
+ bases: unique(bases)
1473
1630
  });
1474
1631
  }
1475
- async function loadDesignSystem(css, bases) {
1476
- const uniqueBases = Array.from(new Set(bases.filter(Boolean)));
1477
- if (uniqueBases.length === 0) throw new Error("No base directories provided for Tailwind CSS design system.");
1478
- const cacheKey = createDesignSystemCacheKey(css, uniqueBases);
1632
+ function getTailwindV4DesignSystemCacheKey(source) {
1633
+ return createDesignSystemCacheKey(source.css, [source.base, ...source.baseFallbacks]);
1634
+ }
1635
+ async function loadTailwindV4DesignSystem(source) {
1636
+ const bases = unique([source.base, ...source.baseFallbacks]);
1637
+ if (bases.length === 0) throw new Error("No base directories provided for Tailwind CSS v4 design system.");
1638
+ const cacheKey = createDesignSystemCacheKey(source.css, bases);
1479
1639
  const cached = designSystemPromiseCache.get(cacheKey);
1480
1640
  if (cached) return cached;
1481
1641
  const promise = (async () => {
1482
- const { __unstable__loadDesignSystem } = await getNodeModule();
1642
+ const node = await loadTailwindV4NodeModule([source.projectRoot, ...bases]);
1483
1643
  let lastError;
1484
- for (const base of uniqueBases) try {
1485
- return await __unstable__loadDesignSystem(css, { base });
1644
+ for (const base of bases) try {
1645
+ return await node.__unstable__loadDesignSystem(source.css, { base });
1486
1646
  } catch (error) {
1487
1647
  lastError = error;
1488
1648
  }
1489
1649
  if (lastError instanceof Error) throw lastError;
1490
- throw new Error("Failed to load Tailwind CSS design system.");
1650
+ throw new Error("Failed to load Tailwind CSS v4 design system.");
1491
1651
  })();
1492
1652
  designSystemPromiseCache.set(cacheKey, promise);
1493
1653
  promise.catch(() => {
1494
- if (designSystemPromiseCache.get(cacheKey) === promise) {
1495
- designSystemPromiseCache.delete(cacheKey);
1496
- designSystemCandidateCache.delete(cacheKey);
1497
- }
1654
+ if (designSystemPromiseCache.get(cacheKey) === promise) designSystemPromiseCache.delete(cacheKey);
1498
1655
  });
1499
1656
  return promise;
1500
1657
  }
1658
+ async function compileTailwindV4Source(source) {
1659
+ const node = await loadTailwindV4NodeModule([
1660
+ source.projectRoot,
1661
+ source.base,
1662
+ ...source.baseFallbacks
1663
+ ]);
1664
+ const dependencies = new Set(source.dependencies);
1665
+ return {
1666
+ compiled: await node.compile(source.css, {
1667
+ base: source.base,
1668
+ onDependency(dependency) {
1669
+ dependencies.add(pathe.default.resolve(dependency));
1670
+ }
1671
+ }),
1672
+ dependencies
1673
+ };
1674
+ }
1675
+ //#endregion
1676
+ //#region src/extraction/candidate-extractor.ts
1677
+ let oxideImportPromise;
1678
+ const designSystemCandidateCache = /* @__PURE__ */ new Map();
1679
+ async function importOxide() {
1680
+ return import("@tailwindcss/oxide");
1681
+ }
1682
+ function getOxideModule() {
1683
+ oxideImportPromise ??= importOxide();
1684
+ return oxideImportPromise;
1685
+ }
1501
1686
  async function extractRawCandidatesWithPositions(content, extension = "html") {
1502
1687
  const { Scanner } = await getOxideModule();
1503
1688
  return new Scanner({}).getCandidatesWithPositions({
@@ -1528,8 +1713,15 @@ async function extractValidCandidates(options) {
1528
1713
  pattern: source.pattern,
1529
1714
  negated: source.negated
1530
1715
  }));
1531
- const designSystemKey = createDesignSystemCacheKey(css, [base, ...baseFallbacks]);
1532
- const designSystem = await loadDesignSystem(css, [base, ...baseFallbacks]);
1716
+ const source = {
1717
+ projectRoot: defaultCwd,
1718
+ base,
1719
+ baseFallbacks,
1720
+ css,
1721
+ dependencies: []
1722
+ };
1723
+ const designSystemKey = getTailwindV4DesignSystemCacheKey(source);
1724
+ const designSystem = await loadTailwindV4DesignSystem(source);
1533
1725
  const candidateCache = designSystemCandidateCache.get(designSystemKey) ?? /* @__PURE__ */ new Map();
1534
1726
  designSystemCandidateCache.set(designSystemKey, candidateCache);
1535
1727
  const candidates = await extractRawCandidates(sources);
@@ -1549,12 +1741,9 @@ async function extractValidCandidates(options) {
1549
1741
  candidateCache.set(rawCandidate, false);
1550
1742
  }
1551
1743
  if (uncachedCandidates.length === 0) return validCandidates;
1552
- const cssByCandidate = designSystem.candidatesToCss(uncachedCandidates);
1553
- for (let index = 0; index < uncachedCandidates.length; index++) {
1554
- const candidate = uncachedCandidates[index];
1555
- if (candidate === void 0) continue;
1556
- const candidateCss = cssByCandidate[index];
1557
- const isValid = typeof candidateCss === "string" && candidateCss.trim().length > 0;
1744
+ const validUncachedCandidates = resolveValidTailwindV4Candidates(designSystem, uncachedCandidates);
1745
+ for (const candidate of uncachedCandidates) {
1746
+ const isValid = validUncachedCandidates.has(candidate);
1558
1747
  candidateCache.set(candidate, isValid);
1559
1748
  if (!isValid) continue;
1560
1749
  validCandidates.push(candidate);
@@ -3395,6 +3584,12 @@ Object.defineProperty(exports, "collectClassesFromTailwindV4", {
3395
3584
  return collectClassesFromTailwindV4;
3396
3585
  }
3397
3586
  });
3587
+ Object.defineProperty(exports, "compileTailwindV4Source", {
3588
+ enumerable: true,
3589
+ get: function() {
3590
+ return compileTailwindV4Source;
3591
+ }
3592
+ });
3398
3593
  Object.defineProperty(exports, "extractProjectCandidatesWithPositions", {
3399
3594
  enumerable: true,
3400
3595
  get: function() {
@@ -3413,6 +3608,12 @@ Object.defineProperty(exports, "extractRawCandidatesWithPositions", {
3413
3608
  return extractRawCandidatesWithPositions;
3414
3609
  }
3415
3610
  });
3611
+ Object.defineProperty(exports, "extractTailwindV4InlineSourceCandidates", {
3612
+ enumerable: true,
3613
+ get: function() {
3614
+ return extractTailwindV4InlineSourceCandidates;
3615
+ }
3616
+ });
3416
3617
  Object.defineProperty(exports, "extractValidCandidates", {
3417
3618
  enumerable: true,
3418
3619
  get: function() {
@@ -3443,6 +3644,12 @@ Object.defineProperty(exports, "loadRuntimeContexts", {
3443
3644
  return loadRuntimeContexts;
3444
3645
  }
3445
3646
  });
3647
+ Object.defineProperty(exports, "loadTailwindV4DesignSystem", {
3648
+ enumerable: true,
3649
+ get: function() {
3650
+ return loadTailwindV4DesignSystem;
3651
+ }
3652
+ });
3446
3653
  Object.defineProperty(exports, "loadWorkspaceConfigModule", {
3447
3654
  enumerable: true,
3448
3655
  get: function() {
@@ -3467,6 +3674,12 @@ Object.defineProperty(exports, "normalizeOptions", {
3467
3674
  return normalizeOptions;
3468
3675
  }
3469
3676
  });
3677
+ Object.defineProperty(exports, "resolveValidTailwindV4Candidates", {
3678
+ enumerable: true,
3679
+ get: function() {
3680
+ return resolveValidTailwindV4Candidates;
3681
+ }
3682
+ });
3470
3683
  Object.defineProperty(exports, "restoreConfigFiles", {
3471
3684
  enumerable: true,
3472
3685
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "9.0.1",
3
+ "version": "9.1.0",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -71,7 +71,7 @@
71
71
  "fs-extra": "^11.3.4",
72
72
  "local-pkg": "^1.1.2",
73
73
  "pathe": "^2.0.3",
74
- "postcss": "^8.5.13",
74
+ "postcss": "^8.5.14",
75
75
  "semver": "^7.7.4",
76
76
  "tailwindcss-config": "^1.1.5",
77
77
  "@tailwindcss-mangle/config": "7.0.1"
@@ -8,78 +8,21 @@ import type {
8
8
  import { promises as fs } from 'node:fs'
9
9
  import process from 'node:process'
10
10
  import path from 'pathe'
11
+ import { resolveValidTailwindV4Candidates } from '../v4/candidates'
12
+ import { getTailwindV4DesignSystemCacheKey, loadTailwindV4DesignSystem } from '../v4/node-adapter'
11
13
 
12
- let nodeImportPromise: ReturnType<typeof importNode> | undefined
13
14
  let oxideImportPromise: ReturnType<typeof importOxide> | undefined
14
- const designSystemPromiseCache = new Map<string, Promise<any>>()
15
15
  const designSystemCandidateCache = new Map<string, Map<string, boolean>>()
16
16
 
17
- async function importNode() {
18
- return import('@tailwindcss/node')
19
- }
20
-
21
17
  async function importOxide() {
22
18
  return import('@tailwindcss/oxide')
23
19
  }
24
20
 
25
- function getNodeModule() {
26
- nodeImportPromise ??= importNode()
27
- return nodeImportPromise
28
- }
29
-
30
21
  function getOxideModule() {
31
22
  oxideImportPromise ??= importOxide()
32
23
  return oxideImportPromise
33
24
  }
34
25
 
35
- function createDesignSystemCacheKey(css: string, bases: string[]) {
36
- return JSON.stringify({
37
- css,
38
- bases: Array.from(new Set(bases.filter(Boolean))),
39
- })
40
- }
41
-
42
- async function loadDesignSystem(css: string, bases: string[]) {
43
- const uniqueBases = Array.from(new Set(bases.filter(Boolean)))
44
- if (uniqueBases.length === 0) {
45
- throw new Error('No base directories provided for Tailwind CSS design system.')
46
- }
47
-
48
- const cacheKey = createDesignSystemCacheKey(css, uniqueBases)
49
- const cached = designSystemPromiseCache.get(cacheKey)
50
- if (cached) {
51
- return cached
52
- }
53
-
54
- const promise = (async () => {
55
- const { __unstable__loadDesignSystem } = await getNodeModule()
56
- let lastError: unknown
57
-
58
- for (const base of uniqueBases) {
59
- try {
60
- return await __unstable__loadDesignSystem(css, { base })
61
- }
62
- catch (error) {
63
- lastError = error
64
- }
65
- }
66
-
67
- if (lastError instanceof Error) {
68
- throw lastError
69
- }
70
- throw new Error('Failed to load Tailwind CSS design system.')
71
- })()
72
-
73
- designSystemPromiseCache.set(cacheKey, promise)
74
- promise.catch(() => {
75
- if (designSystemPromiseCache.get(cacheKey) === promise) {
76
- designSystemPromiseCache.delete(cacheKey)
77
- designSystemCandidateCache.delete(cacheKey)
78
- }
79
- })
80
- return promise
81
- }
82
-
83
26
  export interface ExtractValidCandidatesOption {
84
27
  sources?: SourceEntry[]
85
28
  base?: string
@@ -131,8 +74,15 @@ export async function extractValidCandidates(options?: ExtractValidCandidatesOpt
131
74
  negated: source.negated,
132
75
  }))
133
76
 
134
- const designSystemKey = createDesignSystemCacheKey(css, [base, ...baseFallbacks])
135
- const designSystem = await loadDesignSystem(css, [base, ...baseFallbacks])
77
+ const source = {
78
+ projectRoot: defaultCwd,
79
+ base,
80
+ baseFallbacks,
81
+ css,
82
+ dependencies: [],
83
+ }
84
+ const designSystemKey = getTailwindV4DesignSystemCacheKey(source)
85
+ const designSystem = await loadTailwindV4DesignSystem(source)
136
86
  const candidateCache = designSystemCandidateCache.get(designSystemKey) ?? new Map<string, boolean>()
137
87
  designSystemCandidateCache.set(designSystemKey, candidateCache)
138
88
 
@@ -163,15 +113,10 @@ export async function extractValidCandidates(options?: ExtractValidCandidatesOpt
163
113
  return validCandidates
164
114
  }
165
115
 
166
- const cssByCandidate = designSystem.candidatesToCss(uncachedCandidates)
116
+ const validUncachedCandidates = resolveValidTailwindV4Candidates(designSystem, uncachedCandidates)
167
117
 
168
- for (let index = 0; index < uncachedCandidates.length; index++) {
169
- const candidate = uncachedCandidates[index]
170
- if (candidate === undefined) {
171
- continue
172
- }
173
- const candidateCss = cssByCandidate[index]
174
- const isValid = typeof candidateCss === 'string' && candidateCss.trim().length > 0
118
+ for (const candidate of uncachedCandidates) {
119
+ const isValid = validUncachedCandidates.has(candidate)
175
120
  candidateCache.set(candidate, isValid)
176
121
  if (!isValid) {
177
122
  continue
@@ -33,6 +33,13 @@ import {
33
33
  runTailwindBuild,
34
34
  } from './install'
35
35
  import logger from './logger'
36
+ import {
37
+ createTailwindV4Engine,
38
+ loadTailwindV4DesignSystem,
39
+ resolveTailwindV4Source,
40
+ resolveTailwindV4SourceFromPatchOptions,
41
+ resolveValidTailwindV4Candidates,
42
+ } from './v4'
36
43
 
37
44
  const require = createRequire(import.meta.url)
38
45
 
@@ -46,6 +53,7 @@ export {
46
53
  CacheStore,
47
54
  collectClassesFromContexts,
48
55
  collectClassesFromTailwindV4,
56
+ createTailwindV4Engine,
49
57
  extractProjectCandidatesWithPositions,
50
58
  extractRawCandidates,
51
59
  extractRawCandidatesWithPositions,
@@ -53,11 +61,15 @@ export {
53
61
  getPatchStatusReport,
54
62
  groupTokensByFile,
55
63
  loadRuntimeContexts,
64
+ loadTailwindV4DesignSystem,
56
65
  logger,
57
66
  migrateConfigFiles,
58
67
  MIGRATION_REPORT_KIND,
59
68
  MIGRATION_REPORT_SCHEMA_VERSION,
60
69
  normalizeOptions,
70
+ resolveTailwindV4Source,
71
+ resolveTailwindV4SourceFromPatchOptions,
72
+ resolveValidTailwindV4Candidates,
61
73
  restoreConfigFiles,
62
74
  runTailwindBuild,
63
75
  tailwindcssPatchCommands,
@@ -91,6 +103,15 @@ export type {
91
103
  } from './commands/validate'
92
104
  export type { TailwindCssPatchOptions } from './config'
93
105
  export * from './types'
106
+ export type {
107
+ TailwindV4CandidateSource,
108
+ TailwindV4DesignSystem,
109
+ TailwindV4Engine,
110
+ TailwindV4GenerateOptions,
111
+ TailwindV4GenerateResult,
112
+ TailwindV4ResolvedSource,
113
+ TailwindV4SourceOptions,
114
+ } from './v4'
94
115
 
95
116
  export function mountTailwindcssPatchCommands(cli: CAC, options: TailwindcssPatchCliMountOptions = {}) {
96
117
  return loadCliModule().mountTailwindcssPatchCommands(cli, options)
package/src/index.ts CHANGED
@@ -51,6 +51,22 @@ export {
51
51
  } from './install'
52
52
  export { default as logger } from './logger'
53
53
  export * from './types'
54
+ export {
55
+ createTailwindV4Engine,
56
+ loadTailwindV4DesignSystem,
57
+ resolveTailwindV4Source,
58
+ resolveTailwindV4SourceFromPatchOptions,
59
+ resolveValidTailwindV4Candidates,
60
+ } from './v4'
61
+ export type {
62
+ TailwindV4CandidateSource,
63
+ TailwindV4DesignSystem,
64
+ TailwindV4Engine,
65
+ TailwindV4GenerateOptions,
66
+ TailwindV4GenerateResult,
67
+ TailwindV4ResolvedSource,
68
+ TailwindV4SourceOptions,
69
+ } from './v4'
54
70
 
55
71
  export function defineConfig<T extends TailwindcssMangleConfig>(config: T): T {
56
72
  return config