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.2
to
2.1.3
+17
-16
dist/index.js

@@ -15,6 +15,8 @@ import { extname } from "pathe";

return [].concat(types).some((type) => {
if (type === "Function") return isFunctionType(node);
else if (type === "Literal") return isLiteralType(node);
else if (type === "Expression") return isExpressionType(node);
else return node.type === type;
switch (type) {
case "Function": return isFunctionType(node);
case "Literal": return isLiteralType(node);
case "Expression": return isExpressionType(node);
default: return node.type === type;
}
});

@@ -463,8 +465,10 @@ }

if (typeof node === "string") return node;
else if (node.type === "Identifier") {
if (computed) throw new TypeError("Invalid Identifier");
return node.name;
} else if (node.type === "PrivateName") return `#${node.id.name}`;
else if (node.type === "ThisExpression") return "this";
else if (node.type === "Super") return "super";
else switch (node.type) {
case "Identifier":
if (computed) throw new TypeError("Invalid Identifier");
return node.name;
case "PrivateName": return `#${node.id.name}`;
case "ThisExpression": return "this";
case "Super": return "super";
}
return String(resolveLiteral(node));

@@ -856,4 +860,3 @@ }

function walk(ast, { enter, leave }) {
const instance = new SyncWalker(enter, leave);
return instance.visit(ast, null);
return new SyncWalker(enter, leave).visit(ast, null);
}

@@ -869,4 +872,3 @@ /**

async function asyncWalk(ast, { enter, leave }) {
const instance = new AsyncWalker(enter, leave);
return await instance.visit(ast, null);
return await new AsyncWalker(enter, leave).visit(ast, null);
}

@@ -901,4 +903,3 @@

try {
const node = parseExpression(`({${rawKey}: 1})`);
if (node.properties[0].key.type === "Identifier") return rawKey;
if (parseExpression(`({${rawKey}: 1})`).properties[0].key.type === "Identifier") return rawKey;
} catch {}

@@ -905,0 +906,0 @@ return JSON.stringify(rawKey);

The MIT License (MIT)
Copyright © 2023-PRESENT 三咲智子 (https://github.com/sxzz)
Copyright © 2023-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-kit",
"version": "2.1.2",
"version": "2.1.3",
"description": "A toolkit for easy Babel AST generation and manipulation.",

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

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

@@ -32,24 +32,24 @@ "files": [

"dependencies": {
"@babel/parser": "^7.28.0",
"@babel/parser": "^7.28.4",
"pathe": "^2.0.3"
},
"devDependencies": {
"@babel/types": "^7.28.2",
"@sxzz/eslint-config": "^7.1.2",
"@sxzz/prettier-config": "^2.2.3",
"@types/node": "^24.2.1",
"@babel/types": "^7.28.4",
"@sxzz/eslint-config": "^7.2.7",
"@sxzz/prettier-config": "^2.2.4",
"@types/node": "^24.7.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"bumpp": "^10.2.2",
"eslint": "^9.33.0",
"bumpp": "^10.3.1",
"eslint": "^9.37.0",
"estree-walker": "^3.0.3",
"fast-glob": "^3.3.3",
"prettier": "^3.6.2",
"tsdown": "^0.14.0",
"tsx": "^4.20.3",
"typescript": "5.9.2",
"tsdown": "^0.15.6",
"tsx": "^4.20.6",
"typescript": "5.9.3",
"vitest": "^3.2.4"
},
"engines": {
"node": ">=20.18.0"
"node": ">=20.19.0"
},

@@ -56,0 +56,0 @@ "prettier": "@sxzz/prettier-config",

@@ -1,3 +0,9 @@

# ast-kit [![npm](https://img.shields.io/npm/v/ast-kit.svg)](https://npmjs.com/package/ast-kit) [![JSR](https://jsr.io/badges/@sxzz/ast-kit)](https://jsr.io/@sxzz/ast-kit) [![Unit Test](https://github.com/sxzz/ast-kit/actions/workflows/unit-test.yml/badge.svg)](https://github.com/sxzz/ast-kit/actions/workflows/unit-test.yml) [![codecov](https://codecov.io/gh/sxzz/ast-kit/graph/badge.svg?token=MHTCPNMZAK)](https://codecov.io/gh/sxzz/ast-kit)
# ast-kit
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![JSR][jsr-src]][jsr-href]
[![Unit Test][unit-test-src]][unit-test-href]
[![codecov][codecov-src]][codecov-href]
A toolkit for easy Babel AST generation and manipulation.

@@ -36,2 +42,15 @@

[MIT](./LICENSE) License © 2023-PRESENT [三咲智子](https://github.com/sxzz)
[MIT](./LICENSE) License © 2023-PRESENT [Kevin Deng](https://github.com/sxzz)
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/ast-kit.svg
[npm-version-href]: https://npmjs.com/package/ast-kit
[npm-downloads-src]: https://img.shields.io/npm/dm/ast-kit
[npm-downloads-href]: https://www.npmcharts.com/compare/ast-kit?interval=30
[jsr-src]: https://jsr.io/badges/@sxzz/ast-kit
[jsr-href]: https://jsr.io/@sxzz/ast-kit
[unit-test-src]: https://github.com/sxzz/ast-kit/actions/workflows/unit-test.yml/badge.svg
[unit-test-href]: https://github.com/sxzz/ast-kit/actions/workflows/unit-test.yml
[codecov-src]: https://codecov.io/gh/sxzz/ast-kit/graph/badge.svg?token=MHTCPNMZAK
[codecov-href]: https://codecov.io/gh/sxzz/ast-kit