sv 0.8.10 → 0.8.12
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 +352 -326
- package/dist/index.js +1 -1
- package/dist/{install-Da9nxDO6.js → install-CDGqSUYA.js} +28 -3
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { AGENT_NAMES, Command, De, Element, Fe, Ge, J, Ke, Option, T, Tag, Ue, Vu, We, __commonJS, __export, __toESM, __toESM$1, addPnpmBuildDependencies, create, detect, esm_exports, et, from, getUserAgent, installDependencies, installOption, ke, packageManagerPrompt, parseCss$1, parseHtml, parseHtml$1, parseJson$1, parseScript$1, parseSvelte, program, require_picocolors as require_picocolors$1, require_picocolors$1 as require_picocolors, resolveCommand, templates, up, walk_exports, ze } from "./package-manager-DmLyIAsB.js";
|
|
3
|
-
import { addFromString, applyAddons, array_exports, common_exports, createWorkspace, dedent_default, exports_exports, formatFiles, function_exports, getHighlighter, imports_exports, kit_exports, object_exports, setupAddons, variables_exports } from "./install-
|
|
2
|
+
import { AGENT_NAMES, Command, De, Element, Fe, Ge, J, Ke, Option, T, Tag, Ue, Vu, We, __commonJS, __export, __toESM as __toESM$1, __toESM$1 as __toESM, addPnpmBuildDependencies, create, detect, esm_exports, et, from, getUserAgent, installDependencies, installOption, ke, packageManagerPrompt, parseCss$1, parseHtml, parseHtml$1, parseJson$1, parseScript$1, parseSvelte, program, require_picocolors as require_picocolors$1, require_picocolors$1 as require_picocolors, resolveCommand, templates, up, walk_exports, ze } from "./package-manager-DmLyIAsB.js";
|
|
3
|
+
import { addFromString, applyAddons, array_exports, common_exports, createWorkspace, dedent_default, exports_exports, formatFiles, function_exports, getHighlighter, imports_exports, kit_exports, object_exports, setupAddons, variables_exports } from "./install-CDGqSUYA.js";
|
|
4
4
|
import fs, { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -15,7 +15,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
15
15
|
|
|
16
16
|
//#region packages/cli/package.json
|
|
17
17
|
var name = "sv";
|
|
18
|
-
var version = "0.8.
|
|
18
|
+
var version = "0.8.12";
|
|
19
19
|
var type = "module";
|
|
20
20
|
var description = "A CLI for creating and updating SvelteKit projects";
|
|
21
21
|
var license = "MIT";
|
|
@@ -263,14 +263,14 @@ function optional(wrapped, ...args) {
|
|
|
263
263
|
if (0 in args) schema.default = args[0];
|
|
264
264
|
return schema;
|
|
265
265
|
}
|
|
266
|
-
function picklist(options$
|
|
266
|
+
function picklist(options$7, message) {
|
|
267
267
|
return {
|
|
268
268
|
kind: "schema",
|
|
269
269
|
type: "picklist",
|
|
270
270
|
reference: picklist,
|
|
271
|
-
expects: _joinExpects(options$
|
|
271
|
+
expects: _joinExpects(options$7.map(_stringify), "|"),
|
|
272
272
|
async: false,
|
|
273
|
-
options: options$
|
|
273
|
+
options: options$7,
|
|
274
274
|
message,
|
|
275
275
|
_run(dataset, config2) {
|
|
276
276
|
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
@@ -434,14 +434,14 @@ function _subIssues(datasets) {
|
|
|
434
434
|
else issues = dataset.issues;
|
|
435
435
|
return issues;
|
|
436
436
|
}
|
|
437
|
-
function union(options$
|
|
437
|
+
function union(options$7, message) {
|
|
438
438
|
return {
|
|
439
439
|
kind: "schema",
|
|
440
440
|
type: "union",
|
|
441
441
|
reference: union,
|
|
442
|
-
expects: _joinExpects(options$
|
|
442
|
+
expects: _joinExpects(options$7.map((option) => option.expects), "|"),
|
|
443
443
|
async: false,
|
|
444
|
-
options: options$
|
|
444
|
+
options: options$7,
|
|
445
445
|
message,
|
|
446
446
|
_run(dataset, config2) {
|
|
447
447
|
let validDataset;
|
|
@@ -499,8 +499,8 @@ function pipe(...pipe2) {
|
|
|
499
499
|
|
|
500
500
|
//#endregion
|
|
501
501
|
//#region node_modules/.pnpm/empathic@1.0.0/node_modules/empathic/package.mjs
|
|
502
|
-
function up$1(options$
|
|
503
|
-
return up("package.json", options$
|
|
502
|
+
function up$1(options$7) {
|
|
503
|
+
return up("package.json", options$7);
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
//#endregion
|
|
@@ -508,8 +508,8 @@ function up$1(options$6) {
|
|
|
508
508
|
function defineAddon(config) {
|
|
509
509
|
return config;
|
|
510
510
|
}
|
|
511
|
-
function defineAddonOptions(options$
|
|
512
|
-
return options$
|
|
511
|
+
function defineAddonOptions(options$7) {
|
|
512
|
+
return options$7;
|
|
513
513
|
}
|
|
514
514
|
var require_src = __commonJS({ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports$1, module) {
|
|
515
515
|
const ESC = "\x1B";
|
|
@@ -565,8 +565,8 @@ else if (y > 0) ret += `${CSI}${y}B`;
|
|
|
565
565
|
beep
|
|
566
566
|
};
|
|
567
567
|
} });
|
|
568
|
-
var import_src$1 = __toESM(require_src(), 1);
|
|
569
|
-
var import_picocolors$3$1 = __toESM(require_picocolors$1(), 1);
|
|
568
|
+
var import_src$1 = __toESM$1(require_src(), 1);
|
|
569
|
+
var import_picocolors$3$1 = __toESM$1(require_picocolors$1(), 1);
|
|
570
570
|
function hu({ onlyFirst: e$1 = !1 } = {}) {
|
|
571
571
|
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
572
572
|
return new RegExp(t, e$1 ? void 0 : "g");
|
|
@@ -1301,9 +1301,9 @@ B$1 = new WeakMap(), k$1 = new WeakMap(), I = new WeakMap(), v$1 = new WeakMap()
|
|
|
1301
1301
|
e$1 ? this.filteredOptions = D$1.filter((t) => x$1(this, I).call(this, e$1, t)) : this.filteredOptions = [...D$1], m(this, B$1, FD(this.focusedValue, this.filteredOptions)), this.focusedValue = this.filteredOptions[x$1(this, B$1)]?.value, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
1302
1302
|
}
|
|
1303
1303
|
};
|
|
1304
|
-
var import_picocolors$1$1 = __toESM(require_picocolors$1(), 1);
|
|
1305
|
-
var import_picocolors$2$1 = __toESM(require_picocolors$1(), 1);
|
|
1306
|
-
var import_src = __toESM(require_src(), 1);
|
|
1304
|
+
var import_picocolors$1$1 = __toESM$1(require_picocolors$1(), 1);
|
|
1305
|
+
var import_picocolors$2$1 = __toESM$1(require_picocolors$1(), 1);
|
|
1306
|
+
var import_src = __toESM$1(require_src(), 1);
|
|
1307
1307
|
function Pe() {
|
|
1308
1308
|
return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1309
1309
|
}
|
|
@@ -1975,9 +1975,39 @@ function createPrinter(...conditions) {
|
|
|
1975
1975
|
});
|
|
1976
1976
|
return printers;
|
|
1977
1977
|
}
|
|
1978
|
-
var import_picocolors$4 = __toESM(require_picocolors$1(), 1);
|
|
1978
|
+
var import_picocolors$4 = __toESM$1(require_picocolors$1(), 1);
|
|
1979
1979
|
var colors = import_picocolors$4.default;
|
|
1980
1980
|
|
|
1981
|
+
//#endregion
|
|
1982
|
+
//#region packages/addons/devtools-json/index.ts
|
|
1983
|
+
var devtools_json_default = defineAddon({
|
|
1984
|
+
id: "devtools-json",
|
|
1985
|
+
shortDescription: "devtools json",
|
|
1986
|
+
homepage: "https://github.com/ChromeDevTools/vite-plugin-devtools-json",
|
|
1987
|
+
options: {},
|
|
1988
|
+
setup: ({ defaultSelection }) => {
|
|
1989
|
+
defaultSelection({
|
|
1990
|
+
create: true,
|
|
1991
|
+
add: false
|
|
1992
|
+
});
|
|
1993
|
+
},
|
|
1994
|
+
run: ({ sv, typescript }) => {
|
|
1995
|
+
const ext = typescript ? "ts" : "js";
|
|
1996
|
+
sv.devDependency("vite-plugin-devtools-json", "^0.2.0");
|
|
1997
|
+
sv.file(`vite.config.${ext}`, (content) => {
|
|
1998
|
+
const { ast, generateCode } = parseScript$1(content);
|
|
1999
|
+
const vitePluginName = "devtoolsJson";
|
|
2000
|
+
imports_exports.addDefault(ast, "vite-plugin-devtools-json", vitePluginName);
|
|
2001
|
+
const { value: rootObject } = exports_exports.defaultExport(ast, function_exports.call("defineConfig", []));
|
|
2002
|
+
const param1 = function_exports.argumentByIndex(rootObject, 0, object_exports.createEmpty());
|
|
2003
|
+
const pluginsArray = object_exports.property(param1, "plugins", array_exports.createEmpty());
|
|
2004
|
+
const pluginFunctionCall = function_exports.call(vitePluginName, []);
|
|
2005
|
+
array_exports.push(pluginsArray, pluginFunctionCall);
|
|
2006
|
+
return generateCode();
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
});
|
|
2010
|
+
|
|
1981
2011
|
//#endregion
|
|
1982
2012
|
//#region packages/addons/common.ts
|
|
1983
2013
|
function addEslintConfigPrettier(content) {
|
|
@@ -2031,7 +2061,7 @@ const PORTS = {
|
|
|
2031
2061
|
postgresql: "5432",
|
|
2032
2062
|
sqlite: ""
|
|
2033
2063
|
};
|
|
2034
|
-
const options$
|
|
2064
|
+
const options$6 = defineAddonOptions({
|
|
2035
2065
|
database: {
|
|
2036
2066
|
question: "Which database would you like to use?",
|
|
2037
2067
|
type: "select",
|
|
@@ -2116,7 +2146,7 @@ var drizzle_default = defineAddon({
|
|
|
2116
2146
|
id: "drizzle",
|
|
2117
2147
|
shortDescription: "database orm",
|
|
2118
2148
|
homepage: "https://orm.drizzle.team",
|
|
2119
|
-
options: options$
|
|
2149
|
+
options: options$6,
|
|
2120
2150
|
setup: ({ kit, unsupported, cwd, typescript }) => {
|
|
2121
2151
|
const ext = typescript ? "ts" : "js";
|
|
2122
2152
|
if (!kit) return unsupported("Requires SvelteKit");
|
|
@@ -2128,32 +2158,32 @@ var drizzle_default = defineAddon({
|
|
|
2128
2158
|
};
|
|
2129
2159
|
for (const [fileType, filePath] of Object.entries(paths)) if (fs.existsSync(filePath)) unsupported(`Preexisting ${fileType} file at '${filePath}'`);
|
|
2130
2160
|
},
|
|
2131
|
-
run: ({ sv, typescript, options: options$
|
|
2161
|
+
run: ({ sv, typescript, options: options$7, kit }) => {
|
|
2132
2162
|
const ext = typescript ? "ts" : "js";
|
|
2133
2163
|
sv.dependency("drizzle-orm", "^0.40.0");
|
|
2134
2164
|
sv.devDependency("drizzle-kit", "^0.30.2");
|
|
2135
2165
|
sv.devDependency("@types/node", getNodeTypesVersion());
|
|
2136
|
-
if (options$
|
|
2137
|
-
if (options$
|
|
2138
|
-
if (options$
|
|
2139
|
-
if (options$
|
|
2140
|
-
if (options$
|
|
2166
|
+
if (options$7.mysql === "mysql2") sv.dependency("mysql2", "^3.12.0");
|
|
2167
|
+
if (options$7.mysql === "planetscale") sv.dependency("@planetscale/database", "^1.19.0");
|
|
2168
|
+
if (options$7.postgresql === "neon") sv.dependency("@neondatabase/serverless", "^0.10.4");
|
|
2169
|
+
if (options$7.postgresql === "postgres.js") sv.dependency("postgres", "^3.4.5");
|
|
2170
|
+
if (options$7.sqlite === "better-sqlite3") {
|
|
2141
2171
|
sv.dependency("better-sqlite3", "^11.8.0");
|
|
2142
2172
|
sv.devDependency("@types/better-sqlite3", "^7.6.12");
|
|
2143
2173
|
sv.pnpmBuildDependendency("better-sqlite3");
|
|
2144
2174
|
}
|
|
2145
|
-
if (options$
|
|
2146
|
-
sv.file(".env", (content) => generateEnvFileContent(content, options$
|
|
2147
|
-
sv.file(".env.example", (content) => generateEnvFileContent(content, options$
|
|
2148
|
-
if (options$
|
|
2175
|
+
if (options$7.sqlite === "libsql" || options$7.sqlite === "turso") sv.dependency("@libsql/client", "^0.14.0");
|
|
2176
|
+
sv.file(".env", (content) => generateEnvFileContent(content, options$7));
|
|
2177
|
+
sv.file(".env.example", (content) => generateEnvFileContent(content, options$7));
|
|
2178
|
+
if (options$7.docker && (options$7.mysql === "mysql2" || options$7.postgresql === "postgres.js")) sv.file("docker-compose.yml", (content) => {
|
|
2149
2179
|
if (content.length > 0) return content;
|
|
2150
|
-
const imageName = options$
|
|
2151
|
-
const port = PORTS[options$
|
|
2180
|
+
const imageName = options$7.database === "mysql" ? "mysql" : "postgres";
|
|
2181
|
+
const port = PORTS[options$7.database];
|
|
2152
2182
|
const USER = "root";
|
|
2153
2183
|
const PASSWORD = "mysecretpassword";
|
|
2154
2184
|
const DB_NAME = "local";
|
|
2155
2185
|
let dbSpecificContent = "";
|
|
2156
|
-
if (options$
|
|
2186
|
+
if (options$7.mysql === "mysql2") dbSpecificContent = `
|
|
2157
2187
|
MYSQL_ROOT_PASSWORD: ${PASSWORD}
|
|
2158
2188
|
MYSQL_DATABASE: ${DB_NAME}
|
|
2159
2189
|
volumes:
|
|
@@ -2161,7 +2191,7 @@ var drizzle_default = defineAddon({
|
|
|
2161
2191
|
volumes:
|
|
2162
2192
|
mysqldata:
|
|
2163
2193
|
`;
|
|
2164
|
-
if (options$
|
|
2194
|
+
if (options$7.postgresql === "postgres.js") dbSpecificContent = `
|
|
2165
2195
|
POSTGRES_USER: ${USER}
|
|
2166
2196
|
POSTGRES_PASSWORD: ${PASSWORD}
|
|
2167
2197
|
POSTGRES_DB: ${DB_NAME}
|
|
@@ -2185,13 +2215,13 @@ var drizzle_default = defineAddon({
|
|
|
2185
2215
|
const { data, generateCode } = parseJson$1(content);
|
|
2186
2216
|
data.scripts ??= {};
|
|
2187
2217
|
const scripts$1 = data.scripts;
|
|
2188
|
-
if (options$
|
|
2218
|
+
if (options$7.docker) scripts$1["db:start"] ??= "docker compose up";
|
|
2189
2219
|
scripts$1["db:push"] ??= "drizzle-kit push";
|
|
2190
2220
|
scripts$1["db:migrate"] ??= "drizzle-kit migrate";
|
|
2191
2221
|
scripts$1["db:studio"] ??= "drizzle-kit studio";
|
|
2192
2222
|
return generateCode();
|
|
2193
2223
|
});
|
|
2194
|
-
if (options$
|
|
2224
|
+
if (options$7.database === "sqlite") sv.file(".gitignore", (content) => {
|
|
2195
2225
|
if (content.length === 0) return content;
|
|
2196
2226
|
if (!content.includes("\n*.db")) content = content.trimEnd() + "\n\n# SQLite\n*.db";
|
|
2197
2227
|
return content;
|
|
@@ -2203,9 +2233,9 @@ var drizzle_default = defineAddon({
|
|
|
2203
2233
|
exports_exports.defaultExport(ast, common_exports.expressionFromString(`
|
|
2204
2234
|
defineConfig({
|
|
2205
2235
|
schema: "./src/lib/server/db/schema.${typescript ? "ts" : "js"}",
|
|
2206
|
-
dialect: "${options$
|
|
2236
|
+
dialect: "${options$7.sqlite === "turso" ? "turso" : options$7.database}",
|
|
2207
2237
|
dbCredentials: {
|
|
2208
|
-
${options$
|
|
2238
|
+
${options$7.sqlite === "turso" ? "authToken: process.env.DATABASE_AUTH_TOKEN," : ""}
|
|
2209
2239
|
url: process.env.DATABASE_URL
|
|
2210
2240
|
},
|
|
2211
2241
|
verbose: true,
|
|
@@ -2216,7 +2246,7 @@ var drizzle_default = defineAddon({
|
|
|
2216
2246
|
sv.file(`${kit?.libDirectory}/server/db/schema.${ext}`, (content) => {
|
|
2217
2247
|
const { ast, generateCode } = parseScript$1(content);
|
|
2218
2248
|
let userSchemaExpression;
|
|
2219
|
-
if (options$
|
|
2249
|
+
if (options$7.database === "sqlite") {
|
|
2220
2250
|
imports_exports.addNamed(ast, "drizzle-orm/sqlite-core", {
|
|
2221
2251
|
sqliteTable: "sqliteTable",
|
|
2222
2252
|
integer: "integer"
|
|
@@ -2226,7 +2256,7 @@ var drizzle_default = defineAddon({
|
|
|
2226
2256
|
age: integer('age')
|
|
2227
2257
|
})`);
|
|
2228
2258
|
}
|
|
2229
|
-
if (options$
|
|
2259
|
+
if (options$7.database === "mysql") {
|
|
2230
2260
|
imports_exports.addNamed(ast, "drizzle-orm/mysql-core", {
|
|
2231
2261
|
mysqlTable: "mysqlTable",
|
|
2232
2262
|
serial: "serial",
|
|
@@ -2237,7 +2267,7 @@ var drizzle_default = defineAddon({
|
|
|
2237
2267
|
age: int('age'),
|
|
2238
2268
|
})`);
|
|
2239
2269
|
}
|
|
2240
|
-
if (options$
|
|
2270
|
+
if (options$7.database === "postgresql") {
|
|
2241
2271
|
imports_exports.addNamed(ast, "drizzle-orm/pg-core", {
|
|
2242
2272
|
pgTable: "pgTable",
|
|
2243
2273
|
serial: "serial",
|
|
@@ -2260,32 +2290,32 @@ var drizzle_default = defineAddon({
|
|
|
2260
2290
|
const dbURLCheck = common_exports.statementFromString("if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');");
|
|
2261
2291
|
common_exports.addStatement(ast, dbURLCheck);
|
|
2262
2292
|
let clientExpression;
|
|
2263
|
-
if (options$
|
|
2293
|
+
if (options$7.sqlite === "better-sqlite3") {
|
|
2264
2294
|
imports_exports.addDefault(ast, "better-sqlite3", "Database");
|
|
2265
2295
|
imports_exports.addNamed(ast, "drizzle-orm/better-sqlite3", { drizzle: "drizzle" });
|
|
2266
2296
|
clientExpression = common_exports.expressionFromString("new Database(env.DATABASE_URL)");
|
|
2267
2297
|
}
|
|
2268
|
-
if (options$
|
|
2298
|
+
if (options$7.sqlite === "libsql" || options$7.sqlite === "turso") {
|
|
2269
2299
|
imports_exports.addNamed(ast, "@libsql/client", { createClient: "createClient" });
|
|
2270
2300
|
imports_exports.addNamed(ast, "drizzle-orm/libsql", { drizzle: "drizzle" });
|
|
2271
|
-
if (options$
|
|
2301
|
+
if (options$7.sqlite === "turso") {
|
|
2272
2302
|
imports_exports.addNamed(ast, "$app/environment", { dev: "dev" });
|
|
2273
2303
|
const authTokenCheck = common_exports.statementFromString("if (!dev && !env.DATABASE_AUTH_TOKEN) throw new Error('DATABASE_AUTH_TOKEN is not set');");
|
|
2274
2304
|
common_exports.addStatement(ast, authTokenCheck);
|
|
2275
2305
|
clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL, authToken: env.DATABASE_AUTH_TOKEN })");
|
|
2276
2306
|
} else clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL })");
|
|
2277
2307
|
}
|
|
2278
|
-
if (options$
|
|
2308
|
+
if (options$7.mysql === "mysql2" || options$7.mysql === "planetscale") {
|
|
2279
2309
|
imports_exports.addDefault(ast, "mysql2/promise", "mysql");
|
|
2280
2310
|
imports_exports.addNamed(ast, "drizzle-orm/mysql2", { drizzle: "drizzle" });
|
|
2281
2311
|
clientExpression = common_exports.expressionFromString("mysql.createPool(env.DATABASE_URL)");
|
|
2282
2312
|
}
|
|
2283
|
-
if (options$
|
|
2313
|
+
if (options$7.postgresql === "neon") {
|
|
2284
2314
|
imports_exports.addNamed(ast, "@neondatabase/serverless", { neon: "neon" });
|
|
2285
2315
|
imports_exports.addNamed(ast, "drizzle-orm/neon-http", { drizzle: "drizzle" });
|
|
2286
2316
|
clientExpression = common_exports.expressionFromString("neon(env.DATABASE_URL)");
|
|
2287
2317
|
}
|
|
2288
|
-
if (options$
|
|
2318
|
+
if (options$7.postgresql === "postgres.js") {
|
|
2289
2319
|
imports_exports.addDefault(ast, "postgres", "postgres");
|
|
2290
2320
|
imports_exports.addNamed(ast, "drizzle-orm/postgres-js", { drizzle: "drizzle" });
|
|
2291
2321
|
clientExpression = common_exports.expressionFromString("postgres(env.DATABASE_URL)");
|
|
@@ -2295,8 +2325,8 @@ var drizzle_default = defineAddon({
|
|
|
2295
2325
|
common_exports.addStatement(ast, clientIdentifier);
|
|
2296
2326
|
const drizzleCall = function_exports.callByIdentifier("drizzle", ["client"]);
|
|
2297
2327
|
const paramObject = object_exports.create({ schema: variables_exports.identifier("schema") });
|
|
2298
|
-
if (options$
|
|
2299
|
-
const mode = options$
|
|
2328
|
+
if (options$7.database === "mysql") {
|
|
2329
|
+
const mode = options$7.mysql === "planetscale" ? "planetscale" : "default";
|
|
2300
2330
|
object_exports.property(paramObject, "mode", common_exports.createLiteral(mode));
|
|
2301
2331
|
}
|
|
2302
2332
|
drizzleCall.arguments.push(paramObject);
|
|
@@ -2305,9 +2335,9 @@ var drizzle_default = defineAddon({
|
|
|
2305
2335
|
return generateCode();
|
|
2306
2336
|
});
|
|
2307
2337
|
},
|
|
2308
|
-
nextSteps: ({ options: options$
|
|
2338
|
+
nextSteps: ({ options: options$7, highlighter, packageManager }) => {
|
|
2309
2339
|
const steps = [`You will need to set ${highlighter.env("DATABASE_URL")} in your production environment`];
|
|
2310
|
-
if (options$
|
|
2340
|
+
if (options$7.docker) steps.push(`Run ${highlighter.command(`${packageManager} run db:start`)} to start the docker container`);
|
|
2311
2341
|
else steps.push(`Check ${highlighter.env("DATABASE_URL")} in ${highlighter.path(".env")} and adjust it to your needs`);
|
|
2312
2342
|
steps.push(`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`);
|
|
2313
2343
|
return steps;
|
|
@@ -2456,98 +2486,14 @@ var eslint_default = defineAddon({
|
|
|
2456
2486
|
imports_exports.addNamed(ast, "node:url", { fileURLToPath: "fileURLToPath" });
|
|
2457
2487
|
imports_exports.addDefault(ast, "globals", "globals");
|
|
2458
2488
|
imports_exports.addDefault(ast, "eslint-plugin-svelte", "svelte");
|
|
2459
|
-
imports_exports.addNamed(ast, "@eslint/compat", { includeIgnoreFile: "includeIgnoreFile" });
|
|
2460
2489
|
imports_exports.addDefault(ast, "@eslint/js", "js");
|
|
2490
|
+
imports_exports.addNamed(ast, "@eslint/compat", { includeIgnoreFile: "includeIgnoreFile" });
|
|
2461
2491
|
return generateCode();
|
|
2462
2492
|
});
|
|
2463
2493
|
if (prettierInstalled) sv.file("eslint.config.js", addEslintConfigPrettier);
|
|
2464
2494
|
}
|
|
2465
2495
|
});
|
|
2466
2496
|
|
|
2467
|
-
//#endregion
|
|
2468
|
-
//#region packages/addons/sveltekit-adapter/index.ts
|
|
2469
|
-
const adapters = [
|
|
2470
|
-
{
|
|
2471
|
-
id: "auto",
|
|
2472
|
-
package: "@sveltejs/adapter-auto",
|
|
2473
|
-
version: "^6.0.0"
|
|
2474
|
-
},
|
|
2475
|
-
{
|
|
2476
|
-
id: "node",
|
|
2477
|
-
package: "@sveltejs/adapter-node",
|
|
2478
|
-
version: "^5.2.12"
|
|
2479
|
-
},
|
|
2480
|
-
{
|
|
2481
|
-
id: "static",
|
|
2482
|
-
package: "@sveltejs/adapter-static",
|
|
2483
|
-
version: "^3.0.8"
|
|
2484
|
-
},
|
|
2485
|
-
{
|
|
2486
|
-
id: "vercel",
|
|
2487
|
-
package: "@sveltejs/adapter-vercel",
|
|
2488
|
-
version: "^5.6.3"
|
|
2489
|
-
},
|
|
2490
|
-
{
|
|
2491
|
-
id: "cloudflare",
|
|
2492
|
-
package: "@sveltejs/adapter-cloudflare",
|
|
2493
|
-
version: "^7.0.0"
|
|
2494
|
-
},
|
|
2495
|
-
{
|
|
2496
|
-
id: "netlify",
|
|
2497
|
-
package: "@sveltejs/adapter-netlify",
|
|
2498
|
-
version: "^5.0.0"
|
|
2499
|
-
}
|
|
2500
|
-
];
|
|
2501
|
-
const options$4 = defineAddonOptions({ adapter: {
|
|
2502
|
-
type: "select",
|
|
2503
|
-
question: "Which SvelteKit adapter would you like to use?",
|
|
2504
|
-
options: adapters.map((p$1) => ({
|
|
2505
|
-
value: p$1.id,
|
|
2506
|
-
label: p$1.id,
|
|
2507
|
-
hint: p$1.package
|
|
2508
|
-
})),
|
|
2509
|
-
default: "auto"
|
|
2510
|
-
} });
|
|
2511
|
-
var sveltekit_adapter_default = defineAddon({
|
|
2512
|
-
id: "sveltekit-adapter",
|
|
2513
|
-
alias: "adapter",
|
|
2514
|
-
shortDescription: "deployment",
|
|
2515
|
-
homepage: "https://svelte.dev/docs/kit/adapters",
|
|
2516
|
-
options: options$4,
|
|
2517
|
-
setup: ({ kit, unsupported }) => {
|
|
2518
|
-
if (!kit) unsupported("Requires SvelteKit");
|
|
2519
|
-
},
|
|
2520
|
-
run: ({ sv, options: options$6 }) => {
|
|
2521
|
-
const adapter = adapters.find((a) => a.id === options$6.adapter);
|
|
2522
|
-
sv.file("package.json", (content) => {
|
|
2523
|
-
const { data, generateCode } = parseJson$1(content);
|
|
2524
|
-
const devDeps = data["devDependencies"];
|
|
2525
|
-
for (const pkg of Object.keys(devDeps)) if (pkg.startsWith("@sveltejs/adapter-")) delete devDeps[pkg];
|
|
2526
|
-
return generateCode();
|
|
2527
|
-
});
|
|
2528
|
-
sv.devDependency(adapter.package, adapter.version);
|
|
2529
|
-
sv.file("svelte.config.js", (content) => {
|
|
2530
|
-
const { ast, generateCode } = parseScript$1(content);
|
|
2531
|
-
const importDecls = ast.body.filter((n$1) => n$1.type === "ImportDeclaration");
|
|
2532
|
-
const adapterImportDecl = importDecls.find((importDecl) => typeof importDecl.source.value === "string" && importDecl.source.value.startsWith("@sveltejs/adapter-") && importDecl.importKind === "value");
|
|
2533
|
-
let adapterName = "adapter";
|
|
2534
|
-
if (adapterImportDecl) {
|
|
2535
|
-
adapterImportDecl.source.value = adapter.package;
|
|
2536
|
-
adapterImportDecl.source.raw = undefined;
|
|
2537
|
-
adapterName = adapterImportDecl.specifiers?.find((s) => s.type === "ImportDefaultSpecifier")?.local?.name;
|
|
2538
|
-
} else imports_exports.addDefault(ast, adapter.package, adapterName);
|
|
2539
|
-
const { value: config } = exports_exports.defaultExport(ast, object_exports.createEmpty());
|
|
2540
|
-
const kitConfig = config.properties.find((p$1) => p$1.type === "Property" && p$1.key.type === "Identifier" && p$1.key.name === "kit");
|
|
2541
|
-
if (kitConfig && kitConfig.value.type === "ObjectExpression") {
|
|
2542
|
-
const adapterProp = kitConfig.value.properties.find((p$1) => p$1.type === "Property" && p$1.key.type === "Identifier" && p$1.key.name === "adapter");
|
|
2543
|
-
if (adapterProp) adapterProp.leadingComments = [];
|
|
2544
|
-
object_exports.overrideProperties(kitConfig.value, { adapter: function_exports.callByIdentifier(adapterName, []) });
|
|
2545
|
-
} else object_exports.properties(config, { kit: object_exports.create({ adapter: function_exports.callByIdentifier(adapterName, []) }) });
|
|
2546
|
-
return generateCode();
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
});
|
|
2550
|
-
|
|
2551
2497
|
//#endregion
|
|
2552
2498
|
//#region node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
2553
2499
|
const comma = ",".charCodeAt(0);
|
|
@@ -2950,7 +2896,7 @@ const warned = {
|
|
|
2950
2896
|
storeName: false
|
|
2951
2897
|
};
|
|
2952
2898
|
var MagicString = class MagicString {
|
|
2953
|
-
constructor(string$1, options$
|
|
2899
|
+
constructor(string$1, options$7 = {}) {
|
|
2954
2900
|
const chunk = new Chunk(0, string$1.length, string$1);
|
|
2955
2901
|
Object.defineProperties(this, {
|
|
2956
2902
|
original: {
|
|
@@ -2987,11 +2933,11 @@ var MagicString = class MagicString {
|
|
|
2987
2933
|
},
|
|
2988
2934
|
filename: {
|
|
2989
2935
|
writable: true,
|
|
2990
|
-
value: options$
|
|
2936
|
+
value: options$7.filename
|
|
2991
2937
|
},
|
|
2992
2938
|
indentExclusionRanges: {
|
|
2993
2939
|
writable: true,
|
|
2994
|
-
value: options$
|
|
2940
|
+
value: options$7.indentExclusionRanges
|
|
2995
2941
|
},
|
|
2996
2942
|
sourcemapLocations: {
|
|
2997
2943
|
writable: true,
|
|
@@ -3007,11 +2953,11 @@ var MagicString = class MagicString {
|
|
|
3007
2953
|
},
|
|
3008
2954
|
ignoreList: {
|
|
3009
2955
|
writable: true,
|
|
3010
|
-
value: options$
|
|
2956
|
+
value: options$7.ignoreList
|
|
3011
2957
|
},
|
|
3012
2958
|
offset: {
|
|
3013
2959
|
writable: true,
|
|
3014
|
-
value: options$
|
|
2960
|
+
value: options$7.offset || 0
|
|
3015
2961
|
}
|
|
3016
2962
|
});
|
|
3017
2963
|
this.byStart[0] = chunk;
|
|
@@ -3069,11 +3015,11 @@ else this.outro += content;
|
|
|
3069
3015
|
cloned.outro = this.outro;
|
|
3070
3016
|
return cloned;
|
|
3071
3017
|
}
|
|
3072
|
-
generateDecodedMap(options$
|
|
3073
|
-
options$
|
|
3018
|
+
generateDecodedMap(options$7) {
|
|
3019
|
+
options$7 = options$7 || {};
|
|
3074
3020
|
const sourceIndex = 0;
|
|
3075
3021
|
const names = Object.keys(this.storedNames);
|
|
3076
|
-
const mappings = new Mappings(options$
|
|
3022
|
+
const mappings = new Mappings(options$7.hires);
|
|
3077
3023
|
const locate = getLocator(this.original);
|
|
3078
3024
|
if (this.intro) mappings.advance(this.intro);
|
|
3079
3025
|
this.firstChunk.eachNext((chunk) => {
|
|
@@ -3084,16 +3030,16 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
|
|
|
3084
3030
|
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
3085
3031
|
});
|
|
3086
3032
|
return {
|
|
3087
|
-
file: options$
|
|
3088
|
-
sources: [options$
|
|
3089
|
-
sourcesContent: options$
|
|
3033
|
+
file: options$7.file ? options$7.file.split(/[/\\]/).pop() : undefined,
|
|
3034
|
+
sources: [options$7.source ? getRelativePath(options$7.file || "", options$7.source) : options$7.file || ""],
|
|
3035
|
+
sourcesContent: options$7.includeContent ? [this.original] : undefined,
|
|
3090
3036
|
names,
|
|
3091
3037
|
mappings: mappings.raw,
|
|
3092
3038
|
x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
|
|
3093
3039
|
};
|
|
3094
3040
|
}
|
|
3095
|
-
generateMap(options$
|
|
3096
|
-
return new SourceMap(this.generateDecodedMap(options$
|
|
3041
|
+
generateMap(options$7) {
|
|
3042
|
+
return new SourceMap(this.generateDecodedMap(options$7));
|
|
3097
3043
|
}
|
|
3098
3044
|
_ensureindentStr() {
|
|
3099
3045
|
if (this.indentStr === undefined) this.indentStr = guessIndent(this.original);
|
|
@@ -3106,10 +3052,10 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
|
|
|
3106
3052
|
this._ensureindentStr();
|
|
3107
3053
|
return this.indentStr === null ? " " : this.indentStr;
|
|
3108
3054
|
}
|
|
3109
|
-
indent(indentStr, options$
|
|
3055
|
+
indent(indentStr, options$7) {
|
|
3110
3056
|
const pattern = /^[^\r\n]/gm;
|
|
3111
3057
|
if (isObject(indentStr)) {
|
|
3112
|
-
options$
|
|
3058
|
+
options$7 = indentStr;
|
|
3113
3059
|
indentStr = undefined;
|
|
3114
3060
|
}
|
|
3115
3061
|
if (indentStr === undefined) {
|
|
@@ -3117,15 +3063,15 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
|
|
|
3117
3063
|
indentStr = this.indentStr || " ";
|
|
3118
3064
|
}
|
|
3119
3065
|
if (indentStr === "") return this;
|
|
3120
|
-
options$
|
|
3066
|
+
options$7 = options$7 || {};
|
|
3121
3067
|
const isExcluded = {};
|
|
3122
|
-
if (options$
|
|
3123
|
-
const exclusions = typeof options$
|
|
3068
|
+
if (options$7.exclude) {
|
|
3069
|
+
const exclusions = typeof options$7.exclude[0] === "number" ? [options$7.exclude] : options$7.exclude;
|
|
3124
3070
|
exclusions.forEach((exclusion) => {
|
|
3125
3071
|
for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
|
|
3126
3072
|
});
|
|
3127
3073
|
}
|
|
3128
|
-
let shouldIndentNextCharacter = options$
|
|
3074
|
+
let shouldIndentNextCharacter = options$7.indentStart !== false;
|
|
3129
3075
|
const replacer = (match) => {
|
|
3130
3076
|
if (shouldIndentNextCharacter) return `${indentStr}${match}`;
|
|
3131
3077
|
shouldIndentNextCharacter = true;
|
|
@@ -3213,14 +3159,14 @@ else {
|
|
|
3213
3159
|
if (!newRight) this.lastChunk = last;
|
|
3214
3160
|
return this;
|
|
3215
3161
|
}
|
|
3216
|
-
overwrite(start, end, content, options$
|
|
3217
|
-
options$
|
|
3162
|
+
overwrite(start, end, content, options$7) {
|
|
3163
|
+
options$7 = options$7 || {};
|
|
3218
3164
|
return this.update(start, end, content, {
|
|
3219
|
-
...options$
|
|
3220
|
-
overwrite: !options$
|
|
3165
|
+
...options$7,
|
|
3166
|
+
overwrite: !options$7.contentOnly
|
|
3221
3167
|
});
|
|
3222
3168
|
}
|
|
3223
|
-
update(start, end, content, options$
|
|
3169
|
+
update(start, end, content, options$7) {
|
|
3224
3170
|
start = start + this.offset;
|
|
3225
3171
|
end = end + this.offset;
|
|
3226
3172
|
if (typeof content !== "string") throw new TypeError("replacement content must be a string");
|
|
@@ -3232,15 +3178,15 @@ else {
|
|
|
3232
3178
|
if (start === end) throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
|
|
3233
3179
|
this._split(start);
|
|
3234
3180
|
this._split(end);
|
|
3235
|
-
if (options$
|
|
3181
|
+
if (options$7 === true) {
|
|
3236
3182
|
if (!warned.storeName) {
|
|
3237
3183
|
console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
|
|
3238
3184
|
warned.storeName = true;
|
|
3239
3185
|
}
|
|
3240
|
-
options$
|
|
3186
|
+
options$7 = { storeName: true };
|
|
3241
3187
|
}
|
|
3242
|
-
const storeName = options$
|
|
3243
|
-
const overwrite = options$
|
|
3188
|
+
const storeName = options$7 !== undefined ? options$7.storeName : false;
|
|
3189
|
+
const overwrite = options$7 !== undefined ? options$7.overwrite : false;
|
|
3244
3190
|
if (storeName) {
|
|
3245
3191
|
const original = this.original.slice(start, end);
|
|
3246
3192
|
Object.defineProperty(this.storedNames, original, {
|
|
@@ -3571,7 +3517,7 @@ const TABLE_TYPE = {
|
|
|
3571
3517
|
};
|
|
3572
3518
|
let drizzleDialect;
|
|
3573
3519
|
let schemaPath;
|
|
3574
|
-
const options$
|
|
3520
|
+
const options$5 = defineAddonOptions({ demo: {
|
|
3575
3521
|
type: "boolean",
|
|
3576
3522
|
default: true,
|
|
3577
3523
|
question: `Do you want to include a demo? ${colors.dim("(includes a login/register page)")}`
|
|
@@ -3580,17 +3526,17 @@ var lucia_default = defineAddon({
|
|
|
3580
3526
|
id: "lucia",
|
|
3581
3527
|
shortDescription: "auth guide",
|
|
3582
3528
|
homepage: "https://lucia-auth.com",
|
|
3583
|
-
options: options$
|
|
3529
|
+
options: options$5,
|
|
3584
3530
|
setup: ({ kit, dependencyVersion, unsupported, dependsOn, runsAfter }) => {
|
|
3585
3531
|
if (!kit) unsupported("Requires SvelteKit");
|
|
3586
3532
|
if (!dependencyVersion("drizzle-orm")) dependsOn("drizzle");
|
|
3587
3533
|
runsAfter("tailwindcss");
|
|
3588
3534
|
},
|
|
3589
|
-
run: ({ sv, typescript, options: options$
|
|
3535
|
+
run: ({ sv, typescript, options: options$7, kit, dependencyVersion }) => {
|
|
3590
3536
|
const ext = typescript ? "ts" : "js";
|
|
3591
3537
|
sv.dependency("@oslojs/crypto", "^1.0.1");
|
|
3592
3538
|
sv.dependency("@oslojs/encoding", "^1.1.0");
|
|
3593
|
-
if (options$
|
|
3539
|
+
if (options$7.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
|
|
3594
3540
|
sv.file(`drizzle.config.${ext}`, (content) => {
|
|
3595
3541
|
const { ast, generateCode } = parseScript$1(content);
|
|
3596
3542
|
const isProp = (name$1, node) => node.key.type === "Identifier" && node.key.name === name$1;
|
|
@@ -3624,7 +3570,7 @@ var lucia_default = defineAddon({
|
|
|
3624
3570
|
integer: "integer"
|
|
3625
3571
|
});
|
|
3626
3572
|
object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
|
|
3627
|
-
if (options$
|
|
3573
|
+
if (options$7.demo) object_exports.overrideProperties(userAttributes, {
|
|
3628
3574
|
username: common_exports.expressionFromString("text('username').notNull().unique()"),
|
|
3629
3575
|
passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
|
|
3630
3576
|
});
|
|
@@ -3641,7 +3587,7 @@ var lucia_default = defineAddon({
|
|
|
3641
3587
|
datetime: "datetime"
|
|
3642
3588
|
});
|
|
3643
3589
|
object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("varchar('id', { length: 255 }).primaryKey()") });
|
|
3644
|
-
if (options$
|
|
3590
|
+
if (options$7.demo) object_exports.overrideProperties(userAttributes, {
|
|
3645
3591
|
username: common_exports.expressionFromString("varchar('username', { length: 32 }).notNull().unique()"),
|
|
3646
3592
|
passwordHash: common_exports.expressionFromString("varchar('password_hash', { length: 255 }).notNull()")
|
|
3647
3593
|
});
|
|
@@ -3658,7 +3604,7 @@ var lucia_default = defineAddon({
|
|
|
3658
3604
|
timestamp: "timestamp"
|
|
3659
3605
|
});
|
|
3660
3606
|
object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
|
|
3661
|
-
if (options$
|
|
3607
|
+
if (options$7.demo) object_exports.overrideProperties(userAttributes, {
|
|
3662
3608
|
username: common_exports.expressionFromString("text('username').notNull().unique()"),
|
|
3663
3609
|
passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
|
|
3664
3610
|
});
|
|
@@ -3811,7 +3757,7 @@ var lucia_default = defineAddon({
|
|
|
3811
3757
|
kit_exports.addHooksHandle(ast, typescript, "handleAuth", getAuthHandleContent());
|
|
3812
3758
|
return generateCode();
|
|
3813
3759
|
});
|
|
3814
|
-
if (options$
|
|
3760
|
+
if (options$7.demo) {
|
|
3815
3761
|
sv.file(`${kit?.routesDirectory}/demo/+page.svelte`, (content) => {
|
|
3816
3762
|
return addToDemoPage(content, "lucia");
|
|
3817
3763
|
});
|
|
@@ -4045,9 +3991,9 @@ var lucia_default = defineAddon({
|
|
|
4045
3991
|
});
|
|
4046
3992
|
}
|
|
4047
3993
|
},
|
|
4048
|
-
nextSteps: ({ highlighter, options: options$
|
|
3994
|
+
nextSteps: ({ highlighter, options: options$7, packageManager }) => {
|
|
4049
3995
|
const steps = [`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`];
|
|
4050
|
-
if (options$
|
|
3996
|
+
if (options$7.demo) steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
|
|
4051
3997
|
return steps;
|
|
4052
3998
|
}
|
|
4053
3999
|
});
|
|
@@ -4179,7 +4125,7 @@ const DEFAULT_INLANG_PROJECT = {
|
|
|
4179
4125
|
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"],
|
|
4180
4126
|
"plugin.inlang.messageFormat": { pathPattern: "./messages/{locale}.json" }
|
|
4181
4127
|
};
|
|
4182
|
-
const options$
|
|
4128
|
+
const options$4 = defineAddonOptions({
|
|
4183
4129
|
languageTags: {
|
|
4184
4130
|
question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
|
|
4185
4131
|
type: "string",
|
|
@@ -4209,11 +4155,11 @@ var paraglide_default = defineAddon({
|
|
|
4209
4155
|
id: "paraglide",
|
|
4210
4156
|
shortDescription: "i18n",
|
|
4211
4157
|
homepage: "https://inlang.com/m/gerre34r/library-inlang-paraglideJs",
|
|
4212
|
-
options: options$
|
|
4158
|
+
options: options$4,
|
|
4213
4159
|
setup: ({ kit, unsupported }) => {
|
|
4214
4160
|
if (!kit) unsupported("Requires SvelteKit");
|
|
4215
4161
|
},
|
|
4216
|
-
run: ({ sv, options: options$
|
|
4162
|
+
run: ({ sv, options: options$7, typescript, kit }) => {
|
|
4217
4163
|
const ext = typescript ? "ts" : "js";
|
|
4218
4164
|
if (!kit) throw new Error("SvelteKit is required");
|
|
4219
4165
|
const paraglideOutDir = "src/lib/paraglide";
|
|
@@ -4222,7 +4168,7 @@ var paraglide_default = defineAddon({
|
|
|
4222
4168
|
if (content) return content;
|
|
4223
4169
|
const { data, generateCode } = parseJson$1(content);
|
|
4224
4170
|
for (const key in DEFAULT_INLANG_PROJECT) data[key] = DEFAULT_INLANG_PROJECT[key];
|
|
4225
|
-
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$
|
|
4171
|
+
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$7.languageTags);
|
|
4226
4172
|
const baseLocale = validLanguageTags$1[0];
|
|
4227
4173
|
data.baseLocale = baseLocale;
|
|
4228
4174
|
data.locales = validLanguageTags$1;
|
|
@@ -4283,7 +4229,7 @@ var paraglide_default = defineAddon({
|
|
|
4283
4229
|
if (!content.includes(`\n${paraglideOutDir}`)) content = content.trimEnd() + `\n\n# Paraglide\n${paraglideOutDir}`;
|
|
4284
4230
|
return content;
|
|
4285
4231
|
});
|
|
4286
|
-
if (options$
|
|
4232
|
+
if (options$7.demo) {
|
|
4287
4233
|
sv.file(`${kit.routesDirectory}/demo/+page.svelte`, (content) => {
|
|
4288
4234
|
return addToDemoPage(content, "paraglide");
|
|
4289
4235
|
});
|
|
@@ -4296,7 +4242,7 @@ var paraglide_default = defineAddon({
|
|
|
4296
4242
|
const scriptCode = new MagicString(script.generateCode());
|
|
4297
4243
|
const templateCode = new MagicString(template.source);
|
|
4298
4244
|
templateCode.append("\n\n<h1>{m.hello_world({ name: 'SvelteKit User' })}</h1>\n");
|
|
4299
|
-
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$
|
|
4245
|
+
const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$7.languageTags);
|
|
4300
4246
|
const links = validLanguageTags$1.map((x$2) => `${templateCode.getIndentString()}<button onclick={() => setLocale('${x$2}')}>${x$2}</button>`).join("\n");
|
|
4301
4247
|
templateCode.append(`<div>\n${links}\n</div>`);
|
|
4302
4248
|
templateCode.append("<p>\nIf you use VSCode, install the <a href=\"https://marketplace.visualstudio.com/items?itemName=inlang.vs-code-extension\" target=\"_blank\">Sherlock i18n extension</a> for a better i18n experience.\n</p>");
|
|
@@ -4306,7 +4252,7 @@ var paraglide_default = defineAddon({
|
|
|
4306
4252
|
});
|
|
4307
4253
|
});
|
|
4308
4254
|
}
|
|
4309
|
-
const { validLanguageTags } = parseLanguageTagInput(options$
|
|
4255
|
+
const { validLanguageTags } = parseLanguageTagInput(options$7.languageTags);
|
|
4310
4256
|
for (const languageTag of validLanguageTags) sv.file(`messages/${languageTag}.json`, (content) => {
|
|
4311
4257
|
const { data, generateCode } = parseJson$1(content);
|
|
4312
4258
|
data["$schema"] = "https://inlang.com/schema/inlang-message-format";
|
|
@@ -4316,7 +4262,7 @@ var paraglide_default = defineAddon({
|
|
|
4316
4262
|
},
|
|
4317
4263
|
nextSteps: ({ highlighter }) => {
|
|
4318
4264
|
const steps = [`Edit your messages in ${highlighter.path("messages/en.json")}`];
|
|
4319
|
-
if (options$
|
|
4265
|
+
if (options$4.demo) steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
|
|
4320
4266
|
return steps;
|
|
4321
4267
|
}
|
|
4322
4268
|
});
|
|
@@ -4488,6 +4434,90 @@ var storybook_default = defineAddon({
|
|
|
4488
4434
|
}
|
|
4489
4435
|
});
|
|
4490
4436
|
|
|
4437
|
+
//#endregion
|
|
4438
|
+
//#region packages/addons/sveltekit-adapter/index.ts
|
|
4439
|
+
const adapters = [
|
|
4440
|
+
{
|
|
4441
|
+
id: "auto",
|
|
4442
|
+
package: "@sveltejs/adapter-auto",
|
|
4443
|
+
version: "^6.0.0"
|
|
4444
|
+
},
|
|
4445
|
+
{
|
|
4446
|
+
id: "node",
|
|
4447
|
+
package: "@sveltejs/adapter-node",
|
|
4448
|
+
version: "^5.2.12"
|
|
4449
|
+
},
|
|
4450
|
+
{
|
|
4451
|
+
id: "static",
|
|
4452
|
+
package: "@sveltejs/adapter-static",
|
|
4453
|
+
version: "^3.0.8"
|
|
4454
|
+
},
|
|
4455
|
+
{
|
|
4456
|
+
id: "vercel",
|
|
4457
|
+
package: "@sveltejs/adapter-vercel",
|
|
4458
|
+
version: "^5.6.3"
|
|
4459
|
+
},
|
|
4460
|
+
{
|
|
4461
|
+
id: "cloudflare",
|
|
4462
|
+
package: "@sveltejs/adapter-cloudflare",
|
|
4463
|
+
version: "^7.0.0"
|
|
4464
|
+
},
|
|
4465
|
+
{
|
|
4466
|
+
id: "netlify",
|
|
4467
|
+
package: "@sveltejs/adapter-netlify",
|
|
4468
|
+
version: "^5.0.0"
|
|
4469
|
+
}
|
|
4470
|
+
];
|
|
4471
|
+
const options$3 = defineAddonOptions({ adapter: {
|
|
4472
|
+
type: "select",
|
|
4473
|
+
question: "Which SvelteKit adapter would you like to use?",
|
|
4474
|
+
options: adapters.map((p$1) => ({
|
|
4475
|
+
value: p$1.id,
|
|
4476
|
+
label: p$1.id,
|
|
4477
|
+
hint: p$1.package
|
|
4478
|
+
})),
|
|
4479
|
+
default: "auto"
|
|
4480
|
+
} });
|
|
4481
|
+
var sveltekit_adapter_default = defineAddon({
|
|
4482
|
+
id: "sveltekit-adapter",
|
|
4483
|
+
alias: "adapter",
|
|
4484
|
+
shortDescription: "deployment",
|
|
4485
|
+
homepage: "https://svelte.dev/docs/kit/adapters",
|
|
4486
|
+
options: options$3,
|
|
4487
|
+
setup: ({ kit, unsupported }) => {
|
|
4488
|
+
if (!kit) unsupported("Requires SvelteKit");
|
|
4489
|
+
},
|
|
4490
|
+
run: ({ sv, options: options$7 }) => {
|
|
4491
|
+
const adapter = adapters.find((a) => a.id === options$7.adapter);
|
|
4492
|
+
sv.file("package.json", (content) => {
|
|
4493
|
+
const { data, generateCode } = parseJson$1(content);
|
|
4494
|
+
const devDeps = data["devDependencies"];
|
|
4495
|
+
for (const pkg of Object.keys(devDeps)) if (pkg.startsWith("@sveltejs/adapter-")) delete devDeps[pkg];
|
|
4496
|
+
return generateCode();
|
|
4497
|
+
});
|
|
4498
|
+
sv.devDependency(adapter.package, adapter.version);
|
|
4499
|
+
sv.file("svelte.config.js", (content) => {
|
|
4500
|
+
const { ast, generateCode } = parseScript$1(content);
|
|
4501
|
+
const importDecls = ast.body.filter((n$1) => n$1.type === "ImportDeclaration");
|
|
4502
|
+
const adapterImportDecl = importDecls.find((importDecl) => typeof importDecl.source.value === "string" && importDecl.source.value.startsWith("@sveltejs/adapter-") && importDecl.importKind === "value");
|
|
4503
|
+
let adapterName = "adapter";
|
|
4504
|
+
if (adapterImportDecl) {
|
|
4505
|
+
adapterImportDecl.source.value = adapter.package;
|
|
4506
|
+
adapterImportDecl.source.raw = undefined;
|
|
4507
|
+
adapterName = adapterImportDecl.specifiers?.find((s) => s.type === "ImportDefaultSpecifier")?.local?.name;
|
|
4508
|
+
} else imports_exports.addDefault(ast, adapter.package, adapterName);
|
|
4509
|
+
const { value: config } = exports_exports.defaultExport(ast, object_exports.createEmpty());
|
|
4510
|
+
const kitConfig = config.properties.find((p$1) => p$1.type === "Property" && p$1.key.type === "Identifier" && p$1.key.name === "kit");
|
|
4511
|
+
if (kitConfig && kitConfig.value.type === "ObjectExpression") {
|
|
4512
|
+
const adapterProp = kitConfig.value.properties.find((p$1) => p$1.type === "Property" && p$1.key.type === "Identifier" && p$1.key.name === "adapter");
|
|
4513
|
+
if (adapterProp) adapterProp.leadingComments = [];
|
|
4514
|
+
object_exports.overrideProperties(kitConfig.value, { adapter: function_exports.callByIdentifier(adapterName, []) });
|
|
4515
|
+
} else object_exports.properties(config, { kit: object_exports.create({ adapter: function_exports.callByIdentifier(adapterName, []) }) });
|
|
4516
|
+
return generateCode();
|
|
4517
|
+
});
|
|
4518
|
+
}
|
|
4519
|
+
});
|
|
4520
|
+
|
|
4491
4521
|
//#endregion
|
|
4492
4522
|
//#region packages/addons/tailwindcss/index.ts
|
|
4493
4523
|
const plugins = [{
|
|
@@ -4501,7 +4531,7 @@ const plugins = [{
|
|
|
4501
4531
|
version: "^0.5.9",
|
|
4502
4532
|
identifier: "forms"
|
|
4503
4533
|
}];
|
|
4504
|
-
const options$
|
|
4534
|
+
const options$2 = defineAddonOptions({ plugins: {
|
|
4505
4535
|
type: "multiselect",
|
|
4506
4536
|
question: "Which plugins would you like to add?",
|
|
4507
4537
|
options: plugins.map((p$1) => ({
|
|
@@ -4509,22 +4539,23 @@ const options$1 = defineAddonOptions({ plugins: {
|
|
|
4509
4539
|
label: p$1.id,
|
|
4510
4540
|
hint: p$1.package
|
|
4511
4541
|
})),
|
|
4512
|
-
default: []
|
|
4542
|
+
default: [],
|
|
4543
|
+
required: false
|
|
4513
4544
|
} });
|
|
4514
4545
|
var tailwindcss_default = defineAddon({
|
|
4515
4546
|
id: "tailwindcss",
|
|
4516
4547
|
alias: "tailwind",
|
|
4517
4548
|
shortDescription: "css framework",
|
|
4518
4549
|
homepage: "https://tailwindcss.com",
|
|
4519
|
-
options: options$
|
|
4520
|
-
run: ({ sv, options: options$
|
|
4550
|
+
options: options$2,
|
|
4551
|
+
run: ({ sv, options: options$7, typescript, kit, dependencyVersion }) => {
|
|
4521
4552
|
const ext = typescript ? "ts" : "js";
|
|
4522
4553
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
4523
4554
|
sv.devDependency("tailwindcss", "^4.0.0");
|
|
4524
4555
|
sv.devDependency("@tailwindcss/vite", "^4.0.0");
|
|
4525
4556
|
if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.6.11");
|
|
4526
4557
|
for (const plugin of plugins) {
|
|
4527
|
-
if (!options$
|
|
4558
|
+
if (!options$7.plugins.includes(plugin.id)) continue;
|
|
4528
4559
|
sv.devDependency(plugin.package, plugin.version);
|
|
4529
4560
|
}
|
|
4530
4561
|
sv.file(`vite.config.${ext}`, (content) => {
|
|
@@ -4550,7 +4581,7 @@ var tailwindcss_default = defineAddon({
|
|
|
4550
4581
|
const lastAtRule = atRules.findLast((rule) => ["plugin", "import"].includes(rule.name));
|
|
4551
4582
|
const pluginPos = lastAtRule.source.end.offset;
|
|
4552
4583
|
for (const plugin of plugins) {
|
|
4553
|
-
if (!options$
|
|
4584
|
+
if (!options$7.plugins.includes(plugin.id)) continue;
|
|
4554
4585
|
const pluginRule = findAtRule("plugin", plugin.package);
|
|
4555
4586
|
if (!pluginRule) {
|
|
4556
4587
|
const pluginImport = `\n@plugin '${plugin.package}';`;
|
|
@@ -4590,17 +4621,34 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
|
|
|
4590
4621
|
|
|
4591
4622
|
//#endregion
|
|
4592
4623
|
//#region packages/addons/vitest-addon/index.ts
|
|
4624
|
+
const options$1 = defineAddonOptions({ usages: {
|
|
4625
|
+
question: "What do you want to use vitest for?",
|
|
4626
|
+
type: "multiselect",
|
|
4627
|
+
default: ["unit", "component"],
|
|
4628
|
+
options: [{
|
|
4629
|
+
value: "unit",
|
|
4630
|
+
label: "unit testing"
|
|
4631
|
+
}, {
|
|
4632
|
+
value: "component",
|
|
4633
|
+
label: "component testing"
|
|
4634
|
+
}],
|
|
4635
|
+
required: true
|
|
4636
|
+
} });
|
|
4593
4637
|
var vitest_addon_default = defineAddon({
|
|
4594
4638
|
id: "vitest",
|
|
4595
4639
|
shortDescription: "unit testing",
|
|
4596
4640
|
homepage: "https://vitest.dev",
|
|
4597
|
-
options:
|
|
4598
|
-
run: ({ sv, typescript, kit }) => {
|
|
4641
|
+
options: options$1,
|
|
4642
|
+
run: ({ sv, typescript, kit, options: options$7 }) => {
|
|
4599
4643
|
const ext = typescript ? "ts" : "js";
|
|
4644
|
+
const unitTesting = options$7.usages.includes("unit");
|
|
4645
|
+
const componentTesting = options$7.usages.includes("component");
|
|
4600
4646
|
sv.devDependency("vitest", "^3.2.3");
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4647
|
+
if (componentTesting) {
|
|
4648
|
+
sv.devDependency("@vitest/browser", "^3.2.3");
|
|
4649
|
+
sv.devDependency("vitest-browser-svelte", "^0.1.0");
|
|
4650
|
+
sv.devDependency("playwright", "^1.53.0");
|
|
4651
|
+
}
|
|
4604
4652
|
sv.file("package.json", (content) => {
|
|
4605
4653
|
const { data, generateCode } = parseJson$1(content);
|
|
4606
4654
|
data.scripts ??= {};
|
|
@@ -4612,96 +4660,71 @@ var vitest_addon_default = defineAddon({
|
|
|
4612
4660
|
if (!scripts$1["test"].includes(RUN_TEST)) scripts$1["test"] += ` && ${RUN_TEST}`;
|
|
4613
4661
|
return generateCode();
|
|
4614
4662
|
});
|
|
4615
|
-
sv.file(`src/demo.spec.${ext}`, (content) => {
|
|
4616
|
-
if (content) return content;
|
|
4617
|
-
return dedent_default`
|
|
4618
|
-
import { describe, it, expect } from 'vitest';
|
|
4619
|
-
|
|
4620
|
-
describe('sum test', () => {
|
|
4621
|
-
it('adds 1 + 2 to equal 3', () => {
|
|
4622
|
-
expect(1 + 2).toBe(3);
|
|
4623
|
-
});
|
|
4624
|
-
});
|
|
4625
|
-
`;
|
|
4626
|
-
});
|
|
4627
|
-
if (kit) sv.file(`${kit.routesDirectory}/page.svelte.test.${ext}`, (content) => {
|
|
4663
|
+
if (unitTesting) sv.file(`src/demo.spec.${ext}`, (content) => {
|
|
4628
4664
|
if (content) return content;
|
|
4629
4665
|
return dedent_default`
|
|
4630
|
-
|
|
4631
|
-
import '@testing-library/jest-dom/vitest';
|
|
4632
|
-
import { render, screen } from '@testing-library/svelte';
|
|
4633
|
-
import Page from './+page.svelte';
|
|
4666
|
+
import { describe, it, expect } from 'vitest';
|
|
4634
4667
|
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument();
|
|
4639
|
-
});
|
|
4668
|
+
describe('sum test', () => {
|
|
4669
|
+
it('adds 1 + 2 to equal 3', () => {
|
|
4670
|
+
expect(1 + 2).toBe(3);
|
|
4640
4671
|
});
|
|
4641
|
-
|
|
4672
|
+
});
|
|
4673
|
+
`;
|
|
4642
4674
|
});
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
import {
|
|
4649
|
-
import
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4675
|
+
if (componentTesting) {
|
|
4676
|
+
const fileName = kit ? `${kit.routesDirectory}/page.svelte.test.${ext}` : `src/App.svelte.test.${ext}`;
|
|
4677
|
+
sv.file(fileName, (content) => {
|
|
4678
|
+
if (content) return content;
|
|
4679
|
+
return dedent_default`
|
|
4680
|
+
import { page } from '@vitest/browser/context';
|
|
4681
|
+
import { describe, expect, it } from 'vitest';
|
|
4682
|
+
import { render } from 'vitest-browser-svelte';
|
|
4683
|
+
${kit ? "import Page from './+page.svelte';" : "import App from './App.svelte';"}
|
|
4684
|
+
|
|
4685
|
+
describe('${kit ? "/+page.svelte" : "App.svelte"}', () => {
|
|
4686
|
+
it('should render h1', async () => {
|
|
4687
|
+
render(${kit ? "Page" : "App"});
|
|
4688
|
+
|
|
4689
|
+
const heading = page.getByRole('heading', { level: 1 });
|
|
4690
|
+
await expect.element(heading).toBeInTheDocument();
|
|
4655
4691
|
});
|
|
4656
4692
|
});
|
|
4657
4693
|
`;
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
// required for svelte5 + jsdom as jsdom does not support matchMedia
|
|
4666
|
-
Object.defineProperty(window, 'matchMedia', {
|
|
4667
|
-
writable: true,
|
|
4668
|
-
enumerable: true,
|
|
4669
|
-
value: vi.fn().mockImplementation(query => ({
|
|
4670
|
-
matches: false,
|
|
4671
|
-
media: query,
|
|
4672
|
-
onchange: null,
|
|
4673
|
-
addEventListener: vi.fn(),
|
|
4674
|
-
removeEventListener: vi.fn(),
|
|
4675
|
-
dispatchEvent: vi.fn(),
|
|
4676
|
-
})),
|
|
4677
|
-
})
|
|
4678
|
-
|
|
4679
|
-
// add more mocks here if you need them
|
|
4694
|
+
});
|
|
4695
|
+
sv.file(`vitest-setup-client.${ext}`, (content) => {
|
|
4696
|
+
if (content) return content;
|
|
4697
|
+
return dedent_default`
|
|
4698
|
+
/// <reference types="@vitest/browser/matchers" />
|
|
4699
|
+
/// <reference types="@vitest/browser/providers/playwright" />
|
|
4680
4700
|
`;
|
|
4681
|
-
|
|
4701
|
+
});
|
|
4702
|
+
}
|
|
4682
4703
|
sv.file(`vite.config.${ext}`, (content) => {
|
|
4683
4704
|
const { ast, generateCode } = parseScript$1(content);
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4705
|
+
const clientObjectExpression = object_exports.createFromPrimitives({
|
|
4706
|
+
extends: `./vite.config.${ext}`,
|
|
4707
|
+
test: {
|
|
4708
|
+
name: "client",
|
|
4709
|
+
environment: "browser",
|
|
4710
|
+
browser: {
|
|
4711
|
+
enabled: true,
|
|
4712
|
+
provider: "playwright",
|
|
4713
|
+
instances: [{ browser: "chromium" }]
|
|
4714
|
+
},
|
|
4715
|
+
include: ["src/**/*.svelte.{test,spec}.{js,ts}"],
|
|
4716
|
+
exclude: ["src/lib/server/**"],
|
|
4717
|
+
setupFiles: [`./vitest-setup-client.${ext}`]
|
|
4718
|
+
}
|
|
4696
4719
|
});
|
|
4697
|
-
const serverObjectExpression = object_exports.
|
|
4698
|
-
extends:
|
|
4699
|
-
test:
|
|
4700
|
-
name:
|
|
4701
|
-
environment:
|
|
4702
|
-
include:
|
|
4703
|
-
exclude:
|
|
4704
|
-
}
|
|
4720
|
+
const serverObjectExpression = object_exports.createFromPrimitives({
|
|
4721
|
+
extends: `./vite.config.${ext}`,
|
|
4722
|
+
test: {
|
|
4723
|
+
name: "server",
|
|
4724
|
+
environment: "node",
|
|
4725
|
+
include: ["src/**/*.{test,spec}.{js,ts}"],
|
|
4726
|
+
exclude: ["src/**/*.svelte.{test,spec}.{js,ts}"]
|
|
4727
|
+
}
|
|
4705
4728
|
});
|
|
4706
4729
|
const defineConfigFallback = function_exports.call("defineConfig", []);
|
|
4707
4730
|
const { value: defineWorkspaceCall } = exports_exports.defaultExport(ast, defineConfigFallback);
|
|
@@ -4709,8 +4732,8 @@ else sv.file(`src/App.svelte.test.${ext}`, (content) => {
|
|
|
4709
4732
|
const vitestConfig = function_exports.argumentByIndex(defineWorkspaceCall, 0, object_exports.createEmpty());
|
|
4710
4733
|
const testObject = object_exports.property(vitestConfig, "test", object_exports.createEmpty());
|
|
4711
4734
|
const workspaceArray = object_exports.property(testObject, "projects", array_exports.createEmpty());
|
|
4712
|
-
array_exports.push(workspaceArray, clientObjectExpression);
|
|
4713
|
-
array_exports.push(workspaceArray, serverObjectExpression);
|
|
4735
|
+
if (componentTesting) array_exports.push(workspaceArray, clientObjectExpression);
|
|
4736
|
+
if (unitTesting) array_exports.push(workspaceArray, serverObjectExpression);
|
|
4714
4737
|
return generateCode();
|
|
4715
4738
|
});
|
|
4716
4739
|
}
|
|
@@ -4725,6 +4748,7 @@ const officialAddons = [
|
|
|
4725
4748
|
playwright_default,
|
|
4726
4749
|
tailwindcss_default,
|
|
4727
4750
|
sveltekit_adapter_default,
|
|
4751
|
+
devtools_json_default,
|
|
4728
4752
|
drizzle_default,
|
|
4729
4753
|
lucia_default,
|
|
4730
4754
|
mdsvex_default,
|
|
@@ -4758,7 +4782,7 @@ var UnsupportedError = class extends Error {
|
|
|
4758
4782
|
|
|
4759
4783
|
//#endregion
|
|
4760
4784
|
//#region packages/cli/utils/common.ts
|
|
4761
|
-
var import_picocolors$3 = __toESM
|
|
4785
|
+
var import_picocolors$3 = __toESM(require_picocolors(), 1);
|
|
4762
4786
|
const NO_PREFIX = "--no-";
|
|
4763
4787
|
let options = [];
|
|
4764
4788
|
function getLongFlag(flags) {
|
|
@@ -4850,14 +4874,14 @@ function verifyPackage(pkg, specifier) {
|
|
|
4850
4874
|
throw new Error(`Invalid add-on package detected: '${specifier}'\nCommunity addons should not have any external 'dependencies' besides '@sveltejs/cli-core'. Consider bundling your dependencies if they are necessary`);
|
|
4851
4875
|
}
|
|
4852
4876
|
}
|
|
4853
|
-
async function downloadPackage(options$
|
|
4854
|
-
const { pkg } = options$
|
|
4855
|
-
if (options$
|
|
4877
|
+
async function downloadPackage(options$7) {
|
|
4878
|
+
const { pkg } = options$7;
|
|
4879
|
+
if (options$7.path) {
|
|
4856
4880
|
const dest = path.join(NODE_MODULES, pkg.name.split("/").join(path.sep));
|
|
4857
4881
|
if (fs.existsSync(dest)) fs.rmSync(dest);
|
|
4858
4882
|
const dir = path.dirname(dest);
|
|
4859
4883
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
4860
|
-
fs.symlinkSync(options$
|
|
4884
|
+
fs.symlinkSync(options$7.path, dest);
|
|
4861
4885
|
const { default: details$1 } = await import(pkg.name);
|
|
4862
4886
|
return details$1;
|
|
4863
4887
|
}
|
|
@@ -4962,7 +4986,7 @@ function getGlobalPreconditions(cwd, addons, addonSetupResult) {
|
|
|
4962
4986
|
|
|
4963
4987
|
//#endregion
|
|
4964
4988
|
//#region packages/cli/commands/add/index.ts
|
|
4965
|
-
var import_picocolors$2 = __toESM
|
|
4989
|
+
var import_picocolors$2 = __toESM(require_picocolors(), 1);
|
|
4966
4990
|
const aliases = officialAddons.map((c$1) => c$1.alias).filter((v$2) => v$2 !== undefined);
|
|
4967
4991
|
const addonOptions = getAddonOptionFlags();
|
|
4968
4992
|
const communityDetails = [];
|
|
@@ -4994,10 +5018,10 @@ const add = new Command("add").description("applies specified add-ons into a pro
|
|
|
4994
5018
|
console.error(`Malformed arguments: An add-on's option in '${value}' is missing it's option name or value (e.g. 'addon=option:value').`);
|
|
4995
5019
|
process$1.exit(1);
|
|
4996
5020
|
}
|
|
4997
|
-
const options$
|
|
5021
|
+
const options$7 = optionFlags.match(/[^+]*:[^:]*(?=\+|$)/g) ?? [];
|
|
4998
5022
|
prev.push({
|
|
4999
5023
|
id: addonId,
|
|
5000
|
-
options: options$
|
|
5024
|
+
options: options$7
|
|
5001
5025
|
});
|
|
5002
5026
|
return prev;
|
|
5003
5027
|
}).option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-preconditions", "skip validating preconditions").option("--no-install", "skip installing dependencies").addOption(installOption).configureHelp({
|
|
@@ -5070,19 +5094,19 @@ const add = new Command("add").description("applies specified add-ons into a pro
|
|
|
5070
5094
|
console.error(`Invalid add-ons specified: ${invalidAddons.join(", ")}`);
|
|
5071
5095
|
process$1.exit(1);
|
|
5072
5096
|
}
|
|
5073
|
-
const options$
|
|
5097
|
+
const options$7 = parse(OptionsSchema$1, {
|
|
5074
5098
|
...opts,
|
|
5075
5099
|
addons: {}
|
|
5076
5100
|
});
|
|
5077
5101
|
const selectedAddons = transformAliases(addonArgs);
|
|
5078
|
-
selectedAddons.forEach((addon) => options$
|
|
5102
|
+
selectedAddons.forEach((addon) => options$7.addons[addon.id] = addon.options);
|
|
5079
5103
|
runCommand(async () => {
|
|
5080
5104
|
const selectedAddonIds = selectedAddons.map(({ id }) => id);
|
|
5081
|
-
const { nextSteps } = await runAddCommand(options$
|
|
5105
|
+
const { nextSteps } = await runAddCommand(options$7, selectedAddonIds, "add");
|
|
5082
5106
|
if (nextSteps) Ke(nextSteps, "Next steps", { format: (line) => line });
|
|
5083
5107
|
});
|
|
5084
5108
|
});
|
|
5085
|
-
async function runAddCommand(options$
|
|
5109
|
+
async function runAddCommand(options$7, selectedAddonIds, from$1) {
|
|
5086
5110
|
const selectedAddons = selectedAddonIds.map((id) => ({
|
|
5087
5111
|
type: "official",
|
|
5088
5112
|
addon: getAddonDetails(id)
|
|
@@ -5091,7 +5115,7 @@ async function runAddCommand(options$6, selectedAddonIds) {
|
|
|
5091
5115
|
const community = {};
|
|
5092
5116
|
for (const addonOption of addonOptions) {
|
|
5093
5117
|
const addonId = addonOption.id;
|
|
5094
|
-
const specifiedOptions = options$
|
|
5118
|
+
const specifiedOptions = options$7.addons[addonId];
|
|
5095
5119
|
if (!specifiedOptions) continue;
|
|
5096
5120
|
const details$1 = getAddonDetails(addonId);
|
|
5097
5121
|
if (!selectedAddons.find((d$1) => d$1.addon === details$1)) selectedAddons.push({
|
|
@@ -5121,7 +5145,7 @@ else official[addonId][questionId] = optionValue;
|
|
|
5121
5145
|
for (const [id, question] of Object.entries(details$1.options)) if (question.condition?.(official[addonId]) !== false) official[addonId][id] ??= question.default;
|
|
5122
5146
|
else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${addonId}' option specified: '${official[addonId][id]}'`);
|
|
5123
5147
|
}
|
|
5124
|
-
if (options$
|
|
5148
|
+
if (options$7.community === true) {
|
|
5125
5149
|
const communityAddons = await Promise.all(communityAddonIds.map(async (id) => await getCommunityAddon(id)));
|
|
5126
5150
|
const promptOptions = communityAddons.map((addon) => ({
|
|
5127
5151
|
value: addon.id,
|
|
@@ -5140,10 +5164,10 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5140
5164
|
De("No add-ons selected. Exiting.");
|
|
5141
5165
|
process$1.exit(1);
|
|
5142
5166
|
}
|
|
5143
|
-
options$
|
|
5167
|
+
options$7.community = selected;
|
|
5144
5168
|
}
|
|
5145
|
-
if (Array.isArray(options$
|
|
5146
|
-
const addons = options$
|
|
5169
|
+
if (Array.isArray(options$7.community) && options$7.community.length > 0) {
|
|
5170
|
+
const addons = options$7.community.map((id) => {
|
|
5147
5171
|
const hasDirective = Object.values(Directive).some((directive) => id.startsWith(directive));
|
|
5148
5172
|
if (hasDirective) return id;
|
|
5149
5173
|
const validAddon = communityAddonIds.includes(id);
|
|
@@ -5155,7 +5179,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5155
5179
|
start("Resolving community add-on packages");
|
|
5156
5180
|
const pkgs = await Promise.all(addons.map(async (id) => {
|
|
5157
5181
|
return await getPackageJSON({
|
|
5158
|
-
cwd: options$
|
|
5182
|
+
cwd: options$7.cwd,
|
|
5159
5183
|
packageName: id
|
|
5160
5184
|
});
|
|
5161
5185
|
}));
|
|
@@ -5192,9 +5216,10 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5192
5216
|
throw err;
|
|
5193
5217
|
}
|
|
5194
5218
|
}
|
|
5195
|
-
let workspace = await createWorkspace({ cwd: options$
|
|
5219
|
+
let workspace = await createWorkspace({ cwd: options$7.cwd });
|
|
5196
5220
|
const setups = selectedAddons.length ? selectedAddons.map(({ addon }) => addon) : officialAddons;
|
|
5197
5221
|
const addonSetupResults = setupAddons(setups, workspace);
|
|
5222
|
+
const initialValues = Object.entries(addonSetupResults).filter(([_$1, value]) => value.defaultSelection[from$1] === true).map(([key]) => key);
|
|
5198
5223
|
if (selectedAddons.length === 0) {
|
|
5199
5224
|
const addonOptions$1 = officialAddons.filter(({ id }) => addonSetupResults[id].unsupported.length === 0).map(({ id, homepage: homepage$1, shortDescription }) => ({
|
|
5200
5225
|
label: id,
|
|
@@ -5204,7 +5229,8 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5204
5229
|
const selected = await Ue({
|
|
5205
5230
|
message: `What would you like to add to your project? ${import_picocolors$2.default.dim("(use arrow keys / space bar)")}`,
|
|
5206
5231
|
options: addonOptions$1,
|
|
5207
|
-
required: false
|
|
5232
|
+
required: false,
|
|
5233
|
+
initialValues
|
|
5208
5234
|
});
|
|
5209
5235
|
if (Vu(selected)) {
|
|
5210
5236
|
De("Operation cancelled.");
|
|
@@ -5236,9 +5262,9 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5236
5262
|
});
|
|
5237
5263
|
}
|
|
5238
5264
|
}
|
|
5239
|
-
if (options$
|
|
5265
|
+
if (options$7.preconditions && selectedAddons.length > 0) {
|
|
5240
5266
|
const addons = selectedAddons.map(({ addon }) => addon);
|
|
5241
|
-
const { preconditions } = getGlobalPreconditions(options$
|
|
5267
|
+
const { preconditions } = getGlobalPreconditions(options$7.cwd, addons, addonSetupResults);
|
|
5242
5268
|
const fails = [];
|
|
5243
5269
|
for (const condition of preconditions) {
|
|
5244
5270
|
const { message, success } = await condition.run();
|
|
@@ -5289,7 +5315,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5289
5315
|
if (question.type === "multiselect") answer = await Ue({
|
|
5290
5316
|
message,
|
|
5291
5317
|
initialValues: question.default,
|
|
5292
|
-
required:
|
|
5318
|
+
required: question.required,
|
|
5293
5319
|
options: question.options
|
|
5294
5320
|
});
|
|
5295
5321
|
if (question.type === "string" || question.type === "number") {
|
|
@@ -5321,12 +5347,12 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5321
5347
|
});
|
|
5322
5348
|
T.success("Successfully setup add-ons");
|
|
5323
5349
|
let packageManager;
|
|
5324
|
-
if (options$
|
|
5325
|
-
packageManager = options$
|
|
5350
|
+
if (options$7.install) {
|
|
5351
|
+
packageManager = options$7.install === true ? await packageManagerPrompt(options$7.cwd) : options$7.install;
|
|
5326
5352
|
if (packageManager) {
|
|
5327
5353
|
workspace.packageManager = packageManager;
|
|
5328
5354
|
addPnpmBuildDependencies(workspace.cwd, packageManager, ["esbuild", ...addonPnpmBuildDependencies]);
|
|
5329
|
-
await installDependencies(packageManager, options$
|
|
5355
|
+
await installDependencies(packageManager, options$7.cwd);
|
|
5330
5356
|
}
|
|
5331
5357
|
}
|
|
5332
5358
|
workspace = await createWorkspace(workspace);
|
|
@@ -5336,7 +5362,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
5336
5362
|
try {
|
|
5337
5363
|
await formatFiles({
|
|
5338
5364
|
packageManager,
|
|
5339
|
-
cwd: options$
|
|
5365
|
+
cwd: options$7.cwd,
|
|
5340
5366
|
paths: filesToFormat
|
|
5341
5367
|
});
|
|
5342
5368
|
stop("Successfully formatted modified files");
|
|
@@ -5377,7 +5403,7 @@ function transformAliases(addons) {
|
|
|
5377
5403
|
return Array.from(set.values());
|
|
5378
5404
|
}
|
|
5379
5405
|
function getAddonOptionFlags() {
|
|
5380
|
-
const options$
|
|
5406
|
+
const options$7 = [];
|
|
5381
5407
|
for (const addon of officialAddons) {
|
|
5382
5408
|
const id = addon.id;
|
|
5383
5409
|
const details = getAddonDetails(id);
|
|
@@ -5385,47 +5411,47 @@ function getAddonOptionFlags() {
|
|
|
5385
5411
|
const { defaults, groups } = getOptionChoices(details);
|
|
5386
5412
|
const choices = Object.entries(groups).map(([group, choices$1]) => `${import_picocolors$2.default.dim(`${group}:`)} ${choices$1.join(", ")}`).join("\n");
|
|
5387
5413
|
const preset = defaults.join(", ") || "none";
|
|
5388
|
-
options$
|
|
5414
|
+
options$7.push({
|
|
5389
5415
|
id,
|
|
5390
5416
|
choices,
|
|
5391
5417
|
preset
|
|
5392
5418
|
});
|
|
5393
5419
|
}
|
|
5394
|
-
return options$
|
|
5420
|
+
return options$7;
|
|
5395
5421
|
}
|
|
5396
5422
|
function getOptionChoices(details) {
|
|
5397
5423
|
const choices = [];
|
|
5398
5424
|
const defaults = [];
|
|
5399
5425
|
const groups = {};
|
|
5400
|
-
const options$
|
|
5426
|
+
const options$7 = {};
|
|
5401
5427
|
for (const [id, question] of Object.entries(details.options)) {
|
|
5402
5428
|
let values = [];
|
|
5403
|
-
const applyDefault = question.condition?.(options$
|
|
5429
|
+
const applyDefault = question.condition?.(options$7) !== false;
|
|
5404
5430
|
if (question.type === "boolean") {
|
|
5405
5431
|
values = ["yes", `no`];
|
|
5406
5432
|
if (applyDefault) {
|
|
5407
|
-
options$
|
|
5433
|
+
options$7[id] = question.default;
|
|
5408
5434
|
defaults.push(question.default ? values[0] : values[1]);
|
|
5409
5435
|
}
|
|
5410
5436
|
}
|
|
5411
5437
|
if (question.type === "select") {
|
|
5412
5438
|
values = question.options.map((o$1) => o$1.value);
|
|
5413
5439
|
if (applyDefault) {
|
|
5414
|
-
options$
|
|
5440
|
+
options$7[id] = question.default;
|
|
5415
5441
|
defaults.push(question.default);
|
|
5416
5442
|
}
|
|
5417
5443
|
}
|
|
5418
5444
|
if (question.type === "multiselect") {
|
|
5419
5445
|
values = question.options.map((o$1) => o$1.value);
|
|
5420
5446
|
if (applyDefault) {
|
|
5421
|
-
options$
|
|
5447
|
+
options$7[id] = question.default;
|
|
5422
5448
|
defaults.push(...question.default);
|
|
5423
5449
|
}
|
|
5424
5450
|
}
|
|
5425
5451
|
if (question.type === "string" || question.type === "number") {
|
|
5426
5452
|
values = ["<user-input>"];
|
|
5427
5453
|
if (applyDefault) {
|
|
5428
|
-
options$
|
|
5454
|
+
options$7[id] = question.default;
|
|
5429
5455
|
defaults.push(question.default.toString());
|
|
5430
5456
|
}
|
|
5431
5457
|
}
|
|
@@ -5443,7 +5469,7 @@ function getOptionChoices(details) {
|
|
|
5443
5469
|
|
|
5444
5470
|
//#endregion
|
|
5445
5471
|
//#region packages/cli/commands/create.ts
|
|
5446
|
-
var import_picocolors$1 = __toESM
|
|
5472
|
+
var import_picocolors$1 = __toESM(require_picocolors(), 1);
|
|
5447
5473
|
const langs = ["ts", "jsdoc"];
|
|
5448
5474
|
const langMap = {
|
|
5449
5475
|
ts: "typescript",
|
|
@@ -5462,9 +5488,9 @@ const OptionsSchema = strictObject({
|
|
|
5462
5488
|
});
|
|
5463
5489
|
const create$1 = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created").addOption(templateOption).addOption(langOption).option("--no-types").option("--no-add-ons", "skips interactive add-on installer").option("--no-install", "skip installing dependencies").addOption(installOption).configureHelp(helpConfig).action((projectPath, opts) => {
|
|
5464
5490
|
const cwd = parse(ProjectPathSchema, projectPath);
|
|
5465
|
-
const options$
|
|
5491
|
+
const options$7 = parse(OptionsSchema, opts);
|
|
5466
5492
|
runCommand(async () => {
|
|
5467
|
-
const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$
|
|
5493
|
+
const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$7);
|
|
5468
5494
|
const highlight = (str) => import_picocolors$1.default.bold(import_picocolors$1.default.cyan(str));
|
|
5469
5495
|
let i = 1;
|
|
5470
5496
|
const initialSteps = [];
|
|
@@ -5493,7 +5519,7 @@ const create$1 = new Command("create").description("scaffolds a new SvelteKit pr
|
|
|
5493
5519
|
if (addOnNextSteps) Ke(addOnNextSteps, "Add-on next steps", { format: (line) => line });
|
|
5494
5520
|
});
|
|
5495
5521
|
});
|
|
5496
|
-
async function createProject(cwd, options$
|
|
5522
|
+
async function createProject(cwd, options$7) {
|
|
5497
5523
|
const { directory, template, language } = await We({
|
|
5498
5524
|
directory: () => {
|
|
5499
5525
|
if (cwd) return Promise.resolve(path.resolve(cwd));
|
|
@@ -5517,7 +5543,7 @@ async function createProject(cwd, options$6) {
|
|
|
5517
5543
|
}
|
|
5518
5544
|
},
|
|
5519
5545
|
template: () => {
|
|
5520
|
-
if (options$
|
|
5546
|
+
if (options$7.template) return Promise.resolve(options$7.template);
|
|
5521
5547
|
return ze({
|
|
5522
5548
|
message: "Which template would you like?",
|
|
5523
5549
|
initialValue: "minimal",
|
|
@@ -5529,7 +5555,7 @@ async function createProject(cwd, options$6) {
|
|
|
5529
5555
|
});
|
|
5530
5556
|
},
|
|
5531
5557
|
language: () => {
|
|
5532
|
-
if (options$
|
|
5558
|
+
if (options$7.types) return Promise.resolve(options$7.types);
|
|
5533
5559
|
return ze({
|
|
5534
5560
|
message: "Add type checking with TypeScript?",
|
|
5535
5561
|
initialValue: "typescript",
|
|
@@ -5567,18 +5593,18 @@ async function createProject(cwd, options$6) {
|
|
|
5567
5593
|
addPnpmBuildDependencies(projectPath, packageManager, ["esbuild"]);
|
|
5568
5594
|
if (packageManager) await installDependencies(packageManager, projectPath);
|
|
5569
5595
|
};
|
|
5570
|
-
if (options$
|
|
5596
|
+
if (options$7.addOns) {
|
|
5571
5597
|
const { nextSteps, packageManager: pm } = await runAddCommand({
|
|
5572
5598
|
cwd: projectPath,
|
|
5573
|
-
install: options$
|
|
5599
|
+
install: options$7.install,
|
|
5574
5600
|
preconditions: false,
|
|
5575
5601
|
community: [],
|
|
5576
5602
|
addons: {}
|
|
5577
|
-
}, []);
|
|
5603
|
+
}, [], "create");
|
|
5578
5604
|
packageManager = pm;
|
|
5579
5605
|
addOnNextSteps = nextSteps;
|
|
5580
|
-
} else if (options$
|
|
5581
|
-
if (packageManager === null && options$
|
|
5606
|
+
} else if (options$7.install) await installDeps(options$7.install);
|
|
5607
|
+
if (packageManager === null && options$7.install) await installDeps(options$7.install);
|
|
5582
5608
|
return {
|
|
5583
5609
|
directory: projectPath,
|
|
5584
5610
|
addOnNextSteps,
|
|
@@ -5591,8 +5617,8 @@ async function createProject(cwd, options$6) {
|
|
|
5591
5617
|
const migrate = new Command("migrate").description("a CLI for migrating Svelte(Kit) codebases").argument("<migration>", "migration to run").option("-C, --cwd <path>", "path to working directory", process$1.cwd()).configureHelp({ formatHelp() {
|
|
5592
5618
|
runMigrate(process$1.cwd(), ["--help"]);
|
|
5593
5619
|
return "";
|
|
5594
|
-
} }).action((migration, options$
|
|
5595
|
-
runMigrate(options$
|
|
5620
|
+
} }).action((migration, options$7) => {
|
|
5621
|
+
runMigrate(options$7.cwd, [migration]);
|
|
5596
5622
|
});
|
|
5597
5623
|
function runMigrate(cwd, args) {
|
|
5598
5624
|
const pm = getUserAgent() ?? "npm";
|
|
@@ -5611,12 +5637,12 @@ function runMigrate(cwd, args) {
|
|
|
5611
5637
|
|
|
5612
5638
|
//#endregion
|
|
5613
5639
|
//#region packages/cli/commands/check.ts
|
|
5614
|
-
var import_picocolors = __toESM
|
|
5640
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
5615
5641
|
const check = new Command("check").description("a CLI for checking your Svelte code").allowUnknownOption(true).allowExcessArguments(true).option("-C, --cwd <path>", "path to working directory", process$1.cwd()).configureHelp({ formatHelp() {
|
|
5616
5642
|
runCheck(process$1.cwd(), ["--help"]);
|
|
5617
5643
|
return "";
|
|
5618
|
-
} }).action((options$
|
|
5619
|
-
const cwd = options$
|
|
5644
|
+
} }).action((options$7, check$1) => {
|
|
5645
|
+
const cwd = options$7.cwd;
|
|
5620
5646
|
const args = check$1.args;
|
|
5621
5647
|
runCheck(cwd, args);
|
|
5622
5648
|
});
|