tailwindcss-patch 9.4.4 → 9.5.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.
Files changed (36) hide show
  1. package/dist/{cli-CLvyx3xl.mjs → cli-Bv15iTiT.mjs} +1 -1
  2. package/dist/{cli-srv0kRlt.js → cli-Db2YAbkN.js} +3 -2
  3. package/dist/cli.js +2 -2
  4. package/dist/cli.mjs +2 -2
  5. package/dist/commands/cli-runtime.d.mts +1 -1
  6. package/dist/commands/cli-runtime.d.ts +1 -1
  7. package/dist/commands/cli-runtime.js +2 -2
  8. package/dist/commands/cli-runtime.mjs +2 -2
  9. package/dist/{dist-Dn7cMVhi.js → dist-wp0o36Ns.js} +1 -1
  10. package/dist/index.d.mts +7 -149
  11. package/dist/index.d.ts +8 -150
  12. package/dist/index.js +294 -521
  13. package/dist/index.mjs +6 -471
  14. package/dist/{validate-oAkURzUC.d.mts → validate-B5-08lrU.d.ts} +8 -252
  15. package/dist/{validate-RpdgpjgT.js → validate-C8oLv32F.js} +79 -1705
  16. package/dist/{validate-BuqRodYI.d.ts → validate-CgrG4aAY.d.mts} +8 -252
  17. package/dist/{validate-CUNJFfHh.mjs → validate-Cu1G06lO.mjs} +5 -1402
  18. package/package.json +5 -7
  19. package/src/api/tailwindcss-patcher.ts +3 -2
  20. package/src/extraction/candidate-extractor.ts +17 -701
  21. package/src/extraction/split-candidate-tokens.ts +5 -101
  22. package/src/options/types.ts +1 -2
  23. package/src/style-candidates.ts +5 -35
  24. package/src/style-generator.ts +11 -80
  25. package/src/types.ts +21 -95
  26. package/src/v3/index.ts +2 -2
  27. package/src/v4/index.ts +104 -28
  28. package/src/v3/style-generator.ts +0 -384
  29. package/src/v4/bare-arbitrary-values.ts +0 -545
  30. package/src/v4/candidates.ts +0 -316
  31. package/src/v4/engine.ts +0 -112
  32. package/src/v4/node-adapter.ts +0 -207
  33. package/src/v4/source-scan.ts +0 -432
  34. package/src/v4/source.ts +0 -235
  35. package/src/v4/style-generator.ts +0 -44
  36. package/src/v4/types.ts +0 -103
package/dist/index.js CHANGED
@@ -1,315 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_validate = require("./validate-RpdgpjgT.js");
2
+ const require_validate = require("./validate-C8oLv32F.js");
3
3
  let node_module = require("node:module");
4
- let node_process = require("node:process");
5
- node_process = require_validate.__toESM(node_process);
6
4
  let pathe = require("pathe");
7
5
  pathe = require_validate.__toESM(pathe);
