sv 0.8.11 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
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-BKjL-s_Q.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.11";
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$6, message) {
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$6.map(_stringify), "|"),
271
+ expects: _joinExpects(options$7.map(_stringify), "|"),
272
272
  async: false,
273
- options: options$6,
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$6, message) {
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$6.map((option) => option.expects), "|"),
442
+ expects: _joinExpects(options$7.map((option) => option.expects), "|"),
443
443
  async: false,
444
- options: options$6,
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$6) {
503
- return up("package.json", options$6);
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$6) {
512
- return options$6;
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";
@@ -2061,7 +2061,7 @@ const PORTS = {
2061
2061
  postgresql: "5432",
2062
2062
  sqlite: ""
2063
2063
  };
2064
- const options$5 = defineAddonOptions({
2064
+ const options$6 = defineAddonOptions({
2065
2065
  database: {
2066
2066
  question: "Which database would you like to use?",
2067
2067
  type: "select",
@@ -2146,7 +2146,7 @@ var drizzle_default = defineAddon({
2146
2146
  id: "drizzle",
2147
2147
  shortDescription: "database orm",
2148
2148
  homepage: "https://orm.drizzle.team",
2149
- options: options$5,
2149
+ options: options$6,
2150
2150
  setup: ({ kit, unsupported, cwd, typescript }) => {
2151
2151
  const ext = typescript ? "ts" : "js";
2152
2152
  if (!kit) return unsupported("Requires SvelteKit");
@@ -2158,32 +2158,32 @@ var drizzle_default = defineAddon({
2158
2158
  };
2159
2159
  for (const [fileType, filePath] of Object.entries(paths)) if (fs.existsSync(filePath)) unsupported(`Preexisting ${fileType} file at '${filePath}'`);
2160
2160
  },
2161
- run: ({ sv, typescript, options: options$6, kit }) => {
2161
+ run: ({ sv, typescript, options: options$7, kit }) => {
2162
2162
  const ext = typescript ? "ts" : "js";
2163
2163
  sv.dependency("drizzle-orm", "^0.40.0");
2164
2164
  sv.devDependency("drizzle-kit", "^0.30.2");
2165
2165
  sv.devDependency("@types/node", getNodeTypesVersion());
2166
- if (options$6.mysql === "mysql2") sv.dependency("mysql2", "^3.12.0");
2167
- if (options$6.mysql === "planetscale") sv.dependency("@planetscale/database", "^1.19.0");
2168
- if (options$6.postgresql === "neon") sv.dependency("@neondatabase/serverless", "^0.10.4");
2169
- if (options$6.postgresql === "postgres.js") sv.dependency("postgres", "^3.4.5");
2170
- if (options$6.sqlite === "better-sqlite3") {
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") {
2171
2171
  sv.dependency("better-sqlite3", "^11.8.0");
2172
2172
  sv.devDependency("@types/better-sqlite3", "^7.6.12");
2173
2173
  sv.pnpmBuildDependendency("better-sqlite3");
2174
2174
  }
2175
- if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") sv.dependency("@libsql/client", "^0.14.0");
2176
- sv.file(".env", (content) => generateEnvFileContent(content, options$6));
2177
- sv.file(".env.example", (content) => generateEnvFileContent(content, options$6));
2178
- if (options$6.docker && (options$6.mysql === "mysql2" || options$6.postgresql === "postgres.js")) sv.file("docker-compose.yml", (content) => {
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) => {
2179
2179
  if (content.length > 0) return content;
2180
- const imageName = options$6.database === "mysql" ? "mysql" : "postgres";
2181
- const port = PORTS[options$6.database];
2180
+ const imageName = options$7.database === "mysql" ? "mysql" : "postgres";
2181
+ const port = PORTS[options$7.database];
2182
2182
  const USER = "root";
2183
2183
  const PASSWORD = "mysecretpassword";
2184
2184
  const DB_NAME = "local";
2185
2185
  let dbSpecificContent = "";
2186
- if (options$6.mysql === "mysql2") dbSpecificContent = `
2186
+ if (options$7.mysql === "mysql2") dbSpecificContent = `
2187
2187
  MYSQL_ROOT_PASSWORD: ${PASSWORD}
2188
2188
  MYSQL_DATABASE: ${DB_NAME}
2189
2189
  volumes:
@@ -2191,7 +2191,7 @@ var drizzle_default = defineAddon({
2191
2191
  volumes:
2192
2192
  mysqldata:
2193
2193
  `;
2194
- if (options$6.postgresql === "postgres.js") dbSpecificContent = `
2194
+ if (options$7.postgresql === "postgres.js") dbSpecificContent = `
2195
2195
  POSTGRES_USER: ${USER}
2196
2196
  POSTGRES_PASSWORD: ${PASSWORD}
2197
2197
  POSTGRES_DB: ${DB_NAME}
@@ -2215,13 +2215,13 @@ var drizzle_default = defineAddon({
2215
2215
  const { data, generateCode } = parseJson$1(content);
2216
2216
  data.scripts ??= {};
2217
2217
  const scripts$1 = data.scripts;
2218
- if (options$6.docker) scripts$1["db:start"] ??= "docker compose up";
2218
+ if (options$7.docker) scripts$1["db:start"] ??= "docker compose up";
2219
2219
  scripts$1["db:push"] ??= "drizzle-kit push";
2220
2220
  scripts$1["db:migrate"] ??= "drizzle-kit migrate";
2221
2221
  scripts$1["db:studio"] ??= "drizzle-kit studio";
2222
2222
  return generateCode();
2223
2223
  });
2224
- if (options$6.database === "sqlite") sv.file(".gitignore", (content) => {
2224
+ if (options$7.database === "sqlite") sv.file(".gitignore", (content) => {
2225
2225
  if (content.length === 0) return content;
2226
2226
  if (!content.includes("\n*.db")) content = content.trimEnd() + "\n\n# SQLite\n*.db";
2227
2227
  return content;
@@ -2233,9 +2233,9 @@ var drizzle_default = defineAddon({
2233
2233
  exports_exports.defaultExport(ast, common_exports.expressionFromString(`
2234
2234
  defineConfig({
2235
2235
  schema: "./src/lib/server/db/schema.${typescript ? "ts" : "js"}",
2236
- dialect: "${options$6.sqlite === "turso" ? "turso" : options$6.database}",
2236
+ dialect: "${options$7.sqlite === "turso" ? "turso" : options$7.database}",
2237
2237
  dbCredentials: {
2238
- ${options$6.sqlite === "turso" ? "authToken: process.env.DATABASE_AUTH_TOKEN," : ""}
2238
+ ${options$7.sqlite === "turso" ? "authToken: process.env.DATABASE_AUTH_TOKEN," : ""}
2239
2239
  url: process.env.DATABASE_URL
2240
2240
  },
2241
2241
  verbose: true,
@@ -2246,7 +2246,7 @@ var drizzle_default = defineAddon({
2246
2246
  sv.file(`${kit?.libDirectory}/server/db/schema.${ext}`, (content) => {
2247
2247
  const { ast, generateCode } = parseScript$1(content);
2248
2248
  let userSchemaExpression;
2249
- if (options$6.database === "sqlite") {
2249
+ if (options$7.database === "sqlite") {
2250
2250
  imports_exports.addNamed(ast, "drizzle-orm/sqlite-core", {
2251
2251
  sqliteTable: "sqliteTable",
2252
2252
  integer: "integer"
@@ -2256,7 +2256,7 @@ var drizzle_default = defineAddon({
2256
2256
  age: integer('age')
2257
2257
  })`);
2258
2258
  }
2259
- if (options$6.database === "mysql") {
2259
+ if (options$7.database === "mysql") {
2260
2260
  imports_exports.addNamed(ast, "drizzle-orm/mysql-core", {
2261
2261
  mysqlTable: "mysqlTable",
2262
2262
  serial: "serial",
@@ -2267,7 +2267,7 @@ var drizzle_default = defineAddon({
2267
2267
  age: int('age'),
2268
2268
  })`);
2269
2269
  }
2270
- if (options$6.database === "postgresql") {
2270
+ if (options$7.database === "postgresql") {
2271
2271
  imports_exports.addNamed(ast, "drizzle-orm/pg-core", {
2272
2272
  pgTable: "pgTable",
2273
2273
  serial: "serial",
@@ -2290,32 +2290,32 @@ var drizzle_default = defineAddon({
2290
2290
  const dbURLCheck = common_exports.statementFromString("if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');");
2291
2291
  common_exports.addStatement(ast, dbURLCheck);
2292
2292
  let clientExpression;
2293
- if (options$6.sqlite === "better-sqlite3") {
2293
+ if (options$7.sqlite === "better-sqlite3") {
2294
2294
  imports_exports.addDefault(ast, "better-sqlite3", "Database");
2295
2295
  imports_exports.addNamed(ast, "drizzle-orm/better-sqlite3", { drizzle: "drizzle" });
2296
2296
  clientExpression = common_exports.expressionFromString("new Database(env.DATABASE_URL)");
2297
2297
  }
2298
- if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") {
2298
+ if (options$7.sqlite === "libsql" || options$7.sqlite === "turso") {
2299
2299
  imports_exports.addNamed(ast, "@libsql/client", { createClient: "createClient" });
2300
2300
  imports_exports.addNamed(ast, "drizzle-orm/libsql", { drizzle: "drizzle" });
2301
- if (options$6.sqlite === "turso") {
2301
+ if (options$7.sqlite === "turso") {
2302
2302
  imports_exports.addNamed(ast, "$app/environment", { dev: "dev" });
2303
2303
  const authTokenCheck = common_exports.statementFromString("if (!dev && !env.DATABASE_AUTH_TOKEN) throw new Error('DATABASE_AUTH_TOKEN is not set');");
2304
2304
  common_exports.addStatement(ast, authTokenCheck);
2305
2305
  clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL, authToken: env.DATABASE_AUTH_TOKEN })");
2306
2306
  } else clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL })");
2307
2307
  }
2308
- if (options$6.mysql === "mysql2" || options$6.mysql === "planetscale") {
2308
+ if (options$7.mysql === "mysql2" || options$7.mysql === "planetscale") {
2309
2309
  imports_exports.addDefault(ast, "mysql2/promise", "mysql");
2310
2310
  imports_exports.addNamed(ast, "drizzle-orm/mysql2", { drizzle: "drizzle" });
2311
2311
  clientExpression = common_exports.expressionFromString("mysql.createPool(env.DATABASE_URL)");
2312
2312
  }
2313
- if (options$6.postgresql === "neon") {
2313
+ if (options$7.postgresql === "neon") {
2314
2314
  imports_exports.addNamed(ast, "@neondatabase/serverless", { neon: "neon" });
2315
2315
  imports_exports.addNamed(ast, "drizzle-orm/neon-http", { drizzle: "drizzle" });
2316
2316
  clientExpression = common_exports.expressionFromString("neon(env.DATABASE_URL)");
2317
2317
  }
2318
- if (options$6.postgresql === "postgres.js") {
2318
+ if (options$7.postgresql === "postgres.js") {
2319
2319
  imports_exports.addDefault(ast, "postgres", "postgres");
2320
2320
  imports_exports.addNamed(ast, "drizzle-orm/postgres-js", { drizzle: "drizzle" });
2321
2321
  clientExpression = common_exports.expressionFromString("postgres(env.DATABASE_URL)");
@@ -2325,8 +2325,8 @@ var drizzle_default = defineAddon({
2325
2325
  common_exports.addStatement(ast, clientIdentifier);
2326
2326
  const drizzleCall = function_exports.callByIdentifier("drizzle", ["client"]);
2327
2327
  const paramObject = object_exports.create({ schema: variables_exports.identifier("schema") });
2328
- if (options$6.database === "mysql") {
2329
- const mode = options$6.mysql === "planetscale" ? "planetscale" : "default";
2328
+ if (options$7.database === "mysql") {
2329
+ const mode = options$7.mysql === "planetscale" ? "planetscale" : "default";
2330
2330
  object_exports.property(paramObject, "mode", common_exports.createLiteral(mode));
2331
2331
  }
2332
2332
  drizzleCall.arguments.push(paramObject);
@@ -2335,9 +2335,9 @@ var drizzle_default = defineAddon({
2335
2335
  return generateCode();
2336
2336
  });
2337
2337
  },
2338
- nextSteps: ({ options: options$6, highlighter, packageManager }) => {
2338
+ nextSteps: ({ options: options$7, highlighter, packageManager }) => {
2339
2339
  const steps = [`You will need to set ${highlighter.env("DATABASE_URL")} in your production environment`];
2340
- if (options$6.docker) steps.push(`Run ${highlighter.command(`${packageManager} run db:start`)} to start the docker container`);
2340
+ if (options$7.docker) steps.push(`Run ${highlighter.command(`${packageManager} run db:start`)} to start the docker container`);
2341
2341
  else steps.push(`Check ${highlighter.env("DATABASE_URL")} in ${highlighter.path(".env")} and adjust it to your needs`);
2342
2342
  steps.push(`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`);
2343
2343
  return steps;
@@ -2896,7 +2896,7 @@ const warned = {
2896
2896
  storeName: false
2897
2897
  };
2898
2898
  var MagicString = class MagicString {
2899
- constructor(string$1, options$6 = {}) {
2899
+ constructor(string$1, options$7 = {}) {
2900
2900
  const chunk = new Chunk(0, string$1.length, string$1);
2901
2901
  Object.defineProperties(this, {
2902
2902
  original: {
@@ -2933,11 +2933,11 @@ var MagicString = class MagicString {
2933
2933
  },
2934
2934
  filename: {
2935
2935
  writable: true,
2936
- value: options$6.filename
2936
+ value: options$7.filename
2937
2937
  },
2938
2938
  indentExclusionRanges: {
2939
2939
  writable: true,
2940
- value: options$6.indentExclusionRanges
2940
+ value: options$7.indentExclusionRanges
2941
2941
  },
2942
2942
  sourcemapLocations: {
2943
2943
  writable: true,
@@ -2953,11 +2953,11 @@ var MagicString = class MagicString {
2953
2953
  },
2954
2954
  ignoreList: {
2955
2955
  writable: true,
2956
- value: options$6.ignoreList
2956
+ value: options$7.ignoreList
2957
2957
  },
2958
2958
  offset: {
2959
2959
  writable: true,
2960
- value: options$6.offset || 0
2960
+ value: options$7.offset || 0
2961
2961
  }
2962
2962
  });
2963
2963
  this.byStart[0] = chunk;
@@ -3015,11 +3015,11 @@ else this.outro += content;
3015
3015
  cloned.outro = this.outro;
3016
3016
  return cloned;
3017
3017
  }
3018
- generateDecodedMap(options$6) {
3019
- options$6 = options$6 || {};
3018
+ generateDecodedMap(options$7) {
3019
+ options$7 = options$7 || {};
3020
3020
  const sourceIndex = 0;
3021
3021
  const names = Object.keys(this.storedNames);
3022
- const mappings = new Mappings(options$6.hires);
3022
+ const mappings = new Mappings(options$7.hires);
3023
3023
  const locate = getLocator(this.original);
3024
3024
  if (this.intro) mappings.advance(this.intro);
3025
3025
  this.firstChunk.eachNext((chunk) => {
@@ -3030,16 +3030,16 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
3030
3030
  if (chunk.outro.length) mappings.advance(chunk.outro);
3031
3031
  });
3032
3032
  return {
3033
- file: options$6.file ? options$6.file.split(/[/\\]/).pop() : undefined,
3034
- sources: [options$6.source ? getRelativePath(options$6.file || "", options$6.source) : options$6.file || ""],
3035
- sourcesContent: options$6.includeContent ? [this.original] : undefined,
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,
3036
3036
  names,
3037
3037
  mappings: mappings.raw,
3038
3038
  x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
3039
3039
  };
3040
3040
  }
3041
- generateMap(options$6) {
3042
- return new SourceMap(this.generateDecodedMap(options$6));
3041
+ generateMap(options$7) {
3042
+ return new SourceMap(this.generateDecodedMap(options$7));
3043
3043
  }
3044
3044
  _ensureindentStr() {
3045
3045
  if (this.indentStr === undefined) this.indentStr = guessIndent(this.original);
@@ -3052,10 +3052,10 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
3052
3052
  this._ensureindentStr();
3053
3053
  return this.indentStr === null ? " " : this.indentStr;
3054
3054
  }
3055
- indent(indentStr, options$6) {
3055
+ indent(indentStr, options$7) {
3056
3056
  const pattern = /^[^\r\n]/gm;
3057
3057
  if (isObject(indentStr)) {
3058
- options$6 = indentStr;
3058
+ options$7 = indentStr;
3059
3059
  indentStr = undefined;
3060
3060
  }
3061
3061
  if (indentStr === undefined) {
@@ -3063,15 +3063,15 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
3063
3063
  indentStr = this.indentStr || " ";
3064
3064
  }
3065
3065
  if (indentStr === "") return this;
3066
- options$6 = options$6 || {};
3066
+ options$7 = options$7 || {};
3067
3067
  const isExcluded = {};
3068
- if (options$6.exclude) {
3069
- const exclusions = typeof options$6.exclude[0] === "number" ? [options$6.exclude] : options$6.exclude;
3068
+ if (options$7.exclude) {
3069
+ const exclusions = typeof options$7.exclude[0] === "number" ? [options$7.exclude] : options$7.exclude;
3070
3070
  exclusions.forEach((exclusion) => {
3071
3071
  for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
3072
3072
  });
3073
3073
  }
3074
- let shouldIndentNextCharacter = options$6.indentStart !== false;
3074
+ let shouldIndentNextCharacter = options$7.indentStart !== false;
3075
3075
  const replacer = (match) => {
3076
3076
  if (shouldIndentNextCharacter) return `${indentStr}${match}`;
3077
3077
  shouldIndentNextCharacter = true;
@@ -3159,14 +3159,14 @@ else {
3159
3159
  if (!newRight) this.lastChunk = last;
3160
3160
  return this;
3161
3161
  }
3162
- overwrite(start, end, content, options$6) {
3163
- options$6 = options$6 || {};
3162
+ overwrite(start, end, content, options$7) {
3163
+ options$7 = options$7 || {};
3164
3164
  return this.update(start, end, content, {
3165
- ...options$6,
3166
- overwrite: !options$6.contentOnly
3165
+ ...options$7,
3166
+ overwrite: !options$7.contentOnly
3167
3167
  });
3168
3168
  }
3169
- update(start, end, content, options$6) {
3169
+ update(start, end, content, options$7) {
3170
3170
  start = start + this.offset;
3171
3171
  end = end + this.offset;
3172
3172
  if (typeof content !== "string") throw new TypeError("replacement content must be a string");
@@ -3178,15 +3178,15 @@ else {
3178
3178
  if (start === end) throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
3179
3179
  this._split(start);
3180
3180
  this._split(end);
3181
- if (options$6 === true) {
3181
+ if (options$7 === true) {
3182
3182
  if (!warned.storeName) {
3183
3183
  console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
3184
3184
  warned.storeName = true;
3185
3185
  }
3186
- options$6 = { storeName: true };
3186
+ options$7 = { storeName: true };
3187
3187
  }
3188
- const storeName = options$6 !== undefined ? options$6.storeName : false;
3189
- const overwrite = options$6 !== undefined ? options$6.overwrite : false;
3188
+ const storeName = options$7 !== undefined ? options$7.storeName : false;
3189
+ const overwrite = options$7 !== undefined ? options$7.overwrite : false;
3190
3190
  if (storeName) {
3191
3191
  const original = this.original.slice(start, end);
3192
3192
  Object.defineProperty(this.storedNames, original, {
@@ -3517,7 +3517,7 @@ const TABLE_TYPE = {
3517
3517
  };
3518
3518
  let drizzleDialect;
3519
3519
  let schemaPath;
3520
- const options$4 = defineAddonOptions({ demo: {
3520
+ const options$5 = defineAddonOptions({ demo: {
3521
3521
  type: "boolean",
3522
3522
  default: true,
3523
3523
  question: `Do you want to include a demo? ${colors.dim("(includes a login/register page)")}`
@@ -3526,17 +3526,17 @@ var lucia_default = defineAddon({
3526
3526
  id: "lucia",
3527
3527
  shortDescription: "auth guide",
3528
3528
  homepage: "https://lucia-auth.com",
3529
- options: options$4,
3529
+ options: options$5,
3530
3530
  setup: ({ kit, dependencyVersion, unsupported, dependsOn, runsAfter }) => {
3531
3531
  if (!kit) unsupported("Requires SvelteKit");
3532
3532
  if (!dependencyVersion("drizzle-orm")) dependsOn("drizzle");
3533
3533
  runsAfter("tailwindcss");
3534
3534
  },
3535
- run: ({ sv, typescript, options: options$6, kit, dependencyVersion }) => {
3535
+ run: ({ sv, typescript, options: options$7, kit, dependencyVersion }) => {
3536
3536
  const ext = typescript ? "ts" : "js";
3537
3537
  sv.dependency("@oslojs/crypto", "^1.0.1");
3538
3538
  sv.dependency("@oslojs/encoding", "^1.1.0");
3539
- if (options$6.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
3539
+ if (options$7.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
3540
3540
  sv.file(`drizzle.config.${ext}`, (content) => {
3541
3541
  const { ast, generateCode } = parseScript$1(content);
3542
3542
  const isProp = (name$1, node) => node.key.type === "Identifier" && node.key.name === name$1;
@@ -3570,7 +3570,7 @@ var lucia_default = defineAddon({
3570
3570
  integer: "integer"
3571
3571
  });
3572
3572
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
3573
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
3573
+ if (options$7.demo) object_exports.overrideProperties(userAttributes, {
3574
3574
  username: common_exports.expressionFromString("text('username').notNull().unique()"),
3575
3575
  passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
3576
3576
  });
@@ -3587,7 +3587,7 @@ var lucia_default = defineAddon({
3587
3587
  datetime: "datetime"
3588
3588
  });
3589
3589
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("varchar('id', { length: 255 }).primaryKey()") });
3590
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
3590
+ if (options$7.demo) object_exports.overrideProperties(userAttributes, {
3591
3591
  username: common_exports.expressionFromString("varchar('username', { length: 32 }).notNull().unique()"),
3592
3592
  passwordHash: common_exports.expressionFromString("varchar('password_hash', { length: 255 }).notNull()")
3593
3593
  });
@@ -3604,7 +3604,7 @@ var lucia_default = defineAddon({
3604
3604
  timestamp: "timestamp"
3605
3605
  });
3606
3606
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
3607
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
3607
+ if (options$7.demo) object_exports.overrideProperties(userAttributes, {
3608
3608
  username: common_exports.expressionFromString("text('username').notNull().unique()"),
3609
3609
  passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
3610
3610
  });
@@ -3757,7 +3757,7 @@ var lucia_default = defineAddon({
3757
3757
  kit_exports.addHooksHandle(ast, typescript, "handleAuth", getAuthHandleContent());
3758
3758
  return generateCode();
3759
3759
  });
3760
- if (options$6.demo) {
3760
+ if (options$7.demo) {
3761
3761
  sv.file(`${kit?.routesDirectory}/demo/+page.svelte`, (content) => {
3762
3762
  return addToDemoPage(content, "lucia");
3763
3763
  });
@@ -3991,9 +3991,9 @@ var lucia_default = defineAddon({
3991
3991
  });
3992
3992
  }
3993
3993
  },
3994
- nextSteps: ({ highlighter, options: options$6, packageManager }) => {
3994
+ nextSteps: ({ highlighter, options: options$7, packageManager }) => {
3995
3995
  const steps = [`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`];
3996
- if (options$6.demo) steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
3996
+ if (options$7.demo) steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
3997
3997
  return steps;
3998
3998
  }
3999
3999
  });
@@ -4125,7 +4125,7 @@ const DEFAULT_INLANG_PROJECT = {
4125
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"],
4126
4126
  "plugin.inlang.messageFormat": { pathPattern: "./messages/{locale}.json" }
4127
4127
  };
4128
- const options$3 = defineAddonOptions({
4128
+ const options$4 = defineAddonOptions({
4129
4129
  languageTags: {
4130
4130
  question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
4131
4131
  type: "string",
@@ -4155,11 +4155,11 @@ var paraglide_default = defineAddon({
4155
4155
  id: "paraglide",
4156
4156
  shortDescription: "i18n",
4157
4157
  homepage: "https://inlang.com/m/gerre34r/library-inlang-paraglideJs",
4158
- options: options$3,
4158
+ options: options$4,
4159
4159
  setup: ({ kit, unsupported }) => {
4160
4160
  if (!kit) unsupported("Requires SvelteKit");
4161
4161
  },
4162
- run: ({ sv, options: options$6, typescript, kit }) => {
4162
+ run: ({ sv, options: options$7, typescript, kit }) => {
4163
4163
  const ext = typescript ? "ts" : "js";
4164
4164
  if (!kit) throw new Error("SvelteKit is required");
4165
4165
  const paraglideOutDir = "src/lib/paraglide";
@@ -4168,7 +4168,7 @@ var paraglide_default = defineAddon({
4168
4168
  if (content) return content;
4169
4169
  const { data, generateCode } = parseJson$1(content);
4170
4170
  for (const key in DEFAULT_INLANG_PROJECT) data[key] = DEFAULT_INLANG_PROJECT[key];
4171
- const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.languageTags);
4171
+ const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$7.languageTags);
4172
4172
  const baseLocale = validLanguageTags$1[0];
4173
4173
  data.baseLocale = baseLocale;
4174
4174
  data.locales = validLanguageTags$1;
@@ -4229,7 +4229,7 @@ var paraglide_default = defineAddon({
4229
4229
  if (!content.includes(`\n${paraglideOutDir}`)) content = content.trimEnd() + `\n\n# Paraglide\n${paraglideOutDir}`;
4230
4230
  return content;
4231
4231
  });
4232
- if (options$6.demo) {
4232
+ if (options$7.demo) {
4233
4233
  sv.file(`${kit.routesDirectory}/demo/+page.svelte`, (content) => {
4234
4234
  return addToDemoPage(content, "paraglide");
4235
4235
  });
@@ -4242,7 +4242,7 @@ var paraglide_default = defineAddon({
4242
4242
  const scriptCode = new MagicString(script.generateCode());
4243
4243
  const templateCode = new MagicString(template.source);
4244
4244
  templateCode.append("\n\n<h1>{m.hello_world({ name: 'SvelteKit User' })}</h1>\n");
4245
- const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.languageTags);
4245
+ const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$7.languageTags);
4246
4246
  const links = validLanguageTags$1.map((x$2) => `${templateCode.getIndentString()}<button onclick={() => setLocale('${x$2}')}>${x$2}</button>`).join("\n");
4247
4247
  templateCode.append(`<div>\n${links}\n</div>`);
4248
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>");
@@ -4252,7 +4252,7 @@ var paraglide_default = defineAddon({
4252
4252
  });
4253
4253
  });
4254
4254
  }
4255
- const { validLanguageTags } = parseLanguageTagInput(options$6.languageTags);
4255
+ const { validLanguageTags } = parseLanguageTagInput(options$7.languageTags);
4256
4256
  for (const languageTag of validLanguageTags) sv.file(`messages/${languageTag}.json`, (content) => {
4257
4257
  const { data, generateCode } = parseJson$1(content);
4258
4258
  data["$schema"] = "https://inlang.com/schema/inlang-message-format";
@@ -4262,7 +4262,7 @@ var paraglide_default = defineAddon({
4262
4262
  },
4263
4263
  nextSteps: ({ highlighter }) => {
4264
4264
  const steps = [`Edit your messages in ${highlighter.path("messages/en.json")}`];
4265
- if (options$3.demo) steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
4265
+ if (options$4.demo) steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
4266
4266
  return steps;
4267
4267
  }
4268
4268
  });
@@ -4468,7 +4468,7 @@ const adapters = [
4468
4468
  version: "^5.0.0"
4469
4469
  }
4470
4470
  ];
4471
- const options$2 = defineAddonOptions({ adapter: {
4471
+ const options$3 = defineAddonOptions({ adapter: {
4472
4472
  type: "select",
4473
4473
  question: "Which SvelteKit adapter would you like to use?",
4474
4474
  options: adapters.map((p$1) => ({
@@ -4483,12 +4483,12 @@ var sveltekit_adapter_default = defineAddon({
4483
4483
  alias: "adapter",
4484
4484
  shortDescription: "deployment",
4485
4485
  homepage: "https://svelte.dev/docs/kit/adapters",
4486
- options: options$2,
4486
+ options: options$3,
4487
4487
  setup: ({ kit, unsupported }) => {
4488
4488
  if (!kit) unsupported("Requires SvelteKit");
4489
4489
  },
4490
- run: ({ sv, options: options$6 }) => {
4491
- const adapter = adapters.find((a) => a.id === options$6.adapter);
4490
+ run: ({ sv, options: options$7 }) => {
4491
+ const adapter = adapters.find((a) => a.id === options$7.adapter);
4492
4492
  sv.file("package.json", (content) => {
4493
4493
  const { data, generateCode } = parseJson$1(content);
4494
4494
  const devDeps = data["devDependencies"];
@@ -4531,7 +4531,7 @@ const plugins = [{
4531
4531
  version: "^0.5.9",
4532
4532
  identifier: "forms"
4533
4533
  }];
4534
- const options$1 = defineAddonOptions({ plugins: {
4534
+ const options$2 = defineAddonOptions({ plugins: {
4535
4535
  type: "multiselect",
4536
4536
  question: "Which plugins would you like to add?",
4537
4537
  options: plugins.map((p$1) => ({
@@ -4539,22 +4539,23 @@ const options$1 = defineAddonOptions({ plugins: {
4539
4539
  label: p$1.id,
4540
4540
  hint: p$1.package
4541
4541
  })),
4542
- default: []
4542
+ default: [],
4543
+ required: false
4543
4544
  } });
4544
4545
  var tailwindcss_default = defineAddon({
4545
4546
  id: "tailwindcss",
4546
4547
  alias: "tailwind",
4547
4548
  shortDescription: "css framework",
4548
4549
  homepage: "https://tailwindcss.com",
4549
- options: options$1,
4550
- run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
4550
+ options: options$2,
4551
+ run: ({ sv, options: options$7, typescript, kit, dependencyVersion }) => {
4551
4552
  const ext = typescript ? "ts" : "js";
4552
4553
  const prettierInstalled = Boolean(dependencyVersion("prettier"));
4553
4554
  sv.devDependency("tailwindcss", "^4.0.0");
4554
4555
  sv.devDependency("@tailwindcss/vite", "^4.0.0");
4555
4556
  if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.6.11");
4556
4557
  for (const plugin of plugins) {
4557
- if (!options$6.plugins.includes(plugin.id)) continue;
4558
+ if (!options$7.plugins.includes(plugin.id)) continue;
4558
4559
  sv.devDependency(plugin.package, plugin.version);
4559
4560
  }
4560
4561
  sv.file(`vite.config.${ext}`, (content) => {
@@ -4580,7 +4581,7 @@ var tailwindcss_default = defineAddon({
4580
4581
  const lastAtRule = atRules.findLast((rule) => ["plugin", "import"].includes(rule.name));
4581
4582
  const pluginPos = lastAtRule.source.end.offset;
4582
4583
  for (const plugin of plugins) {
4583
- if (!options$6.plugins.includes(plugin.id)) continue;
4584
+ if (!options$7.plugins.includes(plugin.id)) continue;
4584
4585
  const pluginRule = findAtRule("plugin", plugin.package);
4585
4586
  if (!pluginRule) {
4586
4587
  const pluginImport = `\n@plugin '${plugin.package}';`;
@@ -4620,17 +4621,34 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
4620
4621
 
4621
4622
  //#endregion
4622
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
+ } });
4623
4637
  var vitest_addon_default = defineAddon({
4624
4638
  id: "vitest",
4625
4639
  shortDescription: "unit testing",
4626
4640
  homepage: "https://vitest.dev",
4627
- options: {},
4628
- run: ({ sv, typescript, kit }) => {
4641
+ options: options$1,
4642
+ run: ({ sv, typescript, kit, options: options$7 }) => {
4629
4643
  const ext = typescript ? "ts" : "js";
4644
+ const unitTesting = options$7.usages.includes("unit");
4645
+ const componentTesting = options$7.usages.includes("component");
4630
4646
  sv.devDependency("vitest", "^3.2.3");
4631
- sv.devDependency("@testing-library/svelte", "^5.2.4");
4632
- sv.devDependency("@testing-library/jest-dom", "^6.6.3");
4633
- sv.devDependency("jsdom", "^26.0.0");
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
+ }
4634
4652
  sv.file("package.json", (content) => {
4635
4653
  const { data, generateCode } = parseJson$1(content);
4636
4654
  data.scripts ??= {};
@@ -4642,96 +4660,71 @@ var vitest_addon_default = defineAddon({
4642
4660
  if (!scripts$1["test"].includes(RUN_TEST)) scripts$1["test"] += ` && ${RUN_TEST}`;
4643
4661
  return generateCode();
4644
4662
  });
4645
- sv.file(`src/demo.spec.${ext}`, (content) => {
4663
+ if (unitTesting) sv.file(`src/demo.spec.${ext}`, (content) => {
4646
4664
  if (content) return content;
4647
4665
  return dedent_default`
4648
- import { describe, it, expect } from 'vitest';
4649
-
4650
- describe('sum test', () => {
4651
- it('adds 1 + 2 to equal 3', () => {
4652
- expect(1 + 2).toBe(3);
4653
- });
4654
- });
4655
- `;
4656
- });
4657
- if (kit) sv.file(`${kit.routesDirectory}/page.svelte.test.${ext}`, (content) => {
4658
- if (content) return content;
4659
- return dedent_default`
4660
- import { describe, test, expect } from 'vitest';
4661
- import '@testing-library/jest-dom/vitest';
4662
- import { render, screen } from '@testing-library/svelte';
4663
- import Page from './+page.svelte';
4666
+ import { describe, it, expect } from 'vitest';
4664
4667
 
4665
- describe('/+page.svelte', () => {
4666
- test('should render h1', () => {
4667
- render(Page);
4668
- expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument();
4669
- });
4668
+ describe('sum test', () => {
4669
+ it('adds 1 + 2 to equal 3', () => {
4670
+ expect(1 + 2).toBe(3);
4670
4671
  });
4671
- `;
4672
+ });
4673
+ `;
4672
4674
  });
4673
- else sv.file(`src/App.svelte.test.${ext}`, (content) => {
4674
- if (content) return content;
4675
- return dedent_default`
4676
- import { describe, test, expect } from 'vitest';
4677
- import '@testing-library/jest-dom/vitest';
4678
- import { render, screen } from '@testing-library/svelte';
4679
- import App from './App.svelte';
4680
-
4681
- describe('App.svelte', () => {
4682
- test('should render h1', () => {
4683
- render(App);
4684
- expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument();
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();
4685
4691
  });
4686
4692
  });
4687
4693
  `;
4688
- });
4689
- sv.file(`vitest-setup-client.${ext}`, (content) => {
4690
- if (content) return content;
4691
- return dedent_default`
4692
- import '@testing-library/jest-dom/vitest';
4693
- import { vi } from 'vitest';
4694
-
4695
- // required for svelte5 + jsdom as jsdom does not support matchMedia
4696
- Object.defineProperty(window, 'matchMedia', {
4697
- writable: true,
4698
- enumerable: true,
4699
- value: vi.fn().mockImplementation(query => ({
4700
- matches: false,
4701
- media: query,
4702
- onchange: null,
4703
- addEventListener: vi.fn(),
4704
- removeEventListener: vi.fn(),
4705
- dispatchEvent: vi.fn(),
4706
- })),
4707
- })
4708
-
4709
- // 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" />
4710
4700
  `;
4711
- });
4701
+ });
4702
+ }
4712
4703
  sv.file(`vite.config.${ext}`, (content) => {
4713
4704
  const { ast, generateCode } = parseScript$1(content);
4714
- imports_exports.addNamed(ast, "@testing-library/svelte/vite", { svelteTesting: "svelteTesting" });
4715
- const clientObjectExpression = object_exports.create({
4716
- extends: common_exports.createLiteral(`./vite.config.${ext}`),
4717
- plugins: common_exports.expressionFromString("[svelteTesting()]"),
4718
- test: object_exports.create({
4719
- name: common_exports.createLiteral("client"),
4720
- environment: common_exports.createLiteral("jsdom"),
4721
- clearMocks: common_exports.expressionFromString("true"),
4722
- include: common_exports.expressionFromString("['src/**/*.svelte.{test,spec}.{js,ts}']"),
4723
- exclude: common_exports.expressionFromString("['src/lib/server/**']"),
4724
- setupFiles: common_exports.expressionFromString(`['./vitest-setup-client.${ext}']`)
4725
- })
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
+ }
4726
4719
  });
4727
- const serverObjectExpression = object_exports.create({
4728
- extends: common_exports.createLiteral(`./vite.config.${ext}`),
4729
- test: object_exports.create({
4730
- name: common_exports.createLiteral("server"),
4731
- environment: common_exports.createLiteral("node"),
4732
- include: common_exports.expressionFromString("['src/**/*.{test,spec}.{js,ts}']"),
4733
- exclude: common_exports.expressionFromString("['src/**/*.svelte.{test,spec}.{js,ts}']")
4734
- })
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
+ }
4735
4728
  });
4736
4729
  const defineConfigFallback = function_exports.call("defineConfig", []);
4737
4730
  const { value: defineWorkspaceCall } = exports_exports.defaultExport(ast, defineConfigFallback);
@@ -4739,8 +4732,8 @@ else sv.file(`src/App.svelte.test.${ext}`, (content) => {
4739
4732
  const vitestConfig = function_exports.argumentByIndex(defineWorkspaceCall, 0, object_exports.createEmpty());
4740
4733
  const testObject = object_exports.property(vitestConfig, "test", object_exports.createEmpty());
4741
4734
  const workspaceArray = object_exports.property(testObject, "projects", array_exports.createEmpty());
4742
- array_exports.push(workspaceArray, clientObjectExpression);
4743
- array_exports.push(workspaceArray, serverObjectExpression);
4735
+ if (componentTesting) array_exports.push(workspaceArray, clientObjectExpression);
4736
+ if (unitTesting) array_exports.push(workspaceArray, serverObjectExpression);
4744
4737
  return generateCode();
4745
4738
  });
4746
4739
  }
@@ -4881,14 +4874,14 @@ function verifyPackage(pkg, specifier) {
4881
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`);
4882
4875
  }
4883
4876
  }
4884
- async function downloadPackage(options$6) {
4885
- const { pkg } = options$6;
4886
- if (options$6.path) {
4877
+ async function downloadPackage(options$7) {
4878
+ const { pkg } = options$7;
4879
+ if (options$7.path) {
4887
4880
  const dest = path.join(NODE_MODULES, pkg.name.split("/").join(path.sep));
4888
4881
  if (fs.existsSync(dest)) fs.rmSync(dest);
4889
4882
  const dir = path.dirname(dest);
4890
4883
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
4891
- fs.symlinkSync(options$6.path, dest);
4884
+ fs.symlinkSync(options$7.path, dest);
4892
4885
  const { default: details$1 } = await import(pkg.name);
4893
4886
  return details$1;
4894
4887
  }
@@ -5025,10 +5018,10 @@ const add = new Command("add").description("applies specified add-ons into a pro
5025
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').`);
5026
5019
  process$1.exit(1);
5027
5020
  }
5028
- const options$6 = optionFlags.match(/[^+]*:[^:]*(?=\+|$)/g) ?? [];
5021
+ const options$7 = optionFlags.match(/[^+]*:[^:]*(?=\+|$)/g) ?? [];
5029
5022
  prev.push({
5030
5023
  id: addonId,
5031
- options: options$6
5024
+ options: options$7
5032
5025
  });
5033
5026
  return prev;
5034
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({
@@ -5101,19 +5094,19 @@ const add = new Command("add").description("applies specified add-ons into a pro
5101
5094
  console.error(`Invalid add-ons specified: ${invalidAddons.join(", ")}`);
5102
5095
  process$1.exit(1);
5103
5096
  }
5104
- const options$6 = parse(OptionsSchema$1, {
5097
+ const options$7 = parse(OptionsSchema$1, {
5105
5098
  ...opts,
5106
5099
  addons: {}
5107
5100
  });
5108
5101
  const selectedAddons = transformAliases(addonArgs);
5109
- selectedAddons.forEach((addon) => options$6.addons[addon.id] = addon.options);
5102
+ selectedAddons.forEach((addon) => options$7.addons[addon.id] = addon.options);
5110
5103
  runCommand(async () => {
5111
5104
  const selectedAddonIds = selectedAddons.map(({ id }) => id);
5112
- const { nextSteps } = await runAddCommand(options$6, selectedAddonIds, "add");
5105
+ const { nextSteps } = await runAddCommand(options$7, selectedAddonIds, "add");
5113
5106
  if (nextSteps) Ke(nextSteps, "Next steps", { format: (line) => line });
5114
5107
  });
5115
5108
  });
5116
- async function runAddCommand(options$6, selectedAddonIds, from$1) {
5109
+ async function runAddCommand(options$7, selectedAddonIds, from$1) {
5117
5110
  const selectedAddons = selectedAddonIds.map((id) => ({
5118
5111
  type: "official",
5119
5112
  addon: getAddonDetails(id)
@@ -5122,7 +5115,7 @@ async function runAddCommand(options$6, selectedAddonIds, from$1) {
5122
5115
  const community = {};
5123
5116
  for (const addonOption of addonOptions) {
5124
5117
  const addonId = addonOption.id;
5125
- const specifiedOptions = options$6.addons[addonId];
5118
+ const specifiedOptions = options$7.addons[addonId];
5126
5119
  if (!specifiedOptions) continue;
5127
5120
  const details$1 = getAddonDetails(addonId);
5128
5121
  if (!selectedAddons.find((d$1) => d$1.addon === details$1)) selectedAddons.push({
@@ -5152,7 +5145,7 @@ else official[addonId][questionId] = optionValue;
5152
5145
  for (const [id, question] of Object.entries(details$1.options)) if (question.condition?.(official[addonId]) !== false) official[addonId][id] ??= question.default;
5153
5146
  else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${addonId}' option specified: '${official[addonId][id]}'`);
5154
5147
  }
5155
- if (options$6.community === true) {
5148
+ if (options$7.community === true) {
5156
5149
  const communityAddons = await Promise.all(communityAddonIds.map(async (id) => await getCommunityAddon(id)));
5157
5150
  const promptOptions = communityAddons.map((addon) => ({
5158
5151
  value: addon.id,
@@ -5171,10 +5164,10 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
5171
5164
  De("No add-ons selected. Exiting.");
5172
5165
  process$1.exit(1);
5173
5166
  }
5174
- options$6.community = selected;
5167
+ options$7.community = selected;
5175
5168
  }
5176
- if (Array.isArray(options$6.community) && options$6.community.length > 0) {
5177
- const addons = options$6.community.map((id) => {
5169
+ if (Array.isArray(options$7.community) && options$7.community.length > 0) {
5170
+ const addons = options$7.community.map((id) => {
5178
5171
  const hasDirective = Object.values(Directive).some((directive) => id.startsWith(directive));
5179
5172
  if (hasDirective) return id;
5180
5173
  const validAddon = communityAddonIds.includes(id);
@@ -5186,7 +5179,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
5186
5179
  start("Resolving community add-on packages");
5187
5180
  const pkgs = await Promise.all(addons.map(async (id) => {
5188
5181
  return await getPackageJSON({
5189
- cwd: options$6.cwd,
5182
+ cwd: options$7.cwd,
5190
5183
  packageName: id
5191
5184
  });
5192
5185
  }));
@@ -5223,7 +5216,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
5223
5216
  throw err;
5224
5217
  }
5225
5218
  }
5226
- let workspace = await createWorkspace({ cwd: options$6.cwd });
5219
+ let workspace = await createWorkspace({ cwd: options$7.cwd });
5227
5220
  const setups = selectedAddons.length ? selectedAddons.map(({ addon }) => addon) : officialAddons;
5228
5221
  const addonSetupResults = setupAddons(setups, workspace);
5229
5222
  const initialValues = Object.entries(addonSetupResults).filter(([_$1, value]) => value.defaultSelection[from$1] === true).map(([key]) => key);
@@ -5269,9 +5262,9 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
5269
5262
  });
5270
5263
  }
5271
5264
  }
5272
- if (options$6.preconditions && selectedAddons.length > 0) {
5265
+ if (options$7.preconditions && selectedAddons.length > 0) {
5273
5266
  const addons = selectedAddons.map(({ addon }) => addon);
5274
- const { preconditions } = getGlobalPreconditions(options$6.cwd, addons, addonSetupResults);
5267
+ const { preconditions } = getGlobalPreconditions(options$7.cwd, addons, addonSetupResults);
5275
5268
  const fails = [];
5276
5269
  for (const condition of preconditions) {
5277
5270
  const { message, success } = await condition.run();
@@ -5322,7 +5315,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
5322
5315
  if (question.type === "multiselect") answer = await Ue({
5323
5316
  message,
5324
5317
  initialValues: question.default,
5325
- required: false,
5318
+ required: question.required,
5326
5319
  options: question.options
5327
5320
  });
5328
5321
  if (question.type === "string" || question.type === "number") {
@@ -5354,12 +5347,12 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
5354
5347
  });
5355
5348
  T.success("Successfully setup add-ons");
5356
5349
  let packageManager;
5357
- if (options$6.install) {
5358
- packageManager = options$6.install === true ? await packageManagerPrompt(options$6.cwd) : options$6.install;
5350
+ if (options$7.install) {
5351
+ packageManager = options$7.install === true ? await packageManagerPrompt(options$7.cwd) : options$7.install;
5359
5352
  if (packageManager) {
5360
5353
  workspace.packageManager = packageManager;
5361
5354
  addPnpmBuildDependencies(workspace.cwd, packageManager, ["esbuild", ...addonPnpmBuildDependencies]);
5362
- await installDependencies(packageManager, options$6.cwd);
5355
+ await installDependencies(packageManager, options$7.cwd);
5363
5356
  }
5364
5357
  }
5365
5358
  workspace = await createWorkspace(workspace);
@@ -5369,7 +5362,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
5369
5362
  try {
5370
5363
  await formatFiles({
5371
5364
  packageManager,
5372
- cwd: options$6.cwd,
5365
+ cwd: options$7.cwd,
5373
5366
  paths: filesToFormat
5374
5367
  });
5375
5368
  stop("Successfully formatted modified files");
@@ -5410,7 +5403,7 @@ function transformAliases(addons) {
5410
5403
  return Array.from(set.values());
5411
5404
  }
5412
5405
  function getAddonOptionFlags() {
5413
- const options$6 = [];
5406
+ const options$7 = [];
5414
5407
  for (const addon of officialAddons) {
5415
5408
  const id = addon.id;
5416
5409
  const details = getAddonDetails(id);
@@ -5418,47 +5411,47 @@ function getAddonOptionFlags() {
5418
5411
  const { defaults, groups } = getOptionChoices(details);
5419
5412
  const choices = Object.entries(groups).map(([group, choices$1]) => `${import_picocolors$2.default.dim(`${group}:`)} ${choices$1.join(", ")}`).join("\n");
5420
5413
  const preset = defaults.join(", ") || "none";
5421
- options$6.push({
5414
+ options$7.push({
5422
5415
  id,
5423
5416
  choices,
5424
5417
  preset
5425
5418
  });
5426
5419
  }
5427
- return options$6;
5420
+ return options$7;
5428
5421
  }
5429
5422
  function getOptionChoices(details) {
5430
5423
  const choices = [];
5431
5424
  const defaults = [];
5432
5425
  const groups = {};
5433
- const options$6 = {};
5426
+ const options$7 = {};
5434
5427
  for (const [id, question] of Object.entries(details.options)) {
5435
5428
  let values = [];
5436
- const applyDefault = question.condition?.(options$6) !== false;
5429
+ const applyDefault = question.condition?.(options$7) !== false;
5437
5430
  if (question.type === "boolean") {
5438
5431
  values = ["yes", `no`];
5439
5432
  if (applyDefault) {
5440
- options$6[id] = question.default;
5433
+ options$7[id] = question.default;
5441
5434
  defaults.push(question.default ? values[0] : values[1]);
5442
5435
  }
5443
5436
  }
5444
5437
  if (question.type === "select") {
5445
5438
  values = question.options.map((o$1) => o$1.value);
5446
5439
  if (applyDefault) {
5447
- options$6[id] = question.default;
5440
+ options$7[id] = question.default;
5448
5441
  defaults.push(question.default);
5449
5442
  }
5450
5443
  }
5451
5444
  if (question.type === "multiselect") {
5452
5445
  values = question.options.map((o$1) => o$1.value);
5453
5446
  if (applyDefault) {
5454
- options$6[id] = question.default;
5447
+ options$7[id] = question.default;
5455
5448
  defaults.push(...question.default);
5456
5449
  }
5457
5450
  }
5458
5451
  if (question.type === "string" || question.type === "number") {
5459
5452
  values = ["<user-input>"];
5460
5453
  if (applyDefault) {
5461
- options$6[id] = question.default;
5454
+ options$7[id] = question.default;
5462
5455
  defaults.push(question.default.toString());
5463
5456
  }
5464
5457
  }
@@ -5495,9 +5488,9 @@ const OptionsSchema = strictObject({
5495
5488
  });
5496
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) => {
5497
5490
  const cwd = parse(ProjectPathSchema, projectPath);
5498
- const options$6 = parse(OptionsSchema, opts);
5491
+ const options$7 = parse(OptionsSchema, opts);
5499
5492
  runCommand(async () => {
5500
- const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$6);
5493
+ const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$7);
5501
5494
  const highlight = (str) => import_picocolors$1.default.bold(import_picocolors$1.default.cyan(str));
5502
5495
  let i = 1;
5503
5496
  const initialSteps = [];
@@ -5526,7 +5519,7 @@ const create$1 = new Command("create").description("scaffolds a new SvelteKit pr
5526
5519
  if (addOnNextSteps) Ke(addOnNextSteps, "Add-on next steps", { format: (line) => line });
5527
5520
  });
5528
5521
  });
5529
- async function createProject(cwd, options$6) {
5522
+ async function createProject(cwd, options$7) {
5530
5523
  const { directory, template, language } = await We({
5531
5524
  directory: () => {
5532
5525
  if (cwd) return Promise.resolve(path.resolve(cwd));
@@ -5550,7 +5543,7 @@ async function createProject(cwd, options$6) {
5550
5543
  }
5551
5544
  },
5552
5545
  template: () => {
5553
- if (options$6.template) return Promise.resolve(options$6.template);
5546
+ if (options$7.template) return Promise.resolve(options$7.template);
5554
5547
  return ze({
5555
5548
  message: "Which template would you like?",
5556
5549
  initialValue: "minimal",
@@ -5562,7 +5555,7 @@ async function createProject(cwd, options$6) {
5562
5555
  });
5563
5556
  },
5564
5557
  language: () => {
5565
- if (options$6.types) return Promise.resolve(options$6.types);
5558
+ if (options$7.types) return Promise.resolve(options$7.types);
5566
5559
  return ze({
5567
5560
  message: "Add type checking with TypeScript?",
5568
5561
  initialValue: "typescript",
@@ -5600,18 +5593,18 @@ async function createProject(cwd, options$6) {
5600
5593
  addPnpmBuildDependencies(projectPath, packageManager, ["esbuild"]);
5601
5594
  if (packageManager) await installDependencies(packageManager, projectPath);
5602
5595
  };
5603
- if (options$6.addOns) {
5596
+ if (options$7.addOns) {
5604
5597
  const { nextSteps, packageManager: pm } = await runAddCommand({
5605
5598
  cwd: projectPath,
5606
- install: options$6.install,
5599
+ install: options$7.install,
5607
5600
  preconditions: false,
5608
5601
  community: [],
5609
5602
  addons: {}
5610
5603
  }, [], "create");
5611
5604
  packageManager = pm;
5612
5605
  addOnNextSteps = nextSteps;
5613
- } else if (options$6.install) await installDeps(options$6.install);
5614
- if (packageManager === null && options$6.install) await installDeps(options$6.install);
5606
+ } else if (options$7.install) await installDeps(options$7.install);
5607
+ if (packageManager === null && options$7.install) await installDeps(options$7.install);
5615
5608
  return {
5616
5609
  directory: projectPath,
5617
5610
  addOnNextSteps,
@@ -5624,8 +5617,8 @@ async function createProject(cwd, options$6) {
5624
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() {
5625
5618
  runMigrate(process$1.cwd(), ["--help"]);
5626
5619
  return "";
5627
- } }).action((migration, options$6) => {
5628
- runMigrate(options$6.cwd, [migration]);
5620
+ } }).action((migration, options$7) => {
5621
+ runMigrate(options$7.cwd, [migration]);
5629
5622
  });
5630
5623
  function runMigrate(cwd, args) {
5631
5624
  const pm = getUserAgent() ?? "npm";
@@ -5648,8 +5641,8 @@ var import_picocolors = __toESM(require_picocolors(), 1);
5648
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() {
5649
5642
  runCheck(process$1.cwd(), ["--help"]);
5650
5643
  return "";
5651
- } }).action((options$6, check$1) => {
5652
- const cwd = options$6.cwd;
5644
+ } }).action((options$7, check$1) => {
5645
+ const cwd = options$7.cwd;
5653
5646
  const args = check$1.args;
5654
5647
  runCheck(cwd, args);
5655
5648
  });
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { create } from "./package-manager-DmLyIAsB.js";
2
- import { installAddon } from "./install-BKjL-s_Q.js";
2
+ import { installAddon } from "./install-CDGqSUYA.js";
3
3
 
4
4
  export { create, installAddon };
@@ -90,7 +90,7 @@ else mindent = Math.min(mindent, indent);
90
90
  }
91
91
 
92
92
  //#endregion
93
- //#region packages/core/dist/common-DXNzjJGm.js
93
+ //#region packages/core/dist/common-BqRWA_Gj.js
94
94
  function decircular(object) {
95
95
  const seenObjects = new WeakMap();
96
96
  function internalDecircular(value, path$1 = []) {
@@ -286,6 +286,7 @@ var object_exports = {};
286
286
  __export(object_exports, {
287
287
  create: () => create,
288
288
  createEmpty: () => createEmpty,
289
+ createFromPrimitives: () => createFromPrimitives,
289
290
  overrideProperties: () => overrideProperties,
290
291
  overrideProperty: () => overrideProperty,
291
292
  properties: () => properties,
@@ -354,6 +355,23 @@ function create(obj) {
354
355
  }
355
356
  return objExpression;
356
357
  }
358
+ function createFromPrimitives(obj) {
359
+ const objExpression = createEmpty();
360
+ const getExpression = (value) => {
361
+ let expression;
362
+ if (Array.isArray(value)) {
363
+ expression = createEmpty$1();
364
+ for (const v of value) push(expression, getExpression(v));
365
+ } else if (typeof value === "object" && value !== null) expression = createFromPrimitives(value);
366
+ else expression = createLiteral(value);
367
+ return expression;
368
+ };
369
+ for (const [prop, value] of Object.entries(obj)) {
370
+ if (value === undefined) continue;
371
+ property(objExpression, prop, getExpression(value));
372
+ }
373
+ return objExpression;
374
+ }
357
375
  function createEmpty() {
358
376
  const objectExpression = {
359
377
  type: "ObjectExpression",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
4
4
  "type": "module",
5
5
  "description": "A CLI for creating and updating SvelteKit projects",
6
6
  "license": "MIT",