vercel-deno-dev
Advanced tools
Comparing version 0.1.0-f8c0fb922356a83b013c85715cfe6b9f0b025bdf to 0.1.0-fe3f9dd386a3021f9f1e05b32beef9d205da98c7
@@ -52,2 +52,5 @@ import * as base64 from 'https://deno.land/x/base64/mod.ts'; | ||
const output = new Deno.Buffer(); | ||
output.grow(33554432); // Initialize memory size to 2^25 ~~ 33.5 MB | ||
// Default buffer size: 4096 Bytes. | ||
const req:NowRequest = new ServerRequest(); | ||
@@ -59,5 +62,5 @@ req.r = new BufReader(input); | ||
req.url = data.path; | ||
req.proto = 'HTTP/1.1'; | ||
req.protoMinor = 1; | ||
req.protoMajor = 1; | ||
req.proto = 'HTTP/2.0'; | ||
req.protoMinor = 0; | ||
req.protoMajor = 2; | ||
@@ -89,11 +92,10 @@ for (const [name, value] of Object.entries(data.headers)) { | ||
// The actual output is raw HTTP message, | ||
// so we will parse it | ||
// - Headers ( statuscode default to 200 ) | ||
// - Message | ||
const bufr = new BufReader(output); | ||
// TODO: dynamically determine buffer size. | ||
// output.length has a mismatch size of a few hundret bytes compared to boy.bytlength. | ||
// not including size argument will make bufReader use default size 4096 Bytes. | ||
// console.log({outlen:output.length}) | ||
const bufr = new BufReader(output,output.length); | ||
const tp = new TextProtoReader(bufr); | ||
const firstLine = await tp.readLine() || 'HTTP/1.1 200 OK'; // e.g. "HTTP/1.1 200 OK" | ||
const firstLine = await tp.readLine() || 'HTTP/2.0 200 OK'; // e.g. "HTTP/1.1 200 OK" | ||
const statuscode = res ? res.status || 200 : parseInt(firstLine.split(' ', 2)[1], 10); // get statuscode either from res or req. | ||
@@ -106,5 +108,10 @@ const headers = await tp.readMIMEHeader() || new Headers(); | ||
const body = await bufr.readFull(new Uint8Array(bufr.buffered())); | ||
let buff = new Uint8Array(bufr.size()); | ||
const size = await bufr.read(buff)||bufr.size(); | ||
const body = buff.slice(0,size); | ||
if (!body) throw new Deno.errors.UnexpectedEof(); | ||
// console.log({ | ||
// outlen:output.length, | ||
// bodylen:body.byteLength, | ||
// }) | ||
await req.finalize(); | ||
@@ -128,3 +135,3 @@ | ||
console.log("invoke Response") | ||
console.log({result,context}) | ||
console.log({result}) | ||
const res = await LambdaFetch(`invocation/${context.awsRequestId}/response`, { | ||
@@ -131,0 +138,0 @@ method: 'POST', |
@@ -17,3 +17,3 @@ "use strict"; | ||
const bootFiles = await util_1.getbootFiles(workPath); | ||
await util_1.CacheEntryPoint(opts, downloadedFiles, denoFiles, bootFiles); | ||
const cacheFiles = await util_1.CacheEntryPoint(opts, downloadedFiles, denoFiles, bootFiles); | ||
// console.log({downloadedFiles, denoFiles,bootFiles,genFiles}) | ||
@@ -26,3 +26,2 @@ // Files directory: | ||
// - *.d.ts | ||
// - src | ||
// - bootstrap | ||
@@ -34,3 +33,4 @@ // - runtime.ts | ||
files: { | ||
...await build_utils_1.glob("**", workPath), | ||
...downloadedFiles, | ||
...cacheFiles, | ||
...bootFiles, | ||
@@ -37,0 +37,0 @@ ...denoFiles |
@@ -73,4 +73,4 @@ "use strict"; | ||
const bootstrapPath = path_1.join(__dirname, "../boot/bootstrap"); | ||
await fs_extra_1.copy(path_1.join(__dirname, '../boot'), path_1.join(workPath, 'boot')); | ||
const runtimeFiles = await dist_1.glob('boot/*.ts', workPath); | ||
const runtimeGlobs = await dist_1.glob("boot/*.ts", { cwd: path_1.join(__dirname, "../") }); | ||
const runtimeFiles = await dist_1.download(runtimeGlobs, workPath); | ||
return { | ||
@@ -127,2 +127,3 @@ ...runtimeFiles, | ||
await fs_extra_1.move(cwd, aws_task, { overwrite: true }); | ||
return await dist_1.glob(".deno/**", workPath); | ||
} | ||
@@ -129,0 +130,0 @@ exports.CacheEntryPoint = CacheEntryPoint; |
{ | ||
"name": "vercel-deno-dev", | ||
"version": "0.1.0-f8c0fb922356a83b013c85715cfe6b9f0b025bdf", | ||
"version": "0.1.0-fe3f9dd386a3021f9f1e05b32beef9d205da98c7", | ||
"description": "run deno on vercel", | ||
@@ -9,6 +9,4 @@ "main": "./dist/index", | ||
"dependencies": { | ||
"@vercel/build-utils": "^2.3.1", | ||
"fs-extra": "^9.0.1", | ||
"which": "^2.0.2", | ||
"execa": "4.0.2" | ||
"execa": "4.0.2", | ||
"fs-extra": "^9.0.1" | ||
}, | ||
@@ -20,5 +18,5 @@ "files": [ | ||
"devDependencies": { | ||
"@vercel/build-utils": "^2.3.1", | ||
"@types/fs-extra": "^9.0.1", | ||
"@types/node": "^14.0.1", | ||
"@types/which": "^1.3.2", | ||
"@vercel/frameworks": "^0.0.14", | ||
@@ -29,5 +27,7 @@ "@vercel/routing-utils": "^1.8.2", | ||
"scripts": { | ||
"build": "tsc && cp -R ./src/boot/ ./dist/boot/", | ||
"test": "rmdir /s /q .\\test\\dist_ress\\ || tsc --project ./test/tsconfig.json && node ./test/dist_ress/test.js" | ||
"clean": "if exist .\\dist\\ ( rmdir /s/q .\\dist\\ )", | ||
"build:win": "tsc && (robocopy .\\src\\boot .\\dist\\boot\\ * /s) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0", | ||
"build": "tsc && cp -R ./src/boot/. ./dist/boot/", | ||
"publish:win": "npm run clean && npm run build:win" | ||
} | ||
} |
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
23029
2
14
511
53
+ Addedcross-spawn@7.0.6(transitive)
- Removed@vercel/build-utils@^2.3.1
- Removedwhich@^2.0.2
- Removed@vercel/build-utils@2.17.0(transitive)
- Removedcross-spawn@7.0.5(transitive)