sv 0.16.1 → 0.16.2

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.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { _ as name, a as detectPackageManager, d as Command, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as program, v as version } from "./engine-b8_m6QgA.mjs";
2
+ import { _ as name, a as detectPackageManager, d as Command, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as program, v as version } from "./engine-2Sa2F6eX.mjs";
3
3
  import { color, resolveCommandArray } from "@sveltejs/sv-utils";
4
- import process from "node:process";
4
+ import V from "node:process";
5
5
  import { execSync } from "node:child_process";
6
6
  //#region src/cli/check.ts
7
- 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.cwd()).helpOption(false).action(async (options, check) => {
7
+ 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", V.cwd()).helpOption(false).action(async (options, check) => {
8
8
  const cwd = options.cwd;
9
9
  const args = check.args;
10
10
  await runCheck(cwd, args);
@@ -13,7 +13,7 @@ async function runCheck(cwd, args) {
13
13
  const pm = await detectPackageManager(cwd);
14
14
  if (!from(cwd, "svelte-check", true)) {
15
15
  console.error(`'svelte-check' is not installed locally. Install it with: ${color.command(resolveCommandArray(pm, "add", ["-D", "svelte-check"]))}`);
16
- process.exit(1);
16
+ V.exit(1);
17
17
  }
18
18
  if (args.includes("--help")) {
19
19
  console.log(`All svelte-check [options] are available in sv check [options]`);
@@ -32,7 +32,7 @@ async function runCheck(cwd, args) {
32
32
  }
33
33
  //#endregion
34
34
  //#region src/cli/migrate.ts
35
- 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(async (migration, options) => {
35
+ 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", V.cwd()).action(async (migration, options) => {
36
36
  await runMigrate(options.cwd, [migration]);
37
37
  });
38
38
  async function runMigrate(cwd, args) {
@@ -53,7 +53,7 @@ async function runMigrate(cwd, args) {
53
53
  console.log();
54
54
  program.name(name).version(version, "-v, --version").configureHelp(helpConfig);
55
55
  program.addCommand(create).addCommand(add).addCommand(migrate).addCommand(check);
56
- if (process.argv.includes("--help") || process.argv.includes("-h")) program.addHelpText("after", () => "\n" + create.helpInformation());
56
+ if (V.argv.includes("--help") || V.argv.includes("-h")) program.addHelpText("after", () => "\n" + create.helpInformation());
57
57
  program.parse();
58
58
  //#endregion
59
59
  export {};
@@ -3,9 +3,9 @@ import { AGENTS, COMMANDS, Walker, coerceVersion, color, constructCommand, creat
3
3
  import fs, { closeSync, existsSync, openSync, readSync, statSync } from "node:fs";
4
4
  import path, { basename, delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
5
5
  import { promisify, stripVTControlCharacters, styleText } from "node:util";
6
- import process$1, { cwd, stdin, stdout } from "node:process";
6
+ import V, { cwd, stdin, stdout } from "node:process";
7
7
  import * as b$1 from "node:readline";
8
- import u from "node:readline";
8
+ import G from "node:readline";
9
9
  import { ReadStream } from "node:tty";
10
10
  import { fileURLToPath } from "node:url";
11
11
  import childProcess, { exec, spawn } from "node:child_process";
@@ -37,7 +37,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
37
37
  value: mod,
38
38
  enumerable: true
39
39
  }) : target, mod));
40
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
40
+ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
41
41
  //#endregion
42
42
  //#region src/core/deprecated.ts
43
43
  const warned = /* @__PURE__ */ new Set();
@@ -392,7 +392,7 @@ function f(r, t, s) {
392
392
  return s[n].disabled ? f(n, t < 0 ? -1 : 1, s) : n;
393
393
  }
394
394
  const h$1 = {
395
- actions: new Set([
395
+ actions: /* @__PURE__ */ new Set([
396
396
  "up",
397
397
  "down",
398
398
  "left",
@@ -401,7 +401,7 @@ const h$1 = {
401
401
  "enter",
402
402
  "cancel"
403
403
  ]),
404
- aliases: new Map([
404
+ aliases: /* @__PURE__ */ new Map([
405
405
  ["k", "up"],
406
406
  ["j", "down"],
407
407
  ["h", "left"],
@@ -561,7 +561,7 @@ var m = class {
561
561
  this.state = "cancel", this.close();
562
562
  }, { once: !0 });
563
563
  }
564
- this.rl = u.createInterface({
564
+ this.rl = G.createInterface({
565
565
  input: this.input,
566
566
  tabSize: 2,
567
567
  prompt: "",
@@ -680,12 +680,6 @@ var Z = class extends m {
680
680
  });
681
681
  }
682
682
  };
683
- new Set([
684
- "up",
685
- "down",
686
- "left",
687
- "right"
688
- ]);
689
683
  let ut$1 = class extends m {
690
684
  options;
691
685
  cursor = 0;
@@ -784,7 +778,7 @@ var ct$1 = class extends m {
784
778
  //#endregion
785
779
  //#region ../../node_modules/.pnpm/@clack+prompts@1.5.0/node_modules/@clack/prompts/dist/index.mjs
786
780
  function se() {
787
- 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";
781
+ return V.platform !== "win32" ? V.env.TERM !== "linux" : !!V.env.CI || !!V.env.WT_SESSION || !!V.env.TERMINUS_SUBLIME || V.env.ConEmuTask === "{cmd::Cmder}" || V.env.TERM_PROGRAM === "Terminus-Sublime" || V.env.TERM_PROGRAM === "vscode" || V.env.TERM === "xterm-256color" || V.env.TERM === "alacritty" || V.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
788
782
  }
789
783
  const tt = se(), at = () => process.env.CI === "true", Tt = (t) => t.isTTY === !0, w$1 = (t, i) => tt ? t : i, _t = w$1("◆", "*"), ut = w$1("■", "x"), lt = w$1("▲", "x"), H = w$1("◇", "o"), ct = w$1("┌", "T"), $ = w$1("│", "|"), x$1 = w$1("└", "—"), z$1 = w$1("●", ">"), U = w$1("○", " "), et = w$1("◻", "[•]"), K = w$1("◼", "[+]"), Y = w$1("◻", "[ ]"), st = w$1("─", "-"), $t = w$1("╮", "+"), Mt = w$1("├", "+"), dt = w$1("╯", "+"), ht = w$1("╰", "+"), pt = w$1("●", "•"), mt = w$1("◆", "*"), gt = w$1("▲", "!"), yt = w$1("■", "x"), P$1 = (t) => {
790
784
  switch (t) {
@@ -1031,7 +1025,7 @@ ${r ? styleText("cyan", x$1) : ""}
1031
1025
  `), n = u.reduce((o, l) => Math.max(fastStringWidth(l), o), 0);
1032
1026
  return wrapAnsi(t, i - (u.map(s).reduce((o, l) => Math.max(fastStringWidth(l), o), 0) - n), r);
1033
1027
  }, Ce = (t = "", i = "", s) => {
1034
- const r = s?.output ?? process$1.stdout, u = s?.withGuide ?? h$1.withGuide, n = s?.format ?? be, a = [
1028
+ const r = s?.output ?? V.stdout, u = s?.withGuide ?? h$1.withGuide, n = s?.format ?? be, a = [
1035
1029
  "",
1036
1030
  ...Se(t, A(r) - 6, n).split(`
1037
1031
  `).map(n),
@@ -1354,7 +1348,7 @@ ${i ? styleText("cyan", x$1) : ""}
1354
1348
  //#endregion
1355
1349
  //#region package.json
1356
1350
  var name = "sv";
1357
- var version = "0.16.1";
1351
+ var version = "0.16.2";
1358
1352
  //#endregion
1359
1353
  //#region src/core/errors.ts
1360
1354
  var UnsupportedError = class extends Error {
@@ -1459,7 +1453,7 @@ async function runCommand(action) {
1459
1453
  console.log(color.hidden("HINT: Run \"sv --help\" to get the full list of commands, add-ons, and examples to one-shot and skip interactive prompts."));
1460
1454
  ye(`Welcome to the Svelte CLI! ${color.optional(`(v${version})`)}`);
1461
1455
  const minimumVersion = "18.3.0";
1462
- if (isVersionUnsupportedBelow(process$1.versions.node, minimumVersion)) R$1.warn(`You are using Node.js ${color.error(process$1.versions.node)}, please upgrade to Node.js ${color.success(minimumVersion)} or higher.`);
1456
+ if (isVersionUnsupportedBelow(V.versions.node, minimumVersion)) R$1.warn(`You are using Node.js ${color.error(V.versions.node)}, please upgrade to Node.js ${color.success(minimumVersion)} or higher.`);
1463
1457
  await action();
1464
1458
  fe("You're all set!");
1465
1459
  } catch (e) {
@@ -1480,8 +1474,8 @@ function getPadding(lines) {
1480
1474
  return Math.max(...lengths);
1481
1475
  }
1482
1476
  function forwardExitCode(error) {
1483
- if (error && typeof error === "object" && "status" in error && typeof error.status === "number") process$1.exit(error.status);
1484
- else process$1.exit(1);
1477
+ if (error && typeof error === "object" && "status" in error && typeof error.status === "number") V.exit(error.status);
1478
+ else V.exit(1);
1485
1479
  }
1486
1480
  function parseAddonOptions(optionFlags) {
1487
1481
  if (optionFlags === void 0 || optionFlags === "") return;
@@ -1527,7 +1521,7 @@ function errorAndExit(message) {
1527
1521
  R$1.error(message);
1528
1522
  R$1.message();
1529
1523
  ge("Operation failed.");
1530
- process$1.exit(1);
1524
+ V.exit(1);
1531
1525
  }
1532
1526
  const normalizePosix = (dir) => {
1533
1527
  return path.posix.normalize(dir.replace(/\\/g, "/"));
@@ -1968,7 +1962,7 @@ var I = class {
1968
1962
  if (this._streamErr) t.push(this._streamErr);
1969
1963
  if (this._streamOut) t.push(this._streamOut);
1970
1964
  const n = b(t);
1971
- const r = u.createInterface({ input: n });
1965
+ const r = G.createInterface({ input: n });
1972
1966
  for await (const e of r) yield e.toString();
1973
1967
  await this._processClosed;
1974
1968
  e.removeAllListeners();
@@ -3076,13 +3070,13 @@ var Command = class Command extends EventEmitter {
3076
3070
  this._showSuggestionAfterError = true;
3077
3071
  this._savedState = null;
3078
3072
  this._outputConfiguration = {
3079
- writeOut: (str) => process$1.stdout.write(str),
3080
- writeErr: (str) => process$1.stderr.write(str),
3073
+ writeOut: (str) => V.stdout.write(str),
3074
+ writeErr: (str) => V.stderr.write(str),
3081
3075
  outputError: (str, write) => write(str),
3082
- getOutHelpWidth: () => process$1.stdout.isTTY ? process$1.stdout.columns : void 0,
3083
- getErrHelpWidth: () => process$1.stderr.isTTY ? process$1.stderr.columns : void 0,
3084
- getOutHasColors: () => useColor() ?? (process$1.stdout.isTTY && process$1.stdout.hasColors?.()),
3085
- getErrHasColors: () => useColor() ?? (process$1.stderr.isTTY && process$1.stderr.hasColors?.()),
3076
+ getOutHelpWidth: () => V.stdout.isTTY ? V.stdout.columns : void 0,
3077
+ getErrHelpWidth: () => V.stderr.isTTY ? V.stderr.columns : void 0,
3078
+ getOutHasColors: () => useColor() ?? (V.stdout.isTTY && V.stdout.hasColors?.()),
3079
+ getErrHasColors: () => useColor() ?? (V.stderr.isTTY && V.stderr.hasColors?.()),
3086
3080
  stripColor: (str) => stripVTControlCharacters(str)
3087
3081
  };
3088
3082
  this._hidden = false;
@@ -3451,7 +3445,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3451
3445
  */
3452
3446
  _exit(exitCode, code, message) {
3453
3447
  if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
3454
- process$1.exit(exitCode);
3448
+ V.exit(exitCode);
3455
3449
  }
3456
3450
  /**
3457
3451
  * Register callback `fn` for the command.
@@ -3789,11 +3783,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
3789
3783
  if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
3790
3784
  parseOptions = parseOptions || {};
3791
3785
  if (argv === void 0 && parseOptions.from === void 0) {
3792
- if (process$1.versions?.electron) parseOptions.from = "electron";
3793
- const execArgv = process$1.execArgv ?? [];
3786
+ if (V.versions?.electron) parseOptions.from = "electron";
3787
+ const execArgv = V.execArgv ?? [];
3794
3788
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
3795
3789
  }
3796
- if (argv === void 0) argv = process$1.argv;
3790
+ if (argv === void 0) argv = V.argv;
3797
3791
  this.rawArgs = argv.slice();
3798
3792
  let userArgs;
3799
3793
  switch (parseOptions.from) {
@@ -3803,7 +3797,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3803
3797
  userArgs = argv.slice(2);
3804
3798
  break;
3805
3799
  case "electron":
3806
- if (process$1.defaultApp) {
3800
+ if (V.defaultApp) {
3807
3801
  this._scriptPath = argv[1];
3808
3802
  userArgs = argv.slice(2);
3809
3803
  } else userArgs = argv.slice(1);
@@ -3972,16 +3966,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
3972
3966
  }
3973
3967
  const launchWithNode = sourceExt.includes(path.extname(executableFile));
3974
3968
  let proc;
3975
- if (process$1.platform !== "win32") if (launchWithNode) {
3969
+ if (V.platform !== "win32") if (launchWithNode) {
3976
3970
  args.unshift(executableFile);
3977
- args = incrementNodeInspectorPort(process$1.execArgv).concat(args);
3978
- proc = childProcess.spawn(process$1.argv[0], args, { stdio: "inherit" });
3971
+ args = incrementNodeInspectorPort(V.execArgv).concat(args);
3972
+ proc = childProcess.spawn(V.argv[0], args, { stdio: "inherit" });
3979
3973
  } else proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
3980
3974
  else {
3981
3975
  this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
3982
3976
  args.unshift(executableFile);
3983
- args = incrementNodeInspectorPort(process$1.execArgv).concat(args);
3984
- proc = childProcess.spawn(process$1.execPath, args, { stdio: "inherit" });
3977
+ args = incrementNodeInspectorPort(V.execArgv).concat(args);
3978
+ proc = childProcess.spawn(V.execPath, args, { stdio: "inherit" });
3985
3979
  }
3986
3980
  if (!proc.killed) [
3987
3981
  "SIGUSR1",
@@ -3990,20 +3984,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
3990
3984
  "SIGINT",
3991
3985
  "SIGHUP"
3992
3986
  ].forEach((signal) => {
3993
- process$1.on(signal, () => {
3987
+ V.on(signal, () => {
3994
3988
  if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
3995
3989
  });
3996
3990
  });
3997
3991
  const exitCallback = this._exitCallback;
3998
3992
  proc.on("close", (code) => {
3999
3993
  code = code ?? 1;
4000
- if (!exitCallback) process$1.exit(code);
3994
+ if (!exitCallback) V.exit(code);
4001
3995
  else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
4002
3996
  });
4003
3997
  proc.on("error", (err) => {
4004
3998
  if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
4005
3999
  else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
4006
- if (!exitCallback) process$1.exit(1);
4000
+ if (!exitCallback) V.exit(1);
4007
4001
  else {
4008
4002
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
4009
4003
  wrappedError.nestedError = err;
@@ -4415,13 +4409,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
4415
4409
  */
4416
4410
  _parseOptionsEnv() {
4417
4411
  this.options.forEach((option) => {
4418
- if (option.envVar && option.envVar in process$1.env) {
4412
+ if (option.envVar && option.envVar in V.env) {
4419
4413
  const optionKey = option.attributeName();
4420
4414
  if (this.getOptionValue(optionKey) === void 0 || [
4421
4415
  "default",
4422
4416
  "config",
4423
4417
  "env"
4424
- ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$1.env[option.envVar]);
4418
+ ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, V.env[option.envVar]);
4425
4419
  else this.emit(`optionEnv:${option.name()}`);
4426
4420
  }
4427
4421
  });
@@ -4901,7 +4895,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4901
4895
  */
4902
4896
  help(contextOptions) {
4903
4897
  this.outputHelp(contextOptions);
4904
- let exitCode = Number(process$1.exitCode ?? 0);
4898
+ let exitCode = Number(V.exitCode ?? 0);
4905
4899
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
4906
4900
  this._exit(exitCode, "commander.help", "(outputHelp)");
4907
4901
  }
@@ -4993,8 +4987,8 @@ function incrementNodeInspectorPort(args) {
4993
4987
  * @package
4994
4988
  */
4995
4989
  function useColor() {
4996
- if (process$1.env.NO_COLOR || process$1.env.FORCE_COLOR === "0" || process$1.env.FORCE_COLOR === "false") return false;
4997
- if (process$1.env.FORCE_COLOR || process$1.env.CLICOLOR_FORCE !== void 0) return true;
4990
+ if (V.env.NO_COLOR || V.env.FORCE_COLOR === "0" || V.env.FORCE_COLOR === "false") return false;
4991
+ if (V.env.FORCE_COLOR || V.env.CLICOLOR_FORCE !== void 0) return true;
4998
4992
  }
4999
4993
  //#endregion
5000
4994
  //#region ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
@@ -5731,6 +5725,61 @@ const addEslintConfigPrettier = transforms.script(({ ast, js }) => {
5731
5725
  if (idx !== -1) elements.splice(idx + 1, 0, ...nodesToInsert);
5732
5726
  else elements.push(...nodesToInsert);
5733
5727
  });
5728
+ /**
5729
+ * Path of the prettier config file we generate. We always emit a `.js` file (with a JSDoc `@type`)
5730
+ * rather than `.ts`, since the VSCode prettier extension can't load a `.ts` config without a recent
5731
+ * enough Node in its extension host (see prettier/prettier-vscode#3989).
5732
+ */
5733
+ function prettierConfigPath() {
5734
+ return "prettier.config.js";
5735
+ }
5736
+ /**
5737
+ * Creates a `prettier.config.js` file with our defaults. Bails (leaving the file untouched)
5738
+ * if a config is already defined.
5739
+ */
5740
+ const createPrettierConfig = (opts) => transforms.script(({ ast, comments, js }) => {
5741
+ if (ast.body.some((node) => node.type === "ExportDefaultDeclaration")) {
5742
+ R$1.warn(`A ${color.warning("prettier")} config already exists. Skipping initialization.`);
5743
+ return false;
5744
+ }
5745
+ const plugins = ["prettier-plugin-svelte"];
5746
+ if (opts.tailwind) plugins.push("prettier-plugin-tailwindcss");
5747
+ const properties = [
5748
+ "useTabs: true",
5749
+ "singleQuote: true",
5750
+ `trailingComma: 'none'`,
5751
+ "printWidth: 100",
5752
+ `plugins: [${plugins.map((p) => `'${p}'`).join(", ")}]`,
5753
+ `overrides: [{ files: '*.svelte', options: { parser: 'svelte' } }]`
5754
+ ];
5755
+ if (opts.tailwind && opts.stylesheet) properties.push(`tailwindStylesheet: '${opts.stylesheet}'`);
5756
+ js.common.appendFromString(ast, {
5757
+ comments,
5758
+ code: `
5759
+ /** @type {import("prettier").Config} */
5760
+ const config = { ${properties.join(", ")} };
5761
+ export default config;
5762
+ `
5763
+ });
5764
+ });
5765
+ /**
5766
+ * Augments an existing `prettier.config.js` config object with the tailwindcss plugin and
5767
+ * stylesheet. Used when prettier was added before tailwindcss.
5768
+ */
5769
+ const addPrettierTailwind = (opts) => transforms.script(({ ast, js }) => {
5770
+ if (!ast.body.some((node) => node.type === "ExportDefaultDeclaration")) return false;
5771
+ const { value } = js.exports.createDefault(ast, { fallback: js.object.create({}) });
5772
+ if (value.type !== "ObjectExpression") return false;
5773
+ const plugins = js.object.property(value, {
5774
+ name: "plugins",
5775
+ fallback: js.array.create()
5776
+ });
5777
+ if (plugins.type === "ArrayExpression") js.array.append(plugins, "prettier-plugin-tailwindcss");
5778
+ if (!value.properties.some((p) => p.type === "Property" && p.key.type === "Identifier" && p.key.name === "tailwindStylesheet")) js.object.property(value, {
5779
+ name: "tailwindStylesheet",
5780
+ fallback: js.common.createLiteral(opts.stylesheet)
5781
+ });
5782
+ });
5734
5783
  const addToDemoPage = (path, language) => transforms.svelteScript({ language }, ({ ast, js, svelte }) => {
5735
5784
  for (const node of ast.fragment.nodes) if (node.type === "RegularElement") {
5736
5785
  const hrefAttribute = node.attributes.find((x) => x.type === "Attribute" && x.name === "href");
@@ -5751,16 +5800,16 @@ const addToDemoPage = (path, language) => transforms.svelteScript({ language },
5751
5800
  * the nearest `LTS` release version.
5752
5801
  */
5753
5802
  function getNodeTypesVersion() {
5754
- const nodeVersion = process$1.versions.node;
5755
- const isDenoOrBun = Boolean(process$1.versions.deno ?? process$1.versions.bun);
5803
+ const nodeVersion = V.versions.node;
5804
+ const isDenoOrBun = Boolean(V.versions.deno ?? V.versions.bun);
5756
5805
  const [major] = nodeVersion.split(".");
5757
5806
  const majorNum = Number(major);
5758
5807
  const isEvenMajor = majorNum % 2 === 0;
5759
- if (!!process$1.release.lts || isDenoOrBun && isEvenMajor) return `^${major}`;
5808
+ if (!!V.release.lts || isDenoOrBun && isEvenMajor) return `^${major}`;
5760
5809
  return `^${isEvenMajor ? majorNum - 2 : majorNum - 1}`;
5761
5810
  }
5762
5811
  //#endregion
5763
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/taggedTemplateLiteral.js
5812
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/taggedTemplateLiteral.js
5764
5813
  function _taggedTemplateLiteral(e, t) {
5765
5814
  return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } }));
5766
5815
  }
@@ -5960,10 +6009,7 @@ var better_auth_default = defineAddon({
5960
6009
  imports: [d1 ? "createAuth" : "auth"],
5961
6010
  from: "$lib/server/auth"
5962
6011
  });
5963
- js.imports.addNamed(ast, {
5964
- imports: ["building"],
5965
- from: "$app/environment"
5966
- });
6012
+ env.importEnv(ast, js, ["building"]);
5967
6013
  const handleContent = dedent`
5968
6014
  async ({ event, resolve }) => {${d1 ? dedent`
5969
6015
  if (!event.platform?.env?.DB) throw new Error('D1 binding "DB" not found - are you running with wrangler?');
@@ -6426,7 +6472,7 @@ var drizzle_default = defineAddon({
6426
6472
  sv,
6427
6473
  cwd
6428
6474
  }, ({ override, js }) => {
6429
- override({ typescript: { config: js.common.parseExpression(`(config) => ({ ...config, include: [...config.include, '../drizzle.config.${language}'] })`) } });
6475
+ override({ typescript: { config: js.common.parseExpression(`(config) => { config.include.push('../drizzle.config.${language}')}`) } });
6430
6476
  });
6431
6477
  sv.file(paths["database schema"], transforms.script(({ ast, js }) => {
6432
6478
  let taskSchemaExpression;
@@ -6624,7 +6670,7 @@ var drizzle_default = defineAddon({
6624
6670
  ]))} to add it`);
6625
6671
  const ext = fileExists(cwd, "wrangler.toml") ? "toml" : "jsonc";
6626
6672
  steps.push(`Add your ${color.env("CLOUDFLARE_ACCOUNT_ID")}, ${color.env("CLOUDFLARE_DATABASE_ID")}, and ${color.env("CLOUDFLARE_D1_TOKEN")} to ${color.path(".env")}`);
6627
- steps.push(`Run ${color.command(resolveCommandArray(packageManager, "run", [
6673
+ steps.push(`Run ${color.command(resolveCommandArray(packageManager, "execute-local", [
6628
6674
  "wrangler",
6629
6675
  "d1",
6630
6676
  "create",
@@ -7327,11 +7373,11 @@ var playwright_default = defineAddon({
7327
7373
  else R$1.warn("Unexpected playwright config for playwright add-on. Could not update.");
7328
7374
  }));
7329
7375
  },
7330
- nextSteps: ({ isKit }) => {
7376
+ nextSteps: ({ isKit, packageManager }) => {
7331
7377
  const steps = [];
7332
- steps.push(`Run ${color.command("npx playwright install")} to download browsers`);
7378
+ steps.push(`Run ${color.command(resolveCommandArray(packageManager, "execute-local", ["playwright", "install"]))} to download browsers`);
7333
7379
  if (isKit) steps.push(`Visit ${color.route("/demo/playwright")} to see the demo page`);
7334
- steps.push(`Run ${color.command("npm run test:e2e")} to execute the example tests`);
7380
+ steps.push(`Run ${color.command(resolveCommandArray(packageManager, "run", ["test:e2e"]))} to execute the example tests`);
7335
7381
  return steps;
7336
7382
  }
7337
7383
  });
@@ -7361,27 +7407,10 @@ var prettier_default = defineAddon({
7361
7407
  /static/
7362
7408
  `;
7363
7409
  }));
7364
- sv.file(".prettierrc", transforms.json(({ data, json }) => {
7365
- if (Object.keys(data).length === 0) {
7366
- data.useTabs = true;
7367
- data.singleQuote = true;
7368
- data.trailingComma = "none";
7369
- data.printWidth = 100;
7370
- }
7371
- json.arrayUpsert(data, "plugins", "prettier-plugin-svelte");
7372
- if (tailwindcssInstalled) {
7373
- json.arrayUpsert(data, "plugins", "prettier-plugin-tailwindcss");
7374
- data.tailwindStylesheet ??= file.getRelative({ to: file.stylesheet });
7375
- }
7376
- data.overrides ??= [];
7377
- const overrides = data.overrides;
7378
- if (!overrides.find((o) => o?.options?.parser === "svelte")) overrides.push({
7379
- files: "*.svelte",
7380
- options: { parser: "svelte" }
7381
- });
7382
- }, { onError: () => {
7383
- R$1.warn(`A ${color.warning(".prettierrc")} config already exists and cannot be parsed as JSON. Skipping initialization.`);
7384
- } }));
7410
+ sv.file(prettierConfigPath(), createPrettierConfig({
7411
+ tailwind: tailwindcssInstalled,
7412
+ stylesheet: tailwindcssInstalled ? file.getRelative({ to: file.stylesheet }) : void 0
7413
+ }));
7385
7414
  const eslintInfo = checkEslint(dependencyVersion("eslint"));
7386
7415
  sv.file(file.package, transforms.json(({ data, json }) => {
7387
7416
  json.packageScriptsUpsert(data, "lint", "prettier --check .", { mode: "prepend" });
@@ -7425,7 +7454,7 @@ var storybook_default = defineAddon({
7425
7454
  "--skip-install",
7426
7455
  "--no-dev"
7427
7456
  ];
7428
- if (process$1.env.NODE_ENV?.toLowerCase() === "test") args.push(...["--no-features", "--yes"]);
7457
+ if (V.env.NODE_ENV?.toLowerCase() === "test") args.push(...["--no-features", "--yes"]);
7429
7458
  await sv.execute(args, "inherit");
7430
7459
  sv.devDependency(`@types/node`, getNodeTypesVersion());
7431
7460
  }
@@ -7671,10 +7700,7 @@ var tailwindcss_default = defineAddon({
7671
7700
  sv.file(".vscode/extensions.json", transforms.json(({ data, json }) => {
7672
7701
  json.arrayUpsert(data, "recommendations", "bradlc.vscode-tailwindcss");
7673
7702
  }));
7674
- if (prettierInstalled) sv.file(".prettierrc", transforms.json(({ data, json }) => {
7675
- json.arrayUpsert(data, "plugins", "prettier-plugin-tailwindcss");
7676
- data.tailwindStylesheet ??= file.getRelative({ to: file.stylesheet });
7677
- }));
7703
+ if (prettierInstalled) sv.file(prettierConfigPath(), addPrettierTailwind({ stylesheet: file.getRelative({ to: file.stylesheet }) }));
7678
7704
  }
7679
7705
  });
7680
7706
  //#endregion
@@ -10705,7 +10731,7 @@ agentOptions.unshift({
10705
10731
  const installOption = new Option("--install <package-manager>", "installs dependencies with a specified package manager").choices(AGENT_NAMES);
10706
10732
  async function packageManagerPrompt(cwd) {
10707
10733
  const agent = (await detect({ cwd }))?.name ?? getUserAgent();
10708
- if (!process$1.stdout.isTTY) return agent;
10734
+ if (!V.stdout.isTTY) return agent;
10709
10735
  const pm = await Ee({
10710
10736
  message: "Which package manager do you want to install dependencies with?",
10711
10737
  options: agentOptions,
@@ -10713,14 +10739,14 @@ async function packageManagerPrompt(cwd) {
10713
10739
  });
10714
10740
  if (R$2(pm)) {
10715
10741
  ge("Operation cancelled.");
10716
- process$1.exit(1);
10742
+ V.exit(1);
10717
10743
  }
10718
10744
  return pm;
10719
10745
  }
10720
10746
  async function installDependencies(agent, cwd) {
10721
10747
  const task = Pe({
10722
10748
  title: `Installing dependencies with ${color.command(agent)}...`,
10723
- limit: Math.ceil(process$1.stdout.rows / 2),
10749
+ limit: Math.ceil(V.stdout.rows / 2),
10724
10750
  spacing: 0,
10725
10751
  retainLog: true
10726
10752
  });
@@ -10750,13 +10776,13 @@ async function installDependencies(agent, cwd) {
10750
10776
  }
10751
10777
  task.error("Failed to install dependencies");
10752
10778
  ge("Operation failed.");
10753
- process$1.exit(2);
10779
+ V.exit(2);
10754
10780
  }
10755
10781
  async function detectPackageManager(cwd) {
10756
10782
  return (await detect({ cwd }))?.name ?? getUserAgent() ?? "npm";
10757
10783
  }
10758
10784
  function getUserAgent() {
10759
- const userAgent = process$1.env.npm_config_user_agent;
10785
+ const userAgent = V.env.npm_config_user_agent;
10760
10786
  if (!userAgent) return void 0;
10761
10787
  const pmSpec = userAgent.split(" ")[0];
10762
10788
  const separatorPos = pmSpec.lastIndexOf("/");
@@ -10782,7 +10808,7 @@ function verifyCleanWorkingDirectory(cwd, gitCheck) {
10782
10808
  const { stdout } = await promisify(exec)("git status --short", { cwd });
10783
10809
  if (stdout) return {
10784
10810
  success: false,
10785
- message: "Found modified files"
10811
+ message: "Uncommited changes found"
10786
10812
  };
10787
10813
  return {
10788
10814
  success: true,
@@ -11194,13 +11220,13 @@ const create = new Command("create").description("Scaffold a new project (--add
11194
11220
  const options = parse$1(OptionsSchema$1, opts);
11195
11221
  if (options.fromPlayground && !validatePlaygroundUrl(options.fromPlayground)) {
11196
11222
  console.error(color.error(`Error: Invalid playground URL: ${options.fromPlayground}`));
11197
- process$1.exit(1);
11223
+ V.exit(1);
11198
11224
  }
11199
11225
  runCommand(async () => {
11200
11226
  const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options);
11201
11227
  let i = 1;
11202
11228
  const initialSteps = ["📁 Project steps", ""];
11203
- const relative = path.relative(process$1.cwd(), directory);
11229
+ const relative = path.relative(V.cwd(), directory);
11204
11230
  const pm = packageManager ?? await detectPackageManager(directory);
11205
11231
  if (relative !== "") {
11206
11232
  const pathHasSpaces = relative.includes(" ");
@@ -11225,7 +11251,7 @@ const create = new Command("create").description("Scaffold a new project (--add
11225
11251
  });
11226
11252
  }).showHelpAfterError(true);
11227
11253
  async function createProject(cwd, options) {
11228
- if (options.fromPlayground) R$1.warn("Svelte maintainers have not reviewed playgrounds for malicious code. Use at your discretion.");
11254
+ if (options.fromPlayground) R$1.warn("Svelte maintainers have not reviewed playgrounds for malicious code! Use at your discretion.");
11229
11255
  const promptGroupResult = await pe({
11230
11256
  directory: () => {
11231
11257
  const defaultPath = "./";
@@ -11246,7 +11272,7 @@ async function createProject(cwd, options) {
11246
11272
  });
11247
11273
  if (R$2(force) || !force) {
11248
11274
  ge("Exiting.");
11249
- process$1.exit(0);
11275
+ V.exit(0);
11250
11276
  }
11251
11277
  },
11252
11278
  template: () => {
@@ -11286,7 +11312,7 @@ async function createProject(cwd, options) {
11286
11312
  }
11287
11313
  }, { onCancel: () => {
11288
11314
  ge("Operation cancelled.");
11289
- process$1.exit(0);
11315
+ V.exit(0);
11290
11316
  } });
11291
11317
  const { directory, template } = promptGroupResult;
11292
11318
  const language = promptGroupResult.language;
@@ -11306,7 +11332,7 @@ async function createProject(cwd, options) {
11306
11332
  });
11307
11333
  if (R$2(org)) {
11308
11334
  ge("Operation cancelled.");
11309
- process$1.exit(0);
11335
+ V.exit(0);
11310
11336
  }
11311
11337
  projectName = `${org}/${basename}`;
11312
11338
  }
@@ -11410,7 +11436,7 @@ async function confirmExternalDependencies(dependencies) {
11410
11436
  });
11411
11437
  if (R$2(installDeps)) {
11412
11438
  ge("Operation cancelled.");
11413
- process$1.exit(0);
11439
+ V.exit(0);
11414
11440
  }
11415
11441
  return installDeps;
11416
11442
  }
@@ -11699,7 +11725,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
11699
11725
  });
11700
11726
  if (R$2(selected)) {
11701
11727
  ge("Operation cancelled.");
11702
- process$1.exit(1);
11728
+ V.exit(1);
11703
11729
  }
11704
11730
  for (const id of selected) {
11705
11731
  const addon = getAddonDetails(id);
@@ -11743,7 +11769,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
11743
11769
  }
11744
11770
  if (await le({ message: `The ${color.addon(addonId)} add-on requires ${color.addon(depId)} to also be setup. ${color.success("Include it?")}` }) !== true) {
11745
11771
  ge("Operation cancelled.");
11746
- process$1.exit(1);
11772
+ V.exit(1);
11747
11773
  }
11748
11774
  answers[depId] = {};
11749
11775
  }
@@ -11772,7 +11798,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
11772
11798
  });
11773
11799
  if (R$2(force) || !force) {
11774
11800
  ge("Operation cancelled.");
11775
- process$1.exit(1);
11801
+ V.exit(1);
11776
11802
  }
11777
11803
  }
11778
11804
  for (const loaded of addons) {
@@ -11811,7 +11837,7 @@ async function promptAddonQuestions({ options, loadedAddons, workspace }) {
11811
11837
  }
11812
11838
  if (R$2(answer)) {
11813
11839
  ge("Operation cancelled.");
11814
- process$1.exit(1);
11840
+ V.exit(1);
11815
11841
  }
11816
11842
  values[questionId] = answer;
11817
11843
  }
@@ -11847,7 +11873,7 @@ async function runAddonsApply({ answers, options, loadedAddons, setupResults, wo
11847
11873
  if (addonSuccess.length === 0) if (fromCommand === "create") R$1.warn("All selected add-ons were canceled.");
11848
11874
  else {
11849
11875
  ge("All selected add-ons were canceled.");
11850
- process$1.exit(1);
11876
+ V.exit(1);
11851
11877
  }
11852
11878
  else R$1.success(`Successfully setup add-ons: ${addonSuccess.map((c) => color.addon(c)).join(", ")}`);
11853
11879
  const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(options.cwd) : options.install;
@@ -11928,7 +11954,7 @@ function addonArgsHandler(acc, current) {
11928
11954
  } catch (error) {
11929
11955
  if (error instanceof Error) errorAndExit(error.message);
11930
11956
  console.error(error);
11931
- process$1.exit(1);
11957
+ V.exit(1);
11932
11958
  }
11933
11959
  return acc;
11934
11960
  }
@@ -12032,7 +12058,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
12032
12058
  }));
12033
12059
  stop("Resolved community add-on packages");
12034
12060
  for (const { warning } of pkgs) if (warning) R$1.warn(warning);
12035
- R$1.warn("Svelte maintainers have not reviewed community add-ons for malicious code. Use at your discretion.");
12061
+ R$1.warn("Svelte maintainers have not reviewed community add-ons for malicious code! Use at your discretion.");
12036
12062
  const paddingName = getPadding(pkgs.map(({ pkg }) => pkg.name));
12037
12063
  const paddingVersion = getPadding(pkgs.map(({ pkg }) => `(v${pkg.version})`));
12038
12064
  const packageInfos = pkgs.map(({ pkg, repo: _repo }) => {
@@ -12042,7 +12068,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
12042
12068
  if (downloadCheck) {
12043
12069
  if (await le({ message: "Would you like to continue?" }) !== true) {
12044
12070
  ge("Operation cancelled.");
12045
- process$1.exit(1);
12071
+ V.exit(1);
12046
12072
  }
12047
12073
  }
12048
12074
  start("Downloading community add-on packages");
@@ -12071,7 +12097,7 @@ async function resolveNonOfficialAddons(refs, downloadCheck) {
12071
12097
  }
12072
12098
  //#endregion
12073
12099
  //#region src/core/env.ts
12074
- const TESTING = process$1.env.NODE_ENV?.toLowerCase() === "test";
12100
+ const TESTING = V.env.NODE_ENV?.toLowerCase() === "test";
12075
12101
  //#endregion
12076
12102
  //#region src/core/engine.ts
12077
12103
  function alphabetizeRecord(obj) {
package/dist/shared.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "addon"
21
21
  ],
22
22
  "exclude": [],
23
- "contents": "# [sv](https://svelte.dev/docs/cli/overview) community add-on: [~SV-NAME-TODO~](https://github.com/~SV-NAME-TODO~)\n\n> [!IMPORTANT]\n> Svelte maintainers have not reviewed community add-ons for malicious code. Use at your discretion\n\n## Usage\n\nTo install the add-on, run:\n\n```shell\nnpx sv add ~SV-PROTOCOL-NAME-TODO~\n```\n\n## What you get [TO BE FILLED...]\n\n- A super cool stuff\n- Another one!\n\n## Options [TO BE FILLED...]\n\n### `who`\n\nThe name of the person to say hello to.\n\nDefault: `you`\n\n```shell\nnpx sv add ~SV-PROTOCOL-NAME-TODO~=\"who:your-name\"\n```\n"
23
+ "contents": "# [sv](https://svelte.dev/docs/cli/overview) community add-on: [~SV-NAME-TODO~](https://github.com/~SV-NAME-TODO~)\n\n> [!IMPORTANT]\n> Svelte maintainers have not reviewed community add-ons for malicious code! Use at your discretion.\n\n## Usage\n\nTo install the add-on, run:\n\n```shell\nnpx sv add ~SV-PROTOCOL-NAME-TODO~\n```\n\n## What you get [TO BE FILLED...]\n\n- A super cool stuff\n- Another one!\n\n## Options [TO BE FILLED...]\n\n### `who`\n\nThe name of the person to say hello to.\n\nDefault: `you`\n\n```shell\nnpx sv add ~SV-PROTOCOL-NAME-TODO~=\"who:your-name\"\n```\n"
24
24
  },
25
25
  {
26
26
  "name": "jsconfig.json",
@@ -1,4 +1,4 @@
1
- import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-b8_m6QgA.mjs";
1
+ import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-2Sa2F6eX.mjs";
2
2
  //#region src/index.ts
3
3
  function create(cwdOrOptions, legacyOptions) {
4
4
  if (typeof cwdOrOptions === "string") {
@@ -1,7 +1,7 @@
1
- import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-b8_m6QgA.mjs";
1
+ import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-2Sa2F6eX.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
- import process$1 from "node:process";
4
+ import V from "node:process";
5
5
  import { execSync } from "node:child_process";
6
6
  //#region ../../node_modules/.pnpm/through@2.3.8/node_modules/through/index.js
7
7
  var require_through = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -700,7 +700,7 @@ async function getProcessTree(pid) {
700
700
  });
701
701
  }
702
702
  async function terminate(pid) {
703
- if (process$1.platform === "win32") {
703
+ if (V.platform === "win32") {
704
704
  await R("taskkill", [
705
705
  "/PID",
706
706
  `${pid}`,
@@ -718,7 +718,7 @@ async function terminate(pid) {
718
718
  }
719
719
  function kill(pid) {
720
720
  try {
721
- process$1.kill(pid);
721
+ V.kill(pid);
722
722
  } catch {}
723
723
  }
724
724
  function setupGlobal({ TEST_DIR, pre, post }) {
@@ -22,11 +22,11 @@
22
22
  "access": "public"
23
23
  },
24
24
  "peerDependencies": {
25
- "sv": "^0.16.1"
25
+ "sv": "^0.16.2"
26
26
  },
27
27
  "devDependencies": {
28
- "sv": "^0.16.1",
29
- "@sveltejs/sv-utils": "^0.3.0",
28
+ "sv": "^0.16.2",
29
+ "@sveltejs/sv-utils": "^0.3.1",
30
30
  "@playwright/test": "^1.60.0",
31
31
  "@types/node": "^25.9.1",
32
32
  "tsdown": "^0.22.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "type": "module",
5
5
  "description": "A command line interface (CLI) for creating and maintaining Svelte applications",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@sveltejs/sv-utils": "0.3.0"
28
+ "@sveltejs/sv-utils": "0.3.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.5.0",