@vercel/node 1.12.2-canary.4 → 1.12.2-canary.5

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.
Files changed (2) hide show
  1. package/dist/launcher.js +12 -8
  2. package/package.json +3 -3
package/dist/launcher.js CHANGED
@@ -1,5 +1,6 @@
1
- const { parse } = require('url');
1
+ const { parse, pathToFileURL } = require('url');
2
2
  const { createServer, Server } = require('http');
3
+ const { isAbsolute } = require('path');
3
4
  const { Bridge } = require('./bridge.js');
4
5
 
5
6
  /**
@@ -15,8 +16,9 @@ function makeVercelLauncher(config) {
15
16
  shouldAddSourcemapSupport = false,
16
17
  } = config;
17
18
  return `
18
- const { parse } = require('url');
19
+ const { parse, pathToFileURL } = require('url');
19
20
  const { createServer, Server } = require('http');
21
+ const { isAbsolute } = require('path');
20
22
  const { Bridge } = require(${JSON.stringify(bridgePath)});
21
23
  ${
22
24
  shouldAddSourcemapSupport
@@ -60,13 +62,15 @@ function getVercelLauncher({
60
62
  process.env.NODE_ENV = region === 'dev1' ? 'development' : 'production';
61
63
  }
62
64
 
63
- async function getListener() {
65
+ /**
66
+ * @param {string} p - entrypointPath
67
+ */
68
+ async function getListener(p) {
64
69
  let listener = useRequire
65
- ? require(entrypointPath)
66
- : await import(entrypointPath);
70
+ ? require(p)
71
+ : await import(isAbsolute(p) ? pathToFileURL(p).href : p);
67
72
 
68
- // In some cases we might have nested default props
69
- // due to TS => JS
73
+ // In some cases we might have nested default props due to TS => JS
70
74
  for (let i = 0; i < 5; i++) {
71
75
  if (listener.default) listener = listener.default;
72
76
  }
@@ -74,7 +78,7 @@ function getVercelLauncher({
74
78
  return listener;
75
79
  }
76
80
 
77
- getListener()
81
+ getListener(entrypointPath)
78
82
  .then(listener => {
79
83
  if (typeof listener.listen === 'function') {
80
84
  Server.prototype.listen = originalListen;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "1.12.2-canary.4",
3
+ "version": "1.12.2-canary.5",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -34,7 +34,7 @@
34
34
  "@types/test-listen": "1.1.0",
35
35
  "@vercel/ncc": "0.24.0",
36
36
  "@vercel/nft": "0.14.0",
37
- "@vercel/node-bridge": "2.1.1-canary.1",
37
+ "@vercel/node-bridge": "2.1.1-canary.2",
38
38
  "content-type": "1.0.4",
39
39
  "cookie": "0.4.0",
40
40
  "etag": "1.8.1",
@@ -43,5 +43,5 @@
43
43
  "source-map-support": "0.5.12",
44
44
  "test-listen": "1.1.0"
45
45
  },
46
- "gitHead": "4e52f8532baada6d9c2e9c537784abcd8f9fd65b"
46
+ "gitHead": "a6ccf6c180c88f0d606a2fd932bbf558ab78ddeb"
47
47
  }