tailwindcss-patch 9.4.1 → 9.4.3
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 +69 -0
- package/dist/{cli-CBVPia5Z.js → cli-BztQHMRp.js} +63 -64
- package/dist/{cli-CgBdW1U5.mjs → cli-D0jXMGXf.mjs} +1 -1
- package/dist/cli.js +5 -6
- package/dist/cli.mjs +2 -2
- package/dist/commands/cli-runtime.d.mts +1 -1
- package/dist/commands/cli-runtime.d.ts +1 -1
- package/dist/commands/cli-runtime.js +6 -6
- package/dist/commands/cli-runtime.mjs +2 -2
- package/dist/{dist-B1VBpHtd.js → dist-DDcbvOwe.js} +2 -2
- package/dist/index.d.mts +105 -5
- package/dist/index.d.ts +105 -5
- package/dist/index.js +325 -62
- package/dist/index.mjs +253 -4
- package/dist/{migrate-config-DqknZpUe.mjs → validate-Bug_WYcU.mjs} +193 -93
- package/dist/{validate-CaJv2g5K.d.ts → validate-BuqRodYI.d.ts} +65 -16
- package/dist/{migrate-config-Dn9OTXpO.js → validate-DbuKewV-.js} +257 -100
- package/dist/{validate-Dr7IkGU8.d.mts → validate-oAkURzUC.d.mts} +65 -15
- package/package.json +9 -9
- package/src/extraction/candidate-extractor.ts +76 -12
- package/src/public-api.ts +54 -13
- package/src/style-candidates.ts +35 -0
- package/src/style-generator.ts +80 -0
- package/src/v3/index.ts +11 -0
- package/src/v3/style-generator.ts +384 -0
- package/src/v4/bare-arbitrary-values.ts +127 -2
- package/src/v4/engine.ts +5 -2
- package/src/v4/index.ts +20 -4
- package/src/v4/node-adapter.ts +1 -1
- package/src/v4/source-scan.ts +1 -1
- package/src/v4/style-generator.ts +44 -0
- package/src/v4/types.ts +23 -0
- package/dist/chunk-8l464Juk.js +0 -28
- /package/dist/{dist-BjUV1yEM.mjs → dist-CxmNpfyy.mjs} +0 -0
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ Modern tooling to patch Tailwind CSS, capture runtime contexts, and materialise
|
|
|
6
6
|
- Traverse Tailwind v4 projects by scanning CSS outputs and content sources.
|
|
7
7
|
- Write class inventories to disk or keep them in memory for tooling integrations.
|
|
8
8
|
- Control caching, filtering, and custom unit extensions from a single, typed entrypoint.
|
|
9
|
+
- Generate Tailwind v3/v4 CSS, or fully custom CSS, directly from in-memory tokens and source snippets.
|
|
9
10
|
|
|
10
11
|
## Installation
|
|
11
12
|
|
|
@@ -115,6 +116,74 @@ Skip `next()` to fully replace a command (e.g. custom `init` or cache clearing b
|
|
|
115
116
|
| `--css <file>` | Provide a CSS entry file when working with Tailwind v4 projects. |
|
|
116
117
|
| `--no-write` | Skip writing to disk and only return the collected classes. |
|
|
117
118
|
|
|
119
|
+
### Style generation
|
|
120
|
+
|
|
121
|
+
Use the style generator when you want `tailwindcss-patch` to act as the CSS engine and drive your own output format. Tailwind v4 uses `@tailwindcss/node`; Tailwind v3 uses Tailwind v3's internal JIT engine (`createContext` + `generateRules`) without running the Tailwind PostCSS plugin.
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { writeFile } from 'node:fs/promises'
|
|
125
|
+
import { generateTailwindStyle } from 'tailwindcss-patch'
|
|
126
|
+
|
|
127
|
+
const result = await generateTailwindStyle({
|
|
128
|
+
version: 4,
|
|
129
|
+
css: '@import "tailwindcss";',
|
|
130
|
+
candidates: ['text-red-500'],
|
|
131
|
+
sources: [
|
|
132
|
+
{
|
|
133
|
+
content: '<view class="min-h-screen rounded-[18px]"></view>',
|
|
134
|
+
extension: 'tsx',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
await writeFile('dist/style.css', result.css)
|
|
140
|
+
await writeFile('dist/tokens.json', JSON.stringify([...result.tokens], null, 2))
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Generate Tailwind v3 CSS from the same candidate pipeline:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { generateTailwindStyle } from 'tailwindcss-patch'
|
|
147
|
+
|
|
148
|
+
const result = await generateTailwindStyle({
|
|
149
|
+
version: 3,
|
|
150
|
+
candidates: ['text-red-500'],
|
|
151
|
+
sources: [
|
|
152
|
+
{
|
|
153
|
+
content: '<view class="min-h-screen rounded-[18px]"></view>',
|
|
154
|
+
extension: 'wxml',
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
config: {
|
|
158
|
+
corePlugins: {
|
|
159
|
+
preflight: false,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Or bypass Tailwind CSS output entirely and provide your own CSS generator:
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
import { escapeCssClassName, generateTailwindStyle } from 'tailwindcss-patch'
|
|
169
|
+
|
|
170
|
+
const result = await generateTailwindStyle({
|
|
171
|
+
version: 'custom',
|
|
172
|
+
candidates: ['token-card'],
|
|
173
|
+
sources: [
|
|
174
|
+
{
|
|
175
|
+
content: '<view class="rounded-[18px]"></view>',
|
|
176
|
+
extension: 'wxml',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
generate({ tokens }) {
|
|
180
|
+
return [...tokens]
|
|
181
|
+
.map(token => `.${escapeCssClassName(token)}{--tw-token:"${token}"}`)
|
|
182
|
+
.join('\n')
|
|
183
|
+
},
|
|
184
|
+
})
|
|
185
|
+
```
|
|
186
|
+
|
|
118
187
|
The CLI loads `tailwindcss-patch.config.ts` via `@tailwindcss-mangle/config`. v9 expects the modern `registry` shape; use `tw-patch migrate` before upgrading if your config still uses deprecated keys.
|
|
119
188
|
|
|
120
189
|
### Public Type Names
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_migrate_config = require("./migrate-config-Dn9OTXpO.js");
|
|
1
|
+
const require_validate = require("./validate-DbuKewV-.js");
|
|
3
2
|
let node_process = require("node:process");
|
|
4
|
-
node_process =
|
|
3
|
+
node_process = require_validate.__toESM(node_process);
|
|
5
4
|
let fs_extra = require("fs-extra");
|
|
6
|
-
fs_extra =
|
|
5
|
+
fs_extra = require_validate.__toESM(fs_extra);
|
|
7
6
|
let pathe = require("pathe");
|
|
8
|
-
pathe =
|
|
7
|
+
pathe = require_validate.__toESM(pathe);
|
|
9
8
|
let cac = require("cac");
|
|
10
|
-
cac =
|
|
9
|
+
cac = require_validate.__toESM(cac);
|
|
11
10
|
//#region src/commands/token-output.ts
|
|
12
11
|
const TOKEN_FORMATS = [
|
|
13
12
|
"json",
|
|
@@ -246,17 +245,17 @@ function createMemoizedPromiseRunner(factory) {
|
|
|
246
245
|
};
|
|
247
246
|
}
|
|
248
247
|
function createTailwindcssPatchCommandContext(cli, command, commandName, args, cwd) {
|
|
249
|
-
const loadCachedConfig = createMemoizedPromiseRunner(() =>
|
|
250
|
-
const loadCachedPatchOptions = createMemoizedPromiseRunner(() =>
|
|
248
|
+
const loadCachedConfig = createMemoizedPromiseRunner(() => require_validate.loadWorkspaceConfigModule().then((mod) => mod.getConfig(cwd)));
|
|
249
|
+
const loadCachedPatchOptions = createMemoizedPromiseRunner(() => require_validate.loadPatchOptionsForWorkspace(cwd));
|
|
251
250
|
const createCachedPatcher = createMemoizedPromiseRunner(async () => {
|
|
252
|
-
return new
|
|
251
|
+
return new require_validate.TailwindcssPatcher(await loadCachedPatchOptions());
|
|
253
252
|
});
|
|
254
253
|
const loadPatchOptionsForContext = (overrides) => {
|
|
255
|
-
if (overrides) return
|
|
254
|
+
if (overrides) return require_validate.loadPatchOptionsForWorkspace(cwd, overrides);
|
|
256
255
|
return loadCachedPatchOptions();
|
|
257
256
|
};
|
|
258
257
|
const createPatcherForContext = async (overrides) => {
|
|
259
|
-
if (overrides) return new
|
|
258
|
+
if (overrides) return new require_validate.TailwindcssPatcher(await require_validate.loadPatchOptionsForWorkspace(cwd, overrides));
|
|
260
259
|
return createCachedPatcher();
|
|
261
260
|
};
|
|
262
261
|
return {
|
|
@@ -265,7 +264,7 @@ function createTailwindcssPatchCommandContext(cli, command, commandName, args, c
|
|
|
265
264
|
commandName,
|
|
266
265
|
args,
|
|
267
266
|
cwd,
|
|
268
|
-
logger:
|
|
267
|
+
logger: require_validate.logger,
|
|
269
268
|
loadConfig: loadCachedConfig,
|
|
270
269
|
loadPatchOptions: loadPatchOptionsForContext,
|
|
271
270
|
createPatcher: createPatcherForContext
|
|
@@ -284,7 +283,7 @@ function runWithCommandHandler(cli, command, commandName, args, handler, default
|
|
|
284
283
|
const DEFAULT_CONFIG_NAME = "tailwindcss-mangle";
|
|
285
284
|
async function installCommandDefaultHandler(_ctx) {
|
|
286
285
|
await (await _ctx.createPatcher()).patch();
|
|
287
|
-
|
|
286
|
+
require_validate.logger.success("Tailwind CSS runtime patched successfully.");
|
|
288
287
|
}
|
|
289
288
|
async function extractCommandDefaultHandler(ctx) {
|
|
290
289
|
const { args } = ctx;
|
|
@@ -304,8 +303,8 @@ async function extractCommandDefaultHandler(ctx) {
|
|
|
304
303
|
const patcher = await ctx.createPatcher(hasOverrides ? overrides : void 0);
|
|
305
304
|
const extractOptions = args.write === void 0 ? {} : { write: args.write };
|
|
306
305
|
const result = await patcher.extract(extractOptions);
|
|
307
|
-
if (result.filename)
|
|
308
|
-
else
|
|
306
|
+
if (result.filename) require_validate.logger.success(`Collected ${result.classList.length} classes → ${result.filename}`);
|
|
307
|
+
else require_validate.logger.success(`Collected ${result.classList.length} classes.`);
|
|
309
308
|
return result;
|
|
310
309
|
}
|
|
311
310
|
async function tokensCommandDefaultHandler(ctx) {
|
|
@@ -316,7 +315,7 @@ async function tokensCommandDefaultHandler(ctx) {
|
|
|
316
315
|
if (!TOKEN_FORMATS.includes(format)) format = "json";
|
|
317
316
|
const targetFile = args.output ?? ".tw-patch/tw-token-report.json";
|
|
318
317
|
const groupKey = args.groupKey === "absolute" ? "absolute" : "relative";
|
|
319
|
-
const buildGrouped = () =>
|
|
318
|
+
const buildGrouped = () => require_validate.groupTokensByFile(report, {
|
|
320
319
|
key: groupKey,
|
|
321
320
|
stripAbsolutePaths: groupKey !== "absolute"
|
|
322
321
|
});
|
|
@@ -331,42 +330,42 @@ async function tokensCommandDefaultHandler(ctx) {
|
|
|
331
330
|
const lines = report.entries.map(formatTokenLine);
|
|
332
331
|
await fs_extra.default.writeFile(target, `${lines.join("\n")}\n`, "utf8");
|
|
333
332
|
}
|
|
334
|
-
|
|
333
|
+
require_validate.logger.success(`Collected ${report.entries.length} tokens (${format}) → ${target.replace(node_process.default.cwd(), ".")}`);
|
|
335
334
|
} else {
|
|
336
|
-
|
|
335
|
+
require_validate.logger.success(`Collected ${report.entries.length} tokens from ${report.filesScanned} files.`);
|
|
337
336
|
if (format === "lines") {
|
|
338
337
|
const preview = report.entries.slice(0, 5).map(formatTokenLine).join("\n");
|
|
339
338
|
if (preview) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (report.entries.length > 5)
|
|
339
|
+
require_validate.logger.log("");
|
|
340
|
+
require_validate.logger.info(preview);
|
|
341
|
+
if (report.entries.length > 5) require_validate.logger.info(`…and ${report.entries.length - 5} more.`);
|
|
343
342
|
}
|
|
344
343
|
} else if (format === "grouped-json") {
|
|
345
344
|
const { preview, moreFiles } = formatGroupedPreview(resolveGrouped());
|
|
346
345
|
if (preview) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if (moreFiles > 0)
|
|
346
|
+
require_validate.logger.log("");
|
|
347
|
+
require_validate.logger.info(preview);
|
|
348
|
+
if (moreFiles > 0) require_validate.logger.info(`…and ${moreFiles} more files.`);
|
|
350
349
|
}
|
|
351
350
|
} else {
|
|
352
351
|
const previewEntries = report.entries.slice(0, 3);
|
|
353
352
|
if (previewEntries.length) {
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
require_validate.logger.log("");
|
|
354
|
+
require_validate.logger.info(JSON.stringify(previewEntries, null, 2));
|
|
356
355
|
}
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
358
|
if (report.skippedFiles.length) {
|
|
360
|
-
|
|
361
|
-
for (const skipped of report.skippedFiles)
|
|
359
|
+
require_validate.logger.warn("Skipped files:");
|
|
360
|
+
for (const skipped of report.skippedFiles) require_validate.logger.warn(` • ${skipped.file} (${skipped.reason})`);
|
|
362
361
|
}
|
|
363
362
|
return report;
|
|
364
363
|
}
|
|
365
364
|
async function initCommandDefaultHandler(ctx) {
|
|
366
|
-
const configModule = await
|
|
365
|
+
const configModule = await require_validate.loadWorkspaceConfigModule();
|
|
367
366
|
await configModule.initConfig(ctx.cwd);
|
|
368
367
|
const configName = configModule.CONFIG_NAME || DEFAULT_CONFIG_NAME;
|
|
369
|
-
|
|
368
|
+
require_validate.logger.success(`✨ ${configName}.config.ts initialized!`);
|
|
370
369
|
}
|
|
371
370
|
//#endregion
|
|
372
371
|
//#region src/commands/migration-args.ts
|
|
@@ -429,39 +428,39 @@ async function writeMigrationReportFile(cwd, reportFile, report) {
|
|
|
429
428
|
const reportPath = pathe.default.resolve(cwd, reportFile);
|
|
430
429
|
await fs_extra.default.ensureDir(pathe.default.dirname(reportPath));
|
|
431
430
|
await fs_extra.default.writeJSON(reportPath, report, { spaces: 2 });
|
|
432
|
-
|
|
431
|
+
require_validate.logger.info(`Migration report written: ${formatPathForLog(reportPath)}`);
|
|
433
432
|
}
|
|
434
433
|
function logMigrationReportAsJson(report) {
|
|
435
|
-
|
|
434
|
+
require_validate.logger.log(JSON.stringify(report, null, 2));
|
|
436
435
|
}
|
|
437
436
|
function logNoMigrationConfigFilesWarning() {
|
|
438
|
-
|
|
437
|
+
require_validate.logger.warn("No config files found for migration.");
|
|
439
438
|
}
|
|
440
439
|
function logMigrationEntries(report, dryRun) {
|
|
441
440
|
for (const entry of report.entries) {
|
|
442
441
|
const fileLabel = formatPathForLog(entry.file);
|
|
443
442
|
if (!entry.changed) {
|
|
444
|
-
|
|
443
|
+
require_validate.logger.info(`No changes: ${fileLabel}`);
|
|
445
444
|
continue;
|
|
446
445
|
}
|
|
447
|
-
if (dryRun)
|
|
448
|
-
else
|
|
449
|
-
for (const change of entry.changes)
|
|
450
|
-
if (entry.backupFile)
|
|
446
|
+
if (dryRun) require_validate.logger.info(`[dry-run] ${fileLabel}`);
|
|
447
|
+
else require_validate.logger.success(`Migrated: ${fileLabel}`);
|
|
448
|
+
for (const change of entry.changes) require_validate.logger.info(` - ${change}`);
|
|
449
|
+
if (entry.backupFile) require_validate.logger.info(` - backup: ${formatPathForLog(entry.backupFile)}`);
|
|
451
450
|
}
|
|
452
451
|
}
|
|
453
452
|
function logMigrationSummary(report) {
|
|
454
|
-
|
|
453
|
+
require_validate.logger.info(`Migration summary: scanned=${report.scannedFiles}, changed=${report.changedFiles}, written=${report.writtenFiles}, backups=${report.backupsWritten}, missing=${report.missingFiles}, unchanged=${report.unchangedFiles}`);
|
|
455
454
|
}
|
|
456
455
|
function logRestoreResultAsJson(result) {
|
|
457
|
-
|
|
456
|
+
require_validate.logger.log(JSON.stringify(result, null, 2));
|
|
458
457
|
}
|
|
459
458
|
function logRestoreSummary(result) {
|
|
460
|
-
|
|
459
|
+
require_validate.logger.info(`Restore summary: scanned=${result.scannedEntries}, restorable=${result.restorableEntries}, restored=${result.restoredFiles}, missingBackups=${result.missingBackups}, skipped=${result.skippedEntries}`);
|
|
461
460
|
if (result.restored.length > 0) {
|
|
462
461
|
const preview = result.restored.slice(0, 5);
|
|
463
|
-
for (const file of preview)
|
|
464
|
-
if (result.restored.length > preview.length)
|
|
462
|
+
for (const file of preview) require_validate.logger.info(` - ${formatPathForLog(file)}`);
|
|
463
|
+
if (result.restored.length > preview.length) require_validate.logger.info(` ...and ${result.restored.length - preview.length} more`);
|
|
465
464
|
}
|
|
466
465
|
}
|
|
467
466
|
function logValidateSuccessAsJson(result) {
|
|
@@ -469,14 +468,14 @@ function logValidateSuccessAsJson(result) {
|
|
|
469
468
|
ok: true,
|
|
470
469
|
...result
|
|
471
470
|
};
|
|
472
|
-
|
|
471
|
+
require_validate.logger.log(JSON.stringify(payload, null, 2));
|
|
473
472
|
}
|
|
474
473
|
function logValidateSuccessSummary(result) {
|
|
475
|
-
|
|
474
|
+
require_validate.logger.success(`Migration report validated: scanned=${result.scannedEntries}, restorable=${result.restorableEntries}, missingBackups=${result.missingBackups}, skipped=${result.skippedEntries}`);
|
|
476
475
|
if (result.reportKind || result.reportSchemaVersion !== void 0) {
|
|
477
476
|
const kind = result.reportKind ?? "unknown";
|
|
478
477
|
const schema = result.reportSchemaVersion === void 0 ? "unknown" : String(result.reportSchemaVersion);
|
|
479
|
-
|
|
478
|
+
require_validate.logger.info(` metadata: kind=${kind}, schema=${schema}`);
|
|
480
479
|
}
|
|
481
480
|
}
|
|
482
481
|
function logValidateFailureAsJson(summary) {
|
|
@@ -486,18 +485,18 @@ function logValidateFailureAsJson(summary) {
|
|
|
486
485
|
exitCode: summary.exitCode,
|
|
487
486
|
message: summary.message
|
|
488
487
|
};
|
|
489
|
-
|
|
488
|
+
require_validate.logger.log(JSON.stringify(payload, null, 2));
|
|
490
489
|
}
|
|
491
490
|
function logValidateFailureSummary(summary) {
|
|
492
|
-
|
|
491
|
+
require_validate.logger.error(`Validation failed [${summary.reason}] (exit ${summary.exitCode}): ${summary.message}`);
|
|
493
492
|
}
|
|
494
493
|
//#endregion
|
|
495
494
|
//#region src/commands/migrate-handler.ts
|
|
496
495
|
async function migrateCommandDefaultHandler(ctx) {
|
|
497
496
|
const { args } = ctx;
|
|
498
497
|
const { include, exclude, maxDepth, checkMode, dryRun, hasInvalidMaxDepth } = resolveMigrateCommandArgs(args);
|
|
499
|
-
if (args.workspace && hasInvalidMaxDepth)
|
|
500
|
-
const report = await
|
|
498
|
+
if (args.workspace && hasInvalidMaxDepth) require_validate.logger.warn(`Invalid --max-depth value "${String(args.maxDepth)}", fallback to default depth.`);
|
|
499
|
+
const report = await require_validate.migrateConfigFiles({
|
|
501
500
|
cwd: ctx.cwd,
|
|
502
501
|
dryRun,
|
|
503
502
|
...args.config ? { files: [args.config] } : {},
|
|
@@ -528,7 +527,7 @@ async function migrateCommandDefaultHandler(ctx) {
|
|
|
528
527
|
async function restoreCommandDefaultHandler(ctx) {
|
|
529
528
|
const { args } = ctx;
|
|
530
529
|
const restoreArgs = resolveRestoreCommandArgs(args);
|
|
531
|
-
const result = await
|
|
530
|
+
const result = await require_validate.restoreConfigFiles({
|
|
532
531
|
cwd: ctx.cwd,
|
|
533
532
|
reportFile: restoreArgs.reportFile,
|
|
534
533
|
dryRun: restoreArgs.dryRun,
|
|
@@ -558,27 +557,27 @@ function partitionStatusEntries(report) {
|
|
|
558
557
|
};
|
|
559
558
|
}
|
|
560
559
|
function logStatusReportAsJson(report) {
|
|
561
|
-
|
|
560
|
+
require_validate.logger.log(JSON.stringify(report, null, 2));
|
|
562
561
|
}
|
|
563
562
|
function logStatusReportSummary(report) {
|
|
564
563
|
const { applied, pending, skipped } = partitionStatusEntries(report);
|
|
565
|
-
|
|
564
|
+
require_validate.logger.info(`Patch status for ${formatPackageLabel(report)} (v${report.majorVersion})`);
|
|
566
565
|
if (applied.length) {
|
|
567
|
-
|
|
568
|
-
applied.forEach((entry) =>
|
|
566
|
+
require_validate.logger.success("Applied:");
|
|
567
|
+
applied.forEach((entry) => require_validate.logger.success(` • ${entry.name}${formatFilesHint(entry)}`));
|
|
569
568
|
}
|
|
570
569
|
if (pending.length) {
|
|
571
|
-
|
|
570
|
+
require_validate.logger.warn("Needs attention:");
|
|
572
571
|
pending.forEach((entry) => {
|
|
573
572
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
574
|
-
|
|
573
|
+
require_validate.logger.warn(` • ${entry.name}${formatFilesHint(entry)}${details}`);
|
|
575
574
|
});
|
|
576
|
-
} else
|
|
575
|
+
} else require_validate.logger.success("All applicable patches are applied.");
|
|
577
576
|
if (skipped.length) {
|
|
578
|
-
|
|
577
|
+
require_validate.logger.info("Skipped:");
|
|
579
578
|
skipped.forEach((entry) => {
|
|
580
579
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
581
|
-
|
|
580
|
+
require_validate.logger.info(` • ${entry.name}${details}`);
|
|
582
581
|
});
|
|
583
582
|
}
|
|
584
583
|
}
|
|
@@ -599,7 +598,7 @@ async function validateCommandDefaultHandler(ctx) {
|
|
|
599
598
|
const { args } = ctx;
|
|
600
599
|
const validateArgs = resolveValidateCommandArgs(args);
|
|
601
600
|
try {
|
|
602
|
-
const result = await
|
|
601
|
+
const result = await require_validate.restoreConfigFiles({
|
|
603
602
|
cwd: ctx.cwd,
|
|
604
603
|
reportFile: validateArgs.reportFile,
|
|
605
604
|
dryRun: true,
|
|
@@ -612,10 +611,10 @@ async function validateCommandDefaultHandler(ctx) {
|
|
|
612
611
|
logValidateSuccessSummary(result);
|
|
613
612
|
return result;
|
|
614
613
|
} catch (error) {
|
|
615
|
-
const summary =
|
|
614
|
+
const summary = require_validate.classifyValidateError(error);
|
|
616
615
|
if (args.json) logValidateFailureAsJson(summary);
|
|
617
616
|
else logValidateFailureSummary(summary);
|
|
618
|
-
throw new
|
|
617
|
+
throw new require_validate.ValidateCommandError(summary, { cause: error });
|
|
619
618
|
}
|
|
620
619
|
}
|
|
621
620
|
//#endregion
|
|
@@ -646,7 +645,7 @@ function registerTailwindcssPatchCommand(cli, commandName, options, prefix, defa
|
|
|
646
645
|
//#region src/commands/cli.ts
|
|
647
646
|
function mountTailwindcssPatchCommands(cli, options = {}) {
|
|
648
647
|
const prefix = options.commandPrefix ?? "";
|
|
649
|
-
const selectedCommands = options.commands ??
|
|
648
|
+
const selectedCommands = options.commands ?? require_validate.tailwindcssPatchCommands;
|
|
650
649
|
const defaultDefinitions = buildDefaultCommandDefinitions();
|
|
651
650
|
for (const name of selectedCommands) registerTailwindcssPatchCommand(cli, name, options, prefix, defaultDefinitions);
|
|
652
651
|
return cli;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as groupTokensByFile, a as tailwindcssPatchCommands, et as loadPatchOptionsForWorkspace, i as classifyValidateError, it as logger, o as migrateConfigFiles, r as ValidateCommandError, s as restoreConfigFiles, tt as loadWorkspaceConfigModule, u as TailwindcssPatcher } from "./validate-Bug_WYcU.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import fs from "fs-extra";
|
|
4
4
|
import path from "pathe";
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_cli = require("./cli-CBVPia5Z.js");
|
|
1
|
+
const require_validate = require("./validate-DbuKewV-.js");
|
|
2
|
+
const require_cli = require("./cli-BztQHMRp.js");
|
|
4
3
|
let node_process = require("node:process");
|
|
5
|
-
node_process =
|
|
4
|
+
node_process = require_validate.__toESM(node_process);
|
|
6
5
|
//#region src/cli.ts
|
|
7
6
|
async function main() {
|
|
8
7
|
const cli = require_cli.createTailwindcssPatchCli();
|
|
@@ -11,12 +10,12 @@ async function main() {
|
|
|
11
10
|
await cli.runMatchedCommand();
|
|
12
11
|
}
|
|
13
12
|
main().catch((error) => {
|
|
14
|
-
if (error instanceof
|
|
13
|
+
if (error instanceof require_validate.ValidateCommandError) {
|
|
15
14
|
node_process.default.exitCode = error.exitCode;
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
17
|
const message = error instanceof Error ? error.message : String(error);
|
|
19
|
-
|
|
18
|
+
require_validate.logger.error(message);
|
|
20
19
|
node_process.default.exitCode = 1;
|
|
21
20
|
});
|
|
22
21
|
//#endregion
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createTailwindcssPatchCli } from "./cli-
|
|
1
|
+
import { it as logger, r as ValidateCommandError } from "./validate-Bug_WYcU.mjs";
|
|
2
|
+
import { t as createTailwindcssPatchCli } from "./cli-D0jXMGXf.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
async function main() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ValidateFailureSummary, c as TailwindcssPatchCliMountOptions, d as TailwindcssPatchCommandContext, f as TailwindcssPatchCommandHandler, g as tailwindcssPatchCommands, h as TailwindcssPatchCommandOptions, i as ValidateFailureReason, l as TailwindcssPatchCliOptions, m as TailwindcssPatchCommandOptionDefinition, n as VALIDATE_FAILURE_REASONS, o as ValidateJsonFailurePayload, p as TailwindcssPatchCommandHandlerMap, r as ValidateCommandError, s as ValidateJsonSuccessPayload, t as VALIDATE_EXIT_CODES, u as TailwindcssPatchCommand } from "../validate-
|
|
1
|
+
import { a as ValidateFailureSummary, c as TailwindcssPatchCliMountOptions, d as TailwindcssPatchCommandContext, f as TailwindcssPatchCommandHandler, g as tailwindcssPatchCommands, h as TailwindcssPatchCommandOptions, i as ValidateFailureReason, l as TailwindcssPatchCliOptions, m as TailwindcssPatchCommandOptionDefinition, n as VALIDATE_FAILURE_REASONS, o as ValidateJsonFailurePayload, p as TailwindcssPatchCommandHandlerMap, r as ValidateCommandError, s as ValidateJsonSuccessPayload, t as VALIDATE_EXIT_CODES, u as TailwindcssPatchCommand } from "../validate-oAkURzUC.mjs";
|
|
2
2
|
import { CAC } from "cac";
|
|
3
3
|
|
|
4
4
|
//#region src/commands/cli.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ValidateFailureSummary, c as TailwindcssPatchCliMountOptions, d as TailwindcssPatchCommandContext, f as TailwindcssPatchCommandHandler, g as tailwindcssPatchCommands, h as TailwindcssPatchCommandOptions, i as ValidateFailureReason, l as TailwindcssPatchCliOptions, m as TailwindcssPatchCommandOptionDefinition, n as VALIDATE_FAILURE_REASONS, o as ValidateJsonFailurePayload, p as TailwindcssPatchCommandHandlerMap, r as ValidateCommandError, s as ValidateJsonSuccessPayload, t as VALIDATE_EXIT_CODES, u as TailwindcssPatchCommand } from "../validate-
|
|
1
|
+
import { a as ValidateFailureSummary, c as TailwindcssPatchCliMountOptions, d as TailwindcssPatchCommandContext, f as TailwindcssPatchCommandHandler, g as tailwindcssPatchCommands, h as TailwindcssPatchCommandOptions, i as ValidateFailureReason, l as TailwindcssPatchCliOptions, m as TailwindcssPatchCommandOptionDefinition, n as VALIDATE_FAILURE_REASONS, o as ValidateJsonFailurePayload, p as TailwindcssPatchCommandHandlerMap, r as ValidateCommandError, s as ValidateJsonSuccessPayload, t as VALIDATE_EXIT_CODES, u as TailwindcssPatchCommand } from "../validate-BuqRodYI.js";
|
|
2
2
|
import { CAC } from "cac";
|
|
3
3
|
|
|
4
4
|
//#region src/commands/cli.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_cli = require("../cli-
|
|
4
|
-
exports.VALIDATE_EXIT_CODES =
|
|
5
|
-
exports.VALIDATE_FAILURE_REASONS =
|
|
6
|
-
exports.ValidateCommandError =
|
|
2
|
+
const require_validate = require("../validate-DbuKewV-.js");
|
|
3
|
+
const require_cli = require("../cli-BztQHMRp.js");
|
|
4
|
+
exports.VALIDATE_EXIT_CODES = require_validate.VALIDATE_EXIT_CODES;
|
|
5
|
+
exports.VALIDATE_FAILURE_REASONS = require_validate.VALIDATE_FAILURE_REASONS;
|
|
6
|
+
exports.ValidateCommandError = require_validate.ValidateCommandError;
|
|
7
7
|
exports.createTailwindcssPatchCli = require_cli.createTailwindcssPatchCli;
|
|
8
8
|
exports.mountTailwindcssPatchCommands = require_cli.mountTailwindcssPatchCommands;
|
|
9
|
-
exports.tailwindcssPatchCommands =
|
|
9
|
+
exports.tailwindcssPatchCommands = require_validate.tailwindcssPatchCommands;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n as mountTailwindcssPatchCommands, t as createTailwindcssPatchCli } from "../cli-
|
|
1
|
+
import { a as tailwindcssPatchCommands, n as VALIDATE_FAILURE_REASONS, r as ValidateCommandError, t as VALIDATE_EXIT_CODES } from "../validate-Bug_WYcU.mjs";
|
|
2
|
+
import { n as mountTailwindcssPatchCommands, t as createTailwindcssPatchCli } from "../cli-D0jXMGXf.mjs";
|
|
3
3
|
export { VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, createTailwindcssPatchCli, mountTailwindcssPatchCommands, tailwindcssPatchCommands };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_validate = require("./validate-DbuKewV-.js");
|
|
2
2
|
let node_process = require("node:process");
|
|
3
|
-
node_process =
|
|
3
|
+
node_process = require_validate.__toESM(node_process, 1);
|
|
4
4
|
let defu = require("defu");
|
|
5
5
|
(0, defu.createDefu)((obj, key, value) => {
|
|
6
6
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|