@vercel/backends 0.5.0 → 0.6.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.
Files changed (2) hide show
  1. package/dist/index.mjs +8 -9
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -923,10 +923,10 @@ async function resolveShimFormat(args) {
923
923
  //#endregion
924
924
  //#region src/crons.ts
925
925
  const DYNAMIC_SCHEDULE = "<dynamic>";
926
- /** Build the JSON route table embedded in `__VC_CRON_ROUTES`. */
926
+ /** Build the JSON route table embedded in the dispatcher shim. */
927
927
  function buildCronRouteTable(crons) {
928
928
  const table = {};
929
- for (const cron of crons) table[cron.path] = "default";
929
+ for (const cron of crons) table[cron.path] = cron.exportName;
930
930
  return table;
931
931
  }
932
932
  /**
@@ -935,11 +935,6 @@ function buildCronRouteTable(crons) {
935
935
  * Mirrors `packages/python/src/crons.ts` for static schedules. Returns
936
936
  * `undefined` when the service is not schedule-triggered. Throws on
937
937
  * `<dynamic>` schedules — that path is reserved for a follow-up.
938
- *
939
- * v1 always invokes the user module's default export, so this returns
940
- * plain `Cron[]` (no handler-name field). When `handlerFunction` or
941
- * `<dynamic>` support lands, this will need to grow a per-path handler
942
- * name back.
943
938
  */
944
939
  function getServiceCrons(opts) {
945
940
  const { service, entrypoint } = opts;
@@ -949,7 +944,8 @@ function getServiceCrons(opts) {
949
944
  if (service.schedule === DYNAMIC_SCHEDULE) throw new Error("Dynamic cron schedules (\"<dynamic>\") are not yet supported for JavaScript/TypeScript services. Use a static cron expression in vercel.json.");
950
945
  return [{
951
946
  path: getInternalServiceCronPath(service.name, entrypoint, "cron"),
952
- schedule: service.schedule
947
+ schedule: service.schedule,
948
+ exportName: "default"
953
949
  }];
954
950
  }
955
951
 
@@ -1801,7 +1797,10 @@ const build = async (args) => {
1801
1797
  return {
1802
1798
  routes,
1803
1799
  output,
1804
- ...cronEntries ? { crons: cronEntries } : {}
1800
+ ...cronEntries ? { crons: cronEntries.map(({ path, schedule }) => ({
1801
+ path,
1802
+ schedule
1803
+ })) } : {}
1805
1804
  };
1806
1805
  });
1807
1806
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/backends",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "homepage": "https://vercel.com/docs",
@@ -35,7 +35,7 @@
35
35
  "srvx": "0.8.9",
36
36
  "tsx": "4.21.0",
37
37
  "zod": "3.22.4",
38
- "@vercel/build-utils": "13.23.0"
38
+ "@vercel/build-utils": "13.24.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/express": "5.0.3",