@vercel/node 5.3.8 → 5.3.11
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 +10 -1
- package/dist/index.js +23 -5
- package/package.json +2 -2
package/dist/dev-server.mjs
CHANGED
|
@@ -1116,7 +1116,7 @@ async function compileUserCode2(entrypointPath, awaiter, options) {
|
|
|
1116
1116
|
if (listener.default)
|
|
1117
1117
|
listener = listener.default;
|
|
1118
1118
|
}
|
|
1119
|
-
const shouldUseWebHandlers = options.isMiddleware || HTTP_METHODS.some((method) => typeof listener[method] === "function");
|
|
1119
|
+
const shouldUseWebHandlers = options.isMiddleware || HTTP_METHODS.some((method) => typeof listener[method] === "function") || typeof listener.fetch === "function";
|
|
1120
1120
|
if (shouldUseWebHandlers) {
|
|
1121
1121
|
const { createWebExportsHandler: createWebExportsHandler2 } = await Promise.resolve().then(() => (init_helpers_web(), helpers_web_exports));
|
|
1122
1122
|
const getWebExportsHandler = createWebExportsHandler2(awaiter);
|
|
@@ -1130,6 +1130,15 @@ async function compileUserCode2(entrypointPath, awaiter, options) {
|
|
|
1130
1130
|
{}
|
|
1131
1131
|
);
|
|
1132
1132
|
}
|
|
1133
|
+
if (typeof listener.fetch === "function") {
|
|
1134
|
+
handler = HTTP_METHODS.reduce(
|
|
1135
|
+
(acc, method) => {
|
|
1136
|
+
acc[method] = listener.fetch;
|
|
1137
|
+
return acc;
|
|
1138
|
+
},
|
|
1139
|
+
{}
|
|
1140
|
+
);
|
|
1141
|
+
}
|
|
1133
1142
|
return getWebExportsHandler(handler, HTTP_METHODS);
|
|
1134
1143
|
}
|
|
1135
1144
|
return async (req, res) => {
|
package/dist/index.js
CHANGED
|
@@ -67324,7 +67324,7 @@ var require_import_meta_resolve = __commonJS({
|
|
|
67324
67324
|
} = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null];
|
|
67325
67325
|
return mimeToFormat(mime);
|
|
67326
67326
|
}
|
|
67327
|
-
function
|
|
67327
|
+
function extname4(url2) {
|
|
67328
67328
|
const pathname = url2.pathname;
|
|
67329
67329
|
let index = pathname.length;
|
|
67330
67330
|
while (index--) {
|
|
@@ -67339,7 +67339,7 @@ var require_import_meta_resolve = __commonJS({
|
|
|
67339
67339
|
return "";
|
|
67340
67340
|
}
|
|
67341
67341
|
function getFileProtocolModuleFormat(url2, _context, ignoreErrors) {
|
|
67342
|
-
const ext =
|
|
67342
|
+
const ext = extname4(url2);
|
|
67343
67343
|
if (ext === ".js") {
|
|
67344
67344
|
const packageType = getPackageType(url2);
|
|
67345
67345
|
if (packageType !== "none") {
|
|
@@ -69526,7 +69526,11 @@ function register(opts = {}) {
|
|
|
69526
69526
|
const output = service.getEmitOutput(fileName);
|
|
69527
69527
|
const diagnostics = service.getSemanticDiagnostics(fileName).concat(service.getSyntacticDiagnostics(fileName));
|
|
69528
69528
|
const diagnosticList = filterDiagnostics(diagnostics, ignoreDiagnostics);
|
|
69529
|
-
|
|
69529
|
+
if (process.env.EXPERIMENTAL_NODE_TYPESCRIPT_ERRORS) {
|
|
69530
|
+
reportTSError(diagnosticList, true);
|
|
69531
|
+
} else {
|
|
69532
|
+
reportTSError(diagnosticList, config.options.noEmitOnError);
|
|
69533
|
+
}
|
|
69530
69534
|
if (output.emitSkipped) {
|
|
69531
69535
|
throw new TypeError(`${(0, import_path.relative)(cwd, fileName)}: Emit skipped`);
|
|
69532
69536
|
}
|
|
@@ -70069,10 +70073,24 @@ var build = async ({
|
|
|
70069
70073
|
];
|
|
70070
70074
|
}
|
|
70071
70075
|
if (shim) {
|
|
70076
|
+
const handlerFilename = (0, import_path3.basename)(handler);
|
|
70072
70077
|
const handlerDir = (0, import_path3.dirname)(handler);
|
|
70073
|
-
const
|
|
70078
|
+
const extension = (0, import_path3.extname)(handlerFilename);
|
|
70079
|
+
const extMap = {
|
|
70080
|
+
".ts": ".js",
|
|
70081
|
+
".mts": ".mjs",
|
|
70082
|
+
".mjs": ".mjs",
|
|
70083
|
+
".cjs": ".cjs",
|
|
70084
|
+
".js": ".js"
|
|
70085
|
+
};
|
|
70086
|
+
const ext = extMap[extension];
|
|
70087
|
+
if (!ext) {
|
|
70088
|
+
throw new Error(`Unsupported extension for ${entrypoint}`);
|
|
70089
|
+
}
|
|
70090
|
+
const filename = `shim${ext}`;
|
|
70091
|
+
const shimHandler = handlerDir === "." ? filename : (0, import_path3.join)(handlerDir, filename);
|
|
70074
70092
|
preparedFiles[shimHandler] = new import_build_utils3.FileBlob({
|
|
70075
|
-
data: shim(
|
|
70093
|
+
data: shim(handlerFilename)
|
|
70076
70094
|
});
|
|
70077
70095
|
handler = shimHandler;
|
|
70078
70096
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/node",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.11",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"tree-kill": "1.2.2",
|
|
58
58
|
"vite": "^5.1.6",
|
|
59
59
|
"vitest": "^2.0.1",
|
|
60
|
-
"@vercel/functions": "2.2.
|
|
60
|
+
"@vercel/functions": "2.2.7"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "node build.mjs",
|