@ekino/rendr-loader
Advanced tools
Comparing version 0.0.8 to 0.0.9
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -120,3 +121,3 @@ }); | ||
headers["accept"] = ctx.req.headers["accept"]; | ||
headers["accept-encoding"] = ctx.req.headers["accept-encoding"]; | ||
headers["accept-encoding"] = "gzip, deflate"; | ||
responseType = "stream"; | ||
@@ -172,4 +173,5 @@ } | ||
var dest = new stream_1.Writable({ | ||
write: function (chunk) { | ||
write: function (chunk, _, callback) { | ||
data += chunk; | ||
callback(); | ||
} | ||
@@ -176,0 +178,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -64,3 +65,3 @@ }); | ||
headers["accept"] = ctx.req.headers["accept"]; | ||
headers["accept-encoding"] = ctx.req.headers["accept-encoding"]; | ||
headers["accept-encoding"] = "gzip, deflate"; | ||
responseType = "stream"; | ||
@@ -115,4 +116,5 @@ } | ||
var dest = new Writable({ | ||
write: function (chunk) { | ||
write: function (chunk, _, callback) { | ||
data += chunk; | ||
callback(); | ||
} | ||
@@ -119,0 +121,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -69,3 +70,3 @@ }); | ||
headers["accept"] = ctx.req.headers["accept"]; | ||
headers["accept-encoding"] = ctx.req.headers["accept-encoding"]; | ||
headers["accept-encoding"] = "gzip, deflate"; | ||
responseType = "stream"; | ||
@@ -121,4 +122,5 @@ } | ||
var dest = new stream_1.Writable({ | ||
write: function (chunk) { | ||
write: function (chunk, _, callback) { | ||
data += chunk; | ||
callback(); | ||
} | ||
@@ -125,0 +127,0 @@ }); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -8,0 +9,0 @@ }); |
{ | ||
"name": "@ekino/rendr-loader", | ||
"license": "MIT", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"main": "dist/lib/index.js", | ||
@@ -13,4 +13,3 @@ "typing": "dist/lib/index.d.ts", | ||
"dependencies": { | ||
"@ekino/rendr-core": "0.0.8", | ||
"@types/axios": "^0.14.0", | ||
"@ekino/rendr-core": "0.0.9", | ||
"axios": "^0.19.0", | ||
@@ -21,3 +20,3 @@ "path-match": "^1.2.4", | ||
"devDependencies": { | ||
"@types/node": "^12.7.2", | ||
"@types/node": "^12.7.4", | ||
"@types/url-parse": "^1.4.3" | ||
@@ -28,3 +27,3 @@ }, | ||
}, | ||
"gitHead": "404863fc0ca84698556c72b465261ed1431402af" | ||
"gitHead": "bfb72cae87ba375224002b81bf3e468c6ba60b88" | ||
} |
@@ -21,4 +21,11 @@ import { createPage } from "@ekino/rendr-core"; | ||
const strPage = JSON.stringify(createPage({})); | ||
const rawData = JSON.stringify(createPage({})); | ||
let largeData = "["; | ||
for (let i = 0; i < 128; i++) { | ||
largeData += rawData + ","; | ||
} | ||
largeData += "{}]"; | ||
let pos = 0; | ||
let cptCall = 0; | ||
const resp = { | ||
@@ -30,5 +37,5 @@ headers: { | ||
read(size) { | ||
const content = strPage.substr(pos, size); | ||
const content = largeData.substr(pos, size); | ||
pos = pos + size; | ||
cptCall++; | ||
this.push(content.length ? content : null); | ||
@@ -56,2 +63,3 @@ } | ||
expect(result).toMatchSnapshot(); | ||
expect(cptCall).toBe(3); | ||
}); | ||
@@ -69,3 +77,3 @@ | ||
const strPage = "the content to be streamed..."; | ||
let strPage = "the content to be streamed..."; | ||
let pos = 0; | ||
@@ -72,0 +80,0 @@ const resp = { |
@@ -36,3 +36,4 @@ import { RequestCtx, createPage, Page } from "@ekino/rendr-core"; | ||
headers["accept"] = ctx.req.headers["accept"]; | ||
headers["accept-encoding"] = ctx.req.headers["accept-encoding"]; | ||
// please note: axios does not support br (brotli) | ||
headers["accept-encoding"] = "gzip, deflate"; | ||
@@ -93,2 +94,3 @@ responseType = "stream"; | ||
source.pipe(dest); | ||
source.on("end", (err: Error) => { | ||
@@ -113,4 +115,6 @@ if (err) { | ||
const dest = new Writable({ | ||
write(chunk) { | ||
write(chunk, _, callback) { | ||
data += chunk; | ||
callback(); | ||
} | ||
@@ -117,0 +121,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
54287
4
1006
+ Added@ekino/rendr-core@0.0.9(transitive)
- Removed@types/axios@^0.14.0
- Removed@ekino/rendr-core@0.0.8(transitive)
- Removed@types/axios@0.14.4(transitive)
Updated@ekino/rendr-core@0.0.9