🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

ast-walker-scope

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-walker-scope - npm Package Compare versions

Comparing version
0.8.2
to
0.8.3
+18
-21
dist/index.js

@@ -5,8 +5,8 @@ import { isFunctionType, walkAST as walkAST$1 } from "ast-kit";

//#region src/utils/babel.ts
const NEW_SCOPE = [
const NEW_SCOPE = new Set([
"CatchClause",
"ForInStatement",
"ForOfStatement"
];
const isNewScope = (node) => node && NEW_SCOPE.includes(node.type) || isFunctionType(node);
]);
const isNewScope = (node) => node && NEW_SCOPE.has(node.type) || isFunctionType(node);
function walkFunctionParams(node, onIdent) {

@@ -50,7 +50,6 @@ for (const p of node.params) for (const id of extractIdentifiers(p)) onIdent(id);

}
const ast = parse(code, {
return parse(code, {
sourceType: "module",
plugins
});
return ast;
}

@@ -80,7 +79,6 @@ function walkVariableDeclaration(stmt, register) {

const scopeStack = [currentScope];
const ast = Array.isArray(node) ? {
walkAST$1(Array.isArray(node) ? {
type: "Program",
body: node
} : node;
walkAST$1(ast, {
} : node, {
enter(node$1, parent, ...args) {

@@ -126,17 +124,16 @@ const { scopeCtx, walkerCtx, isSkip, isRemoved, getNode } = getHookContext(this, node$1, [parent, ...args]);

let newNode = node$1;
const walkerCtx = {
skip() {
isSkip = true;
ctx.skip();
},
replace(node$2) {
newNode = node$2;
},
remove() {
isRemoved = true;
}
};
return {
scopeCtx,
walkerCtx,
walkerCtx: {
skip() {
isSkip = true;
ctx.skip();
},
replace(node$2) {
newNode = node$2;
},
remove() {
isRemoved = true;
}
},
isSkip: () => isSkip,

@@ -143,0 +140,0 @@ isRemoved: () => isRemoved,

The MIT License (MIT)
Copyright © 2022-PRESENT 三咲智子 (https://github.com/sxzz)
Copyright © 2022-PRESENT Kevin Deng (https://github.com/sxzz)

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "ast-walker-scope",
"version": "0.8.2",
"version": "0.8.3",
"description": "Traverse Babel AST with scope information.",

@@ -15,3 +15,3 @@ "type": "module",

},
"author": "三咲智子 Kevin Deng <sxzz@sxzz.moe>",
"author": "Kevin Deng <sxzz@sxzz.moe>",
"funding": "https://github.com/sponsors/sxzz",

@@ -26,3 +26,3 @@ "files": [

".": "./dist/index.js",
"./*": "./*"
"./package.json": "./package.json"
},

@@ -33,24 +33,27 @@ "publishConfig": {

"dependencies": {
"@babel/parser": "^7.28.3",
"ast-kit": "^2.1.2"
"@babel/parser": "^7.28.4",
"ast-kit": "^2.1.3"
},
"devDependencies": {
"@babel/types": "^7.28.2",
"@sxzz/eslint-config": "^7.1.2",
"@sxzz/prettier-config": "^2.2.3",
"@types/node": "^24.3.0",
"bumpp": "^10.2.3",
"eslint": "^9.33.0",
"magic-string": "^0.30.17",
"@babel/types": "^7.28.4",
"@sxzz/eslint-config": "^7.2.7",
"@sxzz/prettier-config": "^2.2.4",
"@types/node": "^24.7.0",
"bumpp": "^10.3.1",
"eslint": "^9.37.0",
"magic-string": "^0.30.19",
"prettier": "^3.6.2",
"tsdown": "^0.14.1",
"tsx": "^4.20.4",
"typescript": "^5.9.2",
"vite": "^7.1.2",
"tsdown": "^0.15.6",
"tsx": "^4.20.6",
"typescript": "^5.9.3",
"vite": "^7.1.9",
"vitest": "^3.2.4"
},
"engines": {
"node": ">=20.18.0"
"node": ">=20.19.0"
},
"prettier": "@sxzz/prettier-config",
"tsdown": {
"exports": true
},
"scripts": {

@@ -57,0 +60,0 @@ "lint": "eslint .",