@vercel/static-build 2.8.45 → 2.8.46

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 +32 -5
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -21529,6 +21529,7 @@ var require_schemas = __commonJS({
21529
21529
  }
21530
21530
  }
21531
21531
  },
21532
+ // biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
21532
21533
  then: {
21533
21534
  required: ["args"]
21534
21535
  }
@@ -21552,6 +21553,7 @@ var require_schemas = __commonJS({
21552
21553
  }
21553
21554
  ]
21554
21555
  },
21556
+ // biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
21555
21557
  then: {
21556
21558
  properties: {
21557
21559
  target: {
@@ -21560,6 +21562,7 @@ var require_schemas = __commonJS({
21560
21562
  if: {
21561
21563
  type: "string"
21562
21564
  },
21565
+ // biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
21563
21566
  then: {
21564
21567
  pattern: "^[a-zA-Z0-9_-]+$"
21565
21568
  }
@@ -22876,6 +22879,16 @@ var require_resolve = __commonJS({
22876
22879
  var import_detect_framework = require_detect_framework();
22877
22880
  var import_routing_utils = require_dist6();
22878
22881
  var frameworksBySlug = new Map(import_frameworks2.default.map((f) => [f.slug, f]));
22882
+ var PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
22883
+ function parsePyModuleAttrEntrypoint(entrypoint) {
22884
+ const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
22885
+ if (!match)
22886
+ return null;
22887
+ return {
22888
+ attrName: match[2],
22889
+ filePath: match[1].replace(/\./g, "/") + ".py"
22890
+ };
22891
+ }
22879
22892
  var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
22880
22893
  function normalizeServiceEntrypoint(entrypoint) {
22881
22894
  const normalized = import_path7.posix.normalize(entrypoint);
@@ -23080,7 +23093,9 @@ var require_resolve = __commonJS({
23080
23093
  }
23081
23094
  function validateServiceEntrypoint(name, config, resolvedEntrypoint) {
23082
23095
  if (!resolvedEntrypoint.isDirectory && !config.builder && !config.runtime && !config.framework) {
23083
- const runtime = (0, import_utils.inferServiceRuntime)({ entrypoint: config.entrypoint });
23096
+ const runtime = (0, import_utils.inferServiceRuntime)({
23097
+ entrypoint: resolvedEntrypoint.normalized
23098
+ });
23084
23099
  if (!runtime) {
23085
23100
  const supported = Object.keys(import_types.ENTRYPOINT_EXTENSIONS).join(", ");
23086
23101
  return {
@@ -23103,12 +23118,14 @@ var require_resolve = __commonJS({
23103
23118
  } = options;
23104
23119
  const type = config.type || "web";
23105
23120
  const rawEntrypoint = config.entrypoint;
23121
+ const moduleAttrParsed = typeof rawEntrypoint === "string" && type === "cron" ? parsePyModuleAttrEntrypoint(rawEntrypoint) : null;
23106
23122
  let resolvedEntrypointPath = resolvedEntrypoint;
23107
23123
  if (!resolvedEntrypointPath && typeof rawEntrypoint === "string") {
23124
+ const entrypointToResolve = moduleAttrParsed ? moduleAttrParsed.filePath : rawEntrypoint;
23108
23125
  const resolved = await resolveEntrypointPath({
23109
23126
  fs: fs5,
23110
23127
  serviceName: name,
23111
- entrypoint: rawEntrypoint
23128
+ entrypoint: entrypointToResolve
23112
23129
  });
23113
23130
  resolvedEntrypointPath = resolved.entrypoint;
23114
23131
  }
@@ -23184,6 +23201,9 @@ var require_resolve = __commonJS({
23184
23201
  if (config.framework) {
23185
23202
  builderConfig.framework = config.framework;
23186
23203
  }
23204
+ if (moduleAttrParsed) {
23205
+ builderConfig.handlerFunction = moduleAttrParsed.attrName;
23206
+ }
23187
23207
  return {
23188
23208
  name,
23189
23209
  type,
@@ -23202,6 +23222,7 @@ var require_resolve = __commonJS({
23202
23222
  buildCommand: config.buildCommand,
23203
23223
  installCommand: config.installCommand,
23204
23224
  schedule: config.schedule,
23225
+ handlerFunction: moduleAttrParsed?.attrName,
23205
23226
  topic,
23206
23227
  consumer
23207
23228
  };
@@ -23218,11 +23239,14 @@ var require_resolve = __commonJS({
23218
23239
  continue;
23219
23240
  }
23220
23241
  let resolvedEntrypoint;
23242
+ const serviceType = serviceConfig.type || "web";
23221
23243
  if (typeof serviceConfig.entrypoint === "string") {
23244
+ const moduleAttr = serviceType === "cron" ? parsePyModuleAttrEntrypoint(serviceConfig.entrypoint) : null;
23245
+ const entrypointToResolve = moduleAttr ? moduleAttr.filePath : serviceConfig.entrypoint;
23222
23246
  const resolvedPath = await resolveEntrypointPath({
23223
23247
  fs: fs5,
23224
23248
  serviceName: name,
23225
- entrypoint: serviceConfig.entrypoint
23249
+ entrypoint: entrypointToResolve
23226
23250
  });
23227
23251
  if (resolvedPath.error) {
23228
23252
  errors.push(resolvedPath.error);
@@ -23709,7 +23733,6 @@ var require_detect_services = __commonJS({
23709
23733
  });
23710
23734
  }
23711
23735
  } else {
23712
- continue;
23713
23736
  }
23714
23737
  }
23715
23738
  const workerServices = services.filter((s) => s.type === "worker");
@@ -23729,7 +23752,11 @@ var require_detect_services = __commonJS({
23729
23752
  const cronServices = services.filter((s) => s.type === "cron");
23730
23753
  for (const service of cronServices) {
23731
23754
  const cronEntrypoint = service.entrypoint || service.builder.src || "index";
23732
- const cronPath = (0, import_utils.getInternalServiceCronPath)(service.name, cronEntrypoint);
23755
+ const cronPath = (0, import_utils.getInternalServiceCronPath)(
23756
+ service.name,
23757
+ cronEntrypoint,
23758
+ service.handlerFunction || "cron"
23759
+ );
23733
23760
  const functionPath = (0, import_utils.getInternalServiceFunctionPath)(service.name);
23734
23761
  crons.push({
23735
23762
  src: `^${escapeRegex(cronPath)}$`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.8.45",
3
+ "version": "2.8.46",
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/static-config": "3.1.2",
19
- "@vercel/gatsby-plugin-vercel-builder": "2.0.143"
18
+ "@vercel/gatsby-plugin-vercel-builder": "2.0.144",
19
+ "@vercel/static-config": "3.1.2"
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.6.3",
41
+ "@vercel/build-utils": "13.7.0",
42
42
  "@vercel/error-utils": "2.0.3",
43
43
  "@vercel/frameworks": "3.20.0",
44
44
  "@vercel/routing-utils": "6.0.2",
45
- "@vercel/fs-detectors": "5.8.18"
45
+ "@vercel/fs-detectors": "5.9.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "node ../../utils/build-builder.mjs",