Socket
Socket
Sign inDemoInstall

@babel/types

Package Overview
Dependencies
Maintainers
4
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/types - npm Package Compare versions

Comparing version 7.20.7 to 7.21.0

lib/definitions/deprecated-aliases.js

18

lib/asserts/generated/index.js

@@ -112,2 +112,3 @@ "use strict";

exports.assertImportNamespaceSpecifier = assertImportNamespaceSpecifier;
exports.assertImportOrExportDeclaration = assertImportOrExportDeclaration;
exports.assertImportSpecifier = assertImportSpecifier;

@@ -310,3 +311,2 @@ exports.assertIndexedAccessType = assertIndexedAccessType;

var _is = require("../../validators/is");
function assert(type, node, opts) {

@@ -1157,4 +1157,4 @@ if (!(0, _is.default)(type, node, opts)) {

}
function assertModuleDeclaration(node, opts) {
assert("ModuleDeclaration", node, opts);
function assertImportOrExportDeclaration(node, opts) {
assert("ImportOrExportDeclaration", node, opts);
}

@@ -1213,18 +1213,22 @@ function assertExportDeclaration(node, opts) {

function assertNumberLiteral(node, opts) {
console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
console.trace("`assertNumberLiteral` has been deprecated, please migrate to `assertNumericLiteral`.");
assert("NumberLiteral", node, opts);
}
function assertRegexLiteral(node, opts) {
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
console.trace("`assertRegexLiteral` has been deprecated, please migrate to `assertRegExpLiteral`.");
assert("RegexLiteral", node, opts);
}
function assertRestProperty(node, opts) {
console.trace("The node type RestProperty has been renamed to RestElement");
console.trace("`assertRestProperty` has been deprecated, please migrate to `assertRestElement`.");
assert("RestProperty", node, opts);
}
function assertSpreadProperty(node, opts) {
console.trace("The node type SpreadProperty has been renamed to SpreadElement");
console.trace("`assertSpreadProperty` has been deprecated, please migrate to `assertSpreadElement`.");
assert("SpreadProperty", node, opts);
}
function assertModuleDeclaration(node, opts) {
console.trace("`assertModuleDeclaration` has been deprecated, please migrate to `assertImportOrExportDeclaration`.");
assert("ModuleDeclaration", node, opts);
}
//# sourceMappingURL=index.js.map

@@ -260,3 +260,2 @@ "use strict";

var _validateNode = require("../validateNode");
function arrayExpression(elements = []) {

@@ -263,0 +262,0 @@ return (0, _validateNode.default)({

@@ -22,3 +22,2 @@ "use strict";

}
function cloneNode(node, deep = true, withoutLoc = false) {

@@ -35,3 +34,2 @@ return cloneNodeInternal(node, deep, withoutLoc, new Map());

};
if ((0, _generated.isIdentifier)(node)) {

@@ -51,7 +49,5 @@ newNode.name = node.name;

if (deep) {
newNode[field] = (0, _generated.isFile)(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc, commentsCache) : cloneIfNodeOrArray(
node[field], true, withoutLoc, commentsCache);
newNode[field] = (0, _generated.isFile)(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc, commentsCache) : cloneIfNodeOrArray(node[field], true, withoutLoc, commentsCache);
} else {
newNode[field] =
node[field];
newNode[field] = node[field];
}

@@ -58,0 +54,0 @@ }

@@ -6,5 +6,4 @@ "use strict";

});
exports.WHILE_TYPES = exports.USERWHITESPACABLE_TYPES = exports.UNARYLIKE_TYPES = exports.TYPESCRIPT_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.TSENTITYNAME_TYPES = exports.TSBASETYPE_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.STANDARDIZED_TYPES = exports.SCOPABLE_TYPES = exports.PUREISH_TYPES = exports.PROPERTY_TYPES = exports.PRIVATE_TYPES = exports.PATTERN_TYPES = exports.PATTERNLIKE_TYPES = exports.OBJECTMEMBER_TYPES = exports.MODULESPECIFIER_TYPES = exports.MODULEDECLARATION_TYPES = exports.MISCELLANEOUS_TYPES = exports.METHOD_TYPES = exports.LVAL_TYPES = exports.LOOP_TYPES = exports.LITERAL_TYPES = exports.JSX_TYPES = exports.IMMUTABLE_TYPES = exports.FUNCTION_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FOR_TYPES = exports.FORXSTATEMENT_TYPES = exports.FLOW_TYPES = exports.FLOWTYPE_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.EXPRESSION_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.DECLARATION_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.CLASS_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.BINARY_TYPES = exports.ACCESSOR_TYPES = void 0;
exports.WHILE_TYPES = exports.USERWHITESPACABLE_TYPES = exports.UNARYLIKE_TYPES = exports.TYPESCRIPT_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.TSENTITYNAME_TYPES = exports.TSBASETYPE_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.STANDARDIZED_TYPES = exports.SCOPABLE_TYPES = exports.PUREISH_TYPES = exports.PROPERTY_TYPES = exports.PRIVATE_TYPES = exports.PATTERN_TYPES = exports.PATTERNLIKE_TYPES = exports.OBJECTMEMBER_TYPES = exports.MODULESPECIFIER_TYPES = exports.MODULEDECLARATION_TYPES = exports.MISCELLANEOUS_TYPES = exports.METHOD_TYPES = exports.LVAL_TYPES = exports.LOOP_TYPES = exports.LITERAL_TYPES = exports.JSX_TYPES = exports.IMPORTOREXPORTDECLARATION_TYPES = exports.IMMUTABLE_TYPES = exports.FUNCTION_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FOR_TYPES = exports.FORXSTATEMENT_TYPES = exports.FLOW_TYPES = exports.FLOWTYPE_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.EXPRESSION_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.DECLARATION_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.CLASS_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.BINARY_TYPES = exports.ACCESSOR_TYPES = void 0;
var _definitions = require("../../definitions");
const STANDARDIZED_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Standardized"];

@@ -72,4 +71,4 @@ exports.STANDARDIZED_TYPES = STANDARDIZED_TYPES;

exports.CLASS_TYPES = CLASS_TYPES;
const MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"];
exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES;
const IMPORTOREXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ImportOrExportDeclaration"];
exports.IMPORTOREXPORTDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES;
const EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"];

@@ -109,3 +108,5 @@ exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES;

exports.TSBASETYPE_TYPES = TSBASETYPE_TYPES;
const MODULEDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES;
exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES;
//# sourceMappingURL=index.js.map

@@ -24,3 +24,2 @@ "use strict";

if (node.kind !== "var") return;
for (const declar of node.declarations) {

@@ -43,3 +42,2 @@ const bindings = (0, _getBindingIdentifiers.default)(declar);

if (!consequent || !alternate) return;
exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate));

@@ -49,3 +47,2 @@ } else if ((0, _generated.isBlockStatement)(node)) {

if (!body) return;
exprs.push(body);

@@ -52,0 +49,0 @@ } else if ((0, _generated.isEmptyStatement)(node)) {

@@ -9,4 +9,3 @@ "use strict";

var _generated2 = require("../builders/generated");
function toComputedKey(node,
key = node.key || node.property) {
function toComputedKey(node, key = node.key || node.property) {
if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name);

@@ -13,0 +12,0 @@ return key;

@@ -14,7 +14,5 @@ "use strict";

}
if ((0, _generated.isExpression)(node)) {
return node;
}
if ((0, _generated.isClass)(node)) {

@@ -25,3 +23,2 @@ node.type = "ClassExpression";

}
if (!(0, _generated.isExpression)(node)) {

@@ -28,0 +25,0 @@ throw new Error(`cannot turn ${node.type} to an expression`);

@@ -11,3 +11,2 @@ "use strict";

input = input + "";
let name = "";

@@ -17,5 +16,3 @@ for (const c of input) {

}
name = name.replace(/^[-0-9]+/, "");
name = name.replace(/[-\s]+(.)?/g, function (match, c) {

@@ -22,0 +19,0 @@ return c ? c.toUpperCase() : "";

@@ -12,3 +12,2 @@ "use strict";

let alias;
if (node.kind === "method") {

@@ -23,7 +22,5 @@ return toKeyAlias.increment() + "";

}
if (node.computed) {
alias = `[${alias}]`;
}
if (node.static) {

@@ -30,0 +27,0 @@ alias = `static:${alias}`;

@@ -16,3 +16,2 @@ "use strict";

}
return result;

@@ -19,0 +18,0 @@ }

@@ -26,3 +26,2 @@ "use strict";

}
if (mustHaveId && !node.id) {

@@ -38,5 +37,3 @@ newType = false;

}
node.type = newType;
return node;

@@ -43,0 +40,0 @@ }

@@ -26,15 +26,11 @@ "use strict";

}
if (value === true || value === false) {
return (0, _generated.booleanLiteral)(value);
}
if (value === null) {
return (0, _generated.nullLiteral)();
}
if (typeof value === "string") {
return (0, _generated.stringLiteral)(value);
}
if (typeof value === "number") {

@@ -58,3 +54,2 @@ let result;

}
if (isRegExp(value)) {

@@ -65,7 +60,5 @@ const pattern = value.source;

}
if (Array.isArray(value)) {
return (0, _generated.arrayExpression)(value.map(valueToNode));
}
if (isPlainObject(value)) {

@@ -80,4 +73,3 @@ const props = [];

}
props.push((0, _generated.objectProperty)(nodeKey, valueToNode(
value[key])));
props.push((0, _generated.objectProperty)(nodeKey, valueToNode(value[key])));
}

