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