new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"subscribeToPromise.js","sources":["../../../src/internal/util/subscribeToPromise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAI,OAAuB,IAAK,OAAA,UAAC,UAAyB;IAC1F,OAAO,CAAC,IAAI,CACV,UAAC,KAAK;QACJ,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YACtB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,UAAU,CAAC,QAAQ,EAAE,CAAC;SACvB;IACH,CAAC,EACD,UAAC,GAAQ,IAAK,OAAA,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAArB,CAAqB,CACpC;SACA,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC7B,OAAO,UAAU,CAAC;AACpB,CAAC,EAZiE,CAYjE,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/switch';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"11":0.00789,"36":0.00394,"43":0.0276,"44":0.00394,"48":0.00789,"52":0.04732,"56":0.00789,"59":0.00394,"68":0.00394,"72":0.00394,"78":0.03549,"79":0.00394,"80":0.00394,"81":0.00394,"82":0.00394,"83":0.00394,"87":0.01183,"88":0.00789,"89":0.00394,"90":0.00394,"91":0.01183,"94":0.01577,"96":0.00789,"99":0.00394,"100":0.00394,"101":0.00394,"102":0.09463,"103":0.04337,"104":0.01183,"105":0.02366,"106":0.02366,"107":0.04732,"108":1.33668,"109":0.761,"110":0.00789,_:"2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 45 46 47 49 50 51 53 54 55 57 58 60 61 62 63 64 65 66 67 69 70 71 73 74 75 76 77 84 85 86 92 93 95 97 98 111 3.5 3.6"},D:{"34":0.00789,"35":0.00789,"38":0.01577,"40":0.01577,"43":0.00394,"47":0.00789,"48":0.01972,"49":0.04337,"52":0.00789,"53":0.00789,"55":0.00394,"56":0.08675,"57":0.00394,"58":0.01577,"60":0.01183,"63":0.00789,"64":0.00394,"65":0.00789,"66":0.03154,"67":0.00789,"68":0.01183,"69":0.05915,"70":0.0276,"71":0.01577,"72":0.03154,"73":0.01183,"74":0.04337,"75":0.04732,"76":0.03154,"77":0.01577,"78":0.0276,"79":0.12618,"80":0.03549,"81":0.03943,"83":0.07097,"84":0.04337,"85":0.08675,"86":0.07492,"87":0.07886,"88":0.0276,"89":0.04337,"90":0.05126,"91":0.07492,"92":0.06309,"93":0.05915,"94":0.05126,"95":0.03943,"96":0.06703,"97":0.07097,"98":0.12618,"99":0.0828,"100":0.09463,"101":0.07886,"102":0.1104,"103":0.26812,"104":0.11829,"105":0.14983,"106":0.13801,"107":0.41796,"108":11.22178,"109":9.7471,"110":0.01972,"111":0.01972,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 36 37 39 41 42 44 45 46 50 51 54 59 61 62 112"},F:{"28":0.00789,"31":0.00394,"36":0.00789,"40":0.00789,"46":0.01183,"85":0.00789,"89":0.00394,"92":0.01183,"93":0.49682,"94":0.69003,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 32 33 34 35 37 38 39 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 90 91 9.5-9.6 10.5 10.6 11.1 11.5 11.6 12.1","10.0-10.1":0},B:{"12":0.00789,"15":0.00394,"17":0.00394,"18":0.01577,"84":0.00789,"85":0.00789,"86":0.00394,"87":0.00394,"88":0.00394,"89":0.00789,"90":0.00394,"91":0.00394,"92":0.01183,"95":0.00394,"96":0.00394,"97":0.00394,"100":0.01183,"101":0.00789,"102":0.00394,"103":0.01183,"104":0.01183,"105":0.01183,"106":0.01972,"107":0.10252,"108":2.13316,"109":1.95967,_:"13 14 16 79 80 81 83 93 94 98 99"},E:{"4":0,"13":0.02366,"14":0.09858,"15":0.02366,_:"0 5 6 7 8 9 10 11 12 3.1 3.2 6.1 7.1 10.1","5.1":0.00789,"9.1":0.04732,"11.1":0.00789,"12.1":0.03154,"13.1":0.17744,"14.1":0.25235,"15.1":0.03943,"15.2-15.3":0.03943,"15.4":0.09069,"15.5":0.18138,"15.6":1.13558,"16.0":0.12618,"16.1":0.41007,"16.2":0.80832,"16.3":0.0552},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00158,"5.0-5.1":0.00315,"6.0-6.1":0.00315,"7.0-7.1":0.01261,"8.1-8.4":0.0063,"9.0-9.2":0.01576,"9.3":0.0583,"10.0-10.2":0.0063,"10.3":0.1103,"11.0-11.2":0.02679,"11.3-11.4":0.02521,"12.0-12.1":0.02206,"12.2-12.5":0.3955,"13.0-13.1":0.03309,"13.2":0.02364,"13.3":0.03467,"13.4-13.7":0.10557,"14.0-14.4":0.28836,"14.5-14.8":0.56726,"15.0-15.1":0.15757,"15.2-15.3":0.20799,"15.4":0.25054,"15.5":0.47271,"15.6":1.89085,"16.0":1.7837,"16.1":4.8784,"16.2":3.17191,"16.3":0.23793},P:{"4":0.14773,"5.0-5.4":0,"6.2-6.4":0.01036,"7.2-7.4":0.05276,"8.2":0,"9.2":0.01036,"10.1":0,"11.1-11.2":0.0211,"12.0":0.01055,"13.0":0.03166,"14.0":0.03166,"15.0":0.0211,"16.0":0.07387,"17.0":0.08442,"18.0":0.12663,"19.0":2.09993},I:{"0":0,"3":0,"4":0.02865,"2.1":0,"2.2":0,"2.3":0,"4.1":0.07641,"4.2-4.3":0.07641,"4.4":0,"4.4.3-4.4.4":0.3152},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"8":0.053,"9":0.07421,"10":0.0106,"11":0.50884,_:"6 7 5.5"},J:{"7":0,"10":0},N:{"10":0,"11":0},S:{"2.5":0.06663},R:{_:"0"},M:{"0":0.30285},Q:{"13.1":0.14537},O:{"0":0.89038},H:{"0":1.01498},L:{"0":41.36319}};
|
||||
@@ -0,0 +1,445 @@
|
||||
'use strict';
|
||||
const http2 = require('http2');
|
||||
const {Writable} = require('stream');
|
||||
const {Agent, globalAgent} = require('./agent');
|
||||
const IncomingMessage = require('./incoming-message');
|
||||
const urlToOptions = require('./utils/url-to-options');
|
||||
const proxyEvents = require('./utils/proxy-events');
|
||||
const isRequestPseudoHeader = require('./utils/is-request-pseudo-header');
|
||||
const {
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
ERR_INVALID_PROTOCOL,
|
||||
ERR_HTTP_HEADERS_SENT,
|
||||
ERR_INVALID_HTTP_TOKEN,
|
||||
ERR_HTTP_INVALID_HEADER_VALUE,
|
||||
ERR_INVALID_CHAR
|
||||
} = require('./utils/errors');
|
||||
|
||||
const {
|
||||
HTTP2_HEADER_STATUS,
|
||||
HTTP2_HEADER_METHOD,
|
||||
HTTP2_HEADER_PATH,
|
||||
HTTP2_METHOD_CONNECT
|
||||
} = http2.constants;
|
||||
|
||||
const kHeaders = Symbol('headers');
|
||||
const kOrigin = Symbol('origin');
|
||||
const kSession = Symbol('session');
|
||||
const kOptions = Symbol('options');
|
||||
const kFlushedHeaders = Symbol('flushedHeaders');
|
||||
const kJobs = Symbol('jobs');
|
||||
|
||||
const isValidHttpToken = /^[\^`\-\w!#$%&*+.|~]+$/;
|
||||
const isInvalidHeaderValue = /[^\t\u0020-\u007E\u0080-\u00FF]/;
|
||||
|
||||
class ClientRequest extends Writable {
|
||||
constructor(input, options, callback) {
|
||||
super({
|
||||
autoDestroy: false
|
||||
});
|
||||
|
||||
const hasInput = typeof input === 'string' || input instanceof URL;
|
||||
if (hasInput) {
|
||||
input = urlToOptions(input instanceof URL ? input : new URL(input));
|
||||
}
|
||||
|
||||
if (typeof options === 'function' || options === undefined) {
|
||||
// (options, callback)
|
||||
callback = options;
|
||||
options = hasInput ? input : {...input};
|
||||
} else {
|
||||
// (input, options, callback)
|
||||
options = {...input, ...options};
|
||||
}
|
||||
|
||||
if (options.h2session) {
|
||||
this[kSession] = options.h2session;
|
||||
} else if (options.agent === false) {
|
||||
this.agent = new Agent({maxFreeSessions: 0});
|
||||
} else if (typeof options.agent === 'undefined' || options.agent === null) {
|
||||
if (typeof options.createConnection === 'function') {
|
||||
// This is a workaround - we don't have to create the session on our own.
|
||||
this.agent = new Agent({maxFreeSessions: 0});
|
||||
this.agent.createConnection = options.createConnection;
|
||||
} else {
|
||||
this.agent = globalAgent;
|
||||
}
|
||||
} else if (typeof options.agent.request === 'function') {
|
||||
this.agent = options.agent;
|
||||
} else {
|
||||
throw new ERR_INVALID_ARG_TYPE('options.agent', ['Agent-like Object', 'undefined', 'false'], options.agent);
|
||||
}
|
||||
|
||||
if (options.protocol && options.protocol !== 'https:') {
|
||||
throw new ERR_INVALID_PROTOCOL(options.protocol, 'https:');
|
||||
}
|
||||
|
||||
const port = options.port || options.defaultPort || (this.agent && this.agent.defaultPort) || 443;
|
||||
const host = options.hostname || options.host || 'localhost';
|
||||
|
||||
// Don't enforce the origin via options. It may be changed in an Agent.
|
||||
delete options.hostname;
|
||||
delete options.host;
|
||||
delete options.port;
|
||||
|
||||
const {timeout} = options;
|
||||
options.timeout = undefined;
|
||||
|
||||
this[kHeaders] = Object.create(null);
|
||||
this[kJobs] = [];
|
||||
|
||||
this.socket = null;
|
||||
this.connection = null;
|
||||
|
||||
this.method = options.method || 'GET';
|
||||
this.path = options.path;
|
||||
|
||||
this.res = null;
|
||||
this.aborted = false;
|
||||
this.reusedSocket = false;
|
||||
|
||||
if (options.headers) {
|
||||
for (const [header, value] of Object.entries(options.headers)) {
|
||||
this.setHeader(header, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.auth && !('authorization' in this[kHeaders])) {
|
||||
this[kHeaders].authorization = 'Basic ' + Buffer.from(options.auth).toString('base64');
|
||||
}
|
||||
|
||||
options.session = options.tlsSession;
|
||||
options.path = options.socketPath;
|
||||
|
||||
this[kOptions] = options;
|
||||
|
||||
// Clients that generate HTTP/2 requests directly SHOULD use the :authority pseudo-header field instead of the Host header field.
|
||||
if (port === 443) {
|
||||
this[kOrigin] = `https://${host}`;
|
||||
|
||||
if (!(':authority' in this[kHeaders])) {
|
||||
this[kHeaders][':authority'] = host;
|
||||
}
|
||||
} else {
|
||||
this[kOrigin] = `https://${host}:${port}`;
|
||||
|
||||
if (!(':authority' in this[kHeaders])) {
|
||||
this[kHeaders][':authority'] = `${host}:${port}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (timeout) {
|
||||
this.setTimeout(timeout);
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
this.once('response', callback);
|
||||
}
|
||||
|
||||
this[kFlushedHeaders] = false;
|
||||
}
|
||||
|
||||
get method() {
|
||||
return this[kHeaders][HTTP2_HEADER_METHOD];
|
||||
}
|
||||
|
||||
set method(value) {
|
||||
if (value) {
|
||||
this[kHeaders][HTTP2_HEADER_METHOD] = value.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
get path() {
|
||||
return this[kHeaders][HTTP2_HEADER_PATH];
|
||||
}
|
||||
|
||||
set path(value) {
|
||||
if (value) {
|
||||
this[kHeaders][HTTP2_HEADER_PATH] = value;
|
||||
}
|
||||
}
|
||||
|
||||
get _mustNotHaveABody() {
|
||||
return this.method === 'GET' || this.method === 'HEAD' || this.method === 'DELETE';
|
||||
}
|
||||
|
||||
_write(chunk, encoding, callback) {
|
||||
// https://github.com/nodejs/node/blob/654df09ae0c5e17d1b52a900a545f0664d8c7627/lib/internal/http2/util.js#L148-L156
|
||||
if (this._mustNotHaveABody) {
|
||||
callback(new Error('The GET, HEAD and DELETE methods must NOT have a body'));
|
||||
/* istanbul ignore next: Node.js 12 throws directly */
|
||||
return;
|
||||
}
|
||||
|
||||
this.flushHeaders();
|
||||
|
||||
const callWrite = () => this._request.write(chunk, encoding, callback);
|
||||
if (this._request) {
|
||||
callWrite();
|
||||
} else {
|
||||
this[kJobs].push(callWrite);
|
||||
}
|
||||
}
|
||||
|
||||
_final(callback) {
|
||||
if (this.destroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.flushHeaders();
|
||||
|
||||
const callEnd = () => {
|
||||
// For GET, HEAD and DELETE
|
||||
if (this._mustNotHaveABody) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
this._request.end(callback);
|
||||
};
|
||||
|
||||
if (this._request) {
|
||||
callEnd();
|
||||
} else {
|
||||
this[kJobs].push(callEnd);
|
||||
}
|
||||
}
|
||||
|
||||
abort() {
|
||||
if (this.res && this.res.complete) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.aborted) {
|
||||
process.nextTick(() => this.emit('abort'));
|
||||
}
|
||||
|
||||
this.aborted = true;
|
||||
|
||||
this.destroy();
|
||||
}
|
||||
|
||||
_destroy(error, callback) {
|
||||
if (this.res) {
|
||||
this.res._dump();
|
||||
}
|
||||
|
||||
if (this._request) {
|
||||
this._request.destroy();
|
||||
}
|
||||
|
||||
callback(error);
|
||||
}
|
||||
|
||||
async flushHeaders() {
|
||||
if (this[kFlushedHeaders] || this.destroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this[kFlushedHeaders] = true;
|
||||
|
||||
const isConnectMethod = this.method === HTTP2_METHOD_CONNECT;
|
||||
|
||||
// The real magic is here
|
||||
const onStream = stream => {
|
||||
this._request = stream;
|
||||
|
||||
if (this.destroyed) {
|
||||
stream.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
// Forwards `timeout`, `continue`, `close` and `error` events to this instance.
|
||||
if (!isConnectMethod) {
|
||||
proxyEvents(stream, this, ['timeout', 'continue', 'close', 'error']);
|
||||
}
|
||||
|
||||
// Wait for the `finish` event. We don't want to emit the `response` event
|
||||
// before `request.end()` is called.
|
||||
const waitForEnd = fn => {
|
||||
return (...args) => {
|
||||
if (!this.writable && !this.destroyed) {
|
||||
fn(...args);
|
||||
} else {
|
||||
this.once('finish', () => {
|
||||
fn(...args);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// This event tells we are ready to listen for the data.
|
||||
stream.once('response', waitForEnd((headers, flags, rawHeaders) => {
|
||||
// If we were to emit raw request stream, it would be as fast as the native approach.
|
||||
// Note that wrapping the raw stream in a Proxy instance won't improve the performance (already tested it).
|
||||
const response = new IncomingMessage(this.socket, stream.readableHighWaterMark);
|
||||
this.res = response;
|
||||
|
||||
response.req = this;
|
||||
response.statusCode = headers[HTTP2_HEADER_STATUS];
|
||||
response.headers = headers;
|
||||
response.rawHeaders = rawHeaders;
|
||||
|
||||
response.once('end', () => {
|
||||
if (this.aborted) {
|
||||
response.aborted = true;
|
||||
response.emit('aborted');
|
||||
} else {
|
||||
response.complete = true;
|
||||
|
||||
// Has no effect, just be consistent with the Node.js behavior
|
||||
response.socket = null;
|
||||
response.connection = null;
|
||||
}
|
||||
});
|
||||
|
||||
if (isConnectMethod) {
|
||||
response.upgrade = true;
|
||||
|
||||
// The HTTP1 API says the socket is detached here,
|
||||
// but we can't do that so we pass the original HTTP2 request.
|
||||
if (this.emit('connect', response, stream, Buffer.alloc(0))) {
|
||||
this.emit('close');
|
||||
} else {
|
||||
// No listeners attached, destroy the original request.
|
||||
stream.destroy();
|
||||
}
|
||||
} else {
|
||||
// Forwards data
|
||||
stream.on('data', chunk => {
|
||||
if (!response._dumped && !response.push(chunk)) {
|
||||
stream.pause();
|
||||
}
|
||||
});
|
||||
|
||||
stream.once('end', () => {
|
||||
response.push(null);
|
||||
});
|
||||
|
||||
if (!this.emit('response', response)) {
|
||||
// No listeners attached, dump the response.
|
||||
response._dump();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
// Emits `information` event
|
||||
stream.once('headers', waitForEnd(
|
||||
headers => this.emit('information', {statusCode: headers[HTTP2_HEADER_STATUS]})
|
||||
));
|
||||
|
||||
stream.once('trailers', waitForEnd((trailers, flags, rawTrailers) => {
|
||||
const {res} = this;
|
||||
|
||||
// Assigns trailers to the response object.
|
||||
res.trailers = trailers;
|
||||
res.rawTrailers = rawTrailers;
|
||||
}));
|
||||
|
||||
const {socket} = stream.session;
|
||||
this.socket = socket;
|
||||
this.connection = socket;
|
||||
|
||||
for (const job of this[kJobs]) {
|
||||
job();
|
||||
}
|
||||
|
||||
this.emit('socket', this.socket);
|
||||
};
|
||||
|
||||
// Makes a HTTP2 request
|
||||
if (this[kSession]) {
|
||||
try {
|
||||
onStream(this[kSession].request(this[kHeaders]));
|
||||
} catch (error) {
|
||||
this.emit('error', error);
|
||||
}
|
||||
} else {
|
||||
this.reusedSocket = true;
|
||||
|
||||
try {
|
||||
onStream(await this.agent.request(this[kOrigin], this[kOptions], this[kHeaders]));
|
||||
} catch (error) {
|
||||
this.emit('error', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getHeader(name) {
|
||||
if (typeof name !== 'string') {
|
||||
throw new ERR_INVALID_ARG_TYPE('name', 'string', name);
|
||||
}
|
||||
|
||||
return this[kHeaders][name.toLowerCase()];
|
||||
}
|
||||
|
||||
get headersSent() {
|
||||
return this[kFlushedHeaders];
|
||||
}
|
||||
|
||||
removeHeader(name) {
|
||||
if (typeof name !== 'string') {
|
||||
throw new ERR_INVALID_ARG_TYPE('name', 'string', name);
|
||||
}
|
||||
|
||||
if (this.headersSent) {
|
||||
throw new ERR_HTTP_HEADERS_SENT('remove');
|
||||
}
|
||||
|
||||
delete this[kHeaders][name.toLowerCase()];
|
||||
}
|
||||
|
||||
setHeader(name, value) {
|
||||
if (this.headersSent) {
|
||||
throw new ERR_HTTP_HEADERS_SENT('set');
|
||||
}
|
||||
|
||||
if (typeof name !== 'string' || (!isValidHttpToken.test(name) && !isRequestPseudoHeader(name))) {
|
||||
throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
|
||||
}
|
||||
|
||||
if (typeof value === 'undefined') {
|
||||
throw new ERR_HTTP_INVALID_HEADER_VALUE(value, name);
|
||||
}
|
||||
|
||||
if (isInvalidHeaderValue.test(value)) {
|
||||
throw new ERR_INVALID_CHAR('header content', name);
|
||||
}
|
||||
|
||||
this[kHeaders][name.toLowerCase()] = value;
|
||||
}
|
||||
|
||||
setNoDelay() {
|
||||
// HTTP2 sockets cannot be malformed, do nothing.
|
||||
}
|
||||
|
||||
setSocketKeepAlive() {
|
||||
// HTTP2 sockets cannot be malformed, do nothing.
|
||||
}
|
||||
|
||||
setTimeout(ms, callback) {
|
||||
const applyTimeout = () => this._request.setTimeout(ms, callback);
|
||||
|
||||
if (this._request) {
|
||||
applyTimeout();
|
||||
} else {
|
||||
this[kJobs].push(applyTimeout);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
get maxHeadersCount() {
|
||||
if (!this.destroyed && this._request) {
|
||||
return this._request.session.localSettings.maxHeaderListSize;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
set maxHeadersCount(_value) {
|
||||
// Updating HTTP2 settings would affect all requests, do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientRequest;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delayWhen.js","sources":["../../src/add/operator/delayWhen.ts"],"names":[],"mappings":";;AAAA,8CAA4C"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"groupBy.js","sources":["../../../src/internal/operators/groupBy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAoGrC,MAAM,UAAU,OAAO,CAAU,WAA4B,EAC5B,eAA0C,EAC1C,gBAAwE,EACxE,eAAkC;IACjE,OAAO,CAAC,MAAqB,EAAE,EAAE,CAC/B,MAAM,CAAC,IAAI,CAAC,IA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K,CAAC;QAMxB,KAAI,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,KAAI,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC,CAAC;;IAC3F,CAAC;IAES,oCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,yCAAU,GAAV;QACE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACvC;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AAtBD,CAAsC,UAAU,GAsB/C;AAED,SAAS,oBAAoB,CAAgC,KAAU;IAC/D,IAAA,6BAAU,EAAE,qBAAM,CAAW;IACnC,UAAU,CAAC,UAAU,EAAE,CAAC;IACxB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"catch.js","sources":["../../src/add/operator/catch.ts"],"names":[],"mappings":";;AAAA,0CAAwC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineLatest.js","sources":["../../src/add/operator/combineLatest.ts"],"names":[],"mappings":";;AAAA,kDAAgD"}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Test for (experimental) Content Security Policy 1.1 support.
|
||||
//
|
||||
// This feature is still quite experimental, but is available now in Chrome 22.
|
||||
// If the `SecurityPolicy` property is available, you can be sure the browser
|
||||
// supports CSP. If it's not available, the browser still might support an
|
||||
// earlier version of the CSP spec.
|
||||
//
|
||||
// Editor's Draft: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
|
||||
|
||||
Modernizr.addTest('contentsecuritypolicy', ('securityPolicy' in document || 'SecurityPolicy' in document));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultIfEmpty.js","sources":["../../../src/internal/operators/defaultIfEmpty.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4C3C,MAAM,UAAU,cAAc,CAAO,YAAsB;IAAtB,6BAAA,EAAA,mBAAsB;IACzD,OAAO,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,YAAY,CAAC,CAAsB,EAA1E,CAA0E,CAAC;AAC/G,CAAC;AAED;IAEE,gCAAoB,YAAe;QAAf,iBAAY,GAAZ,YAAY,CAAG;IACnC,CAAC;IAED,qCAAI,GAAJ,UAAK,UAA6B,EAAE,MAAW;QAC7C,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,wBAAwB,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACvF,CAAC;IACH,6BAAC;AAAD,CAAC,AARD,IAQC;AAOD;IAA6C,oDAAa;IAGxD,kCAAY,WAA8B,EAAU,YAAe;QAAnE,YACE,kBAAM,WAAW,CAAC,SACnB;QAFmD,kBAAY,GAAZ,YAAY,CAAG;QAF3D,aAAO,GAAY,IAAI,CAAC;;IAIhC,CAAC;IAES,wCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAES,4CAAS,GAAnB;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC1C;QACD,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IACH,+BAAC;AAAD,CAAC,AAlBD,CAA6C,UAAU,GAkBtD"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"os-name","version":"4.0.0","files":{"license":{"checkedAt":1678887829613,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"package.json":{"checkedAt":1678887830147,"integrity":"sha512-7kd1digzmbknkzN45xyiXWF3JvXOsoOLweqlk8fU5CBJlxCsGUMUtNEXW/41vuBxkleIrrtz5jSZjteGYqv48g==","mode":420,"size":831},"readme.md":{"checkedAt":1678887830147,"integrity":"sha512-eBZJccdKhT+aimlKETSLMpiBFuCyuE1Ex6dBcpeTdtGkDCJflStRW49ixw0pPKxhy4vj8Gy8uaP/U1T140NDHg==","mode":420,"size":1762},"index.d.ts":{"checkedAt":1678887830147,"integrity":"sha512-asTMuJvPiFvB1ovgTEpQSPMC4W2dSSWWscO6Mju4xwiwmcT0UL2vIgllM7vdFHJtGcjBxoZnN0gkxXRBQcECgA==","mode":420,"size":714},"index.js":{"checkedAt":1678887830147,"integrity":"sha512-sQf9FcDqXPtxOcxgFf2tiGNdL6KIPk5whxq9wYxKIkngdSrmw6ho8dQ628S/FPlKxbFoBlXuOilaC2zscYrcxg==","mode":420,"size":1123}}}
|
||||
@@ -0,0 +1,436 @@
|
||||
'use strict';
|
||||
const {
|
||||
V4MAPPED,
|
||||
ADDRCONFIG,
|
||||
ALL,
|
||||
promises: {
|
||||
Resolver: AsyncResolver
|
||||
},
|
||||
lookup: dnsLookup
|
||||
} = require('dns');
|
||||
const {promisify} = require('util');
|
||||
const os = require('os');
|
||||
|
||||
const kCacheableLookupCreateConnection = Symbol('cacheableLookupCreateConnection');
|
||||
const kCacheableLookupInstance = Symbol('cacheableLookupInstance');
|
||||
const kExpires = Symbol('expires');
|
||||
|
||||
const supportsALL = typeof ALL === 'number';
|
||||
|
||||
const verifyAgent = agent => {
|
||||
if (!(agent && typeof agent.createConnection === 'function')) {
|
||||
throw new Error('Expected an Agent instance as the first argument');
|
||||
}
|
||||
};
|
||||
|
||||
const map4to6 = entries => {
|
||||
for (const entry of entries) {
|
||||
if (entry.family === 6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.address = `::ffff:${entry.address}`;
|
||||
entry.family = 6;
|
||||
}
|
||||
};
|
||||
|
||||
const getIfaceInfo = () => {
|
||||
let has4 = false;
|
||||
let has6 = false;
|
||||
|
||||
for (const device of Object.values(os.networkInterfaces())) {
|
||||
for (const iface of device) {
|
||||
if (iface.internal) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (iface.family === 'IPv6') {
|
||||
has6 = true;
|
||||
} else {
|
||||
has4 = true;
|
||||
}
|
||||
|
||||
if (has4 && has6) {
|
||||
return {has4, has6};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {has4, has6};
|
||||
};
|
||||
|
||||
const isIterable = map => {
|
||||
return Symbol.iterator in map;
|
||||
};
|
||||
|
||||
const ttl = {ttl: true};
|
||||
const all = {all: true};
|
||||
|
||||
class CacheableLookup {
|
||||
constructor({
|
||||
cache = new Map(),
|
||||
maxTtl = Infinity,
|
||||
fallbackDuration = 3600,
|
||||
errorTtl = 0.15,
|
||||
resolver = new AsyncResolver(),
|
||||
lookup = dnsLookup
|
||||
} = {}) {
|
||||
this.maxTtl = maxTtl;
|
||||
this.errorTtl = errorTtl;
|
||||
|
||||
this._cache = cache;
|
||||
this._resolver = resolver;
|
||||
this._dnsLookup = promisify(lookup);
|
||||
|
||||
if (this._resolver instanceof AsyncResolver) {
|
||||
this._resolve4 = this._resolver.resolve4.bind(this._resolver);
|
||||
this._resolve6 = this._resolver.resolve6.bind(this._resolver);
|
||||
} else {
|
||||
this._resolve4 = promisify(this._resolver.resolve4.bind(this._resolver));
|
||||
this._resolve6 = promisify(this._resolver.resolve6.bind(this._resolver));
|
||||
}
|
||||
|
||||
this._iface = getIfaceInfo();
|
||||
|
||||
this._pending = {};
|
||||
this._nextRemovalTime = false;
|
||||
this._hostnamesToFallback = new Set();
|
||||
|
||||
if (fallbackDuration < 1) {
|
||||
this._fallback = false;
|
||||
} else {
|
||||
this._fallback = true;
|
||||
|
||||
const interval = setInterval(() => {
|
||||
this._hostnamesToFallback.clear();
|
||||
}, fallbackDuration * 1000);
|
||||
|
||||
/* istanbul ignore next: There is no `interval.unref()` when running inside an Electron renderer */
|
||||
if (interval.unref) {
|
||||
interval.unref();
|
||||
}
|
||||
}
|
||||
|
||||
this.lookup = this.lookup.bind(this);
|
||||
this.lookupAsync = this.lookupAsync.bind(this);
|
||||
}
|
||||
|
||||
set servers(servers) {
|
||||
this.clear();
|
||||
|
||||
this._resolver.setServers(servers);
|
||||
}
|
||||
|
||||
get servers() {
|
||||
return this._resolver.getServers();
|
||||
}
|
||||
|
||||
lookup(hostname, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
} else if (typeof options === 'number') {
|
||||
options = {
|
||||
family: options
|
||||
};
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
throw new Error('Callback must be a function.');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line promise/prefer-await-to-then
|
||||
this.lookupAsync(hostname, options).then(result => {
|
||||
if (options.all) {
|
||||
callback(null, result);
|
||||
} else {
|
||||
callback(null, result.address, result.family, result.expires, result.ttl);
|
||||
}
|
||||
}, callback);
|
||||
}
|
||||
|
||||
async lookupAsync(hostname, options = {}) {
|
||||
if (typeof options === 'number') {
|
||||
options = {
|
||||
family: options
|
||||
};
|
||||
}
|
||||
|
||||
let cached = await this.query(hostname);
|
||||
|
||||
if (options.family === 6) {
|
||||
const filtered = cached.filter(entry => entry.family === 6);
|
||||
|
||||
if (options.hints & V4MAPPED) {
|
||||
if ((supportsALL && options.hints & ALL) || filtered.length === 0) {
|
||||
map4to6(cached);
|
||||
} else {
|
||||
cached = filtered;
|
||||
}
|
||||
} else {
|
||||
cached = filtered;
|
||||
}
|
||||
} else if (options.family === 4) {
|
||||
cached = cached.filter(entry => entry.family === 4);
|
||||
}
|
||||
|
||||
if (options.hints & ADDRCONFIG) {
|
||||
const {_iface} = this;
|
||||
cached = cached.filter(entry => entry.family === 6 ? _iface.has6 : _iface.has4);
|
||||
}
|
||||
|
||||
if (cached.length === 0) {
|
||||
const error = new Error(`cacheableLookup ENOTFOUND ${hostname}`);
|
||||
error.code = 'ENOTFOUND';
|
||||
error.hostname = hostname;
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (options.all) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
return cached[0];
|
||||
}
|
||||
|
||||
async query(hostname) {
|
||||
let cached = await this._cache.get(hostname);
|
||||
|
||||
if (!cached) {
|
||||
const pending = this._pending[hostname];
|
||||
|
||||
if (pending) {
|
||||
cached = await pending;
|
||||
} else {
|
||||
const newPromise = this.queryAndCache(hostname);
|
||||
this._pending[hostname] = newPromise;
|
||||
|
||||
try {
|
||||
cached = await newPromise;
|
||||
} finally {
|
||||
delete this._pending[hostname];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cached = cached.map(entry => {
|
||||
return {...entry};
|
||||
});
|
||||
|
||||
return cached;
|
||||
}
|
||||
|
||||
async _resolve(hostname) {
|
||||
const wrap = async promise => {
|
||||
try {
|
||||
return await promise;
|
||||
} catch (error) {
|
||||
if (error.code === 'ENODATA' || error.code === 'ENOTFOUND') {
|
||||
return [];
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// ANY is unsafe as it doesn't trigger new queries in the underlying server.
|
||||
const [A, AAAA] = await Promise.all([
|
||||
this._resolve4(hostname, ttl),
|
||||
this._resolve6(hostname, ttl)
|
||||
].map(promise => wrap(promise)));
|
||||
|
||||
let aTtl = 0;
|
||||
let aaaaTtl = 0;
|
||||
let cacheTtl = 0;
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
for (const entry of A) {
|
||||
entry.family = 4;
|
||||
entry.expires = now + (entry.ttl * 1000);
|
||||
|
||||
aTtl = Math.max(aTtl, entry.ttl);
|
||||
}
|
||||
|
||||
for (const entry of AAAA) {
|
||||
entry.family = 6;
|
||||
entry.expires = now + (entry.ttl * 1000);
|
||||
|
||||
aaaaTtl = Math.max(aaaaTtl, entry.ttl);
|
||||
}
|
||||
|
||||
if (A.length > 0) {
|
||||
if (AAAA.length > 0) {
|
||||
cacheTtl = Math.min(aTtl, aaaaTtl);
|
||||
} else {
|
||||
cacheTtl = aTtl;
|
||||
}
|
||||
} else {
|
||||
cacheTtl = aaaaTtl;
|
||||
}
|
||||
|
||||
return {
|
||||
entries: [
|
||||
...A,
|
||||
...AAAA
|
||||
],
|
||||
cacheTtl
|
||||
};
|
||||
}
|
||||
|
||||
async _lookup(hostname) {
|
||||
try {
|
||||
const entries = await this._dnsLookup(hostname, {
|
||||
all: true
|
||||
});
|
||||
|
||||
return {
|
||||
entries,
|
||||
cacheTtl: 0
|
||||
};
|
||||
} catch (_) {
|
||||
return {
|
||||
entries: [],
|
||||
cacheTtl: 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async _set(hostname, data, cacheTtl) {
|
||||
if (this.maxTtl > 0 && cacheTtl > 0) {
|
||||
cacheTtl = Math.min(cacheTtl, this.maxTtl) * 1000;
|
||||
data[kExpires] = Date.now() + cacheTtl;
|
||||
|
||||
try {
|
||||
await this._cache.set(hostname, data, cacheTtl);
|
||||
} catch (error) {
|
||||
this.lookupAsync = async () => {
|
||||
const cacheError = new Error('Cache Error. Please recreate the CacheableLookup instance.');
|
||||
cacheError.cause = error;
|
||||
|
||||
throw cacheError;
|
||||
};
|
||||
}
|
||||
|
||||
if (isIterable(this._cache)) {
|
||||
this._tick(cacheTtl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async queryAndCache(hostname) {
|
||||
if (this._hostnamesToFallback.has(hostname)) {
|
||||
return this._dnsLookup(hostname, all);
|
||||
}
|
||||
|
||||
let query = await this._resolve(hostname);
|
||||
|
||||
if (query.entries.length === 0 && this._fallback) {
|
||||
query = await this._lookup(hostname);
|
||||
|
||||
if (query.entries.length !== 0) {
|
||||
// Use `dns.lookup(...)` for that particular hostname
|
||||
this._hostnamesToFallback.add(hostname);
|
||||
}
|
||||
}
|
||||
|
||||
const cacheTtl = query.entries.length === 0 ? this.errorTtl : query.cacheTtl;
|
||||
await this._set(hostname, query.entries, cacheTtl);
|
||||
|
||||
return query.entries;
|
||||
}
|
||||
|
||||
_tick(ms) {
|
||||
const nextRemovalTime = this._nextRemovalTime;
|
||||
|
||||
if (!nextRemovalTime || ms < nextRemovalTime) {
|
||||
clearTimeout(this._removalTimeout);
|
||||
|
||||
this._nextRemovalTime = ms;
|
||||
|
||||
this._removalTimeout = setTimeout(() => {
|
||||
this._nextRemovalTime = false;
|
||||
|
||||
let nextExpiry = Infinity;
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
for (const [hostname, entries] of this._cache) {
|
||||
const expires = entries[kExpires];
|
||||
|
||||
if (now >= expires) {
|
||||
this._cache.delete(hostname);
|
||||
} else if (expires < nextExpiry) {
|
||||
nextExpiry = expires;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextExpiry !== Infinity) {
|
||||
this._tick(nextExpiry - now);
|
||||
}
|
||||
}, ms);
|
||||
|
||||
/* istanbul ignore next: There is no `timeout.unref()` when running inside an Electron renderer */
|
||||
if (this._removalTimeout.unref) {
|
||||
this._removalTimeout.unref();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
install(agent) {
|
||||
verifyAgent(agent);
|
||||
|
||||
if (kCacheableLookupCreateConnection in agent) {
|
||||
throw new Error('CacheableLookup has been already installed');
|
||||
}
|
||||
|
||||
agent[kCacheableLookupCreateConnection] = agent.createConnection;
|
||||
agent[kCacheableLookupInstance] = this;
|
||||
|
||||
agent.createConnection = (options, callback) => {
|
||||
if (!('lookup' in options)) {
|
||||
options.lookup = this.lookup;
|
||||
}
|
||||
|
||||
return agent[kCacheableLookupCreateConnection](options, callback);
|
||||
};
|
||||
}
|
||||
|
||||
uninstall(agent) {
|
||||
verifyAgent(agent);
|
||||
|
||||
if (agent[kCacheableLookupCreateConnection]) {
|
||||
if (agent[kCacheableLookupInstance] !== this) {
|
||||
throw new Error('The agent is not owned by this CacheableLookup instance');
|
||||
}
|
||||
|
||||
agent.createConnection = agent[kCacheableLookupCreateConnection];
|
||||
|
||||
delete agent[kCacheableLookupCreateConnection];
|
||||
delete agent[kCacheableLookupInstance];
|
||||
}
|
||||
}
|
||||
|
||||
updateInterfaceInfo() {
|
||||
const {_iface} = this;
|
||||
|
||||
this._iface = getIfaceInfo();
|
||||
|
||||
if ((_iface.has4 && !this._iface.has4) || (_iface.has6 && !this._iface.has6)) {
|
||||
this._cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
clear(hostname) {
|
||||
if (hostname) {
|
||||
this._cache.delete(hostname);
|
||||
return;
|
||||
}
|
||||
|
||||
this._cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CacheableLookup;
|
||||
module.exports.default = CacheableLookup;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { scan } from './scan';
|
||||
import { takeLast } from './takeLast';
|
||||
import { defaultIfEmpty } from './defaultIfEmpty';
|
||||
import { pipe } from '../util/pipe';
|
||||
export function reduce(accumulator, seed) {
|
||||
if (arguments.length >= 2) {
|
||||
return function reduceOperatorFunctionWithSeed(source) {
|
||||
return pipe(scan(accumulator, seed), takeLast(1), defaultIfEmpty(seed))(source);
|
||||
};
|
||||
}
|
||||
return function reduceOperatorFunction(source) {
|
||||
return pipe(scan((acc, value, index) => accumulator(acc, value, index + 1)), takeLast(1))(source);
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=reduce.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async.js","sources":["../src/scheduler/async.ts"],"names":[],"mappings":";;;;;AAAA,iDAA4C"}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
// Test for CSS 3 UI "resize" property
|
||||
// http://www.w3.org/TR/css3-ui/#resize
|
||||
// https://developer.mozilla.org/en/CSS/resize
|
||||
|
||||
Modernizr.addTest('cssresize', Modernizr.testAllProps('resize'));
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// Test for `srcdoc` attribute in iframes.
|
||||
//
|
||||
// Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-srcdoc
|
||||
|
||||
Modernizr.addTest('srcdoc', 'srcdoc' in document.createElement('iframe'));
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"QueueAction.js","sources":["../../../src/internal/scheduler/QueueAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAU5C,MAAM,OAAO,WAAe,SAAQ,WAAc;IAEhD,YAAsB,SAAyB,EACzB,IAAmD;QACvE,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAFH,cAAS,GAAT,SAAS,CAAgB;QACzB,SAAI,GAAJ,IAAI,CAA+C;IAEzE,CAAC;IAEM,QAAQ,CAAC,KAAS,EAAE,QAAgB,CAAC;QAC1C,IAAI,KAAK,GAAG,CAAC,EAAE;YACb,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACrC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO,CAAC,KAAQ,EAAE,KAAa;QACpC,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAE;IACjC,CAAC;IAES,cAAc,CAAC,SAAyB,EAAE,EAAQ,EAAE,QAAgB,CAAC;QAI7E,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE;YACvE,OAAO,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACnD;QAED,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"2":"C K L H M N O","164":"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 DC EC","66":"V W","257":"Y Z a b c d f g h i j k l m n o p q r s D t xB yB","772":"X"},D:{"2":"I u J E F G A B C K L H M N O v w","132":"xB yB FC","164":"0 1 2 3 4 5 6 7 8 9 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"},E:{"2":"I u GC zB HC","132":"A B C K 0B qB rB 1B","164":"J E F G IC JC KC","516":"L H LC MC 2B 3B 4B 5B sB 6B 7B 8B NC"},F:{"2":"G B C OC PC QC RC qB 9B SC rB","164":"0 1 2 3 4 5 6 7 8 9 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"},G:{"2":"zB TC AC UC","132":"aC bC cC dC eC fC gC hC iC jC","164":"F VC WC XC YC ZC","516":"kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"nC"},I:{"2":"tB I oC pC qC rC AC","164":"D sC tC"},J:{"2":"E","164":"A"},K:{"2":"A B C qB 9B rB","164":"e"},L:{"164":"D"},M:{"257":"D"},N:{"2":"A B"},O:{"164":"uC"},P:{"164":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"164":"1B"},R:{"164":"8C"},S:{"2":"9C"}},B:5,C:"CSS image-set"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"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","2":"C K L H M","257":"N O"},C:{"1":"n o p q r s D t xB yB","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 DC EC","578":"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"},D:{"1":"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","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","194":"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"},E:{"2":"I u J E F GC zB HC IC JC","33":"G A B C K L H KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC"},F:{"1":"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","2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w x y z OC PC QC RC qB 9B SC rB","194":"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"},G:{"2":"F zB TC AC UC VC WC XC","33":"YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"1C 2C 3C 4C sB 5C 6C 7C","2":"I","194":"vC wC xC yC zC 0B 0C"},Q:{"2":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:7,C:"CSS Backdrop Filter"};
|
||||
@@ -0,0 +1,179 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';
|
||||
import { map } from './map';
|
||||
import { from } from '../observable/from';
|
||||
import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export function mergeMap<T, O extends ObservableInput<any>>(project: (value: T, index: number) => O, concurrent?: number): OperatorFunction<T, ObservedValueOf<O>>;
|
||||
/** @deprecated resultSelector no longer supported, use inner map instead */
|
||||
export function mergeMap<T, O extends ObservableInput<any>>(project: (value: T, index: number) => O, resultSelector: undefined, concurrent?: number): OperatorFunction<T, ObservedValueOf<O>>;
|
||||
/** @deprecated resultSelector no longer supported, use inner map instead */
|
||||
export function mergeMap<T, R, O extends ObservableInput<any>>(project: (value: T, index: number) => O, resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R, concurrent?: number): OperatorFunction<T, R>;
|
||||
/* tslint:enable:max-line-length */
|
||||
|
||||
/**
|
||||
* Projects each source value to an Observable which is merged in the output
|
||||
* Observable.
|
||||
*
|
||||
* <span class="informal">Maps each value to an Observable, then flattens all of
|
||||
* these inner Observables using {@link mergeAll}.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Returns an Observable that emits items based on applying a function that you
|
||||
* supply to each item emitted by the source Observable, where that function
|
||||
* returns an Observable, and then merging those resulting Observables and
|
||||
* emitting the results of this merger.
|
||||
*
|
||||
* ## Example
|
||||
* Map and flatten each letter to an Observable ticking every 1 second
|
||||
* ```ts
|
||||
* import { of, interval } from 'rxjs';
|
||||
* import { mergeMap, map } from 'rxjs/operators';
|
||||
*
|
||||
* const letters = of('a', 'b', 'c');
|
||||
* const result = letters.pipe(
|
||||
* mergeMap(x => interval(1000).pipe(map(i => x+i))),
|
||||
* );
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // a0
|
||||
* // b0
|
||||
* // c0
|
||||
* // a1
|
||||
* // b1
|
||||
* // c1
|
||||
* // continues to list a,b,c with respective ascending integers
|
||||
* ```
|
||||
*
|
||||
* @see {@link concatMap}
|
||||
* @see {@link exhaustMap}
|
||||
* @see {@link merge}
|
||||
* @see {@link mergeAll}
|
||||
* @see {@link mergeMapTo}
|
||||
* @see {@link mergeScan}
|
||||
* @see {@link switchMap}
|
||||
*
|
||||
* @param {function(value: T, ?index: number): ObservableInput} project A function
|
||||
* that, when applied to an item emitted by the source Observable, returns an
|
||||
* Observable.
|
||||
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
|
||||
* Observables being subscribed to concurrently.
|
||||
* @return {Observable} An Observable that emits the result of applying the
|
||||
* projection function (and the optional deprecated `resultSelector`) to each item
|
||||
* emitted by the source Observable and merging the results of the Observables
|
||||
* obtained from this transformation.
|
||||
*/
|
||||
export function mergeMap<T, R, O extends ObservableInput<any>>(
|
||||
project: (value: T, index: number) => O,
|
||||
resultSelector?: ((outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R) | number,
|
||||
concurrent: number = Number.POSITIVE_INFINITY
|
||||
): OperatorFunction<T, ObservedValueOf<O>|R> {
|
||||
if (typeof resultSelector === 'function') {
|
||||
// DEPRECATED PATH
|
||||
return (source: Observable<T>) => source.pipe(
|
||||
mergeMap((a, i) => from(project(a, i)).pipe(
|
||||
map((b: any, ii: number) => resultSelector(a, b, i, ii)),
|
||||
), concurrent)
|
||||
);
|
||||
} else if (typeof resultSelector === 'number') {
|
||||
concurrent = resultSelector;
|
||||
}
|
||||
return (source: Observable<T>) => source.lift(new MergeMapOperator(project, concurrent));
|
||||
}
|
||||
|
||||
export class MergeMapOperator<T, R> implements Operator<T, R> {
|
||||
constructor(private project: (value: T, index: number) => ObservableInput<R>,
|
||||
private concurrent: number = Number.POSITIVE_INFINITY) {
|
||||
}
|
||||
|
||||
call(observer: Subscriber<R>, source: any): any {
|
||||
return source.subscribe(new MergeMapSubscriber(
|
||||
observer, this.project, this.concurrent
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export class MergeMapSubscriber<T, R> extends SimpleOuterSubscriber<T, R> {
|
||||
private hasCompleted: boolean = false;
|
||||
private buffer: T[] = [];
|
||||
private active: number = 0;
|
||||
protected index: number = 0;
|
||||
|
||||
constructor(destination: Subscriber<R>,
|
||||
private project: (value: T, index: number) => ObservableInput<R>,
|
||||
private concurrent: number = Number.POSITIVE_INFINITY) {
|
||||
super(destination);
|
||||
}
|
||||
|
||||
protected _next(value: T): void {
|
||||
if (this.active < this.concurrent) {
|
||||
this._tryNext(value);
|
||||
} else {
|
||||
this.buffer.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
protected _tryNext(value: T) {
|
||||
let result: ObservableInput<R>;
|
||||
const index = this.index++;
|
||||
try {
|
||||
result = this.project(value, index);
|
||||
} catch (err) {
|
||||
this.destination.error!(err);
|
||||
return;
|
||||
}
|
||||
this.active++;
|
||||
this._innerSub(result);
|
||||
}
|
||||
|
||||
private _innerSub(ish: ObservableInput<R>): void {
|
||||
const innerSubscriber = new SimpleInnerSubscriber(this);
|
||||
const destination = this.destination as Subscription;
|
||||
destination.add(innerSubscriber);
|
||||
const innerSubscription = innerSubscribe(ish, innerSubscriber);
|
||||
// The returned subscription will usually be the subscriber that was
|
||||
// passed. However, interop subscribers will be wrapped and for
|
||||
// unsubscriptions to chain correctly, the wrapper needs to be added, too.
|
||||
if (innerSubscription !== innerSubscriber) {
|
||||
destination.add(innerSubscription);
|
||||
}
|
||||
}
|
||||
|
||||
protected _complete(): void {
|
||||
this.hasCompleted = true;
|
||||
if (this.active === 0 && this.buffer.length === 0) {
|
||||
this.destination.complete!();
|
||||
}
|
||||
this.unsubscribe();
|
||||
}
|
||||
|
||||
notifyNext(innerValue: R): void {
|
||||
this.destination.next!(innerValue);
|
||||
}
|
||||
|
||||
notifyComplete(): void {
|
||||
const buffer = this.buffer;
|
||||
this.active--;
|
||||
if (buffer.length > 0) {
|
||||
this._next(buffer.shift()!);
|
||||
} else if (this.active === 0 && this.hasCompleted) {
|
||||
this.destination.complete!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated renamed. Use {@link mergeMap}
|
||||
*/
|
||||
export const flatMap = mergeMap;
|
||||
@@ -0,0 +1,16 @@
|
||||
const { version, help } = require('./cli');
|
||||
const runTasks = require('./tasks');
|
||||
const Plugin = require('./plugin/Plugin');
|
||||
|
||||
module.exports = async options => {
|
||||
if (options.version) {
|
||||
version();
|
||||
} else if (options.help) {
|
||||
help();
|
||||
} else {
|
||||
return runTasks(options);
|
||||
}
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
module.exports.Plugin = Plugin;
|
||||
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isRgbColor;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/;
|
||||
var rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;
|
||||
var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)/;
|
||||
var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)/;
|
||||
|
||||
function isRgbColor(str) {
|
||||
var includePercentValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
(0, _assertString.default)(str);
|
||||
|
||||
if (!includePercentValues) {
|
||||
return rgbColor.test(str) || rgbaColor.test(str);
|
||||
}
|
||||
|
||||
return rgbColor.test(str) || rgbaColor.test(str) || rgbColorPercent.test(str) || rgbaColorPercent.test(str);
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","16":"BC","900":"J E F G"},B:{"1":"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","1025":"C K L H M N O"},C:{"1":"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","900":"CC tB DC EC","1025":"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"},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":"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","16":"u GC","900":"I zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 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","16":"G","132":"B C OC PC QC RC qB 9B SC rB"},G:{"1":"TC AC UC VC WC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","16":"zB","2052":"F XC"},H:{"132":"nC"},I:{"1":"tB I qC rC AC sC tC","16":"oC pC","4097":"D"},J:{"1":"E A"},K:{"132":"A B C qB 9B rB","4097":"e"},L:{"4097":"D"},M:{"4097":"D"},N:{"1":"A B"},O:{"1":"uC"},P:{"4097":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1025":"9C"}},B:1,C:"maxlength attribute for input and textarea elements"};
|
||||
@@ -0,0 +1,69 @@
|
||||
/*global module */
|
||||
module.exports = function( grunt ) {
|
||||
'use strict';
|
||||
|
||||
grunt.initConfig({
|
||||
meta: {
|
||||
version: '2.8.3',
|
||||
banner: '/*!\n' +
|
||||
' * Modernizr v<%= meta.version %>\n' +
|
||||
' * www.modernizr.com\n *\n' +
|
||||
' * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton\n' +
|
||||
' * Available under the BSD and MIT licenses: www.modernizr.com/license/\n */'
|
||||
},
|
||||
qunit: {
|
||||
files: ['test/index.html']
|
||||
},
|
||||
lint: {
|
||||
files: [
|
||||
'grunt.js',
|
||||
'modernizr.js',
|
||||
'feature-detects/*.js'
|
||||
]
|
||||
},
|
||||
min: {
|
||||
dist: {
|
||||
src: [
|
||||
'<banner:meta.banner>',
|
||||
'modernizr.js'
|
||||
],
|
||||
dest: 'modernizr.min.js'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
files: '<config:lint.files>',
|
||||
tasks: 'lint'
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
boss: true,
|
||||
browser: true,
|
||||
curly: false,
|
||||
devel: true,
|
||||
eqeqeq: false,
|
||||
eqnull: true,
|
||||
expr: true,
|
||||
evil: true,
|
||||
immed: false,
|
||||
laxcomma: true,
|
||||
newcap: false,
|
||||
noarg: true,
|
||||
smarttabs: true,
|
||||
sub: true,
|
||||
undef: true
|
||||
},
|
||||
globals: {
|
||||
Modernizr: true,
|
||||
DocumentTouch: true,
|
||||
TEST: true,
|
||||
SVGFEColorMatrixElement : true,
|
||||
Blob: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.registerTask('default', 'min');
|
||||
|
||||
// Travis CI task.
|
||||
grunt.registerTask('travis', 'qunit');
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
'use strict'
|
||||
|
||||
let { cyan, gray, green, yellow, magenta } = require('colorette')
|
||||
|
||||
let tokenizer = require('./tokenize')
|
||||
|
||||
let Input
|
||||
|
||||
function registerInput(dependant) {
|
||||
Input = dependant
|
||||
}
|
||||
|
||||
const HIGHLIGHT_THEME = {
|
||||
'brackets': cyan,
|
||||
'at-word': cyan,
|
||||
'comment': gray,
|
||||
'string': green,
|
||||
'class': yellow,
|
||||
'hash': magenta,
|
||||
'call': cyan,
|
||||
'(': cyan,
|
||||
')': cyan,
|
||||
'{': yellow,
|
||||
'}': yellow,
|
||||
'[': yellow,
|
||||
']': yellow,
|
||||
':': yellow,
|
||||
';': yellow
|
||||
}
|
||||
|
||||
function getTokenType([type, value], processor) {
|
||||
if (type === 'word') {
|
||||
if (value[0] === '.') {
|
||||
return 'class'
|
||||
}
|
||||
if (value[0] === '#') {
|
||||
return 'hash'
|
||||
}
|
||||
}
|
||||
|
||||
if (!processor.endOfFile()) {
|
||||
let next = processor.nextToken()
|
||||
processor.back(next)
|
||||
if (next[0] === 'brackets' || next[0] === '(') return 'call'
|
||||
}
|
||||
|
||||
return type
|
||||
}
|
||||
|
||||
function terminalHighlight(css) {
|
||||
let processor = tokenizer(new Input(css), { ignoreErrors: true })
|
||||
let result = ''
|
||||
while (!processor.endOfFile()) {
|
||||
let token = processor.nextToken()
|
||||
let color = HIGHLIGHT_THEME[getTokenType(token, processor)]
|
||||
if (color) {
|
||||
result += token[1]
|
||||
.split(/\r?\n/)
|
||||
.map(i => color(i))
|
||||
.join('\n')
|
||||
} else {
|
||||
result += token[1]
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
terminalHighlight.registerInput = registerInput
|
||||
|
||||
module.exports = terminalHighlight
|
||||
Reference in New Issue
Block a user