sv 0.6.18 → 0.6.20

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-f0ge7H2V.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-PTlNv0EA.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.18";
15
+ var version = "0.6.20";
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"];
@@ -4556,8 +4557,11 @@ var sveltekit_adapter_default = defineAddon({
4556
4557
  } else imports_exports.addDefault(ast, adapter.package, adapterName);
4557
4558
  const { value: config } = exports_exports.defaultExport(ast, object_exports.createEmpty());
4558
4559
  const kitConfig = config.properties.find((p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "kit");
4559
- if (kitConfig && kitConfig.value.type === "ObjectExpression") object_exports.overrideProperties(kitConfig.value, { adapter: function_exports.callByIdentifier(adapterName, []) });
4560
- else object_exports.properties(config, { kit: object_exports.create({ adapter: function_exports.callByIdentifier(adapterName, []) }) });
4560
+ if (kitConfig && kitConfig.value.type === "ObjectExpression") {
4561
+ const adapterProp = kitConfig.value.properties.find((p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "adapter");
4562
+ if (adapterProp) adapterProp.comments = [];
4563
+ object_exports.overrideProperties(kitConfig.value, { adapter: function_exports.callByIdentifier(adapterName, []) });
4564
+ } else object_exports.properties(config, { kit: object_exports.create({ adapter: function_exports.callByIdentifier(adapterName, []) }) });
4561
4565
  return generateCode();
4562
4566
  });
4563
4567
  }
@@ -4965,7 +4969,7 @@ const warned = {
4965
4969
  storeName: false
4966
4970
  };
