sv 1.0.0-next.5 → 1.0.0-next.6

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,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as Command, B as name, C as pipe, D as union, E as transform, F as forwardExitCode, G as ge, H as Ce, I as helpConfig, J as we, K as le, L as normalizePosix, O as from, P as errorAndExit, R as runAndValidateVerifications, S as picklist, T as string, U as Ee, V as version, W as R$1, Y as R, _ as array, a as verifyCleanWorkingDirectory, b as optional, c as AGENT_NAMES, d as installDependencies, f as installOption, i as create, k as program, n as prepareSvApi, o as formatFiles, p as packageManagerPrompt, q as vt, r as add, s as createWorkspace, u as detectPackageManager, v as boolean, w as strictObject, x as parse$1, y as literal, z as runCommand } from "./engine-DbmyuU8L.mjs";
2
+ import { A as Command, B as name, C as pipe, D as union, E as transform, F as forwardExitCode, G as ge, H as Ce, I as helpConfig, J as we, K as le, L as normalizePosix, O as from, P as errorAndExit, R as runAndValidateVerifications, S as picklist, T as string, U as Ee, V as version, W as R$1, Y as R, _ as array, a as verifyCleanWorkingDirectory, b as optional, c as AGENT_NAMES, d as installDependencies, f as installOption, i as create, k as program, n as prepareSvApi, o as formatFiles, p as packageManagerPrompt, q as vt, r as add, s as createWorkspace, u as detectPackageManager, v as boolean, w as strictObject, x as parse$1, y as literal, z as runCommand } from "./engine-qp2yrGle.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { Walker, coerceVersion, color, isVersionUnsupportedBelow, js, loadPackageJson, parse, resolveCommandArray, svelteConfig, transforms } from "@sveltejs/sv-utils";
@@ -1467,11 +1467,19 @@ const KIT3_PEERS = {
1467
1467
  "svelte-check": "^4.7.5",
1468
1468
  typescript: "^6.0.0"
1469
1469
  };
1470
+ const ADAPTERS = {
1471
+ "@sveltejs/adapter-auto": "^8.0.0-next.0",
1472
+ "@sveltejs/adapter-cloudflare": "^8.0.0-next.0",
1473
+ "@sveltejs/adapter-netlify": "^7.0.0-next.0",
1474
+ "@sveltejs/adapter-node": "^6.0.0-next.0",
1475
+ "@sveltejs/adapter-static": "^4.0.0-next.0",
1476
+ "@sveltejs/adapter-vercel": "^7.0.0-next.0"
1477
+ };
1470
1478
  var package_json_default = defineMigrationTask({
1471
1479
  id: "package-json",
1472
1480
  description: "Update package.json to be compatible with SvelteKit 3.0",
1473
1481
  run: ({ sv, cwd, language, dependencyVersion }) => {
1474
- sv.devDependency("@sveltejs/kit", "next");
1482
+ sv.devDependency("@sveltejs/kit", "^3.0.0-next.0");
1475
1483
  for (const [pkg, range] of Object.entries(KIT3_PEERS)) {
1476
1484
  if (pkg === "typescript" && language !== "ts") continue;
1477
1485
  const current = dependencyVersion(pkg);
@@ -1482,7 +1490,7 @@ var package_json_default = defineMigrationTask({
1482
1490
  ...pkg.devDependencies,
1483
1491
  ...pkg.dependencies
1484
1492
  };
1485
- for (const name of Object.keys(dependencies)) if (name.startsWith("@sveltejs/adapter-")) sv.devDependency(name, "next");
1493
+ for (const name of Object.keys(dependencies)) if (ADAPTERS[name]) sv.devDependency(name, ADAPTERS[name]);
1486
1494
  }
1487
1495
  });
1488
1496
  //#endregion
@@ -2562,7 +2570,10 @@ const migrate = new Command("migrate").description("a CLI for migrating Svelte(K
2562
2570
  strategy: "project-script-then-files-only"
2563
2571
  });
2564
2572
  const packageManager = verifiedOptions.install === false ? null : verifiedOptions.install === true ? await packageManagerPrompt(workspace.cwd) : verifiedOptions.install;
2565
- if (packageManager) await installDependencies(packageManager, workspace.cwd);
2573
+ if (packageManager) {
2574
+ const flags = packageManager === "npm" ? ["--legacy-peer-deps"] : [];
2575
+ await installDependencies(packageManager, workspace.cwd, flags);
2576
+ }
2566
2577
  reportNextSteps();
2567
2578
  });
