Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vercel-deno-dev

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vercel-deno-dev - npm Package Compare versions

Comparing version 0.1.0-4d74fbd9a5f6e5dc1f59563e295a2af280298594 to 0.1.0-6ff8b04d5ca62be01d85a2ec96d2a0ed29474cbc

dist/boot/test.ts

9

dist/boot/runtime.ts

@@ -6,3 +6,3 @@ import * as base64 from 'https://deno.land/x/base64/mod.ts';

import { Context, APIGatewayProxyEvent } from 'https://deno.land/x/lambda/mod.ts';
import { NowApiHandler, NowRequest, NowResponse, NowRequestCookies, NowRequestQuery } from './NowHandler.ts';
import { NowApiHandler, NowRequest, NowResponse, NowRequestCookies, NowRequestQuery } from './nowHandler.ts';

@@ -24,3 +24,4 @@ import { setLazyProp, getCookieParser, getQueryParser } from './helpers.ts';

AWS_LAMBDA_LOG_STREAM_NAME,
_HANDLER,
_HANDLER,
LAMBDA_TASK_ROOT,
AWS_LAMBDA_RUNTIME_API

@@ -31,2 +32,3 @@ } = Deno.env.toObject();

const RUNTIME_PATH = '2018-06-01/runtime';
const [HANDLER_FILE,HANDLER_NAME] = _HANDLER.split('.');

@@ -112,2 +114,3 @@ async function initialize() {

await handler(req,res);
console.log({usedbytes:req.w.usedBufferBytes})

@@ -239,3 +242,3 @@ // execute respond if client had not implement it.

chunk = '';
} else if (Buffer.isBuffer(chunk)) {
} else if (chunk instanceof Uint8Array) {
if (!res.headers?.get('content-type')) {

@@ -242,0 +245,0 @@ res.headers?.set('content-type', 'application/octet-stream');

@@ -9,12 +9,9 @@ "use strict";

const path_1 = __importDefault(require("path"));
const util_1 = require("./util");
const gatherExtraFiles_1 = __importDefault(require("./gatherExtraFiles"));
const runUserScripts_1 = __importDefault(require("./runUserScripts"));
const grabDenoDirFiles_1 = __importDefault(require("./grabDenoDirFiles"));
//import grabDenoDirFiles from "./grabDenoDirFiles";
const getDenoLambdaLayer_1 = __importDefault(require("./getDenoLambdaLayer"));
const version_1 = require("../version");
const execa_1 = __importDefault(require("execa"));
async function build(opts) {
const { files, entrypoint, workPath: wp, config, meta = {} } = opts;
const workPath = util_1.getWorkPath(wp, entrypoint);
const { files, entrypoint, workPath, config, meta = {} } = opts;
await fs_extra_1.default.mkdirp(workPath);

@@ -42,3 +39,4 @@ // if (meta.isDev) {

// Booleans
const unstable = !!process.env.DENO_UNSTABLE;
//const unstable = !!process.env.DENO_UNSTABLE;
console.log({ workPath });
let tsconfig = "";

@@ -55,48 +53,46 @@ 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 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 denoDirFiles = await grabDenoDirFiles_1.default(denoDir);
// 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.join(workPath, "layer", ".deno_dir");
// 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(denoDir);
const lambda = await build_utils_1.createLambda({
files: {
...downloadedFiles,
...extraFiles,
...layerFiles,
...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"
});

@@ -107,4 +103,4 @@ if (version_1.version === 3) {

return {
[entrypoint]: lambda,
output: lambda,
};
}

@@ -6,4 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getWorkPath = exports.parseDenoVersion = exports.getDeno = exports.DENO_VERSION = exports.DENO_LATEST = void 0;
const path_1 = __importDefault(require("path"));
exports.parseDenoVersion = exports.getDeno = exports.DENO_VERSION = exports.DENO_LATEST = void 0;
const execa_1 = __importDefault(require("execa"));

@@ -43,2 +42,1 @@ exports.DENO_LATEST = "latest";

exports.parseDenoVersion = parseDenoVersion;
exports.getWorkPath = (workPath, entrypoint) => path_1.default.join(workPath, ".now", "builders", "now-denolis", entrypoint);
{
"name": "vercel-deno-dev",
"version": "0.1.0-4d74fbd9a5f6e5dc1f59563e295a2af280298594",
"version": "0.1.0-6ff8b04d5ca62be01d85a2ec96d2a0ed29474cbc",
"description": "run deno on vercel",

@@ -5,0 +5,0 @@ "main": "./dist/index",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc