sv 0.6.17 → 0.6.19

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
- import { __commonJS, __require, __toESM, create, templates } from "./main-BRiePggL.js";
3
- import { AtRule, Element, __commonJS$1, __export, __toESM$1, addFromString, applyAddons, array_exports, box, cancel, common_exports, confirm, createWorkspace, dedent_default, detectSync, esm_exports, exports_exports, formatFiles, from, function_exports, getHighlighter, getUserAgent, group, imports_exports, installDependencies, intro, isCancel, kit_exports, log, multiselect, note, object_exports, outro, packageManagerPrompt, parseCss, parseHtml, parseHtml$1, parseJson, parseScript, parseSvelte, require_picocolors, resolveCommand, select, setupAddons, spinner, text, up, variables_exports, walk_exports } from "./install-Bcusf2sc.js";
2
+ import { AtRule, Element, __commonJS, __require, __toESM, addPnpmBuildDependendencies, box, cancel, confirm, create, detectSync, esm_exports, from, getUserAgent, group, installDependencies, intro, isCancel, log, multiselect, note, outro, packageManagerPrompt, parseCss, parseHtml as parseHtml$1, parseHtml$1 as parseHtml, parseJson, parseScript, parseSvelte, resolveCommand, select, spinner, templates, text, up, walk_exports } from "./package-manager-BlabCKKr.js";
3
+ import { __commonJS$1, __export, __toESM$1, addFromString, applyAddons, array_exports, common_exports, createWorkspace, dedent_default, exports_exports, formatFiles, function_exports, getHighlighter, imports_exports, kit_exports, object_exports, require_picocolors, setupAddons, variables_exports } from "./install-B9Un6d4s.js";
4
4
  import fs, { existsSync } from "node:fs";