2568
2579
  });
@@ -1339,7 +1339,7 @@ ${i ? styleText("cyan", x$1) : ""}
1339
1339
  //#endregion
1340
1340
  //#region package.json
1341
1341
  var name = "sv";
1342
- var version = "1.0.0-next.5";
1342
+ var version = "1.0.0-next.6";
1343
1343
  //#endregion
1344
1344
  //#region src/core/errors.ts
1345
1345
  var UnsupportedError = class extends Error {
@@ -9265,7 +9265,7 @@ async function packageManagerPrompt(cwd) {
9265
9265
  return pm;
9266
9266
  }
9267
9267
  /** Returns `false` when the package manager isn't installed and the install was skipped. */
9268
- async function installDependencies(agent, cwd) {
9268
+ async function installDependencies(agent, cwd, flags = []) {
9269
9269
  if (!isInstalled(agent)) {
9270
9270
  R.warn(`${color.command(agent)} is not installed, skipping dependency installation.`);
9271
9271
  return false;
@@ -9276,7 +9276,7 @@ async function installDependencies(agent, cwd) {
9276
9276
  spacing: 0,
9277
9277
  retainLog: true
9278
9278
  });
9279
- const { command, args } = constructCommand(COMMANDS[agent].install, []);
9279
+ const { command, args } = constructCommand(COMMANDS[agent].install, flags);
9280
9280
  const proc = exec$1(command, args, {
9281
9281
  nodeOptions: {
9282
9282
  cwd,
@@ -9459,14 +9459,13 @@ function parseKitOptions(cwd) {
9459
9459
  //#region src/core/formatFiles.ts
9460
9460
  async function formatFiles(options) {
9461
9461
  if (options.filesToFormat.length === 0) return;
9462
- if (options.strategy === "project-script-then-files-only") {
9463
- const script = findFormatScript(options.cwd);
9464
- if (script) {
9465
- const packageManager = await detectPackageManager(script.dir);
9466
- const cmd = resolveCommand(packageManager, "run", [script.name]);
9467
- await withSpinner(`Running ${packageManager} run ${script.name}`, () => run(cmd.command, cmd.args, script.dir));
9468
- return;
9469
- }
9462
+ const action = resolveFormatAction(options.cwd, options.strategy);
9463
+ if (action.kind === "skip") return;
9464
+ if (action.kind === "script") {
9465
+ const packageManager = await detectPackageManager(action.dir);
9466
+ const cmd = resolveCommand(packageManager, "run", [action.name]);
9467
+ await withSpinner(`Running ${packageManager} run ${action.name}`, () => run(cmd.command, cmd.args, action.dir));
9468
+ return;
9470
9469
  }
9471
9470
  const args = [
9472
9471
  "--write",
@@ -9483,16 +9482,25 @@ async function formatFiles(options) {
9483
9482
  });
9484
9483
  }
9485
9484
  /**
9486
- * Whether `prettier` resolves from `cwd`, walking up `node_modules` the same way the spawned
9487
- * binary does - so formatting can be skipped instead of failing when deps were never installed.
9485
+ * Checks if a format script is available (`format`/`fmt`). If not, run `prettier`
9486
+ * if it's resolvable from `cwd`. Otherwise, skip altogether if no formatter is detectable.
9488
9487
  */
9489
- function isFormatterInstalled(cwd) {
9490
- try {
9491
- createRequire(path.join(cwd, "index.js")).resolve("prettier/package.json");
9492
- return true;
9493
- } catch {
9494
- return false;
9488
+ function resolveFormatAction(cwd, strategy) {
9489
+ if (strategy === "project-script-then-files-only") {
9490
+ const script = findFormatScript(cwd);
9491
+ if (script) return {
9492
+ kind: "script",
9493
+ ...script
9494
+ };
9495
9495
  }
9496
+ if (isPrettierInstalled(cwd)) return { kind: "prettier" };
9497
+ return { kind: "skip" };
9498
+ }
9499
+ /**
9500
+ * Whether `prettier` resolves from `cwd` via Node's module resolution.
9501
+ */
9502
+ function isPrettierInstalled(cwd) {
9503
+ return Boolean(from(cwd, "prettier", true));
9496
9504
  }
9497
9505
  /** Nearest dir from `cwd` up to the workspace root with a `format` or `fmt` package.json script. */
9498
9506
  function findFormatScript(cwd) {
@@ -9537,8 +9545,8 @@ async function run(command, args, cwd) {
9537
9545
  });
9538
9546
  return {};
9539
9547
  } catch (e) {
9540
- if (e instanceof Error && "code" in e && e.code === "ENOENT") {
9541
- if ("code" in e && e.code === "ENOENT") return { error: `${command} not found` };
9548
+ if (e instanceof Error && "code" in e) {
9549
+ if (e.code === "ENOENT") return { error: `${command} not found` };
9542
9550
  return { error: e.message };
9543
9551
  }
9544
9552
  return { error: "unknown error" };
@@ -10494,7 +10502,7 @@ async function runAddonsApply({ answers, options, loadedAddons, setupResults, wo
10494
10502
  workspace.packageManager = packageManager;
10495
10503
  depsInstalled = await installDependencies(packageManager, options.cwd);
10496
10504
  }
10497
- if (depsInstalled || isFormatterInstalled(options.cwd)) await formatFiles({
10505
+ if (depsInstalled || isPrettierInstalled(options.cwd)) await formatFiles({
10498
10506
  packageManager: packageManager ?? workspace.packageManager,
10499
10507
  cwd: options.cwd,
10500
10508
  filesToFormat,
@@ -1,2 +1,2 @@
1
- import { N as create, g as defineAddonOptions, h as defineAddon, m as officialAddons, t as add } from "../engine-DbmyuU8L.mjs";
1
+ import { N as create, g as defineAddonOptions, h as defineAddon, m as officialAddons, t as add } from "../engine-qp2yrGle.mjs";
2
2
  export { add, create, defineAddon, defineAddonOptions, officialAddons };
@@ -1,4 +1,4 @@
1
- import { M as x, N as create, Q as __toESM, X as __commonJSMin, Z as __require, j as exec$1, l as addPnpmAllowBuilds, t as add } from "../engine-DbmyuU8L.mjs";
1
+ import { M as x, N as create, Q as __toESM, X as __commonJSMin, Z as __require, j as exec$1, l as addPnpmAllowBuilds, t as add } from "../engine-qp2yrGle.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import V from "node:process";
@@ -22,10 +22,10 @@
22
22
  "access": "public"
23
23
  },
24
24
  "peerDependencies": {
25
- "sv": "^1.0.0-next.5"
25
+ "sv": "^1.0.0-next.6"
26
26
  },
27
27
  "devDependencies": {
28
- "sv": "^1.0.0-next.5",
28
+ "sv": "^1.0.0-next.6",
29
29
  "@sveltejs/sv-utils": "^1.0.0-next.4",
30
30
  "@playwright/test": "^1.60.0",
31
31
  "@types/node": "^25.9.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "1.0.0-next.5",
3
+ "version": "1.0.0-next.6",
4
4
  "description": "A command line interface (CLI) for creating and maintaining Svelte applications",
5
5
  "keywords": [
6
6
  "create",