new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
moveSync: require('./move-sync')
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "tinro",
|
||||
"version": "0.6.12",
|
||||
"description": "tinro is a tiny declarative router for Svelte",
|
||||
"main": "dist/tinro.js",
|
||||
"module": "dist/tinro.es.js",
|
||||
"svelte": "cmp/index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"build": "node esbuild",
|
||||
"dev": "node tests/esbuild.dev --dev",
|
||||
"compare": "npm run test:build && node tests/esbuild.compare",
|
||||
"pretest": "node tests/esbuild.dev",
|
||||
"test": "node tests"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/AlexxNB/tinro.git"
|
||||
},
|
||||
"keywords": [
|
||||
"svelte-router",
|
||||
"router",
|
||||
"svelte"
|
||||
],
|
||||
"author": "Alexey Schebelev",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/AlexxNB/tinro/issues"
|
||||
},
|
||||
"homepage": "https://github.com/AlexxNB/tinro#readme",
|
||||
"devDependencies": {
|
||||
"derver": "^0.5.3",
|
||||
"esbuild": "^0.14.18",
|
||||
"esbuild-svelte": "^0.6.2",
|
||||
"port-authority": "^1.1.2",
|
||||
"puppeteer": "^13.1.3",
|
||||
"svelte": "^3.46.4",
|
||||
"uvu": "^0.5.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { initDebug } from './debug';
|
||||
import 'preact/devtools';
|
||||
|
||||
initDebug();
|
||||
|
||||
export { resetPropWarnings } from './check-props';
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"didyoumean","version":"1.2.2","files":{"LICENSE":{"checkedAt":1678883673155,"integrity":"sha512-5T9dJ+IEDtyc5l8mU5FVu3C9+L1AX51T0VuGBBJWU+FZG40v30q/7LJYGaGLcD/9tUNOic3O9K3Vw7bRfeTKjA==","mode":420,"size":584},"didYouMean-1.2.1.js":{"checkedAt":1678883673155,"integrity":"sha512-o8bYnEftLLiuF04mYieZSDPvf32qBdZA49wiSJdzQMzCtkViWqJByhWfQIY7w2X+WRylT6XuZU+KWifbKxnKJg==","mode":420,"size":9538},"package.json":{"checkedAt":1678883673155,"integrity":"sha512-ycB97IdPr2EE/50X9/qEkMJWjZEjNT6UoX+06ttBASyXA67gUXWcUTjSTH+vgUZ2EJNszJ+XvS2HR7jSF6CeBA==","mode":493,"size":647},"didYouMean-1.2.1.min.js":{"checkedAt":1678883673155,"integrity":"sha512-g3WBASnHHNiFXxP1WEfsPelkmHhBc01lwQ2xjdX0T09MDx/hrEo2aj+UFeqG5QkHc2GdIKeDGoxRUqNWq8GOyA==","mode":420,"size":1975},"README.md":{"checkedAt":1678883673155,"integrity":"sha512-BzFCt5Tgr03/xfj0fH4JrH0QaH2YUoYnoRD9bUAvwyZ/TPqe3A1UNrvOw/L7xgpf0ipoUyO/gVjybk1YV6+h5g==","mode":420,"size":4511}}}
|
||||
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BLAKE2 = exports.SIGMA = void 0;
|
||||
const _assert_js_1 = require("./_assert.js");
|
||||
const utils_js_1 = require("./utils.js");
|
||||
// prettier-ignore
|
||||
exports.SIGMA = new Uint8Array([
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
|
||||
11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
|
||||
7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
|
||||
9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
|
||||
2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
|
||||
12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,
|
||||
13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,
|
||||
6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,
|
||||
10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,
|
||||
// For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1].
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
|
||||
]);
|
||||
class BLAKE2 extends utils_js_1.Hash {
|
||||
constructor(blockLen, outputLen, opts = {}, keyLen, saltLen, persLen) {
|
||||
super();
|
||||
this.blockLen = blockLen;
|
||||
this.outputLen = outputLen;
|
||||
this.length = 0;
|
||||
this.pos = 0;
|
||||
this.finished = false;
|
||||
this.destroyed = false;
|
||||
_assert_js_1.default.number(blockLen);
|
||||
_assert_js_1.default.number(outputLen);
|
||||
_assert_js_1.default.number(keyLen);
|
||||
if (outputLen < 0 || outputLen > keyLen)
|
||||
throw new Error('Blake2: outputLen bigger than keyLen');
|
||||
if (opts.key !== undefined && (opts.key.length < 1 || opts.key.length > keyLen))
|
||||
throw new Error(`Key should be up 1..${keyLen} byte long or undefined`);
|
||||
if (opts.salt !== undefined && opts.salt.length !== saltLen)
|
||||
throw new Error(`Salt should be ${saltLen} byte long or undefined`);
|
||||
if (opts.personalization !== undefined && opts.personalization.length !== persLen)
|
||||
throw new Error(`Personalization should be ${persLen} byte long or undefined`);
|
||||
this.buffer32 = (0, utils_js_1.u32)((this.buffer = new Uint8Array(blockLen)));
|
||||
}
|
||||
update(data) {
|
||||
_assert_js_1.default.exists(this);
|
||||
// Main difference with other hashes: there is flag for last block,
|
||||
// so we cannot process current block before we know that there
|
||||
// is the next one. This significantly complicates logic and reduces ability
|
||||
// to do zero-copy processing
|
||||
const { blockLen, buffer, buffer32 } = this;
|
||||
data = (0, utils_js_1.toBytes)(data);
|
||||
const len = data.length;
|
||||
for (let pos = 0; pos < len;) {
|
||||
// If buffer is full and we still have input (don't process last block, same as blake2s)
|
||||
if (this.pos === blockLen) {
|
||||
this.compress(buffer32, 0, false);
|
||||
this.pos = 0;
|
||||
}
|
||||
const take = Math.min(blockLen - this.pos, len - pos);
|
||||
const dataOffset = data.byteOffset + pos;
|
||||
// full block && aligned to 4 bytes && not last in input
|
||||
if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
|
||||
const data32 = new Uint32Array(data.buffer, dataOffset, Math.floor((len - pos) / 4));
|
||||
for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
|
||||
this.length += blockLen;
|
||||
this.compress(data32, pos32, false);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
buffer.set(data.subarray(pos, pos + take), this.pos);
|
||||
this.pos += take;
|
||||
this.length += take;
|
||||
pos += take;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
digestInto(out) {
|
||||
_assert_js_1.default.exists(this);
|
||||
_assert_js_1.default.output(out, this);
|
||||
const { pos, buffer32 } = this;
|
||||
this.finished = true;
|
||||
// Padding
|
||||
this.buffer.subarray(pos).fill(0);
|
||||
this.compress(buffer32, 0, true);
|
||||
const out32 = (0, utils_js_1.u32)(out);
|
||||
this.get().forEach((v, i) => (out32[i] = v));
|
||||
}
|
||||
digest() {
|
||||
const { buffer, outputLen } = this;
|
||||
this.digestInto(buffer);
|
||||
const res = buffer.slice(0, outputLen);
|
||||
this.destroy();
|
||||
return res;
|
||||
}
|
||||
_cloneInto(to) {
|
||||
const { buffer, length, finished, destroyed, outputLen, pos } = this;
|
||||
to || (to = new this.constructor({ dkLen: outputLen }));
|
||||
to.set(...this.get());
|
||||
to.length = length;
|
||||
to.finished = finished;
|
||||
to.destroyed = destroyed;
|
||||
to.outputLen = outputLen;
|
||||
to.buffer.set(buffer);
|
||||
to.pos = pos;
|
||||
return to;
|
||||
}
|
||||
}
|
||||
exports.BLAKE2 = BLAKE2;
|
||||
//# sourceMappingURL=_blake2.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AsyncScheduler.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/AsyncScheduler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC;IAAoC,kCAAS;IAkB3C,wBAAY,eAA8B,EAAE,GAAiC;QAAjC,oBAAA,EAAA,MAAoB,SAAS,CAAC,GAAG;QAA7E,YACE,kBAAM,eAAe,EAAE,GAAG,CAAC,SAC5B;QAnBM,aAAO,GAA4B,EAAE,CAAC;QAOtC,aAAO,GAAY,KAAK,CAAC;;IAYhC,CAAC;IAEM,8BAAK,GAAZ,UAAa,MAAwB;QAC3B,IAAA,OAAO,GAAK,IAAI,QAAT,CAAU;QAEzB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO;SACR;QAED,IAAI,KAAU,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,GAAG;YACD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;gBACxD,MAAM;aACP;SACF,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,EAAG,CAAC,EAAE;QAEtC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,EAAG,CAAC,EAAE;gBAClC,MAAM,CAAC,WAAW,EAAE,CAAC;aACtB;YACD,MAAM,KAAK,CAAC;SACb;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAhDD,CAAoC,SAAS,GAgD5C"}
|
||||
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var isArguments = require('../');
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
|
||||
test('primitives', function (t) {
|
||||
t.notOk(isArguments([]), 'array is not arguments');
|
||||
t.notOk(isArguments({}), 'object is not arguments');
|
||||
t.notOk(isArguments(''), 'empty string is not arguments');
|
||||
t.notOk(isArguments('foo'), 'string is not arguments');
|
||||
t.notOk(isArguments({ length: 2 }), 'naive array-like is not arguments');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arguments object', function (t) {
|
||||
t.ok(isArguments(arguments), 'arguments is arguments');
|
||||
t.notOk(isArguments(Array.prototype.slice.call(arguments)), 'sliced arguments is not arguments');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('old-style arguments object', function (t) {
|
||||
var isLegacyArguments = isArguments.isLegacyArguments || isArguments;
|
||||
var fakeOldArguments = {
|
||||
callee: function () {},
|
||||
length: 3
|
||||
};
|
||||
t.ok(isLegacyArguments(fakeOldArguments), 'old-style arguments is arguments');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Symbol.toStringTag', { skip: !hasToStringTag }, function (t) {
|
||||
var obj = {};
|
||||
obj[Symbol.toStringTag] = 'Arguments';
|
||||
t.notOk(isArguments(obj), 'object with faked toStringTag is not arguments');
|
||||
|
||||
var args = (function () {
|
||||
return arguments;
|
||||
}());
|
||||
args[Symbol.toStringTag] = 'Arguments';
|
||||
t.notOk(isArguments(obj), 'real arguments with faked toStringTag is not arguments');
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 150
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
||||
|
||||
[CHANGELOG.md]
|
||||
max_line_length = off
|
||||
@@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
module.exports =
|
||||
function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) {
|
||||
var util = require("./util");
|
||||
var canEvaluate = util.canEvaluate;
|
||||
var tryCatch = util.tryCatch;
|
||||
var errorObj = util.errorObj;
|
||||
var reject;
|
||||
|
||||
if (!false) {
|
||||
if (canEvaluate) {
|
||||
var thenCallback = function(i) {
|
||||
return new Function("value", "holder", " \n\
|
||||
'use strict'; \n\
|
||||
holder.pIndex = value; \n\
|
||||
holder.checkFulfillment(this); \n\
|
||||
".replace(/Index/g, i));
|
||||
};
|
||||
|
||||
var promiseSetter = function(i) {
|
||||
return new Function("promise", "holder", " \n\
|
||||
'use strict'; \n\
|
||||
holder.pIndex = promise; \n\
|
||||
".replace(/Index/g, i));
|
||||
};
|
||||
|
||||
var generateHolderClass = function(total) {
|
||||
var props = new Array(total);
|
||||
for (var i = 0; i < props.length; ++i) {
|
||||
props[i] = "this.p" + (i+1);
|
||||
}
|
||||
var assignment = props.join(" = ") + " = null;";
|
||||
var cancellationCode= "var promise;\n" + props.map(function(prop) {
|
||||
return " \n\
|
||||
promise = " + prop + "; \n\
|
||||
if (promise instanceof Promise) { \n\
|
||||
promise.cancel(); \n\
|
||||
} \n\
|
||||
";
|
||||
}).join("\n");
|
||||
var passedArguments = props.join(", ");
|
||||
var name = "Holder$" + total;
|
||||
|
||||
|
||||
var code = "return function(tryCatch, errorObj, Promise, async) { \n\
|
||||
'use strict'; \n\
|
||||
function [TheName](fn) { \n\
|
||||
[TheProperties] \n\
|
||||
this.fn = fn; \n\
|
||||
this.asyncNeeded = true; \n\
|
||||
this.now = 0; \n\
|
||||
} \n\
|
||||
\n\
|
||||
[TheName].prototype._callFunction = function(promise) { \n\
|
||||
promise._pushContext(); \n\
|
||||
var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
|
||||
promise._popContext(); \n\
|
||||
if (ret === errorObj) { \n\
|
||||
promise._rejectCallback(ret.e, false); \n\
|
||||
} else { \n\
|
||||
promise._resolveCallback(ret); \n\
|
||||
} \n\
|
||||
}; \n\
|
||||
\n\
|
||||
[TheName].prototype.checkFulfillment = function(promise) { \n\
|
||||
var now = ++this.now; \n\
|
||||
if (now === [TheTotal]) { \n\
|
||||
if (this.asyncNeeded) { \n\
|
||||
async.invoke(this._callFunction, this, promise); \n\
|
||||
} else { \n\
|
||||
this._callFunction(promise); \n\
|
||||
} \n\
|
||||
\n\
|
||||
} \n\
|
||||
}; \n\
|
||||
\n\
|
||||
[TheName].prototype._resultCancelled = function() { \n\
|
||||
[CancellationCode] \n\
|
||||
}; \n\
|
||||
\n\
|
||||
return [TheName]; \n\
|
||||
}(tryCatch, errorObj, Promise, async); \n\
|
||||
";
|
||||
|
||||
code = code.replace(/\[TheName\]/g, name)
|
||||
.replace(/\[TheTotal\]/g, total)
|
||||
.replace(/\[ThePassedArguments\]/g, passedArguments)
|
||||
.replace(/\[TheProperties\]/g, assignment)
|
||||
.replace(/\[CancellationCode\]/g, cancellationCode);
|
||||
|
||||
return new Function("tryCatch", "errorObj", "Promise", "async", code)
|
||||
(tryCatch, errorObj, Promise, async);
|
||||
};
|
||||
|
||||
var holderClasses = [];
|
||||
var thenCallbacks = [];
|
||||
var promiseSetters = [];
|
||||
|
||||
for (var i = 0; i < 8; ++i) {
|
||||
holderClasses.push(generateHolderClass(i + 1));
|
||||
thenCallbacks.push(thenCallback(i + 1));
|
||||
promiseSetters.push(promiseSetter(i + 1));
|
||||
}
|
||||
|
||||
reject = function (reason) {
|
||||
this._reject(reason);
|
||||
};
|
||||
}}
|
||||
|
||||
Promise.join = function () {
|
||||
var last = arguments.length - 1;
|
||||
var fn;
|
||||
if (last > 0 && typeof arguments[last] === "function") {
|
||||
fn = arguments[last];
|
||||
if (!false) {
|
||||
if (last <= 8 && canEvaluate) {
|
||||
var ret = new Promise(INTERNAL);
|
||||
ret._captureStackTrace();
|
||||
var HolderClass = holderClasses[last - 1];
|
||||
var holder = new HolderClass(fn);
|
||||
var callbacks = thenCallbacks;
|
||||
|
||||
for (var i = 0; i < last; ++i) {
|
||||
var maybePromise = tryConvertToPromise(arguments[i], ret);
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise = maybePromise._target();
|
||||
var bitField = maybePromise._bitField;
|
||||
;
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
maybePromise._then(callbacks[i], reject,
|
||||
undefined, ret, holder);
|
||||
promiseSetters[i](maybePromise, holder);
|
||||
holder.asyncNeeded = false;
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
callbacks[i].call(ret,
|
||||
maybePromise._value(), holder);
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
ret._reject(maybePromise._reason());
|
||||
} else {
|
||||
ret._cancel();
|
||||
}
|
||||
} else {
|
||||
callbacks[i].call(ret, maybePromise, holder);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret._isFateSealed()) {
|
||||
if (holder.asyncNeeded) {
|
||||
var context = Promise._getContext();
|
||||
holder.fn = util.contextBind(context, holder.fn);
|
||||
}
|
||||
ret._setAsyncGuaranteed();
|
||||
ret._setOnCancel(holder);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i ];};
|
||||
if (fn) args.pop();
|
||||
var ret = new PromiseArray(args).promise();
|
||||
return fn !== undefined ? ret.spread(fn) : ret;
|
||||
};
|
||||
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
import { RequestHeaders } from "./RequestHeaders";
|
||||
import { RequestMethod } from "./RequestMethod";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
import { Url } from "./Url";
|
||||
/**
|
||||
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
|
||||
* as well as the method property.
|
||||
*/
|
||||
export type EndpointDefaults = RequestParameters & {
|
||||
baseUrl: Url;
|
||||
method: RequestMethod;
|
||||
url?: Url;
|
||||
headers: RequestHeaders & {
|
||||
accept: string;
|
||||
"user-agent": string;
|
||||
};
|
||||
mediaType: {
|
||||
format: string;
|
||||
previews: string[];
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import { EmptyError } from '../util/EmptyError';
|
||||
import { filter } from './filter';
|
||||
import { take } from './take';
|
||||
import { defaultIfEmpty } from './defaultIfEmpty';
|
||||
import { throwIfEmpty } from './throwIfEmpty';
|
||||
import { identity } from '../util/identity';
|
||||
export function first(predicate, defaultValue) {
|
||||
var hasDefaultValue = arguments.length >= 2;
|
||||
return function (source) {
|
||||
return source.pipe(predicate ? filter(function (v, i) { return predicate(v, i, source); }) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function () { return new EmptyError(); }));
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=first.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ignoreElements.js","sourceRoot":"","sources":["../../../../src/internal/operators/ignoreElements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAqCpC,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ColdObservable = void 0;
|
||||
var Observable_1 = require("../Observable");
|
||||
var Subscription_1 = require("../Subscription");
|
||||
var SubscriptionLoggable_1 = require("./SubscriptionLoggable");
|
||||
var applyMixins_1 = require("../util/applyMixins");
|
||||
var Notification_1 = require("../Notification");
|
||||
var ColdObservable = (function (_super) {
|
||||
__extends(ColdObservable, _super);
|
||||
function ColdObservable(messages, scheduler) {
|
||||
var _this = _super.call(this, function (subscriber) {
|
||||
var observable = this;
|
||||
var index = observable.logSubscribedFrame();
|
||||
var subscription = new Subscription_1.Subscription();
|
||||
subscription.add(new Subscription_1.Subscription(function () {
|
||||
observable.logUnsubscribedFrame(index);
|
||||
}));
|
||||
observable.scheduleMessages(subscriber);
|
||||
return subscription;
|
||||
}) || this;
|
||||
_this.messages = messages;
|
||||
_this.subscriptions = [];
|
||||
_this.scheduler = scheduler;
|
||||
return _this;
|
||||
}
|
||||
ColdObservable.prototype.scheduleMessages = function (subscriber) {
|
||||
var messagesLength = this.messages.length;
|
||||
for (var i = 0; i < messagesLength; i++) {
|
||||
var message = this.messages[i];
|
||||
subscriber.add(this.scheduler.schedule(function (state) {
|
||||
var _a = state, notification = _a.message.notification, destination = _a.subscriber;
|
||||
Notification_1.observeNotification(notification, destination);
|
||||
}, message.frame, { message: message, subscriber: subscriber }));
|
||||
}
|
||||
};
|
||||
return ColdObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.ColdObservable = ColdObservable;
|
||||
applyMixins_1.applyMixins(ColdObservable, [SubscriptionLoggable_1.SubscriptionLoggable]);
|
||||
//# sourceMappingURL=ColdObservable.js.map
|
||||
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var isNaN = require('../../helpers/isNaN');
|
||||
|
||||
var Type = require('../Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-numeric-types-number-remainder
|
||||
|
||||
module.exports = function NumberRemainder(n, d) {
|
||||
if (Type(n) !== 'Number' || Type(d) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers');
|
||||
}
|
||||
|
||||
// If either operand is NaN, the result is NaN.
|
||||
// If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
|
||||
if (isNaN(n) || isNaN(d) || !isFinite(n) || d === 0) {
|
||||
return NaN;
|
||||
}
|
||||
|
||||
// If the dividend is finite and the divisor is an infinity, the result equals the dividend.
|
||||
// If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend.
|
||||
if (!isFinite(d) || (n === 0 && d !== 0)) {
|
||||
return n;
|
||||
}
|
||||
|
||||
// In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved…
|
||||
return n % d;
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
import { __read, __spreadArray } from "tslib";
|
||||
export var timeoutProvider = {
|
||||
setTimeout: function (handler, timeout) {
|
||||
var args = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
args[_i - 2] = arguments[_i];
|
||||
}
|
||||
var delegate = timeoutProvider.delegate;
|
||||
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
||||
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
||||
}
|
||||
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
||||
},
|
||||
clearTimeout: function (handle) {
|
||||
var delegate = timeoutProvider.delegate;
|
||||
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
||||
},
|
||||
delegate: undefined,
|
||||
};
|
||||
//# sourceMappingURL=timeoutProvider.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import Wrapper from './shared/Wrapper';
|
||||
import { INode } from '../../nodes/interfaces';
|
||||
import Renderer from '../Renderer';
|
||||
import Block from '../Block';
|
||||
import { Identifier } from 'estree';
|
||||
export default class FragmentWrapper {
|
||||
nodes: Wrapper[];
|
||||
constructor(renderer: Renderer, block: Block, nodes: INode[], parent: Wrapper, strip_whitespace: boolean, next_sibling: Wrapper);
|
||||
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, ensurePlainObject = require("../../plain-object/ensure");
|
||||
|
||||
describe("plain-object/ensure", function () {
|
||||
it("Should return input value", function () {
|
||||
var value = {};
|
||||
assert.equal(ensurePlainObject(value), value);
|
||||
});
|
||||
it("Should crash on invalid value", function () {
|
||||
try {
|
||||
ensurePlainObject(null);
|
||||
throw new Error("Unexpected");
|
||||
} catch (error) {
|
||||
assert.equal(error.name, "TypeError");
|
||||
assert(error.message.includes("is not a plain object"));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
const path = require('path');
|
||||
const resolve = require('resolve');
|
||||
|
||||
module.exports = function (cwd, moduleName, register) {
|
||||
try {
|
||||
var modulePath = resolve.sync(moduleName, {basedir: cwd});
|
||||
var result = require(modulePath);
|
||||
if (typeof register === 'function') {
|
||||
register(result);
|
||||
}
|
||||
} catch (e) {
|
||||
result = e;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"es-set-tostringtag","version":"2.0.1","files":{".eslintrc":{"checkedAt":1678883671616,"integrity":"sha512-avVQBvEjZuAALik4d1n8WoPRiLLkkHk3sctxqfukG6S1H8uf6yDPtpr43KHC/m5Kvg+S4XoW8YPm8lL0Q1Uecg==","mode":420,"size":138},"index.js":{"checkedAt":1678883671616,"integrity":"sha512-mYfti6xjNONfhELTQhiy0NNO7s05ZhakmrsH514URaP+Bjza5V1zCLvVj85xird3KIsZH3f3tNiK3RScfu5GlA==","mode":420,"size":738},"LICENSE":{"checkedAt":1678883671616,"integrity":"sha512-ejuNvD9EeEm1WqD7r4RVoNKMvgN3tSGqs/oFxTWPMZVEsraknZlROcwbuqU+QaHPXa2muiQzVNyGdLU811D0lA==","mode":420,"size":1073},"test/index.js":{"checkedAt":1678883671616,"integrity":"sha512-tAYtGeFHykgs1k6+z6w2WRxw6hP8mg6rf5QWhtHbixtuS9BYOAvY3IBMfyiG4ZX3rsiGqqUo49guG+CYu9bJgw==","mode":420,"size":1440},"package.json":{"checkedAt":1678883671616,"integrity":"sha512-qMM/FwEpDmAfXJm8lRlGoH/3FOuzQn0Nisb1Iw7+MqR9VNAAYRzlBq3BZ2Oc3MQmRxYv7r8qmIKMoSWMfbhsrA==","mode":420,"size":1885},"CHANGELOG.md":{"checkedAt":1678883671616,"integrity":"sha512-AVFEWTuru1klX3naC8L1rpscWwBaK7fvisICMOW4XmbAY3e55dq8E9DPSuUIArxRRBS1ytyNNXbZoGNMOU8GGQ==","mode":420,"size":1767},"README.md":{"checkedAt":1678883671616,"integrity":"sha512-E0O0dkQ1oHnEEpUwAIXbHj2pSfAxa4N02S7hgS7FwvLxW/UHwx6gpDnOF/LpBi2iDOcgESwl+zmBsH7KKK9uwA==","mode":420,"size":1867}}}
|
||||
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
flagEnabled: ()=>flagEnabled,
|
||||
issueFlagNotices: ()=>issueFlagNotices,
|
||||
default: ()=>_default
|
||||
});
|
||||
const _picocolors = /*#__PURE__*/ _interopRequireDefault(require("picocolors"));
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("./util/log"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let defaults = {
|
||||
optimizeUniversalDefaults: false,
|
||||
generalizedModifiers: true
|
||||
};
|
||||
let featureFlags = {
|
||||
future: [
|
||||
"hoverOnlyWhenSupported",
|
||||
"respectDefaultRingColorOpacity",
|
||||
"disableColorOpacityUtilitiesByDefault",
|
||||
"relativeContentPathsByDefault"
|
||||
],
|
||||
experimental: [
|
||||
"optimizeUniversalDefaults",
|
||||
"generalizedModifiers"
|
||||
]
|
||||
};
|
||||
function flagEnabled(config, flag) {
|
||||
if (featureFlags.future.includes(flag)) {
|
||||
var _config_future;
|
||||
var _config_future_flag, _ref;
|
||||
return config.future === "all" || ((_ref = (_config_future_flag = config === null || config === void 0 ? void 0 : (_config_future = config.future) === null || _config_future === void 0 ? void 0 : _config_future[flag]) !== null && _config_future_flag !== void 0 ? _config_future_flag : defaults[flag]) !== null && _ref !== void 0 ? _ref : false);
|
||||
}
|
||||
if (featureFlags.experimental.includes(flag)) {
|
||||
var _config_experimental;
|
||||
var _config_experimental_flag, _ref1;
|
||||
return config.experimental === "all" || ((_ref1 = (_config_experimental_flag = config === null || config === void 0 ? void 0 : (_config_experimental = config.experimental) === null || _config_experimental === void 0 ? void 0 : _config_experimental[flag]) !== null && _config_experimental_flag !== void 0 ? _config_experimental_flag : defaults[flag]) !== null && _ref1 !== void 0 ? _ref1 : false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function experimentalFlagsEnabled(config) {
|
||||
if (config.experimental === "all") {
|
||||
return featureFlags.experimental;
|
||||
}
|
||||
var _config_experimental;
|
||||
return Object.keys((_config_experimental = config === null || config === void 0 ? void 0 : config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
|
||||
}
|
||||
function issueFlagNotices(config) {
|
||||
if (process.env.JEST_WORKER_ID !== undefined) {
|
||||
return;
|
||||
}
|
||||
if (experimentalFlagsEnabled(config).length > 0) {
|
||||
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
|
||||
_log.default.warn("experimental-flags-enabled", [
|
||||
`You have enabled experimental features: ${changes}`,
|
||||
"Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time."
|
||||
]);
|
||||
}
|
||||
}
|
||||
const _default = featureFlags;
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
didYouMean.js copyright (c) 2013-2014 Dave Porter.
|
||||
|
||||
[Available on GitHub](https://github.com/dcporter/didyoumean.js).
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License
|
||||
[here](http://www.apache.org/licenses/LICENSE-2.0).
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
(function(){"use strict";function e(t,r,i){if(!t)return null;if(!e.caseSensitive){t=t.toLowerCase()}var s=e.threshold===null?null:e.threshold*t.length,o=e.thresholdAbsolute,u;if(s!==null&&o!==null)u=Math.min(s,o);else if(s!==null)u=s;else if(o!==null)u=o;else u=null;var a,f,l,c,h,p=r.length;for(h=0;h<p;h++){f=r[h];if(i){f=f[i]}if(!f){continue}if(!e.caseSensitive){l=f.toLowerCase()}else{l=f}c=n(t,l,u);if(u===null||c<u){u=c;if(i&&e.returnWinningObject)a=r[h];else a=f;if(e.returnFirstMatch)return a}}return a||e.nullResultValue}function n(e,n,r){r=r||r===0?r:t;var i=e.length;var s=n.length;if(i===0)return Math.min(r+1,s);if(s===0)return Math.min(r+1,i);if(Math.abs(i-s)>r)return r+1;var o=[],u,a,f,l,c;for(u=0;u<=s;u++){o[u]=[u]}for(a=0;a<=i;a++){o[0][a]=a}for(u=1;u<=s;u++){f=t;l=1;if(u>r)l=u-r;c=s+1;if(c>r+u)c=r+u;for(a=1;a<=i;a++){if(a<l||a>c){o[u][a]=r+1}else{if(n.charAt(u-1)===e.charAt(a-1)){o[u][a]=o[u-1][a-1]}else{o[u][a]=Math.min(o[u-1][a-1]+1,Math.min(o[u][a-1]+1,o[u-1][a]+1))}}if(o[u][a]<f)f=o[u][a]}if(f>r)return r+1}return o[s][i]}e.threshold=.4;e.thresholdAbsolute=20;e.caseSensitive=false;e.nullResultValue=null;e.returnWinningObject=null;e.returnFirstMatch=false;if(typeof module!=="undefined"&&module.exports){module.exports=e}else{window.didYouMean=e}var t=Math.pow(2,32)-1})();
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Buffer } from 'node:buffer';
|
||||
import { promisify } from 'node:util';
|
||||
import is from '@sindresorhus/is';
|
||||
import isFormData from './is-form-data.js';
|
||||
export default async function getBodySize(body, headers) {
|
||||
if (headers && 'content-length' in headers) {
|
||||
return Number(headers['content-length']);
|
||||
}
|
||||
if (!body) {
|
||||
return 0;
|
||||
}
|
||||
if (is.string(body)) {
|
||||
return Buffer.byteLength(body);
|
||||
}
|
||||
if (is.buffer(body)) {
|
||||
return body.length;
|
||||
}
|
||||
if (isFormData(body)) {
|
||||
return promisify(body.getLength.bind(body))();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// @ts-check
|
||||
/** @typedef { import('estree').BaseNode} BaseNode */
|
||||
|
||||
/** @typedef {{
|
||||
skip: () => void;
|
||||
remove: () => void;
|
||||
replace: (node: BaseNode) => void;
|
||||
}} WalkerContext */
|
||||
|
||||
export class WalkerBase {
|
||||
constructor() {
|
||||
/** @type {boolean} */
|
||||
this.should_skip = false;
|
||||
|
||||
/** @type {boolean} */
|
||||
this.should_remove = false;
|
||||
|
||||
/** @type {BaseNode | null} */
|
||||
this.replacement = null;
|
||||
|
||||
/** @type {WalkerContext} */
|
||||
this.context = {
|
||||
skip: () => (this.should_skip = true),
|
||||
remove: () => (this.should_remove = true),
|
||||
replace: (node) => (this.replacement = node)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {any} parent
|
||||
* @param {string} prop
|
||||
* @param {number} index
|
||||
* @param {BaseNode} node
|
||||
*/
|
||||
replace(parent, prop, index, node) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop][index] = node;
|
||||
} else {
|
||||
parent[prop] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {any} parent
|
||||
* @param {string} prop
|
||||
* @param {number} index
|
||||
*/
|
||||
remove(parent, prop, index) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop].splice(index, 1);
|
||||
} else {
|
||||
delete parent[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { noop } from '../util/noop';
|
||||
export var NEVER = new Observable(noop);
|
||||
export function never() {
|
||||
return NEVER;
|
||||
}
|
||||
//# sourceMappingURL=never.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
import { Task } from '../managers/tasks';
|
||||
import ReaderStream from '../readers/stream';
|
||||
import { ReaderOptions } from '../types';
|
||||
import Provider from './provider';
|
||||
export default class ProviderStream extends Provider<Readable> {
|
||||
protected _reader: ReaderStream;
|
||||
read(task: Task): Readable;
|
||||
api(root: string, task: Task, options: ReaderOptions): Readable;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
var argv = require('../')(process.argv.slice(2));
|
||||
console.log(argv);
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"onErrorResumeNextWith.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/onErrorResumeNextWith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIlE,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EACnE,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,GACpC,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtC,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EACnE,GAAG,OAAO,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,GACvC,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAsFtC;;GAEG;AACH,eAAO,MAAM,iBAAiB,8BAAwB,CAAC"}
|
||||
@@ -0,0 +1,36 @@
|
||||
# DOMException
|
||||
An implementation of the DOMException class from NodeJS
|
||||
|
||||
This package implements the [`DOMException`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException) class, from NodeJS itself. (including the legacy codes)
|
||||
NodeJS has DOMException built in, but it's not globally available, and you can't require/import it from somewhere.
|
||||
|
||||
The only possible way is to use some web-ish tools that have been introduced into NodeJS that throws an error and catch the constructor.
|
||||
This way you will have the same class that NodeJS has and you can check if the error is a instance of DOMException.
|
||||
The instanceof check would not have worked with a custom class such as the DOMException provided by domenic which also is much larger in size.
|
||||
|
||||
```js
|
||||
import DOMException from 'node-domexception'
|
||||
import { MessageChannel } from 'worker_threads'
|
||||
|
||||
async function hello() {
|
||||
const port = new MessageChannel().port1
|
||||
const ab = new ArrayBuffer()
|
||||
port.postMessage(ab, [ab, ab])
|
||||
}
|
||||
|
||||
hello().catch(err => {
|
||||
console.assert(err.name === 'DataCloneError')
|
||||
console.assert(err.code === 25)
|
||||
console.assert(err instanceof DOMException)
|
||||
})
|
||||
|
||||
const e1 = new DOMException('Something went wrong', 'BadThingsError')
|
||||
console.assert(e1.name === 'BadThingsError')
|
||||
console.assert(e1.code === 0)
|
||||
|
||||
const e2 = new DOMException('Another exciting error message', 'NoModificationAllowedError')
|
||||
console.assert(e2.name === 'NoModificationAllowedError')
|
||||
console.assert(e2.code === 7)
|
||||
|
||||
console.assert(DOMException.INUSE_ATTRIBUTE_ERR === 10)
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
# `Math.floor10` _(ext/math/floor-10)_
|
||||
|
||||
Decimal floor
|
||||
|
||||
```javascript
|
||||
const floor10 = require("ext/math/floor-10");
|
||||
|
||||
floor10(55.59, -1); // 55.5
|
||||
floor10(59, 1); // 50
|
||||
```
|
||||
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (trim, t) {
|
||||
t.test('normal cases', function (st) {
|
||||
st.equal(trim(' \t\na \t\n'), 'a', 'strips whitespace off left and right sides');
|
||||
st.equal(trim('a'), 'a', 'noop when no whitespace');
|
||||
|
||||
var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
||||
st.equal(trim(allWhitespaceChars + 'a' + allWhitespaceChars), 'a', 'all expected whitespace chars are trimmed');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
// see https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/
|
||||
var mongolianVowelSeparator = '\u180E';
|
||||
var mvsIsWS = (/^\s$/).test('\u180E');
|
||||
t.test('unicode >= 4 && < 6.3', function (st) {
|
||||
st.equal(
|
||||
trim(mongolianVowelSeparator + 'a' + mongolianVowelSeparator),
|
||||
mvsIsWS ? 'a' : mongolianVowelSeparator + 'a' + mongolianVowelSeparator,
|
||||
'mongolian vowel separator is' + (mvsIsWS ? '' : ' not') + ' whitespace'
|
||||
);
|
||||
|
||||
st.equal(
|
||||
trim(mongolianVowelSeparator),
|
||||
mvsIsWS ? '' : mongolianVowelSeparator
|
||||
);
|
||||
st.equal(
|
||||
trim('_' + mongolianVowelSeparator),
|
||||
'_' + (mvsIsWS ? '' : mongolianVowelSeparator)
|
||||
);
|
||||
st.equal(
|
||||
trim(mongolianVowelSeparator + '_'),
|
||||
(mvsIsWS ? '' : mongolianVowelSeparator) + '_'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('zero-width spaces', function (st) {
|
||||
var zeroWidth = '\u200b';
|
||||
st.equal(trim(zeroWidth), zeroWidth, 'zero width space does not trim');
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,151 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var toPrimitive = require('../es6');
|
||||
var is = require('object-is');
|
||||
var forEach = require('foreach');
|
||||
var functionName = require('function.prototype.name');
|
||||
var debug = require('object-inspect');
|
||||
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var hasSymbolToPrimitive = hasSymbols && typeof Symbol.toPrimitive === 'symbol';
|
||||
|
||||
test('function properties', function (t) {
|
||||
t.equal(toPrimitive.length, 1, 'length is 1');
|
||||
t.equal(functionName(toPrimitive), 'ToPrimitive', 'name is ToPrimitive');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
var primitives = [null, undefined, true, false, 0, -0, 42, NaN, Infinity, -Infinity, '', 'abc'];
|
||||
|
||||
test('primitives', function (t) {
|
||||
forEach(primitives, function (i) {
|
||||
t.ok(is(toPrimitive(i), i), 'toPrimitive(' + debug(i) + ') returns the same value');
|
||||
t.ok(is(toPrimitive(i, String), i), 'toPrimitive(' + debug(i) + ', String) returns the same value');
|
||||
t.ok(is(toPrimitive(i, Number), i), 'toPrimitive(' + debug(i) + ', Number) returns the same value');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Symbols', { skip: !hasSymbols }, function (t) {
|
||||
var symbols = [
|
||||
Symbol('foo'),
|
||||
Symbol.iterator,
|
||||
Symbol['for']('foo') // eslint-disable-line no-restricted-properties
|
||||
];
|
||||
forEach(symbols, function (sym) {
|
||||
t.equal(toPrimitive(sym), sym, 'toPrimitive(' + debug(sym) + ') returns the same value');
|
||||
t.equal(toPrimitive(sym, String), sym, 'toPrimitive(' + debug(sym) + ', String) returns the same value');
|
||||
t.equal(toPrimitive(sym, Number), sym, 'toPrimitive(' + debug(sym) + ', Number) returns the same value');
|
||||
});
|
||||
|
||||
var primitiveSym = Symbol('primitiveSym');
|
||||
var objectSym = Object(primitiveSym);
|
||||
t.equal(toPrimitive(objectSym), primitiveSym, 'toPrimitive(' + debug(objectSym) + ') returns ' + debug(primitiveSym));
|
||||
t.equal(toPrimitive(objectSym, String), primitiveSym, 'toPrimitive(' + debug(objectSym) + ', String) returns ' + debug(primitiveSym));
|
||||
t.equal(toPrimitive(objectSym, Number), primitiveSym, 'toPrimitive(' + debug(objectSym) + ', Number) returns ' + debug(primitiveSym));
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Arrays', function (t) {
|
||||
var arrays = [[], ['a', 'b'], [1, 2]];
|
||||
forEach(arrays, function (arr) {
|
||||
t.equal(toPrimitive(arr), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array');
|
||||
t.equal(toPrimitive(arr, String), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array');
|
||||
t.equal(toPrimitive(arr, Number), String(arr), 'toPrimitive(' + debug(arr) + ') returns the string version of the array');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Dates', function (t) {
|
||||
var dates = [new Date(), new Date(0), new Date(NaN)];
|
||||
forEach(dates, function (date) {
|
||||
t.equal(toPrimitive(date), String(date), 'toPrimitive(' + debug(date) + ') returns the string version of the date');
|
||||
t.equal(toPrimitive(date, String), String(date), 'toPrimitive(' + debug(date) + ') returns the string version of the date');
|
||||
t.ok(is(toPrimitive(date, Number), Number(date)), 'toPrimitive(' + debug(date) + ') returns the number version of the date');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } };
|
||||
var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } };
|
||||
var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } };
|
||||
var coercibleFnObject = {
|
||||
valueOf: function () { return function valueOfFn() {}; },
|
||||
toString: function () { return 42; }
|
||||
};
|
||||
var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } };
|
||||
var uncoercibleFnObject = {
|
||||
valueOf: function () { return function valueOfFn() {}; },
|
||||
toString: function () { return function toStrFn() {}; }
|
||||
};
|
||||
|
||||
test('Objects', function (t) {
|
||||
t.equal(toPrimitive(coercibleObject), coercibleObject.valueOf(), 'coercibleObject with no hint coerces to valueOf');
|
||||
t.equal(toPrimitive(coercibleObject, Number), coercibleObject.valueOf(), 'coercibleObject with hint Number coerces to valueOf');
|
||||
t.equal(toPrimitive(coercibleObject, String), coercibleObject.toString(), 'coercibleObject with hint String coerces to non-stringified toString');
|
||||
|
||||
t.equal(toPrimitive(coercibleFnObject), coercibleFnObject.toString(), 'coercibleFnObject coerces to non-stringified toString');
|
||||
t.equal(toPrimitive(coercibleFnObject, Number), coercibleFnObject.toString(), 'coercibleFnObject with hint Number coerces to non-stringified toString');
|
||||
t.equal(toPrimitive(coercibleFnObject, String), coercibleFnObject.toString(), 'coercibleFnObject with hint String coerces to non-stringified toString');
|
||||
|
||||
t.equal(toPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString');
|
||||
t.equal(toPrimitive({}, Number), '[object Object]', '{} with hint Number coerces to Object#toString');
|
||||
t.equal(toPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString');
|
||||
|
||||
t.equal(toPrimitive(toStringOnlyObject), toStringOnlyObject.toString(), 'toStringOnlyObject returns non-stringified toString');
|
||||
t.equal(toPrimitive(toStringOnlyObject, Number), toStringOnlyObject.toString(), 'toStringOnlyObject with hint Number returns non-stringified toString');
|
||||
t.equal(toPrimitive(toStringOnlyObject, String), toStringOnlyObject.toString(), 'toStringOnlyObject with hint String returns non-stringified toString');
|
||||
|
||||
t.equal(toPrimitive(valueOfOnlyObject), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject returns valueOf');
|
||||
t.equal(toPrimitive(valueOfOnlyObject, Number), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint Number returns valueOf');
|
||||
t.equal(toPrimitive(valueOfOnlyObject, String), valueOfOnlyObject.valueOf(), 'valueOfOnlyObject with hint String returns non-stringified valueOf');
|
||||
|
||||
t.test('Symbol.toPrimitive', { skip: !hasSymbolToPrimitive }, function (st) {
|
||||
var overriddenObject = { toString: st.fail, valueOf: st.fail };
|
||||
overriddenObject[Symbol.toPrimitive] = function (hint) { return String(hint); };
|
||||
|
||||
st.equal(toPrimitive(overriddenObject), 'default', 'object with Symbol.toPrimitive + no hint invokes that');
|
||||
st.equal(toPrimitive(overriddenObject, Number), 'number', 'object with Symbol.toPrimitive + hint Number invokes that');
|
||||
st.equal(toPrimitive(overriddenObject, String), 'string', 'object with Symbol.toPrimitive + hint String invokes that');
|
||||
|
||||
var nullToPrimitive = { toString: coercibleObject.toString, valueOf: coercibleObject.valueOf };
|
||||
nullToPrimitive[Symbol.toPrimitive] = null;
|
||||
st.equal(toPrimitive(nullToPrimitive), toPrimitive(coercibleObject), 'object with no hint + null Symbol.toPrimitive ignores it');
|
||||
st.equal(toPrimitive(nullToPrimitive, Number), toPrimitive(coercibleObject, Number), 'object with hint Number + null Symbol.toPrimitive ignores it');
|
||||
st.equal(toPrimitive(nullToPrimitive, String), toPrimitive(coercibleObject, String), 'object with hint String + null Symbol.toPrimitive ignores it');
|
||||
|
||||
st.test('exceptions', function (sst) {
|
||||
var nonFunctionToPrimitive = { toString: sst.fail, valueOf: sst.fail };
|
||||
nonFunctionToPrimitive[Symbol.toPrimitive] = {};
|
||||
sst['throws'](toPrimitive.bind(null, nonFunctionToPrimitive), TypeError, 'Symbol.toPrimitive returning a non-function throws');
|
||||
|
||||
var uncoercibleToPrimitive = { toString: sst.fail, valueOf: sst.fail };
|
||||
uncoercibleToPrimitive[Symbol.toPrimitive] = function (hint) {
|
||||
return { toString: function () { return hint; } };
|
||||
};
|
||||
sst['throws'](toPrimitive.bind(null, uncoercibleToPrimitive), TypeError, 'Symbol.toPrimitive returning an object throws');
|
||||
|
||||
var throwingToPrimitive = { toString: sst.fail, valueOf: sst.fail };
|
||||
throwingToPrimitive[Symbol.toPrimitive] = function (hint) { throw new RangeError(hint); };
|
||||
sst['throws'](toPrimitive.bind(null, throwingToPrimitive), RangeError, 'Symbol.toPrimitive throwing throws');
|
||||
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('exceptions', function (st) {
|
||||
st['throws'](toPrimitive.bind(null, uncoercibleObject), TypeError, 'uncoercibleObject throws a TypeError');
|
||||
st['throws'](toPrimitive.bind(null, uncoercibleObject, Number), TypeError, 'uncoercibleObject with hint Number throws a TypeError');
|
||||
st['throws'](toPrimitive.bind(null, uncoercibleObject, String), TypeError, 'uncoercibleObject with hint String throws a TypeError');
|
||||
|
||||
st['throws'](toPrimitive.bind(null, uncoercibleFnObject), TypeError, 'uncoercibleFnObject throws a TypeError');
|
||||
st['throws'](toPrimitive.bind(null, uncoercibleFnObject, Number), TypeError, 'uncoercibleFnObject with hint Number throws a TypeError');
|
||||
st['throws'](toPrimitive.bind(null, uncoercibleFnObject, String), TypeError, 'uncoercibleFnObject with hint String throws a TypeError');
|
||||
st.end();
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import inquirer from 'inquirer';
|
||||
|
||||
class Prompt {
|
||||
constructor({ container }) {
|
||||
this.createPrompt = (container.inquirer || inquirer).prompt;
|
||||
this.prompts = {};
|
||||
}
|
||||
|
||||
register(pluginPrompts, namespace = 'default') {
|
||||
this.prompts[namespace] = this.prompts[namespace] || {};
|
||||
Object.assign(this.prompts[namespace], pluginPrompts);
|
||||
}
|
||||
|
||||
async show({ enabled = true, prompt: promptName, namespace = 'default', task, context }) {
|
||||
if (!enabled) return false;
|
||||
|
||||
const prompt = this.prompts[namespace][promptName];
|
||||
const options = Object.assign({}, prompt, {
|
||||
name: promptName,
|
||||
message: prompt.message(context),
|
||||
choices: 'choices' in prompt && prompt.choices(context),
|
||||
transformer: 'transformer' in prompt && prompt.transformer(context)
|
||||
});
|
||||
|
||||
const answers = await this.createPrompt([options]);
|
||||
|
||||
const doExecute = prompt.type === 'confirm' ? answers[promptName] : true;
|
||||
|
||||
return doExecute && task ? await task(answers[promptName]) : false;
|
||||
}
|
||||
}
|
||||
|
||||
export default Prompt;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Symbol.observable or a string "@@observable". Used for interop
|
||||
*
|
||||
* @deprecated We will no longer be exporting this symbol in upcoming versions of RxJS.
|
||||
* Instead polyfill and use Symbol.observable directly *or* use https://www.npmjs.com/package/symbol-observable
|
||||
*/
|
||||
export declare const observable: string | symbol;
|
||||
//# sourceMappingURL=observable.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"depd","version":"2.0.0","files":{"package.json":{"checkedAt":1678883672270,"integrity":"sha512-e91yWby415qkF3fwPTo/iim2DC0lEEBy7bqf6+uBPhLveNMVc2N3At7N26qX2P7CY7xBO9J91mDe0X1kRFjLwg==","mode":420,"size":1335},"History.md":{"checkedAt":1678883672270,"integrity":"sha512-ubxQGDs2N/R4y7eLHYj9rHbCls3HPIgpYQrJnDFoI54kImyCaIRY7a1ZhyUlXkE/BbQt1/oaJfQbXUGtledwLQ==","mode":420,"size":2256},"LICENSE":{"checkedAt":1678883672272,"integrity":"sha512-F1WWYJyRdnoQHWsQUd6RVjaVuSJFtcS9CiukzCTvKPBIDqInWHjlZvwI0gPRglRffMfr+wiWbLprq+1REu3bvQ==","mode":420,"size":1094},"index.js":{"checkedAt":1678883672272,"integrity":"sha512-6hrZvPCac6EN0f2KZtqsEvh3JeFq0n577/bZ/ak3V5l2zV1+1kOcQSKxYXjD/99BDWx6VJGPlLyY+nlQrfO9VA==","mode":420,"size":10932},"lib/browser/index.js":{"checkedAt":1678883672272,"integrity":"sha512-WEiyjdqsGvldZY0RCujBjTCQRCBrBmxXVwXg+LdfSpGP5pLl+Qu6b+KxxO+DRMcJbE9+LOh/f7FTe1XgSJ11sw==","mode":420,"size":1512},"Readme.md":{"checkedAt":1678883672272,"integrity":"sha512-2bB1U8HF/FBXMtFDW4Gsy/5dFkco/Qx+oOF5WCvG9PudpwR+EZRo5kMZA92oVk1KJmCM36teL3NE0vVqJbAhrQ==","mode":420,"size":9988}}}
|
||||
@@ -0,0 +1,37 @@
|
||||
declare namespace ansiRegex {
|
||||
interface Options {
|
||||
/**
|
||||
Match only the first ANSI escape.
|
||||
|
||||
@default false
|
||||
*/
|
||||
onlyFirst: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Regular expression for matching ANSI escape codes.
|
||||
|
||||
@example
|
||||
```
|
||||
import ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||
//=> ['\u001B[4m', '\u001B[0m']
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||
//=> ['\u001B[4m']
|
||||
|
||||
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||
```
|
||||
*/
|
||||
declare function ansiRegex(options?: ansiRegex.Options): RegExp;
|
||||
|
||||
export = ansiRegex;
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "escalade",
|
||||
"version": "3.1.1",
|
||||
"repository": "lukeed/escalade",
|
||||
"description": "A tiny (183B to 210B) and fast utility to ascend parent directories",
|
||||
"module": "dist/index.mjs",
|
||||
"main": "dist/index.js",
|
||||
"types": "index.d.ts",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.js"
|
||||
},
|
||||
"./dist/index.js"
|
||||
],
|
||||
"./sync": [
|
||||
{
|
||||
"import": "./sync/index.mjs",
|
||||
"require": "./sync/index.js"
|
||||
},
|
||||
"./sync/index.js"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist",
|
||||
"sync"
|
||||
],
|
||||
"modes": {
|
||||
"sync": "src/sync.js",
|
||||
"default": "src/async.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "bundt",
|
||||
"pretest": "npm run build",
|
||||
"test": "uvu -r esm test -i fixtures"
|
||||
},
|
||||
"keywords": [
|
||||
"find",
|
||||
"parent",
|
||||
"parents",
|
||||
"directory",
|
||||
"search",
|
||||
"walk"
|
||||
],
|
||||
"devDependencies": {
|
||||
"bundt": "1.1.1",
|
||||
"esm": "3.2.25",
|
||||
"uvu": "0.3.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
declare const _boolean_attributes: readonly ["allowfullscreen", "allowpaymentrequest", "async", "autofocus", "autoplay", "checked", "controls", "default", "defer", "disabled", "formnovalidate", "hidden", "inert", "ismap", "itemscope", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "selected"];
|
||||
export declare type BooleanAttributes = typeof _boolean_attributes[number];
|
||||
/**
|
||||
* List of HTML boolean attributes (e.g. `<input disabled>`).
|
||||
* Source: https://html.spec.whatwg.org/multipage/indices.html
|
||||
*/
|
||||
export declare const boolean_attributes: Set<string>;
|
||||
export {};
|
||||
@@ -0,0 +1,46 @@
|
||||
var baseClone = require('./_baseClone'),
|
||||
baseMatches = require('./_baseMatches');
|
||||
|
||||
/** Used to compose bitmasks for cloning. */
|
||||
var CLONE_DEEP_FLAG = 1;
|
||||
|
||||
/**
|
||||
* Creates a function that performs a partial deep comparison between a given
|
||||
* object and `source`, returning `true` if the given object has equivalent
|
||||
* property values, else `false`.
|
||||
*
|
||||
* **Note:** The created function is equivalent to `_.isMatch` with `source`
|
||||
* partially applied.
|
||||
*
|
||||
* Partial comparisons will match empty array and empty object `source`
|
||||
* values against any array or object value, respectively. See `_.isEqual`
|
||||
* for a list of supported value comparisons.
|
||||
*
|
||||
* **Note:** Multiple values can be checked by combining several matchers
|
||||
* using `_.overSome`
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.0.0
|
||||
* @category Util
|
||||
* @param {Object} source The object of property values to match.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
* @example
|
||||
*
|
||||
* var objects = [
|
||||
* { 'a': 1, 'b': 2, 'c': 3 },
|
||||
* { 'a': 4, 'b': 5, 'c': 6 }
|
||||
* ];
|
||||
*
|
||||
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
||||
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
||||
*
|
||||
* // Checking for several possible values
|
||||
* _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
|
||||
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
||||
*/
|
||||
function matches(source) {
|
||||
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
||||
}
|
||||
|
||||
module.exports = matches;
|
||||
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var originalGetProto = GetIntrinsic('%Object.getPrototypeOf%', true);
|
||||
|
||||
var hasProto = require('has-proto')();
|
||||
|
||||
module.exports = originalGetProto || (
|
||||
hasProto
|
||||
? function (O) {
|
||||
return O.__proto__; // eslint-disable-line no-proto
|
||||
}
|
||||
: null
|
||||
);
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "detective",
|
||||
"description": "find all require() calls by walking the AST",
|
||||
"version": "5.2.1",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bin": "bin/detective.js",
|
||||
"dependencies": {
|
||||
"acorn-node": "^1.8.2",
|
||||
"defined": "^1.0.0",
|
||||
"minimist": "^1.2.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^10.7.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"keywords": [
|
||||
"analyze",
|
||||
"ast",
|
||||
"require",
|
||||
"source"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/browserify/detective.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"reportUnhandledError.js","sourceRoot":"","sources":["../../../../src/internal/util/reportUnhandledError.ts"],"names":[],"mappings":";;;AAAA,oCAAmC;AACnC,gEAA+D;AAW/D,SAAgB,oBAAoB,CAAC,GAAQ;IAC3C,iCAAe,CAAC,UAAU,CAAC;QACjB,IAAA,gBAAgB,GAAK,eAAM,iBAAX,CAAY;QACpC,IAAI,gBAAgB,EAAE;YAEpB,gBAAgB,CAAC,GAAG,CAAC,CAAC;SACvB;aAAM;YAEL,MAAM,GAAG,CAAC;SACX;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,oDAWC"}
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2017 Josh Glazebrook
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"slash","version":"3.0.0","files":{"license":{"checkedAt":1678883669272,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"index.d.ts":{"checkedAt":1678883669496,"integrity":"sha512-Xjgu8PhpYFf7LoDZjsyPyeVOKHjWKB5BEXy4NwAtJ0yI4yOI/zF3aK6tPHcyInCsOznbUJlMut7Wgm1SQnWyJg==","mode":420,"size":621},"index.js":{"checkedAt":1678883669496,"integrity":"sha512-EJWeUJkVqnFUxQODDm8mHzcH0rT74BxeYzJ/z8vnFSzC/nL+oK1uSMfmrREbpDRcNzrqfRzPzduEkO0Hd8OAgA==","mode":420,"size":289},"package.json":{"checkedAt":1678883669496,"integrity":"sha512-ew28LW6A69rTZ4wsbFXyoYTtdKwfkKphLsAtC2/xXoPqnpuiEyQjk0JWowK6DaoMQLYoNfvmBZWmFqB2DNQZRA==","mode":420,"size":576},"readme.md":{"checkedAt":1678883669496,"integrity":"sha512-UgH8SZd+Ppu8/rFSZfkosHC37hDlV0yuHL0Plc6Eg46sEzlu36DAtQrBTNRgKFOdgmiA2yylN0dhVMiRXepqfA==","mode":420,"size":912}}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F CC","132":"A B"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB FC","2":"DC tB EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"I v"},E:{"1":"J D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e qB AC TC rB","2":"F B PC QC RC SC"},G:{"1":"E WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC"},H:{"2":"oC"},I:{"1":"tB I f sC BC tC uC","2":"pC qC rC"},J:{"1":"A","2":"D"},K:{"1":"C h qB AC rB","2":"A B"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"FileReader API"};
|
||||
@@ -0,0 +1,33 @@
|
||||
import * as OctokitTypes from "@octokit/types";
|
||||
export type AnyResponse = OctokitTypes.OctokitResponse<any>;
|
||||
export type StrategyInterface = OctokitTypes.StrategyInterface<[
|
||||
Token
|
||||
], [
|
||||
], Authentication>;
|
||||
export type EndpointDefaults = OctokitTypes.EndpointDefaults;
|
||||
export type EndpointOptions = OctokitTypes.EndpointOptions;
|
||||
export type RequestParameters = OctokitTypes.RequestParameters;
|
||||
export type RequestInterface = OctokitTypes.RequestInterface;
|
||||
export type Route = OctokitTypes.Route;
|
||||
export type Token = string;
|
||||
export type OAuthTokenAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "oauth";
|
||||
token: Token;
|
||||
};
|
||||
export type InstallationTokenAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "installation";
|
||||
token: Token;
|
||||
};
|
||||
export type AppAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "app";
|
||||
token: Token;
|
||||
};
|
||||
export type UserToServerAuthentication = {
|
||||
type: "token";
|
||||
tokenType: "user-to-server";
|
||||
token: Token;
|
||||
};
|
||||
export type Authentication = OAuthTokenAuthentication | InstallationTokenAuthentication | AppAuthentication | UserToServerAuthentication;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SubscriptionLog.js","sourceRoot":"","sources":["../../../../src/internal/testing/SubscriptionLog.ts"],"names":[],"mappings":";;;AAAA;IACE,yBAAmB,eAAuB,EACvB,iBAAoC;QAApC,kCAAA,EAAA,4BAAoC;QADpC,oBAAe,GAAf,eAAe,CAAQ;QACvB,sBAAiB,GAAjB,iBAAiB,CAAmB;IACvD,CAAC;IACH,sBAAC;AAAD,CAAC,AAJD,IAIC;AAJY,0CAAe"}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').any;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('setWith', require('../setWith'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,325 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://codecov.io/gh/chalk/chalk)
|
||||
[](https://www.npmjs.com/package/chalk?activeTab=dependents)
|
||||
[](https://www.npmjs.com/package/chalk)
|
||||
[](https://repl.it/github/chalk/chalk)
|
||||
|
||||

|
||||
|
||||
<br>
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<p>
|
||||
<sup>
|
||||
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a>
|
||||
</sup>
|
||||
</p>
|
||||
<sup>Special thanks to:</sup>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://standardresume.co/tech">
|
||||
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160">
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://retool.com/?utm_campaign=sindresorhus">
|
||||
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230">
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://strapi.io/?ref=sindresorhus">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/strapi-logo-white-bg.png" width="220" alt="Strapi">
|
||||
</div>
|
||||
<b>Strapi is the leading open-source headless CMS.</b>
|
||||
<div>
|
||||
<sup>It’s 100% JavaScript, fully customizable, and developer-first.</sup>
|
||||
</div>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://www.stackaid.us/?utm_campaign=sindre">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/stackaid-logo.png" width="230" alt="StackAid">
|
||||
</div>
|
||||
<b>Fund your open source dependencies</b>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<br>
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- No dependencies
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~86,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 4, 2022
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install chalk
|
||||
```
|
||||
|
||||
**IMPORTANT:** Chalk 5 is ESM. If you want to use Chalk with TypeScript or a build tool, you will probably want to use Chalk 4 for now. [Read more.](https://github.com/chalk/chalk/releases/tag/v5.0.0)
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import chalk from 'chalk';
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
import chalk from 'chalk';
|
||||
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
import chalk from 'chalk';
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.hex('#FFA500'); // Orange color
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
import chalk from 'chalk';
|
||||
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.level
|
||||
|
||||
Specifies the level of color support.
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
import {Chalk} from 'chalk';
|
||||
|
||||
const customChalk = new Chalk({level: 0});
|
||||
```
|
||||
|
||||
| Level | Description |
|
||||
| :---: | :--- |
|
||||
| `0` | All colors disabled |
|
||||
| `1` | Basic color support (16 colors) |
|
||||
| `2` | 256 color support |
|
||||
| `3` | Truecolor support (16 million colors) |
|
||||
|
||||
### supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
### chalkStderr and supportsColorStderr
|
||||
|
||||
`chalkStderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `supportsColor` apply to this too. `supportsColorStderr` is exposed for convenience.
|
||||
|
||||
### modifierNames, foregroundColorNames, backgroundColorNames, and colorNames
|
||||
|
||||
All supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`.
|
||||
|
||||
This can be useful if you wrap Chalk and need to validate input:
|
||||
|
||||
```js
|
||||
import {modifierNames, foregroundColorNames} from 'chalk';
|
||||
|
||||
console.log(modifierNames.includes('bold'));
|
||||
//=> true
|
||||
|
||||
console.log(foregroundColorNames.includes('pink'));
|
||||
//=> false
|
||||
```
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset` - Reset the current style.
|
||||
- `bold` - Make the text bold.
|
||||
- `dim` - Make the text have lower opacity.
|
||||
- `italic` - Make the text italic. *(Not widely supported)*
|
||||
- `underline` - Put a horizontal line below the text. *(Not widely supported)*
|
||||
- `overline` - Put a horizontal line above the text. *(Not widely supported)*
|
||||
- `inverse`- Invert background and foreground colors.
|
||||
- `hidden` - Print the text but make it invisible.
|
||||
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||
- `visible`- Print the text only when Chalk has a color level above zero. Can be useful for things that are purely cosmetic.
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://github.com/termstandard/colors) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `hex` for foreground colors and `bgHex` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||
|
||||
## Browser support
|
||||
|
||||
Since Chrome 69, ANSI escape codes are natively supported in the developer console.
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-template](https://github.com/chalk/chalk-template) - [Tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates) support for this module
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"J D E F CC","132":"A"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"I v J"},E:{"1":"J D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB","260":"IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e TC rB","2":"F B PC QC RC SC qB AC"},G:{"1":"E VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC","260":"BC"},H:{"1":"oC"},I:{"1":"I f sC BC tC uC","2":"tB pC qC rC"},J:{"1":"A","2":"D"},K:{"1":"C h rB","2":"A B qB AC"},L:{"1":"H"},M:{"1":"H"},N:{"132":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:6,C:"Typed Arrays"};
|
||||
@@ -0,0 +1,555 @@
|
||||
// Type definitions for postcss-selector-parser 2.2.3
|
||||
// Definitions by: Chris Eppstein <chris@eppsteins.net>
|
||||
|
||||
/*~ Note that ES6 modules cannot directly export callable functions.
|
||||
*~ This file should be imported using the CommonJS-style:
|
||||
*~ import x = require('someLibrary');
|
||||
*~
|
||||
*~ Refer to the documentation to understand common
|
||||
*~ workarounds for this limitation of ES6 modules.
|
||||
*/
|
||||
|
||||
/*~ This declaration specifies that the function
|
||||
*~ is the exported object from the file
|
||||
*/
|
||||
export = parser;
|
||||
|
||||
// A type that's T but not U.
|
||||
type Diff<T, U> = T extends U ? never : T;
|
||||
|
||||
// TODO: Conditional types in TS 1.8 will really clean this up.
|
||||
declare function parser(): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor: parser.AsyncProcessor<Transform>): parser.Processor<Transform, never>;
|
||||
declare function parser(processor: parser.AsyncProcessor<void>): parser.Processor<never, never>;
|
||||
declare function parser<Transform>(processor: parser.SyncProcessor<Transform>): parser.Processor<Transform>;
|
||||
declare function parser(processor: parser.SyncProcessor<void>): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor?: parser.SyncProcessor<Transform> | parser.AsyncProcessor<Transform>): parser.Processor<Transform>;
|
||||
|
||||
/*~ If you want to expose types from your module as well, you can
|
||||
*~ place them in this block. Often you will want to describe the
|
||||
*~ shape of the return type of the function; that type should
|
||||
*~ be declared in here, as this example shows.
|
||||
*/
|
||||
declare namespace parser {
|
||||
/* copied from postcss -- so we don't need to add a dependency */
|
||||
type ErrorOptions = {
|
||||
plugin?: string;
|
||||
word?: string;
|
||||
index?: number
|
||||
};
|
||||
/* the bits we use of postcss.Rule, copied from postcss -- so we don't need to add a dependency */
|
||||
type PostCSSRuleNode = {
|
||||
selector: string
|
||||
/**
|
||||
* @returns postcss.CssSyntaxError but it's a complex object, caller
|
||||
* should cast to it if they have a dependency on postcss.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
};
|
||||
/** Accepts a string */
|
||||
type Selectors = string | PostCSSRuleNode
|
||||
type ProcessorFn<ReturnType = void> = (root: parser.Root) => ReturnType;
|
||||
type SyncProcessor<Transform = void> = ProcessorFn<Transform>;
|
||||
type AsyncProcessor<Transform = void> = ProcessorFn<PromiseLike<Transform>>;
|
||||
|
||||
const TAG: "tag";
|
||||
const STRING: "string";
|
||||
const SELECTOR: "selector";
|
||||
const ROOT: "root";
|
||||
const PSEUDO: "pseudo";
|
||||
const NESTING: "nesting";
|
||||
const ID: "id";
|
||||
const COMMENT: "comment";
|
||||
const COMBINATOR: "combinator";
|
||||
const CLASS: "class";
|
||||
const ATTRIBUTE: "attribute";
|
||||
const UNIVERSAL: "universal";
|
||||
|
||||
interface NodeTypes {
|
||||
tag: Tag,
|
||||
string: String,
|
||||
selector: Selector,
|
||||
root: Root,
|
||||
pseudo: Pseudo,
|
||||
nesting: Nesting,
|
||||
id: Identifier,
|
||||
comment: Comment,
|
||||
combinator: Combinator,
|
||||
class: ClassName,
|
||||
attribute: Attribute,
|
||||
universal: Universal
|
||||
}
|
||||
|
||||
type Node = NodeTypes[keyof NodeTypes];
|
||||
|
||||
function isNode(node: any): node is Node;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Preserve whitespace when true. Default: false;
|
||||
*/
|
||||
lossless: boolean;
|
||||
/**
|
||||
* When true and a postcss.Rule is passed, set the result of
|
||||
* processing back onto the rule when done. Default: false.
|
||||
*/
|
||||
updateSelector: boolean;
|
||||
}
|
||||
class Processor<
|
||||
TransformType = never,
|
||||
SyncSelectorsType extends Selectors | never = Selectors
|
||||
> {
|
||||
res: Root;
|
||||
readonly result: String;
|
||||
ast(selectors: Selectors, options?: Partial<Options>): Promise<Root>;
|
||||
astSync(selectors: SyncSelectorsType, options?: Partial<Options>): Root;
|
||||
transform(selectors: Selectors, options?: Partial<Options>): Promise<TransformType>;
|
||||
transformSync(selectors: SyncSelectorsType, options?: Partial<Options>): TransformType;
|
||||
process(selectors: Selectors, options?: Partial<Options>): Promise<string>;
|
||||
processSync(selectors: SyncSelectorsType, options?: Partial<Options>): string;
|
||||
}
|
||||
interface ParserOptions {
|
||||
css: string;
|
||||
error: (message: string, options: ErrorOptions) => Error;
|
||||
options: Options;
|
||||
}
|
||||
class Parser {
|
||||
input: ParserOptions;
|
||||
lossy: boolean;
|
||||
position: number;
|
||||
root: Root;
|
||||
selectors: string;
|
||||
current: Selector;
|
||||
constructor(input: ParserOptions);
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): void;
|
||||
}
|
||||
interface NodeSource {
|
||||
start?: {
|
||||
line: number,
|
||||
column: number
|
||||
},
|
||||
end?: {
|
||||
line: number,
|
||||
column: number
|
||||
}
|
||||
}
|
||||
interface SpaceAround {
|
||||
before: string;
|
||||
after: string;
|
||||
}
|
||||
interface Spaces extends SpaceAround {
|
||||
[spaceType: string]: string | Partial<SpaceAround> | undefined;
|
||||
}
|
||||
interface NodeOptions<Value = string> {
|
||||
value: Value;
|
||||
spaces?: Partial<Spaces>;
|
||||
source?: NodeSource;
|
||||
sourceIndex?: number;
|
||||
}
|
||||
interface Base<
|
||||
Value extends string | undefined = string,
|
||||
ParentType extends Container | undefined = Container | undefined
|
||||
> {
|
||||
type: keyof NodeTypes;
|
||||
parent: ParentType;
|
||||
value: Value;
|
||||
spaces: Spaces;
|
||||
source?: NodeSource;
|
||||
sourceIndex: number;
|
||||
rawSpaceBefore: string;
|
||||
rawSpaceAfter: string;
|
||||
remove(): Node;
|
||||
replaceWith(...nodes: Node[]): Node;
|
||||
next(): Node;
|
||||
prev(): Node;
|
||||
clone(opts: {[override: string]:any}): Node;
|
||||
/**
|
||||
* Return whether this node includes the character at the position of the given line and column.
|
||||
* Returns undefined if the nodes lack sufficient source metadata to determine the position.
|
||||
* @param line 1-index based line number relative to the start of the selector.
|
||||
* @param column 1-index based column number relative to the start of the selector.
|
||||
*/
|
||||
isAtPosition(line: number, column: number): boolean | undefined;
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css,
|
||||
* this allows the escaped value to be specified directly, allowing illegal characters to be
|
||||
* directly inserted into css output.
|
||||
* @param name the property to set
|
||||
* @param value the unescaped value of the property
|
||||
* @param valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
setPropertyAndEscape(name: string, value: any, valueEscaped: string): void;
|
||||
/**
|
||||
* When you want a value to passed through to CSS directly. This method
|
||||
* deletes the corresponding raw value causing the stringifier to fallback
|
||||
* to the unescaped value.
|
||||
* @param name the property to set.
|
||||
* @param value The value that is both escaped and unescaped.
|
||||
*/
|
||||
setPropertyWithoutEscape(name: string, value: any): void;
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows non standard syntax to be appended to an existing property
|
||||
* by specifying the escaped value. By specifying the escaped value,
|
||||
* illegal characters are allowed to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
appendToPropertyAndEscape(name: string, value: any, valueEscaped: string): void;
|
||||
toString(): string;
|
||||
}
|
||||
interface ContainerOptions extends NodeOptions {
|
||||
nodes?: Array<Node>;
|
||||
}
|
||||
interface Container<
|
||||
Value extends string | undefined = string,
|
||||
Child extends Node = Node
|
||||
> extends Base<Value> {
|
||||
nodes: Array<Child>;
|
||||
append(selector: Selector): this;
|
||||
prepend(selector: Selector): this;
|
||||
at(index: number): Child;
|
||||
/**
|
||||
* Return the most specific node at the line and column number given.
|
||||
* The source location is based on the original parsed location, locations aren't
|
||||
* updated as selector nodes are mutated.
|
||||
*
|
||||
* Note that this location is relative to the location of the first character
|
||||
* of the selector, and not the location of the selector in the overall document
|
||||
* when used in conjunction with postcss.
|
||||
*
|
||||
* If not found, returns undefined.
|
||||
* @param line The line number of the node to find. (1-based index)
|
||||
* @param col The column number of the node to find. (1-based index)
|
||||
*/
|
||||
atPosition(line: number, column: number): Child;
|
||||
index(child: Child): number;
|
||||
readonly first: Child;
|
||||
readonly last: Child;
|
||||
readonly length: number;
|
||||
removeChild(child: Child): this;
|
||||
removeAll(): Container;
|
||||
empty(): Container;
|
||||
insertAfter(oldNode: Child, newNode: Child): this;
|
||||
insertBefore(oldNode: Child, newNode: Child): this;
|
||||
each(callback: (node: Child) => boolean | void): boolean | undefined;
|
||||
walk(
|
||||
callback: (node: Node) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkAttributes(
|
||||
callback: (node: Attribute) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkClasses(
|
||||
callback: (node: ClassName) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkCombinators(
|
||||
callback: (node: Combinator) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkComments(
|
||||
callback: (node: Comment) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkIds(
|
||||
callback: (node: Identifier) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkNesting(
|
||||
callback: (node: Nesting) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkPseudos(
|
||||
callback: (node: Pseudo) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkTags(callback: (node: Tag) => boolean | void): boolean | undefined;
|
||||
split(callback: (node: Child) => boolean): [Child[], Child[]];
|
||||
map<T>(callback: (node: Child) => T): T[];
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child
|
||||
): Child;
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child,
|
||||
initialValue: Child
|
||||
): Child;
|
||||
reduce<T>(
|
||||
callback: (
|
||||
previousValue: T,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => T,
|
||||
initialValue: T
|
||||
): T;
|
||||
every(callback: (node: Child) => boolean): boolean;
|
||||
some(callback: (node: Child) => boolean): boolean;
|
||||
filter(callback: (node: Child) => boolean): Child[];
|
||||
sort(callback: (nodeA: Child, nodeB: Child) => number): Child[];
|
||||
toString(): string;
|
||||
}
|
||||
function isContainer(node: any): node is Root | Selector | Pseudo;
|
||||
|
||||
interface NamespaceOptions<Value extends string | undefined = string> extends NodeOptions<Value> {
|
||||
namespace?: string | true;
|
||||
}
|
||||
interface Namespace<Value extends string | undefined = string> extends Base<Value> {
|
||||
/** alias for namespace */
|
||||
ns: string | true;
|
||||
/**
|
||||
* namespace prefix.
|
||||
*/
|
||||
namespace: string | true;
|
||||
/**
|
||||
* If a namespace exists, prefix the value provided with it, separated by |.
|
||||
*/
|
||||
qualifiedName(value: string): string;
|
||||
/**
|
||||
* A string representing the namespace suitable for output.
|
||||
*/
|
||||
readonly namespaceString: string;
|
||||
}
|
||||
function isNamespace(node: any): node is Attribute | Tag;
|
||||
|
||||
interface Root extends Container<undefined, Selector> {
|
||||
type: "root";
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
nodeAt(line: number, column: number): Node
|
||||
}
|
||||
function root(opts: ContainerOptions): Root;
|
||||
function isRoot(node: any): node is Root;
|
||||
|
||||
interface _Selector<S> extends Container<string, Diff<Node, S>> {
|
||||
type: "selector";
|
||||
}
|
||||
type Selector = _Selector<Selector>;
|
||||
function selector(opts: ContainerOptions): Selector;
|
||||
function isSelector(node: any): node is Selector;
|
||||
|
||||
interface CombinatorRaws {
|
||||
value?: string;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
};
|
||||
}
|
||||
interface Combinator extends Base {
|
||||
type: "combinator";
|
||||
raws?: CombinatorRaws;
|
||||
}
|
||||
function combinator(opts: NodeOptions): Combinator;
|
||||
function isCombinator(node: any): node is Combinator;
|
||||
|
||||
interface ClassName extends Base {
|
||||
type: "class";
|
||||
}
|
||||
function className(opts: NamespaceOptions): ClassName;
|
||||
function isClassName(node: any): node is ClassName;
|
||||
|
||||
type AttributeOperator = "=" | "~=" | "|=" | "^=" | "$=" | "*=";
|
||||
type QuoteMark = '"' | "'" | null;
|
||||
interface PreferredQuoteMarkOptions {
|
||||
quoteMark?: QuoteMark;
|
||||
preferCurrentQuoteMark?: boolean;
|
||||
}
|
||||
interface SmartQuoteMarkOptions extends PreferredQuoteMarkOptions {
|
||||
smart?: boolean;
|
||||
}
|
||||
interface AttributeOptions extends NamespaceOptions<string | undefined> {
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoteMark?: QuoteMark;
|
||||
/** @deprecated Use quoteMark instead. */
|
||||
quoted?: boolean;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
attribute?: Partial<SpaceAround>;
|
||||
operator?: Partial<SpaceAround>;
|
||||
value?: Partial<SpaceAround>;
|
||||
insensitive?: Partial<SpaceAround>;
|
||||
}
|
||||
raws: {
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
}
|
||||
interface Attribute extends Namespace<string | undefined> {
|
||||
type: "attribute";
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoteMark: QuoteMark;
|
||||
quoted?: boolean;
|
||||
spaces: {
|
||||
before: string;
|
||||
after: string;
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
raws: {
|
||||
/** @deprecated The attribute value is unquoted, use that instead.. */
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
/** The value of the attribute with quotes and escapes. */
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* The attribute name after having been qualified with a namespace.
|
||||
*/
|
||||
readonly qualifiedAttribute: string;
|
||||
|
||||
/**
|
||||
* The case insensitivity flag or an empty string depending on whether this
|
||||
* attribute is case insensitive.
|
||||
*/
|
||||
readonly insensitiveFlag : 'i' | '';
|
||||
|
||||
/**
|
||||
* Returns the attribute's value quoted such that it would be legal to use
|
||||
* in the value of a css file. The original value's quotation setting
|
||||
* used for stringification is left unchanged. See `setValue(value, options)`
|
||||
* if you want to control the quote settings of a new value for the attribute or
|
||||
* `set quoteMark(mark)` if you want to change the quote settings of the current
|
||||
* value.
|
||||
*
|
||||
* You can also change the quotation used for the current value by setting quoteMark.
|
||||
**/
|
||||
getQuotedValue(options?: SmartQuoteMarkOptions): string;
|
||||
|
||||
/**
|
||||
* Set the unescaped value with the specified quotation options. The value
|
||||
* provided must not include any wrapping quote marks -- those quotes will
|
||||
* be interpreted as part of the value and escaped accordingly.
|
||||
* @param value
|
||||
*/
|
||||
setValue(value: string, options?: SmartQuoteMarkOptions): void;
|
||||
|
||||
/**
|
||||
* Intelligently select a quoteMark value based on the value's contents. If
|
||||
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
|
||||
* mark will be picked that minimizes the number of escapes.
|
||||
*
|
||||
* If there's no clear winner, the quote mark from these options is used,
|
||||
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
|
||||
* true). If the quoteMark is unspecified, a double quote is used.
|
||||
**/
|
||||
smartQuoteMark(options: PreferredQuoteMarkOptions): QuoteMark;
|
||||
|
||||
/**
|
||||
* Selects the preferred quote mark based on the options and the current quote mark value.
|
||||
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
|
||||
* instead.
|
||||
*/
|
||||
preferredQuoteMark(options: PreferredQuoteMarkOptions): QuoteMark
|
||||
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/
|
||||
offsetOf(part: "ns" | "namespace" | "attribute" | "attributeNS" | "operator" | "value" | "insensitive"): number;
|
||||
}
|
||||
function attribute(opts: AttributeOptions): Attribute;
|
||||
function isAttribute(node: any): node is Attribute;
|
||||
|
||||
interface Pseudo extends Container<string, Selector> {
|
||||
type: "pseudo";
|
||||
}
|
||||
function pseudo(opts: ContainerOptions): Pseudo;
|
||||
/**
|
||||
* Checks wether the node is the Psuedo subtype of node.
|
||||
*/
|
||||
function isPseudo(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks wether the node is, specifically, a pseudo element instead of
|
||||
* pseudo class.
|
||||
*/
|
||||
function isPseudoElement(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks wether the node is, specifically, a pseudo class instead of
|
||||
* pseudo element.
|
||||
*/
|
||||
function isPseudoClass(node: any): node is Pseudo;
|
||||
|
||||
|
||||
interface Tag extends Namespace {
|
||||
type: "tag";
|
||||
}
|
||||
function tag(opts: NamespaceOptions): Tag;
|
||||
function isTag(node: any): node is Tag;
|
||||
|
||||
interface Comment extends Base {
|
||||
type: "comment";
|
||||
}
|
||||
function comment(opts: NodeOptions): Comment;
|
||||
function isComment(node: any): node is Comment;
|
||||
|
||||
interface Identifier extends Base {
|
||||
type: "id";
|
||||
}
|
||||
function id(opts: any): any;
|
||||
function isIdentifier(node: any): node is Identifier;
|
||||
|
||||
interface Nesting extends Base {
|
||||
type: "nesting";
|
||||
}
|
||||
function nesting(opts: any): any;
|
||||
function isNesting(node: any): node is Nesting;
|
||||
|
||||
interface String extends Base {
|
||||
type: "string";
|
||||
}
|
||||
function string(opts: NodeOptions): String;
|
||||
function isString(node: any): node is String;
|
||||
|
||||
interface Universal extends Base {
|
||||
type: "universal";
|
||||
}
|
||||
function universal(opts?: NamespaceOptions): any;
|
||||
function isUniversal(node: any): node is Universal;
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
"use strict";;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var types_1 = tslib_1.__importDefault(require("./types"));
|
||||
var Op = Object.prototype;
|
||||
var hasOwn = Op.hasOwnProperty;
|
||||
function pathPlugin(fork) {
|
||||
var types = fork.use(types_1.default);
|
||||
var isArray = types.builtInTypes.array;
|
||||
var isNumber = types.builtInTypes.number;
|
||||
var Path = function Path(value, parentPath, name) {
|
||||
if (!(this instanceof Path)) {
|
||||
throw new Error("Path constructor cannot be invoked without 'new'");
|
||||
}
|
||||
if (parentPath) {
|
||||
if (!(parentPath instanceof Path)) {
|
||||
throw new Error("");
|
||||
}
|
||||
}
|
||||
else {
|
||||
parentPath = null;
|
||||
name = null;
|
||||
}
|
||||
// The value encapsulated by this Path, generally equal to
|
||||
// parentPath.value[name] if we have a parentPath.
|
||||
this.value = value;
|
||||
// The immediate parent Path of this Path.
|
||||
this.parentPath = parentPath;
|
||||
// The name of the property of parentPath.value through which this
|
||||
// Path's value was reached.
|
||||
this.name = name;
|
||||
// Calling path.get("child") multiple times always returns the same
|
||||
// child Path object, for both performance and consistency reasons.
|
||||
this.__childCache = null;
|
||||
};
|
||||
var Pp = Path.prototype;
|
||||
function getChildCache(path) {
|
||||
// Lazily create the child cache. This also cheapens cache
|
||||
// invalidation, since you can just reset path.__childCache to null.
|
||||
return path.__childCache || (path.__childCache = Object.create(null));
|
||||
}
|
||||
function getChildPath(path, name) {
|
||||
var cache = getChildCache(path);
|
||||
var actualChildValue = path.getValueProperty(name);
|
||||
var childPath = cache[name];
|
||||
if (!hasOwn.call(cache, name) ||
|
||||
// Ensure consistency between cache and reality.
|
||||
childPath.value !== actualChildValue) {
|
||||
childPath = cache[name] = new path.constructor(actualChildValue, path, name);
|
||||
}
|
||||
return childPath;
|
||||
}
|
||||
// This method is designed to be overridden by subclasses that need to
|
||||
// handle missing properties, etc.
|
||||
Pp.getValueProperty = function getValueProperty(name) {
|
||||
return this.value[name];
|
||||
};
|
||||
Pp.get = function get() {
|
||||
var names = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
names[_i] = arguments[_i];
|
||||
}
|
||||
var path = this;
|
||||
var count = names.length;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
path = getChildPath(path, names[i]);
|
||||
}
|
||||
return path;
|
||||
};
|
||||
Pp.each = function each(callback, context) {
|
||||
var childPaths = [];
|
||||
var len = this.value.length;
|
||||
var i = 0;
|
||||
// Collect all the original child paths before invoking the callback.
|
||||
for (var i = 0; i < len; ++i) {
|
||||
if (hasOwn.call(this.value, i)) {
|
||||
childPaths[i] = this.get(i);
|
||||
}
|
||||
}
|
||||
// Invoke the callback on just the original child paths, regardless of
|
||||
// any modifications made to the array by the callback. I chose these
|
||||
// semantics over cleverly invoking the callback on new elements because
|
||||
// this way is much easier to reason about.
|
||||
context = context || this;
|
||||
for (i = 0; i < len; ++i) {
|
||||
if (hasOwn.call(childPaths, i)) {
|
||||
callback.call(context, childPaths[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
Pp.map = function map(callback, context) {
|
||||
var result = [];
|
||||
this.each(function (childPath) {
|
||||
result.push(callback.call(this, childPath));
|
||||
}, context);
|
||||
return result;
|
||||
};
|
||||
Pp.filter = function filter(callback, context) {
|
||||
var result = [];
|
||||
this.each(function (childPath) {
|
||||
if (callback.call(this, childPath)) {
|
||||
result.push(childPath);
|
||||
}
|
||||
}, context);
|
||||
return result;
|
||||
};
|
||||
function emptyMoves() { }
|
||||
function getMoves(path, offset, start, end) {
|
||||
isArray.assert(path.value);
|
||||
if (offset === 0) {
|
||||
return emptyMoves;
|
||||
}
|
||||
var length = path.value.length;
|
||||
if (length < 1) {
|
||||
return emptyMoves;
|
||||
}
|
||||
var argc = arguments.length;
|
||||
if (argc === 2) {
|
||||
start = 0;
|
||||
end = length;
|
||||
}
|
||||
else if (argc === 3) {
|
||||
start = Math.max(start, 0);
|
||||
end = length;
|
||||
}
|
||||
else {
|
||||
start = Math.max(start, 0);
|
||||
end = Math.min(end, length);
|
||||
}
|
||||
isNumber.assert(start);
|
||||
isNumber.assert(end);
|
||||
var moves = Object.create(null);
|
||||
var cache = getChildCache(path);
|
||||
for (var i = start; i < end; ++i) {
|
||||
if (hasOwn.call(path.value, i)) {
|
||||
var childPath = path.get(i);
|
||||
if (childPath.name !== i) {
|
||||
throw new Error("");
|
||||
}
|
||||
var newIndex = i + offset;
|
||||
childPath.name = newIndex;
|
||||
moves[newIndex] = childPath;
|
||||
delete cache[i];
|
||||
}
|
||||
}
|
||||
delete cache.length;
|
||||
return function () {
|
||||
for (var newIndex in moves) {
|
||||
var childPath = moves[newIndex];
|
||||
if (childPath.name !== +newIndex) {
|
||||
throw new Error("");
|
||||
}
|
||||
cache[newIndex] = childPath;
|
||||
path.value[newIndex] = childPath.value;
|
||||
}
|
||||
};
|
||||
}
|
||||
Pp.shift = function shift() {
|
||||
var move = getMoves(this, -1);
|
||||
var result = this.value.shift();
|
||||
move();
|
||||
return result;
|
||||
};
|
||||
Pp.unshift = function unshift() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var move = getMoves(this, args.length);
|
||||
var result = this.value.unshift.apply(this.value, args);
|
||||
move();
|
||||
return result;
|
||||
};
|
||||
Pp.push = function push() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
isArray.assert(this.value);
|
||||
delete getChildCache(this).length;
|
||||
return this.value.push.apply(this.value, args);
|
||||
};
|
||||
Pp.pop = function pop() {
|
||||
isArray.assert(this.value);
|
||||
var cache = getChildCache(this);
|
||||
delete cache[this.value.length - 1];
|
||||
delete cache.length;
|
||||
return this.value.pop();
|
||||
};
|
||||
Pp.insertAt = function insertAt(index) {
|
||||
var argc = arguments.length;
|
||||
var move = getMoves(this, argc - 1, index);
|
||||
if (move === emptyMoves && argc <= 1) {
|
||||
return this;
|
||||
}
|
||||
index = Math.max(index, 0);
|
||||
for (var i = 1; i < argc; ++i) {
|
||||
this.value[index + i - 1] = arguments[i];
|
||||
}
|
||||
move();
|
||||
return this;
|
||||
};
|
||||
Pp.insertBefore = function insertBefore() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var pp = this.parentPath;
|
||||
var argc = args.length;
|
||||
var insertAtArgs = [this.name];
|
||||
for (var i = 0; i < argc; ++i) {
|
||||
insertAtArgs.push(args[i]);
|
||||
}
|
||||
return pp.insertAt.apply(pp, insertAtArgs);
|
||||
};
|
||||
Pp.insertAfter = function insertAfter() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var pp = this.parentPath;
|
||||
var argc = args.length;
|
||||
var insertAtArgs = [this.name + 1];
|
||||
for (var i = 0; i < argc; ++i) {
|
||||
insertAtArgs.push(args[i]);
|
||||
}
|
||||
return pp.insertAt.apply(pp, insertAtArgs);
|
||||
};
|
||||
function repairRelationshipWithParent(path) {
|
||||
if (!(path instanceof Path)) {
|
||||
throw new Error("");
|
||||
}
|
||||
var pp = path.parentPath;
|
||||
if (!pp) {
|
||||
// Orphan paths have no relationship to repair.
|
||||
return path;
|
||||
}
|
||||
var parentValue = pp.value;
|
||||
var parentCache = getChildCache(pp);
|
||||
// Make sure parentCache[path.name] is populated.
|
||||
if (parentValue[path.name] === path.value) {
|
||||
parentCache[path.name] = path;
|
||||
}
|
||||
else if (isArray.check(parentValue)) {
|
||||
// Something caused path.name to become out of date, so attempt to
|
||||
// recover by searching for path.value in parentValue.
|
||||
var i = parentValue.indexOf(path.value);
|
||||
if (i >= 0) {
|
||||
parentCache[path.name = i] = path;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If path.value disagrees with parentValue[path.name], and
|
||||
// path.name is not an array index, let path.value become the new
|
||||
// parentValue[path.name] and update parentCache accordingly.
|
||||
parentValue[path.name] = path.value;
|
||||
parentCache[path.name] = path;
|
||||
}
|
||||
if (parentValue[path.name] !== path.value) {
|
||||
throw new Error("");
|
||||
}
|
||||
if (path.parentPath.get(path.name) !== path) {
|
||||
throw new Error("");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
Pp.replace = function replace(replacement) {
|
||||
var results = [];
|
||||
var parentValue = this.parentPath.value;
|
||||
var parentCache = getChildCache(this.parentPath);
|
||||
var count = arguments.length;
|
||||
repairRelationshipWithParent(this);
|
||||
if (isArray.check(parentValue)) {
|
||||
var originalLength = parentValue.length;
|
||||
var move = getMoves(this.parentPath, count - 1, this.name + 1);
|
||||
var spliceArgs = [this.name, 1];
|
||||
for (var i = 0; i < count; ++i) {
|
||||
spliceArgs.push(arguments[i]);
|
||||
}
|
||||
var splicedOut = parentValue.splice.apply(parentValue, spliceArgs);
|
||||
if (splicedOut[0] !== this.value) {
|
||||
throw new Error("");
|
||||
}
|
||||
if (parentValue.length !== (originalLength - 1 + count)) {
|
||||
throw new Error("");
|
||||
}
|
||||
move();
|
||||
if (count === 0) {
|
||||
delete this.value;
|
||||
delete parentCache[this.name];
|
||||
this.__childCache = null;
|
||||
}
|
||||
else {
|
||||
if (parentValue[this.name] !== replacement) {
|
||||
throw new Error("");
|
||||
}
|
||||
if (this.value !== replacement) {
|
||||
this.value = replacement;
|
||||
this.__childCache = null;
|
||||
}
|
||||
for (i = 0; i < count; ++i) {
|
||||
results.push(this.parentPath.get(this.name + i));
|
||||
}
|
||||
if (results[0] !== this) {
|
||||
throw new Error("");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (count === 1) {
|
||||
if (this.value !== replacement) {
|
||||
this.__childCache = null;
|
||||
}
|
||||
this.value = parentValue[this.name] = replacement;
|
||||
results.push(this);
|
||||
}
|
||||
else if (count === 0) {
|
||||
delete parentValue[this.name];
|
||||
delete this.value;
|
||||
this.__childCache = null;
|
||||
// Leave this path cached as parentCache[this.name], even though
|
||||
// it no longer has a value defined.
|
||||
}
|
||||
else {
|
||||
throw new Error("Could not replace path");
|
||||
}
|
||||
return results;
|
||||
};
|
||||
return Path;
|
||||
}
|
||||
exports.default = pathPlugin;
|
||||
module.exports = exports["default"];
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"tiny-glob","version":"0.2.9","files":{"index.js":{"checkedAt":1678883668792,"integrity":"sha512-E2gw8/1mYM5qGIngfEtsZDC/wbkGn6573klqZ6C46rZ43TQmepTIMH9BstVdCbaAtoUSBVhSstzH66SLpKC9tA==","mode":420,"size":2579},"package.json":{"checkedAt":1678883668792,"integrity":"sha512-4ApdA3Zd6V6y1Ae0OAwE0VyAuPG7OJ+Ab6IrZ4vcB0rVp0P5O0qEtPDHaGLTUkrkNdPaFMai5mOScoj2VZqd/A==","mode":420,"size":700},"sync.js":{"checkedAt":1678883668792,"integrity":"sha512-preYZf8t16Pinen0whRIEreYR8yjE0zUQ9z3kKnR04QQ3ZhHWIWisW25+/LAG7bXNdUhGvJCdgM/ly+AeJHgSQ==","mode":420,"size":2447},"readme.md":{"checkedAt":1678883668792,"integrity":"sha512-4iX9j4sEsI0P7sE1BLPhtmQFUqg9P5NdIFUPCR0/MTUWB1TSbOYHjUAh6pryGpUW1E5ks6V0zgp6XcYvHfih4Q==","mode":420,"size":4848},"license":{"checkedAt":1678883668792,"integrity":"sha512-hWN2Wl57Co7+xKDoZ9wQSNRPOLf9MXL8FIfj2cYN4LrKec12s3no2kym8E7HtHFGe4P/IT6F0Lxmb0MZ5om4qw==","mode":420,"size":1063},"index.d.ts":{"checkedAt":1678883668801,"integrity":"sha512-urs2kAZsTdS8vILWIF0iewZeqTWjfgwbgSqLNtJlimC+DWNNTa4ZSIdbg536Qvc9Uw6LzyWaYWNSbevJekU3ww==","mode":420,"size":232},"sync.d.ts":{"checkedAt":1678883668801,"integrity":"sha512-rGyFUduPpcJm5VeZjGjFhJ3Dh9mmgpIF81sk0FbaR6T4vrUh3V8DfOFUp95pkiZ0LiiK93cFUyrPa4cOnjoVzw==","mode":420,"size":223}}}
|
||||
Reference in New Issue
Block a user