sv 0.8.18 → 0.8.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A command line interface (CLI) for creating and maintaining [Svelte](https://svelte.dev) applications. Just run:
4
4
 
5
- ```bash
5
+ ```sh
6
6
  npx sv
7
7
  ```
8
8
 
@@ -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 as require_picocolors$1, require_picocolors$1 as require_picocolors, resolveCommand, serializeScript, stripAst, up, walk, walk_exports } from "./package-manager-DO5R9a6p.js";
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";
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";
@@ -483,7 +483,8 @@ function addDefault(node, options$6) {
483
483
  addImportIfNecessary(node, expectedImportDeclaration);
484
484
  }
485
485
  function addNamed(node, options$6) {
486
- const specifiers = Object.entries(options$6.imports).map(([key, value]) => {
486
+ const o_imports = Array.isArray(options$6.imports) ? Object.fromEntries(options$6.imports.map((n$1) => [n$1, n$1])) : options$6.imports;
487
+ const specifiers = Object.entries(o_imports).map(([key, value]) => {
487
488
  const specifier = {
488
489
  type: "ImportSpecifier",
489
490
  imported: {
@@ -816,10 +817,78 @@ function getVariableDeclarator(node, variableName) {
816
817
  function isFunctionDeclaration(node, funcName) {
817
818
  return node.type === "FunctionDeclaration" && node.id?.name === funcName;
818
819
  }
820
+ var vite_exports = {};
821
+ __export(vite_exports, { addPlugin: () => addPlugin });
822
+ function exportDefaultConfig(ast, options$6 = {}) {
823
+ const { fallback, ignoreWrapper } = options$6;
824
+ let fallbackExpression;
825
+ if (fallback) fallbackExpression = typeof fallback === "string" ? parseExpression(fallback) : fallback;
826
+ else fallbackExpression = create({});
827
+ const { value: rootObject } = createDefault(ast, { fallback: fallbackExpression });
828
+ let configObject;
829
+ if (!ignoreWrapper || !("arguments" in rootObject) || !Array.isArray(rootObject.arguments)) {
830
+ configObject = rootObject;
831
+ return configObject;
832
+ }
833
+ if (rootObject.type !== "CallExpression" || rootObject.callee.type !== "Identifier" || rootObject.callee.name !== ignoreWrapper) {
834
+ configObject = rootObject;
835
+ return configObject;
836
+ }
837
+ const firstArg = getArgument(rootObject, {
838
+ index: 0,
839
+ fallback: create({})
840
+ });
841
+ if (firstArg.type === "ArrowFunctionExpression") {
842
+ const arrowFunction = firstArg;
843
+ if (arrowFunction.body.type === "BlockStatement") {
844
+ const returnStatement = arrowFunction.body.body.find((stmt) => stmt.type === "ReturnStatement");
845
+ if (returnStatement && returnStatement.argument?.type === "ObjectExpression") configObject = returnStatement.argument;
846
+ else {
847
+ configObject = create({});
848
+ const newReturnStatement = {
849
+ type: "ReturnStatement",
850
+ argument: configObject
851
+ };
852
+ arrowFunction.body.body.push(newReturnStatement);
853
+ }
854
+ } else if (arrowFunction.body.type === "ObjectExpression") configObject = arrowFunction.body;
855
+ else {
856
+ configObject = create({});
857
+ arrowFunction.body = configObject;
858
+ arrowFunction.expression = true;
859
+ }
860
+ } else if (firstArg.type === "ObjectExpression") configObject = firstArg;
861
+ else configObject = create({});
862
+ return configObject;
863
+ }
864
+ function addInArrayOfObject(ast, options$6) {
865
+ const { code, arrayProperty, mode = "append" } = options$6;
866
+ const targetArray = property(ast, {
867
+ name: arrayProperty,
868
+ fallback: create$1()
869
+ });
870
+ const expression = parseExpression(code);
871
+ if (mode === "prepend") prepend(targetArray, expression);
872
+ else append(targetArray, expression);
873
+ }
874
+ const addPlugin = (ast, options$6) => {
875
+ addNamed(ast, {
876
+ from: "vite",
877
+ imports: { defineConfig: "defineConfig" }
878
+ });
879
+ const configObject = exportDefaultConfig(ast, {
880
+ fallback: "defineConfig()",
881
+ ignoreWrapper: "defineConfig"
882
+ });
883
+ addInArrayOfObject(configObject, {
884
+ arrayProperty: "plugins",
885
+ ...options$6
886
+ });
887
+ };
819
888
 
820
889
  //#endregion
821
890
  //#region packages/cli/commands/add/utils.ts
822
- var import_picocolors$5 = __toESM$1(require_picocolors(), 1);
891
+ var import_picocolors$5 = __toESM$1(require_picocolors$1(), 1);
823
892
  function getPackageJson(cwd) {
824
893
  const packageText = readFile(cwd, commonFilePaths.packageJson);
825
894
  if (!packageText) {
@@ -990,7 +1059,7 @@ function parseKitOptions(cwd) {
990
1059
 
991
1060
  //#endregion
992
1061
  //#region packages/cli/lib/install.ts
993
- var import_picocolors$4 = __toESM$1(require_picocolors(), 1);
1062
+ var import_picocolors$4 = __toESM$1(require_picocolors$1(), 1);
994
1063
  async function installAddon({ addons, cwd, options: options$6, packageManager = "npm" }) {
995
1064
  const workspace = await createWorkspace({
996
1065
  cwd,
@@ -1184,7 +1253,7 @@ else if (y > 0) ret += `${CSI}${y}B`;
1184
1253
  };
1185
1254
  } });
1186
1255
  var import_src$1 = __toESM(require_src(), 1);
1187
- var import_picocolors$3 = __toESM(require_picocolors$1(), 1);
1256
+ var import_picocolors$3 = __toESM(require_picocolors(), 1);
1188
1257
  function hu({ onlyFirst: e$1 = !1 } = {}) {
1189
1258
  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("|");
1190
1259
  return new RegExp(t, e$1 ? void 0 : "g");
@@ -1919,8 +1988,8 @@ B$1 = new WeakMap(), k$1 = new WeakMap(), I = new WeakMap(), v$1 = new WeakMap()
1919
1988
  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());
1920
1989
  }
1921
1990
  };
1922
- var import_picocolors$1 = __toESM(require_picocolors$1(), 1);
1923
- var import_picocolors$2 = __toESM(require_picocolors$1(), 1);
1991
+ var import_picocolors$1 = __toESM(require_picocolors(), 1);
1992
+ var import_picocolors$2 = __toESM(require_picocolors(), 1);
1924
1993
  var import_src = __toESM(require_src(), 1);
1925
1994
  function Pe() {
1926
1995
  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";
@@ -2593,7 +2662,35 @@ function createPrinter(...conditions) {
2593
2662
  });
2594
2663
  return printers;
2595
2664
  }
2596
- var import_picocolors = __toESM(require_picocolors$1(), 1);
2665
+ function splitVersion(str) {
2666
+ const [major, minor, patch] = str?.split(".") ?? [];
2667
+ function toVersionNumber(val) {
2668
+ return val !== undefined && val !== "" && !isNaN(Number(val)) ? Number(val) : undefined;
2669
+ }
2670
+ return {
2671
+ major: toVersionNumber(major),
2672
+ minor: toVersionNumber(minor),
2673
+ patch: toVersionNumber(patch)
2674
+ };
2675
+ }
2676
+ function isVersionUnsupportedBelow(versionStr, belowStr) {
2677
+ const version = splitVersion(versionStr);
2678
+ const below = splitVersion(belowStr);
2679
+ if (version.major === undefined || below.major === undefined) return undefined;
2680
+ if (version.major < below.major) return true;
2681
+ if (version.major > below.major) return false;
2682
+ if (version.minor === undefined || below.minor === undefined) if (version.major === below.major) return false;
2683
+ else return true;
2684
+ if (version.minor < below.minor) return true;
2685
+ if (version.minor > below.minor) return false;
2686
+ if (version.patch === undefined || below.patch === undefined) if (version.minor === below.minor) return false;
2687
+ else return true;
2688
+ if (version.patch < below.patch) return true;
2689
+ if (version.patch > below.patch) return false;
2690
+ if (version.patch === below.patch) return false;
2691
+ return undefined;
2692
+ }
2693
+ var import_picocolors = __toESM(require_picocolors(), 1);
2597
2694
  var colors = import_picocolors.default;
2598
2695
 
2599
2696
  //#endregion
@@ -2610,26 +2707,10 @@ var devtools_json_default = defineAddon({
2610
2707
  const { ast, generateCode } = parseScript$1(content);
2611
2708
  const vitePluginName = "devtoolsJson";
2612
2709
  imports_exports.addDefault(ast, {
2613
- from: "vite-plugin-devtools-json",
2614
- as: vitePluginName
2710
+ as: vitePluginName,
2711
+ from: "vite-plugin-devtools-json"
2615
2712
  });
2616
- const { value: rootObject } = exports_exports.createDefault(ast, { fallback: function_exports.createCall({
2617
- name: "defineConfig",
2618
- args: []
2619
- }) });
2620
- const param1 = function_exports.getArgument(rootObject, {
2621
- index: 0,
2622
- fallback: object_exports.create({})
2623
- });
2624
- const pluginsArray = object_exports.property(param1, {
2625
- name: "plugins",
2626
- fallback: array_exports.create()
2627
- });
2628
- const pluginFunctionCall = function_exports.createCall({
2629
- name: vitePluginName,
2630
- args: []
2631
- });
2632
- array_exports.append(pluginsArray, pluginFunctionCall);
2713
+ vite_exports.addPlugin(ast, { code: `${vitePluginName}()` });
2633
2714
  return generateCode();
2634
2715
  });
2635
2716
  }
@@ -2891,10 +2972,7 @@ var drizzle_default = defineAddon({
2891
2972
  if (options$6.database === "sqlite") {
2892
2973
  imports_exports.addNamed(ast, {
2893
2974
  from: "drizzle-orm/sqlite-core",
2894
- imports: {
2895
- sqliteTable: "sqliteTable",
2896
- integer: "integer"
2897
- }
2975
+ imports: ["sqliteTable", "integer"]
2898
2976
  });
2899
2977
  userSchemaExpression = common_exports.parseExpression(`sqliteTable('user', {
2900
2978
  id: integer('id').primaryKey(),
@@ -2904,11 +2982,11 @@ var drizzle_default = defineAddon({
2904
2982
  if (options$6.database === "mysql") {
2905
2983
  imports_exports.addNamed(ast, {
2906
2984
  from: "drizzle-orm/mysql-core",
2907
- imports: {
2908
- mysqlTable: "mysqlTable",
2909
- serial: "serial",
2910
- int: "int"
2911
- }
2985
+ imports: [
2986
+ "mysqlTable",
2987
+ "serial",
2988
+ "int"
2989
+ ]
2912
2990
  });
2913
2991
  userSchemaExpression = common_exports.parseExpression(`mysqlTable('user', {
2914
2992
  id: serial('id').primaryKey(),
@@ -2918,11 +2996,11 @@ var drizzle_default = defineAddon({
2918
2996
  if (options$6.database === "postgresql") {
2919
2997
  imports_exports.addNamed(ast, {
2920
2998
  from: "drizzle-orm/pg-core",
2921
- imports: {
2922
- pgTable: "pgTable",
2923
- serial: "serial",
2924
- integer: "integer"
2925
- }
2999
+ imports: [
3000
+ "pgTable",
3001
+ "serial",
3002
+ "integer"
3003
+ ]
2926
3004
  });
2927
3005
  userSchemaExpression = common_exports.parseExpression(`pgTable('user', {
2928
3006
  id: serial('id').primaryKey(),
@@ -2945,7 +3023,7 @@ var drizzle_default = defineAddon({
2945
3023
  const { ast, generateCode } = parseScript$1(content);
2946
3024
  imports_exports.addNamed(ast, {
2947
3025
  from: "$env/dynamic/private",
2948
- imports: { env: "env" }
3026
+ imports: ["env"]
2949
3027
  });
2950
3028
  imports_exports.addNamespace(ast, {
2951
3029
  from: "./schema",
@@ -2961,23 +3039,23 @@ var drizzle_default = defineAddon({
2961
3039
  });
2962
3040
  imports_exports.addNamed(ast, {
2963
3041
  from: "drizzle-orm/better-sqlite3",
2964
- imports: { drizzle: "drizzle" }
3042
+ imports: ["drizzle"]
2965
3043
  });
2966
3044
  clientExpression = common_exports.parseExpression("new Database(env.DATABASE_URL)");
2967
3045
  }
2968
3046
  if (options$6.sqlite === "libsql" || options$6.sqlite === "turso") {
2969
3047
  imports_exports.addNamed(ast, {
2970
3048
  from: "@libsql/client",
2971
- imports: { createClient: "createClient" }
3049
+ imports: ["createClient"]
2972
3050
  });
2973
3051
  imports_exports.addNamed(ast, {
2974
3052
  from: "drizzle-orm/libsql",
2975
- imports: { drizzle: "drizzle" }
3053
+ imports: ["drizzle"]
2976
3054
  });
2977
3055
  if (options$6.sqlite === "turso") {
2978
3056
  imports_exports.addNamed(ast, {
2979
3057
  from: "$app/environment",
2980
- imports: { dev: "dev" }
3058
+ imports: ["dev"]
2981
3059
  });
2982
3060
  const authTokenCheck = common_exports.parseStatement("if (!dev && !env.DATABASE_AUTH_TOKEN) throw new Error('DATABASE_AUTH_TOKEN is not set');");
2983
3061
  ast.body.push(authTokenCheck);
@@ -2991,18 +3069,18 @@ var drizzle_default = defineAddon({
2991
3069
  });
2992
3070
  imports_exports.addNamed(ast, {
2993
3071
  from: "drizzle-orm/mysql2",
2994
- imports: { drizzle: "drizzle" }
3072
+ imports: ["drizzle"]
2995
3073
  });
2996
3074
  clientExpression = common_exports.parseExpression("mysql.createPool(env.DATABASE_URL)");
2997
3075
  }
2998
3076
  if (options$6.postgresql === "neon") {
2999
3077
  imports_exports.addNamed(ast, {
3000
3078
  from: "@neondatabase/serverless",
3001
- imports: { neon: "neon" }
3079
+ imports: ["neon"]
3002
3080
  });
3003
3081
  imports_exports.addNamed(ast, {
3004
3082
  from: "drizzle-orm/neon-http",
3005
- imports: { drizzle: "drizzle" }
3083
+ imports: ["drizzle"]
3006
3084
  });
3007
3085
  clientExpression = common_exports.parseExpression("neon(env.DATABASE_URL)");
3008
3086
  }
@@ -3013,7 +3091,7 @@ var drizzle_default = defineAddon({
3013
3091
  });
3014
3092
  imports_exports.addNamed(ast, {
3015
3093
  from: "drizzle-orm/postgres-js",
3016
- imports: { drizzle: "drizzle" }
3094
+ imports: ["drizzle"]
3017
3095
  });
3018
3096
  clientExpression = common_exports.parseExpression("postgres(env.DATABASE_URL)");
3019
3097
  }
@@ -3214,7 +3292,7 @@ var eslint_default = defineAddon({
3214
3292
  });
3215
3293
  imports_exports.addNamed(ast, {
3216
3294
  from: "node:url",
3217
- imports: { fileURLToPath: "fileURLToPath" }
3295
+ imports: ["fileURLToPath"]
3218
3296
  });
3219
3297
  imports_exports.addDefault(ast, {
3220
3298
  from: "globals",
@@ -3230,7 +3308,7 @@ var eslint_default = defineAddon({
3230
3308
  });
3231
3309
  imports_exports.addNamed(ast, {
3232
3310
  from: "@eslint/compat",
3233
- imports: { includeIgnoreFile: "includeIgnoreFile" }
3311
+ imports: ["includeIgnoreFile"]
3234
3312
  });
3235
3313
  return generateCode();
3236
3314
  });
@@ -4327,11 +4405,11 @@ var lucia_default = defineAddon({
4327
4405
  if (drizzleDialect === "sqlite" || drizzleDialect === "turso") {
4328
4406
  imports_exports.addNamed(ast, {
4329
4407
  from: "drizzle-orm/sqlite-core",
4330
- imports: {
4331
- sqliteTable: "sqliteTable",
4332
- text: "text",
4333
- integer: "integer"
4334
- }
4408
+ imports: [
4409
+ "sqliteTable",
4410
+ "text",
4411
+ "integer"
4412
+ ]
4335
4413
  });
4336
4414
  object_exports.overrideProperties(userAttributes, { properties: { id: common_exports.parseExpression("text('id').primaryKey()") } });
4337
4415
  if (options$6.demo) object_exports.overrideProperties(userAttributes, { properties: {
@@ -4347,11 +4425,11 @@ var lucia_default = defineAddon({
4347
4425
  if (drizzleDialect === "mysql") {
4348
4426
  imports_exports.addNamed(ast, {
4349
4427
  from: "drizzle-orm/mysql-core",
4350
- imports: {
4351
- mysqlTable: "mysqlTable",
4352
- varchar: "varchar",
4353
- datetime: "datetime"
4354
- }
4428
+ imports: [
4429
+ "mysqlTable",
4430
+ "varchar",
4431
+ "datetime"
4432
+ ]
4355
4433
  });
4356
4434
  object_exports.overrideProperties(userAttributes, { properties: { id: common_exports.parseExpression("varchar('id', { length: 255 }).primaryKey()") } });
4357
4435
  if (options$6.demo) object_exports.overrideProperties(userAttributes, { properties: {
@@ -4367,11 +4445,11 @@ var lucia_default = defineAddon({
4367
4445
  if (drizzleDialect === "postgresql") {
4368
4446
  imports_exports.addNamed(ast, {
4369
4447
  from: "drizzle-orm/pg-core",
4370
- imports: {
4371
- pgTable: "pgTable",
4372
- text: "text",
4373
- timestamp: "timestamp"
4374
- }
4448
+ imports: [
4449
+ "pgTable",
4450
+ "text",
4451
+ "timestamp"
4452
+ ]
4375
4453
  });
4376
4454
  object_exports.overrideProperties(userAttributes, { properties: { id: common_exports.parseExpression("text('id').primaryKey()") } });
4377
4455
  if (options$6.demo) object_exports.overrideProperties(userAttributes, { properties: {
@@ -4399,26 +4477,23 @@ var lucia_default = defineAddon({
4399
4477
  });
4400
4478
  imports_exports.addNamed(ast, {
4401
4479
  from: "$lib/server/db",
4402
- imports: { db: "db" }
4480
+ imports: ["db"]
4403
4481
  });
4404
4482
  imports_exports.addNamed(ast, {
4405
4483
  from: "@oslojs/encoding",
4406
- imports: {
4407
- encodeBase64url: "encodeBase64url",
4408
- encodeHexLowerCase: "encodeHexLowerCase"
4409
- }
4484
+ imports: ["encodeBase64url", "encodeHexLowerCase"]
4410
4485
  });
4411
4486
  imports_exports.addNamed(ast, {
4412
4487
  from: "@oslojs/crypto/sha2",
4413
- imports: { sha256: "sha256" }
4488
+ imports: ["sha256"]
4414
4489
  });
4415
4490
  imports_exports.addNamed(ast, {
4416
4491
  from: "drizzle-orm",
4417
- imports: { eq: "eq" }
4492
+ imports: ["eq"]
4418
4493
  });
4419
4494
  if (typescript) imports_exports.addNamed(ast, {
4420
4495
  from: "@sveltejs/kit",
4421
- imports: { RequestEvent: "RequestEvent" },
4496
+ imports: ["RequestEvent"],
4422
4497
  isType: true
4423
4498
  });
4424
4499
  const ms = new MagicString(generateCode().trim());
@@ -4872,7 +4947,7 @@ var mdsvex_default = defineAddon({
4872
4947
  const { ast, generateCode } = parseScript$1(content);
4873
4948
  imports_exports.addNamed(ast, {
4874
4949
  from: "mdsvex",
4875
- imports: { mdsvex: "mdsvex" }
4950
+ imports: ["mdsvex"]
4876
4951
  });
4877
4952
  const { value: exportDefault } = exports_exports.createDefault(ast, { fallback: object_exports.create({}) });
4878
4953
  let preprocessorArray = object_exports.property(exportDefault, {
@@ -4990,41 +5065,20 @@ var paraglide_default = defineAddon({
4990
5065
  const { ast, generateCode } = parseScript$1(content);
4991
5066
  const vitePluginName = "paraglideVitePlugin";
4992
5067
  imports_exports.addNamed(ast, {
4993
- from: "@inlang/paraglide-js",
4994
- imports: { paraglideVitePlugin: vitePluginName }
4995
- });
4996
- const { value: rootObject } = exports_exports.createDefault(ast, { fallback: function_exports.createCall({
4997
- name: "defineConfig",
4998
- args: []
4999
- }) });
5000
- const param1 = function_exports.getArgument(rootObject, {
5001
- index: 0,
5002
- fallback: object_exports.create({})
5003
- });
5004
- const pluginsArray = object_exports.property(param1, {
5005
- name: "plugins",
5006
- fallback: array_exports.create()
5068
+ imports: [vitePluginName],
5069
+ from: "@inlang/paraglide-js"
5007
5070
  });
5008
- const pluginFunctionCall = function_exports.createCall({
5009
- name: vitePluginName,
5010
- args: []
5011
- });
5012
- const pluginConfig = object_exports.create({
5013
- project: "./project.inlang",
5014
- outdir: `./${paraglideOutDir}`
5015
- });
5016
- function_exports.getArgument(pluginFunctionCall, {
5017
- index: 0,
5018
- fallback: pluginConfig
5019
- });
5020
- array_exports.append(pluginsArray, pluginFunctionCall);
5071
+ vite_exports.addPlugin(ast, { code: `${vitePluginName}({
5072
+ project: './project.inlang',
5073
+ outdir: './${paraglideOutDir}'
5074
+ })` });
5021
5075
  return generateCode();
5022
5076
  });
5023
5077
  sv.file(`src/hooks.${ext}`, (content) => {
5024
5078
  const { ast, generateCode } = parseScript$1(content);
5025
5079
  imports_exports.addNamed(ast, {
5026
5080
  from: "$lib/paraglide/runtime",
5027
- imports: { deLocalizeUrl: "deLocalizeUrl" }
5081
+ imports: ["deLocalizeUrl"]
5028
5082
  });
5029
5083
  const expression = common_exports.parseExpression("(request) => deLocalizeUrl(request.url).pathname");
5030
5084
  const rerouteIdentifier = variables_exports.declaration(ast, {
@@ -5043,7 +5097,7 @@ var paraglide_default = defineAddon({
5043
5097
  const { ast, generateCode } = parseScript$1(content);
5044
5098
  imports_exports.addNamed(ast, {
5045
5099
  from: "$lib/paraglide/server",
5046
- imports: { paraglideMiddleware: "paraglideMiddleware" }
5100
+ imports: ["paraglideMiddleware"]
5047
5101
  });
5048
5102
  const hookHandleContent = `({ event, resolve }) => paraglideMiddleware(event.request, ({ request, locale }) => {
5049
5103
  event.request = request;
@@ -5084,19 +5138,19 @@ var paraglide_default = defineAddon({
5084
5138
  const { script, template, generateCode } = parseSvelte(content, { typescript });
5085
5139
  imports_exports.addNamed(script.ast, {
5086
5140
  from: "$lib/paraglide/messages.js",
5087
- imports: { m: "m" }
5141
+ imports: ["m"]
5088
5142
  });
5089
5143
  imports_exports.addNamed(script.ast, {
5090
5144
  from: "$app/navigation",
5091
- imports: { goto: "goto" }
5145
+ imports: ["goto"]
5092
5146
  });
5093
5147
  imports_exports.addNamed(script.ast, {
5094
5148
  from: "$app/state",
5095
- imports: { page: "page" }
5149
+ imports: ["page"]
5096
5150
  });
5097
5151
  imports_exports.addNamed(script.ast, {
5098
5152
  from: "$lib/paraglide/runtime",
5099
- imports: { setLocale: "setLocale" }
5153
+ imports: ["setLocale"]
5100
5154
  });
5101
5155
  const scriptCode = new MagicString(script.generateCode());
5102
5156
  const templateCode = new MagicString(template.source);
@@ -5189,7 +5243,7 @@ var playwright_default = defineAddon({
5189
5243
  if (defaultExport.type === "CallExpression" && defaultExport.arguments[0]?.type === "ObjectExpression") {
5190
5244
  imports_exports.addNamed(ast, {
5191
5245
  from: "@playwright/test",
5192
- imports: { defineConfig: "defineConfig" }
5246
+ imports: ["defineConfig"]
5193
5247
  });
5194
5248
  object_exports.addProperties(defaultExport.arguments[0], { properties: config });
5195
5249
  } else if (defaultExport.type === "ObjectExpression") object_exports.addProperties(defaultExport, { properties: config });
@@ -5288,8 +5342,7 @@ var storybook_default = defineAddon({
5288
5342
  },
5289
5343
  run: async ({ sv }) => {
5290
5344
  const args = [
5291
- "storybook@latest",
5292
- "init",
5345
+ "create-storybook@latest",
5293
5346
  "--skip-install",
5294
5347
  "--no-dev"
5295
5348
  ];
@@ -5438,26 +5491,13 @@ var tailwindcss_default = defineAddon({
5438
5491
  const { ast, generateCode } = parseScript$1(content);
5439
5492
  const vitePluginName = "tailwindcss";
5440
5493
  imports_exports.addDefault(ast, {
5441
- from: "@tailwindcss/vite",
5442
- as: vitePluginName
5494
+ as: vitePluginName,
5495
+ from: "@tailwindcss/vite"
5443
5496
  });
5444
- const { value: rootObject } = exports_exports.createDefault(ast, { fallback: function_exports.createCall({
5445
- name: "defineConfig",
5446
- args: []
5447
- }) });
5448
- const param1 = function_exports.getArgument(rootObject, {
5449
- index: 0,
5450
- fallback: object_exports.create({})
5451
- });
5452
- const pluginsArray = object_exports.property(param1, {
5453
- name: "plugins",
5454
- fallback: array_exports.create()
5455
- });
5456
- const pluginFunctionCall = function_exports.createCall({
5457
- name: vitePluginName,
5458
- args: []
5497
+ vite_exports.addPlugin(ast, {
5498
+ code: `${vitePluginName}()`,
5499
+ mode: "prepend"
5459
5500
  });
5460
- array_exports.prepend(pluginsArray, pluginFunctionCall);
5461
5501
  return generateCode();
5462
5502
  });
5463
5503
  sv.file("src/app.css", (content) => {
@@ -5508,6 +5548,7 @@ else sv.file(`${kit?.routesDirectory}/+layout.svelte`, (content) => {
5508
5548
  data.plugins ??= [];
5509
5549
  const plugins$1 = data.plugins;
5510
5550
  if (!plugins$1.includes(PLUGIN_NAME)) plugins$1.push(PLUGIN_NAME);
5551
+ data.tailwindStylesheet ??= "./src/app.css";
5511
5552
  return generateCode();
5512
5553
  });
5513
5554
  }
@@ -5676,4 +5717,4 @@ async function getCommunityAddon(name) {
5676
5717
  }
5677
5718
 
5678
5719
  //#endregion
5679
- export { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, installAddon, officialAddons, setupAddons };
5720
+ export { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, installAddon, isVersionUnsupportedBelow, officialAddons, setupAddons };
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, officialAddons, setupAddons } from "./addons-Br9tic5t.js";
3
+ import { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, isVersionUnsupportedBelow, officialAddons, setupAddons } from "./addons-Ce9LFQn0.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.8.18";
15
+ var version = "0.8.20";
16
16
  var type = "module";
17
17
  var description = "A CLI for creating and updating SvelteKit projects";
18
18
  var license = "MIT";
@@ -562,6 +562,9 @@ function formatDescription(arg) {
562
562
  async function runCommand(action) {
563
563
  try {
564
564
  Ge(`Welcome to the Svelte CLI! ${import_picocolors$3.default.gray(`(v${package_default.version})`)}`);
565
+ const minimumVersion = "18.3.0";
566
+ const unsupported = isVersionUnsupportedBelow(process.versions.node, minimumVersion);
567
+ if (unsupported) T.warn(`You are using Node.js ${import_picocolors$3.default.red(process.versions.node)}, please upgrade to Node.js ${import_picocolors$3.default.green(minimumVersion)} or higher.`);
565
568
  await action();
566
569
  Fe("You're all set!");
567
570
  } catch (e) {
@@ -834,7 +837,7 @@ const add = new Command("add").description("applies specified add-ons into a pro
834
837
  runCommand(async () => {
835
838
  const selectedAddonIds = selectedAddons.map(({ id }) => id);
836
839
  const { nextSteps } = await runAddCommand(options$1, selectedAddonIds);
837
- if (nextSteps) Ke(nextSteps, "Next steps", { format: (line) => line });
840
+ if (nextSteps.length > 0) Ke(nextSteps.join("\n"), "Next steps", { format: (line) => line });
838
841
  });
839
842
  });
840
843
  async function runAddCommand(options$1, selectedAddonIds) {
@@ -1063,7 +1066,10 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
1063
1066
  values[questionId] = answer;
1064
1067
  }
1065
1068
  }
1066
- if (selectedAddons.length === 0) return { packageManager: null };
1069
+ if (selectedAddons.length === 0) return {
1070
+ packageManager: null,
1071
+ nextSteps: []
1072
+ };
1067
1073
  const officialDetails = Object.keys(official).map((id) => getAddonDetails(id));
1068
1074
  const commDetails = Object.keys(community).map((id) => communityDetails.find((a) => a.id === id));
1069
1075
  const details = officialDetails.concat(commDetails);
@@ -1101,17 +1107,18 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
1101
1107
  }
1102
1108
  }
1103
1109
  const highlighter = getHighlighter();
1104
- const nextSteps = selectedAddons.filter(({ addon }) => addon.nextSteps).map(({ addon }) => {
1105
- let addonMessage = "";
1106
- if (selectedAddons.length > 1) addonMessage = `${import_picocolors$2.default.green(addon.id)}:\n`;
1110
+ const nextSteps = selectedAddons.map(({ addon }) => {
1111
+ if (!addon.nextSteps) return;
1112
+ let addonMessage = `${import_picocolors$2.default.green(addon.id)}:\n`;
1113
+ const options$2 = official[addon.id];
1107
1114
  const addonNextSteps = addon.nextSteps({
1108
1115
  ...workspace,
1109
- options: official[addon.id],
1116
+ options: options$2,
1110
1117
  highlighter
1111
1118
  });
1112
- addonMessage += `- ${addonNextSteps.join("\n- ")}`;
1119
+ addonMessage += ` - ${addonNextSteps.join("\n - ")}`;
1113
1120
  return addonMessage;
1114
- }).join("\n\n") || undefined;
1121
+ }).filter((msg) => msg !== undefined);
1115
1122
  return {
1116
1123
  nextSteps,
1117
1124
  packageManager
@@ -1222,30 +1229,35 @@ const create$1 = new Command("create").description("scaffolds a new SvelteKit pr
1222
1229
  const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$1);
1223
1230
  const highlight = (str) => import_picocolors$1.default.bold(import_picocolors$1.default.cyan(str));
1224
1231
  let i = 1;
1225
- const initialSteps = [];
1232
+ const initialSteps = ["📁 Project steps", ""];
1226
1233
  const relative = path.relative(process.cwd(), directory);
1227
1234
  const pm = packageManager ?? (await detect({ cwd: directory }))?.name ?? getUserAgent() ?? "npm";
1228
1235
  if (relative !== "") {
1229
1236
  const pathHasSpaces = relative.includes(" ");
1230
- initialSteps.push(`${i++}: ${highlight(`cd ${pathHasSpaces ? `"${relative}"` : relative}`)}`);
1237
+ initialSteps.push(` ${i++}: ${highlight(`cd ${pathHasSpaces ? `"${relative}"` : relative}`)}`);
1231
1238
  }
1232
1239
  if (!packageManager) {
1233
1240
  const { args: args$1, command: command$1 } = resolveCommand(pm, "install", []);
1234
- initialSteps.push(`${i++}: ${highlight(`${command$1} ${args$1.join(" ")}`)}`);
1241
+ initialSteps.push(` ${i++}: ${highlight(`${command$1} ${args$1.join(" ")}`)}`);
1235
1242
  }
1236
1243
  const { args, command } = resolveCommand(pm, "run", ["dev", "--open"]);
1237
1244
  const pmRunCmd = `${command} ${args.join(" ")}`;
1238
1245
  const steps = [
1239
1246
  ...initialSteps,
1240
- `${i++}: ${highlight("git init && git add -A && git commit -m \"Initial commit\"")} (optional)`,
1241
- `${i++}: ${highlight(pmRunCmd)}`,
1242
- "",
1243
- `To close the dev server, hit ${highlight("Ctrl-C")}`,
1247
+ ` ${i++}: ${highlight("git init && git add -A && git commit -m \"Initial commit\"")} (optional)`,
1248
+ ` ${i++}: ${highlight(pmRunCmd)}`,
1244
1249
  "",
1245
- `Stuck? Visit us at ${import_picocolors$1.default.cyan("https://svelte.dev/chat")}`
1250
+ `To close the dev server, hit ${highlight("Ctrl-C")}`
1246
1251
  ];
1247
- Ke(steps.join("\n"), "Project next steps", { format: (line) => line });
1248
- if (addOnNextSteps) Ke(addOnNextSteps, "Add-on next steps", { format: (line) => line });
1252
+ if (addOnNextSteps.length > 0) {
1253
+ steps.push("", "🧩 Add-on steps", "");
1254
+ for (const step of addOnNextSteps) {
1255
+ const indented = step.replaceAll(" -", " -");
1256
+ steps.push(` ${indented}`);
1257
+ }
1258
+ }
1259
+ steps.push("", `Stuck? Visit us at ${import_picocolors$1.default.cyan("https://svelte.dev/chat")}`);
1260
+ Ke(steps.join("\n"), "What's next?", { format: (line) => line });
1249
1261
  });
1250
1262
  });
1251
1263
  async function createProject(cwd, options$1) {
@@ -1316,7 +1328,7 @@ async function createProject(cwd, options$1) {
1316
1328
  });
1317
1329
  T.success("Project created");
1318
1330
  let packageManager;
1319
- let addOnNextSteps;
1331
+ let addOnNextSteps = [];
1320
1332
  const installDeps = async (install) => {
1321
1333
  packageManager = install === true ? await packageManagerPrompt(projectPath) : install;
1322
1334
  addPnpmBuildDependencies(projectPath, packageManager, ["esbuild"]);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { create } from "./package-manager-DO5R9a6p.js";
2
- import { installAddon, officialAddons } from "./addons-Br9tic5t.js";
2
+ import { installAddon, officialAddons } from "./addons-Ce9LFQn0.js";
3
3
 
4
4
  export { create, installAddon, officialAddons };
package/dist/shared.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "README.md",
5
5
  "include": [],
6
6
  "exclude": [],
7
- "contents": "# sv\n\nEverything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```bash\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```bash\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\n## Building\n\nTo create a production version of your app:\n\n```bash\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n"
7
+ "contents": "# sv\n\nEverything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\n## Building\n\nTo create a production version of your app:\n\n```sh\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n"
8
8
  },
9
9
  {
10
10
  "name": "jsconfig.json",
@@ -28,7 +28,7 @@
28
28
  "library"
29
29
  ],
30
30
  "exclude": [],
31
- "contents": "# Svelte library\n\nEverything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).\n\nRead more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```bash\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```bash\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\nEverything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.\n\n## Building\n\nTo build your library:\n\n```bash\nnpm run package\n```\n\nTo create a production version of your showcase app:\n\n```bash\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n\n## Publishing\n\nGo into the `package.json` and give your package the desired name through the `\"name\"` option. Also consider adding a `\"license\"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).\n\nTo publish your library to [npm](https://www.npmjs.com):\n\n```bash\nnpm publish\n```\n"
31
+ "contents": "# Svelte library\n\nEverything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).\n\nRead more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\nEverything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.\n\n## Building\n\nTo build your library:\n\n```sh\nnpm run package\n```\n\nTo create a production version of your showcase app:\n\n```sh\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n\n## Publishing\n\nGo into the `package.json` and give your package the desired name through the `\"name\"` option. Also consider adding a `\"license\"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).\n\nTo publish your library to [npm](https://www.npmjs.com):\n\n```sh\nnpm publish\n```\n"
32
32
  },
33
33
  {
34
34
  "name": "jsconfig.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.8.18",
3
+ "version": "0.8.20",
4
4
  "type": "module",
5
5
  "description": "A CLI for creating and updating SvelteKit projects",
6
6
  "license": "MIT",
@@ -36,9 +36,9 @@
36
36
  "ps-tree": "^1.2.0",
37
37
  "tinyexec": "^0.3.2",
38
38
  "valibot": "^0.41.0",
39
- "@sveltejs/addons": "0.0.0",
40
39
  "@sveltejs/cli-core": "0.0.0",
41
- "@sveltejs/create": "0.0.0"
40
+ "@sveltejs/create": "0.0.0",
41
+ "@sveltejs/addons": "0.0.0"
42
42
  },
43
43
  "keywords": [
44
44
  "create",