sv 0.8.1 → 0.8.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/bin.js
CHANGED
|
@@ -12,7 +12,7 @@ import { promisify } from "node:util";
|
|
|
12
12
|
|
|
13
13
|
//#region packages/cli/package.json
|
|
14
14
|
var name = "sv";
|
|
15
|
-
var version = "0.8.
|
|
15
|
+
var version = "0.8.2";
|
|
16
16
|
var type = "module";
|
|
17
17
|
var description = "A CLI for creating and updating SvelteKit projects";
|
|
18
18
|
var license = "MIT";
|
|
@@ -1076,6 +1076,49 @@ function createPrinter(...conditions) {
|
|
|
1076
1076
|
var import_picocolors$4 = __toESM$1(require_picocolors(), 1);
|
|
1077
1077
|
var colors = import_picocolors$4.default;
|
|
1078
1078
|
|
|
1079
|
+
//#endregion
|
|
1080
|
+
//#region packages/addons/common.ts
|
|
1081
|
+
function addEslintConfigPrettier(content) {
|
|
1082
|
+
const { ast, generateCode } = parseScript$1(content);
|
|
1083
|
+
const importNodes = ast.body.filter((n$1) => n$1.type === "ImportDeclaration");
|
|
1084
|
+
const sveltePluginImport = importNodes.find((n$1) => n$1.type === "ImportDeclaration" && n$1.source.value === "eslint-plugin-svelte" && n$1.specifiers?.some((n$2) => n$2.type === "ImportDefaultSpecifier"));
|
|
1085
|
+
let svelteImportName;
|
|
1086
|
+
for (const specifier of sveltePluginImport?.specifiers ?? []) if (specifier.type === "ImportDefaultSpecifier" && specifier.local?.name) svelteImportName = specifier.local.name;
|
|
1087
|
+
svelteImportName ??= "svelte";
|
|
1088
|
+
imports_exports.addDefault(ast, "eslint-plugin-svelte", svelteImportName);
|
|
1089
|
+
imports_exports.addDefault(ast, "eslint-config-prettier", "prettier");
|
|
1090
|
+
const fallbackConfig = common_exports.expressionFromString("[]");
|
|
1091
|
+
const defaultExport = exports_exports.defaultExport(ast, fallbackConfig);
|
|
1092
|
+
const eslintConfig = defaultExport.value;
|
|
1093
|
+
if (eslintConfig.type !== "ArrayExpression" && eslintConfig.type !== "CallExpression") return content;
|
|
1094
|
+
const prettier = common_exports.expressionFromString("prettier");
|
|
1095
|
+
const sveltePrettierConfig = common_exports.expressionFromString(`${svelteImportName}.configs.prettier`);
|
|
1096
|
+
const configSpread = common_exports.createSpreadElement(sveltePrettierConfig);
|
|
1097
|
+
const nodesToInsert = [];
|
|
1098
|
+
if (!common_exports.hasNode(eslintConfig, prettier)) nodesToInsert.push(prettier);
|
|
1099
|
+
if (!common_exports.hasNode(eslintConfig, configSpread)) nodesToInsert.push(configSpread);
|
|
1100
|
+
const elements = eslintConfig.type === "ArrayExpression" ? eslintConfig.elements : eslintConfig.arguments;
|
|
1101
|
+
const idx = elements.findIndex((el) => el?.type === "SpreadElement" && el.argument.type === "MemberExpression" && el.argument.object.type === "MemberExpression" && el.argument.object.property.type === "Identifier" && el.argument.object.property.name === "configs" && el.argument.object.object.type === "Identifier" && el.argument.object.object.name === svelteImportName);
|
|
1102
|
+
if (idx !== -1) elements.splice(idx + 1, 0, ...nodesToInsert);
|
|
1103
|
+
else elements.push(...nodesToInsert);
|
|
1104
|
+
return generateCode();
|
|
1105
|
+
}
|
|
1106
|
+
function addToDemoPage(content, path$2) {
|
|
1107
|
+
const { template, generateCode } = parseSvelte(content);
|
|
1108
|
+
for (const node of template.ast.childNodes) if (node.type === "tag" && node.attribs["href"] === `/demo/${path$2}`) return content;
|
|
1109
|
+
const newLine = template.source ? "\n" : "";
|
|
1110
|
+
const src = template.source + `${newLine}<a href="/demo/${path$2}">${path$2}</a>`;
|
|
1111
|
+
return generateCode({ template: src });
|
|
1112
|
+
}
|
|
1113
|
+
function getNodeTypesVersion() {
|
|
1114
|
+
const nodeVersion = process$1.versions.node;
|
|
1115
|
+
const [major] = nodeVersion.split(".");
|
|
1116
|
+
const isLTS = Number(major) % 2 === 0;
|
|
1117
|
+
if (isLTS) return `^${major}`;
|
|
1118
|
+
const previousLTSMajor = Number(major) - 1;
|
|
1119
|
+
return `^${previousLTSMajor}`;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1079
1122
|
//#endregion
|
|
1080
1123
|
//#region packages/addons/drizzle/index.ts
|
|
1081
1124
|
const PORTS = {
|
|
@@ -1176,6 +1219,7 @@ var drizzle_default = defineAddon({
|
|
|
1176
1219
|
const ext = typescript ? "ts" : "js";
|
|
1177
1220
|
sv.dependency("drizzle-orm", "^0.40.0");
|
|
1178
1221
|
sv.devDependency("drizzle-kit", "^0.30.2");
|
|
1222
|
+
sv.devDependency("@types/node", getNodeTypesVersion());
|
|
1179
1223
|
if (options$6.mysql === "mysql2") sv.dependency("mysql2", "^3.12.0");
|
|
1180
1224
|
if (options$6.mysql === "planetscale") sv.dependency("@planetscale/database", "^1.19.0");
|
|
1181
1225
|
if (options$6.postgresql === "neon") sv.dependency("@neondatabase/serverless", "^0.10.4");
|
|
@@ -1338,7 +1382,7 @@ var drizzle_default = defineAddon({
|
|
|
1338
1382
|
if (options$6.mysql === "mysql2" || options$6.mysql === "planetscale") {
|
|
1339
1383
|
imports_exports.addDefault(ast, "mysql2/promise", "mysql");
|
|
1340
1384
|
imports_exports.addNamed(ast, "drizzle-orm/mysql2", { drizzle: "drizzle" });
|
|
1341
|
-
clientExpression = common_exports.expressionFromString("
|
|
1385
|
+
clientExpression = common_exports.expressionFromString("mysql.createPool(env.DATABASE_URL)");
|
|
1342
1386
|
}
|
|
1343
1387
|
if (options$6.postgresql === "neon") {
|
|
1344
1388
|
imports_exports.addNamed(ast, "@neondatabase/serverless", { neon: "neon" });
|
|
@@ -1411,41 +1455,6 @@ function appendEnvContent(existing, content) {
|
|
|
1411
1455
|
return withNewLine + content + "\n";
|
|
1412
1456
|
}
|
|
1413
1457
|
|
|
1414
|
-
//#endregion
|
|
1415
|
-
//#region packages/addons/common.ts
|
|
1416
|
-
function addEslintConfigPrettier(content) {
|
|
1417
|
-
const { ast, generateCode } = parseScript$1(content);
|
|
1418
|
-
const importNodes = ast.body.filter((n$1) => n$1.type === "ImportDeclaration");
|
|
1419
|
-
const sveltePluginImport = importNodes.find((n$1) => n$1.type === "ImportDeclaration" && n$1.source.value === "eslint-plugin-svelte" && n$1.specifiers?.some((n$2) => n$2.type === "ImportDefaultSpecifier"));
|
|
1420
|
-
let svelteImportName;
|
|
1421
|
-
for (const specifier of sveltePluginImport?.specifiers ?? []) if (specifier.type === "ImportDefaultSpecifier" && specifier.local?.name) svelteImportName = specifier.local.name;
|
|
1422
|
-
svelteImportName ??= "svelte";
|
|
1423
|
-
imports_exports.addDefault(ast, "eslint-plugin-svelte", svelteImportName);
|
|
1424
|
-
imports_exports.addDefault(ast, "eslint-config-prettier", "prettier");
|
|
1425
|
-
const fallbackConfig = common_exports.expressionFromString("[]");
|
|
1426
|
-
const defaultExport = exports_exports.defaultExport(ast, fallbackConfig);
|
|
1427
|
-
const eslintConfig = defaultExport.value;
|
|
1428
|
-
if (eslintConfig.type !== "ArrayExpression" && eslintConfig.type !== "CallExpression") return content;
|
|
1429
|
-
const prettier = common_exports.expressionFromString("prettier");
|
|
1430
|
-
const sveltePrettierConfig = common_exports.expressionFromString(`${svelteImportName}.configs.prettier`);
|
|
1431
|
-
const configSpread = common_exports.createSpreadElement(sveltePrettierConfig);
|
|
1432
|
-
const nodesToInsert = [];
|
|
1433
|
-
if (!common_exports.hasNode(eslintConfig, prettier)) nodesToInsert.push(prettier);
|
|
1434
|
-
if (!common_exports.hasNode(eslintConfig, configSpread)) nodesToInsert.push(configSpread);
|
|
1435
|
-
const elements = eslintConfig.type === "ArrayExpression" ? eslintConfig.elements : eslintConfig.arguments;
|
|
1436
|
-
const idx = elements.findIndex((el) => el?.type === "SpreadElement" && el.argument.type === "MemberExpression" && el.argument.object.type === "MemberExpression" && el.argument.object.property.type === "Identifier" && el.argument.object.property.name === "configs" && el.argument.object.object.type === "Identifier" && el.argument.object.object.name === svelteImportName);
|
|
1437
|
-
if (idx !== -1) elements.splice(idx + 1, 0, ...nodesToInsert);
|
|
1438
|
-
else elements.push(...nodesToInsert);
|
|
1439
|
-
return generateCode();
|
|
1440
|
-
}
|
|
1441
|
-
function addToDemoPage(content, path$2) {
|
|
1442
|
-
const { template, generateCode } = parseSvelte(content);
|
|
1443
|
-
for (const node of template.ast.childNodes) if (node.type === "tag" && node.attribs["href"] === `/demo/${path$2}`) return content;
|
|
1444
|
-
const newLine = template.source ? "\n" : "";
|
|
1445
|
-
const src = template.source + `${newLine}<a href="/demo/${path$2}">${path$2}</a>`;
|
|
1446
|
-
return generateCode({ template: src });
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
1458
|
//#endregion
|
|
1450
1459
|
//#region packages/addons/eslint/index.ts
|
|
1451
1460
|
var eslint_default = defineAddon({
|
|
@@ -1583,7 +1592,7 @@ const adapters = [
|
|
|
1583
1592
|
version: "^5.6.3"
|
|
1584
1593
|
},
|
|
1585
1594
|
{
|
|
1586
|
-
id: "cloudflare
|
|
1595
|
+
id: "cloudflare",
|
|
1587
1596
|
package: "@sveltejs/adapter-cloudflare",
|
|
1588
1597
|
version: "^7.0.0"
|
|
1589
1598
|
},
|
|
@@ -3548,6 +3557,7 @@ var storybook_default = defineAddon({
|
|
|
3548
3557
|
"--skip-install",
|
|
3549
3558
|
"--no-dev"
|
|
3550
3559
|
], "inherit");
|
|
3560
|
+
sv.devDependency(`@types/node`, getNodeTypesVersion());
|
|
3551
3561
|
}
|
|
3552
3562
|
});
|
|
3553
3563
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@fontsource/fira-mono": "^5.0.0",
|
|
14
14
|
"@neoconfetti/svelte": "^2.0.0",
|
|
15
|
-
"@sveltejs/adapter-auto": "^
|
|
15
|
+
"@sveltejs/adapter-auto": "^6.0.0",
|
|
16
16
|
"@sveltejs/kit": "^2.16.0",
|
|
17
17
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
18
18
|
"svelte": "^5.25.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sv",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI for creating and updating SvelteKit projects",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"tinyexec": "^0.3.2",
|
|
39
39
|
"valibot": "^0.41.0",
|
|
40
40
|
"@sveltejs/addons": "0.0.0",
|
|
41
|
-
"@sveltejs/clack-prompts": "0.9.1",
|
|
42
41
|
"@sveltejs/cli-core": "0.0.0",
|
|
42
|
+
"@sveltejs/clack-prompts": "0.9.1",
|
|
43
43
|
"@sveltejs/create": "0.0.0"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|