sv 0.11.3 → 0.11.4
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/{add-BWQarWDB.mjs → add-BVmpqSBJ.mjs} +137 -141
- package/dist/{add-nRRWTjzp.d.mts → add-CX9qz1SZ.d.mts} +2 -2
- package/dist/bin.mjs +4 -6
- package/dist/{core-CnPhgWST.d.mts → core-BLHPg_eo.d.mts} +8 -3
- package/dist/lib/core.d.mts +1 -1
- package/dist/lib/core.mjs +2 -2
- package/dist/lib/index.d.mts +3 -3
- package/dist/lib/index.mjs +3 -3
- package/dist/lib/testing.d.mts +4 -4
- package/dist/lib/testing.mjs +17 -10253
- package/dist/{package-manager-DkCPtZM1.mjs → package-manager-XDkWi9-7.mjs} +17 -10
- package/dist/shared.json +2 -2
- package/dist/templates/addon/package.json +3 -3
- package/dist/templates/demo/package.json +4 -4
- package/dist/templates/library/package.json +5 -5
- package/dist/templates/minimal/package.json +4 -4
- package/dist/templates/svelte/assets/DOT-gitignore +24 -0
- package/dist/templates/svelte/assets/public/vite.svg +1 -0
- package/dist/templates/svelte/assets/src/assets/svelte.svg +1 -0
- package/dist/templates/svelte/files.types=checkjs.json +1 -0
- package/dist/templates/svelte/files.types=none.json +42 -0
- package/dist/templates/svelte/files.types=typescript.json +50 -0
- package/dist/templates/svelte/meta.json +4 -0
- package/dist/{utils-DjBRIDJG.mjs → utils-IP07VUBl.mjs} +2773 -2450
- package/package.json +5 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as dist, a as installOption, c as up$1, d as Option, g as detect, h as sanitizeName, i as installDependencies, m as templates, n as addPnpmBuildDependencies, o as packageManagerPrompt, p as create$1, r as getUserAgent, s as any, t as AGENT_NAMES, u as Command, v as getSharedFiles } from "./package-manager-
|
|
3
|
-
import { $ as getNodeTypesVersion, A as createCall, B as hasTypeProperty, C as declaration, Ct as
|
|
1
|
+
import { r as __require, t as __commonJSMin } from "./chunk-BjMGrMj9.mjs";
|
|
2
|
+
import { _ as dist, a as installOption, c as up$1, d as Option, g as detect, h as sanitizeName, i as installDependencies, m as templates, n as addPnpmBuildDependencies, o as packageManagerPrompt, p as create$1, r as getUserAgent, s as any, t as AGENT_NAMES, u as Command, v as getSharedFiles } from "./package-manager-XDkWi9-7.mjs";
|
|
3
|
+
import { $ as getNodeTypesVersion, A as createCall, B as hasTypeProperty, C as declaration, Ct as qt, D as addNamespace, E as addNamed, F as create$3, G as ensureScript, H as parseStatement, I as addJsDocTypeComment, J as addAtRule, L as appendStatement, M as overrideProperties, N as property, O as find, P as append, Q as addToDemoPage, R as createLiteral, S as createIdentifier, St as kt, T as addEmpty, Tt as Ct, U as addFragment, V as parseExpression, W as addSlot, X as createPrinter, Z as addEslintConfigPrettier, _ as getConfig, _t as Qt, a as getPackageJson, at as walk, b as createDefault, bt as Se, c as writeFile, et as isVersionUnsupportedBelow, f as packageScriptsUpsert, ft as resolveCommand, g as addPlugin, gt as Pt, ht as Nt, i as formatFiles, it as getErrorHint, j as create$2, k as remove, l as parse$1, lt as q, mt as Mt, n as commonFilePaths, nt as defineAddon, o as installPackages, p as addAttribute, pt as Lt, q as MagicString, r as fileExists, rt as defineAddonOptions, s as readFile, st as dedent_default, t as color, tt as splitVersion, u as arrayUpsert, v as addGlobalAppInterface, vt as R, w as addDefault, x as createNamed, xt as Wt, y as addHooksHandle, yt as Rt, z as createSpread } from "./utils-IP07VUBl.mjs";
|
|
4
4
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -610,7 +610,7 @@ function pipe(...pipe$1) {
|
|
|
610
610
|
}
|
|
611
611
|
|
|
612
612
|
//#endregion
|
|
613
|
-
//#region lib/addons/devtools-json
|
|
613
|
+
//#region lib/addons/devtools-json.ts
|
|
614
614
|
var devtools_json_default = defineAddon({
|
|
615
615
|
id: "devtools-json",
|
|
616
616
|
shortDescription: "devtools json",
|
|
@@ -632,7 +632,7 @@ var devtools_json_default = defineAddon({
|
|
|
632
632
|
});
|
|
633
633
|
|
|
634
634
|
//#endregion
|
|
635
|
-
//#region lib/addons/drizzle
|
|
635
|
+
//#region lib/addons/drizzle.ts
|
|
636
636
|
const PORTS = {
|
|
637
637
|
mysql: "3306",
|
|
638
638
|
postgresql: "5432",
|
|
@@ -732,19 +732,19 @@ var drizzle_default = defineAddon({
|
|
|
732
732
|
database: path.resolve(baseDBPath, `index.${language}`)
|
|
733
733
|
};
|
|
734
734
|
for (const [fileType, filePath] of Object.entries(paths)) if (fs.existsSync(filePath)) return cancel(`Preexisting ${fileType} file at '${filePath}'`);
|
|
735
|
-
sv.devDependency("drizzle-orm", "^0.45.
|
|
735
|
+
sv.devDependency("drizzle-orm", "^0.45.1");
|
|
736
736
|
sv.devDependency("drizzle-kit", "^0.31.8");
|
|
737
737
|
sv.devDependency("@types/node", getNodeTypesVersion());
|
|
738
|
-
if (options$8.mysql === "mysql2") sv.dependency("mysql2", "^3.
|
|
738
|
+
if (options$8.mysql === "mysql2") sv.dependency("mysql2", "^3.16.1");
|
|
739
739
|
if (options$8.mysql === "planetscale") sv.dependency("@planetscale/database", "^1.19.0");
|
|
740
740
|
if (options$8.postgresql === "neon") sv.dependency("@neondatabase/serverless", "^1.0.2");
|
|
741
|
-
if (options$8.postgresql === "postgres.js") sv.dependency("postgres", "^3.4.
|
|
741
|
+
if (options$8.postgresql === "postgres.js") sv.dependency("postgres", "^3.4.8");
|
|
742
742
|
if (options$8.sqlite === "better-sqlite3") {
|
|
743
|
-
sv.dependency("better-sqlite3", "^12.
|
|
743
|
+
sv.dependency("better-sqlite3", "^12.6.2");
|
|
744
744
|
sv.devDependency("@types/better-sqlite3", "^7.6.13");
|
|
745
745
|
sv.pnpmBuildDependency("better-sqlite3");
|
|
746
746
|
}
|
|
747
|
-
if (options$8.sqlite === "libsql" || options$8.sqlite === "turso") sv.devDependency("@libsql/client", "^0.
|
|
747
|
+
if (options$8.sqlite === "libsql" || options$8.sqlite === "turso") sv.devDependency("@libsql/client", "^0.17.0");
|
|
748
748
|
sv.file(".env", (content) => generateEnvFileContent(content, options$8));
|
|
749
749
|
sv.file(".env.example", (content) => generateEnvFileContent(content, options$8));
|
|
750
750
|
if (options$8.docker && (options$8.mysql === "mysql2" || options$8.postgresql === "postgres.js")) {
|
|
@@ -1048,7 +1048,7 @@ function appendEnvContent(existing, content) {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
//#endregion
|
|
1051
|
-
//#region lib/addons/eslint
|
|
1051
|
+
//#region lib/addons/eslint.ts
|
|
1052
1052
|
var eslint_default = defineAddon({
|
|
1053
1053
|
id: "eslint",
|
|
1054
1054
|
shortDescription: "linter",
|
|
@@ -1057,13 +1057,13 @@ var eslint_default = defineAddon({
|
|
|
1057
1057
|
run: ({ sv, language, dependencyVersion, files }) => {
|
|
1058
1058
|
const typescript = language === "ts";
|
|
1059
1059
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
1060
|
-
sv.devDependency("eslint", "^9.39.
|
|
1061
|
-
sv.devDependency("@eslint/compat", "^
|
|
1062
|
-
sv.devDependency("eslint-plugin-svelte", "^3.
|
|
1063
|
-
sv.devDependency("globals", "^
|
|
1064
|
-
sv.devDependency("@eslint/js", "^9.39.
|
|
1060
|
+
sv.devDependency("eslint", "^9.39.2");
|
|
1061
|
+
sv.devDependency("@eslint/compat", "^2.0.1");
|
|
1062
|
+
sv.devDependency("eslint-plugin-svelte", "^3.14.0");
|
|
1063
|
+
sv.devDependency("globals", "^17.1.0");
|
|
1064
|
+
sv.devDependency("@eslint/js", "^9.39.2");
|
|
1065
1065
|
sv.devDependency("@types/node", getNodeTypesVersion());
|
|
1066
|
-
if (typescript) sv.devDependency("typescript-eslint", "^8.
|
|
1066
|
+
if (typescript) sv.devDependency("typescript-eslint", "^8.53.1");
|
|
1067
1067
|
if (prettierInstalled) sv.devDependency("eslint-config-prettier", "^10.1.8");
|
|
1068
1068
|
sv.file(files.package, (content) => {
|
|
1069
1069
|
const { data, generateCode } = parse$1.json(content);
|
|
@@ -1077,7 +1077,7 @@ var eslint_default = defineAddon({
|
|
|
1077
1077
|
from: "./svelte.config.js",
|
|
1078
1078
|
as: "svelteConfig"
|
|
1079
1079
|
});
|
|
1080
|
-
const gitIgnorePathStatement = parseStatement("\nconst gitignorePath =
|
|
1080
|
+
const gitIgnorePathStatement = parseStatement("\nconst gitignorePath = path.resolve(import.meta.dirname, '.gitignore');");
|
|
1081
1081
|
appendStatement(ast, { statement: gitIgnorePathStatement });
|
|
1082
1082
|
const ignoresConfig = parseExpression("includeIgnoreFile(gitignorePath)");
|
|
1083
1083
|
eslintConfigs.push(ignoresConfig);
|
|
@@ -1145,7 +1145,7 @@ var eslint_default = defineAddon({
|
|
|
1145
1145
|
}
|
|
1146
1146
|
const { value: defaultExport, astNode } = createDefault(ast, { fallback: exportExpression });
|
|
1147
1147
|
if (defaultExport !== exportExpression) {
|
|
1148
|
-
|
|
1148
|
+
R.warn("An eslint config is already defined. Skipping initialization.");
|
|
1149
1149
|
return content;
|
|
1150
1150
|
}
|
|
1151
1151
|
if (!typescript) addJsDocTypeComment(astNode, comments, { type: "import('eslint').Linter.Config[]" });
|
|
@@ -1173,9 +1173,9 @@ var eslint_default = defineAddon({
|
|
|
1173
1173
|
from: "@eslint/compat",
|
|
1174
1174
|
imports: ["includeIgnoreFile"]
|
|
1175
1175
|
});
|
|
1176
|
-
|
|
1177
|
-
from: "node:
|
|
1178
|
-
|
|
1176
|
+
addDefault(ast, {
|
|
1177
|
+
from: "node:path",
|
|
1178
|
+
as: "path"
|
|
1179
1179
|
});
|
|
1180
1180
|
return generateCode();
|
|
1181
1181
|
});
|
|
@@ -1184,7 +1184,7 @@ var eslint_default = defineAddon({
|
|
|
1184
1184
|
});
|
|
1185
1185
|
|
|
1186
1186
|
//#endregion
|
|
1187
|
-
//#region lib/addons/lucia
|
|
1187
|
+
//#region lib/addons/lucia.ts
|
|
1188
1188
|
const TABLE_TYPE = {
|
|
1189
1189
|
mysql: "mysqlTable",
|
|
1190
1190
|
postgresql: "pgTable",
|
|
@@ -1486,7 +1486,7 @@ var lucia_default = defineAddon({
|
|
|
1486
1486
|
sv.file(`${kit.routesDirectory}/demo/lucia/login/+page.server.${language}`, (content) => {
|
|
1487
1487
|
if (content) {
|
|
1488
1488
|
const filePath = `${kit.routesDirectory}/demo/lucia/login/+page.server.${typescript ? "ts" : "js"}`;
|
|
1489
|
-
|
|
1489
|
+
R.warn(`Existing ${color.warning(filePath)} file. Could not update.`);
|
|
1490
1490
|
return content;
|
|
1491
1491
|
}
|
|
1492
1492
|
const [ts] = createPrinter(typescript);
|
|
@@ -1607,7 +1607,7 @@ var lucia_default = defineAddon({
|
|
|
1607
1607
|
sv.file(`${kit.routesDirectory}/demo/lucia/login/+page.svelte`, (content) => {
|
|
1608
1608
|
if (content) {
|
|
1609
1609
|
const filePath = `${kit.routesDirectory}/demo/lucia/login/+page.svelte`;
|
|
1610
|
-
|
|
1610
|
+
R.warn(`Existing ${color.warning(filePath)} file. Could not update.`);
|
|
1611
1611
|
return content;
|
|
1612
1612
|
}
|
|
1613
1613
|
const tailwind = dependencyVersion("@tailwindcss/vite") !== void 0;
|
|
@@ -1651,7 +1651,7 @@ var lucia_default = defineAddon({
|
|
|
1651
1651
|
sv.file(`${kit.routesDirectory}/demo/lucia/+page.server.${language}`, (content) => {
|
|
1652
1652
|
if (content) {
|
|
1653
1653
|
const filePath = `${kit.routesDirectory}/demo/lucia/+page.server.${typescript ? "ts" : "js"}`;
|
|
1654
|
-
|
|
1654
|
+
R.warn(`Existing ${color.warning(filePath)} file. Could not update.`);
|
|
1655
1655
|
return content;
|
|
1656
1656
|
}
|
|
1657
1657
|
const [ts] = createPrinter(typescript);
|
|
@@ -1691,7 +1691,7 @@ var lucia_default = defineAddon({
|
|
|
1691
1691
|
sv.file(`${kit.routesDirectory}/demo/lucia/+page.svelte`, (content) => {
|
|
1692
1692
|
if (content) {
|
|
1693
1693
|
const filePath = `${kit.routesDirectory}/demo/lucia/+page.svelte`;
|
|
1694
|
-
|
|
1694
|
+
R.warn(`Existing ${color.warning(filePath)} file. Could not update.`);
|
|
1695
1695
|
return content;
|
|
1696
1696
|
}
|
|
1697
1697
|
const [ts, s5] = createPrinter(typescript, !!dependencyVersion("svelte")?.startsWith("5"));
|
|
@@ -1784,7 +1784,7 @@ function getCallExpression(ast) {
|
|
|
1784
1784
|
}
|
|
1785
1785
|
|
|
1786
1786
|
//#endregion
|
|
1787
|
-
//#region lib/addons/mcp
|
|
1787
|
+
//#region lib/addons/mcp.ts
|
|
1788
1788
|
const options$5 = defineAddonOptions().add("ide", {
|
|
1789
1789
|
question: "Which client would you like to use?",
|
|
1790
1790
|
type: "multiselect",
|
|
@@ -1919,7 +1919,7 @@ var mcp_default = defineAddon({
|
|
|
1919
1919
|
return generateCode();
|
|
1920
1920
|
});
|
|
1921
1921
|
}
|
|
1922
|
-
if (filesExistingAlready.length > 0)
|
|
1922
|
+
if (filesExistingAlready.length > 0) R.warn(`${filesExistingAlready.map((path$2) => color.path(path$2)).join(", ")} already exists, we didn't touch ${filesExistingAlready.length > 1 ? "them" : "it"}. See ${color.website("https://svelte.dev/docs/mcp/overview#Usage")} for manual setup.`);
|
|
1923
1923
|
},
|
|
1924
1924
|
nextSteps({ options: options$8 }) {
|
|
1925
1925
|
const steps = [];
|
|
@@ -1929,7 +1929,7 @@ var mcp_default = defineAddon({
|
|
|
1929
1929
|
});
|
|
1930
1930
|
|
|
1931
1931
|
//#endregion
|
|
1932
|
-
//#region lib/addons/mdsvex
|
|
1932
|
+
//#region lib/addons/mdsvex.ts
|
|
1933
1933
|
var mdsvex_default = defineAddon({
|
|
1934
1934
|
id: "mdsvex",
|
|
1935
1935
|
shortDescription: "svelte + markdown",
|
|
@@ -1971,7 +1971,7 @@ var mdsvex_default = defineAddon({
|
|
|
1971
1971
|
});
|
|
1972
1972
|
|
|
1973
1973
|
//#endregion
|
|
1974
|
-
//#region lib/addons/paraglide
|
|
1974
|
+
//#region lib/addons/paraglide.ts
|
|
1975
1975
|
const DEFAULT_INLANG_PROJECT = {
|
|
1976
1976
|
$schema: "https://inlang.com/schema/project-settings",
|
|
1977
1977
|
modules: ["https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js", "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js"],
|
|
@@ -2007,7 +2007,7 @@ var paraglide_default = defineAddon({
|
|
|
2007
2007
|
run: ({ sv, options: options$8, files, language, kit }) => {
|
|
2008
2008
|
if (!kit) throw new Error("SvelteKit is required");
|
|
2009
2009
|
const paraglideOutDir = "src/lib/paraglide";
|
|
2010
|
-
sv.devDependency("@inlang/paraglide-js", "^2.
|
|
2010
|
+
sv.devDependency("@inlang/paraglide-js", "^2.9.1");
|
|
2011
2011
|
sv.file(files.viteConfig, (content) => {
|
|
2012
2012
|
const { ast, generateCode } = parse$1.script(content);
|
|
2013
2013
|
const vitePluginName = "paraglideVitePlugin";
|
|
@@ -2036,7 +2036,7 @@ var paraglide_default = defineAddon({
|
|
|
2036
2036
|
if (createNamed(ast, {
|
|
2037
2037
|
name: "reroute",
|
|
2038
2038
|
fallback: rerouteIdentifier
|
|
2039
|
-
}).declaration !== rerouteIdentifier)
|
|
2039
|
+
}).declaration !== rerouteIdentifier) R.warn("Adding the reroute hook automatically failed. Add it manually");
|
|
2040
2040
|
return generateCode();
|
|
2041
2041
|
});
|
|
2042
2042
|
sv.file(`src/hooks.server.${language}`, (content) => {
|
|
@@ -2061,7 +2061,7 @@ var paraglide_default = defineAddon({
|
|
|
2061
2061
|
const { ast, generateCode } = parse$1.html(content);
|
|
2062
2062
|
const htmlNode = ast.nodes.find((child) => child.type === "RegularElement" && child.name === "html");
|
|
2063
2063
|
if (!htmlNode) {
|
|
2064
|
-
|
|
2064
|
+
R.warn("Could not find <html> node in app.html. You'll need to add the language placeholder manually");
|
|
2065
2065
|
return generateCode();
|
|
2066
2066
|
}
|
|
2067
2067
|
addAttribute(htmlNode, "lang", "%paraglide.lang%");
|
|
@@ -2151,14 +2151,14 @@ function parseLanguageTagInput(input) {
|
|
|
2151
2151
|
}
|
|
2152
2152
|
|
|
2153
2153
|
//#endregion
|
|
2154
|
-
//#region lib/addons/playwright
|
|
2154
|
+
//#region lib/addons/playwright.ts
|
|
2155
2155
|
var playwright_default = defineAddon({
|
|
2156
2156
|
id: "playwright",
|
|
2157
2157
|
shortDescription: "browser testing",
|
|
2158
2158
|
homepage: "https://playwright.dev",
|
|
2159
2159
|
options: {},
|
|
2160
2160
|
run: ({ sv, language, files }) => {
|
|
2161
|
-
sv.devDependency("@playwright/test", "^1.
|
|
2161
|
+
sv.devDependency("@playwright/test", "^1.58.0");
|
|
2162
2162
|
sv.file(files.package, (content) => {
|
|
2163
2163
|
const { data, generateCode } = parse$1.json(content);
|
|
2164
2164
|
packageScriptsUpsert(data, "test:e2e", "playwright test");
|
|
@@ -2199,14 +2199,14 @@ var playwright_default = defineAddon({
|
|
|
2199
2199
|
});
|
|
2200
2200
|
overrideProperties(defaultExport.arguments[0], config);
|
|
2201
2201
|
} else if (defaultExport.type === "ObjectExpression") overrideProperties(defaultExport, config);
|
|
2202
|
-
else
|
|
2202
|
+
else R.warn("Unexpected playwright config for playwright add-on. Could not update.");
|
|
2203
2203
|
return generateCode();
|
|
2204
2204
|
});
|
|
2205
2205
|
}
|
|
2206
2206
|
});
|
|
2207
2207
|
|
|
2208
2208
|
//#endregion
|
|
2209
|
-
//#region lib/addons/prettier
|
|
2209
|
+
//#region lib/addons/prettier.ts
|
|
2210
2210
|
var prettier_default = defineAddon({
|
|
2211
2211
|
id: "prettier",
|
|
2212
2212
|
shortDescription: "formatter",
|
|
@@ -2215,8 +2215,8 @@ var prettier_default = defineAddon({
|
|
|
2215
2215
|
run: ({ sv, dependencyVersion, files }) => {
|
|
2216
2216
|
const tailwindcssInstalled = Boolean(dependencyVersion("tailwindcss"));
|
|
2217
2217
|
if (tailwindcssInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.7.2");
|
|
2218
|
-
sv.devDependency("prettier", "^3.
|
|
2219
|
-
sv.devDependency("prettier-plugin-svelte", "^3.4.
|
|
2218
|
+
sv.devDependency("prettier", "^3.8.1");
|
|
2219
|
+
sv.devDependency("prettier-plugin-svelte", "^3.4.1");
|
|
2220
2220
|
sv.file(files.prettierignore, (content) => {
|
|
2221
2221
|
if (content) return content;
|
|
2222
2222
|
return dedent_default`
|
|
@@ -2236,7 +2236,7 @@ var prettier_default = defineAddon({
|
|
|
2236
2236
|
try {
|
|
2237
2237
|
({data, generateCode} = parse$1.json(content));
|
|
2238
2238
|
} catch {
|
|
2239
|
-
|
|
2239
|
+
R.warn(`A ${color.warning(".prettierrc")} config already exists and cannot be parsed as JSON. Skipping initialization.`);
|
|
2240
2240
|
return content;
|
|
2241
2241
|
}
|
|
2242
2242
|
if (Object.keys(data).length === 0) {
|
|
@@ -2262,12 +2262,11 @@ var prettier_default = defineAddon({
|
|
|
2262
2262
|
const eslintInstalled = hasEslint(eslintVersion);
|
|
2263
2263
|
sv.file(files.package, (content) => {
|
|
2264
2264
|
const { data, generateCode } = parse$1.json(content);
|
|
2265
|
-
|
|
2266
|
-
packageScriptsUpsert(data, "lint", cmd);
|
|
2265
|
+
packageScriptsUpsert(data, "lint", "prettier --check .", { mode: "prepend" });
|
|
2267
2266
|
packageScriptsUpsert(data, "format", "prettier --write .");
|
|
2268
2267
|
return generateCode();
|
|
2269
2268
|
});
|
|
2270
|
-
if (eslintVersion?.startsWith(SUPPORTED_ESLINT_VERSION) === false)
|
|
2269
|
+
if (eslintVersion?.startsWith(SUPPORTED_ESLINT_VERSION) === false) R.warn(`An older major version of ${color.warning("eslint")} was detected. Skipping ${color.warning("eslint-config-prettier")} installation.`);
|
|
2271
2270
|
if (eslintInstalled) {
|
|
2272
2271
|
sv.devDependency("eslint-config-prettier", "^10.1.8");
|
|
2273
2272
|
sv.file(files.eslintConfig, addEslintConfigPrettier);
|
|
@@ -2280,7 +2279,7 @@ function hasEslint(version$1) {
|
|
|
2280
2279
|
}
|
|
2281
2280
|
|
|
2282
2281
|
//#endregion
|
|
2283
|
-
//#region lib/addons/storybook
|
|
2282
|
+
//#region lib/addons/storybook.ts
|
|
2284
2283
|
var storybook_default = defineAddon({
|
|
2285
2284
|
id: "storybook",
|
|
2286
2285
|
shortDescription: "frontend workshop",
|
|
@@ -2303,7 +2302,7 @@ var storybook_default = defineAddon({
|
|
|
2303
2302
|
});
|
|
2304
2303
|
|
|
2305
2304
|
//#endregion
|
|
2306
|
-
//#region lib/addons/sveltekit-adapter
|
|
2305
|
+
//#region lib/addons/sveltekit-adapter.ts
|
|
2307
2306
|
const adapters = [
|
|
2308
2307
|
{
|
|
2309
2308
|
id: "auto",
|
|
@@ -2313,7 +2312,7 @@ const adapters = [
|
|
|
2313
2312
|
{
|
|
2314
2313
|
id: "node",
|
|
2315
2314
|
package: "@sveltejs/adapter-node",
|
|
2316
|
-
version: "^5.
|
|
2315
|
+
version: "^5.5.2"
|
|
2317
2316
|
},
|
|
2318
2317
|
{
|
|
2319
2318
|
id: "static",
|
|
@@ -2323,12 +2322,12 @@ const adapters = [
|
|
|
2323
2322
|
{
|
|
2324
2323
|
id: "vercel",
|
|
2325
2324
|
package: "@sveltejs/adapter-vercel",
|
|
2326
|
-
version: "^6.
|
|
2325
|
+
version: "^6.3.1"
|
|
2327
2326
|
},
|
|
2328
2327
|
{
|
|
2329
2328
|
id: "cloudflare",
|
|
2330
2329
|
package: "@sveltejs/adapter-cloudflare",
|
|
2331
|
-
version: "^7.2.
|
|
2330
|
+
version: "^7.2.6"
|
|
2332
2331
|
},
|
|
2333
2332
|
{
|
|
2334
2333
|
id: "netlify",
|
|
@@ -2410,7 +2409,7 @@ var sveltekit_adapter_default = defineAddon({
|
|
|
2410
2409
|
return generateCode();
|
|
2411
2410
|
});
|
|
2412
2411
|
if (adapter.package === "@sveltejs/adapter-cloudflare") {
|
|
2413
|
-
sv.devDependency("wrangler", "^4.
|
|
2412
|
+
sv.devDependency("wrangler", "^4.60.0");
|
|
2414
2413
|
const configFormat = fileExists(cwd$1, "wrangler.toml") ? "toml" : "jsonc";
|
|
2415
2414
|
sv.file(`wrangler.${configFormat}`, (content) => {
|
|
2416
2415
|
const { data, generateCode } = configFormat === "jsonc" ? parse$1.json(content) : parse$1.toml(content);
|
|
@@ -2493,7 +2492,7 @@ function createCloudflarePlatformType(name$1, value, optional$1 = false) {
|
|
|
2493
2492
|
}
|
|
2494
2493
|
|
|
2495
2494
|
//#endregion
|
|
2496
|
-
//#region lib/addons/tailwindcss
|
|
2495
|
+
//#region lib/addons/tailwindcss.ts
|
|
2497
2496
|
const plugins = [{
|
|
2498
2497
|
id: "typography",
|
|
2499
2498
|
package: "@tailwindcss/typography",
|
|
@@ -2501,7 +2500,7 @@ const plugins = [{
|
|
|
2501
2500
|
}, {
|
|
2502
2501
|
id: "forms",
|
|
2503
2502
|
package: "@tailwindcss/forms",
|
|
2504
|
-
version: "^0.5.
|
|
2503
|
+
version: "^0.5.11"
|
|
2505
2504
|
}];
|
|
2506
2505
|
const options$2 = defineAddonOptions().add("plugins", {
|
|
2507
2506
|
type: "multiselect",
|
|
@@ -2522,8 +2521,8 @@ var tailwindcss_default = defineAddon({
|
|
|
2522
2521
|
options: options$2,
|
|
2523
2522
|
run: ({ sv, options: options$8, files, kit, dependencyVersion, language }) => {
|
|
2524
2523
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
2525
|
-
sv.devDependency("tailwindcss", "^4.1.
|
|
2526
|
-
sv.devDependency("@tailwindcss/vite", "^4.1.
|
|
2524
|
+
sv.devDependency("tailwindcss", "^4.1.18");
|
|
2525
|
+
sv.devDependency("@tailwindcss/vite", "^4.1.18");
|
|
2527
2526
|
sv.pnpmBuildDependency("@tailwindcss/oxide");
|
|
2528
2527
|
if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.7.2");
|
|
2529
2528
|
for (const plugin of plugins) {
|
|
@@ -2606,7 +2605,7 @@ var tailwindcss_default = defineAddon({
|
|
|
2606
2605
|
});
|
|
2607
2606
|
|
|
2608
2607
|
//#endregion
|
|
2609
|
-
//#region lib/addons/vitest-addon
|
|
2608
|
+
//#region lib/addons/vitest-addon.ts
|
|
2610
2609
|
const options$1 = defineAddonOptions().add("usages", {
|
|
2611
2610
|
question: "What do you want to use vitest for?",
|
|
2612
2611
|
type: "multiselect",
|
|
@@ -2630,16 +2629,16 @@ var vitest_addon_default = defineAddon({
|
|
|
2630
2629
|
const unitTesting = options$8.usages.includes("unit");
|
|
2631
2630
|
const componentTesting = options$8.usages.includes("component");
|
|
2632
2631
|
vitestV3Installed = (dependencyVersion("vitest") ?? "").replaceAll("^", "").replaceAll("~", "")?.startsWith("3.");
|
|
2633
|
-
sv.devDependency("vitest", "^4.0.
|
|
2632
|
+
sv.devDependency("vitest", "^4.0.18");
|
|
2634
2633
|
if (componentTesting) {
|
|
2635
|
-
sv.devDependency("@vitest/browser-playwright", "^4.0.
|
|
2636
|
-
sv.devDependency("vitest-browser-svelte", "^2.0.
|
|
2637
|
-
sv.devDependency("playwright", "^1.
|
|
2634
|
+
sv.devDependency("@vitest/browser-playwright", "^4.0.18");
|
|
2635
|
+
sv.devDependency("vitest-browser-svelte", "^2.0.2");
|
|
2636
|
+
sv.devDependency("playwright", "^1.58.0");
|
|
2638
2637
|
}
|
|
2639
2638
|
sv.file(files.package, (content) => {
|
|
2640
2639
|
const { data, generateCode } = parse$1.json(content);
|
|
2641
2640
|
packageScriptsUpsert(data, "test:unit", "vitest");
|
|
2642
|
-
packageScriptsUpsert(data, "test", "npm run test:unit -- --run");
|
|
2641
|
+
packageScriptsUpsert(data, "test", "npm run test:unit -- --run", { mode: "prepend" });
|
|
2643
2642
|
return generateCode();
|
|
2644
2643
|
});
|
|
2645
2644
|
if (unitTesting) sv.file(`src/demo.spec.${language}`, (content) => {
|
|
@@ -2754,7 +2753,7 @@ var vitest_addon_default = defineAddon({
|
|
|
2754
2753
|
});
|
|
2755
2754
|
|
|
2756
2755
|
//#endregion
|
|
2757
|
-
//#region lib/addons/
|
|
2756
|
+
//#region lib/addons/_engine/official.ts
|
|
2758
2757
|
const officialAddons$1 = {
|
|
2759
2758
|
prettier: prettier_default,
|
|
2760
2759
|
eslint: eslint_default,
|
|
@@ -3037,7 +3036,9 @@ function findWorkspaceRoot(cwd$1) {
|
|
|
3037
3036
|
const { data } = getPackageJson(directory);
|
|
3038
3037
|
if (data.workspaces) return directory;
|
|
3039
3038
|
}
|
|
3040
|
-
|
|
3039
|
+
const parent = path.dirname(directory);
|
|
3040
|
+
if (directory.includes(".test-output") && !parent.includes(".test-output")) break;
|
|
3041
|
+
directory = parent;
|
|
3041
3042
|
}
|
|
3042
3043
|
return cwd$1;
|
|
3043
3044
|
}
|
|
@@ -3083,7 +3084,7 @@ function parseKitOptions(cwd$1) {
|
|
|
3083
3084
|
//#endregion
|
|
3084
3085
|
//#region package.json
|
|
3085
3086
|
var name = "sv";
|
|
3086
|
-
var version = "0.11.
|
|
3087
|
+
var version = "0.11.4";
|
|
3087
3088
|
|
|
3088
3089
|
//#endregion
|
|
3089
3090
|
//#region lib/cli/utils/errors.ts
|
|
@@ -3098,7 +3099,6 @@ var UnsupportedError = class extends Error {
|
|
|
3098
3099
|
|
|
3099
3100
|
//#endregion
|
|
3100
3101
|
//#region lib/cli/utils/common.ts
|
|
3101
|
-
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
3102
3102
|
const NO_PREFIX = "--no-";
|
|
3103
3103
|
let options = [];
|
|
3104
3104
|
function getLongFlag(flags) {
|
|
@@ -3129,37 +3129,33 @@ const helpConfig = {
|
|
|
3129
3129
|
if (options.some((o) => getLongFlag(o.flags) === noVariant)) return `--[no-]${longFlag.slice(2)}`;
|
|
3130
3130
|
return option.flags;
|
|
3131
3131
|
},
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
styleDescriptionText: (str) => import_picocolors.default.gray(str),
|
|
3135
|
-
styleOptionText: (str) => import_picocolors.default.white(str),
|
|
3136
|
-
styleArgumentText: (str) => import_picocolors.default.white(str),
|
|
3137
|
-
styleSubcommandText: (str) => import_picocolors.default.red(str)
|
|
3132
|
+
styleCommandText: (str) => color.success(str),
|
|
3133
|
+
styleDescriptionText: (str) => color.optional(str)
|
|
3138
3134
|
};
|
|
3139
3135
|
function formatDescription(arg) {
|
|
3140
3136
|
let output = arg.description;
|
|
3141
|
-
if (arg.defaultValue !== void 0 && String(arg.defaultValue)) output +=
|
|
3142
|
-
if (arg.argChoices !== void 0 && String(arg.argChoices)) output +=
|
|
3137
|
+
if (arg.defaultValue !== void 0 && String(arg.defaultValue)) output += color.dim(` (default: ${JSON.stringify(arg.defaultValue)})`);
|
|
3138
|
+
if (arg.argChoices !== void 0 && String(arg.argChoices)) output += color.dim(` (choices: ${arg.argChoices.join(", ")})`);
|
|
3143
3139
|
return output;
|
|
3144
3140
|
}
|
|
3145
3141
|
async function runCommand(action) {
|
|
3146
3142
|
try {
|
|
3147
|
-
|
|
3143
|
+
Nt(`Welcome to the Svelte CLI! ${color.optional(`(v${version})`)}`);
|
|
3148
3144
|
const minimumVersion = "18.3.0";
|
|
3149
|
-
if (isVersionUnsupportedBelow(process$1.versions.node, minimumVersion))
|
|
3145
|
+
if (isVersionUnsupportedBelow(process$1.versions.node, minimumVersion)) R.warn(`You are using Node.js ${color.error(process$1.versions.node)}, please upgrade to Node.js ${color.success(minimumVersion)} or higher.`);
|
|
3150
3146
|
await action();
|
|
3151
|
-
|
|
3147
|
+
Wt("You're all set!");
|
|
3152
3148
|
} catch (e) {
|
|
3153
3149
|
if (e instanceof UnsupportedError) {
|
|
3154
3150
|
const padding = getPadding(e.reasons.map((r) => r.id));
|
|
3155
|
-
const message = e.reasons.map((r) => ` ${r.id.padEnd(padding)} ${
|
|
3156
|
-
|
|
3157
|
-
|
|
3151
|
+
const message = e.reasons.map((r) => ` ${r.id.padEnd(padding)} ${color.error(r.reason)}`).join("\n");
|
|
3152
|
+
R.error(`${e.name}\n\n${message}`);
|
|
3153
|
+
R.message();
|
|
3158
3154
|
} else if (e instanceof Error) {
|
|
3159
|
-
|
|
3160
|
-
|
|
3155
|
+
R.error(e.stack ?? String(e));
|
|
3156
|
+
R.message();
|
|
3161
3157
|
}
|
|
3162
|
-
|
|
3158
|
+
Pt("Operation failed.");
|
|
3163
3159
|
}
|
|
3164
3160
|
}
|
|
3165
3161
|
function getPadding(lines) {
|
|
@@ -3190,7 +3186,8 @@ function buildAndLogArgs(agent, command, args, lastArgs = []) {
|
|
|
3190
3186
|
else allArgs.push("--install", agent);
|
|
3191
3187
|
const res = resolveCommand(agent ?? "npm", "execute", [...allArgs, ...lastArgs]);
|
|
3192
3188
|
const message = [res.command, ...res.args].join(" ");
|
|
3193
|
-
|
|
3189
|
+
R.message(color.optional(color.dim(`To skip prompts next time, run:`)));
|
|
3190
|
+
R.info(color.optional(message), { spacing: -1 });
|
|
3194
3191
|
return message;
|
|
3195
3192
|
}
|
|
3196
3193
|
function updateReadme(projectPath, command) {
|
|
@@ -3211,9 +3208,9 @@ ${command}\n\`\`\`
|
|
|
3211
3208
|
fs.writeFileSync(readmePath, content);
|
|
3212
3209
|
}
|
|
3213
3210
|
function errorAndExit(message) {
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3211
|
+
R.error(message);
|
|
3212
|
+
R.message();
|
|
3213
|
+
Pt("Operation failed.");
|
|
3217
3214
|
process$1.exit(1);
|
|
3218
3215
|
}
|
|
3219
3216
|
const normalizePosix = (dir) => {
|
|
@@ -3250,31 +3247,30 @@ const create = new Command("create").description("scaffolds a new SvelteKit proj
|
|
|
3250
3247
|
const cwd$1 = parse(ProjectPathSchema, projectPath);
|
|
3251
3248
|
const options$8 = parse(OptionsSchema$1, opts);
|
|
3252
3249
|
if (options$8.fromPlayground && !validatePlaygroundUrl(options$8.fromPlayground)) {
|
|
3253
|
-
console.error(
|
|
3250
|
+
console.error(color.error(`Error: Invalid playground URL: ${options$8.fromPlayground}`));
|
|
3254
3251
|
process$1.exit(1);
|
|
3255
3252
|
}
|
|
3256
3253
|
runCommand(async () => {
|
|
3257
3254
|
const { directory, addOnNextSteps, packageManager } = await createProject(cwd$1, options$8);
|
|
3258
|
-
const highlight = (str) => import_picocolors.default.bold(import_picocolors.default.cyan(str));
|
|
3259
3255
|
let i = 1;
|
|
3260
3256
|
const initialSteps = ["📁 Project steps", ""];
|
|
3261
3257
|
const relative = path.relative(process$1.cwd(), directory);
|
|
3262
3258
|
const pm = packageManager ?? (await detect({ cwd: directory }))?.name ?? getUserAgent() ?? "npm";
|
|
3263
3259
|
if (relative !== "") {
|
|
3264
3260
|
const pathHasSpaces = relative.includes(" ");
|
|
3265
|
-
initialSteps.push(` ${i++}: ${
|
|
3261
|
+
initialSteps.push(` ${i++}: ${color.command(`cd ${pathHasSpaces ? `"${relative}"` : relative}`)}`);
|
|
3266
3262
|
}
|
|
3267
3263
|
if (!packageManager) {
|
|
3268
3264
|
const { args: args$1, command: command$1 } = resolveCommand(pm, "install", []);
|
|
3269
|
-
initialSteps.push(` ${i++}: ${
|
|
3265
|
+
initialSteps.push(` ${i++}: ${color.command(`${command$1} ${args$1.join(" ")}`)}`);
|
|
3270
3266
|
}
|
|
3271
3267
|
const { args, command } = resolveCommand(pm, "run", ["dev", "--open"]);
|
|
3272
3268
|
const pmRunCmd = `${command} ${args.join(" ")}`;
|
|
3273
3269
|
const steps = [
|
|
3274
3270
|
...initialSteps,
|
|
3275
|
-
` ${i++}: ${
|
|
3271
|
+
` ${i++}: ${color.command(pmRunCmd)}`,
|
|
3276
3272
|
"",
|
|
3277
|
-
`To close the dev server, hit ${
|
|
3273
|
+
`To close the dev server, hit ${color.command("Ctrl-C")}`
|
|
3278
3274
|
];
|
|
3279
3275
|
if (addOnNextSteps.length > 0) {
|
|
3280
3276
|
steps.push("", "🧩 Add-on steps", "");
|
|
@@ -3283,17 +3279,17 @@ const create = new Command("create").description("scaffolds a new SvelteKit proj
|
|
|
3283
3279
|
steps.push(` ${indented}`);
|
|
3284
3280
|
}
|
|
3285
3281
|
}
|
|
3286
|
-
steps.push("", `Stuck? Visit us at ${
|
|
3287
|
-
|
|
3282
|
+
steps.push("", `Stuck? Visit us at ${color.website("https://svelte.dev/chat")}`);
|
|
3283
|
+
kt(steps.join("\n"), "What's next?", { format: (line) => line });
|
|
3288
3284
|
});
|
|
3289
3285
|
}).showHelpAfterError(true);
|
|
3290
3286
|
async function createProject(cwd$1, options$8) {
|
|
3291
|
-
if (options$8.fromPlayground)
|
|
3292
|
-
const { directory, template, language } = await
|
|
3287
|
+
if (options$8.fromPlayground) R.warn("Svelte maintainers have not reviewed playgrounds for malicious code. Use at your discretion.");
|
|
3288
|
+
const { directory, template, language } = await Rt({
|
|
3293
3289
|
directory: () => {
|
|
3294
3290
|
const defaultPath = "./";
|
|
3295
3291
|
if (cwd$1) return Promise.resolve(normalizePosix(cwd$1));
|
|
3296
|
-
return
|
|
3292
|
+
return Qt({
|
|
3297
3293
|
message: "Where would you like your project to be created?",
|
|
3298
3294
|
placeholder: ` (hit Enter to use '${defaultPath}')`,
|
|
3299
3295
|
defaultValue: defaultPath
|
|
@@ -3303,12 +3299,12 @@ async function createProject(cwd$1, options$8) {
|
|
|
3303
3299
|
if (!options$8.dirCheck) return;
|
|
3304
3300
|
if (!fs.existsSync(directory$1)) return;
|
|
3305
3301
|
if (!fs.readdirSync(directory$1).some((file) => !file.startsWith(".git"))) return;
|
|
3306
|
-
const force = await
|
|
3302
|
+
const force = await Mt({
|
|
3307
3303
|
message: "Directory not empty. Continue?",
|
|
3308
3304
|
initialValue: false
|
|
3309
3305
|
});
|
|
3310
|
-
if (
|
|
3311
|
-
|
|
3306
|
+
if (Ct(force) || !force) {
|
|
3307
|
+
Pt("Exiting.");
|
|
3312
3308
|
process$1.exit(0);
|
|
3313
3309
|
}
|
|
3314
3310
|
},
|
|
@@ -3316,7 +3312,7 @@ async function createProject(cwd$1, options$8) {
|
|
|
3316
3312
|
if (options$8.template) return Promise.resolve(options$8.template);
|
|
3317
3313
|
if (options$8.fromPlayground) return Promise.resolve("minimal");
|
|
3318
3314
|
const availableTemplates = templates.filter((t) => t.name !== "addon");
|
|
3319
|
-
return
|
|
3315
|
+
return qt({
|
|
3320
3316
|
message: "Which template would you like?",
|
|
3321
3317
|
initialValue: "minimal",
|
|
3322
3318
|
options: availableTemplates.map((t) => ({
|
|
@@ -3329,7 +3325,7 @@ async function createProject(cwd$1, options$8) {
|
|
|
3329
3325
|
language: (o) => {
|
|
3330
3326
|
if (options$8.types) return Promise.resolve(options$8.types);
|
|
3331
3327
|
if (o.results.template === "addon") return Promise.resolve("none");
|
|
3332
|
-
return
|
|
3328
|
+
return qt({
|
|
3333
3329
|
message: "Add type checking with TypeScript?",
|
|
3334
3330
|
initialValue: "typescript",
|
|
3335
3331
|
options: [
|
|
@@ -3349,7 +3345,7 @@ async function createProject(cwd$1, options$8) {
|
|
|
3349
3345
|
});
|
|
3350
3346
|
}
|
|
3351
3347
|
}, { onCancel: () => {
|
|
3352
|
-
|
|
3348
|
+
Pt("Operation cancelled.");
|
|
3353
3349
|
process$1.exit(0);
|
|
3354
3350
|
} });
|
|
3355
3351
|
const projectPath = path.resolve(directory);
|
|
@@ -3389,7 +3385,7 @@ async function createProject(cwd$1, options$8) {
|
|
|
3389
3385
|
types: language
|
|
3390
3386
|
});
|
|
3391
3387
|
if (options$8.fromPlayground) await createProjectFromPlayground(options$8.fromPlayground, projectPath);
|
|
3392
|
-
|
|
3388
|
+
R.success("Project created");
|
|
3393
3389
|
let addOnNextSteps = [];
|
|
3394
3390
|
let argsFormattedAddons = [];
|
|
3395
3391
|
let addOnFilesToFormat = [];
|
|
@@ -3443,14 +3439,14 @@ async function createProjectFromPlayground(url, cwd$1) {
|
|
|
3443
3439
|
}
|
|
3444
3440
|
async function confirmExternalDependencies(dependencies) {
|
|
3445
3441
|
if (dependencies.length === 0) return false;
|
|
3446
|
-
const dependencyList = dependencies.map(
|
|
3447
|
-
|
|
3448
|
-
const installDeps = await
|
|
3442
|
+
const dependencyList = dependencies.map(color.warning).join(", ");
|
|
3443
|
+
R.warn(`The following external dependencies were found in the playground:\n\n${dependencyList}`);
|
|
3444
|
+
const installDeps = await Mt({
|
|
3449
3445
|
message: "Do you want to install these external dependencies?",
|
|
3450
3446
|
initialValue: false
|
|
3451
3447
|
});
|
|
3452
|
-
if (
|
|
3453
|
-
|
|
3448
|
+
if (Ct(installDeps)) {
|
|
3449
|
+
Pt("Operation cancelled.");
|
|
3454
3450
|
process$1.exit(0);
|
|
3455
3451
|
}
|
|
3456
3452
|
return installDeps;
|
|
@@ -6381,7 +6377,7 @@ const add$1 = new Command("add").description("applies specified add-ons into a p
|
|
|
6381
6377
|
workspace,
|
|
6382
6378
|
fromCommand: "add"
|
|
6383
6379
|
});
|
|
6384
|
-
if (nextSteps.length > 0)
|
|
6380
|
+
if (nextSteps.length > 0) kt(nextSteps.join("\n"), "Next steps", { format: (line) => line });
|
|
6385
6381
|
});
|
|
6386
6382
|
});
|
|
6387
6383
|
/**
|
|
@@ -6482,13 +6478,13 @@ async function promptAddonQuestions({ options: options$8, loadedAddons, workspac
|
|
|
6482
6478
|
value: id,
|
|
6483
6479
|
hint: `${shortDescription} - ${homepage}`
|
|
6484
6480
|
}));
|
|
6485
|
-
const selected = await
|
|
6486
|
-
message: `What would you like to add to your project? ${
|
|
6481
|
+
const selected = await Lt({
|
|
6482
|
+
message: `What would you like to add to your project? ${color.dim("(use arrow keys / space bar)")}`,
|
|
6487
6483
|
options: addonOptions$1,
|
|
6488
6484
|
required: false
|
|
6489
6485
|
});
|
|
6490
|
-
if (
|
|
6491
|
-
|
|
6486
|
+
if (Ct(selected)) {
|
|
6487
|
+
Pt("Operation cancelled.");
|
|
6492
6488
|
process$1.exit(1);
|
|
6493
6489
|
}
|
|
6494
6490
|
for (const id of selected) {
|
|
@@ -6534,8 +6530,8 @@ async function promptAddonQuestions({ options: options$8, loadedAddons, workspac
|
|
|
6534
6530
|
answers[depId] = {};
|
|
6535
6531
|
continue;
|
|
6536
6532
|
}
|
|
6537
|
-
if (await
|
|
6538
|
-
|
|
6533
|
+
if (await Mt({ message: `The ${color.addon(addonId)} add-on requires ${color.addon(depId)} to also be setup. ${color.success("Include it?")}` }) !== true) {
|
|
6534
|
+
Pt("Operation cancelled.");
|
|
6539
6535
|
process$1.exit(1);
|
|
6540
6536
|
}
|
|
6541
6537
|
answers[depId] = {};
|
|
@@ -6558,14 +6554,14 @@ async function promptAddonQuestions({ options: options$8, loadedAddons, workspac
|
|
|
6558
6554
|
});
|
|
6559
6555
|
}
|
|
6560
6556
|
if (fails.length > 0) {
|
|
6561
|
-
const message = fails.map(({ name: name$1, message: message$1 }) =>
|
|
6562
|
-
|
|
6563
|
-
const force = await
|
|
6557
|
+
const message = fails.map(({ name: name$1, message: message$1 }) => color.warning(`${name$1} (${message$1})`)).join("\n- ");
|
|
6558
|
+
kt(`- ${message}`, "Verifications not met", { format: (line) => line });
|
|
6559
|
+
const force = await Mt({
|
|
6564
6560
|
message: "Verifications failed. Do you wish to continue?",
|
|
6565
6561
|
initialValue: false
|
|
6566
6562
|
});
|
|
6567
|
-
if (
|
|
6568
|
-
|
|
6563
|
+
if (Ct(force) || !force) {
|
|
6564
|
+
Pt("Operation cancelled.");
|
|
6569
6565
|
process$1.exit(1);
|
|
6570
6566
|
}
|
|
6571
6567
|
}
|
|
@@ -6579,23 +6575,23 @@ async function promptAddonQuestions({ options: options$8, loadedAddons, workspac
|
|
|
6579
6575
|
if (question.condition?.(values) === false || values[questionId] !== void 0) continue;
|
|
6580
6576
|
let answer;
|
|
6581
6577
|
const message = questionPrefix + question.question;
|
|
6582
|
-
if (question.type === "boolean") answer = await
|
|
6578
|
+
if (question.type === "boolean") answer = await Mt({
|
|
6583
6579
|
message,
|
|
6584
6580
|
initialValue: question.default
|
|
6585
6581
|
});
|
|
6586
|
-
if (question.type === "select") answer = await
|
|
6582
|
+
if (question.type === "select") answer = await qt({
|
|
6587
6583
|
message,
|
|
6588
6584
|
initialValue: question.default,
|
|
6589
6585
|
options: question.options
|
|
6590
6586
|
});
|
|
6591
|
-
if (question.type === "multiselect") answer = await
|
|
6587
|
+
if (question.type === "multiselect") answer = await Lt({
|
|
6592
6588
|
message,
|
|
6593
6589
|
initialValues: question.default,
|
|
6594
6590
|
required: question.required,
|
|
6595
6591
|
options: question.options
|
|
6596
6592
|
});
|
|
6597
6593
|
if (question.type === "string" || question.type === "number") {
|
|
6598
|
-
answer = await
|
|
6594
|
+
answer = await Qt({
|
|
6599
6595
|
message,
|
|
6600
6596
|
initialValue: question.default?.toString() ?? (question.type === "number" ? "0" : ""),
|
|
6601
6597
|
placeholder: question.placeholder,
|
|
@@ -6603,8 +6599,8 @@ async function promptAddonQuestions({ options: options$8, loadedAddons, workspac
|
|
|
6603
6599
|
});
|
|
6604
6600
|
if (question.type === "number") answer = Number(answer);
|
|
6605
6601
|
}
|
|
6606
|
-
if (
|
|
6607
|
-
|
|
6602
|
+
if (Ct(answer)) {
|
|
6603
|
+
Pt("Operation cancelled.");
|
|
6608
6604
|
process$1.exit(1);
|
|
6609
6605
|
}
|
|
6610
6606
|
values[questionId] = answer;
|
|
@@ -6632,14 +6628,14 @@ async function runAddonsApply({ answers, options: options$8, loadedAddons, setup
|
|
|
6632
6628
|
const canceledAddonIds = [];
|
|
6633
6629
|
for (const [addonId, info] of Object.entries(status)) if (info === "success") addonSuccess.push(addonId);
|
|
6634
6630
|
else {
|
|
6635
|
-
|
|
6631
|
+
R.warn(`Canceled ${addonId}: ${info.join(", ")}`);
|
|
6636
6632
|
canceledAddonIds.push(addonId);
|
|
6637
6633
|
}
|
|
6638
6634
|
const successfulAddons = loadedAddons.filter((a) => !canceledAddonIds.includes(a.addon.id));
|
|
6639
6635
|
if (addonSuccess.length === 0) {
|
|
6640
|
-
|
|
6636
|
+
Pt("All selected add-ons were canceled.");
|
|
6641
6637
|
process$1.exit(1);
|
|
6642
|
-
} else
|
|
6638
|
+
} else R.success(`Successfully setup add-ons: ${addonSuccess.map((c) => color.addon(c)).join(", ")}`);
|
|
6643
6639
|
const packageManager = options$8.install === false ? null : options$8.install === true ? await packageManagerPrompt(options$8.cwd) : options$8.install;
|
|
6644
6640
|
await addPnpmBuildDependencies(workspace.cwd, packageManager, ["esbuild", ...pnpmBuildDependencies]);
|
|
6645
6641
|
const argsFormattedAddons = [];
|
|
@@ -6690,7 +6686,7 @@ async function runAddonsApply({ answers, options: options$8, loadedAddons, setup
|
|
|
6690
6686
|
options: addonOptions$1
|
|
6691
6687
|
});
|
|
6692
6688
|
if (addonNextSteps.length === 0) return;
|
|
6693
|
-
let addonMessage = `${
|
|
6689
|
+
let addonMessage = `${color.addon(addon.id)}:\n`;
|
|
6694
6690
|
addonMessage += ` - ${addonNextSteps.join("\n - ")}`;
|
|
6695
6691
|
return addonMessage;
|
|
6696
6692
|
}).filter((msg) => msg !== void 0),
|
|
@@ -6724,7 +6720,7 @@ function getAddonOptionFlags() {
|
|
|
6724
6720
|
const details = getAddonDetails(id);
|
|
6725
6721
|
if (Object.values(details.options).length === 0) continue;
|
|
6726
6722
|
const { defaults, groups } = getOptionChoices(details);
|
|
6727
|
-
const choices = Object.entries(groups).map(([group, choices$1]) => `${
|
|
6723
|
+
const choices = Object.entries(groups).map(([group, choices$1]) => `${color.optional(`${group}:`)} ${color.dim(choices$1.join(", "))}`).join("\n");
|
|
6728
6724
|
const preset = defaults.join(", ") || "none";
|
|
6729
6725
|
options$8.push({
|
|
6730
6726
|
id,
|
|
@@ -6783,7 +6779,7 @@ function getOptionChoices(details) {
|
|
|
6783
6779
|
}
|
|
6784
6780
|
async function resolveNonOfficialAddons(refs, downloadCheck) {
|
|
6785
6781
|
const selectedAddons = [];
|
|
6786
|
-
const { start, stop } =
|
|
6782
|
+
const { start, stop } = Se();
|
|
6787
6783
|
try {
|
|
6788
6784
|
start(`Resolving ${refs.map((r) => color.addon(r.specifier)).join(", ")} packages`);
|
|
6789
6785
|
const pkgs = await Promise.all(refs.map(async (ref) => {
|
|
@@ -6791,17 +6787,17 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
|
|
|
6791
6787
|
return await getPackageJSON(ref);
|
|
6792
6788
|
}));
|
|
6793
6789
|
stop("Resolved community add-on packages");
|
|
6794
|
-
for (const { warning } of pkgs) if (warning)
|
|
6795
|
-
|
|
6790
|
+
for (const { warning } of pkgs) if (warning) R.warn(warning);
|
|
6791
|
+
R.warn("Svelte maintainers have not reviewed community add-ons for malicious code. Use at your discretion.");
|
|
6796
6792
|
const paddingName = getPadding(pkgs.map(({ pkg }) => pkg.name));
|
|
6797
6793
|
const paddingVersion = getPadding(pkgs.map(({ pkg }) => `(v${pkg.version})`));
|
|
6798
6794
|
const packageInfos = pkgs.map(({ pkg, repo: _repo }) => {
|
|
6799
|
-
return `${
|
|
6795
|
+
return `${color.warning(pkg.name.padEnd(paddingName))} ${color.dim(`(v${pkg.version})`.padEnd(paddingVersion))} ${color.dim(`(${_repo})`)}`;
|
|
6800
6796
|
});
|
|
6801
|
-
|
|
6797
|
+
R.message(packageInfos.join("\n"));
|
|
6802
6798
|
if (downloadCheck) {
|
|
6803
|
-
if (await
|
|
6804
|
-
|
|
6799
|
+
if (await Mt({ message: "Would you like to continue?" }) !== true) {
|
|
6800
|
+
Pt("Operation cancelled.");
|
|
6805
6801
|
process$1.exit(1);
|
|
6806
6802
|
}
|
|
6807
6803
|
}
|
|
@@ -6824,7 +6820,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
|
|
|
6824
6820
|
}
|
|
6825
6821
|
stop("Downloaded community add-on packages");
|
|
6826
6822
|
} catch (err) {
|
|
6827
|
-
stop("Failed to download community add-on packages"
|
|
6823
|
+
stop("Failed to download community add-on packages");
|
|
6828
6824
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
6829
6825
|
errorAndExit(msg);
|
|
6830
6826
|
}
|
|
@@ -6836,7 +6832,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
|
|
|
6836
6832
|
const TESTING = process$1.env.NODE_ENV?.toLowerCase() === "test";
|
|
6837
6833
|
|
|
6838
6834
|
//#endregion
|
|
6839
|
-
//#region lib/addons/add.ts
|
|
6835
|
+
//#region lib/addons/_engine/add.ts
|
|
6840
6836
|
async function add({ addons, cwd: cwd$1, options: options$8, packageManager = "npm" }) {
|
|
6841
6837
|
const workspace = await createWorkspace({
|
|
6842
6838
|
cwd: cwd$1,
|
|
@@ -6933,7 +6929,7 @@ async function runAddon({ addon, loaded, multiple, workspace, workspaceOptions }
|
|
|
6933
6929
|
const { command, args } = resolveCommand(workspace.packageManager, "execute", commandArgs);
|
|
6934
6930
|
const addonPrefix = multiple ? `${addon.id}: ` : "";
|
|
6935
6931
|
const executedCommand = `${command} ${args.join(" ")}`;
|
|
6936
|
-
if (!TESTING)
|
|
6932
|
+
if (!TESTING) R.step(`${addonPrefix}Running external command ${color.optional(`(${executedCommand})`)}`);
|
|
6937
6933
|
if (workspace.packageManager === "npm") args.unshift("--yes");
|
|
6938
6934
|
try {
|
|
6939
6935
|
await q(command, args, {
|