@vercel/node 3.0.5 → 3.0.6
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/dist/dev-server.mjs +1170 -79
- package/dist/index.d.ts +29 -21
- package/dist/index.js +100042 -135984
- package/package.json +7 -9
- package/dist/babel.js +0 -32
- package/dist/edge-functions/edge-handler.mjs +0 -175
- package/dist/edge-functions/edge-node-compat-plugin.mjs +0 -140
- package/dist/edge-functions/edge-wasm-plugin.mjs +0 -77
- package/dist/fork-dev-server.js +0 -78
- package/dist/serverless-functions/helpers-web.d.ts +0 -7
- package/dist/serverless-functions/helpers-web.js +0 -63
- package/dist/serverless-functions/helpers.js +0 -229
- package/dist/serverless-functions/serverless-handler.mjs +0 -116
- package/dist/types.js +0 -2
- package/dist/typescript.js +0 -368
- package/dist/utils.js +0 -90
- /package/dist/{edge-functions/edge-handler-template.js → edge-handler-template.js} +0 -0
package/dist/typescript.js
DELETED
@@ -1,368 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.fixConfig = exports.register = void 0;
|
4
|
-
const build_utils_1 = require("@vercel/build-utils");
|
5
|
-
const path_1 = require("path");
|
6
|
-
/*
|
7
|
-
* Fork of TS-Node - https://github.com/TypeStrong/ts-node
|
8
|
-
* Copyright Blake Embrey
|
9
|
-
* MIT License
|
10
|
-
*/
|
11
|
-
/**
|
12
|
-
* Debugging.
|
13
|
-
*/
|
14
|
-
const shouldDebug = false;
|
15
|
-
const debug = shouldDebug
|
16
|
-
? console.log.bind(console, 'ts-node')
|
17
|
-
: () => undefined;
|
18
|
-
const debugFn = shouldDebug
|
19
|
-
? (key, fn) => {
|
20
|
-
let i = 0;
|
21
|
-
return (x) => {
|
22
|
-
debug(key, x, ++i);
|
23
|
-
return fn(x);
|
24
|
-
};
|
25
|
-
}
|
26
|
-
: (_, fn) => fn;
|
27
|
-
/**
|
28
|
-
* Track the project information.
|
29
|
-
*/
|
30
|
-
class MemoryCache {
|
31
|
-
constructor(rootFileNames = []) {
|
32
|
-
this.fileContents = new Map();
|
33
|
-
this.fileVersions = new Map();
|
34
|
-
for (const fileName of rootFileNames)
|
35
|
-
this.fileVersions.set(fileName, 1);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
/**
|
39
|
-
* Default register options.
|
40
|
-
*/
|
41
|
-
const DEFAULTS = {
|
42
|
-
files: null,
|
43
|
-
pretty: null,
|
44
|
-
compiler: undefined,
|
45
|
-
compilerOptions: undefined,
|
46
|
-
ignore: undefined,
|
47
|
-
project: undefined,
|
48
|
-
ignoreDiagnostics: undefined,
|
49
|
-
logError: null,
|
50
|
-
};
|
51
|
-
/**
|
52
|
-
* Default TypeScript compiler options required by `ts-node`.
|
53
|
-
*/
|
54
|
-
const TS_NODE_COMPILER_OPTIONS = {
|
55
|
-
sourceMap: true,
|
56
|
-
inlineSourceMap: false,
|
57
|
-
inlineSources: true,
|
58
|
-
declaration: false,
|
59
|
-
noEmit: false,
|
60
|
-
outDir: '$$ts-node$$',
|
61
|
-
};
|
62
|
-
/**
|
63
|
-
* Replace backslashes with forward slashes.
|
64
|
-
*/
|
65
|
-
function normalizeSlashes(value) {
|
66
|
-
return value.replace(/\\/g, '/');
|
67
|
-
}
|
68
|
-
/**
|
69
|
-
* Cached fs operation wrapper.
|
70
|
-
*/
|
71
|
-
function cachedLookup(fn) {
|
72
|
-
const cache = new Map();
|
73
|
-
return (arg) => {
|
74
|
-
if (!cache.has(arg)) {
|
75
|
-
cache.set(arg, fn(arg));
|
76
|
-
}
|
77
|
-
return cache.get(arg);
|
78
|
-
};
|
79
|
-
}
|
80
|
-
/**
|
81
|
-
* Maps the config path to a build func
|
82
|
-
*/
|
83
|
-
const configFileToBuildMap = new Map();
|
84
|
-
/**
|
85
|
-
* Register TypeScript compiler.
|
86
|
-
*/
|
87
|
-
function register(opts = {}) {
|
88
|
-
const options = Object.assign({}, DEFAULTS, opts);
|
89
|
-
const ignoreDiagnostics = [
|
90
|
-
6059,
|
91
|
-
18002,
|
92
|
-
18003,
|
93
|
-
...(options.ignoreDiagnostics || []),
|
94
|
-
].map(Number);
|
95
|
-
// Require the TypeScript compiler and configuration.
|
96
|
-
const cwd = options.basePath || process.cwd();
|
97
|
-
let compiler;
|
98
|
-
const require_ = eval('require');
|
99
|
-
try {
|
100
|
-
compiler = require_.resolve(options.compiler || 'typescript', {
|
101
|
-
paths: [options.project || cwd],
|
102
|
-
});
|
103
|
-
}
|
104
|
-
catch (e) {
|
105
|
-
compiler = 'typescript';
|
106
|
-
}
|
107
|
-
//eslint-disable-next-line @typescript-eslint/no-var-requires
|
108
|
-
const ts = require_(compiler);
|
109
|
-
if (compiler === 'typescript') {
|
110
|
-
console.log(`Using built-in TypeScript ${ts.version} since "typescript" is missing from "devDependencies"`);
|
111
|
-
}
|
112
|
-
else {
|
113
|
-
console.log(`Using TypeScript ${ts.version} (local user-provided)`);
|
114
|
-
}
|
115
|
-
const transformers = options.transformers || undefined;
|
116
|
-
const readFile = options.readFile || ts.sys.readFile;
|
117
|
-
const fileExists = options.fileExists || ts.sys.fileExists;
|
118
|
-
const formatDiagnostics = process.stdout.isTTY || options.pretty
|
119
|
-
? ts.formatDiagnosticsWithColorAndContext
|
120
|
-
: ts.formatDiagnostics;
|
121
|
-
const diagnosticHost = {
|
122
|
-
getNewLine: () => ts.sys.newLine,
|
123
|
-
getCurrentDirectory: () => cwd,
|
124
|
-
getCanonicalFileName: path => path,
|
125
|
-
};
|
126
|
-
function reportTSError(diagnostics, shouldExit) {
|
127
|
-
if (!diagnostics || diagnostics.length === 0) {
|
128
|
-
return;
|
129
|
-
}
|
130
|
-
const message = formatDiagnostics(diagnostics, diagnosticHost);
|
131
|
-
if (shouldExit) {
|
132
|
-
throw new build_utils_1.NowBuildError({ code: 'NODE_TYPESCRIPT_ERROR', message });
|
133
|
-
}
|
134
|
-
else {
|
135
|
-
// Print error in red color and continue execution.
|
136
|
-
console.error(message);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
function getBuild(configFileName = '', skipTypeCheck) {
|
140
|
-
const cachedGetOutput = configFileToBuildMap.get(configFileName);
|
141
|
-
if (cachedGetOutput) {
|
142
|
-
return cachedGetOutput;
|
143
|
-
}
|
144
|
-
const outFiles = new Map();
|
145
|
-
const config = readConfig(configFileName);
|
146
|
-
/**
|
147
|
-
* Create the basic function for transpile only (ts-node --transpileOnly)
|
148
|
-
*/
|
149
|
-
const getOutputTranspile = (code, fileName) => {
|
150
|
-
const outFile = outFiles.get(fileName);
|
151
|
-
if (outFile) {
|
152
|
-
return outFile;
|
153
|
-
}
|
154
|
-
const result = ts.transpileModule(code, {
|
155
|
-
fileName,
|
156
|
-
transformers,
|
157
|
-
compilerOptions: config.options,
|
158
|
-
reportDiagnostics: true,
|
159
|
-
});
|
160
|
-
const diagnosticList = result.diagnostics
|
161
|
-
? filterDiagnostics(result.diagnostics, ignoreDiagnostics)
|
162
|
-
: [];
|
163
|
-
reportTSError(diagnosticList, config.options.noEmitOnError);
|
164
|
-
const file = {
|
165
|
-
code: result.outputText,
|
166
|
-
map: result.sourceMapText,
|
167
|
-
};
|
168
|
-
outFiles.set(fileName, file);
|
169
|
-
return file;
|
170
|
-
};
|
171
|
-
const memoryCache = new MemoryCache(config.fileNames);
|
172
|
-
const cachedReadFile = cachedLookup(readFile);
|
173
|
-
// Create the compiler host for type checking.
|
174
|
-
const serviceHost = {
|
175
|
-
getScriptFileNames: () => Array.from(memoryCache.fileVersions.keys()),
|
176
|
-
getScriptVersion: (fileName) => {
|
177
|
-
const version = memoryCache.fileVersions.get(fileName);
|
178
|
-
return version === undefined ? '' : version.toString();
|
179
|
-
},
|
180
|
-
getScriptSnapshot(fileName) {
|
181
|
-
let contents = memoryCache.fileContents.get(fileName);
|
182
|
-
// Read contents into TypeScript memory cache.
|
183
|
-
if (contents === undefined) {
|
184
|
-
contents = cachedReadFile(fileName);
|
185
|
-
if (contents === undefined)
|
186
|
-
return;
|
187
|
-
memoryCache.fileVersions.set(fileName, 1);
|
188
|
-
memoryCache.fileContents.set(fileName, contents);
|
189
|
-
}
|
190
|
-
return ts.ScriptSnapshot.fromString(contents);
|
191
|
-
},
|
192
|
-
readFile: cachedReadFile,
|
193
|
-
readDirectory: cachedLookup(debugFn('readDirectory', ts.sys.readDirectory)),
|
194
|
-
getDirectories: cachedLookup(debugFn('getDirectories', ts.sys.getDirectories)),
|
195
|
-
fileExists: cachedLookup(debugFn('fileExists', fileExists)),
|
196
|
-
directoryExists: cachedLookup(debugFn('directoryExists', ts.sys.directoryExists)),
|
197
|
-
getNewLine: () => ts.sys.newLine,
|
198
|
-
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
199
|
-
getCurrentDirectory: () => cwd,
|
200
|
-
getCompilationSettings: () => config.options,
|
201
|
-
getDefaultLibFileName: () => ts.getDefaultLibFilePath(config.options),
|
202
|
-
getCustomTransformers: () => transformers,
|
203
|
-
};
|
204
|
-
const registry = ts.createDocumentRegistry(ts.sys.useCaseSensitiveFileNames, cwd);
|
205
|
-
const service = ts.createLanguageService(serviceHost, registry);
|
206
|
-
// Set the file contents into cache manually.
|
207
|
-
const updateMemoryCache = function (contents, fileName) {
|
208
|
-
const fileVersion = memoryCache.fileVersions.get(fileName) || 0;
|
209
|
-
// Avoid incrementing cache when nothing has changed.
|
210
|
-
if (memoryCache.fileContents.get(fileName) === contents)
|
211
|
-
return;
|
212
|
-
memoryCache.fileVersions.set(fileName, fileVersion + 1);
|
213
|
-
memoryCache.fileContents.set(fileName, contents);
|
214
|
-
};
|
215
|
-
/**
|
216
|
-
* Create complete function with full language services (normal behavior for `tsc`)
|
217
|
-
*/
|
218
|
-
const getOutputTypeCheck = (code, fileName) => {
|
219
|
-
const outFile = outFiles.get(fileName);
|
220
|
-
if (outFile) {
|
221
|
-
return outFile;
|
222
|
-
}
|
223
|
-
updateMemoryCache(code, fileName);
|
224
|
-
const output = service.getEmitOutput(fileName);
|
225
|
-
// Get the relevant diagnostics - this is 3x faster than `getPreEmitDiagnostics`.
|
226
|
-
const diagnostics = service
|
227
|
-
.getSemanticDiagnostics(fileName)
|
228
|
-
.concat(service.getSyntacticDiagnostics(fileName));
|
229
|
-
const diagnosticList = filterDiagnostics(diagnostics, ignoreDiagnostics);
|
230
|
-
reportTSError(diagnosticList, config.options.noEmitOnError);
|
231
|
-
if (output.emitSkipped) {
|
232
|
-
throw new TypeError(`${(0, path_1.relative)(cwd, fileName)}: Emit skipped`);
|
233
|
-
}
|
234
|
-
// Throw an error when requiring `.d.ts` files.
|
235
|
-
if (output.outputFiles.length === 0) {
|
236
|
-
throw new TypeError('Unable to require `.d.ts` file.\n' +
|
237
|
-
'This is usually the result of a faulty configuration or import. ' +
|
238
|
-
'Make sure there is a `.js`, `.json` or another executable extension and ' +
|
239
|
-
'loader (attached before `ts-node`) available alongside ' +
|
240
|
-
`\`${(0, path_1.basename)(fileName)}\`.`);
|
241
|
-
}
|
242
|
-
const file = {
|
243
|
-
code: output.outputFiles[1].text,
|
244
|
-
map: output.outputFiles[0].text,
|
245
|
-
};
|
246
|
-
outFiles.set(fileName, file);
|
247
|
-
return file;
|
248
|
-
};
|
249
|
-
const getOutput = skipTypeCheck ? getOutputTranspile : getOutputTypeCheck;
|
250
|
-
configFileToBuildMap.set(configFileName, getOutput);
|
251
|
-
return getOutput;
|
252
|
-
}
|
253
|
-
// determine the tsconfig.json path for a given folder
|
254
|
-
function detectConfig() {
|
255
|
-
let configFileName = undefined;
|
256
|
-
// Read project configuration when available.
|
257
|
-
configFileName = options.project
|
258
|
-
? ts.findConfigFile(normalizeSlashes(options.project), fileExists)
|
259
|
-
: ts.findConfigFile(normalizeSlashes(cwd), fileExists);
|
260
|
-
if (configFileName)
|
261
|
-
return normalizeSlashes(configFileName);
|
262
|
-
}
|
263
|
-
/**
|
264
|
-
* Load TypeScript configuration.
|
265
|
-
*/
|
266
|
-
function readConfig(configFileName) {
|
267
|
-
let config = { compilerOptions: {} };
|
268
|
-
const basePath = normalizeSlashes((0, path_1.dirname)(configFileName));
|
269
|
-
// Read project configuration when available.
|
270
|
-
if (configFileName) {
|
271
|
-
const result = ts.readConfigFile(configFileName, readFile);
|
272
|
-
// Return diagnostics.
|
273
|
-
if (result.error) {
|
274
|
-
const errorResult = {
|
275
|
-
errors: [result.error],
|
276
|
-
fileNames: [],
|
277
|
-
options: {},
|
278
|
-
};
|
279
|
-
const configDiagnosticList = filterDiagnostics(errorResult.errors, ignoreDiagnostics);
|
280
|
-
// Render the configuration errors.
|
281
|
-
reportTSError(configDiagnosticList, true);
|
282
|
-
return errorResult;
|
283
|
-
}
|
284
|
-
config = result.config;
|
285
|
-
}
|
286
|
-
// Remove resolution of "files".
|
287
|
-
if (!options.files) {
|
288
|
-
config.files = [];
|
289
|
-
config.include = [];
|
290
|
-
}
|
291
|
-
// Override default configuration options `ts-node` requires.
|
292
|
-
config.compilerOptions = Object.assign({}, config.compilerOptions, options.compilerOptions, TS_NODE_COMPILER_OPTIONS);
|
293
|
-
fixConfig(config, options.nodeVersionMajor);
|
294
|
-
const configResult = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName);
|
295
|
-
if (configFileName) {
|
296
|
-
const configDiagnosticList = filterDiagnostics(configResult.errors, ignoreDiagnostics);
|
297
|
-
// Render the configuration errors.
|
298
|
-
reportTSError(configDiagnosticList, configResult.options.noEmitOnError);
|
299
|
-
}
|
300
|
-
return configResult;
|
301
|
-
}
|
302
|
-
// Create a simple TypeScript compiler proxy.
|
303
|
-
function compile(code, fileName, skipTypeCheck) {
|
304
|
-
const configFileName = detectConfig();
|
305
|
-
const buildOutput = getBuild(configFileName, skipTypeCheck);
|
306
|
-
const { code: value, map: sourceMap } = buildOutput(code, fileName);
|
307
|
-
const output = {
|
308
|
-
code: value,
|
309
|
-
map: Object.assign(JSON.parse(sourceMap), {
|
310
|
-
file: (0, path_1.basename)(fileName),
|
311
|
-
sources: [fileName],
|
312
|
-
}),
|
313
|
-
};
|
314
|
-
delete output.map.sourceRoot;
|
315
|
-
return output;
|
316
|
-
}
|
317
|
-
return compile;
|
318
|
-
}
|
319
|
-
exports.register = register;
|
320
|
-
/**
|
321
|
-
* Do post-processing on config options to support `ts-node`.
|
322
|
-
*/
|
323
|
-
function fixConfig(config, nodeVersionMajor = 12) {
|
324
|
-
if (!config.compilerOptions) {
|
325
|
-
config.compilerOptions = {};
|
326
|
-
}
|
327
|
-
// Delete options that *should not* be passed through.
|
328
|
-
delete config.compilerOptions.out;
|
329
|
-
delete config.compilerOptions.outFile;
|
330
|
-
delete config.compilerOptions.composite;
|
331
|
-
delete config.compilerOptions.declarationDir;
|
332
|
-
delete config.compilerOptions.declarationMap;
|
333
|
-
delete config.compilerOptions.emitDeclarationOnly;
|
334
|
-
delete config.compilerOptions.tsBuildInfoFile;
|
335
|
-
delete config.compilerOptions.incremental;
|
336
|
-
// This will prevent TS from polyfill/downlevel emit.
|
337
|
-
if (config.compilerOptions.target === undefined) {
|
338
|
-
// See https://github.com/tsconfig/bases/tree/main/bases
|
339
|
-
let target;
|
340
|
-
if (nodeVersionMajor >= 16) {
|
341
|
-
target = 'ES2021';
|
342
|
-
}
|
343
|
-
else if (nodeVersionMajor >= 14) {
|
344
|
-
target = 'ES2020';
|
345
|
-
}
|
346
|
-
else {
|
347
|
-
target = 'ES2019';
|
348
|
-
}
|
349
|
-
config.compilerOptions.target = target;
|
350
|
-
}
|
351
|
-
// When mixing TS with JS, its best to enable this flag.
|
352
|
-
// This is useful when no `tsconfig.json` is supplied.
|
353
|
-
if (config.compilerOptions.esModuleInterop === undefined) {
|
354
|
-
config.compilerOptions.esModuleInterop = true;
|
355
|
-
}
|
356
|
-
// If not specified, the default Node.js module is CommonJS.
|
357
|
-
if (config.compilerOptions.module === undefined) {
|
358
|
-
config.compilerOptions.module = 'CommonJS';
|
359
|
-
}
|
360
|
-
return config;
|
361
|
-
}
|
362
|
-
exports.fixConfig = fixConfig;
|
363
|
-
/**
|
364
|
-
* Filter diagnostics.
|
365
|
-
*/
|
366
|
-
function filterDiagnostics(diagnostics, ignore) {
|
367
|
-
return diagnostics.filter(x => ignore.indexOf(x.code) === -1);
|
368
|
-
}
|
package/dist/utils.js
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.serializeBody = exports.validateConfiguredRuntime = exports.isEdgeRuntime = exports.EdgeRuntimes = exports.logError = exports.entrypointToOutputPath = exports.getRegExpFromMatchers = void 0;
|
4
|
-
const build_utils_1 = require("@vercel/build-utils");
|
5
|
-
const path_to_regexp_1 = require("path-to-regexp");
|
6
|
-
const path_1 = require("path");
|
7
|
-
function getRegExpFromMatchers(matcherOrMatchers) {
|
8
|
-
if (!matcherOrMatchers) {
|
9
|
-
return '^/.*$';
|
10
|
-
}
|
11
|
-
const matchers = Array.isArray(matcherOrMatchers)
|
12
|
-
? matcherOrMatchers
|
13
|
-
: [matcherOrMatchers];
|
14
|
-
const regExps = matchers.flatMap(getRegExpFromMatcher).join('|');
|
15
|
-
return regExps;
|
16
|
-
}
|
17
|
-
exports.getRegExpFromMatchers = getRegExpFromMatchers;
|
18
|
-
function getRegExpFromMatcher(matcher, index, allMatchers) {
|
19
|
-
if (typeof matcher !== 'string') {
|
20
|
-
throw new Error("Middleware's `config.matcher` must be a path matcher (string) or an array of path matchers (string[])");
|
21
|
-
}
|
22
|
-
if (!matcher.startsWith('/')) {
|
23
|
-
throw new Error(`Middleware's \`config.matcher\` values must start with "/". Received: ${matcher}`);
|
24
|
-
}
|
25
|
-
const regExps = [(0, path_to_regexp_1.pathToRegexp)(matcher).source];
|
26
|
-
if (matcher === '/' && !allMatchers.includes('/index')) {
|
27
|
-
regExps.push((0, path_to_regexp_1.pathToRegexp)('/index').source);
|
28
|
-
}
|
29
|
-
return regExps;
|
30
|
-
}
|
31
|
-
/**
|
32
|
-
* If `zeroConfig`:
|
33
|
-
* "api/foo.js" -> "api/foo.js"
|
34
|
-
* "api/foo.ts" -> "api/foo.ts"
|
35
|
-
*
|
36
|
-
* If *NOT* `zeroConfig`:
|
37
|
-
* "api/foo.js" -> "api/foo"
|
38
|
-
* "api/foo.ts" -> "api/foo"
|
39
|
-
*/
|
40
|
-
function entrypointToOutputPath(entrypoint, zeroConfig) {
|
41
|
-
if (zeroConfig) {
|
42
|
-
const ext = (0, path_1.extname)(entrypoint);
|
43
|
-
return entrypoint.slice(0, entrypoint.length - ext.length);
|
44
|
-
}
|
45
|
-
return entrypoint;
|
46
|
-
}
|
47
|
-
exports.entrypointToOutputPath = entrypointToOutputPath;
|
48
|
-
function logError(error) {
|
49
|
-
let message = error.message;
|
50
|
-
if (!message.startsWith('Error:')) {
|
51
|
-
message = `Error: ${message}`;
|
52
|
-
}
|
53
|
-
console.error(message);
|
54
|
-
if (error.stack) {
|
55
|
-
// only show the stack trace if debug is enabled
|
56
|
-
// because it points to internals, not user code
|
57
|
-
const errorPrefixLength = 'Error: '.length;
|
58
|
-
const errorMessageLength = errorPrefixLength + error.message.length;
|
59
|
-
(0, build_utils_1.debug)(error.stack.substring(errorMessageLength + 1));
|
60
|
-
}
|
61
|
-
}
|
62
|
-
exports.logError = logError;
|
63
|
-
var EdgeRuntimes;
|
64
|
-
(function (EdgeRuntimes) {
|
65
|
-
EdgeRuntimes["Edge"] = "edge";
|
66
|
-
EdgeRuntimes["ExperimentalEdge"] = "experimental-edge";
|
67
|
-
})(EdgeRuntimes = exports.EdgeRuntimes || (exports.EdgeRuntimes = {}));
|
68
|
-
function isEdgeRuntime(runtime) {
|
69
|
-
return (runtime !== undefined &&
|
70
|
-
Object.values(EdgeRuntimes).includes(runtime));
|
71
|
-
}
|
72
|
-
exports.isEdgeRuntime = isEdgeRuntime;
|
73
|
-
const ALLOWED_RUNTIMES = Object.values(EdgeRuntimes);
|
74
|
-
function validateConfiguredRuntime(runtime, entrypoint) {
|
75
|
-
if (runtime) {
|
76
|
-
if (runtime === 'nodejs') {
|
77
|
-
throw new Error(`${entrypoint}: \`config.runtime: "nodejs"\` semantics will evolve soon. Please remove the \`runtime\` key to keep the existing behavior.`);
|
78
|
-
}
|
79
|
-
if (!ALLOWED_RUNTIMES.includes(runtime)) {
|
80
|
-
throw new Error(`${entrypoint}: unsupported "runtime" value in \`config\`: ${JSON.stringify(runtime)} (must be one of: ${JSON.stringify(ALLOWED_RUNTIMES)}). Learn more: https://vercel.link/creating-edge-functions`);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
exports.validateConfiguredRuntime = validateConfiguredRuntime;
|
85
|
-
async function serializeBody(request) {
|
86
|
-
return request.method !== 'GET' && request.method !== 'HEAD'
|
87
|
-
? await (0, build_utils_1.streamToBuffer)(request)
|
88
|
-
: undefined;
|
89
|
-
}
|
90
|
-
exports.serializeBody = serializeBody;
|
File without changes
|