sv 0.12.1 → 0.12.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.
@@ -1,4 +1,4 @@
1
- import { $ as OptionValues, C as Addon, G as PackageManager, I as SetupResult, K as Workspace, j as LoadedAddon } from "./core-DjIj3YV4.mjs";
1
+ import { H as Workspace, N as SetupResult, O as LoadedAddon, V as PackageManager, Y as OptionValues, b as Addon } from "./core-VSHdSalh.mjs";
2
2
 
3
3
  //#region lib/addons/_engine/add.d.ts
4
4
  type InstallOptions<Addons extends AddonMap> = {
@@ -1,12 +1,12 @@
1
1
  import { r as __require, t as __commonJSMin } from "./chunk-BcJDCUAU.mjs";
2
- import { _ as getSharedFiles, a as installOption, c as up$1, d as Option, g as dist, h as sanitizeName, i as installDependencies, m as templates, n as addPnpmBuildDependencies, o as packageManagerPrompt, p as create$1, r as detectPackageManager, s as any, t as AGENT_NAMES, u as Command } from "./package-manager-DYfxv5nk.mjs";
3
- import { $ as createPrinter, A as addNamespace$1, B as appendFromString, C as createDefault, Ct as Rt, D as addDefault, E as declaration, Et as qt, F as overrideProperties, G as parseExpression, H as createLiteral, I as property, J as addSlot, K as parseStatement, L as append, M as remove, N as createCall, O as addEmpty, Ot as Ct, P as create$2, R as create$3, S as addNamespace, St as R, T as createIdentifier, Tt as kt, U as createSpread, V as appendStatement, W as hasTypeProperty, Y as ensureScript, Z as addAtRule, _t as Lt, a as getPackageJson, at as defineAddon, b as addGlobalAppInterface, bt as Pt, c as writeFile, ct as walk, et as addEslintConfigPrettier, f as packageScriptsUpsert, ft as q, gt as Ie, h as addAttribute, ht as resolveCommand, i as formatFiles, it as splitVersion, j as find, k as addNamed, l as parse$1, m as upsert, n as commonFilePaths, nt as getNodeTypesVersion, o as installPackages, ot as defineAddonOptions, q as addFragment, r as fileExists, rt as isVersionUnsupportedBelow, s as readFile, st as getErrorHint, t as color, tt as addToDemoPage, u as arrayUpsert, ut as dedent_default, v as addPlugin, vt as Mt, w as createNamed, wt as Wt, x as addHooksHandle, xt as Qt, y as getConfig, yt as Nt, z as addJsDocTypeComment } from "./utils-CnfD6Z1s.mjs";
2
+ import { A as addNamespace$1, C as createDefault, Ct as R, D as addDefault, Dt as qt, E as declaration, Et as kt, F as overrideProperties, G as isVersionUnsupportedBelow, H as addEslintConfigPrettier, I as property, J as defineAddonOptions, K as splitVersion, L as append, M as remove, N as createCall, O as addEmpty, P as create$1, Q as ensureScript, R as create$2, S as addNamespace, St as Qt, T as createIdentifier, Tt as Wt, U as addToDemoPage, V as createPrinter, W as getNodeTypesVersion, X as addFragment, Y as getErrorHint, Z as addSlot, _t as Ie, a as getPackageJson, at as createTypeProperty, b as addGlobalAppInterface, bt as Nt, c as writeFile, ct as parseStatement, et as addJsDocTypeComment, f as packageScriptsUpsert, gt as resolveCommand, h as addAttribute, i as formatFiles, it as createSpread, j as find, k as addNamed, kt as Ct, l as parse$1, lt as dedent_default, m as upsert, n as commonFilePaths, nt as appendStatement, o as installPackages, ot as hasTypeProperty, pt as q, q as defineAddon, r as fileExists, rt as createLiteral, s as readFile, st as parseExpression, t as color, tt as appendFromString, u as arrayUpsert, ut as walk, v as addPlugin, vt as Lt, w as createNamed, wt as Rt, x as addHooksHandle, xt as Pt, y as getConfig, yt as Mt, z as addAtRule } from "./utils-D-OWcBXG.mjs";
3
+ import { _ as getSharedFiles, a as installOption, c as up$1, d as Option, g as dist, h as sanitizeName, i as installDependencies, m as templates, n as addPnpmBuildDependencies, o as packageManagerPrompt, p as create$3, r as detectPackageManager, s as any, t as AGENT_NAMES, u as Command } from "./package-manager-B3sMOeTk.mjs";
4
4
  import fs, { existsSync, readFileSync } from "node:fs";
5
5
  import path, { dirname, join } from "node:path";
6
- import { fileURLToPath } from "node:url";
7
6
  import process$1 from "node:process";
8
7
  import { promisify } from "node:util";
9
8
  import { exec } from "node:child_process";
9
+ import { fileURLToPath } from "node:url";
10
10
  import crypto from "node:crypto";
11
11
  import { platform } from "node:os";
12
12
  import { pipeline } from "node:stream/promises";
@@ -676,7 +676,7 @@ var better_auth_default = defineAddon({
676
676
  imports: ["drizzleAdapter"]
677
677
  });
678
678
  addNamed(ast, {
679
- from: "better-auth",
679
+ from: "better-auth/minimal",
680
680
  imports: ["betterAuth"]
681
681
  });
682
682
  const authConfig = dedent_default`
@@ -727,39 +727,19 @@ var better_auth_default = defineAddon({
727
727
  return generateCode();
728
728
  });
729
729
  sv.file("src/app.d.ts", (content) => {
730
- const { ast, generateCode } = parse$1.script(content);
730
+ const { ast, comments, generateCode } = parse$1.script(content);
731
731
  addNamed(ast, {
732
732
  imports: ["User", "Session"],
733
- from: "better-auth",
733
+ from: "better-auth/minimal",
734
734
  isType: true
735
735
  });
736
736
  const locals = addGlobalAppInterface(ast, { name: "Locals" });
737
737
  if (!locals) throw new Error("Failed detecting `locals` interface in `src/app.d.ts`");
738
+ comments.remove((c) => c.type === "Line" && c.value.trim() === "interface Locals {}");
738
739
  const user = locals.body.body.find((prop) => hasTypeProperty(prop, { name: "user" }));
739
740
  const session = locals.body.body.find((prop) => hasTypeProperty(prop, { name: "session" }));
740
- function addProps(name$1, value, optional$1 = false) {
741
- return {
742
- type: "TSPropertySignature",
743
- key: {
744
- type: "Identifier",
745
- name: name$1
746
- },
747
- computed: false,
748
- optional: optional$1,
749
- typeAnnotation: {
750
- type: "TSTypeAnnotation",
751
- typeAnnotation: {
752
- type: "TSTypeReference",
753
- typeName: {
754
- type: "Identifier",
755
- name: value
756
- }
757
- }
758
- }
759
- };
760
- }
761
- if (!user) locals.body.body.push(addProps("user", "User", true));
762
- if (!session) locals.body.body.push(addProps("session", "Session", true));
741
+ if (!user) locals.body.body.push(createTypeProperty("user", "User", true));
742
+ if (!session) locals.body.body.push(createTypeProperty("session", "Session", true));
763
743
  return generateCode();
764
744
  });
765
745
  sv.file(`src/hooks.server.${language}`, (content) => {
@@ -882,7 +862,7 @@ var better_auth_default = defineAddon({
882
862
  ${ts("import type { Actions } from './$types';")}
883
863
  ${ts("import type { PageServerLoad } from './$types';")}
884
864
  import { auth } from '$lib/server/auth';
885
- ${needsAPIError ? "import { APIError } from 'better-auth';" : ""}
865
+ ${needsAPIError ? "import { APIError } from 'better-auth/api';" : ""}
886
866
 
887
867
  export const load${ts(": PageServerLoad")} = async (event) => {
888
868
  if (event.locals.user) {
@@ -1401,7 +1381,7 @@ var drizzle_default = defineAddon({
1401
1381
  args: ["client"],
1402
1382
  useIdentifiers: true
1403
1383
  });
1404
- const paramObject = create$2({ schema: createIdentifier("schema") });
1384
+ const paramObject = create$1({ schema: createIdentifier("schema") });
1405
1385
  if (options$8.database === "mysql") {
1406
1386
  const mode = options$8.mysql === "planetscale" ? "planetscale" : "default";
1407
1387
  property(paramObject, {
@@ -1512,9 +1492,9 @@ var eslint_default = defineAddon({
1512
1492
  eslintConfigs.push(createSpread(svelteConfig));
1513
1493
  const globalsBrowser = createSpread(parseExpression("globals.browser"));
1514
1494
  const globalsNode = createSpread(parseExpression("globals.node"));
1515
- const globalsObjLiteral = create$2({});
1495
+ const globalsObjLiteral = create$1({});
1516
1496
  globalsObjLiteral.properties = [globalsBrowser, globalsNode];
1517
- const rules = create$2({ "\"no-undef\"": "off" });
1497
+ const rules = create$1({ "\"no-undef\"": "off" });
1518
1498
  if (rules.properties[0].type !== "Property") throw new Error("rules.properties[0].type !== \"Property\"");
1519
1499
  comments.add(rules.properties[0].key, {
1520
1500
  type: "Line",
@@ -1524,13 +1504,13 @@ var eslint_default = defineAddon({
1524
1504
  type: "Line",
1525
1505
  value: " see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors"
1526
1506
  });
1527
- const globalsConfig = create$2({
1507
+ const globalsConfig = create$1({
1528
1508
  languageOptions: { globals: globalsObjLiteral },
1529
1509
  rules: typescript ? rules : void 0
1530
1510
  });
1531
1511
  eslintConfigs.push(globalsConfig);
1532
1512
  if (typescript) {
1533
- const svelteTSParserConfig = create$2({
1513
+ const svelteTSParserConfig = create$1({
1534
1514
  files: [
1535
1515
  "**/*.svelte",
1536
1516
  "**/*.svelte.ts",
@@ -1545,7 +1525,7 @@ var eslint_default = defineAddon({
1545
1525
  });
1546
1526
  eslintConfigs.push(svelteTSParserConfig);
1547
1527
  } else {
1548
- const svelteTSParserConfig = create$2({
1528
+ const svelteTSParserConfig = create$1({
1549
1529
  files: ["**/*.svelte", "**/*.svelte.js"],
1550
1530
  languageOptions: { parserOptions: { svelteConfig: createIdentifier("svelteConfig") } }
1551
1531
  });
@@ -1560,7 +1540,7 @@ var eslint_default = defineAddon({
1560
1540
  tsConfigCall.arguments.push(...eslintConfigs);
1561
1541
  exportExpression = tsConfigCall;
1562
1542
  } else {
1563
- const eslintArray = create$3();
1543
+ const eslintArray = create$2();
1564
1544
  eslintConfigs.map((x) => append(eslintArray, x));
1565
1545
  exportExpression = eslintArray;
1566
1546
  }
@@ -1764,14 +1744,14 @@ var mdsvex_default = defineAddon({
1764
1744
  from: "mdsvex",
1765
1745
  imports: ["mdsvex"]
1766
1746
  });
1767
- const { value: exportDefault } = createDefault(ast, { fallback: create$2({}) });
1747
+ const { value: exportDefault } = createDefault(ast, { fallback: create$1({}) });
1768
1748
  let preprocessorArray = property(exportDefault, {
1769
1749
  name: "preprocess",
1770
- fallback: create$3()
1750
+ fallback: create$2()
1771
1751
  });
1772
1752
  if (!(preprocessorArray.type === "ArrayExpression")) {
1773
1753
  const previousElement = preprocessorArray;
1774
- preprocessorArray = create$3();
1754
+ preprocessorArray = create$2();
1775
1755
  append(preprocessorArray, previousElement);
1776
1756
  overrideProperties(exportDefault, { preprocess: preprocessorArray });
1777
1757
  }
@@ -1782,7 +1762,7 @@ var mdsvex_default = defineAddon({
1782
1762
  append(preprocessorArray, mdsvexCall);
1783
1763
  const extensionsArray = property(exportDefault, {
1784
1764
  name: "extensions",
1785
- fallback: create$3()
1765
+ fallback: create$2()
1786
1766
  });
1787
1767
  append(extensionsArray, ".svelte");
1788
1768
  append(extensionsArray, ".svx");
@@ -2214,14 +2194,14 @@ var sveltekit_adapter_default = defineAddon({
2214
2194
  from: adapter.package,
2215
2195
  as: adapterName
2216
2196
  });
2217
- const { value: config } = createDefault(ast, { fallback: create$2({}) });
2197
+ const { value: config } = createDefault(ast, { fallback: create$1({}) });
2218
2198
  overrideProperties(config, { kit: { adapter: createCall({
2219
2199
  name: adapterName,
2220
2200
  args: [],
2221
2201
  useIdentifiers: true
2222
2202
  }) } });
2223
2203
  if (adapter.package !== "@sveltejs/adapter-auto") {
2224
- const fallback = create$2({});
2204
+ const fallback = create$1({});
2225
2205
  const cfgKitValue = property(config, {
2226
2206
  name: "kit",
2227
2207
  fallback
@@ -2274,10 +2254,11 @@ var sveltekit_adapter_default = defineAddon({
2274
2254
  return generateCode();
2275
2255
  });
2276
2256
  sv.file("src/app.d.ts", (content) => {
2277
- const { ast, generateCode } = parse$1.script(content);
2257
+ const { ast, comments, generateCode } = parse$1.script(content);
2278
2258
  const platform$1 = addGlobalAppInterface(ast, { name: "Platform" });
2279
2259
  if (!platform$1) throw new Error("Failed detecting `platform` interface in `src/app.d.ts`");
2280
- platform$1.body.body.push(createCloudflarePlatformType("env", "Env"), createCloudflarePlatformType("ctx", "ExecutionContext"), createCloudflarePlatformType("caches", "CacheStorage"), createCloudflarePlatformType("cf", "IncomingRequestCfProperties", true));
2260
+ comments.remove((c) => c.type === "Line" && c.value.trim() === "interface Platform {}");
2261
+ platform$1.body.body.push(createTypeProperty("env", "Env"), createTypeProperty("ctx", "ExecutionContext"), createTypeProperty("caches", "CacheStorage"), createTypeProperty("cf", "IncomingRequestCfProperties", true));
2281
2262
  return generateCode();
2282
2263
  });
2283
2264
  }
@@ -2292,27 +2273,6 @@ var sveltekit_adapter_default = defineAddon({
2292
2273
  return toReturn;
2293
2274
  }
2294
2275
  });
2295
- function createCloudflarePlatformType(name$1, value, optional$1 = false) {
2296
- return {
2297
- type: "TSPropertySignature",
2298
- key: {
2299
- type: "Identifier",
2300
- name: name$1
2301
- },
2302
- computed: false,
2303
- optional: optional$1,
2304
- typeAnnotation: {
2305
- type: "TSTypeAnnotation",
2306
- typeAnnotation: {
2307
- type: "TSTypeReference",
2308
- typeName: {
2309
- type: "Identifier",
2310
- name: value
2311
- }
2312
- }
2313
- }
2314
- };
2315
- }
2316
2276
 
2317
2277
  //#endregion
2318
2278
  //#region lib/addons/tailwindcss.ts
@@ -2499,7 +2459,7 @@ var vitest_addon_default = defineAddon({
2499
2459
  }
2500
2460
  sv.file(files.viteConfig, (content) => {
2501
2461
  const { ast, generateCode } = parse$1.script(content);
2502
- const clientObjectExpression = create$2({
2462
+ const clientObjectExpression = create$1({
2503
2463
  extends: `./${files.viteConfig}`,
2504
2464
  test: {
2505
2465
  name: "client",
@@ -2518,7 +2478,7 @@ var vitest_addon_default = defineAddon({
2518
2478
  exclude: ["src/lib/server/**"]
2519
2479
  }
2520
2480
  });
2521
- const serverObjectExpression = create$2({
2481
+ const serverObjectExpression = create$1({
2522
2482
  extends: `./${files.viteConfig}`,
2523
2483
  test: {
2524
2484
  name: "server",
@@ -2530,11 +2490,11 @@ var vitest_addon_default = defineAddon({
2530
2490
  const viteConfig = getConfig(ast);
2531
2491
  const testObject = property(viteConfig, {
2532
2492
  name: "test",
2533
- fallback: create$2({ expect: { requireAssertions: true } })
2493
+ fallback: create$1({ expect: { requireAssertions: true } })
2534
2494
  });
2535
2495
  const workspaceArray = property(testObject, {
2536
2496
  name: "projects",
2537
- fallback: create$3()
2497
+ fallback: create$2()
2538
2498
  });
2539
2499
  if (componentTesting) append(workspaceArray, clientObjectExpression);
2540
2500
  if (unitTesting) append(workspaceArray, serverObjectExpression);
@@ -2777,7 +2737,7 @@ function setupPlaygroundProject(url, playground, cwd$1, installDependencies$1) {
2777
2737
  const svelteConfigPath = path.join(cwd$1, commonFilePaths.svelteConfig);
2778
2738
  const svelteConfig = fs.readFileSync(svelteConfigPath, "utf-8");
2779
2739
  const { ast: ast$1, generateCode: generateCode$1 } = parse$1.script(svelteConfig);
2780
- const { value: config } = createDefault(ast$1, { fallback: create$2({}) });
2740
+ const { value: config } = createDefault(ast$1, { fallback: create$1({}) });
2781
2741
  overrideProperties(config, { compilerOptions: { experimental: { async: true } } });
2782
2742
  fs.writeFileSync(svelteConfigPath, generateCode$1(), "utf-8");
2783
2743
  };
@@ -2884,11 +2844,11 @@ function parseKitOptions(cwd$1, svelteConfigPath) {
2884
2844
  if (!objectExpression) throw new Error(`Unexpected svelte config shape from \`${svelteConfigPath}\``);
