@vercel/build-utils 13.2.16 → 13.2.17

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.2.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `exposeErrBody` optional boolean property to Prerender object ([#14845](https://github.com/vercel/vercel/pull/14845))
8
+
9
+ - Move backends builder detection to detectBuilders phase ([#14830](https://github.com/vercel/vercel/pull/14830))
10
+
3
11
  ## 13.2.16
4
12
 
5
13
  ### Patch Changes
@@ -5,7 +5,15 @@ import { Builder } from '.';
5
5
  export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "koa", "nestjs", "fastify", "elysia"];
6
6
  export declare const PYTHON_FRAMEWORKS: readonly ["fastapi", "flask", "python"];
7
7
  export declare const RUNTIME_FRAMEWORKS: readonly ["python"];
8
+ /**
9
+ * List of framework-specific backend builders that get replaced by UNIFIED_BACKEND_BUILDER
10
+ * when experimental backends is enabled
11
+ */
8
12
  export declare const BACKEND_BUILDERS: readonly ["@vercel/express", "@vercel/hono", "@vercel/h3", "@vercel/koa", "@vercel/nestjs", "@vercel/fastify", "@vercel/elysia"];
13
+ /**
14
+ * The unified backend builder that replaces framework-specific backend builders
15
+ */
16
+ export declare const UNIFIED_BACKEND_BUILDER: "@vercel/backends";
9
17
  export type BackendFramework = (typeof BACKEND_FRAMEWORKS)[number];
10
18
  export type PythonFramework = (typeof PYTHON_FRAMEWORKS)[number];
11
19
  /**
@@ -22,6 +22,7 @@ __export(framework_helpers_exports, {
22
22
  BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
23
23
  PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
24
24
  RUNTIME_FRAMEWORKS: () => RUNTIME_FRAMEWORKS,
25
+ UNIFIED_BACKEND_BUILDER: () => UNIFIED_BACKEND_BUILDER,
25
26
  isBackendBuilder: () => isBackendBuilder,
26
27
  isBackendFramework: () => isBackendFramework,
27
28
  isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
@@ -55,6 +56,7 @@ const BACKEND_BUILDERS = [
55
56
  "@vercel/fastify",
56
57
  "@vercel/elysia"
57
58
  ];
59
+ const UNIFIED_BACKEND_BUILDER = "@vercel/backends";
58
60
  function isBackendFramework(framework) {
59
61
  if (!framework)
60
62
  return false;
@@ -75,6 +77,8 @@ function isExperimentalBackendsEnabled() {
75
77
  function isBackendBuilder(builder) {
76
78
  if (!builder)
77
79
  return false;
80
+ if (builder.use === UNIFIED_BACKEND_BUILDER)
81
+ return true;
78
82
  const use = builder.use;
79
83
  return BACKEND_BUILDERS.includes(use);
80
84
  }
@@ -87,6 +91,7 @@ function shouldUseExperimentalBackends(framework) {
87
91
  BACKEND_FRAMEWORKS,
88
92
  PYTHON_FRAMEWORKS,
89
93
  RUNTIME_FRAMEWORKS,
94
+ UNIFIED_BACKEND_BUILDER,
90
95
  isBackendBuilder,
91
96
  isBackendFramework,
92
97
  isExperimentalBackendsEnabled,
package/dist/index.d.ts CHANGED
@@ -32,5 +32,5 @@ export { NODE_VERSIONS } from './fs/node-version';
32
32
  export { getInstalledPackageVersion } from './get-installed-package-version';
33
33
  export { defaultCachePathGlob } from './default-cache-path-glob';
34
34
  export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
35
- export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
35
+ export { BACKEND_FRAMEWORKS, BACKEND_BUILDERS, UNIFIED_BACKEND_BUILDER, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
36
36
  export * from './python';
package/dist/index.js CHANGED
@@ -23715,6 +23715,7 @@ var require_execa = __commonJS({
23715
23715
  // src/index.ts
23716
23716
  var src_exports = {};
23717
23717
  __export(src_exports, {
23718
+ BACKEND_BUILDERS: () => BACKEND_BUILDERS,
23718
23719
  BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
23719
23720
  BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
23720
23721
  BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP,
@@ -23731,6 +23732,7 @@ __export(src_exports, {
23731
23732
  PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
23732
23733
  Prerender: () => Prerender,
23733
23734
  Span: () => Span,
23735
+ UNIFIED_BACKEND_BUILDER: () => UNIFIED_BACKEND_BUILDER,
23734
23736
  Version: () => Version,
23735
23737
  buildsSchema: () => buildsSchema,
23736
23738
  cloneEnv: () => cloneEnv,
@@ -24612,7 +24614,8 @@ var Prerender = class {
24612
24614
  sourcePath,
24613
24615
  experimentalBypassFor,
24614
24616
  experimentalStreamingLambdaPath,
24615
- chain
24617
+ chain,
24618
+ exposeErrBody
24616
24619
  }) {
24617
24620
  this.type = "Prerender";
24618
24621
  this.expiration = expiration;
@@ -24737,6 +24740,13 @@ var Prerender = class {
24737
24740
  }
24738
24741
  this.chain = chain;
24739
24742
  }
24743
+ if (exposeErrBody === true) {
24744
+ this.exposeErrBody = true;
24745
+ } else if (typeof exposeErrBody !== "boolean" && typeof exposeErrBody !== "undefined") {
24746
+ throw new Error(
24747
+ `The \`exposeErrBody\` argument for \`Prerender\` must be a boolean.`
24748
+ );
24749
+ }
24740
24750
  }
24741
24751
  };
24742
24752
 
@@ -26779,6 +26789,7 @@ var BACKEND_BUILDERS = [
26779
26789
  "@vercel/fastify",
26780
26790
  "@vercel/elysia"
26781
26791
  ];
26792
+ var UNIFIED_BACKEND_BUILDER = "@vercel/backends";
26782
26793
  function isBackendFramework(framework) {
26783
26794
  if (!framework)
26784
26795
  return false;
@@ -26799,6 +26810,8 @@ function isExperimentalBackendsEnabled() {
26799
26810
  function isBackendBuilder(builder) {
26800
26811
  if (!builder)
26801
26812
  return false;
26813
+ if (builder.use === UNIFIED_BACKEND_BUILDER)
26814
+ return true;
26802
26815
  const use = builder.use;
26803
26816
  return BACKEND_BUILDERS.includes(use);
26804
26817
  }
@@ -26854,6 +26867,7 @@ async function isPythonEntrypoint(file) {
26854
26867
  }
26855
26868
  // Annotate the CommonJS export names for ESM import in node:
26856
26869
  0 && (module.exports = {
26870
+ BACKEND_BUILDERS,
26857
26871
  BACKEND_FRAMEWORKS,
26858
26872
  BUILDER_COMPILE_STEP,
26859
26873
  BUILDER_INSTALLER_STEP,
@@ -26870,6 +26884,7 @@ async function isPythonEntrypoint(file) {
26870
26884
  PYTHON_FRAMEWORKS,
26871
26885
  Prerender,
26872
26886
  Span,
26887
+ UNIFIED_BACKEND_BUILDER,
26873
26888
  Version,
26874
26889
  buildsSchema,
26875
26890
  cloneEnv,
@@ -16,6 +16,7 @@ interface PrerenderOptions {
16
16
  experimentalBypassFor?: HasField;
17
17
  experimentalStreamingLambdaPath?: string;
18
18
  chain?: Chain;
19
+ exposeErrBody?: boolean;
19
20
  }
20
21
  export declare class Prerender {
21
22
  type: 'Prerender';
@@ -43,6 +44,7 @@ export declare class Prerender {
43
44
  experimentalBypassFor?: HasField;
44
45
  experimentalStreamingLambdaPath?: string;
45
46
  chain?: Chain;
46
- constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
47
+ exposeErrBody?: boolean;
48
+ constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, }: PrerenderOptions);
47
49
  }
48
50
  export {};
package/dist/prerender.js CHANGED
@@ -37,7 +37,8 @@ class Prerender {
37
37
  sourcePath,
38
38
  experimentalBypassFor,
39
39
  experimentalStreamingLambdaPath,
40
- chain
40
+ chain,
41
+ exposeErrBody
41
42
  }) {
42
43
  this.type = "Prerender";
43
44
  this.expiration = expiration;
@@ -162,6 +163,13 @@ class Prerender {
162
163
  }
163
164
  this.chain = chain;
164
165
  }
166
+ if (exposeErrBody === true) {
167
+ this.exposeErrBody = true;
168
+ } else if (typeof exposeErrBody !== "boolean" && typeof exposeErrBody !== "undefined") {
169
+ throw new Error(
170
+ `The \`exposeErrBody\` argument for \`Prerender\` must be a boolean.`
171
+ );
172
+ }
165
173
  }
166
174
  }
167
175
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.2.16",
3
+ "version": "13.2.17",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",