new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"name":"pump","version":"3.0.0","files":{"package.json":{"checkedAt":1678887829944,"integrity":"sha512-BgzWxEbR2QtJaFZoGGBeTRBE2FF++7ULq0NmqMF0OHWONl5p7pZxtbunMScZrkdE/YaNsGgqz5ET0hCh/0Ta6w==","mode":420,"size":530},".travis.yml":{"checkedAt":1678887829944,"integrity":"sha512-z06apwq8G+1XpliF7/dLtmUufL0NUEz+Aa8kIglQRtuCEVvgnLkARMRbk0VEo2W9BwnnvwjN2cU9mozxIa0/dA==","mode":420,"size":58},"index.js":{"checkedAt":1678887829944,"integrity":"sha512-JwWKfRAcKgkymGL3Q3fnDnxWHTrc938pvTjxoFIE8xvxOSkaL25mAGQHFWxToM6YhXAYijQzJrey6ANG5eqy4w==","mode":420,"size":2224},"LICENSE":{"checkedAt":1678887829944,"integrity":"sha512-tSuhQwQoEtbdEDGhKUav3bbo+Ou8cWnFnBONFqr8XiYarpL+ax6pSj2A450kFcSyGXEO9Gk5ot8TXbJKDPcS+w==","mode":420,"size":1078},"README.md":{"checkedAt":1678887829944,"integrity":"sha512-R4fzggCkhwwM52Y1Sgf1u5tQOSPGBBcJHqdM3H/j4LjmfnIJtdFLKsQnlDYyJ3Bn2hU199wp0XofCsC2ux6BRQ==","mode":420,"size":1721},"test-node.js":{"checkedAt":1678887829944,"integrity":"sha512-WSkbXzspFBGVRn4g9TaM7C/0yXNiMCR0enRWpfLEoAouwP6BIbSIRLqhxt4B8kRCpVuSm8ERRnD/ZvBk6CMm3w==","mode":420,"size":992},"test-browser.js":{"checkedAt":1678887829944,"integrity":"sha512-jhcv0JRsaw3gpqO9D1h/vUoVmeCpS2MiNDJirghI980X8X05SG0WerVa0o59DLXdfzkzTiKgMwaW/bPWtkL6CQ==","mode":420,"size":1172}}}
|
||||
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
const http2 = require('http2');
|
||||
const agent = require('./agent');
|
||||
const ClientRequest = require('./client-request');
|
||||
const IncomingMessage = require('./incoming-message');
|
||||
const auto = require('./auto');
|
||||
|
||||
const request = (url, options, callback) => {
|
||||
return new ClientRequest(url, options, callback);
|
||||
};
|
||||
|
||||
const get = (url, options, callback) => {
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
const req = new ClientRequest(url, options, callback);
|
||||
req.end();
|
||||
|
||||
return req;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
...http2,
|
||||
ClientRequest,
|
||||
IncomingMessage,
|
||||
...agent,
|
||||
request,
|
||||
get,
|
||||
auto
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J E F G BC"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"CC tB DC EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"1":"u J E F G A B C K L H HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","132":"I GC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d 9B SC rB","2":"G OC PC QC RC","132":"B qB"},G:{"1":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"1":"nC"},I:{"1":"tB D oC pC qC AC sC tC","4":"I rC"},J:{"1":"E A"},K:{"1":"B C e qB 9B rB","2":"A"},L:{"1":"D"},M:{"1":"D"},N:{"1":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:1,C:"input placeholder attribute"};
|
||||
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("rxjs-compat/add/operator/toArray");
|
||||
//# sourceMappingURL=toArray.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bindNodeCallback.js","sources":["../src/observable/bindNodeCallback.ts"],"names":[],"mappings":";;;;;AAAA,6DAAwD"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"single.js","sources":["../../src/add/operator/single.ts"],"names":[],"mappings":";;AAAA,2CAAyC"}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Subscriber } from './Subscriber';
|
||||
import { InnerSubscriber } from './InnerSubscriber';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class OuterSubscriber<T, R> extends Subscriber<T> {
|
||||
notifyNext(outerValue: T, innerValue: R, outerIndex: number, innerIndex: number, innerSub: InnerSubscriber<T, R>): void;
|
||||
notifyError(error: any, innerSub: InnerSubscriber<T, R>): void;
|
||||
notifyComplete(innerSub: InnerSubscriber<T, R>): void;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"catchError.js","sources":["../../src/internal/operators/catchError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,oDAAiG;AAkFjG,SAAgB,UAAU,CACxB,QAAgD;IAEhD,OAAO,SAAS,0BAA0B,CAAC,MAAqB;QAC9D,IAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAuB,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC;AARD,gCAQC;AAED;IAGE,uBAAoB,QAAqE;QAArE,aAAQ,GAAR,QAAQ,CAA6D;IACzF,CAAC;IAED,4BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACvF,CAAC;IACH,oBAAC;AAAD,CAAC,AATD,IASC;AAOD;IAAoC,mCAA+B;IACjE,yBAAY,WAA4B,EACpB,QAAqE,EACrE,MAAqB;QAFzC,YAGE,kBAAM,WAAW,CAAC,SACnB;QAHmB,cAAQ,GAAR,QAAQ,CAA6D;QACrE,YAAM,GAAN,MAAM,CAAe;;IAEzC,CAAC;IAOD,+BAAK,GAAL,UAAM,GAAQ;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,MAAM,SAAK,CAAC;YAChB,IAAI;gBACF,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aAC1C;YAAC,OAAO,IAAI,EAAE;gBACb,iBAAM,KAAK,YAAC,IAAI,CAAC,CAAC;gBAClB,OAAO;aACR;YACD,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,IAAM,eAAe,GAAG,IAAI,sCAAqB,CAAC,IAAI,CAAC,CAAC;YACxD,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC1B,IAAM,iBAAiB,GAAG,+BAAc,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YAIlE,IAAI,iBAAiB,KAAK,eAAe,EAAE;gBACzC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;aAC7B;SACF;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AAjCD,CAAoC,sCAAqB,GAiCxD"}
|
||||
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (...arguments_) => {
|
||||
return [...new Set([].concat(...arguments_))];
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
/** PURE_IMPORTS_START tslib,_Observable,_scheduler_asap,_util_isNumeric PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { Observable } from '../Observable';
|
||||
import { asap } from '../scheduler/asap';
|
||||
import { isNumeric } from '../util/isNumeric';
|
||||
var SubscribeOnObservable = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(SubscribeOnObservable, _super);
|
||||
function SubscribeOnObservable(source, delayTime, scheduler) {
|
||||
if (delayTime === void 0) {
|
||||
delayTime = 0;
|
||||
}
|
||||
if (scheduler === void 0) {
|
||||
scheduler = asap;
|
||||
}
|
||||
var _this = _super.call(this) || this;
|
||||
_this.source = source;
|
||||
_this.delayTime = delayTime;
|
||||
_this.scheduler = scheduler;
|
||||
if (!isNumeric(delayTime) || delayTime < 0) {
|
||||
_this.delayTime = 0;
|
||||
}
|
||||
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
||||
_this.scheduler = asap;
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
SubscribeOnObservable.create = function (source, delay, scheduler) {
|
||||
if (delay === void 0) {
|
||||
delay = 0;
|
||||
}
|
||||
if (scheduler === void 0) {
|
||||
scheduler = asap;
|
||||
}
|
||||
return new SubscribeOnObservable(source, delay, scheduler);
|
||||
};
|
||||
SubscribeOnObservable.dispatch = function (arg) {
|
||||
var source = arg.source, subscriber = arg.subscriber;
|
||||
return this.add(source.subscribe(subscriber));
|
||||
};
|
||||
SubscribeOnObservable.prototype._subscribe = function (subscriber) {
|
||||
var delay = this.delayTime;
|
||||
var source = this.source;
|
||||
var scheduler = this.scheduler;
|
||||
return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
|
||||
source: source, subscriber: subscriber
|
||||
});
|
||||
};
|
||||
return SubscribeOnObservable;
|
||||
}(Observable));
|
||||
export { SubscribeOnObservable };
|
||||
//# sourceMappingURL=SubscribeOnObservable.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/operator/bufferWhen"));
|
||||
//# sourceMappingURL=bufferWhen.js.map
|
||||
@@ -0,0 +1,94 @@
|
||||
import { Operator } from '../Operator';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Notification } from '../Notification';
|
||||
import { OperatorFunction } from '../types';
|
||||
|
||||
/**
|
||||
* Represents all of the notifications from the source Observable as `next`
|
||||
* emissions marked with their original types within {@link Notification}
|
||||
* objects.
|
||||
*
|
||||
* <span class="informal">Wraps `next`, `error` and `complete` emissions in
|
||||
* {@link Notification} objects, emitted as `next` on the output Observable.
|
||||
* </span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `materialize` returns an Observable that emits a `next` notification for each
|
||||
* `next`, `error`, or `complete` emission of the source Observable. When the
|
||||
* source Observable emits `complete`, the output Observable will emit `next` as
|
||||
* a Notification of type "complete", and then it will emit `complete` as well.
|
||||
* When the source Observable emits `error`, the output will emit `next` as a
|
||||
* Notification of type "error", and then `complete`.
|
||||
*
|
||||
* This operator is useful for producing metadata of the source Observable, to
|
||||
* be consumed as `next` emissions. Use it in conjunction with
|
||||
* {@link dematerialize}.
|
||||
*
|
||||
* ## Example
|
||||
* Convert a faulty Observable to an Observable of Notifications
|
||||
* ```ts
|
||||
* import { of } from 'rxjs';
|
||||
* import { materialize, map } from 'rxjs/operators';
|
||||
*
|
||||
* const letters = of('a', 'b', 13, 'd');
|
||||
* const upperCase = letters.pipe(map(x => x.toUpperCase()));
|
||||
* const materialized = upperCase.pipe(materialize());
|
||||
* materialized.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // - Notification {kind: "N", value: "A", error: undefined, hasValue: true}
|
||||
* // - Notification {kind: "N", value: "B", error: undefined, hasValue: true}
|
||||
* // - Notification {kind: "E", value: undefined, error: TypeError:
|
||||
* // x.toUpperCase is not a function at MapSubscriber.letters.map.x
|
||||
* // [as project] (http://1…, hasValue: false}
|
||||
* ```
|
||||
*
|
||||
* @see {@link Notification}
|
||||
* @see {@link dematerialize}
|
||||
*
|
||||
* @return {Observable<Notification<T>>} An Observable that emits
|
||||
* {@link Notification} objects that wrap the original emissions from the source
|
||||
* Observable with metadata.
|
||||
* @method materialize
|
||||
* @owner Observable
|
||||
*/
|
||||
export function materialize<T>(): OperatorFunction<T, Notification<T>> {
|
||||
return function materializeOperatorFunction(source: Observable<T>) {
|
||||
return source.lift(new MaterializeOperator());
|
||||
};
|
||||
}
|
||||
|
||||
class MaterializeOperator<T> implements Operator<T, Notification<T>> {
|
||||
call(subscriber: Subscriber<Notification<T>>, source: any): any {
|
||||
return source.subscribe(new MaterializeSubscriber(subscriber));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class MaterializeSubscriber<T> extends Subscriber<T> {
|
||||
constructor(destination: Subscriber<Notification<T>>) {
|
||||
super(destination);
|
||||
}
|
||||
|
||||
protected _next(value: T) {
|
||||
this.destination.next(Notification.createNext(value));
|
||||
}
|
||||
|
||||
protected _error(err: any) {
|
||||
const destination = this.destination;
|
||||
destination.next(Notification.createError(err));
|
||||
destination.complete();
|
||||
}
|
||||
|
||||
protected _complete() {
|
||||
const destination = this.destination;
|
||||
destination.next(Notification.createComplete());
|
||||
destination.complete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Subject_1 = require("../Subject");
|
||||
var Subscription_1 = require("../Subscription");
|
||||
var OuterSubscriber_1 = require("../OuterSubscriber");
|
||||
var subscribeToResult_1 = require("../util/subscribeToResult");
|
||||
function windowToggle(openings, closingSelector) {
|
||||
return function (source) { return source.lift(new WindowToggleOperator(openings, closingSelector)); };
|
||||
}
|
||||
exports.windowToggle = windowToggle;
|
||||
var WindowToggleOperator = (function () {
|
||||
function WindowToggleOperator(openings, closingSelector) {
|
||||
this.openings = openings;
|
||||
this.closingSelector = closingSelector;
|
||||
}
|
||||
WindowToggleOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector));
|
||||
};
|
||||
return WindowToggleOperator;
|
||||
}());
|
||||
var WindowToggleSubscriber = (function (_super) {
|
||||
__extends(WindowToggleSubscriber, _super);
|
||||
function WindowToggleSubscriber(destination, openings, closingSelector) {
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.openings = openings;
|
||||
_this.closingSelector = closingSelector;
|
||||
_this.contexts = [];
|
||||
_this.add(_this.openSubscription = subscribeToResult_1.subscribeToResult(_this, openings, openings));
|
||||
return _this;
|
||||
}
|
||||
WindowToggleSubscriber.prototype._next = function (value) {
|
||||
var contexts = this.contexts;
|
||||
if (contexts) {
|
||||
var len = contexts.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
contexts[i].window.next(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
WindowToggleSubscriber.prototype._error = function (err) {
|
||||
var contexts = this.contexts;
|
||||
this.contexts = null;
|
||||
if (contexts) {
|
||||
var len = contexts.length;
|
||||
var index = -1;
|
||||
while (++index < len) {
|
||||
var context_1 = contexts[index];
|
||||
context_1.window.error(err);
|
||||
context_1.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
_super.prototype._error.call(this, err);
|
||||
};
|
||||
WindowToggleSubscriber.prototype._complete = function () {
|
||||
var contexts = this.contexts;
|
||||
this.contexts = null;
|
||||
if (contexts) {
|
||||
var len = contexts.length;
|
||||
var index = -1;
|
||||
while (++index < len) {
|
||||
var context_2 = contexts[index];
|
||||
context_2.window.complete();
|
||||
context_2.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
_super.prototype._complete.call(this);
|
||||
};
|
||||
WindowToggleSubscriber.prototype._unsubscribe = function () {
|
||||
var contexts = this.contexts;
|
||||
this.contexts = null;
|
||||
if (contexts) {
|
||||
var len = contexts.length;
|
||||
var index = -1;
|
||||
while (++index < len) {
|
||||
var context_3 = contexts[index];
|
||||
context_3.window.unsubscribe();
|
||||
context_3.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
};
|
||||
WindowToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
if (outerValue === this.openings) {
|
||||
var closingNotifier = void 0;
|
||||
try {
|
||||
var closingSelector = this.closingSelector;
|
||||
closingNotifier = closingSelector(innerValue);
|
||||
}
|
||||
catch (e) {
|
||||
return this.error(e);
|
||||
}
|
||||
var window_1 = new Subject_1.Subject();
|
||||
var subscription = new Subscription_1.Subscription();
|
||||
var context_4 = { window: window_1, subscription: subscription };
|
||||
this.contexts.push(context_4);
|
||||
var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context_4);
|
||||
if (innerSubscription.closed) {
|
||||
this.closeWindow(this.contexts.length - 1);
|
||||
}
|
||||
else {
|
||||
innerSubscription.context = context_4;
|
||||
subscription.add(innerSubscription);
|
||||
}
|
||||
this.destination.next(window_1);
|
||||
}
|
||||
else {
|
||||
this.closeWindow(this.contexts.indexOf(outerValue));
|
||||
}
|
||||
};
|
||||
WindowToggleSubscriber.prototype.notifyError = function (err) {
|
||||
this.error(err);
|
||||
};
|
||||
WindowToggleSubscriber.prototype.notifyComplete = function (inner) {
|
||||
if (inner !== this.openSubscription) {
|
||||
this.closeWindow(this.contexts.indexOf(inner.context));
|
||||
}
|
||||
};
|
||||
WindowToggleSubscriber.prototype.closeWindow = function (index) {
|
||||
if (index === -1) {
|
||||
return;
|
||||
}
|
||||
var contexts = this.contexts;
|
||||
var context = contexts[index];
|
||||
var window = context.window, subscription = context.subscription;
|
||||
contexts.splice(index, 1);
|
||||
window.complete();
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
return WindowToggleSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=windowToggle.js.map
|
||||
@@ -0,0 +1,29 @@
|
||||
// API
|
||||
module.exports = abort;
|
||||
|
||||
/**
|
||||
* Aborts leftover active jobs
|
||||
*
|
||||
* @param {object} state - current state object
|
||||
*/
|
||||
function abort(state)
|
||||
{
|
||||
Object.keys(state.jobs).forEach(clean.bind(state));
|
||||
|
||||
// reset leftover jobs
|
||||
state.jobs = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up leftover job by invoking abort function for the provided job id
|
||||
*
|
||||
* @this state
|
||||
* @param {string|number} key - job id to abort
|
||||
*/
|
||||
function clean(key)
|
||||
{
|
||||
if (typeof this.jobs[key] == 'function')
|
||||
{
|
||||
this.jobs[key]();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
const { join } = require('path')
|
||||
const Handlebars = require('handlebars')
|
||||
const fetch = require('node-fetch')
|
||||
const { readFile, fileExists } = require('./utils')
|
||||
|
||||
const TEMPLATES_DIR = join(__dirname, '..', 'templates')
|
||||
const MATCH_URL = /^https?:\/\/.+/
|
||||
const COMPILE_OPTIONS = {
|
||||
noEscape: true
|
||||
}
|
||||
|
||||
Handlebars.registerHelper('json', (object) => {
|
||||
return new Handlebars.SafeString(JSON.stringify(object, null, 2))
|
||||
})
|
||||
|
||||
Handlebars.registerHelper('commit-list', (context, options) => {
|
||||
if (!context || context.length === 0) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const list = context
|
||||
.filter(item => {
|
||||
const commit = item.commit || item
|
||||
if (options.hash.exclude) {
|
||||
const pattern = new RegExp(options.hash.exclude, 'm')
|
||||
if (pattern.test(commit.message)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (options.hash.message) {
|
||||
const pattern = new RegExp(options.hash.message, 'm')
|
||||
return pattern.test(commit.message)
|
||||
}
|
||||
if (options.hash.subject) {
|
||||
const pattern = new RegExp(options.hash.subject)
|
||||
return pattern.test(commit.subject)
|
||||
}
|
||||
return true
|
||||
})
|
||||
.map(item => options.fn(item))
|
||||
.join('')
|
||||
|
||||
if (!list) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return `${options.hash.heading}\n\n${list}`
|
||||
})
|
||||
|
||||
Handlebars.registerHelper('matches', function (val, pattern, options) {
|
||||
const r = new RegExp(pattern, options.hash.flags || '')
|
||||
return r.test(val) ? options.fn(this) : options.inverse(this)
|
||||
})
|
||||
|
||||
const getTemplate = async template => {
|
||||
if (MATCH_URL.test(template)) {
|
||||
const response = await fetch(template)
|
||||
return response.text()
|
||||
}
|
||||
if (await fileExists(template)) {
|
||||
return readFile(template)
|
||||
}
|
||||
const path = join(TEMPLATES_DIR, template + '.hbs')
|
||||
if (await fileExists(path) === false) {
|
||||
throw new Error(`Template '${template}' was not found`)
|
||||
}
|
||||
return readFile(path)
|
||||
}
|
||||
|
||||
const cleanTemplate = template => {
|
||||
return template
|
||||
// Remove indentation
|
||||
.replace(/\n +/g, '\n')
|
||||
.replace(/^ +/, '')
|
||||
// Fix multiple blank lines
|
||||
.replace(/\n\n\n+/g, '\n\n')
|
||||
.replace(/\n\n$/, '\n')
|
||||
}
|
||||
|
||||
const compileTemplate = async (releases, options) => {
|
||||
const { template, handlebarsSetup } = options
|
||||
if (handlebarsSetup) {
|
||||
const setup = require(join(process.cwd(), handlebarsSetup))
|
||||
if (typeof setup === 'function') {
|
||||
setup(Handlebars)
|
||||
}
|
||||
}
|
||||
const compile = Handlebars.compile(await getTemplate(template), COMPILE_OPTIONS)
|
||||
if (template === 'json') {
|
||||
return compile({ releases, options })
|
||||
}
|
||||
return cleanTemplate(compile({ releases, options }))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
compileTemplate
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/** PURE_IMPORTS_START _AsyncAction,_AsyncScheduler PURE_IMPORTS_END */
|
||||
import { AsyncAction } from './AsyncAction';
|
||||
import { AsyncScheduler } from './AsyncScheduler';
|
||||
export var asyncScheduler = /*@__PURE__*/ new AsyncScheduler(AsyncAction);
|
||||
export var async = asyncScheduler;
|
||||
//# sourceMappingURL=async.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"2":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB DC EC"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"1":"A B C K L H 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G GC zB HC IC JC KC"},F:{"2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d OC PC QC RC qB 9B SC rB"},G:{"1":"aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC"},H:{"2":"nC"},I:{"2":"tB I D oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"2":"A B C e qB 9B rB"},L:{"2":"D"},M:{"2":"D"},N:{"2":"A B"},O:{"2":"uC"},P:{"2":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"2":"1B"},R:{"2":"8C"},S:{"2":"9C"}},B:4,C:"CSS hanging-punctuation"};
|
||||
@@ -0,0 +1,10 @@
|
||||
/** PURE_IMPORTS_START _mergeMap,_util_identity PURE_IMPORTS_END */
|
||||
import { mergeMap } from './mergeMap';
|
||||
import { identity } from '../util/identity';
|
||||
export function mergeAll(concurrent) {
|
||||
if (concurrent === void 0) {
|
||||
concurrent = Number.POSITIVE_INFINITY;
|
||||
}
|
||||
return mergeMap(identity, concurrent);
|
||||
}
|
||||
//# sourceMappingURL=mergeAll.js.map
|
||||
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Subscription_1 = require("../Subscription");
|
||||
var Action = (function (_super) {
|
||||
__extends(Action, _super);
|
||||
function Action(scheduler, work) {
|
||||
return _super.call(this) || this;
|
||||
}
|
||||
Action.prototype.schedule = function (state, delay) {
|
||||
if (delay === void 0) { delay = 0; }
|
||||
return this;
|
||||
};
|
||||
return Action;
|
||||
}(Subscription_1.Subscription));
|
||||
exports.Action = Action;
|
||||
//# sourceMappingURL=Action.js.map
|
||||
Reference in New Issue
Block a user