@vercel/node-bridge
Advanced tools
Comparing version 2.0.1-canary.1 to 2.0.1-canary.2
@@ -29,2 +29,3 @@ const { parse } = require('url'); | ||
const helpersPath = ${JSON.stringify(helpersPath)}; | ||
const useRequire = false; | ||
@@ -42,2 +43,3 @@ const func = (${getVercelLauncher(config).toString()})(); | ||
shouldAddHelpers = false, | ||
useRequire = false, | ||
}) { | ||
@@ -63,10 +65,18 @@ return function () { | ||
import(entrypointPath) | ||
async function getListener() { | ||
let listener = useRequire | ||
? require(entrypointPath) | ||
: await import(entrypointPath); | ||
// In some cases we might have nested default props | ||
// due to TS => JS | ||
for (let i = 0; i < 5; i++) { | ||
if (listener.default) listener = listener.default; | ||
} | ||
return listener; | ||
} | ||
getListener() | ||
.then(listener => { | ||
// In some cases we might have nested default props | ||
// due to TS => JS | ||
for (let i = 0; i < 5; i++) { | ||
if (listener.default) listener = listener.default; | ||
} | ||
if (typeof listener.listen === 'function') { | ||
@@ -149,5 +159,8 @@ Server.prototype.listen = originalListen; | ||
function internal(e, context, callback) { | ||
const { path, method: httpMethod, body, headers } = JSON.parse( | ||
e.body || '{}' | ||
); | ||
const { | ||
path, | ||
method: httpMethod, | ||
body, | ||
headers, | ||
} = JSON.parse(e.body || '{}'); | ||
const { query } = parse(path, true); | ||
@@ -154,0 +167,0 @@ /** |
{ | ||
"name": "@vercel/node-bridge", | ||
"version": "2.0.1-canary.1", | ||
"version": "2.0.1-canary.2", | ||
"license": "MIT", | ||
@@ -25,3 +25,3 @@ "main": "./index.js", | ||
}, | ||
"gitHead": "cf827a8b919ff6eed383863af39c26d51b2aa16e" | ||
"gitHead": "0a09a5232c9ffddcc68475bf05fccd56ebe946d1" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25268
419
6