new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { defer } from './defer';
|
||||
export function iif(condition, trueResult, falseResult) {
|
||||
return defer(() => (condition() ? trueResult : falseResult));
|
||||
}
|
||||
//# sourceMappingURL=iif.js.map
|
||||
@@ -0,0 +1,31 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
function symlinkType (srcpath, type, callback) {
|
||||
callback = (typeof type === 'function') ? type : callback
|
||||
type = (typeof type === 'function') ? false : type
|
||||
if (type) return callback(null, type)
|
||||
fs.lstat(srcpath, (err, stats) => {
|
||||
if (err) return callback(null, 'file')
|
||||
type = (stats && stats.isDirectory()) ? 'dir' : 'file'
|
||||
callback(null, type)
|
||||
})
|
||||
}
|
||||
|
||||
function symlinkTypeSync (srcpath, type) {
|
||||
let stats
|
||||
|
||||
if (type) return type
|
||||
try {
|
||||
stats = fs.lstatSync(srcpath)
|
||||
} catch (e) {
|
||||
return 'file'
|
||||
}
|
||||
return (stats && stats.isDirectory()) ? 'dir' : 'file'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
symlinkType,
|
||||
symlinkTypeSync
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ComputeExponentForMagnitude.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/NumberFormat/ComputeExponentForMagnitude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAmB,MAAM,iBAAiB,CAAA;AAEtE;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,MAAM,EACjB,EACE,gBAAgB,GACjB,EAAE;IAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAAC,GACjE,MAAM,CAyDR"}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').doDuring;
|
||||
@@ -0,0 +1,33 @@
|
||||
// Abstracts constructing a Blob object, so it also works in older
|
||||
// browsers that don't support the native Blob constructor. (i.e.
|
||||
// old QtWebKit versions, at least).
|
||||
// Abstracts constructing a Blob object, so it also works in older
|
||||
// browsers that don't support the native Blob constructor. (i.e.
|
||||
// old QtWebKit versions, at least).
|
||||
function createBlob(parts, properties) {
|
||||
/* global BlobBuilder,MSBlobBuilder,MozBlobBuilder,WebKitBlobBuilder */
|
||||
parts = parts || [];
|
||||
properties = properties || {};
|
||||
try {
|
||||
return new Blob(parts, properties);
|
||||
} catch (e) {
|
||||
if (e.name !== 'TypeError') {
|
||||
throw e;
|
||||
}
|
||||
var Builder =
|
||||
typeof BlobBuilder !== 'undefined'
|
||||
? BlobBuilder
|
||||
: typeof MSBlobBuilder !== 'undefined'
|
||||
? MSBlobBuilder
|
||||
: typeof MozBlobBuilder !== 'undefined'
|
||||
? MozBlobBuilder
|
||||
: WebKitBlobBuilder;
|
||||
var builder = new Builder();
|
||||
for (var i = 0; i < parts.length; i += 1) {
|
||||
builder.append(parts[i]);
|
||||
}
|
||||
return builder.getBlob(properties.type);
|
||||
}
|
||||
}
|
||||
|
||||
export default createBlob;
|
||||
@@ -0,0 +1,82 @@
|
||||
var baseRandom = require('./_baseRandom'),
|
||||
isIterateeCall = require('./_isIterateeCall'),
|
||||
toFinite = require('./toFinite');
|
||||
|
||||
/** Built-in method references without a dependency on `root`. */
|
||||
var freeParseFloat = parseFloat;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min,
|
||||
nativeRandom = Math.random;
|
||||
|
||||
/**
|
||||
* Produces a random number between the inclusive `lower` and `upper` bounds.
|
||||
* If only one argument is provided a number between `0` and the given number
|
||||
* is returned. If `floating` is `true`, or either `lower` or `upper` are
|
||||
* floats, a floating-point number is returned instead of an integer.
|
||||
*
|
||||
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
||||
* floating-point values which can produce unexpected results.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.7.0
|
||||
* @category Number
|
||||
* @param {number} [lower=0] The lower bound.
|
||||
* @param {number} [upper=1] The upper bound.
|
||||
* @param {boolean} [floating] Specify returning a floating-point number.
|
||||
* @returns {number} Returns the random number.
|
||||
* @example
|
||||
*
|
||||
* _.random(0, 5);
|
||||
* // => an integer between 0 and 5
|
||||
*
|
||||
* _.random(5);
|
||||
* // => also an integer between 0 and 5
|
||||
*
|
||||
* _.random(5, true);
|
||||
* // => a floating-point number between 0 and 5
|
||||
*
|
||||
* _.random(1.2, 5.2);
|
||||
* // => a floating-point number between 1.2 and 5.2
|
||||
*/
|
||||
function random(lower, upper, floating) {
|
||||
if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
|
||||
upper = floating = undefined;
|
||||
}
|
||||
if (floating === undefined) {
|
||||
if (typeof upper == 'boolean') {
|
||||
floating = upper;
|
||||
upper = undefined;
|
||||
}
|
||||
else if (typeof lower == 'boolean') {
|
||||
floating = lower;
|
||||
lower = undefined;
|
||||
}
|
||||
}
|
||||
if (lower === undefined && upper === undefined) {
|
||||
lower = 0;
|
||||
upper = 1;
|
||||
}
|
||||
else {
|
||||
lower = toFinite(lower);
|
||||
if (upper === undefined) {
|
||||
upper = lower;
|
||||
lower = 0;
|
||||
} else {
|
||||
upper = toFinite(upper);
|
||||
}
|
||||
}
|
||||
if (lower > upper) {
|
||||
var temp = lower;
|
||||
lower = upper;
|
||||
upper = temp;
|
||||
}
|
||||
if (floating || lower % 1 || upper % 1) {
|
||||
var rand = nativeRandom();
|
||||
return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
|
||||
}
|
||||
return baseRandom(lower, upper);
|
||||
}
|
||||
|
||||
module.exports = random;
|
||||
@@ -0,0 +1,28 @@
|
||||
# Plain Function
|
||||
|
||||
A _Function_ instance that is not a _Class_
|
||||
|
||||
## `plain-function/is`
|
||||
|
||||
Confirms if given object is a _plain function_
|
||||
|
||||
```javascript
|
||||
const isPlainFunction = require("type/plain-function/is");
|
||||
|
||||
isPlainFunction(function () {}); // true
|
||||
isPlainFunction(() => {}); // true
|
||||
isPlainFunction(class {}); // false
|
||||
isPlainFunction("foo"); // false
|
||||
```
|
||||
|
||||
## `plain-function/ensure`
|
||||
|
||||
If given argument is a _plain function_ object, it is returned back. Otherwise `TypeError` is thrown.
|
||||
|
||||
```javascript
|
||||
const ensurePlainFunction = require("type/function/ensure");
|
||||
|
||||
const fn = function () {};
|
||||
ensurePlainFunction(fn); // fn
|
||||
ensurePlainFunction(class {}); // Thrown TypeError: class is not a plain function
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { isFunction } from '../util/isFunction';
|
||||
import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';
|
||||
export function fromEventPattern(addHandler, removeHandler, resultSelector) {
|
||||
if (resultSelector) {
|
||||
return fromEventPattern(addHandler, removeHandler).pipe(mapOneOrManyArgs(resultSelector));
|
||||
}
|
||||
return new Observable((subscriber) => {
|
||||
const handler = (...e) => subscriber.next(e.length === 1 ? e[0] : e);
|
||||
const retValue = addHandler(handler);
|
||||
return isFunction(removeHandler) ? () => removeHandler(handler, retValue) : undefined;
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=fromEventPattern.js.map
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Math.sign : require("./shim");
|
||||
@@ -0,0 +1,4 @@
|
||||
export type PasswordNeededError = {
|
||||
name: string;
|
||||
message: string;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-get-o-p
|
||||
|
||||
module.exports = function Get(O, P) {
|
||||
// 7.3.1.1
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
||||
}
|
||||
// 7.3.1.2
|
||||
if (!IsPropertyKey(P)) {
|
||||
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P));
|
||||
}
|
||||
// 7.3.1.3
|
||||
return O[P];
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"has-tostringtag","version":"1.0.0","files":{".eslintrc":{"checkedAt":1678883671537,"integrity":"sha512-/jtNmWJBCosGcZFwL7g8YgvM8V61kw1A/Ev3ARlU5d+sKCy7ulo9cDlstJP087urAtDgIEwMxBnV1qjIrf9xNg==","mode":420,"size":164},"LICENSE":{"checkedAt":1678883671616,"integrity":"sha512-BnoJcv9kJwR3xmFye4OSyYx52JuiWUfoAzjouUfO/Eke87mI1a6IrEi6iKFxxywe6SikoxxCkbElKtYu/MZq5g==","mode":420,"size":1067},"test/shams/get-own-property-symbols.js":{"checkedAt":1678883671616,"integrity":"sha512-issfLCs0cNxjnPnESWlnbAqh8l2CmWK0+9zYmHfhuPGkUhODqoR2fZokdYmlCuI5um8ja/9xoEv+W3Zj8onwKg==","mode":420,"size":744},"test/shams/core-js.js":{"checkedAt":1678883671616,"integrity":"sha512-sp9WR8s7kqDIBtRRA3/DtxoWUbl1VUh+t9JV+t58MD6xnYQZdIkyuizCx+OZSM0RQYMu79QHDNPXV5QRNkEsWQ==","mode":420,"size":813},"test/index.js":{"checkedAt":1678883671616,"integrity":"sha512-hlDzK749trspv8RhSqIeZtekOxUIYjsuNuU7WjF9SsLMKXNxJxmKncODSYcgY86opAIpM9bWNZpm2hDfY28pEA==","mode":420,"size":679},"index.js":{"checkedAt":1678883671616,"integrity":"sha512-07SvoTFl4V7BrPKfumPWa7Jr1OstpilIhkJV6SLKIar3js69FGZ3UMihmR1SQIiNbgmnwkYTJLzGqw3LHIGDFA==","mode":420,"size":169},"shams.js":{"checkedAt":1678883671616,"integrity":"sha512-H4/3yMDf/2iPEMScRx+yAZ+FfVw5upiN1aQHQbNmz2LKFMMhvsKBix52dWxn5Z9Vs1/bkSkXGvZ0k2jZcMDrog==","mode":420,"size":162},"package.json":{"checkedAt":1678883671616,"integrity":"sha512-cs8lUfdmkxlecQ8ID8SuIZoG8qHy+WQ+yl4PK7mr+o0qsm5Sjn3yuT1FwqgLd2AKBPwbG5cjrB6iDBGI79tIOA==","mode":420,"size":2420},"test/tests.js":{"checkedAt":1678883671616,"integrity":"sha512-3WAplTLB3R5ThhL4CAX+JNujTgBQDQ8hpCyvK7F1xeZ/7U3VLyNTK6IltYsvDS0zHfDsiQFw09wOILPbqALmZA==","mode":420,"size":427},"CHANGELOG.md":{"checkedAt":1678883671616,"integrity":"sha512-U793E2TPdJC3uqxQFWKuME4fqN+v8g2Nai4ju/QkF2qHZT1GR5fziz6D/s6xz3KQs+cBU2UcLuUMjAOErpjw3A==","mode":420,"size":1466},"README.md":{"checkedAt":1678883671619,"integrity":"sha512-Qpb8Y/z240UT73xmTslcaxzwhj5EV5OhXmRQ9VlRVN2kdlIgFtD3FO9Mx/Dc2EZr+O6JJlrpAgvlGZETxRuz3Q==","mode":420,"size":2190},".github/FUNDING.yml":{"checkedAt":1678883671619,"integrity":"sha512-oOqrSeS0Cv6GP65vmllhqPcM3eOepd30glCPYcPrUmONolfrENlGhHW9FquGuk212rzg7sIWnsPsSBG2lFH8oA==","mode":420,"size":586}}}
|
||||
@@ -0,0 +1,54 @@
|
||||
# 1.0.0 - 2016-01-07
|
||||
|
||||
- Removed: unused speed test
|
||||
- Added: Automatic routing between previously unsupported conversions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `convert()` class
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: all functions to lookup dictionary
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: `ansi` to `ansi256`
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Fixed: argument grouping for functions requiring only one argument
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
|
||||
# 0.6.0 - 2015-07-23
|
||||
|
||||
- Added: methods to handle
|
||||
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||
- rgb2ansi16
|
||||
- rgb2ansi
|
||||
- hsl2ansi16
|
||||
- hsl2ansi
|
||||
- hsv2ansi16
|
||||
- hsv2ansi
|
||||
- hwb2ansi16
|
||||
- hwb2ansi
|
||||
- cmyk2ansi16
|
||||
- cmyk2ansi
|
||||
- keyword2ansi16
|
||||
- keyword2ansi
|
||||
- ansi162rgb
|
||||
- ansi162hsl
|
||||
- ansi162hsv
|
||||
- ansi162hwb
|
||||
- ansi162cmyk
|
||||
- ansi162keyword
|
||||
- ansi2rgb
|
||||
- ansi2hsl
|
||||
- ansi2hsv
|
||||
- ansi2hwb
|
||||
- ansi2cmyk
|
||||
- ansi2keyword
|
||||
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||
|
||||
# 0.5.3 - 2015-06-02
|
||||
|
||||
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||
|
||||
---
|
||||
|
||||
Check out commit logs for older releases
|
||||
@@ -0,0 +1,347 @@
|
||||
import { number as assertNumber } from './_assert.js';
|
||||
import { toBytes, wrapConstructorWithOpts, u32 } from './utils.js';
|
||||
import { Keccak } from './sha3.js';
|
||||
// cSHAKE && KMAC (NIST SP800-185)
|
||||
function leftEncode(n) {
|
||||
const res = [n & 0xff];
|
||||
n >>= 8;
|
||||
for (; n > 0; n >>= 8)
|
||||
res.unshift(n & 0xff);
|
||||
res.unshift(res.length);
|
||||
return new Uint8Array(res);
|
||||
}
|
||||
function rightEncode(n) {
|
||||
const res = [n & 0xff];
|
||||
n >>= 8;
|
||||
for (; n > 0; n >>= 8)
|
||||
res.unshift(n & 0xff);
|
||||
res.push(res.length);
|
||||
return new Uint8Array(res);
|
||||
}
|
||||
function chooseLen(opts, outputLen) {
|
||||
return opts.dkLen === undefined ? outputLen : opts.dkLen;
|
||||
}
|
||||
const toBytesOptional = (buf) => (buf !== undefined ? toBytes(buf) : new Uint8Array([]));
|
||||
// NOTE: second modulo is necessary since we don't need to add padding if current element takes whole block
|
||||
const getPadding = (len, block) => new Uint8Array((block - (len % block)) % block);
|
||||
// Personalization
|
||||
function cshakePers(hash, opts = {}) {
|
||||
if (!opts || (!opts.personalization && !opts.NISTfn))
|
||||
return hash;
|
||||
// Encode and pad inplace to avoid unneccesary memory copies/slices (so we don't need to zero them later)
|
||||
// bytepad(encode_string(N) || encode_string(S), 168)
|
||||
const blockLenBytes = leftEncode(hash.blockLen);
|
||||
const fn = toBytesOptional(opts.NISTfn);
|
||||
const fnLen = leftEncode(8 * fn.length); // length in bits
|
||||
const pers = toBytesOptional(opts.personalization);
|
||||
const persLen = leftEncode(8 * pers.length); // length in bits
|
||||
if (!fn.length && !pers.length)
|
||||
return hash;
|
||||
hash.suffix = 0x04;
|
||||
hash.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers);
|
||||
let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length;
|
||||
hash.update(getPadding(totalLen, hash.blockLen));
|
||||
return hash;
|
||||
}
|
||||
const gencShake = (suffix, blockLen, outputLen) => wrapConstructorWithOpts((opts = {}) => cshakePers(new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts));
|
||||
export const cshake128 = gencShake(0x1f, 168, 128 / 8);
|
||||
export const cshake256 = gencShake(0x1f, 136, 256 / 8);
|
||||
class KMAC extends Keccak {
|
||||
constructor(blockLen, outputLen, enableXOF, key, opts = {}) {
|
||||
super(blockLen, 0x1f, outputLen, enableXOF);
|
||||
cshakePers(this, { NISTfn: 'KMAC', personalization: opts.personalization });
|
||||
key = toBytes(key);
|
||||
// 1. newX = bytepad(encode_string(K), 168) || X || right_encode(L).
|
||||
const blockLenBytes = leftEncode(this.blockLen);
|
||||
const keyLen = leftEncode(8 * key.length);
|
||||
this.update(blockLenBytes).update(keyLen).update(key);
|
||||
const totalLen = blockLenBytes.length + keyLen.length + key.length;
|
||||
this.update(getPadding(totalLen, this.blockLen));
|
||||
}
|
||||
finish() {
|
||||
if (!this.finished)
|
||||
this.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits
|
||||
super.finish();
|
||||
}
|
||||
_cloneInto(to) {
|
||||
// Create new instance without calling constructor since key already in state and we don't know it.
|
||||
// Force "to" to be instance of KMAC instead of Sha3.
|
||||
if (!to) {
|
||||
to = Object.create(Object.getPrototypeOf(this), {});
|
||||
to.state = this.state.slice();
|
||||
to.blockLen = this.blockLen;
|
||||
to.state32 = u32(to.state);
|
||||
}
|
||||
return super._cloneInto(to);
|
||||
}
|
||||
clone() {
|
||||
return this._cloneInto();
|
||||
}
|
||||
}
|
||||
function genKmac(blockLen, outputLen, xof = false) {
|
||||
const kmac = (key, message, opts) => kmac.create(key, opts).update(message).digest();
|
||||
kmac.create = (key, opts = {}) => new KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts);
|
||||
return kmac;
|
||||
}
|
||||
export const kmac128 = genKmac(168, 128 / 8);
|
||||
export const kmac256 = genKmac(136, 256 / 8);
|
||||
export const kmac128xof = genKmac(168, 128 / 8, true);
|
||||
export const kmac256xof = genKmac(136, 256 / 8, true);
|
||||
// TupleHash
|
||||
// Usage: tuple(['ab', 'cd']) != tuple(['a', 'bcd'])
|
||||
class TupleHash extends Keccak {
|
||||
constructor(blockLen, outputLen, enableXOF, opts = {}) {
|
||||
super(blockLen, 0x1f, outputLen, enableXOF);
|
||||
cshakePers(this, { NISTfn: 'TupleHash', personalization: opts.personalization });
|
||||
// Change update after cshake processed
|
||||
this.update = (data) => {
|
||||
data = toBytes(data);
|
||||
super.update(leftEncode(data.length * 8));
|
||||
super.update(data);
|
||||
return this;
|
||||
};
|
||||
}
|
||||
finish() {
|
||||
if (!this.finished)
|
||||
super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits
|
||||
super.finish();
|
||||
}
|
||||
_cloneInto(to) {
|
||||
to || (to = new TupleHash(this.blockLen, this.outputLen, this.enableXOF));
|
||||
return super._cloneInto(to);
|
||||
}
|
||||
clone() {
|
||||
return this._cloneInto();
|
||||
}
|
||||
}
|
||||
function genTuple(blockLen, outputLen, xof = false) {
|
||||
const tuple = (messages, opts) => {
|
||||
const h = tuple.create(opts);
|
||||
for (const msg of messages)
|
||||
h.update(msg);
|
||||
return h.digest();
|
||||
};
|
||||
tuple.create = (opts = {}) => new TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts);
|
||||
return tuple;
|
||||
}
|
||||
export const tuplehash128 = genTuple(168, 128 / 8);
|
||||
export const tuplehash256 = genTuple(136, 256 / 8);
|
||||
export const tuplehash128xof = genTuple(168, 128 / 8, true);
|
||||
export const tuplehash256xof = genTuple(136, 256 / 8, true);
|
||||
class ParallelHash extends Keccak {
|
||||
constructor(blockLen, outputLen, leafCons, enableXOF, opts = {}) {
|
||||
super(blockLen, 0x1f, outputLen, enableXOF);
|
||||
this.leafCons = leafCons;
|
||||
this.chunkPos = 0; // Position of current block in chunk
|
||||
this.chunksDone = 0; // How many chunks we already have
|
||||
cshakePers(this, { NISTfn: 'ParallelHash', personalization: opts.personalization });
|
||||
let { blockLen: B } = opts;
|
||||
B || (B = 8);
|
||||
assertNumber(B);
|
||||
this.chunkLen = B;
|
||||
super.update(leftEncode(B));
|
||||
// Change update after cshake processed
|
||||
this.update = (data) => {
|
||||
data = toBytes(data);
|
||||
const { chunkLen, leafCons } = this;
|
||||
for (let pos = 0, len = data.length; pos < len;) {
|
||||
if (this.chunkPos == chunkLen || !this.leafHash) {
|
||||
if (this.leafHash) {
|
||||
super.update(this.leafHash.digest());
|
||||
this.chunksDone++;
|
||||
}
|
||||
this.leafHash = leafCons();
|
||||
this.chunkPos = 0;
|
||||
}
|
||||
const take = Math.min(chunkLen - this.chunkPos, len - pos);
|
||||
this.leafHash.update(data.subarray(pos, pos + take));
|
||||
this.chunkPos += take;
|
||||
pos += take;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
}
|
||||
finish() {
|
||||
if (this.finished)
|
||||
return;
|
||||
if (this.leafHash) {
|
||||
super.update(this.leafHash.digest());
|
||||
this.chunksDone++;
|
||||
}
|
||||
super.update(rightEncode(this.chunksDone));
|
||||
super.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); // outputLen in bits
|
||||
super.finish();
|
||||
}
|
||||
_cloneInto(to) {
|
||||
to || (to = new ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF));
|
||||
if (this.leafHash)
|
||||
to.leafHash = this.leafHash._cloneInto(to.leafHash);
|
||||
to.chunkPos = this.chunkPos;
|
||||
to.chunkLen = this.chunkLen;
|
||||
to.chunksDone = this.chunksDone;
|
||||
return super._cloneInto(to);
|
||||
}
|
||||
destroy() {
|
||||
super.destroy.call(this);
|
||||
if (this.leafHash)
|
||||
this.leafHash.destroy();
|
||||
}
|
||||
clone() {
|
||||
return this._cloneInto();
|
||||
}
|
||||
}
|
||||
function genParallel(blockLen, outputLen, leaf, xof = false) {
|
||||
const parallel = (message, opts) => parallel.create(opts).update(message).digest();
|
||||
parallel.create = (opts = {}) => new ParallelHash(blockLen, chooseLen(opts, outputLen), () => leaf.create({ dkLen: 2 * outputLen }), xof, opts);
|
||||
return parallel;
|
||||
}
|
||||
export const parallelhash128 = genParallel(168, 128 / 8, cshake128);
|
||||
export const parallelhash256 = genParallel(136, 256 / 8, cshake256);
|
||||
export const parallelhash128xof = genParallel(168, 128 / 8, cshake128, true);
|
||||
export const parallelhash256xof = genParallel(136, 256 / 8, cshake256, true);
|
||||
// Kangaroo
|
||||
// Same as NIST rightEncode, but returns [0] for zero string
|
||||
function rightEncodeK12(n) {
|
||||
const res = [];
|
||||
for (; n > 0; n >>= 8)
|
||||
res.unshift(n & 0xff);
|
||||
res.push(res.length);
|
||||
return new Uint8Array(res);
|
||||
}
|
||||
const EMPTY = new Uint8Array([]);
|
||||
class KangarooTwelve extends Keccak {
|
||||
constructor(blockLen, leafLen, outputLen, rounds, opts) {
|
||||
super(blockLen, 0x07, outputLen, true, rounds);
|
||||
this.leafLen = leafLen;
|
||||
this.chunkLen = 8192;
|
||||
this.chunkPos = 0; // Position of current block in chunk
|
||||
this.chunksDone = 0; // How many chunks we already have
|
||||
const { personalization } = opts;
|
||||
this.personalization = toBytesOptional(personalization);
|
||||
}
|
||||
update(data) {
|
||||
data = toBytes(data);
|
||||
const { chunkLen, blockLen, leafLen, rounds } = this;
|
||||
for (let pos = 0, len = data.length; pos < len;) {
|
||||
if (this.chunkPos == chunkLen) {
|
||||
if (this.leafHash)
|
||||
super.update(this.leafHash.digest());
|
||||
else {
|
||||
this.suffix = 0x06; // Its safe to change suffix here since its used only in digest()
|
||||
super.update(new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0]));
|
||||
}
|
||||
this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds);
|
||||
this.chunksDone++;
|
||||
this.chunkPos = 0;
|
||||
}
|
||||
const take = Math.min(chunkLen - this.chunkPos, len - pos);
|
||||
const chunk = data.subarray(pos, pos + take);
|
||||
if (this.leafHash)
|
||||
this.leafHash.update(chunk);
|
||||
else
|
||||
super.update(chunk);
|
||||
this.chunkPos += take;
|
||||
pos += take;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
finish() {
|
||||
if (this.finished)
|
||||
return;
|
||||
const { personalization } = this;
|
||||
this.update(personalization).update(rightEncodeK12(personalization.length));
|
||||
// Leaf hash
|
||||
if (this.leafHash) {
|
||||
super.update(this.leafHash.digest());
|
||||
super.update(rightEncodeK12(this.chunksDone));
|
||||
super.update(new Uint8Array([0xff, 0xff]));
|
||||
}
|
||||
super.finish.call(this);
|
||||
}
|
||||
destroy() {
|
||||
super.destroy.call(this);
|
||||
if (this.leafHash)
|
||||
this.leafHash.destroy();
|
||||
// We cannot zero personalization buffer since it is user provided and we don't want to mutate user input
|
||||
this.personalization = EMPTY;
|
||||
}
|
||||
_cloneInto(to) {
|
||||
const { blockLen, leafLen, leafHash, outputLen, rounds } = this;
|
||||
to || (to = new KangarooTwelve(blockLen, leafLen, outputLen, rounds, {}));
|
||||
super._cloneInto(to);
|
||||
if (leafHash)
|
||||
to.leafHash = leafHash._cloneInto(to.leafHash);
|
||||
to.personalization.set(this.personalization);
|
||||
to.leafLen = this.leafLen;
|
||||
to.chunkPos = this.chunkPos;
|
||||
to.chunksDone = this.chunksDone;
|
||||
return to;
|
||||
}
|
||||
clone() {
|
||||
return this._cloneInto();
|
||||
}
|
||||
}
|
||||
// Default to 32 bytes, so it can be used without opts
|
||||
export const k12 = wrapConstructorWithOpts((opts = {}) => new KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts));
|
||||
// MarsupilamiFourteen
|
||||
export const m14 = wrapConstructorWithOpts((opts = {}) => new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts));
|
||||
// https://keccak.team/files/CSF-0.1.pdf
|
||||
// + https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG
|
||||
class KeccakPRG extends Keccak {
|
||||
constructor(capacity) {
|
||||
assertNumber(capacity);
|
||||
// Rho should be full bytes
|
||||
if (capacity < 0 || capacity > 1600 - 10 || (1600 - capacity - 2) % 8)
|
||||
throw new Error('KeccakPRG: Invalid capacity');
|
||||
// blockLen = rho in bytes
|
||||
super((1600 - capacity - 2) / 8, 0, 0, true);
|
||||
this.rate = 1600 - capacity;
|
||||
this.posOut = Math.floor((this.rate + 7) / 8);
|
||||
}
|
||||
keccak() {
|
||||
// Duplex padding
|
||||
this.state[this.pos] ^= 0x01;
|
||||
this.state[this.blockLen] ^= 0x02; // Rho is full bytes
|
||||
super.keccak();
|
||||
this.pos = 0;
|
||||
this.posOut = 0;
|
||||
}
|
||||
update(data) {
|
||||
super.update(data);
|
||||
this.posOut = this.blockLen;
|
||||
return this;
|
||||
}
|
||||
feed(data) {
|
||||
return this.update(data);
|
||||
}
|
||||
finish() { }
|
||||
digestInto(out) {
|
||||
throw new Error('KeccakPRG: digest is not allowed, please use .fetch instead.');
|
||||
}
|
||||
fetch(bytes) {
|
||||
return this.xof(bytes);
|
||||
}
|
||||
// Ensure irreversibility (even if state leaked previous outputs cannot be computed)
|
||||
forget() {
|
||||
if (this.rate < 1600 / 2 + 1)
|
||||
throw new Error('KeccakPRG: rate too low to use forget');
|
||||
this.keccak();
|
||||
for (let i = 0; i < this.blockLen; i++)
|
||||
this.state[i] = 0;
|
||||
this.pos = this.blockLen;
|
||||
this.keccak();
|
||||
this.posOut = this.blockLen;
|
||||
}
|
||||
_cloneInto(to) {
|
||||
const { rate } = this;
|
||||
to || (to = new KeccakPRG(1600 - rate));
|
||||
super._cloneInto(to);
|
||||
to.rate = rate;
|
||||
return to;
|
||||
}
|
||||
clone() {
|
||||
return this._cloneInto();
|
||||
}
|
||||
}
|
||||
export const keccakprg = (capacity = 254) => new KeccakPRG(capacity);
|
||||
//# sourceMappingURL=sha3-addons.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ignoreElements.js","sourceRoot":"","sources":["../../../../src/internal/operators/ignoreElements.ts"],"names":[],"mappings":";;;AACA,qCAAuC;AACvC,2DAAgE;AAChE,qCAAoC;AAqCpC,SAAgB,cAAc;IAC5B,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,MAAM,CAAC,SAAS,CAAC,6CAAwB,CAAC,UAAU,EAAE,WAAI,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,wCAIC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0.00351,"49":0,"50":0,"51":0,"52":0.00351,"53":0,"54":0,"55":0,"56":0,"57":0.00351,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0.00351,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0.00351,"95":0,"96":0.01054,"97":0,"98":0,"99":0.01054,"100":0.00351,"101":0.00351,"102":0.01054,"103":0.00702,"104":0.00351,"105":0.00702,"106":0.03863,"107":0.01054,"108":0.07726,"109":0.46007,"110":0.30554,"111":0.01054,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00351,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0.01054,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00702,"47":0,"48":0,"49":0.00702,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0.01054,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0.00702,"64":0.00351,"65":0.00351,"66":0,"67":0,"68":0.00351,"69":0.00702,"70":0.01054,"71":0.00351,"72":0.00351,"73":0.00351,"74":0.01405,"75":0.00351,"76":0.00351,"77":0.00702,"78":0.00351,"79":0.01756,"80":0.00351,"81":0.02458,"83":0.00351,"84":0.00351,"85":0.00351,"86":0.00351,"87":0.01054,"88":0.00702,"89":0.00351,"90":0.00351,"91":0.00351,"92":0.01756,"93":0.00702,"94":0.00351,"95":0.02107,"96":0.01054,"97":0.00351,"98":0.01054,"99":0.00702,"100":0.00702,"101":0.01054,"102":0.02107,"103":0.04214,"104":0.0281,"105":0.03161,"106":0.0281,"107":0.06673,"108":0.18965,"109":3.43825,"110":2.04047,"111":0.00702,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0.01054,"27":0,"28":0.01054,"29":0,"30":0.00351,"31":0,"32":0.00702,"33":0,"34":0,"35":0.01405,"36":0,"37":0,"38":0.00351,"39":0,"40":0,"41":0,"42":0.01405,"43":0,"44":0,"45":0.00351,"46":0.00351,"47":0.07726,"48":0,"49":0,"50":0.03161,"51":0.00702,"52":0,"53":0,"54":0.01054,"55":0,"56":0,"57":0.01054,"58":0.0281,"60":0.14048,"62":0,"63":0.21072,"64":0.13697,"65":0.0597,"66":0.22477,"67":0.41793,"68":0,"69":0,"70":0.00351,"71":0,"72":0.00351,"73":0.00351,"74":0.00351,"75":0,"76":0,"77":0,"78":0,"79":0.01054,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.01054,"86":0.00351,"87":0,"88":0,"89":0,"90":0.00351,"91":0.00351,"92":0.00351,"93":0.00702,"94":0.12643,"95":0.22477,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.10887},B:{"12":0.01054,"13":0.00702,"14":0.03512,"15":0.01054,"16":0.01054,"17":0.01054,"18":0.03512,"79":0,"80":0,"81":0,"83":0,"84":0.00702,"85":0.00351,"86":0,"87":0,"88":0,"89":0.01756,"90":0.00702,"91":0,"92":0.02458,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00351,"100":0.00702,"101":0,"102":0.00351,"103":0.00702,"104":0.00351,"105":0.00702,"106":0.00702,"107":0.05619,"108":0.05619,"109":0.52329,"110":0.68133},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00351,"14":0.00702,"15":0.00702,_:"0","3.1":0,"3.2":0,"5.1":0.00702,"6.1":0,"7.1":0,"9.1":0.00351,"10.1":0,"11.1":0.00351,"12.1":0.00351,"13.1":0.01054,"14.1":0.04214,"15.1":0.00351,"15.2-15.3":0.00351,"15.4":0.00702,"15.5":0.01405,"15.6":0.07726,"16.0":0.01054,"16.1":0.0281,"16.2":0.05619,"16.3":0.08078,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00104,"6.0-6.1":0,"7.0-7.1":0.00104,"8.1-8.4":0.00208,"9.0-9.2":0.00104,"9.3":0.06652,"10.0-10.2":0,"10.3":0.03014,"11.0-11.2":0.12161,"11.3-11.4":0.0052,"12.0-12.1":0.04365,"12.2-12.5":0.54567,"13.0-13.1":0.00831,"13.2":0.00728,"13.3":0.02702,"13.4-13.7":0.06132,"14.0-14.4":0.26816,"14.5-14.8":0.46252,"15.0-15.1":0.1715,"15.2-15.3":0.26816,"15.4":0.23594,"15.5":0.40639,"15.6":0.86164,"16.0":1.06743,"16.1":1.73159,"16.2":1.70665,"16.3":1.36157,"16.4":0.00312},P:{"4":0.10244,"20":0.27659,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.17415,"8.2":0,"9.2":0.01024,"10.1":0,"11.1-11.2":0.02049,"12.0":0.01024,"13.0":0.05122,"14.0":0.08195,"15.0":0.04098,"16.0":0.14342,"17.0":0.06147,"18.0":0.08195,"19.0":1.08589},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00633,"4.4":0,"4.4.3-4.4.4":0.13421},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.02107,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.00649,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":1.1873},H:{"0":8.31069},L:{"0":63.77162},R:{_:"0"},M:{"0":0.23357},Q:{"13.1":0.0519}};
|
||||
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var ToInt32 = require('../ToInt32');
|
||||
var ToUint32 = require('../ToUint32');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-unsignedRightShift
|
||||
|
||||
module.exports = function NumberUnsignedRightShift(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
|
||||
var lnum = ToInt32(x);
|
||||
var rnum = ToUint32(y);
|
||||
|
||||
var shiftCount = rnum & 0x1F;
|
||||
|
||||
return lnum >>> shiftCount;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var CreateDataProperty = require('./CreateDataProperty');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow
|
||||
|
||||
module.exports = function CreateDataPropertyOrThrow(O, P, V) {
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
||||
}
|
||||
if (!IsPropertyKey(P)) {
|
||||
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
||||
}
|
||||
var success = CreateDataProperty(O, P, V);
|
||||
if (!success) {
|
||||
throw new $TypeError('unable to create data property');
|
||||
}
|
||||
return success;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
declare function getPropertyByPath(source: {
|
||||
[key: string]: unknown;
|
||||
}, path: string | Array<string>): unknown;
|
||||
export { getPropertyByPath };
|
||||
//# sourceMappingURL=getPropertyByPath.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,SAAS,eAAe,CAAC,GAAW;IACnC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACzB,MAAM,IAAI,SAAS,CAClB,kEAAkE,CAClE,CAAC;KACF;IAED,iBAAiB;IACjB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEhC,+DAA+D;IAC/D,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,UAAU,KAAK,CAAC,CAAC,IAAI,UAAU,IAAI,CAAC,EAAE;QACzC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAC3C;IAED,mDAAmD;IACnD,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAErD,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC;IACrC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YACzB,MAAM,GAAG,IAAI,CAAC;SACd;aAAM;YACN,QAAQ,IAAI,IAAM,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBACtC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aAC/B;SACD;KACD;IACD,oDAAoD;IACpD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,QAAQ,IAAI,mBAAmB,CAAC;QAChC,OAAO,GAAG,UAAU,CAAC;KACrB;IAED,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAA+B,CAAC;IAEzE,sDAAsD;IACtD,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE3B,8BAA8B;IAC9B,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAEzB,OAAO,MAAM,CAAC;AACf,CAAC;AAUD,iBAAS,eAAe,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"shebang-command","version":"2.0.0","files":{"license":{"checkedAt":1678883670657,"integrity":"sha512-QQmk4M/jfBcyygmcqkvREGxOKYqfHdUIKM74BnQ1zGaNq0S+fUpNo/uv3aWu7iKuXEJBbPedCZYIl4PLE7L/Sg==","mode":420,"size":1116},"index.js":{"checkedAt":1678883670657,"integrity":"sha512-ke6l3VBCfYsEfgo3oeF+HPhVuX1jolfdY0cUWTYQDH4T59KATrzxC8D0BwkKRELj1r2Y981Gpjdiob9i8rvIqQ==","mode":420,"size":387},"package.json":{"checkedAt":1678883670657,"integrity":"sha512-RSLnhnXEL+fcLDY6pXhB2zk6R6rZ/JS6XW3O+pMtosR37IvqXq95BRGxxDj5SkA90AQbW50AXZlR+Qbv/VO5rg==","mode":420,"size":558},"readme.md":{"checkedAt":1678883670657,"integrity":"sha512-z4JzoMGGqrM6pKE/AfhgYNOQ/U3whlefZxt4OpGtuV5y28WqkZh6AnR/0A40a9z1CJpwl2vHL1kE/CfWxVWbTg==","mode":420,"size":495}}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./every');
|
||||
@@ -0,0 +1,93 @@
|
||||
export interface CSVParseParam {
|
||||
/**
|
||||
* delimiter used for seperating columns. Use "auto" if delimiter is unknown in advance, in this case, delimiter will be auto-detected (by best attempt). Use an array to give a list of potential delimiters e.g. [",","|","$"]. default: ","
|
||||
*/
|
||||
delimiter: string | string[];
|
||||
/**
|
||||
* This parameter instructs the parser to ignore columns as specified by the regular expression. Example: /(name|age)/ will ignore columns whose header contains "name" or "age"
|
||||
*/
|
||||
ignoreColumns?: RegExp;
|
||||
/**
|
||||
* This parameter instructs the parser to include only those columns as specified by the regular expression. Example: /(name|age)/ will parse and include columns whose header contains "name" or "age"
|
||||
*/
|
||||
includeColumns?: RegExp;
|
||||
/**
|
||||
* If a column contains delimiter, it is able to use quote character to surround the column content. e.g. "hello, world" wont be split into two columns while parsing. Set to "off" will ignore all quotes. default: " (double quote)
|
||||
*/
|
||||
quote: string;
|
||||
/**
|
||||
* Indicate if parser trim off spaces surrounding column content. e.g. " content " will be trimmed to "content". Default: true
|
||||
*/
|
||||
trim: boolean;
|
||||
/**
|
||||
* This parameter turns on and off whether check field type. Default is false.
|
||||
*/
|
||||
checkType: boolean;
|
||||
/**
|
||||
* Ignore the empty value in CSV columns. If a column value is not given, set this to true to skip them. Default: false.
|
||||
*/
|
||||
ignoreEmpty: boolean;
|
||||
/**
|
||||
* Delegate parsing work to another process.
|
||||
*/
|
||||
/**
|
||||
* Indicating csv data has no header row and first row is data row. Default is false.
|
||||
*/
|
||||
noheader: boolean;
|
||||
/**
|
||||
* An array to specify the headers of CSV data. If --noheader is false, this value will override CSV header row. Default: null. Example: ["my field","name"].
|
||||
*/
|
||||
headers?: string[];
|
||||
/**
|
||||
* Don't interpret dots (.) and square brackets in header fields as nested object or array identifiers at all (treat them like regular characters for JSON field identifiers). Default: false.
|
||||
*/
|
||||
flatKeys: boolean;
|
||||
/**
|
||||
* the max character a csv row could have. 0 means infinite. If max number exceeded, parser will emit "error" of "row_exceed". if a possibly corrupted csv data provided, give it a number like 65535 so the parser wont consume memory. default: 0
|
||||
*/
|
||||
maxRowLength: number;
|
||||
/**
|
||||
* whether check column number of a row is the same as headers. If column number mismatched headers number, an error of "mismatched_column" will be emitted.. default: false
|
||||
*/
|
||||
checkColumn: boolean;
|
||||
/**
|
||||
* escape character used in quoted column. Default is double quote (") according to RFC4108. Change to back slash (\) or other chars for your own case.
|
||||
*/
|
||||
escape: string;
|
||||
/**
|
||||
* Allows override parsing logic for a specific column. It accepts a JSON object with fields like: headName: <String | Function> . e.g. {field1:'number'} will use built-in number parser to convert value of the field1 column to number. Another example {"name":nameProcessFunc} will use specified function to parse the value.
|
||||
*/
|
||||
colParser: {
|
||||
[key: string]: string | CellParser | ColumnParam;
|
||||
};
|
||||
/**
|
||||
* End of line character. If omitted, parser will attempt to retrieve it from the first chunks of CSV data
|
||||
*/
|
||||
eol?: string;
|
||||
/**
|
||||
* Always interpret each line (as defined by eol) as a row. This will prevent eol characters from being used within a row (even inside a quoted field). Default is false. Change to true if you are confident no inline line breaks (like line break in a cell which has multi line text)
|
||||
*/
|
||||
alwaysSplitAtEOL: boolean;
|
||||
/**
|
||||
* The format to be converted to. "json" (default) -- convert csv to json. "csv" -- convert csv to csv row array. "line" -- convert csv to csv line string
|
||||
*/
|
||||
output: "json" | "csv" | "line";
|
||||
/**
|
||||
* Convert string "null" to null object in JSON outputs. Default is false.
|
||||
*/
|
||||
nullObject: boolean;
|
||||
/**
|
||||
* Define the format required by downstream (this parameter does not work if objectMode is on). `line` -- json is emitted in a single line separated by a line breake like "json1\njson2" . `array` -- downstream requires array format like "[json1,json2]". Default is line.
|
||||
*/
|
||||
downstreamFormat: "line" | "array";
|
||||
/**
|
||||
* Define whether .then(callback) returns all JSON data in its callback. Default is true. Change to false to save memory if subscribing json lines.
|
||||
*/
|
||||
needEmitAll: boolean;
|
||||
}
|
||||
export declare type CellParser = (item: string, head: string, resultRow: any, row: string[], columnIndex: number) => any;
|
||||
export interface ColumnParam {
|
||||
flat?: boolean;
|
||||
cellParser?: string | CellParser;
|
||||
}
|
||||
export declare function mergeParams(params?: Partial<CSVParseParam>): CSVParseParam;
|
||||
@@ -0,0 +1,256 @@
|
||||
"use strict";;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var types_1 = tslib_1.__importDefault(require("../lib/types"));
|
||||
var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
|
||||
var es7_1 = tslib_1.__importDefault(require("./es7"));
|
||||
function default_1(fork) {
|
||||
fork.use(es7_1.default);
|
||||
var types = fork.use(types_1.default);
|
||||
var defaults = fork.use(shared_1.default).defaults;
|
||||
var def = types.Type.def;
|
||||
var or = types.Type.or;
|
||||
def("Noop")
|
||||
.bases("Statement")
|
||||
.build();
|
||||
def("DoExpression")
|
||||
.bases("Expression")
|
||||
.build("body")
|
||||
.field("body", [def("Statement")]);
|
||||
def("Super")
|
||||
.bases("Expression")
|
||||
.build();
|
||||
def("BindExpression")
|
||||
.bases("Expression")
|
||||
.build("object", "callee")
|
||||
.field("object", or(def("Expression"), null))
|
||||
.field("callee", def("Expression"));
|
||||
def("Decorator")
|
||||
.bases("Node")
|
||||
.build("expression")
|
||||
.field("expression", def("Expression"));
|
||||
def("Property")
|
||||
.field("decorators", or([def("Decorator")], null), defaults["null"]);
|
||||
def("MethodDefinition")
|
||||
.field("decorators", or([def("Decorator")], null), defaults["null"]);
|
||||
def("MetaProperty")
|
||||
.bases("Expression")
|
||||
.build("meta", "property")
|
||||
.field("meta", def("Identifier"))
|
||||
.field("property", def("Identifier"));
|
||||
def("ParenthesizedExpression")
|
||||
.bases("Expression")
|
||||
.build("expression")
|
||||
.field("expression", def("Expression"));
|
||||
def("ImportSpecifier")
|
||||
.bases("ModuleSpecifier")
|
||||
.build("imported", "local")
|
||||
.field("imported", def("Identifier"));
|
||||
def("ImportDefaultSpecifier")
|
||||
.bases("ModuleSpecifier")
|
||||
.build("local");
|
||||
def("ImportNamespaceSpecifier")
|
||||
.bases("ModuleSpecifier")
|
||||
.build("local");
|
||||
def("ExportDefaultDeclaration")
|
||||
.bases("Declaration")
|
||||
.build("declaration")
|
||||
.field("declaration", or(def("Declaration"), def("Expression")));
|
||||
def("ExportNamedDeclaration")
|
||||
.bases("Declaration")
|
||||
.build("declaration", "specifiers", "source")
|
||||
.field("declaration", or(def("Declaration"), null))
|
||||
.field("specifiers", [def("ExportSpecifier")], defaults.emptyArray)
|
||||
.field("source", or(def("Literal"), null), defaults["null"]);
|
||||
def("ExportSpecifier")
|
||||
.bases("ModuleSpecifier")
|
||||
.build("local", "exported")
|
||||
.field("exported", def("Identifier"));
|
||||
def("ExportNamespaceSpecifier")
|
||||
.bases("Specifier")
|
||||
.build("exported")
|
||||
.field("exported", def("Identifier"));
|
||||
def("ExportDefaultSpecifier")
|
||||
.bases("Specifier")
|
||||
.build("exported")
|
||||
.field("exported", def("Identifier"));
|
||||
def("ExportAllDeclaration")
|
||||
.bases("Declaration")
|
||||
.build("exported", "source")
|
||||
.field("exported", or(def("Identifier"), null))
|
||||
.field("source", def("Literal"));
|
||||
def("CommentBlock")
|
||||
.bases("Comment")
|
||||
.build("value", /*optional:*/ "leading", "trailing");
|
||||
def("CommentLine")
|
||||
.bases("Comment")
|
||||
.build("value", /*optional:*/ "leading", "trailing");
|
||||
def("Directive")
|
||||
.bases("Node")
|
||||
.build("value")
|
||||
.field("value", def("DirectiveLiteral"));
|
||||
def("DirectiveLiteral")
|
||||
.bases("Node", "Expression")
|
||||
.build("value")
|
||||
.field("value", String, defaults["use strict"]);
|
||||
def("InterpreterDirective")
|
||||
.bases("Node")
|
||||
.build("value")
|
||||
.field("value", String);
|
||||
def("BlockStatement")
|
||||
.bases("Statement")
|
||||
.build("body")
|
||||
.field("body", [def("Statement")])
|
||||
.field("directives", [def("Directive")], defaults.emptyArray);
|
||||
def("Program")
|
||||
.bases("Node")
|
||||
.build("body")
|
||||
.field("body", [def("Statement")])
|
||||
.field("directives", [def("Directive")], defaults.emptyArray)
|
||||
.field("interpreter", or(def("InterpreterDirective"), null), defaults["null"]);
|
||||
// Split Literal
|
||||
def("StringLiteral")
|
||||
.bases("Literal")
|
||||
.build("value")
|
||||
.field("value", String);
|
||||
def("NumericLiteral")
|
||||
.bases("Literal")
|
||||
.build("value")
|
||||
.field("value", Number)
|
||||
.field("raw", or(String, null), defaults["null"])
|
||||
.field("extra", {
|
||||
rawValue: Number,
|
||||
raw: String
|
||||
}, function getDefault() {
|
||||
return {
|
||||
rawValue: this.value,
|
||||
raw: this.value + ""
|
||||
};
|
||||
});
|
||||
def("BigIntLiteral")
|
||||
.bases("Literal")
|
||||
.build("value")
|
||||
// Only String really seems appropriate here, since BigInt values
|
||||
// often exceed the limits of JS numbers.
|
||||
.field("value", or(String, Number))
|
||||
.field("extra", {
|
||||
rawValue: String,
|
||||
raw: String
|
||||
}, function getDefault() {
|
||||
return {
|
||||
rawValue: String(this.value),
|
||||
raw: this.value + "n"
|
||||
};
|
||||
});
|
||||
def("NullLiteral")
|
||||
.bases("Literal")
|
||||
.build()
|
||||
.field("value", null, defaults["null"]);
|
||||
def("BooleanLiteral")
|
||||
.bases("Literal")
|
||||
.build("value")
|
||||
.field("value", Boolean);
|
||||
def("RegExpLiteral")
|
||||
.bases("Literal")
|
||||
.build("pattern", "flags")
|
||||
.field("pattern", String)
|
||||
.field("flags", String)
|
||||
.field("value", RegExp, function () {
|
||||
return new RegExp(this.pattern, this.flags);
|
||||
});
|
||||
var ObjectExpressionProperty = or(def("Property"), def("ObjectMethod"), def("ObjectProperty"), def("SpreadProperty"), def("SpreadElement"));
|
||||
// Split Property -> ObjectProperty and ObjectMethod
|
||||
def("ObjectExpression")
|
||||
.bases("Expression")
|
||||
.build("properties")
|
||||
.field("properties", [ObjectExpressionProperty]);
|
||||
// ObjectMethod hoist .value properties to own properties
|
||||
def("ObjectMethod")
|
||||
.bases("Node", "Function")
|
||||
.build("kind", "key", "params", "body", "computed")
|
||||
.field("kind", or("method", "get", "set"))
|
||||
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
|
||||
.field("params", [def("Pattern")])
|
||||
.field("body", def("BlockStatement"))
|
||||
.field("computed", Boolean, defaults["false"])
|
||||
.field("generator", Boolean, defaults["false"])
|
||||
.field("async", Boolean, defaults["false"])
|
||||
.field("accessibility", // TypeScript
|
||||
or(def("Literal"), null), defaults["null"])
|
||||
.field("decorators", or([def("Decorator")], null), defaults["null"]);
|
||||
def("ObjectProperty")
|
||||
.bases("Node")
|
||||
.build("key", "value")
|
||||
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
|
||||
.field("value", or(def("Expression"), def("Pattern")))
|
||||
.field("accessibility", // TypeScript
|
||||
or(def("Literal"), null), defaults["null"])
|
||||
.field("computed", Boolean, defaults["false"]);
|
||||
var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod"));
|
||||
// MethodDefinition -> ClassMethod
|
||||
def("ClassBody")
|
||||
.bases("Declaration")
|
||||
.build("body")
|
||||
.field("body", [ClassBodyElement]);
|
||||
def("ClassMethod")
|
||||
.bases("Declaration", "Function")
|
||||
.build("kind", "key", "params", "body", "computed", "static")
|
||||
.field("key", or(def("Literal"), def("Identifier"), def("Expression")));
|
||||
def("ClassPrivateMethod")
|
||||
.bases("Declaration", "Function")
|
||||
.build("key", "params", "body", "kind", "computed", "static")
|
||||
.field("key", def("PrivateName"));
|
||||
["ClassMethod",
|
||||
"ClassPrivateMethod",
|
||||
].forEach(function (typeName) {
|
||||
def(typeName)
|
||||
.field("kind", or("get", "set", "method", "constructor"), function () { return "method"; })
|
||||
.field("body", def("BlockStatement"))
|
||||
.field("computed", Boolean, defaults["false"])
|
||||
.field("static", or(Boolean, null), defaults["null"])
|
||||
.field("abstract", or(Boolean, null), defaults["null"])
|
||||
.field("access", or("public", "private", "protected", null), defaults["null"])
|
||||
.field("accessibility", or("public", "private", "protected", null), defaults["null"])
|
||||
.field("decorators", or([def("Decorator")], null), defaults["null"])
|
||||
.field("optional", or(Boolean, null), defaults["null"]);
|
||||
});
|
||||
def("ClassPrivateProperty")
|
||||
.bases("ClassProperty")
|
||||
.build("key", "value")
|
||||
.field("key", def("PrivateName"))
|
||||
.field("value", or(def("Expression"), null), defaults["null"]);
|
||||
def("PrivateName")
|
||||
.bases("Expression", "Pattern")
|
||||
.build("id")
|
||||
.field("id", def("Identifier"));
|
||||
var ObjectPatternProperty = or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty"), // Used by Esprima
|
||||
def("ObjectProperty"), // Babel 6
|
||||
def("RestProperty") // Babel 6
|
||||
);
|
||||
// Split into RestProperty and SpreadProperty
|
||||
def("ObjectPattern")
|
||||
.bases("Pattern")
|
||||
.build("properties")
|
||||
.field("properties", [ObjectPatternProperty])
|
||||
.field("decorators", or([def("Decorator")], null), defaults["null"]);
|
||||
def("SpreadProperty")
|
||||
.bases("Node")
|
||||
.build("argument")
|
||||
.field("argument", def("Expression"));
|
||||
def("RestProperty")
|
||||
.bases("Node")
|
||||
.build("argument")
|
||||
.field("argument", def("Expression"));
|
||||
def("ForAwaitStatement")
|
||||
.bases("Statement")
|
||||
.build("left", "right", "body")
|
||||
.field("left", or(def("VariableDeclaration"), def("Expression")))
|
||||
.field("right", def("Expression"))
|
||||
.field("body", def("Statement"));
|
||||
// The callee node of a dynamic import(...) expression.
|
||||
def("Import")
|
||||
.bases("Expression")
|
||||
.build();
|
||||
}
|
||||
exports.default = default_1;
|
||||
module.exports = exports["default"];
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0.00492,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0.00492,"43":0.00492,"44":0,"45":0,"46":0,"47":0,"48":0.00984,"49":0,"50":0,"51":0,"52":0.09842,"53":0,"54":0,"55":0,"56":0.00492,"57":0.00492,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.00492,"68":0.00492,"69":0,"70":0.00492,"71":0,"72":0.01476,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.02461,"79":0,"80":0.00984,"81":0.00492,"82":0.00984,"83":0,"84":0,"85":0.00492,"86":0.00492,"87":0,"88":0.00984,"89":0.02461,"90":0,"91":0.00984,"92":0.00984,"93":0.00492,"94":0.00984,"95":0.02461,"96":0.01476,"97":0.00984,"98":0,"99":0.01476,"100":0.00984,"101":0.00492,"102":0.08858,"103":0.01476,"104":0.01968,"105":0.02461,"106":0.02953,"107":0.02953,"108":0.11318,"109":1.83553,"110":1.03341,"111":0.03445,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.02953,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0.00492,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0.00984,"40":0,"41":0,"42":0.00492,"43":0.00492,"44":0,"45":0,"46":0.00492,"47":0,"48":0,"49":0.01476,"50":0.00492,"51":0,"52":0,"53":0.00492,"54":0,"55":0.01476,"56":0.00492,"57":0.02461,"58":0.00492,"59":0,"60":0.00492,"61":0,"62":0,"63":0,"64":0.00492,"65":0.00984,"66":0.00492,"67":0.00984,"68":0,"69":0.01476,"70":0.00984,"71":0.00984,"72":0.00492,"73":0.00492,"74":0.02461,"75":0.00492,"76":0.00492,"77":0.00492,"78":0.00492,"79":0.05413,"80":0.01476,"81":0.03445,"83":0.01476,"84":0.00984,"85":0.01968,"86":0.02953,"87":0.01968,"88":0.02461,"89":0.00492,"90":0.03937,"91":0.01476,"92":0.00984,"93":0.00984,"94":0.00984,"95":0.05413,"96":0.03937,"97":0.07874,"98":0.01968,"99":0.01476,"100":0.02461,"101":0.05905,"102":0.03445,"103":0.08366,"104":0.05905,"105":0.13287,"106":0.07382,"107":0.22145,"108":0.36415,"109":7.93265,"110":3.85806,"111":0.00492,"112":0.02953,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0.00492,"25":0,"26":0.00492,"27":0.00492,"28":0.00492,"29":0,"30":0,"31":0,"32":0.01476,"33":0.00492,"34":0,"35":0,"36":0,"37":0.02461,"38":0.00492,"39":0,"40":0,"41":0.01968,"42":0.01476,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0.01476,"51":0,"52":0,"53":0.07874,"54":0,"55":0,"56":0,"57":0.05905,"58":0.03937,"60":0.04429,"62":0.00492,"63":0.03445,"64":0.03445,"65":0.00984,"66":0.01476,"67":0.14271,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.00492,"75":0,"76":0,"77":0,"78":0,"79":0.01476,"80":0.00984,"81":0,"82":0,"83":0,"84":0,"85":0.00984,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.01968,"94":0.24605,"95":0.44781,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.01476},B:{"12":0.00492,"13":0.00492,"14":0.00492,"15":0.01968,"16":0,"17":0.01476,"18":0.01476,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0.00492,"86":0,"87":0,"88":0,"89":0.00492,"90":0.00984,"91":0,"92":0.04921,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00492,"101":0,"102":0,"103":0.06889,"104":0.00492,"105":0.00492,"106":0.00984,"107":0.04429,"108":0.02953,"109":1.12199,"110":0.83165},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00492,"14":0.00492,"15":0.00492,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.03445,"13.1":0.02953,"14.1":0.04921,"15.1":0.00492,"15.2-15.3":0,"15.4":0.00984,"15.5":0.03445,"15.6":0.03445,"16.0":0.00492,"16.1":0.01476,"16.2":0.03937,"16.3":0.04921,"16.4":0},G:{"8":0.00614,"3.2":0.00061,"4.0-4.1":0,"4.2-4.3":0.0043,"5.0-5.1":0.00184,"6.0-6.1":0,"7.0-7.1":0.02455,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.22712,"10.0-10.2":0,"10.3":0.17862,"11.0-11.2":0.01719,"11.3-11.4":0.00307,"12.0-12.1":0.01166,"12.2-12.5":0.58559,"13.0-13.1":0.02517,"13.2":0.02148,"13.3":0.11294,"13.4-13.7":0.03069,"14.0-14.4":0.14425,"14.5-14.8":0.27929,"15.0-15.1":0.11356,"15.2-15.3":0.11847,"15.4":0.16757,"15.5":0.20747,"15.6":0.34865,"16.0":0.41433,"16.1":0.95634,"16.2":0.87777,"16.3":0.65004,"16.4":0.00246},P:{"4":0.04135,"20":0.09304,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.03101,"8.2":0,"9.2":0.02067,"10.1":0,"11.1-11.2":0.02067,"12.0":0.01034,"13.0":0.03101,"14.0":0.02067,"15.0":0.02067,"16.0":0.02067,"17.0":0.12405,"18.0":0.03101,"19.0":0.41349},I:{"0":0,"3":0,"4":0.00106,"2.1":0,"2.2":0,"2.3":0,"4.1":0.01802,"4.2-4.3":0.0371,"4.4":0,"4.4.3-4.4.4":0.1781},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0.00492,"10":0,"11":0.01476,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.29458,_:"3.0-3.1"},J:{"7":0,"10":0.01016},O:{"0":1.17833},H:{"0":4.47188},L:{"0":62.18327},R:{_:"0"},M:{"0":0.26411},Q:{"13.1":0.0254}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAKA,oDAAuC;AAEvC,SAAS,qBAAqB,CAC7B,IAA2D;IAE3D,OAAO,IAAI,eAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,WAAU,qBAAqB;IAoBjB,qCAAe,GAAG,eAAgB,CAAC;IAEhD,qBAAqB,CAAC,SAAS,GAAG,eAAgB,CAAC,SAAS,CAAC;AAC9D,CAAC,EAvBS,qBAAqB,KAArB,qBAAqB,QAuB9B;AAED,iBAAS,qBAAqB,CAAC"}
|
||||
@@ -0,0 +1,49 @@
|
||||
# postcss-selector-parser [](https://travis-ci.org/postcss/postcss-selector-parser)
|
||||
|
||||
> Selector parser with built in methods for working with selector strings.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.com/package/postcss-selector-parser) do:
|
||||
|
||||
```
|
||||
npm install postcss-selector-parser
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const transform = selectors => {
|
||||
selectors.walk(selector => {
|
||||
// do something with the selector
|
||||
console.log(String(selector))
|
||||
});
|
||||
};
|
||||
|
||||
const transformed = parser(transform).processSync('h1, h2, h3');
|
||||
```
|
||||
|
||||
To normalize selector whitespace:
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const normalized = parser().processSync('h1, h2, h3', {lossless: false});
|
||||
// -> h1,h2,h3
|
||||
```
|
||||
|
||||
Async support is provided through `parser.process` and will resolve a Promise
|
||||
with the resulting selector string.
|
||||
|
||||
## API
|
||||
|
||||
Please see [API.md](API.md).
|
||||
|
||||
## Credits
|
||||
|
||||
* Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped
|
||||
accelerate this module's development.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { Options, PreprocessorGroup } from '../types/index';
|
||||
declare const _default: (options?: Options.Pug) => PreprocessorGroup;
|
||||
export default _default;
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This function is like `arrayIncludes` except that it accepts a comparator.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to inspect.
|
||||
* @param {*} target The value to search for.
|
||||
* @param {Function} comparator The comparator invoked per element.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
*/
|
||||
function arrayIncludesWith(array, value, comparator) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (comparator(value, array[index])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = arrayIncludesWith;
|
||||
@@ -0,0 +1,92 @@
|
||||
# changelog
|
||||
|
||||
## 2.0.2
|
||||
|
||||
* Internal tidying up (change test runner, convert to JS)
|
||||
|
||||
## 2.0.1
|
||||
|
||||
* Robustify `this.remove()`, pass current index to walker functions ([#18](https://github.com/Rich-Harris/estree-walker/pull/18))
|
||||
|
||||
## 2.0.0
|
||||
|
||||
* Add an `asyncWalk` export ([#20](https://github.com/Rich-Harris/estree-walker/pull/20))
|
||||
* Internal rewrite
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Relax node type to `BaseNode` ([#17](https://github.com/Rich-Harris/estree-walker/pull/17))
|
||||
|
||||
## 1.0.0
|
||||
|
||||
* Don't cache child keys
|
||||
|
||||
## 0.9.0
|
||||
|
||||
* Add `this.remove()` method
|
||||
|
||||
## 0.8.1
|
||||
|
||||
* Fix pkg.files
|
||||
|
||||
## 0.8.0
|
||||
|
||||
* Adopt `estree` types
|
||||
|
||||
## 0.7.0
|
||||
|
||||
* Add a `this.replace(node)` method
|
||||
|
||||
## 0.6.1
|
||||
|
||||
* Only traverse nodes that exist and have a type ([#9](https://github.com/Rich-Harris/estree-walker/pull/9))
|
||||
* Only cache keys for nodes with a type ([#8](https://github.com/Rich-Harris/estree-walker/pull/8))
|
||||
|
||||
## 0.6.0
|
||||
|
||||
* Fix walker context type
|
||||
* Update deps, remove unncessary Bublé transformation
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Add types to package
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Prevent context corruption when `walk()` is called during a walk
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Export `childKeys`, for manually fixing in case of malformed ASTs
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Add TypeScript typings ([#3](https://github.com/Rich-Harris/estree-walker/pull/3))
|
||||
|
||||
## 0.3.1
|
||||
|
||||
* Include `pkg.repository` ([#2](https://github.com/Rich-Harris/estree-walker/pull/2))
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* More predictable ordering
|
||||
|
||||
## 0.2.1
|
||||
|
||||
* Keep `context` shape
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* Add ES6 build
|
||||
|
||||
## 0.1.3
|
||||
|
||||
* npm snafu
|
||||
|
||||
## 0.1.2
|
||||
|
||||
* Pass current prop and index to `enter`/`leave` callbacks
|
||||
|
||||
## 0.1.1
|
||||
|
||||
* First release
|
||||
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var slice = Array.prototype.slice;
|
||||
var isArgs = require('./isArguments');
|
||||
|
||||
var origKeys = Object.keys;
|
||||
var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
|
||||
|
||||
var originalKeys = Object.keys;
|
||||
|
||||
keysShim.shim = function shimObjectKeys() {
|
||||
if (Object.keys) {
|
||||
var keysWorksWithArguments = (function () {
|
||||
// Safari 5.0 bug
|
||||
var args = Object.keys(arguments);
|
||||
return args && args.length === arguments.length;
|
||||
}(1, 2));
|
||||
if (!keysWorksWithArguments) {
|
||||
Object.keys = function keys(object) { // eslint-disable-line func-name-matching
|
||||
if (isArgs(object)) {
|
||||
return originalKeys(slice.call(object));
|
||||
}
|
||||
return originalKeys(object);
|
||||
};
|
||||
}
|
||||
} else {
|
||||
Object.keys = keysShim;
|
||||
}
|
||||
return Object.keys || keysShim;
|
||||
};
|
||||
|
||||
module.exports = keysShim;
|
||||
@@ -0,0 +1,25 @@
|
||||
import {PromiseValue} from './promise-value';
|
||||
|
||||
type AsyncFunction = (...args: any[]) => Promise<unknown>;
|
||||
|
||||
/**
|
||||
Unwrap the return type of a function that returns a `Promise`.
|
||||
|
||||
There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript.
|
||||
|
||||
@example
|
||||
```ts
|
||||
import {AsyncReturnType} from 'type-fest';
|
||||
import {asyncFunction} from 'api';
|
||||
|
||||
// This type resolves to the unwrapped return type of `asyncFunction`.
|
||||
type Value = AsyncReturnType<typeof asyncFunction>;
|
||||
|
||||
async function doSomething(value: Value) {}
|
||||
|
||||
asyncFunction().then(value => doSomething(value));
|
||||
```
|
||||
|
||||
@category Utilities
|
||||
*/
|
||||
export type AsyncReturnType<Target extends AsyncFunction> = PromiseValue<ReturnType<Target>>;
|
||||
@@ -0,0 +1,500 @@
|
||||
[![npm][npm]][npm-url]
|
||||
[![node][node]][node-url]
|
||||
[![deps][deps]][deps-url]
|
||||
[![test][test]][test-url]
|
||||
[![coverage][cover]][cover-url]
|
||||
[![code style][style]][style-url]
|
||||
[![chat][chat]][chat-url]
|
||||
|
||||
<div align="center">
|
||||
<img width="100" height="100" title="Load Options" src="http://michael-ciniawsky.github.io/postcss-load-options/logo.svg">
|
||||
<a href="https://github.com/postcss/postcss">
|
||||
<img width="110" height="110" title="PostCSS" src="http://postcss.github.io/postcss/logo.svg" hspace="10">
|
||||
</a>
|
||||
<img width="100" height="100" title="Load Plugins" src="http://michael-ciniawsky.github.io/postcss-load-plugins/logo.svg">
|
||||
<h1>Load Config</h1>
|
||||
</div>
|
||||
|
||||
<h2 align="center">Install</h2>
|
||||
|
||||
```bash
|
||||
npm i -D postcss-load-config
|
||||
```
|
||||
|
||||
<h2 align="center">Usage</h2>
|
||||
|
||||
```bash
|
||||
npm i -S|-D postcss-plugin
|
||||
```
|
||||
|
||||
Install all required PostCSS plugins and save them to your **package.json** `dependencies`/`devDependencies`
|
||||
|
||||
Then create a PostCSS config file by choosing one of the following formats
|
||||
|
||||
### `package.json`
|
||||
|
||||
Create a **`postcss`** section in your project's **`package.json`**
|
||||
|
||||
```
|
||||
Project (Root)
|
||||
|– client
|
||||
|– public
|
||||
|
|
||||
|- package.json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"postcss": {
|
||||
"parser": "sugarss",
|
||||
"map": false,
|
||||
"plugins": {
|
||||
"postcss-plugin": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `.postcssrc`
|
||||
|
||||
Create a **`.postcssrc`** file in JSON or YAML format
|
||||
|
||||
> ℹ️ It's recommended to use an extension (e.g **`.postcssrc.json`** or **`.postcssrc.yml`**) instead of `.postcssrc`
|
||||
|
||||
```
|
||||
Project (Root)
|
||||
|– client
|
||||
|– public
|
||||
|
|
||||
|- (.postcssrc|.postcssrc.json|.postcssrc.yml)
|
||||
|- package.json
|
||||
```
|
||||
|
||||
**`.postcssrc.json`**
|
||||
```json
|
||||
{
|
||||
"parser": "sugarss",
|
||||
"map": false,
|
||||
"plugins": {
|
||||
"postcss-plugin": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**`.postcssrc.yml`**
|
||||
```yaml
|
||||
parser: sugarss
|
||||
map: false
|
||||
plugins:
|
||||
postcss-plugin: {}
|
||||
```
|
||||
|
||||
### `.postcssrc.js` or `postcss.config.js`
|
||||
|
||||
You may need some logic within your config. In this case create JS file named **`.postcssrc.js`** or **`postcss.config.js`**
|
||||
|
||||
```
|
||||
Project (Root)
|
||||
|– client
|
||||
|– public
|
||||
|
|
||||
|- (.postcssrc.js|postcss.config.js)
|
||||
|- package.json
|
||||
```
|
||||
|
||||
You can export the config as an `{Object}`
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
parser: 'sugarss',
|
||||
map: false,
|
||||
plugins: {
|
||||
'postcss-plugin': {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or export a `{Function}` that returns the config (more about the `ctx` param below)
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = (ctx) => ({
|
||||
parser: ctx.parser ? 'sugarss' : false,
|
||||
map: ctx.env === 'development' ? ctx.map : false,
|
||||
plugins: {
|
||||
'postcss-plugin': ctx.options.plugin
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Plugins can be loaded either using an `{Object}` or an `{Array}`
|
||||
|
||||
#### `{Object}`
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = ({ env }) => ({
|
||||
...options,
|
||||
plugins: {
|
||||
'postcss-plugin': env === 'production' ? {} : false
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
> ℹ️ When using an `{Object}`, the key can be a Node.js module name, a path to a JavaScript file that is relative to the directory of the PostCSS config file, or an absolute path to a JavaScript file.
|
||||
|
||||
#### `{Array}`
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = ({ env }) => ({
|
||||
...options,
|
||||
plugins: [
|
||||
env === 'production' ? require('postcss-plugin')() : false
|
||||
]
|
||||
})
|
||||
```
|
||||
> :warning: When using an `{Array}`, make sure to `require()` each plugin
|
||||
|
||||
<h2 align="center">Options</h2>
|
||||
|
||||
|Name|Type|Default|Description|
|
||||
|:--:|:--:|:-----:|:----------|
|
||||
|[**`to`**](#to)|`{String}`|`undefined`|Destination File Path|
|
||||
|[**`map`**](#map)|`{String\|Object}`|`false`|Enable/Disable Source Maps|
|
||||
|[**`from`**](#from)|`{String}`|`undefined`|Source File Path|
|
||||
|[**`parser`**](#parser)|`{String\|Function}`|`false`|Custom PostCSS Parser|
|
||||
|[**`syntax`**](#syntax)|`{String\|Function}`|`false`|Custom PostCSS Syntax|
|
||||
|[**`stringifier`**](#stringifier)|`{String\|Function}`|`false`|Custom PostCSS Stringifier|
|
||||
|
||||
### `parser`
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
parser: 'sugarss'
|
||||
}
|
||||
```
|
||||
|
||||
### `syntax`
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
syntax: 'postcss-scss'
|
||||
}
|
||||
```
|
||||
|
||||
### `stringifier`
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
stringifier: 'midas'
|
||||
}
|
||||
```
|
||||
|
||||
### [**`map`**](https://github.com/postcss/postcss/blob/master/docs/source-maps.md)
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
map: 'inline'
|
||||
}
|
||||
```
|
||||
|
||||
> :warning: In most cases `options.from` && `options.to` are set by the third-party which integrates this package (CLI, gulp, webpack). It's unlikely one needs to set/use `options.from` && `options.to` within a config file. Unless you're a third-party plugin author using this module and its Node API directly **dont't set `options.from` && `options.to` yourself**
|
||||
|
||||
### `to`
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
to: 'path/to/dest.css'
|
||||
}
|
||||
```
|
||||
|
||||
### `from`
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
from: 'path/to/src.css'
|
||||
}
|
||||
```
|
||||
|
||||
<h2 align="center">Plugins</h2>
|
||||
|
||||
### `{} || null`
|
||||
|
||||
The plugin will be loaded with defaults
|
||||
|
||||
```js
|
||||
'postcss-plugin': {} || null
|
||||
```
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
plugins: {
|
||||
'postcss-plugin': {} || null
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> :warning: `{}` must be an **empty** `{Object}` literal
|
||||
|
||||
### `{Object}`
|
||||
|
||||
The plugin will be loaded with given options
|
||||
|
||||
```js
|
||||
'postcss-plugin': { option: '', option: '' }
|
||||
```
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
plugins: {
|
||||
'postcss-plugin': { option: '', option: '' }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `false`
|
||||
|
||||
The plugin will not be loaded
|
||||
|
||||
```js
|
||||
'postcss-plugin': false
|
||||
```
|
||||
|
||||
**.postcssrc.js**
|
||||
```js
|
||||
module.exports = {
|
||||
plugins: {
|
||||
'postcss-plugin': false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `Ordering`
|
||||
|
||||
Plugin **execution order** is determined by declaration in the plugins section (**top-down**)
|
||||
|
||||
```js
|
||||
{
|
||||
plugins: {
|
||||
'postcss-plugin': {}, // [0]
|
||||
'postcss-plugin': {}, // [1]
|
||||
'postcss-plugin': {} // [2]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<h2 align="center">Context</h2>
|
||||
|
||||
When using a `{Function}` (`postcss.config.js` or `.postcssrc.js`), it's possible to pass context to `postcss-load-config`, which will be evaluated while loading your config. By default `ctx.env (process.env.NODE_ENV)` and `ctx.cwd (process.cwd())` are available on the `ctx` `{Object}`
|
||||
|
||||
> ℹ️ Most third-party integrations add additional properties to the `ctx` (e.g `postcss-loader`). Check the specific module's README for more information about what is available on the respective `ctx`
|
||||
|
||||
<h2 align="center">Examples</h2>
|
||||
|
||||
**postcss.config.js**
|
||||
|
||||
```js
|
||||
module.exports = (ctx) => ({
|
||||
parser: ctx.parser ? 'sugarss' : false,
|
||||
map: ctx.env === 'development' ? ctx.map : false,
|
||||
plugins: {
|
||||
'postcss-import': {},
|
||||
'postcss-nested': {},
|
||||
cssnano: ctx.env === 'production' ? {} : false
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
<div align="center">
|
||||
<img width="80" height="80" src="https://worldvectorlogo.com/logos/nodejs-icon.svg">
|
||||
</div>
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production node postcss",
|
||||
"start": "NODE_ENV=development node postcss"
|
||||
}
|
||||
```
|
||||
|
||||
### `Async`
|
||||
|
||||
```js
|
||||
const { readFileSync } = require('fs')
|
||||
|
||||
const postcss = require('postcss')
|
||||
const postcssrc = require('postcss-load-config')
|
||||
|
||||
const css = readFileSync('index.sss', 'utf8')
|
||||
|
||||
const ctx = { parser: true, map: 'inline' }
|
||||
|
||||
postcssrc(ctx).then(({ plugins, options }) => {
|
||||
postcss(plugins)
|
||||
.process(css, options)
|
||||
.then((result) => console.log(result.css))
|
||||
})
|
||||
```
|
||||
|
||||
### `Sync`
|
||||
|
||||
```js
|
||||
const { readFileSync } = require('fs')
|
||||
|
||||
const postcss = require('postcss')
|
||||
const postcssrc = require('postcss-load-config')
|
||||
|
||||
const css = readFileSync('index.sss', 'utf8')
|
||||
|
||||
const ctx = { parser: true, map: 'inline' }
|
||||
|
||||
const { plugins, options } = postcssrc.sync(ctx)
|
||||
```
|
||||
|
||||
<div align="center">
|
||||
<img width="80" height="80" halign="10" src="https://worldvectorlogo.com/logos/gulp.svg">
|
||||
</div>
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production gulp",
|
||||
"start": "NODE_ENV=development gulp"
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
const { task, src, dest, series, watch } = require('gulp')
|
||||
|
||||
const postcss = require('gulp-postcssrc')
|
||||
|
||||
const css = () => {
|
||||
src('src/*.css')
|
||||
.pipe(postcss())
|
||||
.pipe(dest('dest'))
|
||||
})
|
||||
|
||||
task('watch', () => {
|
||||
watch(['src/*.css', 'postcss.config.js'], css)
|
||||
})
|
||||
|
||||
task('default', series(css, 'watch'))
|
||||
```
|
||||
|
||||
<div align="center">
|
||||
<img width="80" height="80" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
|
||||
</div>
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production webpack",
|
||||
"start": "NODE_ENV=development webpack-dev-server"
|
||||
}
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
```js
|
||||
module.exports = (env) => ({
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader'
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
<h2 align="center">Maintainers</h2>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://github.com/michael-ciniawsky.png?v=3&s=150">
|
||||
<br />
|
||||
<a href="https://github.com/michael-ciniawsky">Michael Ciniawsky</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://github.com/ertrzyiks.png?v=3&s=150">
|
||||
<br />
|
||||
<a href="https://github.com/ertrzyiks">Mateusz Derks</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
<h2 align="center">Contributors</h2>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://github.com/sparty02.png?v=3&s=150">
|
||||
<br />
|
||||
<a href="https://github.com/sparty02">Ryan Dunckel</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://github.com/pcgilday.png?v=3&s=150">
|
||||
<br />
|
||||
<a href="https://github.com/pcgilday">Patrick Gilday</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://github.com/daltones.png?v=3&s=150">
|
||||
<br />
|
||||
<a href="https://github.com/daltones">Dalton Santos</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img width="150" height="150"
|
||||
src="https://github.com/fwouts.png?v=3&s=150">
|
||||
<br />
|
||||
<a href="https://github.com/fwouts">François Wouts</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/postcss-load-config.svg
|
||||
[npm-url]: https://npmjs.com/package/postcss-load-config
|
||||
|
||||
[node]: https://img.shields.io/node/v/postcss-load-plugins.svg
|
||||
[node-url]: https://nodejs.org/
|
||||
|
||||
[deps]: https://david-dm.org/michael-ciniawsky/postcss-load-config.svg
|
||||
[deps-url]: https://david-dm.org/michael-ciniawsky/postcss-load-config
|
||||
|
||||
[test]: http://img.shields.io/travis/michael-ciniawsky/postcss-load-config.svg
|
||||
[test-url]: https://travis-ci.org/michael-ciniawsky/postcss-load-config
|
||||
|
||||
[cover]: https://coveralls.io/repos/github/michael-ciniawsky/postcss-load-config/badge.svg
|
||||
[cover-url]: https://coveralls.io/github/michael-ciniawsky/postcss-load-config
|
||||
|
||||
[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg
|
||||
[style-url]: http://standardjs.com/
|
||||
|
||||
[chat]: https://img.shields.io/gitter/room/postcss/postcss.svg
|
||||
[chat-url]: https://gitter.im/postcss/postcss
|
||||
|
||||
## Security Contact
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact].
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
[Tidelift security contact]: https://tidelift.com/security
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"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","2":"C"},C:{"1":"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","2":"DC tB I v J D E F A B C K EC FC","33":"0 1 2 3 4 5 6 7 8 9 L G M N O w g x y z AB BB CB DB EB FB GB"},D:{"1":"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 F A B C K L G","33":"0 1 2 3 4 5 6 7 8 9 y z AB BB CB","66":"M N O w g x"},E:{"1":"B C K L G 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A HC zB IC JC KC LC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 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","2":"F B C PC QC RC SC qB AC TC rB","33":"G M N O w g x y z"},G:{"2":"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":"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:{"1":"vC"},P:{"2":"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:2,C:"Pointer Lock API"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":25,"110":0,"111":0,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0,"14.1":0,"15.1":0,"15.2-15.3":0,"15.4":0,"15.5":0,"15.6":0,"16.0":0,"16.1":0,"16.2":0,"16.3":0,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0,"11.0-11.2":0,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":0,"13.0-13.1":0,"13.2":0,"13.3":0,"13.4-13.7":0,"14.0-14.4":0,"14.5-14.8":0,"15.0-15.1":0,"15.2-15.3":0,"15.4":9.375,"15.5":0,"15.6":0,"16.0":0,"16.1":0,"16.2":65.625,"16.3":0,"16.4":0},P:{"4":0,"20":0,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0,"14.0":0,"15.0":0,"16.0":0,"17.0":0,"18.0":0,"19.0":0},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0},H:{"0":0},L:{"0":0},R:{_:"0"},M:{"0":0},Q:{"13.1":0}};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00837,"53":0,"54":0,"55":0,"56":0.00419,"57":0,"58":0,"59":0,"60":0,"61":0.00837,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00837,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.00419,"86":0,"87":0,"88":0,"89":0.00837,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0.00419,"99":0,"100":0,"101":0,"102":0.00837,"103":0,"104":0,"105":0,"106":0.00419,"107":0.04185,"108":0.00419,"109":0.38502,"110":0.15485,"111":0.00419,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0.10463,"41":0,"42":0.00419,"43":0,"44":0,"45":0,"46":0,"47":0.00419,"48":0,"49":0.02093,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0.00419,"56":0.00419,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0.00419,"65":0.37665,"66":0,"67":0,"68":0,"69":0,"70":0.00837,"71":0.02093,"72":0.00419,"73":0,"74":0,"75":0.00419,"76":0.01674,"77":0,"78":0.00837,"79":0.10463,"80":0,"81":0.20507,"83":0,"84":0.00837,"85":0,"86":0,"87":0.02511,"88":0.00419,"89":0,"90":0.01674,"91":0.14648,"92":0.00419,"93":0.02093,"94":0.00837,"95":0.00837,"96":0.00419,"97":0.02093,"98":0.00419,"99":0.01674,"100":0.00419,"101":0.00837,"102":0.00837,"103":0.12974,"104":0.01256,"105":0.03767,"106":0.01256,"107":0.07952,"108":0.33899,"109":6.09755,"110":4.44866,"111":0.00419,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.00837,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0.02093,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.00419,"94":0.17159,"95":0.24273,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0.00419,"16":0.00419,"17":0,"18":0.00419,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00837,"93":0,"94":0,"95":0,"96":0.01256,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00419,"106":0,"107":0.0293,"108":0.12555,"109":0.82445,"110":1.14251},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.0837,"15":0.00419,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.01256,"13.1":0.05022,"14.1":0.03767,"15.1":0,"15.2-15.3":0.00419,"15.4":0.00419,"15.5":0.00837,"15.6":0.15485,"16.0":0.01256,"16.1":0.02093,"16.2":0.21344,"16.3":0.10044,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.01722,"8.1-8.4":0.00172,"9.0-9.2":0,"9.3":0.33411,"10.0-10.2":0,"10.3":0.16878,"11.0-11.2":0.02756,"11.3-11.4":0.28761,"12.0-12.1":0.01894,"12.2-12.5":1.39674,"13.0-13.1":0.00344,"13.2":0.24284,"13.3":0.03444,"13.4-13.7":0.05511,"14.0-14.4":1.78941,"14.5-14.8":0.434,"15.0-15.1":0.19117,"15.2-15.3":0.30828,"15.4":0.42539,"15.5":0.51667,"15.6":1.87207,"16.0":0.89901,"16.1":2.54719,"16.2":2.10285,"16.3":1.83419,"16.4":0.00344},P:{"4":0.2782,"20":0.46367,"5.0-5.4":0.02061,"6.2-6.4":0,"7.2-7.4":0.16486,"8.2":0,"9.2":0.02061,"10.1":0.0103,"11.1-11.2":0.03091,"12.0":0,"13.0":0.0103,"14.0":0.04122,"15.0":0.06182,"16.0":0.08243,"17.0":0.03091,"18.0":0.10304,"19.0":1.03038},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00213,"4.2-4.3":0.00426,"4.4":0,"4.4.3-4.4.4":0.31612},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.01256,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.00582,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.08141},H:{"0":0.19819},L:{"0":63.60003},R:{_:"0"},M:{"0":0.06978},Q:{"13.1":0.00582}};
|
||||
@@ -0,0 +1,97 @@
|
||||
import { EOL } from 'node:os';
|
||||
import test from 'ava';
|
||||
import mockStdIo from 'mock-stdio';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import { format, truncateLines, parseGitUrl, parseVersion } from '../lib/util.js';
|
||||
|
||||
test('format', t => {
|
||||
t.is(format('release v${version}', { version: '1.0.0' }), 'release v1.0.0');
|
||||
t.is(format('release v${version} (${name})', { version: '1.0.0', name: 'foo' }), 'release v1.0.0 (foo)');
|
||||
t.is(format('release v${version} (${name})', { version: '1.0.0', name: 'foo' }), 'release v1.0.0 (foo)');
|
||||
});
|
||||
|
||||
test('format (throw)', t => {
|
||||
mockStdIo.start();
|
||||
t.throws(() => format('release v${foo}', { version: '1.0.0' }), { message: /foo is not defined/ });
|
||||
const { stdout, stderr } = mockStdIo.end();
|
||||
t.is(stdout, '');
|
||||
t.regex(
|
||||
stripAnsi(stderr),
|
||||
/ERROR Unable to render template with context:\s+release v\${foo}\s+{"version":"1\.0\.0"}\s+ERROR ReferenceError: foo is not defined/
|
||||
);
|
||||
});
|
||||
|
||||
test('truncateLines', t => {
|
||||
const input = `1${EOL}2${EOL}3${EOL}4${EOL}5${EOL}6`;
|
||||
t.is(truncateLines(input), input);
|
||||
t.is(truncateLines(input, 3), `1${EOL}2${EOL}3${EOL}...and 3 more`);
|
||||
t.is(truncateLines(input, 1, '...'), `1...`);
|
||||
});
|
||||
|
||||
test('parseGitUrl', t => {
|
||||
t.deepEqual(parseGitUrl('https://github.com/webpro/release-it.git'), {
|
||||
host: 'github.com',
|
||||
owner: 'webpro',
|
||||
project: 'release-it',
|
||||
protocol: 'https',
|
||||
remote: 'https://github.com/webpro/release-it.git',
|
||||
repository: 'webpro/release-it'
|
||||
});
|
||||
|
||||
t.deepEqual(parseGitUrl('git@gitlab.com:org/sub-group/repo-in-sub-group.git'), {
|
||||
host: 'gitlab.com',
|
||||
owner: 'org/sub-group',
|
||||
project: 'repo-in-sub-group',
|
||||
protocol: 'ssh',
|
||||
remote: 'git@gitlab.com:org/sub-group/repo-in-sub-group.git',
|
||||
repository: 'org/sub-group/repo-in-sub-group'
|
||||
});
|
||||
|
||||
t.deepEqual(parseGitUrl('git@github.com:org/example.com.git'), {
|
||||
host: 'github.com',
|
||||
owner: 'org',
|
||||
project: 'example.com',
|
||||
protocol: 'ssh',
|
||||
remote: 'git@github.com:org/example.com.git',
|
||||
repository: 'org/example.com'
|
||||
});
|
||||
|
||||
t.deepEqual(parseGitUrl('file://Users/john/doe/owner/project'), {
|
||||
host: 'users',
|
||||
owner: 'owner',
|
||||
project: 'project',
|
||||
protocol: 'file',
|
||||
remote: 'file://users/john/doe/owner/project',
|
||||
repository: 'owner/project'
|
||||
});
|
||||
|
||||
t.deepEqual(parseGitUrl('/Users/john/doe/owner/project'), {
|
||||
host: 'users',
|
||||
owner: 'owner',
|
||||
project: 'project',
|
||||
protocol: 'file',
|
||||
remote: 'file://users/john/doe/owner/project',
|
||||
repository: 'owner/project'
|
||||
});
|
||||
|
||||
t.deepEqual(parseGitUrl('C:\\\\Users\\john\\doe\\owner\\project'), {
|
||||
host: 'users',
|
||||
owner: 'owner',
|
||||
project: 'project',
|
||||
protocol: 'file',
|
||||
remote: 'file://users/john/doe/owner/project',
|
||||
repository: 'owner/project'
|
||||
});
|
||||
});
|
||||
|
||||
test('parseVersion', t => {
|
||||
t.deepEqual(parseVersion(), { version: undefined, isPreRelease: false, preReleaseId: null });
|
||||
t.deepEqual(parseVersion(0), { version: '0.0.0', isPreRelease: false, preReleaseId: null });
|
||||
t.deepEqual(parseVersion(1), { version: '1.0.0', isPreRelease: false, preReleaseId: null });
|
||||
t.deepEqual(parseVersion('1'), { version: '1.0.0', isPreRelease: false, preReleaseId: null });
|
||||
t.deepEqual(parseVersion('1.0'), { version: '1.0.0', isPreRelease: false, preReleaseId: null });
|
||||
t.deepEqual(parseVersion('1.0.0'), { version: '1.0.0', isPreRelease: false, preReleaseId: null });
|
||||
t.deepEqual(parseVersion('1.0.0-0'), { version: '1.0.0-0', isPreRelease: true, preReleaseId: null });
|
||||
t.deepEqual(parseVersion('1.0.0-next.1'), { version: '1.0.0-next.1', isPreRelease: true, preReleaseId: 'next' });
|
||||
t.deepEqual(parseVersion('21.04.1'), { version: '21.04.1', isPreRelease: false, preReleaseId: null });
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2016-23 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, ensureArrayLength = require("../../array-length/ensure");
|
||||
|
||||
describe("array-length/ensure", function () {
|
||||
it("Should return coerced value", function () {
|
||||
assert.equal(ensureArrayLength("12.23"), 12);
|
||||
});
|
||||
it("Should crash on no value", function () {
|
||||
try {
|
||||
ensureArrayLength(-20);
|
||||
throw new Error("Unexpected");
|
||||
} catch (error) {
|
||||
assert.equal(error.name, "TypeError");
|
||||
assert.equal(error.message, "-20 is not a valid array length");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"withLatestFrom.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/withLatestFrom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAQlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhI,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EACtD,GAAG,MAAM,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAClE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
import { h } from 'preact';
|
||||
import { BaseComponent, BaseProps } from '../base';
|
||||
import Header from '../../header';
|
||||
interface THeadProps extends BaseProps {
|
||||
header: Header;
|
||||
}
|
||||
export declare class THead extends BaseComponent<THeadProps> {
|
||||
private renderColumn;
|
||||
private renderRow;
|
||||
private renderRows;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1,103 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { MonoTypeOperatorFunction, ObservableInput } from '../types';
|
||||
import { concat } from '../observable/concat';
|
||||
import { take } from './take';
|
||||
import { ignoreElements } from './ignoreElements';
|
||||
import { mapTo } from './mapTo';
|
||||
import { mergeMap } from './mergeMap';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
|
||||
/** @deprecated The `subscriptionDelay` parameter will be removed in v8. */
|
||||
export function delayWhen<T>(
|
||||
delayDurationSelector: (value: T, index: number) => ObservableInput<any>,
|
||||
subscriptionDelay: Observable<any>
|
||||
): MonoTypeOperatorFunction<T>;
|
||||
export function delayWhen<T>(delayDurationSelector: (value: T, index: number) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
|
||||
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given time span
|
||||
* determined by the emissions of another Observable.
|
||||
*
|
||||
* <span class="informal">It's like {@link delay}, but the time span of the
|
||||
* delay duration is determined by a second Observable.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `delayWhen` operator shifts each emitted value from the source Observable by
|
||||
* a time span determined by another Observable. When the source emits a value,
|
||||
* the `delayDurationSelector` function is called with the value emitted from
|
||||
* the source Observable as the first argument to the `delayDurationSelector`.
|
||||
* The `delayDurationSelector` function should return an {@link ObservableInput},
|
||||
* that is internally converted to an Observable that is called the "duration"
|
||||
* Observable.
|
||||
*
|
||||
* The source value is emitted on the output Observable only when the "duration"
|
||||
* Observable emits ({@link guide/glossary-and-semantics#next next}s) any value.
|
||||
* Upon that, the "duration" Observable gets unsubscribed.
|
||||
*
|
||||
* Before RxJS V7, the {@link guide/glossary-and-semantics#complete completion}
|
||||
* of the "duration" Observable would have been triggering the emission of the
|
||||
* source value to the output Observable, but with RxJS V7, this is not the case
|
||||
* anymore.
|
||||
*
|
||||
* Only next notifications (from the "duration" Observable) trigger values from
|
||||
* the source Observable to be passed to the output Observable. If the "duration"
|
||||
* Observable only emits the complete notification (without next), the value
|
||||
* emitted by the source Observable will never get to the output Observable - it
|
||||
* will be swallowed. If the "duration" Observable errors, the error will be
|
||||
* propagated to the output Observable.
|
||||
*
|
||||
* Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which
|
||||
* is an Observable. When `subscriptionDelay` emits its first value or
|
||||
* completes, the source Observable is subscribed to and starts behaving like
|
||||
* described in the previous paragraph. If `subscriptionDelay` is not provided,
|
||||
* `delayWhen` will subscribe to the source Observable as soon as the output
|
||||
* Observable is subscribed.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Delay each click by a random amount of time, between 0 and 5 seconds
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, delayWhen, interval } from 'rxjs';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const delayedClicks = clicks.pipe(
|
||||
* delayWhen(() => interval(Math.random() * 5000))
|
||||
* );
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link delay}
|
||||
* @see {@link throttle}
|
||||
* @see {@link throttleTime}
|
||||
* @see {@link debounce}
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link sample}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link audit}
|
||||
* @see {@link auditTime}
|
||||
*
|
||||
* @param delayDurationSelector A function that returns an `ObservableInput` for
|
||||
* each `value` emitted by the source Observable, which is then used to delay the
|
||||
* emission of that `value` on the output Observable until the `ObservableInput`
|
||||
* returned from this function emits a next value. When called, beside `value`,
|
||||
* this function receives a zero-based `index` of the emission order.
|
||||
* @param subscriptionDelay An Observable that triggers the subscription to the
|
||||
* source Observable once it emits any value.
|
||||
* @return A function that returns an Observable that delays the emissions of
|
||||
* the source Observable by an amount of time specified by the Observable
|
||||
* returned by `delayDurationSelector`.
|
||||
*/
|
||||
export function delayWhen<T>(
|
||||
delayDurationSelector: (value: T, index: number) => ObservableInput<any>,
|
||||
subscriptionDelay?: Observable<any>
|
||||
): MonoTypeOperatorFunction<T> {
|
||||
if (subscriptionDelay) {
|
||||
// DEPRECATED PATH
|
||||
return (source: Observable<T>) =>
|
||||
concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
||||
}
|
||||
|
||||
return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));
|
||||
}
|
||||
@@ -0,0 +1,576 @@
|
||||
import {type Buffer} from 'node:buffer';
|
||||
import {type ChildProcess} from 'node:child_process';
|
||||
import {type Stream, type Readable as ReadableStream} from 'node:stream';
|
||||
|
||||
export type StdioOption =
|
||||
| 'pipe'
|
||||
| 'overlapped'
|
||||
| 'ipc'
|
||||
| 'ignore'
|
||||
| 'inherit'
|
||||
| Stream
|
||||
| number
|
||||
| undefined;
|
||||
|
||||
export type CommonOptions<EncodingType> = {
|
||||
/**
|
||||
Kill the spawned process when the parent process exits unless either:
|
||||
- the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)
|
||||
- the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly cleanup?: boolean;
|
||||
|
||||
/**
|
||||
Prefer locally installed binaries when looking for a binary to execute.
|
||||
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly preferLocal?: boolean;
|
||||
|
||||
/**
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly localDir?: string | URL;
|
||||
|
||||
/**
|
||||
Path to the Node.js executable to use in child processes.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
Requires `preferLocal` to be `true`.
|
||||
|
||||
For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
|
||||
/**
|
||||
Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.
|
||||
|
||||
If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly buffer?: boolean;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdin?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdout?: StdioOption;
|
||||
|
||||
/**
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stderr?: StdioOption;
|
||||
|
||||
/**
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly reject?: boolean;
|
||||
|
||||
/**
|
||||
Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly all?: boolean;
|
||||
|
||||
/**
|
||||
Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly stripFinalNewline?: boolean;
|
||||
|
||||
/**
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly extendEnv?: boolean;
|
||||
|
||||
/**
|
||||
Current working directory of the child process.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string | URL;
|
||||
|
||||
/**
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
|
||||
|
||||
@default process.env
|
||||
*/
|
||||
readonly env?: NodeJS.ProcessEnv;
|
||||
|
||||
/**
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
|
||||
*/
|
||||
readonly argv0?: string;
|
||||
|
||||
/**
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
@default 'pipe'
|
||||
*/
|
||||
readonly stdio?: 'pipe' | 'overlapped' | 'ignore' | 'inherit' | readonly StdioOption[];
|
||||
|
||||
/**
|
||||
Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:
|
||||
- `json`: Uses `JSON.stringify()` and `JSON.parse()`.
|
||||
- `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
|
||||
|
||||
[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
|
||||
|
||||
@default 'json'
|
||||
*/
|
||||
readonly serialization?: 'json' | 'advanced';
|
||||
|
||||
/**
|
||||
Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly detached?: boolean;
|
||||
|
||||
/**
|
||||
Sets the user identity of the process.
|
||||
*/
|
||||
readonly uid?: number;
|
||||
|
||||
/**
|
||||
Sets the group identity of the process.
|
||||
*/
|
||||
readonly gid?: number;
|
||||
|
||||
/**
|
||||
If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
|
||||
|
||||
We recommend against using this option since it is:
|
||||
- not cross-platform, encouraging shell-specific syntax.
|
||||
- slower, because of the additional shell interpretation.
|
||||
- unsafe, potentially allowing command injection.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly shell?: boolean | string;
|
||||
|
||||
/**
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.
|
||||
|
||||
@default 'utf8'
|
||||
*/
|
||||
readonly encoding?: EncodingType;
|
||||
|
||||
/**
|
||||
If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
readonly timeout?: number;
|
||||
|
||||
/**
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`. Default: 100 MB.
|
||||
|
||||
@default 100_000_000
|
||||
*/
|
||||
readonly maxBuffer?: number;
|
||||
|
||||
/**
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
@default 'SIGTERM'
|
||||
*/
|
||||
readonly killSignal?: string | number;
|
||||
|
||||
/**
|
||||
You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
||||
|
||||
When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `false`.
|
||||
|
||||
*Requires Node.js 16 or later.*
|
||||
|
||||
@example
|
||||
```
|
||||
import {execa} from 'execa';
|
||||
|
||||
const abortController = new AbortController();
|
||||
const subprocess = execa('node', [], {signal: abortController.signal});
|
||||
|
||||
setTimeout(() => {
|
||||
abortController.abort();
|
||||
}, 1000);
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
```
|
||||
*/
|
||||
readonly signal?: AbortSignal;
|
||||
|
||||
/**
|
||||
If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly windowsVerbatimArguments?: boolean;
|
||||
|
||||
/**
|
||||
On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly windowsHide?: boolean;
|
||||
};
|
||||
|
||||
export type Options<EncodingType = string> = {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer | ReadableStream;
|
||||
} & CommonOptions<EncodingType>;
|
||||
|
||||
export type SyncOptions<EncodingType = string> = {
|
||||
/**
|
||||
Write some input to the `stdin` of your binary.
|
||||
*/
|
||||
readonly input?: string | Buffer;
|
||||
} & CommonOptions<EncodingType>;
|
||||
|
||||
export type NodeOptions<EncodingType = string> = {
|
||||
/**
|
||||
The Node.js executable to use.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly nodePath?: string;
|
||||
|
||||
/**
|
||||
List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.
|
||||
|
||||
@default process.execArgv
|
||||
*/
|
||||
readonly nodeOptions?: string[];
|
||||
} & Options<EncodingType>;
|
||||
|
||||
export type ExecaReturnBase<StdoutStderrType> = {
|
||||
/**
|
||||
The file and arguments that were run, for logging purposes.
|
||||
|
||||
This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
|
||||
*/
|
||||
command: string;
|
||||
|
||||
/**
|
||||
Same as `command` but escaped.
|
||||
|
||||
This is meant to be copy and pasted into a shell, for debugging purposes.
|
||||
Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
|
||||
*/
|
||||
escapedCommand: string;
|
||||
|
||||
/**
|
||||
The numeric exit code of the process that was run.
|
||||
*/
|
||||
exitCode: number;
|
||||
|
||||
/**
|
||||
The output of the process on stdout.
|
||||
*/
|
||||
stdout: StdoutStderrType;
|
||||
|
||||
/**
|
||||
The output of the process on stderr.
|
||||
*/
|
||||
stderr: StdoutStderrType;
|
||||
|
||||
/**
|
||||
Whether the process failed to run.
|
||||
*/
|
||||
failed: boolean;
|
||||
|
||||
/**
|
||||
Whether the process timed out.
|
||||
*/
|
||||
timedOut: boolean;
|
||||
|
||||
/**
|
||||
Whether the process was killed.
|
||||
*/
|
||||
killed: boolean;
|
||||
|
||||
/**
|
||||
The name of the signal that was used to terminate the process. For example, `SIGFPE`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
|
||||
*/
|
||||
signal?: string;
|
||||
|
||||
/**
|
||||
A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.
|
||||
|
||||
If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.
|
||||
*/
|
||||
signalDescription?: string;
|
||||
};
|
||||
|
||||
export type ExecaSyncReturnValue<StdoutErrorType = string> = {
|
||||
} & ExecaReturnBase<StdoutErrorType>;
|
||||
|
||||
/**
|
||||
Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.
|
||||
|
||||
The child process fails when:
|
||||
- its exit code is not `0`
|
||||
- it was killed with a signal
|
||||
- timing out
|
||||
- being canceled
|
||||
- there's not enough memory or there are already too many child processes
|
||||
*/
|
||||
export type ExecaReturnValue<StdoutErrorType = string> = {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execaSync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
|
||||
You can cancel the spawned process using the [`signal`](https://github.com/sindresorhus/execa#signal-1) option.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
} & ExecaSyncReturnValue<StdoutErrorType>;
|
||||
|
||||
export type ExecaSyncError<StdoutErrorType = string> = {
|
||||
/**
|
||||
Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.
|
||||
|
||||
The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
This is the same as the `message` property except it does not include the child process stdout/stderr.
|
||||
*/
|
||||
shortMessage: string;
|
||||
|
||||
/**
|
||||
Original error message. This is the same as the `message` property except it includes neither the child process stdout/stderr nor some additional information added by Execa.
|
||||
|
||||
This is `undefined` unless the child process exited due to an `error` event or a timeout.
|
||||
*/
|
||||
originalMessage?: string;
|
||||
} & Error & ExecaReturnBase<StdoutErrorType>;
|
||||
|
||||
export type ExecaError<StdoutErrorType = string> = {
|
||||
/**
|
||||
The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (default value)
|
||||
- `execaSync()` was used
|
||||
*/
|
||||
all?: StdoutErrorType;
|
||||
|
||||
/**
|
||||
Whether the process was canceled.
|
||||
*/
|
||||
isCanceled: boolean;
|
||||
} & ExecaSyncError<StdoutErrorType>;
|
||||
|
||||
export type KillOptions = {
|
||||
/**
|
||||
Milliseconds to wait for the child process to terminate before sending `SIGKILL`.
|
||||
|
||||
Can be disabled with `false`.
|
||||
|
||||
@default 5000
|
||||
*/
|
||||
forceKillAfterTimeout?: number | false;
|
||||
};
|
||||
|
||||
export type ExecaChildPromise<StdoutErrorType> = {
|
||||
/**
|
||||
Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).
|
||||
|
||||
This is `undefined` if either:
|
||||
- the `all` option is `false` (the default value)
|
||||
- both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
|
||||
*/
|
||||
all?: ReadableStream;
|
||||
|
||||
catch<ResultType = never>(
|
||||
onRejected?: (reason: ExecaError<StdoutErrorType>) => ResultType | PromiseLike<ResultType>
|
||||
): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;
|
||||
|
||||
/**
|
||||
Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`.
|
||||
*/
|
||||
kill(signal?: string, options?: KillOptions): void;
|
||||
|
||||
/**
|
||||
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This used to be preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`. But now this is deprecated and you should either use `.kill()` or the `signal` option when creating the child process.
|
||||
*/
|
||||
cancel(): void;
|
||||
};
|
||||
|
||||
export type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
|
||||
ExecaChildPromise<StdoutErrorType> &
|
||||
Promise<ExecaReturnValue<StdoutErrorType>>;
|
||||
|
||||
/**
|
||||
Execute a file.
|
||||
|
||||
Think of this as a mix of `child_process.execFile` and `child_process.spawn`.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@returns A [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
||||
|
||||
@example
|
||||
```
|
||||
import {execa} from 'execa';
|
||||
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
|
||||
// Cancelling a spawned process
|
||||
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.cancel()
|
||||
}, 1000);
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
|
||||
// Pipe the child process stdout to the current stdout
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
```
|
||||
*/
|
||||
export function execa(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: Options
|
||||
): ExecaChildProcess;
|
||||
export function execa(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: Options<null>
|
||||
): ExecaChildProcess<Buffer>;
|
||||
export function execa(file: string, options?: Options): ExecaChildProcess;
|
||||
export function execa(file: string, options?: Options<null>): ExecaChildProcess<Buffer>;
|
||||
|
||||
/**
|
||||
Execute a file synchronously.
|
||||
|
||||
This method throws an `Error` if the command fails.
|
||||
|
||||
@param file - The program/script to execute.
|
||||
@param arguments - Arguments to pass to `file` on execution.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
export function execaSync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: SyncOptions
|
||||
): ExecaSyncReturnValue;
|
||||
export function execaSync(
|
||||
file: string,
|
||||
arguments?: readonly string[],
|
||||
options?: SyncOptions<null>
|
||||
): ExecaSyncReturnValue<Buffer>;
|
||||
export function execaSync(file: string, options?: SyncOptions): ExecaSyncReturnValue;
|
||||
export function execaSync(
|
||||
file: string,
|
||||
options?: SyncOptions<null>
|
||||
): ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execa()` except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execaCommand('echo unicorns')`.
|
||||
|
||||
If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.
|
||||
|
||||
The `shell` option must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@returns A [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
||||
|
||||
@example
|
||||
```
|
||||
import {execaCommand} from 'execa';
|
||||
|
||||
const {stdout} = await execaCommand('echo unicorns');
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
```
|
||||
*/
|
||||
export function execaCommand(command: string, options?: Options): ExecaChildProcess;
|
||||
export function execaCommand(command: string, options?: Options<null>): ExecaChildProcess<Buffer>;
|
||||
|
||||
/**
|
||||
Same as `execaCommand()` but synchronous.
|
||||
|
||||
@param command - The program/script to execute and its arguments.
|
||||
@returns A result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
export function execaCommandSync(command: string, options?: SyncOptions): ExecaSyncReturnValue;
|
||||
export function execaCommandSync(command: string, options?: SyncOptions<null>): ExecaSyncReturnValue<Buffer>;
|
||||
|
||||
/**
|
||||
Execute a Node.js script as a child process.
|
||||
|
||||
Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
|
||||
- the current Node version and options are used. This can be overridden using the `nodePath` and `nodeArguments` options.
|
||||
- the `shell` option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
@param scriptPath - Node.js script to execute.
|
||||
@param arguments - Arguments to pass to `scriptPath` on execution.
|
||||
@returns A [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
||||
*/
|
||||
export function execaNode(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: NodeOptions
|
||||
): ExecaChildProcess;
|
||||
export function execaNode(
|
||||
scriptPath: string,
|
||||
arguments?: readonly string[],
|
||||
options?: NodeOptions<null>
|
||||
): ExecaChildProcess<Buffer>;
|
||||
export function execaNode(scriptPath: string, options?: NodeOptions): ExecaChildProcess;
|
||||
export function execaNode(scriptPath: string, options?: NodeOptions<null>): ExecaChildProcess<Buffer>;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"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","2":"C K","132":"L G M N O"},C:{"1":"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","2":"0 1 2 3 4 5 6 DC tB I v J D E F A B C K L G M N O w g x y z EC FC","132":"7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB"},D:{"1":"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":"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","132":"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"},E:{"1":"A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D HC zB IC JC","132":"E F KC"},F:{"1":"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","2":"F B C G M N O w g x y PC QC RC SC qB AC TC rB","132":"0 1 2 3 4 5 6 7 8 9 z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB"},G:{"1":"ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC WC XC","16":"E","132":"YC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"1":"A","2":"D"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","132":"I wC xC yC zC 0C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"Path2D"};
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, is = require("./is");
|
||||
|
||||
module.exports = function (value/*, options*/) {
|
||||
if (is(value)) return value;
|
||||
var options = arguments[1];
|
||||
var errorMessage =
|
||||
options && options.name
|
||||
? "Expected a regular expression for %n, received %v"
|
||||
: "%v is not a regular expression";
|
||||
return resolveException(value, errorMessage, options);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./isEqual');
|
||||
@@ -0,0 +1,90 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [1.2.0](https://github.com/medikoo/type/compare/v1.1.0...v1.2.0) (2019-09-20)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Improve error message so it's not confusing ([97cd6b9](https://github.com/medikoo/type/commit/97cd6b9))
|
||||
|
||||
### Features
|
||||
|
||||
- 'coerceItem' option for iterable/ensure ([0818860](https://github.com/medikoo/type/commit/0818860))
|
||||
|
||||
## [1.1.0](https://github.com/medikoo/type/compare/v1.0.3...v1.1.0) (2019-09-20)
|
||||
|
||||
### Features
|
||||
|
||||
- `denyEmpty` option for iterables validation ([301d071](https://github.com/medikoo/type/commit/301d071))
|
||||
|
||||
### [1.0.3](https://github.com/medikoo/type/compare/v1.0.2...v1.0.3) (2019-08-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Recognize custom built ES5 era errors ([6462fac](https://github.com/medikoo/type/commit/6462fac))
|
||||
|
||||
### [1.0.2](https://github.com/medikoo/type/compare/v1.0.1...v1.0.2) (2019-08-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Recognize host errors (e.g. DOMException) ([96ef399](https://github.com/medikoo/type/commit/96ef399))
|
||||
|
||||
## [1.0.1](https://github.com/medikoo/type/compare/v1.0.0...v1.0.1) (2019-04-08)
|
||||
|
||||
# 1.0.0 (2019-04-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- ensure 'is' functions can't crash ([59ceb78](https://github.com/medikoo/type/commit/59ceb78))
|
||||
|
||||
### Features
|
||||
|
||||
- array-length/coerce ([af8ddec](https://github.com/medikoo/type/commit/af8ddec))
|
||||
- array-length/ensure ([d313eb6](https://github.com/medikoo/type/commit/d313eb6))
|
||||
- array-like/ensure ([45f1ddd](https://github.com/medikoo/type/commit/45f1ddd))
|
||||
- array-like/is ([9a026a5](https://github.com/medikoo/type/commit/9a026a5))
|
||||
- array/ensure ([9db1515](https://github.com/medikoo/type/commit/9db1515))
|
||||
- array/is ([9672839](https://github.com/medikoo/type/commit/9672839))
|
||||
- date/ensure ([44e25a0](https://github.com/medikoo/type/commit/44e25a0))
|
||||
- date/is ([0316558](https://github.com/medikoo/type/commit/0316558))
|
||||
- ensure to not crash ([3998348](https://github.com/medikoo/type/commit/3998348))
|
||||
- ensure/number ([134b5cb](https://github.com/medikoo/type/commit/134b5cb))
|
||||
- error/ensure ([d5c8a30](https://github.com/medikoo/type/commit/d5c8a30))
|
||||
- error/is-error ([4d6b899](https://github.com/medikoo/type/commit/4d6b899))
|
||||
- finite/coerce ([accaad1](https://github.com/medikoo/type/commit/accaad1))
|
||||
- finite/ensure ([51e4174](https://github.com/medikoo/type/commit/51e4174))
|
||||
- function/ensure ([b624c9a](https://github.com/medikoo/type/commit/b624c9a))
|
||||
- function/is ([dab8026](https://github.com/medikoo/type/commit/dab8026))
|
||||
- integer/coerce ([89dea2e](https://github.com/medikoo/type/commit/89dea2e))
|
||||
- integer/ensure ([44a7071](https://github.com/medikoo/type/commit/44a7071))
|
||||
- iterable/ensure ([3d48841](https://github.com/medikoo/type/commit/3d48841))
|
||||
- iterable/is ([cf09513](https://github.com/medikoo/type/commit/cf09513))
|
||||
- lib/is-to-string-tag-supported ([c8c001d](https://github.com/medikoo/type/commit/c8c001d))
|
||||
- natural-number/coerce ([d08fdd9](https://github.com/medikoo/type/commit/d08fdd9))
|
||||
- natural-number/ensure ([6c24d12](https://github.com/medikoo/type/commit/6c24d12))
|
||||
- number/coerce ([86ccf08](https://github.com/medikoo/type/commit/86ccf08))
|
||||
- object/ensure ([a9e8eed](https://github.com/medikoo/type/commit/a9e8eed))
|
||||
- object/is ([d2d7251](https://github.com/medikoo/type/commit/d2d7251))
|
||||
- plain-function/ensure ([5186518](https://github.com/medikoo/type/commit/5186518))
|
||||
- plain-function/is ([51bc791](https://github.com/medikoo/type/commit/51bc791))
|
||||
- plain-object/ensure ([91cf5e5](https://github.com/medikoo/type/commit/91cf5e5))
|
||||
- plain-object/is ([4dcf393](https://github.com/medikoo/type/commit/4dcf393))
|
||||
- promise/ensure ([8d096a4](https://github.com/medikoo/type/commit/8d096a4))
|
||||
- promise/is ([a00de02](https://github.com/medikoo/type/commit/a00de02))
|
||||
- prototype/is ([b23bdcc](https://github.com/medikoo/type/commit/b23bdcc))
|
||||
- reg-exp/ensure ([6f7bbcb](https://github.com/medikoo/type/commit/6f7bbcb))
|
||||
- reg-exp/is ([9728519](https://github.com/medikoo/type/commit/9728519))
|
||||
- safe-integer/coerce ([b8549c4](https://github.com/medikoo/type/commit/b8549c4))
|
||||
- safe-integer/ensure ([a70ef3f](https://github.com/medikoo/type/commit/a70ef3f))
|
||||
- string/coerce ([b25c71f](https://github.com/medikoo/type/commit/b25c71f))
|
||||
- string/ensure ([b62577d](https://github.com/medikoo/type/commit/b62577d))
|
||||
- support 'default' in resolveException ([e08332a](https://github.com/medikoo/type/commit/e08332a))
|
||||
- switch config to ES3 based ([37606d9](https://github.com/medikoo/type/commit/37606d9))
|
||||
- thenable/ensure ([6762c0d](https://github.com/medikoo/type/commit/6762c0d))
|
||||
- thenable/is ([2711d70](https://github.com/medikoo/type/commit/2711d70))
|
||||
- time-value/coerce ([27fd109](https://github.com/medikoo/type/commit/27fd109))
|
||||
- time-value/ensure ([1f6a8ea](https://github.com/medikoo/type/commit/1f6a8ea))
|
||||
- **string/coerce:** restrict toString acceptance ([2a87100](https://github.com/medikoo/type/commit/2a87100))
|
||||
- value/ensure ([dd6d8cb](https://github.com/medikoo/type/commit/dd6d8cb))
|
||||
- value/is ([fdf4763](https://github.com/medikoo/type/commit/fdf4763))
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('negate', require('../negate'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
Reference in New Issue
Block a user