new license file version [CI SKIP]

This commit is contained in:
2023-03-15 12:34:41 +00:00
parent 0a6d92a1f3
commit 61328d20ed
13115 changed files with 1892314 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
import { EMPTY } from '../observable/empty';
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';
import { innerFrom } from '../observable/innerFrom';
import { timer } from '../observable/timer';
export function repeat(countOrConfig) {
let count = Infinity;
let delay;
if (countOrConfig != null) {
if (typeof countOrConfig === 'object') {
({ count = Infinity, delay } = countOrConfig);
}
else {
count = countOrConfig;
}
}
return count <= 0
? () => EMPTY
: operate((source, subscriber) => {
let soFar = 0;
let sourceSub;
const resubscribe = () => {
sourceSub === null || sourceSub === void 0 ? void 0 : sourceSub.unsubscribe();
sourceSub = null;
if (delay != null) {
const notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(soFar));
const notifierSubscriber = createOperatorSubscriber(subscriber, () => {
notifierSubscriber.unsubscribe();
subscribeToSource();
});
notifier.subscribe(notifierSubscriber);
}
else {
subscribeToSource();
}
};
const subscribeToSource = () => {
let syncUnsub = false;
sourceSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, () => {
if (++soFar < count) {
if (sourceSub) {
resubscribe();
}
else {
syncUnsub = true;
}
}
else {
subscriber.complete();
}
}));
if (syncUnsub) {
resubscribe();
}
};
subscribeToSource();
});
}
//# sourceMappingURL=repeat.js.map

View File

@@ -0,0 +1 @@
{"name":"yallist","version":"4.0.0","files":{"LICENSE":{"checkedAt":1678883670198,"integrity":"sha512-P6dI5Z+zrwxSk1MIRPqpYG2ScYNkidLIATQXd50QzBgBh/XmcEd/nsd9NB4O9k6rfc+4dsY5DwJ7xvhpoS0PRg==","mode":420,"size":765},"iterator.js":{"checkedAt":1678883670198,"integrity":"sha512-gdEBfYpX2q8L4tHZwoKV39GhQ2qnmpbwvu+K+8y8fp7lVGhdXPpacQtlGn2Xo/kooGqITRLY69eA22wu6NeDWw==","mode":420,"size":207},"package.json":{"checkedAt":1678883670198,"integrity":"sha512-vIVxLDkmlFd0i5hbmVampMB0KXbo5X2jLhL547BcH8OpFvVtgxlDds7KorQeDifK03JaaOB5PokaACJxD1HO1A==","mode":420,"size":652},"yallist.js":{"checkedAt":1678883670198,"integrity":"sha512-MU4uXuqGeBGRAKzaslH9tyMEDVYrNP83Pev9va1xBzmdM8YVRdAxkCB+XDLlvYWJfVJsdYL7LOQ2PsSav3G7Ng==","mode":420,"size":8411},"README.md":{"checkedAt":1678883670198,"integrity":"sha512-r+xy8CtSKInl7bODQ7P3Q0gPrK/lM9eEXzgUF7UxghBQbrH1Xb8k6PKpUunSSAa7dTSZ+JtRaQx39sLXF5Klpw==","mode":420,"size":4717}}}

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O P Q R S T U"},C:{"1":"gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g 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 EC FC"},D:{"1":"V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R S T U"},E:{"1":"OC","2":"I v J D E F A B HC zB IC JC KC LC 0B","129":"C K L G qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B"},F:{"1":"kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g 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 PC QC RC SC qB AC TC rB"},G:{"1":"eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"2":"vC"},P:{"1":"g 4C 5C sB 6C 7C 8C","2":"I wC xC yC zC 0C 0B 1C 2C 3C"},Q:{"2":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:5,C:"CSS ::marker pseudo-element"};

View File

@@ -0,0 +1,52 @@
var arrayFilter = require('./_arrayFilter'),
baseFilter = require('./_baseFilter'),
baseIteratee = require('./_baseIteratee'),
isArray = require('./isArray');
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* **Note:** Unlike `_.remove`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');
* // => objects for ['barney']
*
* // Combining several predicates using `_.overEvery` or `_.overSome`.
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
* // => objects for ['fred', 'barney']
*/
function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, baseIteratee(predicate, 3));
}
module.exports = filter;

View File

@@ -0,0 +1,13 @@
var compactable = require('./compactable');
function restoreWithComponents(property) {
var descriptor = compactable[property.name];
if (descriptor && descriptor.shorthand) {
return descriptor.restore(property, compactable);
} else {
return property.value;
}
}
module.exports = restoreWithComponents;

View File

@@ -0,0 +1,235 @@
import { CSVParseParam } from "./Parameters";
import { Converter } from "./Converter";
import { Fileline } from "./fileline";
import getEol from "./getEol";
import { filterArray, trimLeft, trimRight } from "./util";
const defaulDelimiters = [",", "|", "\t", ";", ":"];
export class RowSplit {
private quote: string;
private trim: boolean;
private escape: string;
private cachedRegExp: { [key: string]: RegExp } = {};
private delimiterEmitted = false;
private _needEmitDelimiter?: boolean = undefined;
private get needEmitDelimiter() {
if (this._needEmitDelimiter === undefined) {
this._needEmitDelimiter = this.conv.listeners("delimiter").length > 0;
}
return this._needEmitDelimiter;
}
constructor(private conv: Converter) {
this.quote = conv.parseParam.quote;
this.trim = conv.parseParam.trim;
this.escape = conv.parseParam.escape;
}
parse(fileline: Fileline): RowSplitResult {
if (fileline.length === 0 || (this.conv.parseParam.ignoreEmpty && fileline.trim().length === 0)) {
return { cells: [], closed: true };
}
const quote = this.quote;
const trim = this.trim;
const escape = this.escape;
if (this.conv.parseRuntime.delimiter instanceof Array || this.conv.parseRuntime.delimiter.toLowerCase() === "auto") {
this.conv.parseRuntime.delimiter = this.getDelimiter(fileline);
}
if (this.needEmitDelimiter && !this.delimiterEmitted) {
this.conv.emit("delimiter", this.conv.parseRuntime.delimiter);
this.delimiterEmitted = true;
}
const delimiter = this.conv.parseRuntime.delimiter;
const rowArr = fileline.split(delimiter);
if (quote === "off") {
if (trim) {
for (let i = 0; i < rowArr.length; i++) {
rowArr[i] = rowArr[i].trim();
}
}
return { cells: rowArr, closed: true };
} else {
return this.toCSVRow(rowArr, trim, quote, delimiter);
}
}
private toCSVRow(rowArr: string[], trim: boolean, quote: string, delimiter: string): RowSplitResult {
const row: string[] = [];
let inquote = false;
let quoteBuff = '';
for (let i = 0, rowLen = rowArr.length; i < rowLen; i++) {
let e = rowArr[i];
if (!inquote && trim) {
e = trimLeft(e);
}
const len = e.length;
if (!inquote) {
if (len === 2 && e === this.quote + this.quote) {
row.push("");
continue;
} else if (this.isQuoteOpen(e)) { //quote open
e = e.substr(1);
if (this.isQuoteClose(e)) { //quote close
e = e.substring(0, e.lastIndexOf(quote));
e = this.escapeQuote(e);
row.push(e);
continue;
} else if (e.indexOf(quote) !== -1) {
let count = 0;
let prev = "";
for (const c of e) {
// count quotes only if previous character is not escape char
if (c === quote && prev !== this.escape) {
count++;
prev = "";
} else {
// save previous char to temp variable
prev = c;
}
}
if (count % 2 === 1) {
if (trim) {
e = trimRight(e);
}
row.push(quote + e);
continue;
}else{
inquote = true;
quoteBuff += e;
continue;
}
}
else {
inquote = true;
quoteBuff += e;
continue;
}
} else {
if (trim) {
e = trimRight(e);
}
row.push(e);
continue;
}
} else { //previous quote not closed
if (this.isQuoteClose(e)) { //close double quote
inquote = false;
e = e.substr(0, len - 1);
quoteBuff += delimiter + e;
quoteBuff = this.escapeQuote(quoteBuff);
if (trim) {
quoteBuff = trimRight(quoteBuff);
}
row.push(quoteBuff);
quoteBuff = "";
} else {
quoteBuff += delimiter + e;
}
}
}
// if (!inquote && param._needFilterRow) {
// row = filterRow(row, param);
// }
return { cells: row, closed: !inquote };
}
private getDelimiter(fileline: Fileline): string {
let checker;
if (this.conv.parseParam.delimiter === "auto") {
checker = defaulDelimiters;
} else if (this.conv.parseParam.delimiter instanceof Array) {
checker = this.conv.parseParam.delimiter;
} else {
return this.conv.parseParam.delimiter;
}
let count = 0;
let rtn = ",";
checker.forEach(function (delim) {
const delimCount = fileline.split(delim).length;
if (delimCount > count) {
rtn = delim;
count = delimCount;
}
});
return rtn;
}
private isQuoteOpen(str: string): boolean {
const quote = this.quote;
const escape = this.escape;
return str[0] === quote && (
str[1] !== quote ||
str[1] === escape && (str[2] === quote || str.length === 2));
}
private isQuoteClose(str: string): boolean {
const quote = this.quote;
const escape = this.escape;
if (this.conv.parseParam.trim) {
str = trimRight(str);
}
let count = 0;
let idx = str.length - 1;
while (str[idx] === quote || str[idx] === escape) {
idx--;
count++;
}
return count % 2 !== 0;
}
// private twoDoubleQuote(str: string): string {
// var twoQuote = this.quote + this.quote;
// var curIndex = -1;
// while ((curIndex = str.indexOf(twoQuote, curIndex)) > -1) {
// str = str.substring(0, curIndex) + str.substring(++curIndex);
// }
// return str;
// }
private escapeQuote(segment: string): string {
const key = "es|" + this.quote + "|" + this.escape;
if (this.cachedRegExp[key] === undefined) {
this.cachedRegExp[key] = new RegExp('\\' + this.escape + '\\' + this.quote, 'g');
}
const regExp = this.cachedRegExp[key];
// console.log(regExp,segment);
return segment.replace(regExp, this.quote);
}
parseMultiLines(lines: Fileline[]): MultipleRowResult {
const csvLines: string[][] = [];
let left = "";
while (lines.length) {
const line = left + lines.shift();
const row = this.parse(line);
if (row.cells.length === 0 && this.conv.parseParam.ignoreEmpty) {
continue;
}
if (row.closed || this.conv.parseParam.alwaysSplitAtEOL) {
if (this.conv.parseRuntime.selectedColumns) {
csvLines.push(filterArray(row.cells, this.conv.parseRuntime.selectedColumns));
} else {
csvLines.push(row.cells);
}
left = "";
} else {
left = line + (getEol(line, this.conv.parseRuntime) || "\n");
}
}
return { rowsCells: csvLines, partial: left };
}
}
export interface MultipleRowResult {
rowsCells: string[][];
partial: string;
}
export interface RowSplitResult {
/**
* csv row array. ["a","b","c"]
*/
cells: string[],
/**
* if the passed fileline is a complete row
*/
closed: boolean
}