4967
4971
  var MagicString = class MagicString {
4968
- constructor(string$1, options$6 = {}) {
4972
+ constructor(string$1, options$5 = {}) {
4969
4973
  const chunk = new Chunk(0, string$1.length, string$1);
4970
4974
  Object.defineProperties(this, {
4971
4975
  original: {
@@ -5002,11 +5006,11 @@ var MagicString = class MagicString {
5002
5006
  },
5003
5007
  filename: {
5004
5008
  writable: true,
5005
- value: options$6.filename
5009
+ value: options$5.filename
5006
5010
  },
5007
5011
  indentExclusionRanges: {
5008
5012
  writable: true,
5009
- value: options$6.indentExclusionRanges
5013
+ value: options$5.indentExclusionRanges
5010
5014
  },
5011
5015
  sourcemapLocations: {
5012
5016
  writable: true,
@@ -5022,11 +5026,11 @@ var MagicString = class MagicString {
5022
5026
  },
5023
5027
  ignoreList: {
5024
5028
  writable: true,
5025
- value: options$6.ignoreList
5029
+ value: options$5.ignoreList
5026
5030
  },
5027
5031
  offset: {
5028
5032
  writable: true,
5029
- value: options$6.offset || 0
5033
+ value: options$5.offset || 0
5030
5034
  }
5031
5035
  });
5032
5036
  this.byStart[0] = chunk;
@@ -5084,11 +5088,11 @@ else this.outro += content;
5084
5088
  cloned.outro = this.outro;
5085
5089
  return cloned;
5086
5090
  }
5087
- generateDecodedMap(options$6) {
5088
- options$6 = options$6 || {};
5091
+ generateDecodedMap(options$5) {
5092
+ options$5 = options$5 || {};
5089
5093
  const sourceIndex = 0;
5090
5094
  const names = Object.keys(this.storedNames);
5091
- const mappings = new Mappings(options$6.hires);
5095
+ const mappings = new Mappings(options$5.hires);
5092
5096
  const locate = getLocator(this.original);
5093
5097
  if (this.intro) mappings.advance(this.intro);
5094
5098
  this.firstChunk.eachNext((chunk) => {
@@ -5099,16 +5103,16 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
5099
5103
  if (chunk.outro.length) mappings.advance(chunk.outro);
5100
5104
  });
5101
5105
  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,
5106
+ file: options$5.file ? options$5.file.split(/[/\\]/).pop() : undefined,
5107
+ sources: [options$5.source ? getRelativePath(options$5.file || "", options$5.source) : options$5.file || ""],
5108
+ sourcesContent: options$5.includeContent ? [this.original] : undefined,
5105
5109
  names,
5106
5110
  mappings: mappings.raw,
5107
5111
  x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
5108
5112
  };
5109
5113
  }
5110
- generateMap(options$6) {
5111
- return new SourceMap(this.generateDecodedMap(options$6));
5114
+ generateMap(options$5) {
5115
+ return new SourceMap(this.generateDecodedMap(options$5));
5112
5116
  }
5113
5117
  _ensureindentStr() {
5114
5118
  if (this.indentStr === undefined) this.indentStr = guessIndent(this.original);
@@ -5121,10 +5125,10 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
5121
5125
  this._ensureindentStr();
5122
5126
  return this.indentStr === null ? " " : this.indentStr;
5123
5127
  }
5124
- indent(indentStr, options$6) {
5128
+ indent(indentStr, options$5) {
5125
5129
  const pattern = /^[^\r\n]/gm;
5126
5130
  if (isObject(indentStr)) {
5127
- options$6 = indentStr;
5131
+ options$5 = indentStr;
5128
5132
  indentStr = undefined;
5129
5133
  }
5130
5134
  if (indentStr === undefined) {
@@ -5132,15 +5136,15 @@ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sour
5132
5136
  indentStr = this.indentStr || " ";
5133
5137
  }
5134
5138
  if (indentStr === "") return this;
5135
- options$6 = options$6 || {};
5139
+ options$5 = options$5 || {};
5136
5140
  const isExcluded = {};
5137
- if (options$6.exclude) {
5138
- const exclusions = typeof options$6.exclude[0] === "number" ? [options$6.exclude] : options$6.exclude;
5141
+ if (options$5.exclude) {
5142
+ const exclusions = typeof options$5.exclude[0] === "number" ? [options$5.exclude] : options$5.exclude;
5139
5143
  exclusions.forEach((exclusion) => {
5140
5144
  for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
5141
5145
  });
5142
5146
  }
5143
- let shouldIndentNextCharacter = options$6.indentStart !== false;
5147
+ let shouldIndentNextCharacter = options$5.indentStart !== false;
5144
5148
  const replacer = (match) => {
5145
5149
  if (shouldIndentNextCharacter) return `${indentStr}${match}`;
5146
5150
  shouldIndentNextCharacter = true;
@@ -5228,14 +5232,14 @@ else {
5228
5232
  if (!newRight) this.lastChunk = last;
5229
5233
  return this;
5230
5234
  }
5231
- overwrite(start, end, content, options$6) {
5232
- options$6 = options$6 || {};
5235
+ overwrite(start, end, content, options$5) {
5236
+ options$5 = options$5 || {};
5233
5237
  return this.update(start, end, content, {
5234
- ...options$6,
5235
- overwrite: !options$6.contentOnly
5238
+ ...options$5,
5239
+ overwrite: !options$5.contentOnly
5236
5240
  });
5237
5241
  }
5238
- update(start, end, content, options$6) {
5242
+ update(start, end, content, options$5) {
5239
5243
  start = start + this.offset;
5240
5244
  end = end + this.offset;
5241
5245
  if (typeof content !== "string") throw new TypeError("replacement content must be a string");
@@ -5247,15 +5251,15 @@ else {
5247
5251
  if (start === end) throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
5248
5252
  this._split(start);
5249
5253
  this._split(end);
5250
- if (options$6 === true) {
5254
+ if (options$5 === true) {
5251
5255
  if (!warned.storeName) {
5252
5256
  console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
5253
5257
  warned.storeName = true;
5254
5258
  }
5255
- options$6 = { storeName: true };
5259
+ options$5 = { storeName: true };
5256
5260
  }
5257
- const storeName = options$6 !== undefined ? options$6.storeName : false;
5258
- const overwrite = options$6 !== undefined ? options$6.overwrite : false;
5261
+ const storeName = options$5 !== undefined ? options$5.storeName : false;
5262
+ const overwrite = options$5 !== undefined ? options$5.overwrite : false;
5259
5263
  if (storeName) {
5260
5264
  const original = this.original.slice(start, end);
5261
5265
  Object.defineProperty(this.storedNames, original, {
@@ -5581,11 +5585,12 @@ else return replacement(...match, match.index, str, match.groups);
5581
5585
  const TABLE_TYPE = {
5582
5586
  mysql: "mysqlTable",
5583
5587
  postgresql: "pgTable",
5584
- sqlite: "sqliteTable"
5588
+ sqlite: "sqliteTable",
5589
+ turso: "sqliteTable"
5585
5590
  };
5586
5591
  let drizzleDialect;
5587
5592
  let schemaPath;
5588
- const options$3 = defineAddonOptions({ demo: {
5593
+ const options$2 = defineAddonOptions({ demo: {
5589
5594
  type: "boolean",
5590
5595
  default: true,
5591
5596
  question: `Do you want to include a demo? ${colors.dim("(includes a login/register page)")}`
@@ -5594,16 +5599,16 @@ var lucia_default = defineAddon({
5594
5599
  id: "lucia",
5595
5600
  shortDescription: "auth guide",
5596
5601
  homepage: "https://lucia-auth.com",
5597
- options: options$3,
5602
+ options: options$2,
5598
5603
  setup: ({ kit, dependencyVersion, unsupported, dependsOn }) => {
5599
5604
  if (!kit) unsupported("Requires SvelteKit");
5600
5605
  if (!dependencyVersion("drizzle-orm")) dependsOn("drizzle");
5601
5606
  },
5602
- run: ({ sv, typescript, options: options$6, kit, dependencyVersion }) => {
5607
+ run: ({ sv, typescript, options: options$5, kit, dependencyVersion }) => {
5603
5608
  const ext = typescript ? "ts" : "js";
5604
5609
  sv.dependency("@oslojs/crypto", "^1.0.1");
5605
5610
  sv.dependency("@oslojs/encoding", "^1.1.0");
5606
- if (options$6.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
5611
+ if (options$5.demo) sv.dependency("@node-rs/argon2", "^2.0.2");
5607
5612
  sv.file(`drizzle.config.${ext}`, (content) => {
5608
5613
  const { ast, generateCode } = parseScript(content);
5609
5614
  const isProp = (name$1, node) => node.key.type === "Identifier" && node.key.name === name$1;
@@ -5630,14 +5635,14 @@ var lucia_default = defineAddon({
5630
5635
  const userAttributes = userTable.arguments[1];
5631
5636
  const sessionAttributes = sessionTable.arguments[1];
5632
5637
  if (userAttributes?.type !== "ObjectExpression" || sessionAttributes?.type !== "ObjectExpression") throw new Error("unexpected shape of `user` or `session` table definition");
5633
- if (drizzleDialect === "sqlite") {
5638
+ if (drizzleDialect === "sqlite" || drizzleDialect === "turso") {
5634
5639
  imports_exports.addNamed(ast, "drizzle-orm/sqlite-core", {
5635
5640
  sqliteTable: "sqliteTable",
5636
5641
  text: "text",
5637
5642
  integer: "integer"
5638
5643
  });
5639
5644
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
5640
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
5645
+ if (options$5.demo) object_exports.overrideProperties(userAttributes, {
5641
5646
  username: common_exports.expressionFromString("text('username').notNull().unique()"),
5642
5647
  passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
5643
5648
  });
@@ -5654,7 +5659,7 @@ var lucia_default = defineAddon({
5654
5659
  datetime: "datetime"
5655
5660
  });
5656
5661
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("varchar('id', { length: 255 }).primaryKey()") });
5657
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
5662
+ if (options$5.demo) object_exports.overrideProperties(userAttributes, {
5658
5663
  username: common_exports.expressionFromString("varchar('username', { length: 32 }).notNull().unique()"),
5659
5664
  passwordHash: common_exports.expressionFromString("varchar('password_hash', { length: 255 }).notNull()")
5660
5665
  });
@@ -5671,7 +5676,7 @@ var lucia_default = defineAddon({
5671
5676
  timestamp: "timestamp"
5672
5677
  });
5673
5678
  object_exports.overrideProperties(userAttributes, { id: common_exports.expressionFromString("text('id').primaryKey()") });
5674
- if (options$6.demo) object_exports.overrideProperties(userAttributes, {
5679
+ if (options$5.demo) object_exports.overrideProperties(userAttributes, {
5675
5680
  username: common_exports.expressionFromString("text('username').notNull().unique()"),
5676
5681
  passwordHash: common_exports.expressionFromString("text('password_hash').notNull()")
5677
5682
  });
@@ -5824,7 +5829,7 @@ var lucia_default = defineAddon({
5824
5829
  kit_exports.addHooksHandle(ast, typescript, "handleAuth", getAuthHandleContent());
5825
5830
  return generateCode();
5826
5831
  });
5827
- if (options$6.demo) {
5832
+ if (options$5.demo) {
5828
5833
  sv.file(`${kit?.routesDirectory}/demo/+page.svelte`, (content) => {
5829
5834
  return addToDemoPage(content, "lucia");
5830
5835
  });
@@ -6035,9 +6040,9 @@ var lucia_default = defineAddon({
6035
6040
  });
6036
6041
  }
6037
6042
  },
6038
- nextSteps: ({ highlighter, options: options$6, packageManager }) => {
6043
+ nextSteps: ({ highlighter, options: options$5, packageManager }) => {
6039
6044
  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`);
6045
+ if (options$5.demo) steps.push(`Visit ${highlighter.route("/demo/lucia")} route to view the demo`);
6041
6046
  return steps;
6042
6047
  }
6043
6048
  });
@@ -6147,7 +6152,7 @@ function appendElement(childNodes, elementToAppend) {
6147
6152
  childNodes.push(elementToAppend);
6148
6153
  }
6149
6154
  function addFromRawHtml(childNodes, html) {
6150
- const document = parseHtml$1(html);
6155
+ const document = parseHtml(html);
6151
6156
  for (const childNode of document.childNodes) childNodes.push(childNode);
6152
6157
  }
6153
6158
  function addSlot(jsAst, htmlAst, svelteVersion) {
@@ -6176,7 +6181,7 @@ const DEFAULT_INLANG_PROJECT = {
6176
6181
  ],
6177
6182
  "plugin.inlang.messageFormat": { pathPattern: "./messages/{languageTag}.json" }
6178
6183
  };
6179
- const options$2 = defineAddonOptions({
6184
+ const options$1 = defineAddonOptions({
6180
6185
  availableLanguageTags: {
6181
6186
  question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
6182
6187
  type: "string",
@@ -6205,11 +6210,11 @@ var paraglide_default = defineAddon({
6205
6210
  id: "paraglide",
6206
6211
  shortDescription: "i18n",
6207
6212
  homepage: "https://inlang.com",
6208
- options: options$2,
6213
+ options: options$1,
6209
6214
  setup: ({ kit, unsupported }) => {
6210
6215
  if (!kit) unsupported("Requires SvelteKit");
6211
6216
  },
6212
- run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
6217
+ run: ({ sv, options: options$5, typescript, kit, dependencyVersion }) => {
6213
6218
  const ext = typescript ? "ts" : "js";
6214
6219
  if (!kit) throw new Error("SvelteKit is required");
6215
6220
  const paraglideOutDir = "src/lib/paraglide";
@@ -6218,7 +6223,7 @@ var paraglide_default = defineAddon({
6218
6223
  if (content) return content;
6219
6224
  const { data, generateCode } = parseJson(content);
6220
6225
  for (const key in DEFAULT_INLANG_PROJECT) data[key] = DEFAULT_INLANG_PROJECT[key];
6221
- const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.availableLanguageTags);
6226
+ const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$5.availableLanguageTags);
6222
6227
  const sourceLanguageTag = validLanguageTags$1[0];
6223
6228
  data.sourceLanguageTag = sourceLanguageTag;
6224
6229
  data.languageTags = validLanguageTags$1;
@@ -6288,7 +6293,7 @@ var paraglide_default = defineAddon({
6288
6293
  });
6289
6294
  });
6290
6295
  sv.file("src/app.html", (content) => {
6291
- const { ast, generateCode } = parseHtml(content);
6296
+ const { ast, generateCode } = parseHtml$1(content);
6292
6297
  const htmlNode = ast.children.find((child) => child.type === esm_exports.Tag && child.name === "html");
6293
6298
  if (!htmlNode) {
6294
6299
  log$1.warn("Could not find <html> node in app.html. You'll need to add the language placeholder manually");
@@ -6306,7 +6311,7 @@ var paraglide_default = defineAddon({
6306
6311
  if (!content.includes(`\n${paraglideOutDir}`)) content = content.trimEnd() + `\n\n# Paraglide\n${paraglideOutDir}`;
6307
6312
  return content;
6308
6313
  });
6309
- if (options$6.demo) {
6314
+ if (options$5.demo) {
6310
6315
  sv.file(`${kit.routesDirectory}/demo/+page.svelte`, (content) => {
6311
6316
  return addToDemoPage(content, "paraglide");
6312
6317
  });
@@ -6335,7 +6340,7 @@ var paraglide_default = defineAddon({
6335
6340
  }
6336
6341
  const templateCode = new MagicString(template.source);
6337
6342
  templateCode.append("\n\n<h1>{m.hello_world({ name: 'SvelteKit User' })}</h1>\n");
6338
- const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$6.availableLanguageTags);
6343
+ const { validLanguageTags: validLanguageTags$1 } = parseLanguageTagInput(options$5.availableLanguageTags);
6339
6344
  const links = validLanguageTags$1.map((x) => `${templateCode.getIndentString()}<button onclick={() => switchToLanguage('${x}')}>${x}</button>`).join("\n");
6340
6345
  templateCode.append(`<div>\n${links}\n</div>`);
6341
6346
  return generateCode({
@@ -6344,7 +6349,7 @@ var paraglide_default = defineAddon({
6344
6349
  });
6345
6350
  });
6346
6351
  }
6347
- const { validLanguageTags } = parseLanguageTagInput(options$6.availableLanguageTags);
6352
+ const { validLanguageTags } = parseLanguageTagInput(options$5.availableLanguageTags);
6348
6353
  for (const languageTag of validLanguageTags) sv.file(`messages/${languageTag}.json`, (content) => {
6349
6354
  const { data, generateCode } = parseJson(content);
6350
6355
  data["$schema"] = "https://inlang.com/schema/inlang-message-format";
@@ -6354,7 +6359,7 @@ var paraglide_default = defineAddon({
6354
6359
  },
6355
6360
  nextSteps: ({ highlighter }) => {
6356
6361
  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`);
6362
+ if (options$1.demo) steps.push(`Visit ${highlighter.route("/demo/paraglide")} route to view the demo`);
6358
6363
  return steps;
6359
6364
  }
6360
6365
  });
@@ -6458,8 +6463,8 @@ var prettier_default = defineAddon({
6458
6463
  }
6459
6464
  data.plugins ??= [];
6460
6465
  data.overrides ??= [];
6461
- const plugins$1 = data.plugins;
6462
- if (!plugins$1.includes("prettier-plugin-svelte")) data.plugins.unshift("prettier-plugin-svelte");
6466
+ const plugins = data.plugins;
6467
+ if (!plugins.includes("prettier-plugin-svelte")) data.plugins.unshift("prettier-plugin-svelte");
6463
6468
  const overrides = data.overrides;
6464
6469
  const override = overrides.find((o) => o?.options?.parser === "svelte");
6465
6470
  if (!override) overrides.push({
@@ -6531,98 +6536,34 @@ else ast.prepend(rule);
6531
6536
 
6532
6537
  //#endregion
6533
6538
  //#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
6539
  var tailwindcss_default = defineAddon({
6565
6540
  id: "tailwindcss",
6566
6541
  alias: "tailwind",
6567
6542
  shortDescription: "css framework",
6568
6543
  homepage: "https://tailwindcss.com",
6569
- options: options$1,
6570
- run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
6544
+ options: {},
6545
+ run: ({ sv, typescript, kit, dependencyVersion }) => {
6571
6546
  const ext = typescript ? "ts" : "js";
6572
6547
  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) => {
6548
+ sv.devDependency("tailwindcss", "^4.0.0");
6549
+ sv.devDependency("@tailwindcss/vite", "^4.0.0");
6550
+ if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.6.11");
6551
+ sv.file(`vite.config.${ext}`, (content) => {
6608
6552
  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());
6553
+ const vitePluginName = "tailwindcss";
6554
+ imports_exports.addDefault(ast, "@tailwindcss/vite", vitePluginName);
6555
+ const { value: rootObject } = exports_exports.defaultExport(ast, function_exports.call("defineConfig", []));
6556
+ const param1 = function_exports.argumentByIndex(rootObject, 0, object_exports.createEmpty());
6557
+ const pluginsArray = object_exports.property(param1, "plugins", array_exports.createEmpty());
6558
+ const pluginFunctionCall = function_exports.call(vitePluginName, []);
6559
+ array_exports.push(pluginsArray, pluginFunctionCall);
6613
6560
  return generateCode();
6614
6561
  });
6615
6562
  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;
6563
+ if (content.includes("tailwindcss")) return content;
6622
6564
  const { ast, generateCode } = parseCss(content);
6623
6565
  const originalFirst = ast.first;
6624
- const specifiers = layerImports.map((i) => `'${i}'`);
6625
- const nodes = addImports(ast, specifiers);
6566
+ const nodes = addImports(ast, ["'tailwindcss'"]);
6626
6567
  if (originalFirst !== ast.first && originalFirst?.type === "atrule" && originalFirst.name === "import") originalFirst.raws.before = "\n";
6627
6568
  nodes.shift();
6628
6569
  nodes.forEach((n$1) => n$1.raws.before = "\n");
@@ -6650,8 +6591,8 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
6650
6591
  const { data, generateCode } = parseJson(content);
6651
6592
  const PLUGIN_NAME = "prettier-plugin-tailwindcss";
6652
6593
  data.plugins ??= [];
6653
- const plugins$1 = data.plugins;
6654
- if (!plugins$1.includes(PLUGIN_NAME)) plugins$1.push(PLUGIN_NAME);
6594
+ const plugins = data.plugins;
6595
+ if (!plugins.includes(PLUGIN_NAME)) plugins.push(PLUGIN_NAME);
6655
6596
  return generateCode();
6656
6597
  });
6657
6598
  }
@@ -9532,14 +9473,14 @@ function verifyPackage(pkg, specifier) {
9532
9473
  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
9474
  }
9534
9475
  }
9535
- async function downloadPackage(options$6) {
9536
- const { pkg } = options$6;
9537
- if (options$6.path) {
9476
+ async function downloadPackage(options$5) {
9477
+ const { pkg } = options$5;
9478
+ if (options$5.path) {
9538
9479
  const dest = path.join(NODE_MODULES, pkg.name.split("/").join(path.sep));
9539
9480
  if (fs.existsSync(dest)) fs.rmSync(dest);
9540
9481
  const dir = path.dirname(dest);
9541
9482
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
9542
- fs.symlinkSync(options$6.path, dest);
9483
+ fs.symlinkSync(options$5.path, dest);
9543
9484
  const { default: details$1 } = await import(pkg.name);
9544
9485
  return details$1;
9545
9486
  }
@@ -9662,7 +9603,7 @@ const add = new Command("add").description("applies specified add-ons into a pro
9662
9603
  process$1.exit(1);
9663
9604
  }
9664
9605
  const specifiedAddons = parse(AddonsSchema, addonArgs);
9665
- const options$6 = parse(OptionsSchema$1, opts);
9606
+ const options$5 = parse(OptionsSchema$1, opts);
9666
9607
  const addonIds = officialAddons.map((addon) => addon.id);
9667
9608
  const invalidAddons = specifiedAddons.filter((a) => !addonIds.includes(a) && !aliases.includes(a));
9668
9609
  if (invalidAddons.length > 0) {
@@ -9671,12 +9612,12 @@ const add = new Command("add").description("applies specified add-ons into a pro
9671
9612
  }
9672
9613
  const selectedAddons = transformAliases(specifiedAddons);
9673
9614
  runCommand(async () => {
9674
- const { nextSteps } = await runAddCommand(options$6, selectedAddons);
9615
+ const { nextSteps } = await runAddCommand(options$5, selectedAddons);
9675
9616
  if (nextSteps) box(nextSteps, "Next steps");
9676
9617
  });
9677
9618
  });
9678
9619
  for (const option of addonsOptions) add.addOption(option);
9679
- async function runAddCommand(options$6, selectedAddonIds) {
9620
+ async function runAddCommand(options$5, selectedAddonIds) {
9680
9621
  const selectedAddons = selectedAddonIds.map((id) => ({
9681
9622
  type: "official",
9682
9623
  addon: getAddonDetails(id)
@@ -9686,7 +9627,7 @@ async function runAddCommand(options$6, selectedAddonIds) {
9686
9627
  for (const addonOption of addonsOptions) {
9687
9628
  const addonId = addonOption.name();
9688
9629
  const aliased = addonOption.attributeName();
9689
- const specifiedOptions = options$6[addonId] || options$6[aliased];
9630
+ const specifiedOptions = options$5[addonId] || options$5[aliased];
9690
9631
  if (!specifiedOptions) continue;
9691
9632
  const details$1 = getAddonDetails(addonId);
9692
9633
  if (!selectedAddons.find((d) => d.addon === details$1)) selectedAddons.push({
@@ -9716,7 +9657,7 @@ async function runAddCommand(options$6, selectedAddonIds) {
9716
9657
  for (const [id, question] of Object.entries(details$1.options)) if (question.condition?.(official[addonId]) !== false) official[addonId][id] ??= question.default;
9717
9658
  else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--${addonId}' option specified: '${official[addonId][id]}'`);
9718
9659
  }
9719
- if (options$6.community === true) {
9660
+ if (options$5.community === true) {
9720
9661
  const communityAddons = await Promise.all(communityAddonIds.map(async (id) => await getCommunityAddon(id)));
9721
9662
  const promptOptions = communityAddons.map((addon) => ({
9722
9663
  value: addon.id,
@@ -9735,10 +9676,10 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9735
9676
  cancel("No add-ons selected. Exiting.");
9736
9677
  process$1.exit(1);
9737
9678
  }
9738
- options$6.community = selected;
9679
+ options$5.community = selected;
9739
9680
  }
9740
- if (Array.isArray(options$6.community) && options$6.community.length > 0) {
9741
- const addons = options$6.community.map((id) => {
9681
+ if (Array.isArray(options$5.community) && options$5.community.length > 0) {
9682
+ const addons = options$5.community.map((id) => {
9742
9683
  const hasDirective = Object.values(Directive).some((directive) => id.startsWith(directive));
9743
9684
  if (hasDirective) return id;
9744
9685
  const validAddon = communityAddonIds.includes(id);
@@ -9750,7 +9691,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9750
9691
  start("Resolving community add-on packages");
9751
9692
  const pkgs = await Promise.all(addons.map(async (id) => {
9752
9693
  return await getPackageJSON({
9753
- cwd: options$6.cwd,
9694
+ cwd: options$5.cwd,
9754
9695
  packageName: id
9755
9696
  });
9756
9697
  }));
@@ -9787,7 +9728,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9787
9728
  throw err;
9788
9729
  }
9789
9730
  }
9790
- let workspace = createWorkspace({ cwd: options$6.cwd });
9731
+ let workspace = createWorkspace({ cwd: options$5.cwd });
9791
9732
  const addonSetupResults = setupAddons(officialAddons, workspace);
9792
9733
  if (selectedAddons.length === 0) {
9793
9734
  const addonOptions = officialAddons.filter(({ id }) => addonSetupResults[id].unsupported.length === 0).map(({ id, homepage: homepage$1, shortDescription }) => ({
@@ -9830,9 +9771,9 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9830
9771
  });
9831
9772
  }
9832
9773
  }
9833
- if (options$6.preconditions && selectedAddons.length > 0) {
9774
+ if (options$5.preconditions && selectedAddons.length > 0) {
9834
9775
  const addons = selectedAddons.map(({ addon }) => addon);
9835
- const { preconditions } = getGlobalPreconditions(options$6.cwd, addons, addonSetupResults);
9776
+ const { preconditions } = getGlobalPreconditions(options$5.cwd, addons, addonSetupResults);
9836
9777
  const fails = [];
9837
9778
  for (const condition of preconditions) {
9838
9779
  const { message, success } = await condition.run();
@@ -9903,23 +9844,26 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9903
9844
  }
9904
9845
  }
9905
9846
  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
9847
  const officialDetails = Object.keys(official).map((id) => getAddonDetails(id));
9912
9848
  const commDetails = Object.keys(community).map((id) => communityDetails.find((a) => a.id === id));
9913
9849
  const details = officialDetails.concat(commDetails);
9914
9850
  const addonMap = Object.assign({}, ...details.map((a) => ({ [a.id]: a })));
9915
- const filesToFormat = await applyAddons({
9851
+ const { filesToFormat, pnpmBuildDependencies: addonPnpmBuildDependencies } = await applyAddons({
9916
9852
  workspace,
9917
9853
  addonSetupResults,
9918
9854
  addons: addonMap,
9919
9855
  options: official
9920
9856
  });
9921
9857
  log.success("Successfully setup add-ons");
9922
- if (packageManager && options$6.install) await installDependencies(packageManager, options$6.cwd);
9858
+ let packageManager;
9859
+ if (options$5.install) {
9860
+ packageManager = await packageManagerPrompt(options$5.cwd);
9861
+ if (packageManager) {
9862
+ workspace.packageManager = packageManager;
9863
+ addPnpmBuildDependendencies(workspace.cwd, packageManager, ["esbuild", ...addonPnpmBuildDependencies]);
9864
+ await installDependencies(packageManager, options$5.cwd);
9865
+ }
9866
+ }
9923
9867
  workspace = createWorkspace(workspace);
9924
9868
  if (filesToFormat.length > 0 && packageManager && !!workspace.dependencyVersion("prettier")) {
9925
9869
  const { start, stop } = spinner();
@@ -9927,7 +9871,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '--$
9927
9871
  try {
9928
9872
  await formatFiles({
9929
9873
  packageManager,
9930
- cwd: options$6.cwd,
9874
+ cwd: options$5.cwd,
9931
9875
  paths: filesToFormat
9932
9876
  });
9933
9877
  stop("Successfully formatted modified files");
@@ -9965,7 +9909,7 @@ function transformAliases(ids) {
9965
9909
  return Array.from(set);
9966
9910
  }
9967
9911
  function getAddonOptionFlags() {
9968
- const options$6 = [];
9912
+ const options$5 = [];
9969
9913
  for (const addon of officialAddons) {
9970
9914
  const id = addon.id;
9971
9915
  const details = getAddonDetails(id);
@@ -9978,36 +9922,36 @@ function getAddonOptionFlags() {
9978
9922
  prev = prev.concat(value.split(/\s|,/));
9979
9923
  return prev;
9980
9924
  });
9981
- options$6.push(option);
9925
+ options$5.push(option);
9982
9926
  }
9983
- return options$6;
9927
+ return options$5;
9984
9928
  }
9985
9929
  function getOptionChoices(details) {
9986
9930
  const choices = [];
9987
9931
  const defaults = [];
9988
9932
  const groups = {};
9989
- const options$6 = {};
9933
+ const options$5 = {};
9990
9934
  for (const [id, question] of Object.entries(details.options)) {
9991
9935
  let values = [];
9992
- const applyDefault = question.condition?.(options$6) !== false;
9936
+ const applyDefault = question.condition?.(options$5) !== false;
9993
9937
  if (question.type === "boolean") {
9994
9938
  values = [id, `no-${id}`];
9995
9939
  if (applyDefault) {
9996
- options$6[id] = question.default;
9940
+ options$5[id] = question.default;
9997
9941
  defaults.push(question.default ? values[0] : values[1]);
9998
9942
  }
9999
9943
  }
10000
9944
  if (question.type === "select") {
10001
9945
  values = question.options.map((o) => o.value);
10002
9946
  if (applyDefault) {
10003
- options$6[id] = question.default;
9947
+ options$5[id] = question.default;
10004
9948
  defaults.push(question.default);
10005
9949
  }
10006
9950
  }
10007
9951
  if (question.type === "multiselect") {
10008
9952
  values = question.options.map((o) => o.value);
10009
9953
  if (applyDefault) {
10010
- options$6[id] = question.default;
9954
+ options$5[id] = question.default;
10011
9955
  defaults.push(...question.default);
10012
9956
  }
10013
9957
  }
@@ -10044,9 +9988,9 @@ const OptionsSchema = strictObject({
10044
9988
  });
10045
9989
  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
9990
  const cwd = parse(ProjectPathSchema, projectPath);
10047
- const options$6 = parse(OptionsSchema, opts);
9991
+ const options$5 = parse(OptionsSchema, opts);
10048
9992
  runCommand(async () => {
10049
- const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$6);
9993
+ const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$5);
10050
9994
  const highlight = (str) => import_picocolors$1.default.bold(import_picocolors$1.default.cyan(str));
10051
9995
  let i = 1;
10052
9996
  const initialSteps = [];
@@ -10075,7 +10019,7 @@ const create$1 = new Command("create").description("scaffolds a new SvelteKit pr
10075
10019
  if (addOnNextSteps) box(addOnNextSteps, "Add-on next steps");
10076
10020
  });
10077
10021
  });
10078
- async function createProject(cwd, options$6) {
10022
+ async function createProject(cwd, options$5) {
10079
10023
  const { directory, template, language } = await group({
10080
10024
  directory: () => {
10081
10025
  if (cwd) return Promise.resolve(path.resolve(cwd));
@@ -10099,7 +10043,7 @@ async function createProject(cwd, options$6) {
10099
10043
  }
10100
10044
  },
10101
10045
  template: () => {
10102
- if (options$6.template) return Promise.resolve(options$6.template);
10046
+ if (options$5.template) return Promise.resolve(options$5.template);
10103
10047
  return select({
10104
10048
  message: "Which template would you like?",
10105
10049
  initialValue: "minimal",
@@ -10111,7 +10055,7 @@ async function createProject(cwd, options$6) {
10111
10055
  });
10112
10056
  },
10113
10057
  language: () => {
10114
- if (options$6.types) return Promise.resolve(options$6.types);
10058
+ if (options$5.types) return Promise.resolve(options$5.types);
10115
10059
  return select({
10116
10060
  message: "Add type checking with Typescript?",
10117
10061
  initialValue: "typescript",
@@ -10146,19 +10090,20 @@ async function createProject(cwd, options$6) {
10146
10090
  let addOnNextSteps;
10147
10091
  const installDeps = async () => {
10148
10092
  packageManager = await packageManagerPrompt(projectPath);
10093
+ addPnpmBuildDependendencies(projectPath, packageManager, ["esbuild"]);
10149
10094
  if (packageManager) await installDependencies(packageManager, projectPath);
10150
10095
  };
10151
- if (options$6.addOns) {
10096
+ if (options$5.addOns) {
10152
10097
  const { nextSteps, packageManager: pm } = await runAddCommand({
10153
10098
  cwd: projectPath,
10154
- install: options$6.install,
10099
+ install: options$5.install,
10155
10100
  preconditions: false,
10156
10101
  community: []
10157
10102
  }, []);
10158
10103
  packageManager = pm;
10159
10104
  addOnNextSteps = nextSteps;
10160
- } else if (options$6.install) await installDeps();
10161
- if (packageManager === null && options$6.install) await installDeps();
10105
+ } else if (options$5.install) await installDeps();
10106
+ if (packageManager === null && options$5.install) await installDeps();
10162
10107
  return {
10163
10108
  directory: projectPath,
10164
10109
  addOnNextSteps,
@@ -10171,8 +10116,8 @@ async function createProject(cwd, options$6) {
10171
10116
  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
10117
  runMigrate(process$1.cwd(), ["--help"]);
10173
10118
  return "";
10174
- } }).action((migration, options$6) => {
10175
- runMigrate(options$6.cwd, [migration]);
10119
+ } }).action((migration, options$5) => {
10120
+ runMigrate(options$5.cwd, [migration]);
10176
10121
  });
10177
10122
  function runMigrate(cwd, args) {
10178
10123
  const pm = getUserAgent() ?? "npm";
@@ -10195,8 +10140,8 @@ var import_picocolors = __toESM(require_picocolors(), 1);
10195
10140
  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
10141
  runCheck(process$1.cwd(), ["--help"]);
10197
10142
  return "";
10198
- } }).action((options$6, check$1) => {
10199
- const cwd = options$6.cwd;
10143
+ } }).action((options$5, check$1) => {
10144
+ const cwd = options$5.cwd;
10200
10145
  const args = check$1.args;
10201
10146
  runCheck(cwd, args);
10202
10147
  });