@@ -84,0 +76,0 @@ return (0, _generated.objectExpression)(props);

@@ -63,4 +63,3 @@ "use strict";

validator(node, key, val);
},
{
}, {
oneOfNodeTypes: ["Expression", "PrivateName"]

@@ -291,9 +290,7 @@ });

returnType: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true

@@ -356,6 +353,9 @@ }

typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
decorators: {

@@ -381,6 +381,2 @@ validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),

}))
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}

@@ -396,3 +392,2 @@ }),

};
if (parentKey === "property") {

@@ -415,5 +410,3 @@ if ((0, _is.default)("MemberExpression", parent, nonComp)) return;

}
if (
((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) &&
node.name !== "this") {
if (((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) && node.name !== "this") {
throw new TypeError(`"${node.name}" is not a valid identifier`);

@@ -685,6 +678,2 @@ }

validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression")
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}

@@ -773,3 +762,2 @@ }),

if (!process.env.BABEL_TYPES_8_BREAKING) return;
if (!node.handler && !node.finalizer) {

@@ -834,4 +822,3 @@ throw new TypeError("TryStatement expects either a handler or finalizer, or both");

kind: {
validate: (0, _utils.assertOneOf)("var", "let", "const",
"using")
validate: (0, _utils.assertOneOf)("var", "let", "const", "using")
},

@@ -902,3 +889,2 @@ declarations: {

});
defineType("AssignmentPattern", {

@@ -928,10 +914,2 @@ visitor: ["left", "right", "decorators"],

validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike", "LVal")))
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}

@@ -975,4 +953,3 @@ })

typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true

@@ -1013,4 +990,3 @@ },

typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true

@@ -1062,3 +1038,3 @@ },

visitor: ["source"],
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"],
fields: {

@@ -1077,3 +1053,3 @@ source: {

visitor: ["declaration"],
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"],
fields: {

@@ -1088,3 +1064,3 @@ declaration: {

visitor: ["declaration", "specifiers", "source"],
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"],
fields: {

@@ -1095,3 +1071,2 @@ declaration: {

if (!process.env.BABEL_TYPES_8_BREAKING) return;
if (val && node.specifiers.length) {

@@ -1104,3 +1079,2 @@ throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");

if (!process.env.BABEL_TYPES_8_BREAKING) return;
if (val && node.source) {

@@ -1184,3 +1158,3 @@ throw new TypeError("Cannot export a declaration from a source");

visitor: ["specifiers", "source"],
aliases: ["Statement", "Declaration", "ModuleDeclaration"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration"],
fields: {

@@ -1338,3 +1312,2 @@ assertions: {

visitor: ["properties", "typeAnnotation", "decorators"],
builder: ["properties"],

@@ -1427,4 +1400,3 @@ aliases: ["Pattern", "PatternLike", "LVal"],

expressions: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression",
"TSType")), function (node, key, val) {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "TSType")), function (node, key, val) {
if (node.quasis.length !== val.length + 1) {

@@ -1459,3 +1431,2 @@ throw new TypeError(`Number of ${node.type} quasis should be exactly one more than the number of expressions.\nExpected ${val.length + 1} quasis but got ${node.quasis.length}`);

});
defineType("AwaitExpression", {

@@ -1471,7 +1442,5 @@ builder: ["argument"],

});
defineType("Import", {
aliases: ["Expression"]
});
defineType("BigIntLiteral", {

@@ -1510,4 +1479,3 @@ builder: ["value"],

validator(node, key, val);
},
{
}, {
oneOfNodeTypes: ["Expression", "Identifier"]

@@ -1550,3 +1518,2 @@ });

});
defineType("ClassProperty", {

@@ -1566,4 +1533,3 @@ visitor: ["key", "value", "typeAnnotation", "decorators"],

typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true

@@ -1613,4 +1579,3 @@ },

typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true

@@ -1649,4 +1614,3 @@ },

typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
"Noop"),
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true

@@ -1653,0 +1617,0 @@ },

@@ -98,3 +98,2 @@ "use strict";

});
(0, _utils.default)("ModuleExpression", {

@@ -109,7 +108,5 @@ visitor: ["body"],

});
(0, _utils.default)("TopicReference", {
aliases: ["Expression"]
});
(0, _utils.default)("PipelineTopicExpression", {

@@ -116,0 +113,0 @@ builder: ["expression"],

@@ -393,3 +393,2 @@ "use strict";

});
defineType("EnumDeclaration", {

@@ -396,0 +395,0 @@ aliases: ["Statement", "Declaration"],

@@ -18,2 +18,8 @@ "use strict";

});
Object.defineProperty(exports, "DEPRECATED_ALIASES", {
enumerable: true,
get: function () {
return _deprecatedAliases.DEPRECATED_ALIASES;
}
});
Object.defineProperty(exports, "DEPRECATED_KEYS", {

@@ -77,2 +83,6 @@ enumerable: true,

var _placeholders = require("./placeholders");
var _deprecatedAliases = require("./deprecated-aliases");
Object.keys(_deprecatedAliases.DEPRECATED_ALIASES).forEach(deprecatedAlias => {
_utils.FLIPPED_ALIAS_KEYS[deprecatedAlias] = _utils.FLIPPED_ALIAS_KEYS[_deprecatedAliases.DEPRECATED_ALIASES[deprecatedAlias]];
});
_toFastProperties(_utils.VISITOR_KEYS);

@@ -79,0 +89,0 @@ _toFastProperties(_utils.ALIAS_KEYS);

@@ -10,9 +10,7 @@ "use strict";

returnType: {
validate:
(0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
optional: true
},
typeParameters: {
validate:
(0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
optional: true

@@ -478,2 +476,6 @@ }

},
const: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
constraint: {

@@ -480,0 +482,0 @@ validate: (0, _utils.assertNodeType)("TSType"),

@@ -200,3 +200,2 @@ "use strict";

const store = {};
function defineAliasedType(...aliases) {

@@ -248,3 +247,2 @@ return (type, opts = {}) => {

}
for (const key of visitor.concat(builder)) {

@@ -251,0 +249,0 @@ fields[key] = fields[key] || {};

@@ -567,3 +567,2 @@ "use strict";

});
const react = {

@@ -570,0 +569,0 @@ isReactComponent: _isReactComponent.default,

@@ -11,8 +11,5 @@ "use strict";

}
function removeTypeDuplicates(
nodes) {
function removeTypeDuplicates(nodes) {
const generics = new Map();
const bases = new Map();
const typeGroups = new Set();

@@ -23,7 +20,5 @@ const types = [];

if (!node) continue;
if (types.indexOf(node) >= 0) {
continue;
}
if ((0, _generated.isAnyTypeAnnotation)(node)) {

@@ -43,3 +38,2 @@ return [node];

}
if ((0, _generated.isGenericTypeAnnotation)(node)) {

@@ -63,7 +57,5 @@ const name = getQualifiedName(node.id);

}
for (const [, baseType] of bases) {
types.push(baseType);
}
for (const [, genericName] of generics) {

@@ -70,0 +62,0 @@ types.push(genericName);

@@ -11,3 +11,2 @@ "use strict";

if (!child || !parent) return child;
for (const key of _constants.INHERIT_KEYS.optional) {

@@ -18,3 +17,2 @@ if (child[key] == null) {

}
for (const key of Object.keys(parent)) {

@@ -25,3 +23,2 @@ if (key[0] === "_" && key !== "__clone") {

}
for (const key of _constants.INHERIT_KEYS.force) {

@@ -28,0 +25,0 @@ child[key] = parent[key];

@@ -8,5 +8,3 @@ "use strict";

var _constants = require("../constants");
const CLEAR_KEYS = ["tokens",
"start", "end", "loc",
"raw", "rawValue"];
const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"];
const CLEAR_KEYS_PLUS_COMMENTS = [..._constants.COMMENT_KEYS, "comments", ...CLEAR_KEYS];

@@ -13,0 +11,0 @@ function removeProperties(node, opts = {}) {

@@ -11,7 +11,5 @@ "use strict";

}
function removeTypeDuplicates(nodes) {
const generics = new Map();
const bases = new Map();
const typeGroups = new Set();

@@ -22,11 +20,8 @@ const types = [];

if (!node) continue;
if (types.indexOf(node) >= 0) {
continue;
}
if ((0, _generated.isTSAnyKeyword)(node)) {
return [node];
}
if ((0, _generated.isTSBaseType)(node)) {

@@ -43,3 +38,2 @@ bases.set(node.type, node);

}
if ((0, _generated.isTSTypeReference)(node) && node.typeParameters) {

@@ -63,7 +57,5 @@ const name = getQualifiedName(node.typeName);

}
for (const [, baseType] of bases) {
types.push(baseType);
}
for (const [, genericName] of generics) {

@@ -70,0 +62,0 @@ types.push(genericName);

@@ -14,4 +14,3 @@ "use strict";

if (!id) continue;
const keys =
getBindingIdentifiers.keys[id.type];
const keys = getBindingIdentifiers.keys[id.type];
if ((0, _generated.isIdentifier)(id)) {

@@ -44,4 +43,3 @@ if (duplicates) {

const key = keys[i];
const nodes =
id[key];
const nodes = id[key];
if (nodes) {

@@ -53,6 +51,4 @@ Array.isArray(nodes) ? search.push(...nodes) : search.push(nodes);

}
return ids;
}
getBindingIdentifiers.keys = {

@@ -59,0 +55,0 @@ DeclareClass: ["id"],

@@ -15,4 +15,3 @@ "use strict";

for (const key of keys) {
const subNode =
node[key];
const subNode = node[key];
if (Array.isArray(subNode)) {

@@ -19,0 +18,0 @@ for (const node of subNode) {

@@ -23,9 +23,6 @@ "use strict";

const isLastNonEmptyLine = i === lastNonEmptyLine;
let trimmedLine = line.replace(/\t/g, " ");
if (!isFirstLine) {
trimmedLine = trimmedLine.replace(/^[ ]+/, "");
}
if (!isLastLine) {

@@ -32,0 +29,0 @@ trimmedLine = trimmedLine.replace(/[ ]+$/, "");

@@ -10,4 +10,3 @@ "use strict";

for (const key of keys) {
if (
actual[key] !== expected[key]) {
if (actual[key] !== expected[key]) {
return false;

@@ -14,0 +13,0 @@ }

@@ -12,9 +12,7 @@ "use strict";

}
const keys =
_getBindingIdentifiers.default.keys[parent.type];
const keys = _getBindingIdentifiers.default.keys[parent.type];
if (keys) {
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const val =
parent[key];
const val = parent[key];
if (Array.isArray(val)) {

@@ -21,0 +19,0 @@ if (val.indexOf(node) >= 0) return true;

@@ -10,6 +10,5 @@ "use strict";

function isLet(node) {
return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" ||
node[_constants.BLOCK_SCOPED_SYMBOL]);
return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]);
}
//# sourceMappingURL=isLet.js.map

@@ -18,4 +18,3 @@ "use strict";

for (const field of fields) {
const val_a =
a[field];
const val_a = a[field];
const val_b = b[field];

@@ -22,0 +21,0 @@ if (typeof val_a !== typeof val_b) {

@@ -19,9 +19,6 @@ "use strict";

return parent.init === node;
case "ArrowFunctionExpression":
return parent.body === node;
case "PrivateName":
return false;
case "ClassMethod":

@@ -34,3 +31,2 @@ case "ClassPrivateMethod":

return false;
case "ObjectProperty":

@@ -49,19 +45,13 @@ if (parent.key === node) {

return parent.key !== node;
case "ClassDeclaration":
case "ClassExpression":
return parent.superClass === node;
case "AssignmentExpression":
return parent.right === node;
case "AssignmentPattern":
return parent.right === node;
case "LabeledStatement":
return false;
case "CatchClause":
return false;
case "RestElement":

@@ -72,11 +62,8 @@ return false;

return false;
case "FunctionDeclaration":
case "FunctionExpression":
return false;
case "ExportNamespaceSpecifier":
case "ExportDefaultSpecifier":
return false;
case "ExportSpecifier":

@@ -87,3 +74,2 @@ if (grandparent != null && grandparent.source) {

return parent.local === node;
case "ImportDefaultSpecifier":

@@ -93,22 +79,15 @@ case "ImportNamespaceSpecifier":

return false;
case "ImportAttribute":
return false;
case "JSXAttribute":
return false;
case "ObjectPattern":
case "ArrayPattern":
return false;
case "MetaProperty":
return false;
case "ObjectTypeProperty":
return parent.key !== node;
case "TSEnumMember":
return parent.id !== node;
case "TSPropertySignature":

@@ -115,0 +94,0 @@ if (parent.key === node) {

@@ -12,3 +12,2 @@ "use strict";

}
if ((0, _generated.isPattern)(node) && ((0, _generated.isFunction)(parent) || (0, _generated.isCatchClause)(parent))) {

@@ -15,0 +14,0 @@ return true;

@@ -9,4 +9,3 @@ "use strict";

function isSpecifierDefault(specifier) {
return (0, _generated.isImportDefaultSpecifier)(specifier) ||
(0, _generated.isIdentifier)(specifier.imported || specifier.exported, {
return (0, _generated.isImportDefaultSpecifier)(specifier) || (0, _generated.isIdentifier)(specifier.imported || specifier.exported, {
name: "default"

@@ -13,0 +12,0 @@ });

@@ -10,3 +10,2 @@ "use strict";

if (nodeType === targetType) return true;
if (_definitions.ALIAS_KEYS[targetType]) return false;

@@ -13,0 +12,0 @@ const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType];

@@ -9,3 +9,2 @@ "use strict";

const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]);
function isValidES3Identifier(name) {

@@ -12,0 +11,0 @@ return (0, _isValidIdentifier.default)(name) && !RESERVED_WORDS_ES3_ONLY.has(name);

@@ -12,6 +12,5 @@ "use strict";

kind: "var"
}) && !
node[_constants.BLOCK_SCOPED_SYMBOL];
}) && !node[_constants.BLOCK_SCOPED_SYMBOL];
}
//# sourceMappingURL=isVar.js.map
{
"name": "@babel/types",
"version": "7.20.7",
"version": "7.21.0",
"description": "Babel Types is a Lodash-esque utility library for AST nodes",

@@ -32,4 +32,4 @@ "author": "The Babel Team (https://babel.dev/team)",

"devDependencies": {
"@babel/generator": "^7.20.7",
"@babel/parser": "^7.20.7",
"@babel/generator": "^7.21.0",
"@babel/parser": "^7.21.0",
"chalk": "^4.1.0",

@@ -36,0 +36,0 @@ "glob": "^7.2.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc