tailwindcss-patch 9.0.0-alpha.2 → 9.0.0-alpha.4

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/index.d.mts CHANGED
@@ -1,479 +1,15 @@
1
1
  import { TailwindcssMangleConfig } from '@tailwindcss-mangle/config';
2
- import { SourceEntry } from '@tailwindcss/oxide';
3
- import postcss, { Rule, Node } from 'postcss';
4
- import { Config } from 'tailwindcss';
5
- import { PackageResolvingOptions, PackageInfo } from 'local-pkg';
6
- import { Command, CAC } from 'cac';
7
- import * as consola from 'consola';
8
-
9
- type CacheStrategy = 'merge' | 'overwrite';
10
- type CacheDriver = 'file' | 'memory' | 'noop';
11
- /**
12
- * Configures how the Tailwind class cache is stored and where it lives on disk.
13
- */
14
- interface CacheOptions {
15
- /** Whether caching is enabled. */
16
- enabled?: boolean;
17
- /** Working directory used when resolving cache paths. */
18
- cwd?: string;
19
- /** Directory where cache files are written. */
20
- dir?: string;
21
- /**
22
- * Cache filename. Defaults to `class-cache.json` inside the derived cache folder
23
- * when omitted.
24
- */
25
- file?: string;
26
- /** Strategy used when merging new class lists with an existing cache. */
27
- strategy?: CacheStrategy;
28
- /** Backend used to persist the cache (`file`, `memory`, or `noop`). Defaults to `file`. */
29
- driver?: CacheDriver;
30
- }
31
- /**
32
- * Preferred options for extraction output behavior.
33
- */
34
- interface ExtractOptions {
35
- /** Whether to produce an output file. */
36
- write?: boolean;
37
- /** Optional absolute or relative path to the output file. */
38
- file?: string;
39
- /** Output format, defaults to JSON when omitted. */
40
- format?: 'json' | 'lines';
41
- /** Pretty-print spacing (truthy value enables indentation). */
42
- pretty?: number | boolean;
43
- /** Whether to strip the universal selector (`*`) from the final list. */
44
- removeUniversalSelector?: boolean;
45
- }
46
- /**
47
- * Options controlling how Tailwind contexts are exposed during runtime patching.
48
- */
49
- interface ExposeContextOptions {
50
- /** Name of the property used to reference an exposed context. */
51
- refProperty?: string;
52
- }
53
- /**
54
- * Extends the built-in length-unit patch with custom defaults.
55
- */
56
- interface ExtendLengthUnitsOptions extends Partial<ILengthUnitsPatchOptions> {
57
- /** Enables or disables the length-unit patch. */
58
- enabled?: boolean;
59
- }
60
- /**
61
- * Preferred options for runtime patch behavior.
62
- */
63
- interface ApplyOptions {
64
- /** Whether patched files can be overwritten on disk. */
65
- overwrite?: boolean;
66
- /** Whether to expose runtime Tailwind contexts (or configure how they are exposed). */
67
- exposeContext?: boolean | ExposeContextOptions;
68
- /** Extends the length-unit patch or disables it entirely. */
69
- extendLengthUnits?: false | ExtendLengthUnitsOptions;
70
- }
71
- interface TailwindRuntimeOptionsBase {
72
- /** Path to a Tailwind config file when auto-detection is insufficient. */
73
- config?: string;
74
- /** Custom working directory used when resolving config-relative paths. */
75
- cwd?: string;
76
- /** Optional PostCSS plugin name to use instead of the default. */
77
- postcssPlugin?: string;
78
- }
79
- /**
80
- * Configuration specific to Tailwind CSS v2 patching flows.
81
- */
82
- interface TailwindV2Options extends TailwindRuntimeOptionsBase {
83
- }
84
- /**
85
- * Configuration specific to Tailwind CSS v3 patching flows.
86
- */
87
- interface TailwindV3Options extends TailwindRuntimeOptionsBase {
88
- }
89
- /**
90
- * Additional configuration specific to Tailwind CSS v4 extraction.
91
- */
92
- interface TailwindV4Options {
93
- /** Base directory used when resolving v4 content sources and configs. */
94
- base?: string;
95
- /** Raw CSS passed directly to the v4 design system. */
96
- css?: string;
97
- /** Set of CSS entry files that should be scanned for `@config` directives. */
98
- cssEntries?: string[];
99
- /** Overrides the content sources scanned by the oxide scanner. */
100
- sources?: SourceEntry[];
101
- }
102
- /**
103
- * High-level Tailwind patch configuration shared across versions.
104
- */
105
- interface TailwindCssOptions extends TailwindRuntimeOptionsBase {
106
- /** Explicit Tailwind CSS major version used by the current project. When omitted, the installed package version is inferred. */
107
- version?: 2 | 3 | 4;
108
- /** Tailwind package name if the project uses a fork. */
109
- packageName?: string;
110
- /** Package resolution options forwarded to `local-pkg`. */
111
- resolve?: PackageResolvingOptions;
112
- /** Overrides applied when patching Tailwind CSS v2. */
113
- v2?: TailwindV2Options;
114
- /** Overrides applied when patching Tailwind CSS v3. */
115
- v3?: TailwindV3Options;
116
- /** Options specific to Tailwind CSS v4 patching. */
117
- v4?: TailwindV4Options;
118
- }
119
- /**
120
- * Root configuration consumed by the Tailwind CSS patch runner.
121
- */
122
- interface TailwindCssPatchOptions {
123
- /**
124
- * Base directory used when resolving Tailwind resources.
125
- * Defaults to `process.cwd()`.
126
- */
127
- projectRoot?: string;
128
- /** Preferred Tailwind runtime configuration. */
129
- tailwindcss?: TailwindCssOptions;
130
- /** Preferred patch toggles. */
131
- apply?: ApplyOptions;
132
- /** Preferred extraction output settings. */
133
- extract?: ExtractOptions;
134
- /** Optional function that filters final class names. */
135
- filter?: (className: string) => boolean;
136
- /** Cache configuration or boolean to enable/disable quickly. */
137
- cache?: boolean | CacheOptions;
138
- }
139
- /**
140
- * Stable shape for output configuration after normalization.
141
- */
142
- interface NormalizedOutputOptions {
143
- enabled: boolean;
144
- file?: string;
145
- format: 'json' | 'lines';
146
- pretty: number | false;
147
- removeUniversalSelector: boolean;
148
- }
149
- /**
150
- * Stable cache configuration used internally after defaults are applied.
151
- */
152
- interface NormalizedCacheOptions {
153
- enabled: boolean;
154
- cwd: string;
155
- dir: string;
156
- file: string;
157
- path: string;
158
- strategy: CacheStrategy;
159
- driver: CacheDriver;
160
- }
161
- /** Tracks whether runtime contexts should be exposed and via which property. */
162
- interface NormalizedExposeContextOptions {
163
- enabled: boolean;
164
- refProperty: string;
165
- }
166
- /** Normalized representation of the extend-length-units feature flag. */
167
- interface NormalizedExtendLengthUnitsOptions extends ILengthUnitsPatchOptions {
168
- enabled: boolean;
169
- }
170
- /** Normalized Tailwind v4 configuration consumed by runtime helpers. */
171
- interface NormalizedTailwindV4Options {
172
- base: string;
173
- configuredBase?: string;
174
- css?: string;
175
- cssEntries: string[];
176
- sources: SourceEntry[];
177
- hasUserDefinedSources: boolean;
178
- }
179
- /**
180
- * Tailwind configuration ready for consumption by the runtime after normalization.
181
- */
182
- interface NormalizedTailwindConfigOptions extends TailwindRuntimeOptionsBase {
183
- packageName: string;
184
- versionHint?: 2 | 3 | 4;
185
- resolve?: PackageResolvingOptions;
186
- v2?: TailwindV2Options;
187
- v3?: TailwindV3Options;
188
- v4?: NormalizedTailwindV4Options;
189
- }
190
- /** Grouped normalized feature flags. */
191
- interface NormalizedFeatureOptions {
192
- exposeContext: NormalizedExposeContextOptions;
193
- extendLengthUnits: NormalizedExtendLengthUnitsOptions | null;
194
- }
195
- /** Final normalized shape consumed throughout the patch runtime. */
196
- interface NormalizedTailwindCssPatchOptions {
197
- projectRoot: string;
198
- overwrite: boolean;
199
- tailwind: NormalizedTailwindConfigOptions;
200
- features: NormalizedFeatureOptions;
201
- output: NormalizedOutputOptions;
202
- cache: NormalizedCacheOptions;
203
- filter: (className: string) => boolean;
204
- }
205
-
206
- declare const CACHE_SCHEMA_VERSION = 2;
207
- declare const CACHE_FINGERPRINT_VERSION = 1;
208
- type CacheSchemaVersion = typeof CACHE_SCHEMA_VERSION;
209
- type CacheFingerprintVersion = typeof CACHE_FINGERPRINT_VERSION;
210
- type CacheClearScope = 'current' | 'all';
211
- interface CacheContextMetadata {
212
- fingerprintVersion: CacheFingerprintVersion;
213
- projectRootRealpath: string;
214
- processCwdRealpath: string;
215
- cacheCwdRealpath: string;
216
- tailwindConfigPath?: string;
217
- tailwindConfigMtimeMs?: number;
218
- tailwindPackageRootRealpath: string;
219
- tailwindPackageVersion: string;
220
- patcherVersion: string;
221
- majorVersion: 2 | 3 | 4;
222
- optionsHash: string;
223
- }
224
- interface CacheContextDescriptor {
225
- fingerprint: string;
226
- metadata: CacheContextMetadata;
227
- }
228
- interface CacheIndexEntry {
229
- context: CacheContextMetadata;
230
- values: string[];
231
- updatedAt: string;
232
- }
233
- interface CacheIndexFileV2 {
234
- schemaVersion: CacheSchemaVersion;
235
- updatedAt: string;
236
- contexts: Record<string, CacheIndexEntry>;
237
- }
238
- type CacheReadReason = 'hit' | 'cache-disabled' | 'noop-driver' | 'file-missing' | 'context-not-found' | 'context-mismatch' | 'legacy-schema' | 'invalid-schema';
239
- interface CacheReadMeta {
240
- hit: boolean;
241
- reason: CacheReadReason;
242
- fingerprint?: string;
243
- schemaVersion?: number;
244
- details: string[];
245
- }
246
- interface CacheReadResult {
247
- data: Set<string>;
248
- meta: CacheReadMeta;
249
- }
250
- interface CacheClearOptions {
251
- scope?: CacheClearScope;
252
- }
253
- interface CacheClearResult {
254
- scope: CacheClearScope;
255
- filesRemoved: number;
256
- entriesRemoved: number;
257
- contextsRemoved: number;
258
- }
259
-
260
- type TailwindcssClassCacheEntry = Rule | {
261
- layer: string;
262
- options: Record<string, any>;
263
- sort: Record<string, any>;
264
- };
265
- type TailwindcssClassCache = Map<string, TailwindcssClassCacheEntry[]>;
266
- interface TailwindcssRuntimeContext {
267
- applyClassCache: Map<any, any>;
268
- candidateRuleCache: Map<string, Set<[
269
- {
270
- arbitrary: any;
271
- index: any;
272
- layer: string;
273
- options: any[];
274
- parallelIndex: any;
275
- parentLayer: string;
276
- variants: any;
277
- },
278
- Node
279
- ]>>;
280
- candidateRuleMap: Map<string | string, [object, Node][]>;
281
- changedContent: any[];
282
- classCache: TailwindcssClassCache;
283
- disposables: any[];
284
- getClassList: (...args: any[]) => any;
285
- getClassOrder: (...args: any[]) => any;
286
- getVariants: (...args: any[]) => any;
287
- markInvalidUtilityCandidate: (...args: any[]) => any;
288
- markInvalidUtilityNode: (...args: any[]) => any;
289
- notClassCache: Set<string>;
290
- offsets: {
291
- layerPositions: object;
292
- offsets: object;
293
- reservedVariantBits: any;
294
- variantOffsets: Map<string, any>;
295
- };
296
- postCssNodeCache: Map<object, [Node]>;
297
- ruleCache: Set<[object, Node]>;
298
- stylesheetCache: Record<string, Set<any>>;
299
- tailwindConfig: Config;
300
- userConfigPath: string | null;
301
- variantMap: Map<string, [[object, (...args: any[]) => unknown]]>;
302
- variantOptions: Map<string, object>;
303
- }
304
- interface ExtractResult {
305
- classList: string[];
306
- classSet: Set<string>;
307
- filename?: string;
308
- }
309
- interface TailwindTokenLocation {
310
- rawCandidate: string;
311
- file: string;
312
- relativeFile: string;
313
- extension: string;
314
- start: number;
315
- end: number;
316
- length: number;
317
- line: number;
318
- column: number;
319
- lineText: string;
320
- }
321
- type TailwindTokenFileKey = 'relative' | 'absolute';
322
- interface TailwindTokenReport {
323
- entries: TailwindTokenLocation[];
324
- filesScanned: number;
325
- sources: SourceEntry[];
326
- skippedFiles: {
327
- file: string;
328
- reason: string;
329
- }[];
330
- }
331
- type TailwindTokenByFileMap = Record<string, TailwindTokenLocation[]>;
332
- interface TailwindPatchRuntime {
333
- options: NormalizedTailwindCssPatchOptions;
334
- majorVersion: 2 | 3 | 4;
335
- }
336
-
337
- interface ILengthUnitsPatchOptions {
338
- units: string[];
339
- lengthUnitsFilePath?: string;
340
- variableName?: string;
341
- overwrite?: boolean;
342
- destPath?: string;
343
- }
344
- type PatchCheckStatus = 'applied' | 'not-applied' | 'skipped' | 'unsupported';
345
- type PatchName = 'exposeContext' | 'extendLengthUnits';
346
- interface PatchStatusEntry {
347
- name: PatchName;
348
- status: PatchCheckStatus;
349
- reason?: string;
350
- files: string[];
351
- }
352
- interface PatchStatusReport {
353
- package: {
354
- name?: string;
355
- version?: string;
356
- root: string;
357
- };
358
- majorVersion: 2 | 3 | 4;
359
- entries: PatchStatusEntry[];
360
- }
361
-
362
- interface ExposeContextPatchParams {
363
- rootDir: string;
364
- refProperty: string;
365
- overwrite: boolean;
366
- majorVersion: 2 | 3;
367
- }
368
- interface ExposeContextPatchResult {
369
- applied: boolean;
370
- files: Record<string, string>;
371
- }
372
- declare function applyExposeContextPatch(params: ExposeContextPatchParams): ExposeContextPatchResult;
373
-
374
- declare function applyExtendLengthUnitsPatchV3(rootDir: string, options: NormalizedExtendLengthUnitsOptions): {
375
- changed: boolean;
376
- code: undefined;
377
- } | {
378
- changed: boolean;
379
- code: string;
380
- };
381
- interface V4FilePatch {
382
- file: string;
383
- code: string;
384
- hasPatched: boolean;
385
- }
386
- interface V4Candidate extends V4FilePatch {
387
- match: RegExpExecArray;
388
- }
389
- declare function applyExtendLengthUnitsPatchV4(rootDir: string, options: NormalizedExtendLengthUnitsOptions): {
390
- changed: boolean;
391
- files: V4Candidate[];
392
- };
393
-
394
- interface PatchRunnerResult {
395
- exposeContext?: ReturnType<typeof applyExposeContextPatch>;
396
- extendLengthUnits?: ReturnType<typeof applyExtendLengthUnitsPatchV3> | ReturnType<typeof applyExtendLengthUnitsPatchV4>;
397
- }
2
+ import { CAC } from 'cac';
3
+ import { n as TailwindCssPatchOptions, N as NormalizedTailwindCssPatchOptions, o as NormalizedCacheOptions, C as CacheContextDescriptor, p as CacheReadResult, q as CacheReadMeta, r as CacheClearOptions, s as CacheClearResult, u as CacheIndexFileV2, M as MigrateConfigFilesOptions, v as ConfigFileMigrationReport, R as RestoreConfigFilesOptions, w as RestoreConfigFilesResult, x as TailwindcssRuntimeContext, P as PatchStatusReport, T as TailwindcssPatchCliOptions, a as TailwindcssPatchCliMountOptions } from './validate-nbmOI2w8.mjs';
4
+ export { A as ApplyOptions, y as CacheClearScope, z as CacheContextMetadata, B as CacheOptions, D as CacheStrategy, E as ConfigFileMigrationEntry, F as ExposeContextOptions, G as ExtendLengthUnitsOptions, H as ExtractOptions, I as ExtractResult, J as ILengthUnitsPatchOptions, K as MIGRATION_REPORT_KIND, L as MIGRATION_REPORT_SCHEMA_VERSION, O as PatchCheckStatus, Q as PatchName, S as PatchStatusEntry, U as TailwindCssOptions, W as TailwindPatchRuntime, X as TailwindTokenByFileMap, Y as TailwindTokenFileKey, Z as TailwindTokenLocation, _ as TailwindTokenReport, $ as TailwindV2Options, a0 as TailwindV3Options, a1 as TailwindV4Options, a2 as TailwindcssClassCache, b as TailwindcssPatchCommand, c as TailwindcssPatchCommandContext, d as TailwindcssPatchCommandHandler, e as TailwindcssPatchCommandHandlerMap, f as TailwindcssPatchCommandOptionDefinition, g as TailwindcssPatchCommandOptions, a3 as TailwindcssPatcher, V as VALIDATE_EXIT_CODES, h as VALIDATE_FAILURE_REASONS, i as ValidateCommandError, j as ValidateFailureReason, k as ValidateFailureSummary, l as ValidateJsonFailurePayload, m as ValidateJsonSuccessPayload, a4 as extractProjectCandidatesWithPositions, a5 as extractRawCandidates, a6 as extractRawCandidatesWithPositions, a7 as extractValidCandidates, a8 as groupTokensByFile, a9 as logger, t as tailwindcssPatchCommands } from './validate-nbmOI2w8.mjs';
5
+ import { PackageInfo } from 'local-pkg';
6
+ import postcss from 'postcss';
7
+ import '@tailwindcss/oxide';
8
+ import 'tailwindcss';
9
+ import 'consola';
398
10
 
