@vercel/node 5.3.20 → 5.3.22

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.
@@ -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
@@ -69504,7 +69504,9 @@ function register(opts = {}) {
69504
69504
  getCompilationSettings: () => config.options,
69505
69505
  getDefaultLibFileName: () => ts.getDefaultLibFilePath(config.options),
69506
69506
  getCustomTransformers: () => transformers,
69507
- resolveModuleNames: (moduleNames, containingFile) => {
69507
+ // This hurts performance, but for Express, type checking will fail to find @types/express without it
69508
+ // so keeping it on for now for Express/Hono projects
69509
+ resolveModuleNames: process.env.EXPERIMENTAL_NODE_TYPESCRIPT_ERRORS ? (moduleNames, containingFile) => {
69508
69510
  return moduleNames.map((moduleName) => {
69509
69511
  const result = ts.resolveModuleName(
69510
69512
  moduleName,
@@ -69514,7 +69516,7 @@ function register(opts = {}) {
69514
69516
  );
69515
69517
  return result.resolvedModule;
69516
69518
  });
69517
- }
69519
+ } : void 0
69518
69520
  };
69519
69521
  const registry = ts.createDocumentRegistry(
69520
69522
  ts.sys.useCaseSensitiveFileNames,
@@ -70260,6 +70262,7 @@ function forkDevServer(options) {
70260
70262
  VERCEL_DEV_ENTRYPOINT: options.entrypoint,
70261
70263
  VERCEL_DEV_CONFIG: JSON.stringify(options.config),
70262
70264
  VERCEL_DEV_BUILD_ENV: JSON.stringify(options.meta.buildEnv || {}),
70265
+ VERCEL_DEV_PUBLIC_DIR: options.publicDir || "",
70263
70266
  TS_NODE_TRANSPILE_ONLY: "1",
70264
70267
  TS_NODE_COMPILER_OPTIONS: options.tsConfig?.compilerOptions ? JSON.stringify(options.tsConfig.compilerOptions) : void 0,
70265
70268
  NODE_OPTIONS: nodeOptions
@@ -70304,7 +70307,7 @@ var require_3 = (0, import_module3.createRequire)(__filename);
70304
70307
  var treeKill = (0, import_util.promisify)(import_tree_kill.default);
70305
70308
  var tscPath = (0, import_path5.resolve)((0, import_path5.dirname)(require_3.resolve("typescript")), "../bin/tsc");
70306
70309
  var startDevServer = async (opts) => {
70307
- const { entrypoint, workPath, config, meta = {} } = opts;
70310
+ const { entrypoint, workPath, config, meta = {}, publicDir } = opts;
70308
70311
  const entrypointPath = (0, import_path5.join)(workPath, entrypoint);
70309
70312
  if (config.middleware === true && typeof meta.requestUrl === "string") {
70310
70313
  const project = new import_ts_morph2.Project();
@@ -70387,7 +70390,8 @@ var startDevServer = async (opts) => {
70387
70390
  isTypeScript,
70388
70391
  maybeTranspile,
70389
70392
  meta,
70390
- tsConfig
70393
+ tsConfig,
70394
+ publicDir
70391
70395
  });
70392
70396
  const { pid } = child;
70393
70397
  const message = await readMessage(child);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "5.3.20",
3
+ "version": "5.3.22",
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",
@@ -57,7 +59,7 @@
57
59
  "tree-kill": "1.2.2",
58
60
  "vite": "^5.1.6",
59
61
  "vitest": "^2.0.1",
60
- "@vercel/functions": "3.0.0"
62
+ "@vercel/functions": "3.1.0"
61
63
  },
62
64
  "scripts": {
63
65
  "build": "node build.mjs",