tailwindcss-patch 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -11
- package/dist/chunk-2YHCFHVA.mjs +4739 -0
- package/dist/chunk-ATKR3J24.js +4743 -0
- package/dist/cli.js +20 -5
- package/dist/cli.mjs +20 -5
- package/dist/index.d.mts +283 -23
- package/dist/index.d.ts +283 -23
- package/dist/index.js +16 -2
- package/dist/index.mjs +15 -1
- package/package.json +14 -10
- package/schema/migration-report.schema.json +144 -0
- package/schema/restore-result.schema.json +68 -0
- package/schema/validate-result.schema.json +122 -0
- package/dist/chunk-J27TPXH5.js +0 -2441
- package/dist/chunk-RVSD53YX.mjs +0 -2437
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkATKR3J24js = require('./chunk-ATKR3J24.js');
|
|
4
6
|
|
|
5
7
|
// src/cli.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
cli.
|
|
8
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
9
|
+
async function main() {
|
|
10
|
+
const cli = _chunkATKR3J24js.createTailwindcssPatchCli.call(void 0, );
|
|
11
|
+
cli.help();
|
|
12
|
+
cli.parse(_process2.default.argv, { run: false });
|
|
13
|
+
await cli.runMatchedCommand();
|
|
14
|
+
}
|
|
15
|
+
main().catch((error) => {
|
|
16
|
+
if (error instanceof _chunkATKR3J24js.ValidateCommandError) {
|
|
17
|
+
_process2.default.exitCode = error.exitCode;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
21
|
+
_chunkATKR3J24js.logger_default.error(message);
|
|
22
|
+
_process2.default.exitCode = 1;
|
|
23
|
+
});
|
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ValidateCommandError,
|
|
3
|
+
createTailwindcssPatchCli,
|
|
4
|
+
logger_default
|
|
5
|
+
} from "./chunk-2YHCFHVA.mjs";
|
|
4
6
|
|
|
5
7
|
// src/cli.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
cli
|
|
8
|
+
import process from "process";
|
|
9
|
+
async function main() {
|
|
10
|
+
const cli = createTailwindcssPatchCli();
|
|
11
|
+
cli.help();
|
|
12
|
+
cli.parse(process.argv, { run: false });
|
|
13
|
+
await cli.runMatchedCommand();
|
|
14
|
+
}
|
|
15
|
+
main().catch((error) => {
|
|
16
|
+
if (error instanceof ValidateCommandError) {
|
|
17
|
+
process.exitCode = error.exitCode;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
21
|
+
logger_default.error(message);
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
});
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SourceEntry } from '@tailwindcss/oxide';
|
|
2
|
-
import postcss, {
|
|
2
|
+
import postcss, { Rule, Node } from 'postcss';
|
|
3
3
|
import { Config } from 'tailwindcss';
|
|
4
4
|
import { PackageResolvingOptions, PackageInfo } from 'local-pkg';
|
|
5
5
|
import { TailwindLocatorOptions, TailwindNextOptions, getConfig } from '@tailwindcss-mangle/config';
|
|
@@ -30,11 +30,11 @@ interface CacheUserOptions {
|
|
|
30
30
|
driver?: CacheDriver;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Preferred options for extraction output behavior.
|
|
34
34
|
*/
|
|
35
|
-
interface
|
|
35
|
+
interface TailwindExtractionUserOptions {
|
|
36
36
|
/** Whether to produce an output file. */
|
|
37
|
-
|
|
37
|
+
write?: boolean;
|
|
38
38
|
/** Optional absolute or relative path to the output file. */
|
|
39
39
|
file?: string;
|
|
40
40
|
/** Output format, defaults to JSON when omitted. */
|
|
@@ -44,6 +44,22 @@ interface OutputUserOptions {
|
|
|
44
44
|
/** Whether to strip the universal selector (`*`) from the final list. */
|
|
45
45
|
removeUniversalSelector?: boolean;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use `TailwindExtractionUserOptions`.
|
|
49
|
+
* Legacy output options kept for backward compatibility and will be removed in the next major version.
|
|
50
|
+
*/
|
|
51
|
+
interface OutputUserOptions {
|
|
52
|
+
/** @deprecated Use `extract.write` instead. */
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
/** @deprecated Use `extract.file` instead. */
|
|
55
|
+
file?: string;
|
|
56
|
+
/** @deprecated Use `extract.format` instead. */
|
|
57
|
+
format?: 'json' | 'lines';
|
|
58
|
+
/** @deprecated Use `extract.pretty` instead. */
|
|
59
|
+
pretty?: number | boolean;
|
|
60
|
+
/** @deprecated Use `extract.removeUniversalSelector` instead. */
|
|
61
|
+
removeUniversalSelector?: boolean;
|
|
62
|
+
}
|
|
47
63
|
/**
|
|
48
64
|
* Options controlling how Tailwind contexts are exposed during runtime patching.
|
|
49
65
|
*/
|
|
@@ -59,18 +75,30 @@ interface ExtendLengthUnitsUserOptions extends Partial<ILengthUnitsPatchOptions>
|
|
|
59
75
|
enabled?: boolean;
|
|
60
76
|
}
|
|
61
77
|
/**
|
|
62
|
-
*
|
|
78
|
+
* Preferred options for runtime patch behavior.
|
|
63
79
|
*/
|
|
64
|
-
interface
|
|
80
|
+
interface PatchApplyUserOptions {
|
|
81
|
+
/** Whether patched files can be overwritten on disk. */
|
|
82
|
+
overwrite?: boolean;
|
|
65
83
|
/** Whether to expose runtime Tailwind contexts (or configure how they are exposed). */
|
|
66
84
|
exposeContext?: boolean | ExposeContextUserOptions;
|
|
67
85
|
/** Extends the length-unit patch or disables it entirely. */
|
|
68
86
|
extendLengthUnits?: false | ExtendLengthUnitsUserOptions;
|
|
69
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Use `PatchApplyUserOptions`.
|
|
90
|
+
* Legacy nested feature options kept for backward compatibility and will be removed in the next major version.
|
|
91
|
+
*/
|
|
92
|
+
interface FeatureUserOptions {
|
|
93
|
+
/** @deprecated Use `apply.exposeContext` instead. */
|
|
94
|
+
exposeContext?: boolean | ExposeContextUserOptions;
|
|
95
|
+
/** @deprecated Use `apply.extendLengthUnits` instead. */
|
|
96
|
+
extendLengthUnits?: false | ExtendLengthUnitsUserOptions;
|
|
97
|
+
}
|
|
70
98
|
/**
|
|
71
99
|
* Shared configuration used for Tailwind v2/v3 patching flows.
|
|
72
100
|
*/
|
|
73
|
-
interface
|
|
101
|
+
interface TailwindRuntimeConfigUserOptions {
|
|
74
102
|
/** Path to a Tailwind config file when auto-detection is insufficient. */
|
|
75
103
|
config?: string;
|
|
76
104
|
/** Custom working directory used when resolving config-relative paths. */
|
|
@@ -78,10 +106,16 @@ interface TailwindConfigUserOptions {
|
|
|
78
106
|
/** Optional PostCSS plugin name to use instead of the default. */
|
|
79
107
|
postcssPlugin?: string;
|
|
80
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated Use `TailwindRuntimeConfigUserOptions`.
|
|
111
|
+
* Legacy naming kept for backward compatibility and will be removed in the next major version.
|
|
112
|
+
*/
|
|
113
|
+
interface TailwindConfigUserOptions extends TailwindRuntimeConfigUserOptions {
|
|
114
|
+
}
|
|
81
115
|
/**
|
|
82
116
|
* Additional configuration specific to Tailwind CSS v4 extraction.
|
|
83
117
|
*/
|
|
84
|
-
interface
|
|
118
|
+
interface TailwindV4RuntimeUserOptions {
|
|
85
119
|
/** Base directory used when resolving v4 content sources and configs. */
|
|
86
120
|
base?: string;
|
|
87
121
|
/** Raw CSS passed directly to the v4 design system. */
|
|
@@ -94,7 +128,7 @@ interface TailwindV4UserOptions {
|
|
|
94
128
|
/**
|
|
95
129
|
* High-level Tailwind patch configuration shared across versions.
|
|
96
130
|
*/
|
|
97
|
-
interface
|
|
131
|
+
interface TailwindcssUserOptions extends TailwindRuntimeConfigUserOptions {
|
|
98
132
|
/**
|
|
99
133
|
* Optional hint for picking the patch strategy.
|
|
100
134
|
* When omitted we infer from the installed Tailwind CSS package version.
|
|
@@ -105,11 +139,17 @@ interface TailwindUserOptions extends TailwindConfigUserOptions {
|
|
|
105
139
|
/** Package resolution options forwarded to `local-pkg`. */
|
|
106
140
|
resolve?: PackageResolvingOptions;
|
|
107
141
|
/** Overrides applied when patching Tailwind CSS v2. */
|
|
108
|
-
v2?:
|
|
142
|
+
v2?: TailwindRuntimeConfigUserOptions;
|
|
109
143
|
/** Overrides applied when patching Tailwind CSS v3. */
|
|
110
|
-
v3?:
|
|
144
|
+
v3?: TailwindRuntimeConfigUserOptions;
|
|
111
145
|
/** Options specific to Tailwind CSS v4 patching. */
|
|
112
|
-
v4?:
|
|
146
|
+
v4?: TailwindV4RuntimeUserOptions;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @deprecated Use `TailwindcssUserOptions`.
|
|
150
|
+
* Legacy naming kept for backward compatibility and will be removed in the next major version.
|
|
151
|
+
*/
|
|
152
|
+
interface TailwindUserOptions extends TailwindcssUserOptions {
|
|
113
153
|
}
|
|
114
154
|
/**
|
|
115
155
|
* Root configuration consumed by the Tailwind CSS patch runner.
|
|
@@ -119,18 +159,33 @@ interface TailwindcssPatchOptions {
|
|
|
119
159
|
* Base directory used when resolving Tailwind resources.
|
|
120
160
|
* Defaults to `process.cwd()`.
|
|
121
161
|
*/
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
|
|
162
|
+
projectRoot?: string;
|
|
163
|
+
/** Preferred Tailwind runtime configuration. */
|
|
164
|
+
tailwindcss?: TailwindcssUserOptions;
|
|
165
|
+
/** Preferred patch toggles. */
|
|
166
|
+
apply?: PatchApplyUserOptions;
|
|
167
|
+
/** Preferred extraction output settings. */
|
|
168
|
+
extract?: TailwindExtractionUserOptions;
|
|
129
169
|
/** Optional function that filters final class names. */
|
|
130
170
|
filter?: (className: string) => boolean;
|
|
131
171
|
/** Cache configuration or boolean to enable/disable quickly. */
|
|
132
172
|
cache?: boolean | CacheUserOptions;
|
|
133
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* Base directory used when resolving Tailwind resources.
|
|
175
|
+
* Defaults to `process.cwd()`.
|
|
176
|
+
* @deprecated Use `projectRoot` instead.
|
|
177
|
+
*/
|
|
178
|
+
cwd?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Whether to overwrite generated artifacts (e.g., caches, outputs).
|
|
181
|
+
* @deprecated Use `apply.overwrite` instead.
|
|
182
|
+
*/
|
|
183
|
+
overwrite?: boolean;
|
|
184
|
+
/** @deprecated Use `tailwindcss` instead. */
|
|
185
|
+
tailwind?: TailwindUserOptions;
|
|
186
|
+
/** @deprecated Use `apply` instead. */
|
|
187
|
+
features?: FeatureUserOptions;
|
|
188
|
+
/** @deprecated Use `extract` instead. */
|
|
134
189
|
output?: OutputUserOptions;
|
|
135
190
|
}
|
|
136
191
|
/**
|
|
@@ -200,6 +255,60 @@ interface NormalizedTailwindcssPatchOptions {
|
|
|
200
255
|
filter: (className: string) => boolean;
|
|
201
256
|
}
|
|
202
257
|
|
|
258
|
+
declare const CACHE_SCHEMA_VERSION = 2;
|
|
259
|
+
declare const CACHE_FINGERPRINT_VERSION = 1;
|
|
260
|
+
type CacheSchemaVersion = typeof CACHE_SCHEMA_VERSION;
|
|
261
|
+
type CacheFingerprintVersion = typeof CACHE_FINGERPRINT_VERSION;
|
|
262
|
+
type CacheClearScope = 'current' | 'all';
|
|
263
|
+
interface CacheContextMetadata {
|
|
264
|
+
fingerprintVersion: CacheFingerprintVersion;
|
|
265
|
+
projectRootRealpath: string;
|
|
266
|
+
processCwdRealpath: string;
|
|
267
|
+
cacheCwdRealpath: string;
|
|
268
|
+
tailwindConfigPath?: string;
|
|
269
|
+
tailwindConfigMtimeMs?: number;
|
|
270
|
+
tailwindPackageRootRealpath: string;
|
|
271
|
+
tailwindPackageVersion: string;
|
|
272
|
+
patcherVersion: string;
|
|
273
|
+
majorVersion: 2 | 3 | 4;
|
|
274
|
+
optionsHash: string;
|
|
275
|
+
}
|
|
276
|
+
interface CacheContextDescriptor {
|
|
277
|
+
fingerprint: string;
|
|
278
|
+
metadata: CacheContextMetadata;
|
|
279
|
+
}
|
|
280
|
+
interface CacheIndexEntry {
|
|
281
|
+
context: CacheContextMetadata;
|
|
282
|
+
values: string[];
|
|
283
|
+
updatedAt: string;
|
|
284
|
+
}
|
|
285
|
+
interface CacheIndexFileV2 {
|
|
286
|
+
schemaVersion: CacheSchemaVersion;
|
|
287
|
+
updatedAt: string;
|
|
288
|
+
contexts: Record<string, CacheIndexEntry>;
|
|
289
|
+
}
|
|
290
|
+
type CacheReadReason = 'hit' | 'cache-disabled' | 'noop-driver' | 'file-missing' | 'context-not-found' | 'context-mismatch' | 'legacy-schema' | 'invalid-schema';
|
|
291
|
+
interface CacheReadMeta {
|
|
292
|
+
hit: boolean;
|
|
293
|
+
reason: CacheReadReason;
|
|
294
|
+
fingerprint?: string;
|
|
295
|
+
schemaVersion?: number;
|
|
296
|
+
details: string[];
|
|
297
|
+
}
|
|
298
|
+
interface CacheReadResult {
|
|
299
|
+
data: Set<string>;
|
|
300
|
+
meta: CacheReadMeta;
|
|
301
|
+
}
|
|
302
|
+
interface CacheClearOptions {
|
|
303
|
+
scope?: CacheClearScope;
|
|
304
|
+
}
|
|
305
|
+
interface CacheClearResult {
|
|
306
|
+
scope: CacheClearScope;
|
|
307
|
+
filesRemoved: number;
|
|
308
|
+
entriesRemoved: number;
|
|
309
|
+
contextsRemoved: number;
|
|
310
|
+
}
|
|
311
|
+
|
|
203
312
|
type TailwindcssClassCacheEntry = Rule | {
|
|
204
313
|
layer: string;
|
|
205
314
|
options: Record<string, any>;
|
|
@@ -380,6 +489,7 @@ interface LegacyTailwindcssPatcherOptions {
|
|
|
380
489
|
interface ExtractValidCandidatesOption {
|
|
381
490
|
sources?: SourceEntry[];
|
|
382
491
|
base?: string;
|
|
492
|
+
baseFallbacks?: string[];
|
|
383
493
|
css?: string;
|
|
384
494
|
cwd?: string;
|
|
385
495
|
}
|
|
@@ -406,6 +516,7 @@ declare class TailwindcssPatcher {
|
|
|
406
516
|
readonly options: NormalizedTailwindcssPatchOptions;
|
|
407
517
|
readonly packageInfo: PackageInfo;
|
|
408
518
|
readonly majorVersion: TailwindMajorVersion;
|
|
519
|
+
private readonly cacheContext;
|
|
409
520
|
private readonly cacheStore;
|
|
410
521
|
constructor(options?: TailwindcssPatcherInitOptions);
|
|
411
522
|
patch(): Promise<PatchRunnerResult>;
|
|
@@ -413,6 +524,7 @@ declare class TailwindcssPatcher {
|
|
|
413
524
|
getContexts(): TailwindcssRuntimeContext[];
|
|
414
525
|
private runTailwindBuildIfNeeded;
|
|
415
526
|
private collectClassSet;
|
|
527
|
+
private debugCacheRead;
|
|
416
528
|
private mergeWithCache;
|
|
417
529
|
private mergeWithCacheSync;
|
|
418
530
|
getClassSet(): Promise<Set<string>>;
|
|
@@ -420,6 +532,7 @@ declare class TailwindcssPatcher {
|
|
|
420
532
|
extract(options?: {
|
|
421
533
|
write?: boolean;
|
|
422
534
|
}): Promise<ExtractResult>;
|
|
535
|
+
clearCache(options?: CacheClearOptions): Promise<CacheClearResult>;
|
|
423
536
|
extractValidCandidates: typeof extractValidCandidates;
|
|
424
537
|
collectContentTokens(options?: {
|
|
425
538
|
cwd?: string;
|
|
@@ -435,9 +548,15 @@ declare class TailwindcssPatcher {
|
|
|
435
548
|
|
|
436
549
|
declare class CacheStore {
|
|
437
550
|
private readonly options;
|
|
551
|
+
private readonly context?;
|
|
438
552
|
private readonly driver;
|
|
553
|
+
private readonly lockPath;
|
|
439
554
|
private memoryCache;
|
|
440
|
-
|
|
555
|
+
private memoryIndex;
|
|
556
|
+
private lastReadMeta;
|
|
557
|
+
constructor(options: NormalizedCacheOptions, context?: CacheContextDescriptor | undefined);
|
|
558
|
+
private isContextAware;
|
|
559
|
+
private createEmptyIndex;
|
|
441
560
|
private ensureDir;
|
|
442
561
|
private ensureDirSync;
|
|
443
562
|
private createTempPath;
|
|
@@ -445,16 +564,128 @@ declare class CacheStore {
|
|
|
445
564
|
private replaceCacheFileSync;
|
|
446
565
|
private cleanupTempFile;
|
|
447
566
|
private cleanupTempFileSync;
|
|
567
|
+
private delay;
|
|
568
|
+
private acquireLock;
|
|
569
|
+
private releaseLockSyncOrAsync;
|
|
570
|
+
private acquireLockSync;
|
|
571
|
+
private withFileLock;
|
|
572
|
+
private withFileLockSync;
|
|
573
|
+
private normalizeContextEntry;
|
|
574
|
+
private normalizeIndexFile;
|
|
575
|
+
private readParsedCacheFile;
|
|
576
|
+
private readParsedCacheFileSync;
|
|
577
|
+
private findProjectMatch;
|
|
578
|
+
private writeIndexFile;
|
|
579
|
+
private writeIndexFileSync;
|
|
448
580
|
write(data: Set<string>): Promise<string | undefined>;
|
|
449
581
|
writeSync(data: Set<string>): string | undefined;
|
|
582
|
+
readWithMeta(): Promise<CacheReadResult>;
|
|
583
|
+
readWithMetaSync(): CacheReadResult;
|
|
450
584
|
read(): Promise<Set<string>>;
|
|
451
585
|
readSync(): Set<string>;
|
|
586
|
+
getLastReadMeta(): CacheReadMeta;
|
|
587
|
+
private countEntriesFromParsed;
|
|
588
|
+
clear(options?: CacheClearOptions): Promise<CacheClearResult>;
|
|
589
|
+
clearSync(options?: CacheClearOptions): CacheClearResult;
|
|
590
|
+
readIndexSnapshot(): CacheIndexFileV2 | undefined;
|
|
452
591
|
}
|
|
453
592
|
|
|
593
|
+
declare const MIGRATION_REPORT_KIND = "tw-patch-migrate-report";
|
|
594
|
+
declare const MIGRATION_REPORT_SCHEMA_VERSION = 1;
|
|
595
|
+
interface ConfigFileMigrationEntry {
|
|
596
|
+
file: string;
|
|
597
|
+
changed: boolean;
|
|
598
|
+
written: boolean;
|
|
599
|
+
rolledBack: boolean;
|
|
600
|
+
backupFile?: string;
|
|
601
|
+
changes: string[];
|
|
602
|
+
}
|
|
603
|
+
interface ConfigFileMigrationReport {
|
|
604
|
+
reportKind: typeof MIGRATION_REPORT_KIND;
|
|
605
|
+
schemaVersion: typeof MIGRATION_REPORT_SCHEMA_VERSION;
|
|
606
|
+
generatedAt: string;
|
|
607
|
+
tool: {
|
|
608
|
+
name: string;
|
|
609
|
+
version: string;
|
|
610
|
+
};
|
|
611
|
+
cwd: string;
|
|
612
|
+
dryRun: boolean;
|
|
613
|
+
rollbackOnError: boolean;
|
|
614
|
+
backupDirectory?: string;
|
|
615
|
+
scannedFiles: number;
|
|
616
|
+
changedFiles: number;
|
|
617
|
+
writtenFiles: number;
|
|
618
|
+
backupsWritten: number;
|
|
619
|
+
unchangedFiles: number;
|
|
620
|
+
missingFiles: number;
|
|
621
|
+
entries: ConfigFileMigrationEntry[];
|
|
622
|
+
}
|
|
623
|
+
interface MigrateConfigFilesOptions {
|
|
624
|
+
cwd: string;
|
|
625
|
+
files?: string[];
|
|
626
|
+
dryRun?: boolean;
|
|
627
|
+
workspace?: boolean;
|
|
628
|
+
maxDepth?: number;
|
|
629
|
+
rollbackOnError?: boolean;
|
|
630
|
+
backupDir?: string;
|
|
631
|
+
include?: string[];
|
|
632
|
+
exclude?: string[];
|
|
633
|
+
}
|
|
634
|
+
interface RestoreConfigFilesOptions {
|
|
635
|
+
cwd: string;
|
|
636
|
+
reportFile: string;
|
|
637
|
+
dryRun?: boolean;
|
|
638
|
+
strict?: boolean;
|
|
639
|
+
}
|
|
640
|
+
interface RestoreConfigFilesResult {
|
|
641
|
+
cwd: string;
|
|
642
|
+
reportFile: string;
|
|
643
|
+
reportKind?: string;
|
|
644
|
+
reportSchemaVersion?: number;
|
|
645
|
+
dryRun: boolean;
|
|
646
|
+
strict: boolean;
|
|
647
|
+
scannedEntries: number;
|
|
648
|
+
restorableEntries: number;
|
|
649
|
+
restoredFiles: number;
|
|
650
|
+
missingBackups: number;
|
|
651
|
+
skippedEntries: number;
|
|
652
|
+
restored: string[];
|
|
653
|
+
}
|
|
654
|
+
declare function migrateConfigFiles(options: MigrateConfigFilesOptions): Promise<ConfigFileMigrationReport>;
|
|
655
|
+
declare function restoreConfigFiles(options: RestoreConfigFilesOptions): Promise<RestoreConfigFilesResult>;
|
|
656
|
+
|
|
454
657
|
declare const logger: consola.ConsolaInstance;
|
|
455
658
|
|
|
456
|
-
type TailwindcssPatchCommand = 'install' | 'extract' | 'tokens' | 'init' | 'status';
|
|
659
|
+
type TailwindcssPatchCommand = 'install' | 'extract' | 'tokens' | 'init' | 'migrate' | 'restore' | 'validate' | 'status';
|
|
457
660
|
declare const tailwindcssPatchCommands: TailwindcssPatchCommand[];
|
|
661
|
+
declare const VALIDATE_EXIT_CODES: {
|
|
662
|
+
readonly OK: 0;
|
|
663
|
+
readonly REPORT_INCOMPATIBLE: 21;
|
|
664
|
+
readonly MISSING_BACKUPS: 22;
|
|
665
|
+
readonly IO_ERROR: 23;
|
|
666
|
+
readonly UNKNOWN_ERROR: 24;
|
|
667
|
+
};
|
|
668
|
+
declare const VALIDATE_FAILURE_REASONS: readonly ["report-incompatible", "missing-backups", "io-error", "unknown-error"];
|
|
669
|
+
type ValidateFailureReason = (typeof VALIDATE_FAILURE_REASONS)[number];
|
|
670
|
+
interface ValidateFailureSummary {
|
|
671
|
+
reason: ValidateFailureReason;
|
|
672
|
+
exitCode: number;
|
|
673
|
+
message: string;
|
|
674
|
+
}
|
|
675
|
+
interface ValidateJsonSuccessPayload extends RestoreConfigFilesResult {
|
|
676
|
+
ok: true;
|
|
677
|
+
}
|
|
678
|
+
interface ValidateJsonFailurePayload {
|
|
679
|
+
ok: false;
|
|
680
|
+
reason: ValidateFailureReason;
|
|
681
|
+
exitCode: number;
|
|
682
|
+
message: string;
|
|
683
|
+
}
|
|
684
|
+
declare class ValidateCommandError extends Error {
|
|
685
|
+
reason: ValidateFailureReason;
|
|
686
|
+
exitCode: number;
|
|
687
|
+
constructor(summary: ValidateFailureSummary, options?: ErrorOptions);
|
|
688
|
+
}
|
|
458
689
|
type TokenOutputFormat = 'json' | 'lines' | 'grouped-json';
|
|
459
690
|
type TokenGroupKey = 'relative' | 'absolute';
|
|
460
691
|
type CacOptionConfig = Parameters<Command['option']>[2];
|
|
@@ -489,6 +720,29 @@ interface TokensCommandArgs extends BaseCommandArgs {
|
|
|
489
720
|
}
|
|
490
721
|
interface InitCommandArgs extends BaseCommandArgs {
|
|
491
722
|
}
|
|
723
|
+
interface MigrateCommandArgs extends BaseCommandArgs {
|
|
724
|
+
config?: string;
|
|
725
|
+
dryRun?: boolean;
|
|
726
|
+
workspace?: boolean;
|
|
727
|
+
maxDepth?: string | number;
|
|
728
|
+
include?: string | string[];
|
|
729
|
+
exclude?: string | string[];
|
|
730
|
+
reportFile?: string;
|
|
731
|
+
backupDir?: string;
|
|
732
|
+
check?: boolean;
|
|
733
|
+
json?: boolean;
|
|
734
|
+
}
|
|
735
|
+
interface RestoreCommandArgs extends BaseCommandArgs {
|
|
736
|
+
reportFile?: string;
|
|
737
|
+
dryRun?: boolean;
|
|
738
|
+
strict?: boolean;
|
|
739
|
+
json?: boolean;
|
|
740
|
+
}
|
|
741
|
+
interface ValidateCommandArgs extends BaseCommandArgs {
|
|
742
|
+
reportFile?: string;
|
|
743
|
+
strict?: boolean;
|
|
744
|
+
json?: boolean;
|
|
745
|
+
}
|
|
492
746
|
interface StatusCommandArgs extends BaseCommandArgs {
|
|
493
747
|
json?: boolean;
|
|
494
748
|
}
|
|
@@ -497,6 +751,9 @@ interface TailwindcssPatchCommandArgMap {
|
|
|
497
751
|
extract: ExtractCommandArgs;
|
|
498
752
|
tokens: TokensCommandArgs;
|
|
499
753
|
init: InitCommandArgs;
|
|
754
|
+
migrate: MigrateCommandArgs;
|
|
755
|
+
restore: RestoreCommandArgs;
|
|
756
|
+
validate: ValidateCommandArgs;
|
|
500
757
|
status: StatusCommandArgs;
|
|
501
758
|
}
|
|
502
759
|
interface TailwindcssPatchCommandResultMap {
|
|
@@ -504,6 +761,9 @@ interface TailwindcssPatchCommandResultMap {
|
|
|
504
761
|
extract: ExtractResult;
|
|
505
762
|
tokens: TailwindTokenReport;
|
|
506
763
|
init: void;
|
|
764
|
+
migrate: ConfigFileMigrationReport;
|
|
765
|
+
restore: RestoreConfigFilesResult;
|
|
766
|
+
validate: RestoreConfigFilesResult;
|
|
507
767
|
status: PatchStatusReport;
|
|
508
768
|
}
|
|
509
769
|
interface TailwindcssPatchCommandContext<TCommand extends TailwindcssPatchCommand> {
|
|
@@ -556,4 +816,4 @@ interface TailwindBuildOptions {
|
|
|
556
816
|
}
|
|
557
817
|
declare function runTailwindBuild(options: TailwindBuildOptions): Promise<postcss.Result<postcss.Root>>;
|
|
558
818
|
|
|
559
|
-
export { CacheStore, type CacheStrategy, type ExtractResult, type ILengthUnitsPatchOptions, type NormalizedTailwindcssPatchOptions, type PatchCheckStatus, type PatchName, type PatchStatusEntry, type PatchStatusReport, type TailwindPatchRuntime, type TailwindTokenByFileMap, type TailwindTokenFileKey, type TailwindTokenLocation, type TailwindTokenReport, type TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandContext, type TailwindcssPatchCommandHandler, type TailwindcssPatchCommandHandlerMap, type TailwindcssPatchCommandOptionDefinition, type TailwindcssPatchCommandOptions, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, logger, mountTailwindcssPatchCommands, normalizeOptions, runTailwindBuild, tailwindcssPatchCommands };
|
|
819
|
+
export { type CacheClearOptions, type CacheClearResult, type CacheClearScope, type CacheContextMetadata, type CacheReadMeta, CacheStore, type CacheStrategy, type ConfigFileMigrationEntry, type ConfigFileMigrationReport, 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 TailwindPatchRuntime, type TailwindTokenByFileMap, type TailwindTokenFileKey, type TailwindTokenLocation, type TailwindTokenReport, type TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandContext, type TailwindcssPatchCommandHandler, type TailwindcssPatchCommandHandlerMap, type TailwindcssPatchCommandOptionDefinition, type TailwindcssPatchCommandOptions, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, type ValidateFailureReason, type ValidateFailureSummary, type ValidateJsonFailurePayload, type ValidateJsonSuccessPayload, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };
|