new license file version [CI SKIP]

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

View File

@@ -0,0 +1,52 @@
'use strict';
var ArraySpeciesCreate = require('es-abstract/2022/ArraySpeciesCreate');
var Call = require('es-abstract/2022/Call');
var CreateDataPropertyOrThrow = require('es-abstract/2022/CreateDataPropertyOrThrow');
var Get = require('es-abstract/2022/Get');
var HasProperty = require('es-abstract/2022/HasProperty');
var IsCallable = require('es-abstract/2022/IsCallable');
var ToUint32 = require('es-abstract/2022/ToUint32');
var ToObject = require('es-abstract/2022/ToObject');
var ToString = require('es-abstract/2022/ToString');
var callBound = require('call-bind/callBound');
var isString = require('is-string');
// Check failure of by-index access of string characters (IE < 9) and failure of `0 in boxedString` (Rhino)
var boxedString = Object('a');
var splitString = boxedString[0] !== 'a' || !(0 in boxedString);
var strSplit = callBound('String.prototype.split');
module.exports = function map(callbackfn) {
var O = ToObject(this);
var self = splitString && isString(O) ? strSplit(O, '') : O;
var len = ToUint32(self.length);
// If no callback function or if callback is not a callable function
if (!IsCallable(callbackfn)) {
throw new TypeError('Array.prototype.map callback must be a function');
}
var T;
if (arguments.length > 1) {
T = arguments[1];
}
var A = ArraySpeciesCreate(O, len);
var k = 0;
while (k < len) {
var Pk = ToString(k);
var kPresent = HasProperty(O, Pk);
if (kPresent) {
var kValue = Get(O, Pk);
var mappedValue = Call(callbackfn, T, [kValue, k, O]);
CreateDataPropertyOrThrow(A, Pk, mappedValue);
}
k += 1;
}
return A;
};

View File

@@ -0,0 +1,90 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "hasContentChanged", {
enumerable: true,
get: ()=>hasContentChanged
});
const _crypto = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Calculate the hash of a string.
*
* This doesn't need to be cryptographically secure or
* anything like that since it's used only to detect
* when the CSS changes to invalidate the context.
*
* This is wrapped in a try/catch because it's really dependent
* on how Node itself is build and the environment and OpenSSL
* version / build that is installed on the user's machine.
*
* Based on the environment this can just outright fail.
*
* See https://github.com/nodejs/node/issues/40455
*
* @param {string} str
*/ function getHash(str) {
try {
return _crypto.default.createHash("md5").update(str, "utf-8").digest("binary");
} catch (err) {
return "";
}
}
function hasContentChanged(sourcePath, root) {
let css = root.toString();
// We only care about files with @tailwind directives
// Other files use an existing context
if (!css.includes("@tailwind")) {
return false;
}
let existingHash = _sharedState.sourceHashMap.get(sourcePath);
let rootHash = getHash(css);
let didChange = existingHash !== rootHash;
_sharedState.sourceHashMap.set(sourcePath, rootHash);
return didChange;
}

View File

@@ -0,0 +1,85 @@
import type {Except} from './except';
import type {RequiredKeysOf} from './required-keys-of';
import type {Simplify} from './simplify';
type SpreadObject<FirstType extends object, SecondType extends object> = {
[Key in keyof FirstType]: Key extends keyof SecondType
? FirstType[Key] | Required<SecondType>[Key]
: FirstType[Key];
} & Pick<
SecondType,
RequiredKeysOf<SecondType> | Exclude<keyof SecondType, keyof FirstType>
>;
type TupleOrArray = readonly [...unknown[]];
type SpreadTupleOrArray<
FirstType extends TupleOrArray,
SecondType extends TupleOrArray,
> = Array<FirstType[number] | SecondType[number]>;
type Spreadable = object | TupleOrArray;
/**
Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.
@example
```
import type {Spread} from 'type-fest';
type Foo = {
a: number;
b?: string;
};
type Bar = {
b?: number;
c: boolean;
};
const foo = {a: 1, b: '2'};
const bar = {c: false};
const fooBar = {...foo, ...bar};
type FooBar = Spread<Foo, Bar>;
// type FooBar = {
// a: number;
// b?: string | number | undefined;
// c: boolean;
// }
const baz = (argument: FooBar) => {
// Do something
}
baz(fooBar);
```
@example
```
import type {Spread} from 'type-fest';
const foo = [1, 2, 3];
const bar = ['4', '5', '6'];
const fooBar = [...foo, ...bar];
type FooBar = Spread<typeof foo, typeof bar>;
// FooBar = (string | number)[]
const baz = (argument: FooBar) => {
// Do something
};
baz(fooBar);
```
@category Object
*/
export type Spread<
FirstType extends Spreadable,
SecondType extends Spreadable,
> = FirstType extends TupleOrArray
? SecondType extends TupleOrArray
? SpreadTupleOrArray<FirstType, SecondType>
: Simplify<SpreadObject<FirstType, SecondType>>
: Simplify<SpreadObject<FirstType, SecondType>>;

View File

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

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.read = void 0;
function read(path, settings) {
const lstat = settings.fs.lstatSync(path);
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
return lstat;
}
try {
const stat = settings.fs.statSync(path);
if (settings.markSymbolicLink) {
stat.isSymbolicLink = () => true;
}
return stat;
}
catch (error) {
if (!settings.throwErrorOnBrokenSymbolicLink) {
return lstat;
}
throw error;
}
}
exports.read = read;

View File

@@ -0,0 +1 @@
{"name":"path-parse","version":"1.0.7","files":{"LICENSE":{"checkedAt":1678883669554,"integrity":"sha512-cQVm2ZHJQn8+rLUVRjRM3+S6Wt1iEWz7c/pejRLMf9mwbU0m42mZAq4o0XsaJam7E6wgIbUsPVMTpzPHU2DB1A==","mode":420,"size":1080},"index.js":{"checkedAt":1678883669554,"integrity":"sha512-wEnmeNtipZ2ypV56FKN/fDxF13E21I9eud2ZgUYjq3xZwSSZ1mauxvxwZVyeA2skfMIIm1szKLLuoIlSTB+Fnw==","mode":420,"size":1893},"package.json":{"checkedAt":1678883669555,"integrity":"sha512-v92v0vBr7XdKB6SJnFbzkFLn21GbH5Zyig2+a/o7R3R+7AD5nl4j3Mp6zhEcmuu41zY9o4fJRael4iaNKSeWBQ==","mode":420,"size":667},"README.md":{"checkedAt":1678883669555,"integrity":"sha512-4OXc8gEOiFjsAl2l/2I1Atl5CpyL2NhsDla5up1n1UytHZyo+1Ulvs+joMo6cTAvhk+qkTMYdrHCMUDf1ktG+g==","mode":420,"size":871}}}

