sv 0.9.1 → 0.9.3

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.
@@ -1,4 +1,4 @@
1
- import { Element, T, Tag, __commonJS, __export, __toESM, __toESM$1, be, detect, esm_exports, getUserAgent, parseCss$1, parseHtml, parseHtml$1, parseJson$1, parseScript, parseScript$1, parseSvelte, require_picocolors, require_picocolors$1, resolveCommand, serializeScript, stripAst, up, walk, walk_exports } from "./package-manager-DO5R9a6p.js";
1
+ import { Element, T, Tag, __commonJS, __export, __toESM as __toESM$1, __toESM$1 as __toESM, be, detect, esm_exports, getUserAgent, parseCss$1, parseHtml, parseHtml$1, parseJson$1, parseScript, parseScript$1, parseSvelte, require_picocolors as require_picocolors$1, require_picocolors$1 as require_picocolors, resolveCommand, serializeScript, stripAst, up, walk, walk_exports } from "./package-manager-DO5R9a6p.js";
2
2
  import fs, { existsSync, lstatSync, readdirSync } from "node:fs";
3
3
  import path, { dirname, join } from "node:path";
4
4
  import process$1, { stdin, stdout } from "node:process";
@@ -889,7 +889,7 @@ const addPlugin = (ast, options$6) => {
889
889
 
890
890
  //#endregion
891
891
  //#region packages/cli/commands/add/utils.ts
892
- var import_picocolors$5 = __toESM$1(require_picocolors$1(), 1);
892
+ var import_picocolors$5 = __toESM(require_picocolors(), 1);
893
893
  function getPackageJson(cwd) {
894
894
  const packageText = readFile(cwd, commonFilePaths.packageJson);
895
895
  if (!packageText) {
@@ -960,6 +960,7 @@ const commonFilePaths = {
960
960
  packageJson: "package.json",
961
961
  svelteConfig: "svelte.config.js",
962
962
  tsconfig: "tsconfig.json",
963
+ viteConfig: "vite.config.js",
963
964
  viteConfigTS: "vite.config.ts"
964
965
  };
965
966
  function getHighlighter() {
@@ -978,6 +979,7 @@ async function createWorkspace({ cwd, options: options$6 = {}, packageManager })
978
979
  const resolvedCwd = path.resolve(cwd);
979
980
  const viteConfigPath = path.join(resolvedCwd, commonFilePaths.viteConfigTS);
980
981
  let usesTypescript = fs.existsSync(viteConfigPath);
982
+ const viteConfigFile = usesTypescript ? commonFilePaths.viteConfigTS : commonFilePaths.viteConfig;
981
983
  if (TESTING) usesTypescript ||= fs.existsSync(path.join(resolvedCwd, commonFilePaths.tsconfig));
982
984
  else usesTypescript ||= up(commonFilePaths.tsconfig, { cwd }) !== undefined;
983
985
  let dependencies = {};
@@ -1000,6 +1002,7 @@ else usesTypescript ||= up(commonFilePaths.tsconfig, { cwd }) !== undefined;
1000
1002
  options: options$6,
1001
1003
  packageManager: packageManager ?? (await detect({ cwd }))?.name ?? getUserAgent() ?? "npm",
1002
1004
  typescript: usesTypescript,
1005
+ viteConfigFile,
1003
1006
  kit: dependencies["@sveltejs/kit"] ? parseKitOptions(resolvedCwd) : undefined,
1004
1007
  dependencyVersion: (pkg) => dependencies[pkg]
1005
1008
  };
@@ -1060,7 +1063,7 @@ function parseKitOptions(cwd) {
1060
1063
 
1061
1064
  //#endregion
1062
1065
  //#region packages/cli/lib/install.ts
1063
- var import_picocolors$4 = __toESM$1(require_picocolors$1(), 1);
1066
+ var import_picocolors$4 = __toESM(require_picocolors(), 1);
1064
1067
  async function installAddon({ addons, cwd, options: options$6, packageManager = "npm" }) {
1065
1068
  const workspace = await createWorkspace({
1066
1069
  cwd,
@@ -1196,8 +1199,22 @@ function orderAddons(addons, setupResults) {
1196
1199
  function defineAddon(config) {
1197
1200
  return config;
1198
1201
  }
1199
- function defineAddonOptions(options$6) {
1200
- return options$6;
1202
+ function defineAddonOptions() {
1203
+ return createOptionBuilder({});
1204
+ }
1205
+ function createOptionBuilder(options$6 = {}) {
1206
+ return {
1207
+ add(key, question) {
1208
+ const newOptions = {
1209
+ ...options$6,
1210
+ [key]: question
1211
+ };
1212
+ return createOptionBuilder(newOptions);
1213
+ },
1214
+ build() {
1215
+ return options$6;
1216
+ }
1217
+ };
1201
1218
  }
1202
1219
  var require_src = __commonJS({ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
1203
1220
  const ESC = "\x1B";
@@ -1253,8 +1270,8 @@ else if (y > 0) ret += `${CSI}${y}B`;
1253
1270
  beep
1254
1271
  };
1255
1272
  } });
1256
- var import_src$1 = __toESM(require_src(), 1);
1257
- var import_picocolors$3 = __toESM(require_picocolors(), 1);
1273
+ var import_src$1 = __toESM$1(require_src(), 1);
1274
+ var import_picocolors$3 = __toESM$1(require_picocolors$1(), 1);
1258
1275
  function hu({ onlyFirst: e$1 = !1 } = {}) {
1259
1276
  const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
1260
1277
  return new RegExp(t, e$1 ? void 0 : "g");
@@ -1989,9 +2006,9 @@ B$1 = new WeakMap(), k$1 = new WeakMap(), I = new WeakMap(), v$1 = new WeakMap()
1989
2006
  e$1 ? this.filteredOptions = D$1.filter((t) => x$1(this, I).call(this, e$1, t)) : this.filteredOptions = [...D$1], m(this, B$1, FD(this.focusedValue, this.filteredOptions)), this.focusedValue = this.filteredOptions[x$1(this, B$1)]?.value, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
1990
2007
  }
1991
2008
  };
1992
- var import_picocolors$1 = __toESM(require_picocolors(), 1);
1993
- var import_picocolors$2 = __toESM(require_picocolors(), 1);
1994
- var import_src = __toESM(require_src(), 1);
2009
+ var import_picocolors$1 = __toESM$1(require_picocolors$1(), 1);
2010
+ var import_picocolors$2 = __toESM$1(require_picocolors$1(), 1);
2011
+ var import_src = __toESM$1(require_src(), 1);
1995
2012
  function Pe() {
1996
2013
  return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1997
2014
  }
@@ -2691,7 +2708,7 @@ else return true;
2691
2708
  if (version.patch === below.patch) return false;
2692
2709
  return undefined;
2693
2710
  }
2694
- var import_picocolors = __toESM(require_picocolors(), 1);
2711
+ var import_picocolors = __toESM$1(require_picocolors$1(), 1);
2695
2712
  var colors = import_picocolors.default;
2696
2713
 
2697
2714
  //#endregion
@@ -2701,10 +2718,9 @@ var devtools_json_default = defineAddon({
2701
2718
  shortDescription: "devtools json",
2702
2719
  homepage: "https://github.com/ChromeDevTools/vite-plugin-devtools-json",
2703
2720
  options: {},
2704
- run: ({ sv, typescript }) => {
2705
- const ext = typescript ? "ts" : "js";
2721
+ run: ({ sv, viteConfigFile }) => {
2706
2722
  sv.devDependency("vite-plugin-devtools-json", "^1.0.0");
2707
- sv.file(`vite.config.${ext}`, (content) => {
2723
+ sv.file(viteConfigFile, (content) => {
2708
2724
  const { ast, generateCode } = parseScript$1(content);
2709
2725
  const vitePluginName = "devtoolsJson";
2710
2726
  imports_exports.addDefault(ast, {
@@ -2776,87 +2792,81 @@ const PORTS = {
2776
2792
  postgresql: "5432",
2777
2793
  sqlite: ""
2778
2794
  };
2779
- const options$5 = defineAddonOptions({
2780
- database: {
2781
- question: "Which database would you like to use?",
2782
- type: "select",
2783
- default: "sqlite",
2784
- options: [
2785
- {
2786
- value: "postgresql",
2787
- label: "PostgreSQL"
2788
- },
2789
- {
2790
- value: "mysql",
2791
- label: "MySQL"
2792
- },
2793
- {
2794
- value: "sqlite",
2795
- label: "SQLite"
2796
- }
2797
- ]
2798
- },
2799
- postgresql: {
2800
- question: "Which PostgreSQL client would you like to use?",
2801
- type: "select",
2802
- group: "client",
2803
- default: "postgres.js",
2804
- options: [{
2805
- value: "postgres.js",
2806
- label: "Postgres.JS",
2807
- hint: "recommended for most users"
2808
- }, {
2809
- value: "neon",
2810
- label: "Neon",
2811
- hint: "popular hosted platform"
2812
- }],
2813
- condition: ({ database }) => database === "postgresql"
2814
- },
2815
- mysql: {
2816
- question: "Which MySQL client would you like to use?",
2817
- type: "select",
2818
- group: "client",
2819
- default: "mysql2",
2820
- options: [{
2821
- value: "mysql2",
2822
- hint: "recommended for most users"
2823
- }, {
2824
- value: "planetscale",
2825
- label: "PlanetScale",
2795
+ const options$5 = defineAddonOptions().add("database", {
2796
+ question: "Which database would you like to use?",
2797
+ type: "select",
2798
+ default: "sqlite",
2799
+ options: [
2800
+ {
2801
+ value: "postgresql",
2802
+ label: "PostgreSQL"
2803
+ },
2804
+ {
2805
+ value: "mysql",
2806
+ label: "MySQL"
2807
+ },
2808
+ {
2809
+ value: "sqlite",
2810
+ label: "SQLite"
2811
+ }
2812
+ ]
2813
+ }).add("postgresql", {
2814
+ question: "Which PostgreSQL client would you like to use?",
2815
+ type: "select",
2816
+ group: "client",
2817
+ default: "postgres.js",
2818
+ options: [{
2819
+ value: "postgres.js",
2820
+ label: "Postgres.JS",
2821
+ hint: "recommended for most users"
2822
+ }, {
2823
+ value: "neon",
2824
+ label: "Neon",
2825
+ hint: "popular hosted platform"
2826
+ }],
2827
+ condition: ({ database }) => database === "postgresql"
2828
+ }).add("mysql", {
2829
+ question: "Which MySQL client would you like to use?",
2830
+ type: "select",
2831
+ group: "client",
2832
+ default: "mysql2",
2833
+ options: [{
2834
+ value: "mysql2",
2835
+ hint: "recommended for most users"
2836
+ }, {
2837
+ value: "planetscale",
2838
+ label: "PlanetScale",
2839
+ hint: "popular hosted platform"
2840
+ }],
2841
+ condition: ({ database }) => database === "mysql"
2842
+ }).add("sqlite", {
2843
+ question: "Which SQLite client would you like to use?",
2844
+ type: "select",
2845
+ group: "client",
2846
+ default: "libsql",
2847
+ options: [
2848
+ {
2849
+ value: "better-sqlite3",
2850
+ hint: "for traditional Node environments"
2851
+ },
2852
+ {
2853
+ value: "libsql",
2854
+ label: "libSQL",
2855
+ hint: "for serverless environments"
2856
+ },
2857
+ {
2858
+ value: "turso",
2859
+ label: "Turso",
2826
2860
  hint: "popular hosted platform"
2827
- }],
2828
- condition: ({ database }) => database === "mysql"
2829
- },
2830
- sqlite: {
2831
- question: "Which SQLite client would you like to use?",
2832
- type: "select",
2833
- group: "client",
2834
- default: "libsql",
2835
- options: [
2836
- {
2837
- value: "better-sqlite3",
2838
- hint: "for traditional Node environments"
2839
- },
2840
- {
2841
- value: "libsql",
2842
- label: "libSQL",
2843
- hint: "for serverless environments"
2844
- },
2845
- {
2846
- value: "turso",
2847
- label: "Turso",
2848
- hint: "popular hosted platform"
2849
- }
2850
- ],
2851
- condition: ({ database }) => database === "sqlite"
2852
- },
2853
- docker: {
2854
- question: "Do you want to run the database locally with docker-compose?",
2855
- default: false,
2856
- type: "boolean",
2857
- condition: ({ database, mysql, postgresql }) => database === "mysql" && mysql === "mysql2" || database === "postgresql" && postgresql === "postgres.js"
2858
- }
2859
- });
2861
+ }
2862
+ ],
2863
+ condition: ({ database }) => database === "sqlite"
2864
+ }).add("docker", {
2865
+ question: "Do you want to run the database locally with docker-compose?",
2866
+ default: false,
2867
+ type: "boolean",
2868
+ condition: ({ database, mysql, postgresql }) => database === "mysql" && mysql === "mysql2" || database === "postgresql" && postgresql === "postgres.js"
2869
+ }).build();
2860
2870
  var drizzle_default = defineAddon({
2861
2871
  id: "drizzle",
2862
2872
  shortDescription: "database orm",
@@ -4341,11 +4351,11 @@ const TABLE_TYPE = {
4341
4351
  };
4342
4352
  let drizzleDialect;
4343
4353
  let schemaPath;
4344
- const options$4 = defineAddonOptions({ demo: {
4354
+ const options$4 = defineAddonOptions().add("demo", {
4345
4355
  type: "boolean",
4346
4356
  default: true,
4347
4357
  question: `Do you want to include a demo? ${colors.dim("(includes a login/register page)")}`
4348
- } });
4358
+ }).build();
4349
4359
  var lucia_default = defineAddon({
4350
4360
  id: "lucia",
4351
4361
  shortDescription: "auth guide",
@@ -5014,32 +5024,29 @@ const DEFAULT_INLANG_PROJECT = {
5014
5024
  modules: ["https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js", "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js"],
5015
5025
  "plugin.inlang.messageFormat": { pathPattern: "./messages/{locale}.json" }
5016
5026
  };
5017
- const options$3 = defineAddonOptions({
5018
- languageTags: {
5019
- question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
5020
- type: "string",
5021
- default: "en, es",
5022
- validate(input) {
5023
- if (!input) return;
5024
- const { invalidLanguageTags, validLanguageTags } = parseLanguageTagInput(input);
5025
- if (invalidLanguageTags.length > 0) if (invalidLanguageTags.length === 1) return `The input "${invalidLanguageTags[0]}" is not a valid IETF BCP 47 language tag`;
5027
+ const options$3 = defineAddonOptions().add("languageTags", {
5028
+ question: `Which languages would you like to support? ${colors.gray("(e.g. en,de-ch)")}`,
5029
+ type: "string",
5030
+ default: "en, es",
5031
+ validate(input) {
5032
+ if (!input) return;
5033
+ const { invalidLanguageTags, validLanguageTags } = parseLanguageTagInput(input);
5034
+ if (invalidLanguageTags.length > 0) if (invalidLanguageTags.length === 1) return `The input "${invalidLanguageTags[0]}" is not a valid IETF BCP 47 language tag`;
5026
5035
  else {
5027
- const listFormat = new Intl.ListFormat("en", {
5028
- style: "long",
5029
- type: "conjunction"
5030
- });
5031
- return `The inputs ${listFormat.format(invalidLanguageTags.map((x$2) => `"${x$2}"`))} are not valid BCP47 language tags`;
5032
- }
5033
- if (validLanguageTags.length === 0) return "Please enter at least one valid BCP47 language tag. Eg: en";
5034
- return undefined;
5036
+ const listFormat = new Intl.ListFormat("en", {
5037
+ style: "long",
5038
+ type: "conjunction"
5039
+ });
5040
+ return `The inputs ${listFormat.format(invalidLanguageTags.map((x$2) => `"${x$2}"`))} are not valid BCP47 language tags`;
5035
5041
  }
5036
- },
5037
- demo: {
5038
- type: "boolean",
5039
- default: true,
5040
- question: "Do you want to include a demo?"
5042
+ if (validLanguageTags.length === 0) return "Please enter at least one valid BCP47 language tag. Eg: en";
5043
+ return undefined;
5041
5044
  }
5042
- });
5045
+ }).add("demo", {
5046
+ type: "boolean",
5047
+ default: true,
5048
+ question: "Do you want to include a demo?"
5049
+ }).build();
5043
5050
  var paraglide_default = defineAddon({
5044
5051
  id: "paraglide",
5045
5052
  shortDescription: "i18n",
@@ -5048,7 +5055,7 @@ var paraglide_default = defineAddon({
5048
5055
  setup: ({ kit, unsupported }) => {
5049
5056
  if (!kit) unsupported("Requires SvelteKit");
5050
5057
  },
5051
- run: ({ sv, options: options$6, typescript, kit }) => {
5058
+ run: ({ sv, options: options$6, viteConfigFile, typescript, kit }) => {
5052
5059
  const ext = typescript ? "ts" : "js";
5053
5060
  if (!kit) throw new Error("SvelteKit is required");
5054
5061
  const paraglideOutDir = "src/lib/paraglide";
@@ -5063,7 +5070,7 @@ var paraglide_default = defineAddon({
5063
5070
  data.locales = validLanguageTags$1;
5064
5071
  return generateCode();
5065
5072
  });
5066
- sv.file(`vite.config.${ext}`, (content) => {
5073
+ sv.file(viteConfigFile, (content) => {
5067
5074
  const { ast, generateCode } = parseScript$1(content);
5068
5075
  const vitePluginName = "paraglideVitePlugin";
5069
5076
  imports_exports.addNamed(ast, {
@@ -5388,7 +5395,7 @@ const adapters = [
5388
5395
  version: "^5.0.0"
5389
5396
  }
5390
5397
  ];
5391
- const options$2 = defineAddonOptions({ adapter: {
5398
+ const options$2 = defineAddonOptions().add("adapter", {
5392
5399
  type: "select",
5393
5400
  question: "Which SvelteKit adapter would you like to use?",
5394
5401
  options: adapters.map((p$1) => ({
@@ -5397,7 +5404,7 @@ const options$2 = defineAddonOptions({ adapter: {
5397
5404
  hint: p$1.package
5398
5405
  })),
5399
5406
  default: "auto"
5400
- } });
5407
+ }).build();
5401
5408
  var sveltekit_adapter_default = defineAddon({
5402
5409
  id: "sveltekit-adapter",
5403
5410
  alias: "adapter",
@@ -5451,45 +5458,46 @@ var sveltekit_adapter_default = defineAddon({
5451
5458
 
5452
5459
  //#endregion
5453
5460
  //#region packages/addons/tailwindcss/index.ts
5454
- const plugins = [{
5455
- id: "typography",
5456
- package: "@tailwindcss/typography",
5457
- version: "^0.5.15",
5458
- identifier: "typography"
5459
- }, {
5460
- id: "forms",
5461
- package: "@tailwindcss/forms",
5462
- version: "^0.5.9",
5463
- identifier: "forms"
5464
- }];
5465
- const options$1 = defineAddonOptions({ plugins: {
5461
+ function typedEntries(obj) {
5462
+ return Object.entries(obj);
5463
+ }
5464
+ const plugins = {
5465
+ typography: {
5466
+ package: "@tailwindcss/typography",
5467
+ version: "^0.5.15"
5468
+ },
5469
+ forms: {
5470
+ package: "@tailwindcss/forms",
5471
+ version: "^0.5.9"
5472
+ }
5473
+ };
5474
+ const options$1 = defineAddonOptions().add("plugins", {
5466
5475
  type: "multiselect",
5467
5476
  question: "Which plugins would you like to add?",
5468
- options: plugins.map((p$1) => ({
5469
- value: p$1.id,
5470
- label: p$1.id,
5477
+ options: typedEntries(plugins).map(([id, p$1]) => ({
5478
+ value: id,
5479
+ label: id,
5471
5480
  hint: p$1.package
5472
5481
  })),
5473
5482
  default: [],
5474
5483
  required: false
5475
- } });
5484
+ }).build();
5476
5485
  var tailwindcss_default = defineAddon({
5477
5486
  id: "tailwindcss",
5478
5487
  alias: "tailwind",
5479
5488
  shortDescription: "css framework",
5480
5489
  homepage: "https://tailwindcss.com",
5481
5490
  options: options$1,
5482
- run: ({ sv, options: options$6, typescript, kit, dependencyVersion }) => {
5483
- const ext = typescript ? "ts" : "js";
5491
+ run: ({ sv, options: options$6, viteConfigFile, typescript, kit, dependencyVersion }) => {
5484
5492
  const prettierInstalled = Boolean(dependencyVersion("prettier"));
5485
5493
  sv.devDependency("tailwindcss", "^4.0.0");
5486
5494
  sv.devDependency("@tailwindcss/vite", "^4.0.0");
5487
5495
  if (prettierInstalled) sv.devDependency("prettier-plugin-tailwindcss", "^0.6.11");
5488
- for (const plugin of plugins) {
5489
- if (!options$6.plugins.includes(plugin.id)) continue;
5496
+ for (const [id, plugin] of typedEntries(plugins)) {
5497
+ if (!options$6.plugins.includes(id)) continue;
5490
5498
  sv.devDependency(plugin.package, plugin.version);
5491
5499
  }
5492
- sv.file(`vite.config.${ext}`, (content) => {
5500
+ sv.file(viteConfigFile, (content) => {
5493
5501
  const { ast, generateCode } = parseScript$1(content);
5494
5502
  const vitePluginName = "tailwindcss";
5495
5503
  imports_exports.addDefault(ast, {
@@ -5513,8 +5521,8 @@ var tailwindcss_default = defineAddon({
5513
5521
  }
5514
5522
  const lastAtRule = atRules.findLast((rule) => ["plugin", "import"].includes(rule.name));
5515
5523
  const pluginPos = lastAtRule.source.end.offset;
5516
- for (const plugin of plugins) {
5517
- if (!options$6.plugins.includes(plugin.id)) continue;
5524
+ for (const [id, plugin] of typedEntries(plugins)) {
5525
+ if (!options$6.plugins.includes(id)) continue;
5518
5526
  const pluginRule = findAtRule("plugin", plugin.package);
5519
5527
  if (!pluginRule) {
5520
5528
  const pluginImport = `\n@plugin '${plugin.package}';`;
@@ -5558,7 +5566,7 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
5558
5566
 
5559
5567
  //#endregion
5560
5568
  //#region packages/addons/vitest-addon/index.ts
5561
- const options = defineAddonOptions({ usages: {
5569
+ const options = defineAddonOptions().add("usages", {
5562
5570
  question: "What do you want to use vitest for?",
5563
5571
  type: "multiselect",
5564
5572
  default: ["unit", "component"],
@@ -5570,13 +5578,13 @@ const options = defineAddonOptions({ usages: {
5570
5578
  label: "component testing"
5571
5579
  }],
5572
5580
  required: true
5573
- } });
5581
+ }).build();
5574
5582
  var vitest_addon_default = defineAddon({
5575
5583
  id: "vitest",
5576
5584
  shortDescription: "unit testing",
5577
5585
  homepage: "https://vitest.dev",
5578
5586
  options,
5579
- run: ({ sv, typescript, kit, options: options$6 }) => {
5587
+ run: ({ sv, viteConfigFile, typescript, kit, options: options$6 }) => {
5580
5588
  const ext = typescript ? "ts" : "js";
5581
5589
  const unitTesting = options$6.usages.includes("unit");
5582
5590
  const componentTesting = options$6.usages.includes("component");
@@ -5637,10 +5645,10 @@ var vitest_addon_default = defineAddon({
5637
5645
  `;
5638
5646
  });
5639
5647
  }
5640
- sv.file(`vite.config.${ext}`, (content) => {
5648
+ sv.file(viteConfigFile, (content) => {
5641
5649
  const { ast, generateCode } = parseScript$1(content);
5642
5650
  const clientObjectExpression = object_exports.create({
5643
- extends: `./vite.config.${ext}`,
5651
+ extends: `./${viteConfigFile}`,
5644
5652
  test: {
5645
5653
  name: "client",
5646
5654
  environment: "browser",
@@ -5655,7 +5663,7 @@ var vitest_addon_default = defineAddon({
5655
5663
  }
5656
5664
  });
5657
5665
  const serverObjectExpression = object_exports.create({
5658
- extends: `./vite.config.${ext}`,
5666
+ extends: `./${viteConfigFile}`,
5659
5667
  test: {
5660
5668
  name: "server",
5661
5669
  environment: "node",
package/dist/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { AGENT_NAMES, Command, De, Fe, Ge, J, Ke, Option, T, Ue, Vu, We, __toESM$1 as __toESM, addPnpmBuildDependencies, create, detect, et, from, getUserAgent, installDependencies, installOption, ke, packageManagerPrompt, program, require_picocolors$1 as require_picocolors, resolveCommand, templates, up, ze } from "./package-manager-DO5R9a6p.js";
3
- import { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, isVersionUnsupportedBelow, officialAddons, setupAddons } from "./addons-DPvkmr43.js";
3
+ import { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, isVersionUnsupportedBelow, officialAddons, setupAddons } from "./addons-uHDStNUk.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 { pipeline } from "node:stream/promises";
12
12
 
13
13
  //#region packages/cli/package.json
14
14
  var name = "sv";
15
- var version = "0.9.1";
15
+ var version = "0.9.3";
16
16
  var type = "module";
17
17
  var description = "A CLI for creating and updating SvelteKit projects";
18
18
  var license = "MIT";
@@ -588,6 +588,16 @@ function forwardExitCode(error) {
588
588
  if (error && typeof error === "object" && "status" in error && typeof error.status === "number") process.exit(error.status);
589
589
  else process.exit(1);
590
590
  }
591
+ function parseAddonOptions(optionFlags) {
592
+ if (optionFlags === undefined || optionFlags === "") return undefined;
593
+ const options$1 = optionFlags.split("+");
594
+ const malformed = options$1.filter((option) => !/.+:.*/.test(option));
595
+ if (malformed.length > 0) {
596
+ const message = `Malformed arguments: The following add-on options: ${malformed.map((o) => `'${o}'`).join(", ")} are missing their option name or value (e.g. 'addon=option1:value1+option2:value2').`;
597
+ throw new Error(message);
598
+ }
599
+ return options$1;
600
+ }
591
601
 
592
602
  //#endregion
593
603
  //#region packages/cli/commands/add/fetch-packages.ts
@@ -745,22 +755,16 @@ const add = new Command("add").description("applies specified add-ons into a pro
745
755
  console.error(`Malformed arguments: Add-on '${addonId}' is repeated multiple times.`);
746
756
  process.exit(1);
747
757
  }
748
- if (optionFlags === undefined) {
758
+ try {
759
+ const options$1 = parseAddonOptions(optionFlags);
749
760
  prev.push({
750
761
  id: addonId,
751
- options: undefined
762
+ options: options$1
752
763
  });
753
- return prev;
754
- }
755
- if (optionFlags.length > 0 && !/.+:.*/.test(optionFlags)) {
756
- console.error(`Malformed arguments: An add-on's option in '${value}' is missing it's option name or value (e.g. 'addon=option:value').`);
764
+ } catch (error) {
765
+ if (error instanceof Error) console.error(error.message);
757
766
  process.exit(1);
758
767
  }
759
- const options$1 = optionFlags.match(/[^+]*:[^:]*(?=\+|$)/g) ?? [];
760
- prev.push({
761
- id: addonId,
762
- options: options$1
763
- });
764
768
  return prev;
765
769
  }).option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-git-check", "even if some files are dirty, no prompt will be shown").option("--no-install", "skip installing dependencies").addOption(installOption).configureHelp({
766
770
  ...helpConfig,
@@ -1356,10 +1360,7 @@ async function createProject(cwd, options$1) {
1356
1360
 
1357
1361
  //#endregion
1358
1362
  //#region packages/cli/commands/migrate.ts
1359
- 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.cwd()).configureHelp({ formatHelp() {
1360
- runMigrate(process.cwd(), ["--help"]);
1361
- return "";
1362
- } }).action((migration, options$1) => {
1363
+ 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.cwd()).action((migration, options$1) => {
1363
1364
  runMigrate(options$1.cwd, [migration]);
1364
1365
  });
1365
1366
  function runMigrate(cwd, args) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { create } from "./package-manager-DO5R9a6p.js";
2
- import { installAddon, officialAddons } from "./addons-DPvkmr43.js";
2
+ import { installAddon, officialAddons } from "./addons-uHDStNUk.js";
3
3
 
4
4
  export { create, installAddon, officialAddons };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "type": "module",
5
5
  "description": "A CLI for creating and updating SvelteKit projects",
6
6
  "license": "MIT",
@@ -37,8 +37,8 @@
37
37
  "tinyexec": "^0.3.2",
38
38
  "valibot": "^0.41.0",
39
39
  "@sveltejs/addons": "0.0.0",
40
- "@sveltejs/create": "0.0.0",
41
- "@sveltejs/cli-core": "0.0.0"
40
+ "@sveltejs/cli-core": "0.0.0",
41
+ "@sveltejs/create": "0.0.0"
42
42
  },
43
43
  "keywords": [
44
44
  "create",