@csszyx/cli 0.9.1 → 0.9.2
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 +2 -0
- package/dist/index.mjs +54 -7
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -210,6 +210,8 @@ interface TransformResult {
|
|
|
210
210
|
stats: {
|
|
211
211
|
classNamesTransformed: number;
|
|
212
212
|
classNamesSkipped: number;
|
|
213
|
+
/** className kept on capitalized components (they do not accept sz). */
|
|
214
|
+
classNamesSkippedComponent: number;
|
|
213
215
|
classesUnrecognized: string[];
|
|
214
216
|
};
|
|
215
217
|
/** Imports that may be unused after migration (e.g., clsx, cn). */
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import fs$1, { existsSync, writeFileSync, readFileSync } from 'node:fs';
|
|
2
3
|
import cac from 'cac';
|
|
3
4
|
import * as path from 'node:path';
|
|
4
5
|
import path__default, { resolve, dirname } from 'node:path';
|
|
5
6
|
import fs from 'fs-extra';
|
|
6
7
|
import ora from 'ora';
|
|
7
8
|
import pc from 'picocolors';
|
|
8
|
-
import fs$1, { existsSync, writeFileSync } from 'node:fs';
|
|
9
9
|
import { mkdir } from 'node:fs/promises';
|
|
10
10
|
import { pathToFileURL } from 'node:url';
|
|
11
11
|
import resolveConfig from 'tailwindcss/resolveConfig.js';
|
|
@@ -1955,6 +1955,11 @@ const REVERSE_BOOLEAN_MAP = {
|
|
|
1955
1955
|
isolate: "isolate",
|
|
1956
1956
|
ordinal: "ordinal",
|
|
1957
1957
|
"slashed-zero": "slashedZero",
|
|
1958
|
+
// Bare `transition` (common transition property) and the `group`/`peer`
|
|
1959
|
+
// marker classes round-trip through the compiler as boolean sugar.
|
|
1960
|
+
transition: "transition",
|
|
1961
|
+
group: "group",
|
|
1962
|
+
peer: "peer",
|
|
1958
1963
|
// Divide/Space reverse
|
|
1959
1964
|
"divide-x-reverse": "divideXReverse",
|
|
1960
1965
|
"divide-y-reverse": "divideYReverse",
|
|
@@ -3746,6 +3751,7 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3746
3751
|
const warnings = [];
|
|
3747
3752
|
let classNamesTransformed = 0;
|
|
3748
3753
|
let classNamesSkipped = 0;
|
|
3754
|
+
let classNamesSkippedComponent = 0;
|
|
3749
3755
|
const classesUnrecognized = [];
|
|
3750
3756
|
const replacements = [];
|
|
3751
3757
|
const clsxImportNames = /* @__PURE__ */ new Set();
|
|
@@ -3757,7 +3763,12 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3757
3763
|
code: source,
|
|
3758
3764
|
changed: false,
|
|
3759
3765
|
warnings: [],
|
|
3760
|
-
stats: {
|
|
3766
|
+
stats: {
|
|
3767
|
+
classNamesTransformed: 0,
|
|
3768
|
+
classNamesSkipped: 0,
|
|
3769
|
+
classNamesSkippedComponent: 0,
|
|
3770
|
+
classesUnrecognized: []
|
|
3771
|
+
},
|
|
3761
3772
|
potentiallyUnusedImports: []
|
|
3762
3773
|
};
|
|
3763
3774
|
}
|
|
@@ -3774,7 +3785,12 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3774
3785
|
code: source,
|
|
3775
3786
|
changed: false,
|
|
3776
3787
|
warnings: [`Parse error in ${filePath}: ${msg}`],
|
|
3777
|
-
stats: {
|
|
3788
|
+
stats: {
|
|
3789
|
+
classNamesTransformed: 0,
|
|
3790
|
+
classNamesSkipped: 0,
|
|
3791
|
+
classNamesSkippedComponent: 0,
|
|
3792
|
+
classesUnrecognized: []
|
|
3793
|
+
},
|
|
3778
3794
|
potentiallyUnusedImports: []
|
|
3779
3795
|
};
|
|
3780
3796
|
}
|
|
@@ -3811,7 +3827,7 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3811
3827
|
const elementName = parent.name;
|
|
3812
3828
|
const isCapitalized = t.isJSXIdentifier(elementName) && /^[A-Z]/.test(elementName.name) || t.isJSXMemberExpression(elementName);
|
|
3813
3829
|
if (isCapitalized) {
|
|
3814
|
-
|
|
3830
|
+
classNamesSkippedComponent++;
|
|
3815
3831
|
return;
|
|
3816
3832
|
}
|
|
3817
3833
|
}
|
|
@@ -3873,6 +3889,7 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3873
3889
|
} else {
|
|
3874
3890
|
classNamesSkipped++;
|
|
3875
3891
|
warnings.push(...result.warnings.map((w) => `[${filePath}] ${w}`));
|
|
3892
|
+
classesUnrecognized.push(...result.unrecognized);
|
|
3876
3893
|
}
|
|
3877
3894
|
injectTodoComment(result.unrecognized, parent, options, replacements);
|
|
3878
3895
|
return;
|
|
@@ -3893,6 +3910,7 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3893
3910
|
} else {
|
|
3894
3911
|
classNamesSkipped++;
|
|
3895
3912
|
warnings.push(...result.warnings.map((w) => `[${filePath}] ${w}`));
|
|
3913
|
+
classesUnrecognized.push(...result.unrecognized);
|
|
3896
3914
|
}
|
|
3897
3915
|
injectTodoComment(result.unrecognized, parent, options, replacements);
|
|
3898
3916
|
return;
|
|
@@ -3910,6 +3928,7 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3910
3928
|
} else {
|
|
3911
3929
|
classNamesSkipped++;
|
|
3912
3930
|
warnings.push(...result.warnings.map((w) => `[${filePath}] ${w}`));
|
|
3931
|
+
classesUnrecognized.push(...result.unrecognized);
|
|
3913
3932
|
}
|
|
3914
3933
|
injectTodoComment(result.unrecognized, parent, options, replacements);
|
|
3915
3934
|
return;
|
|
@@ -3927,6 +3946,7 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3927
3946
|
} else {
|
|
3928
3947
|
classNamesSkipped++;
|
|
3929
3948
|
warnings.push(...result.warnings.map((w) => `[${filePath}] ${w}`));
|
|
3949
|
+
classesUnrecognized.push(...result.unrecognized);
|
|
3930
3950
|
}
|
|
3931
3951
|
injectTodoComment(result.unrecognized, parent, options, replacements);
|
|
3932
3952
|
return;
|
|
@@ -3960,7 +3980,12 @@ function transformSource(source, filePath, options = {}) {
|
|
|
3960
3980
|
code: output,
|
|
3961
3981
|
changed: replacements.length > 0,
|
|
3962
3982
|
warnings,
|
|
3963
|
-
stats: {
|
|
3983
|
+
stats: {
|
|
3984
|
+
classNamesTransformed,
|
|
3985
|
+
classNamesSkipped,
|
|
3986
|
+
classNamesSkippedComponent,
|
|
3987
|
+
classesUnrecognized
|
|
3988
|
+
},
|
|
3964
3989
|
potentiallyUnusedImports
|
|
3965
3990
|
};
|
|
3966
3991
|
}
|
|
@@ -4002,6 +4027,7 @@ function transformHtmlSourceSimple(source, filePath, options = {}) {
|
|
|
4002
4027
|
const warnings = [];
|
|
4003
4028
|
let classNamesTransformed = 0;
|
|
4004
4029
|
let classNamesSkipped = 0;
|
|
4030
|
+
const classNamesSkippedComponent = 0;
|
|
4005
4031
|
const classesUnrecognized = [];
|
|
4006
4032
|
let changed = false;
|
|
4007
4033
|
let output = source.replace(/\bclass="([^"]*)"/g, (match, classStr) => {
|
|
@@ -4049,7 +4075,12 @@ function transformHtmlSourceSimple(source, filePath, options = {}) {
|
|
|
4049
4075
|
code: output,
|
|
4050
4076
|
changed,
|
|
4051
4077
|
warnings,
|
|
4052
|
-
stats: {
|
|
4078
|
+
stats: {
|
|
4079
|
+
classNamesTransformed,
|
|
4080
|
+
classNamesSkipped,
|
|
4081
|
+
classNamesSkippedComponent,
|
|
4082
|
+
classesUnrecognized
|
|
4083
|
+
},
|
|
4053
4084
|
potentiallyUnusedImports: []
|
|
4054
4085
|
};
|
|
4055
4086
|
}
|
|
@@ -4169,6 +4200,7 @@ async function migrate(options = {}) {
|
|
|
4169
4200
|
}
|
|
4170
4201
|
let totalTransformed = 0;
|
|
4171
4202
|
let totalSkipped = 0;
|
|
4203
|
+
let totalSkippedComponent = 0;
|
|
4172
4204
|
let totalFiles = 0;
|
|
4173
4205
|
const allUnrecognized = [];
|
|
4174
4206
|
const allWarnings = [];
|
|
@@ -4200,6 +4232,7 @@ async function migrate(options = {}) {
|
|
|
4200
4232
|
totalFiles++;
|
|
4201
4233
|
totalTransformed += result.stats.classNamesTransformed;
|
|
4202
4234
|
totalSkipped += result.stats.classNamesSkipped;
|
|
4235
|
+
totalSkippedComponent += result.stats.classNamesSkippedComponent;
|
|
4203
4236
|
allUnrecognized.push(...result.stats.classesUnrecognized);
|
|
4204
4237
|
if (result.potentiallyUnusedImports.length > 0) {
|
|
4205
4238
|
const rel2 = path__default.relative(cwd, filePath);
|
|
@@ -4236,6 +4269,10 @@ async function migrate(options = {}) {
|
|
|
4236
4269
|
printWarn(`classNames skipped (dynamic): ${totalSkipped}`);
|
|
4237
4270
|
log.writeLine(`classNames skipped (dynamic): ${totalSkipped}`);
|
|
4238
4271
|
}
|
|
4272
|
+
if (totalSkippedComponent > 0) {
|
|
4273
|
+
printWarn(`classNames kept on components (no sz support): ${totalSkippedComponent}`);
|
|
4274
|
+
log.writeLine(`classNames kept on components (no sz support): ${totalSkippedComponent}`);
|
|
4275
|
+
}
|
|
4239
4276
|
if (allUnrecognized.length > 0) {
|
|
4240
4277
|
const unique = [...new Set(allUnrecognized)];
|
|
4241
4278
|
printWarn(
|
|
@@ -4629,7 +4666,17 @@ function normalizeDebounceMs(debounceMs) {
|
|
|
4629
4666
|
|
|
4630
4667
|
const cli = cac("csszyx");
|
|
4631
4668
|
normalizeNextCommandAlias(process.argv);
|
|
4632
|
-
|
|
4669
|
+
function readCliVersion() {
|
|
4670
|
+
try {
|
|
4671
|
+
const manifest = JSON.parse(
|
|
4672
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
|
4673
|
+
);
|
|
4674
|
+
return typeof manifest.version === "string" ? manifest.version : "0.0.0";
|
|
4675
|
+
} catch {
|
|
4676
|
+
return "0.0.0";
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
const VERSION = readCliVersion();
|
|
4633
4680
|
async function runNextPrebuildCommand(pattern, options) {
|
|
4634
4681
|
const code = await nextPrebuild({
|
|
4635
4682
|
cwd: options.cwd,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Command-line tools for csszyx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csszyx",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"picocolors": "^1.0.0",
|
|
50
50
|
"prompts": "^2.4.2",
|
|
51
51
|
"tailwindcss": "^3.4.1",
|
|
52
|
-
"@csszyx/types": "0.9.
|
|
53
|
-
"@csszyx/unplugin": "0.9.
|
|
52
|
+
"@csszyx/types": "0.9.2",
|
|
53
|
+
"@csszyx/unplugin": "0.9.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/fs-extra": "^11.0.4",
|