@vercel/static-build 2.9.13 → 2.9.15

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 +175 -32
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -11012,6 +11012,105 @@ var require_frameworks = __commonJS({
11012
11012
  }
11013
11013
  ]
11014
11014
  },
11015
+ {
11016
+ name: "Axum",
11017
+ slug: "axum",
11018
+ experimental: true,
11019
+ supersedes: ["rust"],
11020
+ logo: "https://api-frameworks.vercel.sh/framework-logos/axum.svg",
11021
+ tagline: "Ergonomic and modular web framework built with Tokio, Tower, and Hyper.",
11022
+ description: "An Axum application deployed as a serverless function.",
11023
+ website: "https://github.com/tokio-rs/axum",
11024
+ useRuntime: { src: "src/main.rs", use: "@vercel/rust" },
11025
+ ignoreRuntimes: ["@vercel/rust"],
11026
+ detectors: {
11027
+ every: [
11028
+ {
11029
+ path: "Cargo.toml",
11030
+ matchContent: "axum\\s*="
11031
+ },
11032
+ {
11033
+ path: "src/main.rs"
11034
+ }
11035
+ ]
11036
+ },
11037
+ settings: {
11038
+ installCommand: {
11039
+ placeholder: "None"
11040
+ },
11041
+ buildCommand: {
11042
+ placeholder: "None",
11043
+ value: null
11044
+ },
11045
+ devCommand: {
11046
+ placeholder: "`cargo run`",
11047
+ value: null
11048
+ },
11049
+ outputDirectory: {
11050
+ value: "N/A"
11051
+ }
11052
+ },
11053
+ getOutputDirName: async () => "public",
11054
+ defaultRoutes: [
11055
+ {
11056
+ handle: "filesystem"
11057
+ },
11058
+ {
11059
+ src: "/(.*)",
11060
+ dest: "/src/main"
11061
+ }
11062
+ ]
11063
+ },
11064
+ {
11065
+ name: "Actix Web",
11066
+ slug: "actix-web",
11067
+ experimental: true,
11068
+ runtimeFramework: true,
11069
+ supersedes: ["rust"],
11070
+ logo: "https://api-frameworks.vercel.sh/framework-logos/actix-web.svg",
11071
+ tagline: "A powerful, pragmatic, and extremely fast web framework for Rust.",
11072
+ description: "An Actix Web application deployed as a serverless function.",
11073
+ website: "https://actix.rs",
11074
+ useRuntime: { src: "src/main.rs", use: "@vercel/rust" },
11075
+ ignoreRuntimes: ["@vercel/rust"],
11076
+ detectors: {
11077
+ every: [
11078
+ {
11079
+ path: "Cargo.toml",
11080
+ matchContent: "actix-web\\s*="
11081
+ },
11082
+ {
11083
+ path: "src/main.rs"
11084
+ }
11085
+ ]
11086
+ },
11087
+ settings: {
11088
+ installCommand: {
11089
+ placeholder: "None"
11090
+ },
11091
+ buildCommand: {
11092
+ placeholder: "None",
11093
+ value: null
11094
+ },
11095
+ devCommand: {
11096
+ placeholder: "`cargo run`",
11097
+ value: null
11098
+ },
11099
+ outputDirectory: {
11100
+ value: "N/A"
11101
+ }
11102
+ },
11103
+ getOutputDirName: async () => "public",
11104
+ defaultRoutes: [
11105
+ {
11106
+ handle: "filesystem"
11107
+ },
11108
+ {
11109
+ src: "/(.*)",
11110
+ dest: "/src/main"
11111
+ }
11112
+ ]
11113
+ },
11015
11114
  {
11016
11115
  name: "Node",
11017
11116
  slug: "node",
@@ -22255,12 +22354,12 @@ var require_utils4 = __commonJS({
22255
22354
  var utils_exports = {};
22256
22355
  __export2(utils_exports, {
22257
22356
  INTERNAL_QUEUES_PREFIX: () => INTERNAL_QUEUES_PREFIX,
22258
- INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX2,
22357
+ INTERNAL_SERVICE_PREFIX: () => import_build_utils5.INTERNAL_SERVICE_PREFIX,
22259
22358
  filterFrameworksByRuntime: () => filterFrameworksByRuntime,
22260
22359
  getBuilderForRuntime: () => getBuilderForRuntime,
22261
- getInternalServiceCronPath: () => getInternalServiceCronPath2,
22262
- getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix2,
22263
- getInternalServiceFunctionPath: () => getInternalServiceFunctionPath2,
22360
+ getInternalServiceCronPath: () => import_build_utils5.getInternalServiceCronPath,
22361
+ getInternalServiceCronPathPrefix: () => import_build_utils5.getInternalServiceCronPathPrefix,
22362
+ getInternalServiceFunctionPath: () => import_build_utils5.getInternalServiceFunctionPath,
22264
22363
  getInternalServiceWorkerPath: () => getInternalServiceWorkerPath2,
22265
22364
  getInternalServiceWorkerPathPrefix: () => getInternalServiceWorkerPathPrefix2,
22266
22365
  hasFile: () => hasFile,
@@ -22273,6 +22372,7 @@ var require_utils4 = __commonJS({
22273
22372
  });
22274
22373
  module2.exports = __toCommonJS2(utils_exports);
22275
22374
  var import_framework_helpers = require("@vercel/build-utils/dist/framework-helpers");
22375
+ var import_build_utils5 = require("@vercel/build-utils");
22276
22376
  var import_types = require_types3();
22277
22377
  async function hasFile(fs5, filePath) {
22278
22378
  try {
@@ -22281,29 +22381,18 @@ var require_utils4 = __commonJS({
22281
22381
  return false;
22282
22382
  }
22283
22383
  }
22284
- var INTERNAL_SERVICE_PREFIX2 = "/_svc";
22285
22384
  var INTERNAL_QUEUES_PREFIX = "/_svc/_queues";
22286
- function getInternalServiceFunctionPath2(serviceName) {
22287
- return `${INTERNAL_SERVICE_PREFIX2}/${serviceName}/index`;
22288
- }
22289
22385
  function normalizeInternalServiceEntrypoint(entrypoint) {
22290
22386
  const normalized = entrypoint.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\.[^/.]+$/, "");
22291
22387
  return normalized || "index";
22292
22388
  }
22293
22389
  function getInternalServiceWorkerPathPrefix2(serviceName) {
22294
- return `${INTERNAL_SERVICE_PREFIX2}/${serviceName}/workers`;
22295
- }
22296
- function getInternalServiceCronPathPrefix2(serviceName) {
22297
- return `${INTERNAL_SERVICE_PREFIX2}/${serviceName}/crons`;
22390
+ return `${import_build_utils5.INTERNAL_SERVICE_PREFIX}/${serviceName}/workers`;
22298
22391
  }
22299
22392
  function getInternalServiceWorkerPath2(serviceName, entrypoint, handler = "worker") {
22300
22393
  const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
22301
22394
  return `${getInternalServiceWorkerPathPrefix2(serviceName)}/${normalizedEntrypoint}/${handler}`;
22302
22395
  }
22303
- function getInternalServiceCronPath2(serviceName, entrypoint, handler = "cron") {
22304
- const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
22305
- return `${getInternalServiceCronPathPrefix2(serviceName)}/${normalizedEntrypoint}/${handler}`;
22306
- }
22307
22396
  function getBuilderForRuntime(runtime) {
22308
22397
  const builder = import_types.RUNTIME_BUILDERS[runtime];
22309
22398
  if (!builder) {
@@ -22712,6 +22801,33 @@ var require_resolve = __commonJS({
22712
22801
  var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
22713
22802
  var DNS_LABEL_RE = /^(?!-)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
22714
22803
  var ENV_PREFIX_RE = /^[A-Z][A-Z0-9_]*_$/;
22804
+ async function getServiceFs(fs5, serviceName, root) {
22805
+ if (!root) {
22806
+ return { fs: fs5 };
22807
+ }
22808
+ const normalizedRoot = import_path7.posix.normalize(root);
22809
+ if (!await fs5.hasPath(normalizedRoot)) {
22810
+ return {
22811
+ fs: fs5,
22812
+ error: {
22813
+ code: "ROOT_NOT_FOUND",
22814
+ message: `Service "${serviceName}" has root "${root}" but that directory does not exist.`,
22815
+ serviceName
22816
+ }
22817
+ };
22818
+ }
22819
+ if (await fs5.isFile(normalizedRoot)) {
22820
+ return {
22821
+ fs: fs5,
22822
+ error: {
22823
+ code: "ROOT_NOT_DIRECTORY",
22824
+ message: `Service "${serviceName}" has root "${root}" but that path is a file, not a directory.`,
22825
+ serviceName
22826
+ }
22827
+ };
22828
+ }
22829
+ return { fs: fs5.chdir(normalizedRoot) };
22830
+ }
22715
22831
  function normalizeServiceEntrypoint(entrypoint) {
22716
22832
  const normalized = import_path7.posix.normalize(entrypoint);
22717
22833
  return normalized === "" ? "." : normalized;
@@ -22970,6 +23086,23 @@ var require_resolve = __commonJS({
22970
23086
  serviceName: name
22971
23087
  };
22972
23088
  }
23089
+ if (config.root !== void 0) {
23090
+ const normalizedRoot = import_path7.posix.normalize(config.root);
23091
+ if (normalizedRoot.startsWith("/")) {
23092
+ return {
23093
+ code: "INVALID_ROOT",
23094
+ message: `Service "${name}" has invalid "root" "${config.root}". Must be a relative path.`,
23095
+ serviceName: name
23096
+ };
23097
+ }
23098
+ if (normalizedRoot === ".." || normalizedRoot.startsWith("../")) {
23099
+ return {
23100
+ code: "INVALID_ROOT",
23101
+ message: `Service "${name}" has invalid "root" "${config.root}". Must not escape the project root.`,
23102
+ serviceName: name
23103
+ };
23104
+ }
23105
+ }
22973
23106
  if (config.envPrefix !== void 0) {
22974
23107
  if (!ENV_PREFIX_RE.test(config.envPrefix)) {
22975
23108
  return {
@@ -23043,7 +23176,8 @@ var require_resolve = __commonJS({
23043
23176
  const {
23044
23177
  name,
23045
23178
  config,
23046
- fs: fs5,
23179
+ serviceFs,
23180
+ root,
23047
23181
  group,
23048
23182
  resolvedEntrypoint,
23049
23183
  routePrefixSource = "configured"
@@ -23062,7 +23196,7 @@ var require_resolve = __commonJS({
23062
23196
  if (!resolvedEntrypointPath && typeof rawEntrypoint === "string") {
23063
23197
  const entrypointToResolve = moduleAttrParsed ? moduleAttrParsed.filePath : rawEntrypoint;
23064
23198
  const resolved = await resolveEntrypointPath({
23065
- fs: fs5,
23199
+ fs: serviceFs,
23066
23200
  serviceName: name,
23067
23201
  entrypoint: entrypointToResolve
23068
23202
  });
@@ -23085,7 +23219,7 @@ var require_resolve = __commonJS({
23085
23219
  workspace = normalizedEntrypoint;
23086
23220
  } else {
23087
23221
  const inferredWorkspace = await inferWorkspaceFromNearestManifest({
23088
- fs: fs5,
23222
+ fs: serviceFs,
23089
23223
  entrypoint: resolvedEntrypointFile,
23090
23224
  runtime: inferredRuntime
23091
23225
  });
@@ -23099,6 +23233,12 @@ var require_resolve = __commonJS({
23099
23233
  }
23100
23234
  }
23101
23235
  }
23236
+ if (root) {
23237
+ const normalizedRoot = import_path7.posix.normalize(root);
23238
+ if (normalizedRoot !== ".") {
23239
+ workspace = workspace === "." ? normalizedRoot : import_path7.posix.join(normalizedRoot, workspace);
23240
+ }
23241
+ }
23102
23242
  const topics = type === "worker" ? (0, import_build_utils5.getWorkerTopics)(config) : config.topics;
23103
23243
  const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
23104
23244
  let builderUse;
@@ -23198,12 +23338,19 @@ var require_resolve = __commonJS({
23198
23338
  errors.push(validationError);
23199
23339
  continue;
23200
23340
  }
23341
+ const root = serviceConfig.root;
23342
+ const serviceFsResult = await getServiceFs(fs5, name, root);
23343
+ if (serviceFsResult.error) {
23344
+ errors.push(serviceFsResult.error);
23345
+ continue;
23346
+ }
23347
+ const serviceFs = serviceFsResult.fs;
23201
23348
  let resolvedEntrypoint;
23202
23349
  if (typeof serviceConfig.entrypoint === "string") {
23203
23350
  const moduleAttr = parsePyModuleAttrEntrypoint(serviceConfig.entrypoint);
23204
23351
  const entrypointToResolve = moduleAttr?.filePath ?? serviceConfig.entrypoint;
23205
23352
  const resolvedPath = await resolveEntrypointPath({
23206
- fs: fs5,
23353
+ fs: serviceFs,
23207
23354
  serviceName: name,
23208
23355
  entrypoint: entrypointToResolve
23209
23356
  });
@@ -23232,7 +23379,7 @@ var require_resolve = __commonJS({
23232
23379
  });
23233
23380
  const workspace = resolvedEntrypoint.normalized;
23234
23381
  const { framework, error } = await detectFrameworkFromWorkspace({
23235
- fs: fs5,
23382
+ fs: serviceFs,
23236
23383
  workspace,
23237
23384
  runtime: inferredRuntime,
23238
23385
  serviceName: name
@@ -23260,13 +23407,13 @@ var require_resolve = __commonJS({
23260
23407
  });
23261
23408
  if (inferredRuntime) {
23262
23409
  const inferredWorkspace = await inferWorkspaceFromNearestManifest({
23263
- fs: fs5,
23410
+ fs: serviceFs,
23264
23411
  entrypoint: resolvedEntrypoint.normalized,
23265
23412
  runtime: inferredRuntime
23266
23413
  });
23267
23414
  const workspace = inferredWorkspace ?? import_path7.posix.dirname(resolvedEntrypoint.normalized);
23268
23415
  const detection = await detectFrameworkFromWorkspace({
23269
- fs: fs5,
23416
+ fs: serviceFs,
23270
23417
  workspace,
23271
23418
  serviceName: name,
23272
23419
  runtime: inferredRuntime
@@ -23283,7 +23430,8 @@ var require_resolve = __commonJS({
23283
23430
  const service = await resolveConfiguredService({
23284
23431
  name,
23285
23432
  config: resolvedConfig,
23286
- fs: fs5,
23433
+ serviceFs,
23434
+ root,
23287
23435
  resolvedEntrypoint,
23288
23436
  routePrefixSource
23289
23437
  });
@@ -24099,15 +24247,10 @@ var require_detect_services = __commonJS({
24099
24247
  }
24100
24248
  const cronServices = services.filter((s) => s.type === "cron");
24101
24249
  for (const service of cronServices) {
24102
- const cronEntrypoint = service.entrypoint || service.builder.src || "index";
24103
- const cronPath = (0, import_utils.getInternalServiceCronPath)(
24104
- service.name,
24105
- cronEntrypoint,
24106
- service.handlerFunction || "cron"
24107
- );
24250
+ const cronPrefix = (0, import_utils.getInternalServiceCronPathPrefix)(service.name);
24108
24251
  const functionPath = (0, import_utils.getInternalServiceFunctionPath)(service.name);
24109
24252
  crons.push({
24110
- src: `^${escapeRegex(cronPath)}$`,
24253
+ src: `^${escapeRegex(cronPrefix)}/.*$`,
24111
24254
  dest: functionPath,
24112
24255
  check: true
24113
24256
  });
@@ -24767,7 +24910,7 @@ var require_detect_builders = __commonJS({
24767
24910
  }
24768
24911
  }
24769
24912
  const nodeExtensions = [".js", ".mjs", ".ts", ".tsx"];
24770
- if (process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
24913
+ if (fileName.startsWith("api/") && process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
24771
24914
  const fsPath = (0, import_path7.join)(options.workPath, fileName);
24772
24915
  const isEntrypoint = await (0, import_build_utils5.isNodeEntrypoint)({ fsPath });
24773
24916
  if (!isEntrypoint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.9.13",
3
+ "version": "2.9.15",
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.13",
18
+ "@vercel/gatsby-plugin-vercel-builder": "2.1.15",
19
19
  "@vercel/static-config": "3.2.0"
20
20
  },
21
21
  "devDependencies": {
@@ -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.15.0",
41
+ "@vercel/build-utils": "13.17.0",
42
42
  "@vercel/error-utils": "2.0.3",
43
- "@vercel/frameworks": "3.24.0",
44
- "@vercel/routing-utils": "6.1.1",
45
- "@vercel/fs-detectors": "5.16.0"
43
+ "@vercel/frameworks": "3.24.1",
44
+ "@vercel/fs-detectors": "5.18.0",
45
+ "@vercel/routing-utils": "6.1.1"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "node ../../utils/build-builder.mjs",