sv 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { AGENT_NAMES, Command, De, Fe, Ge, J, Ke, Option, T, Ue, Vu, We, __toESM, addPnpmBuildDependencies, create as create$1, detect, dist, et, from, getUserAgent, installDependencies, installOption, isVersionUnsupportedBelow, ke, packageManagerPrompt, parseJson, parseScript, parseSvelte, program, require_picocolors, resolveCommand, templates, up as up$1, ze } from "./create-CdiXN6U7.js";
3
- import { addDefault, applyAddons, communityAddonIds, create as create$2, createDefault, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, officialAddons, overrideProperties, setupAddons } from "./install-CA9o73JK.js";
2
+ import { B as We, F as Ge, H as ke, I as J, J as require_picocolors, K as up$1, L as Ke, N as De, O as isVersionUnsupportedBelow, P as Fe, R as T, U as ze, V as et, W as Vu, X as Option, Y as Command, Z as program, _ as parseScript, a as addPnpmBuildDependencies, c as installOption, et as __toESM, f as detect, g as parseJson, i as AGENT_NAMES, l as packageManagerPrompt, n as templates, o as getUserAgent, p as resolveCommand, q as from, r as dist, s as installDependencies, t as create$1, v as parseSvelte, z as Ue } from "./create-Bt2-1pFJ.js";
3
+ import { a as formatFiles, c as getCommunityAddon, d as createDefault, f as addDefault, i as createWorkspace, l as getAddonDetails, m as overrideProperties, o as getHighlighter, p as create$2, r as setupAddons, s as communityAddonIds, t as applyAddons, u as officialAddons } from "./install-Dy7mZYPj.js";
4
4
  import { exec, execSync } from "node:child_process";
5
5
  import path, { dirname, join } from "node:path";
6
6
  import fs, { existsSync } from "node:fs";
@@ -12,74 +12,7 @@ import { pipeline } from "node:stream/promises";
12
12
 
13
13
  //#region package.json
14
14
  var name = "sv";
15
- var version = "0.9.11";
16
- var type = "module";
17
- var description = "A CLI for creating and updating SvelteKit projects";
18
- var license = "MIT";
19
- var repository = {
20
- "type": "git",
21
- "url": "git+https://github.com/sveltejs/cli.git",
22
- "directory": "packages/cli"
23
- };
24
- var homepage = "https://svelte.dev";
25
- var scripts = {
26
- "check": "tsc",
27
- "format": "pnpm lint --write",
28
- "lint": "prettier --check . --config ../../prettier.config.js --ignore-path ../../.gitignore --ignore-path .gitignore --ignore-path ../../.prettierignore"
29
- };
30
- var files = ["dist"];
31
- var bin = "./dist/bin.js";
32
- var exports = {
33
- ".": {
34
- "types": "./dist/lib/index.d.ts",
35
- "default": "./dist/lib/index.js"
36
- },
37
- "./testing": {
38
- "types": "./dist/lib/testing.d.ts",
39
- "default": "./dist/lib/testing.js"
40
- }
41
- };
42
- var devDependencies = {
43
- "@clack/prompts": "1.0.0-alpha.1",
44
- "@sveltejs/addons": "workspace:*",
45
- "@sveltejs/cli-core": "workspace:*",
46
- "@sveltejs/create": "workspace:*",
47
- "@types/degit": "^2.8.6",
48
- "@types/ps-tree": "^1.1.6",
49
- "commander": "^13.1.0",
50
- "degit": "^2.8.4",
51
- "empathic": "^1.1.0",
52
- "package-manager-detector": "^0.2.11",
53
- "picocolors": "^1.1.1",
54
- "ps-tree": "^1.2.0",
55
- "tinyexec": "^0.3.2",
56
- "valibot": "^0.41.0"
57
- };
58
- var keywords = [
59
- "create",
60
- "new",
61
- "project",
62
- "starter",
63
- "svelte",
64
- "sveltekit",
65
- "template",
66
- "wizard"
67
- ];
68
- var package_default = {
69
- name,
70
- version,
71
- type,
72
- description,
73
- license,
74
- repository,
75
- homepage,
76
- scripts,
77
- files,
78
- bin,
79
- exports,
80
- devDependencies,
81
- keywords
82
- };
15
+ var version = "0.9.12";
83
16
 
84
17
  //#endregion
85
18
  //#region ../../node_modules/.pnpm/valibot@0.41.0_typescript@5.8.3/node_modules/valibot/dist/index.js
@@ -106,11 +39,11 @@ function getSpecificMessage(reference, lang) {
106
39
  return store4?.get(reference)?.get(lang);
107
40
  }
108
41
  function _stringify(input) {
109
- const type$1 = typeof input;
110
- if (type$1 === "string") return `"${input}"`;
111
- if (type$1 === "number" || type$1 === "bigint" || type$1 === "boolean") return `${input}`;
112
- if (type$1 === "object" || type$1 === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
113
- return type$1;
42
+ const type = typeof input;
43
+ if (type === "string") return `"${input}"`;
44
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
45
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
46
+ return type;
114
47
  }
115
48
  function _addIssue(context, label, dataset, config2, other) {
116
49
  const input = other && "input" in other ? other.input : dataset.value;
@@ -563,7 +496,7 @@ function formatDescription(arg) {
563
496
  }
564
497
  async function runCommand(action) {
565
498
  try {
566
- Ge(`Welcome to the Svelte CLI! ${import_picocolors$3.default.gray(`(v${package_default.version})`)}`);
499
+ Ge(`Welcome to the Svelte CLI! ${import_picocolors$3.default.gray(`(v${version})`)}`);
567
500
  const minimumVersion = "18.3.0";
568
501
  if (isVersionUnsupportedBelow(process.versions.node, minimumVersion)) 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.`);
569
502
  await action();
@@ -764,8 +697,8 @@ const add = new Command("add").description("applies specified add-ons into a pro
764
697
  formatHelp(cmd, helper) {
765
698
  const termWidth = helper.padWidth(cmd, helper);
766
699
  const helpWidth = helper.helpWidth ?? 80;
767
- function callFormatItem(term, description$1) {
768
- return helper.formatItem(term, termWidth, description$1, helper);
700
+ function callFormatItem(term, description) {
701
+ return helper.formatItem(term, termWidth, description, helper);
769
702
  }
770
703
  let output = [`${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`, ""];
771
704
  const commandDescription = helper.commandDescription(cmd);
@@ -779,8 +712,8 @@ const add = new Command("add").description("applies specified add-ons into a pro
779
712
  ""
780
713
  ]);
781
714
  const addonList = addonOptions.map((option) => {
782
- const description$1 = option.choices;
783
- return callFormatItem(helper.styleArgumentTerm(option.id), helper.styleArgumentDescription(description$1));
715
+ const description = option.choices;
716
+ return callFormatItem(helper.styleArgumentTerm(option.id), helper.styleArgumentDescription(description));
784
717
  });
785
718
  if (addonList.length > 0) output = output.concat([
786
719
  helper.styleTitle("Add-On Options:"),
@@ -836,8 +769,7 @@ const add = new Command("add").description("applies specified add-ons into a pro
836
769
  const selectedAddons = transformAliases(addonArgs);
837
770
  selectedAddons.forEach((addon) => options$1.addons[addon.id] = addon.options);
838
771
  runCommand(async () => {
839
- const selectedAddonIds = selectedAddons.map(({ id }) => id);
840
- const { nextSteps } = await runAddCommand(options$1, selectedAddonIds);
772
+ const { nextSteps } = await runAddCommand(options$1, selectedAddons.map(({ id }) => id));
841
773
  if (nextSteps.length > 0) Ke(nextSteps.join("\n"), "Next steps", { format: (line) => line });
842
774
  });
843
775
  });
@@ -859,9 +791,20 @@ async function runAddCommand(options$1, selectedAddonIds) {
859
791
  });
860
792
  official[addonId] ??= {};
861
793
  const optionEntries = Object.entries(details$1.options);
794
+ const specifiedOptionsObject = Object.fromEntries(specifiedOptions.map((option) => option.split(":", 2)));
862
795
  for (const option of specifiedOptions) {
863
796
  let [optionId, optionValue] = option.split(":", 2);
864
- const optionEntry = optionEntries.find(([id, question$1]) => id === optionId || question$1.group === optionId);
797
+ const optionEntry = optionEntries.find(([id, question$1]) => {
798
+ if (id === optionId) return true;
799
+ if (question$1.group === optionId) {
800
+ if (question$1.type === "select" || question$1.type === "multiselect") {
801
+ if (!question$1.options.some((opt) => opt.value === optionValue)) return false;
802
+ }
803
+ if (question$1.condition) return question$1.condition(specifiedOptionsObject);
804
+ return true;
805
+ }
806
+ return false;
807
+ });
865
808
  if (!optionEntry) {
866
809
  const { choices } = getOptionChoices(details$1);
867
810
  throw new Error(`Invalid '${addonId}' option: '${option}'\nAvailable options: ${choices.join(", ")}`);
@@ -920,10 +863,7 @@ async function runAddCommand(options$1, selectedAddonIds) {
920
863
  const paddingName = getPadding(pkgs.map(({ pkg }) => pkg.name));
921
864
  const paddingVersion = getPadding(pkgs.map(({ pkg }) => `(v${pkg.version})`));
922
865
  const packageInfos = pkgs.map(({ pkg, repo: _repo }) => {
923
- const name$1 = import_picocolors$2.default.yellowBright(pkg.name.padEnd(paddingName));
924
- const version$1 = import_picocolors$2.default.dim(`(v${pkg.version})`.padEnd(paddingVersion));
925
- const repo = import_picocolors$2.default.dim(`(${_repo})`);
926
- return `${name$1} ${version$1} ${repo}`;
866
+ return `${import_picocolors$2.default.yellowBright(pkg.name.padEnd(paddingName))} ${import_picocolors$2.default.dim(`(v${pkg.version})`.padEnd(paddingVersion))} ${import_picocolors$2.default.dim(`(${_repo})`)}`;
927
867
  });
928
868
  T.message(packageInfos.join("\n"));
929
869
  if (await ke({ message: "Would you like to continue?" }) !== true) {
@@ -950,10 +890,10 @@ async function runAddCommand(options$1, selectedAddonIds) {
950
890
  let workspace = await createWorkspace({ cwd: options$1.cwd });
951
891
  if (selectedAddons.length === 0) {
952
892
  const allSetupResults = setupAddons(officialAddons$1, workspace);
953
- const addonOptions$1 = officialAddons$1.filter(({ id }) => allSetupResults[id].unsupported.length === 0).map(({ id, homepage: homepage$1, shortDescription }) => ({
893
+ const addonOptions$1 = officialAddons$1.filter(({ id }) => allSetupResults[id].unsupported.length === 0).map(({ id, homepage, shortDescription }) => ({
954
894
  label: id,
955
895
  value: id,
956
- hint: `${shortDescription} - ${homepage$1}`
896
+ hint: `${shortDescription} - ${homepage}`
957
897
  }));
958
898
  const selected = await Ue({
959
899
  message: `What would you like to add to your project? ${import_picocolors$2.default.dim("(use arrow keys / space bar)")}`,
@@ -974,8 +914,7 @@ async function runAddCommand(options$1, selectedAddonIds) {
974
914
  }
975
915
  for (const { addon } of selectedAddons) {
976
916
  workspace = await createWorkspace(workspace);
977
- const setups = selectedAddons.map(({ addon: addon$1 }) => addon$1);
978
- const missingDependencies = setupAddons(setups, workspace)[addon.id].dependsOn.filter((depId) => !selectedAddons.some((a) => a.addon.id === depId));
917
+ const missingDependencies = setupAddons(selectedAddons.map(({ addon: addon$1 }) => addon$1), workspace)[addon.id].dependsOn.filter((depId) => !selectedAddons.some((a) => a.addon.id === depId));
979
918
  for (const depId of missingDependencies) {
980
919
  const dependency = getAddonDetails(depId);
981
920
  if (!dependency) throw new Error(`'${addon.id}' depends on an invalid add-on: '${depId}'`);
@@ -1012,15 +951,15 @@ async function runAddCommand(options$1, selectedAddonIds) {
1012
951
  process.exit(1);
1013
952
  }
1014
953
  }
1015
- for (const { addon, type: type$1 } of selectedAddons) {
954
+ for (const { addon, type } of selectedAddons) {
1016
955
  const addonId = addon.id;
1017
956
  const questionPrefix = selectedAddons.length > 1 ? `${addon.id}: ` : "";
1018
957
  let values = {};
1019
- if (type$1 === "official") {
958
+ if (type === "official") {
1020
959
  official[addonId] ??= {};
1021
960
  values = official[addonId];
1022
961
  }
1023
- if (type$1 === "community") {
962
+ if (type === "community") {
1024
963
  community[addonId] ??= {};
1025
964
  values = community[addonId];
1026
965
  }
@@ -1221,22 +1160,20 @@ function validatePlaygroundUrl(link) {
1221
1160
  function parsePlaygroundUrl(link) {
1222
1161
  const url = new URL(link);
1223
1162
  const [, playgroundId] = url.pathname.match(/\/playground\/([^/]+)/) || [];
1224
- const hash = url.hash !== "" ? url.hash.slice(1) : void 0;
1225
- const svelteVersion = url.searchParams.get("version") || void 0;
1226
1163
  return {
1227
1164
  playgroundId,
1228
- hash,
1229
- svelteVersion
1165
+ hash: url.hash !== "" ? url.hash.slice(1) : void 0,
1166
+ svelteVersion: url.searchParams.get("version") || void 0
1230
1167
  };
1231
1168
  }
1232
1169
  async function downloadPlaygroundData({ playgroundId, hash, svelteVersion }) {
1233
1170
  let data = [];
1234
1171
  if (hash) data = JSON.parse(await decodeAndDecompressText(hash));
1235
1172
  else data = await (await fetch(`https://svelte.dev/playground/api/${playgroundId}.json`)).json();
1236
- const files$1 = data.components !== void 0 ? data.components : data.files;
1173
+ const files = data.components !== void 0 ? data.components : data.files;
1237
1174
  return {
1238
1175
  name: data.name,
1239
- files: files$1.map((file) => {
1176
+ files: files.map((file) => {
1240
1177
  return {
1241
1178
  name: file.name + (file.type !== "file" ? `.${file.type}` : ""),
1242
1179
  content: file.source || file.contents
@@ -1255,7 +1192,7 @@ async function decodeAndDecompressText(input) {
1255
1192
  /**
1256
1193
  * @returns A Map of packages with it's name as the key, and it's version as the value.
1257
1194
  */
1258
- function detectPlaygroundDependencies(files$1) {
1195
+ function detectPlaygroundDependencies(files) {
1259
1196
  const packages = /* @__PURE__ */ new Map();
1260
1197
  const excludedPrefixes = [
1261
1198
  "$",
@@ -1263,7 +1200,7 @@ function detectPlaygroundDependencies(files$1) {
1263
1200
  "svelte",
1264
1201
  "@sveltejs/"
1265
1202
  ];
1266
- for (const file of files$1) {
1203
+ for (const file of files) {
1267
1204
  let ast;
1268
1205
  if (file.name.endsWith(".svelte")) ast = parseSvelte(file.content).script.ast;
1269
1206
  else if (file.name.endsWith(".js") || file.name.endsWith(".ts")) ast = parseScript(file.content).ast;
@@ -1309,8 +1246,8 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies$1, typ
1309
1246
  }
1310
1247
  {
1311
1248
  const shared = dist("shared.json");
1312
- const { files: files$1 } = JSON.parse(fs.readFileSync(shared, "utf-8"));
1313
- const playgroundFiles = files$1.filter((file) => file.include.includes("playground"));
1249
+ const { files } = JSON.parse(fs.readFileSync(shared, "utf-8"));
1250
+ const playgroundFiles = files.filter((file) => file.include.includes("playground"));
1314
1251
  for (const file of playgroundFiles) {
1315
1252
  let contentToWrite = file.contents;
1316
1253
  if (file.name === "src/lib/PlaygroundLayout.svelte") {
@@ -1326,8 +1263,7 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies$1, typ
1326
1263
  }
1327
1264
  }
1328
1265
  const filePath = path.join(cwd, "src/routes/+page.svelte");
1329
- const content = fs.readFileSync(filePath, "utf-8");
1330
- const { script, generateCode } = parseSvelte(content, { typescript });
1266
+ const { script, generateCode } = parseSvelte(fs.readFileSync(filePath, "utf-8"), { typescript });
1331
1267
  addDefault(script.ast, {
1332
1268
  as: "App",
1333
1269
  from: `$lib/playground/${mainFile.name}`
@@ -1344,8 +1280,7 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies$1, typ
1344
1280
  });
1345
1281
  fs.writeFileSync(filePath, newContent, "utf-8");
1346
1282
  const pkgPath = path.join(cwd, "package.json");
1347
- const pkgSource = fs.readFileSync(pkgPath, "utf-8");
1348
- const pkgJson = parseJson(pkgSource);
1283
+ const pkgJson = parseJson(fs.readFileSync(pkgPath, "utf-8"));
1349
1284
  let updatePackageJson = false;
1350
1285
  if (installDependencies$1 && dependencies.size >= 0) {
1351
1286
  updatePackageJson = true;
@@ -1355,8 +1290,7 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies$1, typ
1355
1290
  let experimentalAsyncNeeded = true;
1356
1291
  const addExperimentalAsync = () => {
1357
1292
  const svelteConfigPath = path.join(cwd, "svelte.config.js");
1358
- const svelteConfig = fs.readFileSync(svelteConfigPath, "utf-8");
1359
- const { ast, generateCode: generateCode$1 } = parseScript(svelteConfig);
1293
+ const { ast, generateCode: generateCode$1 } = parseScript(fs.readFileSync(svelteConfigPath, "utf-8"));
1360
1294
  const { value: config } = createDefault(ast, { fallback: create$2({}) });
1361
1295
  overrideProperties(config, { compilerOptions: { experimental: { async: true } } });
1362
1296
  fs.writeFileSync(svelteConfigPath, generateCode$1(), "utf-8");
@@ -1531,11 +1465,9 @@ async function createProject(cwd, options$1) {
1531
1465
  };
1532
1466
  }
1533
1467
  async function createProjectFromPlayground(url, cwd, typescript) {
1534
- const urlData = parsePlaygroundUrl(url);
1535
- const playground = await downloadPlaygroundData(urlData);
1468
+ const playground = await downloadPlaygroundData(parsePlaygroundUrl(url));
1536
1469
  const dependencies = detectPlaygroundDependencies(playground.files);
1537
- const installDependencies$1 = await confirmExternalDependencies(Array.from(dependencies.keys()));
1538
- setupPlaygroundProject(url, playground, cwd, installDependencies$1, typescript);
1470
+ setupPlaygroundProject(url, playground, cwd, await confirmExternalDependencies(Array.from(dependencies.keys())), typescript);
1539
1471
  }
1540
1472
  async function confirmExternalDependencies(dependencies) {
1541
1473
  if (dependencies.length === 0) return false;
@@ -1604,7 +1536,7 @@ function runCheck(cwd, args) {
1604
1536
  //#endregion
1605
1537
  //#region bin.ts
1606
1538
  console.log();
1607
- program.name(package_default.name).version(package_default.version, "-v, --version").configureHelp(helpConfig);
1539
+ program.name(name).version(version, "-v, --version").configureHelp(helpConfig);
1608
1540
  program.addCommand(create).addCommand(add).addCommand(migrate).addCommand(check);
1609
1541
  program.parse();
1610
1542
 
@@ -1569,12 +1569,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1569
1569
  this.setOptionValueWithSource(name, val, valueSource);
1570
1570
  };
1571
1571
  this.on("option:" + oname, (val) => {
1572
- const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
1573
- handleOptionValue(val, invalidValueMessage, "cli");
1572
+ handleOptionValue(val, `error: option '${option.flags}' argument '${val}' is invalid.`, "cli");
1574
1573
  });
1575
1574
  if (option.envVar) this.on("optionEnv:" + oname, (val) => {
1576
- const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
1577
- handleOptionValue(val, invalidValueMessage, "env");
1575
+ handleOptionValue(val, `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`, "env");
1578
1576
  });
1579
1577
  return this;
1580
1578
  }
@@ -1914,11 +1912,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1914
1912
  */
1915
1913
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
1916
1914
  if (fs$1.existsSync(executableFile)) return;
1917
- const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
1918
1915
  const executableMissing = `'${executableFile}' does not exist
1919
1916
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
1920
1917
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1921
- - ${executableDirMessage}`;
1918
+ - ${executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory"}`;
1922
1919
  throw new Error(executableMissing);
1923
1920
  }
1924
1921
  /**
@@ -3039,8 +3036,7 @@ function absolute(input, root$1) {
3039
3036
  }
3040
3037
  function from(root$1, ident, silent) {
3041
3038
  try {
3042
- let r = root$1 instanceof URL || root$1.startsWith("file://") ? join(fileURLToPath(root$1), "noop.js") : join(absolute(root$1), "noop.js");
3043
- return createRequire(r).resolve(ident);
3039
+ return createRequire(root$1 instanceof URL || root$1.startsWith("file://") ? join(fileURLToPath(root$1), "noop.js") : join(absolute(root$1), "noop.js")).resolve(ident);
3044
3040
  } catch (err) {
3045
3041
  if (!silent) throw err;
3046
3042
  }
@@ -4302,11 +4298,11 @@ ${import_picocolors$2.default.cyan(f)}
4302
4298
  try {
4303
4299
  let s;
4304
4300
  return existsSync(r) ? lstatSync(r).isDirectory() ? s = r : s = dirname(r) : s = dirname(r), readdirSync(s).map((n$1) => {
4305
- const a = join(s, n$1), l$2 = lstatSync(a);
4301
+ const a = join(s, n$1);
4306
4302
  return {
4307
4303
  name: n$1,
4308
4304
  path: a,
4309
- isDirectory: l$2.isDirectory()
4305
+ isDirectory: lstatSync(a).isDirectory()
4310
4306
  };
4311
4307
  }).filter(({ path: n$1, isDirectory: a }) => n$1.startsWith(r) && (t.directory || !a)).map((n$1) => ({ value: n$1.path }));
4312
4308
  } catch {
@@ -4571,11 +4567,10 @@ function defineAddonOptions() {
4571
4567
  function createOptionBuilder(options) {
4572
4568
  return {
4573
4569
  add(key, question) {
4574
- const newOptions = {
4570
+ return createOptionBuilder({
4575
4571
  ...options,
4576
4572
  [key]: question
4577
- };
4578
- return createOptionBuilder(newOptions);
4573
+ });
4579
4574
  },
4580
4575
  build() {
4581
4576
  return options;
@@ -5229,8 +5224,7 @@ var DomHandler = class {
5229
5224
  if (this.elementCB) this.elementCB(elem);
5230
5225
  }
5231
5226
  onopentag(name, attribs) {
5232
- const type = this.options.xmlMode ? ElementType.Tag : void 0;
5233
- const element = new Element(name, attribs, void 0, type);
5227
+ const element = new Element(name, attribs, void 0, this.options.xmlMode ? ElementType.Tag : void 0);
5234
5228
  this.addNode(element);
5235
5229
  this.tagStack.push(element);
5236
5230
  }
@@ -6985,6 +6979,12 @@ const attributeNames = new Map([
6985
6979
 
6986
6980
  //#endregion
6987
6981
  //#region ../../node_modules/.pnpm/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/index.js
6982
+ /**
6983
+ * Mixed-case SVG and MathML tags & attributes
6984
+ * recognized by the HTML parser.
6985
+ *
6986
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
6987
+ */
6988
6988
  const unencodedElements = new Set([
6989
6989
  "style",
6990
6990
  "script",
@@ -10327,9 +10327,7 @@ var require_source_node = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
10327
10327
  var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
10328
10328
  var remainingLinesIndex = 0;
10329
10329
  var shiftNextLine = function() {
10330
- var lineContents = getNextLine();
10331
- var newLine = getNextLine() || "";
10332
- return lineContents + newLine;
10330
+ return getNextLine() + (getNextLine() || "");
10333
10331
  function getNextLine() {
10334
10332
  return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
10335
10333
  }
@@ -11744,8 +11742,7 @@ var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postc
11744
11742
  let Input$2 = require_input();
11745
11743
  let Parser$2 = require_parser$1();
11746
11744
  function parse$6(css, opts) {
11747
- let input = new Input$2(css, opts);
11748
- let parser$2 = new Parser$2(input);
11745
+ let parser$2 = new Parser$2(new Input$2(css, opts));
11749
11746
  try {
11750
11747
  parser$2.parse();
11751
11748
  } catch (e$1) {
@@ -12139,10 +12136,7 @@ var require_lazy_result = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
12139
12136
  if (this.processed) return this.result;
12140
12137
  this.processed = true;
12141
12138
  if (this.processing) throw this.getAsyncError();
12142
- for (let plugin$1 of this.plugins) {
12143
- let promise = this.runOnRoot(plugin$1);
12144
- if (isPromise(promise)) throw this.getAsyncError();
12145
- }
12139
+ for (let plugin$1 of this.plugins) if (isPromise(this.runOnRoot(plugin$1))) throw this.getAsyncError();
12146
12140
  this.prepareVisitors();
12147
12141
  if (this.hasListener) {
12148
12142
  let root$1 = this.result.root;
@@ -12795,8 +12789,7 @@ var require_silver_fleece_umd = /* @__PURE__ */ __commonJS({ "../../node_modules
12795
12789
  return Parser$6;
12796
12790
  }();
12797
12791
  function evaluate(str, opts) {
12798
- var ast = parse$8(str, opts);
12799
- return getValue(ast);
12792
+ return getValue(parse$8(str, opts));
12800
12793
  }
12801
12794
  function getValue(node) {
12802
12795
  if (node.type === "Literal") return node.value;
@@ -12810,8 +12803,7 @@ var require_silver_fleece_umd = /* @__PURE__ */ __commonJS({ "../../node_modules
12810
12803
  }
12811
12804
  }
12812
12805
  function stringify$13(value, options) {
12813
- var indentString = options && options.spaces ? spaces(options.spaces) : " ";
12814
- return stringifyValue(value, "\n", indentString, true);
12806
+ return stringifyValue(value, "\n", options && options.spaces ? spaces(options.spaces) : " ", true);
12815
12807
  }
12816
12808
  function stringifyProperty(key, value, indentation, indentString, newlines) {
12817
12809
  return JSON.stringify(key) + ": " + stringifyValue(value, indentation, indentString, newlines);
@@ -14187,6 +14179,8 @@ function encode(decoded) {
14187
14179
 
14188
14180
  //#endregion
14189
14181
  //#region ../../node_modules/.pnpm/esrap@1.4.9/node_modules/esrap/src/index.js
14182
+ /** @import { TSESTree } from '@typescript-eslint/types' */
14183
+ /** @import { Command, PrintOptions, State } from './types' */
14190
14184
  /** @type {(str: string) => string} str */
14191
14185
  let btoa$2 = () => {
14192
14186
  throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
@@ -20740,8 +20734,7 @@ function tsPlugin(options) {
20740
20734
  return this.type === acornTypeScript.tokTypes[type];
20741
20735
  }
20742
20736
  ts_eatWithState(type, nextCount, state) {
20743
- const targetType = state.type;
20744
- if (type === targetType) {
20737
+ if (type === state.type) {
20745
20738
  for (let i$1 = 0; i$1 < nextCount; i$1++) this.next();
20746
20739
  return true;
20747
20740
  } else return false;
@@ -24808,9 +24801,7 @@ var require_Pair = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/yaml@2
24808
24801
  var addPairToJSMap$1 = require_addPairToJSMap();
24809
24802
  var identity$20 = require_identity();
24810
24803
  function createPair(key, value, ctx) {
24811
- const k$2 = createNode$2.createNode(key, void 0, ctx);
24812
- const v$2 = createNode$2.createNode(value, void 0, ctx);
24813
- return new Pair$7(k$2, v$2);
24804
+ return new Pair$7(createNode$2.createNode(key, void 0, ctx), createNode$2.createNode(value, void 0, ctx));
24814
24805
  }
24815
24806
  var Pair$7 = class Pair$7 {
24816
24807
  constructor(key, value = null) {
@@ -25251,8 +25242,7 @@ var require_bool$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/yaml
25251
25242
  resolve: (str) => new Scalar$11.Scalar(str[0] === "t" || str[0] === "T"),
25252
25243
  stringify({ source, value }, ctx) {
25253
25244
  if (source && boolTag.test.test(source)) {
25254
- const sv = source[0] === "t" || source[0] === "T";
25255
- if (value === sv) return source;
25245
+ if (value === (source[0] === "t" || source[0] === "T")) return source;
25256
25246
  }
25257
25247
  return value ? ctx.options.trueStr : ctx.options.falseStr;
25258
25248
  }
@@ -27180,8 +27170,7 @@ var require_resolve_block_scalar = /* @__PURE__ */ __commonJS({ "../../node_modu
27180
27170
  length += token.source.length;
27181
27171
  break;
27182
27172
  default: {
27183
- const message = `Unexpected token in block scalar header: ${token.type}`;
27184
- onError(token, "UNEXPECTED_TOKEN", message);
27173
+ onError(token, "UNEXPECTED_TOKEN", `Unexpected token in block scalar header: ${token.type}`);
27185
27174
  const ts = token.source;
27186
27175
  if (ts && typeof ts === "string") length += ts.length;
27187
27176
  }
@@ -27467,12 +27456,7 @@ var require_compose_scalar = /* @__PURE__ */ __commonJS({ "../../node_modules/.p
27467
27456
  const tag = schema$6.tags.find((tag$1) => (tag$1.default === true || atKey && tag$1.default === "key") && tag$1.test?.test(value)) || schema$6[identity$5.SCALAR];
27468
27457
  if (schema$6.compat) {
27469
27458
  const compat = schema$6.compat.find((tag$1) => tag$1.default && tag$1.test?.test(value)) ?? schema$6[identity$5.SCALAR];
27470
- if (tag.tag !== compat.tag) {
27471
- const ts = directives$2.tagString(tag.tag);
27472
- const cs = directives$2.tagString(compat.tag);
27473
- const msg = `Value may be parsed as either ${ts} or ${cs}`;
27474
- onError(token, "TAG_RESOLVE_FAILED", msg, true);
27475
- }
27459
+ if (tag.tag !== compat.tag) onError(token, "TAG_RESOLVE_FAILED", `Value may be parsed as either ${directives$2.tagString(tag.tag)} or ${directives$2.tagString(compat.tag)}`, true);
27476
27460
  }
27477
27461
  return tag;
27478
27462
  }
@@ -27543,12 +27527,10 @@ var require_compose_node = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
27543
27527
  node = composeCollection.composeCollection(CN, ctx, token, props, onError);
27544
27528
  if (anchor) node.anchor = anchor.source.substring(1);
27545
27529
  break;
27546
- default: {
27547
- const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
27548
- onError(token, "UNEXPECTED_TOKEN", message);
27530
+ default:
27531
+ onError(token, "UNEXPECTED_TOKEN", token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`);
27549
27532
  node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError);
27550
27533
  isSrcToken = false;
27551
- }
27552
27534
  }
27553
27535
  if (anchor && node.anchor === "") onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
27554
27536
  if (atKey && ctx.options.stringKeys && (!identity$4.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) onError(tag ?? token, "NON_STRING_KEY", "With stringKeys, all keys must be strings");
@@ -29262,8 +29244,7 @@ var require_parser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/yaml
29262
29244
  }
29263
29245
  *scalar(scalar) {
29264
29246
  if (this.type === "map-value-ind") {
29265
- const prev = getPrevProps(this.peek(2));
29266
- const start = getFirstKeyStartProps(prev);
29247
+ const start = getFirstKeyStartProps(getPrevProps(this.peek(2)));
29267
29248
  let sep$1;
29268
29249
  if (scalar.end) {
29269
29250
  sep$1 = scalar.end;
@@ -29628,8 +29609,7 @@ var require_parser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/yaml
29628
29609
  yield* this.pop();
29629
29610
  yield* this.step();
29630
29611
  } else if (this.type === "map-value-ind" && parent.type !== "flow-collection") {
29631
- const prev = getPrevProps(parent);
29632
- const start = getFirstKeyStartProps(prev);
29612
+ const start = getFirstKeyStartProps(getPrevProps(parent));
29633
29613
  fixFlowSeqItems(fc);
29634
29614
  const sep$1 = fc.end.splice(1, fc.end.length);
29635
29615
  sep$1.push(this.sourceToken);
@@ -29693,8 +29673,7 @@ var require_parser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/yaml
29693
29673
  };
29694
29674
  case "explicit-key-ind": {
29695
29675
  this.onKeyLine = true;
29696
- const prev = getPrevProps(parent);
29697
- const start = getFirstKeyStartProps(prev);
29676
+ const start = getFirstKeyStartProps(getPrevProps(parent));
29698
29677
  start.push(this.sourceToken);
29699
29678
  return {
29700
29679
  type: "block-map",
@@ -29708,8 +29687,7 @@ var require_parser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/yaml
29708
29687
  }
29709
29688
  case "map-value-ind": {
29710
29689
  this.onKeyLine = true;
29711
- const prev = getPrevProps(parent);
29712
- const start = getFirstKeyStartProps(prev);
29690
+ const start = getFirstKeyStartProps(getPrevProps(parent));
29713
29691
  return {
29714
29692
  type: "block-map",
29715
29693
  offset: this.offset,
@@ -30251,10 +30229,9 @@ function getLocator(source) {
30251
30229
  else i$1 = m$1 + 1;
30252
30230
  }
30253
30231
  const line = i$1 - 1;
30254
- const column = index - lineOffsets[line];
30255
30232
  return {
30256
30233
  line,
30257
- column
30234
+ column: index - lineOffsets[line]
30258
30235
  };
30259
30236
  };
30260
30237
  }
@@ -31039,9 +31016,7 @@ function parseSvelte(source, options) {
31039
31016
  const generateCode = (code) => {
31040
31017
  const ms = new MagicString(source);
31041
31018
  if (code.script !== void 0) if (scriptSource.length === 0) {
31042
- const ts = options?.typescript ? " lang=\"ts\"" : "";
31043
- const indented = code.script.split("\n").join("\n ");
31044
- const script$1 = `<script${ts}>\n\t${indented}\n<\/script>\n\n`;
31019
+ const script$1 = `<script${options?.typescript ? " lang=\"ts\"" : ""}>\n\t${code.script.split("\n").join("\n ")}\n<\/script>\n\n`;
31045
31020
  ms.prepend(script$1);
31046
31021
  } else {
31047
31022
  const { start, end } = locations(source, scriptSource);
@@ -31049,9 +31024,7 @@ function parseSvelte(source, options) {
31049
31024
  ms.update(start, end, formatted);
31050
31025
  }
31051
31026
  if (code.module !== void 0) if (moduleSource.length === 0) {
31052
- const ts = options?.typescript ? " lang=\"ts\"" : "";
31053
- const indented = code.module.split("\n").join("\n ");
31054
- const module$2 = `<script${ts} context="module">\n\t${indented}\n<\/script>\n\n`;
31027
+ const module$2 = `<script${options?.typescript ? " lang=\"ts\"" : ""} context="module">\n\t${code.module.split("\n").join("\n ")}\n<\/script>\n\n`;
31055
31028
  ms.prepend(module$2);
31056
31029
  } else {
31057
31030
  const { start, end } = locations(source, moduleSource);
@@ -31095,10 +31068,9 @@ function parseSvelte(source, options) {
31095
31068
  }
31096
31069
  function locations(source, search) {
31097
31070
  const start = source.indexOf(search);
31098
- const end = start + search.length;
31099
31071
  return {
31100
31072
  start,
31101
- end
31073
+ end: start + search.length
31102
31074
  };
31103
31075
  }
31104
31076
  function indent(content, indent$2) {
@@ -31812,8 +31784,8 @@ var et = l((Re, tt) => {
31812
31784
  typeof e$1 == "function" && (n$1 = e$1, e$1 = {}), e$1 || (e$1 = {});
31813
31785
  let { pathEnv: r, pathExt: s, pathExtExe: o$1 } = Q$1(t, e$1), i$1 = [], a = (u) => new Promise((f$2, p$2) => {
31814
31786
  if (u === r.length) return e$1.all && i$1.length ? f$2(i$1) : p$2(J$2(t));
31815
- let d$1 = r[u], w$1 = /^".*"$/.test(d$1) ? d$1.slice(1, -1) : d$1, m$1 = Y$1.join(w$1, t), b$1 = !w$1 && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m$1 : m$1;
31816
- f$2(c$2(b$1, u, 0));
31787
+ let d$1 = r[u], w$1 = /^".*"$/.test(d$1) ? d$1.slice(1, -1) : d$1, m$1 = Y$1.join(w$1, t);
31788
+ f$2(c$2(!w$1 && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m$1 : m$1, u, 0));
31817
31789
  }), c$2 = (u, f$2, p$2) => new Promise((d$1, w$1) => {
31818
31790
  if (p$2 === s.length) return d$1(a(f$2 + 1));
31819
31791
  let m$1 = s[p$2];
@@ -32346,10 +32318,8 @@ function write_common_files(cwd$1, options, name) {
32346
32318
  sort_files(files).forEach((file) => {
32347
32319
  const include = file.include.every((condition) => matches_condition(condition, options));
32348
32320
  if (file.exclude.some((condition) => matches_condition(condition, options)) || !include) return;
32349
- if (file.name === "package.json") {
32350
- const new_pkg = JSON.parse(file.contents);
32351
- merge(pkg, new_pkg);
32352
- } else {
32321
+ if (file.name === "package.json") merge(pkg, JSON.parse(file.contents));
32322
+ else {
32353
32323
  const dest = path.join(cwd$1, file.name);
32354
32324
  mkdirp(path.dirname(dest));
32355
32325
  fs.writeFileSync(dest, file.contents);
@@ -32398,4 +32368,4 @@ function to_valid_package_name(name) {
32398
32368
  }
32399
32369
 
32400
32370
  //#endregion
32401
- export { AGENT_NAMES, Command, De, Element, Fe, Ge, J, Ke, MagicString, Option, T, Tag, Ue, Vu, We, __commonJS, __require, __toESM, addPnpmBuildDependencies, any, be, create, createPrinter, dedent_default, defineAddon, defineAddonOptions, detect, dist, et$1 as et, from, getUserAgent, import_picocolors, installDependencies, installOption, isVersionUnsupportedBelow, ke, packageManagerPrompt, parseCss, parseHtml, parseHtml$1, parseJson, parseScript, parseScript$1, parseSvelte, program, require_picocolors, resolveCommand, serializeScript, stripAst, templates, up, ve, walk, ze };
32371
+ export { __require as $, dedent_default as A, We as B, serializeScript as C, walk as D, Tag as E, Ge as F, any as G, ke as H, J as I, require_picocolors as J, up as K, Ke as L, defineAddonOptions as M, De as N, isVersionUnsupportedBelow as O, Fe as P, __commonJS as Q, T as R, parseScript$1 as S, Element as T, ze as U, et$1 as V, Vu as W, Option as X, Command as Y, program as Z, parseScript as _, addPnpmBuildDependencies as a, import_picocolors as b, installOption as c, ve as d, __toESM as et, detect as f, parseJson as g, parseHtml as h, AGENT_NAMES as i, defineAddon as j, createPrinter as k, packageManagerPrompt as l, parseCss as m, templates as n, getUserAgent as o, resolveCommand as p, from as q, dist as r, installDependencies as s, create as t, be as u, parseSvelte as v, stripAst as w, parseHtml$1 as x, MagicString as y, Ue as z };
@@ -1,4 +1,4 @@
1
- import { Element, MagicString, T, Tag, __toESM, any, be, createPrinter, dedent_default, defineAddon, defineAddonOptions, detect, getUserAgent, import_picocolors as import_picocolors$2, parseCss, parseHtml, parseHtml$1, parseJson, parseScript, parseScript$1, parseSvelte, require_picocolors, resolveCommand, serializeScript, stripAst, walk } from "./create-CdiXN6U7.js";
1
+ import { A as dedent_default, C as serializeScript, D as walk, E as Tag, G as any, J as require_picocolors, M as defineAddonOptions, R as T, S as parseScript$1, T as Element, _ as parseScript, b as import_picocolors$2, et as __toESM, f as detect, g as parseJson, h as parseHtml, j as defineAddon, k as createPrinter, m as parseCss, o as getUserAgent, p as resolveCommand, u as be, v as parseSvelte, w as stripAst, x as parseHtml$1, y as MagicString } from "./create-Bt2-1pFJ.js";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs";
4
4
  import process from "node:process";
@@ -22,11 +22,10 @@ function decircular(object) {
22
22
  //#endregion
23
23
  //#region ../core/tooling/js/common.ts
24
24
  function addJsDocTypeComment(node, options$7) {
25
- const comment = {
25
+ addComment(node, {
26
26
  type: "Block",
27
27
  value: `* @type {${options$7.type}} `
28
- };
29
- addComment(node, comment);
28
+ });
30
29
  }
31
30
  function addComment(node, comment) {
32
31
  node.leadingComments ??= [];
@@ -239,7 +238,7 @@ function getArgument(node, options$7) {
239
238
  //#endregion
240
239
  //#region ../core/tooling/js/imports.ts
241
240
  function addEmpty(node, options$7) {
242
- const expectedImportDeclaration = {
241
+ addImportIfNecessary(node, {
243
242
  type: "ImportDeclaration",
244
243
  source: {
245
244
  type: "Literal",
@@ -248,11 +247,10 @@ function addEmpty(node, options$7) {
248
247
  specifiers: [],
249
248
  attributes: [],
250
249
  importKind: "value"
251
- };
252
- addImportIfNecessary(node, expectedImportDeclaration);
250
+ });
253
251
  }
254
252
  function addNamespace(node, options$7) {
255
- const expectedImportDeclaration = {
253
+ addImportIfNecessary(node, {
256
254
  type: "ImportDeclaration",
257
255
  importKind: "value",
258
256
  source: {
@@ -267,11 +265,10 @@ function addNamespace(node, options$7) {
267
265
  }
268
266
  }],
269
267
  attributes: []
270
- };
271
- addImportIfNecessary(node, expectedImportDeclaration);
268
+ });
272
269
  }
273
270
  function addDefault(node, options$7) {
274
- const expectedImportDeclaration = {
271
+ addImportIfNecessary(node, {
275
272
  type: "ImportDeclaration",
276
273
  source: {
277
274
  type: "Literal",
@@ -286,8 +283,7 @@ function addDefault(node, options$7) {
286
283
  }],
287
284
  attributes: [],
288
285
  importKind: "value"
289
- };
290
- addImportIfNecessary(node, expectedImportDeclaration);
286
+ });
291
287
  }
292
288
  function addNamed(node, options$7) {
293
289
  const o_imports = Array.isArray(options$7.imports) ? Object.fromEntries(options$7.imports.map((n) => [n, n])) : options$7.imports;
@@ -428,23 +424,21 @@ function createDefault(node, options$7) {
428
424
  const identifier = exportDefaultDeclaration.declaration;
429
425
  let variableDeclaration;
430
426
  let variableDeclarator;
431
- for (const declaration$2 of node.body) {
432
- if (declaration$2.type !== "VariableDeclaration") continue;
433
- variableDeclarator = declaration$2.declarations.find((declarator) => declarator.type === "VariableDeclarator" && declarator.id.type === "Identifier" && declarator.id.name === identifier.name);
434
- variableDeclaration = declaration$2;
427
+ for (const declaration$1 of node.body) {
428
+ if (declaration$1.type !== "VariableDeclaration") continue;
429
+ variableDeclarator = declaration$1.declarations.find((declarator) => declarator.type === "VariableDeclarator" && declarator.id.type === "Identifier" && declarator.id.name === identifier.name);
430
+ variableDeclaration = declaration$1;
435
431
  }
436
432
  if (!variableDeclaration || !variableDeclarator) throw new Error(`Unable to find exported variable '${identifier.name}'`);
437
- const value = variableDeclarator.init;
438
433
  return {
439
434
  astNode: exportDefaultDeclaration,
440
- value,
435
+ value: variableDeclarator.init,
441
436
  isFallback: false
442
437
  };
443
438
  }
444
- const declaration$1 = exportDefaultDeclaration.declaration;
445
439
  return {
446
440
  astNode: exportDefaultDeclaration,
447
- value: declaration$1,
441
+ value: exportDefaultDeclaration.declaration,
448
442
  isFallback: false
449
443
  };
450
444
  }
@@ -708,8 +702,7 @@ function addInArrayOfObject(ast, options$7) {
708
702
  else append(targetArray, expression);
709
703
  }
710
704
  const addPlugin = (ast, options$7) => {
711
- const configObject = getConfig(ast);
712
- addInArrayOfObject(configObject, {
705
+ addInArrayOfObject(getConfig(ast), {
713
706
  arrayProperty: "plugins",
714
707
  ...options$7
715
708
  });
@@ -784,8 +777,7 @@ function addToDemoPage(content, path$1) {
784
777
  const { template, generateCode } = parseSvelte(content);
785
778
  for (const node of template.ast.childNodes) if (node.type === "tag" && node.attribs["href"] === `/demo/${path$1}`) return content;
786
779
  const newLine = template.source ? "\n" : "";
787
- const src = template.source + `${newLine}<a href="/demo/${path$1}">${path$1}</a>`;
788
- return generateCode({ template: src });
780
+ return generateCode({ template: template.source + `${newLine}<a href="/demo/${path$1}">${path$1}</a>` });
789
781
  }
790
782
  /**
791
783
  * Returns the corresponding `@types/node` version for the version of Node.js running in the current process.
@@ -2713,10 +2705,10 @@ var vitest_addon_default = defineAddon({
2713
2705
  const ext = typescript ? "ts" : "js";
2714
2706
  const unitTesting = options$7.usages.includes("unit");
2715
2707
  const componentTesting = options$7.usages.includes("component");
2716
- sv.devDependency("vitest", "^3.2.4");
2708
+ sv.devDependency("vitest", "^4.0.5");
2717
2709
  if (componentTesting) {
2718
- sv.devDependency("@vitest/browser", "^3.2.4");
2719
- sv.devDependency("vitest-browser-svelte", "^1.1.0");
2710
+ sv.devDependency("@vitest/browser-playwright", "^4.0.5");
2711
+ sv.devDependency("vitest-browser-svelte", "^2.0.1");
2720
2712
  sv.devDependency("playwright", "^1.56.1");
2721
2713
  }
2722
2714
  sv.file("package.json", (content) => {
@@ -2747,7 +2739,7 @@ var vitest_addon_default = defineAddon({
2747
2739
  sv.file(fileName, (content) => {
2748
2740
  if (content) return content;
2749
2741
  return dedent_default`
2750
- import { page } from '@vitest/browser/context';
2742
+ import { page } from 'vitest/browser';
2751
2743
  import { describe, expect, it } from 'vitest';
2752
2744
  import { render } from 'vitest-browser-svelte';
2753
2745
  ${kit ? "import Page from './+page.svelte';" : "import App from './App.svelte';"}
@@ -2762,13 +2754,6 @@ var vitest_addon_default = defineAddon({
2762
2754
  });
2763
2755
  `;
2764
2756
  });
2765
- sv.file(`vitest-setup-client.${ext}`, (content) => {
2766
- if (content) return content;
2767
- return dedent_default`
2768
- /// <reference types="@vitest/browser/matchers" />
2769
- /// <reference types="@vitest/browser/providers/playwright" />
2770
- `;
2771
- });
2772
2757
  }
2773
2758
  sv.file(files.viteConfig, (content) => {
2774
2759
  const { ast, generateCode } = parseScript(content);
@@ -2776,15 +2761,19 @@ var vitest_addon_default = defineAddon({
2776
2761
  extends: `./${files.viteConfig}`,
2777
2762
  test: {
2778
2763
  name: "client",
2779
- environment: "browser",
2780
2764
  browser: {
2781
2765
  enabled: true,
2782
- provider: "playwright",
2783
- instances: [{ browser: "chromium" }]
2766
+ provider: createCall({
2767
+ name: "playwright",
2768
+ args: []
2769
+ }),
2770
+ instances: [{
2771
+ browser: "chromium",
2772
+ headless: true
2773
+ }]
2784
2774
  },
2785
2775
  include: ["src/**/*.svelte.{test,spec}.{js,ts}"],
2786
- exclude: ["src/lib/server/**"],
2787
- setupFiles: [`./vitest-setup-client.${ext}`]
2776
+ exclude: ["src/lib/server/**"]
2788
2777
  }
2789
2778
  });
2790
2779
  const serverObjectExpression = create({
@@ -2807,6 +2796,10 @@ var vitest_addon_default = defineAddon({
2807
2796
  });
2808
2797
  if (componentTesting) append(workspaceArray, clientObjectExpression);
2809
2798
  if (unitTesting) append(workspaceArray, serverObjectExpression);
2799
+ if (componentTesting) addNamed(ast, {
2800
+ imports: ["playwright"],
2801
+ from: "@vitest/browser-playwright"
2802
+ });
2810
2803
  const importName = "defineConfig";
2811
2804
  const { statement, alias } = find(ast, {
2812
2805
  name: importName,
@@ -3000,8 +2993,7 @@ function findWorkspaceRoot(cwd) {
3000
2993
  return cwd;
3001
2994
  }
3002
2995
  function parseKitOptions(cwd) {
3003
- const configSource = readFile(cwd, commonFilePaths.svelteConfig);
3004
- const { ast } = parseScript(configSource);
2996
+ const { ast } = parseScript(readFile(cwd, commonFilePaths.svelteConfig));
3005
2997
  const defaultExport = ast.body.find((s) => s.type === "ExportDefaultDeclaration");
3006
2998
  if (!defaultExport) throw Error("Missing default export in `svelte.config.js`");
3007
2999
  let objectExpression;
@@ -3032,11 +3024,9 @@ function parseKitOptions(cwd) {
3032
3024
  name: "lib",
3033
3025
  fallback: createLiteral("")
3034
3026
  });
3035
- const routesDirectory = routes.value || "src/routes";
3036
- const libDirectory = lib.value || "src/lib";
3037
3027
  return {
3038
- routesDirectory,
3039
- libDirectory
3028
+ routesDirectory: routes.value || "src/routes",
3029
+ libDirectory: lib.value || "src/lib"
3040
3030
  };
3041
3031
  }
3042
3032
 
@@ -3052,20 +3042,18 @@ async function installAddon({ addons, cwd, options: options$7, packageManager =
3052
3042
  cwd,
3053
3043
  packageManager
3054
3044
  });
3055
- const addonSetupResults = setupAddons(Object.values(addons), workspace);
3056
3045
  return await applyAddons({
3057
3046
  addons,
3058
3047
  workspace,
3059
3048
  options: options$7,
3060
- addonSetupResults
3049
+ addonSetupResults: setupAddons(Object.values(addons), workspace)
3061
3050
  });
3062
3051
  }
3063
3052
  async function applyAddons({ addons, workspace, addonSetupResults, options: options$7 }) {
3064
3053
  const filesToFormat = /* @__PURE__ */ new Set();
3065
3054
  const allPnpmBuildDependencies = [];
3066
3055
  const status = {};
3067
- const mapped = Object.entries(addons).map(([, addon]) => addon);
3068
- const ordered = orderAddons(mapped, addonSetupResults);
3056
+ const ordered = orderAddons(Object.entries(addons).map(([, addon]) => addon), addonSetupResults);
3069
3057
  for (const addon of ordered) {
3070
3058
  workspace = await createWorkspace({
3071
3059
  ...workspace,
@@ -3188,4 +3176,4 @@ function orderAddons(addons, setupResults) {
3188
3176
  }
3189
3177
 
3190
3178
  //#endregion
3191
- export { addDefault, applyAddons, communityAddonIds, create, createDefault, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, installAddon, officialAddons, overrideProperties, setupAddons };
3179
+ export { formatFiles as a, getCommunityAddon as c, createDefault as d, addDefault as f, createWorkspace as i, getAddonDetails as l, overrideProperties as m, installAddon as n, getHighlighter as o, create as p, setupAddons as r, communityAddonIds as s, applyAddons as t, officialAddons as u };
package/dist/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { create } from "../create-CdiXN6U7.js";
2
- import { installAddon, officialAddons } from "../install-CA9o73JK.js";
1
+ import { t as create } from "../create-Bt2-1pFJ.js";
2
+ import { n as installAddon, u as officialAddons } from "../install-Dy7mZYPj.js";
3
3
 
4
4
  export { create, installAddon, officialAddons };
@@ -1,4 +1,4 @@
1
- import { __commonJS, __require, __toESM, addPnpmBuildDependencies, be, create, ve } from "../create-CdiXN6U7.js";
1
+ import { $ as __require, Q as __commonJS, a as addPnpmBuildDependencies, d as ve, et as __toESM, t as create, u as be } from "../create-Bt2-1pFJ.js";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs";
4
4
  import process$1 from "node:process";
@@ -3193,13 +3193,9 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
3193
3193
  });
3194
3194
  if (child.isDirectory()) chownr(path__default["default"].resolve(p, child.name), uid, gid, (er) => {
3195
3195
  if (er) return cb(er);
3196
- const cpath = path__default["default"].resolve(p, child.name);
3197
- chown(cpath, uid, gid, cb);
3196
+ chown(path__default["default"].resolve(p, child.name), uid, gid, cb);
3198
3197
  });
3199
- else {
3200
- const cpath = path__default["default"].resolve(p, child.name);
3201
- chown(cpath, uid, gid, cb);
3202
- }
3198
+ else chown(path__default["default"].resolve(p, child.name), uid, gid, cb);
3203
3199
  };
3204
3200
  const chownr = (p, uid, gid, cb) => {
3205
3201
  readdir(p, { withFileTypes: true }, (er, children) => {
@@ -3290,8 +3286,7 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
3290
3286
  done(er);
3291
3287
  });
3292
3288
  if (preserve) return mkdirp_1(dir, { mode }).then((made) => done(null, made), done);
3293
- const parts = path__default["default"].relative(cwd$1, dir).split(/\/|\\/);
3294
- mkdir_(cwd$1, parts, mode, cache, unlink, cwd$1, null, done);
3289
+ mkdir_(cwd$1, path__default["default"].relative(cwd$1, dir).split(/\/|\\/), mode, cache, unlink, cwd$1, null, done);
3295
3290
  };
3296
3291
  const mkdir_ = (base$1, parts, mode, cache, unlink, cwd$1, created, cb) => {
3297
3292
  if (!parts.length) return cb(null, created);
@@ -4934,13 +4929,10 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
4934
4929
  x = x > .008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
4935
4930
  y$1 = y$1 > .008856 ? y$1 ** (1 / 3) : 7.787 * y$1 + 16 / 116;
4936
4931
  z = z > .008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
4937
- const l = 116 * y$1 - 16;
4938
- const a = 500 * (x - y$1);
4939
- const b = 200 * (y$1 - z);
4940
4932
  return [
4941
- l,
4942
- a,
4943
- b
4933
+ 116 * y$1 - 16,
4934
+ 500 * (x - y$1),
4935
+ 200 * (y$1 - z)
4944
4936
  ];
4945
4937
  };
4946
4938
  convert$1.hsl.rgb = function(hsl) {
@@ -4988,10 +4980,9 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
4988
4980
  s$1 *= l <= 1 ? l : 2 - l;
4989
4981
  smin *= lmin <= 1 ? lmin : 2 - lmin;
4990
4982
  const v = (l + s$1) / 2;
4991
- const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s$1 / (l + s$1);
4992
4983
  return [
4993
4984
  h$1,
4994
- sv * 100,
4985
+ (l === 0 ? 2 * smin / (lmin + smin) : 2 * s$1 / (l + s$1)) * 100,
4995
4986
  v * 100
4996
4987
  ];
4997
4988
  };
@@ -5161,13 +5152,10 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5161
5152
  x = x > .008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
5162
5153
  y$1 = y$1 > .008856 ? y$1 ** (1 / 3) : 7.787 * y$1 + 16 / 116;
5163
5154
  z = z > .008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
5164
- const l = 116 * y$1 - 16;
5165
- const a = 500 * (x - y$1);
5166
- const b = 200 * (y$1 - z);
5167
5155
  return [
5168
- l,
5169
- a,
5170
- b
5156
+ 116 * y$1 - 16,
5157
+ 500 * (x - y$1),
5158
+ 200 * (y$1 - z)
5171
5159
  ];
5172
5160
  };
5173
5161
  convert$1.lab.xyz = function(lab) {
@@ -5202,10 +5190,9 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5202
5190
  let h$1;
5203
5191
  h$1 = Math.atan2(b, a) * 360 / 2 / Math.PI;
5204
5192
  if (h$1 < 0) h$1 += 360;
5205
- const c = Math.sqrt(a * a + b * b);
5206
5193
  return [
5207
5194
  l,
5208
- c,
5195
+ Math.sqrt(a * a + b * b),
5209
5196
  h$1
5210
5197
  ];
5211
5198
  };
@@ -5213,12 +5200,10 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5213
5200
  const l = lch[0];
5214
5201
  const c = lch[1];
5215
5202
  const hr = lch[2] / 360 * 2 * Math.PI;
5216
- const a = c * Math.cos(hr);
5217
- const b = c * Math.sin(hr);
5218
5203
  return [
5219
5204
  l,
5220
- a,
5221
- b
5205
+ c * Math.cos(hr),
5206
+ c * Math.sin(hr)
5222
5207
  ];
5223
5208
  };
5224
5209
  convert$1.rgb.ansi16 = function(args, saturation = null) {
@@ -5256,13 +5241,10 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5256
5241
  ];
5257
5242
  }
5258
5243
  const mult = (~~(args > 50) + 1) * .5;
5259
- const r = (color & 1) * mult * 255;
5260
- const g = (color >> 1 & 1) * mult * 255;
5261
- const b = (color >> 2 & 1) * mult * 255;
5262
5244
  return [
5263
- r,
5264
- g,
5265
- b
5245
+ (color & 1) * mult * 255,
5246
+ (color >> 1 & 1) * mult * 255,
5247
+ (color >> 2 & 1) * mult * 255
5266
5248
  ];
5267
5249
  };
5268
5250
  convert$1.ansi256.rgb = function(args) {
@@ -5276,13 +5258,10 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5276
5258
  }
5277
5259
  args -= 16;
5278
5260
  let rem;
5279
- const r = Math.floor(args / 36) / 5 * 255;
5280
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
5281
- const b = rem % 6 / 5 * 255;
5282
5261
  return [
5283
- r,
5284
- g,
5285
- b
5262
+ Math.floor(args / 36) / 5 * 255,
5263
+ Math.floor((rem = args % 36) / 6) / 5 * 255,
5264
+ rem % 6 / 5 * 255
5286
5265
  ];
5287
5266
  };
5288
5267
  convert$1.rgb.hex = function(args) {
@@ -5301,13 +5280,10 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5301
5280
  return char + char;
5302
5281
  }).join("");
5303
5282
  const integer = parseInt(colorString, 16);
5304
- const r = integer >> 16 & 255;
5305
- const g = integer >> 8 & 255;
5306
- const b = integer & 255;
5307
5283
  return [
5308
- r,
5309
- g,
5310
- b
5284
+ integer >> 16 & 255,
5285
+ integer >> 8 & 255,
5286
+ integer & 255
5311
5287
  ];
5312
5288
  };
5313
5289
  convert$1.rgb.hcg = function(rgb) {
@@ -5415,8 +5391,7 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5415
5391
  };
5416
5392
  convert$1.hcg.hsv = function(hcg) {
5417
5393
  const c = hcg[1] / 100;
5418
- const g = hcg[2] / 100;
5419
- const v = c + g * (1 - c);
5394
+ const v = c + hcg[2] / 100 * (1 - c);
5420
5395
  let f = 0;
5421
5396
  if (v > 0) f = c / v;
5422
5397
  return [
@@ -5439,8 +5414,7 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5439
5414
  };
5440
5415
  convert$1.hcg.hwb = function(hcg) {
5441
5416
  const c = hcg[1] / 100;
5442
- const g = hcg[2] / 100;
5443
- const v = c + g * (1 - c);
5417
+ const v = c + hcg[2] / 100 * (1 - c);
5444
5418
  return [
5445
5419
  hcg[0],
5446
5420
  (v - c) * 100,
@@ -5803,8 +5777,7 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
5803
5777
  return min;
5804
5778
  }
5805
5779
  function getSupportLevel(stream) {
5806
- const level = supportsColor(stream, stream && stream.isTTY);
5807
- return translateLevel(level);
5780
+ return translateLevel(supportsColor(stream, stream && stream.isTTY));
5808
5781
  }
5809
5782
  var supportsColor_1 = {
5810
5783
  supportsColor: getSupportLevel,
@@ -7608,10 +7581,7 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
7608
7581
  }
7609
7582
  function ignoreMap(pattern) {
7610
7583
  var gmatcher = null;
7611
- if (pattern.slice(-3) === "/**") {
7612
- var gpattern = pattern.replace(/(\/\*\*)+$/, "");
7613
- gmatcher = new Minimatch(gpattern, { dot: true });
7614
- }
7584
+ if (pattern.slice(-3) === "/**") gmatcher = new Minimatch(pattern.replace(/(\/\*\*)+$/, ""), { dot: true });
7615
7585
  return {
7616
7586
  matcher: new Minimatch(pattern, { dot: true }),
7617
7587
  gmatcher
@@ -9632,8 +9602,7 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
9632
9602
  req.onSocket(socket);
9633
9603
  return;
9634
9604
  }
9635
- const err = /* @__PURE__ */ new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``);
9636
- onerror(err);
9605
+ onerror(/* @__PURE__ */ new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``));
9637
9606
  };
9638
9607
  if (typeof this.callback !== "function") {
9639
9608
  onerror(/* @__PURE__ */ new Error("`callback` is not defined"));
@@ -10177,18 +10146,15 @@ while (this[PROCESSENTRY](this[QUEUE].shift()));
10177
10146
  const subdir = match$1[6];
10178
10147
  const ref = match$1[7] || "HEAD";
10179
10148
  const domain = `${site}.${site === "bitbucket" ? "org" : site === "git.sr.ht" ? "" : "com"}`;
10180
- const url = `https://${domain}/${user}/${name}`;
10181
- const ssh = `git@${domain}:${user}/${name}`;
10182
- const mode = supported.has(site) ? "tar" : "git";
10183
10149
  return {
10184
10150
  site,
10185
10151
  user,
10186
10152
  name,
10187
10153
  ref,
10188
- url,
10189
- ssh,
10154
+ url: `https://${domain}/${user}/${name}`,
10155
+ ssh: `git@${domain}:${user}/${name}`,
10190
10156
  subdir,
10191
- mode
10157
+ mode: supported.has(site) ? "tar" : "git"
10192
10158
  };
10193
10159
  }
10194
10160
  async function untar(file, dest, subdir = null) {
@@ -10984,8 +10950,7 @@ async function terminate(pid) {
10984
10950
  const children = await getProcessTree(pid);
10985
10951
  for (let i = children.length - 1; i >= 0; i--) {
10986
10952
  const child = children[i];
10987
- const pid$1 = Number(child.PID);
10988
- kill(pid$1);
10953
+ kill(Number(child.PID));
10989
10954
  }
10990
10955
  kill(pid);
10991
10956
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.9.11",
3
+ "version": "0.9.12",
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",