skeleton 4.1.5 → 4.2.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/dist/index.js +43 -25
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import child_process from "node:child_process";
|
|
3
3
|
import { promisify } from "node:util";
|
|
4
4
|
import { detect, resolveCommand } from "package-manager-detector";
|
|
5
|
+
import { intro, isCancel, log, multiselect, outro, spinner } from "@clack/prompts";
|
|
5
6
|
import { AtRule, atRule, comment, parse } from "postcss";
|
|
6
7
|
import { parse as parse$1 } from "node-html-parser";
|
|
7
8
|
import { nanoid } from "nanoid";
|
|
@@ -11,7 +12,6 @@ import { coerce, lt } from "semver";
|
|
|
11
12
|
import MagicString from "magic-string";
|
|
12
13
|
import { parse as parse$2 } from "svelte/compiler";
|
|
13
14
|
import { walk } from "zimmerframe";
|
|
14
|
-
import { intro, isCancel, log, multiselect, outro, spinner } from "@clack/prompts";
|
|
15
15
|
import getLatestVersion from "latest-version";
|
|
16
16
|
import { readFile, writeFile } from "node:fs/promises";
|
|
17
17
|
import { dirname, extname, join } from "node:path";
|
|
@@ -241,11 +241,16 @@ function transformClasses(code) {
|
|
|
241
241
|
//#endregion
|
|
242
242
|
//#region src/commands/migrate/migrations/skeleton-3/transformers/transform-stylesheet.ts
|
|
243
243
|
function transformStylesheet$1(code) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
try {
|
|
245
|
+
const parsed = parse(code);
|
|
246
|
+
parsed.walkAtRules("apply", (atRule$1) => {
|
|
247
|
+
atRule$1.params = transformClasses(atRule$1.params).code;
|
|
248
|
+
});
|
|
249
|
+
return { code: parsed.toString() };
|
|
250
|
+
} catch (error) {
|
|
251
|
+
log.warn(`Failed to parse CSS, skipping transformation: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
252
|
+
return { code };
|
|
253
|
+
}
|
|
249
254
|
}
|
|
250
255
|
|
|
251
256
|
//#endregion
|
|
@@ -893,8 +898,12 @@ function transformScript$1(s, script) {
|
|
|
893
898
|
}
|
|
894
899
|
function transformCss$1(s, css) {
|
|
895
900
|
if (!css) return;
|
|
896
|
-
|
|
897
|
-
|
|
901
|
+
try {
|
|
902
|
+
const transformed = transformStylesheet$1(s.original.slice(css.content.start, css.content.end));
|
|
903
|
+
s.overwrite(css.content.start, css.content.end, transformed.code);
|
|
904
|
+
} catch (error) {
|
|
905
|
+
log.warn(`Failed to transform CSS in Svelte component, skipping: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
906
|
+
}
|
|
898
907
|
}
|
|
899
908
|
function transformFragment$1(s, fragment, skeletonImports) {
|
|
900
909
|
walk(fragment, {}, {
|
|
@@ -1175,21 +1184,26 @@ function transformPackageJson(code) {
|
|
|
1175
1184
|
//#endregion
|
|
1176
1185
|
//#region src/commands/migrate/migrations/skeleton-4/transformers/transform-stylesheet.ts
|
|
1177
1186
|
function transformStylesheet(content) {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
if (atRule$1.
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1187
|
+
try {
|
|
1188
|
+
const ast = parse(content);
|
|
1189
|
+
ast.walkAtRules((atRule$1) => {
|
|
1190
|
+
if (atRule$1.name === "import" && atRule$1.params.includes("@skeletonlabs/skeleton/optional/presets")) atRule$1.remove();
|
|
1191
|
+
if (atRule$1.name === "source") {
|
|
1192
|
+
if (atRule$1.params.includes("@skeletonlabs/skeleton-svelte")) atRule$1.replaceWith(new AtRule({
|
|
1193
|
+
name: "import",
|
|
1194
|
+
params: `'@skeletonlabs/skeleton-svelte'`
|
|
1195
|
+
}));
|
|
1196
|
+
if (atRule$1.params.includes("@skeletonlabs/skeleton-react")) atRule$1.replaceWith(new AtRule({
|
|
1197
|
+
name: "import",
|
|
1198
|
+
params: `'@skeletonlabs/skeleton-react'`
|
|
1199
|
+
}));
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
return { code: ast.toString() };
|
|
1203
|
+
} catch (error) {
|
|
1204
|
+
log.warn(`Failed to parse CSS, skipping transformation: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1205
|
+
return { code: content };
|
|
1206
|
+
}
|
|
1193
1207
|
}
|
|
1194
1208
|
|
|
1195
1209
|
//#endregion
|
|
@@ -1202,8 +1216,12 @@ function transformScript(s, script) {
|
|
|
1202
1216
|
}
|
|
1203
1217
|
function transformCss(s, css) {
|
|
1204
1218
|
if (!css) return;
|
|
1205
|
-
|
|
1206
|
-
|
|
1219
|
+
try {
|
|
1220
|
+
const transformed = transformStylesheet(s.original.slice(css.content.start, css.content.end));
|
|
1221
|
+
s.overwrite(css.content.start, css.content.end, transformed.code);
|
|
1222
|
+
} catch (error) {
|
|
1223
|
+
log.warn(`Failed to transform CSS in Svelte component, skipping: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1224
|
+
}
|
|
1207
1225
|
}
|
|
1208
1226
|
function transformFragment(s, fragment, skeletonImports) {
|
|
1209
1227
|
walk(fragment, {}, { Component(node, ctx) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skeleton",
|
|
3
3
|
"description": "The CLI for Skeleton related tooling.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/skeletonlabs/skeleton.git",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/estree": "1.0.8",
|
|
24
|
-
"@types/node": "24.
|
|
24
|
+
"@types/node": "24.9.1",
|
|
25
25
|
"@types/semver": "7.7.1",
|
|
26
|
-
"tsdown": "0.15.
|
|
26
|
+
"tsdown": "0.15.9",
|
|
27
27
|
"type-fest": "5.1.0",
|
|
28
28
|
"typescript": "5.9.3",
|
|
29
29
|
"vite": "7.1.10",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@clack/prompts": "0.11.0",
|
|
34
34
|
"colorette": "2.0.20",
|
|
35
|
-
"commander": "14.0.
|
|
35
|
+
"commander": "14.0.2",
|
|
36
36
|
"detect-indent": "7.0.2",
|
|
37
37
|
"latest-version": "9.0.0",
|
|
38
|
-
"magic-string": "0.30.
|
|
38
|
+
"magic-string": "0.30.21",
|
|
39
39
|
"nanoid": "5.1.6",
|
|
40
40
|
"node-html-parser": "7.0.1",
|
|
41
41
|
"package-manager-detector": "1.5.0",
|
|
42
42
|
"postcss": "8.5.6",
|
|
43
43
|
"semver": "7.7.3",
|
|
44
|
-
"svelte": "5.
|
|
44
|
+
"svelte": "5.42.2",
|
|
45
45
|
"tinyglobby": "0.2.15",
|
|
46
46
|
"ts-morph": "27.0.2",
|
|
47
47
|
"zimmerframe": "1.1.4"
|