update
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isType;
|
||||
var _index = require("../definitions/index.js");
|
||||
function isType(nodeType, targetType) {
|
||||
if (nodeType === targetType) return true;
|
||||
if (nodeType == null) return false;
|
||||
if (_index.ALIAS_KEYS[targetType]) return false;
|
||||
const aliases = _index.FLIPPED_ALIAS_KEYS[targetType];
|
||||
if (aliases != null && aliases.includes(nodeType)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=isType.js.map
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "clsx",
|
||||
"version": "2.1.1",
|
||||
"repository": "lukeed/clsx",
|
||||
"description": "A tiny (239B) utility for constructing className strings conditionally.",
|
||||
"module": "dist/clsx.mjs",
|
||||
"unpkg": "dist/clsx.min.js",
|
||||
"main": "dist/clsx.js",
|
||||
"types": "clsx.d.ts",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./clsx.d.mts",
|
||||
"default": "./dist/clsx.mjs"
|
||||
},
|
||||
"default": {
|
||||
"types": "./clsx.d.ts",
|
||||
"default": "./dist/clsx.js"
|
||||
}
|
||||
},
|
||||
"./lite": {
|
||||
"import": {
|
||||
"types": "./clsx.d.mts",
|
||||
"default": "./dist/lite.mjs"
|
||||
},
|
||||
"default": {
|
||||
"types": "./clsx.d.ts",
|
||||
"default": "./dist/lite.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node bin",
|
||||
"test": "uvu -r esm test"
|
||||
},
|
||||
"files": [
|
||||
"*.d.mts",
|
||||
"*.d.ts",
|
||||
"dist"
|
||||
],
|
||||
"keywords": [
|
||||
"classes",
|
||||
"classname",
|
||||
"classnames"
|
||||
],
|
||||
"devDependencies": {
|
||||
"esm": "3.2.25",
|
||||
"terser": "4.8.0",
|
||||
"uvu": "0.5.4"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _classPrivateMethodSet;
|
||||
function _classPrivateMethodSet() {
|
||||
throw new TypeError("attempted to reassign private method");
|
||||
}
|
||||
|
||||
//# sourceMappingURL=classPrivateMethodSet.js.map
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "wrappy",
|
||||
"version": "1.0.2",
|
||||
"description": "Callback wrapping utility",
|
||||
"main": "wrappy.js",
|
||||
"files": [
|
||||
"wrappy.js"
|
||||
],
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tap": "^2.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap --coverage test/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/npm/wrappy"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/wrappy/issues"
|
||||
},
|
||||
"homepage": "https://github.com/npm/wrappy"
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
{
|
||||
"bugfix/transform-async-arrows-in-class": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "11",
|
||||
"node": "7.6",
|
||||
"deno": "1",
|
||||
"ios": "11",
|
||||
"samsung": "6",
|
||||
"opera_mobile": "42",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"bugfix/transform-edge-default-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "18",
|
||||
"firefox": "52",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-edge-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "79",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"bugfix/transform-safari-block-shadowing": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "12",
|
||||
"firefox": "44",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ie": "11",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-for-shadowing": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "12",
|
||||
"firefox": "4",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ie": "11",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.13",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-id-destructuring-collision-in-function-expression": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "2",
|
||||
"safari": "16.3",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "16.3",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-tagged-template-caching": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "13",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "16.9",
|
||||
"deno": "1.9",
|
||||
"ios": "13.4",
|
||||
"samsung": "16",
|
||||
"opera_mobile": "64",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"bugfix/transform-firefox-class-in-computed-class-key": {
|
||||
"chrome": "74",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"safari": "16",
|
||||
"node": "12",
|
||||
"deno": "1",
|
||||
"ios": "16",
|
||||
"samsung": "11",
|
||||
"opera_mobile": "53",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"transform-optional-chaining": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"deno": "1",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"opera_mobile": "57",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"proposal-optional-chaining": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"deno": "1",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"opera_mobile": "57",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7.6",
|
||||
"deno": "1",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"opera_mobile": "42",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "37",
|
||||
"electron": "1.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var isProduction = process.env.NODE_ENV === 'production';
|
||||
function warning(condition, message) {
|
||||
if (!isProduction) {
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = "Warning: " + message;
|
||||
|
||||
if (typeof console !== 'undefined') {
|
||||
console.warn(text);
|
||||
}
|
||||
|
||||
try {
|
||||
throw Error(text);
|
||||
} catch (x) {}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = warning;
|
||||
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var vanilla = require('zustand/vanilla');
|
||||
|
||||
const identity = (arg) => arg;
|
||||
function useStore(api, selector = identity) {
|
||||
const slice = React.useSyncExternalStore(
|
||||
api.subscribe,
|
||||
() => selector(api.getState()),
|
||||
() => selector(api.getInitialState())
|
||||
);
|
||||
React.useDebugValue(slice);
|
||||
return slice;
|
||||
}
|
||||
const createImpl = (createState) => {
|
||||
const api = vanilla.createStore(createState);
|
||||
const useBoundStore = (selector) => useStore(api, selector);
|
||||
Object.assign(useBoundStore, api);
|
||||
return useBoundStore;
|
||||
};
|
||||
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
||||
|
||||
exports.create = create;
|
||||
exports.useStore = useStore;
|
||||
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* @fileoverview Rule to disallow negating the left operand of relational operators
|
||||
* @author Toru Nagashima
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks whether the given operator is `in` or `instanceof`
|
||||
* @param {string} op The operator type to check.
|
||||
* @returns {boolean} `true` if the operator is `in` or `instanceof`
|
||||
*/
|
||||
function isInOrInstanceOfOperator(op) {
|
||||
return op === "in" || op === "instanceof";
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given operator is an ordering relational operator or not.
|
||||
* @param {string} op The operator type to check.
|
||||
* @returns {boolean} `true` if the operator is an ordering relational operator.
|
||||
*/
|
||||
function isOrderingRelationalOperator(op) {
|
||||
return op === "<" || op === ">" || op === ">=" || op === "<=";
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given node is a logical negation expression or not.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {boolean} `true` if the node is a logical negation expression.
|
||||
*/
|
||||
function isNegation(node) {
|
||||
return node.type === "UnaryExpression" && node.operator === "!";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
defaultOptions: [
|
||||
{
|
||||
enforceForOrderingRelations: false,
|
||||
},
|
||||
],
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow negating the left operand of relational operators",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-unsafe-negation",
|
||||
},
|
||||
|
||||
hasSuggestions: true,
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
enforceForOrderingRelations: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
fixable: null,
|
||||
|
||||
messages: {
|
||||
unexpected:
|
||||
"Unexpected negating the left operand of '{{operator}}' operator.",
|
||||
suggestNegatedExpression:
|
||||
"Negate '{{operator}}' expression instead of its left operand. This changes the current behavior.",
|
||||
suggestParenthesisedNegation:
|
||||
"Wrap negation in '()' to make the intention explicit. This preserves the current behavior.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const [{ enforceForOrderingRelations }] = context.options;
|
||||
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
const operator = node.operator;
|
||||
const orderingRelationRuleApplies =
|
||||
enforceForOrderingRelations &&
|
||||
isOrderingRelationalOperator(operator);
|
||||
|
||||
if (
|
||||
(isInOrInstanceOfOperator(operator) ||
|
||||
orderingRelationRuleApplies) &&
|
||||
isNegation(node.left) &&
|
||||
!astUtils.isParenthesised(sourceCode, node.left)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: node.left.loc,
|
||||
messageId: "unexpected",
|
||||
data: { operator },
|
||||
suggest: [
|
||||
{
|
||||
messageId: "suggestNegatedExpression",
|
||||
data: { operator },
|
||||
fix(fixer) {
|
||||
const negationToken =
|
||||
sourceCode.getFirstToken(node.left);
|
||||
const fixRange = [
|
||||
negationToken.range[1],
|
||||
node.range[1],
|
||||
];
|
||||
const text = sourceCode.text.slice(
|
||||
fixRange[0],
|
||||
fixRange[1],
|
||||
);
|
||||
|
||||
return fixer.replaceTextRange(
|
||||
fixRange,
|
||||
`(${text})`,
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
messageId: "suggestParenthesisedNegation",
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(
|
||||
node.left,
|
||||
`(${sourceCode.getText(node.left)})`,
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,499 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _regeneratorRuntime;
|
||||
function _regeneratorRuntime() {
|
||||
"use strict";
|
||||
exports.default = _regeneratorRuntime = function () {
|
||||
return _exports;
|
||||
};
|
||||
var _exports = {};
|
||||
var Op = Object.prototype;
|
||||
var hasOwn = Op.hasOwnProperty;
|
||||
var defineProperty = Object.defineProperty || function (obj, key, desc) {
|
||||
obj[key] = desc.value;
|
||||
};
|
||||
var undefined;
|
||||
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
||||
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
||||
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
||||
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
||||
function define(obj, key, value) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
return obj[key];
|
||||
}
|
||||
try {
|
||||
define({}, "");
|
||||
} catch (err) {
|
||||
define = function (obj, key, value) {
|
||||
return obj[key] = value;
|
||||
};
|
||||
}
|
||||
function wrap(innerFn, outerFn, self, tryLocsList) {
|
||||
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
||||
var generator = Object.create(protoGenerator.prototype);
|
||||
var context = new Context(tryLocsList || []);
|
||||
defineProperty(generator, "_invoke", {
|
||||
value: makeInvokeMethod(innerFn, self, context)
|
||||
});
|
||||
return generator;
|
||||
}
|
||||
_exports.wrap = wrap;
|
||||
function tryCatch(fn, obj, arg) {
|
||||
try {
|
||||
return {
|
||||
type: "normal",
|
||||
arg: fn.call(obj, arg)
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
type: "throw",
|
||||
arg: err
|
||||
};
|
||||
}
|
||||
}
|
||||
var GenStateSuspendedStart = "suspendedStart";
|
||||
var GenStateSuspendedYield = "suspendedYield";
|
||||
var GenStateExecuting = "executing";
|
||||
var GenStateCompleted = "completed";
|
||||
var ContinueSentinel = {};
|
||||
function Generator() {}
|
||||
function GeneratorFunction() {}
|
||||
function GeneratorFunctionPrototype() {}
|
||||
var IteratorPrototype = {};
|
||||
define(IteratorPrototype, iteratorSymbol, function () {
|
||||
return this;
|
||||
});
|
||||
var getProto = Object.getPrototypeOf;
|
||||
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
||||
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
||||
IteratorPrototype = NativeIteratorPrototype;
|
||||
}
|
||||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
||||
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
||||
defineProperty(Gp, "constructor", {
|
||||
value: GeneratorFunctionPrototype,
|
||||
configurable: true
|
||||
});
|
||||
defineProperty(GeneratorFunctionPrototype, "constructor", {
|
||||
value: GeneratorFunction,
|
||||
configurable: true
|
||||
});
|
||||
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
||||
function defineIteratorMethods(prototype) {
|
||||
["next", "throw", "return"].forEach(function (method) {
|
||||
define(prototype, method, function (arg) {
|
||||
return this._invoke(method, arg);
|
||||
});
|
||||
});
|
||||
}
|
||||
_exports.isGeneratorFunction = function (genFun) {
|
||||
var ctor = typeof genFun === "function" && genFun.constructor;
|
||||
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
||||
};
|
||||
_exports.mark = function (genFun) {
|
||||
if (Object.setPrototypeOf) {
|
||||
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
||||
} else {
|
||||
genFun.__proto__ = GeneratorFunctionPrototype;
|
||||
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
||||
}
|
||||
genFun.prototype = Object.create(Gp);
|
||||
return genFun;
|
||||
};
|
||||
_exports.awrap = function (arg) {
|
||||
return {
|
||||
__await: arg
|
||||
};
|
||||
};
|
||||
function AsyncIterator(generator, PromiseImpl) {
|
||||
function invoke(method, arg, resolve, reject) {
|
||||
var record = tryCatch(generator[method], generator, arg);
|
||||
if (record.type === "throw") {
|
||||
reject(record.arg);
|
||||
} else {
|
||||
var result = record.arg;
|
||||
var value = result.value;
|
||||
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
||||
return PromiseImpl.resolve(value.__await).then(function (value) {
|
||||
invoke("next", value, resolve, reject);
|
||||
}, function (err) {
|
||||
invoke("throw", err, resolve, reject);
|
||||
});
|
||||
}
|
||||
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
||||
result.value = unwrapped;
|
||||
resolve(result);
|
||||
}, function (error) {
|
||||
return invoke("throw", error, resolve, reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
var previousPromise;
|
||||
function enqueue(method, arg) {
|
||||
function callInvokeWithMethodAndArg() {
|
||||
return new PromiseImpl(function (resolve, reject) {
|
||||
invoke(method, arg, resolve, reject);
|
||||
});
|
||||
}
|
||||
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
||||
}
|
||||
defineProperty(this, "_invoke", {
|
||||
value: enqueue
|
||||
});
|
||||
}
|
||||
defineIteratorMethods(AsyncIterator.prototype);
|
||||
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
||||
return this;
|
||||
});
|
||||
_exports.AsyncIterator = AsyncIterator;
|
||||
_exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
||||
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
||||
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
||||
return _exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
||||
return result.done ? result.value : iter.next();
|
||||
});
|
||||
};
|
||||
function makeInvokeMethod(innerFn, self, context) {
|
||||
var state = GenStateSuspendedStart;
|
||||
return function invoke(method, arg) {
|
||||
if (state === GenStateExecuting) {
|
||||
throw new Error("Generator is already running");
|
||||
}
|
||||
if (state === GenStateCompleted) {
|
||||
if (method === "throw") {
|
||||
throw arg;
|
||||
}
|
||||
return doneResult();
|
||||
}
|
||||
context.method = method;
|
||||
context.arg = arg;
|
||||
while (true) {
|
||||
var delegate = context.delegate;
|
||||
if (delegate) {
|
||||
var delegateResult = maybeInvokeDelegate(delegate, context);
|
||||
if (delegateResult) {
|
||||
if (delegateResult === ContinueSentinel) continue;
|
||||
return delegateResult;
|
||||
}
|
||||
}
|
||||
if (context.method === "next") {
|
||||
context.sent = context._sent = context.arg;
|
||||
} else if (context.method === "throw") {
|
||||
if (state === GenStateSuspendedStart) {
|
||||
state = GenStateCompleted;
|
||||
throw context.arg;
|
||||
}
|
||||
context.dispatchException(context.arg);
|
||||
} else if (context.method === "return") {
|
||||
context.abrupt("return", context.arg);
|
||||
}
|
||||
state = GenStateExecuting;
|
||||
var record = tryCatch(innerFn, self, context);
|
||||
if (record.type === "normal") {
|
||||
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
||||
if (record.arg === ContinueSentinel) {
|
||||
continue;
|
||||
}
|
||||
return {
|
||||
value: record.arg,
|
||||
done: context.done
|
||||
};
|
||||
} else if (record.type === "throw") {
|
||||
state = GenStateCompleted;
|
||||
context.method = "throw";
|
||||
context.arg = record.arg;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function maybeInvokeDelegate(delegate, context) {
|
||||
var methodName = context.method;
|
||||
var method = delegate.iterator[methodName];
|
||||
if (method === undefined) {
|
||||
context.delegate = null;
|
||||
if (methodName === "throw" && delegate.iterator["return"]) {
|
||||
context.method = "return";
|
||||
context.arg = undefined;
|
||||
maybeInvokeDelegate(delegate, context);
|
||||
if (context.method === "throw") {
|
||||
return ContinueSentinel;
|
||||
}
|
||||
}
|
||||
if (methodName !== "return") {
|
||||
context.method = "throw";
|
||||
context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method");
|
||||
}
|
||||
return ContinueSentinel;
|
||||
}
|
||||
var record = tryCatch(method, delegate.iterator, context.arg);
|
||||
if (record.type === "throw") {
|
||||
context.method = "throw";
|
||||
context.arg = record.arg;
|
||||
context.delegate = null;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
var info = record.arg;
|
||||
if (!info) {
|
||||
context.method = "throw";
|
||||
context.arg = new TypeError("iterator result is not an object");
|
||||
context.delegate = null;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
if (info.done) {
|
||||
context[delegate.resultName] = info.value;
|
||||
context.next = delegate.nextLoc;
|
||||
if (context.method !== "return") {
|
||||
context.method = "next";
|
||||
context.arg = undefined;
|
||||
}
|
||||
} else {
|
||||
return info;
|
||||
}
|
||||
context.delegate = null;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
defineIteratorMethods(Gp);
|
||||
define(Gp, toStringTagSymbol, "Generator");
|
||||
define(Gp, iteratorSymbol, function () {
|
||||
return this;
|
||||
});
|
||||
define(Gp, "toString", function () {
|
||||
return "[object Generator]";
|
||||
});
|
||||
function pushTryEntry(locs) {
|
||||
var entry = {
|
||||
tryLoc: locs[0]
|
||||
};
|
||||
if (1 in locs) {
|
||||
entry.catchLoc = locs[1];
|
||||
}
|
||||
if (2 in locs) {
|
||||
entry.finallyLoc = locs[2];
|
||||
entry.afterLoc = locs[3];
|
||||
}
|
||||
this.tryEntries.push(entry);
|
||||
}
|
||||
function resetTryEntry(entry) {
|
||||
var record = entry.completion || {};
|
||||
record.type = "normal";
|
||||
delete record.arg;
|
||||
entry.completion = record;
|
||||
}
|
||||
function Context(tryLocsList) {
|
||||
this.tryEntries = [{
|
||||
tryLoc: "root"
|
||||
}];
|
||||
tryLocsList.forEach(pushTryEntry, this);
|
||||
this.reset(true);
|
||||
}
|
||||
_exports.keys = function (val) {
|
||||
var object = Object(val);
|
||||
var keys = [];
|
||||
for (var key in object) {
|
||||
keys.push(key);
|
||||
}
|
||||
keys.reverse();
|
||||
return function next() {
|
||||
while (keys.length) {
|
||||
var key = keys.pop();
|
||||
if (key in object) {
|
||||
next.value = key;
|
||||
next.done = false;
|
||||
return next;
|
||||
}
|
||||
}
|
||||
next.done = true;
|
||||
return next;
|
||||
};
|
||||
};
|
||||
function values(iterable) {
|
||||
if (iterable || iterable === "") {
|
||||
var iteratorMethod = iterable[iteratorSymbol];
|
||||
if (iteratorMethod) {
|
||||
return iteratorMethod.call(iterable);
|
||||
}
|
||||
if (typeof iterable.next === "function") {
|
||||
return iterable;
|
||||
}
|
||||
if (!isNaN(iterable.length)) {
|
||||
var i = -1,
|
||||
next = function next() {
|
||||
while (++i < iterable.length) {
|
||||
if (hasOwn.call(iterable, i)) {
|
||||
next.value = iterable[i];
|
||||
next.done = false;
|
||||
return next;
|
||||
}
|
||||
}
|
||||
next.value = undefined;
|
||||
next.done = true;
|
||||
return next;
|
||||
};
|
||||
return next.next = next;
|
||||
}
|
||||
}
|
||||
throw new TypeError(typeof iterable + " is not iterable");
|
||||
}
|
||||
_exports.values = values;
|
||||
function doneResult() {
|
||||
return {
|
||||
value: undefined,
|
||||
done: true
|
||||
};
|
||||
}
|
||||
Context.prototype = {
|
||||
constructor: Context,
|
||||
reset: function (skipTempReset) {
|
||||
this.prev = 0;
|
||||
this.next = 0;
|
||||
this.sent = this._sent = undefined;
|
||||
this.done = false;
|
||||
this.delegate = null;
|
||||
this.method = "next";
|
||||
this.arg = undefined;
|
||||
this.tryEntries.forEach(resetTryEntry);
|
||||
if (!skipTempReset) {
|
||||
for (var name in this) {
|
||||
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
||||
this[name] = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
stop: function () {
|
||||
this.done = true;
|
||||
var rootEntry = this.tryEntries[0];
|
||||
var rootRecord = rootEntry.completion;
|
||||
if (rootRecord.type === "throw") {
|
||||
throw rootRecord.arg;
|
||||
}
|
||||
return this.rval;
|
||||
},
|
||||
dispatchException: function (exception) {
|
||||
if (this.done) {
|
||||
throw exception;
|
||||
}
|
||||
var context = this;
|
||||
function handle(loc, caught) {
|
||||
record.type = "throw";
|
||||
record.arg = exception;
|
||||
context.next = loc;
|
||||
if (caught) {
|
||||
context.method = "next";
|
||||
context.arg = undefined;
|
||||
}
|
||||
return !!caught;
|
||||
}
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
var record = entry.completion;
|
||||
if (entry.tryLoc === "root") {
|
||||
return handle("end");
|
||||
}
|
||||
if (entry.tryLoc <= this.prev) {
|
||||
var hasCatch = hasOwn.call(entry, "catchLoc");
|
||||
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
||||
if (hasCatch && hasFinally) {
|
||||
if (this.prev < entry.catchLoc) {
|
||||
return handle(entry.catchLoc, true);
|
||||
} else if (this.prev < entry.finallyLoc) {
|
||||
return handle(entry.finallyLoc);
|
||||
}
|
||||
} else if (hasCatch) {
|
||||
if (this.prev < entry.catchLoc) {
|
||||
return handle(entry.catchLoc, true);
|
||||
}
|
||||
} else if (hasFinally) {
|
||||
if (this.prev < entry.finallyLoc) {
|
||||
return handle(entry.finallyLoc);
|
||||
}
|
||||
} else {
|
||||
throw new Error("try statement without catch or finally");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
abrupt: function (type, arg) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
||||
var finallyEntry = entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
||||
finallyEntry = null;
|
||||
}
|
||||
var record = finallyEntry ? finallyEntry.completion : {};
|
||||
record.type = type;
|
||||
record.arg = arg;
|
||||
if (finallyEntry) {
|
||||
this.method = "next";
|
||||
this.next = finallyEntry.finallyLoc;
|
||||
return ContinueSentinel;
|
||||
}
|
||||
return this.complete(record);
|
||||
},
|
||||
complete: function (record, afterLoc) {
|
||||
if (record.type === "throw") {
|
||||
throw record.arg;
|
||||
}
|
||||
if (record.type === "break" || record.type === "continue") {
|
||||
this.next = record.arg;
|
||||
} else if (record.type === "return") {
|
||||
this.rval = this.arg = record.arg;
|
||||
this.method = "return";
|
||||
this.next = "end";
|
||||
} else if (record.type === "normal" && afterLoc) {
|
||||
this.next = afterLoc;
|
||||
}
|
||||
return ContinueSentinel;
|
||||
},
|
||||
finish: function (finallyLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.finallyLoc === finallyLoc) {
|
||||
this.complete(entry.completion, entry.afterLoc);
|
||||
resetTryEntry(entry);
|
||||
return ContinueSentinel;
|
||||
}
|
||||
}
|
||||
},
|
||||
catch: function (tryLoc) {
|
||||
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
||||
var entry = this.tryEntries[i];
|
||||
if (entry.tryLoc === tryLoc) {
|
||||
var record = entry.completion;
|
||||
if (record.type === "throw") {
|
||||
var thrown = record.arg;
|
||||
resetTryEntry(entry);
|
||||
}
|
||||
return thrown;
|
||||
}
|
||||
}
|
||||
throw new Error("illegal catch attempt");
|
||||
},
|
||||
delegateYield: function (iterable, resultName, nextLoc) {
|
||||
this.delegate = {
|
||||
iterator: values(iterable),
|
||||
resultName: resultName,
|
||||
nextLoc: nextLoc
|
||||
};
|
||||
if (this.method === "next") {
|
||||
this.arg = undefined;
|
||||
}
|
||||
return ContinueSentinel;
|
||||
}
|
||||
};
|
||||
return _exports;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=regeneratorRuntime.js.map
|
||||
@@ -0,0 +1,84 @@
|
||||
'use strict'
|
||||
|
||||
const DuplexStream = require('readable-stream').Duplex
|
||||
const inherits = require('inherits')
|
||||
const BufferList = require('./BufferList')
|
||||
|
||||
function BufferListStream (callback) {
|
||||
if (!(this instanceof BufferListStream)) {
|
||||
return new BufferListStream(callback)
|
||||
}
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
this._callback = callback
|
||||
|
||||
const piper = function piper (err) {
|
||||
if (this._callback) {
|
||||
this._callback(err)
|
||||
this._callback = null
|
||||
}
|
||||
}.bind(this)
|
||||
|
||||
this.on('pipe', function onPipe (src) {
|
||||
src.on('error', piper)
|
||||
})
|
||||
this.on('unpipe', function onUnpipe (src) {
|
||||
src.removeListener('error', piper)
|
||||
})
|
||||
|
||||
callback = null
|
||||
}
|
||||
|
||||
BufferList._init.call(this, callback)
|
||||
DuplexStream.call(this)
|
||||
}
|
||||
|
||||
inherits(BufferListStream, DuplexStream)
|
||||
Object.assign(BufferListStream.prototype, BufferList.prototype)
|
||||
|
||||
BufferListStream.prototype._new = function _new (callback) {
|
||||
return new BufferListStream(callback)
|
||||
}
|
||||
|
||||
BufferListStream.prototype._write = function _write (buf, encoding, callback) {
|
||||
this._appendBuffer(buf)
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
BufferListStream.prototype._read = function _read (size) {
|
||||
if (!this.length) {
|
||||
return this.push(null)
|
||||
}
|
||||
|
||||
size = Math.min(size, this.length)
|
||||
this.push(this.slice(0, size))
|
||||
this.consume(size)
|
||||
}
|
||||
|
||||
BufferListStream.prototype.end = function end (chunk) {
|
||||
DuplexStream.prototype.end.call(this, chunk)
|
||||
|
||||
if (this._callback) {
|
||||
this._callback(null, this.slice())
|
||||
this._callback = null
|
||||
}
|
||||
}
|
||||
|
||||
BufferListStream.prototype._destroy = function _destroy (err, cb) {
|
||||
this._bufs.length = 0
|
||||
this.length = 0
|
||||
cb(err)
|
||||
}
|
||||
|
||||
BufferListStream.prototype._isBufferList = function _isBufferList (b) {
|
||||
return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b)
|
||||
}
|
||||
|
||||
BufferListStream.isBufferList = BufferList.isBufferList
|
||||
|
||||
module.exports = BufferListStream
|
||||
module.exports.BufferListStream = BufferListStream
|
||||
module.exports.BufferList = BufferList
|
||||
@@ -0,0 +1,383 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag dangling underscores in variable declarations.
|
||||
* @author Matt DuVall <http://www.mattduvall.com>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [
|
||||
{
|
||||
allow: [],
|
||||
allowAfterSuper: false,
|
||||
allowAfterThis: false,
|
||||
allowAfterThisConstructor: false,
|
||||
allowFunctionParams: true,
|
||||
allowInArrayDestructuring: true,
|
||||
allowInObjectDestructuring: true,
|
||||
enforceInClassFields: false,
|
||||
enforceInMethodNames: false,
|
||||
},
|
||||
],
|
||||
|
||||
docs: {
|
||||
description: "Disallow dangling underscores in identifiers",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-underscore-dangle",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
allow: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
allowAfterThis: {
|
||||
type: "boolean",
|
||||
},
|
||||
allowAfterSuper: {
|
||||
type: "boolean",
|
||||
},
|
||||
allowAfterThisConstructor: {
|
||||
type: "boolean",
|
||||
},
|
||||
enforceInMethodNames: {
|
||||
type: "boolean",
|
||||
},
|
||||
allowFunctionParams: {
|
||||
type: "boolean",
|
||||
},
|
||||
enforceInClassFields: {
|
||||
type: "boolean",
|
||||
},
|
||||
allowInArrayDestructuring: {
|
||||
type: "boolean",
|
||||
},
|
||||
allowInObjectDestructuring: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
unexpectedUnderscore:
|
||||
"Unexpected dangling '_' in '{{identifier}}'.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [
|
||||
{
|
||||
allow,
|
||||
allowAfterSuper,
|
||||
allowAfterThis,
|
||||
allowAfterThisConstructor,
|
||||
allowFunctionParams,
|
||||
allowInArrayDestructuring,
|
||||
allowInObjectDestructuring,
|
||||
enforceInClassFields,
|
||||
enforceInMethodNames,
|
||||
},
|
||||
] = context.options;
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Check if identifier is present inside the allowed option
|
||||
* @param {string} identifier name of the node
|
||||
* @returns {boolean} true if its is present
|
||||
* @private
|
||||
*/
|
||||
function isAllowed(identifier) {
|
||||
return allow.includes(identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if identifier has a dangling underscore
|
||||
* @param {string} identifier name of the node
|
||||
* @returns {boolean} true if its is present
|
||||
* @private
|
||||
*/
|
||||
function hasDanglingUnderscore(identifier) {
|
||||
const len = identifier.length;
|
||||
|
||||
return (
|
||||
identifier !== "_" &&
|
||||
(identifier[0] === "_" || identifier[len - 1] === "_")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if identifier is a special case member expression
|
||||
* @param {string} identifier name of the node
|
||||
* @returns {boolean} true if its is a special case
|
||||
* @private
|
||||
*/
|
||||
function isSpecialCaseIdentifierForMemberExpression(identifier) {
|
||||
return identifier === "__proto__";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if identifier is a special case variable expression
|
||||
* @param {string} identifier name of the node
|
||||
* @returns {boolean} true if its is a special case
|
||||
* @private
|
||||
*/
|
||||
function isSpecialCaseIdentifierInVariableExpression(identifier) {
|
||||
// Checks for the underscore library usage here
|
||||
return identifier === "_";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a node is a member reference of this.constructor
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {boolean} true if it is a reference on this.constructor
|
||||
* @private
|
||||
*/
|
||||
function isThisConstructorReference(node) {
|
||||
return (
|
||||
node.object.type === "MemberExpression" &&
|
||||
node.object.property.name === "constructor" &&
|
||||
node.object.object.type === "ThisExpression"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if function parameter has a dangling underscore.
|
||||
* @param {ASTNode} node function node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkForDanglingUnderscoreInFunctionParameters(node) {
|
||||
if (!allowFunctionParams) {
|
||||
node.params.forEach(param => {
|
||||
const { type } = param;
|
||||
let nodeToCheck;
|
||||
|
||||
if (type === "RestElement") {
|
||||
nodeToCheck = param.argument;
|
||||
} else if (type === "AssignmentPattern") {
|
||||
nodeToCheck = param.left;
|
||||
} else {
|
||||
nodeToCheck = param;
|
||||
}
|
||||
|
||||
if (nodeToCheck.type === "Identifier") {
|
||||
const identifier = nodeToCheck.name;
|
||||
|
||||
if (
|
||||
hasDanglingUnderscore(identifier) &&
|
||||
!isAllowed(identifier)
|
||||
) {
|
||||
context.report({
|
||||
node: param,
|
||||
messageId: "unexpectedUnderscore",
|
||||
data: {
|
||||
identifier,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if function has a dangling underscore
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkForDanglingUnderscoreInFunction(node) {
|
||||
if (node.type === "FunctionDeclaration" && node.id) {
|
||||
const identifier = node.id.name;
|
||||
|
||||
if (
|
||||
typeof identifier !== "undefined" &&
|
||||
hasDanglingUnderscore(identifier) &&
|
||||
!isAllowed(identifier)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedUnderscore",
|
||||
data: {
|
||||
identifier,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
checkForDanglingUnderscoreInFunctionParameters(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if variable expression has a dangling underscore
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkForDanglingUnderscoreInVariableExpression(node) {
|
||||
sourceCode.getDeclaredVariables(node).forEach(variable => {
|
||||
const definition = variable.defs.find(def => def.node === node);
|
||||
const identifierNode = definition.name;
|
||||
const identifier = identifierNode.name;
|
||||
let parent = identifierNode.parent;
|
||||
|
||||
while (
|
||||
![
|
||||
"VariableDeclarator",
|
||||
"ArrayPattern",
|
||||
"ObjectPattern",
|
||||
].includes(parent.type)
|
||||
) {
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
if (
|
||||
hasDanglingUnderscore(identifier) &&
|
||||
!isSpecialCaseIdentifierInVariableExpression(identifier) &&
|
||||
!isAllowed(identifier) &&
|
||||
!(
|
||||
allowInArrayDestructuring &&
|
||||
parent.type === "ArrayPattern"
|
||||
) &&
|
||||
!(
|
||||
allowInObjectDestructuring &&
|
||||
parent.type === "ObjectPattern"
|
||||
)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedUnderscore",
|
||||
data: {
|
||||
identifier,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if member expression has a dangling underscore
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkForDanglingUnderscoreInMemberExpression(node) {
|
||||
const identifier = node.property.name,
|
||||
isMemberOfThis = node.object.type === "ThisExpression",
|
||||
isMemberOfSuper = node.object.type === "Super",
|
||||
isMemberOfThisConstructor = isThisConstructorReference(node);
|
||||
|
||||
if (
|
||||
typeof identifier !== "undefined" &&
|
||||
hasDanglingUnderscore(identifier) &&
|
||||
!(isMemberOfThis && allowAfterThis) &&
|
||||
!(isMemberOfSuper && allowAfterSuper) &&
|
||||
!(isMemberOfThisConstructor && allowAfterThisConstructor) &&
|
||||
!isSpecialCaseIdentifierForMemberExpression(identifier) &&
|
||||
!isAllowed(identifier)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedUnderscore",
|
||||
data: {
|
||||
identifier,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if method declaration or method property has a dangling underscore
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkForDanglingUnderscoreInMethod(node) {
|
||||
const identifier = node.key.name;
|
||||
const isMethod =
|
||||
node.type === "MethodDefinition" ||
|
||||
(node.type === "Property" && node.method);
|
||||
|
||||
if (
|
||||
typeof identifier !== "undefined" &&
|
||||
enforceInMethodNames &&
|
||||
isMethod &&
|
||||
hasDanglingUnderscore(identifier) &&
|
||||
!isAllowed(identifier)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedUnderscore",
|
||||
data: {
|
||||
identifier:
|
||||
node.key.type === "PrivateIdentifier"
|
||||
? `#${identifier}`
|
||||
: identifier,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a class field has a dangling underscore
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkForDanglingUnderscoreInClassField(node) {
|
||||
const identifier = node.key.name;
|
||||
|
||||
if (
|
||||
typeof identifier !== "undefined" &&
|
||||
hasDanglingUnderscore(identifier) &&
|
||||
enforceInClassFields &&
|
||||
!isAllowed(identifier)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedUnderscore",
|
||||
data: {
|
||||
identifier:
|
||||
node.key.type === "PrivateIdentifier"
|
||||
? `#${identifier}`
|
||||
: identifier,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public API
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
FunctionDeclaration: checkForDanglingUnderscoreInFunction,
|
||||
VariableDeclarator: checkForDanglingUnderscoreInVariableExpression,
|
||||
MemberExpression: checkForDanglingUnderscoreInMemberExpression,
|
||||
MethodDefinition: checkForDanglingUnderscoreInMethod,
|
||||
PropertyDefinition: checkForDanglingUnderscoreInClassField,
|
||||
Property: checkForDanglingUnderscoreInMethod,
|
||||
FunctionExpression: checkForDanglingUnderscoreInFunction,
|
||||
ArrowFunctionExpression: checkForDanglingUnderscoreInFunction,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Run update and print output to terminal.
|
||||
*/
|
||||
declare function updateDb(print?: (str: string) => void): void
|
||||
|
||||
export = updateDb
|
||||
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const cp = require('child_process');
|
||||
const parse = require('./lib/parse');
|
||||
const enoent = require('./lib/enoent');
|
||||
|
||||
function spawn(command, args, options) {
|
||||
// Parse the arguments
|
||||
const parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Hook into child process "exit" event to emit an error if the command
|
||||
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
enoent.hookChildProcess(spawned, parsed);
|
||||
|
||||
return spawned;
|
||||
}
|
||||
|
||||
function spawnSync(command, args, options) {
|
||||
// Parse the arguments
|
||||
const parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = spawn;
|
||||
module.exports.spawn = spawn;
|
||||
module.exports.sync = spawnSync;
|
||||
|
||||
module.exports._parse = parse;
|
||||
module.exports._enoent = enoent;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"132":"K D E F A B mC"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","132":"C L M G N O P"},C:{"1":"0 9 nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","33":"1 2 3 4 5 6 7 8 O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB","132":"nC LC J PB K D E F qC rC","292":"A B C L M G N"},D:{"1":"0 9 lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","132":"J PB K D E F A B C L M G N","548":"1 2 3 4 5 6 7 8 O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB"},E:{"132":"J PB K D E sC SC tC uC vC","548":"F A B C L M G wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"132":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB 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 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC"},G:{"132":"E SC 9C lC AD BD CD DD","548":"ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"16":"WD"},I:{"1":"I","16":"LC J XD YD ZD aD lC bD cD"},J:{"16":"D A"},K:{"1":"H","16":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"132":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","16":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","33":"qD"}},B:4,C:"CSS unicode-bidi property",D:false};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F mC","132":"A B"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC rC","2":"nC LC qC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"J PB"},E:{"1":"K D E F A B C L M G uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB sC SC tC"},F:{"1":"0 1 2 3 4 5 6 7 8 C G N O P QB RB SB TB UB VB WB XB YB ZB 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 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z FC kC 8C GC","2":"F B 4C 5C 6C 7C"},G:{"1":"E BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC AD"},H:{"2":"WD"},I:{"1":"LC J I aD lC bD cD","2":"XD YD ZD"},J:{"1":"A","2":"D"},K:{"1":"C H FC kC GC","2":"A B"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:5,C:"FileReader API",D:true};
|
||||
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('-', function (t) {
|
||||
t.plan(6);
|
||||
t.deepEqual(parse(['-n', '-']), { n: '-', _: [] });
|
||||
t.deepEqual(parse(['--nnn', '-']), { nnn: '-', _: [] });
|
||||
t.deepEqual(parse(['-']), { _: ['-'] });
|
||||
t.deepEqual(parse(['-f-']), { f: '-', _: [] });
|
||||
t.deepEqual(
|
||||
parse(['-b', '-'], { boolean: 'b' }),
|
||||
{ b: true, _: ['-'] }
|
||||
);
|
||||
t.deepEqual(
|
||||
parse(['-s', '-'], { string: 's' }),
|
||||
{ s: '-', _: [] }
|
||||
);
|
||||
});
|
||||
|
||||
test('-a -- b', function (t) {
|
||||
t.plan(2);
|
||||
t.deepEqual(parse(['-a', '--', 'b']), { a: true, _: ['b'] });
|
||||
t.deepEqual(parse(['--a', '--', 'b']), { a: true, _: ['b'] });
|
||||
});
|
||||
|
||||
test('move arguments after the -- into their own `--` array', function (t) {
|
||||
t.plan(1);
|
||||
t.deepEqual(
|
||||
parse(['--name', 'John', 'before', '--', 'after'], { '--': true }),
|
||||
{ name: 'John', _: ['before'], '--': ['after'] }
|
||||
);
|
||||
});
|
||||
|
||||
test('--- option value', function (t) {
|
||||
// A multi-dash value is largely an edge case, but check the behaviour is as expected,
|
||||
// and in particular the same for short option and long option (as made consistent in Jan 2023).
|
||||
t.plan(2);
|
||||
t.deepEqual(parse(['-n', '---']), { n: '---', _: [] });
|
||||
t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] });
|
||||
});
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _classPrivateMethodInitSpec;
|
||||
var _checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js");
|
||||
function _classPrivateMethodInitSpec(obj, privateSet) {
|
||||
(0, _checkPrivateRedeclaration.default)(obj, privateSet);
|
||||
privateSet.add(obj);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=classPrivateMethodInitSpec.js.map
|
||||
Reference in New Issue
Block a user