void 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-7EA_lKq9.mjs").then((n) => n.t).then(({ runDeploy }) => {
1519
+ import("../deploy-Cr8F6801.mjs").then((n) => n.t).then(({ runDeploy }) => {
1520
1520
  runDeploy(root, {
1521
1521
  projectSlug: deployArgs.projectSlug,
1522
1522
  dir: deployArgs.dir,
@@ -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-DL6syXuF.mjs").then(({ runInitCommand, parseInitArgs }) => {
1555
+ import("../init-CbNCFFWx.mjs").then(({ runInitCommand, parseInitArgs }) => {
1556
1556
  let initArgs;
1557
1557
  try {
1558
1558
  initArgs = parseInitArgs(args.slice(1));
@@ -1641,12 +1641,12 @@ 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-DL6syXuF.mjs");
1644
+ const { runInitCommand, parseInitArgs } = await import("../init-CbNCFFWx.mjs");
1645
1645
  await runInitCommand(root, parseInitArgs([]));
1646
1646
  return;
1647
1647
  }
1648
1648
  case "deploy": {
1649
- const { runDeploy } = await import("../deploy-7EA_lKq9.mjs").then((n) => n.t);
1649
+ const { runDeploy } = await import("../deploy-Cr8F6801.mjs").then((n) => n.t);
1650
1650
  await runDeploy(root);
1651
1651
  return;
1652
1652
  }
@@ -2781,24 +2781,30 @@ async function runFrameworkDeploy(root, config, client, detected, fwPreset, void
2781
2781
  R.error(getErrorMessage(err));
2782
2782
  process.exit(1);
2783
2783
  }
2784
- if (dialect === "postgresql" && (bindings.needsD1 || rawMigrations.length > 0)) try {
2785
- if (!(await client.getResources(config.projectId)).some((resource) => resource.type === "hyperdrive")) {
2786
- const { text: promptText, isCancel: isCancelPrompt } = await import("./dist-abzUneor.mjs").then((n) => n.p);
2787
- const connectionString = await promptText({
2788
- message: "Your project uses PostgreSQL. Enter your connection string:",
2789
- placeholder: "postgresql://user:pass@host:5432/dbname",
2790
- validate(value) {
2791
- if (!value?.startsWith("postgres://") && !value?.startsWith("postgresql://")) return "Must start with \"postgres://\" or \"postgresql://\"";
2784
+ if (dialect === "postgresql" && (bindings.needsD1 || rawMigrations.length > 0)) {
2785
+ let resources = null;
2786
+ try {
2787
+ resources = await client.getResources(config.projectId);
2788
+ } catch {}
2789
+ if (resources) {
2790
+ if (!resources.some((resource) => resource.type === "hyperdrive")) {
2791
+ const { text: promptText, isCancel: isCancelPrompt } = await import("./dist-abzUneor.mjs").then((n) => n.p);
2792
+ const connectionString = await promptText({
2793
+ message: "Your project uses PostgreSQL. Enter your connection string:",
2794
+ placeholder: "postgresql://user:pass@host:5432/dbname",
2795
+ validate(value) {
2796
+ if (!value?.startsWith("postgres://") && !value?.startsWith("postgresql://")) return "Must start with \"postgres://\" or \"postgresql://\"";
2797
+ }
2798
+ });
2799
+ if (isCancelPrompt(connectionString)) {
2800
+ R.info("Deploy cancelled.");
2801
+ process.exit(0);
2792
2802
  }
2793
- });
2794
- if (isCancelPrompt(connectionString)) {
2795
- R.info("Deploy cancelled.");
2796
- process.exit(0);
2803
+ await client.provisionDatabase(config.projectId, connectionString);
2804
+ R.success("Hyperdrive provisioned.");
2797
2805
  }
2798
- await client.provisionDatabase(config.projectId, connectionString);
2799
- R.success("Hyperdrive provisioned.");
2800
2806
  }
2801
- } catch {}
2807
+ }
2802
2808
  const rawJobs = scanJobsSync(root, paths.cronsDir);
2803
2809
  const rawQueues = scanQueuesSync(root, paths.queuesDir);
2804
2810
  const originalEntry = join(workerDir, fwPreset.workerMain);
@@ -2996,24 +3002,30 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
2996
3002
  R.error(getErrorMessage(err));
2997
3003
  process.exit(1);
2998
3004
  }
2999
- if (dialect === "postgresql" && (effectiveBindings.needsD1 || rawMigrations.length > 0)) try {
3000
- if (!(await client.getResources(config.projectId)).some((resource) => resource.type === "hyperdrive")) {
3001
- const { text: promptText, isCancel: isCancelPrompt } = await import("./dist-abzUneor.mjs").then((n) => n.p);
3002
- const connectionString = await promptText({
3003
- message: "Your project uses PostgreSQL. Enter your connection string:",
3004
- placeholder: "postgresql://user:pass@host:5432/dbname",
3005
- validate(value) {
3006
- if (!value?.startsWith("postgres://") && !value?.startsWith("postgresql://")) return "Must start with \"postgres://\" or \"postgresql://\"";
3005
+ if (dialect === "postgresql" && (effectiveBindings.needsD1 || rawMigrations.length > 0)) {
3006
+ let resources = null;
3007
+ try {
3008
+ resources = await client.getResources(config.projectId);
3009
+ } catch {}
3010
+ if (resources) {
3011
+ if (!resources.some((resource) => resource.type === "hyperdrive")) {
3012
+ const { text: promptText, isCancel: isCancelPrompt } = await import("./dist-abzUneor.mjs").then((n) => n.p);
3013
+ const connectionString = await promptText({
3014
+ message: "Your project uses PostgreSQL. Enter your connection string:",
3015
+ placeholder: "postgresql://user:pass@host:5432/dbname",
3016
+ validate(value) {
3017
+ if (!value?.startsWith("postgres://") && !value?.startsWith("postgresql://")) return "Must start with \"postgres://\" or \"postgresql://\"";
3018
+ }
3019
+ });
3020
+ if (isCancelPrompt(connectionString)) {
3021
+ R.info("Deploy cancelled.");
3022
+ process.exit(0);
3007
3023
  }
3008
- });
3009
- if (isCancelPrompt(connectionString)) {
3010
- R.info("Deploy cancelled.");
3011
- process.exit(0);
3024
+ await client.provisionDatabase(config.projectId, connectionString);
3025
+ R.success("Hyperdrive provisioned.");
3012
3026
  }
3013
- await client.provisionDatabase(config.projectId, connectionString);
3014
- R.success("Hyperdrive provisioned.");
3015
3027
  }
3016
- } catch {}
3028
+ }
3017
3029
  const workerDirName = resolveWorkerDirName(distDir, fwPreset, frameworkBuildCmd);
3018
3030
  const schedules = scanJobsSync(root, paths.cronsDir).flatMap((job) => job.crons.map((cron) => ({
3019
3031
  name: job.name,
@@ -3095,7 +3107,7 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
3095
3107
  hasPages,
3096
3108
  hasDocumentRoutes: hasDocumentRoutes$1,
3097
3109
  hasMiddleware,
3098
- hasWebSockets,
3110
+ hasWebSockets: hasDocumentRoutes(webSockets),
3099
3111
  authEnabled,
3100
3112
  liveEnabled: liveConfig !== void 0
3101
3113
  });
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
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-7EA_lKq9.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-Cr8F6801.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
7
  import { c as getToken, u as isStagingMode } from "./client-C-nH6yz3.mjs";
@@ -3983,9 +3983,16 @@ function compileHeaderMiddleware(lines, rules) {
3983
3983
  lines.push(" for (const rule of __headerRules) {");
3984
3984
  lines.push(" if (__matchPattern(rule.pattern, pathname)) matched.push(...rule.headers);");
3985
3985
  lines.push(" }");
3986
+ lines.push(" if (matched.length === 0) return;");
3987
+ lines.push(" const headers = new Headers(c.res.headers);");
3986
3988
  lines.push(" for (const [name, value] of matched) {");
3987
- lines.push(" c.res.headers.set(name, value);");
3989
+ lines.push(" headers.set(name, value);");
3988
3990
  lines.push(" }");
3991
+ lines.push(" c.res = new Response(c.res.body, {");
3992
+ lines.push(" headers,");
3993
+ lines.push(" status: c.res.status,");
3994
+ lines.push(" statusText: c.res.statusText,");
3995
+ lines.push(" });");
3989
3996
  lines.push("});");
3990
3997
  lines.push("");
3991
3998
  }
@@ -4256,7 +4263,7 @@ function routingPlugin(root, options) {
4256
4263
  hasPages: scan.pages.pages.length > 0,
4257
4264
  hasDocumentRoutes: hasDocumentRoutes(scan.routes),
4258
4265
  hasMiddleware: scan.middleware.length > 0,
4259
- hasWebSockets: (scan.websockets?.length ?? 0) > 0,
4266
+ hasWebSockets: hasDocumentRoutes(scan.websockets ?? []),
4260
4267
  authEnabled: compileOptions.auth !== null,
4261
4268
  liveEnabled: options.live !== void 0
4262
4269
  });
@@ -5301,7 +5308,7 @@ function voidPlugin(options) {
5301
5308
  hasPages,
5302
5309
  hasDocumentRoutes: hasDocumentRoutes$1,
5303
5310
  hasMiddleware,
5304
- hasWebSockets: websocketRoutes.length > 0,
5311
+ hasWebSockets: hasDocumentRoutes(websocketRoutes),
5305
5312
  authEnabled,
5306
5313
  liveEnabled: liveConfig !== void 0
5307
5314
  });
@@ -638,6 +638,8 @@ const EMPTY_PROJECT_ALLOWED_ENTRIES = new Set([
638
638
  ".vscode",
639
639
  ".idea",
640
640
  ".DS_Store",
641
+ ".void",
642
+ ".wrangler",
641
643
  "node_modules",
642
644
  "package.json",
643
645
  "package-lock.json",
@@ -645,6 +647,7 @@ const EMPTY_PROJECT_ALLOWED_ENTRIES = new Set([
645
647
  "yarn.lock",
646
648
  "bun.lock",
647
649
  "bun.lockb",
650
+ "tsconfig.json",
648
651
  ".agents",
649
652
  ".claude",
650
653
  ".cline",
@@ -672,11 +675,55 @@ const PNPM_ALLOWED_BUILDS = [
672
675
  const drizzleKitBin = join(fileURLToPath(import.meta.resolve("drizzle-kit")), "..", "bin.cjs");
673
676
  const EMPTY_PROJECT_ALLOWED_PACKAGES = new Set([
674
677
  "void",
678
+ "hono",
679
+ "vite",
680
+ "vite-plus",
681
+ "typescript",
682
+ "@typescript/native-preview",
683
+ "@rolldown/plugin-babel",
684
+ "@vitejs/plugin-react",
685
+ "babel-plugin-react-compiler",
686
+ "@types/react",
687
+ "@types/react-dom",
688
+ "react",
689
+ "react-dom",
690
+ "vue",
691
+ "svelte",
692
+ "solid-js",
693
+ "@void/react",
694
+ "@void/vue",
695
+ "@void/svelte",
696
+ "@void/solid"
697
+ ]);
698
+ const EMPTY_PROJECT_ALLOWED_ADAPTER_PACKAGES = new Set([
675
699
  "@void/react",
676
700
  "@void/vue",
677
701
  "@void/svelte",
678
702
  "@void/solid"
679
703
  ]);
704
+ const EMPTY_PROJECT_BASE_PACKAGES = new Set([
705
+ "void",
706
+ "@void/react",
707
+ "@void/vue",
708
+ "@void/svelte",
709
+ "@void/solid"
710
+ ]);
711
+ const EMPTY_PROJECT_ALLOWED_SCRIPTS = {
712
+ test: void 0,
713
+ dev: new Set(["vite", "vp dev"]),
714
+ build: new Set(["vite build", "vp build"]),
715
+ preview: new Set(["vite preview", "vp preview"])
716
+ };
717
+ const EMPTY_PROJECT_STARTER_SCRIPT_COMMANDS = new Set(Object.values(EMPTY_PROJECT_ALLOWED_SCRIPTS).flatMap((commands) => commands ? Array.from(commands) : []));
718
+ function isStarterScriptCommand(value) {
719
+ return typeof value === "string" && EMPTY_PROJECT_STARTER_SCRIPT_COMMANDS.has(value);
720
+ }
721
+ function hasOnlyVoidStarterDependencies(depNames) {
722
+ if (depNames.some((dep) => !EMPTY_PROJECT_ALLOWED_PACKAGES.has(dep))) return false;
723
+ const hasStarterDependency = depNames.some((dep) => !EMPTY_PROJECT_BASE_PACKAGES.has(dep));
724
+ const hasPagesAdapter = depNames.some((dep) => EMPTY_PROJECT_ALLOWED_ADAPTER_PACKAGES.has(dep));
725
+ return !hasStarterDependency || hasPagesAdapter;
726
+ }
680
727
  const VITE_CONFIG_FILES = [
681
728
  "vite.config.ts",
682
729
  "vite.config.js",
@@ -832,9 +879,14 @@ function isScaffoldableEmptyProject(root) {
832
879
  ...asRecord(pkg.dependencies) ?? {},
833
880
  ...asRecord(pkg.devDependencies) ?? {}
834
881
  };
835
- if (Object.keys(deps).some((dep) => !EMPTY_PROJECT_ALLOWED_PACKAGES.has(dep))) return false;
882
+ if (!hasOnlyVoidStarterDependencies(Object.keys(deps))) return false;
836
883
  const scripts = asRecord(pkg.scripts) ?? {};
837
- if (Object.keys(scripts).some((name) => name !== "test")) return false;
884
+ for (const [name, command] of Object.entries(scripts)) {
885
+ if (!(name in EMPTY_PROJECT_ALLOWED_SCRIPTS)) return false;
886
+ const allowed = EMPTY_PROJECT_ALLOWED_SCRIPTS[name];
887
+ if (allowed === void 0) continue;
888
+ if (typeof command !== "string" || !allowed.has(command)) return false;
889
+ }
838
890
  return true;
839
891
  }
840
892
  function shouldPromptForInitLocation(root) {
@@ -1952,7 +2004,10 @@ function scaffoldPagesApp(root, packageManager, framework, starterMode, toolchai
1952
2004
  if (!pkg.type) pkg.type = "module";
1953
2005
  const scripts = asRecord(pkg.scripts) ?? {};
1954
2006
  pkg.scripts = scripts;
1955
- for (const [name, command] of Object.entries(template.scripts)) if (!scripts[name]) scripts[name] = command;
2007
+ for (const [name, command] of Object.entries(template.scripts)) {
2008
+ const existing = scripts[name];
2009
+ if (typeof existing !== "string" || isStarterScriptCommand(existing)) scripts[name] = command;
2010
+ }
1956
2011
  const dependencies = asRecord(pkg.dependencies) ?? {};
1957
2012
  const devDependencies = asRecord(pkg.devDependencies) ?? {};
1958
2013
  pkg.dependencies = dependencies;
@@ -2328,6 +2383,9 @@ export default defineConfig({
2328
2383
  });
2329
2384
  `;
2330
2385
  }
2386
+ function getGeneratedViteConfigPath(root) {
2387
+ return readPackageJson(root)?.type === "module" ? "vite.config.ts" : "vite.config.mts";
2388
+ }
2331
2389
  function noteManualViteConfigSetup(configPath) {
2332
2390
  Se(`Could not safely update ${configPath ?? "your framework Vite config"} automatically.\n\nAdd \`voidPlugin()\` to the top-level Vite plugins array:\n\nimport { voidPlugin } from "void";\n\nexport default defineConfig({\n plugins: [voidPlugin()],\n});`, "Manual Vite config step");
2333
2391
  }
@@ -2349,7 +2407,7 @@ function ensureExistingProjectViteConfig(root, framework) {
2349
2407
  }
2350
2408
  const configPath = findViteConfig(root);
2351
2409
  if (!configPath) {
2352
- writeFileIfMissing(root, "vite.config.ts", getBasicVoidViteConfig());
2410
+ writeFileIfMissing(root, getGeneratedViteConfigPath(root), getBasicVoidViteConfig());
2353
2411
  return;
2354
2412
  }
2355
2413
  const fullPath = join(root, configPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "void",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
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.0"
336
+ "@void/md": "0.8.2"
337
337
  },
338
338
  "peerDependenciesMeta": {
339
339
  "@void/md": {
@@ -29,7 +29,7 @@ Add to your `void.json`:
29
29
  For local development, add `DATABASE_URL` to `.env.local`:
30
30
 
31
31
  ```
32
- DATABASE_URL=postgres://user:password@host:5432/mydb
32
+ DATABASE_URL=postgresql://user:password@host:5432/mydb?sslmode=require
33
33
  ```
34
34
 
35
35
  This connects directly to your Postgres database during local Vite development.
@@ -40,10 +40,11 @@ On your first deploy, the CLI will prompt for your connection string:
40
40
 
41
41
  ```
42
42
  Your project uses PostgreSQL. Enter your connection string:
43
- > postgres://user:password@host:5432/mydb
43
+ > postgresql://user:password@host:5432/mydb?sslmode=require
44
44
  ```
45
45
 
46
46
  Void provisions a Hyperdrive configuration and stores only the config ID. Your connection string is sent directly to Cloudflare's API and is never stored by Void.
47
+ Both `postgres://` and `postgresql://` URLs are supported, including provider-supplied query strings such as `?sslmode=require`.
47
48
 
48
49
  You can also set the connection string ahead of time with `void db set-url`.
49
50
 
@@ -313,7 +313,7 @@ Rename existing migrations from the old numeric prefix format (`0001_name.sql`)
313
313
 
314
314
  ### `void db set-url`
315
315
 
316
- Update the PostgreSQL connection string for deployment. Only available for projects with `database.dialect: "postgresql"`.
316
+ Update the PostgreSQL connection string for deployment. Only available for projects with `"database": "pg"` in `void.json`.
317
317
 
318
318
  Prompts for a connection string and sends it to the platform API to create or update the Hyperdrive configuration.
319
319