You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP →
Socket
Book a DemoSign in
Socket

ast-kit

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-kit - npm Package Compare versions

Comparing version
2.1.3
to
2.2.0
+2
-2
dist/index.d.ts

@@ -1,2 +0,2 @@

import { ParseError, ParseResult, ParserOptions } from "@babel/parser";
import { ParseError, ParseResult, ParserOptions, parse } from "@babel/parser";
import * as t from "@babel/types";

@@ -380,2 +380,2 @@ import { Node } from "@babel/types";

//#endregion
export { AttachedScope, ExportBinding, GetNode, ImportBinding, LiteralUnion, NodeType, ObjectPropertyLike, REGEX_DTS, REGEX_LANG_JSX, REGEX_LANG_TS, Scope, ScopeOptions, TS_NODE_TYPES, WithScope, attachScopes, babelParse, babelParseExpression, createStringLiteral, createTSLiteralType, createTSUnionType, escapeKey, extractIdentifiers, getBabelParserOptions, getLang, isCallOf, isDeclarationType, isDts, isExpressionType, isForStatement, isFunctionType, isIdentifier, isIdentifierOf, isInDestructureAssignment, isInNewExpression, isLiteralType, isReferenced, isReferencedIdentifier, isStaticProperty, isStaticPropertyKey, isTaggedFunctionCallOf, isTs, isTypeOf, locateTrailingComma, parseCache, resolveIdentifier, resolveLiteral, resolveObjectKey, resolveString, resolveTemplateLiteral, tryResolveIdentifier, unwrapTSNode, walkAST, walkASTAsync, walkBlockDeclarations, walkExportDeclaration, walkFunctionParams, walkIdentifiers, walkImportDeclaration };
export { AttachedScope, ExportBinding, GetNode, ImportBinding, LiteralUnion, NodeType, ObjectPropertyLike, REGEX_DTS, REGEX_LANG_JSX, REGEX_LANG_TS, Scope, ScopeOptions, TS_NODE_TYPES, WithScope, attachScopes, babelParse, babelParseExpression, parse as babelParseFile, createStringLiteral, createTSLiteralType, createTSUnionType, escapeKey, extractIdentifiers, getBabelParserOptions, getLang, isCallOf, isDeclarationType, isDts, isExpressionType, isForStatement, isFunctionType, isIdentifier, isIdentifierOf, isInDestructureAssignment, isInNewExpression, isLiteralType, isReferenced, isReferencedIdentifier, isStaticProperty, isStaticPropertyKey, isTaggedFunctionCallOf, isTs, isTypeOf, locateTrailingComma, parseCache, resolveIdentifier, resolveLiteral, resolveObjectKey, resolveString, resolveTemplateLiteral, tryResolveIdentifier, unwrapTSNode, walkAST, walkASTAsync, walkBlockDeclarations, walkExportDeclaration, walkFunctionParams, walkIdentifiers, walkImportDeclaration };

@@ -135,3 +135,3 @@ import { extname } from "pathe";

}
/* v8 ignore start */
/* v8 ignore next -- @preserve */
/**

@@ -251,3 +251,2 @@ * Checks if the input `node` is a reference to a bound variable.

}
/* v8 ignore end */

@@ -939,7 +938,6 @@ //#endregion

const local = specifier.local.name;
const imported = specifier.type === "ImportSpecifier" ? resolveString(specifier.imported) : specifier.type === "ImportNamespaceSpecifier" ? "*" : "default";
imports[local] = {
source,
local,
imported,
imported: specifier.type === "ImportSpecifier" ? resolveString(specifier.imported) : specifier.type === "ImportNamespaceSpecifier" ? "*" : "default",
specifier,

@@ -973,3 +971,3 @@ isType

if (node.type === "ExportNamedDeclaration") {
if (node.specifiers.length > 0) for (const s of node.specifiers) {
if (node.specifiers.length) for (const s of node.specifiers) {
const isExportSpecifier = s.type === "ExportSpecifier";

@@ -984,5 +982,6 @@ isType = node.exportKind === "type" || isExportSpecifier && s.exportKind === "type";

}
else if (node.specifiers.length === 0 && !!node.declaration) {
else if (!node.specifiers.length && node.declaration) {
/* v8 ignore else -- @preserve */
if (node.declaration.type === "VariableDeclaration") for (const decl of node.declaration.declarations) {
/* c8 ignore next 4 */
/* v8 ignore if -- @preserve */
if (decl.id.type !== "Identifier") continue;

@@ -1047,7 +1046,7 @@ local = resolveString(decl.id);

else if (isFunctionType(node))
/* v8 ignore start */
/* v8 ignore if -- @preserve */
if (node.scopeIds) node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
else walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
else if (node.type === "BlockStatement")
/* v8 ignore start */
/* v8 ignore if -- @preserve */
if (node.scopeIds) node.scopeIds.forEach((id) => markKnownIds(id, knownIds));

@@ -1075,3 +1074,3 @@ else walkBlockDeclarations(node, (id) => markScopeIdentifier(node, id, knownIds));

} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
/* v8 ignore next */
/* v8 ignore if -- @preserve */
if (stmt.declare || !stmt.id) continue;

@@ -1091,5 +1090,4 @@ onIdent(stmt.id);

const { name } = child;
/* v8 ignore start */
/* v8 ignore if -- @preserve */
if (node.scopeIds && node.scopeIds.has(name)) return;
/* v8 ignore end */
markKnownIds(name, knownIds);

@@ -1101,2 +1099,3 @@ (node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);

//#region src/scope.ts
/* v8 ignore file -- @preserve */
const extractors = {

@@ -1213,5 +1212,4 @@ ArrayPattern(names, param) {

}
/* c8 ignore stop */
//#endregion
export { REGEX_DTS, REGEX_LANG_JSX, REGEX_LANG_TS, Scope, TS_NODE_TYPES, attachScopes, babelParse, babelParseExpression, createStringLiteral, createTSLiteralType, createTSUnionType, escapeKey, extractIdentifiers, getBabelParserOptions, getLang, isCallOf, isDeclarationType, isDts, isExpressionType, isForStatement, isFunctionType, isIdentifier, isIdentifierOf, isInDestructureAssignment, isInNewExpression, isLiteralType, isReferenced, isReferencedIdentifier, isStaticProperty, isStaticPropertyKey, isTaggedFunctionCallOf, isTs, isTypeOf, locateTrailingComma, parseCache, resolveIdentifier, resolveLiteral, resolveObjectKey, resolveString, resolveTemplateLiteral, tryResolveIdentifier, unwrapTSNode, walkAST, walkASTAsync, walkBlockDeclarations, walkExportDeclaration, walkFunctionParams, walkIdentifiers, walkImportDeclaration };
export { REGEX_DTS, REGEX_LANG_JSX, REGEX_LANG_TS, Scope, TS_NODE_TYPES, attachScopes, babelParse, babelParseExpression, parse as babelParseFile, createStringLiteral, createTSLiteralType, createTSUnionType, escapeKey, extractIdentifiers, getBabelParserOptions, getLang, isCallOf, isDeclarationType, isDts, isExpressionType, isForStatement, isFunctionType, isIdentifier, isIdentifierOf, isInDestructureAssignment, isInNewExpression, isLiteralType, isReferenced, isReferencedIdentifier, isStaticProperty, isStaticPropertyKey, isTaggedFunctionCallOf, isTs, isTypeOf, locateTrailingComma, parseCache, resolveIdentifier, resolveLiteral, resolveObjectKey, resolveString, resolveTemplateLiteral, tryResolveIdentifier, unwrapTSNode, walkAST, walkASTAsync, walkBlockDeclarations, walkExportDeclaration, walkFunctionParams, walkIdentifiers, walkImportDeclaration };
{
"name": "ast-kit",
"version": "2.1.3",
"version": "2.2.0",
"description": "A toolkit for easy Babel AST generation and manipulation.",

@@ -31,21 +31,21 @@ "type": "module",

"dependencies": {
"@babel/parser": "^7.28.4",
"@babel/parser": "^7.28.5",
"pathe": "^2.0.3"
},
"devDependencies": {
"@babel/types": "^7.28.4",
"@sxzz/eslint-config": "^7.2.7",
"@babel/types": "^7.28.5",
"@sxzz/eslint-config": "^7.2.8",
"@sxzz/prettier-config": "^2.2.4",
"@types/node": "^24.7.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"@types/node": "^24.10.0",
"@vitest/coverage-v8": "^4.0.8",
"@vitest/ui": "^4.0.8",
"bumpp": "^10.3.1",
"eslint": "^9.37.0",
"eslint": "^9.39.1",
"estree-walker": "^3.0.3",
"fast-glob": "^3.3.3",
"prettier": "^3.6.2",
"tsdown": "^0.15.6",
"tsdown": "^0.16.1",
"tsx": "^4.20.6",
"typescript": "5.9.3",
"vitest": "^3.2.4"
"vitest": "^4.0.8"
},

@@ -52,0 +52,0 @@ "engines": {

@@ -26,7 +26,7 @@ # ast-kit

Requires Node.js 20.18.0 or higher.
Requires Node.js 20.19.0 or higher.
## AST Explorer
You can explore your code's AST using the [AST Explorer](https://ast.sxzz.moe/).
You can explore your code's AST using the [AST Explorer](https://ast-explorer.dev/).

@@ -33,0 +33,0 @@ ## Sponsors