vercel-deno-dev
Advanced tools
Comparing version 0.1.0-7b646479eba56e16ae746f5032130b9c9947174c to 0.1.0-885c1f9192c6dea8b235a3469ea2509e3711d928
@@ -73,3 +73,3 @@ import * as base64 from 'https://deno.land/x/base64/mod.ts'; | ||
if (!handler) { | ||
const module = await import(`${LAMBDA_TASK_ROOT}/${_HANDLER}`); | ||
const module = await import(`./${_HANDLER}`); | ||
handler = module.default; | ||
@@ -76,0 +76,0 @@ if (!handler) { |
@@ -15,3 +15,2 @@ "use strict"; | ||
const version_1 = require("../version"); | ||
const execa_1 = __importDefault(require("execa")); | ||
async function build(opts) { | ||
@@ -42,3 +41,3 @@ const { files, entrypoint, workPath: wp, config, meta = {} } = opts; | ||
// Booleans | ||
const unstable = !!process.env.DENO_UNSTABLE; | ||
//const unstable = !!process.env.DENO_UNSTABLE; | ||
let tsconfig = ""; | ||
@@ -55,31 +54,37 @@ try { | ||
} | ||
console.log({ tsconfig }); | ||
console.log("building single file"); | ||
const entrypointPath = downloadedFiles[entrypoint].fsPath; | ||
const entrypointDirname = path_1.default.dirname(entrypointPath); | ||
const extname = path_1.default.extname(entrypointPath); | ||
const binName = path_1.default.basename(entrypointPath).replace(extname, ""); | ||
const binPath = path_1.default.join(workPath, binName) + ".bundle.js"; | ||
// const entrypointPath = downloadedFiles[entrypoint].fsPath; | ||
// const entrypointDirname = path.dirname(entrypointPath); | ||
// const extname = path.extname(entrypointPath); | ||
// const binName = path.basename(entrypointPath).replace(extname, ""); | ||
// const binPath = path.join(workPath, binName) + ".bundle.js"; | ||
const denoDir = path_1.default.join(workPath, "layer", ".deno_dir"); | ||
const denoVer = util_1.parseDenoVersion(process.env.DENO_VERSION || "latest"); | ||
console.log("running `deno bundle`..."); | ||
try { | ||
const denoBin = layerFiles["bin/deno"].fsPath; | ||
await execa_1.default(denoBin, [ | ||
"bundle", | ||
entrypointPath, | ||
binPath, | ||
...(tsconfig && (denoVer.major >= 1) ? ["-c", tsconfig] : []), | ||
...(unstable ? ["--unstable"] : []), | ||
], { | ||
env: { | ||
DENO_DIR: denoDir, | ||
}, | ||
cwd: entrypointDirname, | ||
stdio: "pipe", | ||
}); | ||
} | ||
catch (err) { | ||
build_utils_1.debug("failed to `deno bundle`"); | ||
throw new Error("Failed to run `deno bundle`: " + err.stdout + " " + err.stderr); | ||
} | ||
// const denoVer = parseDenoVersion(process.env.DENO_VERSION || "latest"); | ||
// console.log("running `deno bundle`..."); | ||
// try { | ||
// const denoBin = layerFiles["bin/deno"].fsPath as string; | ||
// await execa( | ||
// denoBin, | ||
// [ | ||
// "bundle", | ||
// entrypointPath, | ||
// binPath, | ||
// ...(tsconfig && (denoVer.major >= 1) ? ["-c", tsconfig] : []), | ||
// ...(unstable ? ["--unstable"] : []), | ||
// ], | ||
// { | ||
// env: { | ||
// DENO_DIR: denoDir, | ||
// }, | ||
// cwd: entrypointDirname, | ||
// stdio: "pipe", | ||
// }, | ||
// ); | ||
// } catch (err) { | ||
// debug("failed to `deno bundle`"); | ||
// throw new Error( | ||
// "Failed to run `deno bundle`: " + err.stdout + " " + err.stderr, | ||
// ); | ||
// } | ||
const denoDirFiles = await grabDenoDirFiles_1.default(denoDir); | ||
@@ -91,13 +96,5 @@ const lambda = await build_utils_1.createLambda({ | ||
...denoDirFiles, | ||
[binName + ".bundle.js"]: new build_utils_1.FileFsRef({ | ||
mode: 0o755, | ||
fsPath: binPath, | ||
}), | ||
}, | ||
handler: binName + ".handler", | ||
runtime: "provided", | ||
environment: { | ||
HANDLER_EXT: "bundle.js", | ||
PATH: process.env.PATH + ":./bin", | ||
}, | ||
handler: entrypoint, | ||
runtime: "provided" | ||
}); | ||
@@ -108,4 +105,4 @@ if (version_1.version === 3) { | ||
return { | ||
[entrypoint]: lambda, | ||
output: lambda, | ||
}; | ||
} |
{ | ||
"name": "vercel-deno-dev", | ||
"version": "0.1.0-7b646479eba56e16ae746f5032130b9c9947174c", | ||
"version": "0.1.0-885c1f9192c6dea8b235a3469ea2509e3711d928", | ||
"description": "run deno on vercel", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index", |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
19
11
32062
634