@vercel/static-build 2.9.12 → 2.9.14

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 +170 -13
  2. package/package.json +7 -7
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",
@@ -22712,6 +22811,33 @@ var require_resolve = __commonJS({
22712
22811
  var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
22713
22812
  var DNS_LABEL_RE = /^(?!-)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
22714
22813
  var ENV_PREFIX_RE = /^[A-Z][A-Z0-9_]*_$/;
22814
+ async function getServiceFs(fs5, serviceName, root) {
22815
+ if (!root) {
22816
+ return { fs: fs5 };
22817
+ }
22818
+ const normalizedRoot = import_path7.posix.normalize(root);
22819
+ if (!await fs5.hasPath(normalizedRoot)) {
22820
+ return {
22821
+ fs: fs5,
22822
+ error: {
22823
+ code: "ROOT_NOT_FOUND",
22824
+ message: `Service "${serviceName}" has root "${root}" but that directory does not exist.`,
22825
+ serviceName
22826
+ }
22827
+ };
22828
+ }
22829
+ if (await fs5.isFile(normalizedRoot)) {
22830
+ return {
22831
+ fs: fs5,
22832
+ error: {
22833
+ code: "ROOT_NOT_DIRECTORY",
22834
+ message: `Service "${serviceName}" has root "${root}" but that path is a file, not a directory.`,
22835
+ serviceName
22836
+ }
22837
+ };
22838
+ }
22839
+ return { fs: fs5.chdir(normalizedRoot) };
22840
+ }
22715
22841
  function normalizeServiceEntrypoint(entrypoint) {
22716
22842
  const normalized = import_path7.posix.normalize(entrypoint);
22717
22843
  return normalized === "" ? "." : normalized;
@@ -22970,6 +23096,23 @@ var require_resolve = __commonJS({
22970
23096
  serviceName: name
22971
23097
  };
22972
23098
  }
23099
+ if (config.root !== void 0) {
23100
+ const normalizedRoot = import_path7.posix.normalize(config.root);
23101
+ if (normalizedRoot.startsWith("/")) {
23102
+ return {
23103
+ code: "INVALID_ROOT",
23104
+ message: `Service "${name}" has invalid "root" "${config.root}". Must be a relative path.`,
23105
+ serviceName: name
23106
+ };
23107
+ }
23108
+ if (normalizedRoot === ".." || normalizedRoot.startsWith("../")) {
23109
+ return {
23110
+ code: "INVALID_ROOT",
23111
+ message: `Service "${name}" has invalid "root" "${config.root}". Must not escape the project root.`,
23112
+ serviceName: name
23113
+ };
23114
+ }
23115
+ }
22973
23116
  if (config.envPrefix !== void 0) {
22974
23117
  if (!ENV_PREFIX_RE.test(config.envPrefix)) {
22975
23118
  return {
@@ -23043,14 +23186,15 @@ var require_resolve = __commonJS({
23043
23186
  const {
23044
23187
  name,
23045
23188
  config,
23046
- fs: fs5,
23189
+ serviceFs,
23190
+ root,
23047
23191
  group,
23048
23192
  resolvedEntrypoint,
23049
23193
  routePrefixSource = "configured"
23050
23194
  } = options;
23051
23195
  const type = config.type || "web";
23052
23196
  const rawEntrypoint = config.entrypoint;
23053
- const moduleAttrParsed = typeof rawEntrypoint === "string" && type === "cron" ? parsePyModuleAttrEntrypoint(rawEntrypoint) : null;
23197
+ const moduleAttrParsed = typeof rawEntrypoint === "string" ? parsePyModuleAttrEntrypoint(rawEntrypoint) : null;
23054
23198
  const routingResult = resolveServiceRoutingConfig(name, config);
23055
23199
  if (routingResult.error) {
23056
23200
  throw new Error(routingResult.error.message);
@@ -23062,7 +23206,7 @@ var require_resolve = __commonJS({
23062
23206
  if (!resolvedEntrypointPath && typeof rawEntrypoint === "string") {
23063
23207
  const entrypointToResolve = moduleAttrParsed ? moduleAttrParsed.filePath : rawEntrypoint;
23064
23208
  const resolved = await resolveEntrypointPath({
23065
- fs: fs5,
23209
+ fs: serviceFs,
23066
23210
  serviceName: name,
23067
23211
  entrypoint: entrypointToResolve
23068
23212
  });
@@ -23085,7 +23229,7 @@ var require_resolve = __commonJS({
23085
23229
  workspace = normalizedEntrypoint;
23086
23230
  } else {
23087
23231
  const inferredWorkspace = await inferWorkspaceFromNearestManifest({
23088
- fs: fs5,
23232
+ fs: serviceFs,
23089
23233
  entrypoint: resolvedEntrypointFile,
23090
23234
  runtime: inferredRuntime
23091
23235
  });
@@ -23099,6 +23243,12 @@ var require_resolve = __commonJS({
23099
23243
  }
23100
23244
  }
23101
23245
  }
23246
+ if (root) {
23247
+ const normalizedRoot = import_path7.posix.normalize(root);
23248
+ if (normalizedRoot !== ".") {
23249
+ workspace = workspace === "." ? normalizedRoot : import_path7.posix.join(normalizedRoot, workspace);
23250
+ }
23251
+ }
23102
23252
  const topics = type === "worker" ? (0, import_build_utils5.getWorkerTopics)(config) : config.topics;
23103
23253
  const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
23104
23254
  let builderUse;
@@ -23198,13 +23348,19 @@ var require_resolve = __commonJS({
23198
23348
  errors.push(validationError);
23199
23349
  continue;
23200
23350
  }
23351
+ const root = serviceConfig.root;
23352
+ const serviceFsResult = await getServiceFs(fs5, name, root);
23353
+ if (serviceFsResult.error) {
23354
+ errors.push(serviceFsResult.error);
23355
+ continue;
23356
+ }
23357
+ const serviceFs = serviceFsResult.fs;
23201
23358
  let resolvedEntrypoint;
23202
- const serviceType = serviceConfig.type || "web";
23203
23359
  if (typeof serviceConfig.entrypoint === "string") {
23204
- const moduleAttr = serviceType === "cron" ? parsePyModuleAttrEntrypoint(serviceConfig.entrypoint) : null;
23205
- const entrypointToResolve = moduleAttr ? moduleAttr.filePath : serviceConfig.entrypoint;
23360
+ const moduleAttr = parsePyModuleAttrEntrypoint(serviceConfig.entrypoint);
23361
+ const entrypointToResolve = moduleAttr?.filePath ?? serviceConfig.entrypoint;
23206
23362
  const resolvedPath = await resolveEntrypointPath({
23207
- fs: fs5,
23363
+ fs: serviceFs,
23208
23364
  serviceName: name,
23209
23365
  entrypoint: entrypointToResolve
23210
23366
  });
@@ -23233,7 +23389,7 @@ var require_resolve = __commonJS({
23233
23389
  });
23234
23390
  const workspace = resolvedEntrypoint.normalized;
23235
23391
  const { framework, error } = await detectFrameworkFromWorkspace({
23236
- fs: fs5,
23392
+ fs: serviceFs,
23237
23393
  workspace,
23238
23394
  runtime: inferredRuntime,
23239
23395
  serviceName: name
@@ -23261,13 +23417,13 @@ var require_resolve = __commonJS({
23261
23417
  });
23262
23418
  if (inferredRuntime) {
23263
23419
  const inferredWorkspace = await inferWorkspaceFromNearestManifest({
23264
- fs: fs5,
23420
+ fs: serviceFs,
23265
23421
  entrypoint: resolvedEntrypoint.normalized,
23266
23422
  runtime: inferredRuntime
23267
23423
  });
23268
23424
  const workspace = inferredWorkspace ?? import_path7.posix.dirname(resolvedEntrypoint.normalized);
23269
23425
  const detection = await detectFrameworkFromWorkspace({
23270
- fs: fs5,
23426
+ fs: serviceFs,
23271
23427
  workspace,
23272
23428
  serviceName: name,
23273
23429
  runtime: inferredRuntime
@@ -23284,7 +23440,8 @@ var require_resolve = __commonJS({
23284
23440
  const service = await resolveConfiguredService({
23285
23441
  name,
23286
23442
  config: resolvedConfig,
23287
- fs: fs5,
23443
+ serviceFs,
23444
+ root,
23288
23445
  resolvedEntrypoint,
23289
23446
  routePrefixSource
23290
23447
  });
@@ -24768,7 +24925,7 @@ var require_detect_builders = __commonJS({
24768
24925
  }
24769
24926
  }
24770
24927
  const nodeExtensions = [".js", ".mjs", ".ts", ".tsx"];
24771
- if (process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
24928
+ if (fileName.startsWith("api/") && process.env.VERCEL_NODE_FILTER_ENTRYPOINTS === "1" && nodeExtensions.some((ext) => fileName.endsWith(ext)) && options.workPath) {
24772
24929
  const fsPath = (0, import_path7.join)(options.workPath, fileName);
24773
24930
  const isEntrypoint = await (0, import_build_utils5.isNodeEntrypoint)({ fsPath });
24774
24931
  if (!isEntrypoint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.9.12",
3
+ "version": "2.9.14",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -14,9 +14,9 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "ts-morph": "12.0.0",
17
- "@vercel/static-config": "3.2.0",
18
17
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
19
- "@vercel/gatsby-plugin-vercel-builder": "2.1.12"
18
+ "@vercel/static-config": "3.2.0",
19
+ "@vercel/gatsby-plugin-vercel-builder": "2.1.14"
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/fs-detectors": "5.15.2",
42
- "@vercel/frameworks": "3.24.0",
41
+ "@vercel/build-utils": "13.16.0",
42
+ "@vercel/frameworks": "3.24.1",
43
+ "@vercel/fs-detectors": "5.17.0",
43
44
  "@vercel/routing-utils": "6.1.1",
44
- "@vercel/error-utils": "2.0.3",
45
- "@vercel/build-utils": "13.14.2"
45
+ "@vercel/error-utils": "2.0.3"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "node ../../utils/build-builder.mjs",