sv 1.0.0-next.7 → 1.0.0

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 { T as getSharedFiles, _ as defineAddon, dt as R, v as defineAddonOptions } from "./engine-w0Kq5hjN.mjs";
1
+ import { T as getSharedFiles, _ as defineAddon, dt as R, v as defineAddonOptions } from "./engine-Do1htOYy.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { Walker, coerceVersion, color, createPrinter, dedent, defineEnv, fileExists, isKit3, loadPackageJson, pnpm, resolveCommandArray, resolveLibPrefix, sanitizeName, svelteConfig, transforms } from "@sveltejs/sv-utils";
@@ -96,59 +96,60 @@ const TOOLS = {
96
96
  hint: "sub-agent"
97
97
  }
98
98
  };
99
+ const options$7 = defineAddonOptions().add("ide", {
100
+ question: "Which client would you like to use?",
101
+ type: "multiselect",
102
+ default: [],
103
+ options: Object.entries(CLIENTS).map(([value, client]) => ({
104
+ value,
105
+ label: client.label
106
+ })),
107
+ required: true
108
+ }).add("delivery", {
109
+ question: "How would you like to add the Svelte tools?",
110
+ type: "select",
111
+ default: "plugin",
112
+ options: [{
113
+ value: "plugin",
114
+ label: "Svelte plugin",
115
+ hint: "recommended, auto-installs & updates"
116
+ }, {
117
+ value: "tools",
118
+ label: "Individual tools",
119
+ hint: "choose exactly what to add"
120
+ }],
121
+ condition: ({ ide }) => ide.some((i) => CLIENTS[i]?.pluginSettings)
122
+ }).add("tools", {
123
+ question: "Which tools would you like to add?",
124
+ type: "multiselect",
125
+ default: Object.keys(TOOLS),
126
+ options: Object.entries(TOOLS).map(([value, t]) => ({
127
+ value,
128
+ label: t.label,
129
+ hint: t.hint
130
+ })),
131
+ required: false,
132
+ condition: ({ ide, delivery }) => ide.some((i) => wantsLooseTools(CLIENTS[i], delivery))
133
+ }).add("mcpSetup", {
134
+ question: "Which MCP setup would you like to use?",
135
+ type: "select",
136
+ default: "remote",
137
+ options: [{
138
+ value: "local",
139
+ label: "Local",
140
+ hint: "will use stdio"
141
+ }, {
142
+ value: "remote",
143
+ label: "Remote",
144
+ hint: "will use a remote endpoint"
145
+ }],
146
+ condition: ({ ide, delivery, tools }) => (tools === void 0 || tools.includes("mcp")) && ide.some((i) => wantsMcpConfig(CLIENTS[i], delivery))
147
+ }).build();
99
148
  var ai_tools_default = defineAddon({
100
149
  id: "ai-tools",
101
150
  shortDescription: "Svelte AI tools",
102
151
  homepage: "https://svelte.dev/docs/ai",
103
- options: defineAddonOptions().add("ide", {
104
- question: "Which client would you like to use?",
105
- type: "multiselect",
106
- default: [],
107
- options: Object.entries(CLIENTS).map(([value, client]) => ({
108
- value,
109
- label: client.label
110
- })),
111
- required: true
112
- }).add("delivery", {
113
- question: "How would you like to add the Svelte tools?",
114
- type: "select",
115
- default: "plugin",
116
- options: [{
117
- value: "plugin",
118
- label: "Svelte plugin",
119
- hint: "recommended, auto-installs & updates"
120
- }, {
121
- value: "tools",
122
- label: "Individual tools",
123
- hint: "choose exactly what to add"
124
- }],
125
- condition: ({ ide }) => ide.some((i) => CLIENTS[i]?.pluginSettings)
126
- }).add("tools", {
127
- question: "Which tools would you like to add?",
128
- type: "multiselect",
129
- default: Object.keys(TOOLS),
130
- options: Object.entries(TOOLS).map(([value, t]) => ({
131
- value,
132
- label: t.label,
133
- hint: t.hint
134
- })),
135
- required: false,
136
- condition: ({ ide, delivery }) => ide.some((i) => wantsLooseTools(CLIENTS[i], delivery))
137
- }).add("mcpSetup", {
138
- question: "Which MCP setup would you like to use?",
139
- type: "select",
140
- default: "remote",
141
- options: [{
142
- value: "local",
143
- label: "Local",
144
- hint: "will use stdio"
145
- }, {
146
- value: "remote",
147
- label: "Remote",
148
- hint: "will use a remote endpoint"
149
- }],
150
- condition: ({ ide, delivery, tools }) => (tools === void 0 || tools.includes("mcp")) && ide.some((i) => wantsMcpConfig(CLIENTS[i], delivery))
151
- }).build(),
152
+ options: options$7,
152
153
  run: ({ sv, options }) => {
153
154
  const usePlugin = options.delivery === "plugin";
154
155
  const selected = options.tools ?? Object.keys(TOOLS);
@@ -280,9 +281,10 @@ const addEslintConfigPrettier = transforms.script(({ ast, js }) => {
280
281
  const eslintConfig = js.exports.createDefault(ast, { fallback: fallbackConfig }).value;
281
282
  let elements = [];
282
283
  if (eslintConfig.type === "ArrayExpression") elements = eslintConfig.elements;
283
- else if (eslintConfig.type === "CallExpression") if (eslintConfig.arguments.length === 1 && eslintConfig.arguments[0].type === "ArrayExpression") elements = eslintConfig.arguments[0].elements;
284
- else elements = eslintConfig.arguments;
285
- else return false;
284
+ else if (eslintConfig.type === "CallExpression") {
285
+ if (eslintConfig.arguments.length === 1 && eslintConfig.arguments[0].type === "ArrayExpression") elements = eslintConfig.arguments[0].elements;
286
+ else elements = eslintConfig.arguments;
287
+ } else return false;
286
288
  const prettier = js.common.parseExpression("prettier");
287
289
  const sveltePrettierConfig = js.common.parseExpression(`${svelteImportName}.configs.prettier`);
288
290
  const nodesToInsert = [];
@@ -380,7 +382,7 @@ function getNodeTypesVersion() {
380
382
  return `^${isEvenMajor ? majorNum - 2 : majorNum - 1}`;
381
383
  }
382
384
  //#endregion
383
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/taggedTemplateLiteral.js
385
+ //#region \0@oxc-project+runtime@0.150.0/helpers/esm/taggedTemplateLiteral.js
384
386
  function _taggedTemplateLiteral(e, t) {
385
387
  return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } }));
386
388
  }
@@ -388,23 +390,24 @@ function _taggedTemplateLiteral(e, t) {
388
390
  //#region src/addons/better-auth.ts
389
391
  var _templateObject$1;
390
392
  var _templateObject2;
393
+ const options$6 = defineAddonOptions().add("demo", {
394
+ question: "Which demo would you like to include?",
395
+ type: "multiselect",
396
+ default: ["password"],
397
+ options: [{
398
+ value: "password",
399
+ label: "Email & Password"
400
+ }, {
401
+ value: "github",
402
+ label: "GitHub OAuth"
403
+ }],
404
+ required: false
405
+ }).build();
391
406
  var better_auth_default = defineAddon({
392
407
  id: "better-auth",
393
408
  shortDescription: "auth library",
394
409
  homepage: "https://www.better-auth.com",
395
- options: defineAddonOptions().add("demo", {
396
- question: "Which demo would you like to include?",
397
- type: "multiselect",
398
- default: ["password"],
399
- options: [{
400
- value: "password",
401
- label: "Email & Password"
402
- }, {
403
- value: "github",
404
- label: "GitHub OAuth"
405
- }],
406
- required: false
407
- }).build(),
410
+ options: options$6,
408
411
  setup: ({ isKit, dependencyVersion, unsupported, dependsOn, runsAfter }) => {
409
412
  if (!isKit) unsupported("Requires SvelteKit");
410
413
  if (!dependencyVersion("drizzle-orm")) dependsOn("drizzle");
@@ -583,11 +586,12 @@ var better_auth_default = defineAddon({
583
586
  from: `${lib}/server/auth.${language}`
584
587
  });
585
588
  env.importEnv(ast, js, ["building"]);
586
- const handleContent = dedent`
587
- async ({ event, resolve }) => {${d1 ? dedent`
589
+ const d1HandleSetup = d1 ? dedent`
588
590
  if (!event.platform?.env?.DB) throw new Error('D1 binding "DB" not found - are you running with wrangler?');
589
591
  event.locals.auth = createAuth(event.platform.env.DB);
590
- const { auth } = event.locals;\n` : ""}
592
+ const { auth } = event.locals;\n` : "";
593
+ const handleContent = dedent`
594
+ async ({ event, resolve }) => {${d1HandleSetup}
591
595
  // Fetch current session from Better Auth
592
596
  const session = await auth.api.getSession({
593
597
  headers: event.request.headers
@@ -835,101 +839,102 @@ const PORTS = {
835
839
  sqlite: "",
836
840
  d1: ""
837
841
  };
842
+ const options$5 = defineAddonOptions().add("database", {
843
+ question: "Which database would you like to use?",
844
+ type: "select",
845
+ default: "sqlite",
846
+ options: [
847
+ {
848
+ value: "postgresql",
849
+ label: "PostgreSQL"
850
+ },
851
+ {
852
+ value: "mysql",
853
+ label: "MySQL"
854
+ },
855
+ {
856
+ value: "sqlite",
857
+ label: "SQLite"
858
+ },
859
+ {
860
+ value: "d1",
861
+ label: "Cloudflare D1"
862
+ }
863
+ ]
864
+ }).add("postgresql", {
865
+ question: "Which PostgreSQL client would you like to use?",
866
+ type: "select",
867
+ group: "client",
868
+ default: "postgres.js",
869
+ options: [{
870
+ value: "postgres.js",
871
+ label: "Postgres.JS",
872
+ hint: "recommended for most users"
873
+ }, {
874
+ value: "neon",
875
+ label: "Neon",
876
+ hint: "popular hosted platform"
877
+ }],
878
+ condition: ({ database }) => database === "postgresql"
879
+ }).add("mysql", {
880
+ question: "Which MySQL client would you like to use?",
881
+ type: "select",
882
+ group: "client",
883
+ default: "mysql2",
884
+ options: [{
885
+ value: "mysql2",
886
+ hint: "recommended for most users"
887
+ }, {
888
+ value: "planetscale",
889
+ label: "PlanetScale",
890
+ hint: "popular hosted platform"
891
+ }],
892
+ condition: ({ database }) => database === "mysql"
893
+ }).add("sqlite", {
894
+ question: "Which SQLite client would you like to use?",
895
+ type: "select",
896
+ group: "client",
897
+ default: "libsql",
898
+ options: [
899
+ {
900
+ value: "node-sqlite",
901
+ label: "node:sqlite",
902
+ hint: "built-in to Node.js and Deno"
903
+ },
904
+ {
905
+ value: "better-sqlite3",
906
+ hint: "for server environments"
907
+ },
908
+ {
909
+ value: "libsql",
910
+ label: "libSQL",
911
+ hint: "for serverless environments"
912
+ },
913
+ {
914
+ value: "turso",
915
+ label: "Turso",
916
+ hint: "popular hosted platform"
917
+ }
918
+ ],
919
+ condition: ({ database }) => database === "sqlite"
920
+ }).add("docker", {
921
+ question: "Do you want to run the database locally with docker-compose?",
922
+ default: false,
923
+ type: "boolean",
924
+ condition: ({ database, mysql, postgresql }) => database === "mysql" && mysql === "mysql2" || database === "postgresql" && postgresql === "postgres.js"
925
+ }).build();
838
926
  var drizzle_default = defineAddon({
839
927
  id: "drizzle",
840
928
  shortDescription: "database orm",
841
929
  homepage: "https://orm.drizzle.team",
842
- options: defineAddonOptions().add("database", {
843
- question: "Which database would you like to use?",
844
- type: "select",
845
- default: "sqlite",
846
- options: [
847
- {
848
- value: "postgresql",
849
- label: "PostgreSQL"
850
- },
851
- {
852
- value: "mysql",
853
- label: "MySQL"
854
- },
855
- {
856
- value: "sqlite",
857
- label: "SQLite"
858
- },
859
- {
860
- value: "d1",
861
- label: "Cloudflare D1"
862
- }
863
- ]
864
- }).add("postgresql", {
865
- question: "Which PostgreSQL client would you like to use?",
866
- type: "select",
867
- group: "client",
868
- default: "postgres.js",
869
- options: [{
870
- value: "postgres.js",
871
- label: "Postgres.JS",
872
- hint: "recommended for most users"
873
- }, {
874
- value: "neon",
875
- label: "Neon",
876
- hint: "popular hosted platform"
877
- }],
878
- condition: ({ database }) => database === "postgresql"
879
- }).add("mysql", {
880
- question: "Which MySQL client would you like to use?",
881
- type: "select",
882
- group: "client",
883
- default: "mysql2",
884
- options: [{
885
- value: "mysql2",
886
- hint: "recommended for most users"
887
- }, {
888
- value: "planetscale",
889
- label: "PlanetScale",
890
- hint: "popular hosted platform"
891
- }],
892
- condition: ({ database }) => database === "mysql"
893
- }).add("sqlite", {
894
- question: "Which SQLite client would you like to use?",
895
- type: "select",
896
- group: "client",
897
- default: "libsql",
898
- options: [
899
- {
900
- value: "node-sqlite",
901
- label: "node:sqlite",
902
- hint: "built-in to Node.js and Deno"
903
- },
904
- {
905
- value: "better-sqlite3",
906
- hint: "for server environments"
907
- },
908
- {
909
- value: "libsql",
910
- label: "libSQL",
911
- hint: "for serverless environments"
912
- },
913
- {
914
- value: "turso",
915
- label: "Turso",
916
- hint: "popular hosted platform"
917
- }
918
- ],
919
- condition: ({ database }) => database === "sqlite"
920
- }).add("docker", {
921
- question: "Do you want to run the database locally with docker-compose?",
922
- default: false,
923
- type: "boolean",
924
- condition: ({ database, mysql, postgresql }) => database === "mysql" && mysql === "mysql2" || database === "postgresql" && postgresql === "postgres.js"
925
- }).build(),
930
+ options: options$5,
926
931
  setup: ({ isKit, unsupported, runsAfter }) => {
927
932
  runsAfter("prettier");
928
933
  runsAfter("sveltekitAdapter");
929
934
  runsAfter("experimental");
930
935
  if (!isKit) return unsupported("Requires SvelteKit");
931
936
  },
932
- run: ({ sv, language, options, directory, dependencyVersion, cwd, cancel, file }) => {
937
+ run: ({ sv, language, options, directory, dependencyVersion, cwd, cancel, file, packageManager }) => {
933
938
  const [ts] = createPrinter(language === "ts");
934
939
  const baseDBPath = path.resolve(cwd, directory.lib, "server", "db");
935
940
  const paths = {
@@ -950,6 +955,10 @@ var drizzle_default = defineAddon({
950
955
  sv.devDependency("@types/better-sqlite3", "^9.6.0");
951
956
  }
952
957
  if (options.sqlite === "libsql" || options.sqlite === "turso") sv.devDependency("@libsql/client", "^0.17.3");
958
+ if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds({
959
+ cwd,
960
+ packages: ["esbuild"]
961
+ }));
953
962
  sv.file(".env", generateEnv(options, false));
954
963
  sv.file(".env.example", generateEnv(options, true));
955
964
  if (options.docker && (options.mysql === "mysql2" || options.postgresql === "postgres.js")) {
@@ -1298,20 +1307,21 @@ const generateEnv = (opts, isExample) => transforms.text(({ content, text }) =>
1298
1307
  "libsql",
1299
1308
  "node-sqlite"
1300
1309
  ].includes(opts.sqlite)) value = opts.sqlite === "libsql" ? "file:local.db" : "local.db";
1301
- else if (opts.sqlite === "turso") if (isExample) {
1302
- value = "\"libsql://db-name-user.turso.io\"";
1303
- comment.push("Replace with your DB credentials!", {
1304
- text: "A local DB can also be used in dev as well",
1305
- mode: "append"
1306
- }, {
1307
- text: `${DB_URL_KEY}="file:local.db"`,
1308
- mode: "append"
1309
- });
1310
- } else {
1311
- value = "\"file:local.db\"";
1312
- comment.push("Replace with your DB credentials!", `${DB_URL_KEY}="libsql://db-name-user.turso.io"`, "A local DB can also be used in dev as well");
1313
- }
1314
- else if (opts.database === "mysql") {
1310
+ else if (opts.sqlite === "turso") {
1311
+ if (isExample) {
1312
+ value = "\"libsql://db-name-user.turso.io\"";
1313
+ comment.push("Replace with your DB credentials!", {
1314
+ text: "A local DB can also be used in dev as well",
1315
+ mode: "append"
1316
+ }, {
1317
+ text: `${DB_URL_KEY}="file:local.db"`,
1318
+ mode: "append"
1319
+ });
1320
+ } else {
1321
+ value = "\"file:local.db\"";
1322
+ comment.push("Replace with your DB credentials!", `${DB_URL_KEY}="libsql://db-name-user.turso.io"`, "A local DB can also be used in dev as well");
1323
+ }
1324
+ } else if (opts.database === "mysql") {
1315
1325
  value = "\"mysql://user:password@host:port/db-name\"";
1316
1326
  comment.push("Replace with your DB credentials!");
1317
1327
  } else if (opts.database === "postgresql") {
@@ -1327,6 +1337,52 @@ const generateEnv = (opts, isExample) => transforms.text(({ content, text }) =>
1327
1337
  return content;
1328
1338
  });
1329
1339
  //#endregion
1340
+ //#region src/addons/enhanced-img.ts
1341
+ const REGEX_IMPORTED_IMG = /import (\w+) from '([^']+\.(?:png|jpe?g|webp|avif|gif))';/g;
1342
+ const REGEX_REGEX_CHARS = /[.*+?^${}()|[\]\\]/g;
1343
+ function escapeRegex(value) {
1344
+ return value.replace(REGEX_REGEX_CHARS, "\\$&");
1345
+ }
1346
+ var enhanced_img_default = defineAddon({
1347
+ id: "enhanced-img",
1348
+ shortDescription: "image optimization",
1349
+ homepage: "https://svelte.dev/docs/kit/images",
1350
+ options: {},
1351
+ run: ({ sv, file, packageManager, cwd }) => {
1352
+ sv.devDependency("@sveltejs/enhanced-img", "^1.0.0");
1353
+ if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds({
1354
+ cwd,
1355
+ packages: ["sharp"]
1356
+ }));
1357
+ sv.files({
1358
+ include: "src/**/*.svelte",
1359
+ where: (content) => content.includes("<img")
1360
+ }, transforms.text(({ content }) => {
1361
+ let next = content;
1362
+ for (const [statement, binding, src] of content.matchAll(REGEX_IMPORTED_IMG)) {
1363
+ const tag = new RegExp(`<img([^>]*?)src=\\{${binding}\\}`, "g");
1364
+ if (!tag.test(next)) continue;
1365
+ const importLine = new RegExp(`[ \\t]*${escapeRegex(statement)}\\r?\\n?`);
1366
+ const unused = !new RegExp(`(?<![\\w"'./-])${binding}\\b`).test(content.replace(importLine, "").replaceAll(tag, ""));
1367
+ next = next.replaceAll(tag, `<enhanced:img$1src="${src}"`);
1368
+ if (unused) next = next.replace(importLine, "");
1369
+ }
1370
+ return next === content ? false : next;
1371
+ }));
1372
+ sv.file(file.viteConfig, transforms.script(({ ast, js }) => {
1373
+ js.imports.addNamed(ast, {
1374
+ imports: ["enhancedImages"],
1375
+ from: "@sveltejs/enhanced-img"
1376
+ });
1377
+ js.vite.addPlugin(ast, {
1378
+ code: "enhancedImages()",
1379
+ mode: "prepend"
1380
+ });
1381
+ }));
1382
+ },
1383
+ nextSteps: () => [`Imported images now use ${color.command("`<enhanced:img>`")}`, `Docs: ${color.website("https://svelte.dev/docs/kit/images")}`]
1384
+ });
1385
+ //#endregion
1330
1386
  //#region src/addons/eslint.ts
1331
1387
  var eslint_default = defineAddon({
1332
1388
  id: "eslint",
@@ -1483,21 +1539,22 @@ const FEATURES = {
1483
1539
  off: true
1484
1540
  }
1485
1541
  };
1542
+ const options$4 = defineAddonOptions().add("features", {
1543
+ question: "Which experimental features do you want to enable?",
1544
+ type: "multiselect",
1545
+ default: Object.entries(FEATURES).filter(([, f]) => !f.off).map(([value]) => value),
1546
+ options: Object.entries(FEATURES).map(([value, { label, hint }]) => ({
1547
+ value,
1548
+ label,
1549
+ hint
1550
+ })),
1551
+ required: false
1552
+ }).build();
1486
1553
  var experimental_default = defineAddon({
1487
1554
  id: "experimental",
1488
1555
  shortDescription: "svelte & kit experimental features",
1489
1556
  homepage: "https://svelte.dev/docs/kit/configuration#experimental",
1490
- options: defineAddonOptions().add("features", {
1491
- question: "Which experimental features do you want to enable?",
1492
- type: "multiselect",
1493
- default: Object.entries(FEATURES).filter(([, f]) => !f.off).map(([value]) => value),
1494
- options: Object.entries(FEATURES).map(([value, { label, hint }]) => ({
1495
- value,
1496
- label,
1497
- hint
1498
- })),
1499
- required: false
1500
- }).build(),
1557
+ options: options$4,
1501
1558
  run: ({ sv, cwd, options }) => {
1502
1559
  const config = {};
1503
1560
  for (const [name, f] of Object.entries(FEATURES)) {
@@ -1564,11 +1621,13 @@ const options$3 = defineAddonOptions().add("languageTags", {
1564
1621
  validate(input) {
1565
1622
  if (!input) return;
1566
1623
  const { invalidLanguageTags, validLanguageTags } = parseLanguageTagInput(input);
1567
- if (invalidLanguageTags.length > 0) if (invalidLanguageTags.length === 1) return `The input "${invalidLanguageTags[0]}" is not a valid IETF BCP 47 language tag`;
1568
- else return `The inputs ${new Intl.ListFormat("en", {
1569
- style: "long",
1570
- type: "conjunction"
1571
- }).format(invalidLanguageTags.map((x) => `"${x}"`))} are not valid BCP47 language tags`;
1624
+ if (invalidLanguageTags.length > 0) {
1625
+ if (invalidLanguageTags.length === 1) return `The input "${invalidLanguageTags[0]}" is not a valid IETF BCP 47 language tag`;
1626
+ else return `The inputs ${new Intl.ListFormat("en", {
1627
+ style: "long",
1628
+ type: "conjunction"
1629
+ }).format(invalidLanguageTags.map((x) => `"${x}"`))} are not valid BCP47 language tags`;
1630
+ }
1572
1631
  if (validLanguageTags.length === 0) return "Please enter at least one valid BCP47 language tag. Eg: en";
1573
1632
  }
1574
1633
  }).add("demo", {
@@ -1885,62 +1944,65 @@ const adapters = [
1885
1944
  {
1886
1945
  id: "auto",
1887
1946
  package: "@sveltejs/adapter-auto",
1888
- version: "^8.0.0-next.3"
1947
+ version: "^8.0.0"
1889
1948
  },
1890
1949
  {
1891
1950
  id: "node",
1892
1951
  package: "@sveltejs/adapter-node",
1893
- version: "^6.0.0-next.10"
1952
+ version: "^6.0.0"
1894
1953
  },
1895
1954
  {
1896
1955
  id: "static",
1897
1956
  package: "@sveltejs/adapter-static",
1898
- version: "^4.0.0-next.4"
1957
+ version: "^4.0.0"
1899
1958
  },
1900
1959
  {
1901
1960
  id: "vercel",
1902
1961
  package: "@sveltejs/adapter-vercel",
1903
- version: "^7.0.0-next.6"
1962
+ version: "^7.0.0"
1904
1963
  },
1905
1964
  {
1906
1965
  id: "cloudflare",
1907
1966
  package: "@sveltejs/adapter-cloudflare",
1908
- version: "^8.0.0-next.6"
1967
+ version: "^8.0.0"
1909
1968
  },
1910
1969
  {
1911
1970
  id: "netlify",
1912
1971
  package: "@sveltejs/adapter-netlify",
1913
- version: "^7.0.0-next.8"
1972
+ version: "^7.0.0"
1914
1973
  }
1915
1974
  ];
1975
+ /** The README blockquote pointing at the adapters docs, only relevant while on `adapter-auto`. */
1976
+ const ADAPTER_HINT_REGEX = /(?:\r?\n)*^> [^\r\n]*\(https:\/\/svelte\.dev\/docs\/kit\/adapters\)[^\r\n]*$/m;
1977
+ const options$2 = defineAddonOptions().add("adapter", {
1978
+ type: "select",
1979
+ question: "Which SvelteKit adapter would you like to use?",
1980
+ default: "auto",
1981
+ options: adapters.map((p) => ({
1982
+ value: p.id,
1983
+ label: p.id,
1984
+ hint: p.package
1985
+ }))
1986
+ }).add("cfTarget", {
1987
+ condition: (options) => options.adapter === "cloudflare",
1988
+ type: "select",
1989
+ question: "Are you deploying to Workers (assets) or Pages?",
1990
+ default: "workers",
1991
+ options: [{
1992
+ value: "workers",
1993
+ label: "Workers",
1994
+ hint: "Recommended way to deploy to Cloudflare"
1995
+ }, {
1996
+ value: "pages",
1997
+ label: "Pages"
1998
+ }]
1999
+ }).build();
1916
2000
  var sveltekit_adapter_default = defineAddon({
1917
2001
  id: "sveltekit-adapter",
1918
2002
  alias: "adapter",
1919
2003
  shortDescription: "deployment",
1920
2004
  homepage: "https://svelte.dev/docs/kit/adapters",
1921
- options: defineAddonOptions().add("adapter", {
1922
- type: "select",
1923
- question: "Which SvelteKit adapter would you like to use?",
1924
- default: "auto",
1925
- options: adapters.map((p) => ({
1926
- value: p.id,
1927
- label: p.id,
1928
- hint: p.package
1929
- }))
1930
- }).add("cfTarget", {
1931
- condition: (options) => options.adapter === "cloudflare",
1932
- type: "select",
1933
- question: "Are you deploying to Workers (assets) or Pages?",
1934
- default: "workers",
1935
- options: [{
1936
- value: "workers",
1937
- label: "Workers",
1938
- hint: "Recommended way to deploy to Cloudflare"
1939
- }, {
1940
- value: "pages",
1941
- label: "Pages"
1942
- }]
1943
- }).build(),
2005
+ options: options$2,
1944
2006
  setup: ({ isKit, unsupported }) => {
1945
2007
  if (!isKit) unsupported("Requires SvelteKit");
1946
2008
  },
@@ -1955,6 +2017,7 @@ var sveltekit_adapter_default = defineAddon({
1955
2017
  }
1956
2018
  }));
1957
2019
  sv.devDependency(adapter.package, adapter.version);
2020
+ if (adapter.package !== "@sveltejs/adapter-auto") sv.file("README.md", transforms.text(({ content }) => content.replace(ADAPTER_HINT_REGEX, "")));
1958
2021
  svelteConfig.edit({
1959
2022
  sv,
1960
2023
  cwd
@@ -1977,11 +2040,17 @@ var sveltekit_adapter_default = defineAddon({
1977
2040
  });
1978
2041
  if (adapter.package === "@sveltejs/adapter-cloudflare") {
1979
2042
  sv.devDependency("wrangler", "^4.97.0");
1980
- if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds("workerd"));
2043
+ if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds({
2044
+ cwd,
2045
+ packages: ["workerd"]
2046
+ }));
1981
2047
  const ext = fileExists(cwd, "wrangler.toml") ? "toml" : "jsonc";
1982
2048
  const applyWranglerConfig = (data) => {
1983
2049
  if (ext === "jsonc") data.$schema ??= "./node_modules/wrangler/config-schema.json";
1984
- if (!data.name) data.name = sanitizeName(loadPackageJson(cwd).data.name, "wrangler");
2050
+ if (!data.name) {
2051
+ const pkg = loadPackageJson(cwd);
2052
+ data.name = sanitizeName(pkg.data.name, "wrangler");
2053
+ }
1985
2054
  data.compatibility_date ??= (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
1986
2055
  data.compatibility_flags ??= [];
1987
2056
  if (!data.compatibility_flags.includes("nodejs_compat") && !data.compatibility_flags.includes("nodejs_als")) data.compatibility_flags.push("nodejs_als");
@@ -1994,9 +2063,7 @@ var sveltekit_adapter_default = defineAddon({
1994
2063
  data.workers_dev = true;
1995
2064
  data.preview_urls = true;
1996
2065
  break;
1997
- case "pages":
1998
- data.pages_build_output_dir = ".svelte-kit/cloudflare";
1999
- break;
2066
+ case "pages": data.pages_build_output_dir = ".svelte-kit/cloudflare";
2000
2067
  }
2001
2068
  };
2002
2069
  sv.file(`wrangler.${ext}`, ext === "toml" ? transforms.toml(({ data }) => applyWranglerConfig(data)) : transforms.json(({ data }) => applyWranglerConfig(data)));
@@ -2037,22 +2104,23 @@ const plugins = [{
2037
2104
  package: "@tailwindcss/forms",
2038
2105
  version: "^0.5.11"
2039
2106
  }];
2107
+ const options$1 = defineAddonOptions().add("plugins", {
2108
+ type: "multiselect",
2109
+ question: "Which plugins would you like to add?",
2110
+ options: plugins.map((p) => ({
2111
+ value: p.id,
2112
+ label: p.id,
2113
+ hint: p.package
2114
+ })),
2115
+ default: [],
2116
+ required: false
2117
+ }).build();
2040
2118
  var tailwindcss_default = defineAddon({
2041
2119
  id: "tailwindcss",
2042
2120
  alias: "tailwind",
2043
2121
  shortDescription: "css framework",
2044
2122
  homepage: "https://tailwindcss.com",
2045
- options: defineAddonOptions().add("plugins", {
2046
- type: "multiselect",
2047
- question: "Which plugins would you like to add?",
2048
- options: plugins.map((p) => ({
2049
- value: p.id,
2050
- label: p.id,
2051
- hint: p.package
2052
- })),
2053
- default: [],
2054
- required: false
2055
- }).build(),
2123
+ options: options$1,
2056
2124
  run: ({ sv, options, file, isKit, directory, dependencyVersion, language }) => {
2057
2125
  const prettierInstalled = Boolean(dependencyVersion("prettier"));
2058
2126
  sv.devDependency("tailwindcss", "^4.3.0");
@@ -2288,6 +2356,7 @@ const officialAddons = {
2288
2356
  }),
2289
2357
  playwright: playwright_default,
2290
2358
  tailwindcss: tailwindcss_default,
2359
+ enhancedImg: enhanced_img_default,
2291
2360
  sveltekitAdapter: sveltekit_adapter_default,
2292
2361
  drizzle: drizzle_default,
2293
2362
  betterAuth: better_auth_default,