sv 0.15.0 → 0.15.1

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 { _ as name, a as detectPackageManager, d as program, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as Command, v as version } from "./engine-CzIdz0uO.mjs";
2
+ import { _ as name, a as detectPackageManager, d as program, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as Command, v as version } from "./engine-Cq2kv_P1.mjs";
3
3
  import { color, resolveCommandArray } from "@sveltejs/sv-utils";
4
4
  import process from "node:process";
5
5
  import { execSync } from "node:child_process";
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
- import { AGENTS, COMMANDS, Walker, color, constructCommand, createPrinter, dedent, detect, downloadJson, fileExists, isVersionUnsupportedBelow, js, loadFile, loadPackageJson, parse, pnpm, resolveCommand, resolveCommandArray, sanitizeName, saveFile, splitVersion, svelte, text, transforms } from "@sveltejs/sv-utils";
2
+ import { AGENTS, COMMANDS, Walker, color, constructCommand, createPrinter, dedent, detect, downloadJson, fileExists, isVersionUnsupportedBelow, js, loadFile, loadPackageJson, parse, pnpm, resolveCommand, resolveCommandArray, sanitizeName, saveFile, splitVersion, svelte, transforms } from "@sveltejs/sv-utils";
3
3
  import fs, { existsSync } from "node:fs";
4
4
  import path, { delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
5
5
  import process$1, { cwd, stdin, stdout } from "node:process";
@@ -44,7 +44,10 @@ const warned = /* @__PURE__ */ new Set();
44
44
  function svDeprecated(message) {
45
45
  if (warned.has(message)) return;
46
46
  warned.add(message);
47
- console.warn(`[sv] Deprecated: ${message}`);
47
+ console.warn();
48
+ console.warn(` ${color.dim("[sv] Deprecated:")} ${message}`);
49
+ console.warn(` Still works. ${color.warning("Warn add-on's author about it.")}`);
50
+ console.warn();
48
51
  }
49
52
  //#endregion
50
53
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
@@ -1391,7 +1394,7 @@ ${r ? import_picocolors.default.cyan(x$1) : ""}
1391
1394
  //#endregion
1392
1395
  //#region package.json
1393
1396
  var name = "sv";
1394
- var version = "0.15.0";
1397
+ var version = "0.15.1";
1395
1398
  //#endregion
1396
1399
  //#region src/core/errors.ts
1397
1400
  var UnsupportedError = class extends Error {
@@ -7823,12 +7826,10 @@ var sveltekit_adapter_default = defineAddon({
7823
7826
  };
7824
7827
  sv.file(`wrangler.${ext}`, ext === "toml" ? transforms.toml(({ data }) => applyWranglerConfig(data)) : transforms.json(({ data }) => applyWranglerConfig(data)));
7825
7828
  if (file.typeConfig) {
7826
- sv.file(file.gitignore, transforms.text(({ content }) => {
7827
- if (content.length === 0) return false;
7828
- return text.upsert(content, "/worker-configuration.d.ts", { comment: "Cloudflare Types" });
7829
- }));
7830
7829
  sv.file(file.package, transforms.json(({ data, json }) => {
7831
7830
  json.packageScriptsUpsert(data, "gen", "wrangler types");
7831
+ json.packageScriptsUpsert(data, "check", "wrangler types --check", { mode: "prepend" });
7832
+ json.packageScriptsUpsert(data, "build", "wrangler types --check", { mode: "prepend" });
7832
7833
  }));
7833
7834
  sv.file(file.typeConfig, transforms.json(({ data }) => {
7834
7835
  data.compilerOptions ??= {};
@@ -11032,6 +11033,27 @@ function verifyUnsupportedAddons(addons, setupResults) {
11032
11033
  }
11033
11034
  //#endregion
11034
11035
  //#region src/core/workspace.ts
11036
+ const deprecatedFiles = {
11037
+ prettierignore: ".prettierignore",
11038
+ prettierrc: ".prettierrc",
11039
+ eslintConfig: "eslint.config.js",
11040
+ vscodeSettings: ".vscode/settings.json",
11041
+ vscodeExtensions: ".vscode/extensions.json"
11042
+ };
11043
+ /**
11044
+ * Adds deprecated file properties as non-enumerable getters so they don't trigger on spread
11045
+ * Once we remove these deprecatedFiles, we can get rid of addDeprecatedFileProperties
11046
+ */
11047
+ function addDeprecatedFileProperties(file) {
11048
+ for (const [key, value] of Object.entries(deprecatedFiles)) Object.defineProperty(file, key, {
11049
+ get() {
11050
+ svDeprecated(`use the string \`"${value}"\` instead of \`file.${key}\``);
11051
+ return value;
11052
+ },
11053
+ enumerable: false
11054
+ });
11055
+ return file;
11056
+ }
11035
11057
  async function createWorkspace({ cwd, packageManager, override }) {
11036
11058
  const resolvedCwd = path.resolve(cwd);
11037
11059
  const typeConfig = any([filePaths.jsconfig, filePaths.tsconfig], { cwd });
@@ -11074,33 +11096,13 @@ async function createWorkspace({ cwd, packageManager, override }) {
11074
11096
  cwd: resolvedCwd,
11075
11097
  packageManager: packageManager ?? await detectPackageManager(cwd),
11076
11098
  language: typescript ? "ts" : "js",
11077
- file: {
11099
+ file: addDeprecatedFileProperties({
11078
11100
  viteConfig,
11079
11101
  svelteConfig,
11080
11102
  typeConfig,
11081
11103
  stylesheet,
11082
11104
  package: "package.json",
11083
11105
  gitignore: ".gitignore",
11084
- get prettierignore() {
11085
- svDeprecated("`workspace.file.prettierignore` is deprecated, use the string `.prettierignore` isntead.");
11086
- return ".prettierignore";
11087
- },
11088
- get prettierrc() {
11089
- svDeprecated("`workspace.file.prettierrc` is deprecated, use the string `.prettierrc` isntead.");
11090
- return ".prettierrc";
11091
- },
11092
- get eslintConfig() {
11093
- svDeprecated("`workspace.file.eslintConfig` is deprecated, use the string `eslint.config.js` isntead.");
11094
- return "eslint.config.js";
11095
- },
11096
- get vscodeSettings() {
11097
- svDeprecated("`workspace.file.vscodeSettings` is deprecated, use the string `.vscode/settings.json` isntead.");
11098
- return ".vscode/settings.json";
11099
- },
11100
- get vscodeExtensions() {
11101
- svDeprecated("`workspace.file.vscodeExtensions` is deprecated, use the string `.vscode/extensions.json` isntead.");
11102
- return ".vscode/extensions.json";
11103
- },
11104
11106
  getRelative({ from, to }) {
11105
11107
  from = from ?? "";
11106
11108
  let relativePath = path.posix.relative(path.posix.dirname(from), to);
@@ -11113,7 +11115,7 @@ async function createWorkspace({ cwd, packageManager, override }) {
11113
11115
  if (resolvedCwd.includes(".test-output") && !found.includes(".test-output")) return filename;
11114
11116
  return path.relative(resolvedCwd, found);
11115
11117
  }
11116
- },
11118
+ }),
11117
11119
  isKit,
11118
11120
  directory,
11119
11121
  dependencyVersion: (pkg) => dependencies[pkg]
@@ -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-CzIdz0uO.mjs";
1
+ import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-Cq2kv_P1.mjs";
2
2
  //#region src/index.ts
3
3
  function create(cwdOrOptions, legacyOptions) {
4
4
  if (typeof cwdOrOptions === "string") {
@@ -1,4 +1,4 @@
1
- import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmOnlyBuiltDependencies, m as create, p as z, t as add, x as __require } from "../engine-CzIdz0uO.mjs";
1
+ import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmOnlyBuiltDependencies, m as create, p as z, t as add, x as __require } from "../engine-Cq2kv_P1.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import process$1 from "node:process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "description": "A command line interface (CLI) for creating and maintaining Svelte applications",
6
6
  "license": "MIT",