2885
2845
  const kit = property(objectExpression, {
2886
2846
  name: "kit",
2887
- fallback: create$2({})
2847
+ fallback: create$1({})
2888
2848
  });
2889
2849
  const files = property(kit, {
2890
2850
  name: "files",
2891
- fallback: create$2({})
2851
+ fallback: create$1({})
2892
2852
  });
2893
2853
  const routes = property(files, {
2894
2854
  name: "routes",
@@ -2907,7 +2867,7 @@ function parseKitOptions(cwd$1, svelteConfigPath) {
2907
2867
  //#endregion
2908
2868
  //#region package.json
2909
2869
  var name = "sv";
2910
- var version = "0.12.1";
2870
+ var version = "0.12.2";
2911
2871
 
2912
2872
  //#endregion
2913
2873
  //#region lib/cli/utils/errors.ts
@@ -3202,7 +3162,7 @@ async function createProject(cwd$1, options$8) {
3202
3162
  loadedAddons = result.loadedAddons;
3203
3163
  answers = result.answers;
3204
3164
  }
3205
- create$1(projectPath, {
3165
+ create$3(projectPath, {
3206
3166
  name: projectName,
3207
3167
  template,
3208
3168
  types: language
package/dist/bin.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { f as program, l as from, r as detectPackageManager, u as Command } from "./package-manager-DYfxv5nk.mjs";
3
- import { ht as resolveCommand, t as color } from "./utils-CnfD6Z1s.mjs";
4
- import { a as helpConfig, i as forwardExitCode, n as add, o as name, r as create, s as version } from "./add-D8995Wsf.mjs";
2
+ import { gt as resolveCommand, t as color } from "./utils-D-OWcBXG.mjs";
3
+ import { f as program, l as from, r as detectPackageManager, u as Command } from "./package-manager-B3sMOeTk.mjs";
4
+ import { a as helpConfig, i as forwardExitCode, n as add, o as name, r as create, s as version } from "./add-RNKqR0_d.mjs";
5
5
  import process from "node:process";
6
6
  import { execSync } from "node:child_process";
7
7