@vercel/build-utils 13.18.0 → 13.19.0
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,15 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [services] move Python workers to v2beta triggers with private routing ([#15920](https://github.com/vercel/vercel/pull/15920))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Added a shared build result validation helper in `@vercel/build-utils` for existing callers. ([#16030](https://github.com/vercel/vercel/pull/16030))
|
|
12
|
+
|
|
3
13
|
## 13.18.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BuildResultV2Typical, BuildResultV3, BuilderFunctions, Config } from '../types';
|
|
2
|
+
export declare const SUPPORTED_AL2023_RUNTIMES: readonly ["nodejs20.x", "nodejs22.x", "nodejs24.x", "provided.al2023", "python3.12", "python3.13", "python3.14", "ruby3.3", "bun1.x", "executable"];
|
|
3
|
+
type BuildConfigWithVercelConfig = Config & {
|
|
4
|
+
vercelConfig?: {
|
|
5
|
+
functions?: BuilderFunctions;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export interface ValidateBuildResultParams {
|
|
9
|
+
allowInvalidRuntime?: boolean;
|
|
10
|
+
buildConfig?: BuildConfigWithVercelConfig;
|
|
11
|
+
buildResponse: BuildResultV2Typical | BuildResultV3;
|
|
12
|
+
osRelease?: OsRelease | null;
|
|
13
|
+
vercelBaseUrl?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ValidateBuildResultResult {
|
|
16
|
+
buildOutputMap: BuildResultV2Typical['output'];
|
|
17
|
+
customFunctionConfiguration?: BuilderFunctions[string];
|
|
18
|
+
}
|
|
19
|
+
type OsRelease = Record<string, string>;
|
|
20
|
+
export declare function validateBuildResult({ allowInvalidRuntime, buildConfig, buildResponse, osRelease, vercelBaseUrl, }: ValidateBuildResultParams): Promise<ValidateBuildResultResult>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var validate_build_result_exports = {};
|
|
30
|
+
__export(validate_build_result_exports, {
|
|
31
|
+
SUPPORTED_AL2023_RUNTIMES: () => SUPPORTED_AL2023_RUNTIMES,
|
|
32
|
+
validateBuildResult: () => validateBuildResult
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(validate_build_result_exports);
|
|
35
|
+
var import_minimatch = __toESM(require("minimatch"));
|
|
36
|
+
var import_errors = require("../errors");
|
|
37
|
+
const SUPPORTED_AL2023_RUNTIMES = [
|
|
38
|
+
"nodejs20.x",
|
|
39
|
+
"nodejs22.x",
|
|
40
|
+
"nodejs24.x",
|
|
41
|
+
"provided.al2023",
|
|
42
|
+
"python3.12",
|
|
43
|
+
"python3.13",
|
|
44
|
+
"python3.14",
|
|
45
|
+
"ruby3.3",
|
|
46
|
+
"bun1.x",
|
|
47
|
+
"executable"
|
|
48
|
+
];
|
|
49
|
+
const DEFAULT_ENTRYPOINT = ".";
|
|
50
|
+
const DEVELOPING_A_RUNTIME_URL = "https://github.com/vercel/vercel/blob/master/DEVELOPING_A_RUNTIME.md";
|
|
51
|
+
function isSupportedAl2023Runtime(runtime) {
|
|
52
|
+
return SUPPORTED_AL2023_RUNTIMES.some((supported) => supported === runtime);
|
|
53
|
+
}
|
|
54
|
+
async function validateBuildResult({
|
|
55
|
+
allowInvalidRuntime = false,
|
|
56
|
+
buildConfig,
|
|
57
|
+
buildResponse,
|
|
58
|
+
osRelease,
|
|
59
|
+
vercelBaseUrl
|
|
60
|
+
}) {
|
|
61
|
+
if (!("output" in buildResponse)) {
|
|
62
|
+
throw new import_errors.NowBuildError({
|
|
63
|
+
code: "NOW_SANDBOX_WORKER_BUILDER_ERROR",
|
|
64
|
+
message: 'The result of "builder.build" must include an `output` property for "@vercel/vc-build".'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (!buildResponse.output || typeof buildResponse.output !== "object") {
|
|
68
|
+
throw new import_errors.NowBuildError({
|
|
69
|
+
code: "NOW_SANDBOX_WORKER_BUILDER_ERROR",
|
|
70
|
+
message: 'The result of "builder.build" must be an object'
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const buildOutputMap = getAndVerifyOutputLambdasOrEdgeFuncs(buildResponse);
|
|
74
|
+
if (osRelease?.VERSION === "2023") {
|
|
75
|
+
const invalidRuntimes = [];
|
|
76
|
+
for (const [name, entry] of Object.entries(buildOutputMap)) {
|
|
77
|
+
let lambda;
|
|
78
|
+
if (entry.type === "Prerender") {
|
|
79
|
+
lambda = entry.lambda;
|
|
80
|
+
} else if (entry.type === "Lambda") {
|
|
81
|
+
lambda = entry;
|
|
82
|
+
}
|
|
83
|
+
if (!lambda)
|
|
84
|
+
continue;
|
|
85
|
+
if (!isSupportedAl2023Runtime(lambda.runtime)) {
|
|
86
|
+
invalidRuntimes.push({ name, lambda });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (invalidRuntimes.length > 0 && !allowInvalidRuntime) {
|
|
90
|
+
throw new import_errors.NowBuildError({
|
|
91
|
+
code: "NOW_SANDBOX_WORKER_INVALID_RUNTIME",
|
|
92
|
+
message: `The following Serverless Functions contain an invalid "runtime":
|
|
93
|
+
${invalidRuntimes.map(({ name, lambda }) => ` - ${name} (${lambda.runtime})`).join("\n")}`,
|
|
94
|
+
link: getVercelUrl(
|
|
95
|
+
"/docs/functions/runtimes#official-runtimes",
|
|
96
|
+
vercelBaseUrl
|
|
97
|
+
)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const customFunctionConfiguration = getCustomFunctionConfigMaybe(buildConfig);
|
|
102
|
+
if (customFunctionConfiguration?.runtime) {
|
|
103
|
+
throw new import_errors.NowBuildError({
|
|
104
|
+
code: "NOW_SANDBOX_WORKER_FUNCTION_RUNTIME_VERSION",
|
|
105
|
+
message: `The Community Runtime ${customFunctionConfiguration.runtime} is not using version 3 of the Runtime API. If you are the Runtime author, see the docs by clicking "View Details" above.`,
|
|
106
|
+
link: DEVELOPING_A_RUNTIME_URL
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
buildOutputMap,
|
|
111
|
+
customFunctionConfiguration
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function getCustomFunctionConfigMaybe(buildConfig) {
|
|
115
|
+
const functions = buildConfig?.functions ?? buildConfig?.vercelConfig?.functions;
|
|
116
|
+
if (!functions) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
for (const [funcPath, config] of Object.entries(functions)) {
|
|
120
|
+
if (funcPath === DEFAULT_ENTRYPOINT || (0, import_minimatch.default)(DEFAULT_ENTRYPOINT, funcPath)) {
|
|
121
|
+
return config;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
function getVercelUrl(path, vercelBaseUrl = "https://vercel.com") {
|
|
127
|
+
const url = new URL(path, vercelBaseUrl);
|
|
128
|
+
if (url.pathname === "/") {
|
|
129
|
+
return url.href.slice(0, -1);
|
|
130
|
+
}
|
|
131
|
+
return url.href;
|
|
132
|
+
}
|
|
133
|
+
function getAndVerifyOutputLambdasOrEdgeFuncs(buildResponse) {
|
|
134
|
+
return buildResponse.output;
|
|
135
|
+
}
|
|
136
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
137
|
+
0 && (module.exports = {
|
|
138
|
+
SUPPORTED_AL2023_RUNTIMES,
|
|
139
|
+
validateBuildResult
|
|
140
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export { getLambdaPreloadScripts, type BytecodeCachingOptions, } from './process
|
|
|
45
45
|
export { getLambdaSupportsStreaming, type SupportsStreamingResult, } from './process-serverless/get-lambda-supports-streaming';
|
|
46
46
|
export { streamToDigestAsync, sha256, md5, type FileDigest, } from './fs/stream-to-digest-async';
|
|
47
47
|
export { getBuildResultMetadata, type BuildResultMetadata, } from './collect-build-result/get-build-result-metadata';
|
|
48
|
+
export { validateBuildResult, SUPPORTED_AL2023_RUNTIMES, type ValidateBuildResultParams, type ValidateBuildResultResult, } from './collect-build-result/validate-build-result';
|
|
48
49
|
export { getLambdaByOutputPath } from './collect-build-result/get-lambda-by-output-path';
|
|
49
50
|
export { isRouteMiddleware } from './collect-build-result/is-route-middleware';
|
|
50
51
|
export { getPrerenderChain } from './collect-build-result/get-prerender-chain';
|
package/dist/index.js
CHANGED
|
@@ -9826,8 +9826,8 @@ var require_brace_expansion = __commonJS({
|
|
|
9826
9826
|
// ../../node_modules/.pnpm/minimatch@3.1.2/node_modules/minimatch/minimatch.js
|
|
9827
9827
|
var require_minimatch = __commonJS({
|
|
9828
9828
|
"../../node_modules/.pnpm/minimatch@3.1.2/node_modules/minimatch/minimatch.js"(exports, module2) {
|
|
9829
|
-
module2.exports =
|
|
9830
|
-
|
|
9829
|
+
module2.exports = minimatch3;
|
|
9830
|
+
minimatch3.Minimatch = Minimatch;
|
|
9831
9831
|
var path7 = function() {
|
|
9832
9832
|
try {
|
|
9833
9833
|
return require("path");
|
|
@@ -9836,8 +9836,8 @@ var require_minimatch = __commonJS({
|
|
|
9836
9836
|
}() || {
|
|
9837
9837
|
sep: "/"
|
|
9838
9838
|
};
|
|
9839
|
-
|
|
9840
|
-
var GLOBSTAR =
|
|
9839
|
+
minimatch3.sep = path7.sep;
|
|
9840
|
+
var GLOBSTAR = minimatch3.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
|
9841
9841
|
var expand = require_brace_expansion();
|
|
9842
9842
|
var plTypes = {
|
|
9843
9843
|
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
|
|
@@ -9858,11 +9858,11 @@ var require_minimatch = __commonJS({
|
|
|
9858
9858
|
}, {});
|
|
9859
9859
|
}
|
|
9860
9860
|
var slashSplit = /\/+/;
|
|
9861
|
-
|
|
9861
|
+
minimatch3.filter = filter;
|
|
9862
9862
|
function filter(pattern, options) {
|
|
9863
9863
|
options = options || {};
|
|
9864
9864
|
return function(p, i, list) {
|
|
9865
|
-
return
|
|
9865
|
+
return minimatch3(p, pattern, options);
|
|
9866
9866
|
};
|
|
9867
9867
|
}
|
|
9868
9868
|
function ext(a, b) {
|
|
@@ -9876,12 +9876,12 @@ var require_minimatch = __commonJS({
|
|
|
9876
9876
|
});
|
|
9877
9877
|
return t;
|
|
9878
9878
|
}
|
|
9879
|
-
|
|
9879
|
+
minimatch3.defaults = function(def) {
|
|
9880
9880
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
9881
|
-
return
|
|
9881
|
+
return minimatch3;
|
|
9882
9882
|
}
|
|
9883
|
-
var orig =
|
|
9884
|
-
var m = function
|
|
9883
|
+
var orig = minimatch3;
|
|
9884
|
+
var m = function minimatch4(p, pattern, options) {
|
|
9885
9885
|
return orig(p, pattern, ext(def, options));
|
|
9886
9886
|
};
|
|
9887
9887
|
m.Minimatch = function Minimatch2(pattern, options) {
|
|
@@ -9908,9 +9908,9 @@ var require_minimatch = __commonJS({
|
|
|
9908
9908
|
return m;
|
|
9909
9909
|
};
|
|
9910
9910
|
Minimatch.defaults = function(def) {
|
|
9911
|
-
return
|
|
9911
|
+
return minimatch3.defaults(def).Minimatch;
|
|
9912
9912
|
};
|
|
9913
|
-
function
|
|
9913
|
+
function minimatch3(p, pattern, options) {
|
|
9914
9914
|
assertValidPattern(pattern);
|
|
9915
9915
|
if (!options)
|
|
9916
9916
|
options = {};
|
|
@@ -9991,7 +9991,7 @@ var require_minimatch = __commonJS({
|
|
|
9991
9991
|
this.pattern = pattern.substr(negateOffset);
|
|
9992
9992
|
this.negate = negate;
|
|
9993
9993
|
}
|
|
9994
|
-
|
|
9994
|
+
minimatch3.braceExpand = function(pattern, options) {
|
|
9995
9995
|
return braceExpand(pattern, options);
|
|
9996
9996
|
};
|
|
9997
9997
|
Minimatch.prototype.braceExpand = braceExpand;
|
|
@@ -10253,7 +10253,7 @@ var require_minimatch = __commonJS({
|
|
|
10253
10253
|
regExp._src = re;
|
|
10254
10254
|
return regExp;
|
|
10255
10255
|
}
|
|
10256
|
-
|
|
10256
|
+
minimatch3.makeRe = function(pattern, options) {
|
|
10257
10257
|
return new Minimatch(pattern, options || {}).makeRe();
|
|
10258
10258
|
};
|
|
10259
10259
|
Minimatch.prototype.makeRe = makeRe;
|
|
@@ -10283,7 +10283,7 @@ var require_minimatch = __commonJS({
|
|
|
10283
10283
|
}
|
|
10284
10284
|
return this.regexp;
|
|
10285
10285
|
}
|
|
10286
|
-
|
|
10286
|
+
minimatch3.match = function(list, pattern, options) {
|
|
10287
10287
|
options = options || {};
|
|
10288
10288
|
var mm = new Minimatch(pattern, options);
|
|
10289
10289
|
list = list.filter(function(f) {
|
|
@@ -11010,18 +11010,18 @@ var require_brace_expansion2 = __commonJS({
|
|
|
11010
11010
|
// ../../node_modules/.pnpm/minimatch@5.0.1/node_modules/minimatch/minimatch.js
|
|
11011
11011
|
var require_minimatch2 = __commonJS({
|
|
11012
11012
|
"../../node_modules/.pnpm/minimatch@5.0.1/node_modules/minimatch/minimatch.js"(exports, module2) {
|
|
11013
|
-
var
|
|
11013
|
+
var minimatch3 = module2.exports = (p, pattern, options = {}) => {
|
|
11014
11014
|
assertValidPattern(pattern);
|
|
11015
11015
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
11016
11016
|
return false;
|
|
11017
11017
|
}
|
|
11018
11018
|
return new Minimatch(pattern, options).match(p);
|
|
11019
11019
|
};
|
|
11020
|
-
module2.exports =
|
|
11020
|
+
module2.exports = minimatch3;
|
|
11021
11021
|
var path7 = require_path();
|
|
11022
|
-
|
|
11022
|
+
minimatch3.sep = path7.sep;
|
|
11023
11023
|
var GLOBSTAR = Symbol("globstar **");
|
|
11024
|
-
|
|
11024
|
+
minimatch3.GLOBSTAR = GLOBSTAR;
|
|
11025
11025
|
var expand = require_brace_expansion2();
|
|
11026
11026
|
var plTypes = {
|
|
11027
11027
|
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
|
|
@@ -11041,18 +11041,18 @@ var require_minimatch2 = __commonJS({
|
|
|
11041
11041
|
var reSpecials = charSet("().*{}+?[]^$\\!");
|
|
11042
11042
|
var addPatternStartSet = charSet("[.(");
|
|
11043
11043
|
var slashSplit = /\/+/;
|
|
11044
|
-
|
|
11044
|
+
minimatch3.filter = (pattern, options = {}) => (p, i, list) => minimatch3(p, pattern, options);
|
|
11045
11045
|
var ext = (a, b = {}) => {
|
|
11046
11046
|
const t = {};
|
|
11047
11047
|
Object.keys(a).forEach((k) => t[k] = a[k]);
|
|
11048
11048
|
Object.keys(b).forEach((k) => t[k] = b[k]);
|
|
11049
11049
|
return t;
|
|
11050
11050
|
};
|
|
11051
|
-
|
|
11051
|
+
minimatch3.defaults = (def) => {
|
|
11052
11052
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
11053
|
-
return
|
|
11053
|
+
return minimatch3;
|
|
11054
11054
|
}
|
|
11055
|
-
const orig =
|
|
11055
|
+
const orig = minimatch3;
|
|
11056
11056
|
const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
|
|
11057
11057
|
m.Minimatch = class Minimatch extends orig.Minimatch {
|
|
11058
11058
|
constructor(pattern, options) {
|
|
@@ -11067,7 +11067,7 @@ var require_minimatch2 = __commonJS({
|
|
|
11067
11067
|
m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
|
|
11068
11068
|
return m;
|
|
11069
11069
|
};
|
|
11070
|
-
|
|
11070
|
+
minimatch3.braceExpand = (pattern, options) => braceExpand(pattern, options);
|
|
11071
11071
|
var braceExpand = (pattern, options = {}) => {
|
|
11072
11072
|
assertValidPattern(pattern);
|
|
11073
11073
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
@@ -11085,8 +11085,8 @@ var require_minimatch2 = __commonJS({
|
|
|
11085
11085
|
}
|
|
11086
11086
|
};
|
|
11087
11087
|
var SUBPARSE = Symbol("subparse");
|
|
11088
|
-
|
|
11089
|
-
|
|
11088
|
+
minimatch3.makeRe = (pattern, options) => new Minimatch(pattern, options || {}).makeRe();
|
|
11089
|
+
minimatch3.match = (list, pattern, options = {}) => {
|
|
11090
11090
|
const mm = new Minimatch(pattern, options);
|
|
11091
11091
|
list = list.filter((f) => mm.match(f));
|
|
11092
11092
|
if (mm.options.nonull && !list.length) {
|
|
@@ -11543,10 +11543,10 @@ var require_minimatch2 = __commonJS({
|
|
|
11543
11543
|
return this.negate;
|
|
11544
11544
|
}
|
|
11545
11545
|
static defaults(def) {
|
|
11546
|
-
return
|
|
11546
|
+
return minimatch3.defaults(def).Minimatch;
|
|
11547
11547
|
}
|
|
11548
11548
|
};
|
|
11549
|
-
|
|
11549
|
+
minimatch3.Minimatch = Minimatch;
|
|
11550
11550
|
}
|
|
11551
11551
|
});
|
|
11552
11552
|
|
|
@@ -11565,9 +11565,9 @@ var require_common = __commonJS({
|
|
|
11565
11565
|
}
|
|
11566
11566
|
var fs9 = require("fs");
|
|
11567
11567
|
var path7 = require("path");
|
|
11568
|
-
var
|
|
11568
|
+
var minimatch3 = require_minimatch2();
|
|
11569
11569
|
var isAbsolute = require("path").isAbsolute;
|
|
11570
|
-
var Minimatch =
|
|
11570
|
+
var Minimatch = minimatch3.Minimatch;
|
|
11571
11571
|
function alphasort(a, b) {
|
|
11572
11572
|
return a.localeCompare(b, "en");
|
|
11573
11573
|
}
|
|
@@ -11751,8 +11751,8 @@ var require_sync = __commonJS({
|
|
|
11751
11751
|
module2.exports = globSync;
|
|
11752
11752
|
globSync.GlobSync = GlobSync;
|
|
11753
11753
|
var rp = require_fs2();
|
|
11754
|
-
var
|
|
11755
|
-
var Minimatch =
|
|
11754
|
+
var minimatch3 = require_minimatch2();
|
|
11755
|
+
var Minimatch = minimatch3.Minimatch;
|
|
11756
11756
|
var Glob = require_glob().Glob;
|
|
11757
11757
|
var util = require("util");
|
|
11758
11758
|
var path7 = require("path");
|
|
@@ -11840,7 +11840,7 @@ var require_sync = __commonJS({
|
|
|
11840
11840
|
var abs = this._makeAbs(read);
|
|
11841
11841
|
if (childrenIgnored(this, read))
|
|
11842
11842
|
return;
|
|
11843
|
-
var isGlobStar = remain[0] ===
|
|
11843
|
+
var isGlobStar = remain[0] === minimatch3.GLOBSTAR;
|
|
11844
11844
|
if (isGlobStar)
|
|
11845
11845
|
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
|
|
11846
11846
|
else
|
|
@@ -12149,8 +12149,8 @@ var require_glob = __commonJS({
|
|
|
12149
12149
|
"../../node_modules/.pnpm/glob@8.0.3/node_modules/glob/glob.js"(exports, module2) {
|
|
12150
12150
|
module2.exports = glob2;
|
|
12151
12151
|
var rp = require_fs2();
|
|
12152
|
-
var
|
|
12153
|
-
var Minimatch =
|
|
12152
|
+
var minimatch3 = require_minimatch2();
|
|
12153
|
+
var Minimatch = minimatch3.Minimatch;
|
|
12154
12154
|
var inherits = require_inherits();
|
|
12155
12155
|
var EE = require("events").EventEmitter;
|
|
12156
12156
|
var path7 = require("path");
|
|
@@ -12388,7 +12388,7 @@ var require_glob = __commonJS({
|
|
|
12388
12388
|
var abs = this._makeAbs(read);
|
|
12389
12389
|
if (childrenIgnored(this, read))
|
|
12390
12390
|
return cb();
|
|
12391
|
-
var isGlobStar = remain[0] ===
|
|
12391
|
+
var isGlobStar = remain[0] === minimatch3.GLOBSTAR;
|
|
12392
12392
|
if (isGlobStar)
|
|
12393
12393
|
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
12394
12394
|
else
|
|
@@ -28268,6 +28268,7 @@ __export(src_exports, {
|
|
|
28268
28268
|
NowBuildError: () => NowBuildError,
|
|
28269
28269
|
PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
|
|
28270
28270
|
Prerender: () => Prerender,
|
|
28271
|
+
SUPPORTED_AL2023_RUNTIMES: () => SUPPORTED_AL2023_RUNTIMES,
|
|
28271
28272
|
Span: () => Span,
|
|
28272
28273
|
UNIFIED_BACKEND_BUILDER: () => UNIFIED_BACKEND_BUILDER,
|
|
28273
28274
|
Version: () => Version,
|
|
@@ -28370,6 +28371,7 @@ __export(src_exports, {
|
|
|
28370
28371
|
streamToDigestAsync: () => streamToDigestAsync,
|
|
28371
28372
|
streamWithExtendedPayload: () => streamWithExtendedPayload,
|
|
28372
28373
|
traverseUpDirectories: () => traverseUpDirectories,
|
|
28374
|
+
validateBuildResult: () => validateBuildResult,
|
|
28373
28375
|
validateEnvWrapperSupport: () => validateEnvWrapperSupport,
|
|
28374
28376
|
validateFrameworkVersion: () => validateFrameworkVersion,
|
|
28375
28377
|
validateLambdaSize: () => validateLambdaSize,
|
|
@@ -32884,6 +32886,108 @@ function toMiddlewareTuple(params) {
|
|
|
32884
32886
|
];
|
|
32885
32887
|
}
|
|
32886
32888
|
|
|
32889
|
+
// src/collect-build-result/validate-build-result.ts
|
|
32890
|
+
var import_minimatch2 = __toESM(require_minimatch());
|
|
32891
|
+
var SUPPORTED_AL2023_RUNTIMES = [
|
|
32892
|
+
"nodejs20.x",
|
|
32893
|
+
"nodejs22.x",
|
|
32894
|
+
"nodejs24.x",
|
|
32895
|
+
"provided.al2023",
|
|
32896
|
+
"python3.12",
|
|
32897
|
+
"python3.13",
|
|
32898
|
+
"python3.14",
|
|
32899
|
+
"ruby3.3",
|
|
32900
|
+
"bun1.x",
|
|
32901
|
+
"executable"
|
|
32902
|
+
];
|
|
32903
|
+
var DEFAULT_ENTRYPOINT = ".";
|
|
32904
|
+
var DEVELOPING_A_RUNTIME_URL = "https://github.com/vercel/vercel/blob/master/DEVELOPING_A_RUNTIME.md";
|
|
32905
|
+
function isSupportedAl2023Runtime(runtime) {
|
|
32906
|
+
return SUPPORTED_AL2023_RUNTIMES.some((supported) => supported === runtime);
|
|
32907
|
+
}
|
|
32908
|
+
async function validateBuildResult({
|
|
32909
|
+
allowInvalidRuntime = false,
|
|
32910
|
+
buildConfig,
|
|
32911
|
+
buildResponse,
|
|
32912
|
+
osRelease,
|
|
32913
|
+
vercelBaseUrl
|
|
32914
|
+
}) {
|
|
32915
|
+
if (!("output" in buildResponse)) {
|
|
32916
|
+
throw new NowBuildError({
|
|
32917
|
+
code: "NOW_SANDBOX_WORKER_BUILDER_ERROR",
|
|
32918
|
+
message: 'The result of "builder.build" must include an `output` property for "@vercel/vc-build".'
|
|
32919
|
+
});
|
|
32920
|
+
}
|
|
32921
|
+
if (!buildResponse.output || typeof buildResponse.output !== "object") {
|
|
32922
|
+
throw new NowBuildError({
|
|
32923
|
+
code: "NOW_SANDBOX_WORKER_BUILDER_ERROR",
|
|
32924
|
+
message: 'The result of "builder.build" must be an object'
|
|
32925
|
+
});
|
|
32926
|
+
}
|
|
32927
|
+
const buildOutputMap = getAndVerifyOutputLambdasOrEdgeFuncs(buildResponse);
|
|
32928
|
+
if (osRelease?.VERSION === "2023") {
|
|
32929
|
+
const invalidRuntimes = [];
|
|
32930
|
+
for (const [name, entry] of Object.entries(buildOutputMap)) {
|
|
32931
|
+
let lambda;
|
|
32932
|
+
if (entry.type === "Prerender") {
|
|
32933
|
+
lambda = entry.lambda;
|
|
32934
|
+
} else if (entry.type === "Lambda") {
|
|
32935
|
+
lambda = entry;
|
|
32936
|
+
}
|
|
32937
|
+
if (!lambda)
|
|
32938
|
+
continue;
|
|
32939
|
+
if (!isSupportedAl2023Runtime(lambda.runtime)) {
|
|
32940
|
+
invalidRuntimes.push({ name, lambda });
|
|
32941
|
+
}
|
|
32942
|
+
}
|
|
32943
|
+
if (invalidRuntimes.length > 0 && !allowInvalidRuntime) {
|
|
32944
|
+
throw new NowBuildError({
|
|
32945
|
+
code: "NOW_SANDBOX_WORKER_INVALID_RUNTIME",
|
|
32946
|
+
message: `The following Serverless Functions contain an invalid "runtime":
|
|
32947
|
+
${invalidRuntimes.map(({ name, lambda }) => ` - ${name} (${lambda.runtime})`).join("\n")}`,
|
|
32948
|
+
link: getVercelUrl(
|
|
32949
|
+
"/docs/functions/runtimes#official-runtimes",
|
|
32950
|
+
vercelBaseUrl
|
|
32951
|
+
)
|
|
32952
|
+
});
|
|
32953
|
+
}
|
|
32954
|
+
}
|
|
32955
|
+
const customFunctionConfiguration = getCustomFunctionConfigMaybe(buildConfig);
|
|
32956
|
+
if (customFunctionConfiguration?.runtime) {
|
|
32957
|
+
throw new NowBuildError({
|
|
32958
|
+
code: "NOW_SANDBOX_WORKER_FUNCTION_RUNTIME_VERSION",
|
|
32959
|
+
message: `The Community Runtime ${customFunctionConfiguration.runtime} is not using version 3 of the Runtime API. If you are the Runtime author, see the docs by clicking "View Details" above.`,
|
|
32960
|
+
link: DEVELOPING_A_RUNTIME_URL
|
|
32961
|
+
});
|
|
32962
|
+
}
|
|
32963
|
+
return {
|
|
32964
|
+
buildOutputMap,
|
|
32965
|
+
customFunctionConfiguration
|
|
32966
|
+
};
|
|
32967
|
+
}
|
|
32968
|
+
function getCustomFunctionConfigMaybe(buildConfig) {
|
|
32969
|
+
const functions = buildConfig?.functions ?? buildConfig?.vercelConfig?.functions;
|
|
32970
|
+
if (!functions) {
|
|
32971
|
+
return;
|
|
32972
|
+
}
|
|
32973
|
+
for (const [funcPath, config] of Object.entries(functions)) {
|
|
32974
|
+
if (funcPath === DEFAULT_ENTRYPOINT || (0, import_minimatch2.default)(DEFAULT_ENTRYPOINT, funcPath)) {
|
|
32975
|
+
return config;
|
|
32976
|
+
}
|
|
32977
|
+
}
|
|
32978
|
+
return void 0;
|
|
32979
|
+
}
|
|
32980
|
+
function getVercelUrl(path7, vercelBaseUrl = "https://vercel.com") {
|
|
32981
|
+
const url = new URL(path7, vercelBaseUrl);
|
|
32982
|
+
if (url.pathname === "/") {
|
|
32983
|
+
return url.href.slice(0, -1);
|
|
32984
|
+
}
|
|
32985
|
+
return url.href;
|
|
32986
|
+
}
|
|
32987
|
+
function getAndVerifyOutputLambdasOrEdgeFuncs(buildResponse) {
|
|
32988
|
+
return buildResponse.output;
|
|
32989
|
+
}
|
|
32990
|
+
|
|
32887
32991
|
// src/collect-build-result/stream-with-extended-payload.ts
|
|
32888
32992
|
var import_stream = require("stream");
|
|
32889
32993
|
function streamWithExtendedPayload(stream, data) {
|
|
@@ -33363,6 +33467,7 @@ function getExtendedPayload({
|
|
|
33363
33467
|
NowBuildError,
|
|
33364
33468
|
PYTHON_FRAMEWORKS,
|
|
33365
33469
|
Prerender,
|
|
33470
|
+
SUPPORTED_AL2023_RUNTIMES,
|
|
33366
33471
|
Span,
|
|
33367
33472
|
UNIFIED_BACKEND_BUILDER,
|
|
33368
33473
|
Version,
|
|
@@ -33465,6 +33570,7 @@ function getExtendedPayload({
|
|
|
33465
33570
|
streamToDigestAsync,
|
|
33466
33571
|
streamWithExtendedPayload,
|
|
33467
33572
|
traverseUpDirectories,
|
|
33573
|
+
validateBuildResult,
|
|
33468
33574
|
validateEnvWrapperSupport,
|
|
33469
33575
|
validateFrameworkVersion,
|
|
33470
33576
|
validateLambdaSize,
|
package/dist/types.d.ts
CHANGED
|
@@ -520,7 +520,6 @@ export interface Service {
|
|
|
520
520
|
schedule?: string;
|
|
521
521
|
handlerFunction?: string;
|
|
522
522
|
topics?: ServiceTopics;
|
|
523
|
-
consumer?: string;
|
|
524
523
|
/** custom prefix to inject service URL env vars */
|
|
525
524
|
envPrefix?: string;
|
|
526
525
|
}
|
|
@@ -736,7 +735,6 @@ export interface ExperimentalServiceConfig {
|
|
|
736
735
|
/** Cron schedule expression(s) (e.g., "0 0 * * *") */
|
|
737
736
|
schedule?: string;
|
|
738
737
|
topics?: ServiceTopics;
|
|
739
|
-
consumer?: string;
|
|
740
738
|
/** Custom prefix to use to inject service URL env vars */
|
|
741
739
|
envPrefix?: string;
|
|
742
740
|
}
|