View File

@@ -0,0 +1,29 @@
{
"name": "rc",
"version": "1.2.8",
"description": "hardwired configuration loader",
"main": "index.js",
"browser": "browser.js",
"scripts": {
"test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js"
},
"repository": {
"type": "git",
"url": "https://github.com/dominictarr/rc.git"
},
"license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
"keywords": [
"config",
"rc",
"unix",
"defaults"
],
"bin": "./cli.js",
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
"dependencies": {
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
}
}

View File

@@ -0,0 +1,7 @@
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
declare function ensureNumber(value: any, options?: EnsureBaseOptions): number;
declare function ensureNumber(value: any, options?: EnsureBaseOptions & EnsureIsOptional): number | null;
declare function ensureNumber(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<number>): number;
export default ensureNumber;

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"B","2":"J D E F A CC"},B:{"2":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB","2":"DC tB I v J D E F A B C RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB","2":"RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"E F A B C LC 0B qB","2":"I v J D HC zB IC JC KC","129":"K L G rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB IB KB rB","2":"F B C GB HB JB 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e PC QC RC SC qB AC TC"},G:{"1":"E YC ZC aC bC cC dC eC fC","2":"zB UC BC VC WC XC","257":"gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"tB I sC BC tC uC","2":"f pC qC rC"},J:{"2":"D A"},K:{"1":"rB","2":"A B C h qB AC"},L:{"2":"H"},M:{"2":"H"},N:{"1":"B","2":"A"},O:{"2":"vC"},P:{"1":"I","2":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"2":"1B"},R:{"2":"9C"},S:{"1":"AD","2":"BD"}},B:7,C:"SPDY protocol"};

View File

@@ -0,0 +1,65 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var deprecation = require('deprecation');
var once = _interopDefault(require('once'));
const logOnceCode = once(deprecation => console.warn(deprecation));
const logOnceHeaders = once(deprecation => console.warn(deprecation));
/**
* Error with extra properties to help with debugging
*/
class RequestError extends Error {
constructor(message, statusCode, options) {
super(message);
// Maintains proper stack trace (only available on V8)
/* istanbul ignore next */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "HttpError";
this.status = statusCode;
let headers;
if ("headers" in options && typeof options.headers !== "undefined") {
headers = options.headers;
}
if ("response" in options) {
this.response = options.response;
headers = options.response.headers;
}
// redact request credentials without mutating original request options
const requestCopy = Object.assign({}, options.request);
if (options.request.headers.authorization) {
requestCopy.headers = Object.assign({}, options.request.headers, {
authorization: options.request.headers.authorization.replace(/ .*$/, " [REDACTED]")
});
}
requestCopy.url = requestCopy.url
// client_id & client_secret can be passed as URL query parameters to increase rate limit
// see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications
.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]")
// OAuth tokens can be passed as URL query parameters, although it is not recommended
// see https://developer.github.com/v3/#oauth2-token-sent-in-a-header
.replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
this.request = requestCopy;
// deprecations
Object.defineProperty(this, "code", {
get() {
logOnceCode(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
return statusCode;
}
});
Object.defineProperty(this, "headers", {
get() {
logOnceHeaders(new deprecation.Deprecation("[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`."));
return headers || {};
}
});
}
}
exports.RequestError = RequestError;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,80 @@
const SemVer = require('../classes/semver')
const Comparator = require('../classes/comparator')
const {ANY} = Comparator
const Range = require('../classes/range')
const satisfies = require('../functions/satisfies')
const gt = require('../functions/gt')
const lt = require('../functions/lt')
const lte = require('../functions/lte')
const gte = require('../functions/gte')
const outside = (version, range, hilo, options) => {
version = new SemVer(version, options)
range = new Range(range, options)
let gtfn, ltefn, ltfn, comp, ecomp
switch (hilo) {
case '>':
gtfn = gt
ltefn = lte
ltfn = lt
comp = '>'
ecomp = '>='
break
case '<':
gtfn = lt
ltefn = gte
ltfn = gt
comp = '<'
ecomp = '<='
break
default:
throw new TypeError('Must provide a hilo val of "<" or ">"')
}
// If it satisfies the range it is not outside
if (satisfies(version, range, options)) {
return false
}
// From now on, variable terms are as if we're in "gtr" mode.
// but note that everything is flipped for the "ltr" function.
for (let i = 0; i < range.set.length; ++i) {
const comparators = range.set[i]
let high = null
let low = null
comparators.forEach((comparator) => {
if (comparator.semver === ANY) {
comparator = new Comparator('>=0.0.0')
}
high = high || comparator
low = low || comparator
if (gtfn(comparator.semver, high.semver, options)) {
high = comparator
} else if (ltfn(comparator.semver, low.semver, options)) {
low = comparator
}
})
// If the edge version comparator has a operator then our version
// isn't outside it
if (high.operator === comp || high.operator === ecomp) {
return false
}
// If the lowest version comparator has an operator and our version
// is less than it then it isn't higher than the range
if ((!low.operator || low.operator === comp) &&
ltefn(version, low.semver)) {
return false
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
return false
}
}
return true
}
module.exports = outside

View File

@@ -0,0 +1,35 @@
// @ts-check
import { SyncWalker } from './sync.js';
import { AsyncWalker } from './async.js';
/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
/**
*
* @param {BaseNode} ast
* @param {{
* enter?: SyncHandler
* leave?: SyncHandler
* }} walker
* @returns {BaseNode}
*/
export function walk(ast, { enter, leave }) {
const instance = new SyncWalker(enter, leave);
return instance.visit(ast, null);
}
/**
*
* @param {BaseNode} ast
* @param {{
* enter?: AsyncHandler
* leave?: AsyncHandler
* }} walker
* @returns {Promise<BaseNode>}
*/
export async function asyncWalk(ast, { enter, leave }) {
const instance = new AsyncWalker(enter, leave);
return await instance.visit(ast, null);
}

View File

@@ -0,0 +1,39 @@
let flexSpec = require('./flex-spec')
let Declaration = require('../declaration')
class FlexShrink extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'flex-shrink'
}
/**
* Return flex property for 2012 spec
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012) {
return prefix + 'flex-negative'
}
return super.prefixed(prop, prefix)
}
/**
* Ignore 2009 spec and use flex property for 2012
*/
set(decl, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2012 || spec === 'final') {
return super.set(decl, prefix)
}
return undefined
}
}
FlexShrink.names = ['flex-shrink', 'flex-negative']
module.exports = FlexShrink

View File

@@ -0,0 +1,110 @@
export class CancelError extends Error {
constructor(reason) {
super(reason || 'Promise was canceled');
this.name = 'CancelError';
}
get isCanceled() {
return true;
}
}
// TODO: Use private class fields when ESLint 8 is out.
export default class PCancelable {
static fn(userFunction) {
return (...arguments_) => {
return new PCancelable((resolve, reject, onCancel) => {
arguments_.push(onCancel);
// eslint-disable-next-line promise/prefer-await-to-then
userFunction(...arguments_).then(resolve, reject);
});
};
}
constructor(executor) {
this._cancelHandlers = [];
this._isPending = true;
this._isCanceled = false;
this._rejectOnCancel = true;
this._promise = new Promise((resolve, reject) => {
this._reject = reject;
const onResolve = value => {
if (!this._isCanceled || !onCancel.shouldReject) {
this._isPending = false;
resolve(value);
}
};
const onReject = error => {
this._isPending = false;
reject(error);
};
const onCancel = handler => {
if (!this._isPending) {
throw new Error('The `onCancel` handler was attached after the promise settled.');
}
this._cancelHandlers.push(handler);
};
Object.defineProperties(onCancel, {
shouldReject: {
get: () => this._rejectOnCancel,
set: boolean => {
this._rejectOnCancel = boolean;
}
}
});
executor(onResolve, onReject, onCancel);
});
}
then(onFulfilled, onRejected) {
// eslint-disable-next-line promise/prefer-await-to-then
return this._promise.then(onFulfilled, onRejected);
}
catch(onRejected) {
// eslint-disable-next-line promise/prefer-await-to-then
return this._promise.catch(onRejected);
}
finally(onFinally) {
// eslint-disable-next-line promise/prefer-await-to-then
return this._promise.finally(onFinally);
}
cancel(reason) {
if (!this._isPending || this._isCanceled) {
return;
}
this._isCanceled = true;
if (this._cancelHandlers.length > 0) {
try {
for (const handler of this._cancelHandlers) {
handler();
}
} catch (error) {
this._reject(error);
return;
}
}
if (this._rejectOnCancel) {
this._reject(new CancelError(reason));
}
}
get isCanceled() {
return this._isCanceled;
}
}
Object.setPrototypeOf(PCancelable.prototype, Promise.prototype);

View File

@@ -0,0 +1,21 @@
var eq = require('./eq');
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;

View File

