mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
tools: udpate @babel/eslint-parser
Remove unused plugins and update @babel/eslint-parser PR-URL: https://github.com/nodejs/node/pull/40394 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
43c780e741
commit
012152d7d6
934 files changed
+4266
-4670
No files matched your search
@@ -36,10 +36,6 @@ module.exports = {
|
||||
plugins: ['markdown', 'node-core'],
|
||||
parser: '@babel/eslint-parser',
|
||||
parserOptions: {
|
||||
babelOptions: {
|
||||
plugins: [
|
||||
],
|
||||
},
|
||||
requireConfigFile: false,
|
||||
sourceType: 'script',
|
||||
},
|
||||
|
||||
+10
-2
@@ -501,11 +501,19 @@ function configFieldIsApplicable(context, test, dirname) {
|
||||
return matchesPatterns(context, patterns, dirname);
|
||||
}
|
||||
|
||||
function ignoreListReplacer(_key, value) {
|
||||
if (value instanceof RegExp) {
|
||||
return String(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function shouldIgnore(context, ignore, only, dirname) {
|
||||
if (ignore && matchesPatterns(context, ignore, dirname)) {
|
||||
var _context$filename;
|
||||
|
||||
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore)}\` from "${dirname}"`;
|
||||
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
|
||||
if (context.showConfig) {
|
||||
@@ -518,7 +526,7 @@ function shouldIgnore(context, ignore, only, dirname) {
|
||||
if (only && !matchesPatterns(context, only, dirname)) {
|
||||
var _context$filename2;
|
||||
|
||||
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only)}\` from "${dirname}"`;
|
||||
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
|
||||
if (context.showConfig) {
|
||||
|
||||
+1
-1
@@ -245,7 +245,7 @@ var _transformAst = require("./transform-ast");
|
||||
|
||||
var _parse = require("./parse");
|
||||
|
||||
const version = "7.15.0";
|
||||
const version = "7.15.8";
|
||||
exports.version = version;
|
||||
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]);
|
||||
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;
|
||||
|
||||
+45
-23
@@ -35,10 +35,10 @@ function _template() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
function _t() {
|
||||
const data = require("@babel/types");
|
||||
|
||||
t = function () {
|
||||
_t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -47,7 +47,29 @@ function t() {
|
||||
|
||||
var _file = require("../transformation/file/file");
|
||||
|
||||
const buildUmdWrapper = replacements => (0, _template().default)`
|
||||
const {
|
||||
arrayExpression,
|
||||
assignmentExpression,
|
||||
binaryExpression,
|
||||
blockStatement,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
conditionalExpression,
|
||||
exportNamedDeclaration,
|
||||
exportSpecifier,
|
||||
expressionStatement,
|
||||
functionExpression,
|
||||
identifier,
|
||||
memberExpression,
|
||||
objectExpression,
|
||||
program,
|
||||
stringLiteral,
|
||||
unaryExpression,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t();
|
||||
|
||||
const buildUmdWrapper = replacements => _template().default.statement`
|
||||
(function (root, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(AMD_ARGUMENTS, factory);
|
||||
@@ -62,11 +84,11 @@ const buildUmdWrapper = replacements => (0, _template().default)`
|
||||
`(replacements);
|
||||
|
||||
function buildGlobal(allowlist) {
|
||||
const namespace = t().identifier("babelHelpers");
|
||||
const namespace = identifier("babelHelpers");
|
||||
const body = [];
|
||||
const container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
|
||||
const tree = t().program([t().expressionStatement(t().callExpression(container, [t().conditionalExpression(t().binaryExpression("===", t().unaryExpression("typeof", t().identifier("global")), t().stringLiteral("undefined")), t().identifier("self"), t().identifier("global"))]))]);
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().assignmentExpression("=", t().memberExpression(t().identifier("global"), namespace), t().objectExpression([])))]));
|
||||
const container = functionExpression(null, [identifier("global")], blockStatement(body));
|
||||
const tree = program([expressionStatement(callExpression(container, [conditionalExpression(binaryExpression("===", unaryExpression("typeof", identifier("global")), stringLiteral("undefined")), identifier("self"), identifier("global"))]))]);
|
||||
body.push(variableDeclaration("var", [variableDeclarator(namespace, assignmentExpression("=", memberExpression(identifier("global"), namespace), objectExpression([])))]));
|
||||
buildHelpers(body, namespace, allowlist);
|
||||
return tree;
|
||||
}
|
||||
@@ -74,40 +96,40 @@ function buildGlobal(allowlist) {
|
||||
function buildModule(allowlist) {
|
||||
const body = [];
|
||||
const refs = buildHelpers(body, null, allowlist);
|
||||
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(name => {
|
||||
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name));
|
||||
body.unshift(exportNamedDeclaration(null, Object.keys(refs).map(name => {
|
||||
return exportSpecifier(cloneNode(refs[name]), identifier(name));
|
||||
})));
|
||||
return t().program(body, [], "module");
|
||||
return program(body, [], "module");
|
||||
}
|
||||
|
||||
function buildUmd(allowlist) {
|
||||
const namespace = t().identifier("babelHelpers");
|
||||
const namespace = identifier("babelHelpers");
|
||||
const body = [];
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))]));
|
||||
body.push(variableDeclaration("var", [variableDeclarator(namespace, identifier("global"))]));
|
||||
buildHelpers(body, namespace, allowlist);
|
||||
return t().program([buildUmdWrapper({
|
||||
FACTORY_PARAMETERS: t().identifier("global"),
|
||||
BROWSER_ARGUMENTS: t().assignmentExpression("=", t().memberExpression(t().identifier("root"), namespace), t().objectExpression([])),
|
||||
COMMON_ARGUMENTS: t().identifier("exports"),
|
||||
AMD_ARGUMENTS: t().arrayExpression([t().stringLiteral("exports")]),
|
||||
return program([buildUmdWrapper({
|
||||
FACTORY_PARAMETERS: identifier("global"),
|
||||
BROWSER_ARGUMENTS: assignmentExpression("=", memberExpression(identifier("root"), namespace), objectExpression([])),
|
||||
COMMON_ARGUMENTS: identifier("exports"),
|
||||
AMD_ARGUMENTS: arrayExpression([stringLiteral("exports")]),
|
||||
FACTORY_BODY: body,
|
||||
UMD_ROOT: t().identifier("this")
|
||||
UMD_ROOT: identifier("this")
|
||||
})]);
|
||||
}
|
||||
|
||||
function buildVar(allowlist) {
|
||||
const namespace = t().identifier("babelHelpers");
|
||||
const namespace = identifier("babelHelpers");
|
||||
const body = [];
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))]));
|
||||
const tree = t().program(body);
|
||||
body.push(variableDeclaration("var", [variableDeclarator(namespace, objectExpression([]))]));
|
||||
const tree = program(body);
|
||||
buildHelpers(body, namespace, allowlist);
|
||||
body.push(t().expressionStatement(namespace));
|
||||
body.push(expressionStatement(namespace));
|
||||
return tree;
|
||||
}
|
||||
|
||||
function buildHelpers(body, namespace, allowlist) {
|
||||
const getHelperReference = name => {
|
||||
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier(`_${name}`);
|
||||
return namespace ? memberExpression(namespace, identifier(name)) : identifier(`_${name}`);
|
||||
};
|
||||
|
||||
const refs = {};
|
||||
|
||||
+9
-4
@@ -35,10 +35,10 @@ function _codeFrame() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
function _t() {
|
||||
const data = require("@babel/types");
|
||||
|
||||
t = function () {
|
||||
_t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -65,6 +65,11 @@ function _semver() {
|
||||
return data;
|
||||
}
|
||||
|
||||
const {
|
||||
cloneNode,
|
||||
interpreterDirective
|
||||
} = _t();
|
||||
|
||||
const errorVisitor = {
|
||||
enter(path, state) {
|
||||
const loc = path.node.loc;
|
||||
@@ -122,7 +127,7 @@ class File {
|
||||
|
||||
set shebang(value) {
|
||||
if (value) {
|
||||
this.path.get("interpreter").replaceWith(t().interpreterDirective(value));
|
||||
this.path.get("interpreter").replaceWith(interpreterDirective(value));
|
||||
} else {
|
||||
this.path.get("interpreter").remove();
|
||||
}
|
||||
@@ -169,7 +174,7 @@ class File {
|
||||
|
||||
addHelper(name) {
|
||||
const declar = this.declarations[name];
|
||||
if (declar) return t().cloneNode(declar);
|
||||
if (declar) return cloneNode(declar);
|
||||
const generator = this.get("helperGenerator");
|
||||
|
||||
if (generator) {
|
||||
|
||||
+9
-4
@@ -35,10 +35,10 @@ function _debug() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
function _t() {
|
||||
const data = require("@babel/types");
|
||||
|
||||
t = function () {
|
||||
_t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -61,6 +61,11 @@ var _parser = require("../parser");
|
||||
|
||||
var _cloneDeep = require("./util/clone-deep");
|
||||
|
||||
const {
|
||||
file,
|
||||
traverseFast
|
||||
} = _t();
|
||||
|
||||
const debug = _debug()("babel:transform:file");
|
||||
|
||||
const LARGE_INPUT_SOURCEMAP_THRESHOLD = 1000000;
|
||||
@@ -70,7 +75,7 @@ function* normalizeFile(pluginPasses, options, code, ast) {
|
||||
|
||||
if (ast) {
|
||||
if (ast.type === "Program") {
|
||||
ast = t().file(ast, [], []);
|
||||
ast = file(ast, [], []);
|
||||
} else if (ast.type !== "File") {
|
||||
throw new Error("AST root must be a Program or File node");
|
||||
}
|
||||
@@ -153,7 +158,7 @@ function extractCommentsFromList(regex, comments, lastComment) {
|
||||
|
||||
function extractComments(regex, ast) {
|
||||
let lastComment = null;
|
||||
t().traverseFast(ast, node => {
|
||||
traverseFast(ast, node => {
|
||||
[node.leadingComments, lastComment] = extractCommentsFromList(regex, node.leadingComments, lastComment);
|
||||
[node.innerComments, lastComment] = extractCommentsFromList(regex, node.innerComments, lastComment);
|
||||
[node.trailingComments, lastComment] = extractCommentsFromList(regex, node.trailingComments, lastComment);
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end).length;
|
||||
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} |`;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/code-frame",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.8",
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||
|
||||
Generated
Vendored
-2
@@ -11,8 +11,6 @@ exports.DirectiveLiteral = DirectiveLiteral;
|
||||
exports.InterpreterDirective = InterpreterDirective;
|
||||
exports.Placeholder = Placeholder;
|
||||
|
||||
var t = require("@babel/types");
|
||||
|
||||
function File(node) {
|
||||
if (node.program) {
|
||||
this.print(node.program.interpreter, node);
|
||||
|
||||
Generated
Vendored
+3
-2
@@ -12,12 +12,12 @@ exports.ClassPrivateMethod = ClassPrivateMethod;
|
||||
exports._classMethodHead = _classMethodHead;
|
||||
exports.StaticBlock = StaticBlock;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
isExportDefaultDeclaration,
|
||||
isExportNamedDeclaration
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function ClassDeclaration(node, parent) {
|
||||
if (!this.format.decoratorsBeforeExport || !isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) {
|
||||
@@ -35,6 +35,7 @@ function ClassDeclaration(node, parent) {
|
||||
}
|
||||
|
||||
this.word("class");
|
||||
this.printInnerComments(node);
|
||||
|
||||
if (node.id) {
|
||||
this.space();
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -29,7 +29,7 @@ exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier;
|
||||
exports.ModuleExpression = ModuleExpression;
|
||||
exports.AwaitExpression = exports.YieldExpression = void 0;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var n = require("../node");
|
||||
|
||||
@@ -38,7 +38,7 @@ const {
|
||||
isLiteral,
|
||||
isMemberExpression,
|
||||
isNewExpression
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function UnaryExpression(node) {
|
||||
if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || node.operator === "throw") {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -78,7 +78,7 @@ Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
|
||||
}
|
||||
});
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _modules = require("./modules");
|
||||
|
||||
@@ -87,7 +87,7 @@ var _types2 = require("./types");
|
||||
const {
|
||||
isDeclareExportDeclaration,
|
||||
isStatement
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function AnyTypeAnnotation() {
|
||||
this.word("any");
|
||||
|
||||
Generated
Vendored
-2
@@ -19,8 +19,6 @@ exports.JSXFragment = JSXFragment;
|
||||
exports.JSXOpeningFragment = JSXOpeningFragment;
|
||||
exports.JSXClosingFragment = JSXClosingFragment;
|
||||
|
||||
var t = require("@babel/types");
|
||||
|
||||
function JSXAttribute(node) {
|
||||
this.print(node.name, node);
|
||||
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -12,11 +12,11 @@ exports._functionHead = _functionHead;
|
||||
exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression;
|
||||
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
isIdentifier
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function _params(node) {
|
||||
this.print(node.typeParameters, node);
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -15,7 +15,7 @@ exports.ImportDeclaration = ImportDeclaration;
|
||||
exports.ImportAttribute = ImportAttribute;
|
||||
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
isClassDeclaration,
|
||||
@@ -24,7 +24,7 @@ const {
|
||||
isImportDefaultSpecifier,
|
||||
isImportNamespaceSpecifier,
|
||||
isStatement
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function ImportSpecifier(node) {
|
||||
if (node.importKind === "type" || node.importKind === "typeof") {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -18,14 +18,14 @@ exports.VariableDeclaration = VariableDeclaration;
|
||||
exports.VariableDeclarator = VariableDeclarator;
|
||||
exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForOfStatement = exports.ForInStatement = void 0;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
isFor,
|
||||
isForStatement,
|
||||
isIfStatement,
|
||||
isStatement
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function WithStatement(node) {
|
||||
this.word("with");
|
||||
|
||||
Generated
Vendored
-2
@@ -7,8 +7,6 @@ exports.TaggedTemplateExpression = TaggedTemplateExpression;
|
||||
exports.TemplateElement = TemplateElement;
|
||||
exports.TemplateLiteral = TemplateLiteral;
|
||||
|
||||
var t = require("@babel/types");
|
||||
|
||||
function TaggedTemplateExpression(node) {
|
||||
this.print(node.tag, node);
|
||||
this.print(node.typeParameters, node);
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -24,14 +24,14 @@ exports.PipelineTopicExpression = PipelineTopicExpression;
|
||||
exports.PipelineBareFunction = PipelineBareFunction;
|
||||
exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _jsesc = require("jsesc");
|
||||
|
||||
const {
|
||||
isAssignmentPattern,
|
||||
isIdentifier
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function Identifier(node) {
|
||||
this.exactSource(node.loc, () => {
|
||||
|
||||
Generated
Vendored
-2
@@ -73,8 +73,6 @@ exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
|
||||
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
|
||||
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
|
||||
|
||||
var t = require("@babel/types");
|
||||
|
||||
function TSTypeAnnotation(node) {
|
||||
this.token(":");
|
||||
this.space();
|
||||
|
||||
+4
-3
@@ -12,14 +12,15 @@ var whitespace = require("./whitespace");
|
||||
|
||||
var parens = require("./parentheses");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
FLIPPED_ALIAS_KEYS,
|
||||
isCallExpression,
|
||||
isExpressionStatement,
|
||||
isMemberExpression,
|
||||
isNewExpression
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function expandAliases(obj) {
|
||||
const newObj = {};
|
||||
@@ -33,7 +34,7 @@ function expandAliases(obj) {
|
||||
}
|
||||
|
||||
for (const type of Object.keys(obj)) {
|
||||
const aliases = t.FLIPPED_ALIAS_KEYS[type];
|
||||
const aliases = FLIPPED_ALIAS_KEYS[type];
|
||||
|
||||
if (aliases) {
|
||||
for (const alias of aliases) {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -28,7 +28,7 @@ exports.AssignmentExpression = AssignmentExpression;
|
||||
exports.LogicalExpression = LogicalExpression;
|
||||
exports.Identifier = Identifier;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
isArrayTypeAnnotation,
|
||||
@@ -78,7 +78,7 @@ const {
|
||||
isVariableDeclarator,
|
||||
isWhileStatement,
|
||||
isYieldExpression
|
||||
} = t;
|
||||
} = _t;
|
||||
const PRECEDENCE = {
|
||||
"||": 0,
|
||||
"??": 0,
|
||||
|
||||
Generated
Vendored
+4
-3
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.list = exports.nodes = void 0;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
FLIPPED_ALIAS_KEYS,
|
||||
isArrayExpression,
|
||||
isAssignmentExpression,
|
||||
isBinary,
|
||||
@@ -21,7 +22,7 @@ const {
|
||||
isOptionalCallExpression,
|
||||
isOptionalMemberExpression,
|
||||
isStringLiteral
|
||||
} = t;
|
||||
} = _t;
|
||||
|
||||
function crawl(node, state = {}) {
|
||||
if (isMemberExpression(node) || isOptionalMemberExpression(node)) {
|
||||
@@ -205,7 +206,7 @@ exports.list = list;
|
||||
};
|
||||
}
|
||||
|
||||
[type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
|
||||
[type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
|
||||
nodes[type] = function () {
|
||||
return amounts;
|
||||
};
|
||||
|
||||
+6
-6
@@ -9,19 +9,19 @@ var _buffer = require("./buffer");
|
||||
|
||||
var n = require("./node");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var generatorFunctions = require("./generators");
|
||||
|
||||
const SCIENTIFIC_NOTATION = /e/i;
|
||||
const ZERO_DECIMAL_INTEGER = /\.0+$/;
|
||||
const NON_DECIMAL_LITERAL = /^0[box]/;
|
||||
const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/;
|
||||
const {
|
||||
isProgram,
|
||||
isFile,
|
||||
isEmptyStatement
|
||||
} = t;
|
||||
} = _t;
|
||||
const SCIENTIFIC_NOTATION = /e/i;
|
||||
const ZERO_DECIMAL_INTEGER = /\.0+$/;
|
||||
const NON_DECIMAL_LITERAL = /^0[box]/;
|
||||
const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/;
|
||||
const {
|
||||
needsParens,
|
||||
needsWhitespaceAfter,
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/generator",
|
||||
"version": "7.15.0",
|
||||
"version": "7.15.8",
|
||||
"description": "Turns an AST into code.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
@@ -19,13 +19,13 @@
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.15.0",
|
||||
"@babel/types": "^7.15.6",
|
||||
"jsesc": "^2.5.1",
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-fixtures": "7.14.5",
|
||||
"@babel/parser": "7.15.0",
|
||||
"@babel/parser": "7.15.8",
|
||||
"@types/jsesc": "^2.5.0",
|
||||
"@types/source-map": "^0.5.0",
|
||||
"charcodes": "^0.2.0"
|
||||
|
||||
Generated
Vendored
+4
-3
@@ -164,9 +164,10 @@ function generateTargets(inputTargets) {
|
||||
return input;
|
||||
}
|
||||
|
||||
function resolveTargets(queries) {
|
||||
function resolveTargets(queries, env) {
|
||||
const resolved = _browserslist(queries, {
|
||||
mobileToDesktop: true
|
||||
mobileToDesktop: true,
|
||||
env
|
||||
});
|
||||
|
||||
return getLowestVersions(resolved);
|
||||
@@ -209,7 +210,7 @@ function getTargets(inputTargets = {}, options = {}) {
|
||||
}
|
||||
|
||||
if (browsers) {
|
||||
const queryBrowsers = resolveTargets(browsers);
|
||||
const queryBrowsers = resolveTargets(browsers, options.browserslistEnv);
|
||||
|
||||
if (esmodules === "intersect") {
|
||||
for (const browser of Object.keys(queryBrowsers)) {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-compilation-targets",
|
||||
"version": "7.15.0",
|
||||
"version": "7.15.4",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
"description": "Helper functions on Babel compilation targets",
|
||||
@@ -30,7 +30,7 @@
|
||||
"@babel/core": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.15.0",
|
||||
"@babel/core": "7.15.4",
|
||||
"@babel/helper-plugin-test-runner": "7.14.5",
|
||||
"@types/semver": "^5.5.0"
|
||||
},
|
||||
|
||||
Generated
Vendored
+33
-17
@@ -9,8 +9,24 @@ var _helperGetFunctionArity = require("@babel/helper-get-function-arity");
|
||||
|
||||
var _template = require("@babel/template");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
NOT_LOCAL_BINDING,
|
||||
cloneNode,
|
||||
identifier,
|
||||
isAssignmentExpression,
|
||||
isFunction,
|
||||
isIdentifier,
|
||||
isLiteral,
|
||||
isNullLiteral,
|
||||
isObjectMethod,
|
||||
isObjectProperty,
|
||||
isRegExpLiteral,
|
||||
isTemplateLiteral,
|
||||
isVariableDeclarator,
|
||||
toBindingIdentifierName
|
||||
} = _t;
|
||||
const buildPropertyMethodAssignmentWrapper = (0, _template.default)(`
|
||||
(function (FUNCTION_KEY) {
|
||||
function FUNCTION_ID() {
|
||||
@@ -49,15 +65,15 @@ const visitor = {
|
||||
};
|
||||
|
||||
function getNameFromLiteralId(id) {
|
||||
if (t.isNullLiteral(id)) {
|
||||
if (isNullLiteral(id)) {
|
||||
return "null";
|
||||
}
|
||||
|
||||
if (t.isRegExpLiteral(id)) {
|
||||
if (isRegExpLiteral(id)) {
|
||||
return `_${id.pattern}_${id.flags}`;
|
||||
}
|
||||
|
||||
if (t.isTemplateLiteral(id)) {
|
||||
if (isTemplateLiteral(id)) {
|
||||
return id.quasis.map(quasi => quasi.value.raw).join("");
|
||||
}
|
||||
|
||||
@@ -73,7 +89,7 @@ function wrap(state, method, id, scope) {
|
||||
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
|
||||
scope.rename(id.name);
|
||||
} else {
|
||||
if (!t.isFunction(method)) return;
|
||||
if (!isFunction(method)) return;
|
||||
let build = buildPropertyMethodAssignmentWrapper;
|
||||
|
||||
if (method.generator) {
|
||||
@@ -128,23 +144,23 @@ function _default({
|
||||
}, localBinding = false) {
|
||||
if (node.id) return;
|
||||
|
||||
if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, {
|
||||
if ((isObjectProperty(parent) || isObjectMethod(parent, {
|
||||
kind: "method"
|
||||
})) && (!parent.computed || t.isLiteral(parent.key))) {
|
||||
})) && (!parent.computed || isLiteral(parent.key))) {
|
||||
id = parent.key;
|
||||
} else if (t.isVariableDeclarator(parent)) {
|
||||
} else if (isVariableDeclarator(parent)) {
|
||||
id = parent.id;
|
||||
|
||||
if (t.isIdentifier(id) && !localBinding) {
|
||||
if (isIdentifier(id) && !localBinding) {
|
||||
const binding = scope.parent.getBinding(id.name);
|
||||
|
||||
if (binding && binding.constant && scope.getBinding(id.name) === binding) {
|
||||
node.id = t.cloneNode(id);
|
||||
node.id[t.NOT_LOCAL_BINDING] = true;
|
||||
node.id = cloneNode(id);
|
||||
node.id[NOT_LOCAL_BINDING] = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (t.isAssignmentExpression(parent, {
|
||||
} else if (isAssignmentExpression(parent, {
|
||||
operator: "="
|
||||
})) {
|
||||
id = parent.left;
|
||||
@@ -154,9 +170,9 @@ function _default({
|
||||
|
||||
let name;
|
||||
|
||||
if (id && t.isLiteral(id)) {
|
||||
if (id && isLiteral(id)) {
|
||||
name = getNameFromLiteralId(id);
|
||||
} else if (id && t.isIdentifier(id)) {
|
||||
} else if (id && isIdentifier(id)) {
|
||||
name = id.name;
|
||||
}
|
||||
|
||||
@@ -164,9 +180,9 @@ function _default({
|
||||
return;
|
||||
}
|
||||
|
||||
name = t.toBindingIdentifierName(name);
|
||||
id = t.identifier(name);
|
||||
id[t.NOT_LOCAL_BINDING] = true;
|
||||
name = toBindingIdentifierName(name);
|
||||
id = identifier(name);
|
||||
id[NOT_LOCAL_BINDING] = true;
|
||||
const state = visit(node, name, scope);
|
||||
return wrap(state, node, id, scope) || node;
|
||||
}
|
||||
Generated
Vendored
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-function-name",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.4",
|
||||
"description": "Helper function to change the property 'name' of every function",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,9 +14,9 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-get-function-arity": "^7.14.5",
|
||||
"@babel/template": "^7.14.5",
|
||||
"@babel/types": "^7.14.5"
|
||||
"@babel/helper-get-function-arity": "^7.15.4",
|
||||
"@babel/template": "^7.15.4",
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+7
-2
@@ -5,7 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
isAssignmentPattern,
|
||||
isRestElement
|
||||
} = _t;
|
||||
|
||||
function _default(node) {
|
||||
const params = node.params;
|
||||
@@ -13,7 +18,7 @@ function _default(node) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
const param = params[i];
|
||||
|
||||
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
|
||||
if (isAssignmentPattern(param) || isRestElement(param)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-get-function-arity",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.4",
|
||||
"description": "Helper function to get function arity",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.14.5"
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+8
-3
@@ -5,8 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = hoistVariables;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
assignmentExpression,
|
||||
expressionStatement,
|
||||
identifier
|
||||
} = _t;
|
||||
const visitor = {
|
||||
Scope(path, state) {
|
||||
if (state.kind === "let") path.skip();
|
||||
@@ -26,11 +31,11 @@ const visitor = {
|
||||
firstId = declar.node.id;
|
||||
|
||||
if (declar.node.init) {
|
||||
nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.node.id, declar.node.init)));
|
||||
nodes.push(expressionStatement(assignmentExpression("=", declar.node.id, declar.node.init)));
|
||||
}
|
||||
|
||||
for (const name of Object.keys(declar.getBindingIdentifiers())) {
|
||||
state.emit(t.identifier(name), name, declar.node.init !== null);
|
||||
state.emit(identifier(name), name, declar.node.init !== null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Generated
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-hoist-variables",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.4",
|
||||
"description": "Helper function to hoist variables",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,11 +14,11 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.14.5"
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"TODO": "The @babel/traverse dependency is only needed for the NodePath TS type. We can consider exporting it from @babel/core.",
|
||||
"devDependencies": {
|
||||
"@babel/traverse": "7.14.5"
|
||||
"@babel/traverse": "7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+53
-29
@@ -2,7 +2,7 @@
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var t = require('@babel/types');
|
||||
var _t = require('@babel/types');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
@@ -24,7 +24,7 @@ function _interopNamespace(e) {
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var t__namespace = /*#__PURE__*/_interopNamespace(t);
|
||||
var _t__namespace = /*#__PURE__*/_interopNamespace(_t);
|
||||
|
||||
function willPathCastToBoolean(path) {
|
||||
const maybeWrapped = path;
|
||||
@@ -65,6 +65,30 @@ function willPathCastToBoolean(path) {
|
||||
});
|
||||
}
|
||||
|
||||
const {
|
||||
LOGICAL_OPERATORS,
|
||||
arrowFunctionExpression,
|
||||
assignmentExpression,
|
||||
binaryExpression,
|
||||
booleanLiteral,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
conditionalExpression,
|
||||
identifier,
|
||||
isMemberExpression,
|
||||
isOptionalCallExpression,
|
||||
isOptionalMemberExpression,
|
||||
isUpdateExpression,
|
||||
logicalExpression,
|
||||
memberExpression,
|
||||
nullLiteral,
|
||||
numericLiteral,
|
||||
optionalCallExpression,
|
||||
optionalMemberExpression,
|
||||
sequenceExpression,
|
||||
unaryExpression
|
||||
} = _t__namespace;
|
||||
|
||||
class AssignmentMemoiser {
|
||||
constructor() {
|
||||
this._map = void 0;
|
||||
@@ -86,7 +110,7 @@ class AssignmentMemoiser {
|
||||
record.count--;
|
||||
|
||||
if (record.count === 0) {
|
||||
return t__namespace.assignmentExpression("=", value, key);
|
||||
return assignmentExpression("=", value, key);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -106,8 +130,8 @@ function toNonOptional(path, base) {
|
||||
node
|
||||
} = path;
|
||||
|
||||
if (t__namespace.isOptionalMemberExpression(node)) {
|
||||
return t__namespace.memberExpression(base, node.property, node.computed);
|
||||
if (isOptionalMemberExpression(node)) {
|
||||
return memberExpression(base, node.property, node.computed);
|
||||
}
|
||||
|
||||
if (path.isOptionalCallExpression()) {
|
||||
@@ -118,11 +142,11 @@ function toNonOptional(path, base) {
|
||||
object
|
||||
} = callee.node;
|
||||
const context = path.scope.maybeGenerateMemoised(object) || object;
|
||||
callee.get("object").replaceWith(t__namespace.assignmentExpression("=", context, object));
|
||||
return t__namespace.callExpression(t__namespace.memberExpression(base, t__namespace.identifier("call")), [context, ...path.node.arguments]);
|
||||
callee.get("object").replaceWith(assignmentExpression("=", context, object));
|
||||
return callExpression(memberExpression(base, identifier("call")), [context, ...path.node.arguments]);
|
||||
}
|
||||
|
||||
return t__namespace.callExpression(base, path.node.arguments);
|
||||
return callExpression(base, path.node.arguments);
|
||||
}
|
||||
|
||||
return path.node;
|
||||
@@ -167,11 +191,11 @@ const handle = {
|
||||
node,
|
||||
parent
|
||||
}) => {
|
||||
if (t__namespace.isOptionalMemberExpression(parent)) {
|
||||
if (isOptionalMemberExpression(parent)) {
|
||||
return parent.optional || parent.object !== node;
|
||||
}
|
||||
|
||||
if (t__namespace.isOptionalCallExpression(parent)) {
|
||||
if (isOptionalCallExpression(parent)) {
|
||||
return node !== member.node && parent.optional || parent.callee !== node;
|
||||
}
|
||||
|
||||
@@ -179,7 +203,7 @@ const handle = {
|
||||
});
|
||||
|
||||
if (scope.path.isPattern()) {
|
||||
endPath.replaceWith(t__namespace.callExpression(t__namespace.arrowFunctionExpression([], endPath.node), []));
|
||||
endPath.replaceWith(callExpression(arrowFunctionExpression([], endPath.node), []));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -262,7 +286,7 @@ const handle = {
|
||||
let context;
|
||||
const endParentPath = endPath.parentPath;
|
||||
|
||||
if (t__namespace.isMemberExpression(regular) && endParentPath.isOptionalCallExpression({
|
||||
if (isMemberExpression(regular) && endParentPath.isOptionalCallExpression({
|
||||
callee: endPath.node,
|
||||
optional: true
|
||||
})) {
|
||||
@@ -272,7 +296,7 @@ const handle = {
|
||||
context = member.scope.maybeGenerateMemoised(object);
|
||||
|
||||
if (context) {
|
||||
regular.object = t__namespace.assignmentExpression("=", context, object);
|
||||
regular.object = assignmentExpression("=", context, object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,39 +307,39 @@ const handle = {
|
||||
regular = endParentPath.node;
|
||||
}
|
||||
|
||||
const baseMemoised = baseNeedsMemoised ? t__namespace.assignmentExpression("=", t__namespace.cloneNode(baseRef), t__namespace.cloneNode(startingNode)) : t__namespace.cloneNode(baseRef);
|
||||
const baseMemoised = baseNeedsMemoised ? assignmentExpression("=", cloneNode(baseRef), cloneNode(startingNode)) : cloneNode(baseRef);
|
||||
|
||||
if (willEndPathCastToBoolean) {
|
||||
let nonNullishCheck;
|
||||
|
||||
if (noDocumentAll) {
|
||||
nonNullishCheck = t__namespace.binaryExpression("!=", baseMemoised, t__namespace.nullLiteral());
|
||||
nonNullishCheck = binaryExpression("!=", baseMemoised, nullLiteral());
|
||||
} else {
|
||||
nonNullishCheck = t__namespace.logicalExpression("&&", t__namespace.binaryExpression("!==", baseMemoised, t__namespace.nullLiteral()), t__namespace.binaryExpression("!==", t__namespace.cloneNode(baseRef), scope.buildUndefinedNode()));
|
||||
nonNullishCheck = logicalExpression("&&", binaryExpression("!==", baseMemoised, nullLiteral()), binaryExpression("!==", cloneNode(baseRef), scope.buildUndefinedNode()));
|
||||
}
|
||||
|
||||
replacementPath.replaceWith(t__namespace.logicalExpression("&&", nonNullishCheck, regular));
|
||||
replacementPath.replaceWith(logicalExpression("&&", nonNullishCheck, regular));
|
||||
} else {
|
||||
let nullishCheck;
|
||||
|
||||
if (noDocumentAll) {
|
||||
nullishCheck = t__namespace.binaryExpression("==", baseMemoised, t__namespace.nullLiteral());
|
||||
nullishCheck = binaryExpression("==", baseMemoised, nullLiteral());
|
||||
} else {
|
||||
nullishCheck = t__namespace.logicalExpression("||", t__namespace.binaryExpression("===", baseMemoised, t__namespace.nullLiteral()), t__namespace.binaryExpression("===", t__namespace.cloneNode(baseRef), scope.buildUndefinedNode()));
|
||||
nullishCheck = logicalExpression("||", binaryExpression("===", baseMemoised, nullLiteral()), binaryExpression("===", cloneNode(baseRef), scope.buildUndefinedNode()));
|
||||
}
|
||||
|
||||
replacementPath.replaceWith(t__namespace.conditionalExpression(nullishCheck, isDeleteOperation ? t__namespace.booleanLiteral(true) : scope.buildUndefinedNode(), regular));
|
||||
replacementPath.replaceWith(conditionalExpression(nullishCheck, isDeleteOperation ? booleanLiteral(true) : scope.buildUndefinedNode(), regular));
|
||||
}
|
||||
|
||||
if (context) {
|
||||
const endParent = endParentPath.node;
|
||||
endParentPath.replaceWith(t__namespace.optionalCallExpression(t__namespace.optionalMemberExpression(endParent.callee, t__namespace.identifier("call"), false, true), [t__namespace.cloneNode(context), ...endParent.arguments], false));
|
||||
endParentPath.replaceWith(optionalCallExpression(optionalMemberExpression(endParent.callee, identifier("call"), false, true), [cloneNode(context), ...endParent.arguments], false));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (t__namespace.isUpdateExpression(parent, {
|
||||
if (isUpdateExpression(parent, {
|
||||
argument: node
|
||||
})) {
|
||||
if (this.simpleSet) {
|
||||
@@ -328,7 +352,7 @@ const handle = {
|
||||
prefix
|
||||
} = parent;
|
||||
this.memoise(member, 2);
|
||||
const value = t__namespace.binaryExpression(operator[0], t__namespace.unaryExpression("+", this.get(member)), t__namespace.numericLiteral(1));
|
||||
const value = binaryExpression(operator[0], unaryExpression("+", this.get(member)), numericLiteral(1));
|
||||
|
||||
if (prefix) {
|
||||
parentPath.replaceWith(this.set(member, value));
|
||||
@@ -340,8 +364,8 @@ const handle = {
|
||||
scope.push({
|
||||
id: ref
|
||||
});
|
||||
value.left = t__namespace.assignmentExpression("=", t__namespace.cloneNode(ref), value.left);
|
||||
parentPath.replaceWith(t__namespace.sequenceExpression([this.set(member, value), t__namespace.cloneNode(ref)]));
|
||||
value.left = assignmentExpression("=", cloneNode(ref), value.left);
|
||||
parentPath.replaceWith(sequenceExpression([this.set(member, value), cloneNode(ref)]));
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -365,12 +389,12 @@ const handle = {
|
||||
} else {
|
||||
const operatorTrunc = operator.slice(0, -1);
|
||||
|
||||
if (t__namespace.LOGICAL_OPERATORS.includes(operatorTrunc)) {
|
||||
if (LOGICAL_OPERATORS.includes(operatorTrunc)) {
|
||||
this.memoise(member, 1);
|
||||
parentPath.replaceWith(t__namespace.logicalExpression(operatorTrunc, this.get(member), this.set(member, value)));
|
||||
parentPath.replaceWith(logicalExpression(operatorTrunc, this.get(member), this.set(member, value)));
|
||||
} else {
|
||||
this.memoise(member, 2);
|
||||
parentPath.replaceWith(this.set(member, t__namespace.binaryExpression(operatorTrunc, this.get(member), value)));
|
||||
parentPath.replaceWith(this.set(member, binaryExpression(operatorTrunc, this.get(member), value)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +412,7 @@ const handle = {
|
||||
callee: node
|
||||
})) {
|
||||
if (scope.path.isPattern()) {
|
||||
parentPath.replaceWith(t__namespace.callExpression(t__namespace.arrowFunctionExpression([], parentPath.node), []));
|
||||
parentPath.replaceWith(callExpression(arrowFunctionExpression([], parentPath.node), []));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Generated
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-member-expression-to-functions",
|
||||
"version": "7.15.0",
|
||||
"version": "7.15.4",
|
||||
"description": "Helper function to replace certain member expressions with function calls",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -15,10 +15,10 @@
|
||||
"main": "./lib/index.js",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.15.0"
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/traverse": "7.15.0"
|
||||
"@babel/traverse": "7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+32
-17
@@ -7,7 +7,22 @@ exports.default = void 0;
|
||||
|
||||
var _assert = require("assert");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
callExpression,
|
||||
cloneNode,
|
||||
expressionStatement,
|
||||
identifier,
|
||||
importDeclaration,
|
||||
importDefaultSpecifier,
|
||||
importNamespaceSpecifier,
|
||||
importSpecifier,
|
||||
memberExpression,
|
||||
stringLiteral,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
|
||||
class ImportBuilder {
|
||||
constructor(importedSource, scope, hub) {
|
||||
@@ -29,13 +44,13 @@ class ImportBuilder {
|
||||
}
|
||||
|
||||
import() {
|
||||
this._statements.push(t.importDeclaration([], t.stringLiteral(this._importedSource)));
|
||||
this._statements.push(importDeclaration([], stringLiteral(this._importedSource)));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
require() {
|
||||
this._statements.push(t.expressionStatement(t.callExpression(t.identifier("require"), [t.stringLiteral(this._importedSource)])));
|
||||
this._statements.push(expressionStatement(callExpression(identifier("require"), [stringLiteral(this._importedSource)])));
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -49,8 +64,8 @@ class ImportBuilder {
|
||||
|
||||
_assert(statement.specifiers.length === 0);
|
||||
|
||||
statement.specifiers = [t.importNamespaceSpecifier(local)];
|
||||
this._resultName = t.cloneNode(local);
|
||||
statement.specifiers = [importNamespaceSpecifier(local)];
|
||||
this._resultName = cloneNode(local);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -62,8 +77,8 @@ class ImportBuilder {
|
||||
|
||||
_assert(statement.specifiers.length === 0);
|
||||
|
||||
statement.specifiers = [t.importDefaultSpecifier(name)];
|
||||
this._resultName = t.cloneNode(name);
|
||||
statement.specifiers = [importDefaultSpecifier(name)];
|
||||
this._resultName = cloneNode(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -76,8 +91,8 @@ class ImportBuilder {
|
||||
|
||||
_assert(statement.specifiers.length === 0);
|
||||
|
||||
statement.specifiers = [t.importSpecifier(name, t.identifier(importName))];
|
||||
this._resultName = t.cloneNode(name);
|
||||
statement.specifiers = [importSpecifier(name, identifier(importName))];
|
||||
this._resultName = cloneNode(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -88,13 +103,13 @@ class ImportBuilder {
|
||||
if (statement.type !== "ExpressionStatement") {
|
||||
_assert(this._resultName);
|
||||
|
||||
statement = t.expressionStatement(this._resultName);
|
||||
statement = expressionStatement(this._resultName);
|
||||
|
||||
this._statements.push(statement);
|
||||
}
|
||||
|
||||
this._statements[this._statements.length - 1] = t.variableDeclaration("var", [t.variableDeclarator(name, statement.expression)]);
|
||||
this._resultName = t.cloneNode(name);
|
||||
this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(name, statement.expression)]);
|
||||
this._resultName = cloneNode(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -110,11 +125,11 @@ class ImportBuilder {
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
|
||||
if (statement.type === "ExpressionStatement") {
|
||||
statement.expression = t.callExpression(callee, [statement.expression]);
|
||||
statement.expression = callExpression(callee, [statement.expression]);
|
||||
} else if (statement.type === "VariableDeclaration") {
|
||||
_assert(statement.declarations.length === 1);
|
||||
|
||||
statement.declarations[0].init = t.callExpression(callee, [statement.declarations[0].init]);
|
||||
statement.declarations[0].init = callExpression(callee, [statement.declarations[0].init]);
|
||||
} else {
|
||||
_assert.fail("Unexpected type.");
|
||||
}
|
||||
@@ -126,11 +141,11 @@ class ImportBuilder {
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
|
||||
if (statement.type === "ExpressionStatement") {
|
||||
statement.expression = t.memberExpression(statement.expression, t.identifier(name));
|
||||
statement.expression = memberExpression(statement.expression, identifier(name));
|
||||
} else if (statement.type === "VariableDeclaration") {
|
||||
_assert(statement.declarations.length === 1);
|
||||
|
||||
statement.declarations[0].init = t.memberExpression(statement.declarations[0].init, t.identifier(name));
|
||||
statement.declarations[0].init = memberExpression(statement.declarations[0].init, identifier(name));
|
||||
} else {
|
||||
_assert.fail("Unexpected type:" + statement.type);
|
||||
}
|
||||
@@ -139,7 +154,7 @@ class ImportBuilder {
|
||||
}
|
||||
|
||||
read(name) {
|
||||
this._resultName = t.memberExpression(this._resultName, t.identifier(name));
|
||||
this._resultName = memberExpression(this._resultName, identifier(name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Generated
Vendored
+7
-2
@@ -7,12 +7,17 @@ exports.default = void 0;
|
||||
|
||||
var _assert = require("assert");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _importBuilder = require("./import-builder");
|
||||
|
||||
var _isModule = require("./is-module");
|
||||
|
||||
const {
|
||||
numericLiteral,
|
||||
sequenceExpression
|
||||
} = _t;
|
||||
|
||||
class ImportInjector {
|
||||
constructor(path, importedSource, opts) {
|
||||
this._defaultOpts = {
|
||||
@@ -246,7 +251,7 @@ class ImportInjector {
|
||||
this._insertStatements(statements, importPosition, blockHoist);
|
||||
|
||||
if ((isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier") {
|
||||
return t.sequenceExpression([t.numericLiteral(0), resultName]);
|
||||
return sequenceExpression([numericLiteral(0), resultName]);
|
||||
}
|
||||
|
||||
return resultName;
|
||||
|
||||
Generated
Vendored
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-module-imports",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.4",
|
||||
"description": "Babel helper functions for inserting module loads",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-imports",
|
||||
@@ -15,11 +15,11 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.14.5"
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.14.5",
|
||||
"@babel/traverse": "7.14.5"
|
||||
"@babel/core": "7.15.4",
|
||||
"@babel/traverse": "7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+79
-39
@@ -40,7 +40,7 @@ Object.defineProperty(exports, "getModuleName", {
|
||||
|
||||
var _assert = require("assert");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _template = require("@babel/template");
|
||||
|
||||
@@ -54,6 +54,22 @@ var _normalizeAndLoadMetadata = require("./normalize-and-load-metadata");
|
||||
|
||||
var _getModuleName = require("./get-module-name");
|
||||
|
||||
const {
|
||||
booleanLiteral,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
directive,
|
||||
directiveLiteral,
|
||||
expressionStatement,
|
||||
identifier,
|
||||
isIdentifier,
|
||||
memberExpression,
|
||||
stringLiteral,
|
||||
valueToNode,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
|
||||
function rewriteModuleStatementsAndPrepareHeader(path, {
|
||||
loose,
|
||||
exportName,
|
||||
@@ -92,7 +108,7 @@ function rewriteModuleStatementsAndPrepareHeader(path, {
|
||||
});
|
||||
|
||||
if (!hasStrict) {
|
||||
path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict")));
|
||||
path.unshiftContainer("directives", directive(directiveLiteral("use strict")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +144,7 @@ function wrapInterop(programPath, expr, type) {
|
||||
}
|
||||
|
||||
if (type === "node-namespace") {
|
||||
return t.callExpression(programPath.hub.addHelper("interopRequireWildcard"), [expr, t.booleanLiteral(true)]);
|
||||
return callExpression(programPath.hub.addHelper("interopRequireWildcard"), [expr, booleanLiteral(true)]);
|
||||
} else if (type === "node-default") {
|
||||
return null;
|
||||
}
|
||||
@@ -143,19 +159,19 @@ function wrapInterop(programPath, expr, type) {
|
||||
throw new Error(`Unknown interop: ${type}`);
|
||||
}
|
||||
|
||||
return t.callExpression(programPath.hub.addHelper(helper), [expr]);
|
||||
return callExpression(programPath.hub.addHelper(helper), [expr]);
|
||||
}
|
||||
|
||||
function buildNamespaceInitStatements(metadata, sourceMetadata, constantReexports = false) {
|
||||
const statements = [];
|
||||
let srcNamespace = t.identifier(sourceMetadata.name);
|
||||
if (sourceMetadata.lazy) srcNamespace = t.callExpression(srcNamespace, []);
|
||||
let srcNamespace = identifier(sourceMetadata.name);
|
||||
if (sourceMetadata.lazy) srcNamespace = callExpression(srcNamespace, []);
|
||||
|
||||
for (const localName of sourceMetadata.importsNamespace) {
|
||||
if (localName === sourceMetadata.name) continue;
|
||||
statements.push(_template.default.statement`var NAME = SOURCE;`({
|
||||
NAME: localName,
|
||||
SOURCE: t.cloneNode(srcNamespace)
|
||||
SOURCE: cloneNode(srcNamespace)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -174,12 +190,12 @@ function buildNamespaceInitStatements(metadata, sourceMetadata, constantReexport
|
||||
` : _template.default.statement`EXPORTS.NAME = NAMESPACE;`)({
|
||||
EXPORTS: metadata.exportName,
|
||||
NAME: exportName,
|
||||
NAMESPACE: t.cloneNode(srcNamespace)
|
||||
NAMESPACE: cloneNode(srcNamespace)
|
||||
}));
|
||||
}
|
||||
|
||||
if (sourceMetadata.reexportAll) {
|
||||
const statement = buildNamespaceReexport(metadata, t.cloneNode(srcNamespace), constantReexports);
|
||||
const statement = buildNamespaceReexport(metadata, cloneNode(srcNamespace), constantReexports);
|
||||
statement.loc = sourceMetadata.reexportAll.loc;
|
||||
statements.push(statement);
|
||||
}
|
||||
@@ -190,7 +206,7 @@ function buildNamespaceInitStatements(metadata, sourceMetadata, constantReexport
|
||||
const ReexportTemplate = {
|
||||
constant: _template.default.statement`EXPORTS.EXPORT_NAME = NAMESPACE_IMPORT;`,
|
||||
constantComputed: _template.default.statement`EXPORTS["EXPORT_NAME"] = NAMESPACE_IMPORT;`,
|
||||
spec: (0, _template.default)`
|
||||
spec: _template.default.statement`
|
||||
Object.defineProperty(EXPORTS, "EXPORT_NAME", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
@@ -201,17 +217,17 @@ const ReexportTemplate = {
|
||||
};
|
||||
|
||||
const buildReexportsFromMeta = (meta, metadata, constantReexports) => {
|
||||
const namespace = metadata.lazy ? t.callExpression(t.identifier(metadata.name), []) : t.identifier(metadata.name);
|
||||
const namespace = metadata.lazy ? callExpression(identifier(metadata.name), []) : identifier(metadata.name);
|
||||
const {
|
||||
stringSpecifiers
|
||||
} = meta;
|
||||
return Array.from(metadata.reexports, ([exportName, importName]) => {
|
||||
let NAMESPACE_IMPORT = t.cloneNode(namespace);
|
||||
let NAMESPACE_IMPORT = cloneNode(namespace);
|
||||
|
||||
if (importName === "default" && metadata.interop === "node-default") {} else if (stringSpecifiers.has(importName)) {
|
||||
NAMESPACE_IMPORT = t.memberExpression(NAMESPACE_IMPORT, t.stringLiteral(importName), true);
|
||||
NAMESPACE_IMPORT = memberExpression(NAMESPACE_IMPORT, stringLiteral(importName), true);
|
||||
} else {
|
||||
NAMESPACE_IMPORT = t.memberExpression(NAMESPACE_IMPORT, t.identifier(importName));
|
||||
NAMESPACE_IMPORT = memberExpression(NAMESPACE_IMPORT, identifier(importName));
|
||||
}
|
||||
|
||||
const astNodes = {
|
||||
@@ -220,7 +236,7 @@ const buildReexportsFromMeta = (meta, metadata, constantReexports) => {
|
||||
NAMESPACE_IMPORT
|
||||
};
|
||||
|
||||
if (constantReexports || t.isIdentifier(NAMESPACE_IMPORT)) {
|
||||
if (constantReexports || isIdentifier(NAMESPACE_IMPORT)) {
|
||||
if (stringSpecifiers.has(exportName)) {
|
||||
return ReexportTemplate.constantComputed(astNodes);
|
||||
} else {
|
||||
@@ -305,39 +321,73 @@ function buildExportNameListDeclaration(programPath, metadata) {
|
||||
delete exportedVars.default;
|
||||
return {
|
||||
name: name.name,
|
||||
statement: t.variableDeclaration("var", [t.variableDeclarator(name, t.valueToNode(exportedVars))])
|
||||
statement: variableDeclaration("var", [variableDeclarator(name, valueToNode(exportedVars))])
|
||||
};
|
||||
}
|
||||
|
||||
function buildExportInitializationStatements(programPath, metadata, constantReexports = false, noIncompleteNsImportDetection = false) {
|
||||
const initStatements = [];
|
||||
const exportNames = [];
|
||||
|
||||
for (const [localName, data] of metadata.local) {
|
||||
if (data.kind === "import") {} else if (data.kind === "hoisted") {
|
||||
initStatements.push(buildInitStatement(metadata, data.names, t.identifier(localName)));
|
||||
} else {
|
||||
exportNames.push(...data.names);
|
||||
initStatements.push([data.names[0], buildInitStatement(metadata, data.names, identifier(localName))]);
|
||||
} else if (!noIncompleteNsImportDetection) {
|
||||
for (const exportName of data.names) {
|
||||
initStatements.push([exportName, null]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const data of metadata.source.values()) {
|
||||
if (!constantReexports) {
|
||||
initStatements.push(...buildReexportsFromMeta(metadata, data, false));
|
||||
const reexportsStatements = buildReexportsFromMeta(metadata, data, false);
|
||||
const reexports = [...data.reexports.keys()];
|
||||
|
||||
for (let i = 0; i < reexportsStatements.length; i++) {
|
||||
initStatements.push([reexports[i], reexportsStatements[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
for (const exportName of data.reexportNamespace) {
|
||||
exportNames.push(exportName);
|
||||
if (!noIncompleteNsImportDetection) {
|
||||
for (const exportName of data.reexportNamespace) {
|
||||
initStatements.push([exportName, null]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!noIncompleteNsImportDetection) {
|
||||
initStatements.push(...chunk(exportNames, 100).map(members => {
|
||||
return buildInitStatement(metadata, members, programPath.scope.buildUndefinedNode());
|
||||
}));
|
||||
initStatements.sort((a, b) => a[0] > b[0] ? 1 : -1);
|
||||
const results = [];
|
||||
|
||||
if (noIncompleteNsImportDetection) {
|
||||
for (const [, initStatement] of initStatements) {
|
||||
results.push(initStatement);
|
||||
}
|
||||
} else {
|
||||
const chunkSize = 100;
|
||||
|
||||
for (let i = 0, uninitializedExportNames = []; i < initStatements.length; i += chunkSize) {
|
||||
for (let j = 0; j < chunkSize && i + j < initStatements.length; j++) {
|
||||
const [exportName, initStatement] = initStatements[i + j];
|
||||
|
||||
if (initStatement !== null) {
|
||||
if (uninitializedExportNames.length > 0) {
|
||||
results.push(buildInitStatement(metadata, uninitializedExportNames, programPath.scope.buildUndefinedNode()));
|
||||
uninitializedExportNames = [];
|
||||
}
|
||||
|
||||
results.push(initStatement);
|
||||
} else {
|
||||
uninitializedExportNames.push(exportName);
|
||||
}
|
||||
}
|
||||
|
||||
if (uninitializedExportNames.length > 0) {
|
||||
results.push(buildInitStatement(metadata, uninitializedExportNames, programPath.scope.buildUndefinedNode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return initStatements;
|
||||
return results;
|
||||
}
|
||||
|
||||
const InitTemplate = {
|
||||
@@ -350,7 +400,7 @@ function buildInitStatement(metadata, exportNames, initExpr) {
|
||||
stringSpecifiers,
|
||||
exportName: EXPORTS
|
||||
} = metadata;
|
||||
return t.expressionStatement(exportNames.reduce((acc, exportName) => {
|
||||
return expressionStatement(exportNames.reduce((acc, exportName) => {
|
||||
const params = {
|
||||
EXPORTS,
|
||||
NAME: exportName,
|
||||
@@ -363,14 +413,4 @@ function buildInitStatement(metadata, exportNames, initExpr) {
|
||||
return InitTemplate.default(params);
|
||||
}
|
||||
}, initExpr));
|
||||
}
|
||||
|
||||
function chunk(array, size) {
|
||||
const chunks = [];
|
||||
|
||||
for (let i = 0; i < array.length; i += size) {
|
||||
chunks.push(array.slice(i, i + size));
|
||||
}
|
||||
|
||||
return chunks;
|
||||
}
|
||||
Generated
Vendored
+67
-22
@@ -7,12 +7,53 @@ exports.default = rewriteLiveReferences;
|
||||
|
||||
var _assert = require("assert");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _template = require("@babel/template");
|
||||
|
||||
var _helperSimpleAccess = require("@babel/helper-simple-access");
|
||||
|
||||
const {
|
||||
assignmentExpression,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
expressionStatement,
|
||||
getOuterBindingIdentifiers,
|
||||
identifier,
|
||||
isMemberExpression,
|
||||
isVariableDeclaration,
|
||||
jsxIdentifier,
|
||||
jsxMemberExpression,
|
||||
memberExpression,
|
||||
numericLiteral,
|
||||
sequenceExpression,
|
||||
stringLiteral,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
|
||||
function isInType(path) {
|
||||
do {
|
||||
switch (path.parent.type) {
|
||||
case "TSTypeAnnotation":
|
||||
case "TSTypeAliasDeclaration":
|
||||
case "TSTypeReference":
|
||||
case "TypeAnnotation":
|
||||
case "TypeAlias":
|
||||
return true;
|
||||
|
||||
case "ExportSpecifier":
|
||||
return path.parentPath.parent.exportKind === "type";
|
||||
|
||||
default:
|
||||
if (path.parentPath.isStatement() || path.parentPath.isExpression()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
} while (path = path.parentPath);
|
||||
}
|
||||
|
||||
function rewriteLiveReferences(programPath, metadata) {
|
||||
const imported = new Map();
|
||||
const exported = new Map();
|
||||
@@ -61,19 +102,19 @@ function rewriteLiveReferences(programPath, metadata) {
|
||||
const meta = metadata.source.get(source);
|
||||
|
||||
if (localName) {
|
||||
if (meta.lazy) identNode = t.callExpression(identNode, []);
|
||||
if (meta.lazy) identNode = callExpression(identNode, []);
|
||||
return identNode;
|
||||
}
|
||||
|
||||
let namespace = t.identifier(meta.name);
|
||||
if (meta.lazy) namespace = t.callExpression(namespace, []);
|
||||
let namespace = identifier(meta.name);
|
||||
if (meta.lazy) namespace = callExpression(namespace, []);
|
||||
|
||||
if (importName === "default" && meta.interop === "node-default") {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
const computed = metadata.stringSpecifiers.has(importName);
|
||||
return t.memberExpression(namespace, computed ? t.stringLiteral(importName) : t.identifier(importName), computed);
|
||||
return memberExpression(namespace, computed ? stringLiteral(importName) : identifier(importName), computed);
|
||||
}
|
||||
};
|
||||
programPath.traverse(rewriteReferencesVisitor, rewriteReferencesVisitorState);
|
||||
@@ -98,7 +139,7 @@ const rewriteBindingInitVisitor = {
|
||||
const exportNames = exported.get(localName) || [];
|
||||
|
||||
if (exportNames.length > 0) {
|
||||
const statement = t.expressionStatement(buildBindingExportAssignmentExpression(metadata, exportNames, t.identifier(localName)));
|
||||
const statement = expressionStatement(buildBindingExportAssignmentExpression(metadata, exportNames, identifier(localName)));
|
||||
statement._blockHoist = path.node._blockHoist;
|
||||
requeueInParent(path.insertAfter(statement)[0]);
|
||||
}
|
||||
@@ -114,7 +155,7 @@ const rewriteBindingInitVisitor = {
|
||||
const exportNames = exported.get(localName) || [];
|
||||
|
||||
if (exportNames.length > 0) {
|
||||
const statement = t.expressionStatement(buildBindingExportAssignmentExpression(metadata, exportNames, t.identifier(localName)));
|
||||
const statement = expressionStatement(buildBindingExportAssignmentExpression(metadata, exportNames, identifier(localName)));
|
||||
statement._blockHoist = path.node._blockHoist;
|
||||
requeueInParent(path.insertAfter(statement)[0]);
|
||||
}
|
||||
@@ -129,7 +170,7 @@ const buildBindingExportAssignmentExpression = (metadata, exportNames, localExpr
|
||||
stringSpecifiers
|
||||
} = metadata;
|
||||
const computed = stringSpecifiers.has(exportName);
|
||||
return t.assignmentExpression("=", t.memberExpression(t.identifier(metadata.exportName), computed ? t.stringLiteral(exportName) : t.identifier(exportName), computed), expr);
|
||||
return assignmentExpression("=", memberExpression(identifier(metadata.exportName), computed ? stringLiteral(exportName) : identifier(exportName), computed), expr);
|
||||
}, localExpr);
|
||||
};
|
||||
|
||||
@@ -156,6 +197,10 @@ const rewriteReferencesVisitor = {
|
||||
const importData = imported.get(localName);
|
||||
|
||||
if (importData) {
|
||||
if (isInType(path)) {
|
||||
throw path.buildCodeFrameError(`Cannot transform the imported binding "${localName}" since it's also used in a type annotation. ` + `Please strip type annotations using @babel/preset-typescript or @babel/preset-flow.`);
|
||||
}
|
||||
|
||||
const localBinding = path.scope.getBinding(localName);
|
||||
const rootBinding = scope.getBinding(localName);
|
||||
if (rootBinding !== localBinding) return;
|
||||
@@ -168,14 +213,14 @@ const rewriteReferencesVisitor = {
|
||||
callee: path.node
|
||||
}) || path.parentPath.isTaggedTemplateExpression({
|
||||
tag: path.node
|
||||
})) && t.isMemberExpression(ref)) {
|
||||
path.replaceWith(t.sequenceExpression([t.numericLiteral(0), ref]));
|
||||
} else if (path.isJSXIdentifier() && t.isMemberExpression(ref)) {
|
||||
})) && isMemberExpression(ref)) {
|
||||
path.replaceWith(sequenceExpression([numericLiteral(0), ref]));
|
||||
} else if (path.isJSXIdentifier() && isMemberExpression(ref)) {
|
||||
const {
|
||||
object,
|
||||
property
|
||||
} = ref;
|
||||
path.replaceWith(t.jsxMemberExpression(t.jsxIdentifier(object.name), t.jsxIdentifier(property.name)));
|
||||
path.replaceWith(jsxMemberExpression(jsxIdentifier(object.name), jsxIdentifier(property.name)));
|
||||
} else {
|
||||
path.replaceWith(ref);
|
||||
}
|
||||
@@ -217,7 +262,7 @@ const rewriteReferencesVisitor = {
|
||||
|
||||
if (importData) {
|
||||
assignment.left = buildImportReference(importData, assignment.left);
|
||||
assignment.right = t.sequenceExpression([assignment.right, buildImportThrow(localName)]);
|
||||
assignment.right = sequenceExpression([assignment.right, buildImportThrow(localName)]);
|
||||
}
|
||||
|
||||
path.replaceWith(buildBindingExportAssignmentExpression(this.metadata, exportedNames, assignment));
|
||||
@@ -229,7 +274,7 @@ const rewriteReferencesVisitor = {
|
||||
const id = programScopeIds.find(localName => imported.has(localName));
|
||||
|
||||
if (id) {
|
||||
path.node.right = t.sequenceExpression([path.node.right, buildImportThrow(id)]);
|
||||
path.node.right = sequenceExpression([path.node.right, buildImportThrow(id)]);
|
||||
}
|
||||
|
||||
const items = [];
|
||||
@@ -237,15 +282,15 @@ const rewriteReferencesVisitor = {
|
||||
const exportedNames = exported.get(localName) || [];
|
||||
|
||||
if (exportedNames.length > 0) {
|
||||
items.push(buildBindingExportAssignmentExpression(this.metadata, exportedNames, t.identifier(localName)));
|
||||
items.push(buildBindingExportAssignmentExpression(this.metadata, exportedNames, identifier(localName)));
|
||||
}
|
||||
});
|
||||
|
||||
if (items.length > 0) {
|
||||
let node = t.sequenceExpression(items);
|
||||
let node = sequenceExpression(items);
|
||||
|
||||
if (path.parentPath.isExpressionStatement()) {
|
||||
node = t.expressionStatement(node);
|
||||
node = expressionStatement(node);
|
||||
node._blockHoist = path.parentPath.node._blockHoist;
|
||||
}
|
||||
|
||||
@@ -271,12 +316,12 @@ const rewriteReferencesVisitor = {
|
||||
scope: programScope
|
||||
} = this;
|
||||
|
||||
if (!t.isVariableDeclaration(left)) {
|
||||
if (!isVariableDeclaration(left)) {
|
||||
let didTransformExport = false,
|
||||
importConstViolationName;
|
||||
const loopBodyScope = path.get("body").scope;
|
||||
|
||||
for (const name of Object.keys(t.getOuterBindingIdentifiers(left))) {
|
||||
for (const name of Object.keys(getOuterBindingIdentifiers(left))) {
|
||||
if (programScope.getBinding(name) === scope.getBinding(name)) {
|
||||
if (exported.has(name)) {
|
||||
didTransformExport = true;
|
||||
@@ -299,15 +344,15 @@ const rewriteReferencesVisitor = {
|
||||
path.ensureBlock();
|
||||
const bodyPath = path.get("body");
|
||||
const newLoopId = scope.generateUidIdentifierBasedOnNode(left);
|
||||
path.get("left").replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.cloneNode(newLoopId))]));
|
||||
path.get("left").replaceWith(variableDeclaration("let", [variableDeclarator(cloneNode(newLoopId))]));
|
||||
scope.registerDeclaration(path.get("left"));
|
||||
|
||||
if (didTransformExport) {
|
||||
bodyPath.unshiftContainer("body", t.expressionStatement(t.assignmentExpression("=", left, newLoopId)));
|
||||
bodyPath.unshiftContainer("body", expressionStatement(assignmentExpression("=", left, newLoopId)));
|
||||
}
|
||||
|
||||
if (importConstViolationName) {
|
||||
bodyPath.unshiftContainer("body", t.expressionStatement(buildImportThrow(importConstViolationName)));
|
||||
bodyPath.unshiftContainer("body", expressionStatement(buildImportThrow(importConstViolationName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
Vendored
+7
-2
@@ -9,7 +9,12 @@ var _helperReplaceSupers = require("@babel/helper-replace-supers");
|
||||
|
||||
var _traverse = require("@babel/traverse");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
numericLiteral,
|
||||
unaryExpression
|
||||
} = _t;
|
||||
|
||||
function rewriteThis(programPath) {
|
||||
(0, _traverse.default)(programPath.node, Object.assign({}, rewriteThisVisitor, {
|
||||
@@ -19,7 +24,7 @@ function rewriteThis(programPath) {
|
||||
|
||||
const rewriteThisVisitor = _traverse.default.visitors.merge([_helperReplaceSupers.environmentVisitor, {
|
||||
ThisExpression(path) {
|
||||
path.replaceWith(t.unaryExpression("void", t.numericLiteral(0), true));
|
||||
path.replaceWith(unaryExpression("void", numericLiteral(0), true));
|
||||
}
|
||||
|
||||
}]);
|
||||
Generated
Vendored
+9
-9
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-module-transforms",
|
||||
"version": "7.15.0",
|
||||
"version": "7.15.8",
|
||||
"description": "Babel helper functions for implementing ES6 module transformations",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-transforms",
|
||||
@@ -15,14 +15,14 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "^7.14.5",
|
||||
"@babel/helper-replace-supers": "^7.15.0",
|
||||
"@babel/helper-simple-access": "^7.14.8",
|
||||
"@babel/helper-split-export-declaration": "^7.14.5",
|
||||
"@babel/helper-validator-identifier": "^7.14.9",
|
||||
"@babel/template": "^7.14.5",
|
||||
"@babel/traverse": "^7.15.0",
|
||||
"@babel/types": "^7.15.0"
|
||||
"@babel/helper-module-imports": "^7.15.4",
|
||||
"@babel/helper-replace-supers": "^7.15.4",
|
||||
"@babel/helper-simple-access": "^7.15.4",
|
||||
"@babel/helper-split-export-declaration": "^7.15.4",
|
||||
"@babel/helper-validator-identifier": "^7.15.7",
|
||||
"@babel/template": "^7.15.4",
|
||||
"@babel/traverse": "^7.15.4",
|
||||
"@babel/types": "^7.15.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+16
-6
@@ -5,22 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = optimiseCallExpression;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
callExpression,
|
||||
identifier,
|
||||
isIdentifier,
|
||||
isSpreadElement,
|
||||
memberExpression,
|
||||
optionalCallExpression,
|
||||
optionalMemberExpression
|
||||
} = _t;
|
||||
|
||||
function optimiseCallExpression(callee, thisNode, args, optional) {
|
||||
if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, {
|
||||
if (args.length === 1 && isSpreadElement(args[0]) && isIdentifier(args[0].argument, {
|
||||
name: "arguments"
|
||||
})) {
|
||||
if (optional) {
|
||||
return t.optionalCallExpression(t.optionalMemberExpression(callee, t.identifier("apply"), false, true), [thisNode, args[0].argument], false);
|
||||
return optionalCallExpression(optionalMemberExpression(callee, identifier("apply"), false, true), [thisNode, args[0].argument], false);
|
||||
}
|
||||
|
||||
return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [thisNode, args[0].argument]);
|
||||
return callExpression(memberExpression(callee, identifier("apply")), [thisNode, args[0].argument]);
|
||||
} else {
|
||||
if (optional) {
|
||||
return t.optionalCallExpression(t.optionalMemberExpression(callee, t.identifier("call"), false, true), [thisNode, ...args], false);
|
||||
return optionalCallExpression(optionalMemberExpression(callee, identifier("call"), false, true), [thisNode, ...args], false);
|
||||
}
|
||||
|
||||
return t.callExpression(t.memberExpression(callee, t.identifier("call")), [thisNode, ...args]);
|
||||
return callExpression(memberExpression(callee, identifier("call")), [thisNode, ...args]);
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-optimise-call-expression",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.4",
|
||||
"description": "Helper function to optimise call expression",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,11 +14,11 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.14.5"
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/generator": "7.14.5",
|
||||
"@babel/parser": "7.14.5"
|
||||
"@babel/generator": "7.15.4",
|
||||
"@babel/parser": "7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+42
-28
@@ -12,12 +12,26 @@ var _helperMemberExpressionToFunctions = require("@babel/helper-member-expressio
|
||||
|
||||
var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-expression");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
VISITOR_KEYS,
|
||||
assignmentExpression,
|
||||
booleanLiteral,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
identifier,
|
||||
memberExpression,
|
||||
sequenceExpression,
|
||||
staticBlock,
|
||||
stringLiteral,
|
||||
thisExpression
|
||||
} = _t;
|
||||
|
||||
function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
|
||||
objectRef = t.cloneNode(objectRef);
|
||||
const targetRef = isStatic || isPrivateMethod ? objectRef : t.memberExpression(objectRef, t.identifier("prototype"));
|
||||
return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
|
||||
objectRef = cloneNode(objectRef);
|
||||
const targetRef = isStatic || isPrivateMethod ? objectRef : memberExpression(objectRef, identifier("prototype"));
|
||||
return callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
|
||||
}
|
||||
|
||||
function skipAllButComputedKey(path) {
|
||||
@@ -26,7 +40,7 @@ function skipAllButComputedKey(path) {
|
||||
return;
|
||||
}
|
||||
|
||||
const keys = t.VISITOR_KEYS[path.type];
|
||||
const keys = VISITOR_KEYS[path.type];
|
||||
|
||||
for (const key of keys) {
|
||||
if (key !== "key") path.skipKey(key);
|
||||
@@ -34,7 +48,7 @@ function skipAllButComputedKey(path) {
|
||||
}
|
||||
|
||||
const environmentVisitor = {
|
||||
[`${t.staticBlock ? "StaticBlock|" : ""}ClassPrivateProperty|TypeAnnotation`](path) {
|
||||
[`${staticBlock ? "StaticBlock|" : ""}ClassPrivateProperty|TypeAnnotation`](path) {
|
||||
path.skip();
|
||||
},
|
||||
|
||||
@@ -109,14 +123,14 @@ const specHandlers = {
|
||||
} = superMember.node;
|
||||
|
||||
if (this.memoiser.has(property)) {
|
||||
return t.cloneNode(this.memoiser.get(property));
|
||||
return cloneNode(this.memoiser.get(property));
|
||||
}
|
||||
|
||||
if (computed) {
|
||||
return t.cloneNode(property);
|
||||
return cloneNode(property);
|
||||
}
|
||||
|
||||
return t.stringLiteral(property.name);
|
||||
return stringLiteral(property.name);
|
||||
},
|
||||
|
||||
get(superMember) {
|
||||
@@ -125,20 +139,20 @@ const specHandlers = {
|
||||
|
||||
_get(superMember, thisRefs) {
|
||||
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
|
||||
return t.callExpression(this.file.addHelper("get"), [thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]);
|
||||
return callExpression(this.file.addHelper("get"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]);
|
||||
},
|
||||
|
||||
_getThisRefs() {
|
||||
if (!this.isDerivedConstructor) {
|
||||
return {
|
||||
this: t.thisExpression()
|
||||
this: thisExpression()
|
||||
};
|
||||
}
|
||||
|
||||
const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper");
|
||||
return {
|
||||
memo: t.assignmentExpression("=", thisRef, t.thisExpression()),
|
||||
this: t.cloneNode(thisRef)
|
||||
memo: assignmentExpression("=", thisRef, thisExpression()),
|
||||
this: cloneNode(thisRef)
|
||||
};
|
||||
},
|
||||
|
||||
@@ -146,7 +160,7 @@ const specHandlers = {
|
||||
const thisRefs = this._getThisRefs();
|
||||
|
||||
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
|
||||
return t.callExpression(this.file.addHelper("set"), [thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, t.booleanLiteral(superMember.isInStrictMode())]);
|
||||
return callExpression(this.file.addHelper("set"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, booleanLiteral(superMember.isInStrictMode())]);
|
||||
},
|
||||
|
||||
destructureSet(superMember) {
|
||||
@@ -156,13 +170,13 @@ const specHandlers = {
|
||||
call(superMember, args) {
|
||||
const thisRefs = this._getThisRefs();
|
||||
|
||||
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), t.cloneNode(thisRefs.this), args, false);
|
||||
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, false);
|
||||
},
|
||||
|
||||
optionalCall(superMember, args) {
|
||||
const thisRefs = this._getThisRefs();
|
||||
|
||||
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), t.cloneNode(thisRefs.this), args, true);
|
||||
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, true);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -173,10 +187,10 @@ const looseHandlers = Object.assign({}, specHandlers, {
|
||||
} = superMember.node;
|
||||
|
||||
if (this.memoiser.has(property)) {
|
||||
return t.cloneNode(this.memoiser.get(property));
|
||||
return cloneNode(this.memoiser.get(property));
|
||||
}
|
||||
|
||||
return t.cloneNode(property);
|
||||
return cloneNode(property);
|
||||
},
|
||||
|
||||
get(superMember) {
|
||||
@@ -193,14 +207,14 @@ const looseHandlers = Object.assign({}, specHandlers, {
|
||||
if (isStatic) {
|
||||
var _getSuperRef;
|
||||
|
||||
object = (_getSuperRef = getSuperRef()) != null ? _getSuperRef : t.memberExpression(t.identifier("Function"), t.identifier("prototype"));
|
||||
object = (_getSuperRef = getSuperRef()) != null ? _getSuperRef : memberExpression(identifier("Function"), identifier("prototype"));
|
||||
} else {
|
||||
var _getSuperRef2;
|
||||
|
||||
object = t.memberExpression((_getSuperRef2 = getSuperRef()) != null ? _getSuperRef2 : t.identifier("Object"), t.identifier("prototype"));
|
||||
object = memberExpression((_getSuperRef2 = getSuperRef()) != null ? _getSuperRef2 : identifier("Object"), identifier("prototype"));
|
||||
}
|
||||
|
||||
return t.memberExpression(object, prop, computed);
|
||||
return memberExpression(object, prop, computed);
|
||||
},
|
||||
|
||||
set(superMember, value) {
|
||||
@@ -208,7 +222,7 @@ const looseHandlers = Object.assign({}, specHandlers, {
|
||||
computed
|
||||
} = superMember.node;
|
||||
const prop = this.prop(superMember);
|
||||
return t.assignmentExpression("=", t.memberExpression(t.thisExpression(), prop, computed), value);
|
||||
return assignmentExpression("=", memberExpression(thisExpression(), prop, computed), value);
|
||||
},
|
||||
|
||||
destructureSet(superMember) {
|
||||
@@ -216,15 +230,15 @@ const looseHandlers = Object.assign({}, specHandlers, {
|
||||
computed
|
||||
} = superMember.node;
|
||||
const prop = this.prop(superMember);
|
||||
return t.memberExpression(t.thisExpression(), prop, computed);
|
||||
return memberExpression(thisExpression(), prop, computed);
|
||||
},
|
||||
|
||||
call(superMember, args) {
|
||||
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), t.thisExpression(), args, false);
|
||||
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, false);
|
||||
},
|
||||
|
||||
optionalCall(superMember, args) {
|
||||
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), t.thisExpression(), args, true);
|
||||
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, true);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -246,12 +260,12 @@ class ReplaceSupers {
|
||||
}
|
||||
|
||||
getObjectRef() {
|
||||
return t.cloneNode(this.opts.objectRef || this.opts.getObjectRef());
|
||||
return cloneNode(this.opts.objectRef || this.opts.getObjectRef());
|
||||
}
|
||||
|
||||
getSuperRef() {
|
||||
if (this.opts.superRef) return t.cloneNode(this.opts.superRef);
|
||||
if (this.opts.getSuperRef) return t.cloneNode(this.opts.getSuperRef());
|
||||
if (this.opts.superRef) return cloneNode(this.opts.superRef);
|
||||
if (this.opts.getSuperRef) return cloneNode(this.opts.getSuperRef());
|
||||
}
|
||||
|
||||
replace() {
|
||||
|
||||
Generated
Vendored
+5
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-replace-supers",
|
||||
"version": "7.15.0",
|
||||
"version": "7.15.4",
|
||||
"description": "Helper function to replace supers",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,10 +14,10 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-member-expression-to-functions": "^7.15.0",
|
||||
"@babel/helper-optimise-call-expression": "^7.14.5",
|
||||
"@babel/traverse": "^7.15.0",
|
||||
"@babel/types": "^7.15.0"
|
||||
"@babel/helper-member-expression-to-functions": "^7.15.4",
|
||||
"@babel/helper-optimise-call-expression": "^7.15.4",
|
||||
"@babel/traverse": "^7.15.4",
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+20
-8
@@ -5,7 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = simplifyAccess;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
LOGICAL_OPERATORS,
|
||||
assignmentExpression,
|
||||
binaryExpression,
|
||||
cloneNode,
|
||||
identifier,
|
||||
logicalExpression,
|
||||
numericLiteral,
|
||||
sequenceExpression,
|
||||
unaryExpression
|
||||
} = _t;
|
||||
|
||||
function simplifyAccess(path, bindingNames) {
|
||||
path.traverse(simpleAssignmentVisitor, {
|
||||
@@ -33,17 +45,17 @@ const simpleAssignmentVisitor = {
|
||||
|
||||
if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord()) {
|
||||
const operator = path.node.operator == "++" ? "+=" : "-=";
|
||||
path.replaceWith(t.assignmentExpression(operator, arg.node, t.numericLiteral(1)));
|
||||
path.replaceWith(assignmentExpression(operator, arg.node, numericLiteral(1)));
|
||||
} else if (path.node.prefix) {
|
||||
path.replaceWith(t.assignmentExpression("=", t.identifier(localName), t.binaryExpression(path.node.operator[0], t.unaryExpression("+", arg.node), t.numericLiteral(1))));
|
||||
path.replaceWith(assignmentExpression("=", identifier(localName), binaryExpression(path.node.operator[0], unaryExpression("+", arg.node), numericLiteral(1))));
|
||||
} else {
|
||||
const old = path.scope.generateUidIdentifierBasedOnNode(arg.node, "old");
|
||||
const varName = old.name;
|
||||
path.scope.push({
|
||||
id: old
|
||||
});
|
||||
const binary = t.binaryExpression(path.node.operator[0], t.identifier(varName), t.numericLiteral(1));
|
||||
path.replaceWith(t.sequenceExpression([t.assignmentExpression("=", t.identifier(varName), t.unaryExpression("+", arg.node)), t.assignmentExpression("=", t.cloneNode(arg.node), binary), t.identifier(varName)]));
|
||||
const binary = binaryExpression(path.node.operator[0], identifier(varName), numericLiteral(1));
|
||||
path.replaceWith(sequenceExpression([assignmentExpression("=", identifier(varName), unaryExpression("+", arg.node)), assignmentExpression("=", cloneNode(arg.node), binary), identifier(varName)]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +81,10 @@ const simpleAssignmentVisitor = {
|
||||
|
||||
const operator = path.node.operator.slice(0, -1);
|
||||
|
||||
if (t.LOGICAL_OPERATORS.includes(operator)) {
|
||||
path.replaceWith(t.logicalExpression(operator, path.node.left, t.assignmentExpression("=", t.cloneNode(path.node.left), path.node.right)));
|
||||
if (LOGICAL_OPERATORS.includes(operator)) {
|
||||
path.replaceWith(logicalExpression(operator, path.node.left, assignmentExpression("=", cloneNode(path.node.left), path.node.right)));
|
||||
} else {
|
||||
path.node.right = t.binaryExpression(operator, t.cloneNode(path.node.left), path.node.right);
|
||||
path.node.right = binaryExpression(operator, cloneNode(path.node.left), path.node.right);
|
||||
path.node.operator = "=";
|
||||
}
|
||||
}
|
||||
|
||||
Generated
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-simple-access",
|
||||
"version": "7.14.8",
|
||||
"version": "7.15.4",
|
||||
"description": "Babel helper for ensuring that access to a given value is performed through simple accesses",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-simple-access",
|
||||
@@ -15,10 +15,10 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.14.8"
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/traverse": "7.14.8"
|
||||
"@babel/traverse": "7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+15
-6
@@ -5,7 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = splitExportDeclaration;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
cloneNode,
|
||||
exportNamedDeclaration,
|
||||
exportSpecifier,
|
||||
identifier,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
|
||||
function splitExportDeclaration(exportDeclaration) {
|
||||
if (!exportDeclaration.isExportDeclaration()) {
|
||||
@@ -27,12 +36,12 @@ function splitExportDeclaration(exportDeclaration) {
|
||||
id = scope.generateUidIdentifier("default");
|
||||
|
||||
if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) {
|
||||
declaration.node.id = t.cloneNode(id);
|
||||
declaration.node.id = cloneNode(id);
|
||||
}
|
||||
}
|
||||
|
||||
const updatedDeclaration = standaloneDeclaration ? declaration : t.variableDeclaration("var", [t.variableDeclarator(t.cloneNode(id), declaration.node)]);
|
||||
const updatedExportDeclaration = t.exportNamedDeclaration(null, [t.exportSpecifier(t.cloneNode(id), t.identifier("default"))]);
|
||||
const updatedDeclaration = standaloneDeclaration ? declaration : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]);
|
||||
const updatedExportDeclaration = exportNamedDeclaration(null, [exportSpecifier(cloneNode(id), identifier("default"))]);
|
||||
exportDeclaration.insertAfter(updatedExportDeclaration);
|
||||
exportDeclaration.replaceWith(updatedDeclaration);
|
||||
|
||||
@@ -49,9 +58,9 @@ function splitExportDeclaration(exportDeclaration) {
|
||||
|
||||
const bindingIdentifiers = declaration.getOuterBindingIdentifiers();
|
||||
const specifiers = Object.keys(bindingIdentifiers).map(name => {
|
||||
return t.exportSpecifier(t.identifier(name), t.identifier(name));
|
||||
return exportSpecifier(identifier(name), identifier(name));
|
||||
});
|
||||
const aliasDeclar = t.exportNamedDeclaration(null, specifiers);
|
||||
const aliasDeclar = exportNamedDeclaration(null, specifiers);
|
||||
exportDeclaration.insertAfter(aliasDeclar);
|
||||
exportDeclaration.replaceWith(declaration.node);
|
||||
return exportDeclaration;
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-split-export-declaration",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.4",
|
||||
"description": "",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.14.5"
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
Generated
Vendored
+4
-4
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.isIdentifierStart = isIdentifierStart;
|
||||
exports.isIdentifierChar = isIdentifierChar;
|
||||
exports.isIdentifierName = isIdentifierName;
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||||
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||||
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
||||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||||
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
||||
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
||||
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
||||
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
||||
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
||||
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
||||
|
||||
function isInAstralSet(code, set) {
|
||||
let pos = 0x10000;
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-validator-identifier",
|
||||
"version": "7.14.9",
|
||||
"version": "7.15.7",
|
||||
"description": "Validate identifier/keywords name",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,7 +14,7 @@
|
||||
"main": "./lib/index.js",
|
||||
"exports": "./lib/index.js",
|
||||
"devDependencies": {
|
||||
"@unicode/unicode-13.0.0": "^1.0.6",
|
||||
"@unicode/unicode-14.0.0": "^1.2.1",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
// Always use the latest available version of Unicode!
|
||||
// https://tc39.github.io/ecma262/#sec-conformance
|
||||
const version = "13.0.0";
|
||||
const version = "14.0.0";
|
||||
|
||||
const start = require("@unicode/unicode-" +
|
||||
version +
|
||||
|
||||
+24
-1
@@ -319,7 +319,7 @@ helpers.objectSpread = helper("7.0.0-beta.0")`
|
||||
var source = (arguments[i] != null) ? Object(arguments[i]) : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
@@ -1929,6 +1929,29 @@ helpers.classPrivateMethodGet = helper("7.1.6")`
|
||||
return fn;
|
||||
}
|
||||
`;
|
||||
helpers.checkPrivateRedeclaration = helper("7.14.1")`
|
||||
export default function _checkPrivateRedeclaration(obj, privateCollection) {
|
||||
if (privateCollection.has(obj)) {
|
||||
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
||||
}
|
||||
}
|
||||
`;
|
||||
helpers.classPrivateFieldInitSpec = helper("7.14.1")`
|
||||
import checkPrivateRedeclaration from "checkPrivateRedeclaration";
|
||||
|
||||
export default function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
||||
checkPrivateRedeclaration(obj, privateMap);
|
||||
privateMap.set(obj, value);
|
||||
}
|
||||
`;
|
||||
helpers.classPrivateMethodInitSpec = helper("7.14.1")`
|
||||
import checkPrivateRedeclaration from "checkPrivateRedeclaration";
|
||||
|
||||
export default function _classPrivateMethodInitSpec(obj, privateSet) {
|
||||
checkPrivateRedeclaration(obj, privateSet);
|
||||
privateSet.add(obj);
|
||||
}
|
||||
`;
|
||||
{
|
||||
helpers.classPrivateMethodSet = helper("7.1.6")`
|
||||
export default function _classPrivateMethodSet() {
|
||||
|
||||
+18
-8
@@ -11,10 +11,20 @@ exports.default = exports.list = void 0;
|
||||
|
||||
var _traverse = require("@babel/traverse");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _helpers = require("./helpers");
|
||||
|
||||
const {
|
||||
assignmentExpression,
|
||||
cloneNode,
|
||||
expressionStatement,
|
||||
file: t_file,
|
||||
identifier,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
|
||||
function makePath(path) {
|
||||
const parts = [];
|
||||
|
||||
@@ -94,7 +104,7 @@ function getHelperMetadata(file) {
|
||||
|
||||
ReferencedIdentifier(child) {
|
||||
const name = child.node.name;
|
||||
const binding = child.scope.getBinding(name, true);
|
||||
const binding = child.scope.getBinding(name);
|
||||
|
||||
if (!binding) {
|
||||
globals.add(name);
|
||||
@@ -179,18 +189,18 @@ function permuteHelperAST(file, metadata, id, localBindings, getDependency) {
|
||||
if (decl.isFunctionDeclaration()) {
|
||||
exp.replaceWith(decl);
|
||||
} else {
|
||||
exp.replaceWith(t.variableDeclaration("var", [t.variableDeclarator(id, decl.node)]));
|
||||
exp.replaceWith(variableDeclaration("var", [variableDeclarator(id, decl.node)]));
|
||||
}
|
||||
} else if (id.type === "MemberExpression") {
|
||||
if (decl.isFunctionDeclaration()) {
|
||||
exportBindingAssignments.forEach(assignPath => {
|
||||
const assign = path.get(assignPath);
|
||||
assign.replaceWith(t.assignmentExpression("=", id, assign.node));
|
||||
assign.replaceWith(assignmentExpression("=", id, assign.node));
|
||||
});
|
||||
exp.replaceWith(decl);
|
||||
path.pushContainer("body", t.expressionStatement(t.assignmentExpression("=", id, t.identifier(exportName))));
|
||||
path.pushContainer("body", expressionStatement(assignmentExpression("=", id, identifier(exportName))));
|
||||
} else {
|
||||
exp.replaceWith(t.expressionStatement(t.assignmentExpression("=", id, decl.node)));
|
||||
exp.replaceWith(expressionStatement(assignmentExpression("=", id, decl.node)));
|
||||
}
|
||||
} else {
|
||||
throw new Error("Unexpected helper format.");
|
||||
@@ -203,7 +213,7 @@ function permuteHelperAST(file, metadata, id, localBindings, getDependency) {
|
||||
for (const path of imps) path.remove();
|
||||
|
||||
for (const path of impsBindingRefs) {
|
||||
const node = t.cloneNode(dependenciesRefs[path.node.name]);
|
||||
const node = cloneNode(dependenciesRefs[path.node.name]);
|
||||
path.replaceWith(node);
|
||||
}
|
||||
|
||||
@@ -229,7 +239,7 @@ function loadHelper(name) {
|
||||
|
||||
const fn = () => {
|
||||
const file = {
|
||||
ast: t.file(helper.ast())
|
||||
ast: t_file(helper.ast())
|
||||
};
|
||||
|
||||
if (fileClass) {
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helpers",
|
||||
"version": "7.15.3",
|
||||
"version": "7.15.4",
|
||||
"description": "Collection of helper functions used by Babel transforms.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helpers",
|
||||
@@ -15,9 +15,9 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.14.5",
|
||||
"@babel/traverse": "^7.15.0",
|
||||
"@babel/types": "^7.15.0"
|
||||
"@babel/template": "^7.15.4",
|
||||
"@babel/traverse": "^7.15.4",
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-plugin-test-runner": "7.14.5"
|
||||
|
||||
+1795
-1432
File diff suppressed because it is too large.
Load diff
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/parser",
|
||||
"version": "7.15.3",
|
||||
"version": "7.15.8",
|
||||
"description": "A JavaScript parser",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-parser",
|
||||
@@ -33,9 +33,9 @@
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "7.14.5",
|
||||
"@babel/code-frame": "7.15.8",
|
||||
"@babel/helper-fixtures": "7.14.5",
|
||||
"@babel/helper-validator-identifier": "7.14.9",
|
||||
"@babel/helper-validator-identifier": "7.15.7",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"bin": "./bin/babel-parser.js"
|
||||
|
||||
+6
-2
@@ -5,7 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.program = exports.expression = exports.statement = exports.statements = exports.smart = void 0;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
assertExpressionStatement
|
||||
} = _t;
|
||||
|
||||
function makeStatementFormatter(fn) {
|
||||
return {
|
||||
@@ -54,7 +58,7 @@ const expression = {
|
||||
program
|
||||
}) => {
|
||||
const [stmt] = program.body;
|
||||
t.assertExpressionStatement(stmt);
|
||||
assertExpressionStatement(stmt);
|
||||
return stmt.expression;
|
||||
}
|
||||
};
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.merge = merge;
|
||||
exports.validate = validate;
|
||||
exports.normalizeReplacements = normalizeReplacements;
|
||||
const _excluded = ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"];
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
@@ -37,7 +38,7 @@ function validate(opts) {
|
||||
preserveComments,
|
||||
syntacticPlaceholders
|
||||
} = _ref,
|
||||
parser = _objectWithoutPropertiesLoose(_ref, ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"]);
|
||||
parser = _objectWithoutPropertiesLoose(_ref, _excluded);
|
||||
|
||||
if (placeholderWhitelist != null && !(placeholderWhitelist instanceof Set)) {
|
||||
throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined");
|
||||
|
||||
+23
-10
@@ -5,12 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = parseAndBuildMetadata;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _parser = require("@babel/parser");
|
||||
|
||||
var _codeFrame = require("@babel/code-frame");
|
||||
|
||||
const {
|
||||
isCallExpression,
|
||||
isExpressionStatement,
|
||||
isFunction,
|
||||
isIdentifier,
|
||||
isJSXIdentifier,
|
||||
isNewExpression,
|
||||
isPlaceholder,
|
||||
isStatement,
|
||||
isStringLiteral,
|
||||
removePropertiesDeep,
|
||||
traverse
|
||||
} = _t;
|
||||
const PATTERN = /^[_$A-Z0-9]+$/;
|
||||
|
||||
function parseAndBuildMetadata(formatter, code, opts) {
|
||||
@@ -21,7 +34,7 @@ function parseAndBuildMetadata(formatter, code, opts) {
|
||||
syntacticPlaceholders
|
||||
} = opts;
|
||||
const ast = parseWithCodeFrame(code, opts.parser, syntacticPlaceholders);
|
||||
t.removePropertiesDeep(ast, {
|
||||
removePropertiesDeep(ast, {
|
||||
preserveComments
|
||||
});
|
||||
formatter.validate(ast);
|
||||
@@ -36,7 +49,7 @@ function parseAndBuildMetadata(formatter, code, opts) {
|
||||
const isLegacyRef = {
|
||||
value: undefined
|
||||
};
|
||||
t.traverse(ast, placeholderVisitorHandler, {
|
||||
traverse(ast, placeholderVisitorHandler, {
|
||||
syntactic,
|
||||
legacy,
|
||||
isLegacyRef,
|
||||
@@ -54,7 +67,7 @@ function placeholderVisitorHandler(node, ancestors, state) {
|
||||
|
||||
let name;
|
||||
|
||||
if (t.isPlaceholder(node)) {
|
||||
if (isPlaceholder(node)) {
|
||||
if (state.syntacticPlaceholders === false) {
|
||||
throw new Error("%%foo%%-style placeholders can't be used when " + "'.syntacticPlaceholders' is false.");
|
||||
} else {
|
||||
@@ -63,10 +76,10 @@ function placeholderVisitorHandler(node, ancestors, state) {
|
||||
}
|
||||
} else if (state.isLegacyRef.value === false || state.syntacticPlaceholders) {
|
||||
return;
|
||||
} else if (t.isIdentifier(node) || t.isJSXIdentifier(node)) {
|
||||
} else if (isIdentifier(node) || isJSXIdentifier(node)) {
|
||||
name = node.name;
|
||||
state.isLegacyRef.value = true;
|
||||
} else if (t.isStringLiteral(node)) {
|
||||
} else if (isStringLiteral(node)) {
|
||||
name = node.value;
|
||||
state.isLegacyRef.value = true;
|
||||
} else {
|
||||
@@ -88,16 +101,16 @@ function placeholderVisitorHandler(node, ancestors, state) {
|
||||
} = ancestors[ancestors.length - 1];
|
||||
let type;
|
||||
|
||||
if (t.isStringLiteral(node) || t.isPlaceholder(node, {
|
||||
if (isStringLiteral(node) || isPlaceholder(node, {
|
||||
expectedNode: "StringLiteral"
|
||||
})) {
|
||||
type = "string";
|
||||
} else if (t.isNewExpression(parent) && key === "arguments" || t.isCallExpression(parent) && key === "arguments" || t.isFunction(parent) && key === "params") {
|
||||
} else if (isNewExpression(parent) && key === "arguments" || isCallExpression(parent) && key === "arguments" || isFunction(parent) && key === "params") {
|
||||
type = "param";
|
||||
} else if (t.isExpressionStatement(parent) && !t.isPlaceholder(node)) {
|
||||
} else if (isExpressionStatement(parent) && !isPlaceholder(node)) {
|
||||
type = "statement";
|
||||
ancestors = ancestors.slice(0, -1);
|
||||
} else if (t.isStatement(node) && t.isPlaceholder(node)) {
|
||||
} else if (isStatement(node) && isPlaceholder(node)) {
|
||||
type = "statement";
|
||||
} else {
|
||||
type = "other";
|
||||
|
||||
+30
-18
@@ -5,10 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = populatePlaceholders;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
blockStatement,
|
||||
cloneNode,
|
||||
emptyStatement,
|
||||
expressionStatement,
|
||||
identifier,
|
||||
isStatement,
|
||||
isStringLiteral,
|
||||
stringLiteral,
|
||||
validate
|
||||
} = _t;
|
||||
|
||||
function populatePlaceholders(metadata, replacements) {
|
||||
const ast = t.cloneNode(metadata.ast);
|
||||
const ast = cloneNode(metadata.ast);
|
||||
|
||||
if (replacements) {
|
||||
metadata.placeholders.forEach(placeholder => {
|
||||
@@ -41,9 +53,9 @@ function populatePlaceholders(metadata, replacements) {
|
||||
function applyReplacement(placeholder, ast, replacement) {
|
||||
if (placeholder.isDuplicate) {
|
||||
if (Array.isArray(replacement)) {
|
||||
replacement = replacement.map(node => t.cloneNode(node));
|
||||
replacement = replacement.map(node => cloneNode(node));
|
||||
} else if (typeof replacement === "object") {
|
||||
replacement = t.cloneNode(replacement);
|
||||
replacement = cloneNode(replacement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,43 +67,43 @@ function applyReplacement(placeholder, ast, replacement) {
|
||||
|
||||
if (placeholder.type === "string") {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = t.stringLiteral(replacement);
|
||||
replacement = stringLiteral(replacement);
|
||||
}
|
||||
|
||||
if (!replacement || !t.isStringLiteral(replacement)) {
|
||||
if (!replacement || !isStringLiteral(replacement)) {
|
||||
throw new Error("Expected string substitution");
|
||||
}
|
||||
} else if (placeholder.type === "statement") {
|
||||
if (index === undefined) {
|
||||
if (!replacement) {
|
||||
replacement = t.emptyStatement();
|
||||
replacement = emptyStatement();
|
||||
} else if (Array.isArray(replacement)) {
|
||||
replacement = t.blockStatement(replacement);
|
||||
replacement = blockStatement(replacement);
|
||||
} else if (typeof replacement === "string") {
|
||||
replacement = t.expressionStatement(t.identifier(replacement));
|
||||
} else if (!t.isStatement(replacement)) {
|
||||
replacement = t.expressionStatement(replacement);
|
||||
replacement = expressionStatement(identifier(replacement));
|
||||
} else if (!isStatement(replacement)) {
|
||||
replacement = expressionStatement(replacement);
|
||||
}
|
||||
} else {
|
||||
if (replacement && !Array.isArray(replacement)) {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = t.identifier(replacement);
|
||||
replacement = identifier(replacement);
|
||||
}
|
||||
|
||||
if (!t.isStatement(replacement)) {
|
||||
replacement = t.expressionStatement(replacement);
|
||||
if (!isStatement(replacement)) {
|
||||
replacement = expressionStatement(replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (placeholder.type === "param") {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = t.identifier(replacement);
|
||||
replacement = identifier(replacement);
|
||||
}
|
||||
|
||||
if (index === undefined) throw new Error("Assertion failure.");
|
||||
} else {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = t.identifier(replacement);
|
||||
replacement = identifier(replacement);
|
||||
}
|
||||
|
||||
if (Array.isArray(replacement)) {
|
||||
@@ -100,7 +112,7 @@ function applyReplacement(placeholder, ast, replacement) {
|
||||
}
|
||||
|
||||
if (index === undefined) {
|
||||
t.validate(parent, key, replacement);
|
||||
validate(parent, key, replacement);
|
||||
parent[key] = replacement;
|
||||
} else {
|
||||
const items = parent[key].slice();
|
||||
@@ -117,7 +129,7 @@ function applyReplacement(placeholder, ast, replacement) {
|
||||
items[index] = replacement;
|
||||
}
|
||||
|
||||
t.validate(parent, key, items);
|
||||
validate(parent, key, items);
|
||||
parent[key] = items;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/template",
|
||||
"version": "7.14.5",
|
||||
"version": "7.15.4",
|
||||
"description": "Generate an AST from a string template.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-template",
|
||||
@@ -17,8 +17,8 @@
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.14.5",
|
||||
"@babel/parser": "^7.14.5",
|
||||
"@babel/types": "^7.14.5"
|
||||
"@babel/parser": "^7.15.4",
|
||||
"@babel/types": "^7.15.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
+6
-2
@@ -7,7 +7,11 @@ exports.default = void 0;
|
||||
|
||||
var _path = require("./path");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
VISITOR_KEYS
|
||||
} = _t;
|
||||
|
||||
class TraversalContext {
|
||||
constructor(scope, opts, state, parentPath) {
|
||||
@@ -23,7 +27,7 @@ class TraversalContext {
|
||||
const opts = this.opts;
|
||||
if (opts.enter || opts.exit) return true;
|
||||
if (opts[node.type]) return true;
|
||||
const keys = t.VISITOR_KEYS[node.type];
|
||||
const keys = VISITOR_KEYS[node.type];
|
||||
if (!(keys != null && keys.length)) return false;
|
||||
|
||||
for (const key of keys) {
|
||||
|
||||
+12
-6
@@ -29,7 +29,7 @@ var visitors = require("./visitors");
|
||||
|
||||
exports.visitors = visitors;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var cache = require("./cache");
|
||||
|
||||
@@ -39,6 +39,12 @@ var _scope = require("./scope");
|
||||
|
||||
var _hub = require("./hub");
|
||||
|
||||
const {
|
||||
VISITOR_KEYS,
|
||||
removeProperties,
|
||||
traverseFast
|
||||
} = _t;
|
||||
|
||||
function traverse(parent, opts = {}, scope, state, parentPath) {
|
||||
if (!parent) return;
|
||||
|
||||
@@ -48,7 +54,7 @@ function traverse(parent, opts = {}, scope, state, parentPath) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!t.VISITOR_KEYS[parent.type]) {
|
||||
if (!VISITOR_KEYS[parent.type]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,11 +69,11 @@ traverse.verify = visitors.verify;
|
||||
traverse.explode = visitors.explode;
|
||||
|
||||
traverse.cheap = function (node, enter) {
|
||||
return t.traverseFast(node, enter);
|
||||
return traverseFast(node, enter);
|
||||
};
|
||||
|
||||
traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
|
||||
const keys = t.VISITOR_KEYS[node.type];
|
||||
const keys = VISITOR_KEYS[node.type];
|
||||
if (!keys) return;
|
||||
const context = new _context.default(scope, opts, state, parentPath);
|
||||
|
||||
@@ -78,12 +84,12 @@ traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
|
||||
};
|
||||
|
||||
traverse.clearNode = function (node, opts) {
|
||||
t.removeProperties(node, opts);
|
||||
removeProperties(node, opts);
|
||||
cache.path.delete(node);
|
||||
};
|
||||
|
||||
traverse.removeProperties = function (tree, opts) {
|
||||
t.traverseFast(tree, traverse.clearNode, opts);
|
||||
traverseFast(tree, traverse.clearNode, opts);
|
||||
return tree;
|
||||
};
|
||||
|
||||
|
||||
+6
-2
@@ -14,10 +14,14 @@ exports.isAncestor = isAncestor;
|
||||
exports.isDescendant = isDescendant;
|
||||
exports.inType = inType;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _index = require("./index");
|
||||
|
||||
const {
|
||||
VISITOR_KEYS
|
||||
} = _t;
|
||||
|
||||
function findParent(callback) {
|
||||
let path = this;
|
||||
|
||||
@@ -63,7 +67,7 @@ function getStatementParent() {
|
||||
function getEarliestCommonAncestorFrom(paths) {
|
||||
return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) {
|
||||
let earliest;
|
||||
const keys = t.VISITOR_KEYS[deepest.type];
|
||||
const keys = VISITOR_KEYS[deepest.type];
|
||||
|
||||
for (const ancestry of ancestries) {
|
||||
const path = ancestry[i + 1];
|
||||
|
||||
+8
-3
@@ -7,7 +7,12 @@ exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
|
||||
exports.addComment = addComment;
|
||||
exports.addComments = addComments;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
addComment: _addComment,
|
||||
addComments: _addComments
|
||||
} = _t;
|
||||
|
||||
function shareCommentsWithSiblings() {
|
||||
if (typeof this.key === "string") return;
|
||||
@@ -29,9 +34,9 @@ function shareCommentsWithSiblings() {
|
||||
}
|
||||
|
||||
function addComment(type, content, line) {
|
||||
t.addComment(this.node, type, content, line);
|
||||
_addComment(this.node, type, content, line);
|
||||
}
|
||||
|
||||
function addComments(type, comments) {
|
||||
t.addComments(this.node, type, comments);
|
||||
_addComments(this.node, type, comments);
|
||||
}
|
||||
Generated
Vendored
+57
-32
@@ -9,10 +9,35 @@ exports.arrowFunctionToShadowed = arrowFunctionToShadowed;
|
||||
exports.unwrapFunctionEnvironment = unwrapFunctionEnvironment;
|
||||
exports.arrowFunctionToExpression = arrowFunctionToExpression;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _helperFunctionName = require("@babel/helper-function-name");
|
||||
|
||||
const {
|
||||
arrowFunctionExpression,
|
||||
assignmentExpression,
|
||||
binaryExpression,
|
||||
blockStatement,
|
||||
callExpression,
|
||||
conditionalExpression,
|
||||
expressionStatement,
|
||||
identifier,
|
||||
isIdentifier,
|
||||
jsxIdentifier,
|
||||
memberExpression,
|
||||
metaProperty,
|
||||
numericLiteral,
|
||||
objectExpression,
|
||||
restElement,
|
||||
returnStatement,
|
||||
sequenceExpression,
|
||||
spreadElement,
|
||||
stringLiteral,
|
||||
super: _super,
|
||||
thisExpression,
|
||||
unaryExpression
|
||||
} = _t;
|
||||
|
||||
function toComputedKey() {
|
||||
let key;
|
||||
|
||||
@@ -25,7 +50,7 @@ function toComputedKey() {
|
||||
}
|
||||
|
||||
if (!this.node.computed) {
|
||||
if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
|
||||
if (isIdentifier(key)) key = stringLiteral(key.name);
|
||||
}
|
||||
|
||||
return key;
|
||||
@@ -61,14 +86,14 @@ function ensureBlock() {
|
||||
|
||||
if (this.isFunction()) {
|
||||
key = "argument";
|
||||
statements.push(t.returnStatement(body.node));
|
||||
statements.push(returnStatement(body.node));
|
||||
} else {
|
||||
key = "expression";
|
||||
statements.push(t.expressionStatement(body.node));
|
||||
statements.push(expressionStatement(body.node));
|
||||
}
|
||||
}
|
||||
|
||||
this.node.body = t.blockStatement(statements);
|
||||
this.node.body = blockStatement(statements);
|
||||
const parentPath = this.get(stringPath);
|
||||
body.setup(parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);
|
||||
return this.node;
|
||||
@@ -106,12 +131,12 @@ function arrowFunctionToExpression({
|
||||
if (checkBinding) {
|
||||
this.parentPath.scope.push({
|
||||
id: checkBinding,
|
||||
init: t.objectExpression([])
|
||||
init: objectExpression([])
|
||||
});
|
||||
}
|
||||
|
||||
this.get("body").unshiftContainer("body", t.expressionStatement(t.callExpression(this.hub.addHelper("newArrowCheck"), [t.thisExpression(), checkBinding ? t.identifier(checkBinding.name) : t.identifier(thisBinding)])));
|
||||
this.replaceWith(t.callExpression(t.memberExpression((0, _helperFunctionName.default)(this, true) || this.node, t.identifier("bind")), [checkBinding ? t.identifier(checkBinding.name) : t.thisExpression()]));
|
||||
this.get("body").unshiftContainer("body", expressionStatement(callExpression(this.hub.addHelper("newArrowCheck"), [thisExpression(), checkBinding ? identifier(checkBinding.name) : identifier(thisBinding)])));
|
||||
this.replaceWith(callExpression(memberExpression((0, _helperFunctionName.default)(this, true) || this.node, identifier("bind")), [checkBinding ? identifier(checkBinding.name) : thisExpression()]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +184,7 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
||||
});
|
||||
const superBinding = getSuperBinding(thisEnvFn);
|
||||
allSuperCalls.forEach(superCall => {
|
||||
const callee = t.identifier(superBinding);
|
||||
const callee = identifier(superBinding);
|
||||
callee.loc = superCall.node.callee.loc;
|
||||
superCall.get("callee").replaceWith(callee);
|
||||
});
|
||||
@@ -167,25 +192,25 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
||||
|
||||
if (argumentsPaths.length > 0) {
|
||||
const argumentsBinding = getBinding(thisEnvFn, "arguments", () => {
|
||||
const args = () => t.identifier("arguments");
|
||||
const args = () => identifier("arguments");
|
||||
|
||||
if (thisEnvFn.scope.path.isProgram()) {
|
||||
return t.conditionalExpression(t.binaryExpression("===", t.unaryExpression("typeof", args()), t.stringLiteral("undefined")), thisEnvFn.scope.buildUndefinedNode(), args());
|
||||
return conditionalExpression(binaryExpression("===", unaryExpression("typeof", args()), stringLiteral("undefined")), thisEnvFn.scope.buildUndefinedNode(), args());
|
||||
} else {
|
||||
return args();
|
||||
}
|
||||
});
|
||||
argumentsPaths.forEach(argumentsChild => {
|
||||
const argsRef = t.identifier(argumentsBinding);
|
||||
const argsRef = identifier(argumentsBinding);
|
||||
argsRef.loc = argumentsChild.node.loc;
|
||||
argumentsChild.replaceWith(argsRef);
|
||||
});
|
||||
}
|
||||
|
||||
if (newTargetPaths.length > 0) {
|
||||
const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => t.metaProperty(t.identifier("new"), t.identifier("target")));
|
||||
const newTargetBinding = getBinding(thisEnvFn, "newtarget", () => metaProperty(identifier("new"), identifier("target")));
|
||||
newTargetPaths.forEach(targetChild => {
|
||||
const targetRef = t.identifier(newTargetBinding);
|
||||
const targetRef = identifier(newTargetBinding);
|
||||
targetRef.loc = targetChild.node.loc;
|
||||
targetChild.replaceWith(targetRef);
|
||||
});
|
||||
@@ -217,11 +242,11 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
||||
args.push(value);
|
||||
}
|
||||
|
||||
const call = t.callExpression(t.identifier(superBinding), args);
|
||||
const call = callExpression(identifier(superBinding), args);
|
||||
|
||||
if (isCall) {
|
||||
superProp.parentPath.unshiftContainer("arguments", t.thisExpression());
|
||||
superProp.replaceWith(t.memberExpression(call, t.identifier("call")));
|
||||
superProp.parentPath.unshiftContainer("arguments", thisExpression());
|
||||
superProp.replaceWith(memberExpression(call, identifier("call")));
|
||||
thisPaths.push(superProp.parentPath.get("arguments.0"));
|
||||
} else if (isAssignment) {
|
||||
superProp.parentPath.replaceWith(call);
|
||||
@@ -238,7 +263,7 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
||||
|
||||
if (noNewArrows || inConstructor && hasSuperClass(thisEnvFn)) {
|
||||
thisPaths.forEach(thisChild => {
|
||||
const thisRef = thisChild.isJSX() ? t.jsxIdentifier(thisBinding) : t.identifier(thisBinding);
|
||||
const thisRef = thisChild.isJSX() ? jsxIdentifier(thisBinding) : identifier(thisBinding);
|
||||
thisRef.loc = thisChild.node.loc;
|
||||
thisChild.replaceWith(thisRef);
|
||||
});
|
||||
@@ -258,11 +283,11 @@ function standardizeSuperProperty(superProp) {
|
||||
|
||||
if (superProp.node.computed) {
|
||||
const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
|
||||
assignmentPath.get("left").replaceWith(t.memberExpression(superProp.node.object, t.assignmentExpression("=", tmp, superProp.node.property), true));
|
||||
assignmentPath.get("right").replaceWith(t.binaryExpression(op, t.memberExpression(superProp.node.object, t.identifier(tmp.name), true), value));
|
||||
assignmentPath.get("left").replaceWith(memberExpression(superProp.node.object, assignmentExpression("=", tmp, superProp.node.property), true));
|
||||
assignmentPath.get("right").replaceWith(binaryExpression(op, memberExpression(superProp.node.object, identifier(tmp.name), true), value));
|
||||
} else {
|
||||
assignmentPath.get("left").replaceWith(t.memberExpression(superProp.node.object, superProp.node.property));
|
||||
assignmentPath.get("right").replaceWith(t.binaryExpression(op, t.memberExpression(superProp.node.object, t.identifier(superProp.node.property.name)), value));
|
||||
assignmentPath.get("left").replaceWith(memberExpression(superProp.node.object, superProp.node.property));
|
||||
assignmentPath.get("right").replaceWith(binaryExpression(op, memberExpression(superProp.node.object, identifier(superProp.node.property.name)), value));
|
||||
}
|
||||
|
||||
return [assignmentPath.get("left"), assignmentPath.get("right").get("left")];
|
||||
@@ -270,13 +295,13 @@ function standardizeSuperProperty(superProp) {
|
||||
const updateExpr = superProp.parentPath;
|
||||
const tmp = superProp.scope.generateDeclaredUidIdentifier("tmp");
|
||||
const computedKey = superProp.node.computed ? superProp.scope.generateDeclaredUidIdentifier("prop") : null;
|
||||
const parts = [t.assignmentExpression("=", tmp, t.memberExpression(superProp.node.object, computedKey ? t.assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), t.assignmentExpression("=", t.memberExpression(superProp.node.object, computedKey ? t.identifier(computedKey.name) : superProp.node.property, superProp.node.computed), t.binaryExpression("+", t.identifier(tmp.name), t.numericLiteral(1)))];
|
||||
const parts = [assignmentExpression("=", tmp, memberExpression(superProp.node.object, computedKey ? assignmentExpression("=", computedKey, superProp.node.property) : superProp.node.property, superProp.node.computed)), assignmentExpression("=", memberExpression(superProp.node.object, computedKey ? identifier(computedKey.name) : superProp.node.property, superProp.node.computed), binaryExpression("+", identifier(tmp.name), numericLiteral(1)))];
|
||||
|
||||
if (!superProp.parentPath.node.prefix) {
|
||||
parts.push(t.identifier(tmp.name));
|
||||
parts.push(identifier(tmp.name));
|
||||
}
|
||||
|
||||
updateExpr.replaceWith(t.sequenceExpression(parts));
|
||||
updateExpr.replaceWith(sequenceExpression(parts));
|
||||
const left = updateExpr.get("expressions.0.right");
|
||||
const right = updateExpr.get("expressions.1.left");
|
||||
return [left, right];
|
||||
@@ -291,7 +316,7 @@ function hasSuperClass(thisEnvFn) {
|
||||
|
||||
function getThisBinding(thisEnvFn, inConstructor) {
|
||||
return getBinding(thisEnvFn, "this", thisBinding => {
|
||||
if (!inConstructor || !hasSuperClass(thisEnvFn)) return t.thisExpression();
|
||||
if (!inConstructor || !hasSuperClass(thisEnvFn)) return thisExpression();
|
||||
const supers = new WeakSet();
|
||||
thisEnvFn.traverse({
|
||||
Function(child) {
|
||||
@@ -307,7 +332,7 @@ function getThisBinding(thisEnvFn, inConstructor) {
|
||||
if (!child.get("callee").isSuper()) return;
|
||||
if (supers.has(child.node)) return;
|
||||
supers.add(child.node);
|
||||
child.replaceWithMultiple([child.node, t.assignmentExpression("=", t.identifier(thisBinding), t.identifier("this"))]);
|
||||
child.replaceWithMultiple([child.node, assignmentExpression("=", identifier(thisBinding), identifier("this"))]);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -317,7 +342,7 @@ function getThisBinding(thisEnvFn, inConstructor) {
|
||||
function getSuperBinding(thisEnvFn) {
|
||||
return getBinding(thisEnvFn, "supercall", () => {
|
||||
const argsBinding = thisEnvFn.scope.generateUidIdentifier("args");
|
||||
return t.arrowFunctionExpression([t.restElement(argsBinding)], t.callExpression(t.super(), [t.spreadElement(t.identifier(argsBinding.name))]));
|
||||
return arrowFunctionExpression([restElement(argsBinding)], callExpression(_super(), [spreadElement(identifier(argsBinding.name))]));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -328,20 +353,20 @@ function getSuperPropBinding(thisEnvFn, isAssignment, propName) {
|
||||
let fnBody;
|
||||
|
||||
if (propName) {
|
||||
fnBody = t.memberExpression(t.super(), t.identifier(propName));
|
||||
fnBody = memberExpression(_super(), identifier(propName));
|
||||
} else {
|
||||
const method = thisEnvFn.scope.generateUidIdentifier("prop");
|
||||
argsList.unshift(method);
|
||||
fnBody = t.memberExpression(t.super(), t.identifier(method.name), true);
|
||||
fnBody = memberExpression(_super(), identifier(method.name), true);
|
||||
}
|
||||
|
||||
if (isAssignment) {
|
||||
const valueIdent = thisEnvFn.scope.generateUidIdentifier("value");
|
||||
argsList.push(valueIdent);
|
||||
fnBody = t.assignmentExpression("=", fnBody, t.identifier(valueIdent.name));
|
||||
fnBody = assignmentExpression("=", fnBody, identifier(valueIdent.name));
|
||||
}
|
||||
|
||||
return t.arrowFunctionExpression(argsList, fnBody);
|
||||
return arrowFunctionExpression(argsList, fnBody);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+51
-28
@@ -20,8 +20,15 @@ exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
|
||||
|
||||
var _index = require("./index");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
getBindingIdentifiers: _getBindingIdentifiers,
|
||||
getOuterBindingIdentifiers: _getOuterBindingIdentifiers,
|
||||
isDeclaration,
|
||||
numericLiteral,
|
||||
unaryExpression
|
||||
} = _t;
|
||||
const NORMAL_COMPLETION = 0;
|
||||
const BREAK_COMPLETION = 1;
|
||||
|
||||
@@ -50,7 +57,10 @@ function getOpposite() {
|
||||
}
|
||||
|
||||
function addCompletionRecords(path, records, context) {
|
||||
if (path) return records.concat(_getCompletionRecords(path, context));
|
||||
if (path) {
|
||||
records.push(..._getCompletionRecords(path, context));
|
||||
}
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
@@ -79,10 +89,10 @@ function completionRecordForSwitch(cases, records, context) {
|
||||
lastNormalCompletions = normalCompletions;
|
||||
}
|
||||
|
||||
records = records.concat(breakCompletions);
|
||||
records.push(...breakCompletions);
|
||||
}
|
||||
|
||||
records = records.concat(lastNormalCompletions);
|
||||
records.push(...lastNormalCompletions);
|
||||
return records;
|
||||
}
|
||||
|
||||
@@ -98,7 +108,7 @@ function replaceBreakStatementInBreakCompletion(completions, reachable) {
|
||||
label: null
|
||||
})) {
|
||||
if (reachable) {
|
||||
c.path.replaceWith(t.unaryExpression("void", t.numericLiteral(0)));
|
||||
c.path.replaceWith(unaryExpression("void", numericLiteral(0)));
|
||||
} else {
|
||||
c.path.remove();
|
||||
}
|
||||
@@ -107,7 +117,7 @@ function replaceBreakStatementInBreakCompletion(completions, reachable) {
|
||||
}
|
||||
|
||||
function getStatementListCompletion(paths, context) {
|
||||
let completions = [];
|
||||
const completions = [];
|
||||
|
||||
if (context.canHaveBreak) {
|
||||
let lastNormalCompletions = [];
|
||||
@@ -119,8 +129,8 @@ function getStatementListCompletion(paths, context) {
|
||||
});
|
||||
|
||||
if (path.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
|
||||
newContext.shouldPopulateBreak = true;
|
||||
} else {
|
||||
newContext.shouldPopulateBreak = true;
|
||||
} else {
|
||||
newContext.shouldPopulateBreak = false;
|
||||
}
|
||||
|
||||
@@ -131,16 +141,16 @@ function getStatementListCompletion(paths, context) {
|
||||
label: null
|
||||
}))) {
|
||||
normalCompletionToBreak(lastNormalCompletions);
|
||||
completions = completions.concat(lastNormalCompletions);
|
||||
completions.push(...lastNormalCompletions);
|
||||
|
||||
if (lastNormalCompletions.some(c => c.path.isDeclaration())) {
|
||||
completions = completions.concat(statementCompletions);
|
||||
completions.push(...statementCompletions);
|
||||
replaceBreakStatementInBreakCompletion(statementCompletions, true);
|
||||
}
|
||||
|
||||
replaceBreakStatementInBreakCompletion(statementCompletions, false);
|
||||
} else {
|
||||
completions = completions.concat(statementCompletions);
|
||||
completions.push(...statementCompletions);
|
||||
|
||||
if (!context.shouldPopulateBreak) {
|
||||
replaceBreakStatementInBreakCompletion(statementCompletions, true);
|
||||
@@ -151,10 +161,21 @@ function getStatementListCompletion(paths, context) {
|
||||
}
|
||||
|
||||
if (i === paths.length - 1) {
|
||||
completions = completions.concat(statementCompletions);
|
||||
completions.push(...statementCompletions);
|
||||
} else {
|
||||
completions = completions.concat(statementCompletions.filter(c => c.type === BREAK_COMPLETION));
|
||||
lastNormalCompletions = statementCompletions.filter(c => c.type === NORMAL_COMPLETION);
|
||||
lastNormalCompletions = [];
|
||||
|
||||
for (let i = 0; i < statementCompletions.length; i++) {
|
||||
const c = statementCompletions[i];
|
||||
|
||||
if (c.type === BREAK_COMPLETION) {
|
||||
completions.push(c);
|
||||
}
|
||||
|
||||
if (c.type === NORMAL_COMPLETION) {
|
||||
lastNormalCompletions.push(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (paths.length) {
|
||||
@@ -162,7 +183,7 @@ function getStatementListCompletion(paths, context) {
|
||||
const pathCompletions = _getCompletionRecords(paths[i], context);
|
||||
|
||||
if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) {
|
||||
completions = completions.concat(pathCompletions);
|
||||
completions.push(...pathCompletions);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -178,24 +199,24 @@ function _getCompletionRecords(path, context) {
|
||||
records = addCompletionRecords(path.get("consequent"), records, context);
|
||||
records = addCompletionRecords(path.get("alternate"), records, context);
|
||||
} else if (path.isDoExpression() || path.isFor() || path.isWhile() || path.isLabeledStatement()) {
|
||||
records = addCompletionRecords(path.get("body"), records, context);
|
||||
return addCompletionRecords(path.get("body"), records, context);
|
||||
} else if (path.isProgram() || path.isBlockStatement()) {
|
||||
records = records.concat(getStatementListCompletion(path.get("body"), context));
|
||||
return getStatementListCompletion(path.get("body"), context);
|
||||
} else if (path.isFunction()) {
|
||||
return _getCompletionRecords(path.get("body"), context);
|
||||
} else if (path.isTryStatement()) {
|
||||
records = addCompletionRecords(path.get("block"), records, context);
|
||||
records = addCompletionRecords(path.get("handler"), records, context);
|
||||
} else if (path.isCatchClause()) {
|
||||
records = addCompletionRecords(path.get("body"), records, context);
|
||||
return addCompletionRecords(path.get("body"), records, context);
|
||||
} else if (path.isSwitchStatement()) {
|
||||
records = completionRecordForSwitch(path.get("cases"), records, context);
|
||||
return completionRecordForSwitch(path.get("cases"), records, context);
|
||||
} else if (path.isSwitchCase()) {
|
||||
records = records.concat(getStatementListCompletion(path.get("consequent"), {
|
||||
return getStatementListCompletion(path.get("consequent"), {
|
||||
canHaveBreak: true,
|
||||
shouldPopulateBreak: false,
|
||||
inCaseClause: true
|
||||
}));
|
||||
});
|
||||
} else if (path.isBreakStatement()) {
|
||||
records.push(BreakCompletion(path));
|
||||
} else {
|
||||
@@ -313,23 +334,23 @@ function _getPattern(parts, context) {
|
||||
}
|
||||
|
||||
function getBindingIdentifiers(duplicates) {
|
||||
return t.getBindingIdentifiers(this.node, duplicates);
|
||||
return _getBindingIdentifiers(this.node, duplicates);
|
||||
}
|
||||
|
||||
function getOuterBindingIdentifiers(duplicates) {
|
||||
return t.getOuterBindingIdentifiers(this.node, duplicates);
|
||||
return _getOuterBindingIdentifiers(this.node, duplicates);
|
||||
}
|
||||
|
||||
function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
|
||||
const path = this;
|
||||
let search = [].concat(path);
|
||||
const search = [path];
|
||||
const ids = Object.create(null);
|
||||
|
||||
while (search.length) {
|
||||
const id = search.shift();
|
||||
if (!id) continue;
|
||||
if (!id.node) continue;
|
||||
const keys = t.getBindingIdentifiers.keys[id.node.type];
|
||||
const keys = _getBindingIdentifiers.keys[id.node.type];
|
||||
|
||||
if (id.isIdentifier()) {
|
||||
if (duplicates) {
|
||||
@@ -346,7 +367,7 @@ function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
|
||||
if (id.isExportDeclaration()) {
|
||||
const declaration = id.get("declaration");
|
||||
|
||||
if (declaration.isDeclaration()) {
|
||||
if (isDeclaration(declaration)) {
|
||||
search.push(declaration);
|
||||
}
|
||||
|
||||
@@ -369,8 +390,10 @@ function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
|
||||
const key = keys[i];
|
||||
const child = id.get(key);
|
||||
|
||||
if (Array.isArray(child) || child.node) {
|
||||
search = search.concat(child);
|
||||
if (Array.isArray(child)) {
|
||||
search.push(...child);
|
||||
} else if (child.node) {
|
||||
search.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-2
@@ -13,7 +13,9 @@ var _index = require("../index");
|
||||
|
||||
var _scope = require("../scope");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var t = _t;
|
||||
|
||||
var _cache = require("../cache");
|
||||
|
||||
@@ -41,6 +43,10 @@ var NodePath_family = require("./family");
|
||||
|
||||
var NodePath_comments = require("./comments");
|
||||
|
||||
const {
|
||||
validate
|
||||
} = _t;
|
||||
|
||||
const debug = _debug("babel");
|
||||
|
||||
const REMOVED = 1 << 0;
|
||||
@@ -138,7 +144,7 @@ class NodePath {
|
||||
}
|
||||
|
||||
set(key, node) {
|
||||
t.validate(this.node, key, node);
|
||||
validate(this.node, key, node);
|
||||
this.node[key] = node;
|
||||
}
|
||||
|
||||
|
||||
Generated
Vendored
+36
-18
@@ -12,12 +12,30 @@ exports.isGenericType = isGenericType;
|
||||
|
||||
var inferers = require("./inferers");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
anyTypeAnnotation,
|
||||
isAnyTypeAnnotation,
|
||||
isBooleanTypeAnnotation,
|
||||
isEmptyTypeAnnotation,
|
||||
isFlowBaseAnnotation,
|
||||
isGenericTypeAnnotation,
|
||||
isIdentifier,
|
||||
isMixedTypeAnnotation,
|
||||
isNumberTypeAnnotation,
|
||||
isStringTypeAnnotation,
|
||||
isTypeAnnotation,
|
||||
isUnionTypeAnnotation,
|
||||
isVoidTypeAnnotation,
|
||||
stringTypeAnnotation,
|
||||
voidTypeAnnotation
|
||||
} = _t;
|
||||
|
||||
function getTypeAnnotation() {
|
||||
if (this.typeAnnotation) return this.typeAnnotation;
|
||||
let type = this._getTypeAnnotation() || t.anyTypeAnnotation();
|
||||
if (t.isTypeAnnotation(type)) type = type.typeAnnotation;
|
||||
let type = this._getTypeAnnotation() || anyTypeAnnotation();
|
||||
if (isTypeAnnotation(type)) type = type.typeAnnotation;
|
||||
return this.typeAnnotation = type;
|
||||
}
|
||||
|
||||
@@ -32,14 +50,14 @@ function _getTypeAnnotation() {
|
||||
const declarParent = declar.parentPath;
|
||||
|
||||
if (declar.key === "left" && declarParent.isForInStatement()) {
|
||||
return t.stringTypeAnnotation();
|
||||
return stringTypeAnnotation();
|
||||
}
|
||||
|
||||
if (declar.key === "left" && declarParent.isForOfStatement()) {
|
||||
return t.anyTypeAnnotation();
|
||||
return anyTypeAnnotation();
|
||||
}
|
||||
|
||||
return t.voidTypeAnnotation();
|
||||
return voidTypeAnnotation();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@@ -80,19 +98,19 @@ function isBaseType(baseName, soft) {
|
||||
|
||||
function _isBaseType(baseName, type, soft) {
|
||||
if (baseName === "string") {
|
||||
return t.isStringTypeAnnotation(type);
|
||||
return isStringTypeAnnotation(type);
|
||||
} else if (baseName === "number") {
|
||||
return t.isNumberTypeAnnotation(type);
|
||||
return isNumberTypeAnnotation(type);
|
||||
} else if (baseName === "boolean") {
|
||||
return t.isBooleanTypeAnnotation(type);
|
||||
return isBooleanTypeAnnotation(type);
|
||||
} else if (baseName === "any") {
|
||||
return t.isAnyTypeAnnotation(type);
|
||||
return isAnyTypeAnnotation(type);
|
||||
} else if (baseName === "mixed") {
|
||||
return t.isMixedTypeAnnotation(type);
|
||||
return isMixedTypeAnnotation(type);
|
||||
} else if (baseName === "empty") {
|
||||
return t.isEmptyTypeAnnotation(type);
|
||||
return isEmptyTypeAnnotation(type);
|
||||
} else if (baseName === "void") {
|
||||
return t.isVoidTypeAnnotation(type);
|
||||
return isVoidTypeAnnotation(type);
|
||||
} else {
|
||||
if (soft) {
|
||||
return false;
|
||||
@@ -104,11 +122,11 @@ function _isBaseType(baseName, type, soft) {
|
||||
|
||||
function couldBeBaseType(name) {
|
||||
const type = this.getTypeAnnotation();
|
||||
if (t.isAnyTypeAnnotation(type)) return true;
|
||||
if (isAnyTypeAnnotation(type)) return true;
|
||||
|
||||
if (t.isUnionTypeAnnotation(type)) {
|
||||
if (isUnionTypeAnnotation(type)) {
|
||||
for (const type2 of type.types) {
|
||||
if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
|
||||
if (isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +141,7 @@ function baseTypeStrictlyMatches(rightArg) {
|
||||
const left = this.getTypeAnnotation();
|
||||
const right = rightArg.getTypeAnnotation();
|
||||
|
||||
if (!t.isAnyTypeAnnotation(left) && t.isFlowBaseAnnotation(left)) {
|
||||
if (!isAnyTypeAnnotation(left) && isFlowBaseAnnotation(left)) {
|
||||
return right.type === left.type;
|
||||
}
|
||||
|
||||
@@ -132,7 +150,7 @@ function baseTypeStrictlyMatches(rightArg) {
|
||||
|
||||
function isGenericType(genericName) {
|
||||
const type = this.getTypeAnnotation();
|
||||
return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, {
|
||||
return isGenericTypeAnnotation(type) && isIdentifier(type.id, {
|
||||
name: genericName
|
||||
});
|
||||
}
|
||||
Generated
Vendored
+28
-17
@@ -5,7 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
BOOLEAN_NUMBER_BINARY_OPERATORS,
|
||||
createFlowUnionType,
|
||||
createTSUnionType,
|
||||
createTypeAnnotationBasedOnTypeof,
|
||||
createUnionTypeAnnotation,
|
||||
isTSTypeAnnotation,
|
||||
numberTypeAnnotation,
|
||||
voidTypeAnnotation
|
||||
} = _t;
|
||||
|
||||
function _default(node) {
|
||||
if (!this.isReferenced()) return;
|
||||
@@ -20,9 +31,9 @@ function _default(node) {
|
||||
}
|
||||
|
||||
if (node.name === "undefined") {
|
||||
return t.voidTypeAnnotation();
|
||||
return voidTypeAnnotation();
|
||||
} else if (node.name === "NaN" || node.name === "Infinity") {
|
||||
return t.numberTypeAnnotation();
|
||||
return numberTypeAnnotation();
|
||||
} else if (node.name === "arguments") {}
|
||||
}
|
||||
|
||||
@@ -39,7 +50,7 @@ function getTypeAnnotationBindingConstantViolations(binding, path, name) {
|
||||
}
|
||||
|
||||
if (constantViolations.length) {
|
||||
constantViolations = constantViolations.concat(functionConstantViolations);
|
||||
constantViolations.push(...functionConstantViolations);
|
||||
|
||||
for (const violation of constantViolations) {
|
||||
types.push(violation.getTypeAnnotation());
|
||||
@@ -50,15 +61,15 @@ function getTypeAnnotationBindingConstantViolations(binding, path, name) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) {
|
||||
return t.createTSUnionType(types);
|
||||
if (isTSTypeAnnotation(types[0]) && createTSUnionType) {
|
||||
return createTSUnionType(types);
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return t.createFlowUnionType(types);
|
||||
if (createFlowUnionType) {
|
||||
return createFlowUnionType(types);
|
||||
}
|
||||
|
||||
return t.createUnionTypeAnnotation(types);
|
||||
return createUnionTypeAnnotation(types);
|
||||
}
|
||||
|
||||
function getConstantViolationsBefore(binding, path, functions) {
|
||||
@@ -95,8 +106,8 @@ function inferAnnotationFromBinaryExpression(name, path) {
|
||||
return target.getTypeAnnotation();
|
||||
}
|
||||
|
||||
if (t.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.numberTypeAnnotation();
|
||||
if (BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return numberTypeAnnotation();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -126,7 +137,7 @@ function inferAnnotationFromBinaryExpression(name, path) {
|
||||
if (!typePath.isLiteral()) return;
|
||||
const typeValue = typePath.node.value;
|
||||
if (typeof typeValue !== "string") return;
|
||||
return t.createTypeAnnotationBasedOnTypeof(typeValue);
|
||||
return createTypeAnnotationBasedOnTypeof(typeValue);
|
||||
}
|
||||
|
||||
function getParentConditionalPath(binding, path, name) {
|
||||
@@ -171,22 +182,22 @@ function getConditionalAnnotation(binding, path, name) {
|
||||
}
|
||||
|
||||
if (types.length) {
|
||||
if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) {
|
||||
if (isTSTypeAnnotation(types[0]) && createTSUnionType) {
|
||||
return {
|
||||
typeAnnotation: t.createTSUnionType(types),
|
||||
typeAnnotation: createTSUnionType(types),
|
||||
ifStatement
|
||||
};
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
if (createFlowUnionType) {
|
||||
return {
|
||||
typeAnnotation: t.createFlowUnionType(types),
|
||||
typeAnnotation: createFlowUnionType(types),
|
||||
ifStatement
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
typeAnnotation: t.createUnionTypeAnnotation(types),
|
||||
typeAnnotation: createUnionTypeAnnotation(types),
|
||||
ifStatement
|
||||
};
|
||||
}
|
||||
|
||||
Generated
Vendored
+69
-45
@@ -33,10 +33,34 @@ Object.defineProperty(exports, "Identifier", {
|
||||
}
|
||||
});
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _infererReference = require("./inferer-reference");
|
||||
|
||||
const {
|
||||
BOOLEAN_BINARY_OPERATORS,
|
||||
BOOLEAN_UNARY_OPERATORS,
|
||||
NUMBER_BINARY_OPERATORS,
|
||||
NUMBER_UNARY_OPERATORS,
|
||||
STRING_UNARY_OPERATORS,
|
||||
anyTypeAnnotation,
|
||||
arrayTypeAnnotation,
|
||||
booleanTypeAnnotation,
|
||||
buildMatchMemberExpression,
|
||||
createFlowUnionType,
|
||||
createTSUnionType,
|
||||
createUnionTypeAnnotation,
|
||||
genericTypeAnnotation,
|
||||
identifier,
|
||||
isTSTypeAnnotation,
|
||||
nullLiteralTypeAnnotation,
|
||||
numberTypeAnnotation,
|
||||
stringTypeAnnotation,
|
||||
tupleTypeAnnotation,
|
||||
unionTypeAnnotation,
|
||||
voidTypeAnnotation
|
||||
} = _t;
|
||||
|
||||
function VariableDeclarator() {
|
||||
var _type;
|
||||
|
||||
@@ -64,75 +88,75 @@ TypeCastExpression.validParent = true;
|
||||
|
||||
function NewExpression(node) {
|
||||
if (this.get("callee").isIdentifier()) {
|
||||
return t.genericTypeAnnotation(node.callee);
|
||||
return genericTypeAnnotation(node.callee);
|
||||
}
|
||||
}
|
||||
|
||||
function TemplateLiteral() {
|
||||
return t.stringTypeAnnotation();
|
||||
return stringTypeAnnotation();
|
||||
}
|
||||
|
||||
function UnaryExpression(node) {
|
||||
const operator = node.operator;
|
||||
|
||||
if (operator === "void") {
|
||||
return t.voidTypeAnnotation();
|
||||
} else if (t.NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.numberTypeAnnotation();
|
||||
} else if (t.STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.stringTypeAnnotation();
|
||||
} else if (t.BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.booleanTypeAnnotation();
|
||||
return voidTypeAnnotation();
|
||||
} else if (NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return numberTypeAnnotation();
|
||||
} else if (STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return stringTypeAnnotation();
|
||||
} else if (BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return booleanTypeAnnotation();
|
||||
}
|
||||
}
|
||||
|
||||
function BinaryExpression(node) {
|
||||
const operator = node.operator;
|
||||
|
||||
if (t.NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.numberTypeAnnotation();
|
||||
} else if (t.BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return t.booleanTypeAnnotation();
|
||||
if (NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return numberTypeAnnotation();
|
||||
} else if (BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
|
||||
return booleanTypeAnnotation();
|
||||
} else if (operator === "+") {
|
||||
const right = this.get("right");
|
||||
const left = this.get("left");
|
||||
|
||||
if (left.isBaseType("number") && right.isBaseType("number")) {
|
||||
return t.numberTypeAnnotation();
|
||||
return numberTypeAnnotation();
|
||||
} else if (left.isBaseType("string") || right.isBaseType("string")) {
|
||||
return t.stringTypeAnnotation();
|
||||
return stringTypeAnnotation();
|
||||
}
|
||||
|
||||
return t.unionTypeAnnotation([t.stringTypeAnnotation(), t.numberTypeAnnotation()]);
|
||||
return unionTypeAnnotation([stringTypeAnnotation(), numberTypeAnnotation()]);
|
||||
}
|
||||
}
|
||||
|
||||
function LogicalExpression() {
|
||||
const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()];
|
||||
|
||||
if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) {
|
||||
return t.createTSUnionType(argumentTypes);
|
||||
if (isTSTypeAnnotation(argumentTypes[0]) && createTSUnionType) {
|
||||
return createTSUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return t.createFlowUnionType(argumentTypes);
|
||||
if (createFlowUnionType) {
|
||||
return createFlowUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
return t.createUnionTypeAnnotation(argumentTypes);
|
||||
return createUnionTypeAnnotation(argumentTypes);
|
||||
}
|
||||
|
||||
function ConditionalExpression() {
|
||||
const argumentTypes = [this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()];
|
||||
|
||||
if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) {
|
||||
return t.createTSUnionType(argumentTypes);
|
||||
if (isTSTypeAnnotation(argumentTypes[0]) && createTSUnionType) {
|
||||
return createTSUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
if (t.createFlowUnionType) {
|
||||
return t.createFlowUnionType(argumentTypes);
|
||||
if (createFlowUnionType) {
|
||||
return createFlowUnionType(argumentTypes);
|
||||
}
|
||||
|
||||
return t.createUnionTypeAnnotation(argumentTypes);
|
||||
return createUnionTypeAnnotation(argumentTypes);
|
||||
}
|
||||
|
||||
function SequenceExpression() {
|
||||
@@ -151,36 +175,36 @@ function UpdateExpression(node) {
|
||||
const operator = node.operator;
|
||||
|
||||
if (operator === "++" || operator === "--") {
|
||||
return t.numberTypeAnnotation();
|
||||
return numberTypeAnnotation();
|
||||
}
|
||||
}
|
||||
|
||||
function StringLiteral() {
|
||||
return t.stringTypeAnnotation();
|
||||
return stringTypeAnnotation();
|
||||
}
|
||||
|
||||
function NumericLiteral() {
|
||||
return t.numberTypeAnnotation();
|
||||
return numberTypeAnnotation();
|
||||
}
|
||||
|
||||
function BooleanLiteral() {
|
||||
return t.booleanTypeAnnotation();
|
||||
return booleanTypeAnnotation();
|
||||
}
|
||||
|
||||
function NullLiteral() {
|
||||
return t.nullLiteralTypeAnnotation();
|
||||
return nullLiteralTypeAnnotation();
|
||||
}
|
||||
|
||||
function RegExpLiteral() {
|
||||
return t.genericTypeAnnotation(t.identifier("RegExp"));
|
||||
return genericTypeAnnotation(identifier("RegExp"));
|
||||
}
|
||||
|
||||
function ObjectExpression() {
|
||||
return t.genericTypeAnnotation(t.identifier("Object"));
|
||||
return genericTypeAnnotation(identifier("Object"));
|
||||
}
|
||||
|
||||
function ArrayExpression() {
|
||||
return t.genericTypeAnnotation(t.identifier("Array"));
|
||||
return genericTypeAnnotation(identifier("Array"));
|
||||
}
|
||||
|
||||
function RestElement() {
|
||||
@@ -190,13 +214,13 @@ function RestElement() {
|
||||
RestElement.validParent = true;
|
||||
|
||||
function Func() {
|
||||
return t.genericTypeAnnotation(t.identifier("Function"));
|
||||
return genericTypeAnnotation(identifier("Function"));
|
||||
}
|
||||
|
||||
const isArrayFrom = t.buildMatchMemberExpression("Array.from");
|
||||
const isObjectKeys = t.buildMatchMemberExpression("Object.keys");
|
||||
const isObjectValues = t.buildMatchMemberExpression("Object.values");
|
||||
const isObjectEntries = t.buildMatchMemberExpression("Object.entries");
|
||||
const isArrayFrom = buildMatchMemberExpression("Array.from");
|
||||
const isObjectKeys = buildMatchMemberExpression("Object.keys");
|
||||
const isObjectValues = buildMatchMemberExpression("Object.values");
|
||||
const isObjectEntries = buildMatchMemberExpression("Object.entries");
|
||||
|
||||
function CallExpression() {
|
||||
const {
|
||||
@@ -204,11 +228,11 @@ function CallExpression() {
|
||||
} = this.node;
|
||||
|
||||
if (isObjectKeys(callee)) {
|
||||
return t.arrayTypeAnnotation(t.stringTypeAnnotation());
|
||||
return arrayTypeAnnotation(stringTypeAnnotation());
|
||||
} else if (isArrayFrom(callee) || isObjectValues(callee)) {
|
||||
return t.arrayTypeAnnotation(t.anyTypeAnnotation());
|
||||
return arrayTypeAnnotation(anyTypeAnnotation());
|
||||
} else if (isObjectEntries(callee)) {
|
||||
return t.arrayTypeAnnotation(t.tupleTypeAnnotation([t.stringTypeAnnotation(), t.anyTypeAnnotation()]));
|
||||
return arrayTypeAnnotation(tupleTypeAnnotation([stringTypeAnnotation(), anyTypeAnnotation()]));
|
||||
}
|
||||
|
||||
return resolveCall(this.get("callee"));
|
||||
@@ -224,9 +248,9 @@ function resolveCall(callee) {
|
||||
if (callee.isFunction()) {
|
||||
if (callee.is("async")) {
|
||||
if (callee.is("generator")) {
|
||||
return t.genericTypeAnnotation(t.identifier("AsyncIterator"));
|
||||
return genericTypeAnnotation(identifier("AsyncIterator"));
|
||||
} else {
|
||||
return t.genericTypeAnnotation(t.identifier("Promise"));
|
||||
return genericTypeAnnotation(identifier("Promise"));
|
||||
}
|
||||
} else {
|
||||
if (callee.node.returnType) {
|
||||
|
||||
Generated
Vendored
+23
-11
@@ -24,10 +24,22 @@ exports.isConstantExpression = isConstantExpression;
|
||||
exports.isInStrictMode = isInStrictMode;
|
||||
exports.is = void 0;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
STATEMENT_OR_BLOCK_KEYS,
|
||||
VISITOR_KEYS,
|
||||
isBlockStatement,
|
||||
isExpression,
|
||||
isIdentifier,
|
||||
isLiteral,
|
||||
isStringLiteral,
|
||||
isType,
|
||||
matchesPattern: _matchesPattern
|
||||
} = _t;
|
||||
|
||||
function matchesPattern(pattern, allowPartial) {
|
||||
return t.matchesPattern(this.node, pattern, allowPartial);
|
||||
return _matchesPattern(this.node, pattern, allowPartial);
|
||||
}
|
||||
|
||||
function has(key) {
|
||||
@@ -56,7 +68,7 @@ function equals(key, value) {
|
||||
}
|
||||
|
||||
function isNodeType(type) {
|
||||
return t.isType(this.type, type);
|
||||
return isType(this.type, type);
|
||||
}
|
||||
|
||||
function canHaveVariableDeclarationOrExpression() {
|
||||
@@ -69,9 +81,9 @@ function canSwapBetweenExpressionAndStatement(replacement) {
|
||||
}
|
||||
|
||||
if (this.isExpression()) {
|
||||
return t.isBlockStatement(replacement);
|
||||
return isBlockStatement(replacement);
|
||||
} else if (this.isBlockStatement()) {
|
||||
return t.isExpression(replacement);
|
||||
return isExpression(replacement);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -99,16 +111,16 @@ function isCompletionRecord(allowInsideFunction) {
|
||||
}
|
||||
|
||||
function isStatementOrBlock() {
|
||||
if (this.parentPath.isLabeledStatement() || t.isBlockStatement(this.container)) {
|
||||
if (this.parentPath.isLabeledStatement() || isBlockStatement(this.container)) {
|
||||
return false;
|
||||
} else {
|
||||
return t.STATEMENT_OR_BLOCK_KEYS.includes(this.key);
|
||||
return STATEMENT_OR_BLOCK_KEYS.includes(this.key);
|
||||
}
|
||||
}
|
||||
|
||||
function referencesImport(moduleSource, importName) {
|
||||
if (!this.isReferencedIdentifier()) {
|
||||
if ((this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? t.isStringLiteral(this.node.property, {
|
||||
if ((this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? isStringLiteral(this.node.property, {
|
||||
value: importName
|
||||
}) : this.node.property.name === importName)) {
|
||||
const object = this.get("object");
|
||||
@@ -138,7 +150,7 @@ function referencesImport(moduleSource, importName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (path.isImportSpecifier() && t.isIdentifier(path.node.imported, {
|
||||
if (path.isImportSpecifier() && isIdentifier(path.node.imported, {
|
||||
name: importName
|
||||
})) {
|
||||
return true;
|
||||
@@ -266,7 +278,7 @@ function _guessExecutionStatusRelativeTo(target) {
|
||||
return divergence.target.key > divergence.this.key ? "before" : "after";
|
||||
}
|
||||
|
||||
const keys = t.VISITOR_KEYS[commonPath.type];
|
||||
const keys = VISITOR_KEYS[commonPath.type];
|
||||
const keyPosition = {
|
||||
this: keys.indexOf(divergence.this.parentKey),
|
||||
target: keys.indexOf(divergence.target.parentKey)
|
||||
@@ -339,7 +351,7 @@ function _resolve(dangerous, resolved) {
|
||||
return this.get("expression").resolve(dangerous, resolved);
|
||||
} else if (dangerous && this.isMemberExpression()) {
|
||||
const targetKey = this.toComputedKey();
|
||||
if (!t.isLiteral(targetKey)) return;
|
||||
if (!isLiteral(targetKey)) return;
|
||||
const targetName = targetKey.value;
|
||||
const target = this.get("object").resolve(dangerous, resolved);
|
||||
|
||||
|
||||
Generated
Vendored
+16
-6
@@ -5,11 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _t2 = _t;
|
||||
const {
|
||||
react
|
||||
} = _t;
|
||||
const {
|
||||
cloneNode,
|
||||
jsxExpressionContainer,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t2;
|
||||
const referenceVisitor = {
|
||||
ReferencedIdentifier(path, state) {
|
||||
if (path.isJSXIdentifier() && t.react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
|
||||
if (path.isJSXIdentifier() && react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -178,16 +188,16 @@ class PathHoister {
|
||||
if (!attachTo) return;
|
||||
if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;
|
||||
let uid = attachTo.scope.generateUidIdentifier("ref");
|
||||
const declarator = t.variableDeclarator(uid, this.path.node);
|
||||
const declarator = variableDeclarator(uid, this.path.node);
|
||||
const insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
|
||||
const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]);
|
||||
const [attached] = attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : variableDeclaration("var", [declarator])]);
|
||||
const parent = this.path.parentPath;
|
||||
|
||||
if (parent.isJSXElement() && this.path.container === parent.node.children) {
|
||||
uid = t.jsxExpressionContainer(uid);
|
||||
uid = jsxExpressionContainer(uid);
|
||||
}
|
||||
|
||||
this.path.replaceWith(t.cloneNode(uid));
|
||||
this.path.replaceWith(cloneNode(uid));
|
||||
return attachTo.isVariableDeclarator() ? attached.get("init") : attached.get("declarations.0.init");
|
||||
}
|
||||
|
||||
|
||||
Generated
Vendored
+44
-20
@@ -5,8 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.ForAwaitStatement = exports.NumericLiteralTypeAnnotation = exports.ExistentialTypeParam = exports.SpreadProperty = exports.RestProperty = exports.Flow = exports.Pure = exports.Generated = exports.User = exports.Var = exports.BlockScoped = exports.Referenced = exports.Scope = exports.Expression = exports.Statement = exports.BindingIdentifier = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = void 0;
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
isBinding,
|
||||
isBlockScoped,
|
||||
isExportDeclaration,
|
||||
isExpression,
|
||||
isFlow,
|
||||
isForStatement,
|
||||
isForXStatement,
|
||||
isIdentifier,
|
||||
isImportDeclaration,
|
||||
isImportSpecifier,
|
||||
isJSXIdentifier,
|
||||
isJSXMemberExpression,
|
||||
isMemberExpression,
|
||||
isReferenced,
|
||||
isScope,
|
||||
isStatement,
|
||||
isVar,
|
||||
isVariableDeclaration,
|
||||
react
|
||||
} = _t;
|
||||
const {
|
||||
isCompatTag
|
||||
} = react;
|
||||
const ReferencedIdentifier = {
|
||||
types: ["Identifier", "JSXIdentifier"],
|
||||
|
||||
@@ -16,15 +40,15 @@ const ReferencedIdentifier = {
|
||||
parent
|
||||
} = path;
|
||||
|
||||
if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
|
||||
if (t.isJSXIdentifier(node, opts)) {
|
||||
if (t.react.isCompatTag(node.name)) return false;
|
||||
if (!isIdentifier(node, opts) && !isJSXMemberExpression(parent, opts)) {
|
||||
if (isJSXIdentifier(node, opts)) {
|
||||
if (isCompatTag(node.name)) return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return t.isReferenced(node, parent, path.parentPath.parent);
|
||||
return isReferenced(node, parent, path.parentPath.parent);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -36,7 +60,7 @@ const ReferencedMemberExpression = {
|
||||
node,
|
||||
parent
|
||||
}) {
|
||||
return t.isMemberExpression(node) && t.isReferenced(node, parent);
|
||||
return isMemberExpression(node) && isReferenced(node, parent);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -50,7 +74,7 @@ const BindingIdentifier = {
|
||||
parent
|
||||
} = path;
|
||||
const grandparent = path.parentPath.parent;
|
||||
return t.isIdentifier(node) && t.isBinding(node, parent, grandparent);
|
||||
return isIdentifier(node) && isBinding(node, parent, grandparent);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -62,12 +86,12 @@ const Statement = {
|
||||
node,
|
||||
parent
|
||||
}) {
|
||||
if (t.isStatement(node)) {
|
||||
if (t.isVariableDeclaration(node)) {
|
||||
if (t.isForXStatement(parent, {
|
||||
if (isStatement(node)) {
|
||||
if (isVariableDeclaration(node)) {
|
||||
if (isForXStatement(parent, {
|
||||
left: node
|
||||
})) return false;
|
||||
if (t.isForStatement(parent, {
|
||||
if (isForStatement(parent, {
|
||||
init: node
|
||||
})) return false;
|
||||
}
|
||||
@@ -87,7 +111,7 @@ const Expression = {
|
||||
if (path.isIdentifier()) {
|
||||
return path.isReferencedIdentifier();
|
||||
} else {
|
||||
return t.isExpression(path.node);
|
||||
return isExpression(path.node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,21 +121,21 @@ const Scope = {
|
||||
types: ["Scopable", "Pattern"],
|
||||
|
||||
checkPath(path) {
|
||||
return t.isScope(path.node, path.parent);
|
||||
return isScope(path.node, path.parent);
|
||||
}
|
||||
|
||||
};
|
||||
exports.Scope = Scope;
|
||||
const Referenced = {
|
||||
checkPath(path) {
|
||||
return t.isReferenced(path.node, path.parent);
|
||||
return isReferenced(path.node, path.parent);
|
||||
}
|
||||
|
||||
};
|
||||
exports.Referenced = Referenced;
|
||||
const BlockScoped = {
|
||||
checkPath(path) {
|
||||
return t.isBlockScoped(path.node);
|
||||
return isBlockScoped(path.node);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -120,7 +144,7 @@ const Var = {
|
||||
types: ["VariableDeclaration"],
|
||||
|
||||
checkPath(path) {
|
||||
return t.isVar(path.node);
|
||||
return isVar(path.node);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -152,13 +176,13 @@ const Flow = {
|
||||
checkPath({
|
||||
node
|
||||
}) {
|
||||
if (t.isFlow(node)) {
|
||||
if (isFlow(node)) {
|
||||
return true;
|
||||
} else if (t.isImportDeclaration(node)) {
|
||||
} else if (isImportDeclaration(node)) {
|
||||
return node.importKind === "type" || node.importKind === "typeof";
|
||||
} else if (t.isExportDeclaration(node)) {
|
||||
} else if (isExportDeclaration(node)) {
|
||||
return node.exportKind === "type";
|
||||
} else if (t.isImportSpecifier(node)) {
|
||||
} else if (isImportSpecifier(node)) {
|
||||
return node.importKind === "type" || node.importKind === "typeof";
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Generated
Vendored
+19
-8
@@ -20,7 +20,18 @@ var _hoister = require("./lib/hoister");
|
||||
|
||||
var _index = require("./index");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
arrowFunctionExpression,
|
||||
assertExpression,
|
||||
assignmentExpression,
|
||||
blockStatement,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
expressionStatement,
|
||||
isExpression
|
||||
} = _t;
|
||||
|
||||
function insertBefore(nodes_) {
|
||||
this._assertUnremoved();
|
||||
@@ -41,7 +52,7 @@ function insertBefore(nodes_) {
|
||||
} else if (this.isStatementOrBlock()) {
|
||||
const node = this.node;
|
||||
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
||||
this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [node] : []));
|
||||
this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
|
||||
return this.unshiftContainer("body", nodes);
|
||||
} else {
|
||||
throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
|
||||
@@ -96,7 +107,7 @@ function insertAfter(nodes_) {
|
||||
|
||||
if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) {
|
||||
return parentPath.insertAfter(nodes.map(node => {
|
||||
return t.isExpression(node) ? t.expressionStatement(node) : node;
|
||||
return isExpression(node) ? expressionStatement(node) : node;
|
||||
}));
|
||||
} else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") {
|
||||
if (this.node) {
|
||||
@@ -106,8 +117,8 @@ function insertAfter(nodes_) {
|
||||
} = this;
|
||||
|
||||
if (scope.path.isPattern()) {
|
||||
t.assertExpression(node);
|
||||
this.replaceWith(t.callExpression(t.arrowFunctionExpression([], node), []));
|
||||
assertExpression(node);
|
||||
this.replaceWith(callExpression(arrowFunctionExpression([], node), []));
|
||||
this.get("callee.body").insertAfter(nodes);
|
||||
return [this];
|
||||
}
|
||||
@@ -120,8 +131,8 @@ function insertAfter(nodes_) {
|
||||
}
|
||||
|
||||
const temp = scope.generateDeclaredUidIdentifier();
|
||||
nodes.unshift(t.expressionStatement(t.assignmentExpression("=", t.cloneNode(temp), node)));
|
||||
nodes.push(t.expressionStatement(t.cloneNode(temp)));
|
||||
nodes.unshift(expressionStatement(assignmentExpression("=", cloneNode(temp), node)));
|
||||
nodes.push(expressionStatement(cloneNode(temp)));
|
||||
}
|
||||
|
||||
return this.replaceExpressionWithStatements(nodes);
|
||||
@@ -130,7 +141,7 @@ function insertAfter(nodes_) {
|
||||
} else if (this.isStatementOrBlock()) {
|
||||
const node = this.node;
|
||||
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
||||
this.replaceWith(t.blockStatement(shouldInsertCurrentNode ? [node] : []));
|
||||
this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
|
||||
return this.pushContainer("body", nodes);
|
||||
} else {
|
||||
throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
|
||||
|
||||
Generated
Vendored
+47
-24
@@ -20,17 +20,40 @@ var _cache = require("../cache");
|
||||
|
||||
var _parser = require("@babel/parser");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _helperHoistVariables = require("@babel/helper-hoist-variables");
|
||||
|
||||
const {
|
||||
FUNCTION_TYPES,
|
||||
arrowFunctionExpression,
|
||||
assignmentExpression,
|
||||
awaitExpression,
|
||||
blockStatement,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
expressionStatement,
|
||||
identifier,
|
||||
inheritLeadingComments,
|
||||
inheritTrailingComments,
|
||||
inheritsComments,
|
||||
isExpression,
|
||||
isProgram,
|
||||
isStatement,
|
||||
removeComments,
|
||||
returnStatement,
|
||||
toSequenceExpression,
|
||||
validate,
|
||||
yieldExpression
|
||||
} = _t;
|
||||
|
||||
function replaceWithMultiple(nodes) {
|
||||
var _pathCache$get;
|
||||
|
||||
this.resync();
|
||||
nodes = this._verifyNodeList(nodes);
|
||||
t.inheritLeadingComments(nodes[0], this.node);
|
||||
t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
|
||||
inheritLeadingComments(nodes[0], this.node);
|
||||
inheritTrailingComments(nodes[nodes.length - 1], this.node);
|
||||
(_pathCache$get = _cache.path.get(this.parent)) == null ? void 0 : _pathCache$get.delete(this.node);
|
||||
this.node = this.container[this.key] = null;
|
||||
const paths = this.insertAfter(nodes);
|
||||
@@ -92,7 +115,7 @@ function replaceWith(replacement) {
|
||||
return [this];
|
||||
}
|
||||
|
||||
if (this.isProgram() && !t.isProgram(replacement)) {
|
||||
if (this.isProgram() && !isProgram(replacement)) {
|
||||
throw new Error("You can only replace a Program root node with another Program node");
|
||||
}
|
||||
|
||||
@@ -106,14 +129,14 @@ function replaceWith(replacement) {
|
||||
|
||||
let nodePath = "";
|
||||
|
||||
if (this.isNodeType("Statement") && t.isExpression(replacement)) {
|
||||
if (this.isNodeType("Statement") && isExpression(replacement)) {
|
||||
if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) {
|
||||
replacement = t.expressionStatement(replacement);
|
||||
replacement = expressionStatement(replacement);
|
||||
nodePath = "expression";
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isNodeType("Expression") && t.isStatement(replacement)) {
|
||||
if (this.isNodeType("Expression") && isStatement(replacement)) {
|
||||
if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
|
||||
return this.replaceExpressionWithStatements([replacement]);
|
||||
}
|
||||
@@ -122,8 +145,8 @@ function replaceWith(replacement) {
|
||||
const oldNode = this.node;
|
||||
|
||||
if (oldNode) {
|
||||
t.inheritsComments(replacement, oldNode);
|
||||
t.removeComments(oldNode);
|
||||
inheritsComments(replacement, oldNode);
|
||||
removeComments(oldNode);
|
||||
}
|
||||
|
||||
this._replaceWith(replacement);
|
||||
@@ -142,9 +165,9 @@ function _replaceWith(node) {
|
||||
}
|
||||
|
||||
if (this.inList) {
|
||||
t.validate(this.parent, this.key, [node]);
|
||||
validate(this.parent, this.key, [node]);
|
||||
} else {
|
||||
t.validate(this.parent, this.key, node);
|
||||
validate(this.parent, this.key, node);
|
||||
}
|
||||
|
||||
this.debug(`Replace with ${node == null ? void 0 : node.type}`);
|
||||
@@ -154,17 +177,17 @@ function _replaceWith(node) {
|
||||
|
||||
function replaceExpressionWithStatements(nodes) {
|
||||
this.resync();
|
||||
const toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
|
||||
const nodesAsSequenceExpression = toSequenceExpression(nodes, this.scope);
|
||||
|
||||
if (toSequenceExpression) {
|
||||
return this.replaceWith(toSequenceExpression)[0].get("expressions");
|
||||
if (nodesAsSequenceExpression) {
|
||||
return this.replaceWith(nodesAsSequenceExpression)[0].get("expressions");
|
||||
}
|
||||
|
||||
const functionParent = this.getFunctionParent();
|
||||
const isParentAsync = functionParent == null ? void 0 : functionParent.is("async");
|
||||
const isParentGenerator = functionParent == null ? void 0 : functionParent.is("generator");
|
||||
const container = t.arrowFunctionExpression([], t.blockStatement(nodes));
|
||||
this.replaceWith(t.callExpression(container, []));
|
||||
const container = arrowFunctionExpression([], blockStatement(nodes));
|
||||
this.replaceWith(callExpression(container, []));
|
||||
const callee = this.get("callee");
|
||||
(0, _helperHoistVariables.default)(callee.get("body"), id => {
|
||||
this.scope.push({
|
||||
@@ -182,36 +205,36 @@ function replaceExpressionWithStatements(nodes) {
|
||||
|
||||
if (!uid) {
|
||||
uid = callee.scope.generateDeclaredUidIdentifier("ret");
|
||||
callee.get("body").pushContainer("body", t.returnStatement(t.cloneNode(uid)));
|
||||
callee.get("body").pushContainer("body", returnStatement(cloneNode(uid)));
|
||||
loop.setData("expressionReplacementReturnUid", uid);
|
||||
} else {
|
||||
uid = t.identifier(uid.name);
|
||||
uid = identifier(uid.name);
|
||||
}
|
||||
|
||||
path.get("expression").replaceWith(t.assignmentExpression("=", t.cloneNode(uid), path.node.expression));
|
||||
path.get("expression").replaceWith(assignmentExpression("=", cloneNode(uid), path.node.expression));
|
||||
} else {
|
||||
path.replaceWith(t.returnStatement(path.node.expression));
|
||||
path.replaceWith(returnStatement(path.node.expression));
|
||||
}
|
||||
}
|
||||
|
||||
callee.arrowFunctionToExpression();
|
||||
const newCallee = callee;
|
||||
|
||||
const needToAwaitFunction = isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", t.FUNCTION_TYPES);
|
||||
const needToAwaitFunction = isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", FUNCTION_TYPES);
|
||||
|
||||
const needToYieldFunction = isParentGenerator && _index.default.hasType(this.get("callee.body").node, "YieldExpression", t.FUNCTION_TYPES);
|
||||
const needToYieldFunction = isParentGenerator && _index.default.hasType(this.get("callee.body").node, "YieldExpression", FUNCTION_TYPES);
|
||||
|
||||
if (needToAwaitFunction) {
|
||||
newCallee.set("async", true);
|
||||
|
||||
if (!needToYieldFunction) {
|
||||
this.replaceWith(t.awaitExpression(this.node));
|
||||
this.replaceWith(awaitExpression(this.node));
|
||||
}
|
||||
}
|
||||
|
||||
if (needToYieldFunction) {
|
||||
newCallee.set("generator", true);
|
||||
this.replaceWith(t.yieldExpression(this.node, true));
|
||||
this.replaceWith(yieldExpression(this.node, true));
|
||||
}
|
||||
|
||||
return newCallee.get("body.body");
|
||||
|
||||
+97
-51
@@ -13,24 +13,63 @@ var _binding = require("./binding");
|
||||
|
||||
var _globals = require("globals");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
var _cache = require("../cache");
|
||||
|
||||
const {
|
||||
NOT_LOCAL_BINDING,
|
||||
callExpression,
|
||||
cloneNode,
|
||||
getBindingIdentifiers,
|
||||
identifier,
|
||||
isArrayExpression,
|
||||
isBinary,
|
||||
isClass,
|
||||
isClassBody,
|
||||
isClassDeclaration,
|
||||
isExportAllDeclaration,
|
||||
isExportDefaultDeclaration,
|
||||
isExportNamedDeclaration,
|
||||
isFunctionDeclaration,
|
||||
isIdentifier,
|
||||
isImportDeclaration,
|
||||
isLiteral,
|
||||
isMethod,
|
||||
isModuleDeclaration,
|
||||
isModuleSpecifier,
|
||||
isObjectExpression,
|
||||
isProperty,
|
||||
isPureish,
|
||||
isSuper,
|
||||
isTaggedTemplateExpression,
|
||||
isTemplateLiteral,
|
||||
isThisExpression,
|
||||
isUnaryExpression,
|
||||
isVariableDeclaration,
|
||||
matchesPattern,
|
||||
memberExpression,
|
||||
numericLiteral,
|
||||
toIdentifier,
|
||||
unaryExpression,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
|
||||
function gatherNodeParts(node, parts) {
|
||||
switch (node == null ? void 0 : node.type) {
|
||||
default:
|
||||
if (t.isModuleDeclaration(node)) {
|
||||
if ((t.isExportAllDeclaration(node) || t.isExportNamedDeclaration(node) || t.isImportDeclaration(node)) && node.source) {
|
||||
if (isModuleDeclaration(node)) {
|
||||
if ((isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source) {
|
||||
gatherNodeParts(node.source, parts);
|
||||
} else if ((t.isExportNamedDeclaration(node) || t.isImportDeclaration(node)) && node.specifiers && node.specifiers.length) {
|
||||
} else if ((isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.specifiers && node.specifiers.length) {
|
||||
for (const e of node.specifiers) gatherNodeParts(e, parts);
|
||||
} else if ((t.isExportDefaultDeclaration(node) || t.isExportNamedDeclaration(node)) && node.declaration) {
|
||||
} else if ((isExportDefaultDeclaration(node) || isExportNamedDeclaration(node)) && node.declaration) {
|
||||
gatherNodeParts(node.declaration, parts);
|
||||
}
|
||||
} else if (t.isModuleSpecifier(node)) {
|
||||
} else if (isModuleSpecifier(node)) {
|
||||
gatherNodeParts(node.local, parts);
|
||||
} else if (t.isLiteral(node)) {
|
||||
} else if (isLiteral(node)) {
|
||||
parts.push(node.value);
|
||||
}
|
||||
|
||||
@@ -159,14 +198,15 @@ function gatherNodeParts(node, parts) {
|
||||
}
|
||||
|
||||
const collectorVisitor = {
|
||||
For(path) {
|
||||
for (const key of t.FOR_INIT_KEYS) {
|
||||
const declar = path.get(key);
|
||||
ForStatement(path) {
|
||||
const declar = path.get("init");
|
||||
|
||||
if (declar.isVar()) {
|
||||
const parentScope = path.scope.getFunctionParent() || path.scope.getProgramParent();
|
||||
parentScope.registerBinding("var", declar);
|
||||
}
|
||||
if (declar.isVar()) {
|
||||
const {
|
||||
scope
|
||||
} = path;
|
||||
const parentScope = scope.getFunctionParent() || scope.getProgramParent();
|
||||
parentScope.registerBinding("var", declar);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -192,6 +232,12 @@ const collectorVisitor = {
|
||||
|
||||
if (left.isPattern() || left.isIdentifier()) {
|
||||
state.constantViolations.push(path);
|
||||
} else if (left.isVar()) {
|
||||
const {
|
||||
scope
|
||||
} = path;
|
||||
const parentScope = scope.getFunctionParent() || scope.getProgramParent();
|
||||
parentScope.registerBinding("var", left);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -201,19 +247,19 @@ const collectorVisitor = {
|
||||
node,
|
||||
scope
|
||||
} = path;
|
||||
if (t.isExportAllDeclaration(node)) return;
|
||||
if (isExportAllDeclaration(node)) return;
|
||||
const declar = node.declaration;
|
||||
|
||||
if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
|
||||
if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) {
|
||||
const id = declar.id;
|
||||
if (!id) return;
|
||||
const binding = scope.getBinding(id.name);
|
||||
if (binding) binding.reference(path);
|
||||
} else if (t.isVariableDeclaration(declar)) {
|
||||
binding == null ? void 0 : binding.reference(path);
|
||||
} else if (isVariableDeclaration(declar)) {
|
||||
for (const decl of declar.declarations) {
|
||||
for (const name of Object.keys(t.getBindingIdentifiers(decl))) {
|
||||
for (const name of Object.keys(getBindingIdentifiers(decl))) {
|
||||
const binding = scope.getBinding(name);
|
||||
if (binding) binding.reference(path);
|
||||
binding == null ? void 0 : binding.reference(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +303,7 @@ const collectorVisitor = {
|
||||
},
|
||||
|
||||
Function(path) {
|
||||
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) {
|
||||
if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
|
||||
path.scope.registerBinding("local", path.get("id"), path);
|
||||
}
|
||||
|
||||
@@ -269,7 +315,7 @@ const collectorVisitor = {
|
||||
},
|
||||
|
||||
ClassExpression(path) {
|
||||
if (path.has("id") && !path.get("id").node[t.NOT_LOCAL_BINDING]) {
|
||||
if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) {
|
||||
path.scope.registerBinding("local", path);
|
||||
}
|
||||
}
|
||||
@@ -342,15 +388,15 @@ class Scope {
|
||||
this.push({
|
||||
id
|
||||
});
|
||||
return t.cloneNode(id);
|
||||
return cloneNode(id);
|
||||
}
|
||||
|
||||
generateUidIdentifier(name) {
|
||||
return t.identifier(this.generateUid(name));
|
||||
return identifier(this.generateUid(name));
|
||||
}
|
||||
|
||||
generateUid(name = "temp") {
|
||||
name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
|
||||
name = toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
|
||||
let uid;
|
||||
let i = 1;
|
||||
|
||||
@@ -380,15 +426,15 @@ class Scope {
|
||||
}
|
||||
|
||||
generateUidIdentifierBasedOnNode(node, defaultName) {
|
||||
return t.identifier(this.generateUidBasedOnNode(node, defaultName));
|
||||
return identifier(this.generateUidBasedOnNode(node, defaultName));
|
||||
}
|
||||
|
||||
isStatic(node) {
|
||||
if (t.isThisExpression(node) || t.isSuper(node)) {
|
||||
if (isThisExpression(node) || isSuper(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t.isIdentifier(node)) {
|
||||
if (isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
|
||||
if (binding) {
|
||||
@@ -411,7 +457,7 @@ class Scope {
|
||||
this.push({
|
||||
id
|
||||
});
|
||||
return t.cloneNode(id);
|
||||
return cloneNode(id);
|
||||
}
|
||||
|
||||
return id;
|
||||
@@ -467,7 +513,7 @@ class Scope {
|
||||
}
|
||||
|
||||
toArray(node, i, arrayLikeIsIterable) {
|
||||
if (t.isIdentifier(node)) {
|
||||
if (isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
|
||||
if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
|
||||
@@ -475,14 +521,14 @@ class Scope {
|
||||
}
|
||||
}
|
||||
|
||||
if (t.isArrayExpression(node)) {
|
||||
if (isArrayExpression(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (t.isIdentifier(node, {
|
||||
if (isIdentifier(node, {
|
||||
name: "arguments"
|
||||
})) {
|
||||
return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]);
|
||||
return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);
|
||||
}
|
||||
|
||||
let helperName;
|
||||
@@ -491,7 +537,7 @@ class Scope {
|
||||
if (i === true) {
|
||||
helperName = "toConsumableArray";
|
||||
} else if (i) {
|
||||
args.push(t.numericLiteral(i));
|
||||
args.push(numericLiteral(i));
|
||||
helperName = "slicedToArray";
|
||||
} else {
|
||||
helperName = "toArray";
|
||||
@@ -502,7 +548,7 @@ class Scope {
|
||||
helperName = "maybeArrayLike";
|
||||
}
|
||||
|
||||
return t.callExpression(this.hub.addHelper(helperName), args);
|
||||
return callExpression(this.hub.addHelper(helperName), args);
|
||||
}
|
||||
|
||||
hasLabel(name) {
|
||||
@@ -548,7 +594,7 @@ class Scope {
|
||||
}
|
||||
|
||||
buildUndefinedNode() {
|
||||
return t.unaryExpression("void", t.numericLiteral(0), true);
|
||||
return unaryExpression("void", numericLiteral(0), true);
|
||||
}
|
||||
|
||||
registerConstantViolation(path) {
|
||||
@@ -630,56 +676,56 @@ class Scope {
|
||||
}
|
||||
|
||||
isPure(node, constantsOnly) {
|
||||
if (t.isIdentifier(node)) {
|
||||
if (isIdentifier(node)) {
|
||||
const binding = this.getBinding(node.name);
|
||||
if (!binding) return false;
|
||||
if (constantsOnly) return binding.constant;
|
||||
return true;
|
||||
} else if (t.isClass(node)) {
|
||||
} else if (isClass(node)) {
|
||||
if (node.superClass && !this.isPure(node.superClass, constantsOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.isPure(node.body, constantsOnly);
|
||||
} else if (t.isClassBody(node)) {
|
||||
} else if (isClassBody(node)) {
|
||||
for (const method of node.body) {
|
||||
if (!this.isPure(method, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (t.isBinary(node)) {
|
||||
} else if (isBinary(node)) {
|
||||
return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
|
||||
} else if (t.isArrayExpression(node)) {
|
||||
} else if (isArrayExpression(node)) {
|
||||
for (const elem of node.elements) {
|
||||
if (!this.isPure(elem, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (t.isObjectExpression(node)) {
|
||||
} else if (isObjectExpression(node)) {
|
||||
for (const prop of node.properties) {
|
||||
if (!this.isPure(prop, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (t.isMethod(node)) {
|
||||
} else if (isMethod(node)) {
|
||||
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
|
||||
if (node.kind === "get" || node.kind === "set") return false;
|
||||
return true;
|
||||
} else if (t.isProperty(node)) {
|
||||
} else if (isProperty(node)) {
|
||||
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
|
||||
return this.isPure(node.value, constantsOnly);
|
||||
} else if (t.isUnaryExpression(node)) {
|
||||
} else if (isUnaryExpression(node)) {
|
||||
return this.isPure(node.argument, constantsOnly);
|
||||
} else if (t.isTaggedTemplateExpression(node)) {
|
||||
return t.matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
|
||||
} else if (t.isTemplateLiteral(node)) {
|
||||
} else if (isTaggedTemplateExpression(node)) {
|
||||
return matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly);
|
||||
} else if (isTemplateLiteral(node)) {
|
||||
for (const expression of node.expressions) {
|
||||
if (!this.isPure(expression, constantsOnly)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return t.isPureish(node);
|
||||
return isPureish(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,13 +840,13 @@ class Scope {
|
||||
let declarPath = !unique && path.getData(dataKey);
|
||||
|
||||
if (!declarPath) {
|
||||
const declar = t.variableDeclaration(kind, []);
|
||||
const declar = variableDeclaration(kind, []);
|
||||
declar._blockHoist = blockHoist;
|
||||
[declarPath] = path.unshiftContainer("body", [declar]);
|
||||
if (!unique) path.setData(dataKey, declarPath);
|
||||
}
|
||||
|
||||
const declarator = t.variableDeclarator(opts.id, opts.init);
|
||||
const declarator = variableDeclarator(opts.id, opts.init);
|
||||
declarPath.node.declarations.push(declarator);
|
||||
this.registerBinding(kind, declarPath.get("declarations").pop());
|
||||
}
|
||||
|
||||
Generated
Vendored
+15
-7
@@ -9,8 +9,16 @@ var _binding = require("../binding");
|
||||
|
||||
var _helperSplitExportDeclaration = require("@babel/helper-split-export-declaration");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
VISITOR_KEYS,
|
||||
assignmentExpression,
|
||||
identifier,
|
||||
toExpression,
|
||||
variableDeclaration,
|
||||
variableDeclarator
|
||||
} = _t;
|
||||
const renameVisitor = {
|
||||
ReferencedIdentifier({
|
||||
node
|
||||
@@ -62,20 +70,20 @@ class Renamer {
|
||||
return;
|
||||
if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;
|
||||
if (this.binding.kind !== "hoisted") return;
|
||||
path.node.id = t.identifier(this.oldName);
|
||||
path.node.id = identifier(this.oldName);
|
||||
path.node._blockHoist = 3;
|
||||
path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node))]));
|
||||
path.replaceWith(variableDeclaration("let", [variableDeclarator(identifier(this.newName), toExpression(path.node))]));
|
||||
}
|
||||
|
||||
maybeConvertFromClassFunctionExpression(path) {
|
||||
return;
|
||||
if (!path.isFunctionExpression() && !path.isClassExpression()) return;
|
||||
if (this.binding.kind !== "local") return;
|
||||
path.node.id = t.identifier(this.oldName);
|
||||
path.node.id = identifier(this.oldName);
|
||||
this.binding.scope.parent.push({
|
||||
id: t.identifier(this.newName)
|
||||
id: identifier(this.newName)
|
||||
});
|
||||
path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node));
|
||||
path.replaceWith(assignmentExpression("=", identifier(this.newName), path.node));
|
||||
}
|
||||
|
||||
rename(block) {
|
||||
@@ -130,7 +138,7 @@ function skipAllButComputedMethodKey(path) {
|
||||
return;
|
||||
}
|
||||
|
||||
const keys = t.VISITOR_KEYS[path.type];
|
||||
const keys = VISITOR_KEYS[path.type];
|
||||
|
||||
for (const key of keys) {
|
||||
if (key !== "key") path.skipKey(key);
|
||||
|
||||
-2
@@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var t = require("@babel/types");
|
||||
|
||||
var _index = require("./index");
|
||||
|
||||
var _virtualTypes = require("./path/generated/virtual-types");
|
||||
+10
-4
@@ -9,7 +9,13 @@ exports.merge = merge;
|
||||
|
||||
var virtualTypes = require("./path/lib/virtual-types");
|
||||
|
||||
var t = require("@babel/types");
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
DEPRECATED_KEYS,
|
||||
FLIPPED_ALIAS_KEYS,
|
||||
TYPES
|
||||
} = _t;
|
||||
|
||||
function explode(visitor) {
|
||||
if (visitor._exploded) return visitor;
|
||||
@@ -60,8 +66,8 @@ function explode(visitor) {
|
||||
for (const nodeType of Object.keys(visitor)) {
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
const fns = visitor[nodeType];
|
||||
let aliases = t.FLIPPED_ALIAS_KEYS[nodeType];
|
||||
const deprecatedKey = t.DEPRECATED_KEYS[nodeType];
|
||||
let aliases = FLIPPED_ALIAS_KEYS[nodeType];
|
||||
const deprecatedKey = DEPRECATED_KEYS[nodeType];
|
||||
|
||||
if (deprecatedKey) {
|
||||
console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecatedKey}`);
|
||||
@@ -104,7 +110,7 @@ function verify(visitor) {
|
||||
|
||||
if (shouldIgnoreKey(nodeType)) continue;
|
||||
|
||||
if (t.TYPES.indexOf(nodeType) < 0) {
|
||||
if (TYPES.indexOf(nodeType) < 0) {
|
||||
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type`);
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/traverse",
|
||||
"version": "7.15.0",
|
||||
"version": "7.15.4",
|
||||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-traverse",
|
||||
@@ -17,12 +17,12 @@
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.14.5",
|
||||
"@babel/generator": "^7.15.0",
|
||||
"@babel/helper-function-name": "^7.14.5",
|
||||
"@babel/helper-hoist-variables": "^7.14.5",
|
||||
"@babel/helper-split-export-declaration": "^7.14.5",
|
||||
"@babel/parser": "^7.15.0",
|
||||
"@babel/types": "^7.15.0",
|
||||
"@babel/generator": "^7.15.4",
|
||||
"@babel/helper-function-name": "^7.15.4",
|
||||
"@babel/helper-hoist-variables": "^7.15.4",
|
||||
"@babel/helper-split-export-declaration": "^7.15.4",
|
||||
"@babel/parser": "^7.15.4",
|
||||
"@babel/types": "^7.15.4",
|
||||
"debug": "^4.1.0",
|
||||
"globals": "^11.1.0"
|
||||
},
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -13,7 +13,7 @@ function addComments(node, type, comments) {
|
||||
if (type === "leading") {
|
||||
node[key] = comments.concat(node[key]);
|
||||
} else {
|
||||
node[key] = node[key].concat(comments);
|
||||
node[key].push(...comments);
|
||||
}
|
||||
} else {
|
||||
node[key] = comments;
|
||||
|
||||
+1
-1
@@ -678,7 +678,7 @@ exports.patternLikeCommon = patternLikeCommon;
|
||||
deprecatedAlias: "RestProperty",
|
||||
fields: Object.assign({}, patternLikeCommon, {
|
||||
argument: {
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "Pattern", "MemberExpression")
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression")
|
||||
},
|
||||
optional: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
|
||||
Generated
Vendored
+3
-3
@@ -14,7 +14,7 @@ function getQualifiedName(node) {
|
||||
function removeTypeDuplicates(nodes) {
|
||||
const generics = {};
|
||||
const bases = {};
|
||||
const typeGroups = [];
|
||||
const typeGroups = new Set();
|
||||
const types = [];
|
||||
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
@@ -35,9 +35,9 @@ function removeTypeDuplicates(nodes) {
|
||||
}
|
||||
|
||||
if ((0, _generated.isUnionTypeAnnotation)(node)) {
|
||||
if (typeGroups.indexOf(node.types) < 0) {
|
||||
if (!typeGroups.has(node.types)) {
|
||||
nodes = nodes.concat(node.types);
|
||||
typeGroups.push(node.types);
|
||||
typeGroups.add(node.types);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
Generated
Vendored
+4
-4
@@ -10,7 +10,7 @@ var _generated = require("../../validators/generated");
|
||||
function removeTypeDuplicates(nodes) {
|
||||
const generics = {};
|
||||
const bases = {};
|
||||
const typeGroups = [];
|
||||
const typeGroups = new Set();
|
||||
const types = [];
|
||||
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
@@ -31,9 +31,9 @@ function removeTypeDuplicates(nodes) {
|
||||
}
|
||||
|
||||
if ((0, _generated.isTSUnionType)(node)) {
|
||||
if (typeGroups.indexOf(node.types) < 0) {
|
||||
nodes = nodes.concat(node.types);
|
||||
typeGroups.push(node.types);
|
||||
if (!typeGroups.has(node.types)) {
|
||||
nodes.push(...node.types);
|
||||
typeGroups.add(node.types);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
Generated
Vendored
+1
@@ -88,6 +88,7 @@ getBindingIdentifiers.keys = {
|
||||
ArrowFunctionExpression: ["params"],
|
||||
ObjectMethod: ["params"],
|
||||
ClassMethod: ["params"],
|
||||
ClassPrivateMethod: ["params"],
|
||||
ForInStatement: ["left"],
|
||||
ForOfStatement: ["left"],
|
||||
ClassDeclaration: ["id"],
|
||||
|
||||
Generated
Vendored
+21
-10
@@ -8,7 +8,6 @@ exports.default = isReferenced;
|
||||
function isReferenced(node, parent, grandparent) {
|
||||
switch (parent.type) {
|
||||
case "MemberExpression":
|
||||
case "JSXMemberExpression":
|
||||
case "OptionalMemberExpression":
|
||||
if (parent.property === node) {
|
||||
return !!parent.computed;
|
||||
@@ -16,6 +15,9 @@ function isReferenced(node, parent, grandparent) {
|
||||
|
||||
return parent.object === node;
|
||||
|
||||
case "JSXMemberExpression":
|
||||
return parent.object === node;
|
||||
|
||||
case "VariableDeclarator":
|
||||
return parent.init === node;
|
||||
|
||||
@@ -28,23 +30,29 @@ function isReferenced(node, parent, grandparent) {
|
||||
case "ClassMethod":
|
||||
case "ClassPrivateMethod":
|
||||
case "ObjectMethod":
|
||||
if (parent.params.includes(node)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
case "ObjectProperty":
|
||||
case "ClassProperty":
|
||||
case "ClassPrivateProperty":
|
||||
if (parent.key === node) {
|
||||
return !!parent.computed;
|
||||
}
|
||||
|
||||
if (parent.value === node) {
|
||||
return !grandparent || grandparent.type !== "ObjectPattern";
|
||||
return false;
|
||||
|
||||
case "ObjectProperty":
|
||||
if (parent.key === node) {
|
||||
return !!parent.computed;
|
||||
}
|
||||
|
||||
return !grandparent || grandparent.type !== "ObjectPattern";
|
||||
|
||||
case "ClassProperty":
|
||||
if (parent.key === node) {
|
||||
return !!parent.computed;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case "ClassPrivateProperty":
|
||||
return parent.key !== node;
|
||||
|
||||
case "ClassDeclaration":
|
||||
case "ClassExpression":
|
||||
return parent.superClass === node;
|
||||
@@ -88,6 +96,9 @@ function isReferenced(node, parent, grandparent) {
|
||||
case "ImportSpecifier":
|
||||
return false;
|
||||
|
||||
case "ImportAttribute":
|
||||
return false;
|
||||
|
||||
case "JSXAttribute":
|
||||
return false;
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/types",
|
||||
"version": "7.15.0",
|
||||
"version": "7.15.6",
|
||||
"description": "Babel Types is a Lodash-esque utility library for AST nodes",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-types",
|
||||
@@ -28,8 +28,8 @@
|
||||
"to-fast-properties": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/generator": "7.15.0",
|
||||
"@babel/parser": "7.15.0",
|
||||
"@babel/generator": "7.15.4",
|
||||
"@babel/parser": "7.15.6",
|
||||
"chalk": "^4.1.0",
|
||||
"glob": "^7.1.7"
|
||||
},
|
||||
|
||||
+2
-641
@@ -62,644 +62,5 @@ Browserslist will take queries from tool option,
|
||||
[Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
|
||||
[obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Tools](#tools)
|
||||
* [Text Editors](#text-editors)
|
||||
* [Best Practices](#best-practices)
|
||||
* [Browsers Data Updating](#browsers-data-updating)
|
||||
* [Queries](#queries)
|
||||
* [Query Composition](#query-composition)
|
||||
* [Full List](#full-list)
|
||||
* [Debug](#debug)
|
||||
* [Browsers](#browsers)
|
||||
* [Config File](#config-file)
|
||||
* [`package.json`](#packagejson)
|
||||
* [`.browserslistrc`](#browserslistrc)
|
||||
* [Shareable Configs](#shareable-configs)
|
||||
* [Configuring for Different Environments](#configuring-for-different-environments)
|
||||
* [Custom Usage Data](#custom-usage-data)
|
||||
* [JS API](#js-api)
|
||||
* [Environment Variables](#environment-variables)
|
||||
* [Cache](#cache)
|
||||
* [Security Contact](#security-contact)
|
||||
* [For Enterprise](#for-enterprise)
|
||||
|
||||
## Tools
|
||||
|
||||
* [`browserl.ist`](https://browserl.ist/) is an online tool to check
|
||||
what browsers will be selected by some query.
|
||||
* [`browserslist-ga`] and [`browserslist-ga-export`] download your website
|
||||
browsers statistics to use it in `> 0.5% in my stats` query.
|
||||
* [`browserslist-useragent-regexp`] compiles Browserslist query to a RegExp
|
||||
to test browser useragent.
|
||||
* [`browserslist-useragent-ruby`] is a Ruby library to checks browser
|
||||
by user agent string to match Browserslist.
|
||||
* [`browserslist-browserstack`] runs BrowserStack tests for all browsers
|
||||
in Browserslist config.
|
||||
* [`browserslist-adobe-analytics`] use Adobe Analytics data to target browsers.
|
||||
* [`caniuse-api`] returns browsers which support some specific feature.
|
||||
* Run `npx browserslist` in your project directory to see project’s
|
||||
target browsers. This CLI tool is built-in and available in any project
|
||||
with Autoprefixer.
|
||||
|
||||
[`browserslist-useragent-regexp`]: https://github.com/browserslist/browserslist-useragent-regexp
|
||||
[`browserslist-adobe-analytics`]: https://github.com/xeroxinteractive/browserslist-adobe-analytics
|
||||
[`browserslist-useragent-ruby`]: https://github.com/browserslist/browserslist-useragent-ruby
|
||||
[`browserslist-browserstack`]: https://github.com/xeroxinteractive/browserslist-browserstack
|
||||
[`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
|
||||
[`browserslist-useragent`]: https://github.com/pastelsky/browserslist-useragent
|
||||
[`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
|
||||
[`caniuse-api`]: https://github.com/Nyalab/caniuse-api
|
||||
|
||||
|
||||
### Text Editors
|
||||
|
||||
These extensions will add syntax highlighting for `.browserslistrc` files.
|
||||
|
||||
* [VS Code](https://marketplace.visualstudio.com/items?itemName=webben.browserslist)
|
||||
* [Vim](https://github.com/browserslist/vim-browserslist)
|
||||
|
||||
## Best Practices
|
||||
|
||||
* There is a `defaults` query, which gives a reasonable configuration
|
||||
for most users:
|
||||
|
||||
```json
|
||||
"browserslist": [
|
||||
"defaults"
|
||||
]
|
||||
```
|
||||
|
||||
* If you want to change the default set of browsers, we recommend combining
|
||||
`last 2 versions`, `not dead` with a usage number like `> 0.2%`. This is
|
||||
because `last n versions` on its own does not add popular old versions, while
|
||||
only using a percentage above `0.2%` will in the long run make popular
|
||||
browsers even more popular. We might run into a monopoly and stagnation
|
||||
situation, as we had with Internet Explorer 6. Please use this setting
|
||||
with caution.
|
||||
* Select browsers directly (`last 2 Chrome versions`) only if you are making
|
||||
a web app for a kiosk with one browser. There are a lot of browsers
|
||||
on the market. If you are making general web app you should respect
|
||||
browsers diversity.
|
||||
* Don’t remove browsers just because you don’t know them. Opera Mini has
|
||||
100 million users in Africa and it is more popular in the global market
|
||||
than Microsoft Edge. Chinese QQ Browsers has more market share than Firefox
|
||||
and desktop Safari combined.
|
||||
|
||||
|
||||
## Browsers Data Updating
|
||||
|
||||
`npx browserslist@latest --update-db` updates `caniuse-lite` version
|
||||
in your npm, yarn or pnpm lock file.
|
||||
|
||||
You need to do it regularly for two reasons:
|
||||
|
||||
1. To use the latest browser’s versions and statistics in queries like
|
||||
`last 2 versions` or `>1%`. For example, if you created your project
|
||||
2 years ago and did not update your dependencies, `last 1 version`
|
||||
will return 2 year old browsers.
|
||||
2. `caniuse-lite` deduplication: to synchronize version in different tools.
|
||||
|
||||
> What is deduplication?
|
||||
|
||||
Due to how npm architecture is setup, you may have a situation
|
||||
where you have multiple versions of a single dependency required.
|
||||
|
||||
Imagine you begin a project, and you add `autoprefixer` as a dependency.
|
||||
npm looks for the latest `caniuse-lite` version (1.0.30000700) and adds it to
|
||||
`package-lock.json` under `autoprefixer` dependencies.
|
||||
|
||||
A year later, you decide to add Babel. At this moment, we have a
|
||||
new version of `canuse-lite` (1.0.30000900). npm took the latest version
|
||||
and added it to your lock file under `@babel/preset-env` dependencies.
|
||||
|
||||
Now your lock file looks like this:
|
||||
|
||||
```ocaml
|
||||
autoprefixer 7.1.4
|
||||
browserslist 3.1.1
|
||||
caniuse-lite 1.0.30000700
|
||||
@babel/preset-env 7.10.0
|
||||
browserslist 4.13.0
|
||||
caniuse-lite 1.0.30000900
|
||||
```
|
||||
|
||||
As you can see, we now have two versions of `caniuse-lite` installed.
|
||||
|
||||
|
||||
## Queries
|
||||
|
||||
Browserslist will use browsers and Node.js versions query
|
||||
from one of these sources:
|
||||
|
||||
1. `browserslist` key in `package.json` file in current or parent directories.
|
||||
**We recommend this way.**
|
||||
2. `.browserslistrc` config file in current or parent directories.
|
||||
3. `browserslist` config file in current or parent directories.
|
||||
4. `BROWSERSLIST` environment variable.
|
||||
5. If the above methods did not produce a valid result
|
||||
Browserslist will use defaults:
|
||||
`> 0.5%, last 2 versions, Firefox ESR, not dead`.
|
||||
|
||||
|
||||
### Query Composition
|
||||
|
||||
An `or` combiner can use the keyword `or` as well as `,`.
|
||||
`last 1 version or > 1%` is equal to `last 1 version, > 1%`.
|
||||
|
||||
`and` query combinations are also supported to perform an
|
||||
intersection of all the previous queries:
|
||||
`last 1 version or chrome > 75 and > 1%` will select
|
||||
(`browser last version` or `Chrome since 76`) and `more than 1% marketshare`.
|
||||
|
||||
There are 3 different ways to combine queries as depicted below. First you start
|
||||
with a single query and then we combine the queries to get our final list.
|
||||
|
||||
Obviously you can *not* start with a `not` combiner, since there is no left-hand
|
||||
side query to combine it with. The left-hand is always resolved as `and`
|
||||
combiner even if `or` is used (this is an API implementation specificity).
|
||||
|
||||
| Query combiner type | Illustration | Example |
|
||||
| ------------------- | :----------: | ------- |
|
||||
|`or`/`,` combiner <br> (union) |  | `> .5% or last 2 versions` <br> `> .5%, last 2 versions` |
|
||||
| `and` combiner <br> (intersection) |  | `> .5% and last 2 versions` |
|
||||
| `not` combiner <br> (relative complement) |  | All those three are equivalent to the first one <br> `> .5% and not last 2 versions` <br> `> .5% or not last 2 versions` <br> `> .5%, not last 2 versions` |
|
||||
|
||||
_A quick way to test your query is to do `npx browserslist '> 0.5%, not IE 11'`
|
||||
in your terminal._
|
||||
|
||||
### Full List
|
||||
|
||||
You can specify the browser and Node.js versions by queries (case insensitive):
|
||||
|
||||
* `defaults`: Browserslist’s default browsers
|
||||
(`> 0.5%, last 2 versions, Firefox ESR, not dead`).
|
||||
* By usage statistics:
|
||||
* `> 5%`: browsers versions selected by global usage statistics.
|
||||
`>=`, `<` and `<=` work too.
|
||||
* `> 5% in US`: uses USA usage statistics.
|
||||
It accepts [two-letter country code].
|
||||
* `> 5% in alt-AS`: uses Asia region usage statistics.
|
||||
List of all region codes can be found at [`caniuse-lite/data/regions`].
|
||||
* `> 5% in my stats`: uses [custom usage data].
|
||||
* `> 5% in browserslist-config-mycompany stats`: uses [custom usage data]
|
||||
from `browserslist-config-mycompany/browserslist-stats.json`.
|
||||
* `cover 99.5%`: most popular browsers that provide coverage.
|
||||
* `cover 99.5% in US`: same as above, with [two-letter country code].
|
||||
* `cover 99.5% in my stats`: uses [custom usage data].
|
||||
* Last versions:
|
||||
* `last 2 versions`: the last 2 versions for *each* browser.
|
||||
* `last 2 Chrome versions`: the last 2 versions of Chrome browser.
|
||||
* `last 2 major versions` or `last 2 iOS major versions`:
|
||||
all minor/patch releases of last 2 major versions.
|
||||
* `dead`: browsers without official support or updates for 24 months.
|
||||
Right now it is `IE 10`, `IE_Mob 11`, `BlackBerry 10`, `BlackBerry 7`,
|
||||
`Samsung 4` and `OperaMobile 12.1`.
|
||||
* Node.js versions:
|
||||
* `node 10` and `node 10.4`: selects latest Node.js `10.x.x`
|
||||
or `10.4.x` release.
|
||||
* `current node`: Node.js version used by Browserslist right now.
|
||||
* `maintained node versions`: all Node.js versions, which are [still maintained]
|
||||
by Node.js Foundation.
|
||||
* Browsers versions:
|
||||
* `iOS 7`: the iOS browser version 7 directly.
|
||||
* `Firefox > 20`: versions of Firefox newer than 20.
|
||||
`>=`, `<` and `<=` work too. It also works with Node.js.
|
||||
* `ie 6-8`: selects an inclusive range of versions.
|
||||
* `Firefox ESR`: the latest [Firefox Extended Support Release].
|
||||
* `PhantomJS 2.1` and `PhantomJS 1.9`: selects Safari versions similar
|
||||
to PhantomJS runtime.
|
||||
* `extends browserslist-config-mycompany`: take queries from
|
||||
`browserslist-config-mycompany` npm package.
|
||||
* `supports es6-module`: browsers with support for specific features.
|
||||
`es6-module` here is the `feat` parameter at the URL of the [Can I Use]
|
||||
page. A list of all available features can be found at
|
||||
[`caniuse-lite/data/features`].
|
||||
* `browserslist config`: the browsers defined in Browserslist config. Useful
|
||||
in Differential Serving to modify user’s config like
|
||||
`browserslist config and supports es6-module`.
|
||||
* `since 2015` or `last 2 years`: all versions released since year 2015
|
||||
(also `since 2015-03` and `since 2015-03-10`).
|
||||
* `unreleased versions` or `unreleased Chrome versions`:
|
||||
alpha and beta versions.
|
||||
* `not ie <= 8`: exclude IE 8 and lower from previous queries.
|
||||
|
||||
You can add `not ` to any query.
|
||||
|
||||
[`caniuse-lite/data/regions`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/regions
|
||||
[`caniuse-lite/data/features`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/features
|
||||
[two-letter country code]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||
[custom usage data]: #custom-usage-data
|
||||
[still maintained]: https://github.com/nodejs/Release
|
||||
[Can I Use]: https://caniuse.com/
|
||||
[Firefox Extended Support Release]: https://support.mozilla.org/en-US/kb/choosing-firefox-update-channel
|
||||
|
||||
|
||||
### Debug
|
||||
|
||||
Run `npx browserslist` in project directory to see what browsers was selected
|
||||
by your queries.
|
||||
|
||||
```sh
|
||||
$ npx browserslist
|
||||
and_chr 61
|
||||
and_ff 56
|
||||
and_qq 1.2
|
||||
and_uc 11.4
|
||||
android 56
|
||||
baidu 7.12
|
||||
bb 10
|
||||
chrome 62
|
||||
edge 16
|
||||
firefox 56
|
||||
ios_saf 11
|
||||
opera 48
|
||||
safari 11
|
||||
samsung 5
|
||||
```
|
||||
|
||||
|
||||
### Browsers
|
||||
|
||||
Names are case insensitive:
|
||||
|
||||
* `Android` for Android WebView.
|
||||
* `Baidu` for Baidu Browser.
|
||||
* `BlackBerry` or `bb` for Blackberry browser.
|
||||
* `Chrome` for Google Chrome.
|
||||
* `ChromeAndroid` or `and_chr` for Chrome for Android
|
||||
* `Edge` for Microsoft Edge.
|
||||
* `Electron` for Electron framework. It will be converted to Chrome version.
|
||||
* `Explorer` or `ie` for Internet Explorer.
|
||||
* `ExplorerMobile` or `ie_mob` for Internet Explorer Mobile.
|
||||
* `Firefox` or `ff` for Mozilla Firefox.
|
||||
* `FirefoxAndroid` or `and_ff` for Firefox for Android.
|
||||
* `iOS` or `ios_saf` for iOS Safari.
|
||||
* `Node` for Node.js.
|
||||
* `Opera` for Opera.
|
||||
* `OperaMini` or `op_mini` for Opera Mini.
|
||||
* `OperaMobile` or `op_mob` for Opera Mobile.
|
||||
* `QQAndroid` or `and_qq` for QQ Browser for Android.
|
||||
* `Safari` for desktop Safari.
|
||||
* `Samsung` for Samsung Internet.
|
||||
* `UCAndroid` or `and_uc` for UC Browser for Android.
|
||||
* `kaios` for KaiOS Browser.
|
||||
|
||||
|
||||
## Config File
|
||||
|
||||
### `package.json`
|
||||
|
||||
If you want to reduce config files in project root, you can specify
|
||||
browsers in `package.json` with `browserslist` key:
|
||||
|
||||
```json
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"autoprefixer": "^6.5.4"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 version",
|
||||
"> 1%",
|
||||
"IE 10"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### `.browserslistrc`
|
||||
|
||||
Separated Browserslist config should be named `.browserslistrc`
|
||||
and have browsers queries split by a new line.
|
||||
Each line is combined with the `or` combiner. Comments starts with `#` symbol:
|
||||
|
||||
```yaml
|
||||
# Browsers that we support
|
||||
|
||||
last 1 version
|
||||
> 1%
|
||||
IE 10 # sorry
|
||||
```
|
||||
|
||||
Browserslist will check config in every directory in `path`.
|
||||
So, if tool process `app/styles/main.css`, you can put config to root,
|
||||
`app/` or `app/styles`.
|
||||
|
||||
You can specify direct path in `BROWSERSLIST_CONFIG` environment variables.
|
||||
|
||||
|
||||
## Shareable Configs
|
||||
|
||||
You can use the following query to reference an exported Browserslist config
|
||||
from another package:
|
||||
|
||||
```json
|
||||
"browserslist": [
|
||||
"extends browserslist-config-mycompany"
|
||||
]
|
||||
```
|
||||
|
||||
For security reasons, external configuration only supports packages that have
|
||||
the `browserslist-config-` prefix. npm scoped packages are also supported, by
|
||||
naming or prefixing the module with `@scope/browserslist-config`, such as
|
||||
`@scope/browserslist-config` or `@scope/browserslist-config-mycompany`.
|
||||
|
||||
If you don’t accept Browserslist queries from users, you can disable the
|
||||
validation by using the or `BROWSERSLIST_DANGEROUS_EXTEND` environment variable.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack
|
||||
```
|
||||
|
||||
Because this uses `npm`'s resolution, you can also reference specific files
|
||||
in a package:
|
||||
|
||||
```json
|
||||
"browserslist": [
|
||||
"extends browserslist-config-mycompany/desktop",
|
||||
"extends browserslist-config-mycompany/mobile"
|
||||
]
|
||||
```
|
||||
|
||||
When writing a shared Browserslist package, just export an array.
|
||||
`browserslist-config-mycompany/index.js`:
|
||||
|
||||
```js
|
||||
module.exports = [
|
||||
'last 1 version',
|
||||
'> 1%',
|
||||
'ie 10'
|
||||
]
|
||||
```
|
||||
|
||||
You can also include a `browserslist-stats.json` file as part of your shareable
|
||||
config at the root and query it using
|
||||
`> 5% in browserslist-config-mycompany stats`. It uses the same format
|
||||
as `extends` and the `dangerousExtend` property as above.
|
||||
|
||||
You can export configs for different environments and select environment
|
||||
by `BROWSERSLIST_ENV` or `env` option in your tool:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
development: [
|
||||
'last 1 version'
|
||||
],
|
||||
production: [
|
||||
'last 1 version',
|
||||
'> 1%',
|
||||
'ie 10'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Configuring for Different Environments
|
||||
|
||||
You can also specify different browser queries for various environments.
|
||||
Browserslist will choose query according to `BROWSERSLIST_ENV` or `NODE_ENV`
|
||||
variables. If none of them is declared, Browserslist will firstly look
|
||||
for `production` queries and then use defaults.
|
||||
|
||||
In `package.json`:
|
||||
|
||||
```js
|
||||
"browserslist": {
|
||||
"production": [
|
||||
"> 1%",
|
||||
"ie 10"
|
||||
],
|
||||
"modern": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version"
|
||||
],
|
||||
"ssr": [
|
||||
"node 12"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
In `.browserslistrc` config:
|
||||
|
||||
```ini
|
||||
[production]
|
||||
> 1%
|
||||
ie 10
|
||||
|
||||
[modern]
|
||||
last 1 chrome version
|
||||
last 1 firefox version
|
||||
|
||||
[ssr]
|
||||
node 12
|
||||
```
|
||||
|
||||
|
||||
## Custom Usage Data
|
||||
|
||||
If you have a website, you can query against the usage statistics of your site.
|
||||
[`browserslist-ga`] will ask access to Google Analytics and then generate
|
||||
`browserslist-stats.json`:
|
||||
|
||||
```
|
||||
npx browserslist-ga
|
||||
```
|
||||
|
||||
Or you can use [`browserslist-ga-export`] to convert Google Analytics data without giving a password for Google account.
|
||||
|
||||
You can generate usage statistics file by any other method. File format should
|
||||
be like:
|
||||
|
||||
```js
|
||||
{
|
||||
"ie": {
|
||||
"6": 0.01,
|
||||
"7": 0.4,
|
||||
"8": 1.5
|
||||
},
|
||||
"chrome": {
|
||||
…
|
||||
},
|
||||
…
|
||||
}
|
||||
```
|
||||
|
||||
Note that you can query against your custom usage data while also querying
|
||||
against global or regional data. For example, the query
|
||||
`> 1% in my stats, > 5% in US, 10%` is permitted.
|
||||
|
||||
[`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
|
||||
[`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
|
||||
[Can I Use]: https://caniuse.com/
|
||||
|
||||
|
||||
## JS API
|
||||
|
||||
```js
|
||||
const browserslist = require('browserslist')
|
||||
|
||||
// Your CSS/JS build tool code
|
||||
function process (source, opts) {
|
||||
const browsers = browserslist(opts.overrideBrowserslist, {
|
||||
stats: opts.stats,
|
||||
path: opts.file,
|
||||
env: opts.env
|
||||
})
|
||||
// Your code to add features for selected browsers
|
||||
}
|
||||
```
|
||||
|
||||
Queries can be a string `"> 1%, IE 10"`
|
||||
or an array `['> 1%', 'IE 10']`.
|
||||
|
||||
If a query is missing, Browserslist will look for a config file.
|
||||
You can provide a `path` option (that can be a file) to find the config file
|
||||
relatively to it.
|
||||
|
||||
Options:
|
||||
|
||||
* `path`: file or a directory path to look for config file. Default is `.`.
|
||||
* `env`: what environment section use from config. Default is `production`.
|
||||
* `stats`: custom usage statistics data.
|
||||
* `config`: path to config if you want to set it manually.
|
||||
* `ignoreUnknownVersions`: do not throw on direct query (like `ie 12`).
|
||||
Default is `false`.
|
||||
* `dangerousExtend`: Disable security checks for `extend` query.
|
||||
Default is `false`.
|
||||
* `mobileToDesktop`: Use desktop browsers if Can I Use doesn’t have data
|
||||
about this mobile version. For instance, Browserslist will return
|
||||
`chrome 20` on `and_chr 20` query (Can I Use has only data only about
|
||||
latest versions of mobile browsers). Default is `false`.
|
||||
|
||||
For non-JS environment and debug purpose you can use CLI tool:
|
||||
|
||||
```sh
|
||||
browserslist "> 1%, IE 10"
|
||||
```
|
||||
|
||||
You can get total users coverage for selected browsers by JS API:
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1%'))
|
||||
//=> 81.4
|
||||
```
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1% in US'), 'US')
|
||||
//=> 83.1
|
||||
```
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1% in my stats'), 'my stats')
|
||||
//=> 83.1
|
||||
```
|
||||
|
||||
```js
|
||||
browserslist.coverage(browserslist('> 1% in my stats', { stats }), stats)
|
||||
//=> 82.2
|
||||
```
|
||||
|
||||
Or by CLI:
|
||||
|
||||
```sh
|
||||
$ browserslist --coverage "> 1%"
|
||||
These browsers account for 81.4% of all users globally
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserslist --coverage=US "> 1% in US"
|
||||
These browsers account for 83.1% of all users in the US
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserslist --coverage "> 1% in my stats"
|
||||
These browsers account for 83.1% of all users in custom statistics
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserslist --coverage "> 1% in my stats" --stats=./stats.json
|
||||
These browsers account for 83.1% of all users in custom statistics
|
||||
```
|
||||
|
||||
|
||||
## Environment Variables
|
||||
|
||||
If a tool uses Browserslist inside, you can change the Browserslist settings
|
||||
with [environment variables]:
|
||||
|
||||
* `BROWSERSLIST` with browsers queries.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST="> 5%" npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_CONFIG` with path to config file.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_CONFIG=./config/browserslist npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_ENV` with environments string.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_ENV="development" npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_STATS` with path to the custom usage data
|
||||
for `> 1% in my stats` query.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_STATS=./config/usage_data.json npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_DISABLE_CACHE` if you want to disable config reading cache.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_DISABLE_CACHE=1 npx webpack
|
||||
```
|
||||
|
||||
* `BROWSERSLIST_DANGEROUS_EXTEND` to disable security shareable config
|
||||
name check.
|
||||
|
||||
```sh
|
||||
BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack
|
||||
```
|
||||
|
||||
[environment variables]: https://en.wikipedia.org/wiki/Environment_variable
|
||||
|
||||
|
||||
## Cache
|
||||
|
||||
Browserslist caches the configuration it reads from `package.json` and
|
||||
`browserslist` files, as well as knowledge about the existence of files,
|
||||
for the duration of the hosting process.
|
||||
|
||||
To clear these caches, use:
|
||||
|
||||
```js
|
||||
browserslist.clearCaches()
|
||||
```
|
||||
|
||||
To disable the caching altogether, set the `BROWSERSLIST_DISABLE_CACHE`
|
||||
environment variable.
|
||||
|
||||
|
||||
## Security Contact
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact].
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
[Tidelift security contact]: https://tidelift.com/security
|
||||
|
||||
|
||||
## For Enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of `browserslist` and thousands of other packages are working
|
||||
with Tidelift to deliver commercial support and maintenance for the open source
|
||||
dependencies you use to build your applications. Save time, reduce risk,
|
||||
and improve code health, while paying the maintainers of the exact dependencies
|
||||
you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-browserslist?utm_source=npm-browserslist&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/browserslist/browserslist#readme)** on GitHub.
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "browserslist",
|
||||
"version": "4.16.8",
|
||||
"version": "4.17.3",
|
||||
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
|
||||
"keywords": [
|
||||
"caniuse",
|
||||
@@ -15,11 +15,11 @@
|
||||
"license": "MIT",
|
||||
"repository": "browserslist/browserslist",
|
||||
"dependencies": {
|
||||
"caniuse-lite": "^1.0.30001251",
|
||||
"colorette": "^1.3.0",
|
||||
"electron-to-chromium": "^1.3.811",
|
||||
"caniuse-lite": "^1.0.30001264",
|
||||
"electron-to-chromium": "^1.3.857",
|
||||
"escalade": "^3.1.1",
|
||||
"node-releases": "^1.1.75"
|
||||
"node-releases": "^1.1.77",
|
||||
"picocolors": "^0.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
||||
|
||||
+66
-36
@@ -1,16 +1,11 @@
|
||||
var childProcess = require('child_process')
|
||||
var colorette = require('colorette')
|
||||
var escalade = require('escalade/sync')
|
||||
var pico = require('picocolors')
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
|
||||
var BrowserslistError = require('./error')
|
||||
|
||||
var red = colorette.red
|
||||
var bold = colorette.bold
|
||||
var green = colorette.green
|
||||
var yellow = colorette.yellow
|
||||
|
||||
function detectLockfile () {
|
||||
var packageDir = escalade('.', function (dir, names) {
|
||||
return names.indexOf('package.json') !== -1 ? dir : ''
|
||||
@@ -33,7 +28,10 @@ function detectLockfile () {
|
||||
} else if (fs.existsSync(lockfileNpm)) {
|
||||
return { mode: 'npm', file: lockfileNpm }
|
||||
} else if (fs.existsSync(lockfileYarn)) {
|
||||
return { mode: 'yarn', file: lockfileYarn }
|
||||
var lock = { mode: 'yarn', file: lockfileYarn }
|
||||
lock.content = fs.readFileSync(lock.file).toString()
|
||||
lock.version = /# yarn lockfile v1/.test(lock.content) ? 1 : 2
|
||||
return lock
|
||||
} else if (fs.existsSync(lockfileShrinkwrap)) {
|
||||
return { mode: 'npm', file: lockfileShrinkwrap }
|
||||
}
|
||||
@@ -44,9 +42,15 @@ function detectLockfile () {
|
||||
|
||||
function getLatestInfo (lock) {
|
||||
if (lock.mode === 'yarn') {
|
||||
return JSON.parse(
|
||||
childProcess.execSync('yarn info caniuse-lite --json').toString()
|
||||
).data
|
||||
if (lock.version === 1) {
|
||||
return JSON.parse(
|
||||
childProcess.execSync('yarn info caniuse-lite --json').toString()
|
||||
).data
|
||||
} else {
|
||||
return JSON.parse(
|
||||
childProcess.execSync('yarn npm info caniuse-lite --json').toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
return JSON.parse(
|
||||
childProcess.execSync('npm show caniuse-lite --json').toString()
|
||||
@@ -88,9 +92,9 @@ function diffBrowsersLists (old, current) {
|
||||
return intersection.indexOf(version) === -1
|
||||
})
|
||||
return removedVersions.map(function (version) {
|
||||
return red('- ' + browser + ' ' + version)
|
||||
return pico.red('- ' + browser + ' ' + version)
|
||||
}).concat(addedVersions.map(function (version) {
|
||||
return green('+ ' + browser + ' ' + version)
|
||||
return pico.green('+ ' + browser + ' ' + version)
|
||||
}))
|
||||
})
|
||||
.reduce(function (result, array) {
|
||||
@@ -187,7 +191,7 @@ function updatePnpmLockfile (lock, latest) {
|
||||
}
|
||||
|
||||
function updateLockfile (lock, latest) {
|
||||
lock.content = fs.readFileSync(lock.file).toString()
|
||||
if (!lock.content) lock.content = fs.readFileSync(lock.file).toString()
|
||||
|
||||
if (lock.mode === 'npm') {
|
||||
return updateNpmLockfile(lock, latest)
|
||||
@@ -197,28 +201,14 @@ function updateLockfile (lock, latest) {
|
||||
return updatePnpmLockfile(lock, latest)
|
||||
}
|
||||
|
||||
module.exports = function updateDB (print) {
|
||||
var lock = detectLockfile()
|
||||
var latest = getLatestInfo(lock)
|
||||
var browsersListRetrievalError
|
||||
var oldBrowsersList
|
||||
try {
|
||||
oldBrowsersList = getBrowsersList()
|
||||
} catch (e) {
|
||||
browsersListRetrievalError = e
|
||||
}
|
||||
|
||||
print(
|
||||
'Latest version: ' + bold(green(latest.version)) + '\n'
|
||||
)
|
||||
|
||||
function updatePackageManually (print, lock, latest) {
|
||||
var lockfileData = updateLockfile(lock, latest)
|
||||
var caniuseVersions = Object.keys(lockfileData.versions).sort()
|
||||
if (caniuseVersions.length === 1 &&
|
||||
caniuseVersions[0] === latest.version) {
|
||||
print(
|
||||
'Installed version: ' + bold(green(latest.version)) + '\n' +
|
||||
bold(green('caniuse-lite is up to date')) + '\n'
|
||||
'Installed version: ' + pico.bold(pico.green(latest.version)) + '\n' +
|
||||
pico.bold(pico.green('caniuse-lite is up to date')) + '\n'
|
||||
)
|
||||
return
|
||||
}
|
||||
@@ -229,7 +219,7 @@ module.exports = function updateDB (print) {
|
||||
print(
|
||||
'Installed version' +
|
||||
(caniuseVersions.length === 1 ? ': ' : 's: ') +
|
||||
bold(red(caniuseVersions.join(', '))) +
|
||||
pico.bold(pico.red(caniuseVersions.join(', '))) +
|
||||
'\n' +
|
||||
'Removing old caniuse-lite from lock file\n'
|
||||
)
|
||||
@@ -238,13 +228,13 @@ module.exports = function updateDB (print) {
|
||||
var install = lock.mode === 'yarn' ? 'yarn add -W' : lock.mode + ' install'
|
||||
print(
|
||||
'Installing new caniuse-lite version\n' +
|
||||
yellow('$ ' + install + ' caniuse-lite') + '\n'
|
||||
pico.yellow('$ ' + install + ' caniuse-lite') + '\n'
|
||||
)
|
||||
try {
|
||||
childProcess.execSync(install + ' caniuse-lite')
|
||||
} catch (e) /* istanbul ignore next */ {
|
||||
print(
|
||||
red(
|
||||
pico.red(
|
||||
'\n' +
|
||||
e.stack + '\n\n' +
|
||||
'Problem with `' + install + ' caniuse-lite` call. ' +
|
||||
@@ -257,9 +247,49 @@ module.exports = function updateDB (print) {
|
||||
var del = lock.mode === 'yarn' ? 'yarn remove -W' : lock.mode + ' uninstall'
|
||||
print(
|
||||
'Cleaning package.json dependencies from caniuse-lite\n' +
|
||||
yellow('$ ' + del + ' caniuse-lite') + '\n'
|
||||
pico.yellow('$ ' + del + ' caniuse-lite') + '\n'
|
||||
)
|
||||
childProcess.execSync(del + ' caniuse-lite')
|
||||
}
|
||||
|
||||
module.exports = function updateDB (print) {
|
||||
var lock = detectLockfile()
|
||||
var latest = getLatestInfo(lock)
|
||||
|
||||
var browsersListRetrievalError
|
||||
var oldBrowsersList
|
||||
try {
|
||||
oldBrowsersList = getBrowsersList()
|
||||
} catch (e) {
|
||||
browsersListRetrievalError = e
|
||||
}
|
||||
|
||||
print(
|
||||
'Latest version: ' + pico.bold(pico.green(latest.version)) + '\n'
|
||||
)
|
||||
|
||||
if (lock.mode === 'yarn' && lock.version !== 1) {
|
||||
var update = 'yarn up -R'
|
||||
print(
|
||||
'Updating caniuse-lite version\n' +
|
||||
pico.yellow('$ ' + update + ' caniuse-lite') + '\n'
|
||||
)
|
||||
try {
|
||||
childProcess.execSync(update + ' caniuse-lite')
|
||||
} catch (e) /* istanbul ignore next */ {
|
||||
print(
|
||||
pico.red(
|
||||
'\n' +
|
||||
e.stack + '\n\n' +
|
||||
'Problem with `' + update + ' caniuse-lite` call. ' +
|
||||
'Run it manually.\n'
|
||||
)
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
} else {
|
||||
updatePackageManually(print, lock, latest)
|
||||
}
|
||||
|
||||
print('caniuse-lite has been successfully updated\n')
|
||||
|
||||
@@ -274,7 +304,7 @@ module.exports = function updateDB (print) {
|
||||
|
||||
if (browsersListRetrievalError) {
|
||||
print(
|
||||
red(
|
||||
pico.red(
|
||||
'\n' +
|
||||
browsersListRetrievalError.stack + '\n\n' +
|
||||
'Problem with browser list retrieval.\n' +
|
||||
@@ -290,7 +320,7 @@ module.exports = function updateDB (print) {
|
||||
print('\nTarget browser changes:\n')
|
||||
print(targetBrowserChanges + '\n')
|
||||
} else {
|
||||
print('\n' + green('No target browser changes') + '\n')
|
||||
print('\n' + pico.green('No target browser changes') + '\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
module.exports={A:{A:{J:0.0131217,D:0.00621152,E:0.020096,F:0.113877,A:0.0133974,B:0.763649,iB:0.009298},B:"ms",C:["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","iB","J","D","E","F","A","B","","",""],E:"IE",F:{iB:962323200,J:998870400,D:1161129600,E:1237420800,F:1300060800,A:1346716800,B:1381968000}},B:{A:{C:0.008282,K:0.004267,L:0.004141,G:0.004141,M:0.008282,N:0.016564,O:0.078679,R:0,S:0.004298,T:0.00944,U:0.00415,V:0.008282,W:0.008282,X:0.008282,Y:0.008282,Z:0.008282,a:0.020705,P:0.024846,b:2.58398,H:0.712252},B:"webkit",C:["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","C","K","L","G","M","N","O","R","S","T","U","V","W","X","Y","Z","a","P","b","H","","",""],E:"Edge",F:{C:1438128000,K:1447286400,L:1470096000,G:1491868800,M:1508198400,N:1525046400,O:1542067200,R:1579046400,S:1581033600,T:1586736000,U:1590019200,V:1594857600,W:1598486400,X:1602201600,Y:1605830400,Z:1611360000,a:1614816000,P:1618358400,b:1622073600,H:1626912000},D:{C:"ms",K:"ms",L:"ms",G:"ms",M:"ms",N:"ms",O:"ms"}},C:{A:{"0":0.0047,"1":0.04141,"2":0.008282,"3":0.004141,"4":0.004525,"5":0.004141,"6":0.008282,"7":0.004538,"8":0.008282,"9":0.004141,jB:0.012813,aB:0.004271,I:0.020705,c:0.004879,J:0.020136,D:0.005725,E:0.004525,F:0.00533,A:0.004283,B:0.004141,C:0.004471,K:0.004486,L:0.00453,G:0.008542,M:0.004417,N:0.004425,O:0.008542,d:0.004443,e:0.004283,f:0.008542,g:0.013698,h:0.008542,i:0.008786,j:0.004141,k:0.004317,l:0.004393,m:0.004418,n:0.008834,o:0.008542,p:0.008928,q:0.004471,r:0.009284,s:0.004707,t:0.009076,u:0.004425,v:0.004783,w:0.004271,x:0.004783,y:0.00487,z:0.005029,AB:0.074538,BB:0.004335,CB:0.004141,DB:0.004141,EB:0.008282,FB:0.004425,GB:0.004141,bB:0.004141,HB:0.008282,cB:0.00472,IB:0.004425,JB:0.008282,Q:0.00415,KB:0.004267,LB:0.004141,MB:0.004267,NB:0.012423,OB:0.00415,PB:0.008282,QB:0.004425,RB:0.024846,SB:0.00415,TB:0.00415,UB:0.004141,VB:0.004298,WB:0.004141,XB:0.161499,R:0.008282,S:0.008282,T:0.008282,kB:0.016564,U:0.008282,V:0.016564,W:0.008282,X:0.012423,Y:0.016564,Z:0.057974,a:1.51146,P:0.919302,b:0.016564,H:0,dB:0,lB:0.008786,mB:0.00487},B:"moz",C:["jB","aB","lB","mB","I","c","J","D","E","F","A","B","C","K","L","G","M","N","O","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","AB","BB","CB","DB","EB","FB","GB","bB","HB","cB","IB","JB","Q","KB","LB","MB","NB","OB","PB","QB","RB","SB","TB","UB","VB","WB","XB","R","S","T","kB","U","V","W","X","Y","Z","a","P","b","H","dB",""],E:"Firefox",F:{"0":1446508800,"1":1450137600,"2":1453852800,"3":1457395200,"4":1461628800,"5":1465257600,"6":1470096000,"7":1474329600,"8":1479168000,"9":1485216000,jB:1161648000,aB:1213660800,lB:1246320000,mB:1264032000,I:1300752000,c:1308614400,J:1313452800,D:1317081600,E:1317081600,F:1320710400,A:1324339200,B:1327968000,C:1331596800,K:1335225600,L:1338854400,G:1342483200,M:1346112000,N:1349740800,O:1353628800,d:1357603200,e:1361232000,f:1364860800,g:1368489600,h:1372118400,i:1375747200,j:1379376000,k:1386633600,l:1391472000,m:1395100800,n:1398729600,o:1402358400,p:1405987200,q:1409616000,r:1413244800,s:1417392000,t:1421107200,u:1424736000,v:1428278400,w:1431475200,x:1435881600,y:1439251200,z:1442880000,AB:1488844800,BB:1492560000,CB:1497312000,DB:1502150400,EB:1506556800,FB:1510617600,GB:1516665600,bB:1520985600,HB:1525824000,cB:1529971200,IB:1536105600,JB:1540252800,Q:1544486400,KB:1548720000,LB:1552953600,MB:1558396800,NB:1562630400,OB:1567468800,PB:1571788800,QB:1575331200,RB:1578355200,SB:1581379200,TB:1583798400,UB:1586304000,VB:1588636800,WB:1591056000,XB:1593475200,R:1595894400,S:1598313600,T:1600732800,kB:1603152000,U:1605571200,V:1607990400,W:1611619200,X:1614038400,Y:1616457600,Z:1618790400,a:1622505600,P:1626134400,b:1628553600,H:null,dB:null}},D:{A:{"0":0.004403,"1":0.008282,"2":0.004465,"3":0.004642,"4":0.004891,"5":0.012423,"6":0.020705,"7":0.182204,"8":0.004141,"9":0.004141,I:0.004706,c:0.004879,J:0.004879,D:0.005591,E:0.005591,F:0.005591,A:0.004534,B:0.004464,C:0.010424,K:0.0083,L:0.004706,G:0.015087,M:0.004393,N:0.004393,O:0.008652,d:0.008542,e:0.004393,f:0.004317,g:0.012423,h:0.008786,i:0.008282,j:0.004461,k:0.004141,l:0.004326,m:0.0047,n:0.004538,o:0.008542,p:0.008596,q:0.004566,r:0.004141,s:0.008282,t:0.008282,u:0.004335,v:0.004464,w:0.028987,x:0.004464,y:0.012423,z:0.0236,AB:0.004141,BB:0.020705,CB:0.008282,DB:0.012423,EB:0.045551,FB:0.008282,GB:0.008282,bB:0.008282,HB:0.012423,cB:0.074538,IB:0.008282,JB:0.016564,Q:0.020705,KB:0.020705,LB:0.020705,MB:0.020705,NB:0.012423,OB:0.066256,PB:0.053833,QB:0.028987,RB:0.04141,SB:0.016564,TB:0.111807,UB:0.08282,VB:0.053833,WB:0.024846Line truncated
|
||||
module.exports={A:{A:{J:0.0131217,E:0.00621152,F:0.0414881,G:0.11755,A:0.020744,B:0.726041,kB:0.009298},B:"ms",C:["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","kB","J","E","F","G","A","B","","",""],E:"IE",F:{kB:962323200,J:998870400,E:1161129600,F:1237420800,G:1300060800,A:1346716800,B:1381968000}},B:{A:{C:0.008586,K:0.004267,L:0.004293,D:0.008586,M:0.008586,N:0.017172,O:0.090153,P:0,Q:0.004298,T:0.00944,U:0.004043,V:0.012879,W:0.008586,X:0.008586,Y:0.012879,Z:0.004293,a:0.017172,b:0.008586,c:0.030051,R:0.570969,d:2.53287,H:0.523746},B:"webkit",C:["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","C","K","L","D","M","N","O","P","Q","T","U","V","W","X","Y","Z","a","b","c","R","d","H","","",""],E:"Edge",F:{C:1438128000,K:1447286400,L:1470096000,D:1491868800,M:1508198400,N:1525046400,O:1542067200,P:1579046400,Q:1581033600,T:1586736000,U:1590019200,V:1594857600,W:1598486400,X:1602201600,Y:1605830400,Z:1611360000,a:1614816000,b:1618358400,c:1622073600,R:1626912000,d:1630627200,H:1632441600},D:{C:"ms",K:"ms",L:"ms",D:"ms",M:"ms",N:"ms",O:"ms"}},C:{A:{"0":0.00487,"1":0.005029,"2":0.0047,"3":0.038637,"4":0.004293,"5":0.004293,"6":0.004525,"7":0.004293,"8":0.008586,"9":0.004538,lB:0.004293,cB:0.004271,I:0.021465,e:0.004879,J:0.020136,E:0.005725,F:0.004525,G:0.00533,A:0.004283,B:0.008586,C:0.004471,K:0.004486,L:0.00453,D:0.004293,M:0.004417,N:0.004425,O:0.004293,f:0.004443,g:0.004283,h:0.004293,i:0.013698,j:0.004293,k:0.008786,l:0.008586,m:0.004317,n:0.004393,o:0.004418,p:0.008834,q:0.004293,r:0.008928,s:0.004471,t:0.009284,u:0.004707,v:0.009076,w:0.004425,x:0.004783,y:0.004271,z:0.004783,AB:0.008282,BB:0.008586,CB:0.072981,DB:0.004335,EB:0.008586,FB:0.004293,GB:0.008586,HB:0.004425,IB:0.004293,dB:0.004293,JB:0.008586,eB:0.00472,KB:0.004425,LB:0.008586,S:0.00415,MB:0.004267,NB:0.004293,OB:0.004267,PB:0.012879,QB:0.00415,RB:0.004293,SB:0.004425,TB:0.008586,UB:0.00415,VB:0.00415,WB:0.004141,XB:0.004043,YB:0.004293,ZB:0.150255,P:0.012879,Q:0.012879,T:0.012879,mB:0.012879,U:0.008586,V:0.017172,W:0.008586,X:0.008586,Y:0.012879,Z:0.030051,a:0.047223,b:0.047223,c:0.841428,R:1.77301,d:0.025758,H:0,fB:0,nB:0.008786,oB:0.00487},B:"moz",C:["lB","cB","nB","oB","I","e","J","E","F","G","A","B","C","K","L","D","M","N","O","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","AB","BB","CB","DB","EB","FB","GB","HB","IB","dB","JB","eB","KB","LB","S","MB","NB","OB","PB","QB","RB","SB","TB","UB","VB","WB","XB","YB","ZB","P","Q","T","mB","U","V","W","X","Y","Z","a","b","c","R","d","H","fB",""],E:"Firefox",F:{"0":1439251200,"1":1442880000,"2":1446508800,"3":1450137600,"4":1453852800,"5":1457395200,"6":1461628800,"7":1465257600,"8":1470096000,"9":1474329600,lB:1161648000,cB:1213660800,nB:1246320000,oB:1264032000,I:1300752000,e:1308614400,J:1313452800,E:1317081600,F:1317081600,G:1320710400,A:1324339200,B:1327968000,C:1331596800,K:1335225600,L:1338854400,D:1342483200,M:1346112000,N:1349740800,O:1353628800,f:1357603200,g:1361232000,h:1364860800,i:1368489600,j:1372118400,k:1375747200,l:1379376000,m:1386633600,n:1391472000,o:1395100800,p:1398729600,q:1402358400,r:1405987200,s:1409616000,t:1413244800,u:1417392000,v:1421107200,w:1424736000,x:1428278400,y:1431475200,z:1435881600,AB:1479168000,BB:1485216000,CB:1488844800,DB:1492560000,EB:1497312000,FB:1502150400,GB:1506556800,HB:1510617600,IB:1516665600,dB:1520985600,JB:1525824000,eB:1529971200,KB:1536105600,LB:1540252800,S:1544486400,MB:1548720000,NB:1552953600,OB:1558396800,PB:1562630400,QB:1567468800,RB:1571788800,SB:1575331200,TB:1578355200,UB:1581379200,VB:1583798400,WB:1586304000,XB:1588636800,YB:1591056000,ZB:1593475200,P:1595894400,Q:1598313600,T:1600732800,mB:1603152000,U:1605571200,V:1607990400,W:1611619200,X:1614038400,Y:1616457600,Z:1618790400,a:1622505600,b:1626134400,c:1628553600,R:1630972800,d:1633392000,H:null,fB:null}},D:{A:{"0":0.012879,"1":0.0236,"2":0.004293,"3":0.008586,"4":0.004465,"5":0.004642,"6":0.004891,"7":0.012879,"8":0.021465,"9":0.188892,I:0.004706,e:0.004879,J:0.004879,E:0.005591,F:0.005591,G:0.005591,A:0.004534,B:0.004464,C:0.010424,K:0.0083,L:0.004706,D:0.015087,M:0.004393,N:0.004393,O:0.008652,f:0.004293,g:0.004393,h:0.004317,i:0.008586,j:0.008786,k:0.017172,l:0.004461,m:0.004141,n:0.004326,o:0.0047,p:0.004538,q:0.004293,r:0.008596,s:0.004566,t:0.008586,u:0.008586,v:0.017172,w:0.004335,x:0.004464,y:0.025758,z:0.004464,AB:0.004293,BB:0.008586,CB:0.008586,DB:0.017172,EB:0.012879,FB:0.012879,GB:0.055809,HB:0.008586,IB:0.008586,dB:0.008586,JB:0.012879,eB:0.08586,KB:0.012879,LB:0.017172,S:0.021465,MB:0.025758,NB:0.025758,OB:Line truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
module.exports={"0":"42","1":"43","2":"44","3":"45","4":"46","5":"47","6":"48","7":"49","8":"50","9":"51",A:"10",B:"11",C:"12",D:"7",E:"8",F:"9",G:"15",H:"92",I:"4",J:"6",K:"13",L:"14",M:"16",N:"17",O:"18",P:"90",Q:"64",R:"79",S:"80",T:"81",U:"83",V:"84",W:"85",X:"86",Y:"87",Z:"88",a:"89",b:"91",c:"5",d:"19",e:"20",f:"21",g:"22",h:"23",i:"24",j:"25",k:"26",l:"27",m:"28",n:"29",o:"30",p:"31",q:"32",r:"33",s:"34",t:"35",u:"36",v:"37",w:"38",x:"39",y:"40",z:"41",AB:"52",BB:"53",CB:"54",DB:"55",EB:"56",FB:"57",GB:"58",HB:"60",IB:"62",JB:"63",KB:"65",LB:"66",MB:"67",NB:"68",OB:"69",PB:"70",QB:"71",RB:"72",SB:"73",TB:"74",UB:"75",VB:"76",WB:"77",XB:"78",YB:"11.1",ZB:"12.1",aB:"3",bB:"59",cB:"61",dB:"93",eB:"3.2",fB:"10.1",gB:"11.5",hB:"4.2-4.3",iB:"5.5",jB:"2",kB:"82",lB:"3.5",mB:"3.6",nB:"94",oB:"95",pB:"3.1",qB:"5.1",rB:"6.1",sB:"7.1",tB:"9.1",uB:"13.1",vB:"14.1",wB:"TP",xB:"9.5-9.6",yB:"10.0-10.1",zB:"10.5","0B":"10.6","1B":"11.6","2B":"4.0-4.1","3B":"5.0-5.1","4B":"6.0-6.1","5B":"7.0-7.1","6B":"8.1-8.4","7B":"9.0-9.2","8B":"9.3","9B":"10.0-10.2",AC:"10.3",BC:"11.0-11.2",CC:"11.3-11.4",DC:"12.0-12.1",EC:"12.2-12.4",FC:"13.0-13.1",GC:"13.2",HC:"13.3",IC:"13.4-13.7",JC:"14.0-14.4",KC:"14.5-14.7",LC:"all",MC:"2.1",NC:"2.2",OC:"2.3",PC:"4.1",QC:"4.4",RC:"4.4.3-4.4.4",SC:"12.12",TC:"5.0-5.4",UC:"6.2-6.4",VC:"7.2-7.4",WC:"8.2",XC:"9.2",YC:"11.1-11.2",ZC:"12.0",aC:"13.0",bC:"14.0",cC:"10.4",dC:"7.12",eC:"2.5"};
|
||||
module.exports={"0":"40","1":"41","2":"42","3":"43","4":"44","5":"45","6":"46","7":"47","8":"48","9":"49",A:"10",B:"11",C:"12",D:"15",E:"7",F:"8",G:"9",H:"94",I:"4",J:"6",K:"13",L:"14",M:"16",N:"17",O:"18",P:"79",Q:"80",R:"92",S:"64",T:"81",U:"83",V:"84",W:"85",X:"86",Y:"87",Z:"88",a:"89",b:"90",c:"91",d:"93",e:"5",f:"19",g:"20",h:"21",i:"22",j:"23",k:"24",l:"25",m:"26",n:"27",o:"28",p:"29",q:"30",r:"31",s:"32",t:"33",u:"34",v:"35",w:"36",x:"37",y:"38",z:"39",AB:"50",BB:"51",CB:"52",DB:"53",EB:"54",FB:"55",GB:"56",HB:"57",IB:"58",JB:"60",KB:"62",LB:"63",MB:"65",NB:"66",OB:"67",PB:"68",QB:"69",RB:"70",SB:"71",TB:"72",UB:"73",VB:"74",WB:"75",XB:"76",YB:"77",ZB:"78",aB:"11.1",bB:"12.1",cB:"3",dB:"59",eB:"61",fB:"95",gB:"3.2",hB:"10.1",iB:"11.5",jB:"4.2-4.3",kB:"5.5",lB:"2",mB:"82",nB:"3.5",oB:"3.6",pB:"96",qB:"97",rB:"3.1",sB:"5.1",tB:"6.1",uB:"7.1",vB:"9.1",wB:"13.1",xB:"14.1",yB:"TP",zB:"9.5-9.6","0B":"10.0-10.1","1B":"10.5","2B":"10.6","3B":"11.6","4B":"4.0-4.1","5B":"5.0-5.1","6B":"6.0-6.1","7B":"7.0-7.1","8B":"8.1-8.4","9B":"9.0-9.2",AC:"9.3",BC:"10.0-10.2",CC:"10.3",DC:"11.0-11.2",EC:"11.3-11.4",FC:"12.0-12.1",GC:"12.2-12.5",HC:"13.0-13.1",IC:"13.2",JC:"13.3",KC:"13.4-13.7",LC:"14.0-14.4",MC:"14.5-14.8",NC:"all",OC:"2.1",PC:"2.2",QC:"2.3",RC:"4.1",SC:"4.4",TC:"4.4.3-4.4.4",UC:"12.12",VC:"5.0-5.4",WC:"6.2-6.4",XC:"7.2-7.4",YC:"8.2",ZC:"9.2",aC:"11.1-11.2",bC:"12.0",cC:"13.0",dC:"14.0",eC:"15.0",fC:"10.4",gC:"7.12",hC:"2.5"};
|
||||
+1
-1
@@ -1 +1 @@
|
||||
module.exports={"aac":require("./features/aac"),"abortcontroller":require("./features/abortcontroller"),"ac3-ec3":require("./features/ac3-ec3"),"accelerometer":require("./features/accelerometer"),"addeventlistener":require("./features/addeventlistener"),"alternate-stylesheet":require("./features/alternate-stylesheet"),"ambient-light":require("./features/ambient-light"),"apng":require("./features/apng"),"array-find-index":require("./features/array-find-index"),"array-find":require("./features/array-find"),"array-flat":require("./features/array-flat"),"array-includes":require("./features/array-includes"),"arrow-functions":require("./features/arrow-functions"),"asmjs":require("./features/asmjs"),"async-clipboard":require("./features/async-clipboard"),"async-functions":require("./features/async-functions"),"atob-btoa":require("./features/atob-btoa"),"audio-api":require("./features/audio-api"),"audio":require("./features/audio"),"audiotracks":require("./features/audiotracks"),"autofocus":require("./features/autofocus"),"auxclick":require("./features/auxclick"),"av1":require("./features/av1"),"avif":require("./features/avif"),"background-attachment":require("./features/background-attachment"),"background-clip-text":require("./features/background-clip-text"),"background-img-opts":require("./features/background-img-opts"),"background-position-x-y":require("./features/background-position-x-y"),"background-repeat-round-space":require("./features/background-repeat-round-space"),"background-sync":require("./features/background-sync"),"battery-status":require("./features/battery-status"),"beacon":require("./features/beacon"),"beforeafterprint":require("./features/beforeafterprint"),"bigint":require("./features/bigint"),"blobbuilder":require("./features/blobbuilder"),"bloburls":require("./features/bloburls"),"border-image":require("./features/border-image"),"border-radius":require("./features/border-radius"),"broadcastchannel":require("./features/broadcastchannel"),"brotli":require("./features/brotli"),"calc":require("./features/calc"),"canvas-blending":require("./features/canvas-blending"),"canvas-text":require("./features/canvas-text"),"canvas":require("./features/canvas"),"ch-unit":require("./features/ch-unit"),"chacha20-poly1305":require("./features/chacha20-poly1305"),"channel-messaging":require("./features/channel-messaging"),"childnode-remove":require("./features/childnode-remove"),"classlist":require("./features/classlist"),"client-hints-dpr-width-viewport":require("./features/client-hints-dpr-width-viewport"),"clipboard":require("./features/clipboard"),"colr":require("./features/colr"),"comparedocumentposition":require("./features/comparedocumentposition"),"console-basic":require("./features/console-basic"),"console-time":require("./features/console-time"),"const":require("./features/const"),"constraint-validation":require("./features/constraint-validation"),"contenteditable":require("./features/contenteditable"),"contentsecuritypolicy":require("./features/contentsecuritypolicy"),"contentsecuritypolicy2":require("./features/contentsecuritypolicy2"),"cookie-store-api":require("./features/cookie-store-api"),"cors":require("./features/cors"),"createimagebitmap":require("./features/createimagebitmap"),"credential-management":require("./features/credential-management"),"cryptography":require("./features/cryptography"),"css-all":require("./features/css-all"),"css-animation":require("./features/css-animation"),"css-any-link":require("./features/css-any-link"),"css-appearance":require("./features/css-appearance"),"css-apply-rule":require("./features/css-apply-rule"),"css-at-counter-style":require("./features/css-at-counter-style"),"css-backdrop-filter":require("./features/css-backdrop-filter"),"css-background-offsets":require("./features/css-background-offsets"),"css-backgroundblendmode":require("./features/css-backgroundblendmode"),"css-boxdecorationbreak":require("./features/css-boxdecorationbreak"),"css-boxshadow":require("./features/css-boxshadow"),"css-canvas":require("./features/css-canvas"),"css-caret-color":require("./features/css-caret-color"),"css-case-insensitive":require("./features/css-case-insensitive"),"css-clip-path":require("./features/css-clip-path"),"css-color-adjust":require("./features/css-color-adjust"),"css-color-function":require("./features/css-color-function"),"css-conic-gradients":require("./features/css-conic-gradients"),"css-container-queries":require("./features/css-container-queries"),"css-containment":require("./features/css-containment"),"css-content-visibility":require("./features/css-content-visibility"),"css-counters":require("./features/css-counters"),"css-crisp-edges":require("./features/css-crisp-edges"),"css-cross-fade":require("./features/css-cross-fade"),"css-default-pseudo":require("./features/css-default-pseudo"),"css-descendant-gtgt":require("./features/css-descendant-gtgt"),"css-deviceadaptation":require("./features/css-deviceadaptation"),"css-dir-pseudo":require("./featureLine truncated
|
||||
module.exports={"aac":require("./features/aac"),"abortcontroller":require("./features/abortcontroller"),"ac3-ec3":require("./features/ac3-ec3"),"accelerometer":require("./features/accelerometer"),"addeventlistener":require("./features/addeventlistener"),"alternate-stylesheet":require("./features/alternate-stylesheet"),"ambient-light":require("./features/ambient-light"),"apng":require("./features/apng"),"array-find-index":require("./features/array-find-index"),"array-find":require("./features/array-find"),"array-flat":require("./features/array-flat"),"array-includes":require("./features/array-includes"),"arrow-functions":require("./features/arrow-functions"),"asmjs":require("./features/asmjs"),"async-clipboard":require("./features/async-clipboard"),"async-functions":require("./features/async-functions"),"atob-btoa":require("./features/atob-btoa"),"audio-api":require("./features/audio-api"),"audio":require("./features/audio"),"audiotracks":require("./features/audiotracks"),"autofocus":require("./features/autofocus"),"auxclick":require("./features/auxclick"),"av1":require("./features/av1"),"avif":require("./features/avif"),"background-attachment":require("./features/background-attachment"),"background-clip-text":require("./features/background-clip-text"),"background-img-opts":require("./features/background-img-opts"),"background-position-x-y":require("./features/background-position-x-y"),"background-repeat-round-space":require("./features/background-repeat-round-space"),"background-sync":require("./features/background-sync"),"battery-status":require("./features/battery-status"),"beacon":require("./features/beacon"),"beforeafterprint":require("./features/beforeafterprint"),"bigint":require("./features/bigint"),"blobbuilder":require("./features/blobbuilder"),"bloburls":require("./features/bloburls"),"border-image":require("./features/border-image"),"border-radius":require("./features/border-radius"),"broadcastchannel":require("./features/broadcastchannel"),"brotli":require("./features/brotli"),"calc":require("./features/calc"),"canvas-blending":require("./features/canvas-blending"),"canvas-text":require("./features/canvas-text"),"canvas":require("./features/canvas"),"ch-unit":require("./features/ch-unit"),"chacha20-poly1305":require("./features/chacha20-poly1305"),"channel-messaging":require("./features/channel-messaging"),"childnode-remove":require("./features/childnode-remove"),"classlist":require("./features/classlist"),"client-hints-dpr-width-viewport":require("./features/client-hints-dpr-width-viewport"),"clipboard":require("./features/clipboard"),"colr":require("./features/colr"),"comparedocumentposition":require("./features/comparedocumentposition"),"console-basic":require("./features/console-basic"),"console-time":require("./features/console-time"),"const":require("./features/const"),"constraint-validation":require("./features/constraint-validation"),"contenteditable":require("./features/contenteditable"),"contentsecuritypolicy":require("./features/contentsecuritypolicy"),"contentsecuritypolicy2":require("./features/contentsecuritypolicy2"),"cookie-store-api":require("./features/cookie-store-api"),"cors":require("./features/cors"),"createimagebitmap":require("./features/createimagebitmap"),"credential-management":require("./features/credential-management"),"cryptography":require("./features/cryptography"),"css-all":require("./features/css-all"),"css-animation":require("./features/css-animation"),"css-any-link":require("./features/css-any-link"),"css-appearance":require("./features/css-appearance"),"css-apply-rule":require("./features/css-apply-rule"),"css-at-counter-style":require("./features/css-at-counter-style"),"css-backdrop-filter":require("./features/css-backdrop-filter"),"css-background-offsets":require("./features/css-background-offsets"),"css-backgroundblendmode":require("./features/css-backgroundblendmode"),"css-boxdecorationbreak":require("./features/css-boxdecorationbreak"),"css-boxshadow":require("./features/css-boxshadow"),"css-canvas":require("./features/css-canvas"),"css-caret-color":require("./features/css-caret-color"),"css-cascade-layers":require("./features/css-cascade-layers"),"css-case-insensitive":require("./features/css-case-insensitive"),"css-clip-path":require("./features/css-clip-path"),"css-color-adjust":require("./features/css-color-adjust"),"css-color-function":require("./features/css-color-function"),"css-conic-gradients":require("./features/css-conic-gradients"),"css-container-queries":require("./features/css-container-queries"),"css-containment":require("./features/css-containment"),"css-content-visibility":require("./features/css-content-visibility"),"css-counters":require("./features/css-counters"),"css-crisp-edges":require("./features/css-crisp-edges"),"css-cross-fade":require("./features/css-cross-fade"),"css-default-pseudo":require("./features/css-default-pseudo"),"css-descendant-gtgt":require("./features/css-descendant-gtgt"),"css-deviceadaptation":require("./featuLine truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"J D E iB"},B:{"1":"C K L G M N O R S T U V W X Y Z a P b H"},C:{"2":"jB aB I c J D E F A B C K L G M N O d e f lB mB","132":"0 1 2 3 4 5 6 7 8 9 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 bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T kB U V W X Y Z a P b H dB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 C K L G M N O 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 bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T U V W X Y Z a P b H dB nB oB","2":"I c J D E F","16":"A B"},E:{"1":"I c J D E F A B C K L G qB rB sB tB fB YB ZB uB vB wB","2":"pB eB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O 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 Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB","2":"F B C xB yB zB 0B YB gB 1B ZB"},G:{"1":"E 2B hB 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC","16":"eB"},H:{"2":"LC"},I:{"1":"aB I H PC hB QC RC","2":"MC NC OC"},J:{"1":"A","2":"D"},K:{"1":"Q","2":"A B C YB gB ZB"},L:{"1":"H"},M:{"132":"P"},N:{"1":"A","2":"B"},O:{"1":"SC"},P:{"1":"I TC UC VC WC XC fB YC ZC aC bC"},Q:{"1":"cC"},R:{"1":"dC"},S:{"132":"eC"}},B:6,C:"AAC audio file format"};
|
||||
module.exports={A:{A:{"1":"G A B","2":"J E F kB"},B:{"1":"C K L D M N O P Q T U V W X Y Z a b c R d H"},C:{"2":"lB cB I e J E F G A B C K L D M N O f g h nB oB","132":"0 1 2 3 4 5 6 7 8 9 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 dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T mB U V W X Y Z a b c R d H fB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 C K L D M N O 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 dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T U V W X Y Z a b c R d H fB pB qB","2":"I e J E F G","16":"A B"},E:{"1":"I e J E F G A B C K L D sB tB uB vB hB aB bB wB xB yB","2":"rB gB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 D M N O 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 S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q","2":"G B C zB 0B 1B 2B aB iB 3B bB"},G:{"1":"F D 4B jB 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC MC","16":"gB"},H:{"2":"NC"},I:{"1":"cB I H RC jB SC TC","2":"OC PC QC"},J:{"1":"A","2":"E"},K:{"1":"S","2":"A B C aB iB bB"},L:{"1":"H"},M:{"132":"R"},N:{"1":"A","2":"B"},O:{"1":"UC"},P:{"1":"I VC WC XC YC ZC hB aC bC cC dC eC"},Q:{"1":"fC"},R:{"1":"gC"},S:{"132":"hC"}},B:6,C:"AAC audio file format"};
|
||||
Generated
Vendored
+1
-1
@@ -1 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B iB"},B:{"1":"M N O R S T U V W X Y Z a P b H","2":"C K L G"},C:{"1":"FB GB bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T kB U V W X Y Z a P b H dB","2":"0 1 2 3 4 5 6 7 8 9 jB aB I c J D E F A B C K L G M N O 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 lB mB"},D:{"1":"LB MB NB OB PB QB RB SB TB UB VB WB XB R S T U V W X Y Z a P b H dB nB oB","2":"0 1 2 3 4 5 6 7 8 9 I c J D E F A B C K L G M N O 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 bB HB cB IB JB Q KB"},E:{"1":"K L G ZB uB vB wB","2":"I c J D E F A B pB eB qB rB sB tB fB","130":"C YB"},F:{"1":"BB CB DB EB FB GB HB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O d e f g h i j k l m n o p q r s t u v w x y z AB xB yB zB 0B YB gB 1B ZB"},G:{"1":"CC DC EC FC GC HC IC JC KC","2":"E eB 2B hB 3B 4B 5B 6B 7B 8B 9B AC BC"},H:{"2":"LC"},I:{"1":"H","2":"aB I MC NC OC PC hB QC RC"},J:{"2":"D A"},K:{"1":"Q","2":"A B C YB gB ZB"},L:{"1":"H"},M:{"1":"P"},N:{"2":"A B"},O:{"2":"SC"},P:{"1":"XC fB YC ZC aC bC","2":"I TC UC VC WC"},Q:{"1":"cC"},R:{"2":"dC"},S:{"2":"eC"}},B:1,C:"AbortController & AbortSignal"};
|
||||
module.exports={A:{A:{"2":"J E F G A B kB"},B:{"1":"M N O P Q T U V W X Y Z a b c R d H","2":"C K L D"},C:{"1":"HB IB dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T mB U V W X Y Z a b c R d H fB","2":"0 1 2 3 4 5 6 7 8 9 lB cB I e J E F G A B C K L D M N O 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 nB oB"},D:{"1":"NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T U V W X Y Z a b c R d H fB pB qB","2":"0 1 2 3 4 5 6 7 8 9 I e J E F G A B C K L D M N O 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 dB JB eB KB LB S MB"},E:{"1":"K L D bB wB xB yB","2":"I e J E F G A B rB gB sB tB uB vB hB","130":"C aB"},F:{"1":"DB EB FB GB HB IB JB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q","2":"0 1 2 3 4 5 6 7 8 9 G B C D M N O f g h i j k l m n o p q r s t u v w x y z AB BB CB zB 0B 1B 2B aB iB 3B bB"},G:{"1":"D EC FC GC HC IC JC KC LC MC","2":"F gB 4B jB 5B 6B 7B 8B 9B AC BC CC DC"},H:{"2":"NC"},I:{"1":"H","2":"cB I OC PC QC RC jB SC TC"},J:{"2":"E A"},K:{"1":"S","2":"A B C aB iB bB"},L:{"1":"H"},M:{"1":"R"},N:{"2":"A B"},O:{"2":"UC"},P:{"1":"ZC hB aC bC cC dC eC","2":"I VC WC XC YC"},Q:{"1":"fC"},R:{"2":"gC"},S:{"2":"hC"}},B:1,C:"AbortController & AbortSignal"};
|
||||
Generated
Vendored
+1
-1
@@ -1 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B iB"},B:{"1":"C K L G M N O","2":"R S T U V W X Y Z a P b H"},C:{"2":"0 1 2 3 4 5 6 7 8 9 jB aB I c J D E F A B C K L G M N O 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 bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T kB U V W X Y Z a P b H dB lB mB"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I c J D E F A B C K L G M N O 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 bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T U V W X Y Z a P b H dB nB oB"},E:{"2":"I c J D E F A B C K L G pB eB qB rB sB tB fB YB ZB uB vB wB"},F:{"2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O 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 Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB xB yB zB 0B YB gB 1B ZB"},G:{"2":"E eB 2B hB 3B 4B 5B 6B","132":"7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC"},H:{"2":"LC"},I:{"2":"aB I H MC NC OC PC hB QC RC"},J:{"2":"D","132":"A"},K:{"2":"A B C Q YB gB","132":"ZB"},L:{"2":"H"},M:{"2":"P"},N:{"2":"A B"},O:{"132":"SC"},P:{"2":"I TC UC VC WC XC fB YC ZC aC bC"},Q:{"2":"cC"},R:{"2":"dC"},S:{"2":"eC"}},B:6,C:"AC-3 (Dolby Digital) and EC-3 (Dolby Digital Plus) codecs"};
|
||||
module.exports={A:{A:{"2":"J E F G A B kB"},B:{"1":"C K L D M N O","2":"P Q T U V W X Y Z a b c R d H"},C:{"2":"0 1 2 3 4 5 6 7 8 9 lB cB I e J E F G A B C K L D M N O 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 dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T mB U V W X Y Z a b c R d H fB nB oB"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I e J E F G A B C K L D M N O 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 dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T U V W X Y Z a b c R d H fB pB qB"},E:{"2":"I e J E F G A B C K L D rB gB sB tB uB vB hB aB bB wB xB yB"},F:{"2":"0 1 2 3 4 5 6 7 8 9 G B C D M N O 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 S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q zB 0B 1B 2B aB iB 3B bB"},G:{"2":"F gB 4B jB 5B 6B 7B 8B","132":"D 9B AC BC CC DC EC FC GC HC IC JC KC LC MC"},H:{"2":"NC"},I:{"2":"cB I H OC PC QC RC jB SC TC"},J:{"2":"E","132":"A"},K:{"2":"A B C S aB iB","132":"bB"},L:{"2":"H"},M:{"2":"R"},N:{"2":"A B"},O:{"132":"UC"},P:{"2":"I VC WC XC YC ZC hB aC bC cC dC eC"},Q:{"2":"fC"},R:{"2":"gC"},S:{"2":"hC"}},B:6,C:"AC-3 (Dolby Digital) and EC-3 (Dolby Digital Plus) codecs"};
|
||||
Generated
Vendored
+1
-1
@@ -1 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B iB"},B:{"1":"R S T U V W X Y Z a P b H","2":"C K L G M N O"},C:{"2":"0 1 2 3 4 5 6 7 8 9 jB aB I c J D E F A B C K L G M N O 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 bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T kB U V W X Y Z a P b H dB lB mB"},D:{"1":"MB NB OB PB QB RB SB TB UB VB WB XB R S T U V W X Y Z a P b H dB nB oB","2":"0 1 2 3 4 5 6 7 8 9 I c J D E F A B C K L G M N O 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","194":"GB bB HB cB IB JB Q KB LB"},E:{"2":"I c J D E F A B C K L G pB eB qB rB sB tB fB YB ZB uB vB wB"},F:{"1":"CB DB EB FB GB HB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O 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 xB yB zB 0B YB gB 1B ZB"},G:{"2":"E eB 2B hB 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC"},H:{"2":"LC"},I:{"1":"H","2":"aB I MC NC OC PC hB QC RC"},J:{"2":"D A"},K:{"1":"Q","2":"A B C YB gB ZB"},L:{"1":"H"},M:{"2":"P"},N:{"2":"A B"},O:{"2":"SC"},P:{"2":"I TC UC VC WC XC fB YC ZC aC bC"},Q:{"2":"cC"},R:{"2":"dC"},S:{"2":"eC"}},B:4,C:"Accelerometer"};
|
||||
module.exports={A:{A:{"2":"J E F G A B kB"},B:{"1":"P Q T U V W X Y Z a b c R d H","2":"C K L D M N O"},C:{"2":"0 1 2 3 4 5 6 7 8 9 lB cB I e J E F G A B C K L D M N O 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 dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T mB U V W X Y Z a b c R d H fB nB oB"},D:{"1":"OB PB QB RB SB TB UB VB WB XB YB ZB P Q T U V W X Y Z a b c R d H fB pB qB","2":"0 1 2 3 4 5 6 7 8 9 I e J E F G A B C K L D M N O 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","194":"IB dB JB eB KB LB S MB NB"},E:{"2":"I e J E F G A B C K L D rB gB sB tB uB vB hB aB bB wB xB yB"},F:{"1":"EB FB GB HB IB JB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q","2":"0 1 2 3 4 5 6 7 8 9 G B C D M N O 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 zB 0B 1B 2B aB iB 3B bB"},G:{"2":"F D gB 4B jB 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC MC"},H:{"2":"NC"},I:{"1":"H","2":"cB I OC PC QC RC jB SC TC"},J:{"2":"E A"},K:{"1":"S","2":"A B C aB iB bB"},L:{"1":"H"},M:{"2":"R"},N:{"2":"A B"},O:{"2":"UC"},P:{"2":"I VC WC XC YC ZC hB aC bC cC dC eC"},Q:{"2":"fC"},R:{"2":"gC"},S:{"2":"hC"}},B:4,C:"Accelerometer"};
|
||||
Generated
Vendored
+1
-1
@@ -1 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","130":"J D E iB"},B:{"1":"C K L G M N O R S T U V W X Y Z a P b H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 D E F A B C K L G M N O 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 bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T kB U V W X Y Z a P b H dB","257":"jB aB I c J lB mB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I c J D E F A B C K L G M N O 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 bB HB cB IB JB Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB R S T U V W X Y Z a P b H dB nB oB"},E:{"1":"I c J D E F A B C K L G pB eB qB rB sB tB fB YB ZB uB vB wB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 F B C G M N O 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 Q KB LB MB NB OB PB QB RB SB TB UB VB WB XB xB yB zB 0B YB gB 1B ZB"},G:{"1":"E eB 2B hB 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC"},H:{"1":"LC"},I:{"1":"aB I H MC NC OC PC hB QC RC"},J:{"1":"D A"},K:{"1":"A B C Q YB gB ZB"},L:{"1":"H"},M:{"1":"P"},N:{"1":"A B"},O:{"1":"SC"},P:{"1":"I TC UC VC WC XC fB YC ZC aC bC"},Q:{"1":"cC"},R:{"1":"dC"},S:{"1":"eC"}},B:1,C:"EventTarget.addEventListener()"};
|
||||
module.exports={A:{A:{"1":"G A B","130":"J E F kB"},B:{"1":"C K L D M N O P Q T U V W X Y Z a b c R d H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 E F G A B C K L D M N O 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 dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T mB U V W X Y Z a b c R d H fB","257":"lB cB I e J nB oB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I e J E F G A B C K L D M N O 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 dB JB eB KB LB S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q T U V W X Y Z a b c R d H fB pB qB"},E:{"1":"I e J E F G A B C K L D rB gB sB tB uB vB hB aB bB wB xB yB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G B C D M N O 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 S MB NB OB PB QB RB SB TB UB VB WB XB YB ZB P Q zB 0B 1B 2B aB iB 3B bB"},G:{"1":"F D gB 4B jB 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC MC"},H:{"1":"NC"},I:{"1":"cB I H OC PC QC RC jB SC TC"},J:{"1":"E A"},K:{"1":"A B C S aB iB bB"},L:{"1":"H"},M:{"1":"R"},N:{"1":"A B"},O:{"1":"UC"},P:{"1":"I VC WC XC YC ZC hB aC bC cC dC eC"},Q:{"1":"fC"},R:{"1":"gC"},S:{"1":"hC"}},B:1,C:"EventTarget.addEventListener()"};
|
||||
Loaded 100 of 934 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user