@vercel/node 5.3.20 → 5.3.21
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 +23 -0
- package/dist/index.js +4 -2
- package/package.json +3 -1
package/dist/dev-server.mjs
CHANGED
|
@@ -1301,6 +1301,29 @@ async function onDevRequest(req, res) {
|
|
|
1301
1301
|
if (handlerEventError) {
|
|
1302
1302
|
process.exit(1);
|
|
1303
1303
|
}
|
|
1304
|
+
const publicDir = process.env.VERCEL_DEV_PUBLIC_DIR;
|
|
1305
|
+
if (publicDir && req.url) {
|
|
1306
|
+
const { join: join2 } = await import("path");
|
|
1307
|
+
const { existsSync, statSync } = await import("fs");
|
|
1308
|
+
const { readFile: readFile2 } = await import("fs/promises");
|
|
1309
|
+
const staticPath = join2(process.cwd(), publicDir, req.url);
|
|
1310
|
+
if (existsSync(staticPath) && statSync(staticPath).isFile()) {
|
|
1311
|
+
try {
|
|
1312
|
+
const content = await readFile2(staticPath);
|
|
1313
|
+
const { extname: extname2 } = await import("path");
|
|
1314
|
+
const { contentType } = await import("mime-types");
|
|
1315
|
+
const url = new URL(req.url || "/", "http://localhost");
|
|
1316
|
+
const ext = extname2(url.pathname);
|
|
1317
|
+
const mimeType = contentType(ext) || "application/octet-stream";
|
|
1318
|
+
res.setHeader("Content-Type", mimeType);
|
|
1319
|
+
res.setHeader("Content-Length", content.length);
|
|
1320
|
+
res.statusCode = 200;
|
|
1321
|
+
res.end(content);
|
|
1322
|
+
return;
|
|
1323
|
+
} catch (error) {
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1304
1327
|
if (!handleEvent) {
|
|
1305
1328
|
res.statusCode = 500;
|
|
1306
1329
|
res.end("Bridge is not ready, please try again");
|
package/dist/index.js
CHANGED
|
@@ -70260,6 +70260,7 @@ function forkDevServer(options) {
|
|
|
70260
70260
|
VERCEL_DEV_ENTRYPOINT: options.entrypoint,
|
|
70261
70261
|
VERCEL_DEV_CONFIG: JSON.stringify(options.config),
|
|
70262
70262
|
VERCEL_DEV_BUILD_ENV: JSON.stringify(options.meta.buildEnv || {}),
|
|
70263
|
+
VERCEL_DEV_PUBLIC_DIR: options.publicDir || "",
|
|
70263
70264
|
TS_NODE_TRANSPILE_ONLY: "1",
|
|
70264
70265
|
TS_NODE_COMPILER_OPTIONS: options.tsConfig?.compilerOptions ? JSON.stringify(options.tsConfig.compilerOptions) : void 0,
|
|
70265
70266
|
NODE_OPTIONS: nodeOptions
|
|
@@ -70304,7 +70305,7 @@ var require_3 = (0, import_module3.createRequire)(__filename);
|
|
|
70304
70305
|
var treeKill = (0, import_util.promisify)(import_tree_kill.default);
|
|
70305
70306
|
var tscPath = (0, import_path5.resolve)((0, import_path5.dirname)(require_3.resolve("typescript")), "../bin/tsc");
|
|
70306
70307
|
var startDevServer = async (opts) => {
|
|
70307
|
-
const { entrypoint, workPath, config, meta = {} } = opts;
|
|
70308
|
+
const { entrypoint, workPath, config, meta = {}, publicDir } = opts;
|
|
70308
70309
|
const entrypointPath = (0, import_path5.join)(workPath, entrypoint);
|
|
70309
70310
|
if (config.middleware === true && typeof meta.requestUrl === "string") {
|
|
70310
70311
|
const project = new import_ts_morph2.Project();
|
|
@@ -70387,7 +70388,8 @@ var startDevServer = async (opts) => {
|
|
|
70387
70388
|
isTypeScript,
|
|
70388
70389
|
maybeTranspile,
|
|
70389
70390
|
meta,
|
|
70390
|
-
tsConfig
|
|
70391
|
+
tsConfig,
|
|
70392
|
+
publicDir
|
|
70391
70393
|
});
|
|
70392
70394
|
const { pid } = child;
|
|
70393
70395
|
const message = await readMessage(child);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/node",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.21",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"es-module-lexer": "1.4.1",
|
|
28
28
|
"esbuild": "0.14.47",
|
|
29
29
|
"etag": "1.8.1",
|
|
30
|
+
"mime-types": "2.1.35",
|
|
30
31
|
"node-fetch": "2.6.9",
|
|
31
32
|
"path-to-regexp-updated": "npm:path-to-regexp@6.3.0",
|
|
32
33
|
"path-to-regexp": "6.1.0",
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"@types/cookie": "0.3.3",
|
|
46
47
|
"@types/etag": "1.8.0",
|
|
47
48
|
"@types/jest": "29.5.0",
|
|
49
|
+
"@types/mime-types": "2.1.4",
|
|
48
50
|
"@vitest/expect": "1.4.0",
|
|
49
51
|
"content-type": "1.0.5",
|
|
50
52
|
"cookie": "0.7.0",
|