@ekino/rendr-core
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -89,5 +89,7 @@ /// <reference types="node" /> | ||
import { PageReference, PageReferenceGenerators, Settings, TransformGenerator } from "types"; | ||
import { Writable } from "stream"; | ||
export function createPageReference(url: string, settings?: Settings): PageReference; | ||
export function createPageReferencesGenerator(generators: PageReferenceGenerators): () => AsyncGenerator<PageReference, void, void>; | ||
export function transformGenerator(generator: AsyncGenerator<any, any, any>, transform: TransformGenerator): AsyncGenerator<string | Buffer, void, unknown>; | ||
export function pipeIteratorToWritable(iterator: AsyncGenerator<string | Buffer, void, unknown>, writable: Writable): Promise<void>; | ||
} | ||
@@ -94,0 +96,0 @@ declare module "index" { |
@@ -25,2 +25,11 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
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) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
@@ -72,2 +81,5 @@ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
@@ -80,5 +92,2 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
define("errors", ["require", "exports"], function (require, exports) { | ||
@@ -195,5 +204,7 @@ "use strict"; | ||
}); | ||
define("generator", ["require", "exports"], function (require, exports) { | ||
define("generator", ["require", "exports", "stream", "util"], function (require, exports, stream_1, util_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
util_1 = __importDefault(util_1); | ||
var finished = util_1.default.promisify(stream_1.finished); | ||
function createPageReference(url, settings) { | ||
@@ -311,2 +322,48 @@ return { | ||
exports.transformGenerator = transformGenerator; | ||
function pipeIteratorToWritable(iterator, writable) { | ||
var iterator_1, iterator_1_1; | ||
var e_3, _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var current, e_3_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 5, 6, 11]); | ||
iterator_1 = __asyncValues(iterator); | ||
_b.label = 1; | ||
case 1: return [4, iterator_1.next()]; | ||
case 2: | ||
if (!(iterator_1_1 = _b.sent(), !iterator_1_1.done)) return [3, 4]; | ||
current = iterator_1_1.value; | ||
writable.write(current); | ||
_b.label = 3; | ||
case 3: return [3, 1]; | ||
case 4: return [3, 11]; | ||
case 5: | ||
e_3_1 = _b.sent(); | ||
e_3 = { error: e_3_1 }; | ||
return [3, 11]; | ||
case 6: | ||
_b.trys.push([6, , 9, 10]); | ||
if (!(iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return))) return [3, 8]; | ||
return [4, _a.call(iterator_1)]; | ||
case 7: | ||
_b.sent(); | ||
_b.label = 8; | ||
case 8: return [3, 10]; | ||
case 9: | ||
if (e_3) throw e_3.error; | ||
return [7]; | ||
case 10: return [7]; | ||
case 11: | ||
writable.end(); | ||
return [4, finished(writable)]; | ||
case 12: | ||
_b.sent(); | ||
return [2]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.pipeIteratorToWritable = pipeIteratorToWritable; | ||
}); | ||
@@ -313,0 +370,0 @@ define("index", ["require", "exports", "http", "url-parse", "types", "types", "errors", "generator"], function (require, exports, http_1, url_parse_1, types_1, types_2, errors_1, generator_2) { |
/// <reference types="node" /> | ||
import { PageReference, PageReferenceGenerators, Settings, TransformGenerator } from "./types"; | ||
import { Writable } from "stream"; | ||
export declare function createPageReference(url: string, settings?: Settings): PageReference; | ||
export declare function createPageReferencesGenerator(generators: PageReferenceGenerators): () => AsyncGenerator<PageReference, void, void>; | ||
export declare function transformGenerator(generator: AsyncGenerator<any, any, any>, transform: TransformGenerator): AsyncGenerator<string | Buffer, void, unknown>; | ||
export declare function pipeIteratorToWritable(iterator: AsyncGenerator<string | Buffer, void, unknown>, writable: Writable): Promise<void>; |
@@ -0,1 +1,10 @@ | ||
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) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
@@ -47,2 +56,5 @@ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
}; | ||
import { finished as StreamFinished } from "stream"; | ||
import util from "util"; | ||
var finished = util.promisify(StreamFinished); | ||
export function createPageReference(url, settings) { | ||
@@ -157,2 +169,47 @@ return { | ||
} | ||
export function pipeIteratorToWritable(iterator, writable) { | ||
var iterator_1, iterator_1_1; | ||
var e_3, _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var current, e_3_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 5, 6, 11]); | ||
iterator_1 = __asyncValues(iterator); | ||
_b.label = 1; | ||
case 1: return [4, iterator_1.next()]; | ||
case 2: | ||
if (!(iterator_1_1 = _b.sent(), !iterator_1_1.done)) return [3, 4]; | ||
current = iterator_1_1.value; | ||
writable.write(current); | ||
_b.label = 3; | ||
case 3: return [3, 1]; | ||
case 4: return [3, 11]; | ||
case 5: | ||
e_3_1 = _b.sent(); | ||
e_3 = { error: e_3_1 }; | ||
return [3, 11]; | ||
case 6: | ||
_b.trys.push([6, , 9, 10]); | ||
if (!(iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return))) return [3, 8]; | ||
return [4, _a.call(iterator_1)]; | ||
case 7: | ||
_b.sent(); | ||
_b.label = 8; | ||
case 8: return [3, 10]; | ||
case 9: | ||
if (e_3) throw e_3.error; | ||
return [7]; | ||
case 10: return [7]; | ||
case 11: | ||
writable.end(); | ||
return [4, finished(writable)]; | ||
case 12: | ||
_b.sent(); | ||
return [2]; | ||
} | ||
}); | ||
}); | ||
} | ||
//# sourceMappingURL=generator.js.map |
/// <reference types="node" /> | ||
import { PageReference, PageReferenceGenerators, Settings, TransformGenerator } from "./types"; | ||
import { Writable } from "stream"; | ||
export declare function createPageReference(url: string, settings?: Settings): PageReference; | ||
export declare function createPageReferencesGenerator(generators: PageReferenceGenerators): () => AsyncGenerator<PageReference, void, void>; | ||
export declare function transformGenerator(generator: AsyncGenerator<any, any, any>, transform: TransformGenerator): AsyncGenerator<string | Buffer, void, unknown>; | ||
export declare function pipeIteratorToWritable(iterator: AsyncGenerator<string | Buffer, void, unknown>, writable: Writable): Promise<void>; |
"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) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
@@ -48,3 +57,9 @@ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var stream_1 = require("stream"); | ||
var util_1 = __importDefault(require("util")); | ||
var finished = util_1.default.promisify(stream_1.finished); | ||
function createPageReference(url, settings) { | ||
@@ -162,2 +177,48 @@ return { | ||
exports.transformGenerator = transformGenerator; | ||
function pipeIteratorToWritable(iterator, writable) { | ||
var iterator_1, iterator_1_1; | ||
var e_3, _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var current, e_3_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 5, 6, 11]); | ||
iterator_1 = __asyncValues(iterator); | ||
_b.label = 1; | ||
case 1: return [4, iterator_1.next()]; | ||
case 2: | ||
if (!(iterator_1_1 = _b.sent(), !iterator_1_1.done)) return [3, 4]; | ||
current = iterator_1_1.value; | ||
writable.write(current); | ||
_b.label = 3; | ||
case 3: return [3, 1]; | ||
case 4: return [3, 11]; | ||
case 5: | ||
e_3_1 = _b.sent(); | ||
e_3 = { error: e_3_1 }; | ||
return [3, 11]; | ||
case 6: | ||
_b.trys.push([6, , 9, 10]); | ||
if (!(iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return))) return [3, 8]; | ||
return [4, _a.call(iterator_1)]; | ||
case 7: | ||
_b.sent(); | ||
_b.label = 8; | ||
case 8: return [3, 10]; | ||
case 9: | ||
if (e_3) throw e_3.error; | ||
return [7]; | ||
case 10: return [7]; | ||
case 11: | ||
writable.end(); | ||
return [4, finished(writable)]; | ||
case 12: | ||
_b.sent(); | ||
return [2]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.pipeIteratorToWritable = pipeIteratorToWritable; | ||
//# sourceMappingURL=generator.js.map |
{ | ||
"name": "@ekino/rendr-core", | ||
"license": "MIT", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "dist/lib/index.js", | ||
@@ -22,3 +22,3 @@ "typing": "dist/lib/index.d.ts", | ||
}, | ||
"gitHead": "af44b9c16767ec2cd956f538cd5c8f27ecf00537" | ||
"gitHead": "b98b2ce22a1baff12a5c89262b28464d8701f5b8" | ||
} |
@@ -8,2 +8,7 @@ import { | ||
import { finished as StreamFinished, Writable } from "stream"; | ||
import util from "util"; | ||
const finished = util.promisify(StreamFinished); | ||
export function createPageReference( | ||
@@ -45,1 +50,14 @@ url: string, | ||
} | ||
export async function pipeIteratorToWritable( | ||
iterator: AsyncGenerator<string | Buffer, void, unknown>, | ||
writable: Writable | ||
) { | ||
for await (const current of iterator) { | ||
writable.write(current); | ||
} | ||
writable.end(); | ||
await finished(writable); | ||
} |
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
124609
2456