@ekino/rendr-core
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -23,2 +23,3 @@ /// <reference types="node" /> | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
import { Writable } from "stream"; | ||
export interface BlockDefinition { | ||
@@ -70,14 +71,31 @@ type: string; | ||
} | ||
export interface Normalizer { | ||
(entry: any): BlockDefinition; | ||
} | ||
export type Normalizer = (entry: any) => BlockDefinition; | ||
export type NormalizerList = { | ||
[index: string]: Normalizer; | ||
}; | ||
export interface PageReference { | ||
url: string; | ||
group: string; | ||
settings: Settings; | ||
} | ||
export type AsyncPageReferenceGenerator = AsyncGenerator<PageReference, void, void | unknown>; | ||
export type PageReferenceGenerator = () => AsyncPageReferenceGenerator; | ||
export interface PageReferenceGenerators { | ||
[index: string]: PageReferenceGenerator; | ||
} | ||
export type TransformGenerator = (data: any) => Promise<string | Buffer> | string | Buffer; | ||
export type StreamCreator = (name: string) => Writable; | ||
} | ||
declare module "generator" { | ||
import { PageReference, PageReferenceGenerators, Settings, TransformGenerator } from "types"; | ||
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>; | ||
} | ||
declare module "index" { | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
import { Page, Cache, Head, BlockDefinition, RequestCtx } from "types"; | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
export * from "types"; | ||
export * from "errors"; | ||
export * from "generator"; | ||
export function isObject(data: any): boolean; | ||
@@ -84,0 +102,0 @@ export function isArray(data: any): boolean; |
@@ -25,2 +25,48 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __asyncValues = (this && this.__asyncValues) || function (o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
}; | ||
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } | ||
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
}; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
@@ -147,4 +193,120 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
}); | ||
define("index", ["require", "exports", "types", "http", "url-parse", "types", "errors"], function (require, exports, types_1, http_1, url_parse_1, types_2, errors_1) { | ||
define("generator", ["require", "exports"], function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function createPageReference(url, settings) { | ||
return { | ||
url: url, | ||
group: "", | ||
settings: settings ? settings : {} | ||
}; | ||
} | ||
exports.createPageReference = createPageReference; | ||
function createPageReferencesGenerator(generators) { | ||
return function chainGenerators() { | ||
return __asyncGenerator(this, arguments, function chainGenerators_1() { | ||
var _a, _b, _i, group, generator, _c, _d, curr, e_1_1; | ||
var e_1, _e; | ||
return __generator(this, function (_f) { | ||
switch (_f.label) { | ||
case 0: | ||
_a = []; | ||
for (_b in generators) | ||
_a.push(_b); | ||
_i = 0; | ||
_f.label = 1; | ||
case 1: | ||
if (!(_i < _a.length)) return [3, 16]; | ||
group = _a[_i]; | ||
generator = generators[group]; | ||
_f.label = 2; | ||
case 2: | ||
_f.trys.push([2, 9, 10, 15]); | ||
_c = __asyncValues(generator()); | ||
_f.label = 3; | ||
case 3: return [4, __await(_c.next())]; | ||
case 4: | ||
if (!(_d = _f.sent(), !_d.done)) return [3, 8]; | ||
curr = _d.value; | ||
curr.group = group; | ||
return [4, __await(curr)]; | ||
case 5: return [4, _f.sent()]; | ||
case 6: | ||
_f.sent(); | ||
_f.label = 7; | ||
case 7: return [3, 3]; | ||
case 8: return [3, 15]; | ||
case 9: | ||
e_1_1 = _f.sent(); | ||
e_1 = { error: e_1_1 }; | ||
return [3, 15]; | ||
case 10: | ||
_f.trys.push([10, , 13, 14]); | ||
if (!(_d && !_d.done && (_e = _c.return))) return [3, 12]; | ||
return [4, __await(_e.call(_c))]; | ||
case 11: | ||
_f.sent(); | ||
_f.label = 12; | ||
case 12: return [3, 14]; | ||
case 13: | ||
if (e_1) throw e_1.error; | ||
return [7]; | ||
case 14: return [7]; | ||
case 15: | ||
_i++; | ||
return [3, 1]; | ||
case 16: return [2]; | ||
} | ||
}); | ||
}); | ||
}; | ||
} | ||
exports.createPageReferencesGenerator = createPageReferencesGenerator; | ||
function transformGenerator(generator, transform) { | ||
return __asyncGenerator(this, arguments, function transformGenerator_1() { | ||
var generator_1, generator_1_1, curr, e_2_1; | ||
var e_2, _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 8, 9, 14]); | ||
generator_1 = __asyncValues(generator); | ||
_b.label = 1; | ||
case 1: return [4, __await(generator_1.next())]; | ||
case 2: | ||
if (!(generator_1_1 = _b.sent(), !generator_1_1.done)) return [3, 7]; | ||
curr = generator_1_1.value; | ||
return [4, __await(transform(curr))]; | ||
case 3: return [4, __await.apply(void 0, [_b.sent()])]; | ||
case 4: return [4, _b.sent()]; | ||
case 5: | ||
_b.sent(); | ||
_b.label = 6; | ||
case 6: return [3, 1]; | ||
case 7: return [3, 14]; | ||
case 8: | ||
e_2_1 = _b.sent(); | ||
e_2 = { error: e_2_1 }; | ||
return [3, 14]; | ||
case 9: | ||
_b.trys.push([9, , 12, 13]); | ||
if (!(generator_1_1 && !generator_1_1.done && (_a = generator_1.return))) return [3, 11]; | ||
return [4, __await(_a.call(generator_1))]; | ||
case 10: | ||
_b.sent(); | ||
_b.label = 11; | ||
case 11: return [3, 13]; | ||
case 12: | ||
if (e_2) throw e_2.error; | ||
return [7]; | ||
case 13: return [7]; | ||
case 14: return [2]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.transformGenerator = transformGenerator; | ||
}); | ||
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) { | ||
"use strict"; | ||
function __export(m) { | ||
@@ -157,2 +319,3 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
__export(errors_1); | ||
__export(generator_2); | ||
function isObject(data) { | ||
@@ -159,0 +322,0 @@ return data !== null && typeof data === "object"; |
/// <reference types="node" /> | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
import { Page, Cache, Head, BlockDefinition, RequestCtx } from "./types"; | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
export * from "./types"; | ||
export * from "./errors"; | ||
export * from "./generator"; | ||
export declare function isObject(data: any): boolean; | ||
@@ -7,0 +8,0 @@ export declare function isArray(data: any): boolean; |
@@ -19,7 +19,8 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { Page } from "./types"; | ||
import { IncomingMessage } from "http"; | ||
import parse from "url-parse"; | ||
import { Page } from "./types"; | ||
export * from "./types"; | ||
export * from "./errors"; | ||
export * from "./generator"; | ||
export function isObject(data) { | ||
@@ -26,0 +27,0 @@ return data !== null && typeof data === "object"; |
/// <reference types="node" /> | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
import { Writable } from "stream"; | ||
export interface BlockDefinition { | ||
@@ -49,7 +50,17 @@ type: string; | ||
} | ||
export interface Normalizer { | ||
(entry: any): BlockDefinition; | ||
} | ||
export declare type Normalizer = (entry: any) => BlockDefinition; | ||
export declare type NormalizerList = { | ||
[index: string]: Normalizer; | ||
}; | ||
export interface PageReference { | ||
url: string; | ||
group: string; | ||
settings: Settings; | ||
} | ||
export declare type AsyncPageReferenceGenerator = AsyncGenerator<PageReference, void, void | unknown>; | ||
export declare type PageReferenceGenerator = () => AsyncPageReferenceGenerator; | ||
export interface PageReferenceGenerators { | ||
[index: string]: PageReferenceGenerator; | ||
} | ||
export declare type TransformGenerator = (data: any) => Promise<string | Buffer> | string | Buffer; | ||
export declare type StreamCreator = (name: string) => Writable; |
/// <reference types="node" /> | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
import { Page, Cache, Head, BlockDefinition, RequestCtx } from "./types"; | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
export * from "./types"; | ||
export * from "./errors"; | ||
export * from "./generator"; | ||
export declare function isObject(data: any): boolean; | ||
@@ -7,0 +8,0 @@ export declare function isArray(data: any): boolean; |
@@ -27,7 +27,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var types_1 = require("./types"); | ||
var http_1 = require("http"); | ||
var url_parse_1 = __importDefault(require("url-parse")); | ||
var types_1 = require("./types"); | ||
__export(require("./types")); | ||
__export(require("./errors")); | ||
__export(require("./generator")); | ||
function isObject(data) { | ||
@@ -34,0 +35,0 @@ return data !== null && typeof data === "object"; |
/// <reference types="node" /> | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
import { Writable } from "stream"; | ||
export interface BlockDefinition { | ||
@@ -49,7 +50,17 @@ type: string; | ||
} | ||
export interface Normalizer { | ||
(entry: any): BlockDefinition; | ||
} | ||
export declare type Normalizer = (entry: any) => BlockDefinition; | ||
export declare type NormalizerList = { | ||
[index: string]: Normalizer; | ||
}; | ||
export interface PageReference { | ||
url: string; | ||
group: string; | ||
settings: Settings; | ||
} | ||
export declare type AsyncPageReferenceGenerator = AsyncGenerator<PageReference, void, void | unknown>; | ||
export declare type PageReferenceGenerator = () => AsyncPageReferenceGenerator; | ||
export interface PageReferenceGenerators { | ||
[index: string]: PageReferenceGenerator; | ||
} | ||
export declare type TransformGenerator = (data: any) => Promise<string | Buffer> | string | Buffer; | ||
export declare type StreamCreator = (name: string) => Writable; |
{ | ||
"name": "@ekino/rendr-core", | ||
"license": "MIT", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/lib/index.js", | ||
@@ -22,3 +22,3 @@ "typing": "dist/lib/index.d.ts", | ||
}, | ||
"gitHead": "652bd7c224b9f57b6215bf617bd8ca661cf9e40c" | ||
"gitHead": "af44b9c16767ec2cd956f538cd5c8f27ecf00537" | ||
} |
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
114605
40
2262