void 0.8.5 → 0.8.7

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-D-sNgH78.mjs").then((n) => n.t).then(({ runDeploy }) => {
1519
+ import("../deploy-Dnzq3Mn2.mjs").then((n) => n.t).then(({ runDeploy }) => {
1520
1520
  runDeploy(root, {
1521
1521
  projectSlug: deployArgs.projectSlug,
1522
1522
  dir: deployArgs.dir,
@@ -1646,7 +1646,7 @@ else if (command === "-v" || command === "--version") {
1646
1646
  return;
1647
1647
  }
1648
1648
  case "deploy": {
1649
- const { runDeploy } = await import("../deploy-D-sNgH78.mjs").then((n) => n.t);
1649
+ const { runDeploy } = await import("../deploy-Dnzq3Mn2.mjs").then((n) => n.t);
1650
1650
  await runDeploy(root);
1651
1651
  return;
1652
1652
  }
@@ -2190,6 +2190,7 @@ function generateHandlersSource(root, features) {
2190
2190
  var deploy_exports = /* @__PURE__ */ __exportAll({
2191
2191
  applyDeployEvent: () => applyDeployEvent,
2192
2192
  ensurePreviouslyDeployedLiveBindingConfig: () => ensurePreviouslyDeployedLiveBindingConfig,
2193
+ generateDeployWrapperIfNeeded: () => generateDeployWrapperIfNeeded,
2193
2194
  hasDeploySchemaDrift: () => hasDeploySchemaDrift,
2194
2195
  promptDeployProjectConfig: () => promptDeployProjectConfig,
2195
2196
  resolveDeployLiveBindingConfig: () => resolveDeployLiveBindingConfig,
@@ -2205,6 +2206,11 @@ var deploy_exports = /* @__PURE__ */ __exportAll({
2205
2206
  const drizzleKitBin = join(fileURLToPath(import.meta.resolve("drizzle-kit")), "..", "bin.cjs");
2206
2207
  const deployDriftCheckDir = join(".void", "deploy-drift-check");
2207
2208
  var DeployEventError = class extends Error {};
2209
+ async function generateDeployWrapperIfNeeded(root, workerDir, workerMain, features) {
2210
+ if (!needsWrapper(features)) return false;
2211
+ await generateWrapper(workerDir, workerMain, root, features);
2212
+ return true;
2213
+ }
2208
2214
  const EMPTY_BINDINGS = {
2209
2215
  needsD1: false,
2210
2216
  needsKV: false,
@@ -2837,7 +2843,7 @@ async function runFrameworkDeploy(root, config, client, detected, fwPreset, void
2837
2843
  }
2838
2844
  if (needsWrapper(wrapperFeatures)) {
2839
2845
  R.step("Generating wrapper...");
2840
- await generateWrapper(actualWorkerDir, actualWorkerMain, root, wrapperFeatures);
2846
+ await generateDeployWrapperIfNeeded(root, actualWorkerDir, actualWorkerMain, wrapperFeatures);
2841
2847
  R.info("Wrapper generated");
2842
2848
  }
2843
2849
  const wranglerCompat = resolveDeployWranglerCompat(root, voidConfig, workerDir, { dialect });
@@ -3038,7 +3044,9 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
3038
3044
  }
3039
3045
  }
3040
3046
  const workerDirName = resolveWorkerDirName(distDir, fwPreset, frameworkBuildCmd);
3041
- const schedules = scanJobsSync(root, paths.cronsDir).flatMap((job) => job.crons.map((cron) => ({
3047
+ const rawJobs = scanJobsSync(root, paths.cronsDir);
3048
+ const rawQueues = scanQueuesSync(root, paths.queuesDir);
3049
+ const schedules = rawJobs.flatMap((job) => job.crons.map((cron) => ({
3042
3050
  name: job.name,
3043
3051
  cron
3044
3052
  })));
@@ -3054,7 +3062,7 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
3054
3062
  sandboxClassName: sandboxConfig?.className,
3055
3063
  cliLog
3056
3064
  });
3057
- const queues = scanQueuesSync(root, paths.queuesDir).map((q) => ({
3065
+ const queues = rawQueues.map((q) => ({
3058
3066
  name: q.name,
3059
3067
  bindingName: q.bindingName,
3060
3068
  ...q.maxBatchSize != null && { maxBatchSize: q.maxBatchSize },
@@ -3181,7 +3189,22 @@ async function runFullDeploy(root, config, client, fwPreset, skipBuild, gitMetad
3181
3189
  dialect,
3182
3190
  webSockets
3183
3191
  });
3184
- const workerFiles = collectWorkerFiles(join(distDir, workerDirName));
3192
+ const workerDir = join(distDir, workerDirName);
3193
+ if (isFrameworkMode) {
3194
+ const wrapperFeatures = {
3195
+ auth: null,
3196
+ crons: rawJobs,
3197
+ queues: rawQueues,
3198
+ hasMigrations: validatedMigrations != null && validatedMigrations.length > 0,
3199
+ migrationDialect: dialect
3200
+ };
3201
+ if (needsWrapper(wrapperFeatures)) {
3202
+ R.step("Generating wrapper...");
3203
+ await generateDeployWrapperIfNeeded(root, workerDir, fwPreset?.workerMain ?? "index.js", wrapperFeatures);
3204
+ R.info("Wrapper generated");
3205
+ }
3206
+ }
3207
+ const workerFiles = collectWorkerFiles(workerDir);
3185
3208
  cliLog?.info("package_end", {
3186
3209
  mode: "full",
3187
3210
  durationMs: Date.now() - packageStartedAt
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, 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";
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-Dnzq3Mn2.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-CCOKwNUz.mjs";
@@ -2944,6 +2944,37 @@ window.__vite_plugin_react_preamble_installed__ = true;
2944
2944
  lines.push(`const __migrations = ${JSON.stringify(options.migrations)};`);
2945
2945
  lines.push(`const __migrationPlanBundle = ${JSON.stringify(options.migrationPlanBundle)};`);
2946
2946
  lines.push(`const __migrationDialect = ${JSON.stringify(options.migrationDialect ?? "sqlite")};`);
2947
+ lines.push("function __voidCreateMigrationRequestHandler(request, includeAuthMigrations, includePlanBundle) {");
2948
+ lines.push(" return __createMigrationHandler(");
2949
+ lines.push(" __getRawEnv(),");
2950
+ lines.push(" __migrations,");
2951
+ lines.push(" __migrationDialect,");
2952
+ if (auth) lines.push(` includeAuthMigrations ? () => runVoidAuthMigrations(new Request(request.url), __getRawEnv(), __voidAuthOptions${auth.authSchemaPath ? ", __voidAuthMigrationSchema" : ""}) : undefined,`);
2953
+ else lines.push(" undefined,");
2954
+ lines.push(" includePlanBundle ? __migrationPlanBundle : undefined,");
2955
+ lines.push(" );");
2956
+ lines.push("}");
2957
+ lines.push("export async function __voidHandleInternalRoute(request) {");
2958
+ lines.push(" const url = new URL(request.url);");
2959
+ lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate\") {");
2960
+ lines.push(` return __voidCreateMigrationRequestHandler(request, ${auth ? "true" : "false"}, false)(request);`);
2961
+ lines.push(" }");
2962
+ lines.push(" if (request.method === \"GET\" && url.pathname === \"/__void/migrate/capabilities\") {");
2963
+ lines.push(` return __voidCreateMigrationRequestHandler(request, ${auth ? "true" : "false"}, true)(request);`);
2964
+ lines.push(" }");
2965
+ lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/app\") {");
2966
+ lines.push(" return __voidCreateMigrationRequestHandler(request, false, true)(request);");
2967
+ lines.push(" }");
2968
+ lines.push(" if (request.method === \"GET\" && url.pathname.startsWith(\"/__void/migrate/app/attempt/\")) {");
2969
+ lines.push(" return __voidCreateMigrationRequestHandler(request, false, true)(request);");
2970
+ lines.push(" }");
2971
+ if (auth) {
2972
+ lines.push(" if (request.method === \"POST\" && url.pathname === \"/__void/migrate/auth\") {");
2973
+ lines.push(" return __voidCreateMigrationRequestHandler(request, true, true)(request);");
2974
+ lines.push(" }");
2975
+ }
2976
+ lines.push(" return null;");
2977
+ lines.push("}");
2947
2978
  lines.push("app.post(\"/__void/migrate\", async (c) => {");
2948
2979
  lines.push(" const __voidMigrationHandler = __createMigrationHandler(");
2949
2980
  lines.push(" __getRawEnv(),");
@@ -2998,6 +3029,9 @@ window.__vite_plugin_react_preamble_installed__ = true;
2998
3029
  lines.push("});");
2999
3030
  }
3000
3031
  lines.push("");
3032
+ } else {
3033
+ lines.push("export async function __voidHandleInternalRoute() { return null; }");
3034
+ lines.push("");
3001
3035
  }
3002
3036
  if (options.bindingHandlerPath) {
3003
3037
  lines.push(`import { createBindingHandler as __createBindingHandler } from ${JSON.stringify(options.bindingHandlerPath)};`);
@@ -3554,6 +3588,8 @@ ${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
3554
3588
  if (request.method === "GET" && url.pathname === "/__void/ready") {
3555
3589
  return Response.json({ ready: true });
3556
3590
  }
3591
+ const routeInternal = await __voidHandleInternalRoute(request, env, ctx);
3592
+ if (routeInternal) return routeInternal;
3557
3593
  if (request.method !== "POST" || url.pathname !== "/__void/prerender-paths") return null;
3558
3594
  const __expected = env.__VOID_PROXY_TOKEN;
3559
3595
  if (__expected) {
@@ -3573,7 +3609,7 @@ ${envValidateCall} if (env.__VOID_REMOTE === "1") env = createRemoteEnv(env);
3573
3609
  ${envValidateCall} const userEnv = __filterInternalBindings(env);
3574
3610
  return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
3575
3611
  }`;
3576
- if (hasQueues) return `${sandboxImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleWebSocket, __withRawEnv, __processQueue${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
3612
+ if (hasQueues) return `${sandboxImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __voidHandleWebSocket, __withRawEnv, __processQueue${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
3577
3613
  ${runtimeEnvImport}${envSchemaImport}${remoteImport}${filterBindingsHelper}${assetHelper}
3578
3614
  ${internalRouteHelper}
3579
3615
  ${scheduledHandler}
@@ -3602,7 +3638,7 @@ ${webSocketClasses.map((name) => `export { ${name} };`).join("\n")}
3602
3638
  ${liveExport}
3603
3639
  ${sandboxExport}
3604
3640
  export default { fetch: ${fetchHandler}, scheduled: handleScheduled, queue };`;
3605
- return `${sandboxImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleWebSocket, __withRawEnv${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
3641
+ return `${sandboxImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __voidHandleWebSocket, __withRawEnv${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
3606
3642
  ${runtimeEnvImport}${envSchemaImport}${remoteImport}${filterBindingsHelper}${assetHelper}
3607
3643
  ${internalRouteHelper}
3608
3644
  ${scheduledHandler}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "void",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
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.5"
336
+ "@void/md": "0.8.7"
337
337
  },
338
338
  "peerDependenciesMeta": {
339
339
  "@void/md": {