View File

@@ -0,0 +1,19 @@
Copyright (C) 2018 Dmitry Shirokov
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.

View File

@@ -0,0 +1,19 @@
import assertString from './util/assertString';
export default function rtrim(str, chars) {
assertString(str);
if (chars) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping
var pattern = new RegExp("[".concat(chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "]+$"), 'g');
return str.replace(pattern, '');
} // Use a faster and more safe than regex trim method https://blog.stevenlevithan.com/archives/faster-trim-javascript
var strIndex = str.length - 1;
while (/\s/.test(str.charAt(strIndex))) {
strIndex -= 1;
}
return str.slice(0, strIndex + 1);
}

View File

@@ -0,0 +1,29 @@
var baseClone = require('./_baseClone');
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_SYMBOLS_FLAG = 4;
/**
* This method is like `_.clone` except that it recursively clones `value`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @returns {*} Returns the deep cloned value.
* @see _.clone
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
*
* var deep = _.cloneDeep(objects);
* console.log(deep[0] === objects[0]);
* // => false
*/
function cloneDeep(value) {
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
module.exports = cloneDeep;

View File

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

View File

@@ -0,0 +1,37 @@
{
"name": "estree-walker",
"description": "Traverse an ESTree-compliant AST",
"version": "2.0.2",
"private": false,
"author": "Rich Harris",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Rich-Harris/estree-walker"
},
"type": "commonjs",
"main": "./dist/umd/estree-walker.js",
"module": "./dist/esm/estree-walker.js",
"exports": {
"require": "./dist/umd/estree-walker.js",
"import": "./dist/esm/estree-walker.js"
},
"types": "types/index.d.ts",
"scripts": {
"prepublishOnly": "npm run build && npm test",
"build": "tsc && rollup -c",
"test": "uvu test"
},
"devDependencies": {
"@types/estree": "0.0.42",
"rollup": "^2.10.9",
"typescript": "^3.7.5",
"uvu": "^0.5.1"
},
"files": [
"src",
"dist",
"types",
"README.md"
]
}

View File

@@ -0,0 +1,16 @@
var baseGet = require('./_baseGet');
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
module.exports = basePropertyDeep;

View File

@@ -0,0 +1,4 @@
import { AsyncScheduler } from './AsyncScheduler';
export class QueueScheduler extends AsyncScheduler {
}
//# sourceMappingURL=QueueScheduler.js.map

View File

@@ -0,0 +1,26 @@
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
module.exports = isArray;

View File

@@ -0,0 +1,2 @@
/** @type {typeof globalThis.File} */ export const File: typeof globalThis.File;
export default File;

View File