8
- let node_fs = require("node:fs");
9
- let postcss = require("postcss");
10
- postcss = require_validate.__toESM(postcss);
11
- //#region src/extraction/split-candidate-tokens.ts
12
- const validateCandidateTokenRE = /[\w\u00A0-\uFFFF%-?]/;
13
- function isValidCandidateToken(token = "") {
14
- return validateCandidateTokenRE.test(token);
15
- }
16
- const SPLIT_CACHE_LIMIT = 8192;
17
- const ESCAPED_WHITESPACE_RE = /\\[nrt]/g;
18
- const splitCache = /* @__PURE__ */ new Map();
19
- function isSplitter(char, bracketDepth) {
20
- return bracketDepth === 0 && (char === "\"" || /\s/.test(char));
21
- }
22
- function hasClosingQuotedArbitraryValue(code, start, quote) {
23
- for (let index = start; index < code.length; index++) {
24
- if (code[index] === "\\") {
25
- index++;
26
- continue;
27
- }
28
- if (code[index] === quote) return code.includes("]", index + 1);
29
- }
30
- return false;
31
- }
32
- function splitBracketAware(code) {
33
- const result = [];
34
- let bracketDepth = 0;
35
- let bracketQuote;
36
- let start = 0;
37
- for (let index = 0; index < code.length; index++) {
38
- const char = code[index];
39
- if (char === void 0) continue;
40
- if (bracketDepth > 0 && char === "\\") {
41
- index++;
42
- continue;
43
- }
44
- if (bracketDepth > 0 && (char === "\"" || char === "'")) {
45
- if (bracketQuote === char) bracketQuote = void 0;
46
- else if (bracketQuote === void 0 && hasClosingQuotedArbitraryValue(code, index + 1, char)) bracketQuote = char;
47
- }
48
- if (bracketQuote === void 0) {
49
- if (char === "[" && code.includes("]", index + 1)) bracketDepth++;
50
- else if (char === "]" && bracketDepth > 0) bracketDepth--;
51
- }
52
- if (!isSplitter(char, bracketDepth)) continue;
53
- const candidate = code.slice(start, index);
54
- if (isValidCandidateToken(candidate)) result.push(candidate);
55
- start = index + 1;
56
- }
57
- const candidate = code.slice(start);
58
- if (isValidCandidateToken(candidate)) result.push(candidate);
59
- return result;
60
- }
61
- function splitCandidateTokens(code) {
62
- const cached = splitCache.get(code);
63
- if (cached) return cached;
64
- const result = splitBracketAware(code.includes("\\") ? code.replace(ESCAPED_WHITESPACE_RE, " ") : code);
65
- if (splitCache.size >= SPLIT_CACHE_LIMIT) splitCache.clear();
66
- splitCache.set(code, result);
67
- return result;
68
- }
69
- //#endregion
70
- //#region src/style-candidates.ts
71
- async function collectTailwindStyleCandidates(options = {}) {
72
- const candidates = /* @__PURE__ */ new Set();
73
- for (const candidate of options.candidates ?? []) candidates.add(candidate);
74
- for (const source of options.sources ?? []) {
75
- const sourceCandidates = await require_validate.extractSourceCandidates(source.content, source.extension, { bareArbitraryValues: options.bareArbitraryValues });
76
- for (const candidate of sourceCandidates) candidates.add(candidate);
77
- }
78
- return candidates;
79
- }
80
- //#endregion
81
- //#region src/v3/style-generator.ts
82
- function createPackageRequire(cwd) {
83
- return (0, node_module.createRequire)(pathe.default.join(pathe.default.resolve(cwd ?? node_process.default.cwd()), "package.json"));
84
- }
85
- function createDefaultTailwindV3Config(tokens) {
86
- return {
87
- content: [{
88
- raw: [...tokens].join(" "),
89
- extension: "html"
90
- }],
91
- theme: { extend: {} },
92
- plugins: []
93
- };
94
- }
95
- function getDefaultExport(module) {
96
- if (module && typeof module === "object" && "default" in module) return module.default;
97
- return module;
98
- }
99
- function loadTailwindV3Modules(options) {
100
- const packageName = options.packageName ?? "tailwindcss";
101
- const moduleRequire = createPackageRequire(options.cwd);
102
- const resolveConfig = getDefaultExport(moduleRequire(`${packageName}/lib/public/resolve-config`));
103
- const contextModule = moduleRequire(`${packageName}/lib/lib/setupContextUtils`);
104
- const generateRulesModule = moduleRequire(`${packageName}/lib/lib/generateRules`);
105
- const collapseAdjacentRulesModule = moduleRequire(`${packageName}/lib/lib/collapseAdjacentRules`);
106
- const collapseDuplicateDeclarationsModule = moduleRequire(`${packageName}/lib/lib/collapseDuplicateDeclarations`);
107
- const processTailwindFeaturesModule = moduleRequire(`${packageName}/lib/processTailwindFeatures`);
108
- const resolveDefaultsAtRulesModule = moduleRequire(`${packageName}/lib/lib/resolveDefaultsAtRules`);
109
- const sharedStateModule = moduleRequire(`${packageName}/lib/lib/sharedState`);
110
- const validateConfigModule = moduleRequire(`${packageName}/lib/util/validateConfig.js`);
111
- return {
112
- collapseAdjacentRules: getDefaultExport(collapseAdjacentRulesModule),
113
- collapseDuplicateDeclarations: getDefaultExport(collapseDuplicateDeclarationsModule),
114
- createContext: contextModule.createContext,
115
- generateRules: generateRulesModule.generateRules,
116
- notOnDemandCandidate: sharedStateModule.NOT_ON_DEMAND ?? "*",
117
- processTailwindFeatures: getDefaultExport(processTailwindFeaturesModule),
118
- resolveDefaultsAtRules: getDefaultExport(resolveDefaultsAtRulesModule),
119
- resolveConfig,
120
- validateConfig: validateConfigModule.validateConfig
121
- };
122
- }
123
- function createRawContentEntries(candidates, sources) {
124
- const entries = [];
125
- const candidateContent = [...candidates].join(" ");
126
- if (candidateContent.length > 0) entries.push({
127
- raw: candidateContent,
128
- extension: "html"
129
- });
130
- for (const source of sources) entries.push({
131
- raw: source.content,
132
- extension: source.extension ?? "html"
133
- });
134
- return entries;
135
- }
136
- function createChangedContentEntries(candidates, sources) {
137
- return createRawContentEntries(candidates, sources).map((entry) => ({
138
- content: entry.raw,
139
- extension: entry.extension
140
- }));
141
- }
142
- function createTailwindConfigWithContent(config, tokens, sources) {
143
- const userContent = config?.content;
144
- return {
145
- ...createDefaultTailwindV3Config(tokens),
146
- ...config ?? {},
147
- content: [...Array.isArray(userContent) ? userContent : [], ...createRawContentEntries(tokens, sources)]
148
- };
149
- }
150
- function isDirectUtilitiesOnlyCss(css) {
151
- return css.replace(/\s+/g, "") === "@tailwindutilities;";
152
- }
153
- function sortCandidates(candidates) {
154
- return [...candidates].sort((a, z) => {
155
- if (a === z) return 0;
156
- return a < z ? -1 : 1;
157
- });
158
- }
159
- function appendUtilityRules(root, context, rules) {
160
- const sortedRules = context.offsets.sort(rules);
161
- for (const [sort, rule] of sortedRules) {
162
- const tailwindRaw = rule.raws.tailwind;
163
- if (sort.layer === "utilities" || sort.layer === "variants" && tailwindRaw?.parentLayer === "utilities") root.append(rule.clone());
164
- }
165
- }
166
- function collectClassSet(context, notOnDemandCandidate) {
167
- const classSet = /* @__PURE__ */ new Set();
168
- for (const candidate of context.classCache.keys()) if (String(candidate) !== String(notOnDemandCandidate)) classSet.add(candidate);
169
- return classSet;
170
- }
171
- function collectDependencyMessages(result) {
172
- const dependencies = /* @__PURE__ */ new Set();
173
- for (const message of result.messages) {
174
- const file = message.file;
175
- if (message.type === "dependency" && typeof file === "string") dependencies.add(file);
176
- }
177
- return [...dependencies];
178
- }
179
- function buildStylesheetNodes(rules, context, layers) {
180
- const sortedRules = context.offsets.sort(rules);
181
- const nodes = [];
182
- const layerSet = new Set(layers);
183
- for (const [sort, rule] of sortedRules) {
184
- const layer = sort.layer === "defaults" ? "base" : sort.layer;
185
- if (layerSet.has(layer)) nodes.push(rule.clone());
186
- }
187
- return nodes;
188
- }
189
- function createRootFromNodes(nodes) {
190
- const root = postcss.default.root();
191
- for (const node of nodes) root.append(node);
192
- return root;
193
- }
194
- async function generateTailwindV3Style(options = {}) {
195
- const tokens = await collectTailwindStyleCandidates(options);
196
- const { createContext, generateRules, resolveConfig } = loadTailwindV3Modules(options);
197
- const userContent = options.config?.content;
198
- const config = resolveConfig({
199
- ...createDefaultTailwindV3Config(tokens),
200
- ...options.config ?? {},
201
- content: [...Array.isArray(userContent) ? userContent : [], {
202
- raw: [...tokens].join(" "),
203
- extension: "html"
204
- }]
205
- });
206
- const context = createContext(config, [], postcss.default.root());
207
- return {
208
- version: 3,
209
- css: createRootFromNodes(buildStylesheetNodes(generateRules(tokens, context), context, options.layers ?? [
210
- "base",
211
- "components",
212
- "utilities",
213
- "variants"
214
- ])).toString(),
215
- tokens,
216
- classSet: new Set(context.classCache.keys()),
217
- sources: options.sources ?? [],
218
- config
219
- };
220
- }
221
- async function generateTailwindV3RawStyle(options = {}) {
222
- const tokens = await collectTailwindStyleCandidates(options);
223
- const { collapseAdjacentRules, collapseDuplicateDeclarations, createContext, generateRules, notOnDemandCandidate, processTailwindFeatures, resolveConfig, resolveDefaultsAtRules, validateConfig } = loadTailwindV3Modules(options);
224
- const css = options.css ?? "@tailwind utilities;";
225
- const config = validateConfig(resolveConfig(createTailwindConfigWithContent(options.config, tokens, options.sources ?? [])));
226
- const root = postcss.default.parse(css, { from: void 0 });
227
- const result = {
228
- css: "",
229
- messages: []
230
- };
231
- const changedContent = createChangedContentEntries(tokens, options.sources ?? []);
232
- const shouldUseDirectUtilities = options.directUtilitiesOnly === true || options.directUtilitiesOnly !== false && isDirectUtilitiesOnlyCss(css);
233
- let context;
234
- if (shouldUseDirectUtilities) {
235
- context = createContext(config, changedContent, root);
236
- generateRules(new Set(sortCandidates([notOnDemandCandidate, ...tokens])), context);
237
- root.removeAll();
238
- appendUtilityRules(root, context, [...context.ruleCache]);
239
- resolveDefaultsAtRules(context)(root, result);
240
- collapseAdjacentRules(context)(root, result);
241
- collapseDuplicateDeclarations(context)(root, result);
242
- } else {
243
- const setupContext = () => {
244
- return (currentRoot) => createContext(config, changedContent, currentRoot);
245
- };
246
- context = await processTailwindFeatures(setupContext)(root, result);
247
- }
248
- return {
249
- version: 3,
250
- css: root.toString(),
251
- tokens,
252
- classSet: collectClassSet(context, notOnDemandCandidate),
253
- context,
254
- dependencies: collectDependencyMessages(result),
255
- sources: options.sources ?? [],
256
- config
257
- };
258
- }
259
- //#endregion
260
- //#region src/v4/engine.ts
261
- function resolveScanSources(options, source, compiledRoot, compiledSources) {
262
- if (Array.isArray(options?.scanSources)) return options.scanSources;
263
- if (options?.scanSources === true) return require_validate.createTailwindV4CompiledSourceEntries(compiledRoot, compiledSources, source.base);
264
- return [];
265
- }
266
- async function collectRawCandidates(source, options, compiledRoot, compiledSources = []) {
267
- const rawCandidates = /* @__PURE__ */ new Set();
268
- const extractOptions = options?.bareArbitraryValues === void 0 ? void 0 : { bareArbitraryValues: options.bareArbitraryValues };
269
- for (const candidate of options?.candidates ?? []) rawCandidates.add(candidate);
270
- for (const candidateSource of options?.sources ?? []) {
271
- const candidates = await require_validate.extractRawCandidatesWithPositions(candidateSource.content, candidateSource.extension, extractOptions);
272
- for (const candidate of candidates) rawCandidates.add(candidate.rawCandidate);
273
- }
274
- const filesystemSources = resolveScanSources(options, source, compiledRoot, compiledSources);
275
- if (filesystemSources.length > 0) for (const candidate of await require_validate.extractRawCandidates(filesystemSources, extractOptions)) rawCandidates.add(candidate);
276
- const inlineSources = require_validate.extractTailwindV4InlineSourceCandidates(source.css);
277
- for (const candidate of inlineSources.included) rawCandidates.add(candidate);
278
- for (const candidate of inlineSources.excluded) rawCandidates.delete(candidate);
279
- return rawCandidates;
280
- }
281
- function createTailwindV4Engine(source) {
282
- return {
283
- source,
284
- loadDesignSystem() {
285
- return require_validate.loadTailwindV4DesignSystem(source);
286
- },
287
- async validateCandidates(candidates) {
288
- return require_validate.resolveValidTailwindV4Candidates(await require_validate.loadTailwindV4DesignSystem(source), candidates);
289
- },
290
- async generate(options) {
291
- const { compiled, dependencies } = await require_validate.compileTailwindV4Source(source);
292
- const rawCandidates = await collectRawCandidates(source, options, compiled.root, compiled.sources);
293
- const classSet = require_validate.resolveValidTailwindV4Candidates(await require_validate.loadTailwindV4DesignSystem(source), rawCandidates, { ...options?.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } });
294
- const inlineSources = require_validate.extractTailwindV4InlineSourceCandidates(source.css);
295
- for (const candidate of inlineSources.excluded) classSet.delete(candidate);
296
- const buildCandidates = require_validate.canonicalizeBareArbitraryValueCandidates(classSet, options?.bareArbitraryValues);
297
- return {
298
- css: require_validate.replaceBareArbitraryValueSelectors(compiled.build(buildCandidates), classSet, options?.bareArbitraryValues),
299
- classSet,
300
- rawCandidates,
301
- dependencies: Array.from(dependencies),
302
- sources: compiled.sources,
303
- root: compiled.root
304
- };
305
- }
306
- };
307
- }
308
- //#endregion
309
- //#region src/v4/source.ts
310
- function resolveBase(value, fallback) {
311
- return value === void 0 ? fallback : pathe.default.isAbsolute(value) ? pathe.default.resolve(value) : pathe.default.resolve(fallback, value);
312
- }
6
+ let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
7
+ let _tailwindcss_mangle_engine_v3 = require("@tailwindcss-mangle/engine/v3");
8
+ let _tailwindcss_mangle_engine_v4 = require("@tailwindcss-mangle/engine/v4");
9
+ //#region src/v4/index.ts
313
10
  function uniquePaths(values) {
314
11
  const result = [];
315
12
  for (const value of values) {
@@ -319,113 +16,6 @@ function uniquePaths(values) {
319
16
  }
320
17
  return result;
321
18
  }
322
- function toCssImportPath(value) {
323
- return value.replaceAll("\\", "/");
324
- }
325
- function quoteCssImport(value) {
326
- return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
327
- }
328
- function isPostcssPluginSpecifier(packageName) {
329
- return packageName === "@tailwindcss/postcss" || /(?:^|[/\\])@tailwindcss[/\\]postcss(?:[/\\]|$)/.test(packageName) || /(?:^|[/\\])postcss(?:[/\\]|$)/i.test(packageName) || /postcss\.config\.[cm]?[jt]s$/i.test(packageName);
330
- }
331
- function createDefaultCss(packageName) {
332
- return `@import "${quoteCssImport(toCssImportPath(packageName && !isPostcssPluginSpecifier(packageName) ? packageName : "tailwindcss"))}";`;
333
- }
334
- async function pathExists(filePath) {
335
- try {
336
- await node_fs.promises.access(filePath);
337
- return true;
338
- } catch {
339
- return false;
340
- }
341
- }
342
- async function resolveCssEntries(entries, projectRoot, base) {
343
- const resolvedEntries = entries.map((entry) => ({
344
- original: entry,
345
- absolute: pathe.default.isAbsolute(entry) ? pathe.default.resolve(entry) : pathe.default.resolve(projectRoot, entry)
346
- }));
347
- const resolvedBase = base ?? pathe.default.dirname(resolvedEntries[0]?.absolute ?? projectRoot);
348
- const dependencies = resolvedEntries.map((entry) => entry.absolute);
349
- const cssParts = [];
350
- for (const entry of resolvedEntries) {
351
- if (await pathExists(entry.absolute)) {
352
- cssParts.push(await node_fs.promises.readFile(entry.absolute, "utf8"));
353
- continue;
354
- }
355
- const importPath = pathe.default.isAbsolute(entry.original) ? entry.absolute : pathe.default.relative(resolvedBase, entry.absolute);
356
- cssParts.push(`@import "${quoteCssImport(toCssImportPath(importPath))}";`);
357
- }
358
- return {
359
- base: resolvedBase,
360
- css: cssParts.join("\n"),
361
- dependencies
362
- };
363
- }
364
- function resolveCssSources(sources, projectRoot, base) {
365
- const resolvedSources = sources.map((source) => ({
366
- ...source,
367
- base: source.base === void 0 ? void 0 : resolveBase(source.base, projectRoot),
368
- file: source.file === void 0 ? void 0 : pathe.default.isAbsolute(source.file) ? pathe.default.resolve(source.file) : pathe.default.resolve(projectRoot, source.file),
369
- dependencies: source.dependencies?.map((dependency) => pathe.default.isAbsolute(dependency) ? pathe.default.resolve(dependency) : pathe.default.resolve(projectRoot, dependency)) ?? []
370
- }));
371
- const firstSource = resolvedSources[0];
372
- const resolvedBase = base ?? firstSource?.base ?? (firstSource?.file ? pathe.default.dirname(firstSource.file) : projectRoot);
373
- const dependencies = resolvedSources.flatMap((source) => [source.file, ...source.dependencies]).filter((dependency) => Boolean(dependency));
374
- return {
375
- base: resolvedBase,
376
- css: resolvedSources.map((source) => source.css).join("\n"),
377
- dependencies
378
- };
379
- }
380
- function normalizeResolvedSource(source) {
381
- const baseFallbacks = uniquePaths([
382
- ...source.baseFallbacks,
383
- source.projectRoot,
384
- source.cwd
385
- ]).filter((base) => base !== source.base);
386
- return {
387
- projectRoot: source.projectRoot,
388
- base: source.base,
389
- baseFallbacks,
390
- css: source.css,
391
- dependencies: Array.from(new Set(source.dependencies.map((dependency) => pathe.default.resolve(dependency))))
392
- };
393
- }
394
- async function resolveTailwindV4Source(options = {}) {
395
- const projectRoot = resolveBase(options.projectRoot, node_process.default.cwd());
396
- const cwd = resolveBase(options.cwd, projectRoot);
397
- const configuredBase = options.base === void 0 ? void 0 : resolveBase(options.base, projectRoot);
398
- const baseFallbacks = uniquePaths(options.baseFallbacks?.map((base) => resolveBase(base, projectRoot)) ?? []);
399
- if (options.css !== void 0) return normalizeResolvedSource({
400
- projectRoot,
401
- cwd,
402
- base: configuredBase ?? cwd,
403
- baseFallbacks,
404
- css: options.css,
405
- dependencies: []
406
- });
407
- if (options.cssEntries?.length || options.cssSources?.length) {
408
- const entries = options.cssEntries?.length ? await resolveCssEntries(options.cssEntries, projectRoot, configuredBase) : void 0;
409
- const sources = options.cssSources?.length ? resolveCssSources(options.cssSources, projectRoot, configuredBase) : void 0;
410
- const css = [entries?.css, sources?.css].filter(Boolean).join("\n");
411
- return normalizeResolvedSource({
412
- projectRoot,
413
- cwd,
414
- base: configuredBase ?? entries?.base ?? sources?.base ?? cwd,
415
- baseFallbacks,
416
- css,
417
- dependencies: [...entries?.dependencies ?? [], ...sources?.dependencies ?? []]
418
- });
419
- }
420
- return normalizeResolvedSource({
421
- projectRoot,
422
- cwd,
423
- base: configuredBase ?? cwd,
424
- baseFallbacks,
425
- css: createDefaultCss(options.packageName),
426
- dependencies: []
427
- });
428
- }
429
19
  function resolveConfigDir(config, projectRoot) {
430
20
  if (!config) return;
431
21
  const configPath = pathe.default.isAbsolute(config) ? config : pathe.default.resolve(projectRoot, config);
@@ -455,64 +45,7 @@ function tailwindV4SourceOptionsFromPatchOptions(options) {
455
45
  return createSourceOptionsFromNormalizedPatchOptions(require_validate.normalizeOptions(options));
456
46
  }
457
47
  async function resolveTailwindV4SourceFromPatchOptions(options) {
458
- return resolveTailwindV4Source(tailwindV4SourceOptionsFromPatchOptions(options));
459
- }
460
- //#endregion
461
- //#region src/v4/style-generator.ts
462
- function createSourceOptions(options) {
463
- return {
464
- ...options.projectRoot === void 0 ? {} : { projectRoot: options.projectRoot },
465
- ...options.cwd === void 0 ? {} : { cwd: options.cwd },
466
- ...options.base === void 0 ? {} : { base: options.base },
467
- ...options.baseFallbacks === void 0 ? {} : { baseFallbacks: options.baseFallbacks },
468
- ...options.css === void 0 ? {} : { css: options.css },
469
- ...options.cssSources === void 0 ? {} : { cssSources: options.cssSources },
470
- ...options.cssEntries === void 0 ? {} : { cssEntries: options.cssEntries },
471
- ...options.packageName === void 0 ? {} : { packageName: options.packageName }
472
- };
473
- }
474
- async function collectTailwindV4StyleCandidates(options) {
475
- return collectTailwindStyleCandidates(options);
476
- }
477
- async function generateTailwindV4Style(options = {}) {
478
- const source = options.source ?? await resolveTailwindV4Source(createSourceOptions(options));
479
- const candidates = await collectTailwindV4StyleCandidates(options);
480
- const result = await createTailwindV4Engine(source).generate({
481
- candidates,
482
- ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues },
483
- ...options.scanSources === void 0 ? {} : { scanSources: options.scanSources }
484
- });
485
- return {
486
- ...result,
487
- tokens: result.rawCandidates,
488
- source
489
- };
490
- }
491
- //#endregion
492
- //#region src/style-generator.ts
493
- async function generateCustomStyle(options) {
494
- const tokens = await collectTailwindStyleCandidates(options);
495
- const classSet = new Set(tokens);
496
- const sources = options.sources ?? [];
497
- return {
498
- version: "custom",
499
- css: await options.generate({
500
- tokens,
501
- classSet,
502
- sources
503
- }),
504
- tokens,
505
- classSet,
506
- sources
507
- };
508
- }
509
- async function generateTailwindStyle(options) {
510
- if (options.version === 3) return generateTailwindV3Style(options);
511
- if (options.version === 4) return {
512
- ...await generateTailwindV4Style(options),
513
- version: 4
514
- };
515
- return generateCustomStyle(options);
48
+ return (0, _tailwindcss_mangle_engine_v4.resolveTailwindV4Source)(tailwindV4SourceOptionsFromPatchOptions(options));
516
49
  }
517
50
  //#endregion
518
51
  //#region src/public-api.ts
@@ -535,69 +68,309 @@ function createTailwindcssPatchCli(options = {}) {
535
68
  exports.CacheStore = require_validate.CacheStore;
536
69
  exports.MIGRATION_REPORT_KIND = require_validate.MIGRATION_REPORT_KIND;
537
70
  exports.MIGRATION_REPORT_SCHEMA_VERSION = require_validate.MIGRATION_REPORT_SCHEMA_VERSION;
538
- exports.TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN = require_validate.TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN;
539
- exports.TAILWIND_V4_IGNORED_CONTENT_DIRS = require_validate.TAILWIND_V4_IGNORED_CONTENT_DIRS;
540
- exports.TAILWIND_V4_IGNORED_EXTENSIONS = require_validate.TAILWIND_V4_IGNORED_EXTENSIONS;
541
- exports.TAILWIND_V4_IGNORED_FILES = require_validate.TAILWIND_V4_IGNORED_FILES;
71
+ Object.defineProperty(exports, "TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN", {
72
+ enumerable: true,
73
+ get: function() {
74
+ return _tailwindcss_mangle_engine_v4.TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN;
75
+ }
76
+ });
77
+ Object.defineProperty(exports, "TAILWIND_V4_IGNORED_CONTENT_DIRS", {
78
+ enumerable: true,
79
+ get: function() {
80
+ return _tailwindcss_mangle_engine_v4.TAILWIND_V4_IGNORED_CONTENT_DIRS;
81
+ }
82
+ });
83
+ Object.defineProperty(exports, "TAILWIND_V4_IGNORED_EXTENSIONS", {
84
+ enumerable: true,
85
+ get: function() {
86
+ return _tailwindcss_mangle_engine_v4.TAILWIND_V4_IGNORED_EXTENSIONS;
87
+ }
88
+ });
89
+ Object.defineProperty(exports, "TAILWIND_V4_IGNORED_FILES", {
90
+ enumerable: true,
91
+ get: function() {
92
+ return _tailwindcss_mangle_engine_v4.TAILWIND_V4_IGNORED_FILES;
93
+ }
94
+ });
542
95
  exports.TailwindcssPatcher = require_validate.TailwindcssPatcher;
543
96
  exports.VALIDATE_EXIT_CODES = require_validate.VALIDATE_EXIT_CODES;
544
97
  exports.VALIDATE_FAILURE_REASONS = require_validate.VALIDATE_FAILURE_REASONS;
545
98
  exports.ValidateCommandError = require_validate.ValidateCommandError;
546
- exports.canonicalizeBareArbitraryValueCandidates = require_validate.canonicalizeBareArbitraryValueCandidates;
99
+ Object.defineProperty(exports, "canonicalizeBareArbitraryValueCandidates", {
100
+ enumerable: true,
101
+ get: function() {
102
+ return _tailwindcss_mangle_engine_v4.canonicalizeBareArbitraryValueCandidates;
103
+ }
104
+ });
547
105
  exports.collectClassesFromContexts = require_validate.collectClassesFromContexts;
548
106
  exports.collectClassesFromTailwindV4 = require_validate.collectClassesFromTailwindV4;
549
- exports.collectTailwindStyleCandidates = collectTailwindStyleCandidates;
550
- exports.collectTailwindV4StyleCandidates = collectTailwindV4StyleCandidates;
551
- exports.createTailwindV4CompiledSourceEntries = require_validate.createTailwindV4CompiledSourceEntries;
552
- exports.createTailwindV4DefaultIgnoreSources = require_validate.createTailwindV4DefaultIgnoreSources;
553
- exports.createTailwindV4Engine = createTailwindV4Engine;
554
- exports.createTailwindV4RootSources = require_validate.createTailwindV4RootSources;
555
- exports.createTailwindV4SourceEntryMatcher = require_validate.createTailwindV4SourceEntryMatcher;
556
- exports.createTailwindV4SourceExclusionMatcher = require_validate.createTailwindV4SourceExclusionMatcher;
107
+ Object.defineProperty(exports, "collectTailwindStyleCandidates", {
108
+ enumerable: true,
109
+ get: function() {
110
+ return _tailwindcss_mangle_engine.collectTailwindStyleCandidates;
111
+ }
112
+ });
113
+ Object.defineProperty(exports, "collectTailwindV4StyleCandidates", {
114
+ enumerable: true,
115
+ get: function() {
116
+ return _tailwindcss_mangle_engine_v4.collectTailwindV4StyleCandidates;
117
+ }
118
+ });
119
+ Object.defineProperty(exports, "createTailwindV4CompiledSourceEntries", {
120
+ enumerable: true,
121
+ get: function() {
122
+ return _tailwindcss_mangle_engine_v4.createTailwindV4CompiledSourceEntries;
123
+ }
124
+ });
125
+ Object.defineProperty(exports, "createTailwindV4DefaultIgnoreSources", {
126
+ enumerable: true,
127
+ get: function() {
128
+ return _tailwindcss_mangle_engine_v4.createTailwindV4DefaultIgnoreSources;
129
+ }
130
+ });
131
+ Object.defineProperty(exports, "createTailwindV4Engine", {
132
+ enumerable: true,
133
+ get: function() {
134
+ return _tailwindcss_mangle_engine_v4.createTailwindV4Engine;
135
+ }
136
+ });
137
+ Object.defineProperty(exports, "createTailwindV4RootSources", {
138
+ enumerable: true,
139
+ get: function() {
140
+ return _tailwindcss_mangle_engine_v4.createTailwindV4RootSources;
141
+ }
142
+ });
143
+ Object.defineProperty(exports, "createTailwindV4SourceEntryMatcher", {
144
+ enumerable: true,
145
+ get: function() {
146
+ return _tailwindcss_mangle_engine_v4.createTailwindV4SourceEntryMatcher;
147
+ }
148
+ });
149
+ Object.defineProperty(exports, "createTailwindV4SourceExclusionMatcher", {
150
+ enumerable: true,
151
+ get: function() {
152
+ return _tailwindcss_mangle_engine_v4.createTailwindV4SourceExclusionMatcher;
153
+ }
154
+ });
557
155
  exports.createTailwindcssPatchCli = createTailwindcssPatchCli;
558
156
  exports.defineConfig = defineConfig;
559
- exports.escapeCssClassName = require_validate.escapeCssClassName;
560
- exports.expandTailwindV4SourceEntries = require_validate.expandTailwindV4SourceEntries;
561
- exports.expandTailwindV4SourceEntryBraces = require_validate.expandTailwindV4SourceEntryBraces;
562
- exports.extractBareArbitraryValueSourceCandidates = require_validate.extractBareArbitraryValueSourceCandidates;
563
- exports.extractBareArbitraryValueSourceCandidatesWithPositions = require_validate.extractBareArbitraryValueSourceCandidatesWithPositions;
564
- exports.extractProjectCandidatesWithPositions = require_validate.extractProjectCandidatesWithPositions;
565
- exports.extractRawCandidates = require_validate.extractRawCandidates;
566
- exports.extractRawCandidatesWithPositions = require_validate.extractRawCandidatesWithPositions;
567
- exports.extractSourceCandidates = require_validate.extractSourceCandidates;
568
- exports.extractSourceCandidatesWithPositions = require_validate.extractSourceCandidatesWithPositions;
569
- exports.extractValidCandidates = require_validate.extractValidCandidates;
570
- exports.generateCustomStyle = generateCustomStyle;
571
- exports.generateTailwindStyle = generateTailwindStyle;
572
- exports.generateTailwindV3RawStyle = generateTailwindV3RawStyle;
573
- exports.generateTailwindV3Style = generateTailwindV3Style;
574
- exports.generateTailwindV4Style = generateTailwindV4Style;
157
+ Object.defineProperty(exports, "escapeCssClassName", {
158
+ enumerable: true,
159
+ get: function() {
160
+ return _tailwindcss_mangle_engine_v4.escapeCssClassName;
161
+ }
162
+ });
163
+ Object.defineProperty(exports, "expandTailwindV4SourceEntries", {
164
+ enumerable: true,
165
+ get: function() {
166
+ return _tailwindcss_mangle_engine_v4.expandTailwindV4SourceEntries;
167
+ }
168
+ });
169
+ Object.defineProperty(exports, "expandTailwindV4SourceEntryBraces", {
170
+ enumerable: true,
171
+ get: function() {
172
+ return _tailwindcss_mangle_engine_v4.expandTailwindV4SourceEntryBraces;
173
+ }
174
+ });
175
+ Object.defineProperty(exports, "extractBareArbitraryValueSourceCandidates", {
176
+ enumerable: true,
177
+ get: function() {
178
+ return _tailwindcss_mangle_engine_v4.extractBareArbitraryValueSourceCandidates;
179
+ }
180
+ });
181
+ Object.defineProperty(exports, "extractBareArbitraryValueSourceCandidatesWithPositions", {
182
+ enumerable: true,
183
+ get: function() {
184
+ return _tailwindcss_mangle_engine_v4.extractBareArbitraryValueSourceCandidatesWithPositions;
185
+ }
186
+ });
187
+ Object.defineProperty(exports, "extractProjectCandidatesWithPositions", {
188
+ enumerable: true,
189
+ get: function() {
190
+ return _tailwindcss_mangle_engine.extractProjectCandidatesWithPositions;
191
+ }
192
+ });
193
+ Object.defineProperty(exports, "extractRawCandidates", {
194
+ enumerable: true,
195
+ get: function() {
196
+ return _tailwindcss_mangle_engine.extractRawCandidates;
197
+ }
198
+ });
199
+ Object.defineProperty(exports, "extractRawCandidatesWithPositions", {
200
+ enumerable: true,
201
+ get: function() {
202
+ return _tailwindcss_mangle_engine.extractRawCandidatesWithPositions;
203
+ }
204
+ });
205
+ Object.defineProperty(exports, "extractSourceCandidates", {
206
+ enumerable: true,
207
+ get: function() {
208
+ return _tailwindcss_mangle_engine.extractSourceCandidates;
209
+ }
210
+ });
211
+ Object.defineProperty(exports, "extractSourceCandidatesWithPositions", {
212
+ enumerable: true,
213
+ get: function() {
214
+ return _tailwindcss_mangle_engine.extractSourceCandidatesWithPositions;
215
+ }
216
+ });
217
+ Object.defineProperty(exports, "extractValidCandidates", {
218
+ enumerable: true,
219
+ get: function() {
220
+ return _tailwindcss_mangle_engine.extractValidCandidates;
221
+ }
222
+ });
223
+ Object.defineProperty(exports, "generateCustomStyle", {
224
+ enumerable: true,
225
+ get: function() {
226
+ return _tailwindcss_mangle_engine.generateCustomStyle;
227
+ }
228
+ });
229
+ Object.defineProperty(exports, "generateTailwindStyle", {
230
+ enumerable: true,
231
+ get: function() {
232
+ return _tailwindcss_mangle_engine.generateTailwindStyle;
233
+ }
234
+ });
235
+ Object.defineProperty(exports, "generateTailwindV3RawStyle", {
236
+ enumerable: true,
237
+ get: function() {
238
+ return _tailwindcss_mangle_engine_v3.generateTailwindV3RawStyle;
239
+ }
240
+ });
241
+ Object.defineProperty(exports, "generateTailwindV3Style", {
242
+ enumerable: true,
243
+ get: function() {
244
+ return _tailwindcss_mangle_engine_v3.generateTailwindV3Style;
245
+ }
246
+ });
247
+ Object.defineProperty(exports, "generateTailwindV4Style", {
248
+ enumerable: true,
249
+ get: function() {
250
+ return _tailwindcss_mangle_engine_v4.generateTailwindV4Style;
251
+ }
252
+ });
575
253
  exports.getPatchStatusReport = require_validate.getPatchStatusReport;
576
- exports.groupTokensByFile = require_validate.groupTokensByFile;
577
- exports.isBareArbitraryValuesEnabled = require_validate.isBareArbitraryValuesEnabled;
578
- exports.isFileExcludedByTailwindV4SourceEntries = require_validate.isFileExcludedByTailwindV4SourceEntries;
579
- exports.isFileMatchedByTailwindV4SourceEntries = require_validate.isFileMatchedByTailwindV4SourceEntries;
580
- exports.isValidCandidateToken = isValidCandidateToken;
254
+ Object.defineProperty(exports, "groupTokensByFile", {
255
+ enumerable: true,
256
+ get: function() {
257
+ return _tailwindcss_mangle_engine.groupTokensByFile;
258
+ }
259
+ });
260
+ Object.defineProperty(exports, "isBareArbitraryValuesEnabled", {
261
+ enumerable: true,
262
+ get: function() {
263
+ return _tailwindcss_mangle_engine_v4.isBareArbitraryValuesEnabled;
264
+ }
265
+ });
266
+ Object.defineProperty(exports, "isFileExcludedByTailwindV4SourceEntries", {
267
+ enumerable: true,
268
+ get: function() {
269
+ return _tailwindcss_mangle_engine_v4.isFileExcludedByTailwindV4SourceEntries;
270
+ }
271
+ });
272
+ Object.defineProperty(exports, "isFileMatchedByTailwindV4SourceEntries", {
273
+ enumerable: true,
274
+ get: function() {
275
+ return _tailwindcss_mangle_engine_v4.isFileMatchedByTailwindV4SourceEntries;
276
+ }
277
+ });
278
+ Object.defineProperty(exports, "isValidCandidateToken", {
279
+ enumerable: true,
280
+ get: function() {
281
+ return _tailwindcss_mangle_engine.isValidCandidateToken;
282
+ }
283
+ });
581
284
  exports.loadRuntimeContexts = require_validate.loadRuntimeContexts;
582
- exports.loadTailwindV4DesignSystem = require_validate.loadTailwindV4DesignSystem;
285
+ Object.defineProperty(exports, "loadTailwindV4DesignSystem", {
286
+ enumerable: true,
287
+ get: function() {
288
+ return _tailwindcss_mangle_engine_v4.loadTailwindV4DesignSystem;
289
+ }
290
+ });
583
291
  exports.logger = require_validate.logger;
584
- exports.mergeTailwindV4SourceEntries = require_validate.mergeTailwindV4SourceEntries;
292
+ Object.defineProperty(exports, "mergeTailwindV4SourceEntries", {
293
+ enumerable: true,
294
+ get: function() {
295
+ return _tailwindcss_mangle_engine_v4.mergeTailwindV4SourceEntries;
296
+ }
297
+ });
585
298
  exports.migrateConfigFiles = require_validate.migrateConfigFiles;
586
299
  exports.mountTailwindcssPatchCommands = mountTailwindcssPatchCommands;
587
300
  exports.normalizeOptions = require_validate.normalizeOptions;
588
- exports.normalizeTailwindV4ScannerSources = require_validate.normalizeTailwindV4ScannerSources;
589
- exports.normalizeTailwindV4SourceEntries = require_validate.normalizeTailwindV4SourceEntries;
590
- exports.replaceBareArbitraryValueSelectors = require_validate.replaceBareArbitraryValueSelectors;
591
- exports.resolveBareArbitraryValueCandidate = require_validate.resolveBareArbitraryValueCandidate;
592
- exports.resolveProjectSourceFiles = require_validate.resolveProjectSourceFiles;
593
- exports.resolveSourceScanPath = require_validate.resolveSourceScanPath;
594
- exports.resolveTailwindV4Source = resolveTailwindV4Source;
595
- exports.resolveTailwindV4SourceBaseCandidates = require_validate.resolveTailwindV4SourceBaseCandidates;
596
- exports.resolveTailwindV4SourceEntry = require_validate.resolveTailwindV4SourceEntry;
301
+ Object.defineProperty(exports, "normalizeTailwindV4ScannerSources", {
302
+ enumerable: true,
303
+ get: function() {
304
+ return _tailwindcss_mangle_engine_v4.normalizeTailwindV4ScannerSources;
305
+ }
306
+ });
307
+ Object.defineProperty(exports, "normalizeTailwindV4SourceEntries", {
308
+ enumerable: true,
309
+ get: function() {
310
+ return _tailwindcss_mangle_engine_v4.normalizeTailwindV4SourceEntries;
311
+ }
312
+ });
313
+ Object.defineProperty(exports, "replaceBareArbitraryValueSelectors", {
314
+ enumerable: true,
315
+ get: function() {
316
+ return _tailwindcss_mangle_engine_v4.replaceBareArbitraryValueSelectors;
317
+ }
318
+ });
319
+ Object.defineProperty(exports, "resolveBareArbitraryValueCandidate", {
320
+ enumerable: true,
321
+ get: function() {
322
+ return _tailwindcss_mangle_engine_v4.resolveBareArbitraryValueCandidate;
323
+ }
324
+ });
325
+ Object.defineProperty(exports, "resolveProjectSourceFiles", {
326
+ enumerable: true,
327
+ get: function() {
328
+ return _tailwindcss_mangle_engine.resolveProjectSourceFiles;
329
+ }
330
+ });
331
+ Object.defineProperty(exports, "resolveSourceScanPath", {
332
+ enumerable: true,
333
+ get: function() {
334
+ return _tailwindcss_mangle_engine_v4.resolveSourceScanPath;
335
+ }
336
+ });
337
+ Object.defineProperty(exports, "resolveTailwindV4Source", {
338
+ enumerable: true,
339
+ get: function() {
340
+ return _tailwindcss_mangle_engine_v4.resolveTailwindV4Source;
341
+ }
342
+ });
343
+ Object.defineProperty(exports, "resolveTailwindV4SourceBaseCandidates", {
344
+ enumerable: true,
345
+ get: function() {
346
+ return _tailwindcss_mangle_engine_v4.resolveTailwindV4SourceBaseCandidates;
347
+ }
348
+ });
349
+ Object.defineProperty(exports, "resolveTailwindV4SourceEntry", {
350
+ enumerable: true,
351
+ get: function() {
352
+ return _tailwindcss_mangle_engine_v4.resolveTailwindV4SourceEntry;
353
+ }
354
+ });
597
355
  exports.resolveTailwindV4SourceFromPatchOptions = resolveTailwindV4SourceFromPatchOptions;
598
- exports.resolveValidTailwindV4Candidates = require_validate.resolveValidTailwindV4Candidates;
356
+ Object.defineProperty(exports, "resolveValidTailwindV4Candidates", {
357
+ enumerable: true,
358
+ get: function() {
359
+ return _tailwindcss_mangle_engine_v4.resolveValidTailwindV4Candidates;
360
+ }
361
+ });
599
362
  exports.restoreConfigFiles = require_validate.restoreConfigFiles;
600
363
  exports.runTailwindBuild = require_validate.runTailwindBuild;
601
- exports.splitCandidateTokens = splitCandidateTokens;
364
+ Object.defineProperty(exports, "splitCandidateTokens", {
365
+ enumerable: true,
366
+ get: function() {
367
+ return _tailwindcss_mangle_engine.splitCandidateTokens;
368
+ }
369
+ });
602
370
  exports.tailwindcssPatchCommands = require_validate.tailwindcssPatchCommands;
603
- exports.validateCandidateTokenRE = validateCandidateTokenRE;
371
+ Object.defineProperty(exports, "validateCandidateTokenRE", {
372
+ enumerable: true,
373
+ get: function() {
374
+ return _tailwindcss_mangle_engine.validateCandidateTokenRE;
375
+ }
376
+ });