@babel/traverse
Advanced tools
+0
-1
@@ -32,3 +32,2 @@ "use strict"; | ||
| function getOrCreateCachedPaths(node, parentPath) { | ||
| ; | ||
| let paths = pathsCache.get(node); | ||
@@ -35,0 +34,0 @@ if (!paths) pathsCache.set(node, paths = new Map()); |
+0
-2
@@ -81,3 +81,2 @@ "use strict"; | ||
| _context.resync.call(path); | ||
| ; | ||
| if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) { | ||
@@ -104,3 +103,2 @@ _context.pushContext.call(path, this); | ||
| for (let i = 0; i < visitIndex; i++) { | ||
| ; | ||
| _context.popContext.call(queue[i]); | ||
@@ -107,0 +105,0 @@ } |
+18
-6
@@ -7,2 +7,3 @@ "use strict"; | ||
| exports._call = _call; | ||
| exports._forceSetScope = _forceSetScope; | ||
| exports._getQueueContexts = _getQueueContexts; | ||
@@ -67,5 +68,3 @@ exports._resyncKey = _resyncKey; | ||
| } | ||
| { | ||
| exports.isBlacklisted = isDenylisted; | ||
| } | ||
| exports.isBlacklisted = isDenylisted; | ||
| function restoreContext(path, context) { | ||
@@ -113,4 +112,18 @@ if (path.context !== context) { | ||
| } | ||
| function _forceSetScope() { | ||
| var _this$scope; | ||
| let path = this.parentPath; | ||
| if ((this.key === "key" || this.listKey === "decorators") && path.isMethod() || this.key === "discriminant" && path.isSwitchStatement()) { | ||
| path = path.parentPath; | ||
| } | ||
| let target; | ||
| while (path && !target) { | ||
| target = path.scope; | ||
| path = path.parentPath; | ||
| } | ||
| this.scope = this.getScope(target); | ||
| (_this$scope = this.scope) == null || _this$scope.init(); | ||
| } | ||
| function setScope() { | ||
| var _this$opts2, _this$scope; | ||
| var _this$opts2, _this$scope2; | ||
| if ((_this$opts2 = this.opts) != null && _this$opts2.noScope) return; | ||
@@ -129,3 +142,3 @@ let path = this.parentPath; | ||
| this.scope = this.getScope(target); | ||
| (_this$scope = this.scope) == null || _this$scope.init(); | ||
| (_this$scope2 = this.scope) == null || _this$scope2.init(); | ||
| } | ||
@@ -215,3 +228,2 @@ function setContext(context) { | ||
| if (pathToQueue.removed) return; | ||
| ; | ||
| const contexts = this.contexts; | ||
@@ -218,0 +230,0 @@ for (const context of contexts) { |
@@ -103,8 +103,6 @@ "use strict"; | ||
| } | ||
| { | ||
| exports.arrowFunctionToShadowed = function () { | ||
| if (!this.isArrowFunctionExpression()) return; | ||
| this.arrowFunctionToExpression(); | ||
| }; | ||
| } | ||
| exports.arrowFunctionToShadowed = function () { | ||
| if (!this.isArrowFunctionExpression()) return; | ||
| this.arrowFunctionToExpression(); | ||
| }; | ||
| function unwrapFunctionEnvironment() { | ||
@@ -576,5 +574,3 @@ if (!this.isArrowFunctionExpression() && !this.isFunctionExpression() && !this.isFunctionDeclaration()) { | ||
| this.node.id = id; | ||
| { | ||
| scope.getProgramParent().references[id.name] = true; | ||
| } | ||
| scope.getProgramParent().references[id.name] = true; | ||
| return this; | ||
@@ -585,5 +581,3 @@ } | ||
| this.node.id = id; | ||
| { | ||
| scope.getProgramParent().references[id.name] = true; | ||
| } | ||
| scope.getProgramParent().references[id.name] = true; | ||
| return this; | ||
@@ -590,0 +584,0 @@ } |
@@ -153,10 +153,15 @@ "use strict"; | ||
| } | ||
| const resolved = path.resolve(); | ||
| if (resolved === path) { | ||
| if (!binding) { | ||
| deopt(path, state); | ||
| return; | ||
| } | ||
| const value = evaluateCached(resolved, state); | ||
| const bindingPath = binding.path; | ||
| if (!bindingPath.isVariableDeclarator()) { | ||
| deopt(bindingPath, state); | ||
| return; | ||
| } | ||
| const initPath = bindingPath.get("init"); | ||
| const value = evaluateCached(initPath, state); | ||
| if (typeof value === "object" && value !== null && binding.references > 1) { | ||
| deopt(resolved, state); | ||
| deopt(initPath, state); | ||
| return; | ||
@@ -163,0 +168,0 @@ } |
+42
-46
@@ -229,47 +229,43 @@ "use strict"; | ||
| Object.assign(NodePath_Final.prototype, methods); | ||
| { | ||
| NodePath_Final.prototype.arrowFunctionToShadowed = NodePath_conversion[String("arrowFunctionToShadowed")]; | ||
| Object.assign(NodePath_Final.prototype, { | ||
| has: NodePath_introspection[String("has")], | ||
| is: NodePath_introspection[String("is")], | ||
| isnt: NodePath_introspection[String("isnt")], | ||
| equals: NodePath_introspection[String("equals")], | ||
| hoist: NodePath_modification[String("hoist")], | ||
| updateSiblingKeys: NodePath_modification.updateSiblingKeys, | ||
| call: NodePath_context.call, | ||
| isBlacklisted: NodePath_context[String("isBlacklisted")], | ||
| setScope: NodePath_context.setScope, | ||
| resync: NodePath_context.resync, | ||
| popContext: NodePath_context.popContext, | ||
| pushContext: NodePath_context.pushContext, | ||
| setup: NodePath_context.setup, | ||
| setKey: NodePath_context.setKey | ||
| }); | ||
| } | ||
| { | ||
| NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo; | ||
| NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo; | ||
| Object.assign(NodePath_Final.prototype, { | ||
| _getTypeAnnotation: NodePath_inference._getTypeAnnotation, | ||
| _replaceWith: NodePath_replacement._replaceWith, | ||
| _resolve: NodePath_introspection._resolve, | ||
| _call: NodePath_context._call, | ||
| _resyncParent: NodePath_context._resyncParent, | ||
| _resyncKey: NodePath_context._resyncKey, | ||
| _resyncList: NodePath_context._resyncList, | ||
| _resyncRemoved: NodePath_context._resyncRemoved, | ||
| _getQueueContexts: NodePath_context._getQueueContexts, | ||
| _removeFromScope: NodePath_removal._removeFromScope, | ||
| _callRemovalHooks: NodePath_removal._callRemovalHooks, | ||
| _remove: NodePath_removal._remove, | ||
| _markRemoved: NodePath_removal._markRemoved, | ||
| _assertUnremoved: NodePath_removal._assertUnremoved, | ||
| _containerInsert: NodePath_modification._containerInsert, | ||
| _containerInsertBefore: NodePath_modification._containerInsertBefore, | ||
| _containerInsertAfter: NodePath_modification._containerInsertAfter, | ||
| _verifyNodeList: NodePath_modification._verifyNodeList, | ||
| _getKey: NodePath_family._getKey, | ||
| _getPattern: NodePath_family._getPattern | ||
| }); | ||
| } | ||
| NodePath_Final.prototype.arrowFunctionToShadowed = NodePath_conversion[String("arrowFunctionToShadowed")]; | ||
| Object.assign(NodePath_Final.prototype, { | ||
| has: NodePath_introspection[String("has")], | ||
| is: NodePath_introspection[String("is")], | ||
| isnt: NodePath_introspection[String("isnt")], | ||
| equals: NodePath_introspection[String("equals")], | ||
| hoist: NodePath_modification[String("hoist")], | ||
| updateSiblingKeys: NodePath_modification.updateSiblingKeys, | ||
| call: NodePath_context.call, | ||
| isBlacklisted: NodePath_context[String("isBlacklisted")], | ||
| setScope: NodePath_context.setScope, | ||
| resync: NodePath_context.resync, | ||
| popContext: NodePath_context.popContext, | ||
| pushContext: NodePath_context.pushContext, | ||
| setup: NodePath_context.setup, | ||
| setKey: NodePath_context.setKey | ||
| }); | ||
| NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo; | ||
| NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo; | ||
| Object.assign(NodePath_Final.prototype, { | ||
| _getTypeAnnotation: NodePath_inference._getTypeAnnotation, | ||
| _replaceWith: NodePath_replacement._replaceWith, | ||
| _resolve: NodePath_introspection._resolve, | ||
| _call: NodePath_context._call, | ||
| _resyncParent: NodePath_context._resyncParent, | ||
| _resyncKey: NodePath_context._resyncKey, | ||
| _resyncList: NodePath_context._resyncList, | ||
| _resyncRemoved: NodePath_context._resyncRemoved, | ||
| _getQueueContexts: NodePath_context._getQueueContexts, | ||
| _removeFromScope: NodePath_removal._removeFromScope, | ||
| _callRemovalHooks: NodePath_removal._callRemovalHooks, | ||
| _remove: NodePath_removal._remove, | ||
| _markRemoved: NodePath_removal._markRemoved, | ||
| _assertUnremoved: NodePath_removal._assertUnremoved, | ||
| _containerInsert: NodePath_modification._containerInsert, | ||
| _containerInsertBefore: NodePath_modification._containerInsertBefore, | ||
| _containerInsertAfter: NodePath_modification._containerInsertAfter, | ||
| _verifyNodeList: NodePath_modification._verifyNodeList, | ||
| _getKey: NodePath_family._getKey, | ||
| _getPattern: NodePath_family._getPattern | ||
| }); | ||
| for (const type of t.TYPES) { | ||
@@ -289,3 +285,3 @@ const typeKey = `is${type}`; | ||
| for (const type of Object.keys(virtualTypes)) { | ||
| if (type[0] === "_") continue; | ||
| if (type.startsWith("_")) continue; | ||
| if (!t.TYPES.includes(type)) t.TYPES.push(type); | ||
@@ -292,0 +288,0 @@ } |
@@ -16,13 +16,11 @@ "use strict"; | ||
| function createUnionType(types) { | ||
| { | ||
| if (types.every(v => isFlowType(v))) { | ||
| if (createFlowUnionType) { | ||
| return createFlowUnionType(types); | ||
| } | ||
| return createUnionTypeAnnotation(types); | ||
| } else if (types.every(v => isTSType(v))) { | ||
| if (createTSUnionType) { | ||
| return createTSUnionType(types); | ||
| } | ||
| if (types.every(v => isFlowType(v))) { | ||
| if (createFlowUnionType) { | ||
| return createFlowUnionType(types); | ||
| } | ||
| return createUnionTypeAnnotation(types); | ||
| } else if (types.every(v => isTSType(v))) { | ||
| if (createTSUnionType) { | ||
| return createTSUnionType(types); | ||
| } | ||
| } | ||
@@ -29,0 +27,0 @@ } |
@@ -36,25 +36,21 @@ "use strict"; | ||
| } | ||
| { | ||
| exports.has = function has(key) { | ||
| var _this$node; | ||
| const val = (_this$node = this.node) == null ? void 0 : _this$node[key]; | ||
| if (val && Array.isArray(val)) { | ||
| return !!val.length; | ||
| } else { | ||
| return !!val; | ||
| } | ||
| }; | ||
| } | ||
| exports.has = function has(key) { | ||
| var _this$node; | ||
| const val = (_this$node = this.node) == null ? void 0 : _this$node[key]; | ||
| if (val && Array.isArray(val)) { | ||
| return !!val.length; | ||
| } else { | ||
| return !!val; | ||
| } | ||
| }; | ||
| function isStatic() { | ||
| return this.scope.isStatic(this.node); | ||
| } | ||
| { | ||
| exports.is = exports.has; | ||
| exports.isnt = function isnt(key) { | ||
| return !this.has(key); | ||
| }; | ||
| exports.equals = function equals(key, value) { | ||
| return this.node[key] === value; | ||
| }; | ||
| } | ||
| exports.is = exports.has; | ||
| exports.isnt = function isnt(key) { | ||
| return !this.has(key); | ||
| }; | ||
| exports.equals = function equals(key, value) { | ||
| return this.node[key] === value; | ||
| }; | ||
| function isNodeType(type) { | ||
@@ -113,3 +109,3 @@ return isType(this.type, type); | ||
| const binding = this.scope.getBinding(this.node.name); | ||
| if (!binding || binding.kind !== "module") return false; | ||
| if ((binding == null ? void 0 : binding.kind) !== "module") return false; | ||
| const path = binding.path; | ||
@@ -116,0 +112,0 @@ const parent = path.parentPath; |
@@ -155,11 +155,9 @@ "use strict"; | ||
| } | ||
| { | ||
| exports.isExistentialTypeParam = function isExistentialTypeParam() { | ||
| throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7."); | ||
| }; | ||
| exports.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() { | ||
| throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7."); | ||
| }; | ||
| } | ||
| exports.isExistentialTypeParam = function isExistentialTypeParam() { | ||
| throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7."); | ||
| }; | ||
| exports.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() { | ||
| throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7."); | ||
| }; | ||
| //# sourceMappingURL=virtual-types-validator.js.map |
@@ -224,9 +224,7 @@ "use strict"; | ||
| } | ||
| { | ||
| exports.hoist = function hoist(scope = this.scope) { | ||
| const hoister = new _hoister.default(this, scope); | ||
| return hoister.run(); | ||
| }; | ||
| } | ||
| exports.hoist = function hoist(scope = this.scope) { | ||
| const hoister = new _hoister.default(this, scope); | ||
| return hoister.run(); | ||
| }; | ||
| //# sourceMappingURL=modification.js.map |
@@ -187,4 +187,4 @@ "use strict"; | ||
| const newCallee = callee; | ||
| 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", FUNCTION_TYPES); | ||
| const needToAwaitFunction = isParentAsync && _index.default.hasType(newCallee.node.body, "AwaitExpression", FUNCTION_TYPES); | ||
| const needToYieldFunction = isParentGenerator && _index.default.hasType(newCallee.node.body, "YieldExpression", FUNCTION_TYPES); | ||
| if (needToAwaitFunction) { | ||
@@ -191,0 +191,0 @@ newCallee.set("async", true); |
+107
-132
@@ -56,4 +56,2 @@ "use strict"; | ||
| variableDeclarator, | ||
| isRecordExpression, | ||
| isTupleExpression, | ||
| isObjectProperty, | ||
@@ -184,6 +182,4 @@ isTopicReference, | ||
| function resetScope(scope) { | ||
| { | ||
| scope.references = Object.create(null); | ||
| scope.uids = Object.create(null); | ||
| } | ||
| scope.references = Object.create(null); | ||
| scope.uids = Object.create(null); | ||
| scope.bindings = Object.create(null); | ||
@@ -195,5 +191,3 @@ scope.globals = Object.create(null); | ||
| } | ||
| { | ||
| var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); | ||
| } | ||
| var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); | ||
| const collectorVisitor = { | ||
@@ -341,18 +335,16 @@ ForStatement(path) { | ||
| this.inited = false; | ||
| { | ||
| Object.defineProperties(this, { | ||
| references: { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: Object.create(null) | ||
| }, | ||
| uids: { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: Object.create(null) | ||
| } | ||
| }); | ||
| } | ||
| Object.defineProperties(this, { | ||
| references: { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: Object.create(null) | ||
| }, | ||
| uids: { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: Object.create(null) | ||
| } | ||
| }); | ||
| } | ||
@@ -398,6 +390,4 @@ get parent() { | ||
| const program = this.getProgramParent(); | ||
| { | ||
| program.references[uid] = true; | ||
| program.uids[uid] = true; | ||
| } | ||
| program.references[uid] = true; | ||
| program.uids[uid] = true; | ||
| return uid; | ||
@@ -456,5 +446,3 @@ } | ||
| const renamer = new _renamer.default(binding, oldName, newName); | ||
| { | ||
| renamer.rename(arguments[2]); | ||
| } | ||
| renamer.rename(arguments[2]); | ||
| } | ||
@@ -543,5 +531,3 @@ } | ||
| for (const name of Object.keys(ids)) { | ||
| { | ||
| parent.references[name] = true; | ||
| } | ||
| parent.references[name] = true; | ||
| for (const id of ids[name]) { | ||
@@ -570,9 +556,7 @@ const local = this.getOwnBinding(name); | ||
| hasUid(name) { | ||
| { | ||
| let scope = this; | ||
| do { | ||
| if (scope.uids[name]) return true; | ||
| } while (scope = scope.parent); | ||
| return false; | ||
| } | ||
| let scope = this; | ||
| do { | ||
| if (scope.uids[name]) return true; | ||
| } while (scope = scope.parent); | ||
| return false; | ||
| } | ||
@@ -587,5 +571,3 @@ hasGlobal(name) { | ||
| hasReference(name) { | ||
| { | ||
| return !!this.getProgramParent().references[name]; | ||
| } | ||
| return !!this.getProgramParent().references[name]; | ||
| } | ||
@@ -616,3 +598,3 @@ isPure(node, constantsOnly) { | ||
| return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly); | ||
| } else if (isArrayExpression(node) || isTupleExpression(node)) { | ||
| } else if (isArrayExpression(node) || (node == null ? void 0 : node.type) === "TupleExpression") { | ||
| for (const elem of node.elements) { | ||
@@ -622,3 +604,3 @@ if (elem !== null && !this.isPure(elem, constantsOnly)) return false; | ||
| return true; | ||
| } else if (isObjectExpression(node) || isRecordExpression(node)) { | ||
| } else if (isObjectExpression(node) || (node == null ? void 0 : node.type) === "RecordExpression") { | ||
| for (const prop of node.properties) { | ||
@@ -695,3 +677,2 @@ if (!this.isPure(prop, constantsOnly)) return false; | ||
| const path = this.path; | ||
| ; | ||
| resetScope(this); | ||
@@ -726,5 +707,3 @@ this.data = Object.create(null); | ||
| } | ||
| { | ||
| path.traverse(scopeVisitor, state); | ||
| } | ||
| path.traverse(scopeVisitor, state); | ||
| this.crawling = false; | ||
@@ -917,10 +896,8 @@ for (const path of state.assignments) { | ||
| (_this$getBinding3 = this.getBinding(name)) == null || _this$getBinding3.scope.removeOwnBinding(name); | ||
| { | ||
| let scope = this; | ||
| do { | ||
| if (scope.uids[name]) { | ||
| scope.uids[name] = false; | ||
| } | ||
| } while (scope = scope.parent); | ||
| } | ||
| let scope = this; | ||
| do { | ||
| if (scope.uids[name]) { | ||
| scope.uids[name] = false; | ||
| } | ||
| } while (scope = scope.parent); | ||
| } | ||
@@ -979,80 +956,78 @@ hoistVariables(emit = id => this.push({ | ||
| Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"]; | ||
| { | ||
| Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) { | ||
| if (map[oldName]) { | ||
| map[newName] = value; | ||
| map[oldName] = null; | ||
| Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) { | ||
| if (map[oldName]) { | ||
| map[newName] = value; | ||
| map[oldName] = null; | ||
| } | ||
| }; | ||
| Scope.prototype.traverse = function (node, opts, state) { | ||
| (0, _index.default)(node, opts, this, state, this.path); | ||
| }; | ||
| Scope.prototype._generateUid = function _generateUid(name, i) { | ||
| let id = name; | ||
| if (i > 1) id += i; | ||
| return `_${id}`; | ||
| }; | ||
| Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) { | ||
| if (isIdentifier(node)) { | ||
| const binding = this.getBinding(node.name); | ||
| if (binding != null && binding.constant && binding.path.isGenericType("Array")) { | ||
| return node; | ||
| } | ||
| }; | ||
| Scope.prototype.traverse = function (node, opts, state) { | ||
| (0, _index.default)(node, opts, this, state, this.path); | ||
| }; | ||
| Scope.prototype._generateUid = function _generateUid(name, i) { | ||
| let id = name; | ||
| if (i > 1) id += i; | ||
| return `_${id}`; | ||
| }; | ||
| Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) { | ||
| if (isIdentifier(node)) { | ||
| const binding = this.getBinding(node.name); | ||
| if (binding != null && binding.constant && binding.path.isGenericType("Array")) { | ||
| return node; | ||
| } | ||
| if (isArrayExpression(node)) { | ||
| return node; | ||
| } | ||
| if (isIdentifier(node, { | ||
| name: "arguments" | ||
| })) { | ||
| return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]); | ||
| } | ||
| let helperName; | ||
| const args = [node]; | ||
| if (i === true) { | ||
| helperName = "toConsumableArray"; | ||
| } else if (typeof i === "number") { | ||
| args.push(numericLiteral(i)); | ||
| helperName = "slicedToArray"; | ||
| } else { | ||
| helperName = "toArray"; | ||
| } | ||
| if (arrayLikeIsIterable) { | ||
| args.unshift(this.path.hub.addHelper(helperName)); | ||
| helperName = "maybeArrayLike"; | ||
| } | ||
| return callExpression(this.path.hub.addHelper(helperName), args); | ||
| }; | ||
| Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) { | ||
| const ids = Object.create(null); | ||
| for (const kind of kinds) { | ||
| let scope = this; | ||
| do { | ||
| for (const name of Object.keys(scope.bindings)) { | ||
| const binding = scope.bindings[name]; | ||
| if (binding.kind === kind) ids[name] = binding; | ||
| } | ||
| scope = scope.parent; | ||
| } while (scope); | ||
| } | ||
| return ids; | ||
| }; | ||
| Object.defineProperties(Scope.prototype, { | ||
| parentBlock: { | ||
| configurable: true, | ||
| enumerable: true, | ||
| get() { | ||
| return this.path.parent; | ||
| } | ||
| if (isArrayExpression(node)) { | ||
| return node; | ||
| }, | ||
| hub: { | ||
| configurable: true, | ||
| enumerable: true, | ||
| get() { | ||
| return this.path.hub; | ||
| } | ||
| if (isIdentifier(node, { | ||
| name: "arguments" | ||
| })) { | ||
| return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]); | ||
| } | ||
| let helperName; | ||
| const args = [node]; | ||
| if (i === true) { | ||
| helperName = "toConsumableArray"; | ||
| } else if (typeof i === "number") { | ||
| args.push(numericLiteral(i)); | ||
| helperName = "slicedToArray"; | ||
| } else { | ||
| helperName = "toArray"; | ||
| } | ||
| if (arrayLikeIsIterable) { | ||
| args.unshift(this.path.hub.addHelper(helperName)); | ||
| helperName = "maybeArrayLike"; | ||
| } | ||
| return callExpression(this.path.hub.addHelper(helperName), args); | ||
| }; | ||
| Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) { | ||
| const ids = Object.create(null); | ||
| for (const kind of kinds) { | ||
| let scope = this; | ||
| do { | ||
| for (const name of Object.keys(scope.bindings)) { | ||
| const binding = scope.bindings[name]; | ||
| if (binding.kind === kind) ids[name] = binding; | ||
| } | ||
| scope = scope.parent; | ||
| } while (scope); | ||
| } | ||
| return ids; | ||
| }; | ||
| Object.defineProperties(Scope.prototype, { | ||
| parentBlock: { | ||
| configurable: true, | ||
| enumerable: true, | ||
| get() { | ||
| return this.path.parent; | ||
| } | ||
| }, | ||
| hub: { | ||
| configurable: true, | ||
| enumerable: true, | ||
| get() { | ||
| return this.path.hub; | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| }); | ||
| //# sourceMappingURL=index.js.map |
@@ -43,7 +43,5 @@ "use strict"; | ||
| if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) { | ||
| var _node$extra; | ||
| node.shorthand = false; | ||
| { | ||
| var _node$extra; | ||
| if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false; | ||
| } | ||
| if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false; | ||
| } | ||
@@ -50,0 +48,0 @@ }, |
@@ -32,15 +32,8 @@ "use strict"; | ||
| }); | ||
| _context.setScope.call(path); | ||
| _context._forceSetScope.call(path); | ||
| const visitor = exploded[node.type]; | ||
| if (visitor) { | ||
| if (visitor.enter) { | ||
| for (const visit of visitor.enter) { | ||
| visit.call(state, path, state); | ||
| } | ||
| if (visitor != null && visitor.enter) { | ||
| for (const visit of visitor.enter) { | ||
| visit.call(state, path, state); | ||
| } | ||
| if (visitor.exit) { | ||
| for (const visit of visitor.exit) { | ||
| visit.call(state, path, state); | ||
| } | ||
| } | ||
| } | ||
@@ -66,2 +59,7 @@ if (path.shouldSkip) { | ||
| } | ||
| if (visitor != null && visitor.exit) { | ||
| for (const visit of visitor.exit) { | ||
| visit.call(state, path, state); | ||
| } | ||
| } | ||
| } | ||
@@ -68,0 +66,0 @@ } |
@@ -121,3 +121,2 @@ "use strict"; | ||
| function traverseNode(node, opts, scope, state, path, skipKeys, visitSelf) { | ||
| ; | ||
| const keys = VISITOR_KEYS[node.type]; | ||
@@ -124,0 +123,0 @@ if (!keys) return false; |
+10
-14
@@ -105,3 +105,3 @@ "use strict"; | ||
| if (!TYPES.includes(nodeType)) { | ||
| throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.28.5"}`); | ||
| throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.28.6"}`); | ||
| } | ||
@@ -134,10 +134,8 @@ const visitors = visitor[nodeType]; | ||
| }; | ||
| { | ||
| Object.defineProperty(mergedVisitor, "_exploded", { | ||
| enumerable: false | ||
| }); | ||
| Object.defineProperty(mergedVisitor, "_verified", { | ||
| enumerable: false | ||
| }); | ||
| } | ||
| Object.defineProperty(mergedVisitor, "_exploded", { | ||
| enumerable: false | ||
| }); | ||
| Object.defineProperty(mergedVisitor, "_verified", { | ||
| enumerable: false | ||
| }); | ||
| for (let i = 0; i < visitors.length; i++) { | ||
@@ -214,3 +212,3 @@ const visitor = explode$1(visitors[i]); | ||
| function shouldIgnoreKey(key) { | ||
| if (key[0] === "_") return true; | ||
| if (key.startsWith("_")) return true; | ||
| if (key === "enter" || key === "exit" || key === "shouldSkip") return true; | ||
@@ -220,6 +218,4 @@ if (key === "denylist" || key === "noScope" || key === "skipKeys") { | ||
| } | ||
| { | ||
| if (key === "blacklist") { | ||
| return true; | ||
| } | ||
| if (key === "blacklist") { | ||
| return true; | ||
| } | ||
@@ -226,0 +222,0 @@ return false; |
+7
-7
| { | ||
| "name": "@babel/traverse", | ||
| "version": "7.28.5", | ||
| "version": "7.28.6", | ||
| "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -19,12 +19,12 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
| "dependencies": { | ||
| "@babel/code-frame": "^7.27.1", | ||
| "@babel/generator": "^7.28.5", | ||
| "@babel/code-frame": "^7.28.6", | ||
| "@babel/generator": "^7.28.6", | ||
| "@babel/helper-globals": "^7.28.0", | ||
| "@babel/parser": "^7.28.5", | ||
| "@babel/template": "^7.27.2", | ||
| "@babel/types": "^7.28.5", | ||
| "@babel/parser": "^7.28.6", | ||
| "@babel/template": "^7.28.6", | ||
| "@babel/types": "^7.28.6", | ||
| "debug": "^4.3.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "^7.28.5", | ||
| "@babel/core": "^7.28.6", | ||
| "@babel/helper-plugin-test-runner": "^7.27.1" | ||
@@ -31,0 +31,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 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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
707035
0.39%5847
-0.68%Updated
Updated
Updated
Updated
Updated