5
5
  import path, { dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
@@ -12,7 +12,7 @@ import { promisify } from "node:util";
12
12
 
13
13
  //#region packages/cli/package.json
14
14
  var name = "sv";
15
- var version = "0.6.17";
15
+ var version = "0.6.19";
16
16
  var type = "module";
17
17
  var description = "A CLI for creating and updating SvelteKit projects";
18
18
  var license = "MIT";
@@ -913,11 +913,11 @@ var require_option = __commonJS({ "node_modules/.pnpm/commander@13.0.0/node_modu
913
913
  /**
914
914
  * @param {Option[]} options
915
915
  */
916
- constructor(options$6) {
916
+ constructor(options$5) {
917
917
  this.positiveOptions = new Map();
918
918
  this.negativeOptions = new Map();
919
919
  this.dualOptions = new Set();
920
- options$6.forEach((option) => {
920
+ options$5.forEach((option) => {
921
921
  if (option.negate) this.negativeOptions.set(option.attributeName(), option);
922
922
  else this.positiveOptions.set(option.attributeName(), option);
923
923
  });
@@ -3201,14 +3201,14 @@ function optional(wrapped, ...args) {
3201
3201
  if (0 in args) schema.default = args[0];
3202
3202
  return schema;
3203
3203
  }
3204
- function picklist(options$6, message) {
3204
+ function picklist(options$5, message) {
3205
3205
  return {
3206
3206
  kind: "schema",
3207
3207
  type: "picklist",
3208
3208
  reference: picklist,
3209
- expects: _joinExpects(options$6.map(_stringify), "|"),
3209
+ expects: _joinExpects(options$5.map(_stringify), "|"),
3210
3210
  async: false,
3211
- options: options$6,
3211
+ options: options$5,
3212
3212
  message,
3213
3213
  _run(dataset, config2) {
3214
3214
  if (this.options.includes(dataset.value)) dataset.typed = true;
@@ -3302,14 +3302,14 @@ function _subIssues(datasets) {
3302
3302
  else issues = dataset.issues;
3303
3303
  return issues;
3304
3304
  }
3305
- function union(options$6, message) {
3305
+ function union(options$5, message) {
3306
3306
  return {
3307
3307
  kind: "schema",
3308
3308
  type: "union",
3309
3309
  reference: union,
3310
- expects: _joinExpects(options$6.map((option) => option.expects), "|"),
3310
+ expects: _joinExpects(options$5.map((option) => option.expects), "|"),
3311
3311
  async: false,
3312
- options: options$6,
3312
+ options: options$5,
3313
3313
  message,
3314
3314
  _run(dataset, config2) {
3315
3315
  let validDataset;
@@ -3367,8 +3367,8 @@ function pipe$1(...pipe2) {
3367
3367
 
3368
3368
  //#endregion
3369
3369
  //#region node_modules/.pnpm/empathic@1.0.0/node_modules/empathic/package.mjs
3370
- function up$1(options$6) {
3371
- return up("package.json", options$6);
3370
+ function up$1(options$5) {
3371
+ return up("package.json", options$5);
3372
3372
  }
3373
3373
 
3374
3374
  //#endregion
@@ -3376,8 +3376,8 @@ function up$1(options$6) {
3376
3376
  function defineAddon(config) {
3377
3377
  return config;
3378
3378
  }
3379
- function defineAddonOptions(options$6) {
3380
- return options$6;
3379
+ function defineAddonOptions(options$5) {
3380
+ return options$5;
3381
3381
  }
3382
3382
  var __create$1 = Object.create;
3383
3383
  var __defProp$1 = Object.defineProperty;
@@ -4044,7 +4044,7 @@ const PORTS = {
4044
4044
  postgresql: "5432",
4045
4045
  sqlite: ""
4046
4046
  };
4047
- const options$5 = defineAddonOptions({
4047
+ const options$4 = defineAddonOptions({
4048
4048
  database: {
4049
4049
  question: "Which database would you like to use?",
4050
4050
  type: "select",
@@ -4129,38 +4129,39 @@ var drizzle_default = defineAddon({
4129
4129
  id: "drizzle",
4130
4130
  shortDescription: "database orm",
4131
4131
  homepage: "https://orm.drizzle.team",
4132
- options: options$5,
4132
+ options: options$4,
4133
4133
  setup: ({ kit, unsupported }) => {
4134
4134
  if (!kit) unsupported("Requires SvelteKit");
4135
4135
  },
4136
- run: ({ sv, typescript, options: options$6, kit }) => {
4136
+ run: ({ sv, typescript, options: options$5, kit }) => {
4137
4137
  const ext = typescript ? "ts" : "js";
4138
4138
  sv.dependency("drizzle-orm", "^0.38.4");
4139
4139
  sv.devDependency("drizzle-kit", "^0.30.2");
4140
- if (options$6.mysql === "mysql2") sv.dependency("mysql2", "^3.12.0");
4141
- if (options$6.mysql === "planetscale") sv.dependency("@planetscale/database", "^1.19.0");
4142
- if (options$6.postgresql === "neon") sv.dependency("@neondatabase/serverless", "^0.10.4");
4143
- if (options$6.postgresql === "postgres.js") sv.dependency("postgres", "^3.4.5");
4144
- if (options$6.sqlite === "better-sqlite3") {
4140
+ if (options$5.mysql === "mysql2") sv.dependency("mysql2", "^3.12.0");
4141
+ if (options$5.mysql === "planetscale") sv.dependency("@planetscale/database", "^1.19.0");
4142
+ if (options$5.postgresql === "neon") sv.dependency("@neondatabase/serverless", "^0.10.4");
4143
+ if (options$5.postgresql === "postgres.js") sv.dependency("postgres", "^3.4.5");
4144
+ if (options$5.sqlite === "better-sqlite3") {
4145
4145
  sv.dependency("better-sqlite3", "^11.8.0");
4146
4146
  sv.devDependency("@types/better-sqlite3", "^7.6.12");
4147
+ sv.pnpmBuildDependendency("better-sqlite3");
4147
4148
  }
4148
- if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") sv.dependency("@libsql/client", "^0.14.0");
4149
- sv.file(".env", (content) => generateEnvFileContent(content, options$6));
4150
- sv.file(".env.example", (content) => generateEnvFileContent(content, options$6));
4151
- if (options$6.docker && (options$6.mysql === "mysql2" || options$6.postgresql === "postgres.js")) sv.file("docker-compose.yml", (content) => {
4149
+ if (options$5.sqlite === "libsql" || options$5.sqlite === "turso") sv.dependency("@libsql/client", "^0.14.0");
4150
+ sv.file(".env", (content) => generateEnvFileContent(content, options$5));
4151
+ sv.file(".env.example", (content) => generateEnvFileContent(content, options$5));
4152
+ if (options$5.docker && (options$5.mysql === "mysql2" || options$5.postgresql === "postgres.js")) sv.file("docker-compose.yml", (content) => {
4152
4153
  if (content.length > 0) return content;
4153
- const imageName = options$6.database === "mysql" ? "mysql" : "postgres";
4154
- const port = PORTS[options$6.database];
4154
+ const imageName = options$5.database === "mysql" ? "mysql" : "postgres";
4155
+ const port = PORTS[options$5.database];
4155
4156
  const USER = "root";
4156
4157
  const PASSWORD = "mysecretpassword";
4157
4158
  const DB_NAME = "local";
4158
4159
  let dbSpecificContent = "";
4159
- if (options$6.mysql === "mysql2") dbSpecificContent = `
4160
+ if (options$5.mysql === "mysql2") dbSpecificContent = `
4160
4161
  MYSQL_ROOT_PASSWORD: ${PASSWORD}
4161
4162
  MYSQL_DATABASE: ${DB_NAME}
4162
4163
  `;
4163
- if (options$6.postgresql === "postgres.js") dbSpecificContent = `
4164
+ if (options$5.postgresql === "postgres.js") dbSpecificContent = `
4164
4165
  POSTGRES_USER: ${USER}
4165
4166
  POSTGRES_PASSWORD: ${PASSWORD}
4166
4167
  POSTGRES_DB: ${DB_NAME}
@@ -4180,13 +4181,13 @@ var drizzle_default = defineAddon({
4180
4181
  const { data, generateCode } = parseJson(content);
4181
4182
  data.scripts ??= {};
4182
4183
  const scripts$1 = data.scripts;
4183
- if (options$6.docker) scripts$1["db:start"] ??= "docker compose up";
4184
+ if (options$5.docker) scripts$1["db:start"] ??= "docker compose up";
4184
4185
  scripts$1["db:push"] ??= "drizzle-kit push";
4185
4186
  scripts$1["db:migrate"] ??= "drizzle-kit migrate";
4186
4187
  scripts$1["db:studio"] ??= "drizzle-kit studio";
4187
4188
  return generateCode();
4188
4189
  });
4189
- if (options$6.database === "sqlite") sv.file(".gitignore", (content) => {
4190
+ if (options$5.database === "sqlite") sv.file(".gitignore", (content) => {
4190
4191
  if (content.length === 0) return content;
4191
4192
  if (!content.includes("\n*.db")) content = content.trimEnd() + "\n\n# SQLite\n*.db";
4192
4193
  return content;
@@ -4201,7 +4202,7 @@ var drizzle_default = defineAddon({
4201
4202
  if (exportDefault.type !== "CallExpression") return content;
4202
4203
  const objExpression = exportDefault.arguments?.[0];
4203
4204
  if (!objExpression || objExpression.type !== "ObjectExpression") return content;
4204
- const authToken = options$6.sqlite === "turso" ? common_exports.expressionFromString("process.env.DATABASE_AUTH_TOKEN") : undefined;
4205
+ const authToken = options$5.sqlite === "turso" ? common_exports.expressionFromString("process.env.DATABASE_AUTH_TOKEN") : undefined;
4205
4206
  object_exports.properties(objExpression, {
4206
4207
  schema: common_exports.createLiteral(`./src/lib/server/db/schema.${typescript ? "ts" : "js"}`),
4207
4208
  dbCredentials: object_exports.create({
@@ -4217,15 +4218,15 @@ var drizzle_default = defineAddon({
4217
4218
  value: true
4218
4219
  }
4219
4220
  });
4220
- const dialect = options$6.sqlite === "turso" ? "turso" : options$6.database;
4221
+ const dialect = options$5.sqlite === "turso" ? "turso" : options$5.database;
4221
4222
  object_exports.overrideProperties(objExpression, { dialect: common_exports.createLiteral(dialect) });
4222
- if (options$6.database !== "sqlite") object_exports.removeProperty(objExpression, "driver");
4223
+ if (options$5.database !== "sqlite") object_exports.removeProperty(objExpression, "driver");
4223
4224
  return generateCode();
4224
4225
  });
4225
4226
  sv.file(`${kit?.libDirectory}/server/db/schema.${ext}`, (content) => {
4226
4227
  const { ast, generateCode } = parseScript(content);
4227
4228
  let userSchemaExpression;
4228
- if (options$6.database === "sqlite") {
4229
+ if (options$5.database === "sqlite") {
4229
4230
  imports_exports.addNamed(ast, "drizzle-orm/sqlite-core", {
4230
4231
  sqliteTable: "sqliteTable",
4231
4232
  text: "text",
@@ -4236,7 +4237,7 @@ var drizzle_default = defineAddon({
4236
4237
  age: integer('age')
4237
4238
  })`);
4238
4239
  }
4239
- if (options$6.database === "mysql") {
4240
+ if (options$5.database === "mysql") {
4240
4241
  imports_exports.addNamed(ast, "drizzle-orm/mysql-core", {
4241
4242
  mysqlTable: "mysqlTable",
4242
4243
  serial: "serial",
@@ -4248,7 +4249,7 @@ var drizzle_default = defineAddon({
4248
4249
  age: int('age'),
4249
4250
  })`);
4250
4251
  }
4251
- if (options$6.database === "postgresql") {
4252
+ if (options$5.database === "postgresql") {
4252
4253
  imports_exports.addNamed(ast, "drizzle-orm/pg-core", {
4253
4254
  pgTable: "pgTable",
4254
4255
  serial: "serial",
@@ -4271,37 +4272,37 @@ var drizzle_default = defineAddon({
4271
4272
  const dbURLCheck = common_exports.statementFromString("if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');");
4272
4273
  common_exports.addStatement(ast, dbURLCheck);
4273
4274
  let clientExpression;
4274
- if (options$6.sqlite === "better-sqlite3") {
4275
+ if (options$5.sqlite === "better-sqlite3") {
4275
4276
  imports_exports.addDefault(ast, "better-sqlite3", "Database");
4276
4277
  imports_exports.addNamed(ast, "drizzle-orm/better-sqlite3", { drizzle: "drizzle" });
4277
4278
  clientExpression = common_exports.expressionFromString("new Database(env.DATABASE_URL)");
4278
4279
  }
4279
- if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") {
4280
+ if (options$5.sqlite === "libsql" || options$5.sqlite === "turso") {
4280
4281
  imports_exports.addNamed(ast, "@libsql/client", { createClient: "createClient" });
4281
4282
  imports_exports.addNamed(ast, "drizzle-orm/libsql", { drizzle: "drizzle" });
4282
- if (options$6.sqlite === "turso") {
4283
+ if (options$5.sqlite === "turso") {
4283
4284
  imports_exports.addNamed(ast, "$app/environment", { dev: "dev" });
4284
4285
  const authTokenCheck = common_exports.statementFromString("if (!dev && !env.DATABASE_AUTH_TOKEN) throw new Error('DATABASE_AUTH_TOKEN is not set');");
4285
4286
  common_exports.addStatement(ast, authTokenCheck);
4286
4287
  clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL, authToken: env.DATABASE_AUTH_TOKEN })");
4287
4288
  } else clientExpression = common_exports.expressionFromString("createClient({ url: env.DATABASE_URL })");
4288
4289
  }
4289
- if (options$6.mysql === "mysql2") {
4290
+ if (options$5.mysql === "mysql2") {
4290
4291
  imports_exports.addDefault(ast, "mysql2/promise", "mysql");
4291
4292
  imports_exports.addNamed(ast, "drizzle-orm/mysql2", { drizzle: "drizzle" });
4292
4293
  clientExpression = common_exports.expressionFromString("await mysql.createConnection(env.DATABASE_URL)");
4293
4294
  }
4294
- if (options$6.mysql === "planetscale") {
4295
+ if (options$5.mysql === "planetscale") {
4295
4296
  imports_exports.addNamed(ast, "@planetscale/database", { Client: "Client" });
4296
4297
  imports_exports.addNamed(ast, "drizzle-orm/planetscale-serverless", { drizzle: "drizzle" });
4297
4298
  clientExpression = common_exports.expressionFromString("new Client({ url: env.DATABASE_URL })");
4298
4299
  }
4299
- if (options$6.postgresql === "neon") {
4300
+ if (options$5.postgresql === "neon") {
4300
4301
  imports_exports.addNamed(ast, "@neondatabase/serverless", { neon: "neon" });
4301
4302
  imports_exports.addNamed(ast, "drizzle-orm/neon-http", { drizzle: "drizzle" });
4302
4303
  clientExpression = common_exports.expressionFromString("neon(env.DATABASE_URL)");
4303
4304
  }
4304
- if (options$6.postgresql === "postgres.js") {
4305
+ if (options$5.postgresql === "postgres.js") {
4305
4306
  imports_exports.addDefault(ast, "postgres", "postgres");
4306
4307
  imports_exports.addNamed(ast, "drizzle-orm/postgres-js", { drizzle: "drizzle" });
4307
4308
  clientExpression = common_exports.expressionFromString("postgres(env.DATABASE_URL)");
@@ -4315,9 +4316,9 @@ var drizzle_default = defineAddon({
4315
4316
  return generateCode();
4316
4317
  });
4317
4318
  },
4318
- nextSteps: ({ options: options$6, highlighter, packageManager }) => {
4319
+ nextSteps: ({ options: options$5, highlighter, packageManager }) => {
4319
4320
  const steps = [`You will need to set ${highlighter.env("DATABASE_URL")} in your production environment`];
4320
- if (options$6.docker) steps.push(`Run ${highlighter.command(`${packageManager} run db:start`)} to start the docker container`);
4321
+ if (options$5.docker) steps.push(`Run ${highlighter.command(`${packageManager} run db:start`)} to start the docker container`);
4321
4322
  steps.push(`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`);
4322
4323
  return steps;
4323
4324
  }
@@ -4517,7 +4518,7 @@ const adapters = [
4517
4518
  version: "^4.4.0"
4518
4519
  }
4519
4520
  ];
4520
- const options$4 = defineAddonOptions({ adapter: {
4521
+ const options$3 = defineAddonOptions({ adapter: {
4521
4522
  type: "select",
4522
4523
  question: "Which SvelteKit adapter would you like to use?",
4523
4524
  options: adapters.map((p) => ({
@@ -4532,12 +4533,12 @@ var sveltekit_adapter_default = defineAddon({
4532
4533
  alias: "adapter",
4533
4534
  shortDescription: "deployment",
4534
4535
  homepage: "https://svelte.dev/docs/kit/adapters",
4535
- options: options$4,
4536
+ options: options$3,
4536
4537
  setup: ({ kit, unsupported }) => {
4537
4538
  if (!kit) unsupported("Requires SvelteKit");
4538
4539
  },
4539
- run: ({ sv, options: options$6 }) => {
4540
- const adapter = adapters.find((a) => a.id === options$6.adapter);
4540
+ run: ({ sv, options: options$5 }) => {
4541
+ const adapter = adapters.find((a) => a.id === options$5.adapter);
4541
4542
  sv.file("package.json", (content) => {
4542
4543
  const { data, generateCode } = parseJson(content);
4543
4544
  const devDeps = data["devDependencies"];
@@ -4965,7 +4966,7 @@ const warned = {
4965
4966
  storeName: false
4966
4967
  };
4967
4968
  var MagicString = class MagicString {
4968
- constructor(string$1, options$6 = {}) {
4969
+ constructor(string$1, options$5 = {}) {
4969
4970
  const chunk = new Chunk(0, string$1.length, string$1);
4970
4971
  Object.defineProperties(this, {
4971
4972
  original: {
@@ -5002,11 +5003,11 @@ var MagicString = class MagicString {
5002
5003
  },
5003
5004
  filename: {
5004
5005
  writable: true,
5005
- value: options$6.filename
5006
+ value: options$5.filename
5006
5007
  },
5007
5008
  indentExclusionRanges: {
5008
5009
  writable: true,
5009
- value: options$6.indentExclusionRanges
5010
+ value: options$5.indentExclusionRanges
5010
5011
  },
5011
5012
  sourcemapLocations: {
5012
5013
  writable: true,
@@ -5022,11 +5023,11 @@ var MagicString = class MagicString {
5022
5023
  },
5023
5024
  ignoreList: {
5024
5025
  writable: true,
5025
- value: options$6.ignoreList
5026
+ value: options$5.ignoreList
5026
5027
  },
5027
5028
  offset: {
5028
5029
  writable: true,
5029
- value: options$6.offset || 0
5030
+ value: options$5.offset || 0
5030
5031
  }
5031
5032
  });
5032
5033
  this.byStart[0] = chunk;
@@ -5084,11 +5085,11 @@ else this.outro += content;
5084
5085
  cloned.outro = this.outro;
5085
5086
  return cloned;
5086
5087
  }
5087
- generateDecodedMap(options$6) {
5088
- options$6 = options$6 || {};
5088
+ generateDecodedMap(options$5) {
5089
+ options$5 = options$5 || {};
5089
5090
  const sourceIndex = 0;
5090
5091
  const names = Object.keys(this.storedNames);
5091
- const mappings = new Mappings(options$6.hires);
5092
+ const mappings = new Mappings(options$5.hires);
5092
5093
  const locate = getLocator(this.original);
5093
5094
  if (this.intro) mappings.advance(this.intro);
5094
5095
  this.firstChunk.eachNext((chunk) => {
@@ -5099,16 +5100,16 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
5099
5100
  if (chunk.outro.length) mappings.advance(chunk.outro);
5100
5101
  });
5101
5102
  return {
5102
- file: options$6.file ? options$6.file.split(/[/\\]/).pop() : undefined,
5103
- sources: [options$6.source ? getRelativePath(options$6.file || "", options$6.source) : options$6.file || ""],
5104
- sourcesContent: options$6.includeContent ? [this.original] : undefined,
5103
+ file: options$5.file ? options$5.file.split(/[/\\]/).pop() : undefined,
5104
+ sources: [options$5.source ? getRelativePath(options$5.file || "", options$5.source) : options$5.file || ""],
5105
+ sourcesContent: options$5.includeContent ? [this.original] : undefined,
5105
5106
  names,
5106
5107
  mappings: mappings.raw,
5107
5108
  x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
5108
5109
  };
5109
5110
  }
5110
- generateMap(options$6) {
5111
- return new SourceMap(this.generateDecodedMap(options$6));
5111
+ generateMap(options$5) {
5112
+ return new SourceMap(this.generateDecodedMap(options$5));
5112
5113
  }
5113
5114
  _ensureindentStr() {
5114
5115
  if (this.indentStr === undefined) this.indentStr = guessIndent(this.original);
@@ -5121,10 +5122,10 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
5121
5122
  this._ensureindentStr();
5122
5123
  return this.indentStr === null ? " " : this.indentStr;
5123
5124
  }
5124
- indent(indentStr, options$6) {
5125
+ indent(indentStr, options$5) {
5125
5126
  const pattern = /^[^\r\n]/gm;
5126
5127
  if (isObject(indentStr)) {
5127
- options$6 = indentStr;
5128
+ options$5 = indentStr;
5128
5129
  indentStr = undefined;
5129
5130
  }
5130
5131
  if (indentStr === undefined) {
@@ -5132,15 +5133,15 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
5132
5133
  indentStr = this.indentStr || " ";
5133
5134
  }
5134
5135
  if (indentStr === "") return this;
5135
- options$6 = options$6 || {};
5136
+ options$5 = options$5 || {};
5136
5137
  const isExcluded = {};
5137
- if (options$6.exclude) {
5138
- const exclusions = typeof options$6.exclude[0] === "number" ? [options$6.exclude] : options$6.exclude;
5138
+ if (options$5.exclude) {
5139
+ const exclusions = typeof options$5.exclude[0] === "number" ? [options$5.exclude] : options$5.exclude;
5139
5140
  exclusions.forEach((exclusion) => {
5140
5141
  for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
5141
5142
  });
5142
5143
  }
5143
- let shouldIndentNextCharacter = options$6.indentStart !== false;
5144
+ let shouldIndentNextCharacter = options$5.indentStart !== false;
5144
5145
  const replacer = (match) => {
5145
5146
  if (shouldIndentNextCharacter) return `${indentStr}${match}`;
5146
5147
  shouldIndentNextCharacter = true;
@@ -5228,14 +5229,14 @@ else {
5228
5229
  if (!newRight) this.lastChunk = last;
5229
5230
  return this;
5230
5231
  }
5231
- overwrite(start, end, content, options$6) {
5232
- options$6 = options$6 || {};
5232
+ overwrite(start, end, content, options$5) {
5233
+ options$5 = options$5 || {};
5233
5234
  return this.update(start, end, content, {
5234
- ...options$6,
5235
- overwrite: !options$6.contentOnly
5235
+ ...options$5,
5236
+ overwrite: !options$5.contentOnly
5236
5237
  });
5237
5238
  }
5238
- update(start, end, content, options$6) {
5239
+ update(start, end, content, options$5) {
5239
5240
  start = start + this.offset;
5240
5241
  end = end + this.offset;
5241
5242
  if (typeof content !== "string") throw new TypeError("replacement content must be a string");
@@ -5247,15 +5248,15 @@ else {
5247
5248
  if (start === end) throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
5248
5249
  this._split(start);
5249
5250
  this._split(end);
5250
- if (options$6 === true) {
5251
+ if (options$5 === true) {
5251
5252
  if (!warned.storeName) {
5252
5253
  console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
5253
5254
  warned.storeName = true;
5254
5255
  }
5255
- options$6 = { storeName: true };
5256
+ options$5 = { storeName: true };
5256
5257
  }
5257
- const storeName = options$6 !== undefined ? options$6.storeName : false;
5258
- const overwrite = options$6 !== undefined ? options$6.overwrite : false;
5258
+ const storeName = options$5 !== undefined ? options$5.storeName : false;
5259
+ const overwrite = options$5 !== undefined ? options$5.overwrite : false;
5259
5260
  if (storeName) {
5260
5261
  const original = this.original.slice(start, end);
5261
5262
  Object.defineProperty(this.storedNames, original, {
@@ -5585,7 +5586,7 @@ const TABLE_TYPE = {
5585
5586
  };
5586
5587
  let drizzleDialect;
5587
5588
  let schemaPath;
5588
- const options$3 = defineAddonOptions({ demo: {
5589
+ const options$2 = defineAddonOptions({ demo: {
5589
5590
  type: "boolean",
5590
5591
  default: true,
5591
5592
  question: `Do you want to include a demo? ${colors.dim("(includes a login/register page)")}`
@@ -5594,16 +5595,16 @@ var lucia_default = defineAddon({
5594
5595
  id: "lucia",
5595
5596
  shortDescription: "auth guide",
5596
5597
  homepage: "https://lucia-auth.com",
5597
- options: options$3,
5598
+ options: options$2,
5598
5599
  setup: ({ kit, dependencyVersion, unsupported, dependsOn }) => {
5599
5600
  if (!kit) unsupported("Requires SvelteKit");
5600
5601
  if (!dependencyVersion("drizzle-orm")) dependsOn("drizzle");
5601
5602
  },
5602
- run: ({ sv, typescript, options: options$6, kit, dependencyVersion }) => {
5603
+ run: ({ sv, typescript, options: options$5, kit, dependencyVersion }) => {
5603
5604
  const ext = typescript ? "ts" : "js";
5604
5605
  sv.dependency("@oslojs/crypto", "^1.0.1");
5605
5606
  sv.dependency("@oslojs/encoding", "^1.1.0");
5606
- if (options$6.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
5607
+ if (options$5.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
5607
5608
  sv.file(`drizzle.config.${ext}`, (content) => {
5608
5609
  const { ast, generateCode } = parseScript(content);
5609
5610
  const isProp = (name$1, node) => node.key.type === "Identifier" && node.key.name === name$1;
@@ -5637,7 +5638,7 @@ var lucia_default = defineAddon({
5637
5638
  integer: "integer"
5638
5639
  });
5639
5640
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
5640
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
5641
+ if (options$5.demo) object_exports.overrideProperties(userAttributes, {
5641
5642
  username: common_exports.expressionFromString("text('username').notNull().unique()"),
5642
5643
  passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
5643
5644
  });
@@ -5654,7 +5655,7 @@ var lucia_default = defineAddon({
5654
5655
  datetime: "datetime"
5655
5656
  });
5656
5657
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("varchar('id', { length: 255 }).primaryKey()") });
5657
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
5658
+ if (options$5.demo) object_exports.overrideProperties(userAttributes, {
5658
5659
  username: common_exports.expressionFromString("varchar('username', { length: 32 }).notNull().unique()"),
5659
5660
  passwordHash: common_exports.expressionFromString("varchar('password_hash', { length: 255 }).notNull()")
5660
5661
  });
@@ -5671,7 +5672,7 @@ var lucia_default = defineAddon({
5671
5672
  timestamp: "timestamp"
5672
5673
  });
5673
5674
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
5674
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
5675
+ if (options$5.demo) object_exports.overrideProperties(userAttributes, {
5675
5676
  username: common_exports.expressionFromString("text('username').notNull().unique()"),
5676
5677
  passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
5677
5678
  });
@@ -5824,7 +5825,7 @@ var lucia_default = defineAddon({
5824
5825
  kit_exports.addHooksHandle(ast, typescript, "handleAuth", getAuthHandleContent());
5825
5826
  return generateCode();
5826
5827
  });
5827
- if (options$6.demo) {
5828
+ if (options$5.demo) {
5828
5829
  sv.file(`${kit?.routesDirectory}/demo/+page.svelte`, (content) => {
5829
5830
  return addToDemoPage(content, "lucia");
5830
5831
  });
@@ -6035,9 +6036,9 @@ var lucia_default = defineAddon({
6035
6036
  });
6036
6037
  }
6037
6038
  },
6038
- nextSteps: ({ highlighter, options: options$6, packageManager }) => {
6039
+ nextSteps: ({ highlighter, options: options$5, packageManager }) => {
6039
6040
  const steps = [`Run ${highlighter.command(`${packageManager} run db:push`)} to update your database schema`];
6040
- if (options$6.demo) steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
6041
+ if (options$5.demo) steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
6041
6042
  return steps;
6042
6043
  }
6043
6044
  });
@@ -6147,7 +6148,7 @@ function appendElement(childNodes, elementToAppend) {
6147
6148
  childNodes.push(elementToAppend);
6148
6149
  }
6149
6150
  function addFromRawHtml(childNodes, html) {
6150
- const document = parseHtml$1(html);
6151
+ const document = parseHtml(html);
6151
6152
  for (const childNode of document.childNodes) childNodes.push(childNode);
6152
6153
  }
6153
6154
  function addSlot(jsAst, htmlAst, svelteVersion) {
@@ -6176,7 +6177,7 @@ const DEFAULT_INLANG_PROJECT = {
6176
6177
  ],
6177
6178
  "plugin.inlang.messageFormat": { pathPattern: "./messages/{languageTag}.json" }
6178
6179
  };
6179
- const options$2 = defineAddonOptions({
6180
+ const options$1 = defineAddonOptions({
6180
6181
  availableLanguageTags: {
6181
6182
  question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
6182
6183
  type: "string",
@@ -6205,11 +6206,11 @@ var paraglide_default = defineAddon({
6205
6206
  id: "paraglide",
6206
6207
  shortDescription: "i18n",
6207
6208
  homepage: "https://inlang.com",
6208
- options: options$2,
6209
+ options: options$1,
6209
6210
  setup: ({ kit, unsupported }) => {
6210
6211
  if (!kit) unsupported("Requires SvelteKit");
6211
6212
  },
6212
- run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
6213
+ run: ({ sv, options: options$5, typescript, kit, dependencyVersion }) => {
6213
6214
  const ext = typescript ? "ts" : "js";
6214
6215
  if (!kit) throw new Error("SvelteKit is required");
6215
6216
  const paraglideOutDir = "src/lib/paraglide";
@@ -6218,7 +6219,7 @@ var paraglide_default = defineAddon({
6218
6219
  if (content) return content;
6219
6220
  const { data, generateCode } = parseJson(content);
6220
6221
  for (const key in DEFAULT_INLANG_PROJECT) data[key] = DEFAULT_INLANG_PROJECT[key];
6221
- const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.availableLanguageTags);
6222
+ const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$5.availableLanguageTags);
6222
6223
  const sourceLanguageTag = validLanguageTags$1[0];
6223
6224
  data.sourceLanguageTag = sourceLanguageTag;
6224
6225
  data.languageTags = validLanguageTags$1;
@@ -6288,7 +6289,7 @@ var paraglide_default = defineAddon({
6288
6289
  });
6289
6290
  });
6290
6291
  sv.file("src/app.html", (content) => {
6291
- const { ast, generateCode } = parseHtml(content);
6292
+ const { ast, generateCode } = parseHtml$1(content);
6292
6293
  const htmlNode = ast.children.find((child) => child.type === esm_exports.Tag && child.name === "html");
6293
6294
  if (!htmlNode) {
6294
6295
  log$1.warn("Could not find <html> node in app.html. You'll need to add the language placeholder manually");
@@ -6306,7 +6307,7 @@ var paraglide_default = defineAddon({
6306
6307
  if (!content.includes(`\n${paraglideOutDir}`)) content = content.trimEnd() + `\n\n# Paraglide\n${paraglideOutDir}`;
6307
6308
  return content;
6308
6309
  });
6309
- if (options$6.demo) {
6310
+ if (options$5.demo) {
6310
6311
  sv.file(`${kit.routesDirectory}/demo/+page.svelte`, (content) => {
6311
6312
  return addToDemoPage(content, "paraglide");
6312
6313
  });
@@ -6335,7 +6336,7 @@ var paraglide_default = defineAddon({
6335
6336
  }
6336
6337
  const templateCode = new MagicString(template.source);
6337
6338
  templateCode.append("\n\n<h1>{m.hello_world({ name: 'SvelteKit User' })}</h1>\n");
6338
- const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.availableLanguageTags);
6339
+ const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$5.availableLanguageTags);
6339
6340
  const links = validLanguageTags$1.map((x) => `${templateCode.getIndentString()}<button onclick={() => switchToLanguage('${x}')}>${x}</button>`).join("\n");
6340
6341
  templateCode.append(`<div>\n${links}\n</div>`);
6341
6342
  return generateCode({
@@ -6344,7 +6345,7 @@ var paraglide_default = defineAddon({
6344
6345
  });
6345
6346
  });
6346
6347
  }
6347
- const { validLanguageTags } = parseLanguageTagInput(options$6.availableLanguageTags);
6348
+ const { validLanguageTags } = parseLanguageTagInput(options$5.availableLanguageTags);
6348
6349
  for (const languageTag of validLanguageTags) sv.file(`messages/${languageTag}.json`, (content) => {
6349
6350
  const { data, generateCode } = parseJson(content);
6350
6351
  data["$schema"] = "https://inlang.com/schema/inlang-message-format";
@@ -6354,7 +6355,7 @@ var paraglide_default = defineAddon({
6354
6355
  },
6355
6356
  nextSteps: ({ highlighter }) => {
6356
6357
  const steps = [`Edit your messages in ${highlighter.path("messages/en.json")}`, "Consider installing the Sherlock IDE Extension"];
6357
- if (options$2.demo) steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
6358
+ if (options$1.demo) steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
6358
6359
  return steps;
6359
6360
  }
6360
6361
  });
@@ -6458,8 +6459,8 @@ var prettier_default = defineAddon({
6458
6459
  }
6459
6460
  data.plugins ??= [];
6460
6461
  data.overrides ??= [];
6461
- const plugins$1 = data.plugins;
6462
- if (!plugins$1.includes("prettier-plugin-svelte")) data.plugins.unshift("prettier-plugin-svelte");
6462
+ const plugins = data.plugins;
6463
+ if (!plugins.includes("prettier-plugin-svelte")) data.plugins.unshift("prettier-plugin-svelte");
6463
6464
  const overrides = data.overrides;
6464
6465
  const override = overrides.find((o) => o?.options?.parser === "svelte");
6465
6466
  if (!override) overrides.push({
@@ -6531,98 +6532,34 @@ else ast.prepend(rule);
6531
6532
 
6532
6533
  //#endregion
6533
6534
  //#region packages/addons/tailwindcss/index.ts
6534
- const plugins = [
6535
- {
6536
- id: "typography",
6537
- package: "@tailwindcss/typography",
6538
- version: "^0.5.16",
6539
- identifier: "typography"
6540
- },
6541
- {
6542
- id: "forms",
6543
- package: "@tailwindcss/forms",
6544
- version: "^0.5.10",
6545
- identifier: "forms"
6546
- },
6547
- {
6548
- id: "container-queries",
6549
- package: "@tailwindcss/container-queries",
6550
- version: "^0.1.1",
6551
- identifier: "containerQueries"
6552
- }
6553
- ];
6554
- const options$1 = defineAddonOptions({ plugins: {
6555
- type: "multiselect",
6556
- question: "Which plugins would you like to add?",
6557
- options: plugins.map((p) => ({
6558
- value: p.id,
6559
- label: p.id,
6560
- hint: p.package
6561
- })),
6562
- default: []
6563
- } });
6564
6535
  var tailwindcss_default = defineAddon({
6565
6536
  id: "tailwindcss",
6566
6537
  alias: "tailwind",
6567
6538
  shortDescription: "css framework",
6568
6539
  homepage: "https://tailwindcss.com",
6569
- options: options$1,
6570
- run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
6540
+ options: {},
6541
+ run: ({ sv, typescript, kit, dependencyVersion }) => {
6571
6542
  const ext = typescript ? "ts" : "js";
6572
6543
  const prettierInstalled = Boolean(dependencyVersion("prettier"));
6573
- sv.devDependency("tailwindcss", "^3.4.17");
6574
- sv.devDependency("autoprefixer", "^10.4.20");
6575
- if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.6.10");
6576
- for (const plugin of plugins) {
6577
- if (!options$6.plugins.includes(plugin.id)) continue;
6578
- sv.devDependency(plugin.package, plugin.version);
6579
- }
6580
- sv.file(`tailwind.config.${ext}`, (content) => {
6581
- const { ast, generateCode } = parseScript(content);
6582
- let root;
6583
- const rootExport = object_exports.createEmpty();
6584
- if (typescript) {
6585
- imports_exports.addNamed(ast, "tailwindcss", { Config: "Config" }, true);
6586
- root = common_exports.satisfiesExpression(rootExport, "Config");
6587
- }
6588
- const { astNode: exportDeclaration, value: node } = exports_exports.defaultExport(ast, root ?? rootExport);
6589
- const config = node.type === "TSSatisfiesExpression" ? node.expression : node;
6590
- if (config.type !== "ObjectExpression") throw new Error(`Unexpected tailwind config shape: ${config.type}`);
6591
- if (!typescript) common_exports.addJsDocTypeComment(exportDeclaration, "import('tailwindcss').Config");
6592
- const contentArray = object_exports.property(config, "content", array_exports.createEmpty());
6593
- array_exports.push(contentArray, "./src/**/*.{html,js,svelte,ts}");
6594
- const themeObject = object_exports.property(config, "theme", object_exports.createEmpty());
6595
- object_exports.property(themeObject, "extend", object_exports.createEmpty());
6596
- const pluginsArray = object_exports.property(config, "plugins", array_exports.createEmpty());
6597
- for (const plugin of plugins) {
6598
- if (!options$6.plugins.includes(plugin.id)) continue;
6599
- imports_exports.addDefault(ast, plugin.package, plugin.identifier);
6600
- array_exports.push(pluginsArray, {
6601
- type: "Identifier",
6602
- name: plugin.identifier
6603
- });
6604
- }
6605
- return generateCode();
6606
- });
6607
- sv.file("postcss.config.js", (content) => {
6544
+ sv.devDependency("tailwindcss", "^4.0.0");
6545
+ sv.devDependency("@tailwindcss/vite", "^4.0.0");
6546
+ if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.6.11");
6547
+ sv.file(`vite.config.${ext}`, (content) => {
6608
6548
  const { ast, generateCode } = parseScript(content);
6609
- const { value: rootObject } = exports_exports.defaultExport(ast, object_exports.createEmpty());
6610
- const pluginsObject = object_exports.property(rootObject, "plugins", object_exports.createEmpty());
6611
- object_exports.property(pluginsObject, "tailwindcss", object_exports.createEmpty());
6612
- object_exports.property(pluginsObject, "autoprefixer", object_exports.createEmpty());
6549
+ const vitePluginName = "tailwindcss";
6550
+ imports_exports.addDefault(ast, "@tailwindcss/vite", vitePluginName);
6551
+ const { value: rootObject } = exports_exports.defaultExport(ast, function_exports.call("defineConfig", []));
6552
+ const param1 = function_exports.argumentByIndex(rootObject, 0, object_exports.createEmpty());
6553
+ const pluginsArray = object_exports.property(param1, "plugins", array_exports.createEmpty());
6554
+ const pluginFunctionCall = function_exports.call(vitePluginName, []);
6555
+ array_exports.push(pluginsArray, pluginFunctionCall);
6613
6556
  return generateCode();
6614
6557
  });
6615
6558
  sv.file("src/app.css", (content) => {
6616
- const layerImports = [
6617
- "base",
6618
- "components",
6619
- "utilities"
6620
- ].map((layer) => `tailwindcss/${layer}`);
6621
- if (layerImports.every((i) => content.includes(i))) return content;
6559
+ if (content.includes("tailwindcss")) return content;
6622
6560
  const { ast, generateCode } = parseCss(content);
6623
6561
  const originalFirst = ast.first;
6624
- const specifiers = layerImports.map((i) => `'${i}'`);
6625
- const nodes = addImports(ast, specifiers);
6562
+ const nodes = addImports(ast, ["'tailwindcss'"]);
6626
6563
  if (originalFirst !== ast.first && originalFirst?.type === "atrule" && originalFirst.name === "import") originalFirst.raws.before = "\n";
6627
6564
  nodes.shift();
6628
6565
  nodes.forEach((n$1) => n$1.raws.before = "\n");
@@ -6650,8 +6587,8 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
6650
6587
  const { data, generateCode } = parseJson(content);
6651
6588
  const PLUGIN_NAME = "prettier-plugin-tailwindcss";
6652
6589
  data.plugins ??= [];
6653
- const plugins$1 = data.plugins;
6654
- if (!plugins$1.includes(PLUGIN_NAME)) plugins$1.push(PLUGIN_NAME);
6590
+ const plugins = data.plugins;
6591
+ if (!plugins.includes(PLUGIN_NAME)) plugins.push(PLUGIN_NAME);
6655
6592
  return generateCode();
6656
6593
  });
6657
6594
  }
@@ -9532,14 +9469,14 @@ function verifyPackage(pkg, specifier) {
9532
9469
  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`);
9533
9470
  }
9534
9471
  }
9535
- async function downloadPackage(options$6) {
9536
- const { pkg } = options$6;
9537
- if (options$6.path) {
9472
+ async function downloadPackage(options$5) {
9473
+ const { pkg } = options$5;
9474
+ if (options$5.path) {
9538
9475
  const dest = path.join(NODE_MODULES, pkg.name.split("/").join(path.sep));
9539
9476
  if (fs.existsSync(dest)) fs.rmSync(dest);
9540
9477
  const dir = path.dirname(dest);
9541
9478
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
9542
- fs.symlinkSync(options$6.path, dest);
9479
+ fs.symlinkSync(options$5.path, dest);
9543
9480
  const { default: details$1 } = await import(pkg.name);
9544
9481
  return details$1;
9545
9482
  }
@@ -9662,7 +9599,7 @@ const add = new Command("add").description("applies specified add-ons into a pro
9662
9599
  process$1.exit(1);
9663
9600
  }
9664
9601
  const specifiedAddons = parse(AddonsSchema, addonArgs);
9665
- const options$6 = parse(OptionsSchema$1, opts);
9602
+ const options$5 = parse(OptionsSchema$1, opts);
9666
9603
  const addonIds = officialAddons.map((addon) => addon.id);
9667
9604
  const invalidAddons = specifiedAddons.filter((a) => !addonIds.includes(a) && !aliases.includes(a));
9668
9605
  if (invalidAddons.length > 0) {
@@ -9671,12 +9608,12 @@ const add = new Command("add").description("applies specified add-ons into a pro
9671
9608
  }
9672
9609
  const selectedAddons = transformAliases(specifiedAddons);
9673
9610
  runCommand(async () => {
9674
- const { nextSteps } = await runAddCommand(options$6, selectedAddons);
9611
+ const { nextSteps } = await runAddCommand(options$5, selectedAddons);
9675
9612
  if (nextSteps) box(nextSteps, "Next steps");
9676
9613
  });
9677
9614
  });
9678
9615
  for (const option of addonsOptions) add.addOption(option);
9679
- async function runAddCommand(options$6, selectedAddonIds) {
9616
+ async function runAddCommand(options$5, selectedAddonIds) {
9680
9617
  const selectedAddons = selectedAddonIds.map((id) => ({
9681
9618
  type: "official",
9682
9619
  addon: getAddonDetails(id)
@@ -9686,7 +9623,7 @@ async function runAddCommand(options$6, selectedAddonIds) {
9686
9623
  for (const addonOption of addonsOptions) {
9687
9624
  const addonId = addonOption.name();
9688
9625
  const aliased = addonOption.attributeName();
9689
- const specifiedOptions = options$6[addonId] || options$6[aliased];
9626
+ const specifiedOptions = options$5[addonId] || options$5[aliased];
9690
9627
  if (!specifiedOptions) continue;
9691
9628
  const details$1 = getAddonDetails(addonId);
9692
9629
  if (!selectedAddons.find((d) => d.addon === details$1)) selectedAddons.push({
@@ -9716,7 +9653,7 @@ async function runAddCommand(options$6, selectedAddonIds) {
9716
9653
  for (const [id, question] of Object.entries(details$1.options)) if (question.condition?.(official[addonId]) !== false) official[addonId][id] ??= question.default;
9717
9654
  else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--${addonId}' option specified: '${official[addonId][id]}'`);
9718
9655
  }
9719
- if (options$6.community === true) {
9656
+ if (options$5.community === true) {
9720
9657
  const communityAddons = await Promise.all(communityAddonIds.map(async (id) => await getCommunityAddon(id)));
9721
9658
  const promptOptions = communityAddons.map((addon) => ({
9722
9659
  value: addon.id,
@@ -9735,10 +9672,10 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9735
9672
  cancel("No add-ons selected. Exiting.");
9736
9673
  process$1.exit(1);
9737
9674
  }
9738
- options$6.community = selected;
9675
+ options$5.community = selected;
9739
9676
  }
9740
- if (Array.isArray(options$6.community) && options$6.community.length > 0) {
9741
- const addons = options$6.community.map((id) => {
9677
+ if (Array.isArray(options$5.community) && options$5.community.length > 0) {
9678
+ const addons = options$5.community.map((id) => {
9742
9679
  const hasDirective = Object.values(Directive).some((directive) => id.startsWith(directive));
9743
9680
  if (hasDirective) return id;
9744
9681
  const validAddon = communityAddonIds.includes(id);
@@ -9750,7 +9687,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9750
9687
  start("Resolving community add-on packages");
9751
9688
  const pkgs = await Promise.all(addons.map(async (id) => {
9752
9689
  return await getPackageJSON({
9753
- cwd: options$6.cwd,
9690
+ cwd: options$5.cwd,
9754
9691
  packageName: id
9755
9692
  });
9756
9693
  }));
@@ -9787,7 +9724,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9787
9724
  throw err;
9788
9725
  }
9789
9726
  }
9790
- let workspace = createWorkspace({ cwd: options$6.cwd });
9727
+ let workspace = createWorkspace({ cwd: options$5.cwd });
9791
9728
  const addonSetupResults = setupAddons(officialAddons, workspace);
9792
9729
  if (selectedAddons.length === 0) {
9793
9730
  const addonOptions = officialAddons.filter(({ id }) => addonSetupResults[id].unsupported.length === 0).map(({ id, homepage: homepage$1, shortDescription }) => ({
@@ -9830,9 +9767,9 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9830
9767
  });
9831
9768
  }
9832
9769
  }
9833
- if (options$6.preconditions && selectedAddons.length > 0) {
9770
+ if (options$5.preconditions && selectedAddons.length > 0) {
9834
9771
  const addons = selectedAddons.map(({ addon }) => addon);
9835
- const { preconditions } = getGlobalPreconditions(options$6.cwd, addons, addonSetupResults);
9772
+ const { preconditions } = getGlobalPreconditions(options$5.cwd, addons, addonSetupResults);
9836
9773
  const fails = [];
9837
9774
  for (const condition of preconditions) {
9838
9775
  const { message, success } = await condition.run();
@@ -9903,23 +9840,26 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9903
9840
  }
9904
9841
  }
9905
9842
  if (selectedAddons.length === 0) return { packageManager: null };
9906
- let packageManager;
9907
- if (options$6.install) {
9908
- packageManager = await packageManagerPrompt(options$6.cwd);
9909
- if (packageManager) workspace.packageManager = packageManager;
9910
- }
9911
9843
  const officialDetails = Object.keys(official).map((id) => getAddonDetails(id));
9912
9844
  const commDetails = Object.keys(community).map((id) => communityDetails.find((a) => a.id === id));
9913
9845
  const details = officialDetails.concat(commDetails);
9914
9846
  const addonMap = Object.assign({}, ...details.map((a) => ({ [a.id]: a })));
9915
- const filesToFormat = await applyAddons({
9847
+ const { filesToFormat, pnpmBuildDependencies: addonPnpmBuildDependencies } = await applyAddons({
9916
9848
  workspace,
9917
9849
  addonSetupResults,
9918
9850
  addons: addonMap,
9919
9851
  options: official
9920
9852
  });
9921
9853
  log.success("Successfully setup add-ons");
9922
- if (packageManager && options$6.install) await installDependencies(packageManager, options$6.cwd);
9854
+ let packageManager;
9855
+ if (options$5.install) {
9856
+ packageManager = await packageManagerPrompt(options$5.cwd);
9857
+ if (packageManager) {
9858
+ workspace.packageManager = packageManager;
9859
+ addPnpmBuildDependendencies(workspace.cwd, packageManager, ["esbuild", ...addonPnpmBuildDependencies]);
9860
+ await installDependencies(packageManager, options$5.cwd);
9861
+ }
9862
+ }
9923
9863
  workspace = createWorkspace(workspace);
9924
9864
  if (filesToFormat.length > 0 && packageManager && !!workspace.dependencyVersion("prettier")) {
9925
9865
  const { start, stop } = spinner();
@@ -9927,7 +9867,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9927
9867
  try {
9928
9868
  await formatFiles({
9929
9869
  packageManager,
9930
- cwd: options$6.cwd,
9870
+ cwd: options$5.cwd,
9931
9871
  paths: filesToFormat
9932
9872
  });
9933
9873
  stop("Successfully formatted modified files");
@@ -9965,7 +9905,7 @@ function transformAliases(ids) {
9965
9905
  return Array.from(set);
9966
9906
  }
9967
9907
  function getAddonOptionFlags() {
9968
- const options$6 = [];
9908
+ const options$5 = [];
9969
9909
  for (const addon of officialAddons) {
9970
9910
  const id = addon.id;
9971
9911
  const details = getAddonDetails(id);
@@ -9978,36 +9918,36 @@ function getAddonOptionFlags() {
9978
9918
  prev = prev.concat(value.split(/\s|,/));
9979
9919
  return prev;
9980
9920
  });
9981
- options$6.push(option);
9921
+ options$5.push(option);
9982
9922
  }
9983
- return options$6;
9923
+ return options$5;
9984
9924
  }
9985
9925
  function getOptionChoices(details) {
9986
9926
  const choices = [];
9987
9927
  const defaults = [];
9988
9928
  const groups = {};
9989
- const options$6 = {};
9929
+ const options$5 = {};
9990
9930
  for (const [id, question] of Object.entries(details.options)) {
9991
9931
  let values = [];
9992
- const applyDefault = question.condition?.(options$6) !== false;
9932
+ const applyDefault = question.condition?.(options$5) !== false;
9993
9933
  if (question.type === "boolean") {
9994
9934
  values = [id, `no-${id}`];
9995
9935
  if (applyDefault) {
9996
- options$6[id] = question.default;
9936
+ options$5[id] = question.default;
9997
9937
  defaults.push(question.default ? values[0] : values[1]);
9998
9938
  }
9999
9939
  }
10000
9940
  if (question.type === "select") {
10001
9941
  values = question.options.map((o) => o.value);
10002
9942
  if (applyDefault) {
10003
- options$6[id] = question.default;
9943
+ options$5[id] = question.default;
10004
9944
  defaults.push(question.default);
10005
9945
  }
10006
9946
  }
10007
9947
  if (question.type === "multiselect") {
10008
9948
  values = question.options.map((o) => o.value);
10009
9949
  if (applyDefault) {
10010
- options$6[id] = question.default;
9950
+ options$5[id] = question.default;
10011
9951
  defaults.push(...question.default);
10012
9952
  }
10013
9953
  }
@@ -10044,9 +9984,9 @@ const OptionsSchema = strictObject({
10044
9984
  });
10045
9985
  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").configureHelp(helpConfig).action((projectPath, opts) => {
10046
9986
  const cwd = parse(ProjectPathSchema, projectPath);
10047
- const options$6 = parse(OptionsSchema, opts);
9987
+ const options$5 = parse(OptionsSchema, opts);
10048
9988
  runCommand(async () => {
10049
- const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$6);
9989
+ const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$5);
10050
9990
  const highlight = (str) => import_picocolors$1.default.bold(import_picocolors$1.default.cyan(str));
10051
9991
  let i = 1;
10052
9992
  const initialSteps = [];
@@ -10075,7 +10015,7 @@ const create$1 = new Command("create").description("scaffolds a new SvelteKit pr
10075
10015
  if (addOnNextSteps) box(addOnNextSteps, "Add-on next steps");
10076
10016
  });
10077
10017
  });
10078
- async function createProject(cwd, options$6) {
10018
+ async function createProject(cwd, options$5) {
10079
10019
  const { directory, template, language } = await group({
10080
10020
  directory: () => {
10081
10021
  if (cwd) return Promise.resolve(path.resolve(cwd));
@@ -10099,7 +10039,7 @@ async function createProject(cwd, options$6) {
10099
10039
  }
10100
10040
  },
10101
10041
  template: () => {
10102
- if (options$6.template) return Promise.resolve(options$6.template);
10042
+ if (options$5.template) return Promise.resolve(options$5.template);
10103
10043
  return select({
10104
10044
  message: "Which template would you like?",
10105
10045
  initialValue: "minimal",
@@ -10111,7 +10051,7 @@ async function createProject(cwd, options$6) {
10111
10051
  });
10112
10052
  },
10113
10053
  language: () => {
10114
- if (options$6.types) return Promise.resolve(options$6.types);
10054
+ if (options$5.types) return Promise.resolve(options$5.types);
10115
10055
  return select({
10116
10056
  message: "Add type checking with Typescript?",
10117
10057
  initialValue: "typescript",
@@ -10146,19 +10086,20 @@ async function createProject(cwd, options$6) {
10146
10086
  let addOnNextSteps;
10147
10087
  const installDeps = async () => {
10148
10088
  packageManager = await packageManagerPrompt(projectPath);
10089
+ addPnpmBuildDependendencies(projectPath, packageManager, ["esbuild"]);
10149
10090
  if (packageManager) await installDependencies(packageManager, projectPath);
10150
10091
  };
10151
- if (options$6.addOns) {
10092
+ if (options$5.addOns) {
10152
10093
  const { nextSteps, packageManager: pm } = await runAddCommand({
10153
10094
  cwd: projectPath,
10154
- install: options$6.install,
10095
+ install: options$5.install,
10155
10096
  preconditions: false,
10156
10097
  community: []
10157
10098
  }, []);
10158
10099
  packageManager = pm;
10159
10100
  addOnNextSteps = nextSteps;
10160
- } else if (options$6.install) await installDeps();
10161
- if (packageManager === null && options$6.install) await installDeps();
10101
+ } else if (options$5.install) await installDeps();
10102
+ if (packageManager === null && options$5.install) await installDeps();
10162
10103
  return {
10163
10104
  directory: projectPath,
10164
10105
  addOnNextSteps,
@@ -10171,8 +10112,8 @@ async function createProject(cwd, options$6) {
10171
10112
  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() {
10172
10113
  runMigrate(process$1.cwd(), ["--help"]);
10173
10114
  return "";
10174
- } }).action((migration, options$6) => {
10175
- runMigrate(options$6.cwd, [migration]);
10115
+ } }).action((migration, options$5) => {
10116
+ runMigrate(options$5.cwd, [migration]);
10176
10117
  });
10177
10118
  function runMigrate(cwd, args) {
10178
10119
  const pm = getUserAgent() ?? "npm";
@@ -10195,8 +10136,8 @@ var import_picocolors = __toESM(require_picocolors(), 1);
10195
10136
  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() {
10196
10137
  runCheck(process$1.cwd(), ["--help"]);
10197
10138
  return "";
10198
- } }).action((options$6, check$1) => {
10199
- const cwd = options$6.cwd;
10139
+ } }).action((options$5, check$1) => {
10140
+ const cwd = options$5.cwd;
10200
10141
  const args = check$1.args;
10201
10142
  runCheck(cwd, args);
10202
10143
  });