@vercel/static-build 2.9.16 → 2.9.19

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 +49 -27
  2. package/package.json +7 -7
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,8 +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;
23243
- const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
23277
+ const topics = type === "worker" ? (0, import_build_utils5.getServiceQueueTopics)({ type, topics: config.topics }) : trigger === "queue" ? config.topics : void 0;
23244
23278
  let builderUse;
23245
23279
  let builderSrc;
23246
23280
  const frameworkDefinition = config.framework ? frameworksBySlug.get(config.framework) : void 0;
@@ -23305,6 +23339,7 @@ var require_resolve = __commonJS({
23305
23339
  return {
23306
23340
  name,
23307
23341
  type,
23342
+ trigger,
23308
23343
  group,
23309
23344
  workspace,
23310
23345
  entrypoint: resolvedEntrypointFile,
@@ -23323,7 +23358,6 @@ var require_resolve = __commonJS({
23323
23358
  schedule: config.schedule,
23324
23359
  handlerFunction: moduleAttrParsed?.attrName,
23325
23360
  topics,
23326
- consumer,
23327
23361
  envPrefix: config.envPrefix
23328
23362
  };
23329
23363
  }
@@ -23784,7 +23818,8 @@ var require_detect_railway = __commonJS({
23784
23818
  const schedule = cf.config.deploy.cronSchedule;
23785
23819
  const runtime = frameworks2.length === 1 ? (0, import_utils.inferRuntimeFromFramework)(frameworks2[0].slug) : void 0;
23786
23820
  const hint = {
23787
- type: "cron",
23821
+ type: "job",
23822
+ trigger: "schedule",
23788
23823
  schedule,
23789
23824
  entrypoint: "<path-to-handler>"
23790
23825
  };
@@ -23793,7 +23828,7 @@ var require_detect_railway = __commonJS({
23793
23828
  }
23794
23829
  warnings.push({
23795
23830
  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:
23831
+ 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
23832
  "${deriveServiceName(cf.dirPath)}": ${JSON.stringify(hint, null, 2)}`
23798
23833
  });
23799
23834
  continue;
@@ -23998,6 +24033,7 @@ var require_detect_services = __commonJS({
23998
24033
  generateServicesRoutes: () => generateServicesRoutes2
23999
24034
  });
24000
24035
  module2.exports = __toCommonJS2(detect_services_exports);
24036
+ var import_build_utils5 = require("@vercel/build-utils");
24001
24037
  var import_routing_utils = require_dist7();
24002
24038
  var import_utils = require_utils4();
24003
24039
  var import_resolve = require_resolve();
@@ -24231,21 +24267,7 @@ var require_detect_services = __commonJS({
24231
24267
  }
24232
24268
  }
24233
24269
  }
24234
- const workerServices = services.filter((s) => s.type === "worker");
24235
- for (const service of workerServices) {
24236
- const workerEntrypoint = service.entrypoint || service.builder.src || "index";
24237
- const workerPath = (0, import_utils.getInternalServiceWorkerPath)(
24238
- service.name,
24239
- workerEntrypoint
24240
- );
24241
- const functionPath = (0, import_utils.getInternalServiceFunctionPath)(service.name);
24242
- workers.push({
24243
- src: `^${escapeRegex(workerPath)}$`,
24244
- dest: functionPath,
24245
- check: true
24246
- });
24247
- }
24248
- const cronServices = services.filter((s) => s.type === "cron");
24270
+ const cronServices = services.filter(import_build_utils5.isScheduleTriggeredService);
24249
24271
  for (const service of cronServices) {
24250
24272
  const cronPrefix = (0, import_utils.getInternalServiceCronPathPrefix)(service.name);
24251
24273
  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.19",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -15,8 +15,8 @@
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",
19
- "@vercel/static-config": "3.2.0"
18
+ "@vercel/static-config": "3.2.0",
19
+ "@vercel/gatsby-plugin-vercel-builder": "2.1.19"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/aws-lambda": "8.10.64",
@@ -38,11 +38,11 @@
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.19.0",
44
42
  "@vercel/frameworks": "3.24.1",
45
- "@vercel/routing-utils": "6.1.1"
43
+ "@vercel/error-utils": "2.0.3",
44
+ "@vercel/routing-utils": "6.1.1",
45
+ "@vercel/fs-detectors": "5.19.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "node ../../utils/build-builder.mjs",