sv 0.16.3 → 0.16.5

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 Command, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as program, v as version } from "./engine-B1KphrBP.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-CCAozEpo.mjs";
3
3
  import { color, resolveCommandArray } from "@sveltejs/sv-utils";
4
4
  import V from "node:process";
5
5
  import { execSync } from "node:child_process";
@@ -1348,7 +1348,7 @@ ${i ? styleText("cyan", x$1) : ""}
1348
1348
  //#endregion
1349
1349
  //#region package.json
1350
1350
  var name = "sv";
1351
- var version = "0.16.3";
1351
+ var version = "0.16.5";
1352
1352
  //#endregion
1353
1353
  //#region src/core/errors.ts
1354
1354
  var UnsupportedError = class extends Error {
@@ -5850,8 +5850,8 @@ var better_auth_default = defineAddon({
5850
5850
  const hasDemo = demoPassword || demoGithub;
5851
5851
  let drizzleDialect;
5852
5852
  let d1 = false;
5853
- sv.devDependency("better-auth", "~1.4.21");
5854
- sv.devDependency("@better-auth/cli", "~1.4.21");
5853
+ sv.devDependency("auth", "^1.6.23");
5854
+ sv.devDependency("better-auth", "^1.6.23");
5855
5855
  sv.file(`drizzle.config.${language}`, transforms.script(({ ast }) => {
5856
5856
  const isProp = (name, node) => node.key.type === "Identifier" && node.key.name === name;
5857
5857
  Walker.walk(ast, null, { Property(node) {
@@ -5975,6 +5975,7 @@ var better_auth_default = defineAddon({
5975
5975
  if (content) return false;
5976
5976
  return dedent`
5977
5977
  // If you see this file, you have not run the auth:schema script yet, but you should!
5978
+ export {};
5978
5979
  `;
5979
5980
  }));
5980
5981
  sv.file(`${directory.lib}/server/db/schema.${language}`, transforms.script(({ ast, js }) => {
@@ -7164,14 +7165,9 @@ var paraglide_default = defineAddon({
7164
7165
  setup: ({ isKit, unsupported }) => {
7165
7166
  if (!isKit) unsupported("Requires SvelteKit");
7166
7167
  },
7167
- run: ({ sv, options, file, language, directory, cwd, dependencyVersion }) => {
7168
+ run: ({ sv, options, file, language, directory }) => {
7168
7169
  const [ts] = createPrinter(language === "ts");
7169
7170
  const paraglideOutDir = `${directory.lib}/paraglide`;
7170
- const env = defineEnv({
7171
- sv,
7172
- cwd,
7173
- dependencyVersion
7174
- });
7175
7171
  sv.devDependency("@inlang/paraglide-js", "^2.18.2");
7176
7172
  sv.file(file.viteConfig, transforms.script(({ ast, js }) => {
7177
7173
  const vitePluginName = "paraglideVitePlugin";
@@ -7180,10 +7176,10 @@ var paraglide_default = defineAddon({
7180
7176
  from: "@inlang/paraglide-js"
7181
7177
  });
7182
7178
  js.vite.addPlugin(ast, { code: `${vitePluginName}({
7183
- project: './project.inlang',
7184
- outdir: './${paraglideOutDir}',
7185
- strategy: ['url']
7186
- })` });
7179
+ project: './project.inlang',
7180
+ outdir: './${paraglideOutDir}',
7181
+ emitTsDeclarations: true
7182
+ })` });
7187
7183
  }));
7188
7184
  sv.file(`src/hooks.${language}`, transforms.script(({ ast, comments, js }) => {
7189
7185
  js.imports.addNamed(ast, {
@@ -7238,66 +7234,11 @@ var paraglide_default = defineAddon({
7238
7234
  html.addAttribute(htmlNode, "lang", "%paraglide.lang%");
7239
7235
  html.addAttribute(htmlNode, "dir", "%paraglide.dir%");
7240
7236
  }));
7241
- sv.file(`${directory.lib}/paraglide.svelte.${language}`, transforms.script(({ ast, js, comments }) => {
7242
- js.imports.addNamed(ast, {
7243
- imports: [
7244
- "baseLocale",
7245
- "localizeUrl",
7246
- "overwriteGetLocale",
7247
- "overwriteSetLocale",
7248
- "toLocale"
7249
- ],
7250
- from: "$lib/paraglide/runtime"
7251
- });
7252
- js.imports.addNamed(ast, {
7253
- imports: ["page"],
7254
- from: "$app/state"
7255
- });
7256
- js.imports.addNamed(ast, {
7257
- imports: ["goto"],
7258
- from: "$app/navigation"
7259
- });
7260
- env.importEnv(ast, js, ["browser"]);
7261
- if (language === "ts") js.imports.addNamed(ast, {
7262
- imports: { Locale: "_Locale" },
7263
- from: "$lib/paraglide/runtime",
7264
- isType: true
7265
- });
7266
- const codeBlock = dedent`
7267
- export class Locale {
7268
- #current${ts(": _Locale")} = $state(toLocale(browser && document.querySelector('html')?.lang) ?? baseLocale);
7269
- constructor() {
7270
- overwriteGetLocale(() => this.#current);
7271
- overwriteSetLocale((locale) => {
7272
- this.#current = locale;
7273
- goto(localizeUrl(page.url.pathname, { locale }).href);
7274
- });
7275
- }
7276
- }`;
7277
- js.common.appendFromString(ast, {
7278
- code: codeBlock,
7279
- comments
7280
- });
7281
- }));
7282
- sv.file(`src/hooks.client.${language}`, transforms.script(({ ast, comments, js }) => {
7283
- js.imports.addNamed(ast, {
7284
- imports: ["Locale"],
7285
- from: "$lib/paraglide.svelte"
7286
- });
7287
- if (language === "ts") js.imports.addNamed(ast, {
7288
- imports: ["ClientInit"],
7289
- from: "@sveltejs/kit",
7290
- isType: true
7291
- });
7292
- const init = dedent`
7293
- export const init${ts(": ClientInit")} = () => {
7294
- new Locale()
7295
- }
7296
- `;
7297
- js.common.appendFromString(ast, {
7298
- code: init,
7299
- comments
7300
- });
7237
+ sv.file(file.gitignore, transforms.text(({ content, text }) => {
7238
+ if (!content) return false;
7239
+ content = text.upsert(content, paraglideOutDir, { comment: "Paraglide" });
7240
+ content = text.upsert(content, "project.inlang/cache/");
7241
+ return content;
7301
7242
  }));
7302
7243
  sv.file("project.inlang/settings.json", transforms.json(({ data }) => {
7303
7244
  if (Object.keys(data).length > 0) return false;
@@ -11313,6 +11254,7 @@ const create = new Command("create").description("Scaffold a new project (--add
11313
11254
  }).showHelpAfterError(true);
11314
11255
  async function createProject(cwd, options) {
11315
11256
  if (options.fromPlayground) R$1.warn("Svelte maintainers have not reviewed playgrounds for malicious code! Use at your discretion.");
11257
+ if (options.template === "addon" && options.types === "typescript") R$1.warn(`The addon template does not support TypeScript. The ${color.command("--types")} flag will be ignored.`);
11316
11258
  const promptGroupResult = await pe({
11317
11259
  directory: () => {
11318
11260
  const defaultPath = "./";
@@ -11350,8 +11292,8 @@ async function createProject(cwd, options) {
11350
11292
  });
11351
11293
  },
11352
11294
  language: (o) => {
11353
- if (options.types) return Promise.resolve(options.types);
11354
11295
  if (o.results.template === "addon") return Promise.resolve("none");
11296
+ if (options.types) return Promise.resolve(options.types);
11355
11297
  return Ee({
11356
11298
  message: "Add type checking with TypeScript?",
11357
11299
  initialValue: "typescript",
@@ -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-B1KphrBP.mjs";
1
+ import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-CCAozEpo.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 addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-B1KphrBP.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-CCAozEpo.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import V from "node:process";
@@ -22,15 +22,14 @@
22
22
  "access": "public"
23
23
  },
24
24
  "peerDependencies": {
25
- "sv": "^0.16.3"
25
+ "sv": "^0.16.5"
26
26
  },
27
27
  "devDependencies": {
28
- "sv": "^0.16.3",
28
+ "sv": "^0.16.5",
29
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",
33
- "unrun": "^0.2.39",
34
33
  "vitest": "^4.1.8"
35
34
  },
36
35
  "keywords": ["sv-add", "svelte", "sveltekit"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
4
4
  "type": "module",
5
5
  "description": "A command line interface (CLI) for creating and maintaining Svelte applications",
6
6
  "license": "MIT",