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.
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_validate = require("./validate-B8H-8rWO.js");
3
- const require_index_bundle = require("./index.bundle-BGBMTX9A.js");
2
+ const require_validate = require("./validate-BuhhSYBe.js");
3
+ const require_index_bundle = require("./index.bundle-C4Y53Ygf.js");
4
4
  let node_process = require("node:process");
5
5
  node_process = require_chunk.__toESM(node_process);
6
6
  //#region src/cli.bundle.ts
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { T as logger, r as ValidateCommandError } from "./validate-BI8356RT.mjs";
2
- import { t as createTailwindcssPatchCli } from "./index.bundle-ByrTqrr3.mjs";
1
+ import { k as logger, r as ValidateCommandError } from "./validate-4FCU-Ql3.mjs";
2
+ import { t as createTailwindcssPatchCli } from "./index.bundle-0Fe7Jx8V.mjs";
3
3
  import process from "node:process";
4
4
  //#region src/cli.bundle.ts
5
5
  async function main() {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../chunk-8l464Juk.js");
3
- const require_validate = require("../validate-B8H-8rWO.js");
3
+ const require_validate = require("../validate-BuhhSYBe.js");
4
4
  let node_process = require("node:process");
5
5
  node_process = require_chunk.__toESM(node_process);
6
6
  let fs_extra = require("fs-extra");
@@ -1,4 +1,4 @@
1
- import { S as loadWorkspaceConfigModule, T as logger, a as tailwindcssPatchCommands, b as groupTokensByFile, i as classifyValidateError, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher, x as loadPatchOptionsForWorkspace } from "../validate-BI8356RT.mjs";
1
+ import { E as loadWorkspaceConfigModule, T as loadPatchOptionsForWorkspace, a as tailwindcssPatchCommands, b as groupTokensByFile, i as classifyValidateError, k as logger, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher } from "../validate-4FCU-Ql3.mjs";
2
2
  import process from "node:process";
3
3
  import fs from "fs-extra";
4
4
  import path from "pathe";
@@ -0,0 +1,194 @@
1
+ import { C as extractTailwindV4InlineSourceCandidates, D as normalizeOptions, S as loadTailwindV4DesignSystem, v as extractRawCandidatesWithPositions, w as resolveValidTailwindV4Candidates, x as compileTailwindV4Source } from "./validate-4FCU-Ql3.mjs";
2
+ import { createRequire } from "node:module";
3
+ import process from "node:process";
4
+ import path from "pathe";
5
+ import { promises } from "node:fs";
6
+ //#region src/v4/engine.ts
7
+ async function collectRawCandidates(source, options) {
8
+ const rawCandidates = /* @__PURE__ */ new Set();
9
+ for (const candidate of options?.candidates ?? []) rawCandidates.add(candidate);
10
+ for (const candidateSource of options?.sources ?? []) {
11
+ const candidates = await extractRawCandidatesWithPositions(candidateSource.content, candidateSource.extension);
12
+ for (const candidate of candidates) rawCandidates.add(candidate.rawCandidate);
13
+ }
14
+ const inlineSources = extractTailwindV4InlineSourceCandidates(source.css);
15
+ for (const candidate of inlineSources.included) rawCandidates.add(candidate);
16
+ for (const candidate of inlineSources.excluded) rawCandidates.delete(candidate);
17
+ return rawCandidates;
18
+ }
19
+ function createTailwindV4Engine(source) {
20
+ return {
21
+ source,
22
+ loadDesignSystem() {
23
+ return loadTailwindV4DesignSystem(source);
24
+ },
25
+ async validateCandidates(candidates) {
26
+ return resolveValidTailwindV4Candidates(await loadTailwindV4DesignSystem(source), candidates);
27
+ },
28
+ async generate(options) {
29
+ const rawCandidates = await collectRawCandidates(source, options);
30
+ const classSet = resolveValidTailwindV4Candidates(await loadTailwindV4DesignSystem(source), rawCandidates);
31
+ const inlineSources = extractTailwindV4InlineSourceCandidates(source.css);
32
+ for (const candidate of inlineSources.excluded) classSet.delete(candidate);
33
+ const { compiled, dependencies } = await compileTailwindV4Source(source);
34
+ return {
35
+ css: compiled.build(Array.from(classSet)),
36
+ classSet,
37
+ rawCandidates,
38
+ dependencies: Array.from(dependencies),
39
+ sources: compiled.sources,
40
+ root: compiled.root
41
+ };
42
+ }
43
+ };
44
+ }
45
+ //#endregion
46
+ //#region src/v4/source.ts
47
+ function resolveBase(value, fallback) {
48
+ return value === void 0 ? fallback : path.isAbsolute(value) ? path.resolve(value) : path.resolve(fallback, value);
49
+ }
50
+ function uniquePaths(values) {
51
+ const result = [];
52
+ for (const value of values) {
53
+ if (!value) continue;
54
+ const resolved = path.resolve(value);
55
+ if (!result.includes(resolved)) result.push(resolved);
56
+ }
57
+ return result;
58
+ }
59
+ function toCssImportPath(value) {
60
+ return value.replaceAll("\\", "/");
61
+ }
62
+ function quoteCssImport(value) {
63
+ return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
64
+ }
65
+ function isPostcssPluginSpecifier(packageName) {
66
+ return packageName === "@tailwindcss/postcss" || /(?:^|[/\\])@tailwindcss[/\\]postcss(?:[/\\]|$)/.test(packageName) || /(?:^|[/\\])postcss(?:[/\\]|$)/i.test(packageName) || /postcss\.config\.[cm]?[jt]s$/i.test(packageName);
67
+ }
68
+ function createDefaultCss(packageName) {
69
+ return `@import "${quoteCssImport(toCssImportPath(packageName && !isPostcssPluginSpecifier(packageName) ? packageName : "tailwindcss"))}";`;
70
+ }
71
+ async function pathExists(filePath) {
72
+ try {
73
+ await promises.access(filePath);
74
+ return true;
75
+ } catch {
76
+ return false;
77
+ }
78
+ }
79
+ async function resolveCssEntries(entries, projectRoot, base) {
80
+ const resolvedEntries = entries.map((entry) => ({
81
+ original: entry,
82
+ absolute: path.isAbsolute(entry) ? path.resolve(entry) : path.resolve(projectRoot, entry)
83
+ }));
84
+ const resolvedBase = base ?? path.dirname(resolvedEntries[0]?.absolute ?? projectRoot);
85
+ const dependencies = resolvedEntries.map((entry) => entry.absolute);
86
+ const cssParts = [];
87
+ for (const entry of resolvedEntries) {
88
+ if (await pathExists(entry.absolute)) {
89
+ cssParts.push(await promises.readFile(entry.absolute, "utf8"));
90
+ continue;
91
+ }
92
+ const importPath = path.isAbsolute(entry.original) ? entry.absolute : path.relative(resolvedBase, entry.absolute);
93
+ cssParts.push(`@import "${quoteCssImport(toCssImportPath(importPath))}";`);
94
+ }
95
+ return {
96
+ base: resolvedBase,
97
+ css: cssParts.join("\n"),
98
+ dependencies
99
+ };
100
+ }
101
+ function normalizeResolvedSource(source) {
102
+ const baseFallbacks = uniquePaths([
103
+ ...source.baseFallbacks,
104
+ source.projectRoot,
105
+ source.cwd
106
+ ]).filter((base) => base !== source.base);
107
+ return {
108
+ projectRoot: source.projectRoot,
109
+ base: source.base,
110
+ baseFallbacks,
111
+ css: source.css,
112
+ dependencies: Array.from(new Set(source.dependencies.map((dependency) => path.resolve(dependency))))
113
+ };
114
+ }
115
+ async function resolveTailwindV4Source(options = {}) {
116
+ const projectRoot = resolveBase(options.projectRoot, process.cwd());
117
+ const cwd = resolveBase(options.cwd, projectRoot);
118
+ const configuredBase = options.base === void 0 ? void 0 : resolveBase(options.base, projectRoot);
119
+ const baseFallbacks = uniquePaths(options.baseFallbacks?.map((base) => resolveBase(base, projectRoot)) ?? []);
120
+ if (options.css !== void 0) return normalizeResolvedSource({
121
+ projectRoot,
122
+ cwd,
123
+ base: configuredBase ?? cwd,
124
+ baseFallbacks,
125
+ css: options.css,
126
+ dependencies: []
127
+ });
128
+ if (options.cssEntries?.length) {
129
+ const entries = await resolveCssEntries(options.cssEntries, projectRoot, configuredBase);
130
+ return normalizeResolvedSource({
131
+ projectRoot,
132
+ cwd,
133
+ base: entries.base,
134
+ baseFallbacks,
135
+ css: entries.css,
136
+ dependencies: entries.dependencies
137
+ });
138
+ }
139
+ return normalizeResolvedSource({
140
+ projectRoot,
141
+ cwd,
142
+ base: configuredBase ?? cwd,
143
+ baseFallbacks,
144
+ css: createDefaultCss(options.packageName),
145
+ dependencies: []
146
+ });
147
+ }
148
+ function resolveConfigDir(config, projectRoot) {
149
+ if (!config) return;
150
+ const configPath = path.isAbsolute(config) ? config : path.resolve(projectRoot, config);
151
+ return path.dirname(configPath);
152
+ }
153
+ function createSourceOptionsFromNormalizedPatchOptions(options) {
154
+ const v4 = options.tailwind.v4;
155
+ const configDir = resolveConfigDir(options.tailwind.config, options.projectRoot);
156
+ const baseFallbacks = uniquePaths([
157
+ v4?.configuredBase,
158
+ options.tailwind.cwd,
159
+ options.projectRoot,
160
+ configDir
161
+ ]);
162
+ return {
163
+ projectRoot: options.projectRoot,
164
+ ...options.tailwind.cwd === void 0 ? {} : { cwd: options.tailwind.cwd },
165
+ ...v4?.configuredBase === void 0 ? {} : { base: v4.configuredBase },
166
+ baseFallbacks,
167
+ ...v4?.css === void 0 ? {} : { css: v4.css },
168
+ ...v4?.cssEntries === void 0 ? {} : { cssEntries: v4.cssEntries },
169
+ packageName: options.tailwind.packageName
170
+ };
171
+ }
172
+ function tailwindV4SourceOptionsFromPatchOptions(options) {
173
+ return createSourceOptionsFromNormalizedPatchOptions(normalizeOptions(options));
174
+ }
175
+ async function resolveTailwindV4SourceFromPatchOptions(options) {
176
+ return resolveTailwindV4Source(tailwindV4SourceOptionsFromPatchOptions(options));
177
+ }
178
+ //#endregion
179
+ //#region src/index.bundle.ts
180
+ const require = createRequire(import.meta.url);
181
+ function loadCliModule() {
182
+ return require("./commands/cli-runtime.js");
183
+ }
184
+ function mountTailwindcssPatchCommands(cli, options = {}) {
185
+ return loadCliModule().mountTailwindcssPatchCommands(cli, options);
186
+ }
187
+ function createTailwindcssPatchCli(options = {}) {
188
+ return loadCliModule().createTailwindcssPatchCli(options);
189
+ }
190
+ function defineConfig(config) {
191
+ return config;
192
+ }
193
+ //#endregion
194
+ export { resolveTailwindV4SourceFromPatchOptions as a, resolveTailwindV4Source as i, defineConfig as n, createTailwindV4Engine as o, mountTailwindcssPatchCommands as r, createTailwindcssPatchCli as t };
@@ -0,0 +1,232 @@
1
+ const require_chunk = require("./chunk-8l464Juk.js");
2
+ const require_validate = require("./validate-BuhhSYBe.js");
3
+ let node_module = require("node:module");
4
+ let node_process = require("node:process");
5
+ node_process = require_chunk.__toESM(node_process);
6
+ let pathe = require("pathe");
7
+ pathe = require_chunk.__toESM(pathe);
8
+ let node_fs = require("node:fs");
9
+ //#region src/v4/engine.ts
10
+ async function collectRawCandidates(source, options) {
11
+ const rawCandidates = /* @__PURE__ */ new Set();
12
+ for (const candidate of options?.candidates ?? []) rawCandidates.add(candidate);
13
+ for (const candidateSource of options?.sources ?? []) {
14
+ const candidates = await require_validate.extractRawCandidatesWithPositions(candidateSource.content, candidateSource.extension);
15
+ for (const candidate of candidates) rawCandidates.add(candidate.rawCandidate);
16
+ }
17
+ const inlineSources = require_validate.extractTailwindV4InlineSourceCandidates(source.css);
18
+ for (const candidate of inlineSources.included) rawCandidates.add(candidate);
19
+ for (const candidate of inlineSources.excluded) rawCandidates.delete(candidate);
20
+ return rawCandidates;
21
+ }
22
+ function createTailwindV4Engine(source) {
23
+ return {
24
+ source,
25
+ loadDesignSystem() {
26
+ return require_validate.loadTailwindV4DesignSystem(source);
27
+ },
28
+ async validateCandidates(candidates) {
29
+ return require_validate.resolveValidTailwindV4Candidates(await require_validate.loadTailwindV4DesignSystem(source), candidates);
30
+ },
31
+ async generate(options) {
32
+ const rawCandidates = await collectRawCandidates(source, options);
33
+ const classSet = require_validate.resolveValidTailwindV4Candidates(await require_validate.loadTailwindV4DesignSystem(source), rawCandidates);
34
+ const inlineSources = require_validate.extractTailwindV4InlineSourceCandidates(source.css);
35
+ for (const candidate of inlineSources.excluded) classSet.delete(candidate);
36
+ const { compiled, dependencies } = await require_validate.compileTailwindV4Source(source);
37
+ return {
38
+ css: compiled.build(Array.from(classSet)),
39
+ classSet,
40
+ rawCandidates,
41
+ dependencies: Array.from(dependencies),
42
+ sources: compiled.sources,
43
+ root: compiled.root
44
+ };
45
+ }
46
+ };
47
+ }
48
+ //#endregion
49
+ //#region src/v4/source.ts
50
+ function resolveBase(value, fallback) {
51
+ return value === void 0 ? fallback : pathe.default.isAbsolute(value) ? pathe.default.resolve(value) : pathe.default.resolve(fallback, value);
52
+ }
53
+ function uniquePaths(values) {
54
+ const result = [];
55
+ for (const value of values) {
56
+ if (!value) continue;
57
+ const resolved = pathe.default.resolve(value);
58
+ if (!result.includes(resolved)) result.push(resolved);
59
+ }
60
+ return result;
61
+ }
62
+ function toCssImportPath(value) {
63
+ return value.replaceAll("\\", "/");
64
+ }
65
+ function quoteCssImport(value) {
66
+ return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
67
+ }
68
+ function isPostcssPluginSpecifier(packageName) {
69
+ return packageName === "@tailwindcss/postcss" || /(?:^|[/\\])@tailwindcss[/\\]postcss(?:[/\\]|$)/.test(packageName) || /(?:^|[/\\])postcss(?:[/\\]|$)/i.test(packageName) || /postcss\.config\.[cm]?[jt]s$/i.test(packageName);
70
+ }
71
+ function createDefaultCss(packageName) {
72
+ return `@import "${quoteCssImport(toCssImportPath(packageName && !isPostcssPluginSpecifier(packageName) ? packageName : "tailwindcss"))}";`;
73
+ }
74
+ async function pathExists(filePath) {
75
+ try {
76
+ await node_fs.promises.access(filePath);
77
+ return true;
78
+ } catch {
79
+ return false;
80
+ }
81
+ }
82
+ async function resolveCssEntries(entries, projectRoot, base) {
83
+ const resolvedEntries = entries.map((entry) => ({
84
+ original: entry,
85
+ absolute: pathe.default.isAbsolute(entry) ? pathe.default.resolve(entry) : pathe.default.resolve(projectRoot, entry)
86
+ }));
87
+ const resolvedBase = base ?? pathe.default.dirname(resolvedEntries[0]?.absolute ?? projectRoot);
88
+ const dependencies = resolvedEntries.map((entry) => entry.absolute);
89
+ const cssParts = [];
90
+ for (const entry of resolvedEntries) {
91
+ if (await pathExists(entry.absolute)) {
92
+ cssParts.push(await node_fs.promises.readFile(entry.absolute, "utf8"));
93
+ continue;
94
+ }
95
+ const importPath = pathe.default.isAbsolute(entry.original) ? entry.absolute : pathe.default.relative(resolvedBase, entry.absolute);
96
+ cssParts.push(`@import "${quoteCssImport(toCssImportPath(importPath))}";`);
97
+ }
98
+ return {
99
+ base: resolvedBase,
100
+ css: cssParts.join("\n"),
101
+ dependencies
102
+ };
103
+ }
104
+ function normalizeResolvedSource(source) {
105
+ const baseFallbacks = uniquePaths([
106
+ ...source.baseFallbacks,
107
+ source.projectRoot,
108
+ source.cwd
109
+ ]).filter((base) => base !== source.base);
110
+ return {
111
+ projectRoot: source.projectRoot,
112
+ base: source.base,
113
+ baseFallbacks,
114
+ css: source.css,
115
+ dependencies: Array.from(new Set(source.dependencies.map((dependency) => pathe.default.resolve(dependency))))
116
+ };
117
+ }
118
+ async function resolveTailwindV4Source(options = {}) {
119
+ const projectRoot = resolveBase(options.projectRoot, node_process.default.cwd());
120
+ const cwd = resolveBase(options.cwd, projectRoot);
121
+ const configuredBase = options.base === void 0 ? void 0 : resolveBase(options.base, projectRoot);
122
+ const baseFallbacks = uniquePaths(options.baseFallbacks?.map((base) => resolveBase(base, projectRoot)) ?? []);
123
+ if (options.css !== void 0) return normalizeResolvedSource({
124
+ projectRoot,
125
+ cwd,
126
+ base: configuredBase ?? cwd,
127
+ baseFallbacks,
128
+ css: options.css,
129
+ dependencies: []
130
+ });
131
+ if (options.cssEntries?.length) {
132
+ const entries = await resolveCssEntries(options.cssEntries, projectRoot, configuredBase);
133
+ return normalizeResolvedSource({
134
+ projectRoot,
135
+ cwd,
136
+ base: entries.base,
137
+ baseFallbacks,
138
+ css: entries.css,
139
+ dependencies: entries.dependencies
140
+ });
141
+ }
142
+ return normalizeResolvedSource({
143
+ projectRoot,
144
+ cwd,
145
+ base: configuredBase ?? cwd,
146
+ baseFallbacks,
147
+ css: createDefaultCss(options.packageName),
148
+ dependencies: []
149
+ });
150
+ }
151
+ function resolveConfigDir(config, projectRoot) {
152
+ if (!config) return;
153
+ const configPath = pathe.default.isAbsolute(config) ? config : pathe.default.resolve(projectRoot, config);
154
+ return pathe.default.dirname(configPath);
155
+ }
156
+ function createSourceOptionsFromNormalizedPatchOptions(options) {
157
+ const v4 = options.tailwind.v4;
158
+ const configDir = resolveConfigDir(options.tailwind.config, options.projectRoot);
159
+ const baseFallbacks = uniquePaths([
160
+ v4?.configuredBase,
161
+ options.tailwind.cwd,
162
+ options.projectRoot,
163
+ configDir
164
+ ]);
165
+ return {
166
+ projectRoot: options.projectRoot,
167
+ ...options.tailwind.cwd === void 0 ? {} : { cwd: options.tailwind.cwd },
168
+ ...v4?.configuredBase === void 0 ? {} : { base: v4.configuredBase },
169
+ baseFallbacks,
170
+ ...v4?.css === void 0 ? {} : { css: v4.css },
171
+ ...v4?.cssEntries === void 0 ? {} : { cssEntries: v4.cssEntries },
172
+ packageName: options.tailwind.packageName
173
+ };
174
+ }
175
+ function tailwindV4SourceOptionsFromPatchOptions(options) {
176
+ return createSourceOptionsFromNormalizedPatchOptions(require_validate.normalizeOptions(options));
177
+ }
178
+ async function resolveTailwindV4SourceFromPatchOptions(options) {
179
+ return resolveTailwindV4Source(tailwindV4SourceOptionsFromPatchOptions(options));
180
+ }
181
+ //#endregion
182
+ //#region src/index.bundle.ts
183
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
184
+ function loadCliModule() {
185
+ return require$1("./commands/cli-runtime.js");
186
+ }
187
+ function mountTailwindcssPatchCommands(cli, options = {}) {
188
+ return loadCliModule().mountTailwindcssPatchCommands(cli, options);
189
+ }
190
+ function createTailwindcssPatchCli(options = {}) {
191
+ return loadCliModule().createTailwindcssPatchCli(options);
192
+ }
193
+ function defineConfig(config) {
194
+ return config;
195
+ }
196
+ //#endregion
197
+ Object.defineProperty(exports, "createTailwindV4Engine", {
198
+ enumerable: true,
199
+ get: function() {
200
+ return createTailwindV4Engine;
201
+ }
202
+ });
203
+ Object.defineProperty(exports, "createTailwindcssPatchCli", {
204
+ enumerable: true,
205
+ get: function() {
206
+ return createTailwindcssPatchCli;
207
+ }
208
+ });
209
+ Object.defineProperty(exports, "defineConfig", {
210
+ enumerable: true,
211
+ get: function() {
212
+ return defineConfig;
213
+ }
214
+ });
215
+ Object.defineProperty(exports, "mountTailwindcssPatchCommands", {
216
+ enumerable: true,
217
+ get: function() {
218
+ return mountTailwindcssPatchCommands;
219
+ }
220
+ });
221
+ Object.defineProperty(exports, "resolveTailwindV4Source", {
222
+ enumerable: true,
223
+ get: function() {
224
+ return resolveTailwindV4Source;
225
+ }
226
+ });
227
+ Object.defineProperty(exports, "resolveTailwindV4SourceFromPatchOptions", {
228
+ enumerable: true,
229
+ get: function() {
230
+ return resolveTailwindV4SourceFromPatchOptions;
231
+ }
232
+ });
package/dist/index.d.mts CHANGED
@@ -77,9 +77,74 @@ interface PatchStatusContext {
77
77
  }
78
78
  declare function getPatchStatusReport(context: PatchStatusContext): PatchStatusReport;
79
79
  //#endregion
80
+ //#region src/v4/types.d.ts
81
+ interface TailwindV4SourceOptions {
82
+ projectRoot?: string;
83
+ cwd?: string;
84
+ base?: string;
85
+ baseFallbacks?: string[];
86
+ css?: string;
87
+ cssEntries?: string[];
88
+ packageName?: string;
89
+ }
90
+ interface TailwindV4ResolvedSource {
91
+ projectRoot: string;
92
+ base: string;
93
+ baseFallbacks: string[];
94
+ css: string;
95
+ dependencies: string[];
96
+ }
97
+ interface TailwindV4CandidateSource {
98
+ content: string;
99
+ extension?: string;
100
+ }
101
+ interface TailwindV4GenerateOptions {
102
+ candidates?: Iterable<string>;
103
+ sources?: TailwindV4CandidateSource[];
104
+ }
105
+ interface TailwindV4SourcePattern {
106
+ base: string;
107
+ pattern: string;
108
+ negated: boolean;
109
+ }
110
+ interface TailwindV4GenerateResult {
111
+ css: string;
112
+ classSet: Set<string>;
113
+ rawCandidates: Set<string>;
114
+ dependencies: string[];
115
+ sources: TailwindV4SourcePattern[];
116
+ root: null | 'none' | {
117
+ base: string;
118
+ pattern: string;
119
+ };
120
+ }
121
+ interface TailwindV4DesignSystem {
122
+ parseCandidate: (candidate: string) => unknown[];
123
+ candidatesToCss: (candidates: string[]) => Array<string | null | undefined>;
124
+ }
125
+ interface TailwindV4Engine {
126
+ source: TailwindV4ResolvedSource;
127
+ loadDesignSystem: () => Promise<TailwindV4DesignSystem>;
128
+ validateCandidates: (candidates: Iterable<string>) => Promise<Set<string>>;
129
+ generate: (options?: TailwindV4GenerateOptions) => Promise<TailwindV4GenerateResult>;
130
+ }
131
+ //#endregion
132
+ //#region src/v4/candidates.d.ts
133
+ declare function resolveValidTailwindV4Candidates(designSystem: TailwindV4DesignSystem, candidates: Iterable<string>): Set<string>;
134
+ //#endregion
135
+ //#region src/v4/engine.d.ts
136
+ declare function createTailwindV4Engine(source: TailwindV4ResolvedSource): TailwindV4Engine;
137
+ //#endregion
138
+ //#region src/v4/node-adapter.d.ts
139
+ declare function loadTailwindV4DesignSystem(source: TailwindV4ResolvedSource): Promise<TailwindV4DesignSystem>;
140
+ //#endregion
141
+ //#region src/v4/source.d.ts
142
+ declare function resolveTailwindV4Source(options?: TailwindV4SourceOptions): Promise<TailwindV4ResolvedSource>;
143
+ declare function resolveTailwindV4SourceFromPatchOptions(options: TailwindCssPatchOptions): Promise<TailwindV4ResolvedSource>;
144
+ //#endregion
80
145
  //#region src/index.bundle.d.ts
81
146
  declare function mountTailwindcssPatchCommands(cli: CAC, options?: TailwindcssPatchCliMountOptions): CAC;
82
147
  declare function createTailwindcssPatchCli(options?: TailwindcssPatchCliOptions): CAC;
83
148
  declare function defineConfig<T extends TailwindcssMangleConfig>(config: T): T;
84
149
  //#endregion
85
- export { ApplyOptions, CacheClearOptions, CacheClearResult, CacheClearScope, CacheContextMetadata, CacheOptions, CacheReadMeta, CacheStore, CacheStrategy, type ConfigFileMigrationEntry, type ConfigFileMigrationReport, ExposeContextOptions, ExtendLengthUnitsOptions, ExtractOptions, ExtractResult, ILengthUnitsPatchOptions, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, type MigrateConfigFilesOptions, NormalizedTailwindCssPatchOptions, PatchCheckStatus, PatchName, PatchStatusEntry, PatchStatusReport, type RestoreConfigFilesOptions, type RestoreConfigFilesResult, TailwindCssOptions, type TailwindCssPatchOptions, TailwindPatchRuntime, TailwindTokenByFileMap, TailwindTokenFileKey, TailwindTokenLocation, TailwindTokenReport, TailwindV2Options, TailwindV3Options, TailwindV4Options, TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandContext, type TailwindcssPatchCommandHandler, type TailwindcssPatchCommandHandlerMap, type TailwindcssPatchCommandOptionDefinition, type TailwindcssPatchCommandOptions, TailwindcssPatcher, TailwindcssRuntimeContext, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, type ValidateFailureReason, type ValidateFailureSummary, type ValidateJsonFailurePayload, type ValidateJsonSuccessPayload, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, defineConfig, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };
150
+ export { ApplyOptions, CacheClearOptions, CacheClearResult, CacheClearScope, CacheContextMetadata, CacheOptions, CacheReadMeta, CacheStore, CacheStrategy, type ConfigFileMigrationEntry, type ConfigFileMigrationReport, ExposeContextOptions, ExtendLengthUnitsOptions, ExtractOptions, ExtractResult, ILengthUnitsPatchOptions, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, type MigrateConfigFilesOptions, NormalizedTailwindCssPatchOptions, PatchCheckStatus, PatchName, PatchStatusEntry, PatchStatusReport, type RestoreConfigFilesOptions, type RestoreConfigFilesResult, TailwindCssOptions, type TailwindCssPatchOptions, TailwindPatchRuntime, TailwindTokenByFileMap, TailwindTokenFileKey, TailwindTokenLocation, TailwindTokenReport, TailwindV2Options, TailwindV3Options, type TailwindV4CandidateSource, type TailwindV4DesignSystem, type TailwindV4Engine, type TailwindV4GenerateOptions, type TailwindV4GenerateResult, TailwindV4Options, type TailwindV4ResolvedSource, type TailwindV4SourceOptions, TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandContext, type TailwindcssPatchCommandHandler, type TailwindcssPatchCommandHandlerMap, type TailwindcssPatchCommandOptionDefinition, type TailwindcssPatchCommandOptions, TailwindcssPatcher, TailwindcssRuntimeContext, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, type ValidateFailureReason, type ValidateFailureSummary, type ValidateJsonFailurePayload, type ValidateJsonSuccessPayload, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindV4Engine, createTailwindcssPatchCli, defineConfig, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, loadTailwindV4DesignSystem, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveValidTailwindV4Candidates, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };
package/dist/index.d.ts CHANGED
@@ -77,9 +77,74 @@ interface PatchStatusContext {
77
77
  }
78
78
  declare function getPatchStatusReport(context: PatchStatusContext): PatchStatusReport;
79
79
  //#endregion
80
+ //#region src/v4/types.d.ts
81
+ interface TailwindV4SourceOptions {
82
+ projectRoot?: string;
83
+ cwd?: string;
84
+ base?: string;
85
+ baseFallbacks?: string[];
86
+ css?: string;
87
+ cssEntries?: string[];
88
+ packageName?: string;
89
+ }
90
+ interface TailwindV4ResolvedSource {
91
+ projectRoot: string;
92
+ base: string;
93
+ baseFallbacks: string[];
94
+ css: string;
95
+ dependencies: string[];
96
+ }
97
+ interface TailwindV4CandidateSource {
98
+ content: string;
99
+ extension?: string;
100
+ }
101
+ interface TailwindV4GenerateOptions {
102
+ candidates?: Iterable<string>;
103
+ sources?: TailwindV4CandidateSource[];
104
+ }
105
+ interface TailwindV4SourcePattern {
106
+ base: string;
107
+ pattern: string;
108
+ negated: boolean;
109
+ }
110
+ interface TailwindV4GenerateResult {
111
+ css: string;
112
+ classSet: Set<string>;
113
+ rawCandidates: Set<string>;
114
+ dependencies: string[];
115
+ sources: TailwindV4SourcePattern[];
116
+ root: null | 'none' | {
117
+ base: string;
118
+ pattern: string;
119
+ };
120
+ }
121
+ interface TailwindV4DesignSystem {
122
+ parseCandidate: (candidate: string) => unknown[];
123
+ candidatesToCss: (candidates: string[]) => Array<string | null | undefined>;
124
+ }
125
+ interface TailwindV4Engine {
126
+ source: TailwindV4ResolvedSource;
127
+ loadDesignSystem: () => Promise<TailwindV4DesignSystem>;
128
+ validateCandidates: (candidates: Iterable<string>) => Promise<Set<string>>;
129
+ generate: (options?: TailwindV4GenerateOptions) => Promise<TailwindV4GenerateResult>;
130
+ }
131
+ //#endregion
132
+ //#region src/v4/candidates.d.ts
133
+ declare function resolveValidTailwindV4Candidates(designSystem: TailwindV4DesignSystem, candidates: Iterable<string>): Set<string>;
134
+ //#endregion
135
+ //#region src/v4/engine.d.ts
136
+ declare function createTailwindV4Engine(source: TailwindV4ResolvedSource): TailwindV4Engine;
137
+ //#endregion
138
+ //#region src/v4/node-adapter.d.ts
139
+ declare function loadTailwindV4DesignSystem(source: TailwindV4ResolvedSource): Promise<TailwindV4DesignSystem>;
140
+ //#endregion
141
+ //#region src/v4/source.d.ts
142
+ declare function resolveTailwindV4Source(options?: TailwindV4SourceOptions): Promise<TailwindV4ResolvedSource>;
143
+ declare function resolveTailwindV4SourceFromPatchOptions(options: TailwindCssPatchOptions): Promise<TailwindV4ResolvedSource>;
144
+ //#endregion
80
145
  //#region src/index.bundle.d.ts
81
146
  declare function mountTailwindcssPatchCommands(cli: CAC, options?: TailwindcssPatchCliMountOptions): CAC;
82
147
  declare function createTailwindcssPatchCli(options?: TailwindcssPatchCliOptions): CAC;
83
148
  declare function defineConfig<T extends TailwindcssMangleConfig>(config: T): T;
84
149
  //#endregion
85
- export { ApplyOptions, CacheClearOptions, CacheClearResult, CacheClearScope, CacheContextMetadata, CacheOptions, CacheReadMeta, CacheStore, CacheStrategy, type ConfigFileMigrationEntry, type ConfigFileMigrationReport, ExposeContextOptions, ExtendLengthUnitsOptions, ExtractOptions, ExtractResult, ILengthUnitsPatchOptions, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, type MigrateConfigFilesOptions, NormalizedTailwindCssPatchOptions, PatchCheckStatus, PatchName, PatchStatusEntry, PatchStatusReport, type RestoreConfigFilesOptions, type RestoreConfigFilesResult, TailwindCssOptions, type TailwindCssPatchOptions, TailwindPatchRuntime, TailwindTokenByFileMap, TailwindTokenFileKey, TailwindTokenLocation, TailwindTokenReport, TailwindV2Options, TailwindV3Options, TailwindV4Options, TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandContext, type TailwindcssPatchCommandHandler, type TailwindcssPatchCommandHandlerMap, type TailwindcssPatchCommandOptionDefinition, type TailwindcssPatchCommandOptions, TailwindcssPatcher, TailwindcssRuntimeContext, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, type ValidateFailureReason, type ValidateFailureSummary, type ValidateJsonFailurePayload, type ValidateJsonSuccessPayload, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, defineConfig, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };
150
+ export { ApplyOptions, CacheClearOptions, CacheClearResult, CacheClearScope, CacheContextMetadata, CacheOptions, CacheReadMeta, CacheStore, CacheStrategy, type ConfigFileMigrationEntry, type ConfigFileMigrationReport, ExposeContextOptions, ExtendLengthUnitsOptions, ExtractOptions, ExtractResult, ILengthUnitsPatchOptions, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, type MigrateConfigFilesOptions, NormalizedTailwindCssPatchOptions, PatchCheckStatus, PatchName, PatchStatusEntry, PatchStatusReport, type RestoreConfigFilesOptions, type RestoreConfigFilesResult, TailwindCssOptions, type TailwindCssPatchOptions, TailwindPatchRuntime, TailwindTokenByFileMap, TailwindTokenFileKey, TailwindTokenLocation, TailwindTokenReport, TailwindV2Options, TailwindV3Options, type TailwindV4CandidateSource, type TailwindV4DesignSystem, type TailwindV4Engine, type TailwindV4GenerateOptions, type TailwindV4GenerateResult, TailwindV4Options, type TailwindV4ResolvedSource, type TailwindV4SourceOptions, TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandContext, type TailwindcssPatchCommandHandler, type TailwindcssPatchCommandHandlerMap, type TailwindcssPatchCommandOptionDefinition, type TailwindcssPatchCommandOptions, TailwindcssPatcher, TailwindcssRuntimeContext, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, type ValidateFailureReason, type ValidateFailureSummary, type ValidateJsonFailurePayload, type ValidateJsonSuccessPayload, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindV4Engine, createTailwindcssPatchCli, defineConfig, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, loadTailwindV4DesignSystem, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveValidTailwindV4Candidates, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_validate = require("./validate-B8H-8rWO.js");
3
- const require_index_bundle = require("./index.bundle-BGBMTX9A.js");
2
+ const require_validate = require("./validate-BuhhSYBe.js");
3
+ const require_index_bundle = require("./index.bundle-C4Y53Ygf.js");
4
4
  exports.CacheStore = require_validate.CacheStore;
5
5
  exports.MIGRATION_REPORT_KIND = require_validate.MIGRATION_REPORT_KIND;
6
6
  exports.MIGRATION_REPORT_SCHEMA_VERSION = require_validate.MIGRATION_REPORT_SCHEMA_VERSION;
@@ -10,6 +10,7 @@ exports.VALIDATE_FAILURE_REASONS = require_validate.VALIDATE_FAILURE_REASONS;
10
10
  exports.ValidateCommandError = require_validate.ValidateCommandError;
11
11
  exports.collectClassesFromContexts = require_validate.collectClassesFromContexts;
12
12
  exports.collectClassesFromTailwindV4 = require_validate.collectClassesFromTailwindV4;
13
+ exports.createTailwindV4Engine = require_index_bundle.createTailwindV4Engine;
13
14
  exports.createTailwindcssPatchCli = require_index_bundle.createTailwindcssPatchCli;
14
15
  exports.defineConfig = require_index_bundle.defineConfig;
15
16
  exports.extractProjectCandidatesWithPositions = require_validate.extractProjectCandidatesWithPositions;
@@ -19,10 +20,14 @@ exports.extractValidCandidates = require_validate.extractValidCandidates;
19
20
  exports.getPatchStatusReport = require_validate.getPatchStatusReport;
20
21
  exports.groupTokensByFile = require_validate.groupTokensByFile;
21
22
  exports.loadRuntimeContexts = require_validate.loadRuntimeContexts;
23
+ exports.loadTailwindV4DesignSystem = require_validate.loadTailwindV4DesignSystem;
22
24
  exports.logger = require_validate.logger;
23
25
  exports.migrateConfigFiles = require_validate.migrateConfigFiles;
24
26
  exports.mountTailwindcssPatchCommands = require_index_bundle.mountTailwindcssPatchCommands;
25
27
  exports.normalizeOptions = require_validate.normalizeOptions;
28
+ exports.resolveTailwindV4Source = require_index_bundle.resolveTailwindV4Source;
29
+ exports.resolveTailwindV4SourceFromPatchOptions = require_index_bundle.resolveTailwindV4SourceFromPatchOptions;
30
+ exports.resolveValidTailwindV4Candidates = require_validate.resolveValidTailwindV4Candidates;
26
31
  exports.restoreConfigFiles = require_validate.restoreConfigFiles;
27
32
  exports.runTailwindBuild = require_validate.runTailwindBuild;
28
33
  exports.tailwindcssPatchCommands = require_validate.tailwindcssPatchCommands;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { C as normalizeOptions, T as logger, _ as extractRawCandidates, a as tailwindcssPatchCommands, b as groupTokensByFile, c as MIGRATION_REPORT_KIND, d as getPatchStatusReport, f as runTailwindBuild, g as extractProjectCandidatesWithPositions, h as collectClassesFromTailwindV4, l as MIGRATION_REPORT_SCHEMA_VERSION, m as collectClassesFromContexts, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, p as loadRuntimeContexts, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher, v as extractRawCandidatesWithPositions, w as CacheStore, y as extractValidCandidates } from "./validate-BI8356RT.mjs";
2
- import { n as defineConfig, r as mountTailwindcssPatchCommands, t as createTailwindcssPatchCli } from "./index.bundle-ByrTqrr3.mjs";
3
- export { CacheStore, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, TailwindcssPatcher, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, defineConfig, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };
1
+ import { D as normalizeOptions, O as CacheStore, S as loadTailwindV4DesignSystem, _ as extractRawCandidates, a as tailwindcssPatchCommands, b as groupTokensByFile, c as MIGRATION_REPORT_KIND, d as getPatchStatusReport, f as runTailwindBuild, g as extractProjectCandidatesWithPositions, h as collectClassesFromTailwindV4, k as logger, l as MIGRATION_REPORT_SCHEMA_VERSION, m as collectClassesFromContexts, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, p as loadRuntimeContexts, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher, v as extractRawCandidatesWithPositions, w as resolveValidTailwindV4Candidates, y as extractValidCandidates } from "./validate-4FCU-Ql3.mjs";
2
+ import { a as resolveTailwindV4SourceFromPatchOptions, i as resolveTailwindV4Source, n as defineConfig, o as createTailwindV4Engine, r as mountTailwindcssPatchCommands, t as createTailwindcssPatchCli } from "./index.bundle-0Fe7Jx8V.mjs";
3
+ export { CacheStore, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, TailwindcssPatcher, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindV4Engine, createTailwindcssPatchCli, defineConfig, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, loadTailwindV4DesignSystem, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveValidTailwindV4Candidates, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };