void 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { c as getToken, d as removeToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
1
+ import { c as getToken, d as removeToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
2
2
  import { c as R } from "./dist-abzUneor.mjs";
3
- import { n as runLoginCommand } from "./login-CkLr-AaI.mjs";
3
+ import { n as runLoginCommand } from "./login-BZ1Yk9Xw.mjs";
4
4
  import { execSync } from "node:child_process";
5
5
  //#region src/cli/auth-cmd.ts
6
6
  async function runAuthCommand(root, args) {
@@ -1,5 +1,5 @@
1
1
  import { i as dim, n as cliTitle, r as createSpinner } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-CNpUbUHd.mjs";
@@ -1,5 +1,5 @@
1
1
  import { n as cliTitle } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { c as R, g as ge, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  //#region src/cli/cancel-deploy.ts
package/dist/cli/cli.mjs CHANGED
@@ -1516,7 +1516,7 @@ else if (command === "deploy") {
1516
1516
  R.error(err instanceof Error ? err.message : String(err));
1517
1517
  process.exit(1);
1518
1518
  }
1519
- import("../deploy-BlXg0sMS.mjs").then((n) => n.t).then(({ runDeploy }) => {
1519
+ import("../deploy-D-sNgH78.mjs").then((n) => n.t).then(({ runDeploy }) => {
1520
1520
  runDeploy(root, {
1521
1521
  projectSlug: deployArgs.projectSlug,
1522
1522
  dir: deployArgs.dir,
@@ -1528,12 +1528,12 @@ else if (command === "deploy") {
1528
1528
  process.exit(1);
1529
1529
  });
1530
1530
  });
1531
- } else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-B1-7r6ng.mjs").then(({ runAuthCommand }) => runAuthCommand(root, parsed)));
1532
- else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-JQUzv3qF.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
1533
- else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-mz8t_CML.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
1534
- else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-UfLrp2vc.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
1535
- else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-BvKxda3n.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
1536
- else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-Cvdbbm_N.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
1531
+ } else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-C-fMtekZ.mjs").then(({ runAuthCommand }) => runAuthCommand(root, parsed)));
1532
+ else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-BUuTuUOR.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
1533
+ else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-BQ_MxdCB.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
1534
+ else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-BrCzfzL6.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
1535
+ else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-CpHRUvOY.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
1536
+ else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-I4RIGp1N.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
1537
1537
  else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-Cn2hZ8RR.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
1538
1538
  else if (command === "prepare") {
1539
1539
  const root = process.cwd();
@@ -1552,7 +1552,7 @@ else if (command === "prepare") {
1552
1552
  });
1553
1553
  } else if (command === "init") {
1554
1554
  const root = process.cwd();
1555
- import("../init-CbNCFFWx.mjs").then(({ runInitCommand, parseInitArgs }) => {
1555
+ import("../init-DVqPUMVz.mjs").then(({ runInitCommand, parseInitArgs }) => {
1556
1556
  let initArgs;
1557
1557
  try {
1558
1558
  initArgs = parseInitArgs(args.slice(1));
@@ -1565,7 +1565,7 @@ else if (command === "prepare") {
1565
1565
  process.exit(1);
1566
1566
  });
1567
1567
  });
1568
- } else if (command === "mcp") import("../mcp-B84MmVAW.mjs").then(({ runMcp }) => {
1568
+ } else if (command === "mcp") import("../mcp-Blxy-04t.mjs").then(({ runMcp }) => {
1569
1569
  runMcp();
1570
1570
  });
1571
1571
  else if (command === "-v" || command === "--version") {
@@ -1641,26 +1641,26 @@ else if (command === "-v" || command === "--version") {
1641
1641
  const root = process.cwd();
1642
1642
  switch (cmd) {
1643
1643
  case "init": {
1644
- const { runInitCommand, parseInitArgs } = await import("../init-CbNCFFWx.mjs");
1644
+ const { runInitCommand, parseInitArgs } = await import("../init-DVqPUMVz.mjs");
1645
1645
  await runInitCommand(root, parseInitArgs([]));
1646
1646
  return;
1647
1647
  }
1648
1648
  case "deploy": {
1649
- const { runDeploy } = await import("../deploy-BlXg0sMS.mjs").then((n) => n.t);
1649
+ const { runDeploy } = await import("../deploy-D-sNgH78.mjs").then((n) => n.t);
1650
1650
  await runDeploy(root);
1651
1651
  return;
1652
1652
  }
1653
1653
  case "mcp": {
1654
- const { runMcp } = await import("../mcp-B84MmVAW.mjs");
1654
+ const { runMcp } = await import("../mcp-Blxy-04t.mjs");
1655
1655
  runMcp();
1656
1656
  return;
1657
1657
  }
1658
- case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-B1-7r6ng.mjs").then(({ runAuthCommand }) => runAuthCommand(r, p)));
1659
- case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-JQUzv3qF.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
1660
- case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-mz8t_CML.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
1661
- case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-UfLrp2vc.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
1662
- case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-BvKxda3n.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
1663
- case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-Cvdbbm_N.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
1658
+ case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-C-fMtekZ.mjs").then(({ runAuthCommand }) => runAuthCommand(r, p)));
1659
+ case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-BUuTuUOR.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
1660
+ case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-BQ_MxdCB.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
1661
+ case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-BrCzfzL6.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
1662
+ case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-CpHRUvOY.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
1663
+ case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-I4RIGp1N.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
1664
1664
  case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-Cn2hZ8RR.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
1665
1665
  case "prepare": {
1666
1666
  const { runPrepareCommand } = await import("../prepare-BrAISonG.mjs");
@@ -656,8 +656,10 @@ var PlatformClient = class {
656
656
  if (!res.ok) await throwPlatformApiError("Failed to delete project", res);
657
657
  return res.json();
658
658
  }
659
- async getMigrationStatus(projectId) {
660
- const res = await fetch(`${this.baseUrl}/projects/${projectId}/migrations`, { headers: { ...this.authHeaders } });
659
+ async getMigrationStatus(projectId, dialect) {
660
+ const url = new URL(`${this.baseUrl}/projects/${projectId}/migrations`);
661
+ if (dialect) url.searchParams.set("dialect", dialect);
662
+ const res = await fetch(url, { headers: { ...this.authHeaders } });
661
663
  if (!res.ok) await throwPlatformApiError("Failed to get migration status", res);
662
664
  return res.json();
663
665
  }
@@ -1,6 +1,6 @@
1
1
  import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
2
2
  import { s as import_picocolors } from "./output-DeiS4oEX.mjs";
3
- import { s as getSiteDomain, t as PlatformApiError } from "./client-C-nH6yz3.mjs";
3
+ import { s as getSiteDomain, t as PlatformApiError } from "./client-CCOKwNUz.mjs";
4
4
  import { _ as me, c as R, i as Ee, l as Re, x as q } from "./dist-abzUneor.mjs";
5
5
  import { a as writeProjectConfig } from "./project-CH9pdo16.mjs";
6
6
  import { n as validateProjectSlug } from "./project-slug-De4UjtD9.mjs";
@@ -1,7 +1,7 @@
1
1
  import { a as join, c as resolve, r as extname, s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
2
2
  import { i as dim, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
3
3
  import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
4
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
4
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
5
5
  import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
6
6
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
7
7
  import { c as getDatabaseDialect, f as readConfig } from "./config-BVEC0lti.mjs";
@@ -167,7 +167,7 @@ async function runStatus(root, dialect) {
167
167
  const token = getToken(root);
168
168
  const config = readProjectConfig(root);
169
169
  if (token && config) try {
170
- remoteApplied = (await new PlatformClient(token, { root }).getMigrationStatus(config.projectId)).applied;
170
+ remoteApplied = (await new PlatformClient(token, { root }).getMigrationStatus(config.projectId, dialect)).applied;
171
171
  } catch {}
172
172
  const remoteSet = remoteApplied ? new Set(remoteApplied.map((m) => m.name)) : null;
173
173
  const lines = [];
@@ -337,7 +337,7 @@ async function runMigrate(root, dialect, remote) {
337
337
  const client = new PlatformClient(token, { root });
338
338
  let remoteApplied;
339
339
  try {
340
- const status = await client.getMigrationStatus(config.projectId);
340
+ const status = await client.getMigrationStatus(config.projectId, dialect);
341
341
  remoteApplied = new Set(status.applied.map((m) => m.name));
342
342
  } catch (err) {
343
343
  R.error(`db: Failed to fetch remote migration status: '${err instanceof Error ? err.message : String(err)}'.`);
@@ -1,5 +1,5 @@
1
1
  import { n as cliTitle, r as createSpinner } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { _ as me, c as R, g as ge, l as Re, u as Se, x as q, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { i as removeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  import { r as resolveProjectBySlug } from "./resolve-project-CNpUbUHd.mjs";
@@ -3,7 +3,7 @@ import { a as join, c as resolve, i as isAbsolute, n as dirname, r as extname, s
3
3
  import { n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-DeiS4oEX.mjs";
4
4
  import { i as resolveProjectPaths, n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
5
5
  import { t as findVoidAuthConfig } from "./config-hhMYPVRT.mjs";
6
- import { a as isExpiredTokenError, c as getToken, i as isCliOutdatedError, l as getTokenSource, n as PlatformClient, o as parsePlatformErrorBody, t as PlatformApiError, u as isStagingMode } from "./client-C-nH6yz3.mjs";
6
+ import { a as isExpiredTokenError, c as getToken, i as isCliOutdatedError, l as getTokenSource, n as PlatformClient, o as parsePlatformErrorBody, t as PlatformApiError, u as isStagingMode } from "./client-CCOKwNUz.mjs";
7
7
  import { c as R, g as ge, u as Se, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
8
8
  import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
9
9
  import { c as getDatabaseDialect, f as readConfig, l as isNodeTarget, p as resolveBindingNames } from "./config-BVEC0lti.mjs";
@@ -18,10 +18,10 @@ import { t as collectMigrations } from "./collect-9rO3JFNM.mjs";
18
18
  import { n as buildMigrationPlanBundle } from "./plan-aD3wRDqF.mjs";
19
19
  import { r as validateMigrations, t as assertJournalCoherence } from "./validate-CNWm-PsL.mjs";
20
20
  import { t as scanPages } from "./scan-2YmJkYAf.mjs";
21
- import { i as promptProjectSetupAction, n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-BGnQMy5N.mjs";
21
+ import { i as promptProjectSetupAction, n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-DmGoYMqF.mjs";
22
22
  import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-CNpUbUHd.mjs";
23
23
  import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-wAPJigtE.mjs";
24
- import { t as promptForLoginToken } from "./login-CkLr-AaI.mjs";
24
+ import { t as promptForLoginToken } from "./login-BZ1Yk9Xw.mjs";
25
25
  import { i as resolveProjectCommand, n as detectPreset, r as formatProjectCommand, t as FRAMEWORK_PRESETS } from "./preset-BRsCi8ZB.mjs";
26
26
  import { createRequire } from "node:module";
27
27
  import { copyFileSync, cpSync, createWriteStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
@@ -40,23 +40,31 @@ function isApiRoutePattern(pattern) {
40
40
  function hasDocumentRoutes(routes) {
41
41
  return routes.some((route) => !isApiRoutePattern(route.pattern));
42
42
  }
43
+ function hasApiRoutes(routes) {
44
+ return routes.some((route) => isApiRoutePattern(route.pattern));
45
+ }
43
46
  /**
44
47
  * Returns true when browser document navigations must reach the worker before
45
48
  * a static asset fallback can serve HTML.
46
49
  */
47
50
  function workerOwnsHtmlRouting(inputs) {
48
- return inputs.isSsr || inputs.hasPages || inputs.hasDocumentRoutes || inputs.hasMiddleware || inputs.hasWebSockets === true || inputs.authEnabled === true || inputs.liveEnabled === true;
51
+ return inputs.isSsr || inputs.hasPages || inputs.hasDocumentRoutes || inputs.hasMiddleware || inputs.hasWebSockets === true || inputs.liveEnabled === true;
49
52
  }
50
53
  function resolveAssetConfig(inputs) {
51
54
  return resolveAssetRoutingPolicy(inputs).assetConfig;
52
55
  }
53
56
  function resolveAssetRoutingPolicy(inputs) {
54
57
  const workerFirst = workerOwnsHtmlRouting(inputs);
58
+ const apiWorkerFirst = !workerFirst && (inputs.hasApiRoutes === true || inputs.authEnabled === true);
55
59
  return {
56
60
  assetConfig: workerFirst ? {
57
61
  not_found_handling: "none",
58
62
  run_worker_first: ["/**"]
63
+ } : apiWorkerFirst ? {
64
+ not_found_handling: "single-page-application",
65
+ run_worker_first: ["/api", "/api/*"]
59
66
  } : { not_found_handling: "single-page-application" },
67
+ apiWorkerFirst,
60
68
  workerFirst,
61
69
  workerSpaFallback: workerFirst && !inputs.isSsr && !inputs.hasPages
62
70
  };
@@ -3054,6 +3062,7 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
3054
3062
  }));
3055
3063
  const hasPages = existsSync(paths.pagesDir);
3056
3064
  const hasRoutes = routeScan.routes.length > 0;
3065
+ const hasApiRoutes$1 = hasApiRoutes(routeScan.routes) || hasApiRoutes(webSockets) || authEnabled;
3057
3066
  const hasDocumentRoutes$1 = hasDocumentRoutes(routeScan.routes);
3058
3067
  const hasMiddleware = routeScan.middleware.length > 0;
3059
3068
  const hasWebSockets = webSockets.length > 0;
@@ -3108,6 +3117,7 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
3108
3117
  const assetConfig = resolveAssetConfig({
3109
3118
  isSsr,
3110
3119
  hasPages,
3120
+ hasApiRoutes: hasApiRoutes$1,
3111
3121
  hasDocumentRoutes: hasDocumentRoutes$1,
3112
3122
  hasMiddleware,
3113
3123
  hasWebSockets: hasDocumentRoutes(webSockets),
@@ -3445,4 +3455,4 @@ function resolveWorkerDirName(distDir, fwPreset, buildCommand) {
3445
3455
  throw new Error("deploy: Worker output not found. Expected dist/ssr/ or dist/rsc/.");
3446
3456
  }
3447
3457
  //#endregion
3448
- export { isSandboxEnabled as C, resolveAssetRoutingPolicy as E, SANDBOX_MIGRATION_TAG as S, hasDocumentRoutes as T, normalizeWranglerCompatibilityFlags as _, prerenderPagesNode as a, resolveLiveBindingConfig as b, filterLoadedEnv as c, LIVE_MIGRATION_TAG as d, ensureWranglerCompat as f, nextDurableObjectMigrationTag as g, hasDurableObjectSqliteMigration as h, prerenderPages as i, resolveRemoteMode as l, ensureWranglerNodejsAlsFlag as m, resolveDistDir as n, DEFAULT_PROXY_URL as o, ensureWranglerCompatibilityDate as p, resolveWorkerDirName as r, STAGING_PROXY_URL as s, deploy_exports as t, stripInternalEnvKeys as u, readExistingLiveBindingConfig as v, resolveSandboxConfig as w, syncWranglerBindings as x, readWranglerCompat as y };
3458
+ export { isSandboxEnabled as C, resolveAssetRoutingPolicy as D, hasDocumentRoutes as E, SANDBOX_MIGRATION_TAG as S, hasApiRoutes as T, normalizeWranglerCompatibilityFlags as _, prerenderPagesNode as a, resolveLiveBindingConfig as b, filterLoadedEnv as c, LIVE_MIGRATION_TAG as d, ensureWranglerCompat as f, nextDurableObjectMigrationTag as g, hasDurableObjectSqliteMigration as h, prerenderPages as i, resolveRemoteMode as l, ensureWranglerNodejsAlsFlag as m, resolveDistDir as n, DEFAULT_PROXY_URL as o, ensureWranglerCompatibilityDate as p, resolveWorkerDirName as r, STAGING_PROXY_URL as s, deploy_exports as t, stripInternalEnvKeys as u, readExistingLiveBindingConfig as v, resolveSandboxConfig as w, syncWranglerBindings as x, readWranglerCompat as y };
@@ -1,5 +1,5 @@
1
1
  import { s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { c as R, u as Se } from "./dist-abzUneor.mjs";
4
4
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  //#region src/cli/domain.ts
@@ -1,6 +1,6 @@
1
1
  import { a as join } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
2
2
  import { n as cliTitle } from "./output-DeiS4oEX.mjs";
3
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
3
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
4
4
  import { c as R, g as ge, u as Se, y as ye } from "./dist-abzUneor.mjs";
5
5
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
6
6
  import { r as generateEnvTypes, t as findEnvFile } from "./env-types-D6qI1ThV.mjs";
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { r as __toESM } from "./chunk-DJd-R1mw.mjs";
2
2
  import { a as join, n as dirname, s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
3
3
  import { u as require_picocolors } from "./output-DeiS4oEX.mjs";
4
- import { C as isSandboxEnabled, E as resolveAssetRoutingPolicy, S as SANDBOX_MIGRATION_TAG, T as hasDocumentRoutes, _ as normalizeWranglerCompatibilityFlags, a as prerenderPagesNode, b as resolveLiveBindingConfig, c as filterLoadedEnv, d as LIVE_MIGRATION_TAG, f as ensureWranglerCompat, g as nextDurableObjectMigrationTag, h as hasDurableObjectSqliteMigration, i as prerenderPages, l as resolveRemoteMode, m as ensureWranglerNodejsAlsFlag, n as resolveDistDir, o as DEFAULT_PROXY_URL, p as ensureWranglerCompatibilityDate, r as resolveWorkerDirName, s as STAGING_PROXY_URL, u as stripInternalEnvKeys, v as readExistingLiveBindingConfig, w as resolveSandboxConfig, x as syncWranglerBindings, y as readWranglerCompat } from "./deploy-BlXg0sMS.mjs";
4
+ import { C as isSandboxEnabled, D as resolveAssetRoutingPolicy, E as hasDocumentRoutes, S as SANDBOX_MIGRATION_TAG, T as hasApiRoutes, _ as normalizeWranglerCompatibilityFlags, a as prerenderPagesNode, b as resolveLiveBindingConfig, c as filterLoadedEnv, d as LIVE_MIGRATION_TAG, f as ensureWranglerCompat, g as nextDurableObjectMigrationTag, h as hasDurableObjectSqliteMigration, i as prerenderPages, l as resolveRemoteMode, m as ensureWranglerNodejsAlsFlag, n as resolveDistDir, o as DEFAULT_PROXY_URL, p as ensureWranglerCompatibilityDate, r as resolveWorkerDirName, s as STAGING_PROXY_URL, u as stripInternalEnvKeys, v as readExistingLiveBindingConfig, w as resolveSandboxConfig, x as syncWranglerBindings, y as readWranglerCompat } from "./deploy-D-sNgH78.mjs";
5
5
  import { i as resolveProjectPaths, n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-CCMrHYQm.mjs";
6
6
  import { n as loadVoidAuthConfig, t as findVoidAuthConfig } from "./config-hhMYPVRT.mjs";
7
- import { c as getToken, u as isStagingMode } from "./client-C-nH6yz3.mjs";
7
+ import { c as getToken, u as isStagingMode } from "./client-CCOKwNUz.mjs";
8
8
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
9
9
  import { c as getDatabaseDialect, f as readConfig, l as isNodeTarget, p as resolveBindingNames } from "./config-BVEC0lti.mjs";
10
10
  import { a as scanQueuesSync, i as scanWebSocketRoutesSync, n as scanRoutePatternsSync, o as scanJobsSync, r as scanRoutes, t as scanMiddlewareSync } from "./scan-DzzHqtiT.mjs";
@@ -4252,6 +4252,7 @@ function routingPlugin(root, options) {
4252
4252
  if (!scan) return resolveAssetRoutingPolicy({
4253
4253
  isSsr: Boolean(ssr),
4254
4254
  hasPages: false,
4255
+ hasApiRoutes: compileOptions.auth !== null,
4255
4256
  hasDocumentRoutes: false,
4256
4257
  hasMiddleware: false,
4257
4258
  hasWebSockets: false,
@@ -4261,6 +4262,7 @@ function routingPlugin(root, options) {
4261
4262
  return resolveAssetRoutingPolicy({
4262
4263
  isSsr: Boolean(ssr),
4263
4264
  hasPages: scan.pages.pages.length > 0,
4265
+ hasApiRoutes: hasApiRoutes(scan.routes) || hasApiRoutes(scan.websockets ?? []) || compileOptions.auth !== null,
4264
4266
  hasDocumentRoutes: hasDocumentRoutes(scan.routes),
4265
4267
  hasMiddleware: scan.middleware.length > 0,
4266
4268
  hasWebSockets: hasDocumentRoutes(scan.websockets ?? []),
@@ -4756,7 +4758,7 @@ const STAGING_API_URL = "https://api.staging.void.cloud";
4756
4758
  */
4757
4759
  async function runAiSetupPrompt(root, token, staging, server) {
4758
4760
  const { select, text, isCancel, log } = await import("./dist-abzUneor.mjs").then((n) => n.p);
4759
- const { PlatformClient } = await import("./client-C-nH6yz3.mjs").then((n) => n.r);
4761
+ const { PlatformClient } = await import("./client-CCOKwNUz.mjs").then((n) => n.r);
4760
4762
  const { writeProjectConfig } = await import("./project-CH9pdo16.mjs").then((n) => n.n);
4761
4763
  const { inferDefaultSlug } = await import("./resolve-project-CNpUbUHd.mjs").then((n) => n.i);
4762
4764
  const client = new PlatformClient(token, staging ? STAGING_API_URL : DEFAULT_API_URL);
@@ -4785,7 +4787,7 @@ async function runAiSetupPrompt(root, token, staging, server) {
4785
4787
  let slug;
4786
4788
  if (result === "__create__") {
4787
4789
  const { validateProjectSlug } = await import("./project-slug-De4UjtD9.mjs").then((n) => n.t);
4788
- const { createProjectWithSlugRetry } = await import("./create-project-BGnQMy5N.mjs").then((n) => n.t);
4790
+ const { createProjectWithSlugRetry } = await import("./create-project-DmGoYMqF.mjs").then((n) => n.t);
4789
4791
  let created;
4790
4792
  try {
4791
4793
  created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
@@ -5116,7 +5118,7 @@ function voidPlugin(options) {
5116
5118
  ...env
5117
5119
  };
5118
5120
  const assets = workerConfig.assets;
5119
- if (command === "serve" && assets?.run_worker_first) assets.run_worker_first = [...DEV_ASSET_ROUTING_EXCLUSIONS, "/**"];
5121
+ if (command === "serve" && assets?.run_worker_first?.includes("/**")) assets.run_worker_first = [...DEV_ASSET_ROUTING_EXCLUSIONS, "/**"];
5120
5122
  const watchConfig = { server: { watch: { ignored } } };
5121
5123
  if (!isNodeTarget(config.target) && config.output !== "static") {
5122
5124
  const envNames = framework === "vinext-app" ? ["rsc", "ssr"] : ["ssr"];
@@ -5302,10 +5304,13 @@ function voidPlugin(options) {
5302
5304
  const ssrEntry = validateSsrEntry(root, paths);
5303
5305
  const hasPages = existsSync(paths.pagesDir);
5304
5306
  const hasMiddleware = scanMiddlewareSync(root, paths).length > 0;
5305
- const hasDocumentRoutes$1 = hasDocumentRoutes(scanRoutePatternsSync(root, paths));
5307
+ const routePatterns = scanRoutePatternsSync(root, paths);
5308
+ const hasDocumentRoutes$1 = hasDocumentRoutes(routePatterns);
5309
+ const hasApiRoutes$1 = hasApiRoutes(routePatterns) || hasApiRoutes(websocketRoutes) || authEnabled;
5306
5310
  let assetRouting = resolveAssetRoutingPolicy({
5307
5311
  isSsr: Boolean(ssrEntry),
5308
5312
  hasPages,
5313
+ hasApiRoutes: hasApiRoutes$1,
5309
5314
  hasDocumentRoutes: hasDocumentRoutes$1,
5310
5315
  hasMiddleware,
5311
5316
  hasWebSockets: hasDocumentRoutes(websocketRoutes),
@@ -5322,7 +5327,7 @@ function voidPlugin(options) {
5322
5327
  }
5323
5328
  function updateDevAssetRoutingPolicy(next) {
5324
5329
  const previous = assetRouting;
5325
- const requiresRestart = previous.workerFirst !== next.workerFirst || previous.assetConfig.not_found_handling !== next.assetConfig.not_found_handling;
5330
+ const requiresRestart = previous.workerFirst !== next.workerFirst || previous.apiWorkerFirst !== next.apiWorkerFirst || previous.assetConfig.not_found_handling !== next.assetConfig.not_found_handling || JSON.stringify(previous.assetConfig.run_worker_first) !== JSON.stringify(next.assetConfig.run_worker_first);
5326
5331
  assetRouting = next;
5327
5332
  if (requiresRestart) applyAssetRoutingPolicy(next);
5328
5333
  return requiresRestart;
@@ -1,7 +1,7 @@
1
1
  import { a as join, c as resolve, i as isAbsolute, n as dirname, s as relative, t as basename } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
2
2
  import { n as cliTitle } from "./output-DeiS4oEX.mjs";
3
3
  import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
4
- import { c as getToken, n as PlatformClient, u as isStagingMode } from "./client-C-nH6yz3.mjs";
4
+ import { c as getToken, n as PlatformClient, u as isStagingMode } from "./client-CCOKwNUz.mjs";
5
5
  import { _ as me, c as R, g as ge, i as Ee, l as Re, u as Se, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
6
6
  import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
7
7
  import { c as getDatabaseDialect, f as readConfig } from "./config-BVEC0lti.mjs";
@@ -11,8 +11,8 @@ import { n as ensureProjectTsconfig, t as createProjectTsconfig } from "./projec
11
11
  import { t as MagicString } from "./magic-string.es-C1Fb0uxq.mjs";
12
12
  import { n as writeDrizzleConfig } from "./config--wXmVOoe.mjs";
13
13
  import { n as getAgentById, r as getPackageDir, t as detectAgents } from "./agents-Dkgafwfr.mjs";
14
- import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-BGnQMy5N.mjs";
15
- import { t as promptForLoginToken } from "./login-CkLr-AaI.mjs";
14
+ import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-DmGoYMqF.mjs";
15
+ import { t as promptForLoginToken } from "./login-BZ1Yk9Xw.mjs";
16
16
  import { r as formatProjectCommand } from "./preset-BRsCi8ZB.mjs";
17
17
  import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-QgEYVC3V.mjs";
18
18
  import { createRequire } from "node:module";
@@ -1,8 +1,8 @@
1
1
  import { n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient, s as getSiteDomain } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient, s as getSiteDomain } from "./client-CCOKwNUz.mjs";
3
3
  import { _ as me, c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
- import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-BGnQMy5N.mjs";
5
+ import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-DmGoYMqF.mjs";
6
6
  //#region src/cli/link.ts
7
7
  async function runLink(root, slug) {
8
8
  console.log();
@@ -1,5 +1,5 @@
1
1
  import { a as ensureUtc, i as dim, l as tablePrefix, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  import { r as resolveProjectBySlug } from "./resolve-project-CNpUbUHd.mjs";
@@ -1,5 +1,5 @@
1
1
  import { n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
- import { a as isExpiredTokenError, c as getToken, d as removeToken, f as runLogin, l as getTokenSource, n as PlatformClient, p as saveToken, u as isStagingMode } from "./client-C-nH6yz3.mjs";
2
+ import { a as isExpiredTokenError, c as getToken, d as removeToken, f as runLogin, l as getTokenSource, n as PlatformClient, p as saveToken, u as isStagingMode } from "./client-CCOKwNUz.mjs";
3
3
  import { _ as me, c as R, g as ge, i as Ee, x as q, y as ye } from "./dist-abzUneor.mjs";
4
4
  //#region src/cli/login.ts
5
5
  async function promptForLoginToken(root = process.cwd()) {
@@ -1,5 +1,5 @@
1
1
  import { i as dim, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  //#region src/cli/logs.ts
@@ -1,5 +1,5 @@
1
1
  import { a as join, n as dirname } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { a as writeProjectConfig } from "./project-CH9pdo16.mjs";
4
4
  import { existsSync, readFileSync, readdirSync } from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
@@ -1,5 +1,5 @@
1
1
  import { i as dim, l as tablePrefix, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient, s as getSiteDomain } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient, s as getSiteDomain } from "./client-CCOKwNUz.mjs";
3
3
  import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
4
4
  //#region src/cli/projects.ts
5
5
  async function runProjectsCommand(root) {
@@ -34,32 +34,32 @@ async function runProjectsCommand(root) {
34
34
  //#region src/cli/project-cmd.ts
35
35
  async function runProjectCommand(root, args) {
36
36
  if (args.subcommand === "status") {
37
- const { runListCommand } = await import("./list-ezL7hqDV.mjs");
37
+ const { runListCommand } = await import("./list-IPEcrLnM.mjs");
38
38
  return runListCommand(root, args.name || void 0);
39
39
  }
40
40
  if (args.subcommand === "link") {
41
- const { runLink } = await import("./link-C5x1E-XZ.mjs");
41
+ const { runLink } = await import("./link-GWTu3YvD.mjs");
42
42
  return runLink(root, args.name || void 0);
43
43
  }
44
44
  if (args.subcommand === "list") return runProjectsCommand(root);
45
45
  if (args.subcommand === "logs") {
46
- const { runLogsCommand } = await import("./logs-MnGILmLz.mjs");
46
+ const { runLogsCommand } = await import("./logs-CNF59Q_p.mjs");
47
47
  return runLogsCommand(root, args.filter, args.range, args.deployment || void 0, args.level || void 0);
48
48
  }
49
49
  if (args.subcommand === "rollback") {
50
- const { runRollbackCommand } = await import("./rollback-CoAAvC18.mjs");
50
+ const { runRollbackCommand } = await import("./rollback-vUeM-X4o.mjs");
51
51
  return runRollbackCommand(root, args.deployId || void 0);
52
52
  }
53
53
  if (args.subcommand === "cancel") {
54
- const { runCancelDeployCommand } = await import("./cancel-deploy-B4j31z7d.mjs");
54
+ const { runCancelDeployCommand } = await import("./cancel-deploy-CGL_UJwR.mjs");
55
55
  return runCancelDeployCommand(root, args.deployId || void 0);
56
56
  }
57
57
  if (args.subcommand === "delete") {
58
- const { runDeleteCommand } = await import("./delete-eMGTHHB9.mjs");
58
+ const { runDeleteCommand } = await import("./delete-BPVqSrkA.mjs");
59
59
  return runDeleteCommand(root, args.name || void 0, { force: args.force });
60
60
  }
61
61
  if (args.subcommand === "purge-cache") {
62
- const { runPurgeCacheCommand } = await import("./cache-CGYC-2LW.mjs");
62
+ const { runPurgeCacheCommand } = await import("./cache-CstDt4gH.mjs");
63
63
  return runPurgeCacheCommand(root, args.projectSlug || void 0);
64
64
  }
65
65
  }
@@ -1,5 +1,5 @@
1
1
  import { a as ensureUtc, i as dim, n as cliTitle, r as createSpinner, s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { _ as me, c as R, g as ge, i as Ee, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  //#region src/cli/rollback.ts
@@ -1,5 +1,5 @@
1
1
  import { n as cliTitle } from "./output-DeiS4oEX.mjs";
2
- import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
2
+ import { c as getToken, n as PlatformClient } from "./client-CCOKwNUz.mjs";
3
3
  import { _ as me, c as R, g as ge, n as Ce, u as Se, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
4
4
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
5
  import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-CNpUbUHd.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "void",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voidzero-dev/void.git",
@@ -333,7 +333,7 @@
333
333
  "valibot": ">=1.0.0-beta.7",
334
334
  "vite": "^8.0.0",
335
335
  "zod": "^3.25.0 || ^4.0.0",
336
- "@void/md": "0.8.3"
336
+ "@void/md": "0.8.5"
337
337
  },
338
338
  "peerDependenciesMeta": {
339
339
  "@void/md": {
@@ -73,13 +73,13 @@ Static assets can run in front of the worker, behind the worker, or without any
73
73
 
74
74
  ### Deploy shapes
75
75
 
76
- | Shape | Worker deployed | First handler for assets | First handler for document navigations | Miss behavior |
77
- | --------------------------------------------------------------------------------------- | --------------- | ------------------------ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
78
- | `inference.appType: "static"` | No | Asset platform | Asset platform | Platform 404 page. |
79
- | Static SPA deploy | No | Asset platform | Asset platform | Platform serves `/index.html` for unmatched navigations. If user `routing.fallbacks` exist, Void ships fallback rules. |
80
- | Void app with only `/api` routes | Yes | Asset platform | Asset platform | Static navigations keep the platform SPA fallback; API asset misses fall through to the worker route table. |
81
- | Void app with `middleware/`, managed auth, non-`/api` routes, WebSockets, live bindings | Yes | Worker first | Worker first | Asset misses stay 404, then the worker serves `/index.html` for HTML requests after routes and middleware run. |
82
- | Pages, SSR, and framework apps | Yes | Worker first | Worker first | Asset misses stay 404. Pages, SSR, or framework rendering owns HTML responses, including intentional HTML 404s. |
76
+ | Shape | Worker deployed | First handler for assets | First handler for document navigations | Miss behavior |
77
+ | ---------------------------------------------------------------------------------- | --------------- | ------------------------ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
78
+ | `inference.appType: "static"` | No | Asset platform | Asset platform | Platform 404 page. |
79
+ | Static SPA deploy | No | Asset platform | Asset platform | Platform serves `/index.html` for unmatched navigations. If user `routing.fallbacks` exist, Void ships fallback rules. |
80
+ | Void app with only `/api` routes or managed auth | Yes | Worker first for `/api` | Asset platform | Static navigations keep the platform SPA fallback; API requests, including document navigations, reach the worker. |
81
+ | Void app with `middleware/`, non-`/api` routes, document WebSockets, live bindings | Yes | Worker first | Worker first | Asset misses stay 404, then the worker serves `/index.html` for HTML requests after routes and middleware run. |
82
+ | Pages, SSR, and framework apps | Yes | Worker first | Worker first | Asset misses stay 404. Pages, SSR, or framework rendering owns HTML responses, including intentional HTML 404s. |
83
83
 
84
84
  ### Worker-first Void apps
85
85
 
@@ -95,7 +95,7 @@ This is the path needed for preview auth and other middleware. Cloudflare's plat
95
95
 
96
96
  ### Asset-first Void apps
97
97
 
98
- For Void apps with only `/api` routes, Void does not enable `run_worker_first`. Static assets and SPA navigations stay on the asset platform. Requests that do not resolve to an asset and are not handled by the platform SPA fallback, such as `/api/hello`, fall through to the worker.
98
+ For Void apps with only `/api` routes, Void keeps the platform SPA fallback and scopes `run_worker_first` to `/api` and `/api/*`. Static assets and non-API SPA navigations stay on the asset platform. API requests, including browser document navigations such as OAuth callbacks, reach the worker instead of being rewritten to `index.html`.
99
99
 
100
100
  ### Generated config
101
101