@@ -0,0 +1,3 @@
export * from './date-time';
export * from './number';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,593 @@
# braces [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces)
> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save braces
```
## v3.0.0 Released!!
See the [changelog](CHANGELOG.md) for details.
## Why use braces?
Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters.
* **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests)
* **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity.
* **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up.
* **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written).
* **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)).
* [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
* [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']`
* [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']`
* [Supports escaping](#escaping) - To prevent evaluation of special characters.
## Usage
The main export is a function that takes one or more brace `patterns` and `options`.
```js
const braces = require('braces');
// braces(patterns[, options]);
console.log(braces(['{01..05}', '{a..e}']));
//=> ['(0[1-5])', '([a-e])']
console.log(braces(['{01..05}', '{a..e}'], { expand: true }));
//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e']
```
### Brace Expansion vs. Compilation
By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching.
**Compiled**
```js
console.log(braces('a/{x,y,z}/b'));
//=> ['a/(x|y|z)/b']
console.log(braces(['a/{01..20}/b', 'a/{1..5}/b']));
//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ]
```
**Expanded**
Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)):
```js
console.log(braces('a/{x,y,z}/b', { expand: true }));
//=> ['a/x/b', 'a/y/b', 'a/z/b']
console.log(braces.expand('{01..10}'));
//=> ['01','02','03','04','05','06','07','08','09','10']
```
### Lists
Expand lists (like Bash "sets"):
```js
console.log(braces('a/{foo,bar,baz}/*.js'));
//=> ['a/(foo|bar|baz)/*.js']
console.log(braces.expand('a/{foo,bar,baz}/*.js'));
//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js']
```
### Sequences
Expand ranges of characters (like Bash "sequences"):
```js
console.log(braces.expand('{1..3}')); // ['1', '2', '3']
console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b']
console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c']
console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c']
// supports zero-padded ranges
console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b']
console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b']
```
See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options.
### Steppped ranges
Steps, or increments, may be used with ranges:
```js
console.log(braces.expand('{2..10..2}'));
//=> ['2', '4', '6', '8', '10']
console.log(braces('{2..10..2}'));
//=> ['(2|4|6|8|10)']
```
When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion.
### Nesting
Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved.
**"Expanded" braces**
```js
console.log(braces.expand('a{b,c,/{x,y}}/e'));
//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e']
console.log(braces.expand('a/{x,{1..5},y}/c'));
//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c']
```
**"Optimized" braces**
```js
console.log(braces('a{b,c,/{x,y}}/e'));
//=> ['a(b|c|/(x|y))/e']
console.log(braces('a/{x,{1..5},y}/c'));
//=> ['a/(x|([1-5])|y)/c']
```
### Escaping
**Escaping braces**
A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_:
```js
console.log(braces.expand('a\\{d,c,b}e'));
//=> ['a{d,c,b}e']
console.log(braces.expand('a{d,c,b\\}e'));
//=> ['a{d,c,b}e']
```
**Escaping commas**
Commas inside braces may also be escaped:
```js
console.log(braces.expand('a{b\\,c}d'));
//=> ['a{b,c}d']
console.log(braces.expand('a{d\\,c,b}e'));
//=> ['ad,ce', 'abe']
```
**Single items**
Following bash conventions, a brace pattern is also not expanded when it contains a single character:
```js
console.log(braces.expand('a{b}c'));
//=> ['a{b}c']
```
## Options
### options.maxLength
**Type**: `Number`
**Default**: `65,536`
**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera.
```js
console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error
```
### options.expand
**Type**: `Boolean`
**Default**: `undefined`
**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing).
```js
console.log(braces('a/{b,c}/d', { expand: true }));
//=> [ 'a/b/d', 'a/c/d' ]
```
### options.nodupes
**Type**: `Boolean`
**Default**: `undefined`
**Description**: Remove duplicates from the returned array.
### options.rangeLimit
**Type**: `Number`
**Default**: `1000`
**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`.
You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether.
**Examples**
```js
// pattern exceeds the "rangeLimit", so it's optimized automatically
console.log(braces.expand('{1..1000}'));
//=> ['([1-9]|[1-9][0-9]{1,2}|1000)']
// pattern does not exceed "rangeLimit", so it's NOT optimized
console.log(braces.expand('{1..100}'));
//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100']
```
### options.transform
**Type**: `Function`
**Default**: `undefined`
**Description**: Customize range expansion.
**Example: Transforming non-numeric values**
```js
const alpha = braces.expand('x/{a..e}/y', {
transform(value, index) {
// When non-numeric values are passed, "value" is a character code.
return 'foo/' + String.fromCharCode(value) + '-' + index;
}
});
console.log(alpha);
//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ]
```
**Example: Transforming numeric values**
```js
const numeric = braces.expand('{1..5}', {
transform(value) {
// when numeric values are passed, "value" is a number
return 'foo/' + value * 2;
}
});
console.log(numeric);
//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ]
```
### options.quantifiers
**Type**: `Boolean`
**Default**: `undefined`
**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times.
Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists)
The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists.
**Examples**
```js
const braces = require('braces');
console.log(braces('a/b{1,3}/{x,y,z}'));
//=> [ 'a/b(1|3)/(x|y|z)' ]
console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true}));
//=> [ 'a/b{1,3}/(x|y|z)' ]
console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true, expand: true}));
//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ]
```
### options.unescape
**Type**: `Boolean`
**Default**: `undefined`
**Description**: Strip backslashes that were used for escaping from the result.
## What is "brace expansion"?
Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs).
In addition to "expansion", braces are also used for matching. In other words:
* [brace expansion](#brace-expansion) is for generating new lists
* [brace matching](#brace-matching) is for filtering existing lists
<details>
<summary><strong>More about brace expansion</strong> (click to expand)</summary>
There are two main types of brace expansion:
1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}`
2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges".
Here are some example brace patterns to illustrate how they work:
**Sets**
```
{a,b,c} => a b c
{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2
```
**Sequences**
```
{1..9} => 1 2 3 4 5 6 7 8 9
{4..-4} => 4 3 2 1 0 -1 -2 -3 -4
{1..20..3} => 1 4 7 10 13 16 19
{a..j} => a b c d e f g h i j
{j..a} => j i h g f e d c b a
{a..z..3} => a d g j m p s v y
```
**Combination**
Sets and sequences can be mixed together or used along with any other strings.
```
{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3
foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar
```
The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases.
## Brace matching
In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching.
For example, the pattern `foo/{1..3}/bar` would match any of following strings:
```
foo/1/bar
foo/2/bar
foo/3/bar
```
But not:
```
baz/1/qux
baz/2/qux
baz/3/qux
```
Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings:
```
foo/1/bar
foo/2/bar
foo/3/bar
baz/1/qux
baz/2/qux
baz/3/qux
```
## Brace matching pitfalls
Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of.
### tldr
**"brace bombs"**
* brace expansion can eat up a huge amount of processing resources
* as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially
* users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!)
For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section.
### The solution
Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries.
### Geometric complexity
At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`.
For example, the following sets demonstrate quadratic (`O(n^2)`) complexity:
```
{1,2}{3,4} => (2X2) => 13 14 23 24
{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246
```
But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity:
```
{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248
249 257 258 259 267 268 269 347 348 349 357
358 359 367 368 369
```
Now, imagine how this complexity grows given that each element is a n-tuple:
```
{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB)
{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB)
```
Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control.
**More information**
Interested in learning more about brace expansion?
* [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion)
* [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion)
* [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)
</details>
## Performance
Braces is not only screaming fast, it's also more accurate the other brace expansion libraries.
### Better algorithms
Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_.
Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently.
**The proof is in the numbers**
Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively.
| **Pattern** | **braces** | **[minimatch][]** |
| --- | --- | --- |
| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs)| N/A (freezes) |
| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) |
| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) |
| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) |
| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) |
| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) |
| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) |
| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) |
| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) |
| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) |
| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) |
| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) |
| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) |
| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) |
| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) |
| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) |
| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) |
### Faster algorithms
When you need expansion, braces is still much faster.
_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_
| **Pattern** | **braces** | **[minimatch][]** |
| --- | --- | --- |
| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) |
| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) |
| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) |
| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) |
| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) |
| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) |
| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) |
| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) |
If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js).
## Benchmarks
### Running benchmarks
Install dev dependencies:
```bash
npm i -d && npm benchmark
```
### Latest results
Braces is more accurate, without sacrificing performance.
```bash
# range (expanded)
braces x 29,040 ops/sec ±3.69% (91 runs sampled))
minimatch x 4,735 ops/sec ±1.28% (90 runs sampled)
# range (optimized for regex)
braces x 382,878 ops/sec ±0.56% (94 runs sampled)
minimatch x 1,040 ops/sec ±0.44% (93 runs sampled)
# nested ranges (expanded)
braces x 19,744 ops/sec ±2.27% (92 runs sampled))
minimatch x 4,579 ops/sec ±0.50% (93 runs sampled)
# nested ranges (optimized for regex)
braces x 246,019 ops/sec ±2.02% (93 runs sampled)
minimatch x 1,028 ops/sec ±0.39% (94 runs sampled)
# set (expanded)
braces x 138,641 ops/sec ±0.53% (95 runs sampled)
minimatch x 219,582 ops/sec ±0.98% (94 runs sampled)
# set (optimized for regex)
braces x 388,408 ops/sec ±0.41% (95 runs sampled)
minimatch x 44,724 ops/sec ±0.91% (89 runs sampled)
# nested sets (expanded)
braces x 84,966 ops/sec ±0.48% (94 runs sampled)
minimatch x 140,720 ops/sec ±0.37% (95 runs sampled)
# nested sets (optimized for regex)
braces x 263,340 ops/sec ±2.06% (92 runs sampled)
minimatch x 28,714 ops/sec ±0.40% (90 runs sampled)
```
## About
<details>
<summary><strong>Contributing</strong></summary>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
</details>
<details>
<summary><strong>Running Tests</strong></summary>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
</details>
<details>
<summary><strong>Building docs</strong></summary>
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
</details>
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 197 | [jonschlinkert](https://github.com/jonschlinkert) |
| 4 | [doowb](https://github.com/doowb) |
| 1 | [es128](https://github.com/es128) |
| 1 | [eush77](https://github.com/eush77) |
| 1 | [hemanth](https://github.com/hemanth) |
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
### Author
**Jon Schlinkert**
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
### License
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._

View File

@@ -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 L G M N O"},C:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB 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 EC FC","16":"xB yB"},D:{"1":"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":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"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":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB PC QC RC SC qB AC TC rB"},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:{"2":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:7,C:"Background Sync API"};

View File

@@ -0,0 +1,7 @@
import { Subject } from '../Subject';
import { multicast } from './multicast';
import { connect } from './connect';
export function publish(selector) {
return selector ? (source) => connect(selector)(source) : (source) => multicast(new Subject())(source);
}
//# sourceMappingURL=publish.js.map

View File

@@ -0,0 +1,373 @@
// @ts-check
import bigSign from '../util/bigSign'
import { remapBitfield } from './remap-bitfield.js'
/**
* @typedef {'base' | 'defaults' | 'components' | 'utilities' | 'variants' | 'user'} Layer
*/
/**
* @typedef {object} VariantOption
* @property {number} id An unique identifier to identify `matchVariant`
* @property {function | undefined} sort The sort function
* @property {string|null} value The value we want to compare
* @property {string|null} modifier The modifier that was used (if any)
* @property {bigint} variant The variant bitmask
*/
/**
* @typedef {object} RuleOffset
* @property {Layer} layer The layer that this rule belongs to
* @property {Layer} parentLayer The layer that this rule originally belonged to. Only different from layer if this is a variant.
* @property {bigint} arbitrary 0n if false, 1n if true
* @property {bigint} variants Dynamic size. 1 bit per registered variant. 0n means no variants
* @property {bigint} parallelIndex Rule index for the parallel variant. 0 if not applicable.
* @property {bigint} index Index of the rule / utility in it's given *parent* layer. Monotonically increasing.
* @property {VariantOption[]} options Some information on how we can sort arbitrary variants
*/
export class Offsets {
constructor() {
/**
* Offsets for the next rule in a given layer
*
* @type {Record<Layer, bigint>}
*/
this.offsets = {
defaults: 0n,
base: 0n,
components: 0n,
utilities: 0n,
variants: 0n,
user: 0n,
}
/**
* Positions for a given layer
*
* @type {Record<Layer, bigint>}
*/
this.layerPositions = {
defaults: 0n,
base: 1n,
components: 2n,
utilities: 3n,
// There isn't technically a "user" layer, but we need to give it a position
// Because it's used for ordering user-css from @apply
user: 4n,
variants: 5n,
}
/**
* The total number of functions currently registered across all variants (including arbitrary variants)
*
* @type {bigint}
*/
this.reservedVariantBits = 0n
/**
* Positions for a given variant
*
* @type {Map<string, bigint>}
*/
this.variantOffsets = new Map()
}
/**
* @param {Layer} layer
* @returns {RuleOffset}
*/
create(layer) {
return {
layer,
parentLayer: layer,
arbitrary: 0n,
variants: 0n,
parallelIndex: 0n,
index: this.offsets[layer]++,
options: [],
}
}
/**
* @returns {RuleOffset}
*/
arbitraryProperty() {
return {
...this.create('utilities'),
arbitrary: 1n,
}
}
/**
* Get the offset for a variant
*
* @param {string} variant
* @param {number} index
* @returns {RuleOffset}
*/
forVariant(variant, index = 0) {
let offset = this.variantOffsets.get(variant)
if (offset === undefined) {
throw new Error(`Cannot find offset for unknown variant ${variant}`)
}
return {
...this.create('variants'),
variants: offset << BigInt(index),
}
}
/**
* @param {RuleOffset} rule
* @param {RuleOffset} variant
* @param {VariantOption} options
* @returns {RuleOffset}
*/
applyVariantOffset(rule, variant, options) {
options.variant = variant.variants
return {
...rule,
layer: 'variants',
parentLayer: rule.layer === 'variants' ? rule.parentLayer : rule.layer,
variants: rule.variants | variant.variants,
options: options.sort ? [].concat(options, rule.options) : rule.options,
// TODO: Technically this is wrong. We should be handling parallel index on a per variant basis.
// We'll take the max of all the parallel indexes for now.
// @ts-ignore
parallelIndex: max([rule.parallelIndex, variant.parallelIndex]),
}
}
/**
* @param {RuleOffset} offset
* @param {number} parallelIndex
* @returns {RuleOffset}
*/
applyParallelOffset(offset, parallelIndex) {
return {
...offset,
parallelIndex: BigInt(parallelIndex),
}
}
/**
* Each variant gets 1 bit per function / rule registered.
* This is because multiple variants can be applied to a single rule and we need to know which ones are present and which ones are not.
* Additionally, every unique group of variants is grouped together in the stylesheet.
*
* This grouping is order-independent. For instance, we do not differentiate between `hover:focus` and `focus:hover`.
*
* @param {string[]} variants
* @param {(name: string) => number} getLength
*/
recordVariants(variants, getLength) {
for (let variant of variants) {
this.recordVariant(variant, getLength(variant))
}
}
/**
* The same as `recordVariants` but for a single arbitrary variant at runtime.
* @param {string} variant
* @param {number} fnCount
*
* @returns {RuleOffset} The highest offset for this variant
*/
recordVariant(variant, fnCount = 1) {
this.variantOffsets.set(variant, 1n << this.reservedVariantBits)
// Ensure space is reserved for each "function" in the parallel variant
// by offsetting the next variant by the number of parallel variants
// in the one we just added.
// Single functions that return parallel variants are NOT handled separately here
// They're offset by 1 (or the number of functions) as usual
// And each rule returned is tracked separately since the functions are evaluated lazily.
// @see `RuleOffset.parallelIndex`
this.reservedVariantBits += BigInt(fnCount)
return {
...this.create('variants'),
variants: this.variantOffsets.get(variant),
}
}
/**
* @param {RuleOffset} a
* @param {RuleOffset} b
* @returns {bigint}
*/
compare(a, b) {
// Sort layers together
if (a.layer !== b.layer) {
return this.layerPositions[a.layer] - this.layerPositions[b.layer]
}
// When sorting the `variants` layer, we need to sort based on the parent layer as well within
// this variants layer.
if (a.parentLayer !== b.parentLayer) {
return this.layerPositions[a.parentLayer] - this.layerPositions[b.parentLayer]
}
// Sort based on the sorting function
for (let aOptions of a.options) {
for (let bOptions of b.options) {
if (aOptions.id !== bOptions.id) continue
if (!aOptions.sort || !bOptions.sort) continue
let maxFnVariant = max([aOptions.variant, bOptions.variant]) ?? 0n
// Create a mask of 0s from bits 1..N where N represents the mask of the Nth bit
let mask = ~(maxFnVariant | (maxFnVariant - 1n))
let aVariantsAfterFn = a.variants & mask
let bVariantsAfterFn = b.variants & mask
// If the variants the same, we _can_ sort them
if (aVariantsAfterFn !== bVariantsAfterFn) {
continue
}
let result = aOptions.sort(
{
value: aOptions.value,
modifier: aOptions.modifier,
},
{
value: bOptions.value,
modifier: bOptions.modifier,
}
)
if (result !== 0) return result
}
}
// Sort variants in the order they were registered
if (a.variants !== b.variants) {
return a.variants - b.variants
}
// Make sure each rule returned by a parallel variant is sorted in ascending order
if (a.parallelIndex !== b.parallelIndex) {
return a.parallelIndex - b.parallelIndex
}
// Always sort arbitrary properties after other utilities
if (a.arbitrary !== b.arbitrary) {
return a.arbitrary - b.arbitrary
}
// Sort utilities, components, etc… in the order they were registered
return a.index - b.index
}
/**
* Arbitrary variants are recorded in the order they're encountered.
* This means that the order is not stable between environments and sets of content files.
*
* In order to make the order stable, we need to remap the arbitrary variant offsets to
* be in alphabetical order starting from the offset of the first arbitrary variant.
*/
recalculateVariantOffsets() {
// Sort the variants by their name
let variants = Array.from(this.variantOffsets.entries())
.filter(([v]) => v.startsWith('['))
.sort(([a], [z]) => fastCompare(a, z))
// Sort the list of offsets
// This is not necessarily a discrete range of numbers which is why
// we're using sort instead of creating a range from min/max
let newOffsets = variants.map(([, offset]) => offset).sort((a, z) => bigSign(a - z))
// Create a map from the old offsets to the new offsets in the new sort order
/** @type {[bigint, bigint][]} */
let mapping = variants.map(([, oldOffset], i) => [oldOffset, newOffsets[i]])
// Remove any variants that will not move letting us skip
// remapping if everything happens to be in order
return mapping.filter(([a, z]) => a !== z)
}
/**
* @template T
* @param {[RuleOffset, T][]} list
* @returns {[RuleOffset, T][]}
*/
remapArbitraryVariantOffsets(list) {
let mapping = this.recalculateVariantOffsets()
// No arbitrary variants? Nothing to do.
// Everyhing already in order? Nothing to do.
if (mapping.length === 0) {
return list
}
// Remap every variant offset in the list
return list.map((item) => {
let [offset, rule] = item
offset = {
...offset,
variants: remapBitfield(offset.variants, mapping),
}
return [offset, rule]
})
}
/**
* @template T
* @param {[RuleOffset, T][]} list
* @returns {[RuleOffset, T][]}
*/
sort(list) {
list = this.remapArbitraryVariantOffsets(list)
return list.sort(([a], [b]) => bigSign(this.compare(a, b)))
}
}
/**
*
* @param {bigint[]} nums
* @returns {bigint|null}
*/
function max(nums) {
let max = null
for (const num of nums) {
max = max ?? num
max = max > num ? max : num
}
return max
}
/**
* A fast ASCII order string comparison function.
*
* Using `.sort()` without a custom compare function is faster
* But you can only use that if you're sorting an array of
* only strings. If you're sorting strings inside objects
* or arrays, you need must use a custom compare function.
*
* @param {string} a
* @param {string} b
*/
function fastCompare(a, b) {
let aLen = a.length
let bLen = b.length
let minLen = aLen < bLen ? aLen : bLen
for (let i = 0; i < minLen; i++) {
let cmp = a.charCodeAt(i) - b.charCodeAt(i)
if (cmp !== 0) return cmp
}
return aLen - bLen
}

View File

@@ -0,0 +1,9 @@
import { createErrorClass } from './createErrorClass';
export var NotFoundError = createErrorClass(function (_super) {
return function NotFoundErrorImpl(message) {
_super(this);
this.name = 'NotFoundError';
this.message = message;
};
});
//# sourceMappingURL=NotFoundError.js.map

View File

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

View File

@@ -0,0 +1 @@
{"name":"xtend","version":"4.0.2","files":{"package.json":{"checkedAt":1678883672878,"integrity":"sha512-uzaVuneHLru1+mmShIWPo9/vpohT4gW6mSXorJR9b9vHcA1OYdIopX1RuBXdesnaDIXvE7NRAeFg9WIuudajOw==","mode":436,"size":1056},"immutable.js":{"checkedAt":1678883672878,"integrity":"sha512-HjqCdkmzLUpD/7fIlOejdMEhFtrcnB9T3I0vz6kY6DgTc32tAigPtsCegAGL4PCThAq92liZRRmpRiroqv5U3w==","mode":436,"size":384},".jshintrc":{"checkedAt":1678883672878,"integrity":"sha512-xDAGiM96KKFNKmTQgW675dU84sBIuBatKLAS4nTXMwhiKB2Fd9XaoDlVmsqzE0t5LQCbXgYgVQ4ekj2U35xFaw==","mode":436,"size":545},"LICENSE":{"checkedAt":1678883672878,"integrity":"sha512-NGMeLG5GAXCi6QssRQmGk8h0Z7KjdsCwgFnaDNmgkBFcwQr2ADSmRK4UV9cgrENP0DHJpE5Dlm7nXGSu3n+K5g==","mode":436,"size":1078},"mutable.js":{"checkedAt":1678883672878,"integrity":"sha512-iCpqDNydyAI9x+wKBiYXoOEg3RotYgrIygErutsdFyhDIRYK/i9ElEAsi0EjI0Ui1asYqeT+1UL+gMGl6o7rZw==","mode":436,"size":369},"README.md":{"checkedAt":1678883672878,"integrity":"sha512-y7q36h7gkX3HW4LC/nSLzqU6hgqjLtoVWfGpji6zoWxqz1u1GyZ9tRLGM4jYKlzTRgOzxNbhmyx21olWv4AIyw==","mode":436,"size":726},"test.js":{"checkedAt":1678883672878,"integrity":"sha512-IBSFg1gIxmc3Y61f3iKNvynOqAUlULTA7X98mxSckbgwIFBvzd+FHkWiGA2F4U/yNIpbNK7L/68IFR+/AESSFw==","mode":436,"size":2307}}}

View File

@@ -0,0 +1,97 @@
'use strict';
var common = require('../common');
var Type = require('../type');
var YAML_FLOAT_PATTERN = new RegExp(
// 2.5e4, 2.5 and integers
'^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
// .2e4, .2
// special case, seems not from spec
'|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
// .inf
'|[-+]?\\.(?:inf|Inf|INF)' +
// .nan
'|\\.(?:nan|NaN|NAN))$');
function resolveYamlFloat(data) {
if (data === null) return false;
if (!YAML_FLOAT_PATTERN.test(data) ||
// Quick hack to not allow integers end with `_`
// Probably should update regexp & check speed
data[data.length - 1] === '_') {
return false;
}
return true;
}
function constructYamlFloat(data) {
var value, sign;
value = data.replace(/_/g, '').toLowerCase();
sign = value[0] === '-' ? -1 : 1;
if ('+-'.indexOf(value[0]) >= 0) {
value = value.slice(1);
}
if (value === '.inf') {
return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
} else if (value === '.nan') {
return NaN;
}
return sign * parseFloat(value, 10);
}
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
function representYamlFloat(object, style) {
var res;
if (isNaN(object)) {
switch (style) {
case 'lowercase': return '.nan';
case 'uppercase': return '.NAN';
case 'camelcase': return '.NaN';
}
} else if (Number.POSITIVE_INFINITY === object) {
switch (style) {
case 'lowercase': return '.inf';
case 'uppercase': return '.INF';
case 'camelcase': return '.Inf';
}
} else if (Number.NEGATIVE_INFINITY === object) {
switch (style) {
case 'lowercase': return '-.inf';
case 'uppercase': return '-.INF';
case 'camelcase': return '-.Inf';
}
} else if (common.isNegativeZero(object)) {
return '-0.0';
}
res = object.toString(10);
// JS stringifier can build scientific format without dots: 5e-100,
// while YAML requres dot: 5.e-100. Fix it with simple hack
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
}
function isFloat(object) {
return (Object.prototype.toString.call(object) === '[object Number]') &&
(object % 1 !== 0 || common.isNegativeZero(object));
}
module.exports = new Type('tag:yaml.org,2002:float', {
kind: 'scalar',
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: 'lowercase'
});

View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('./async').pickSeries;

View File

@@ -0,0 +1,10 @@
function InvalidPropertyError(message) {
this.name = 'InvalidPropertyError';
this.message = message;
this.stack = (new Error()).stack;
}
InvalidPropertyError.prototype = Object.create(Error.prototype);
InvalidPropertyError.prototype.constructor = InvalidPropertyError;
module.exports = InvalidPropertyError;

View File

@@ -0,0 +1,34 @@
"use strict";
var d = require("d")
, NativeSymbol = require("ext/global-this").Symbol;
module.exports = function (SymbolPolyfill) {
return Object.defineProperties(SymbolPolyfill, {
// To ensure proper interoperability with other native functions (e.g. Array.from)
// fallback to eventual native implementation of given symbol
hasInstance: d(
"", (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill("hasInstance")
),
isConcatSpreadable: d(
"",
(NativeSymbol && NativeSymbol.isConcatSpreadable) ||
SymbolPolyfill("isConcatSpreadable")
),
iterator: d("", (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill("iterator")),
match: d("", (NativeSymbol && NativeSymbol.match) || SymbolPolyfill("match")),
replace: d("", (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill("replace")),
search: d("", (NativeSymbol && NativeSymbol.search) || SymbolPolyfill("search")),
species: d("", (NativeSymbol && NativeSymbol.species) || SymbolPolyfill("species")),
split: d("", (NativeSymbol && NativeSymbol.split) || SymbolPolyfill("split")),
toPrimitive: d(
"", (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill("toPrimitive")
),
toStringTag: d(
"", (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill("toStringTag")
),
unscopables: d(
"", (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill("unscopables")
)
});
};

View File

@@ -0,0 +1,41 @@
{
"name": "is-npm",
"version": "6.0.0",
"description": "Check if your code is running as an npm script",
"license": "MIT",
"repository": "sindresorhus/is-npm",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"npm",
"yarn",
"is",
"check",
"detect",
"env",
"environment",
"run",
"script"
],
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.17.0",
"xo": "^0.44.0"
}
}

View File

@@ -0,0 +1,23 @@
declare type MessageFormat = (...args: any[]) => string;
declare type Message = string | MessageFormat;
export declare type Language = {
[key: string]: Message | Language;
};
export declare class Translator {
private readonly _language;
private readonly _defaultLanguage;
constructor(language?: Language);
/**
* Tries to split the message with "." and find
* the key in the given language
*
* @param message
* @param lang
*/
getString(message: string, lang: Language): MessageFormat;
translate(message: string, ...args: any[]): string;
}
export declare function useTranslator(
translator: Translator,
): (message: string, ...args: any[]) => string;
export {};

View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/is-typed-array
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -0,0 +1 @@
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../../../src/internal/operators/throttle.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,2DAAgE;AAChE,qDAAoD;AAOvC,QAAA,qBAAqB,GAAmB;IACnD,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,KAAK;CAChB,CAAC;AAgDF,SAAgB,QAAQ,CACtB,gBAAoD,EACpD,MAA8C;IAA9C,uBAAA,EAAA,SAAyB,6BAAqB;IAE9C,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QACxB,IAAA,OAAO,GAAe,MAAM,QAArB,EAAE,QAAQ,GAAK,MAAM,SAAX,CAAY;QACrC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,SAAS,GAAa,IAAI,CAAC;QAC/B,IAAI,SAAS,GAAwB,IAAI,CAAC;QAC1C,IAAI,UAAU,GAAG,KAAK,CAAC;QAEvB,IAAM,aAAa,GAAG;YACpB,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,EAAE,CAAC;YACzB,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,QAAQ,EAAE;gBACZ,IAAI,EAAE,CAAC;gBACP,UAAU,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;aACrC;QACH,CAAC,CAAC;QAEF,IAAM,iBAAiB,GAAG;YACxB,SAAS,GAAG,IAAI,CAAC;YACjB,UAAU,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACtC,CAAC,CAAC;QAEF,IAAM,aAAa,GAAG,UAAC,KAAQ;YAC7B,OAAA,CAAC,SAAS,GAAG,qBAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,6CAAwB,CAAC,UAAU,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC;QAAlI,CAAkI,CAAC;QAErI,IAAM,IAAI,GAAG;YACX,IAAI,QAAQ,EAAE;gBAIZ,QAAQ,GAAG,KAAK,CAAC;gBACjB,IAAM,KAAK,GAAG,SAAU,CAAC;gBACzB,SAAS,GAAG,IAAI,CAAC;gBAEjB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC,UAAU,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;aACrC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EAMV,UAAC,KAAK;YACJ,QAAQ,GAAG,IAAI,CAAC;YAChB,SAAS,GAAG,KAAK,CAAC;YAClB,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;QACjF,CAAC,EACD;YACE,UAAU,GAAG,IAAI,CAAC;YAClB,CAAC,CAAC,QAAQ,IAAI,QAAQ,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACrF,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA9DD,4BA8DC"}

View File

@@ -0,0 +1,12 @@
'use strict';
// this should only run in node >= 13.2, so it
// does not need any of the intense fallbacks that old node/browsers do
var $iterator = Symbol.iterator;
module.exports = function getIterator(iterable) {
// alternatively, `iterable[$iterator]?.()`
if (iterable != null && typeof iterable[$iterator] !== 'undefined') {
return iterable[$iterator]();
}
};

View File

@@ -0,0 +1,63 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $Number = GetIntrinsic('%Number%');
var $TypeError = GetIntrinsic('%TypeError%');
var $isNaN = require('../helpers/isNaN');
var $isFinite = require('../helpers/isFinite');
var isPrefixOf = require('../helpers/isPrefixOf');
var ToNumber = require('./ToNumber');
var ToPrimitive = require('./ToPrimitive');
var Type = require('./Type');
// https://262.ecma-international.org/5.1/#sec-11.8.5
// eslint-disable-next-line max-statements
module.exports = function AbstractRelationalComparison(x, y, LeftFirst) {
if (Type(LeftFirst) !== 'Boolean') {
throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean');
}
var px;
var py;
if (LeftFirst) {
px = ToPrimitive(x, $Number);
py = ToPrimitive(y, $Number);
} else {
py = ToPrimitive(y, $Number);
px = ToPrimitive(x, $Number);
}
var bothStrings = Type(px) === 'String' && Type(py) === 'String';
if (!bothStrings) {
var nx = ToNumber(px);
var ny = ToNumber(py);
if ($isNaN(nx) || $isNaN(ny)) {
return undefined;
}
if ($isFinite(nx) && $isFinite(ny) && nx === ny) {
return false;
}
if (nx === Infinity) {
return false;
}
if (ny === Infinity) {
return true;
}
if (ny === -Infinity) {
return false;
}
if (nx === -Infinity) {
return true;
}
return nx < ny; // by now, these are both nonzero, finite, and not equal
}
if (isPrefixOf(py, px)) {
return false;
}
if (isPrefixOf(px, py)) {
return true;
}
return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f
};

View File

@@ -0,0 +1 @@
{"name":"deep-extend","version":"0.6.0","files":{"package.json":{"checkedAt":1678883672787,"integrity":"sha512-Ljm3tNdZQ75m9SYZjwN8Ud5lBDyLTwtNQ034Z0glCmOpgiLr9f0ndl0dfESvcj2EW1CvojfJa70gdxzOUyJ0Nw==","mode":436,"size":1312},"CHANGELOG.md":{"checkedAt":1678883672787,"integrity":"sha512-n7YjaKIMwQ1tqhv9akzSxDyt0t18v7etftwgDaUP7xRxQEKF+HqhfVSh9nNa1lKTMqWoDTawI1azDuWwRjhiZA==","mode":436,"size":1155},"LICENSE":{"checkedAt":1678883672787,"integrity":"sha512-DWQOyztAi96W4Ds+eIMFCYCstAQ4jwx1A65h7RjH/xwi1I8ayTdn25jMlRcZy0MlYlTnIZaPNq0l4PFqFzQmVw==","mode":436,"size":1093},"index.js":{"checkedAt":1678883672787,"integrity":"sha512-n76QNPhmKQWIEpBl+ivm+TobcRpeNBYB2EE/iWScIu6QZwklnqU0vSnPykn3a8r1Dun2mg4suAy2P10RIZGIOg==","mode":436,"size":47},"README.md":{"checkedAt":1678883672787,"integrity":"sha512-1+QXvAbJMmJ6ImmBXvXytEagD8cPM8+7gnwp21YIEnSHT0drBrKZS1CHzWGjDQmGRWWsZ8sLNnTwTXAn3atvtg==","mode":436,"size":1290},"lib/deep-extend.js":{"checkedAt":1678883672787,"integrity":"sha512-IN+y2Sshk3DYLFRLTIGWknrMjQ0MFgVq2T0e2u0QNhkrx+QBZHRTCwLJmHVg+EtWRHz+C6e/0BCw2ogxc3Ou1g==","mode":436,"size":4293}}}

View File

@@ -0,0 +1,11 @@
"use strict";
module.exports = {
"#": require("./#"),
"formatMethod": require("./format-method"),
"fromCodePoint": require("./from-code-point"),
"isString": require("./is-string"),
"random": require("./random"),
"randomUniq": require("./random-uniq"),
"raw": require("./raw")
};

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,35 @@
/**
* Choice object
* Normalize input as choice object
* @constructor
* @param {Number|String|Object} val Choice value. If an object is passed, it should contains
* at least one of `value` or `name` property
*/
export default class Choice {
constructor(val, answers) {
// Don't process Choice and Separator object
if (val instanceof Choice || val.type === 'separator') {
// eslint-disable-next-line no-constructor-return
return val;
}
if (typeof val === 'string' || typeof val === 'number') {
this.name = String(val);
this.value = val;
this.short = String(val);
} else {
Object.assign(this, val, {
name: val.name || val.value,
value: 'value' in val ? val.value : val.name,
short: val.short || val.name || val.value,
});
}
if (typeof val.disabled === 'function') {
this.disabled = val.disabled(answers);
} else {
this.disabled = val.disabled;
}
}
}

View File

@@ -0,0 +1,19 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('./Type');
var isSharedArrayBuffer = require('is-shared-array-buffer');
// https://262.ecma-international.org/8.0/#sec-issharedarraybuffer
module.exports = function IsSharedArrayBuffer(obj) {
if (Type(obj) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
return isSharedArrayBuffer(obj);
};

View File

@@ -0,0 +1,47 @@
# string_decoder
***Node-core v8.9.4 string_decoder for userland***
[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/)
[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/)
```bash
npm install --save string_decoder
```
***Node-core string_decoder for userland***
This package is a mirror of the string_decoder implementation in Node-core.
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/).
As of version 1.0.0 **string_decoder** uses semantic versioning.
## Previous versions
Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10.
## Update
The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version.
## Streams Working Group
`string_decoder` is maintained by the Streams Working Group, which
oversees the development and maintenance of the Streams API within
Node.js. The responsibilities of the Streams Working Group include:
* Addressing stream issues on the Node.js issue tracker.
* Authoring and editing stream documentation within the Node.js project.
* Reviewing changes to stream subclasses within the Node.js project.
* Redirecting changes to streams from the Node.js project to this
project.
* Assisting in the implementation of stream providers within Node.js.
* Recommending versions of `readable-stream` to be included in Node.js.
* Messaging about the future of streams to give the community advance
notice of changes.
See [readable-stream](https://github.com/nodejs/readable-stream) for
more details.

View File

@@ -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-signedRightShift
module.exports = function NumberSignedRightShift(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;
};

View File

@@ -0,0 +1 @@
{"name":"array-buffer-byte-length","version":"1.0.0","files":{".nycrc":{"checkedAt":1678883671537,"integrity":"sha512-42sgwWzusJB1Dzhl78jX/Zg65Oi0HDDMOGXS/Uklv1kCYn4fHtRsD/JFPwdu+d40vome9XdUspzRWEQAcTGEeQ==","mode":420,"size":216},".eslintrc":{"checkedAt":1678883671576,"integrity":"sha512-4+yheARSL/pPQeg25245ejEKIOgmGjgRW2fotkREQVMDnQQZj7Rw9FvimX0senKxW9R3GgLHQbPLwHLqbvQy6Q==","mode":420,"size":43},"LICENSE":{"checkedAt":1678883671576,"integrity":"sha512-NHFoVSGLgGbMEiVOo9qIXE1oZrVi3RO6KVB9XeEDen516TDX3VcytN7NubUc2qVrYB/KeYV+mqz6PbQYju2odg==","mode":420,"size":1067},"test/index.js":{"checkedAt":1678883671576,"integrity":"sha512-glKcWzlSmawnzWBxBPKSClKcTPdnV5A20ad4y2XKADcAK9GCMhHYG9ivyDl4O2odBcBS/418W+AFumhBuld86Q==","mode":420,"size":751},"index.js":{"checkedAt":1678883671576,"integrity":"sha512-N8yRPe6DE2EEZ6tgqdz0LEKPlp8c9Hi3f+i5yWWtOyq0yCM/7FLqveTSS0i4Nq8ETFvJLv7O20vq0eeXdLtZJA==","mode":420,"size":394},"package.json":{"checkedAt":1678883671576,"integrity":"sha512-ruUH5WcFCsrb4XuOn7Z+hAqkG+WURYb1fulPVHOUfWNANl0/2DyNzawQbJa+zXOXE+Lsy+92gw33ekgMIU18HA==","mode":420,"size":2155},"CHANGELOG.md":{"checkedAt":1678883671576,"integrity":"sha512-47sAgtQir7e1/Q6ra8Wtnx9lyFnNoqb0eFqa4i5FCpsAbqEVuXHysYrxeaciV/3zL0vy9ZA99Dt9GjXEErwOZA==","mode":420,"size":855},"README.md":{"checkedAt":1678883671576,"integrity":"sha512-ESTIpNdIMmSWkWCnHyksqqGqCvqA0kYzmg7yWlWqaIpXJzZVDoBodvMEDd+x1E9UVLpC2a6X28nu0KmZg09SEA==","mode":420,"size":1977},".github/FUNDING.yml":{"checkedAt":1678883671582,"integrity":"sha512-cfg22BwuXqYcWfS6geIX0JX6paiz4nv8GAe6717DtAY6alextJPHltKPfMhLBzoYWi9OvDrXlvMEqXGNNkIthQ==","mode":420,"size":595}}}