@@ -0,0 +1,108 @@
import { SHA2 } from './_sha2.js';
import { wrapConstructor } from './utils.js';
// https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
// https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
const Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
const Id = Uint8Array.from({ length: 16 }, (_, i) => i);
const Pi = Id.map((i) => (9 * i + 5) % 16);
let idxL = [Id];
let idxR = [Pi];
for (let i = 0; i < 4; i++) for (let j of [idxL, idxR]) j.push(j[i].map((k) => Rho[k]));
const shifts = [
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],
].map((i) => new Uint8Array(i));
const shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
const shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
const Kl = new Uint32Array([0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]);
const Kr = new Uint32Array([0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]);
// The rotate left (circular left shift) operation for uint32
const rotl = (word: number, shift: number) => (word << shift) | (word >>> (32 - shift));
// It's called f() in spec.
function f(group: number, x: number, y: number, z: number): number {
if (group === 0) return x ^ y ^ z;
else if (group === 1) return (x & y) | (~x & z);
else if (group === 2) return (x | ~y) ^ z;
else if (group === 3) return (x & z) | (y & ~z);
else return x ^ (y | ~z);
}
// Temporary buffer, not used to store anything between runs
const BUF = new Uint32Array(16);
export class RIPEMD160 extends SHA2<RIPEMD160> {
private h0 = 0x67452301 | 0;
private h1 = 0xefcdab89 | 0;
private h2 = 0x98badcfe | 0;
private h3 = 0x10325476 | 0;
private h4 = 0xc3d2e1f0 | 0;
constructor() {
super(64, 20, 8, true);
}
protected get(): [number, number, number, number, number] {
const { h0, h1, h2, h3, h4 } = this;
return [h0, h1, h2, h3, h4];
}
protected set(h0: number, h1: number, h2: number, h3: number, h4: number) {
this.h0 = h0 | 0;
this.h1 = h1 | 0;
this.h2 = h2 | 0;
this.h3 = h3 | 0;
this.h4 = h4 | 0;
}
protected process(view: DataView, offset: number): void {
for (let i = 0; i < 16; i++, offset += 4) BUF[i] = view.getUint32(offset, true);
// prettier-ignore
let al = this.h0 | 0, ar = al,
bl = this.h1 | 0, br = bl,
cl = this.h2 | 0, cr = cl,
dl = this.h3 | 0, dr = dl,
el = this.h4 | 0, er = el;
// Instead of iterating 0 to 80, we split it into 5 groups
// And use the groups in constants, functions, etc. Much simpler
for (let group = 0; group < 5; group++) {
const rGroup = 4 - group;
const hbl = Kl[group], hbr = Kr[group]; // prettier-ignore
const rl = idxL[group], rr = idxR[group]; // prettier-ignore
const sl = shiftsL[group], sr = shiftsR[group]; // prettier-ignore
for (let i = 0; i < 16; i++) {
const tl = (rotl(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el) | 0;
al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore
}
// 2 loops are 10% faster
for (let i = 0; i < 16; i++) {
const tr = (rotl(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er) | 0;
ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore
}
}
// Add the compressed chunk to the current hash value
this.set(
(this.h1 + cl + dr) | 0,
(this.h2 + dl + er) | 0,
(this.h3 + el + ar) | 0,
(this.h4 + al + br) | 0,
(this.h0 + bl + cr) | 0
);
}
protected roundClean() {
BUF.fill(0);
}
destroy() {
this.destroyed = true;
this.buffer.fill(0);
this.set(0, 0, 0, 0, 0);
}
}
/**
* RIPEMD-160 - a hash function from 1990s.
* @param message - msg that would be hashed
*/
export const ripemd160 = wrapConstructor(() => new RIPEMD160());

View File

@@ -0,0 +1,23 @@
'use strict';
var inspect = require('../');
var Buffer = require('safer-buffer').Buffer;
var holes = ['a', 'b'];
holes[4] = 'e';
holes[6] = 'g';
var obj = {
a: 1,
b: [3, 4, undefined, null],
c: undefined,
d: null,
e: {
regex: /^x/i,
buf: Buffer.from('abc'),
holes: holes
},
now: new Date()
};
obj.self = obj;
console.log(inspect(obj));

View File

@@ -0,0 +1,39 @@
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';
import { innerFrom } from '../observable/innerFrom';
export function sequenceEqual(compareTo, comparator = (a, b) => a === b) {
return operate((source, subscriber) => {
const aState = createState();
const bState = createState();
const emit = (isEqual) => {
subscriber.next(isEqual);
subscriber.complete();
};
const createSubscriber = (selfState, otherState) => {
const sequenceEqualSubscriber = createOperatorSubscriber(subscriber, (a) => {
const { buffer, complete } = otherState;
if (buffer.length === 0) {
complete ? emit(false) : selfState.buffer.push(a);
}
else {
!comparator(a, buffer.shift()) && emit(false);
}
}, () => {
selfState.complete = true;
const { complete, buffer } = otherState;
complete && emit(buffer.length === 0);
sequenceEqualSubscriber === null || sequenceEqualSubscriber === void 0 ? void 0 : sequenceEqualSubscriber.unsubscribe();
});
return sequenceEqualSubscriber;
};
source.subscribe(createSubscriber(aState, bState));
innerFrom(compareTo).subscribe(createSubscriber(bState, aState));
});
}
function createState() {
return {
buffer: [],
complete: false,
};
}
//# sourceMappingURL=sequenceEqual.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Subject.js","sourceRoot":"","sources":["../../../src/internal/Subject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA0C;AAE1C,+CAAkE;AAElE,0EAAyE;AACzE,8CAA6C;AAC7C,oDAAmD;AASnD;IAAgC,2BAAa;IAwB3C;QAAA,YAEE,iBAAO,SACR;QA1BD,YAAM,GAAG,KAAK,CAAC;QAEP,sBAAgB,GAAyB,IAAI,CAAC;QAGtD,eAAS,GAAkB,EAAE,CAAC;QAE9B,eAAS,GAAG,KAAK,CAAC;QAElB,cAAQ,GAAG,KAAK,CAAC;QAEjB,iBAAW,GAAQ,IAAI,CAAC;;IAexB,CAAC;IAGD,sBAAI,GAAJ,UAAQ,QAAwB;QAC9B,IAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,OAAO,CAAC,QAAQ,GAAG,QAAe,CAAC;QACnC,OAAO,OAAc,CAAC;IACxB,CAAC;IAGS,gCAAc,GAAxB;QACE,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,IAAI,iDAAuB,EAAE,CAAC;SACrC;IACH,CAAC;IAED,sBAAI,GAAJ,UAAK,KAAQ;QAAb,iBAYC;QAXC,2BAAY,CAAC;;YACX,KAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,KAAI,CAAC,SAAS,EAAE;gBACnB,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;oBAC1B,KAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;iBACpD;;oBACD,KAAuB,IAAA,KAAA,SAAA,KAAI,CAAC,gBAAgB,CAAA,gBAAA,4BAAE;wBAAzC,IAAM,QAAQ,WAAA;wBACjB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBACtB;;;;;;;;;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,uBAAK,GAAL,UAAM,GAAQ;QAAd,iBAYC;QAXC,2BAAY,CAAC;YACX,KAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,KAAI,CAAC,SAAS,EAAE;gBACnB,KAAI,CAAC,QAAQ,GAAG,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBACtC,KAAI,CAAC,WAAW,GAAG,GAAG,CAAC;gBACf,IAAA,SAAS,GAAK,KAAI,UAAT,CAAU;gBAC3B,OAAO,SAAS,CAAC,MAAM,EAAE;oBACvB,SAAS,CAAC,KAAK,EAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBAC/B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,0BAAQ,GAAR;QAAA,iBAWC;QAVC,2BAAY,CAAC;YACX,KAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,KAAI,CAAC,SAAS,EAAE;gBACnB,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBACd,IAAA,SAAS,GAAK,KAAI,UAAT,CAAU;gBAC3B,OAAO,SAAS,CAAC,MAAM,EAAE;oBACvB,SAAS,CAAC,KAAK,EAAG,CAAC,QAAQ,EAAE,CAAC;iBAC/B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,6BAAW,GAAX;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,GAAG,IAAK,CAAC;IACjD,CAAC;IAED,sBAAI,6BAAQ;aAAZ;;YACE,OAAO,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,MAAM,IAAG,CAAC,CAAC;QACpC,CAAC;;;OAAA;IAGS,+BAAa,GAAvB,UAAwB,UAAyB;QAC/C,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,iBAAM,aAAa,YAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAGS,4BAAU,GAApB,UAAqB,UAAyB;QAC5C,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAGS,iCAAe,GAAzB,UAA0B,UAA2B;QAArD,iBAWC;QAVO,IAAA,KAAqC,IAAI,EAAvC,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,SAAS,eAAS,CAAC;QAChD,IAAI,QAAQ,IAAI,SAAS,EAAE;YACzB,OAAO,iCAAkB,CAAC;SAC3B;QACD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,OAAO,IAAI,2BAAY,CAAC;YACtB,KAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,qBAAS,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAGS,yCAAuB,GAAjC,UAAkC,UAA2B;QACrD,IAAA,KAAuC,IAAI,EAAzC,QAAQ,cAAA,EAAE,WAAW,iBAAA,EAAE,SAAS,eAAS,CAAC;QAClD,IAAI,QAAQ,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SAC/B;aAAM,IAAI,SAAS,EAAE;YACpB,UAAU,CAAC,QAAQ,EAAE,CAAC;SACvB;IACH,CAAC;IAQD,8BAAY,GAAZ;QACE,IAAM,UAAU,GAAQ,IAAI,uBAAU,EAAK,CAAC;QAC5C,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC;QACzB,OAAO,UAAU,CAAC;IACpB,CAAC;IAxHM,cAAM,GAA4B,UAAI,WAAwB,EAAE,MAAqB;QAC1F,OAAO,IAAI,gBAAgB,CAAI,WAAW,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC,CAAC;IAuHJ,cAAC;CAAA,AA7ID,CAAgC,uBAAU,GA6IzC;AA7IY,0BAAO;AAkJpB;IAAyC,oCAAU;IACjD,0BAES,WAAyB,EAChC,MAAsB;QAHxB,YAKE,iBAAO,SAER;QALQ,iBAAW,GAAX,WAAW,CAAc;QAIhC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACvB,CAAC;IAED,+BAAI,GAAJ,UAAK,KAAQ;;QACX,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,mDAAG,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,gCAAK,GAAL,UAAM,GAAQ;;QACZ,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,mDAAG,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,mCAAQ,GAAR;;QACE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,QAAQ,kDAAI,CAAC;IACjC,CAAC;IAGS,qCAAU,GAApB,UAAqB,UAAyB;;QAC5C,OAAO,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,SAAS,CAAC,UAAU,CAAC,mCAAI,iCAAkB,CAAC;IAClE,CAAC;IACH,uBAAC;AAAD,CAAC,AA1BD,CAAyC,OAAO,GA0B/C;AA1BY,4CAAgB"}

View File

@@ -0,0 +1 @@
{"name":"tslib","version":"2.5.0","files":{"tslib.es6.js":{"checkedAt":1678883668057,"integrity":"sha512-iJBLvRkRbcHn9ZlTLF62gEi3XJj/WLITDm61Uh1YRy722MHNxL5LWF3GnJ6d0iYGlaie/zEkiFlXmf4GbBl+RA==","mode":420,"size":14764},"tslib.html":{"checkedAt":1678883668057,"integrity":"sha512-4dCvZ5WYJpcbIJY4RPUhOBbFud1156Rr7RphuR12/+mXKUeIpCxol2/uWL4WDFNNlSH909M2AY4fiLWJo8+fTw==","mode":420,"size":32},"tslib.es6.html":{"checkedAt":1678883668058,"integrity":"sha512-aoAR2zaxE9UtcXO4kE9FbPBgIZEVk7u3Z+nEPmDo6rwcYth07KxrVZejVEdy2XmKvkkcb8O/XM9UK3bPc1iMPw==","mode":420,"size":36},"modules/index.js":{"checkedAt":1678883668059,"integrity":"sha512-H4jCpib5QN/bVUWZzeXfLKv0LCDC9p08okLfMGA9NDmYQ1HmZ9cY4kUEv/hvQa6t8kJUsqMLnMLy1z9c/NRGbg==","mode":420,"size":1205},"modules/package.json":{"checkedAt":1678883668062,"integrity":"sha512-vm8hQn5MuoMkjJYvBBHTAtsdrcuXmVrKZwL3FEq32oGiKFhY562FoUQTbXv24wk0rwJVpgribUCOIU98IaS9Mg==","mode":420,"size":26},"package.json":{"checkedAt":1678883668062,"integrity":"sha512-n16r+LCqvJrn94zZpSK5344UYenJ3MdKoK0YmNyYkoG56cKeErPDg0f7UjXvs39tyijbbWBca/lsayZfcb9K5A==","mode":420,"size":936},"README.md":{"checkedAt":1678883668062,"integrity":"sha512-Ucr8faXSw4RqSbKOZN69YJami3mgE41zHMxceAJFMMSCrZEfNFbJK/jJIkyahwRzjZNMUvcuiOxPyCWveLVoEQ==","mode":420,"size":4032},"SECURITY.md":{"checkedAt":1678883668062,"integrity":"sha512-ix30VBNb4RQLa5M2jgfD6IJ9+1XKmeREKrOYv7rDoWGZCin0605vEx3tTAVb5kNvteCwZwBC+nEGfQ4jHLg9Fw==","mode":420,"size":2757},"tslib.js":{"checkedAt":1678883668062,"integrity":"sha512-Cap2y+21SKP5UoO9IyDJyXco7qLQLLWUt1WMgx5yX5l2rMLMgoPuvcs/Jscmu2xLBG+6KCzZ9ZsZwb+GqOCwRg==","mode":420,"size":18367},"LICENSE.txt":{"checkedAt":1678883668066,"integrity":"sha512-9cs1Im06/fLAPBpXOY8fHMD2LgUM3kREaKlOX7S6fLWwbG5G+UqlUrqdkTKloRPeDghECezxOiUfzvW6lnEjDg==","mode":420,"size":655},"CopyrightNotice.txt":{"checkedAt":1678883668069,"integrity":"sha512-C0myUddnUhhpZ/UcD9yZyMWodQV4fT2wxcfqb/ToD0Z98nB9WfWBl6koNVWJ+8jzeGWP6wQjz9zdX7Unua0/SQ==","mode":420,"size":822},"tslib.d.ts":{"checkedAt":1678883668069,"integrity":"sha512-OFTkVy6JRCQeIx8fkIfmwaocsAz0CLH6/++19IX/qUvwKHpW8KoueSO6nZs2+se9JUoK2m+i6Gps573l2uzENA==","mode":420,"size":16411}}}

View File

@@ -0,0 +1,29 @@
import { ObservableInputTuple, OperatorFunction, Cons } from '../types';
import { zip } from './zip';
/**
* Subscribes to the source, and the observable inputs provided as arguments, and combines their values, by index, into arrays.
*
* What is meant by "combine by index": The first value from each will be made into a single array, then emitted,
* then the second value from each will be combined into a single array and emitted, then the third value
* from each will be combined into a single array and emitted, and so on.
*
* This will continue until it is no longer able to combine values of the same index into an array.
*
* After the last value from any one completed source is emitted in an array, the resulting observable will complete,
* as there is no way to continue "zipping" values together by index.
*
* Use-cases for this operator are limited. There are memory concerns if one of the streams is emitting
* values at a much faster rate than the others. Usage should likely be limited to streams that emit
* at a similar pace, or finite streams of known length.
*
* In many cases, authors want `combineLatestWith` and not `zipWith`.
*
* @param otherInputs other observable inputs to collate values from.
* @return A function that returns an Observable that emits items by index
* combined from the source Observable and provided Observables, in form of an
* array.
*/
export function zipWith<T, A extends readonly unknown[]>(...otherInputs: [...ObservableInputTuple<A>]): OperatorFunction<T, Cons<T, A>> {
return zip(...otherInputs);
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../../src/internal/operators/buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAwCpD,MAAM,UAAU,MAAM,CAAI,eAAqC;IAC7D,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAEhC,IAAI,aAAa,GAAQ,EAAE,CAAC;QAG5B,MAAM,CAAC,SAAS,CACd,wBAAwB,CACtB,UAAU,EACV,UAAC,KAAK,IAAK,OAAA,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAzB,CAAyB,EACpC;YACE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/B,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CACF,CACF,CAAC;QAGF,SAAS,CAAC,eAAe,CAAC,CAAC,SAAS,CAClC,wBAAwB,CACtB,UAAU,EACV;YAEE,IAAM,CAAC,GAAG,aAAa,CAAC;YACxB,aAAa,GAAG,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,EACD,IAAI,CACL,CACF,CAAC;QAEF,OAAO;YAEL,aAAa,GAAG,IAAK,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,5 @@
"use strict";
var isInteger = require("./is-integer");
module.exports = function (num) { return isInteger(num) && num >= 0; };

View File

@@ -0,0 +1,8 @@
TIMESTAMP,UPDATE,UID,BYTES SENT,BYTES RCVED
"13954264""22","n",""10028"",""1213"",""5461""
"abc, def, ccc", n,10013,9954,13560
1395426422,n,10013,9954,13560
1395426422,n,10109,221391500,141836
1395426422,n,10007,53448,308549
1395426422,n,10022,15506,72125

View File

@@ -0,0 +1,15 @@
var test = require('tape');
var inspect = require('../');
var xs = ['a', 'b'];
xs[5] = 'f';
xs[7] = 'j';
xs[8] = 'k';
test('holes', function (t) {
t.plan(1);
t.equal(
inspect(xs),
"[ 'a', 'b', , , , 'f', , 'j', 'k' ]"
);
});

View File

@@ -0,0 +1,3 @@
"use strict";
module.exports = require("./is-implemented")() ? Math.tanh : require("./shim");

View File

@@ -0,0 +1,91 @@
{
"name": "source-map",
"description": "Generates and consumes source maps",
"version": "0.7.4",
"homepage": "https://github.com/mozilla/source-map",
"author": "Nick Fitzgerald <nfitzgerald@mozilla.com>",
"contributors": [
"Tobias Koppers <tobias.koppers@googlemail.com>",
"Duncan Beevers <duncan@dweebd.com>",
"Stephen Crane <scrane@mozilla.com>",
"Ryan Seddon <seddon.ryan@gmail.com>",
"Miles Elam <miles.elam@deem.com>",
"Mihai Bazon <mihai.bazon@gmail.com>",
"Michael Ficarra <github.public.email@michael.ficarra.me>",
"Todd Wolfson <todd@twolfson.com>",
"Alexander Solovyov <alexander@solovyov.net>",
"Felix Gnass <fgnass@gmail.com>",
"Conrad Irwin <conrad.irwin@gmail.com>",
"usrbincc <usrbincc@yahoo.com>",
"David Glasser <glasser@davidglasser.net>",
"Chase Douglas <chase@newrelic.com>",
"Evan Wallace <evan.exe@gmail.com>",
"Heather Arthur <fayearthur@gmail.com>",
"Hugh Kennedy <hughskennedy@gmail.com>",
"David Glasser <glasser@davidglasser.net>",
"Simon Lydell <simon.lydell@gmail.com>",
"Jmeas Smith <jellyes2@gmail.com>",
"Michael Z Goddard <mzgoddard@gmail.com>",
"azu <azu@users.noreply.github.com>",
"John Gozde <john@gozde.ca>",
"Adam Kirkton <akirkton@truefitinnovation.com>",
"Chris Montgomery <christopher.montgomery@dowjones.com>",
"J. Ryan Stinnett <jryans@gmail.com>",
"Jack Herrington <jherrington@walmartlabs.com>",
"Chris Truter <jeffpalentine@gmail.com>",
"Daniel Espeset <daniel@danielespeset.com>",
"Jamie Wong <jamie.lf.wong@gmail.com>",
"Eddy Bruël <ejpbruel@mozilla.com>",
"Hawken Rives <hawkrives@gmail.com>",
"Gilad Peleg <giladp007@gmail.com>",
"djchie <djchie.dev@gmail.com>",
"Gary Ye <garysye@gmail.com>",
"Nicolas Lalevée <nicolas.lalevee@hibnet.org>"
],
"repository": {
"type": "git",
"url": "http://github.com/mozilla/source-map.git"
},
"main": "./source-map.js",
"types": "./source-map.d.ts",
"files": [
"source-map.js",
"source-map.d.ts",
"lib/",
"dist/source-map.js"
],
"engines": {
"node": ">= 8"
},
"license": "BSD-3-Clause",
"scripts": {
"lint": "eslint *.js lib/ test/",
"prebuild": "npm run lint",
"build": "webpack --color",
"pretest": "npm run build",
"test": "node test/run-tests.js",
"precoverage": "npm run build",
"coverage": "nyc node test/run-tests.js",
"setup": "mkdir -p coverage && cp -n .waiting.html coverage/index.html || true",
"dev:live": "live-server --port=4103 --ignorePattern='(js|css|png)$' coverage",
"dev:watch": "watch 'npm run coverage' lib/ test/",
"predev": "npm run setup",
"dev": "npm-run-all -p --silent dev:*",
"clean": "rm -rf coverage .nyc_output",
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
},
"devDependencies": {
"doctoc": "^1.3.1",
"eslint": "^4.19.1",
"live-server": "^1.2.0",
"npm-run-all": "^4.1.2",
"nyc": "^11.7.1",
"watch": "^1.0.2",
"webpack": "^4.9.1",
"webpack-cli": "^3.1"
},
"nyc": {
"reporter": "html"
},
"typings": "source-map"
}

View File

@@ -0,0 +1,5 @@
import { Observable } from '../Observable';
export function fromSubscribable(subscribable) {
return new Observable(function (subscriber) { return subscribable.subscribe(subscriber); });
}
//# sourceMappingURL=fromSubscribable.js.map

View File

@@ -0,0 +1,87 @@
// Dependencies
import parsePath from "parse-path";
import normalizeUrl from "normalize-url";
/**
* parseUrl
* Parses the input url.
*
* **Note**: This *throws* if invalid urls are provided.
*
* @name parseUrl
* @function
* @param {String} url The input url.
* @param {Boolean|Object} normalize Whether to normalize the url or not.
* Default is `false`. If `true`, the url will
* be normalized. If an object, it will be the
* options object sent to [`normalize-url`](https://github.com/sindresorhus/normalize-url).
*
* For SSH urls, normalize won't work.
*
* @return {Object} An object containing the following fields:
*
* - `protocols` (Array): An array with the url protocols (usually it has one element).
* - `protocol` (String): The first protocol, `"ssh"` (if the url is a ssh url) or `"file"`.
* - `port` (null|Number): The domain port.
* - `resource` (String): The url domain (including subdomains).
* - `user` (String): The authentication user (usually for ssh urls).
* - `pathname` (String): The url pathname.
* - `hash` (String): The url hash.
* - `search` (String): The url querystring value.
* - `href` (String): The input url.
* - `query` (Object): The url querystring, parsed as object.
* - `parse_failed` (Boolean): Whether the parsing failed or not.
*/
const parseUrl = (url, normalize = false) => {
// Constants
const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:]([\~,\.\w,\-,\_,\/]+?(?:\.git|\/)?)$/
const throwErr = msg => {
const err = new Error(msg)
err.subject_url = url
throw err
}
if (typeof url !== "string" || !url.trim()) {
throwErr("Invalid url.")
}
if (url.length > parseUrl.MAX_INPUT_LENGTH) {
throwErr("Input exceeds maximum length. If needed, change the value of parseUrl.MAX_INPUT_LENGTH.")
}
if (normalize) {
if (typeof normalize !== "object") {
normalize = {
stripHash: false
}
}
url = normalizeUrl(url, normalize)
}
const parsed = parsePath(url)
// Potential git-ssh urls
if (parsed.parse_failed) {
const matched = parsed.href.match(GIT_RE)
if (matched) {
parsed.protocols = ["ssh"]
parsed.protocol = "ssh"
parsed.resource = matched[2]
parsed.host = matched[2]
parsed.user = matched[1]
parsed.pathname = `/${matched[3]}`
parsed.parse_failed = false
} else {
throwErr("URL parsing failed.")
}
}
return parsed;
}
parseUrl.MAX_INPUT_LENGTH = 2048
export default parseUrl;

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC","2":"DC tB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"I v J D"},E:{"1":"I v J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"HC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G M N O w g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e RC SC qB AC TC rB","2":"F PC QC"},G:{"1":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"tB I f rC sC BC tC uC","16":"pC qC"},J:{"1":"D A"},K:{"1":"B C h qB AC rB","16":"A"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:6,C:"Wav audio format"};

View File

@@ -0,0 +1,19 @@
import { ReplaySubject } from '../ReplaySubject';
import { share } from './share';
export function shareReplay(configOrBufferSize, windowTime, scheduler) {
let bufferSize;
let refCount = false;
if (configOrBufferSize && typeof configOrBufferSize === 'object') {
({ bufferSize = Infinity, windowTime = Infinity, refCount = false, scheduler } = configOrBufferSize);
}
else {
bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);
}
return share({
connector: () => new ReplaySubject(bufferSize, windowTime, scheduler),
resetOnError: true,
resetOnComplete: false,
resetOnRefCountZero: refCount,
});
}
//# sourceMappingURL=shareReplay.js.map

View File

@@ -0,0 +1,102 @@
export type Options = {
/**
Uppercase the first character: `foo-bar` → `FooBar`.
@default false
*/
readonly pascalCase?: boolean;
/**
Preserve consecutive uppercase characters: `foo-BAR` → `FooBAR`.
@default false
*/
readonly preserveConsecutiveUppercase?: boolean;
/**
The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used.
Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm.
Default: The host environments current locale.
@example
```
import camelCase from 'camelcase';
camelCase('lorem-ipsum', {locale: 'en-US'});
//=> 'loremIpsum'
camelCase('lorem-ipsum', {locale: 'tr-TR'});
//=> 'loremİpsum'
camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});
//=> 'loremIpsum'
camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});
//=> 'loremİpsum'
```
*/
readonly locale?: false | string | readonly string[];
};
/**
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
Correctly handles Unicode strings.
@param input - String to convert to camel case.
@example
```
import camelCase from 'camelcase';
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('розовый_пушистый_единорог');
//=> 'розовыйПушистыйЕдинорог'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('Foo-BAR', {preserveConsecutiveUppercase: true});
//=> 'fooBAR'
camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true}));
//=> 'FooBAR'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true})
//=> 'FooBAR'
camelCase('lorem-ipsum', {locale: 'en-US'});
//=> 'loremIpsum'
```
*/
export default function camelcase(
input: string | readonly string[],
options?: Options
): string;

View File

@@ -0,0 +1,32 @@
import { Observable } from '../Observable';
import { innerFrom } from './innerFrom';
import { argsOrArgArray } from '../util/argsOrArgArray';
import { createOperatorSubscriber } from '../operators/OperatorSubscriber';
export function race() {
var sources = [];
for (var _i = 0; _i < arguments.length; _i++) {
sources[_i] = arguments[_i];
}
sources = argsOrArgArray(sources);
return sources.length === 1 ? innerFrom(sources[0]) : new Observable(raceInit(sources));
}
export function raceInit(sources) {
return function (subscriber) {
var subscriptions = [];
var _loop_1 = function (i) {
subscriptions.push(innerFrom(sources[i]).subscribe(createOperatorSubscriber(subscriber, function (value) {
if (subscriptions) {
for (var s = 0; s < subscriptions.length; s++) {
s !== i && subscriptions[s].unsubscribe();
}
subscriptions = null;
}
subscriber.next(value);
})));
};
for (var i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) {
_loop_1(i);
}
};
}
//# sourceMappingURL=race.js.map

View File

@@ -0,0 +1,57 @@
require('./global');
global.config.fatal = true;
global.target = {};
var args = process.argv.slice(2),
targetArgs,
dashesLoc = args.indexOf('--');
// split args, everything after -- if only for targets
if (dashesLoc > -1) {
targetArgs = args.slice(dashesLoc + 1, args.length);
args = args.slice(0, dashesLoc);
}
// This ensures we only execute the script targets after the entire script has
// been evaluated
setTimeout(function() {
var t;
if (args.length === 1 && args[0] === '--help') {
console.log('Available targets:');
for (t in global.target)
console.log(' ' + t);
return;
}
// Wrap targets to prevent duplicate execution
for (t in global.target) {
(function(t, oldTarget){
// Wrap it
global.target[t] = function() {
if (!oldTarget.done){
oldTarget.done = true;
oldTarget.result = oldTarget.apply(oldTarget, arguments);
}
return oldTarget.result;
};
})(t, global.target[t]);
}
// Execute desired targets
if (args.length > 0) {
args.forEach(function(arg) {
if (arg in global.target)
global.target[arg](targetArgs);
else {
console.log('no such target: ' + arg);
}
});
} else if ('all' in global.target) {
global.target.all(targetArgs);
}
}, 0);

View File

@@ -0,0 +1,54 @@
import type {CamelCase} from './camel-case';
/**
Convert object properties to camel case recursively.
This can be useful when, for example, converting some API types from a different style.
@see CamelCasedProperties
@see CamelCase
@example
```
import type {CamelCasedPropertiesDeep} from 'type-fest';
interface User {
UserId: number;
UserName: string;
}
interface UserWithFriends {
UserInfo: User;
UserFriends: User[];
}
const result: CamelCasedPropertiesDeep<UserWithFriends> = {
userInfo: {
userId: 1,
userName: 'Tom',
},
userFriends: [
{
userId: 2,
userName: 'Jerry',
},
{
userId: 3,
userName: 'Spike',
},
],
};
```
@category Change case
@category Template literal
@category Object
*/
export type CamelCasedPropertiesDeep<Value> = Value extends Function
? Value
: Value extends Array<infer U>
? Array<CamelCasedPropertiesDeep<U>>
: Value extends Set<infer U>
? Set<CamelCasedPropertiesDeep<U>> : {
[K in keyof Value as CamelCase<K>]: CamelCasedPropertiesDeep<Value[K]>;
};

View File

@@ -0,0 +1,7 @@
import type Context from '../Context';
export default class Search {
private globalSearch;
constructor(context: Context);
set(value: string, scope?: string[]): void;
remove(): void;
}

View File

@@ -0,0 +1,263 @@
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import type { Buffer } from 'node:buffer';
import type { URL } from 'node:url';
import type { CancelableRequest } from './as-promise/types.js';
import type { Response } from './core/response.js';
import type Options from './core/options.js';
import type { PaginationOptions, OptionsInit } from './core/options.js';
import type Request from './core/index.js';
type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
/**
Defaults for each Got instance.
*/
export type InstanceDefaults = {
/**
An object containing the default options of Got.
*/
options: Options;
/**
An array of functions. You execute them directly by calling `got()`.
They are some sort of "global hooks" - these functions are called first.
The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on the `options.isStream` property.
@default []
*/
handlers: HandlerFunction[];
/**
A read-only boolean describing whether the defaults are mutable or not.
If set to `true`, you can update headers over time, for example, update an access token when it expires.
@default false
*/
mutableDefaults: boolean;
};
/**
A Request object returned by calling Got, or any of the Got HTTP alias request functions.
*/
export type GotReturn = Request | CancelableRequest;
/**
A function to handle options and returns a Request object.
It acts sort of like a "global hook", and will be called before any actual request is made.
*/
export type HandlerFunction = <T extends GotReturn>(options: Options, next: (options: Options) => T) => T | Promise<T>;
/**
The options available for `got.extend()`.
*/
export type ExtendOptions = {
/**
An array of functions. You execute them directly by calling `got()`.
They are some sort of "global hooks" - these functions are called first.
The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on the `options.isStream` property.
@default []
*/
handlers?: HandlerFunction[];
/**
A read-only boolean describing whether the defaults are mutable or not.
If set to `true`, you can update headers over time, for example, update an access token when it expires.
@default false
*/
mutableDefaults?: boolean;
} & OptionsInit;
export type OptionsOfTextResponseBody = Merge<OptionsInit, {
isStream?: false;
resolveBodyOnly?: false;
responseType?: 'text';
}>;
export type OptionsOfJSONResponseBody = Merge<OptionsInit, {
isStream?: false;
resolveBodyOnly?: false;
responseType?: 'json';
}>;
export type OptionsOfBufferResponseBody = Merge<OptionsInit, {
isStream?: false;
resolveBodyOnly?: false;
responseType: 'buffer';
}>;
export type OptionsOfUnknownResponseBody = Merge<OptionsInit, {
isStream?: false;
resolveBodyOnly?: false;
}>;
export type StrictOptions = Except<OptionsInit, 'isStream' | 'responseType' | 'resolveBodyOnly'>;
export type StreamOptions = Merge<OptionsInit, {
isStream?: true;
}>;
type ResponseBodyOnly = {
resolveBodyOnly: true;
};
export type OptionsWithPagination<T = unknown, R = unknown> = Merge<OptionsInit, {
pagination?: PaginationOptions<T, R>;
}>;
/**
An instance of `got.paginate`.
*/
export type GotPaginate = {
/**
Same as `GotPaginate.each`.
*/
<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
/**
Same as `GotPaginate.each`.
*/
<T, R = unknown>(options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
/**
Returns an async iterator.
See pagination.options for more pagination options.
@example
```
import got from 'got';
const countLimit = 10;
const pagination = got.paginate('https://api.github.com/repos/sindresorhus/got/commits', {
pagination: {countLimit}
});
console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
for await (const commitData of pagination) {
console.log(commitData.commit.message);
}
```
*/
each: (<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>) => AsyncIterableIterator<T>) & (<T, R = unknown>(options?: OptionsWithPagination<T, R>) => AsyncIterableIterator<T>);
/**
Returns a Promise for an array of all results.
See pagination.options for more pagination options.
@example
```
import got from 'got';
const countLimit = 10;
const results = await got.paginate.all('https://api.github.com/repos/sindresorhus/got/commits', {
pagination: {countLimit}
});
console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
console.log(results);
```
*/
all: (<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>) => Promise<T[]>) & (<T, R = unknown>(options?: OptionsWithPagination<T, R>) => Promise<T[]>);
};
export type GotRequestFunction = {
(url: string | URL, options?: OptionsOfTextResponseBody): CancelableRequest<Response<string>>;
<T>(url: string | URL, options?: OptionsOfJSONResponseBody): CancelableRequest<Response<T>>;
(url: string | URL, options?: OptionsOfBufferResponseBody): CancelableRequest<Response<Buffer>>;
(url: string | URL, options?: OptionsOfUnknownResponseBody): CancelableRequest<Response>;
(options: OptionsOfTextResponseBody): CancelableRequest<Response<string>>;
<T>(options: OptionsOfJSONResponseBody): CancelableRequest<Response<T>>;
(options: OptionsOfBufferResponseBody): CancelableRequest<Response<Buffer>>;
(options: OptionsOfUnknownResponseBody): CancelableRequest<Response>;
(url: string | URL, options?: (Merge<OptionsOfTextResponseBody, ResponseBodyOnly>)): CancelableRequest<string>;
<T>(url: string | URL, options?: (Merge<OptionsOfJSONResponseBody, ResponseBodyOnly>)): CancelableRequest<T>;
(url: string | URL, options?: (Merge<OptionsOfBufferResponseBody, ResponseBodyOnly>)): CancelableRequest<Buffer>;
(options: (Merge<OptionsOfTextResponseBody, ResponseBodyOnly>)): CancelableRequest<string>;
<T>(options: (Merge<OptionsOfJSONResponseBody, ResponseBodyOnly>)): CancelableRequest<T>;
(options: (Merge<OptionsOfBufferResponseBody, ResponseBodyOnly>)): CancelableRequest<Buffer>;
(url: string | URL, options?: Merge<OptionsInit, {
isStream: true;
}>): Request;
(options: Merge<OptionsInit, {
isStream: true;
}>): Request;
(url: string | URL, options?: OptionsInit): CancelableRequest | Request;
(options: OptionsInit): CancelableRequest | Request;
(url: undefined, options: undefined, defaults: Options): CancelableRequest | Request;
};
/**
All available HTTP request methods provided by Got.
*/
export type HTTPAlias = 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete';
type GotStreamFunction = ((url?: string | URL, options?: Merge<OptionsInit, {
isStream?: true;
}>) => Request) & ((options?: Merge<OptionsInit, {
isStream?: true;
}>) => Request);
/**
An instance of `got.stream()`.
*/
export type GotStream = GotStreamFunction & Record<HTTPAlias, GotStreamFunction>;
/**
An instance of `got`.
*/
export type Got = {
/**
Sets `options.isStream` to `true`.
Returns a [duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex) with additional events:
- request
- response
- redirect
- uploadProgress
- downloadProgress
- error
*/
stream: GotStream;
/**
Returns an async iterator.
See pagination.options for more pagination options.
@example
```
import got from 'got';
const countLimit = 10;
const pagination = got.paginate('https://api.github.com/repos/sindresorhus/got/commits', {
pagination: {countLimit}
});
console.log(`Printing latest ${countLimit} Got commits (newest to oldest):`);
for await (const commitData of pagination) {
console.log(commitData.commit.message);
}
```
*/
paginate: GotPaginate;
/**
The Got defaults used in that instance.
*/
defaults: InstanceDefaults;
/**
Configure a new `got` instance with default `options`.
The `options` are merged with the parent instance's `defaults.options` using `got.mergeOptions`.
You can access the resolved options with the `.defaults` property on the instance.
Additionally, `got.extend()` accepts two properties from the `defaults` object: `mutableDefaults` and `handlers`.
It is also possible to merges many instances into a single one:
- options are merged using `got.mergeOptions()` (including hooks),
- handlers are stored in an array (you can access them through `instance.defaults.handlers`).
@example
```
import got from 'got';
const client = got.extend({
prefixUrl: 'https://example.com',
headers: {
'x-unicorn': 'rainbow'
}
});
client.get('demo');
// HTTP Request =>
// GET /demo HTTP/1.1
// Host: example.com
// x-unicorn: rainbow
```
*/
extend: (...instancesOrOptions: Array<Got | ExtendOptions>) => Got;
} & Record<HTTPAlias, GotRequestFunction> & GotRequestFunction;
export {};

