@vercel/static-build 2.9.16 → 2.9.18

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.js +50 -12
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -23036,6 +23036,12 @@ var require_resolve = __commonJS({
23036
23036
  };
23037
23037
  }
23038
23038
  const serviceType = config.type || "web";
23039
+ const isJobService = serviceType === "job" || serviceType === "cron";
23040
+ const isScheduleJobService = serviceType === "cron" || serviceType === "job" && config.trigger === "schedule";
23041
+ const isQueueJobService = serviceType === "job" && config.trigger === "queue";
23042
+ const isWorkflowService = serviceType === "job" && config.trigger === "workflow";
23043
+ const isNonWebService = serviceType === "worker" || isJobService;
23044
+ const serviceTypeLabel = isJobService ? "Job" : serviceType === "worker" ? "Worker" : "Web";
23039
23045
  const routingResult = resolveServiceRoutingConfig(name, config);
23040
23046
  if (routingResult.error) {
23041
23047
  return routingResult.error;
@@ -23065,24 +23071,52 @@ var require_resolve = __commonJS({
23065
23071
  serviceName: name
23066
23072
  };
23067
23073
  }
23068
- if ((serviceType === "worker" || serviceType === "cron") && configuredRoutePrefix) {
23074
+ if (isNonWebService && configuredRoutePrefix) {
23069
23075
  return {
23070
23076
  code: "INVALID_ROUTE_PREFIX",
23071
- message: `${serviceType === "worker" ? "Worker" : "Cron"} service "${name}" cannot have "routePrefix" or "mount". Only web services should specify path-based routing.`,
23077
+ message: `${serviceTypeLabel} service "${name}" cannot have "routePrefix" or "mount". Only web services should specify path-based routing.`,
23072
23078
  serviceName: name
23073
23079
  };
23074
23080
  }
23075
- if ((serviceType === "worker" || serviceType === "cron") && hasSubdomain) {
23081
+ if (isNonWebService && hasSubdomain) {
23076
23082
  return {
23077
23083
  code: "INVALID_HOST_ROUTING_CONFIG",
23078
- message: `${serviceType === "worker" ? "Worker" : "Cron"} service "${name}" cannot have "subdomain" or "mount.subdomain". Only web services should specify subdomain routing.`,
23084
+ message: `${serviceTypeLabel} service "${name}" cannot have "subdomain" or "mount.subdomain". Only web services should specify subdomain routing.`,
23079
23085
  serviceName: name
23080
23086
  };
23081
23087
  }
23082
- if (serviceType === "cron" && !config.schedule) {
23088
+ if (serviceType === "job" && config.trigger === void 0) {
23083
23089
  return {
23084
- code: "MISSING_CRON_SCHEDULE",
23085
- message: `Cron service "${name}" is missing required "schedule" field.`,
23090
+ code: "MISSING_JOB_TRIGGER",
23091
+ message: `Job service "${name}" is missing required "trigger" field.`,
23092
+ serviceName: name
23093
+ };
23094
+ }
23095
+ if (serviceType === "job" && config.trigger && !import_build_utils5.JOB_TRIGGERS.includes(config.trigger)) {
23096
+ return {
23097
+ code: "INVALID_JOB_TRIGGER",
23098
+ message: `Job service "${name}" has invalid trigger "${config.trigger}". Expected ${import_build_utils5.JOB_TRIGGERS.map((t) => `"${t}"`).join(", ")}.`,
23099
+ serviceName: name
23100
+ };
23101
+ }
23102
+ if (isScheduleJobService && !config.schedule) {
23103
+ return {
23104
+ code: serviceType === "cron" ? "MISSING_CRON_SCHEDULE" : "MISSING_JOB_SCHEDULE",
23105
+ message: `${serviceTypeLabel} service "${name}" is missing required "schedule" field.`,
23106
+ serviceName: name
23107
+ };
23108
+ }
23109
+ if (isQueueJobService && (!Array.isArray(config.topics) || config.topics.length === 0)) {
23110
+ return {
23111
+ code: "MISSING_QUEUE_TOPICS",
23112
+ message: `${serviceTypeLabel} service "${name}" is missing required "topics" field.`,
23113
+ serviceName: name
23114
+ };
23115
+ }
23116
+ if (isWorkflowService && typeof config.entrypoint !== "string") {
23117
+ return {
23118
+ code: "MISSING_ENTRYPOINT",
23119
+ message: `Job service "${name}" with "workflow" trigger must specify "entrypoint".`,
23086
23120
  serviceName: name
23087
23121
  };
23088
23122
  }
@@ -23183,6 +23217,7 @@ var require_resolve = __commonJS({
23183
23217
  routePrefixSource = "configured"
23184
23218
  } = options;
23185
23219
  const type = config.type || "web";
23220
+ const trigger = type === "cron" ? "schedule" : type === "job" ? config.trigger : void 0;
23186
23221
  const rawEntrypoint = config.entrypoint;
23187
23222
  const moduleAttrParsed = typeof rawEntrypoint === "string" ? parsePyModuleAttrEntrypoint(rawEntrypoint) : null;
23188
23223
  const routingResult = resolveServiceRoutingConfig(name, config);
@@ -23239,7 +23274,7 @@ var require_resolve = __commonJS({
23239
23274
  workspace = workspace === "." ? normalizedRoot : import_path7.posix.join(normalizedRoot, workspace);
23240
23275
  }
23241
23276
  }
23242
- const topics = type === "worker" ? (0, import_build_utils5.getWorkerTopics)(config) : config.topics;
23277
+ const topics = type === "worker" ? (0, import_build_utils5.getServiceQueueTopics)({ type, topics: config.topics }) : trigger === "queue" ? config.topics : void 0;
23243
23278
  const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
23244
23279
  let builderUse;
23245
23280
  let builderSrc;
@@ -23305,6 +23340,7 @@ var require_resolve = __commonJS({
23305
23340
  return {
23306
23341
  name,
23307
23342
  type,
23343
+ trigger,
23308
23344
  group,
23309
23345
  workspace,
23310
23346
  entrypoint: resolvedEntrypointFile,
@@ -23784,7 +23820,8 @@ var require_detect_railway = __commonJS({
23784
23820
  const schedule = cf.config.deploy.cronSchedule;
23785
23821
  const runtime = frameworks2.length === 1 ? (0, import_utils.inferRuntimeFromFramework)(frameworks2[0].slug) : void 0;
23786
23822
  const hint = {
23787
- type: "cron",
23823
+ type: "job",
23824
+ trigger: "schedule",
23788
23825
  schedule,
23789
23826
  entrypoint: "<path-to-handler>"
23790
23827
  };
@@ -23793,7 +23830,7 @@ var require_detect_railway = __commonJS({
23793
23830
  }
23794
23831
  warnings.push({
23795
23832
  code: "RAILWAY_CRON_HINT",
23796
- message: `Found Railway cron in ${dirLabel}/ (schedule: "${schedule}"). Vercel crons work with a file entrypoint. You can add the following to define this cron service:
23833
+ message: `Found Railway cron in ${dirLabel}/ (schedule: "${schedule}"). Vercel crons work with a file entrypoint. You can add the following to define this scheduled job service:
23797
23834
  "${deriveServiceName(cf.dirPath)}": ${JSON.stringify(hint, null, 2)}`
23798
23835
  });
23799
23836
  continue;
@@ -23998,6 +24035,7 @@ var require_detect_services = __commonJS({
23998
24035
  generateServicesRoutes: () => generateServicesRoutes2
23999
24036
  });
24000
24037
  module2.exports = __toCommonJS2(detect_services_exports);
24038
+ var import_build_utils5 = require("@vercel/build-utils");
24001
24039
  var import_routing_utils = require_dist7();
24002
24040
  var import_utils = require_utils4();
24003
24041
  var import_resolve = require_resolve();
@@ -24231,7 +24269,7 @@ var require_detect_services = __commonJS({
24231
24269
  }
24232
24270
  }
24233
24271
  }
24234
- const workerServices = services.filter((s) => s.type === "worker");
24272
+ const workerServices = services.filter(import_build_utils5.isQueueTriggeredService);
24235
24273
  for (const service of workerServices) {
24236
24274
  const workerEntrypoint = service.entrypoint || service.builder.src || "index";
24237
24275
  const workerPath = (0, import_utils.getInternalServiceWorkerPath)(
@@ -24245,7 +24283,7 @@ var require_detect_services = __commonJS({
24245
24283
  check: true
24246
24284
  });
24247
24285
  }
24248
- const cronServices = services.filter((s) => s.type === "cron");
24286
+ const cronServices = services.filter(import_build_utils5.isScheduleTriggeredService);
24249
24287
  for (const service of cronServices) {
24250
24288
  const cronPrefix = (0, import_utils.getInternalServiceCronPathPrefix)(service.name);
24251
24289
  const functionPath = (0, import_utils.getInternalServiceFunctionPath)(service.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.9.16",
3
+ "version": "2.9.18",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "ts-morph": "12.0.0",
17
17
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
18
- "@vercel/gatsby-plugin-vercel-builder": "2.1.16",
18
+ "@vercel/gatsby-plugin-vercel-builder": "2.1.18",
19
19
  "@vercel/static-config": "3.2.0"
20
20
  },
21
21
  "devDependencies": {
@@ -38,10 +38,10 @@
38
38
  "rc9": "1.2.0",
39
39
  "semver": "7.5.2",
40
40
  "tree-kill": "1.2.2",
41
- "@vercel/build-utils": "13.17.1",
42
- "@vercel/error-utils": "2.0.3",
43
- "@vercel/fs-detectors": "5.18.1",
41
+ "@vercel/build-utils": "13.18.0",
44
42
  "@vercel/frameworks": "3.24.1",
43
+ "@vercel/fs-detectors": "5.18.3",
44
+ "@vercel/error-utils": "2.0.3",
45
45
  "@vercel/routing-utils": "6.1.1"
46
46
  },
47
47
  "scripts": {