399
11
  declare function normalizeOptions(options?: TailwindCssPatchOptions): NormalizedTailwindCssPatchOptions;
400
12
 
401
- interface TailwindcssConfigModule {
402
- CONFIG_NAME: string;
403
- getConfig: (cwd?: string) => Promise<{
404
- config?: {
405
- registry?: unknown;
406
- patch?: unknown;
407
- };
408
- }>;
409
- initConfig: (cwd: string) => Promise<unknown>;
410
- }
411
- type TailwindcssConfigResult = Awaited<ReturnType<TailwindcssConfigModule['getConfig']>>;
412
-
413
- interface ExtractValidCandidatesOption {
414
- sources?: SourceEntry[];
415
- base?: string;
416
- baseFallbacks?: string[];
417
- css?: string;
418
- cwd?: string;
419
- }
420
- declare function extractRawCandidatesWithPositions(content: string, extension?: string): Promise<{
421
- rawCandidate: string;
422
- start: number;
423
- end: number;
424
- }[]>;
425
- declare function extractRawCandidates(sources?: SourceEntry[]): Promise<string[]>;
426
- declare function extractValidCandidates(options?: ExtractValidCandidatesOption): Promise<string[]>;
427
- interface ExtractProjectCandidatesOptions {
428
- cwd?: string;
429
- sources?: SourceEntry[];
430
- }
431
- declare function extractProjectCandidatesWithPositions(options?: ExtractProjectCandidatesOptions): Promise<TailwindTokenReport>;
432
- declare function groupTokensByFile(report: TailwindTokenReport, options?: {
433
- key?: TailwindTokenFileKey;
434
- stripAbsolutePaths?: boolean;
435
- }): TailwindTokenByFileMap;
436
-
437
- type TailwindMajorVersion = 2 | 3 | 4;
438
-
439
- declare class TailwindcssPatcher {
440
- readonly options: NormalizedTailwindCssPatchOptions;
441
- readonly packageInfo: PackageInfo;
442
- readonly majorVersion: TailwindMajorVersion;
443
- private readonly cacheContext;
444
- private readonly cacheStore;
445
- private readonly collector;
446
- private patchMemo;
447
- constructor(options?: TailwindCssPatchOptions);
448
- patch(): Promise<PatchRunnerResult>;
449
- getPatchStatus(): Promise<PatchStatusReport>;
450
- getContexts(): TailwindcssRuntimeContext[];
451
- private createPatchSnapshot;
452
- private collectClassSet;
453
- private runTailwindBuildIfNeeded;
454
- private debugCacheRead;
455
- private mergeWithCache;
456
- private mergeWithCacheSync;
457
- private areSetsEqual;
458
- getClassSet(): Promise<Set<string>>;
459
- getClassSetSync(): Set<string> | undefined;
460
- extract(options?: {
461
- write?: boolean;
462
- }): Promise<ExtractResult>;
463
- clearCache(options?: CacheClearOptions): Promise<CacheClearResult>;
464
- extractValidCandidates: typeof extractValidCandidates;
465
- collectContentTokens(options?: {
466
- cwd?: string;
467
- sources?: SourceEntry[];
468
- }): Promise<TailwindTokenReport>;
469
- collectContentTokensByFile(options?: {
470
- cwd?: string;
471
- sources?: SourceEntry[];
472
- key?: TailwindTokenFileKey;
473
- stripAbsolutePaths?: boolean;
474
- }): Promise<TailwindTokenByFileMap>;
475
- }
476
-
477
13
  declare class CacheStore {
478
14
  private readonly options;
479
15
  private readonly context?;
@@ -518,212 +54,6 @@ declare class CacheStore {
518
54
  readIndexSnapshot(): CacheIndexFileV2 | undefined;
519
55
  }
520
56
 
521
- declare const logger: consola.ConsolaInstance;
522
-
523
- declare const MIGRATION_REPORT_KIND = "tw-patch-migrate-report";
524
- declare const MIGRATION_REPORT_SCHEMA_VERSION = 1;
525
-
526
- interface ConfigFileMigrationEntry {
527
- file: string;
528
- changed: boolean;
529
- written: boolean;
530
- rolledBack: boolean;
531
- backupFile?: string;
532
- changes: string[];
533
- }
534
- interface ConfigFileMigrationReport {
535
- reportKind: typeof MIGRATION_REPORT_KIND;
536
- schemaVersion: typeof MIGRATION_REPORT_SCHEMA_VERSION;
537
- generatedAt: string;
538
- tool: {
539
- name: string;
540
- version: string;
541
- };
542
- cwd: string;
543
- dryRun: boolean;
544
- rollbackOnError: boolean;
545
- backupDirectory?: string;
546
- scannedFiles: number;
547
- changedFiles: number;
548
- writtenFiles: number;
549
- backupsWritten: number;
550
- unchangedFiles: number;
551
- missingFiles: number;
552
- entries: ConfigFileMigrationEntry[];
553
- }
554
- interface MigrateConfigFilesOptions {
555
- cwd: string;
556
- files?: string[];
557
- dryRun?: boolean;
558
- workspace?: boolean;
559
- maxDepth?: number;
560
- rollbackOnError?: boolean;
561
- backupDir?: string;
562
- include?: string[];
563
- exclude?: string[];
564
- }
565
- interface RestoreConfigFilesOptions {
566
- cwd: string;
567
- reportFile: string;
568
- dryRun?: boolean;
569
- strict?: boolean;
570
- }
571
- interface RestoreConfigFilesResult {
572
- cwd: string;
573
- reportFile: string;
574
- reportKind?: string;
575
- reportSchemaVersion?: number;
576
- dryRun: boolean;
577
- strict: boolean;
578
- scannedEntries: number;
579
- restorableEntries: number;
580
- restoredFiles: number;
581
- missingBackups: number;
582
- skippedEntries: number;
583
- restored: string[];
584
- }
585
-
586
- type TokenOutputFormat = 'json' | 'lines' | 'grouped-json';
587
- type TokenGroupKey = 'relative' | 'absolute';
588
-
589
- type TailwindcssPatchCommand = 'install' | 'extract' | 'tokens' | 'init' | 'migrate' | 'restore' | 'validate' | 'status';
590
- declare const tailwindcssPatchCommands: TailwindcssPatchCommand[];
591
- type CacOptionConfig = Parameters<Command['option']>[2];
592
- interface TailwindcssPatchCommandOptionDefinition {
593
- flags: string;
594
- description?: string;
595
- config?: CacOptionConfig;
596
- }
597
- interface TailwindcssPatchCommandOptions {
598
- name?: string;
599
- aliases?: string[];
600
- description?: string;
601
- optionDefs?: TailwindcssPatchCommandOptionDefinition[];
602
- appendDefaultOptions?: boolean;
603
- }
604
- interface BaseCommandArgs {
605
- cwd: string;
606
- }
607
- interface InstallCommandArgs extends BaseCommandArgs {
608
- }
609
- interface ExtractCommandArgs extends BaseCommandArgs {
610
- output?: string;
611
- format?: 'json' | 'lines';
612
- css?: string;
613
- write?: boolean;
614
- }
615
- interface TokensCommandArgs extends BaseCommandArgs {
616
- output?: string;
617
- format?: TokenOutputFormat;
618
- groupKey?: TokenGroupKey;
619
- write?: boolean;
620
- }
621
- interface InitCommandArgs extends BaseCommandArgs {
622
- }
623
- interface MigrateCommandArgs extends BaseCommandArgs {
624
- config?: string;
625
- dryRun?: boolean;
626
- workspace?: boolean;
627
- maxDepth?: string | number;
628
- include?: string | string[];
629
- exclude?: string | string[];
630
- reportFile?: string;
631
- backupDir?: string;
632
- check?: boolean;
633
- json?: boolean;
634
- }
635
- interface RestoreCommandArgs extends BaseCommandArgs {
636
- reportFile?: string;
637
- dryRun?: boolean;
638
- strict?: boolean;
639
- json?: boolean;
640
- }
641
- interface ValidateCommandArgs extends BaseCommandArgs {
642
- reportFile?: string;
643
- strict?: boolean;
644
- json?: boolean;
645
- }
646
- interface StatusCommandArgs extends BaseCommandArgs {
647
- json?: boolean;
648
- }
649
- interface TailwindcssPatchCommandArgMap {
650
- install: InstallCommandArgs;
651
- extract: ExtractCommandArgs;
652
- tokens: TokensCommandArgs;
653
- init: InitCommandArgs;
654
- migrate: MigrateCommandArgs;
655
- restore: RestoreCommandArgs;
656
- validate: ValidateCommandArgs;
657
- status: StatusCommandArgs;
658
- }
659
- interface TailwindcssPatchCommandResultMap {
660
- install: void;
661
- extract: ExtractResult;
662
- tokens: TailwindTokenReport;
663
- init: void;
664
- migrate: ConfigFileMigrationReport;
665
- restore: RestoreConfigFilesResult;
666
- validate: RestoreConfigFilesResult;
667
- status: PatchStatusReport;
668
- }
669
- interface TailwindcssPatchCommandContext<TCommand extends TailwindcssPatchCommand> {
670
- cli: CAC;
671
- command: Command;
672
- commandName: TCommand;
673
- args: TailwindcssPatchCommandArgMap[TCommand];
674
- cwd: string;
675
- logger: typeof logger;
676
- loadConfig: () => Promise<TailwindcssConfigResult>;
677
- loadPatchOptions: (overrides?: TailwindCssPatchOptions) => Promise<TailwindCssPatchOptions>;
678
- createPatcher: (overrides?: TailwindCssPatchOptions) => Promise<TailwindcssPatcher>;
679
- }
680
- type TailwindcssPatchCommandHandler<TCommand extends TailwindcssPatchCommand> = (context: TailwindcssPatchCommandContext<TCommand>, next: () => Promise<TailwindcssPatchCommandResultMap[TCommand]>) => Promise<TailwindcssPatchCommandResultMap[TCommand]> | TailwindcssPatchCommandResultMap[TCommand];
681
- type TailwindcssPatchCommandHandlerMap = Partial<{
682
- [K in TailwindcssPatchCommand]: TailwindcssPatchCommandHandler<K>;
683
- }>;
684
- interface TailwindcssPatchCliMountOptions {
685
- commandPrefix?: string;
686
- commands?: TailwindcssPatchCommand[];
687
- commandOptions?: Partial<Record<TailwindcssPatchCommand, TailwindcssPatchCommandOptions>>;
688
- commandHandlers?: TailwindcssPatchCommandHandlerMap;
689
- }
690
- interface TailwindcssPatchCliOptions {
691
- name?: string;
692
- mountOptions?: TailwindcssPatchCliMountOptions;
693
- }
694
-
695
- declare const VALIDATE_EXIT_CODES: {
696
- readonly OK: 0;
697
- readonly REPORT_INCOMPATIBLE: 21;
698
- readonly MISSING_BACKUPS: 22;
699
- readonly IO_ERROR: 23;
700
- readonly UNKNOWN_ERROR: 24;
701
- };
702
- declare const VALIDATE_FAILURE_REASONS: readonly ["report-incompatible", "missing-backups", "io-error", "unknown-error"];
703
- type ValidateFailureReason = (typeof VALIDATE_FAILURE_REASONS)[number];
704
- interface ValidateFailureSummary {
705
- reason: ValidateFailureReason;
706
- exitCode: number;
707
- message: string;
708
- }
709
- interface ValidateJsonSuccessPayload extends RestoreConfigFilesResult {
710
- ok: true;
711
- }
712
- interface ValidateJsonFailurePayload {
713
- ok: false;
714
- reason: ValidateFailureReason;
715
- exitCode: number;
716
- message: string;
717
- }
718
- declare class ValidateCommandError extends Error {
719
- reason: ValidateFailureReason;
720
- exitCode: number;
721
- constructor(summary: ValidateFailureSummary, options?: ErrorOptions);
722
- }
723
-
724
- declare function mountTailwindcssPatchCommands(cli: CAC, options?: TailwindcssPatchCliMountOptions): CAC;
725
- declare function createTailwindcssPatchCli(options?: TailwindcssPatchCliOptions): CAC;
726
-
727
57
  declare function migrateConfigFiles(options: MigrateConfigFilesOptions): Promise<ConfigFileMigrationReport>;
728
58
  declare function restoreConfigFiles(options: RestoreConfigFilesOptions): Promise<RestoreConfigFilesResult>;
729
59
 
@@ -747,6 +77,8 @@ interface PatchStatusContext {
747
77
  }
748
78
  declare function getPatchStatusReport(context: PatchStatusContext): PatchStatusReport;
749
79
 
80
+ declare function mountTailwindcssPatchCommands(cli: CAC, options?: TailwindcssPatchCliMountOptions): CAC;
81
+ declare function createTailwindcssPatchCli(options?: TailwindcssPatchCliOptions): CAC;
750
82
  declare function defineConfig<T extends TailwindcssMangleConfig>(config: T): T;
751
83
 
752
- export { type ApplyOptions, type CacheClearOptions, type CacheClearResult, type CacheClearScope, type CacheContextMetadata, type CacheOptions, type CacheReadMeta, CacheStore, type CacheStrategy, type ConfigFileMigrationEntry, type ConfigFileMigrationReport, type ExposeContextOptions, type ExtendLengthUnitsOptions, type ExtractOptions, type ExtractResult, type ILengthUnitsPatchOptions, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, type MigrateConfigFilesOptions, type NormalizedTailwindCssPatchOptions, type PatchCheckStatus, type PatchName, type PatchStatusEntry, type PatchStatusReport, type RestoreConfigFilesOptions, type RestoreConfigFilesResult, type TailwindCssOptions, type TailwindCssPatchOptions, type TailwindPatchRuntime, type TailwindTokenByFileMap, type TailwindTokenFileKey, type TailwindTokenLocation, type TailwindTokenReport, type TailwindV2Options, type TailwindV3Options, type TailwindV4Options, type TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandContext, type TailwindcssPatchCommandHandler, type TailwindcssPatchCommandHandlerMap, type TailwindcssPatchCommandOptionDefinition, type TailwindcssPatchCommandOptions, TailwindcssPatcher, type 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 };
84
+ export { CacheClearOptions, CacheClearResult, CacheReadMeta, CacheStore, ConfigFileMigrationReport, MigrateConfigFilesOptions, NormalizedTailwindCssPatchOptions, PatchStatusReport, RestoreConfigFilesOptions, RestoreConfigFilesResult, TailwindCssPatchOptions, TailwindcssPatchCliMountOptions, TailwindcssPatchCliOptions, TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, defineConfig, getPatchStatusReport, loadRuntimeContexts, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, restoreConfigFiles, runTailwindBuild };