View File

@@ -0,0 +1,419 @@
2.20.3 / 2019-10-11
==================
* Support Node.js 0.10 (Revert #1059)
* Ran "npm unpublish commander@2.20.2". There is no 2.20.2.
2.20.1 / 2019-09-29
==================
* Improve executable subcommand tracking
* Update dev dependencies
2.20.0 / 2019-04-02
==================
* fix: resolve symbolic links completely when hunting for subcommands (#935)
* Update index.d.ts (#930)
* Update Readme.md (#924)
* Remove --save option as it isn't required anymore (#918)
* Add link to the license file (#900)
* Added example of receiving args from options (#858)
* Added missing semicolon (#882)
* Add extension to .eslintrc (#876)
2.19.0 / 2018-10-02
==================
* Removed newline after Options and Commands headers (#864)
* Bugfix - Error output (#862)
* Fix to change default value to string (#856)
2.18.0 / 2018-09-07
==================
* Standardize help output (#853)
* chmod 644 travis.yml (#851)
* add support for execute typescript subcommand via ts-node (#849)
2.17.1 / 2018-08-07
==================
* Fix bug in command emit (#844)
2.17.0 / 2018-08-03
==================
* fixed newline output after help information (#833)
* Fix to emit the action even without command (#778)
* npm update (#823)
2.16.0 / 2018-06-29
==================
* Remove Makefile and `test/run` (#821)
* Make 'npm test' run on Windows (#820)
* Add badge to display install size (#807)
* chore: cache node_modules (#814)
* chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
* fixed typo in readme (#812)
* Fix types (#804)
* Update eslint to resolve vulnerabilities in lodash (#799)
* updated readme with custom event listeners. (#791)
* fix tests (#794)
2.15.0 / 2018-03-07
==================
* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
* Arguments description
2.14.1 / 2018-02-07
==================
* Fix typing of help function
2.14.0 / 2018-02-05
==================
* only register the option:version event once
* Fixes issue #727: Passing empty string for option on command is set to undefined
* enable eqeqeq rule
* resolves #754 add linter configuration to project
* resolves #560 respect custom name for version option
* document how to override the version flag
* document using options per command
2.13.0 / 2018-01-09
==================
* Do not print default for --no-
* remove trailing spaces in command help
* Update CI's Node.js to LTS and latest version
* typedefs: Command and Option types added to commander namespace
2.12.2 / 2017-11-28
==================
* fix: typings are not shipped
2.12.1 / 2017-11-23
==================
* Move @types/node to dev dependency
2.12.0 / 2017-11-22
==================
* add attributeName() method to Option objects
* Documentation updated for options with --no prefix
* typings: `outputHelp` takes a string as the first parameter
* typings: use overloads
* feat(typings): update to match js api
* Print default value in option help
* Fix translation error
* Fail when using same command and alias (#491)
* feat(typings): add help callback
* fix bug when description is add after command with options (#662)
* Format js code
* Rename History.md to CHANGELOG.md (#668)
* feat(typings): add typings to support TypeScript (#646)
* use current node
2.11.0 / 2017-07-03
==================
* Fix help section order and padding (#652)
* feature: support for signals to subcommands (#632)
* Fixed #37, --help should not display first (#447)
* Fix translation errors. (#570)
* Add package-lock.json
* Remove engines
* Upgrade package version
* Prefix events to prevent conflicts between commands and options (#494)
* Removing dependency on graceful-readlink
* Support setting name in #name function and make it chainable
* Add .vscode directory to .gitignore (Visual Studio Code metadata)
* Updated link to ruby commander in readme files
2.10.0 / 2017-06-19
==================
* Update .travis.yml. drop support for older node.js versions.
* Fix require arguments in README.md
* On SemVer you do not start from 0.0.1
* Add missing semi colon in readme
* Add save param to npm install
* node v6 travis test
* Update Readme_zh-CN.md
* Allow literal '--' to be passed-through as an argument
* Test subcommand alias help
* link build badge to master branch
* Support the alias of Git style sub-command
* added keyword commander for better search result on npm
* Fix Sub-Subcommands
* test node.js stable
* Fixes TypeError when a command has an option called `--description`
* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
* Add chinese Readme file
2.9.0 / 2015-10-13
==================
* Add option `isDefault` to set default subcommand #415 @Qix-
* Add callback to allow filtering or post-processing of help text #434 @djulien
* Fix `undefined` text in help information close #414 #416 @zhiyelee
2.8.1 / 2015-04-22
==================
* Back out `support multiline description` Close #396 #397
2.8.0 / 2015-04-07
==================
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
* Fix bug in Git-style sub-commands #372 @zhiyelee
* Allow commands to be hidden from help #383 @tonylukasavage
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
* Support multiline descriptions #208 @zxqfox
2.7.1 / 2015-03-11
==================
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
2.7.0 / 2015-03-09
==================
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
* Add support for camelCase on `opts()`. Close #353 @nkzawa
* Add node.js 0.12 and io.js to travis.yml
* Allow RegEx options. #337 @palanik
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
2.6.0 / 2014-12-30
==================
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
* Add application description to the help msg. Close #112 @dalssoft
2.5.1 / 2014-12-15
==================
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
2.5.0 / 2014-10-24
==================
* add support for variadic arguments. Closes #277 @whitlockjc
2.4.0 / 2014-10-17
==================
* fixed a bug on executing the coercion function of subcommands option. Closes #270
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
* fixed function normalize doesnt honor option terminator. Closes #216 @abbr
2.3.0 / 2014-07-16
==================
* add command alias'. Closes PR #210
* fix: Typos. Closes #99
* fix: Unused fs module. Closes #217
2.2.0 / 2014-03-29
==================
* add passing of previous option value
* fix: support subcommands on windows. Closes #142
* Now the defaultValue passed as the second argument of the coercion function.
2.1.0 / 2013-11-21
==================
* add: allow cflag style option params, unit test, fixes #174
2.0.0 / 2013-07-18
==================
* remove input methods (.prompt, .confirm, etc)
1.3.2 / 2013-07-18
==================
* add support for sub-commands to co-exist with the original command
1.3.1 / 2013-07-18
==================
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
1.3.0 / 2013-07-09
==================
* add EACCES error handling
* fix sub-command --help
1.2.0 / 2013-06-13
==================
* allow "-" hyphen as an option argument
* support for RegExp coercion
1.1.1 / 2012-11-20
==================
* add more sub-command padding
* fix .usage() when args are present. Closes #106
1.1.0 / 2012-11-16
==================
* add git-style executable subcommand support. Closes #94
1.0.5 / 2012-10-09
==================
* fix `--name` clobbering. Closes #92
* fix examples/help. Closes #89
1.0.4 / 2012-09-03
==================
* add `outputHelp()` method.
1.0.3 / 2012-08-30
==================
* remove invalid .version() defaulting
1.0.2 / 2012-08-24
==================
* add `--foo=bar` support [arv]
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
1.0.1 / 2012-08-03
==================
* fix issue #56
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
1.0.0 / 2012-07-05
==================
* add support for optional option descriptions
* add defaulting of `.version()` to package.json's version
0.6.1 / 2012-06-01
==================
* Added: append (yes or no) on confirmation
* Added: allow node.js v0.7.x
0.6.0 / 2012-04-10
==================
* Added `.prompt(obj, callback)` support. Closes #49
* Added default support to .choose(). Closes #41
* Fixed the choice example
0.5.1 / 2011-12-20
==================
* Fixed `password()` for recent nodes. Closes #36
0.5.0 / 2011-12-04
==================
* Added sub-command option support [itay]
0.4.3 / 2011-12-04
==================
* Fixed custom help ordering. Closes #32
0.4.2 / 2011-11-24
==================
* Added travis support
* Fixed: line-buffered input automatically trimmed. Closes #31
0.4.1 / 2011-11-18
==================
* Removed listening for "close" on --help
0.4.0 / 2011-11-15
==================
* Added support for `--`. Closes #24
0.3.3 / 2011-11-14
==================
* Fixed: wait for close event when writing help info [Jerry Hamlet]
0.3.2 / 2011-11-01
==================
* Fixed long flag definitions with values [felixge]
0.3.1 / 2011-10-31
==================
* Changed `--version` short flag to `-V` from `-v`
* Changed `.version()` so it's configurable [felixge]
0.3.0 / 2011-10-31
==================
* Added support for long flags only. Closes #18
0.2.1 / 2011-10-24
==================
* "node": ">= 0.4.x < 0.7.0". Closes #20
0.2.0 / 2011-09-26
==================
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
0.1.0 / 2011-08-24
==================
* Added support for custom `--help` output
0.0.5 / 2011-08-18
==================
* Changed: when the user enters nothing prompt for password again
* Fixed issue with passwords beginning with numbers [NuckChorris]
0.0.4 / 2011-08-15
==================
* Fixed `Commander#args`
0.0.3 / 2011-08-15
==================
* Added default option value support
0.0.2 / 2011-08-15
==================
* Added mask support to `Command#password(str[, mask], fn)`
* Added `Command#password(str, fn)`
0.0.1 / 2010-01-03
==================
* Initial release

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('isLength', require('../isLength'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,60 @@
{
"name": "boxen",
"version": "7.0.2",
"description": "Create boxes in the terminal",
"license": "MIT",
"repository": "sindresorhus/boxen",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=14.16"
},
"scripts": {
"test": "xo && nyc ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"cli",
"box",
"boxes",
"terminal",
"term",
"console",
"ascii",
"unicode",
"border",
"text"
],
"dependencies": {
"ansi-align": "^3.0.1",
"camelcase": "^7.0.0",
"chalk": "^5.0.1",
"cli-boxes": "^3.0.0",
"string-width": "^5.1.2",
"type-fest": "^2.13.0",
"widest-line": "^4.0.1",
"wrap-ansi": "^8.0.1"
},
"devDependencies": {
"ava": "^4.3.0",
"nyc": "^15.1.0",
"tsd": "^0.21.0",
"xo": "^0.50.0"
},
"ava": {
"snapshotDir": "tests/snapshots",
"environmentVariables": {
"COLUMNS": "60",
"FORCE_COLOR": "0"
}
}
}

View File

@@ -0,0 +1,158 @@
import process from 'node:process';
const ESC = '\u001B[';
const OSC = '\u001B]';
const BEL = '\u0007';
const SEP = ';';
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
const ansiEscapes = {};
ansiEscapes.cursorTo = (x, y) => {
if (typeof x !== 'number') {
throw new TypeError('The `x` argument is required');
}
if (typeof y !== 'number') {
return ESC + (x + 1) + 'G';
}
return ESC + (y + 1) + SEP + (x + 1) + 'H';
};
ansiEscapes.cursorMove = (x, y) => {
if (typeof x !== 'number') {
throw new TypeError('The `x` argument is required');
}
let returnValue = '';
if (x < 0) {
returnValue += ESC + (-x) + 'D';
} else if (x > 0) {
returnValue += ESC + x + 'C';
}
if (y < 0) {
returnValue += ESC + (-y) + 'A';
} else if (y > 0) {
returnValue += ESC + y + 'B';
}
return returnValue;
};
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
ansiEscapes.cursorLeft = ESC + 'G';
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
ansiEscapes.cursorGetPosition = ESC + '6n';
ansiEscapes.cursorNextLine = ESC + 'E';
ansiEscapes.cursorPrevLine = ESC + 'F';
ansiEscapes.cursorHide = ESC + '?25l';
ansiEscapes.cursorShow = ESC + '?25h';
ansiEscapes.eraseLines = count => {
let clear = '';
for (let i = 0; i < count; i++) {
clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
}
if (count) {
clear += ansiEscapes.cursorLeft;
}
return clear;
};
ansiEscapes.eraseEndLine = ESC + 'K';
ansiEscapes.eraseStartLine = ESC + '1K';
ansiEscapes.eraseLine = ESC + '2K';
ansiEscapes.eraseDown = ESC + 'J';
ansiEscapes.eraseUp = ESC + '1J';
ansiEscapes.eraseScreen = ESC + '2J';
ansiEscapes.scrollUp = ESC + 'S';
ansiEscapes.scrollDown = ESC + 'T';
ansiEscapes.clearScreen = '\u001Bc';
ansiEscapes.clearTerminal = process.platform === 'win32'
? `${ansiEscapes.eraseScreen}${ESC}0f`
// 1. Erases the screen (Only done in case `2` is not supported)
// 2. Erases the whole screen including scrollback buffer
// 3. Moves cursor to the top-left position
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
: `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
ansiEscapes.beep = BEL;
ansiEscapes.link = (text, url) => [
OSC,
'8',
SEP,
SEP,
url,
BEL,
text,
OSC,
'8',
SEP,
SEP,
BEL,
].join('');
ansiEscapes.image = (buffer, options = {}) => {
let returnValue = `${OSC}1337;File=inline=1`;
if (options.width) {
returnValue += `;width=${options.width}`;
}
if (options.height) {
returnValue += `;height=${options.height}`;
}
if (options.preserveAspectRatio === false) {
returnValue += ';preserveAspectRatio=0';
}
return returnValue + ':' + buffer.toString('base64') + BEL;
};
ansiEscapes.iTerm = {
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
annotation(message, options = {}) {
let returnValue = `${OSC}1337;`;
const hasX = typeof options.x !== 'undefined';
const hasY = typeof options.y !== 'undefined';
if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) {
throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');
}
message = message.replace(/\|/g, '');
returnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';
if (options.length > 0) {
returnValue += (
hasX
? [message, options.length, options.x, options.y]
: [options.length, message]
).join('|');
} else {
returnValue += message;
}
return returnValue + BEL;
},
};
export default ansiEscapes;

View File

@@ -0,0 +1,61 @@
var register = require("./lib/register");
var addHook = require("./lib/add");
var removeHook = require("./lib/remove");
// bind with array of arguments: https://stackoverflow.com/a/21792913
var bind = Function.bind;
var bindable = bind.bind(bind);
function bindApi(hook, state, name) {
var removeHookRef = bindable(removeHook, null).apply(
null,
name ? [state, name] : [state]
);
hook.api = { remove: removeHookRef };
hook.remove = removeHookRef;
["before", "error", "after", "wrap"].forEach(function (kind) {
var args = name ? [state, kind, name] : [state, kind];
hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args);
});
}
function HookSingular() {
var singularHookName = "h";
var singularHookState = {
registry: {},
};
var singularHook = register.bind(null, singularHookState, singularHookName);
bindApi(singularHook, singularHookState, singularHookName);
return singularHook;
}
function HookCollection() {
var state = {
registry: {},
};
var hook = register.bind(null, state);
bindApi(hook, state);
return hook;
}
var collectionHookDeprecationMessageDisplayed = false;
function Hook() {
if (!collectionHookDeprecationMessageDisplayed) {
console.warn(
'[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4'
);
collectionHookDeprecationMessageDisplayed = true;
}
return HookCollection();
}
Hook.Singular = HookSingular.bind();
Hook.Collection = HookCollection.bind();
module.exports = Hook;
// expose constructors as a named property for TypeScript
module.exports.Hook = Hook;
module.exports.Singular = Hook.Singular;
module.exports.Collection = Hook.Collection;

View File

@@ -0,0 +1 @@
{"name":"estraverse","version":"4.3.0","files":{".jshintrc":{"checkedAt":1678883672090,"integrity":"sha512-4xppALudmDTZYQeI5wBGyqi1wU+DyPTZHYsTW2J+2zdn2GGlTmrPNF18YkaJd4MlZCwCG1OWjSLStGtdLAq58Q==","mode":436,"size":242},"package.json":{"checkedAt":1678883672090,"integrity":"sha512-FjQCKHsfJdYA5BLSagITiPvwJwLYXqbZrOj03VGhRfY8WQdqgqGUIagWZ0Bk/gncgBlaDvZqvCEmvLbj833t/w==","mode":436,"size":1009},"LICENSE.BSD":{"checkedAt":1678883672091,"integrity":"sha512-YKl79smr20vdIKCy+fyP+zscyQHwyqDMNEZOwVLEOjQxIxgts1z0klBrcDsCIR2JPrcB00nhm8bCz47uCx24SA==","mode":436,"size":1231},"estraverse.js":{"checkedAt":1678883672099,"integrity":"sha512-/JqGU0wkfew8Hkgo0TuiY0VJX8sfiElH3ytL3rI4E39+i5qt089A4GJXcnIlent2g+rkyMqzWLcOTA/pFYRTLQ==","mode":436,"size":26188},"gulpfile.js":{"checkedAt":1678883672105,"integrity":"sha512-fNyongu2k+SUoYgehgg91h/t7pDLRcQyYxUDinwKZCteBWG5ph5JPwRZlpkCuDYtelx5Ch9U4WaKZ91/o33CBw==","mode":436,"size":2790},"README.md":{"checkedAt":1678883672105,"integrity":"sha512-pPXMFwTPvhH1DSRRu6XKyXh9XRKPGA1/D//NRu9pJcR8UTZEYQF+JHds2D2zcdp+73GYd8e4q/RRtI1MRZrxcg==","mode":436,"size":4865}}}

View File

@@ -0,0 +1,234 @@
import Visitor from './visitor';
function WhitespaceControl(options = {}) {
this.options = options;
}
WhitespaceControl.prototype = new Visitor();
WhitespaceControl.prototype.Program = function(program) {
const doStandalone = !this.options.ignoreStandalone;
let isRoot = !this.isRootSeen;
this.isRootSeen = true;
let body = program.body;
for (let i = 0, l = body.length; i < l; i++) {
let current = body[i],
strip = this.accept(current);
if (!strip) {
continue;
}
let _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
_isNextWhitespace = isNextWhitespace(body, i, isRoot),
openStandalone = strip.openStandalone && _isPrevWhitespace,
closeStandalone = strip.closeStandalone && _isNextWhitespace,
inlineStandalone =
strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
if (strip.close) {
omitRight(body, i, true);
}
if (strip.open) {
omitLeft(body, i, true);
}
if (doStandalone && inlineStandalone) {
omitRight(body, i);
if (omitLeft(body, i)) {
// If we are on a standalone node, save the indent info for partials
if (current.type === 'PartialStatement') {
// Pull out the whitespace from the final line
current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
}
}
}
if (doStandalone && openStandalone) {
omitRight((current.program || current.inverse).body);
// Strip out the previous content node if it's whitespace only
omitLeft(body, i);
}
if (doStandalone && closeStandalone) {
// Always strip the next node
omitRight(body, i);
omitLeft((current.inverse || current.program).body);
}
}
return program;
};
WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function(
block
) {
this.accept(block.program);
this.accept(block.inverse);
// Find the inverse program that is involed with whitespace stripping.
let program = block.program || block.inverse,
inverse = block.program && block.inverse,
firstInverse = inverse,
lastInverse = inverse;
if (inverse && inverse.chained) {
firstInverse = inverse.body[0].program;
// Walk the inverse chain to find the last inverse that is actually in the chain.
while (lastInverse.chained) {
lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
}
}
let strip = {
open: block.openStrip.open,
close: block.closeStrip.close,
// Determine the standalone candiacy. Basically flag our content as being possibly standalone
// so our parent can determine if we actually are standalone
openStandalone: isNextWhitespace(program.body),
closeStandalone: isPrevWhitespace((firstInverse || program).body)
};
if (block.openStrip.close) {
omitRight(program.body, null, true);
}
if (inverse) {
let inverseStrip = block.inverseStrip;
if (inverseStrip.open) {
omitLeft(program.body, null, true);
}
if (inverseStrip.close) {
omitRight(firstInverse.body, null, true);
}
if (block.closeStrip.open) {
omitLeft(lastInverse.body, null, true);
}
// Find standalone else statments
if (
!this.options.ignoreStandalone &&
isPrevWhitespace(program.body) &&
isNextWhitespace(firstInverse.body)
) {
omitLeft(program.body);
omitRight(firstInverse.body);
}
} else if (block.closeStrip.open) {
omitLeft(program.body, null, true);
}
return strip;
};
WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function(
mustache
) {
return mustache.strip;
};
WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function(
node
) {
/* istanbul ignore next */
let strip = node.strip || {};
return {
inlineStandalone: true,
open: strip.open,
close: strip.close
};
};
function isPrevWhitespace(body, i, isRoot) {
if (i === undefined) {
i = body.length;
}
// Nodes that end with newlines are considered whitespace (but are special
// cased for strip operations)
let prev = body[i - 1],
sibling = body[i - 2];
if (!prev) {
return isRoot;
}
if (prev.type === 'ContentStatement') {
return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(
prev.original
);
}
}
function isNextWhitespace(body, i, isRoot) {
if (i === undefined) {
i = -1;
}
let next = body[i + 1],
sibling = body[i + 2];
if (!next) {
return isRoot;
}
if (next.type === 'ContentStatement') {
return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(
next.original
);
}
}
// Marks the node to the right of the position as omitted.
// I.e. {{foo}}' ' will mark the ' ' node as omitted.
//
// If i is undefined, then the first child will be marked as such.
//
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
// content is met.
function omitRight(body, i, multiple) {
let current = body[i == null ? 0 : i + 1];
if (
!current ||
current.type !== 'ContentStatement' ||
(!multiple && current.rightStripped)
) {
return;
}
let original = current.value;
current.value = current.value.replace(
multiple ? /^\s+/ : /^[ \t]*\r?\n?/,
''
);
current.rightStripped = current.value !== original;
}
// Marks the node to the left of the position as omitted.
// I.e. ' '{{foo}} will mark the ' ' node as omitted.
//
// If i is undefined then the last child will be marked as such.
//
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
// content is met.
function omitLeft(body, i, multiple) {
let current = body[i == null ? body.length - 1 : i - 1];
if (
!current ||
current.type !== 'ContentStatement' ||
(!multiple && current.leftStripped)
) {
return;
}
// We omit the last node if it's whitespace only and not preceded by a non-content node.
let original = current.value;
current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, '');
current.leftStripped = current.value !== original;
return current.leftStripped;
}
export default WhitespaceControl;

View File

@@ -0,0 +1 @@
{"version":3,"file":"ReplaySubject.js","sourceRoot":"","sources":["../../../src/internal/ReplaySubject.ts"],"names":[],"mappings":"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"}

View File

@@ -0,0 +1,54 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var callBound = require('call-bind/callBound');
var forEach = require('../helpers/forEach');
var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
var $charCodeAt = callBound('String.prototype.charCodeAt');
var StringToCodePoints = require('./StringToCodePoints');
var Type = require('./Type');
var UnicodeEscape = require('./UnicodeEscape');
var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint');
var has = require('has');
// https://262.ecma-international.org/12.0/#sec-quotejsonstring
var escapes = {
'\u0008': '\\b',
'\u0009': '\\t',
'\u000A': '\\n',
'\u000C': '\\f',
'\u000D': '\\r',
'\u0022': '\\"',
'\u005c': '\\\\'
};
module.exports = function QuoteJSONString(value) {
if (Type(value) !== 'String') {
throw new $TypeError('Assertion failed: `value` must be a String');
}
var product = '"';
if (value) {
forEach(StringToCodePoints(value), function (C) {
if (has(escapes, C)) {
product += escapes[C];
} else {
var cCharCode = $charCodeAt(C, 0);
if (cCharCode < 0x20 || isLeadingSurrogate(C) || isTrailingSurrogate(C)) {
product += UnicodeEscape(C);
} else {
product += UTF16EncodeCodePoint(cCharCode);
}
}
});
}
product += '"';
return product;
};

View File

@@ -0,0 +1,71 @@
/**
Create a deep version of another object type where property values are recursively replaced into a given value type.
Use-cases:
- Form validation: Define how each field should be validated.
- Form settings: Define configuration for input fields.
- Parsing: Define types that specify special behavior for specific fields.
@example
```
import type {Schema} from 'type-fest';
interface User {
id: string;
name: {
firstname: string;
lastname: string;
};
created: Date;
active: boolean;
passwordHash: string;
}
type UserMask = Schema<User, 'mask' | 'hide' | 'show'>;
const userMaskSettings: UserMask = {
id: 'show',
name: {
firstname: 'show',
lastname: 'mask',
},
created: 'show',
active: 'show',
passwordHash: 'hide',
}
```
@category Object
*/
export type Schema<ObjectType, ValueType> = ObjectType extends string
? ValueType
: ObjectType extends Map<unknown, unknown>
? ValueType
: ObjectType extends Set<unknown>
? ValueType
: ObjectType extends ReadonlyMap<unknown, unknown>
? ValueType
: ObjectType extends ReadonlySet<unknown>
? ValueType
: ObjectType extends readonly unknown[]
? ValueType
: ObjectType extends unknown[]
? ValueType
: ObjectType extends (...arguments: unknown[]) => unknown
? ValueType
: ObjectType extends Date
? ValueType
: ObjectType extends Function
? ValueType
: ObjectType extends RegExp
? ValueType
: ObjectType extends object
? SchemaObject<ObjectType, ValueType>
: ValueType;
/**
Same as `Schema`, but accepts only `object`s as inputs. Internal helper for `Schema`.
*/
type SchemaObject<ObjectType extends object, K> = {
[KeyType in keyof ObjectType]: Schema<ObjectType[KeyType], K> | K;
};

View File

@@ -0,0 +1,6 @@
var overArg = require('./_overArg');
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
module.exports = getPrototype;

View File

@@ -0,0 +1,16 @@
'use strict';
var assertRecord = require('../helpers/assertRecord');
var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor');
var Type = require('./Type');
// https://262.ecma-international.org/6.0/#sec-frompropertydescriptor
module.exports = function FromPropertyDescriptor(Desc) {
if (typeof Desc !== 'undefined') {
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
}
return fromPropertyDescriptor(Desc);
};