vela 0.16.0 → 0.17.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.
package/dist/bin.js CHANGED
@@ -20,7 +20,7 @@ import dotenv2 from "dotenv";
20
20
  // package.json
21
21
  var package_default = {
22
22
  name: "vela",
23
- version: "0.16.0",
23
+ version: "0.17.0",
24
24
  type: "module",
25
25
  description: "A CLI for creating and updating SvelteKit projects",
26
26
  license: "MIT",
@@ -57,7 +57,7 @@ var package_default = {
57
57
  dependencies: {
58
58
  "@clack/prompts": "^1.7.0",
59
59
  "@faker-js/faker": "^10.6.0",
60
- "@velastack/patterns": "^0.5.0",
60
+ "@velastack/patterns": "^0.6.0",
61
61
  "@velastack/pocketbase-codegen": "^0.1.0",
62
62
  "@velastack/schema": "^0.3.0",
63
63
  "@velastack/schema-ui": "^0.3.1",
@@ -300,8 +300,8 @@ function dropTemplateAdapters(user, template) {
300
300
  }
301
301
  return copy;
302
302
  }
303
- function readPackageJson(path66) {
304
- return JSON.parse(fs2.readFileSync(path66, "utf8"));
303
+ function readPackageJson(path68) {
304
+ return JSON.parse(fs2.readFileSync(path68, "utf8"));
305
305
  }
306
306
  var PACKAGE_NAME_PLACEHOLDER = /~TODO~/g;
307
307
  var APP_NAME_PLACEHOLDER = /~APP_NAME~/g;
@@ -330,12 +330,12 @@ function jsString(value) {
330
330
  const quote2 = count("'") > count('"') ? '"' : "'";
331
331
  return `${quote2}${escapeFor(quote2, value)}${quote2}`;
332
332
  }
333
- function readTemplatePackageJson(path66, values) {
334
- const raw = fillTemplatePlaceholders(fs2.readFileSync(path66, "utf8"), values);
333
+ function readTemplatePackageJson(path68, values) {
334
+ const raw = fillTemplatePlaceholders(fs2.readFileSync(path68, "utf8"), values);
335
335
  return JSON.parse(raw);
336
336
  }
337
- function writePackageJson(path66, pkg) {
338
- fs2.writeFileSync(path66, JSON.stringify(pkg, null, " ") + "\n");
337
+ function writePackageJson(path68, pkg) {
338
+ fs2.writeFileSync(path68, JSON.stringify(pkg, null, " ") + "\n");
339
339
  }
340
340
  function toValidPackageName(name) {
341
341
  return name.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9~.-]+/g, "-");
@@ -3750,6 +3750,12 @@ async function seedSite(apiKey, projectId, input) {
3750
3750
  body: JSON.stringify(input)
3751
3751
  });
3752
3752
  }
3753
+ async function createProjectForms(apiKey, projectId, forms) {
3754
+ return apiFetch(apiKey, `/v1/projects/${projectId}/forms`, {
3755
+ method: "POST",
3756
+ body: JSON.stringify({ forms })
3757
+ });
3758
+ }
3753
3759
  async function destroyEnvironment(apiKey, projectId, envTag) {
3754
3760
  return apiFetch(apiKey, `/v1/projects/${projectId}/environments/${encodeURIComponent(envTag)}`, {
3755
3761
  method: "DELETE"
@@ -7578,26 +7584,94 @@ var teams = new Command18("teams").description("enable team / multi-tenant suppo
7578
7584
  );
7579
7585
 
7580
7586
  // src/commands/enable/payments.ts
7587
+ import fs35 from "node:fs";
7588
+ import path35 from "node:path";
7581
7589
  import process19 from "node:process";
7582
7590
  import { Command as Command19 } from "commander";
7583
7591
  import * as p21 from "@clack/prompts";
7584
- var payments = new Command19("payments").description("enable payments (Stripe or Shopify)").option("--provider <provider>", "payment provider: stripe or shopify").allowExcessArguments(true).configureHelp(helpConfig).action(
7592
+
7593
+ // src/lib/order-form.ts
7594
+ import fs34 from "node:fs";
7595
+ import path34 from "node:path";
7596
+ var ORDER_FORM_KEY = "order";
7597
+ var ORDER_FORM_NAME = "Orders";
7598
+ var HOSTED_CMS = /^(https?:\/\/[^/]+)\/v1\/projects\/([^/?#]+)\/cms\/?$/;
7599
+ function hostedCmsProject(root) {
7600
+ let source;
7601
+ try {
7602
+ source = fs34.readFileSync(path34.join(root, "src", "lib", "cms.ts"), "utf8");
7603
+ } catch {
7604
+ return null;
7605
+ }
7606
+ const endpoint = /\bendpoint:\s*['"]([^'"]+)['"]/.exec(source)?.[1];
7607
+ const match = endpoint ? HOSTED_CMS.exec(endpoint) : null;
7608
+ return match ? { origin: match[1], projectId: match[2] } : null;
7609
+ }
7610
+ function orderFormUrl(origin, projectId) {
7611
+ return `${origin}/v1/projects/${projectId}/forms/${ORDER_FORM_KEY}`;
7612
+ }
7613
+ async function ensureOrderForm(root, deps = { readApiKey, createForms: createProjectForms }) {
7614
+ const linked = readProjectConfig(root);
7615
+ const project = linked ? { origin: API_URL, projectId: linked.projectId } : hostedCmsProject(root);
7616
+ if (!project) {
7617
+ return {
7618
+ kind: "skipped",
7619
+ note: "Orders are not recorded until PUBLIC_WHATSAPP_ORDER_FORM is set: link the project to velastack.dev (`vela link`), then run `vela enable payments --provider whatsapp` again."
7620
+ };
7621
+ }
7622
+ const apiKey = deps.readApiKey();
7623
+ if (!apiKey) {
7624
+ return {
7625
+ kind: "skipped",
7626
+ note: "Orders are not recorded until PUBLIC_WHATSAPP_ORDER_FORM is set: run `vela login`, then `vela enable payments --provider whatsapp` again."
7627
+ };
7628
+ }
7629
+ let origins;
7630
+ try {
7631
+ ({ origins = [] } = await deps.createForms(apiKey, project.projectId, [
7632
+ { key: ORDER_FORM_KEY, name: ORDER_FORM_NAME }
7633
+ ]));
7634
+ } catch (error) {
7635
+ const reason = error instanceof ApiError ? `velastack.dev answered ${error.status}` : String(error);
7636
+ return {
7637
+ kind: "skipped",
7638
+ note: `Could not create the hosted order form (${reason}). Add a form keyed "${ORDER_FORM_KEY}" to the project on velastack.dev, then set PUBLIC_WHATSAPP_ORDER_FORM=${orderFormUrl(project.origin, project.projectId)}.`
7639
+ };
7640
+ }
7641
+ const url = orderFormUrl(project.origin, project.projectId);
7642
+ return origins.length > 0 ? {
7643
+ kind: "created",
7644
+ url,
7645
+ note: `The project's forms accept posts only from ${origins.join(", ")} (and localhost). If the site is served from another domain, add it on velastack.dev, or its orders are refused.`
7646
+ } : { kind: "created", url };
7647
+ }
7648
+
7649
+ // src/commands/enable/payments.ts
7650
+ var payments = new Command19("payments").description("enable payments (Stripe, Shopify or WhatsApp)").option("--provider <provider>", "payment provider: stripe, shopify or whatsapp").option(
7651
+ "--currency <code>",
7652
+ "WhatsApp: the business's currency, an ISO 4217 code such as MXN (kept in src/lib/site.ts)"
7653
+ ).allowExcessArguments(true).configureHelp(helpConfig).action(
7585
7654
  (opts, cmd) => runCommand(async () => {
7586
7655
  const provider = await resolveProvider("enable-payments", opts.provider);
7587
7656
  await assertPatternRequires("enable-payments", provider.id);
7588
7657
  if (provider.id === "stripe") assertBackendReady("vela enable payments");
7589
7658
  if (provider.id === "stripe") noteWebhookSecret();
7659
+ const currency = provider.id === "whatsapp" ? await askCurrency(opts.currency) : void 0;
7660
+ const orderForm = provider.id === "whatsapp" ? await prepareOrderForm() : [];
7590
7661
  const providerEnv = await collectProviderEnv(provider);
7591
- const demoId = await askDemoId(provider);
7592
- const blank = missingEnvKeys(provider, providerEnv);
7662
+ const demoId = provider.id === "whatsapp" ? "" : await askDemoId(provider);
7663
+ const blank = missingEnvKeys(provider, providerEnv).filter(
7664
+ (key) => !(key === "PUBLIC_WHATSAPP_ORDER_FORM" && orderForm.length > 0)
7665
+ );
7593
7666
  await runPattern(
7594
7667
  "enable-payments",
7595
7668
  cmd.args,
7596
- { provider: provider.id, providerEnv, demoId },
7669
+ { provider: provider.id, providerEnv, demoId, currency },
7597
7670
  {
7598
7671
  summary: `Enabled ${provider.label} payments.`,
7599
7672
  nextSteps: [
7600
7673
  ...blank.map((key) => `Set ${key} in .env.`),
7674
+ ...orderForm,
7601
7675
  ...NEXT_STEPS[provider.id],
7602
7676
  "Set the same variables on each deploy target with `vela env set`."
7603
7677
  ],
@@ -7619,8 +7693,46 @@ var NEXT_STEPS = {
7619
7693
  shopify: [
7620
7694
  "Run `vela dev` and visit /payment to try the Buy button (it is there when you gave a variant).",
7621
7695
  "Products, prices and checkout settings live in Shopify admin."
7696
+ ],
7697
+ whatsapp: [
7698
+ 'Put `<OrderButton name="..." price={...} />` (src/lib/components/payments/order-button.svelte) on the pages that sell things; prices are in `site.currency` (src/lib/site.ts).',
7699
+ "Edit the message the business receives in src/lib/order.ts.",
7700
+ "Orders recorded to the hosted form are on velastack.dev, under the project's forms."
7622
7701
  ]
7623
7702
  };
7703
+ function isCurrency(code2) {
7704
+ return Intl.supportedValuesOf("currency").includes(code2.trim().toUpperCase());
7705
+ }
7706
+ async function askCurrency(flag) {
7707
+ if (flag) return flag.trim().toUpperCase();
7708
+ const root = findWorkspaceRoot();
7709
+ const site = root ? path35.join(root, "src", "lib", "site.ts") : null;
7710
+ if (site && fs35.existsSync(site) && /^\s*currency\s*:/m.test(fs35.readFileSync(site, "utf8"))) {
7711
+ return void 0;
7712
+ }
7713
+ if (!isInteractive()) return void 0;
7714
+ const value = await p21.text({
7715
+ message: "The business's currency, which every price is in (ISO 4217)",
7716
+ placeholder: "MXN, EUR, USD...",
7717
+ validate: (value2) => value2 && isCurrency(value2) ? void 0 : "An ISO 4217 code, such as MXN or EUR"
7718
+ });
7719
+ if (p21.isCancel(value)) {
7720
+ p21.cancel("Operation cancelled.");
7721
+ process19.exit(0);
7722
+ }
7723
+ return value.trim().toUpperCase();
7724
+ }
7725
+ async function prepareOrderForm() {
7726
+ if (process19.env.PUBLIC_WHATSAPP_ORDER_FORM) return [];
7727
+ const root = findWorkspaceRoot();
7728
+ if (!root) return [];
7729
+ const outcome = await ensureOrderForm(root);
7730
+ if (outcome.kind === "created") {
7731
+ process19.env.PUBLIC_WHATSAPP_ORDER_FORM = outcome.url;
7732
+ return outcome.note ? [outcome.note] : [];
7733
+ }
7734
+ return [outcome.note];
7735
+ }
7624
7736
  function noteWebhookSecret() {
7625
7737
  if (process19.env.STRIPE_WEBHOOK_SECRET || !isInteractive()) return;
7626
7738
  p21.note(
@@ -7653,12 +7765,12 @@ async function askDemoId(provider) {
7653
7765
  import process20 from "node:process";
7654
7766
  import { Command as Command20 } from "commander";
7655
7767
  import * as p22 from "@clack/prompts";
7656
- var ecommerce = new Command20("ecommerce").description("enable a cart and checkout on the project's payments provider").option("--provider <provider>", "must match the payments provider: stripe or shopify").allowExcessArguments(true).configureHelp(helpConfig).action(
7768
+ var ecommerce = new Command20("ecommerce").description("enable a cart and checkout on the project's payments provider").option("--provider <provider>", "must match the payments provider: stripe, shopify or whatsapp").allowExcessArguments(true).configureHelp(helpConfig).action(
7657
7769
  (opts, cmd) => runCommand(async () => {
7658
7770
  const { detected } = await detectWorkspace();
7659
7771
  const provider = await resolveProvider("enable-ecommerce", opts.provider, detected.providers);
7660
7772
  await assertPatternRequires("enable-ecommerce", provider.id);
7661
- const demoId = await askDemoId2(provider);
7773
+ const demoId = provider.id === "whatsapp" ? "" : await askDemoId2(provider);
7662
7774
  await runPattern(
7663
7775
  "enable-ecommerce",
7664
7776
  cmd.args,
@@ -7683,7 +7795,11 @@ var NEXT_STEPS2 = {
7683
7795
  stripe: [
7684
7796
  "Checkout is Stripe Checkout: payment methods, tax and shipping are set in the Stripe dashboard."
7685
7797
  ],
7686
- shopify: ["Checkout is Shopify's: payment, tax and shipping settings live in Shopify admin."]
7798
+ shopify: ["Checkout is Shopify's: payment, tax and shipping settings live in Shopify admin."],
7799
+ whatsapp: [
7800
+ 'Give each item an id, a name and, optionally, a price in `site.currency`: `<AddToCart id="concha" name="Concha" price={12} />`.',
7801
+ "Checkout opens WhatsApp with the order; the business confirms it and takes payment in the chat."
7802
+ ]
7687
7803
  };
7688
7804
  async function askDemoId2(provider) {
7689
7805
  if (!isInteractive()) return "";
@@ -8217,6 +8333,14 @@ var SHOPIFY = {
8217
8333
  "The @shopify/storefront-api-client package remains installed. Uninstall it manually if desired."
8218
8334
  ]
8219
8335
  };
8336
+ var WHATSAPP = {
8337
+ confirmMessage: "Disable payments? Removes the Order on WhatsApp button, src/lib/order.ts and the WhatsApp env variables. Orders recorded on velastack.dev are untouched.",
8338
+ nextSteps: [
8339
+ "The hosted order form and the orders in it stay on velastack.dev.",
8340
+ "The @velastack/whatsapp package remains installed. Uninstall it manually if desired."
8341
+ ]
8342
+ };
8343
+ var COPY = { shopify: SHOPIFY, whatsapp: WHATSAPP };
8220
8344
  var payments2 = new Command39("payments").description("disable payments").option("-y, --yes", "skip confirmation prompt").allowExcessArguments(true).configureHelp(helpConfig).action(
8221
8345
  (opts, cmd) => runCommand(async () => {
8222
8346
  const { detected } = await detectWorkspace();
@@ -8224,7 +8348,7 @@ var payments2 = new Command39("payments").description("disable payments").option
8224
8348
  if (provider === "stripe" || provider === void 0 && hasBackend()) {
8225
8349
  assertBackendReady("vela disable payments");
8226
8350
  }
8227
- const copy = provider === "shopify" ? SHOPIFY : STRIPE;
8351
+ const copy = (provider ? COPY[provider] : void 0) ?? STRIPE;
8228
8352
  await runDisable(
8229
8353
  {
8230
8354
  slug: "disable-payments",
@@ -8462,25 +8586,25 @@ import * as p26 from "@clack/prompts";
8462
8586
  import pc9 from "picocolors";
8463
8587
 
8464
8588
  // src/lib/deploy-config.ts
8465
- import fs34 from "node:fs";
8466
- import path34 from "node:path";
8589
+ import fs36 from "node:fs";
8590
+ import path36 from "node:path";
8467
8591
  import crypto2 from "node:crypto";
8468
8592
  function projectFilePath(workspaceRootDir) {
8469
- return path34.join(workspaceRootDir, ".vela", "project.json");
8593
+ return path36.join(workspaceRootDir, ".vela", "project.json");
8470
8594
  }
8471
8595
  function readProjectFile(workspaceRootDir) {
8472
8596
  const file = projectFilePath(workspaceRootDir);
8473
- if (!fs34.existsSync(file)) return {};
8597
+ if (!fs36.existsSync(file)) return {};
8474
8598
  try {
8475
- return JSON.parse(fs34.readFileSync(file, "utf8"));
8599
+ return JSON.parse(fs36.readFileSync(file, "utf8"));
8476
8600
  } catch {
8477
8601
  return {};
8478
8602
  }
8479
8603
  }
8480
8604
  function writeProjectFile(workspaceRootDir, data) {
8481
8605
  const file = projectFilePath(workspaceRootDir);
8482
- fs34.mkdirSync(path34.dirname(file), { recursive: true });
8483
- fs34.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
8606
+ fs36.mkdirSync(path36.dirname(file), { recursive: true });
8607
+ fs36.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
8484
8608
  }
8485
8609
  function resolveAppIdentity(workspaceRootDir, projectName) {
8486
8610
  const project = readProjectFile(workspaceRootDir);
@@ -8505,11 +8629,11 @@ function readAppIdentity(workspaceRootDir, projectName) {
8505
8629
  }
8506
8630
  function defaultProjectName(workspaceRootDir) {
8507
8631
  try {
8508
- const pkg = readPackageJson(path34.join(workspaceRootDir, "package.json"));
8632
+ const pkg = readPackageJson(path36.join(workspaceRootDir, "package.json"));
8509
8633
  if (typeof pkg.name === "string" && pkg.name.trim()) return pkg.name.trim();
8510
8634
  } catch {
8511
8635
  }
8512
- return path34.basename(workspaceRootDir);
8636
+ return path36.basename(workspaceRootDir);
8513
8637
  }
8514
8638
  function slug(value) {
8515
8639
  return value.toLowerCase().replace(/^@/, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32) || "app";
@@ -8580,15 +8704,15 @@ function randomSuffix() {
8580
8704
  }
8581
8705
 
8582
8706
  // src/lib/artifact.ts
8583
- import fs36 from "node:fs";
8584
- import path36 from "node:path";
8707
+ import fs38 from "node:fs";
8708
+ import path38 from "node:path";
8585
8709
  import { detect as detect6 } from "package-manager-detector";
8586
8710
  import { resolveCommand as resolveCommand4 } from "package-manager-detector/commands";
8587
8711
 
8588
8712
  // src/lib/ssh.ts
8589
- import fs35 from "node:fs";
8713
+ import fs37 from "node:fs";
8590
8714
  import os5 from "node:os";
8591
- import path35 from "node:path";
8715
+ import path37 from "node:path";
8592
8716
  import crypto4 from "node:crypto";
8593
8717
  import process25 from "node:process";
8594
8718
  import { spawn as spawn4 } from "node:child_process";
@@ -8631,9 +8755,9 @@ var SshSession = class {
8631
8755
  }
8632
8756
  async open() {
8633
8757
  if (this.controlPath) return;
8634
- const dir = path35.join(os5.tmpdir(), "vela-ssh");
8635
- fs35.mkdirSync(dir, { recursive: true, mode: 448 });
8636
- const socket = path35.join(dir, `${crypto4.randomBytes(6).toString("hex")}.sock`);
8758
+ const dir = path37.join(os5.tmpdir(), "vela-ssh");
8759
+ fs37.mkdirSync(dir, { recursive: true, mode: 448 });
8760
+ const socket = path37.join(dir, `${crypto4.randomBytes(6).toString("hex")}.sock`);
8637
8761
  this.controlPath = socket;
8638
8762
  const args = [
8639
8763
  ...this.sshArgs(),
@@ -8923,11 +9047,11 @@ function collectArtifact(cwd) {
8923
9047
  const outputDir = DEFAULT_OUTPUT_DIR;
8924
9048
  const entries = [];
8925
9049
  const add2 = (rel, remoteDir = "") => {
8926
- const localPath = path36.join(cwd, rel);
8927
- if (fs36.existsSync(localPath)) entries.push({ localPath, remoteDir });
9050
+ const localPath = path38.join(cwd, rel);
9051
+ if (fs38.existsSync(localPath)) entries.push({ localPath, remoteDir });
8928
9052
  };
8929
- const buildPath = path36.join(cwd, outputDir);
8930
- if (!fs36.existsSync(path36.join(buildPath, "index.js"))) {
9053
+ const buildPath = path38.join(cwd, outputDir);
9054
+ if (!fs38.existsSync(path38.join(buildPath, "index.js"))) {
8931
9055
  throw new BuildError(
8932
9056
  `No ${outputDir}/index.js to deploy.
8933
9057
 
@@ -8940,18 +9064,18 @@ build ran with it as the adapter, then deploy again.`
8940
9064
  for (const lockfile of [NPM_LOCKFILE, ...FOREIGN_LOCKFILES]) add2(lockfile);
8941
9065
  add2(".npmrc");
8942
9066
  add2(MIGRATIONS_DIR);
8943
- const hooks = path36.join(cwd, DATA_DIR, "hooks");
8944
- if (fs36.existsSync(hooks)) entries.push({ localPath: hooks, remoteDir: "hooks" });
9067
+ const hooks = path38.join(cwd, DATA_DIR, "hooks");
9068
+ if (fs38.existsSync(hooks)) entries.push({ localPath: hooks, remoteDir: "hooks" });
8945
9069
  return entries;
8946
9070
  }
8947
9071
  var NPM_LOCKFILE = "package-lock.json";
8948
9072
  var FOREIGN_LOCKFILES = ["pnpm-lock.yaml", "yarn.lock", "bun.lock", "bun.lockb"];
8949
9073
  function hasLockfile(cwd) {
8950
- return fs36.existsSync(path36.join(cwd, NPM_LOCKFILE));
9074
+ return fs38.existsSync(path38.join(cwd, NPM_LOCKFILE));
8951
9075
  }
8952
9076
  function foreignLockfile(cwd) {
8953
9077
  if (hasLockfile(cwd)) return void 0;
8954
- return FOREIGN_LOCKFILES.find((name) => fs36.existsSync(path36.join(cwd, name)));
9078
+ return FOREIGN_LOCKFILES.find((name) => fs38.existsSync(path38.join(cwd, name)));
8955
9079
  }
8956
9080
  async function gitSha(cwd) {
8957
9081
  const result = await spawnCapture("git", ["rev-parse", "HEAD"], { cwd });
@@ -8990,8 +9114,8 @@ function sshOptionsFrom(options) {
8990
9114
 
8991
9115
  // src/lib/remote.ts
8992
9116
  import crypto5 from "node:crypto";
8993
- import fs37 from "node:fs";
8994
- import path37 from "node:path";
9117
+ import fs39 from "node:fs";
9118
+ import path39 from "node:path";
8995
9119
  import process26 from "node:process";
8996
9120
  var VELA_ROOT = "/var/lib/vela";
8997
9121
  var VELA_ETC = "/etc/vela";
@@ -9004,19 +9128,19 @@ function instanceHasBackend(state) {
9004
9128
  return state.backend ?? Boolean(state.pbPort);
9005
9129
  }
9006
9130
  function serverTemplatesDir() {
9007
- return path37.join(templatesDir(), "server");
9131
+ return path39.join(templatesDir(), "server");
9008
9132
  }
9009
9133
  var DIGEST_LENGTH = 12;
9010
9134
  function serverScriptsDigest(dir = serverTemplatesDir()) {
9011
9135
  const hash = crypto5.createHash("sha256");
9012
9136
  for (const file of listFiles(dir).sort()) {
9013
- hash.update(file).update("\0").update(fs37.readFileSync(path37.join(dir, file))).update("\0");
9137
+ hash.update(file).update("\0").update(fs39.readFileSync(path39.join(dir, file))).update("\0");
9014
9138
  }
9015
9139
  return hash.digest("hex").slice(0, DIGEST_LENGTH);
9016
9140
  }
9017
9141
  function listFiles(root, prefix = "") {
9018
9142
  const files = [];
9019
- for (const entry of fs37.readdirSync(path37.join(root, prefix), { withFileTypes: true })) {
9143
+ for (const entry of fs39.readdirSync(path39.join(root, prefix), { withFileTypes: true })) {
9020
9144
  const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
9021
9145
  if (entry.isDirectory()) files.push(...listFiles(root, rel));
9022
9146
  else if (entry.isFile()) files.push(rel);
@@ -9143,7 +9267,7 @@ var remotePaths = {
9143
9267
  };
9144
9268
 
9145
9269
  // src/lib/remote-env.ts
9146
- import fs38 from "node:fs";
9270
+ import fs40 from "node:fs";
9147
9271
  import dotenv from "dotenv";
9148
9272
  var KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
9149
9273
  function isValidKey(key) {
@@ -9191,7 +9315,7 @@ function quote(value) {
9191
9315
  return `"${escaped}"`;
9192
9316
  }
9193
9317
  function readLocalEnvFile(file) {
9194
- const parsed = dotenv.parse(fs38.readFileSync(file));
9318
+ const parsed = dotenv.parse(fs40.readFileSync(file));
9195
9319
  const result = {};
9196
9320
  for (const [key, value] of Object.entries(parsed)) {
9197
9321
  if (isValidKey(key)) result[key] = value;
@@ -10042,14 +10166,14 @@ var ui = new Command55("ui").description("generate ui components").configureHelp
10042
10166
  import { Command as Command58 } from "commander";
10043
10167
 
10044
10168
  // src/commands/legal/terms.ts
10045
- import path39 from "node:path";
10169
+ import path41 from "node:path";
10046
10170
  import { Command as Command56 } from "commander";
10047
10171
  import * as p36 from "@clack/prompts";
10048
10172
 
10049
10173
  // src/commands/legal/shared.ts
10050
10174
  import process29 from "node:process";
10051
- import fs39 from "node:fs";
10052
- import path38 from "node:path";
10175
+ import fs41 from "node:fs";
10176
+ import path40 from "node:path";
10053
10177
  import * as p35 from "@clack/prompts";
10054
10178
  function siteFields(site) {
10055
10179
  const url = site?.url && !isLocalUrl(site.url) ? site.url : void 0;
@@ -10331,16 +10455,16 @@ function writeLegalPage(root, dir, page) {
10331
10455
 
10332
10456
  ${html}`;
10333
10457
  }
10334
- const pagePath = path38.join(root, dir, "+page.svelte");
10335
- fs39.mkdirSync(path38.dirname(pagePath), { recursive: true });
10336
- fs39.writeFileSync(pagePath, html);
10458
+ const pagePath = path40.join(root, dir, "+page.svelte");
10459
+ fs41.mkdirSync(path40.dirname(pagePath), { recursive: true });
10460
+ fs41.writeFileSync(pagePath, html);
10337
10461
  const written = [pagePath];
10338
10462
  if (metaTags) {
10339
- const loaderPath = path38.join(root, dir, "+page.ts");
10340
- fs39.writeFileSync(loaderPath, pageMetaTagsLoader(page.title, page.description));
10463
+ const loaderPath = path40.join(root, dir, "+page.ts");
10464
+ fs41.writeFileSync(loaderPath, pageMetaTagsLoader(page.title, page.description));
10341
10465
  written.push(loaderPath);
10342
10466
  }
10343
- return written.map((file) => path38.relative(root, file));
10467
+ return written.map((file) => path40.relative(root, file));
10344
10468
  }
10345
10469
 
10346
10470
  // src/commands/legal/terms.ts
@@ -10737,7 +10861,7 @@ async function termsAction() {
10737
10861
  });
10738
10862
  const [relativeTermsPage, ...rest] = writeLegalPage(
10739
10863
  workspaceRootDir,
10740
- path39.join(publicRoutesDir, LEGAL_DIR, "terms"),
10864
+ path41.join(publicRoutesDir, LEGAL_DIR, "terms"),
10741
10865
  {
10742
10866
  html,
10743
10867
  title: "Terms of Service",
@@ -10757,7 +10881,7 @@ async function termsAction() {
10757
10881
  var terms = new Command56("terms").description("generate placeholder terms and conditions").configureHelp(helpConfig).action(() => runCommand(termsAction, "Failed to generate terms and conditions."));
10758
10882
 
10759
10883
  // src/commands/legal/privacy.ts
10760
- import path40 from "node:path";
10884
+ import path42 from "node:path";
10761
10885
  import { Command as Command57 } from "commander";
10762
10886
  import * as p37 from "@clack/prompts";
10763
10887
  var mapLabels = {
@@ -11473,7 +11597,7 @@ async function privacyAction() {
11473
11597
  });
11474
11598
  const [relativePrivacyPage, ...rest] = writeLegalPage(
11475
11599
  workspaceRootDir,
11476
- path40.join(publicRoutesDir, LEGAL_DIR, "privacy"),
11600
+ path42.join(publicRoutesDir, LEGAL_DIR, "privacy"),
11477
11601
  {
11478
11602
  html,
11479
11603
  title: "Privacy Policy",
@@ -11502,8 +11626,8 @@ import { Command as Command64 } from "commander";
11502
11626
  import { Command as Command59 } from "commander";
11503
11627
 
11504
11628
  // src/lib/data.ts
11505
- import fs40 from "node:fs";
11506
- import path41 from "node:path";
11629
+ import fs42 from "node:fs";
11630
+ import path43 from "node:path";
11507
11631
  import { ClientResponseError } from "pocketbase";
11508
11632
 
11509
11633
  // src/lib/collections.ts
@@ -11540,14 +11664,14 @@ function dependencyOrder(collections2, startingCollectionId) {
11540
11664
 
11541
11665
  // src/lib/data.ts
11542
11666
  function dataDir(cwd, kind) {
11543
- return path41.join(cwd, DATA_DIR, kind);
11667
+ return path43.join(cwd, DATA_DIR, kind);
11544
11668
  }
11545
11669
  function getDataFiles(cwd, kind) {
11546
11670
  const dir = dataDir(cwd, kind);
11547
- if (!fs40.existsSync(dir)) return [];
11548
- return fs40.readdirSync(dir).filter((file) => file.endsWith(".json")).sort((a, b) => a.localeCompare(b)).map((file) => ({
11671
+ if (!fs42.existsSync(dir)) return [];
11672
+ return fs42.readdirSync(dir).filter((file) => file.endsWith(".json")).sort((a, b) => a.localeCompare(b)).map((file) => ({
11549
11673
  collectionName: file.replace(/\.json$/i, "").replace(/^\d+[-_]?/, ""),
11550
- filePath: path41.join(dir, file)
11674
+ filePath: path43.join(dir, file)
11551
11675
  }));
11552
11676
  }
11553
11677
  function getSeedFiles(cwd) {
@@ -11557,7 +11681,7 @@ function getFixtureFiles(cwd) {
11557
11681
  return getDataFiles(cwd, "fixtures");
11558
11682
  }
11559
11683
  function readRecords(filePath) {
11560
- return JSON.parse(fs40.readFileSync(filePath, "utf8"));
11684
+ return JSON.parse(fs42.readFileSync(filePath, "utf8"));
11561
11685
  }
11562
11686
  function readSeedIds(cwd) {
11563
11687
  const ids = /* @__PURE__ */ new Map();
@@ -11594,7 +11718,7 @@ function describeError(e) {
11594
11718
  return e instanceof Error ? e.message : String(e);
11595
11719
  }
11596
11720
  function label(cwd, filePath, count) {
11597
- return `${path41.relative(cwd, filePath)} (${count} records)`;
11721
+ return `${path43.relative(cwd, filePath)} (${count} records)`;
11598
11722
  }
11599
11723
  async function createRecords(pb, kind, cwd, { collectionName, filePath }) {
11600
11724
  const records = readRecords(filePath);
@@ -11602,7 +11726,7 @@ async function createRecords(pb, kind, cwd, { collectionName, filePath }) {
11602
11726
  try {
11603
11727
  await pb.collection(collectionName).create(record);
11604
11728
  } catch (e) {
11605
- throw new DataLoadError(kind, path41.relative(cwd, filePath), index, e);
11729
+ throw new DataLoadError(kind, path43.relative(cwd, filePath), index, e);
11606
11730
  }
11607
11731
  }
11608
11732
  return records.length;
@@ -11776,8 +11900,8 @@ var reset = new Command61("reset").description("clear and reload fixtures").conf
11776
11900
  );
11777
11901
 
11778
11902
  // src/commands/fixtures/generate.ts
11779
- import fs41 from "node:fs";
11780
- import path42 from "node:path";
11903
+ import fs43 from "node:fs";
11904
+ import path44 from "node:path";
11781
11905
  import { Command as Command62, InvalidArgumentError } from "commander";
11782
11906
  import * as p38 from "@clack/prompts";
11783
11907
  import { annotate } from "annotate-json-schema";
@@ -11814,9 +11938,9 @@ async function loadCollections(pb) {
11814
11938
  }
11815
11939
  async function generateFixtureFiles(pb, workspaceRootDir, opts) {
11816
11940
  const fixturesDir = dataDir(workspaceRootDir, "fixtures");
11817
- fs41.mkdirSync(fixturesDir, { recursive: true });
11818
- for (const file of fs41.readdirSync(fixturesDir)) {
11819
- if (file.endsWith(".json")) fs41.unlinkSync(path42.join(fixturesDir, file));
11941
+ fs43.mkdirSync(fixturesDir, { recursive: true });
11942
+ for (const file of fs43.readdirSync(fixturesDir)) {
11943
+ if (file.endsWith(".json")) fs43.unlinkSync(path44.join(fixturesDir, file));
11820
11944
  }
11821
11945
  if (opts.seed !== void 0) faker.seed(opts.seed);
11822
11946
  const generator = createGenerator({
@@ -11883,8 +12007,8 @@ async function generateFixtureFiles(pb, workspaceRootDir, opts) {
11883
12007
  items.push(record);
11884
12008
  }
11885
12009
  const filename = `${padZeros(fileIndex, 2)}-${collection.name}.json`;
11886
- fs41.writeFileSync(path42.join(fixturesDir, filename), JSON.stringify(items, null, 2));
11887
- writtenFiles.push(`${path42.join(DATA_DIR, "fixtures", filename)} (${items.length} records)`);
12010
+ fs43.writeFileSync(path44.join(fixturesDir, filename), JSON.stringify(items, null, 2));
12011
+ writtenFiles.push(`${path44.join(DATA_DIR, "fixtures", filename)} (${items.length} records)`);
11888
12012
  fileIndex++;
11889
12013
  }
11890
12014
  return { writtenFiles, warnings };
@@ -12031,8 +12155,8 @@ var load2 = new Command65("load").description("load seeds into the database").op
12031
12155
  );
12032
12156
 
12033
12157
  // src/commands/seeds/save.ts
12034
- import fs42 from "node:fs";
12035
- import path43 from "node:path";
12158
+ import fs44 from "node:fs";
12159
+ import path45 from "node:path";
12036
12160
  import { Command as Command66 } from "commander";
12037
12161
  var padZeros2 = (num, length) => num.toString().padStart(length, "0");
12038
12162
  function filterSystemFields(record, systemFieldNames) {
@@ -12052,10 +12176,10 @@ var save = new Command66("save").description("save the current data as seeds").o
12052
12176
  if (existing.length > 0 && !opts.force) {
12053
12177
  throw new Error("Existing seed files found in data/seeds. Pass --force to overwrite.");
12054
12178
  }
12055
- fs42.mkdirSync(seedsPath, { recursive: true });
12179
+ fs44.mkdirSync(seedsPath, { recursive: true });
12056
12180
  if (opts.force) {
12057
- for (const file of fs42.readdirSync(seedsPath)) {
12058
- if (file.endsWith(".json")) fs42.unlinkSync(path43.join(seedsPath, file));
12181
+ for (const file of fs44.readdirSync(seedsPath)) {
12182
+ if (file.endsWith(".json")) fs44.unlinkSync(path45.join(seedsPath, file));
12059
12183
  }
12060
12184
  }
12061
12185
  const saved = [];
@@ -12084,13 +12208,13 @@ var save = new Command66("save").description("save the current data as seeds").o
12084
12208
  const filtered = records.map(
12085
12209
  (r) => filterSystemFields(r, systemFieldNames)
12086
12210
  );
12087
- const relativeSeedPath = path43.join(
12211
+ const relativeSeedPath = path45.join(
12088
12212
  DATA_DIR,
12089
12213
  "seeds",
12090
12214
  `${padZeros2(count, 2)}-${collectionName}.json`
12091
12215
  );
12092
- const seedPath = path43.join(workspaceRootDir, relativeSeedPath);
12093
- fs42.writeFileSync(seedPath, JSON.stringify(filtered, null, 2));
12216
+ const seedPath = path45.join(workspaceRootDir, relativeSeedPath);
12217
+ fs44.writeFileSync(seedPath, JSON.stringify(filtered, null, 2));
12094
12218
  saved.push(`${relativeSeedPath} (${filtered.length} records)`);
12095
12219
  count++;
12096
12220
  }
@@ -12228,7 +12352,7 @@ import { Command as Command78 } from "commander";
12228
12352
  import { Command as Command72 } from "commander";
12229
12353
 
12230
12354
  // src/lib/migrate.ts
12231
- import path44 from "node:path";
12355
+ import path46 from "node:path";
12232
12356
  import process30 from "node:process";
12233
12357
  import { x as x3 } from "tinyexec";
12234
12358
  function migrateRoot() {
@@ -12242,9 +12366,9 @@ async function runPocketbaseMigrate(args) {
12242
12366
  binaryPath,
12243
12367
  [
12244
12368
  "--dir",
12245
- path44.join(cwd, DATA_DIR),
12369
+ path46.join(cwd, DATA_DIR),
12246
12370
  "--migrationsDir",
12247
- path44.join(cwd, MIGRATIONS_DIR),
12371
+ path46.join(cwd, MIGRATIONS_DIR),
12248
12372
  "migrate",
12249
12373
  ...args
12250
12374
  ],
@@ -12292,8 +12416,8 @@ var down = new Command73("down").alias("rollback").description("revert the last
12292
12416
  );
12293
12417
 
12294
12418
  // src/commands/migrate/create.ts
12295
- import fs43 from "node:fs";
12296
- import path45 from "node:path";
12419
+ import fs45 from "node:fs";
12420
+ import path47 from "node:path";
12297
12421
  import { Command as Command74 } from "commander";
12298
12422
  var create2 = new Command74("create").alias("new").description("create a new blank migration").argument("<name>", "migration name (snake_case)").configureHelp(helpConfig).action(
12299
12423
  (name) => runCommand(async () => {
@@ -12304,7 +12428,7 @@ var create2 = new Command74("create").alias("new").description("create a new bla
12304
12428
  const added = [...after].filter((f) => !before.has(f));
12305
12429
  reportResult({
12306
12430
  summary: `Created blank migration ${name}.`,
12307
- filesCreated: added.map((f) => path45.join(MIGRATIONS_DIR, f)),
12431
+ filesCreated: added.map((f) => path47.join(MIGRATIONS_DIR, f)),
12308
12432
  nextSteps: [
12309
12433
  `Open the new file in ${MIGRATIONS_DIR}/ and fill in the up/down handlers.`,
12310
12434
  "Run `vela migrate up` to apply the migration once the handlers are written."
@@ -12313,14 +12437,14 @@ var create2 = new Command74("create").alias("new").description("create a new bla
12313
12437
  }, "Failed to create migration.")
12314
12438
  );
12315
12439
  function listMigrationFiles(cwd) {
12316
- const dir = path45.join(cwd, MIGRATIONS_DIR);
12317
- if (!fs43.existsSync(dir)) return /* @__PURE__ */ new Set();
12318
- return new Set(fs43.readdirSync(dir).filter((f) => /\.[jt]s$/.test(f)));
12440
+ const dir = path47.join(cwd, MIGRATIONS_DIR);
12441
+ if (!fs45.existsSync(dir)) return /* @__PURE__ */ new Set();
12442
+ return new Set(fs45.readdirSync(dir).filter((f) => /\.[jt]s$/.test(f)));
12319
12443
  }
12320
12444
 
12321
12445
  // src/commands/migrate/collections.ts
12322
- import fs44 from "node:fs";
12323
- import path46 from "node:path";
12446
+ import fs46 from "node:fs";
12447
+ import path48 from "node:path";
12324
12448
  import { Command as Command75 } from "commander";
12325
12449
  var collections = new Command75("collections").alias("snapshot").description("snapshot local collections into a new migration").configureHelp(helpConfig).action(
12326
12450
  () => runCommand(async () => {
@@ -12337,7 +12461,7 @@ var collections = new Command75("collections").alias("snapshot").description("sn
12337
12461
  }
12338
12462
  reportResult({
12339
12463
  summary: "Snapshotted local collections into a new migration.",
12340
- filesCreated: added.map((f) => path46.join(MIGRATIONS_DIR, f)),
12464
+ filesCreated: added.map((f) => path48.join(MIGRATIONS_DIR, f)),
12341
12465
  nextSteps: [
12342
12466
  `Review the generated snapshot in ${MIGRATIONS_DIR}/.`,
12343
12467
  "Commit the snapshot so teammates pick up the new schema.",
@@ -12347,9 +12471,9 @@ var collections = new Command75("collections").alias("snapshot").description("sn
12347
12471
  }, "Failed to snapshot collections.")
12348
12472
  );
12349
12473
  function listMigrationFiles2(cwd) {
12350
- const dir = path46.join(cwd, MIGRATIONS_DIR);
12351
- if (!fs44.existsSync(dir)) return /* @__PURE__ */ new Set();
12352
- return new Set(fs44.readdirSync(dir).filter((f) => /\.[jt]s$/.test(f)));
12474
+ const dir = path48.join(cwd, MIGRATIONS_DIR);
12475
+ if (!fs46.existsSync(dir)) return /* @__PURE__ */ new Set();
12476
+ return new Set(fs46.readdirSync(dir).filter((f) => /\.[jt]s$/.test(f)));
12353
12477
  }
12354
12478
 
12355
12479
  // src/commands/migrate/history-sync.ts
@@ -12365,14 +12489,14 @@ var historySync = new Command76("history-sync").description("drop _migrations ro
12365
12489
  );
12366
12490
 
12367
12491
  // src/commands/migrate/sveltekit-3.ts
12368
- import path47 from "node:path";
12492
+ import path49 from "node:path";
12369
12493
  import process31 from "node:process";
12370
12494
  import { Command as Command77 } from "commander";
12371
12495
  import * as p43 from "@clack/prompts";
12372
12496
  import pc13 from "picocolors";
12373
12497
  var sveltekit3 = new Command77("sveltekit-3").description("upgrade a SvelteKit 2 project to SvelteKit 3 (sv migrate, then the vela steps)").option("--cwd <path>", "the project to migrate (default: the current project)").option("--no-install", "skip installing dependencies").option("--force", "run even when the git working tree has uncommitted changes").option("--skip-sv", "only run the vela steps (sv has already been run)").configureHelp(helpConfig).action(
12374
12498
  (options) => runCommand(async () => {
12375
- const root = options.cwd ? path47.resolve(options.cwd) : findWorkspaceRoot() ?? process31.cwd();
12499
+ const root = options.cwd ? path49.resolve(options.cwd) : findWorkspaceRoot() ?? process31.cwd();
12376
12500
  p43.intro(pc13.bgCyan(pc13.black(" vela migrate sveltekit-3 ")));
12377
12501
  const result = await runKit3Migration(root, {
12378
12502
  install: options.install,
@@ -12389,7 +12513,7 @@ function printReport(root, result) {
12389
12513
  sections.push({ label: "Build output removed first", items: result.sv.cleared });
12390
12514
  }
12391
12515
  for (const fixup2 of changed) sections.push({ label: fixup2.name, items: fixup2.details });
12392
- const summary = result.mode === "repair" ? changed.length > 0 ? "Already on SvelteKit 3; brought the vela setup up to date." : "Already on SvelteKit 3; nothing left to change." : `Migrated ${path47.basename(root)} to SvelteKit 3.`;
12516
+ const summary = result.mode === "repair" ? changed.length > 0 ? "Already on SvelteKit 3; brought the vela setup up to date." : "Already on SvelteKit 3; nothing left to change." : `Migrated ${path49.basename(root)} to SvelteKit 3.`;
12393
12517
  reportResult({ summary, sections });
12394
12518
  const tasks = result.tasks;
12395
12519
  if (tasks && (tasks.sections.length > 0 || tasks.markerComments > 0)) {
@@ -12447,8 +12571,8 @@ function nextStepsFor(result) {
12447
12571
  var migrate = new Command78("migrate").description("manage database migrations (and `migrate sveltekit-3` to upgrade SvelteKit)").configureHelp(helpConfig).action(() => runCommand(runMigrateUp, "Failed to run migrations.")).addCommand(up).addCommand(down).addCommand(create2).addCommand(collections).addCommand(historySync).addCommand(sveltekit3);
12448
12572
 
12449
12573
  // src/commands/dev.ts
12450
- import fs45 from "node:fs";
12451
- import path49 from "node:path";
12574
+ import fs47 from "node:fs";
12575
+ import path51 from "node:path";
12452
12576
  import process33 from "node:process";
12453
12577
  import { performance } from "node:perf_hooks";
12454
12578
  import { Command as Command79, InvalidArgumentError as InvalidArgumentError4 } from "commander";
@@ -12480,7 +12604,7 @@ function createPocketbaseLogFilter() {
12480
12604
  }
12481
12605
 
12482
12606
  // src/lib/vite.ts
12483
- import path48 from "node:path";
12607
+ import path50 from "node:path";
12484
12608
  import process32 from "node:process";
12485
12609
  import { createRequire as createRequire4 } from "node:module";
12486
12610
  import { pathToFileURL } from "node:url";
@@ -12500,7 +12624,7 @@ function viteVersionError(version) {
12500
12624
  }
12501
12625
  function resolveProjectVite(cwd) {
12502
12626
  try {
12503
- return createRequire4(path48.join(cwd, "package.json")).resolve("vite");
12627
+ return createRequire4(path50.join(cwd, "package.json")).resolve("vite");
12504
12628
  } catch {
12505
12629
  return null;
12506
12630
  }
@@ -12530,8 +12654,8 @@ var dev = new Command79("dev").description("start the development server").optio
12530
12654
  process33.env.VELA_DATA_DIR ??= localDataDir(cwd);
12531
12655
  const startTime = performance.now();
12532
12656
  const { createServer, resolveConfig, version } = await loadVite(cwd);
12533
- const viteMetadataDir = path49.join(cwd, "node_modules", ".vite");
12534
- const viteMetadataFile = path49.join(viteMetadataDir, "_pocketbase_metadata.json");
12657
+ const viteMetadataDir = path51.join(cwd, "node_modules", ".vite");
12658
+ const viteMetadataFile = path51.join(viteMetadataDir, "_pocketbase_metadata.json");
12535
12659
  const serverOptions = {};
12536
12660
  if (options.open !== void 0) serverOptions.open = options.open;
12537
12661
  if (options.host !== void 0) serverOptions.host = options.host;
@@ -12547,7 +12671,7 @@ var dev = new Command79("dev").description("start the development server").optio
12547
12671
  const needsStart = backend3 && !process33.env.POCKETBASE_URL;
12548
12672
  const cleanup = () => {
12549
12673
  if (pbProc?.pid) pbProc.kill();
12550
- if (fs45.existsSync(viteMetadataFile)) fs45.rmSync(viteMetadataFile);
12674
+ if (fs47.existsSync(viteMetadataFile)) fs47.rmSync(viteMetadataFile);
12551
12675
  };
12552
12676
  if (needsStart) {
12553
12677
  const resolved = await resolveConfig(inlineConfig, "serve");
@@ -12565,11 +12689,11 @@ var dev = new Command79("dev").description("start the development server").optio
12565
12689
  )
12566
12690
  );
12567
12691
  }
12568
- const dataDir2 = path49.join(cwd, DATA_DIR);
12692
+ const dataDir2 = path51.join(cwd, DATA_DIR);
12569
12693
  const started = await startPocketbaseServe({
12570
12694
  dataDir: dataDir2,
12571
12695
  migrationsDir: MIGRATIONS_DIR,
12572
- hooksDir: path49.join(dataDir2, "hooks"),
12696
+ hooksDir: path51.join(dataDir2, "hooks"),
12573
12697
  dev: true,
12574
12698
  stdio: "pipe",
12575
12699
  env: {
@@ -12591,8 +12715,8 @@ var dev = new Command79("dev").description("start the development server").optio
12591
12715
  if (!backend3) return;
12592
12716
  const { address, port: vitePort } = server.httpServer.address();
12593
12717
  const viteHost = address === "::1" ? "localhost" : address;
12594
- await fs45.promises.mkdir(viteMetadataDir, { recursive: true });
12595
- await fs45.promises.writeFile(
12718
+ await fs47.promises.mkdir(viteMetadataDir, { recursive: true });
12719
+ await fs47.promises.writeFile(
12596
12720
  viteMetadataFile,
12597
12721
  JSON.stringify({
12598
12722
  pocketbaseUrl: process33.env.POCKETBASE_URL,
@@ -12623,18 +12747,18 @@ var dev = new Command79("dev").description("start the development server").optio
12623
12747
  });
12624
12748
  async function startWatchingTypes(cwd, pb) {
12625
12749
  const { processTypes } = await import("@velastack/pocketbase-codegen");
12626
- const typesDir = path49.resolve(cwd, ".svelte-kit", "types");
12627
- const pocketbaseDir = path49.join(typesDir, "pocketbase");
12628
- const pocketbaseTypes = path49.join(pocketbaseDir, "$types.d.ts");
12750
+ const typesDir = path51.resolve(cwd, ".svelte-kit", "types");
12751
+ const pocketbaseDir = path51.join(typesDir, "pocketbase");
12752
+ const pocketbaseTypes = path51.join(pocketbaseDir, "$types.d.ts");
12629
12753
  const regenerate = () => processTypes(pb, typesDir).catch(() => {
12630
12754
  });
12631
12755
  await regenerate();
12632
12756
  void (async () => {
12633
12757
  for (; ; ) {
12634
12758
  try {
12635
- await fs45.promises.mkdir(pocketbaseDir, { recursive: true });
12636
- for await (const event of fs45.promises.watch(pocketbaseDir)) {
12637
- if (event.eventType === "rename" && event.filename === "$types.d.ts" && !fs45.existsSync(pocketbaseTypes)) {
12759
+ await fs47.promises.mkdir(pocketbaseDir, { recursive: true });
12760
+ for await (const event of fs47.promises.watch(pocketbaseDir)) {
12761
+ if (event.eventType === "rename" && event.filename === "$types.d.ts" && !fs47.existsSync(pocketbaseTypes)) {
12638
12762
  setTimeout(regenerate, 100);
12639
12763
  }
12640
12764
  }
@@ -12646,8 +12770,8 @@ async function startWatchingTypes(cwd, pb) {
12646
12770
  }
12647
12771
 
12648
12772
  // src/commands/build.ts
12649
- import fs46 from "node:fs";
12650
- import path50 from "node:path";
12773
+ import fs48 from "node:fs";
12774
+ import path52 from "node:path";
12651
12775
  import process35 from "node:process";
12652
12776
  import { Command as Command80 } from "commander";
12653
12777
  import * as p44 from "@clack/prompts";
@@ -12689,7 +12813,7 @@ function splitHosts(value) {
12689
12813
  }
12690
12814
 
12691
12815
  // src/commands/build.ts
12692
- var PRERENDERED_DIR = path50.join(".svelte-kit", "output", "prerendered");
12816
+ var PRERENDERED_DIR = path52.join(".svelte-kit", "output", "prerendered");
12693
12817
  var build = new Command80("build").description("build the app").configureHelp(helpConfig).option("-t, --target <target>", "which copy of the app to build for", PRODUCTION_TARGET).action(async (options) => {
12694
12818
  const cwd = process35.cwd();
12695
12819
  warnIfKit2(findWorkspaceRoot(cwd) ?? cwd, (m) => p44.log.warn(m));
@@ -12707,11 +12831,11 @@ var build = new Command80("build").description("build the app").configureHelp(he
12707
12831
  onTerminate(cleanup);
12708
12832
  if (needsStart) {
12709
12833
  await ensureSuperuser(cwd);
12710
- const dataDir2 = path50.join(cwd, DATA_DIR);
12834
+ const dataDir2 = path52.join(cwd, DATA_DIR);
12711
12835
  const started = await startPocketbaseServe({
12712
12836
  dataDir: dataDir2,
12713
12837
  migrationsDir: MIGRATIONS_DIR,
12714
- hooksDir: path50.join(dataDir2, "hooks"),
12838
+ hooksDir: path52.join(dataDir2, "hooks"),
12715
12839
  dev: true
12716
12840
  });
12717
12841
  pbProc = started.proc;
@@ -12758,8 +12882,8 @@ async function originForBuild(cwd, target) {
12758
12882
  }
12759
12883
  }
12760
12884
  function warnIfPrerendered(cwd) {
12761
- const dir = path50.join(cwd, PRERENDERED_DIR);
12762
- if (!fs46.existsSync(dir) || fs46.readdirSync(dir).length === 0) return;
12885
+ const dir = path52.join(cwd, PRERENDERED_DIR);
12886
+ if (!fs48.existsSync(dir) || fs48.readdirSync(dir).length === 0) return;
12763
12887
  if (process35.env.VELA_ORIGIN === "") {
12764
12888
  p44.log.warn(
12765
12889
  `Prerendered pages were built with no origin, on purpose: this app is served on
@@ -12782,8 +12906,8 @@ Set one with ${pc16.cyan("vela deploy --domain example.com")}, or pass ${pc16.cy
12782
12906
  }
12783
12907
 
12784
12908
  // src/commands/preview.ts
12785
- import fs47 from "node:fs";
12786
- import path51 from "node:path";
12909
+ import fs49 from "node:fs";
12910
+ import path53 from "node:path";
12787
12911
  import process36 from "node:process";
12788
12912
  import { Command as Command81 } from "commander";
12789
12913
  import * as p45 from "@clack/prompts";
@@ -12791,7 +12915,7 @@ import pc17 from "picocolors";
12791
12915
  import { x as x5 } from "tinyexec";
12792
12916
  import { detect as detect8 } from "package-manager-detector";
12793
12917
  import { resolveCommand as resolveCommand6 } from "package-manager-detector/commands";
12794
- var ADAPTER_NODE_MODULE = path51.join("build", "adapter-node.js");
12918
+ var ADAPTER_NODE_MODULE = path53.join("build", "adapter-node.js");
12795
12919
  var preview = new Command81("preview").description("preview the built app").configureHelp(helpConfig).action(async () => {
12796
12920
  const cwd = process36.cwd();
12797
12921
  process36.env.VELA_DATA_DIR ??= localDataDir(cwd);
@@ -12806,11 +12930,11 @@ var preview = new Command81("preview").description("preview the built app").conf
12806
12930
  };
12807
12931
  onTerminate(cleanup);
12808
12932
  if (needsStart) {
12809
- const dataDir2 = path51.join(cwd, DATA_DIR);
12933
+ const dataDir2 = path53.join(cwd, DATA_DIR);
12810
12934
  const started = await startPocketbaseServe({
12811
12935
  dataDir: dataDir2,
12812
12936
  migrationsDir: MIGRATIONS_DIR,
12813
- hooksDir: path51.join(dataDir2, "hooks"),
12937
+ hooksDir: path53.join(dataDir2, "hooks"),
12814
12938
  dev: true
12815
12939
  });
12816
12940
  pbProc = started.proc;
@@ -12844,7 +12968,7 @@ function bakedOrigin(source) {
12844
12968
  function warnIfOriginBaked(cwd) {
12845
12969
  let source;
12846
12970
  try {
12847
- source = fs47.readFileSync(path51.join(cwd, ADAPTER_NODE_MODULE), "utf8");
12971
+ source = fs49.readFileSync(path53.join(cwd, ADAPTER_NODE_MODULE), "utf8");
12848
12972
  } catch {
12849
12973
  return;
12850
12974
  }
@@ -12860,12 +12984,12 @@ set empty so no domain is baked in.`
12860
12984
  }
12861
12985
 
12862
12986
  // src/commands/sync.ts
12863
- import path52 from "node:path";
12987
+ import path54 from "node:path";
12864
12988
  import { Command as Command82 } from "commander";
12865
12989
  var sync = new Command82("sync").description("sync types from the database").configureHelp(helpConfig).action(
12866
12990
  () => runCommand(async () => {
12867
12991
  const { workspaceRootDir } = await getWorkspace();
12868
- const typesDir = path52.join(workspaceRootDir, ".svelte-kit", "types");
12992
+ const typesDir = path54.join(workspaceRootDir, ".svelte-kit", "types");
12869
12993
  const { processTypes } = await import("@velastack/pocketbase-codegen");
12870
12994
  await withPocketbase(workspaceRootDir, async (pb) => {
12871
12995
  await processTypes(pb, typesDir);
@@ -12936,8 +13060,8 @@ var provision = addSshOptions(
12936
13060
  );
12937
13061
 
12938
13062
  // src/commands/deploy.ts
12939
- import path56 from "node:path";
12940
- import fs51 from "node:fs";
13063
+ import path58 from "node:path";
13064
+ import fs53 from "node:fs";
12941
13065
  import process38 from "node:process";
12942
13066
  import { Command as Command84, Option as Option2 } from "commander";
12943
13067
  import * as p48 from "@clack/prompts";
@@ -13055,12 +13179,12 @@ function reachedInstances(states, appId, layer) {
13055
13179
  }
13056
13180
 
13057
13181
  // src/lib/build-stack.ts
13058
- import fs49 from "node:fs";
13059
- import path54 from "node:path";
13182
+ import fs51 from "node:fs";
13183
+ import path56 from "node:path";
13060
13184
 
13061
13185
  // src/lib/static-env.ts
13062
- import fs48 from "node:fs";
13063
- import path53 from "node:path";
13186
+ import fs50 from "node:fs";
13187
+ import path55 from "node:path";
13064
13188
  import { ENV_DECL_CANDIDATES } from "@velastack/patterns";
13065
13189
  import { Node as Node5, Project as Project5, QuoteKind as QuoteKind3 } from "ts-morph";
13066
13190
  function staticEnv(root) {
@@ -13074,7 +13198,7 @@ function staticEnv(root) {
13074
13198
  };
13075
13199
  }
13076
13200
  const file = findEnvDecl(root);
13077
- const rel = file ? path53.relative(root, file).split(path53.sep).join("/") : ENV_DECL_CANDIDATES[0];
13201
+ const rel = file ? path55.relative(root, file).split(path55.sep).join("/") : ENV_DECL_CANDIDATES[0];
13078
13202
  return {
13079
13203
  names: file ? staticEnvDeclarations(file) : /* @__PURE__ */ new Set(),
13080
13204
  rule: "declarations",
@@ -13084,8 +13208,8 @@ function staticEnv(root) {
13084
13208
  }
13085
13209
  function findEnvDecl(root) {
13086
13210
  for (const rel of ENV_DECL_CANDIDATES) {
13087
- const abs = path53.join(root, rel);
13088
- if (fs48.existsSync(abs)) return abs;
13211
+ const abs = path55.join(root, rel);
13212
+ if (fs50.existsSync(abs)) return abs;
13089
13213
  }
13090
13214
  return null;
13091
13215
  }
@@ -13157,10 +13281,10 @@ var SOURCE_EXTENSIONS2 = /* @__PURE__ */ new Set([".ts", ".js", ".mts", ".mjs",
13157
13281
  var STATIC_IMPORT = /import\s*(?:type\s*)?\{([^}]*)\}\s*from\s*['"]\$env\/static\/(?:private|public)['"]/g;
13158
13282
  function staticEnvImports(root) {
13159
13283
  const names = /* @__PURE__ */ new Set();
13160
- const src = path53.join(root, "src");
13161
- if (!fs48.existsSync(src)) return names;
13284
+ const src = path55.join(root, "src");
13285
+ if (!fs50.existsSync(src)) return names;
13162
13286
  for (const file of sourceFiles2(src)) {
13163
- const content = fs48.readFileSync(file, "utf8");
13287
+ const content = fs50.readFileSync(file, "utf8");
13164
13288
  if (!content.includes("$env/static/")) continue;
13165
13289
  for (const match of content.matchAll(STATIC_IMPORT)) {
13166
13290
  for (const spec of match[1].split(",")) {
@@ -13172,11 +13296,11 @@ function staticEnvImports(root) {
13172
13296
  return names;
13173
13297
  }
13174
13298
  function* sourceFiles2(dir) {
13175
- for (const entry of fs48.readdirSync(dir, { withFileTypes: true })) {
13299
+ for (const entry of fs50.readdirSync(dir, { withFileTypes: true })) {
13176
13300
  if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
13177
- const full = path53.join(dir, entry.name);
13301
+ const full = path55.join(dir, entry.name);
13178
13302
  if (entry.isDirectory()) yield* sourceFiles2(full);
13179
- else if (SOURCE_EXTENSIONS2.has(path53.extname(entry.name))) yield full;
13303
+ else if (SOURCE_EXTENSIONS2.has(path55.extname(entry.name))) yield full;
13180
13304
  }
13181
13305
  }
13182
13306
 
@@ -13187,8 +13311,8 @@ var DevOnlyEnvError = class extends Error {
13187
13311
  function buildStack(root, input) {
13188
13312
  const env2 = { ...input.stack, ...input.derived };
13189
13313
  const blanked = [];
13190
- const file = path54.join(root, ".env");
13191
- const local = fs49.existsSync(file) ? readLocalEnvFile(file) : {};
13314
+ const file = path56.join(root, ".env");
13315
+ const local = fs51.existsSync(file) ? readLocalEnvFile(file) : {};
13192
13316
  for (const key of Object.keys(local)) {
13193
13317
  if (key in env2) continue;
13194
13318
  if (!input.tunnel && LOCAL_BUILD_KEYS.test(key)) continue;
@@ -13209,16 +13333,16 @@ The build would bake in your development value. Set ${baked.length === 1 ? "it"
13209
13333
  }
13210
13334
 
13211
13335
  // src/lib/env-nudge.ts
13212
- import fs50 from "node:fs";
13213
- import path55 from "node:path";
13336
+ import fs52 from "node:fs";
13337
+ import path57 from "node:path";
13214
13338
  import process37 from "node:process";
13215
13339
  import * as p47 from "@clack/prompts";
13216
13340
  import pc19 from "picocolors";
13217
13341
  var ENV_EXAMPLE = ".env.example";
13218
13342
  var SUPPLIED = /^(NODE_ENV|HOST|PORT|ORIGIN|PROTOCOL_HEADER|HOST_HEADER|ADDRESS_HEADER|XFF_DEPTH|PB_PORT|POCKETBASE_URL|POCKETBASE_SUPERUSER_EMAIL|POCKETBASE_SUPERUSER_PASSWORD|APP_NAME|VELA_)/;
13219
13343
  function missingFromExample(root, present) {
13220
- const file = path55.join(root, ENV_EXAMPLE);
13221
- if (!fs50.existsSync(file)) return [];
13344
+ const file = path57.join(root, ENV_EXAMPLE);
13345
+ if (!fs52.existsSync(file)) return [];
13222
13346
  const have = new Set(present);
13223
13347
  return Object.keys(readLocalEnvFile(file)).filter((key) => !have.has(key) && !SUPPLIED.test(key)).sort();
13224
13348
  }
@@ -13567,12 +13691,12 @@ ${pc20.cyan(err.snippet)}` : err.message);
13567
13691
  current = detectAdapter(workspaceRootDir);
13568
13692
  } catch {
13569
13693
  }
13570
- const editable = current !== void 0 && !/^svelte\.config\./.test(path56.basename(current.file));
13694
+ const editable = current !== void 0 && !/^svelte\.config\./.test(path58.basename(current.file));
13571
13695
  if (current && editable && (current.kind === "auto" || current.kind === "none") && isInteractive()) {
13572
13696
  const has = current.kind === "auto" ? `is on ${ADAPTER_AUTO}` : "has no SvelteKit adapter configured";
13573
13697
  const confirmed = await p48.confirm({
13574
13698
  message: `This project ${has}, and vela deploy runs the app as a Node server.
13575
- Switch it to ${ADAPTER_NODE}? This edits ${path56.basename(current.file)} and package.json.`
13699
+ Switch it to ${ADAPTER_NODE}? This edits ${path58.basename(current.file)} and package.json.`
13576
13700
  });
13577
13701
  if (p48.isCancel(confirmed) || !confirmed) {
13578
13702
  p48.cancel("Nothing was changed, and nothing was deployed.");
@@ -13696,7 +13820,7 @@ async function uploadRelease(session, instance, release, entries) {
13696
13820
  }
13697
13821
  function isDirectory(target) {
13698
13822
  try {
13699
- return fs51.statSync(target).isDirectory();
13823
+ return fs53.statSync(target).isDirectory();
13700
13824
  } catch {
13701
13825
  return false;
13702
13826
  }
@@ -13737,7 +13861,7 @@ async function serverTimeOrLocal(session) {
13737
13861
  }
13738
13862
 
13739
13863
  // src/commands/link.ts
13740
- import path57 from "node:path";
13864
+ import path59 from "node:path";
13741
13865
  import process39 from "node:process";
13742
13866
  import { Command as Command85 } from "commander";
13743
13867
  import * as p49 from "@clack/prompts";
@@ -13800,12 +13924,12 @@ async function promptProjectName(workspaceRootDir) {
13800
13924
  }
13801
13925
  function defaultProjectName2(workspaceRootDir) {
13802
13926
  try {
13803
- const pkg = readPackageJson(path57.join(workspaceRootDir, "package.json"));
13927
+ const pkg = readPackageJson(path59.join(workspaceRootDir, "package.json"));
13804
13928
  const name = pkg.name;
13805
13929
  if (typeof name === "string" && name.trim()) return name.trim();
13806
13930
  } catch {
13807
13931
  }
13808
- return path57.basename(workspaceRootDir);
13932
+ return path59.basename(workspaceRootDir);
13809
13933
  }
13810
13934
 
13811
13935
  // src/commands/env.ts
@@ -13818,17 +13942,17 @@ import * as p52 from "@clack/prompts";
13818
13942
  import pc23 from "picocolors";
13819
13943
 
13820
13944
  // src/lib/local-env.ts
13821
- import fs52 from "node:fs";
13945
+ import fs54 from "node:fs";
13822
13946
  import * as p50 from "@clack/prompts";
13823
13947
  import pc21 from "picocolors";
13824
13948
  function readLocalEnv(envFile) {
13825
- if (!fs52.existsSync(envFile)) return {};
13949
+ if (!fs54.existsSync(envFile)) return {};
13826
13950
  return readLocalEnvFile(envFile);
13827
13951
  }
13828
13952
  function editLocalEnv(envFile, edit) {
13829
- const before = fs52.existsSync(envFile) ? fs52.readFileSync(envFile, "utf8") : "";
13953
+ const before = fs54.existsSync(envFile) ? fs54.readFileSync(envFile, "utf8") : "";
13830
13954
  const after = edit(before);
13831
- if (after !== before) fs52.writeFileSync(envFile, after);
13955
+ if (after !== before) fs54.writeFileSync(envFile, after);
13832
13956
  }
13833
13957
  function setLocalEnv(envFile, key, value) {
13834
13958
  editLocalEnv(envFile, (content) => upsertEnvVar(content, key, value));
@@ -14357,8 +14481,8 @@ var envUnset = addEnvTargetOptions(
14357
14481
  );
14358
14482
 
14359
14483
  // src/commands/env/import.ts
14360
- import fs53 from "node:fs";
14361
- import path58 from "node:path";
14484
+ import fs55 from "node:fs";
14485
+ import path60 from "node:path";
14362
14486
  import process42 from "node:process";
14363
14487
  import { Command as Command89 } from "commander";
14364
14488
  import * as p55 from "@clack/prompts";
@@ -14429,10 +14553,10 @@ function report2(outcome, where) {
14429
14553
  p55.log.success(`${parts.join(", ")} variable(s) updated ${pc26.dim(`(${where})`)}`);
14430
14554
  }
14431
14555
  function resolve(file) {
14432
- return path58.resolve(process42.cwd(), file);
14556
+ return path60.resolve(process42.cwd(), file);
14433
14557
  }
14434
14558
  function read(resolved, shown) {
14435
- if (!fs53.existsSync(resolved)) throw new Error(`${shown} does not exist.`);
14559
+ if (!fs55.existsSync(resolved)) throw new Error(`${shown} does not exist.`);
14436
14560
  const incoming = readLocalEnvFile(resolved);
14437
14561
  if (Object.keys(incoming).length === 0) p55.log.info(`${shown} has no variables to import.`);
14438
14562
  return incoming;
@@ -14821,8 +14945,8 @@ var admin = new Command96("admin").description("manage admin panel logins").conf
14821
14945
  import { Command as Command102 } from "commander";
14822
14946
 
14823
14947
  // src/commands/backup/create.ts
14824
- import fs54 from "node:fs";
14825
- import path59 from "node:path";
14948
+ import fs56 from "node:fs";
14949
+ import path61 from "node:path";
14826
14950
  import { Command as Command97 } from "commander";
14827
14951
  import * as p60 from "@clack/prompts";
14828
14952
  import pc32 from "picocolors";
@@ -15036,12 +15160,12 @@ Your bucket's own versioning is what protects the uploaded files.`
15036
15160
  }, "Failed to create the backup.")
15037
15161
  );
15038
15162
  async function download(ctx, key, outputDir) {
15039
- const dir = path59.resolve(ctx.workspaceRootDir, outputDir);
15040
- fs54.mkdirSync(dir, { recursive: true });
15041
- const destination = path59.join(dir, key);
15163
+ const dir = path61.resolve(ctx.workspaceRootDir, outputDir);
15164
+ fs56.mkdirSync(dir, { recursive: true });
15165
+ const destination = path61.join(dir, key);
15042
15166
  if (!ctx.session) {
15043
- fs54.copyFileSync(path59.join(ctx.workspaceRootDir, "data", "backups", key), destination);
15044
- return path59.relative(ctx.workspaceRootDir, destination);
15167
+ fs56.copyFileSync(path61.join(ctx.workspaceRootDir, "data", "backups", key), destination);
15168
+ return path61.relative(ctx.workspaceRootDir, destination);
15045
15169
  }
15046
15170
  const spinner9 = p60.spinner();
15047
15171
  spinner9.start(`Downloading ${key}`);
@@ -15052,7 +15176,7 @@ async function download(ctx, key, outputDir) {
15052
15176
  throw error;
15053
15177
  }
15054
15178
  spinner9.stop(`Downloaded ${key}`);
15055
- return path59.relative(ctx.workspaceRootDir, destination);
15179
+ return path61.relative(ctx.workspaceRootDir, destination);
15056
15180
  }
15057
15181
 
15058
15182
  // src/commands/backup/list.ts
@@ -15086,8 +15210,8 @@ Take one with ${pc33.cyan("vela backup create")}.`
15086
15210
  );
15087
15211
 
15088
15212
  // src/commands/backup/download.ts
15089
- import fs55 from "node:fs";
15090
- import path60 from "node:path";
15213
+ import fs57 from "node:fs";
15214
+ import path62 from "node:path";
15091
15215
  import { Command as Command99 } from "commander";
15092
15216
  import * as p62 from "@clack/prompts";
15093
15217
  import pc34 from "picocolors";
@@ -15114,11 +15238,11 @@ Run ${pc34.cyan("vela backup list")} to see what it does have.`
15114
15238
  Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
15115
15239
  );
15116
15240
  }
15117
- const dir = path60.resolve(ctx.workspaceRootDir, options.output);
15118
- fs55.mkdirSync(dir, { recursive: true });
15119
- const destination = path60.join(dir, key);
15241
+ const dir = path62.resolve(ctx.workspaceRootDir, options.output);
15242
+ fs57.mkdirSync(dir, { recursive: true });
15243
+ const destination = path62.join(dir, key);
15120
15244
  if (!ctx.session) {
15121
- fs55.copyFileSync(path60.join(ctx.workspaceRootDir, "data", "backups", key), destination);
15245
+ fs57.copyFileSync(path62.join(ctx.workspaceRootDir, "data", "backups", key), destination);
15122
15246
  } else {
15123
15247
  const spinner9 = p62.spinner();
15124
15248
  spinner9.start(`Downloading ${key} (${formatBytes(found.size)})`);
@@ -15132,7 +15256,7 @@ Fetch it from the bucket directly \u2014 vela does not hold its credentials.`
15132
15256
  }
15133
15257
  reportResult({
15134
15258
  summary: `Saved ${key} from ${ctx.targetName}.`,
15135
- filesCreated: [path60.relative(ctx.workspaceRootDir, destination)]
15259
+ filesCreated: [path62.relative(ctx.workspaceRootDir, destination)]
15136
15260
  });
15137
15261
  });
15138
15262
  }, "Failed to download the backup.")
@@ -15227,8 +15351,8 @@ Set one with ${pc36.cyan('vela backup schedule "0 3 * * *"')}.`
15227
15351
  var backup = new Command102("backup").description("back up the database and uploads, locally or on a target").configureHelp(helpConfig).addCommand(backupCreate).addCommand(backupList).addCommand(backupDownload).addCommand(backupDelete).addCommand(backupSchedule);
15228
15352
 
15229
15353
  // src/commands/restore.ts
15230
- import fs56 from "node:fs";
15231
- import path61 from "node:path";
15354
+ import fs58 from "node:fs";
15355
+ import path63 from "node:path";
15232
15356
  import process46 from "node:process";
15233
15357
  import { Command as Command103 } from "commander";
15234
15358
  import * as p65 from "@clack/prompts";
@@ -15258,7 +15382,7 @@ Run \`vela deploy\` first, then restore.`
15258
15382
  `${ctx.targetName} was deployed without a database, so there is nothing to restore.`
15259
15383
  );
15260
15384
  }
15261
- const local = source && fs56.existsSync(source) ? source : void 0;
15385
+ const local = source && fs58.existsSync(source) ? source : void 0;
15262
15386
  const key = local ? void 0 : await resolveKey(ctx, source);
15263
15387
  if (!options.yes) {
15264
15388
  await confirm13(ctx.appName, ctx.targetName, ctx.envTag, local ?? key);
@@ -15281,7 +15405,7 @@ Run \`vela deploy\` first, then restore.`
15281
15405
  });
15282
15406
  p65.log.success(
15283
15407
  `Restored ${pc37.cyan(`${ctx.appName} (${ctx.targetName})`)} from ${pc37.cyan(
15284
- local ? path61.basename(local) : key
15408
+ local ? path63.basename(local) : key
15285
15409
  )}.`
15286
15410
  );
15287
15411
  if (result?.storageCarriedOver) {
@@ -15347,21 +15471,21 @@ Take one with ${pc37.cyan("vela backup create")}, or pass the path to an archive
15347
15471
  }
15348
15472
  async function stage(ctx, file) {
15349
15473
  const dir = remotePaths.restoreStage(ctx.instance);
15350
- const remote = `${dir}/${path61.basename(file)}`;
15474
+ const remote = `${dir}/${path63.basename(file)}`;
15351
15475
  const spinner9 = p65.spinner();
15352
- spinner9.start(`Uploading ${path61.basename(file)}`);
15476
+ spinner9.start(`Uploading ${path63.basename(file)}`);
15353
15477
  try {
15354
15478
  await ctx.session.script(`mkdir -p "$1"`, { args: [dir] });
15355
15479
  await ctx.session.upload([file], dir);
15356
15480
  } catch (error) {
15357
- spinner9.stop(`Could not upload ${path61.basename(file)}.`);
15481
+ spinner9.stop(`Could not upload ${path63.basename(file)}.`);
15358
15482
  throw error;
15359
15483
  }
15360
- spinner9.stop(`Uploaded ${path61.basename(file)}`);
15484
+ spinner9.stop(`Uploaded ${path63.basename(file)}`);
15361
15485
  return remote;
15362
15486
  }
15363
15487
  async function confirm13(appName, targetName, envTag, from) {
15364
- const what = `${pc37.cyan(`${appName} (${targetName})`)} from ${pc37.cyan(path61.basename(from))}`;
15488
+ const what = `${pc37.cyan(`${appName} (${targetName})`)} from ${pc37.cyan(path63.basename(from))}`;
15365
15489
  if (isProd(envTag)) {
15366
15490
  const answer = await p65.text({
15367
15491
  message: `This replaces the database and uploads of ${what}. Type the app name to confirm`,
@@ -15471,7 +15595,7 @@ Release and domain are shown from what this project recorded.`
15471
15595
  }
15472
15596
 
15473
15597
  // src/commands/test.ts
15474
- import path62 from "node:path";
15598
+ import path64 from "node:path";
15475
15599
  import process47 from "node:process";
15476
15600
  import { Command as Command105 } from "commander";
15477
15601
  import PocketBase7 from "pocketbase";
@@ -15479,21 +15603,21 @@ import pc39 from "picocolors";
15479
15603
  import { x as x6 } from "tinyexec";
15480
15604
  import { detect as detect9 } from "package-manager-detector";
15481
15605
  import { resolveCommand as resolveCommand7 } from "package-manager-detector/commands";
15482
- import fs57 from "node:fs";
15606
+ import fs59 from "node:fs";
15483
15607
  var testServer = new Command105("test:server").description("run server tests").allowUnknownOption(true).allowExcessArguments(true).configureHelp(helpConfig).action(async (_opts, cmd) => {
15484
15608
  const cwd = process47.cwd();
15485
15609
  warnIfKit2(cwd, (m) => console.warn(pc39.yellow(`\u25B2 ${m}`)));
15486
15610
  const email2 = `test-${Math.random().toString(36).slice(2)}@example.com`;
15487
15611
  const password8 = "password";
15488
- const testDataDir = path62.join(cwd, "test-data");
15489
- fs57.rmSync(testDataDir, { recursive: true, force: true });
15612
+ const testDataDir = path64.join(cwd, "test-data");
15613
+ fs59.rmSync(testDataDir, { recursive: true, force: true });
15490
15614
  const { stop, url } = await launchPocketbase(cwd, {
15491
15615
  dir: testDataDir,
15492
- migrationsDir: path62.join(cwd, MIGRATIONS_DIR),
15616
+ migrationsDir: path64.join(cwd, MIGRATIONS_DIR),
15493
15617
  // The app's PocketBase hooks (slug generation, personal teams, …) are part
15494
15618
  // of its behaviour; the suite runs against the same server dev and build
15495
15619
  // start, so it loads them from the same place.
15496
- hooksDir: path62.join(cwd, DATA_DIR, "hooks"),
15620
+ hooksDir: path64.join(cwd, DATA_DIR, "hooks"),
15497
15621
  email: email2,
15498
15622
  password: password8
15499
15623
  });
@@ -15509,7 +15633,7 @@ var testServer = new Command105("test:server").description("run server tests").a
15509
15633
  if (cleanedUp) return;
15510
15634
  cleanedUp = true;
15511
15635
  stop();
15512
- fs57.rmSync(testDataDir, { recursive: true, force: true });
15636
+ fs59.rmSync(testDataDir, { recursive: true, force: true });
15513
15637
  };
15514
15638
  const cleanup = async () => {
15515
15639
  if (cleanedUp) return;
@@ -15622,8 +15746,8 @@ function stubPagesPlugin() {
15622
15746
  }
15623
15747
 
15624
15748
  // src/commands/routes.ts
15625
- import fs58 from "node:fs";
15626
- import path63 from "node:path";
15749
+ import fs60 from "node:fs";
15750
+ import path65 from "node:path";
15627
15751
  import { Command as Command106 } from "commander";
15628
15752
  var HTTP_METHODS = /* @__PURE__ */ new Set([
15629
15753
  "GET",
@@ -15637,30 +15761,30 @@ var HTTP_METHODS = /* @__PURE__ */ new Set([
15637
15761
  ]);
15638
15762
  var routes = new Command106("routes").description("list routes").configureHelp(helpConfig).action(async () => {
15639
15763
  const { workspaceRootDir, routesDir } = await getWorkspace();
15640
- const routesRoot = path63.join(workspaceRootDir, routesDir);
15764
+ const routesRoot = path65.join(workspaceRootDir, routesDir);
15641
15765
  const found = walk(routesRoot, routesRoot).filter((r) => r.methods.length > 0);
15642
15766
  found.sort((a, b) => a.urlPattern.localeCompare(b.urlPattern));
15643
15767
  printTable(found);
15644
15768
  });
15645
15769
  function walk(root, dir) {
15646
- const entries = fs58.readdirSync(dir, { withFileTypes: true });
15770
+ const entries = fs60.readdirSync(dir, { withFileTypes: true });
15647
15771
  const routes2 = [];
15648
15772
  const hasLeaf = entries.some((e) => e.isFile() && isRouteFile(e.name));
15649
15773
  if (hasLeaf) {
15650
- const id = "/" + path63.relative(root, dir).split(path63.sep).filter(Boolean).join("/");
15774
+ const id = "/" + path65.relative(root, dir).split(path65.sep).filter(Boolean).join("/");
15651
15775
  const urlPattern = id.replace(/\([^)]+\)\/?/g, "").replace(/\/$/, "") || "/";
15652
15776
  const methods = /* @__PURE__ */ new Set();
15653
15777
  for (const entry of entries) {
15654
15778
  if (!entry.isFile()) continue;
15655
15779
  if (entry.name.endsWith("+page.svelte")) methods.add("GET");
15656
15780
  if (entry.name.endsWith("+server.ts") || entry.name.endsWith("+server.js") || entry.name.endsWith("+page.server.ts") || entry.name.endsWith("+page.server.js")) {
15657
- extractMethods(path63.join(dir, entry.name)).forEach((m) => methods.add(m));
15781
+ extractMethods(path65.join(dir, entry.name)).forEach((m) => methods.add(m));
15658
15782
  }
15659
15783
  }
15660
15784
  routes2.push({ id: id || "/", urlPattern, methods: [...methods] });
15661
15785
  }
15662
15786
  for (const entry of entries) {
15663
- if (entry.isDirectory()) routes2.push(...walk(root, path63.join(dir, entry.name)));
15787
+ if (entry.isDirectory()) routes2.push(...walk(root, path65.join(dir, entry.name)));
15664
15788
  }
15665
15789
  return routes2;
15666
15790
  }
@@ -15669,7 +15793,7 @@ function isRouteFile(name) {
15669
15793
  }
15670
15794
  function extractMethods(file) {
15671
15795
  try {
15672
- const content = fs58.readFileSync(file, "utf8");
15796
+ const content = fs60.readFileSync(file, "utf8");
15673
15797
  const methods = [];
15674
15798
  const exportRegex = /export\s+(?:const|async\s+function|function)\s+(\w+)/g;
15675
15799
  let match;
@@ -15710,8 +15834,8 @@ function printTable(routes2) {
15710
15834
  }
15711
15835
 
15712
15836
  // src/commands/i18n.ts
15713
- import fs59 from "node:fs";
15714
- import path64 from "node:path";
15837
+ import fs61 from "node:fs";
15838
+ import path66 from "node:path";
15715
15839
  import process48 from "node:process";
15716
15840
  import { Command as Command107 } from "commander";
15717
15841
  import { x as x7 } from "tinyexec";
@@ -15720,7 +15844,7 @@ import { resolveCommand as resolveCommand8 } from "package-manager-detector/comm
15720
15844
  var WUCHALE_CONFIG_NAMES = ["js", "mjs", "ts", "mts"].map((ext) => `wuchale.config.${ext}`);
15721
15845
  async function runWuchale(extraArgs) {
15722
15846
  const cwd = findWorkspaceRoot() ?? process48.cwd();
15723
- if (!WUCHALE_CONFIG_NAMES.some((name) => fs59.existsSync(path64.join(cwd, name)))) {
15847
+ if (!WUCHALE_CONFIG_NAMES.some((name) => fs61.existsSync(path66.join(cwd, name)))) {
15724
15848
  throw new Error("No wuchale config found. Run `vela enable i18n` to set up i18n.");
15725
15849
  }
15726
15850
  const pm = (await detect10({ cwd }))?.name ?? "npm";
@@ -15848,7 +15972,7 @@ import pc42 from "picocolors";
15848
15972
 
15849
15973
  // src/lib/cms-backend.ts
15850
15974
  import { createRequire as createRequire5 } from "node:module";
15851
- import path65 from "node:path";
15975
+ import path67 from "node:path";
15852
15976
  import process50 from "node:process";
15853
15977
  import { pathToFileURL as pathToFileURL2 } from "node:url";
15854
15978
  import pc41 from "picocolors";
@@ -15856,7 +15980,7 @@ var DEFAULT_PROJECT = "default";
15856
15980
  async function loadBackendModule(root) {
15857
15981
  let entry;
15858
15982
  try {
15859
- entry = createRequire5(path65.join(root, "package.json")).resolve("@velastack/cms/backend");
15983
+ entry = createRequire5(path67.join(root, "package.json")).resolve("@velastack/cms/backend");
15860
15984
  } catch {
15861
15985
  throw new Error(
15862
15986
  `@velastack/cms is not installed in this project.
@@ -15874,8 +15998,8 @@ async function withCmsBackend(fn, cwd = process50.cwd()) {
15874
15998
  const { createCmsBackend } = await loadBackendModule(root);
15875
15999
  const dataDir2 = localDataDir(root);
15876
16000
  const backend3 = createCmsBackend({
15877
- dbPath: path65.join(dataDir2, "cms.sqlite"),
15878
- uploadDir: path65.join(dataDir2, "uploads")
16001
+ dbPath: path67.join(dataDir2, "cms.sqlite"),
16002
+ uploadDir: path67.join(dataDir2, "uploads")
15879
16003
  });
15880
16004
  try {
15881
16005
  return await fn(backend3);
@@ -16162,20 +16286,20 @@ var program = new Command118().name(package_default.name).description(package_de
16162
16286
  program.hook("preAction", (_thisCommand, actionCommand) => {
16163
16287
  const envRoot = findWorkspaceRoot() ?? process54.cwd();
16164
16288
  dotenv2.config({ path: nodePath.join(envRoot, ".env"), quiet: true });
16165
- const path66 = getCommandPath(actionCommand);
16166
- if (NO_BACKEND_COMMMANDS.has(path66)) return;
16167
- if (PROVIDER_GATED_COMMANDS.has(path66)) return;
16168
- const top = path66.split(" ", 1)[0];
16289
+ const path68 = getCommandPath(actionCommand);
16290
+ if (NO_BACKEND_COMMMANDS.has(path68)) return;
16291
+ if (PROVIDER_GATED_COMMANDS.has(path68)) return;
16292
+ const top = path68.split(" ", 1)[0];
16169
16293
  if (NO_BACKEND_COMMMANDS.has(top)) return;
16170
16294
  if (!hasBackend()) {
16171
16295
  if (BACKEND_OPTIONAL_COMMANDS.has(top)) return;
16172
- p74.log.error(missingBackendMessage(`vela ${path66}`));
16296
+ p74.log.error(missingBackendMessage(`vela ${path68}`));
16173
16297
  p74.log.message();
16174
16298
  p74.cancel("Operation failed.");
16175
16299
  process54.exit(1);
16176
16300
  }
16177
- if (SELF_CREDENTIALED_COMMANDS.has(path66)) return;
16178
- if (path66 === "generate migration" && actionCommand.opts().ai) return;
16301
+ if (SELF_CREDENTIALED_COMMANDS.has(path68)) return;
16302
+ if (path68 === "generate migration" && actionCommand.opts().ai) return;
16179
16303
  if (!hasSuperuserCredentials()) {
16180
16304
  p74.log.error(missingCredentialsMessage());
16181
16305
  p74.log.message();