new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { scanInternals } from './scanInternals';
|
||||
import { operate } from '../util/lift';
|
||||
export function reduce(accumulator, seed) {
|
||||
return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));
|
||||
}
|
||||
//# sourceMappingURL=reduce.js.map
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "decompress-response",
|
||||
"version": "6.0.0",
|
||||
"description": "Decompress a HTTP response if needed",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/decompress-response",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"decompress",
|
||||
"response",
|
||||
"http",
|
||||
"https",
|
||||
"zlib",
|
||||
"gzip",
|
||||
"zip",
|
||||
"deflate",
|
||||
"unzip",
|
||||
"ungzip",
|
||||
"incoming",
|
||||
"message",
|
||||
"stream",
|
||||
"compressed",
|
||||
"brotli"
|
||||
],
|
||||
"dependencies": {
|
||||
"mimic-response": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.1",
|
||||
"ava": "^2.2.0",
|
||||
"get-stream": "^5.0.0",
|
||||
"pify": "^5.0.0",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.30.0"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"@typescript-eslint/prefer-readonly-parameter-types": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"@octokit/core","version":"4.2.0","files":{"dist-src/types.js":{"checkedAt":1678883669320,"integrity":"sha512-TuHIj4w/TkzTTLbAAzm/nW0Db/St469J6HHMiWa4THKdi3VJKsxkE8mmZKwApXlYIjrBPEIp2oxi6+alPk94Pw==","mode":420,"size":11},"LICENSE":{"checkedAt":1678883670372,"integrity":"sha512-EHJOahlMp1lwtBt4Za3avDrfUOnQEDTeZ9T/SbhQwf90Vo/Mr5DW3QqyL+0w2phUaGj/PoEizqq/4IOQcYBr4w==","mode":420,"size":1081},"dist-node/index.js":{"checkedAt":1678883670372,"integrity":"sha512-1LC3CP7u6LJtXUtP3TAOE+/AIJiVguyO1cmycEeFDEIBC6L/F4Neh6yv3bfjiCAwdDqJ4cdz5SR/5TE1l1UPyw==","mode":420,"size":4525},"dist-src/index.js":{"checkedAt":1678883670372,"integrity":"sha512-1i+V3bTPMCaFIENuHxhotAuZk59rFhHEXXX7Ms5ZubQboRUgi10poeAq86LH/qghSjB5VV3Om5ZfrMF8OYW95w==","mode":420,"size":5073},"dist-src/version.js":{"checkedAt":1678883670374,"integrity":"sha512-QfBllNQV8snk2fQCV7tcZFXCjLINVxqLRbeTgm8OjENd0fkZgRHmx/qepNvv+3DYArbF0/HmGMMa9vT5MuO+gw==","mode":420,"size":32},"package.json":{"checkedAt":1678883670374,"integrity":"sha512-9ka95WvxcqyeGCk/jahaZV3lcp2BS/TCFR4CtdSK/rEz4oHBQ+9jwrWPbDbKVNzWF0MVgKK7m2nwigkumsYR4Q==","mode":420,"size":1500},"dist-web/index.js":{"checkedAt":1678883670374,"integrity":"sha512-FbOIKC+gWA23BQhW6zOFM8r1xQT5IZpFJXvdeasFVz9cJbJXl8fWAy1y3lx4S5veNcGyVVQphhEqYHzrTWLSMg==","mode":420,"size":5111},"dist-node/index.js.map":{"checkedAt":1678883670374,"integrity":"sha512-JepNQ3C2W+pUgLbvSYiZA+WEO0hYFqH+foxIfDRCG/K9LvhDRRw0AAjd1cY5lBj6QFGxEaDZGTm2dYkMNOUYLA==","mode":420,"size":9395},"dist-web/index.js.map":{"checkedAt":1678883670376,"integrity":"sha512-sg2Ox/M4Oq+872Aj6kCMrse0i+Gplq6TCG4ylzO3bA5AVts3Um4sWJvDHFWkeowve2nHWck/VkrNqdObrH1cNw==","mode":420,"size":9141},"dist-types/index.d.ts":{"checkedAt":1678883670378,"integrity":"sha512-xHII2oRnyFU/adPDdSMTXpAFNiCMMr18WktJVb1aD3PozLIqSJY+rtFUL9hArz9qswfOPMs/IcH3r8Nw3U8e7g==","mode":420,"size":1296},"dist-types/types.d.ts":{"checkedAt":1678883670378,"integrity":"sha512-UsAu3R7kKcNvuoob3AM/b12RcLM0lyP+dmGQ+aO3iIUQiovjRhs0KnGnm0paQzWfIj+dyIaa9wGGDBWXtEcZVA==","mode":420,"size":1698},"README.md":{"checkedAt":1678883670378,"integrity":"sha512-wy2wD5nTEKyZjnuTWNGVe14C8t7CYC2IrR6g+zWS8AYoJYVSMgdyETOGe7ddAClOKsjaVUse+suvk72G2q8FRQ==","mode":420,"size":12228},"dist-types/version.d.ts":{"checkedAt":1678883670378,"integrity":"sha512-/1EaWXUGubePG1HduQ1srl7Qp4e92QZpH1neXzMWYUywsdNJfVIpx2Df+e7b7JAbzQaM3qt0Ade40yLozCGKKw==","mode":420,"size":40}}}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Scheduler } from '../Scheduler';
|
||||
import { SubscriptionLog } from './SubscriptionLog';
|
||||
|
||||
export class SubscriptionLoggable {
|
||||
public subscriptions: SubscriptionLog[] = [];
|
||||
// @ts-ignore: Property has no initializer and is not definitely assigned
|
||||
scheduler: Scheduler;
|
||||
|
||||
logSubscribedFrame(): number {
|
||||
this.subscriptions.push(new SubscriptionLog(this.scheduler.now()));
|
||||
return this.subscriptions.length - 1;
|
||||
}
|
||||
|
||||
logUnsubscribedFrame(index: number) {
|
||||
const subscriptionLogs = this.subscriptions;
|
||||
const oldSubscriptionLog = subscriptionLogs[index];
|
||||
subscriptionLogs[index] = new SubscriptionLog(
|
||||
oldSubscriptionLog.subscribedFrame,
|
||||
this.scheduler.now()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
var arraySome = require('./_arraySome'),
|
||||
createOver = require('./_createOver');
|
||||
|
||||
/**
|
||||
* Creates a function that checks if **any** of the `predicates` return
|
||||
* truthy when invoked with the arguments it receives.
|
||||
*
|
||||
* Following shorthands are possible for providing predicates.
|
||||
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
||||
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} [predicates=[_.identity]]
|
||||
* The predicates to check.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
* var func = _.overSome([Boolean, isFinite]);
|
||||
*
|
||||
* func('1');
|
||||
* // => true
|
||||
*
|
||||
* func(null);
|
||||
* // => true
|
||||
*
|
||||
* func(NaN);
|
||||
* // => false
|
||||
*
|
||||
* var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
|
||||
* var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
|
||||
*/
|
||||
var overSome = createOver(arraySome);
|
||||
|
||||
module.exports = overSome;
|
||||
@@ -0,0 +1,77 @@
|
||||
var baseKeys = require('./_baseKeys'),
|
||||
getTag = require('./_getTag'),
|
||||
isArguments = require('./isArguments'),
|
||||
isArray = require('./isArray'),
|
||||
isArrayLike = require('./isArrayLike'),
|
||||
isBuffer = require('./isBuffer'),
|
||||
isPrototype = require('./_isPrototype'),
|
||||
isTypedArray = require('./isTypedArray');
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
setTag = '[object Set]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Checks if `value` is an empty object, collection, map, or set.
|
||||
*
|
||||
* Objects are considered empty if they have no own enumerable string keyed
|
||||
* properties.
|
||||
*
|
||||
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
|
||||
* jQuery-like collections are considered empty if they have a `length` of `0`.
|
||||
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isEmpty(null);
|
||||
* // => true
|
||||
*
|
||||
* _.isEmpty(true);
|
||||
* // => true
|
||||
*
|
||||
* _.isEmpty(1);
|
||||
* // => true
|
||||
*
|
||||
* _.isEmpty([1, 2, 3]);
|
||||
* // => false
|
||||
*
|
||||
* _.isEmpty({ 'a': 1 });
|
||||
* // => false
|
||||
*/
|
||||
function isEmpty(value) {
|
||||
if (value == null) {
|
||||
return true;
|
||||
}
|
||||
if (isArrayLike(value) &&
|
||||
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
||||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
||||
return !value.length;
|
||||
}
|
||||
var tag = getTag(value);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return !value.size;
|
||||
}
|
||||
if (isPrototype(value)) {
|
||||
return !baseKeys(value).length;
|
||||
}
|
||||
for (var key in value) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isEmpty;
|
||||
@@ -0,0 +1,611 @@
|
||||
/*!
|
||||
* Tmp
|
||||
*
|
||||
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
|
||||
*
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*
|
||||
* Module dependencies.
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const osTmpDir = require('os-tmpdir');
|
||||
const _c = process.binding('constants');
|
||||
|
||||
/*
|
||||
* The working inner variables.
|
||||
*/
|
||||
const
|
||||
/**
|
||||
* The temporary directory.
|
||||
* @type {string}
|
||||
*/
|
||||
tmpDir = osTmpDir(),
|
||||
|
||||
// the random characters to choose from
|
||||
RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
|
||||
|
||||
TEMPLATE_PATTERN = /XXXXXX/,
|
||||
|
||||
DEFAULT_TRIES = 3,
|
||||
|
||||
CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),
|
||||
|
||||
EBADF = _c.EBADF || _c.os.errno.EBADF,
|
||||
ENOENT = _c.ENOENT || _c.os.errno.ENOENT,
|
||||
|
||||
DIR_MODE = 448 /* 0o700 */,
|
||||
FILE_MODE = 384 /* 0o600 */,
|
||||
|
||||
// this will hold the objects need to be removed on exit
|
||||
_removeObjects = [];
|
||||
|
||||
var
|
||||
_gracefulCleanup = false,
|
||||
_uncaughtException = false;
|
||||
|
||||
/**
|
||||
* Random name generator based on crypto.
|
||||
* Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
|
||||
*
|
||||
* @param {number} howMany
|
||||
* @returns {string} the generated random name
|
||||
* @private
|
||||
*/
|
||||
function _randomChars(howMany) {
|
||||
var
|
||||
value = [],
|
||||
rnd = null;
|
||||
|
||||
// make sure that we do not fail because we ran out of entropy
|
||||
try {
|
||||
rnd = crypto.randomBytes(howMany);
|
||||
} catch (e) {
|
||||
rnd = crypto.pseudoRandomBytes(howMany);
|
||||
}
|
||||
|
||||
for (var i = 0; i < howMany; i++) {
|
||||
value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
|
||||
}
|
||||
|
||||
return value.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the `obj` parameter is defined or not.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @returns {boolean} true if the object is undefined
|
||||
* @private
|
||||
*/
|
||||
function _isUndefined(obj) {
|
||||
return typeof obj === 'undefined';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the function arguments.
|
||||
*
|
||||
* This function helps to have optional arguments.
|
||||
*
|
||||
* @param {(Options|Function)} options
|
||||
* @param {Function} callback
|
||||
* @returns {Array} parsed arguments
|
||||
* @private
|
||||
*/
|
||||
function _parseArguments(options, callback) {
|
||||
if (typeof options == 'function') {
|
||||
return [callback || {}, options];
|
||||
}
|
||||
|
||||
if (_isUndefined(options)) {
|
||||
return [{}, callback];
|
||||
}
|
||||
|
||||
return [options, callback];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a new temporary name.
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @returns {string} the new random name according to opts
|
||||
* @private
|
||||
*/
|
||||
function _generateTmpName(opts) {
|
||||
if (opts.name) {
|
||||
return path.join(opts.dir || tmpDir, opts.name);
|
||||
}
|
||||
|
||||
// mkstemps like template
|
||||
if (opts.template) {
|
||||
return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));
|
||||
}
|
||||
|
||||
// prefix and postfix
|
||||
const name = [
|
||||
opts.prefix || 'tmp-',
|
||||
process.pid,
|
||||
_randomChars(12),
|
||||
opts.postfix || ''
|
||||
].join('');
|
||||
|
||||
return path.join(opts.dir || tmpDir, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a temporary file name.
|
||||
*
|
||||
* @param {(Options|tmpNameCallback)} options options or callback
|
||||
* @param {?tmpNameCallback} callback the callback function
|
||||
*/
|
||||
function tmpName(options, callback) {
|
||||
var
|
||||
args = _parseArguments(options, callback),
|
||||
opts = args[0],
|
||||
cb = args[1],
|
||||
tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
|
||||
|
||||
if (isNaN(tries) || tries < 0)
|
||||
return cb(new Error('Invalid tries'));
|
||||
|
||||
if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
|
||||
return cb(new Error('Invalid template provided'));
|
||||
|
||||
(function _getUniqueName() {
|
||||
const name = _generateTmpName(opts);
|
||||
|
||||
// check whether the path exists then retry if needed
|
||||
fs.stat(name, function (err) {
|
||||
if (!err) {
|
||||
if (tries-- > 0) return _getUniqueName();
|
||||
|
||||
return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));
|
||||
}
|
||||
|
||||
cb(null, name);
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronous version of tmpName.
|
||||
*
|
||||
* @param {Object} options
|
||||
* @returns {string} the generated random name
|
||||
* @throws {Error} if the options are invalid or could not generate a filename
|
||||
*/
|
||||
function tmpNameSync(options) {
|
||||
var
|
||||
args = _parseArguments(options),
|
||||
opts = args[0],
|
||||
tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
|
||||
|
||||
if (isNaN(tries) || tries < 0)
|
||||
throw new Error('Invalid tries');
|
||||
|
||||
if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
|
||||
throw new Error('Invalid template provided');
|
||||
|
||||
do {
|
||||
const name = _generateTmpName(opts);
|
||||
try {
|
||||
fs.statSync(name);
|
||||
} catch (e) {
|
||||
return name;
|
||||
}
|
||||
} while (tries-- > 0);
|
||||
|
||||
throw new Error('Could not get a unique tmp filename, max tries reached');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and opens a temporary file.
|
||||
*
|
||||
* @param {(Options|fileCallback)} options the config options or the callback function
|
||||
* @param {?fileCallback} callback
|
||||
*/
|
||||
function file(options, callback) {
|
||||
var
|
||||
args = _parseArguments(options, callback),
|
||||
opts = args[0],
|
||||
cb = args[1];
|
||||
|
||||
opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;
|
||||
|
||||
// gets a temporary filename
|
||||
tmpName(opts, function _tmpNameCreated(err, name) {
|
||||
if (err) return cb(err);
|
||||
|
||||
// create and open the file
|
||||
fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {
|
||||
if (err) return cb(err);
|
||||
|
||||
if (opts.discardDescriptor) {
|
||||
return fs.close(fd, function _discardCallback(err) {
|
||||
if (err) {
|
||||
// Low probability, and the file exists, so this could be
|
||||
// ignored. If it isn't we certainly need to unlink the
|
||||
// file, and if that fails too its error is more
|
||||
// important.
|
||||
try {
|
||||
fs.unlinkSync(name);
|
||||
} catch (e) {
|
||||
if (!isENOENT(e)) {
|
||||
err = e;
|
||||
}
|
||||
}
|
||||
return cb(err);
|
||||
}
|
||||
cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));
|
||||
});
|
||||
}
|
||||
if (opts.detachDescriptor) {
|
||||
return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));
|
||||
}
|
||||
cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronous version of file.
|
||||
*
|
||||
* @param {Options} options
|
||||
* @returns {FileSyncObject} object consists of name, fd and removeCallback
|
||||
* @throws {Error} if cannot create a file
|
||||
*/
|
||||
function fileSync(options) {
|
||||
var
|
||||
args = _parseArguments(options),
|
||||
opts = args[0];
|
||||
|
||||
opts.postfix = opts.postfix || '.tmp';
|
||||
|
||||
const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
|
||||
const name = tmpNameSync(opts);
|
||||
var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
|
||||
if (opts.discardDescriptor) {
|
||||
fs.closeSync(fd);
|
||||
fd = undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
name: name,
|
||||
fd: fd,
|
||||
removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes files and folders in a directory recursively.
|
||||
*
|
||||
* @param {string} root
|
||||
* @private
|
||||
*/
|
||||
function _rmdirRecursiveSync(root) {
|
||||
const dirs = [root];
|
||||
|
||||
do {
|
||||
var
|
||||
dir = dirs.pop(),
|
||||
deferred = false,
|
||||
files = fs.readdirSync(dir);
|
||||
|
||||
for (var i = 0, length = files.length; i < length; i++) {
|
||||
var
|
||||
file = path.join(dir, files[i]),
|
||||
stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
if (!deferred) {
|
||||
deferred = true;
|
||||
dirs.push(dir);
|
||||
}
|
||||
dirs.push(file);
|
||||
} else {
|
||||
fs.unlinkSync(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (!deferred) {
|
||||
fs.rmdirSync(dir);
|
||||
}
|
||||
} while (dirs.length !== 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a temporary directory.
|
||||
*
|
||||
* @param {(Options|dirCallback)} options the options or the callback function
|
||||
* @param {?dirCallback} callback
|
||||
*/
|
||||
function dir(options, callback) {
|
||||
var
|
||||
args = _parseArguments(options, callback),
|
||||
opts = args[0],
|
||||
cb = args[1];
|
||||
|
||||
// gets a temporary filename
|
||||
tmpName(opts, function _tmpNameCreated(err, name) {
|
||||
if (err) return cb(err);
|
||||
|
||||
// create the directory
|
||||
fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {
|
||||
if (err) return cb(err);
|
||||
|
||||
cb(null, name, _prepareTmpDirRemoveCallback(name, opts));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronous version of dir.
|
||||
*
|
||||
* @param {Options} options
|
||||
* @returns {DirSyncObject} object consists of name and removeCallback
|
||||
* @throws {Error} if it cannot create a directory
|
||||
*/
|
||||
function dirSync(options) {
|
||||
var
|
||||
args = _parseArguments(options),
|
||||
opts = args[0];
|
||||
|
||||
const name = tmpNameSync(opts);
|
||||
fs.mkdirSync(name, opts.mode || DIR_MODE);
|
||||
|
||||
return {
|
||||
name: name,
|
||||
removeCallback: _prepareTmpDirRemoveCallback(name, opts)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the callback for removal of the temporary file.
|
||||
*
|
||||
* @param {string} name the path of the file
|
||||
* @param {number} fd file descriptor
|
||||
* @param {Object} opts
|
||||
* @returns {fileCallback}
|
||||
* @private
|
||||
*/
|
||||
function _prepareTmpFileRemoveCallback(name, fd, opts) {
|
||||
const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {
|
||||
try {
|
||||
if (0 <= fdPath[0]) {
|
||||
fs.closeSync(fdPath[0]);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// under some node/windows related circumstances, a temporary file
|
||||
// may have not be created as expected or the file was already closed
|
||||
// by the user, in which case we will simply ignore the error
|
||||
if (!isEBADF(e) && !isENOENT(e)) {
|
||||
// reraise any unanticipated error
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
try {
|
||||
fs.unlinkSync(fdPath[1]);
|
||||
}
|
||||
catch (e) {
|
||||
if (!isENOENT(e)) {
|
||||
// reraise any unanticipated error
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}, [fd, name]);
|
||||
|
||||
if (!opts.keep) {
|
||||
_removeObjects.unshift(removeCallback);
|
||||
}
|
||||
|
||||
return removeCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the callback for removal of the temporary directory.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Object} opts
|
||||
* @returns {Function} the callback
|
||||
* @private
|
||||
*/
|
||||
function _prepareTmpDirRemoveCallback(name, opts) {
|
||||
const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);
|
||||
const removeCallback = _prepareRemoveCallback(removeFunction, name);
|
||||
|
||||
if (!opts.keep) {
|
||||
_removeObjects.unshift(removeCallback);
|
||||
}
|
||||
|
||||
return removeCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a guarded function wrapping the removeFunction call.
|
||||
*
|
||||
* @param {Function} removeFunction
|
||||
* @param {Object} arg
|
||||
* @returns {Function}
|
||||
* @private
|
||||
*/
|
||||
function _prepareRemoveCallback(removeFunction, arg) {
|
||||
var called = false;
|
||||
|
||||
return function _cleanupCallback(next) {
|
||||
if (!called) {
|
||||
const index = _removeObjects.indexOf(_cleanupCallback);
|
||||
if (index >= 0) {
|
||||
_removeObjects.splice(index, 1);
|
||||
}
|
||||
|
||||
called = true;
|
||||
removeFunction(arg);
|
||||
}
|
||||
|
||||
if (next) next(null);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The garbage collector.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function _garbageCollector() {
|
||||
if (_uncaughtException && !_gracefulCleanup) {
|
||||
return;
|
||||
}
|
||||
|
||||
// the function being called removes itself from _removeObjects,
|
||||
// loop until _removeObjects is empty
|
||||
while (_removeObjects.length) {
|
||||
try {
|
||||
_removeObjects[0].call(null);
|
||||
} catch (e) {
|
||||
// already removed?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.
|
||||
*/
|
||||
function isEBADF(error) {
|
||||
return isExpectedError(error, -EBADF, 'EBADF');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.
|
||||
*/
|
||||
function isENOENT(error) {
|
||||
return isExpectedError(error, -ENOENT, 'ENOENT');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to determine whether the expected error code matches the actual code and errno,
|
||||
* which will differ between the supported node versions.
|
||||
*
|
||||
* - Node >= 7.0:
|
||||
* error.code {String}
|
||||
* error.errno {String|Number} any numerical value will be negated
|
||||
*
|
||||
* - Node >= 6.0 < 7.0:
|
||||
* error.code {String}
|
||||
* error.errno {Number} negated
|
||||
*
|
||||
* - Node >= 4.0 < 6.0: introduces SystemError
|
||||
* error.code {String}
|
||||
* error.errno {Number} negated
|
||||
*
|
||||
* - Node >= 0.10 < 4.0:
|
||||
* error.code {Number} negated
|
||||
* error.errno n/a
|
||||
*/
|
||||
function isExpectedError(error, code, errno) {
|
||||
return error.code == code || error.code == errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the graceful cleanup.
|
||||
*
|
||||
* Also removes the created files and directories when an uncaught exception occurs.
|
||||
*/
|
||||
function setGracefulCleanup() {
|
||||
_gracefulCleanup = true;
|
||||
}
|
||||
|
||||
const version = process.versions.node.split('.').map(function (value) {
|
||||
return parseInt(value, 10);
|
||||
});
|
||||
|
||||
if (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {
|
||||
process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {
|
||||
_uncaughtException = true;
|
||||
_garbageCollector();
|
||||
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
process.addListener('exit', function _exit(code) {
|
||||
if (code) _uncaughtException = true;
|
||||
_garbageCollector();
|
||||
});
|
||||
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @typedef {Object} Options
|
||||
* @property {?number} tries the number of tries before give up the name generation
|
||||
* @property {?string} template the "mkstemp" like filename template
|
||||
* @property {?string} name fix name
|
||||
* @property {?string} dir the tmp directory to use
|
||||
* @property {?string} prefix prefix for the generated name
|
||||
* @property {?string} postfix postfix for the generated name
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} FileSyncObject
|
||||
* @property {string} name the name of the file
|
||||
* @property {string} fd the file descriptor
|
||||
* @property {fileCallback} removeCallback the callback function to remove the file
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} DirSyncObject
|
||||
* @property {string} name the name of the directory
|
||||
* @property {fileCallback} removeCallback the callback function to remove the directory
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback tmpNameCallback
|
||||
* @param {?Error} err the error object if anything goes wrong
|
||||
* @param {string} name the temporary file name
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback fileCallback
|
||||
* @param {?Error} err the error object if anything goes wrong
|
||||
* @param {string} name the temporary file name
|
||||
* @param {number} fd the file descriptor
|
||||
* @param {cleanupCallback} fn the cleanup callback function
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback dirCallback
|
||||
* @param {?Error} err the error object if anything goes wrong
|
||||
* @param {string} name the temporary file name
|
||||
* @param {cleanupCallback} fn the cleanup callback function
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes the temporary created file or directory.
|
||||
*
|
||||
* @callback cleanupCallback
|
||||
* @param {simpleCallback} [next] function to call after entry was removed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Callback function for function composition.
|
||||
* @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57}
|
||||
*
|
||||
* @callback simpleCallback
|
||||
*/
|
||||
|
||||
// exporting all the needed methods
|
||||
module.exports.tmpdir = tmpDir;
|
||||
|
||||
module.exports.dir = dir;
|
||||
module.exports.dirSync = dirSync;
|
||||
|
||||
module.exports.file = file;
|
||||
module.exports.fileSync = fileSync;
|
||||
|
||||
module.exports.tmpName = tmpName;
|
||||
module.exports.tmpNameSync = tmpNameSync;
|
||||
|
||||
module.exports.setGracefulCleanup = setGracefulCleanup;
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "is-ci",
|
||||
"version": "3.0.1",
|
||||
"description": "Detect if the current environment is a CI server",
|
||||
"bin": "bin.js",
|
||||
"main": "index.js",
|
||||
"author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/watson/is-ci.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/watson/is-ci/issues"
|
||||
},
|
||||
"homepage": "https://github.com/watson/is-ci",
|
||||
"keywords": [
|
||||
"ci",
|
||||
"continuous",
|
||||
"integration",
|
||||
"test",
|
||||
"detect"
|
||||
],
|
||||
"coordinates": [
|
||||
55.778272,
|
||||
12.593116
|
||||
],
|
||||
"scripts": {
|
||||
"test": "standard && node test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"ci-info": "^3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"clear-module": "^4.1.1",
|
||||
"standard": "^16.0.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
const Range = require('../classes/range')
|
||||
const intersects = (r1, r2, options) => {
|
||||
r1 = new Range(r1, options)
|
||||
r2 = new Range(r2, options)
|
||||
return r1.intersects(r2)
|
||||
}
|
||||
module.exports = intersects
|
||||
@@ -0,0 +1,178 @@
|
||||
// Generated by LiveScript 1.4.0
|
||||
var Func, List, Obj, Str, Num, id, isType, replicate, prelude, toString$ = {}.toString;
|
||||
Func = require('./Func.js');
|
||||
List = require('./List.js');
|
||||
Obj = require('./Obj.js');
|
||||
Str = require('./Str.js');
|
||||
Num = require('./Num.js');
|
||||
id = function(x){
|
||||
return x;
|
||||
};
|
||||
isType = curry$(function(type, x){
|
||||
return toString$.call(x).slice(8, -1) === type;
|
||||
});
|
||||
replicate = curry$(function(n, x){
|
||||
var i$, results$ = [];
|
||||
for (i$ = 0; i$ < n; ++i$) {
|
||||
results$.push(x);
|
||||
}
|
||||
return results$;
|
||||
});
|
||||
Str.empty = List.empty;
|
||||
Str.slice = List.slice;
|
||||
Str.take = List.take;
|
||||
Str.drop = List.drop;
|
||||
Str.splitAt = List.splitAt;
|
||||
Str.takeWhile = List.takeWhile;
|
||||
Str.dropWhile = List.dropWhile;
|
||||
Str.span = List.span;
|
||||
Str.breakStr = List.breakList;
|
||||
prelude = {
|
||||
Func: Func,
|
||||
List: List,
|
||||
Obj: Obj,
|
||||
Str: Str,
|
||||
Num: Num,
|
||||
id: id,
|
||||
isType: isType,
|
||||
replicate: replicate
|
||||
};
|
||||
prelude.each = List.each;
|
||||
prelude.map = List.map;
|
||||
prelude.filter = List.filter;
|
||||
prelude.compact = List.compact;
|
||||
prelude.reject = List.reject;
|
||||
prelude.partition = List.partition;
|
||||
prelude.find = List.find;
|
||||
prelude.head = List.head;
|
||||
prelude.first = List.first;
|
||||
prelude.tail = List.tail;
|
||||
prelude.last = List.last;
|
||||
prelude.initial = List.initial;
|
||||
prelude.empty = List.empty;
|
||||
prelude.reverse = List.reverse;
|
||||
prelude.difference = List.difference;
|
||||
prelude.intersection = List.intersection;
|
||||
prelude.union = List.union;
|
||||
prelude.countBy = List.countBy;
|
||||
prelude.groupBy = List.groupBy;
|
||||
prelude.fold = List.fold;
|
||||
prelude.foldl = List.foldl;
|
||||
prelude.fold1 = List.fold1;
|
||||
prelude.foldl1 = List.foldl1;
|
||||
prelude.foldr = List.foldr;
|
||||
prelude.foldr1 = List.foldr1;
|
||||
prelude.unfoldr = List.unfoldr;
|
||||
prelude.andList = List.andList;
|
||||
prelude.orList = List.orList;
|
||||
prelude.any = List.any;
|
||||
prelude.all = List.all;
|
||||
prelude.unique = List.unique;
|
||||
prelude.uniqueBy = List.uniqueBy;
|
||||
prelude.sort = List.sort;
|
||||
prelude.sortWith = List.sortWith;
|
||||
prelude.sortBy = List.sortBy;
|
||||
prelude.sum = List.sum;
|
||||
prelude.product = List.product;
|
||||
prelude.mean = List.mean;
|
||||
prelude.average = List.average;
|
||||
prelude.concat = List.concat;
|
||||
prelude.concatMap = List.concatMap;
|
||||
prelude.flatten = List.flatten;
|
||||
prelude.maximum = List.maximum;
|
||||
prelude.minimum = List.minimum;
|
||||
prelude.maximumBy = List.maximumBy;
|
||||
prelude.minimumBy = List.minimumBy;
|
||||
prelude.scan = List.scan;
|
||||
prelude.scanl = List.scanl;
|
||||
prelude.scan1 = List.scan1;
|
||||
prelude.scanl1 = List.scanl1;
|
||||
prelude.scanr = List.scanr;
|
||||
prelude.scanr1 = List.scanr1;
|
||||
prelude.slice = List.slice;
|
||||
prelude.take = List.take;
|
||||
prelude.drop = List.drop;
|
||||
prelude.splitAt = List.splitAt;
|
||||
prelude.takeWhile = List.takeWhile;
|
||||
prelude.dropWhile = List.dropWhile;
|
||||
prelude.span = List.span;
|
||||
prelude.breakList = List.breakList;
|
||||
prelude.zip = List.zip;
|
||||
prelude.zipWith = List.zipWith;
|
||||
prelude.zipAll = List.zipAll;
|
||||
prelude.zipAllWith = List.zipAllWith;
|
||||
prelude.at = List.at;
|
||||
prelude.elemIndex = List.elemIndex;
|
||||
prelude.elemIndices = List.elemIndices;
|
||||
prelude.findIndex = List.findIndex;
|
||||
prelude.findIndices = List.findIndices;
|
||||
prelude.apply = Func.apply;
|
||||
prelude.curry = Func.curry;
|
||||
prelude.flip = Func.flip;
|
||||
prelude.fix = Func.fix;
|
||||
prelude.over = Func.over;
|
||||
prelude.split = Str.split;
|
||||
prelude.join = Str.join;
|
||||
prelude.lines = Str.lines;
|
||||
prelude.unlines = Str.unlines;
|
||||
prelude.words = Str.words;
|
||||
prelude.unwords = Str.unwords;
|
||||
prelude.chars = Str.chars;
|
||||
prelude.unchars = Str.unchars;
|
||||
prelude.repeat = Str.repeat;
|
||||
prelude.capitalize = Str.capitalize;
|
||||
prelude.camelize = Str.camelize;
|
||||
prelude.dasherize = Str.dasherize;
|
||||
prelude.values = Obj.values;
|
||||
prelude.keys = Obj.keys;
|
||||
prelude.pairsToObj = Obj.pairsToObj;
|
||||
prelude.objToPairs = Obj.objToPairs;
|
||||
prelude.listsToObj = Obj.listsToObj;
|
||||
prelude.objToLists = Obj.objToLists;
|
||||
prelude.max = Num.max;
|
||||
prelude.min = Num.min;
|
||||
prelude.negate = Num.negate;
|
||||
prelude.abs = Num.abs;
|
||||
prelude.signum = Num.signum;
|
||||
prelude.quot = Num.quot;
|
||||
prelude.rem = Num.rem;
|
||||
prelude.div = Num.div;
|
||||
prelude.mod = Num.mod;
|
||||
prelude.recip = Num.recip;
|
||||
prelude.pi = Num.pi;
|
||||
prelude.tau = Num.tau;
|
||||
prelude.exp = Num.exp;
|
||||
prelude.sqrt = Num.sqrt;
|
||||
prelude.ln = Num.ln;
|
||||
prelude.pow = Num.pow;
|
||||
prelude.sin = Num.sin;
|
||||
prelude.tan = Num.tan;
|
||||
prelude.cos = Num.cos;
|
||||
prelude.acos = Num.acos;
|
||||
prelude.asin = Num.asin;
|
||||
prelude.atan = Num.atan;
|
||||
prelude.atan2 = Num.atan2;
|
||||
prelude.truncate = Num.truncate;
|
||||
prelude.round = Num.round;
|
||||
prelude.ceiling = Num.ceiling;
|
||||
prelude.floor = Num.floor;
|
||||
prelude.isItNaN = Num.isItNaN;
|
||||
prelude.even = Num.even;
|
||||
prelude.odd = Num.odd;
|
||||
prelude.gcd = Num.gcd;
|
||||
prelude.lcm = Num.lcm;
|
||||
prelude.VERSION = '1.1.2';
|
||||
module.exports = prelude;
|
||||
function curry$(f, bound){
|
||||
var context,
|
||||
_curry = function(args) {
|
||||
return f.length > 1 ? function(){
|
||||
var params = args ? args.concat() : [];
|
||||
context = bound ? context || this : this;
|
||||
return params.push.apply(params, arguments) <
|
||||
f.length && arguments.length ?
|
||||
_curry.call(context, params) : f.apply(context, params);
|
||||
} : f;
|
||||
};
|
||||
return _curry();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var NumberBitwiseOp = require('../NumberBitwiseOp');
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND
|
||||
|
||||
module.exports = function NumberBitwiseAND(x, y) {
|
||||
if (Type(x) !== 'Number' || Type(y) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
|
||||
}
|
||||
return NumberBitwiseOp('&', x, y);
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
var baseEach = require('./_baseEach'),
|
||||
isArrayLike = require('./isArrayLike');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.map` without support for iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns the new mapped array.
|
||||
*/
|
||||
function baseMap(collection, iteratee) {
|
||||
var index = -1,
|
||||
result = isArrayLike(collection) ? Array(collection.length) : [];
|
||||
|
||||
baseEach(collection, function(value, key, collection) {
|
||||
result[++index] = iteratee(value, key, collection);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseMap;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('clone', require('../clone'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),"");
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SetNumberFormatDigitOptions.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/NumberFormat/SetNumberFormatDigitOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,iBAAiB,CAAA;AAIxB;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,8BAA8B,EAC7C,IAAI,EAAE,wBAAwB,EAC9B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,oBAAoB,QA4B/B"}
|
||||
@@ -0,0 +1,6 @@
|
||||
function level0Optimize(tokens) {
|
||||
// noop as level 0 means no optimizations!
|
||||
return tokens;
|
||||
}
|
||||
|
||||
module.exports = level0Optimize;
|
||||
@@ -0,0 +1,172 @@
|
||||
"use strict"
|
||||
|
||||
// external tooling
|
||||
const valueParser = require("postcss-value-parser")
|
||||
|
||||
// extended tooling
|
||||
const { stringify } = valueParser
|
||||
|
||||
function split(params, start) {
|
||||
const list = []
|
||||
const last = params.reduce((item, node, index) => {
|
||||
if (index < start) return ""
|
||||
if (node.type === "div" && node.value === ",") {
|
||||
list.push(item)
|
||||
return ""
|
||||
}
|
||||
return item + stringify(node)
|
||||
}, "")
|
||||
list.push(last)
|
||||
return list
|
||||
}
|
||||
|
||||
module.exports = function (result, styles) {
|
||||
const statements = []
|
||||
let nodes = []
|
||||
|
||||
styles.each(node => {
|
||||
let stmt
|
||||
if (node.type === "atrule") {
|
||||
if (node.name === "import") stmt = parseImport(result, node)
|
||||
else if (node.name === "media") stmt = parseMedia(result, node)
|
||||
else if (node.name === "charset") stmt = parseCharset(result, node)
|
||||
}
|
||||
|
||||
if (stmt) {
|
||||
if (nodes.length) {
|
||||
statements.push({
|
||||
type: "nodes",
|
||||
nodes,
|
||||
media: [],
|
||||
layer: [],
|
||||
})
|
||||
nodes = []
|
||||
}
|
||||
statements.push(stmt)
|
||||
} else nodes.push(node)
|
||||
})
|
||||
|
||||
if (nodes.length) {
|
||||
statements.push({
|
||||
type: "nodes",
|
||||
nodes,
|
||||
media: [],
|
||||
layer: [],
|
||||
})
|
||||
}
|
||||
|
||||
return statements
|
||||
}
|
||||
|
||||
function parseMedia(result, atRule) {
|
||||
const params = valueParser(atRule.params).nodes
|
||||
return {
|
||||
type: "media",
|
||||
node: atRule,
|
||||
media: split(params, 0),
|
||||
layer: [],
|
||||
}
|
||||
}
|
||||
|
||||
function parseCharset(result, atRule) {
|
||||
if (atRule.prev()) {
|
||||
return result.warn("@charset must precede all other statements", {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
return {
|
||||
type: "charset",
|
||||
node: atRule,
|
||||
media: [],
|
||||
layer: [],
|
||||
}
|
||||
}
|
||||
|
||||
function parseImport(result, atRule) {
|
||||
let prev = atRule.prev()
|
||||
if (prev) {
|
||||
do {
|
||||
if (
|
||||
prev.type !== "comment" &&
|
||||
(prev.type !== "atrule" ||
|
||||
(prev.name !== "import" &&
|
||||
prev.name !== "charset" &&
|
||||
!(prev.name === "layer" && !prev.nodes)))
|
||||
) {
|
||||
return result.warn(
|
||||
"@import must precede all other statements (besides @charset or empty @layer)",
|
||||
{ node: atRule }
|
||||
)
|
||||
}
|
||||
prev = prev.prev()
|
||||
} while (prev)
|
||||
}
|
||||
|
||||
if (atRule.nodes) {
|
||||
return result.warn(
|
||||
"It looks like you didn't end your @import statement correctly. " +
|
||||
"Child nodes are attached to it.",
|
||||
{ node: atRule }
|
||||
)
|
||||
}
|
||||
|
||||
const params = valueParser(atRule.params).nodes
|
||||
const stmt = {
|
||||
type: "import",
|
||||
node: atRule,
|
||||
media: [],
|
||||
layer: [],
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
if (
|
||||
!params.length ||
|
||||
(
|
||||
params[0].type !== "string" ||
|
||||
!params[0].value
|
||||
) &&
|
||||
(
|
||||
params[0].type !== "function" ||
|
||||
params[0].value !== "url" ||
|
||||
!params[0].nodes.length ||
|
||||
!params[0].nodes[0].value
|
||||
)
|
||||
) {
|
||||
return result.warn(`Unable to find uri in '${ atRule.toString() }'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
if (params[0].type === "string") stmt.uri = params[0].value
|
||||
else stmt.uri = params[0].nodes[0].value
|
||||
stmt.fullUri = stringify(params[0])
|
||||
|
||||
let remainder = params
|
||||
if (remainder.length > 2) {
|
||||
if (
|
||||
(remainder[2].type === "word" || remainder[2].type === "function") &&
|
||||
remainder[2].value === "layer"
|
||||
) {
|
||||
if (remainder[1].type !== "space") {
|
||||
return result.warn("Invalid import layer statement", { node: atRule })
|
||||
}
|
||||
|
||||
if (remainder[2].nodes) {
|
||||
stmt.layer = [stringify(remainder[2].nodes)]
|
||||
} else {
|
||||
stmt.layer = [""]
|
||||
}
|
||||
remainder = remainder.slice(2)
|
||||
}
|
||||
}
|
||||
|
||||
if (remainder.length > 2) {
|
||||
if (remainder[1].type !== "space") {
|
||||
return result.warn("Invalid import media statement", { node: atRule })
|
||||
}
|
||||
|
||||
stmt.media = split(remainder, 2)
|
||||
}
|
||||
|
||||
return stmt
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,539 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
// A simple implementation of make-array
|
||||
function makeArray(subject) {
|
||||
return Array.isArray(subject) ? subject : [subject];
|
||||
}
|
||||
var EMPTY = '';
|
||||
var SPACE = ' ';
|
||||
var ESCAPE = '\\';
|
||||
var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
||||
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
||||
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
||||
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
||||
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
||||
// /foo,
|
||||
// ./foo,
|
||||
// ../foo,
|
||||
// .
|
||||
// ..
|
||||
var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
|
||||
var SLASH = '/';
|
||||
|
||||
// Do not use ternary expression here, since "istanbul ignore next" is buggy
|
||||
var TMP_KEY_IGNORE = 'node-ignore';
|
||||
/* istanbul ignore else */
|
||||
if (typeof Symbol !== 'undefined') {
|
||||
TMP_KEY_IGNORE = Symbol["for"]('node-ignore');
|
||||
}
|
||||
var KEY_IGNORE = TMP_KEY_IGNORE;
|
||||
var define = function define(object, key, value) {
|
||||
return Object.defineProperty(object, key, {
|
||||
value: value
|
||||
});
|
||||
};
|
||||
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
||||
var RETURN_FALSE = function RETURN_FALSE() {
|
||||
return false;
|
||||
};
|
||||
|
||||
// Sanitize the range of a regular expression
|
||||
// The cases are complicated, see test cases for details
|
||||
var sanitizeRange = function sanitizeRange(range) {
|
||||
return range.replace(REGEX_REGEXP_RANGE, function (match, from, to) {
|
||||
return from.charCodeAt(0) <= to.charCodeAt(0) ? match
|
||||
// Invalid range (out of order) which is ok for gitignore rules but
|
||||
// fatal for JavaScript regular expression, so eliminate it.
|
||||
: EMPTY;
|
||||
});
|
||||
};
|
||||
|
||||
// See fixtures #59
|
||||
var cleanRangeBackSlash = function cleanRangeBackSlash(slashes) {
|
||||
var length = slashes.length;
|
||||
return slashes.slice(0, length - length % 2);
|
||||
};
|
||||
|
||||
// > If the pattern ends with a slash,
|
||||
// > it is removed for the purpose of the following description,
|
||||
// > but it would only find a match with a directory.
|
||||
// > In other words, foo/ will match a directory foo and paths underneath it,
|
||||
// > but will not match a regular file or a symbolic link foo
|
||||
// > (this is consistent with the way how pathspec works in general in Git).
|
||||
// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
|
||||
// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
|
||||
// you could use option `mark: true` with `glob`
|
||||
|
||||
// '`foo/`' should not continue with the '`..`'
|
||||
var REPLACERS = [
|
||||
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
||||
[
|
||||
// (a\ ) -> (a )
|
||||
// (a ) -> (a)
|
||||
// (a \ ) -> (a )
|
||||
/\\?\s+$/, function (match) {
|
||||
return match.indexOf('\\') === 0 ? SPACE : EMPTY;
|
||||
}],
|
||||
// replace (\ ) with ' '
|
||||
[/\\\s/g, function () {
|
||||
return SPACE;
|
||||
}],
|
||||
// Escape metacharacters
|
||||
// which is written down by users but means special for regular expressions.
|
||||
|
||||
// > There are 12 characters with special meanings:
|
||||
// > - the backslash \,
|
||||
// > - the caret ^,
|
||||
// > - the dollar sign $,
|
||||
// > - the period or dot .,
|
||||
// > - the vertical bar or pipe symbol |,
|
||||
// > - the question mark ?,
|
||||
// > - the asterisk or star *,
|
||||
// > - the plus sign +,
|
||||
// > - the opening parenthesis (,
|
||||
// > - the closing parenthesis ),
|
||||
// > - and the opening square bracket [,
|
||||
// > - the opening curly brace {,
|
||||
// > These special characters are often called "metacharacters".
|
||||
[/[\\$.|*+(){^]/g, function (match) {
|
||||
return "\\".concat(match);
|
||||
}], [
|
||||
// > a question mark (?) matches a single character
|
||||
/(?!\\)\?/g, function () {
|
||||
return '[^/]';
|
||||
}],
|
||||
// leading slash
|
||||
[
|
||||
// > A leading slash matches the beginning of the pathname.
|
||||
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
||||
// A leading slash matches the beginning of the pathname
|
||||
/^\//, function () {
|
||||
return '^';
|
||||
}],
|
||||
// replace special metacharacter slash after the leading slash
|
||||
[/\//g, function () {
|
||||
return '\\/';
|
||||
}], [
|
||||
// > A leading "**" followed by a slash means match in all directories.
|
||||
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
||||
// > the same as pattern "foo".
|
||||
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
||||
// > under directory "foo".
|
||||
// Notice that the '*'s have been replaced as '\\*'
|
||||
/^\^*\\\*\\\*\\\//,
|
||||
// '**/foo' <-> 'foo'
|
||||
function () {
|
||||
return '^(?:.*\\/)?';
|
||||
}],
|
||||
// starting
|
||||
[
|
||||
// there will be no leading '/'
|
||||
// (which has been replaced by section "leading slash")
|
||||
// If starts with '**', adding a '^' to the regular expression also works
|
||||
/^(?=[^^])/, function startingReplacer() {
|
||||
// If has a slash `/` at the beginning or middle
|
||||
return !/\/(?!$)/.test(this)
|
||||
// > Prior to 2.22.1
|
||||
// > If the pattern does not contain a slash /,
|
||||
// > Git treats it as a shell glob pattern
|
||||
// Actually, if there is only a trailing slash,
|
||||
// git also treats it as a shell glob pattern
|
||||
|
||||
// After 2.22.1 (compatible but clearer)
|
||||
// > If there is a separator at the beginning or middle (or both)
|
||||
// > of the pattern, then the pattern is relative to the directory
|
||||
// > level of the particular .gitignore file itself.
|
||||
// > Otherwise the pattern may also match at any level below
|
||||
// > the .gitignore level.
|
||||
? '(?:^|\\/)'
|
||||
|
||||
// > Otherwise, Git treats the pattern as a shell glob suitable for
|
||||
// > consumption by fnmatch(3)
|
||||
: '^';
|
||||
}],
|
||||
// two globstars
|
||||
[
|
||||
// Use lookahead assertions so that we could match more than one `'/**'`
|
||||
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
||||
// Zero, one or several directories
|
||||
// should not use '*', or it will be replaced by the next replacer
|
||||
|
||||
// Check if it is not the last `'/**'`
|
||||
function (_, index, str) {
|
||||
return index + 6 < str.length
|
||||
|
||||
// case: /**/
|
||||
// > A slash followed by two consecutive asterisks then a slash matches
|
||||
// > zero or more directories.
|
||||
// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
|
||||
// '/**/'
|
||||
? '(?:\\/[^\\/]+)*'
|
||||
|
||||
// case: /**
|
||||
// > A trailing `"/**"` matches everything inside.
|
||||
|
||||
// #21: everything inside but it should not include the current folder
|
||||
: '\\/.+';
|
||||
}],
|
||||
// normal intermediate wildcards
|
||||
[
|
||||
// Never replace escaped '*'
|
||||
// ignore rule '\*' will match the path '*'
|
||||
|
||||
// 'abc.*/' -> go
|
||||
// 'abc.*' -> skip this rule,
|
||||
// coz trailing single wildcard will be handed by [trailing wildcard]
|
||||
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
||||
// '*.js' matches '.js'
|
||||
// '*.js' doesn't match 'abc'
|
||||
function (_, p1, p2) {
|
||||
// 1.
|
||||
// > An asterisk "*" matches anything except a slash.
|
||||
// 2.
|
||||
// > Other consecutive asterisks are considered regular asterisks
|
||||
// > and will match according to the previous rules.
|
||||
var unescaped = p2.replace(/\\\*/g, '[^\\/]*');
|
||||
return p1 + unescaped;
|
||||
}], [
|
||||
// unescape, revert step 3 except for back slash
|
||||
// For example, if a user escape a '\\*',
|
||||
// after step 3, the result will be '\\\\\\*'
|
||||
/\\\\\\(?=[$.|*+(){^])/g, function () {
|
||||
return ESCAPE;
|
||||
}], [
|
||||
// '\\\\' -> '\\'
|
||||
/\\\\/g, function () {
|
||||
return ESCAPE;
|
||||
}], [
|
||||
// > The range notation, e.g. [a-zA-Z],
|
||||
// > can be used to match one of the characters in a range.
|
||||
|
||||
// `\` is escaped by step 3
|
||||
/(\\)?\[([^\]/]*?)(\\*)($|\])/g, function (match, leadEscape, range, endEscape, close) {
|
||||
return leadEscape === ESCAPE
|
||||
// '\\[bar]' -> '\\\\[bar\\]'
|
||||
? "\\[".concat(range).concat(cleanRangeBackSlash(endEscape)).concat(close) : close === ']' ? endEscape.length % 2 === 0
|
||||
// A normal case, and it is a range notation
|
||||
// '[bar]'
|
||||
// '[bar\\\\]'
|
||||
? "[".concat(sanitizeRange(range)).concat(endEscape, "]") // Invalid range notaton
|
||||
// '[bar\\]' -> '[bar\\\\]'
|
||||
: '[]' : '[]';
|
||||
}],
|
||||
// ending
|
||||
[
|
||||
// 'js' will not match 'js.'
|
||||
// 'ab' will not match 'abc'
|
||||
/(?:[^*])$/,
|
||||
// WTF!
|
||||
// https://git-scm.com/docs/gitignore
|
||||
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
||||
// which re-fixes #24, #38
|
||||
|
||||
// > If there is a separator at the end of the pattern then the pattern
|
||||
// > will only match directories, otherwise the pattern can match both
|
||||
// > files and directories.
|
||||
|
||||
// 'js*' will not match 'a.js'
|
||||
// 'js/' will not match 'a.js'
|
||||
// 'js' will match 'a.js' and 'a.js/'
|
||||
function (match) {
|
||||
return /\/$/.test(match)
|
||||
// foo/ will not match 'foo'
|
||||
? "".concat(match, "$") // foo matches 'foo' and 'foo/'
|
||||
: "".concat(match, "(?=$|\\/$)");
|
||||
}],
|
||||
// trailing wildcard
|
||||
[/(\^|\\\/)?\\\*$/, function (_, p1) {
|
||||
var prefix = p1
|
||||
// '\^':
|
||||
// '/*' does not match EMPTY
|
||||
// '/*' does not match everything
|
||||
|
||||
// '\\\/':
|
||||
// 'abc/*' does not match 'abc/'
|
||||
? "".concat(p1, "[^/]+") // 'a*' matches 'a'
|
||||
// 'a*' matches 'aa'
|
||||
: '[^/]*';
|
||||
return "".concat(prefix, "(?=$|\\/$)");
|
||||
}]];
|
||||
|
||||
// A simple cache, because an ignore rule only has only one certain meaning
|
||||
var regexCache = Object.create(null);
|
||||
|
||||
// @param {pattern}
|
||||
var makeRegex = function makeRegex(pattern, ignoreCase) {
|
||||
var source = regexCache[pattern];
|
||||
if (!source) {
|
||||
source = REPLACERS.reduce(function (prev, current) {
|
||||
return prev.replace(current[0], current[1].bind(pattern));
|
||||
}, pattern);
|
||||
regexCache[pattern] = source;
|
||||
}
|
||||
return ignoreCase ? new RegExp(source, 'i') : new RegExp(source);
|
||||
};
|
||||
var isString = function isString(subject) {
|
||||
return typeof subject === 'string';
|
||||
};
|
||||
|
||||
// > A blank line matches no files, so it can serve as a separator for readability.
|
||||
var checkPattern = function checkPattern(pattern) {
|
||||
return pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)
|
||||
|
||||
// > A line starting with # serves as a comment.
|
||||
&& pattern.indexOf('#') !== 0;
|
||||
};
|
||||
var splitPattern = function splitPattern(pattern) {
|
||||
return pattern.split(REGEX_SPLITALL_CRLF);
|
||||
};
|
||||
var IgnoreRule = /*#__PURE__*/_createClass(function IgnoreRule(origin, pattern, negative, regex) {
|
||||
_classCallCheck(this, IgnoreRule);
|
||||
this.origin = origin;
|
||||
this.pattern = pattern;
|
||||
this.negative = negative;
|
||||
this.regex = regex;
|
||||
});
|
||||
var createRule = function createRule(pattern, ignoreCase) {
|
||||
var origin = pattern;
|
||||
var negative = false;
|
||||
|
||||
// > An optional prefix "!" which negates the pattern;
|
||||
if (pattern.indexOf('!') === 0) {
|
||||
negative = true;
|
||||
pattern = pattern.substr(1);
|
||||
}
|
||||
pattern = pattern
|
||||
// > Put a backslash ("\") in front of the first "!" for patterns that
|
||||
// > begin with a literal "!", for example, `"\!important!.txt"`.
|
||||
.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
|
||||
// > Put a backslash ("\") in front of the first hash for patterns that
|
||||
// > begin with a hash.
|
||||
.replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#');
|
||||
var regex = makeRegex(pattern, ignoreCase);
|
||||
return new IgnoreRule(origin, pattern, negative, regex);
|
||||
};
|
||||
var throwError = function throwError(message, Ctor) {
|
||||
throw new Ctor(message);
|
||||
};
|
||||
var checkPath = function checkPath(path, originalPath, doThrow) {
|
||||
if (!isString(path)) {
|
||||
return doThrow("path must be a string, but got `".concat(originalPath, "`"), TypeError);
|
||||
}
|
||||
|
||||
// We don't know if we should ignore EMPTY, so throw
|
||||
if (!path) {
|
||||
return doThrow("path must not be empty", TypeError);
|
||||
}
|
||||
|
||||
// Check if it is a relative path
|
||||
if (checkPath.isNotRelative(path)) {
|
||||
var r = '`path.relative()`d';
|
||||
return doThrow("path should be a ".concat(r, " string, but got \"").concat(originalPath, "\""), RangeError);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var isNotRelative = function isNotRelative(path) {
|
||||
return REGEX_TEST_INVALID_PATH.test(path);
|
||||
};
|
||||
checkPath.isNotRelative = isNotRelative;
|
||||
checkPath.convert = function (p) {
|
||||
return p;
|
||||
};
|
||||
var Ignore = /*#__PURE__*/function () {
|
||||
function Ignore() {
|
||||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
_ref$ignorecase = _ref.ignorecase,
|
||||
ignorecase = _ref$ignorecase === void 0 ? true : _ref$ignorecase,
|
||||
_ref$ignoreCase = _ref.ignoreCase,
|
||||
ignoreCase = _ref$ignoreCase === void 0 ? ignorecase : _ref$ignoreCase,
|
||||
_ref$allowRelativePat = _ref.allowRelativePaths,
|
||||
allowRelativePaths = _ref$allowRelativePat === void 0 ? false : _ref$allowRelativePat;
|
||||
_classCallCheck(this, Ignore);
|
||||
define(this, KEY_IGNORE, true);
|
||||
this._rules = [];
|
||||
this._ignoreCase = ignoreCase;
|
||||
this._allowRelativePaths = allowRelativePaths;
|
||||
this._initCache();
|
||||
}
|
||||
_createClass(Ignore, [{
|
||||
key: "_initCache",
|
||||
value: function _initCache() {
|
||||
this._ignoreCache = Object.create(null);
|
||||
this._testCache = Object.create(null);
|
||||
}
|
||||
}, {
|
||||
key: "_addPattern",
|
||||
value: function _addPattern(pattern) {
|
||||
// #32
|
||||
if (pattern && pattern[KEY_IGNORE]) {
|
||||
this._rules = this._rules.concat(pattern._rules);
|
||||
this._added = true;
|
||||
return;
|
||||
}
|
||||
if (checkPattern(pattern)) {
|
||||
var rule = createRule(pattern, this._ignoreCase);
|
||||
this._added = true;
|
||||
this._rules.push(rule);
|
||||
}
|
||||
}
|
||||
|
||||
// @param {Array<string> | string | Ignore} pattern
|
||||
}, {
|
||||
key: "add",
|
||||
value: function add(pattern) {
|
||||
this._added = false;
|
||||
makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
|
||||
|
||||
// Some rules have just added to the ignore,
|
||||
// making the behavior changed.
|
||||
if (this._added) {
|
||||
this._initCache();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// legacy
|
||||
}, {
|
||||
key: "addPattern",
|
||||
value: function addPattern(pattern) {
|
||||
return this.add(pattern);
|
||||
}
|
||||
|
||||
// | ignored : unignored
|
||||
// negative | 0:0 | 0:1 | 1:0 | 1:1
|
||||
// -------- | ------- | ------- | ------- | --------
|
||||
// 0 | TEST | TEST | SKIP | X
|
||||
// 1 | TESTIF | SKIP | TEST | X
|
||||
|
||||
// - SKIP: always skip
|
||||
// - TEST: always test
|
||||
// - TESTIF: only test if checkUnignored
|
||||
// - X: that never happen
|
||||
|
||||
// @param {boolean} whether should check if the path is unignored,
|
||||
// setting `checkUnignored` to `false` could reduce additional
|
||||
// path matching.
|
||||
|
||||
// @returns {TestResult} true if a file is ignored
|
||||
}, {
|
||||
key: "_testOne",
|
||||
value: function _testOne(path, checkUnignored) {
|
||||
var ignored = false;
|
||||
var unignored = false;
|
||||
this._rules.forEach(function (rule) {
|
||||
var negative = rule.negative;
|
||||
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
||||
return;
|
||||
}
|
||||
var matched = rule.regex.test(path);
|
||||
if (matched) {
|
||||
ignored = !negative;
|
||||
unignored = negative;
|
||||
}
|
||||
});
|
||||
return {
|
||||
ignored: ignored,
|
||||
unignored: unignored
|
||||
};
|
||||
}
|
||||
|
||||
// @returns {TestResult}
|
||||
}, {
|
||||
key: "_test",
|
||||
value: function _test(originalPath, cache, checkUnignored, slices) {
|
||||
var path = originalPath
|
||||
// Supports nullable path
|
||||
&& checkPath.convert(originalPath);
|
||||
checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
||||
return this._t(path, cache, checkUnignored, slices);
|
||||
}
|
||||
}, {
|
||||
key: "_t",
|
||||
value: function _t(path, cache, checkUnignored, slices) {
|
||||
if (path in cache) {
|
||||
return cache[path];
|
||||
}
|
||||
if (!slices) {
|
||||
// path/to/a.js
|
||||
// ['path', 'to', 'a.js']
|
||||
slices = path.split(SLASH);
|
||||
}
|
||||
slices.pop();
|
||||
|
||||
// If the path has no parent directory, just test it
|
||||
if (!slices.length) {
|
||||
return cache[path] = this._testOne(path, checkUnignored);
|
||||
}
|
||||
var parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
||||
|
||||
// If the path contains a parent directory, check the parent first
|
||||
return cache[path] = parent.ignored
|
||||
// > It is not possible to re-include a file if a parent directory of
|
||||
// > that file is excluded.
|
||||
? parent : this._testOne(path, checkUnignored);
|
||||
}
|
||||
}, {
|
||||
key: "ignores",
|
||||
value: function ignores(path) {
|
||||
return this._test(path, this._ignoreCache, false).ignored;
|
||||
}
|
||||
}, {
|
||||
key: "createFilter",
|
||||
value: function createFilter() {
|
||||
var _this = this;
|
||||
return function (path) {
|
||||
return !_this.ignores(path);
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "filter",
|
||||
value: function filter(paths) {
|
||||
return makeArray(paths).filter(this.createFilter());
|
||||
}
|
||||
|
||||
// @returns {TestResult}
|
||||
}, {
|
||||
key: "test",
|
||||
value: function test(path) {
|
||||
return this._test(path, this._testCache, true);
|
||||
}
|
||||
}]);
|
||||
return Ignore;
|
||||
}();
|
||||
var factory = function factory(options) {
|
||||
return new Ignore(options);
|
||||
};
|
||||
var isPathValid = function isPathValid(path) {
|
||||
return checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
|
||||
};
|
||||
factory.isPathValid = isPathValid;
|
||||
|
||||
// Fixes typescript
|
||||
factory["default"] = factory;
|
||||
module.exports = factory;
|
||||
|
||||
// Windows
|
||||
// --------------------------------------------------------------
|
||||
/* istanbul ignore if */
|
||||
if (
|
||||
// Detect `process` so that it can run in browsers.
|
||||
typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) {
|
||||
/* eslint no-control-regex: "off" */
|
||||
var makePosix = function makePosix(str) {
|
||||
return /^\\\\\?\\/.test(str) || /[\0-\x1F"<>\|]+/.test(str) ? str : str.replace(/\\/g, '/');
|
||||
};
|
||||
checkPath.convert = makePosix;
|
||||
|
||||
// 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
|
||||
// 'd:\\foo'
|
||||
var REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
||||
checkPath.isNotRelative = function (path) {
|
||||
return REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { CreateDistanceDonation } from '../models/CreateDistanceDonation';
|
||||
import type { CreateFixedDonation } from '../models/CreateFixedDonation';
|
||||
import type { ResponseDistanceDonation } from '../models/ResponseDistanceDonation';
|
||||
import type { ResponseDonation } from '../models/ResponseDonation';
|
||||
import type { ResponseEmpty } from '../models/ResponseEmpty';
|
||||
import type { UpdateDistanceDonation } from '../models/UpdateDistanceDonation';
|
||||
import type { UpdateFixedDonation } from '../models/UpdateFixedDonation';
|
||||
export declare class DonationService {
|
||||
/**
|
||||
* Get all
|
||||
* Lists all donations (fixed or distance based) from all donors. <br> This includes the donations's runner's distance ran(if distance donation).
|
||||
* @result any
|
||||
* @throws ApiError
|
||||
*/
|
||||
static donationControllerGetAll(): Promise<(Array<ResponseDonation> | Array<ResponseDistanceDonation>)>;
|
||||
/**
|
||||
* Get one
|
||||
* Lists all information about the donation whose id got provided. This includes the donation's runner's distance ran (if distance donation).
|
||||
* @param id
|
||||
* @result any
|
||||
* @throws ApiError
|
||||
*/
|
||||
static donationControllerGetOne(id: number): Promise<(ResponseDonation | ResponseDistanceDonation)>;
|
||||
/**
|
||||
* Remove
|
||||
* Delete the donation whose id you provided. <br> If no donation with this id exists it will just return 204(no content).
|
||||
* @param id
|
||||
* @param force
|
||||
* @result any
|
||||
* @result ResponseEmpty
|
||||
* @throws ApiError
|
||||
*/
|
||||
static donationControllerRemove(id: number, force?: boolean): Promise<(ResponseDonation | ResponseDistanceDonation) | ResponseEmpty>;
|
||||
/**
|
||||
* Post fixed
|
||||
* Create a fixed donation (not distance donation - use /donations/distance instead). <br> Please rmemember to provide the donation's donors's id and amount.
|
||||
* @param requestBody CreateFixedDonation
|
||||
* @result ResponseDonation
|
||||
* @throws ApiError
|
||||
*/
|
||||
static donationControllerPostFixed(requestBody?: CreateFixedDonation): Promise<ResponseDonation>;
|
||||
/**
|
||||
* Post distance
|
||||
* Create a distance donation (not fixed donation - use /donations/fixed instead). <br> Please rmemember to provide the donation's donors's and runners ids and amount per distance (kilometer).
|
||||
* @param requestBody CreateDistanceDonation
|
||||
* @result ResponseDistanceDonation
|
||||
* @throws ApiError
|
||||
*/
|
||||
static donationControllerPostDistance(requestBody?: CreateDistanceDonation): Promise<ResponseDistanceDonation>;
|
||||
/**
|
||||
* Put fixed
|
||||
* Update the fixed donation (not distance donation - use /donations/distance instead) whose id you provided. <br> Please remember that ids can't be changed and amounts must be positive.
|
||||
* @param id
|
||||
* @param requestBody UpdateFixedDonation
|
||||
* @result ResponseDonation
|
||||
* @throws ApiError
|
||||
*/
|
||||
static donationControllerPutFixed(id: number, requestBody?: UpdateFixedDonation): Promise<ResponseDonation>;
|
||||
/**
|
||||
* Put distance
|
||||
* Update the distance donation (not fixed donation - use /donations/fixed instead) whose id you provided. <br> Please remember that ids can't be changed and amountPerDistance must be positive.
|
||||
* @param id
|
||||
* @param requestBody UpdateDistanceDonation
|
||||
* @result ResponseDonation
|
||||
* @throws ApiError
|
||||
*/
|
||||
static donationControllerPutDistance(id: number, requestBody?: UpdateDistanceDonation): Promise<ResponseDonation>;
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var ToRawFixed_1 = require("./ToRawFixed");
|
||||
var digit_mapping_generated_1 = require("./digit-mapping.generated");
|
||||
var regex_generated_1 = require("../regex.generated");
|
||||
// This is from: unicode-12.1.0/General_Category/Symbol/regex.js
|
||||
// IE11 does not support unicode flag, otherwise this is just /\p{S}/u.
|
||||
// /^\p{S}/u
|
||||
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(regex_generated_1.S_UNICODE_REGEX.source));
|
||||
// /\p{S}$/u
|
||||
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(regex_generated_1.S_UNICODE_REGEX.source, "$"));
|
||||
var CLDR_NUMBER_PATTERN = /[#0](?:[\.,][#0]+)*/g;
|
||||
function formatToParts(numberResult, data, pl, options) {
|
||||
var sign = numberResult.sign, exponent = numberResult.exponent, magnitude = numberResult.magnitude;
|
||||
var notation = options.notation, style = options.style, numberingSystem = options.numberingSystem;
|
||||
var defaultNumberingSystem = data.numbers.nu[0];
|
||||
// #region Part 1: partition and interpolate the CLDR number pattern.
|
||||
// ----------------------------------------------------------
|
||||
var compactNumberPattern = null;
|
||||
if (notation === 'compact' && magnitude) {
|
||||
compactNumberPattern = getCompactDisplayPattern(numberResult, pl, data, style, options.compactDisplay, options.currencyDisplay, numberingSystem);
|
||||
}
|
||||
// This is used multiple times
|
||||
var nonNameCurrencyPart;
|
||||
if (style === 'currency' && options.currencyDisplay !== 'name') {
|
||||
var byCurrencyDisplay = data.currencies[options.currency];
|
||||
if (byCurrencyDisplay) {
|
||||
switch (options.currencyDisplay) {
|
||||
case 'code':
|
||||
nonNameCurrencyPart = options.currency;
|
||||
break;
|
||||
case 'symbol':
|
||||
nonNameCurrencyPart = byCurrencyDisplay.symbol;
|
||||
break;
|
||||
default:
|
||||
nonNameCurrencyPart = byCurrencyDisplay.narrow;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Fallback for unknown currency
|
||||
nonNameCurrencyPart = options.currency;
|
||||
}
|
||||
}
|
||||
var numberPattern;
|
||||
if (!compactNumberPattern) {
|
||||
// Note: if the style is unit, or is currency and the currency display is name,
|
||||
// its unit parts will be interpolated in part 2. So here we can fallback to decimal.
|
||||
if (style === 'decimal' ||
|
||||
style === 'unit' ||
|
||||
(style === 'currency' && options.currencyDisplay === 'name')) {
|
||||
// Shortcut for decimal
|
||||
var decimalData = data.numbers.decimal[numberingSystem] ||
|
||||
data.numbers.decimal[defaultNumberingSystem];
|
||||
numberPattern = getPatternForSign(decimalData.standard, sign);
|
||||
}
|
||||
else if (style === 'currency') {
|
||||
var currencyData = data.numbers.currency[numberingSystem] ||
|
||||
data.numbers.currency[defaultNumberingSystem];
|
||||
// We replace number pattern part with `0` for easier postprocessing.
|
||||
numberPattern = getPatternForSign(currencyData[options.currencySign], sign);
|
||||
}
|
||||
else {
|
||||
// percent
|
||||
var percentPattern = data.numbers.percent[numberingSystem] ||
|
||||
data.numbers.percent[defaultNumberingSystem];
|
||||
numberPattern = getPatternForSign(percentPattern, sign);
|
||||
}
|
||||
}
|
||||
else {
|
||||
numberPattern = compactNumberPattern;
|
||||
}
|
||||
// Extract the decimal number pattern string. It looks like "#,##0,00", which will later be
|
||||
// used to infer decimal group sizes.
|
||||
var decimalNumberPattern = CLDR_NUMBER_PATTERN.exec(numberPattern)[0];
|
||||
// Now we start to substitute patterns
|
||||
// 1. replace strings like `0` and `#,##0.00` with `{0}`
|
||||
// 2. unquote characters (invariant: the quoted characters does not contain the special tokens)
|
||||
numberPattern = numberPattern
|
||||
.replace(CLDR_NUMBER_PATTERN, '{0}')
|
||||
.replace(/'(.)'/g, '$1');
|
||||
// Handle currency spacing (both compact and non-compact).
|
||||
if (style === 'currency' && options.currencyDisplay !== 'name') {
|
||||
var currencyData = data.numbers.currency[numberingSystem] ||
|
||||
data.numbers.currency[defaultNumberingSystem];
|
||||
// See `currencySpacing` substitution rule in TR-35.
|
||||
// Here we always assume the currencyMatch is "[:^S:]" and surroundingMatch is "[:digit:]".
|
||||
//
|
||||
// Example 1: for pattern "#,##0.00¤" with symbol "US$", we replace "¤" with the symbol,
|
||||
// but insert an extra non-break space before the symbol, because "[:^S:]" matches "U" in
|
||||
// "US$" and "[:digit:]" matches the latn numbering system digits.
|
||||
//
|
||||
// Example 2: for pattern "¤#,##0.00" with symbol "US$", there is no spacing between symbol
|
||||
// and number, because `$` does not match "[:^S:]".
|
||||
//
|
||||
// Implementation note: here we do the best effort to infer the insertion.
|
||||
// We also assume that `beforeInsertBetween` and `afterInsertBetween` will never be `;`.
|
||||
var afterCurrency = currencyData.currencySpacing.afterInsertBetween;
|
||||
if (afterCurrency && !S_DOLLAR_UNICODE_REGEX.test(nonNameCurrencyPart)) {
|
||||
numberPattern = numberPattern.replace('¤{0}', "\u00A4".concat(afterCurrency, "{0}"));
|
||||
}
|
||||
var beforeCurrency = currencyData.currencySpacing.beforeInsertBetween;
|
||||
if (beforeCurrency && !CARET_S_UNICODE_REGEX.test(nonNameCurrencyPart)) {
|
||||
numberPattern = numberPattern.replace('{0}¤', "{0}".concat(beforeCurrency, "\u00A4"));
|
||||
}
|
||||
}
|
||||
// The following tokens are special: `{0}`, `¤`, `%`, `-`, `+`, `{c:...}.
|
||||
var numberPatternParts = numberPattern.split(/({c:[^}]+}|\{0\}|[¤%\-\+])/g);
|
||||
var numberParts = [];
|
||||
var symbols = data.numbers.symbols[numberingSystem] ||
|
||||
data.numbers.symbols[defaultNumberingSystem];
|
||||
for (var _i = 0, numberPatternParts_1 = numberPatternParts; _i < numberPatternParts_1.length; _i++) {
|
||||
var part = numberPatternParts_1[_i];
|
||||
if (!part) {
|
||||
continue;
|
||||
}
|
||||
switch (part) {
|
||||
case '{0}': {
|
||||
// We only need to handle scientific and engineering notation here.
|
||||
numberParts.push.apply(numberParts, paritionNumberIntoParts(symbols, numberResult, notation, exponent, numberingSystem,
|
||||
// If compact number pattern exists, do not insert group separators.
|
||||
!compactNumberPattern && options.useGrouping, decimalNumberPattern));
|
||||
break;
|
||||
}
|
||||
case '-':
|
||||
numberParts.push({ type: 'minusSign', value: symbols.minusSign });
|
||||
break;
|
||||
case '+':
|
||||
numberParts.push({ type: 'plusSign', value: symbols.plusSign });
|
||||
break;
|
||||
case '%':
|
||||
numberParts.push({ type: 'percentSign', value: symbols.percentSign });
|
||||
break;
|
||||
case '¤':
|
||||
// Computed above when handling currency spacing.
|
||||
numberParts.push({ type: 'currency', value: nonNameCurrencyPart });
|
||||
break;
|
||||
default:
|
||||
if (/^\{c:/.test(part)) {
|
||||
numberParts.push({
|
||||
type: 'compact',
|
||||
value: part.substring(3, part.length - 1),
|
||||
});
|
||||
}
|
||||
else {
|
||||
// literal
|
||||
numberParts.push({ type: 'literal', value: part });
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// #endregion
|
||||
// #region Part 2: interpolate unit pattern if necessary.
|
||||
// ----------------------------------------------
|
||||
switch (style) {
|
||||
case 'currency': {
|
||||
// `currencyDisplay: 'name'` has similar pattern handling as units.
|
||||
if (options.currencyDisplay === 'name') {
|
||||
var unitPattern = (data.numbers.currency[numberingSystem] ||
|
||||
data.numbers.currency[defaultNumberingSystem]).unitPattern;
|
||||
// Select plural
|
||||
var unitName = void 0;
|
||||
var currencyNameData = data.currencies[options.currency];
|
||||
if (currencyNameData) {
|
||||
unitName = selectPlural(pl, numberResult.roundedNumber * Math.pow(10, exponent), currencyNameData.displayName);
|
||||
}
|
||||
else {
|
||||
// Fallback for unknown currency
|
||||
unitName = options.currency;
|
||||
}
|
||||
// Do {0} and {1} substitution
|
||||
var unitPatternParts = unitPattern.split(/(\{[01]\})/g);
|
||||
var result = [];
|
||||
for (var _a = 0, unitPatternParts_1 = unitPatternParts; _a < unitPatternParts_1.length; _a++) {
|
||||
var part = unitPatternParts_1[_a];
|
||||
switch (part) {
|
||||
case '{0}':
|
||||
result.push.apply(result, numberParts);
|
||||
break;
|
||||
case '{1}':
|
||||
result.push({ type: 'currency', value: unitName });
|
||||
break;
|
||||
default:
|
||||
if (part) {
|
||||
result.push({ type: 'literal', value: part });
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
return numberParts;
|
||||
}
|
||||
}
|
||||
case 'unit': {
|
||||
var unit = options.unit, unitDisplay = options.unitDisplay;
|
||||
var unitData = data.units.simple[unit];
|
||||
var unitPattern = void 0;
|
||||
if (unitData) {
|
||||
// Simple unit pattern
|
||||
unitPattern = selectPlural(pl, numberResult.roundedNumber * Math.pow(10, exponent), data.units.simple[unit][unitDisplay]);
|
||||
}
|
||||
else {
|
||||
// See: http://unicode.org/reports/tr35/tr35-general.html#perUnitPatterns
|
||||
// If cannot find unit in the simple pattern, it must be "per" compound pattern.
|
||||
// Implementation note: we are not following TR-35 here because we need to format to parts!
|
||||
var _b = unit.split('-per-'), numeratorUnit = _b[0], denominatorUnit = _b[1];
|
||||
unitData = data.units.simple[numeratorUnit];
|
||||
var numeratorUnitPattern = selectPlural(pl, numberResult.roundedNumber * Math.pow(10, exponent), data.units.simple[numeratorUnit][unitDisplay]);
|
||||
var perUnitPattern = data.units.simple[denominatorUnit].perUnit[unitDisplay];
|
||||
if (perUnitPattern) {
|
||||
// perUnitPattern exists, combine it with numeratorUnitPattern
|
||||
unitPattern = perUnitPattern.replace('{0}', numeratorUnitPattern);
|
||||
}
|
||||
else {
|
||||
// get compoundUnit pattern (e.g. "{0} per {1}"), repalce {0} with numerator pattern and {1} with
|
||||
// the denominator pattern in singular form.
|
||||
var perPattern = data.units.compound.per[unitDisplay];
|
||||
var denominatorPattern = selectPlural(pl, 1, data.units.simple[denominatorUnit][unitDisplay]);
|
||||
unitPattern = unitPattern = perPattern
|
||||
.replace('{0}', numeratorUnitPattern)
|
||||
.replace('{1}', denominatorPattern.replace('{0}', ''));
|
||||
}
|
||||
}
|
||||
var result = [];
|
||||
// We need spacing around "{0}" because they are not treated as "unit" parts, but "literal".
|
||||
for (var _c = 0, _d = unitPattern.split(/(\s*\{0\}\s*)/); _c < _d.length; _c++) {
|
||||
var part = _d[_c];
|
||||
var interpolateMatch = /^(\s*)\{0\}(\s*)$/.exec(part);
|
||||
if (interpolateMatch) {
|
||||
// Space before "{0}"
|
||||
if (interpolateMatch[1]) {
|
||||
result.push({ type: 'literal', value: interpolateMatch[1] });
|
||||
}
|
||||
// "{0}" itself
|
||||
result.push.apply(result, numberParts);
|
||||
// Space after "{0}"
|
||||
if (interpolateMatch[2]) {
|
||||
result.push({ type: 'literal', value: interpolateMatch[2] });
|
||||
}
|
||||
}
|
||||
else if (part) {
|
||||
result.push({ type: 'unit', value: part });
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
default:
|
||||
return numberParts;
|
||||
}
|
||||
// #endregion
|
||||
}
|
||||
exports.default = formatToParts;
|
||||
// A subset of https://tc39.es/ecma402/#sec-partitionnotationsubpattern
|
||||
// Plus the exponent parts handling.
|
||||
function paritionNumberIntoParts(symbols, numberResult, notation, exponent, numberingSystem, useGrouping,
|
||||
/**
|
||||
* This is the decimal number pattern without signs or symbols.
|
||||
* It is used to infer the group size when `useGrouping` is true.
|
||||
*
|
||||
* A typical value looks like "#,##0.00" (primary group size is 3).
|
||||
* Some locales like Hindi has secondary group size of 2 (e.g. "#,##,##0.00").
|
||||
*/
|
||||
decimalNumberPattern) {
|
||||
var result = [];
|
||||
// eslint-disable-next-line prefer-const
|
||||
var n = numberResult.formattedString, x = numberResult.roundedNumber;
|
||||
if (isNaN(x)) {
|
||||
return [{ type: 'nan', value: n }];
|
||||
}
|
||||
else if (!isFinite(x)) {
|
||||
return [{ type: 'infinity', value: n }];
|
||||
}
|
||||
var digitReplacementTable = digit_mapping_generated_1.digitMapping[numberingSystem];
|
||||
if (digitReplacementTable) {
|
||||
n = n.replace(/\d/g, function (digit) { return digitReplacementTable[+digit] || digit; });
|
||||
}
|
||||
// TODO: Else use an implementation dependent algorithm to map n to the appropriate
|
||||
// representation of n in the given numbering system.
|
||||
var decimalSepIndex = n.indexOf('.');
|
||||
var integer;
|
||||
var fraction;
|
||||
if (decimalSepIndex > 0) {
|
||||
integer = n.slice(0, decimalSepIndex);
|
||||
fraction = n.slice(decimalSepIndex + 1);
|
||||
}
|
||||
else {
|
||||
integer = n;
|
||||
}
|
||||
// #region Grouping integer digits
|
||||
// The weird compact and x >= 10000 check is to ensure consistency with Node.js and Chrome.
|
||||
// Note that `de` does not have compact form for thousands, but Node.js does not insert grouping separator
|
||||
// unless the rounded number is greater than 10000:
|
||||
// NumberFormat('de', {notation: 'compact', compactDisplay: 'short'}).format(1234) //=> "1234"
|
||||
// NumberFormat('de').format(1234) //=> "1.234"
|
||||
if (useGrouping && (notation !== 'compact' || x >= 10000)) {
|
||||
var groupSepSymbol = symbols.group;
|
||||
var groups = [];
|
||||
// > There may be two different grouping sizes: The primary grouping size used for the least
|
||||
// > significant integer group, and the secondary grouping size used for more significant groups.
|
||||
// > If a pattern contains multiple grouping separators, the interval between the last one and the
|
||||
// > end of the integer defines the primary grouping size, and the interval between the last two
|
||||
// > defines the secondary grouping size. All others are ignored.
|
||||
var integerNumberPattern = decimalNumberPattern.split('.')[0];
|
||||
var patternGroups = integerNumberPattern.split(',');
|
||||
var primaryGroupingSize = 3;
|
||||
var secondaryGroupingSize = 3;
|
||||
if (patternGroups.length > 1) {
|
||||
primaryGroupingSize = patternGroups[patternGroups.length - 1].length;
|
||||
}
|
||||
if (patternGroups.length > 2) {
|
||||
secondaryGroupingSize = patternGroups[patternGroups.length - 2].length;
|
||||
}
|
||||
var i = integer.length - primaryGroupingSize;
|
||||
if (i > 0) {
|
||||
// Slice the least significant integer group
|
||||
groups.push(integer.slice(i, i + primaryGroupingSize));
|
||||
// Then iteratively push the more signicant groups
|
||||
// TODO: handle surrogate pairs in some numbering system digits
|
||||
for (i -= secondaryGroupingSize; i > 0; i -= secondaryGroupingSize) {
|
||||
groups.push(integer.slice(i, i + secondaryGroupingSize));
|
||||
}
|
||||
groups.push(integer.slice(0, i + secondaryGroupingSize));
|
||||
}
|
||||
else {
|
||||
groups.push(integer);
|
||||
}
|
||||
while (groups.length > 0) {
|
||||
var integerGroup = groups.pop();
|
||||
result.push({ type: 'integer', value: integerGroup });
|
||||
if (groups.length > 0) {
|
||||
result.push({ type: 'group', value: groupSepSymbol });
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result.push({ type: 'integer', value: integer });
|
||||
}
|
||||
// #endregion
|
||||
if (fraction !== undefined) {
|
||||
result.push({ type: 'decimal', value: symbols.decimal }, { type: 'fraction', value: fraction });
|
||||
}
|
||||
if ((notation === 'scientific' || notation === 'engineering') &&
|
||||
isFinite(x)) {
|
||||
result.push({ type: 'exponentSeparator', value: symbols.exponential });
|
||||
if (exponent < 0) {
|
||||
result.push({ type: 'exponentMinusSign', value: symbols.minusSign });
|
||||
exponent = -exponent;
|
||||
}
|
||||
var exponentResult = (0, ToRawFixed_1.ToRawFixed)(exponent, 0, 0);
|
||||
result.push({
|
||||
type: 'exponentInteger',
|
||||
value: exponentResult.formattedString,
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function getPatternForSign(pattern, sign) {
|
||||
if (pattern.indexOf(';') < 0) {
|
||||
pattern = "".concat(pattern, ";-").concat(pattern);
|
||||
}
|
||||
var _a = pattern.split(';'), zeroPattern = _a[0], negativePattern = _a[1];
|
||||
switch (sign) {
|
||||
case 0:
|
||||
return zeroPattern;
|
||||
case -1:
|
||||
return negativePattern;
|
||||
default:
|
||||
return negativePattern.indexOf('-') >= 0
|
||||
? negativePattern.replace(/-/g, '+')
|
||||
: "+".concat(zeroPattern);
|
||||
}
|
||||
}
|
||||
// Find the CLDR pattern for compact notation based on the magnitude of data and style.
|
||||
//
|
||||
// Example return value: "¤ {c:laki}000;¤{c:laki} -0" (`sw` locale):
|
||||
// - Notice the `{c:...}` token that wraps the compact literal.
|
||||
// - The consecutive zeros are normalized to single zero to match CLDR_NUMBER_PATTERN.
|
||||
//
|
||||
// Returning null means the compact display pattern cannot be found.
|
||||
function getCompactDisplayPattern(numberResult, pl, data, style, compactDisplay, currencyDisplay, numberingSystem) {
|
||||
var _a;
|
||||
var roundedNumber = numberResult.roundedNumber, sign = numberResult.sign, magnitude = numberResult.magnitude;
|
||||
var magnitudeKey = String(Math.pow(10, magnitude));
|
||||
var defaultNumberingSystem = data.numbers.nu[0];
|
||||
var pattern;
|
||||
if (style === 'currency' && currencyDisplay !== 'name') {
|
||||
var byNumberingSystem = data.numbers.currency;
|
||||
var currencyData = byNumberingSystem[numberingSystem] ||
|
||||
byNumberingSystem[defaultNumberingSystem];
|
||||
// NOTE: compact notation ignores currencySign!
|
||||
var compactPluralRules = (_a = currencyData.short) === null || _a === void 0 ? void 0 : _a[magnitudeKey];
|
||||
if (!compactPluralRules) {
|
||||
return null;
|
||||
}
|
||||
pattern = selectPlural(pl, roundedNumber, compactPluralRules);
|
||||
}
|
||||
else {
|
||||
var byNumberingSystem = data.numbers.decimal;
|
||||
var byCompactDisplay = byNumberingSystem[numberingSystem] ||
|
||||
byNumberingSystem[defaultNumberingSystem];
|
||||
var compactPlaralRule = byCompactDisplay[compactDisplay][magnitudeKey];
|
||||
if (!compactPlaralRule) {
|
||||
return null;
|
||||
}
|
||||
pattern = selectPlural(pl, roundedNumber, compactPlaralRule);
|
||||
}
|
||||
// See https://unicode.org/reports/tr35/tr35-numbers.html#Compact_Number_Formats
|
||||
// > If the value is precisely “0”, either explicit or defaulted, then the normal number format
|
||||
// > pattern for that sort of object is supplied.
|
||||
if (pattern === '0') {
|
||||
return null;
|
||||
}
|
||||
pattern = getPatternForSign(pattern, sign)
|
||||
// Extract compact literal from the pattern
|
||||
.replace(/([^\s;\-\+\d¤]+)/g, '{c:$1}')
|
||||
// We replace one or more zeros with a single zero so it matches `CLDR_NUMBER_PATTERN`.
|
||||
.replace(/0+/, '0');
|
||||
return pattern;
|
||||
}
|
||||
function selectPlural(pl, x, rules) {
|
||||
return rules[pl.select(x)] || rules.other;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Number, "MIN_SAFE_INTEGER", {
|
||||
value: require("./"),
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { createErrorClass } from './createErrorClass';
|
||||
|
||||
export interface SequenceError extends Error {}
|
||||
|
||||
export interface SequenceErrorCtor {
|
||||
/**
|
||||
* @deprecated Internal implementation detail. Do not construct error instances.
|
||||
* Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
|
||||
*/
|
||||
new (message: string): SequenceError;
|
||||
}
|
||||
|
||||
/**
|
||||
* An error thrown when something is wrong with the sequence of
|
||||
* values arriving on the observable.
|
||||
*
|
||||
* @see {@link operators/single}
|
||||
*
|
||||
* @class SequenceError
|
||||
*/
|
||||
export const SequenceError: SequenceErrorCtor = createErrorClass(
|
||||
(_super) =>
|
||||
function SequenceErrorImpl(this: any, message: string) {
|
||||
_super(this);
|
||||
this.name = 'SequenceError';
|
||||
this.message = message;
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.first = void 0;
|
||||
var EmptyError_1 = require("../util/EmptyError");
|
||||
var filter_1 = require("./filter");
|
||||
var take_1 = require("./take");
|
||||
var defaultIfEmpty_1 = require("./defaultIfEmpty");
|
||||
var throwIfEmpty_1 = require("./throwIfEmpty");
|
||||
var identity_1 = require("../util/identity");
|
||||
function first(predicate, defaultValue) {
|
||||
var hasDefaultValue = arguments.length >= 2;
|
||||
return function (source) {
|
||||
return source.pipe(predicate ? filter_1.filter(function (v, i) { return predicate(v, i, source); }) : identity_1.identity, take_1.take(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new EmptyError_1.EmptyError(); }));
|
||||
};
|
||||
}
|
||||
exports.first = first;
|
||||
//# sourceMappingURL=first.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bufferWhen.js","sourceRoot":"","sources":["../../../../src/internal/operators/bufferWhen.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AACvC,qCAAoC;AACpC,2DAAgE;AAChE,qDAAoD;AAwCpD,SAAgB,UAAU,CAAI,eAA2C;IACvE,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAEhC,IAAI,MAAM,GAAe,IAAI,CAAC;QAI9B,IAAI,iBAAiB,GAAyB,IAAI,CAAC;QAMnD,IAAM,UAAU,GAAG;YAGjB,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,WAAW,EAAE,CAAC;YAEjC,IAAM,CAAC,GAAG,MAAM,CAAC;YACjB,MAAM,GAAG,EAAE,CAAC;YACZ,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAGxB,qBAAS,CAAC,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,iBAAiB,GAAG,6CAAwB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAI,CAAC,CAAC,CAAC,CAAC;QACvH,CAAC,CAAC;QAGF,UAAU,EAAE,CAAC;QAGb,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EAEV,UAAC,KAAK,IAAK,OAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,KAAK,CAAC,EAAnB,CAAmB,EAG9B;YACE,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClC,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,EAED,SAAS,EAET,cAAM,OAAA,CAAC,MAAM,GAAG,iBAAiB,GAAG,IAAK,CAAC,EAApC,CAAoC,CAC3C,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAhDD,gCAgDC"}
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function initParseRuntime(converter) {
|
||||
var params = converter.parseParam;
|
||||
var rtn = {
|
||||
needProcessIgnoreColumn: false,
|
||||
needProcessIncludeColumn: false,
|
||||
selectedColumns: undefined,
|
||||
ended: false,
|
||||
hasError: false,
|
||||
error: undefined,
|
||||
delimiter: converter.parseParam.delimiter,
|
||||
eol: converter.parseParam.eol,
|
||||
columnConv: [],
|
||||
headerType: [],
|
||||
headerTitle: [],
|
||||
headerFlag: [],
|
||||
headers: undefined,
|
||||
started: false,
|
||||
parsedLineNumber: 0,
|
||||
columnValueSetter: [],
|
||||
};
|
||||
if (params.ignoreColumns) {
|
||||
rtn.needProcessIgnoreColumn = true;
|
||||
}
|
||||
if (params.includeColumns) {
|
||||
rtn.needProcessIncludeColumn = true;
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
exports.initParseRuntime = initParseRuntime;
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiL1VzZXJzL2t4aWFuZy93b3JrL3Byb2plY3RzL2NzdjJqc29uL3NyYy9QYXJzZVJ1bnRpbWUudHMiLCJzb3VyY2VzIjpbIi9Vc2Vycy9reGlhbmcvd29yay9wcm9qZWN0cy9jc3YyanNvbi9zcmMvUGFyc2VSdW50aW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBOERBLDBCQUFpQyxTQUFvQjtJQUNuRCxJQUFNLE1BQU0sR0FBRyxTQUFTLENBQUMsVUFBVSxDQUFDO0lBQ3BDLElBQU0sR0FBRyxHQUFpQjtRQUN4Qix1QkFBdUIsRUFBRSxLQUFLO1FBQzlCLHdCQUF3QixFQUFFLEtBQUs7UUFDL0IsZUFBZSxFQUFFLFNBQVM7UUFDMUIsS0FBSyxFQUFFLEtBQUs7UUFDWixRQUFRLEVBQUUsS0FBSztRQUNmLEtBQUssRUFBRSxTQUFTO1FBQ2hCLFNBQVMsRUFBRSxTQUFTLENBQUMsVUFBVSxDQUFDLFNBQVM7UUFDekMsR0FBRyxFQUFFLFNBQVMsQ0FBQyxVQUFVLENBQUMsR0FBRztRQUM3QixVQUFVLEVBQUUsRUFBRTtRQUNkLFVBQVUsRUFBRSxFQUFFO1FBQ2QsV0FBVyxFQUFFLEVBQUU7UUFDZixVQUFVLEVBQUUsRUFBRTtRQUNkLE9BQU8sRUFBRSxTQUFTO1FBQ2xCLE9BQU8sRUFBRSxLQUFLO1FBQ2QsZ0JBQWdCLEVBQUUsQ0FBQztRQUNuQixpQkFBaUIsRUFBRSxFQUFFO0tBQ3RCLENBQUE7SUFDRCxJQUFJLE1BQU0sQ0FBQyxhQUFhLEVBQUU7UUFDeEIsR0FBRyxDQUFDLHVCQUF1QixHQUFHLElBQUksQ0FBQztLQUNwQztJQUNELElBQUksTUFBTSxDQUFDLGNBQWMsRUFBRTtRQUN6QixHQUFHLENBQUMsd0JBQXdCLEdBQUcsSUFBSSxDQUFDO0tBQ3JDO0lBQ0QsT0FBTyxHQUFHLENBQUM7QUFDYixDQUFDO0FBM0JELDRDQTJCQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IENTVlBhcnNlUGFyYW0sIENlbGxQYXJzZXIgfSBmcm9tIFwiLi9QYXJhbWV0ZXJzXCI7XG5pbXBvcnQgeyBDb252ZXJ0ZXIsIFByZVJhd0RhdGFDYWxsYmFjaywgUHJlRmlsZUxpbmVDYWxsYmFjayB9IGZyb20gXCIuL0NvbnZlcnRlclwiO1xuaW1wb3J0IHsgQ2hpbGRQcm9jZXNzIH0gZnJvbSBcImNoaWxkX3Byb2Nlc3NcIjtcbmltcG9ydCBDU1ZFcnJvciBmcm9tIFwiLi9DU1ZFcnJvclwiO1xuXG5leHBvcnQgaW50ZXJmYWNlIFBhcnNlUnVudGltZSB7XG4gIC8qKlxuICAgKiBJZiBuZWVkIGNvbnZlcnQgaWdub3JlQ29sdW1uIGZyb20gY29sdW1uIG5hbWUoc3RyaW5nKSB0byBjb2x1bW4gaW5kZXggKG51bWJlcikuIFBhcnNlciBuZWVkcyBjb2x1bW4gaW5kZXguXG4gICAqL1xuICBuZWVkUHJvY2Vzc0lnbm9yZUNvbHVtbjogYm9vbGVhbjtcbiAgLyoqXG4gICAqIElmIG5lZWQgY29udmVydCBpbmNsdWRlQ29sdW1uIGZyb20gY29sdW1uIG5hbWUoc3RyaW5nKSB0byBjb2x1bW4gaW5kZXggKG51bWJlcikuIFBhcnNlciBuZWVkcyBjb2x1bW4gaW5kZXguXG4gICAqL1xuICBuZWVkUHJvY2Vzc0luY2x1ZGVDb2x1bW46IGJvb2xlYW47XG4gIC8qKlxuICAgKiB0aGUgaW5kZXhlcyBvZiBjb2x1bW5zIHRvIHJlc2VydmUsIHVuZGVmaW5lZCBtZWFucyByZXNlcnZlIGFsbCwgW10gbWVhbnMgaGlkZSBhbGxcbiAgICovXG4gIHNlbGVjdGVkQ29sdW1ucz86IG51bWJlcltdO1xuICBlbmRlZDogYm9vbGVhbjtcbiAgaGFzRXJyb3I6IGJvb2xlYW47XG4gIGVycm9yPzogRXJyb3I7XG4gIC8qKlxuICAgKiBJbmZlcnJlZCBkZWxpbWl0ZXJcbiAgICovXG4gIGRlbGltaXRlcjogc3RyaW5nIHwgc3RyaW5nW107XG4gIC8qKlxuICAgKiBJbmZlcnJlZCBlb2xcbiAgICovXG4gIGVvbD86IHN0cmluZztcbiAgLyoqXG4gICAqIENvbnZlcnRlciBmdW5jdGlvbiBmb3IgYSBjb2x1bW4uIFBvcHVsYXRlZCBhdCBydW50aW1lLlxuICAgKi9cbiAgY29sdW1uQ29udjogKENlbGxQYXJzZXIgfCBudWxsKVtdLFxuICBoZWFkZXJUeXBlOiBhbnlbXSxcbiAgaGVhZGVyVGl0bGU6IHN0cmluZ1tdLFxuICBoZWFkZXJGbGFnOiBhbnlbXSxcbiAgLyoqXG4gICAqIEluZmVycmVkIGhlYWRlcnNcbiAgICovXG4gIGhlYWRlcnM/OiBhbnlbXSxcbiAgY3N2TGluZUJ1ZmZlcj86IEJ1ZmZlcixcbiAgXG4gIC8qKlxuICAgKiBhZnRlciBmaXJzdCBjaHVuayBvZiBkYXRhIGJlaW5nIHByb2Nlc3NlZCBhbmQgZW1pdHRlZCwgc3RhcnRlZCB3aWxsIGJlY29tZSB0cnVlLlxuICAgKi9cbiAgc3RhcnRlZDogYm9vbGVhbixcbiAgcHJlUmF3RGF0YUhvb2s/OiBQcmVSYXdEYXRhQ2FsbGJhY2ssXG4gIHByZUZpbGVMaW5lSG9vaz86IFByZUZpbGVMaW5lQ2FsbGJhY2ssXG4gIHBhcnNlZExpbmVOdW1iZXI6IG51bWJlcixcblxuICBjb2x1bW5WYWx1ZVNldHRlcjogRnVuY3Rpb25bXTtcbiAgc3Vic2NyaWJlPzoge1xuICAgIG9uTmV4dD86IChkYXRhOiBhbnksIGxpbmVOdW1iZXI6bnVtYmVyKSA9PiB2b2lkIHwgUHJvbWlzZUxpa2U8dm9pZD47XG4gICAgb25FcnJvcj86IChlcnI6IENTVkVycm9yKSA9PiB2b2lkO1xuICAgIG9uQ29tcGxldGVkPzogKCkgPT4gdm9pZDtcbiAgfTtcbiAgdGhlbj86IHtcbiAgICBvbmZ1bGZpbGxlZDogKHZhbHVlOiBhbnlbXSkgPT4gYW55O1xuICAgIG9ucmVqZWN0ZWQ6IChlcnI6IEVycm9yKSA9PiBhbnk7XG4gIH1cblxufVxuZXhwb3J0IGZ1bmN0aW9uIGluaXRQYXJzZVJ1bnRpbWUoY29udmVydGVyOiBDb252ZXJ0ZXIpOiBQYXJzZVJ1bnRpbWUge1xuICBjb25zdCBwYXJhbXMgPSBjb252ZXJ0ZXIucGFyc2VQYXJhbTtcbiAgY29uc3QgcnRuOiBQYXJzZVJ1bnRpbWUgPSB7XG4gICAgbmVlZFByb2Nlc3NJZ25vcmVDb2x1bW46IGZhbHNlLFxuICAgIG5lZWRQcm9jZXNzSW5jbHVkZUNvbHVtbjogZmFsc2UsXG4gICAgc2VsZWN0ZWRDb2x1bW5zOiB1bmRlZmluZWQsXG4gICAgZW5kZWQ6IGZhbHNlLFxuICAgIGhhc0Vycm9yOiBmYWxzZSxcbiAgICBlcnJvcjogdW5kZWZpbmVkLFxuICAgIGRlbGltaXRlcjogY29udmVydGVyLnBhcnNlUGFyYW0uZGVsaW1pdGVyLFxuICAgIGVvbDogY29udmVydGVyLnBhcnNlUGFyYW0uZW9sLFxuICAgIGNvbHVtbkNvbnY6IFtdLFxuICAgIGhlYWRlclR5cGU6IFtdLFxuICAgIGhlYWRlclRpdGxlOiBbXSxcbiAgICBoZWFkZXJGbGFnOiBbXSxcbiAgICBoZWFkZXJzOiB1bmRlZmluZWQsXG4gICAgc3RhcnRlZDogZmFsc2UsXG4gICAgcGFyc2VkTGluZU51bWJlcjogMCxcbiAgICBjb2x1bW5WYWx1ZVNldHRlcjogW10sXG4gIH1cbiAgaWYgKHBhcmFtcy5pZ25vcmVDb2x1bW5zKSB7XG4gICAgcnRuLm5lZWRQcm9jZXNzSWdub3JlQ29sdW1uID0gdHJ1ZTtcbiAgfVxuICBpZiAocGFyYW1zLmluY2x1ZGVDb2x1bW5zKSB7XG4gICAgcnRuLm5lZWRQcm9jZXNzSW5jbHVkZUNvbHVtbiA9IHRydWU7XG4gIH1cbiAgcmV0dXJuIHJ0bjtcbn0iXX0=
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('toPath', require('../toPath'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "lru-queue",
|
||||
"version": "0.1.0",
|
||||
"description": "LRU Queue",
|
||||
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/medikoo/lru-queue.git"
|
||||
},
|
||||
"keywords": [
|
||||
"lru",
|
||||
"cache",
|
||||
"queue"
|
||||
],
|
||||
"dependencies": {
|
||||
"es5-ext": "~0.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tad": "~0.1.21"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node node_modules/tad/bin/tad"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "globals": { "Promise": true } }
|
||||
@@ -0,0 +1,3 @@
|
||||
import { SchedulerLike } from '../types';
|
||||
export declare function schedulePromise<T>(input: PromiseLike<T>, scheduler: SchedulerLike): import("../Observable").Observable<T>;
|
||||
//# sourceMappingURL=schedulePromise.d.ts.map
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Normalize non-File value following the spec requirements.
|
||||
*
|
||||
* See: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data
|
||||
*
|
||||
* @param value A value to normalize
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
export declare const normalizeValue: (value: unknown) => string;
|
||||
@@ -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/typed-array-length
|
||||
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']
|
||||
@@ -0,0 +1,115 @@
|
||||
# npm-run-path [](https://travis-ci.org/sindresorhus/npm-run-path)
|
||||
|
||||
> Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries
|
||||
|
||||
In [npm run scripts](https://docs.npmjs.com/cli/run-script) you can execute locally installed binaries by name. This enables the same outside npm.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install npm-run-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const childProcess = require('child_process');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
|
||||
console.log(process.env.PATH);
|
||||
//=> '/usr/local/bin'
|
||||
|
||||
console.log(npmRunPath());
|
||||
//=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin'
|
||||
|
||||
// `foo` is a locally installed binary
|
||||
childProcess.execFileSync('foo', {
|
||||
env: npmRunPath.env()
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### npmRunPath(options?)
|
||||
|
||||
Returns the augmented path string.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Working directory.
|
||||
|
||||
##### path
|
||||
|
||||
Type: `string`<br>
|
||||
Default: [`PATH`](https://github.com/sindresorhus/path-key)
|
||||
|
||||
PATH to be appended.<br>
|
||||
Set it to an empty string to exclude the default PATH.
|
||||
|
||||
##### execPath
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.execPath`
|
||||
|
||||
Path to the current Node.js executable. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
### npmRunPath.env(options?)
|
||||
|
||||
Returns the augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Working directory.
|
||||
|
||||
##### env
|
||||
|
||||
Type: `Object`
|
||||
|
||||
Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options.
|
||||
|
||||
##### execPath
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.execPath`
|
||||
|
||||
Path to the Node.js executable to use in child processes if that is different from the current one. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [npm-run-path-cli](https://github.com/sindresorhus/npm-run-path-cli) - CLI for this module
|
||||
- [execa](https://github.com/sindresorhus/execa) - Execute a locally installed binary
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-npm-run-path?utm_source=npm-npm-run-path&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('toSafeInteger', require('../toSafeInteger'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"2":"C K L G M N O","258":"P Q R S T U","322":"V W","388":"X Y Z a b c d e i j k l m n o p q r s t u f H"},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 EC FC","258":"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"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB","258":"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","322":"V W","388":"X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"2":"I v J D E F A B HC zB IC JC KC LC 0B","258":"C K L G qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB PC QC RC SC qB AC TC rB","258":"NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB","322":"kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","388":"e"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC","258":"eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"2":"tB I pC qC rC sC BC tC uC","258":"f"},J:{"2":"D A"},K:{"2":"A B C qB AC rB","388":"h"},L:{"388":"H"},M:{"258":"H"},N:{"2":"A B"},O:{"2":"vC"},P:{"2":"I wC xC yC","258":"g zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"258":"1B"},R:{"388":"9C"},S:{"2":"AD","258":"BD"}},B:5,C:"Permissions Policy"};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../../../src/internal/operators/repeat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AA6G5C,MAAM,UAAU,MAAM,CAAI,aAAqC;IAC7D,IAAI,KAAK,GAAG,QAAQ,CAAC;IACrB,IAAI,KAA4B,CAAC;IAEjC,IAAI,aAAa,IAAI,IAAI,EAAE;QACzB,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;YACrC,CAAC,EAAE,KAAK,GAAG,QAAQ,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,CAAC;SAC/C;aAAM;YACL,KAAK,GAAG,aAAa,CAAC;SACvB;KACF;IAED,OAAO,KAAK,IAAI,CAAC;QACf,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;QACb,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;YAC7B,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,IAAI,SAA8B,CAAC;YAEnC,MAAM,WAAW,GAAG,GAAG,EAAE;gBACvB,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,EAAE,CAAC;gBACzB,SAAS,GAAG,IAAI,CAAC;gBACjB,IAAI,KAAK,IAAI,IAAI,EAAE;oBACjB,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;oBACpF,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,UAAU,EAAE,GAAG,EAAE;wBACnE,kBAAkB,CAAC,WAAW,EAAE,CAAC;wBACjC,iBAAiB,EAAE,CAAC;oBACtB,CAAC,CAAC,CAAC;oBACH,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;iBACxC;qBAAM;oBACL,iBAAiB,EAAE,CAAC;iBACrB;YACH,CAAC,CAAC;YAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;gBAC7B,IAAI,SAAS,GAAG,KAAK,CAAC;gBACtB,SAAS,GAAG,MAAM,CAAC,SAAS,CAC1B,wBAAwB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE;oBACnD,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE;wBACnB,IAAI,SAAS,EAAE;4BACb,WAAW,EAAE,CAAC;yBACf;6BAAM;4BACL,SAAS,GAAG,IAAI,CAAC;yBAClB;qBACF;yBAAM;wBACL,UAAU,CAAC,QAAQ,EAAE,CAAC;qBACvB;gBACH,CAAC,CAAC,CACH,CAAC;gBAEF,IAAI,SAAS,EAAE;oBACb,WAAW,EAAE,CAAC;iBACf;YACH,CAAC,CAAC;YAEF,iBAAiB,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;AACT,CAAC"}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { mergeMap } from './mergeMap';
|
||||
export var flatMap = mergeMap;
|
||||
//# sourceMappingURL=flatMap.js.map
|
||||
@@ -0,0 +1,37 @@
|
||||
var baseRest = require('./_baseRest'),
|
||||
isIterateeCall = require('./_isIterateeCall');
|
||||
|
||||
/**
|
||||
* Creates a function like `_.assign`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} assigner The function to assign values.
|
||||
* @returns {Function} Returns the new assigner function.
|
||||
*/
|
||||
function createAssigner(assigner) {
|
||||
return baseRest(function(object, sources) {
|
||||
var index = -1,
|
||||
length = sources.length,
|
||||
customizer = length > 1 ? sources[length - 1] : undefined,
|
||||
guard = length > 2 ? sources[2] : undefined;
|
||||
|
||||
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
||||
? (length--, customizer)
|
||||
: undefined;
|
||||
|
||||
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
||||
customizer = length < 3 ? undefined : customizer;
|
||||
length = 1;
|
||||
}
|
||||
object = Object(object);
|
||||
while (++index < length) {
|
||||
var source = sources[index];
|
||||
if (source) {
|
||||
assigner(object, source, index, customizer);
|
||||
}
|
||||
}
|
||||
return object;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = createAssigner;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('isDate', require('../isDate'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var max = GetIntrinsic('%Math.max%');
|
||||
var min = GetIntrinsic('%Math.min%');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/12.0/#clamping
|
||||
|
||||
module.exports = function clamp(x, lower, upper) {
|
||||
if (Type(x) !== 'Number' || Type(lower) !== 'Number' || Type(upper) !== 'Number' || !(lower <= upper)) {
|
||||
throw new $TypeError('Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`');
|
||||
}
|
||||
return min(max(lower, x), upper);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Math, "log2", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./assignIn');
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"write-file-atomic","version":"3.0.3","files":{"LICENSE":{"checkedAt":1678883672496,"integrity":"sha512-xs8Qx1Pa8SRtx+Es20hNmYmskMAuS+7K6scPjRaQrz+XaN9AHFiAVI6HyLYALi0qXqitmsleljSfQHuhMP/+Hg==","mode":420,"size":734},"package.json":{"checkedAt":1678883672496,"integrity":"sha512-vX7ELJlBCjLXKCRTCYlCWwCkl2GH0IGq7KQMl5brw37Y5tS3rfxTJYVSQ3HVVNxzv3YEu5s5JmlSKcFu8l329Q==","mode":420,"size":1239},"index.js":{"checkedAt":1678883672496,"integrity":"sha512-qGUxfXbelwElEDnCawPrpC8uxMtu0WfFiBFi8EzS9IkDuPDbWAF9tTADukpI6/TE9WwdcxsiPuWYPpX4sFTT9A==","mode":420,"size":6812},"CHANGELOG.md":{"checkedAt":1678883672496,"integrity":"sha512-IR0ozKkbaf+34uXzav+R231XeY/Bh1GPLdjwmx2Uyi7Qs+k8hsPq5Uro+isJa//eWygoGnlih8VTe4DOPDLIig==","mode":420,"size":893},"README.md":{"checkedAt":1678883672499,"integrity":"sha512-oH9/IIaP2iaUygtNEAAsuc0abjvAMxcyK/8QPId/ODwCW8uCJb57Fwx1TiD8c893+J/cMGJJjq3wGPnjG8zVLQ==","mode":420,"size":3109}}}
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Math.log2 : require("./shim");
|
||||
@@ -0,0 +1,27 @@
|
||||
import { EmptyError } from './util/EmptyError';
|
||||
export function lastValueFrom(source, config) {
|
||||
var hasConfig = typeof config === 'object';
|
||||
return new Promise(function (resolve, reject) {
|
||||
var _hasValue = false;
|
||||
var _value;
|
||||
source.subscribe({
|
||||
next: function (value) {
|
||||
_value = value;
|
||||
_hasValue = true;
|
||||
},
|
||||
error: reject,
|
||||
complete: function () {
|
||||
if (_hasValue) {
|
||||
resolve(_value);
|
||||
}
|
||||
else if (hasConfig) {
|
||||
resolve(config.defaultValue);
|
||||
}
|
||||
else {
|
||||
reject(new EmptyError());
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=lastValueFrom.js.map
|
||||
@@ -0,0 +1,4 @@
|
||||
instrumentation:
|
||||
excludes:
|
||||
- test.js
|
||||
- test/**/*
|
||||
Reference in New Issue
Block a user