Socket
Socket
Sign inDemoInstall

ast-kit

Package Overview
Dependencies
Maintainers
1
Versions
41
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 0.5.1 to 0.5.2

16

./dist/index.js

@@ -23,3 +23,3 @@ // src/lang.ts

if (isTs(lang)) {
plugins.push(["typescript", { dts: lang === "dts" }]);
plugins.push(lang === "dts" ? ["typescript", { dts: true }] : "typescript");
if (REGEX_LANG_JSX.test(lang))

@@ -34,4 +34,4 @@ plugins.push("jsx");

sourceType: "module",
plugins,
...options
...options,
plugins
});

@@ -44,2 +44,4 @@ return program;

function isTypeOf(node, types) {
if (!node)
return false;
return types.some((type) => {

@@ -51,3 +53,3 @@ if (type === "Function") {

} else {
return node?.type === type;
return node.type === type;
}

@@ -57,9 +59,9 @@ });

function isCallOf(node, test) {
return !!(node && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : Array.isArray(test) ? test.includes(node.callee.name) : test(node.callee.name)));
return !!node && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : Array.isArray(test) ? test.includes(node.callee.name) : test(node.callee.name));
}
function isLiteralType(node) {
return node.type.endsWith("Literal");
return !!node && node.type.endsWith("Literal");
}
function isFunctionType(node) {
return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
return !!node && /Function(?:Expression|Declaration)$|Method$/.test(node.type);
}

@@ -66,0 +68,0 @@ var TS_NODE_TYPES = [

@@ -30,6 +30,6 @@ import { ParserOptions } from '@babel/parser';

}>;
declare function isTypeOf<K extends NodeType>(node: Node, types: Readonly<K[]>): node is GetNode<K>;
declare function isTypeOf<K extends NodeType>(node: Node | undefined | null, types: Readonly<K[]>): node is GetNode<K>;
declare function isCallOf(node: Node | null | undefined, test: string | string[] | ((id: string) => boolean)): node is CallExpression;
declare function isLiteralType(node: Node): node is Literal;
declare function isFunctionType(node: Node): node is Function;
declare function isLiteralType(node: Node | undefined | null): node is Literal;
declare function isFunctionType(node: Node | undefined | null): node is Function;
declare const TS_NODE_TYPES: readonly ["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSInstantiationExpression", "TSSatisfiesExpression"];

@@ -36,0 +36,0 @@ declare function unwrapTSNode(node: Node): Node;

@@ -23,3 +23,3 @@ // src/lang.ts

if (isTs(lang)) {
plugins.push(["typescript", { dts: lang === "dts" }]);
plugins.push(lang === "dts" ? ["typescript", { dts: true }] : "typescript");
if (REGEX_LANG_JSX.test(lang))

@@ -34,4 +34,4 @@ plugins.push("jsx");

sourceType: "module",
plugins,
...options
...options,
plugins
});

@@ -44,2 +44,4 @@ return program;

function isTypeOf(node, types) {
if (!node)
return false;
return types.some((type) => {

@@ -51,3 +53,3 @@ if (type === "Function") {

} else {
return node?.type === type;
return node.type === type;
}

@@ -57,9 +59,9 @@ });

function isCallOf(node, test) {
return !!(node && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : Array.isArray(test) ? test.includes(node.callee.name) : test(node.callee.name)));
return !!node && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : Array.isArray(test) ? test.includes(node.callee.name) : test(node.callee.name));
}
function isLiteralType(node) {
return node.type.endsWith("Literal");
return !!node && node.type.endsWith("Literal");
}
function isFunctionType(node) {
return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
return !!node && /Function(?:Expression|Declaration)$|Method$/.test(node.type);
}

@@ -66,0 +68,0 @@ var TS_NODE_TYPES = [

{
"name": "ast-kit",
"version": "0.5.1",
"version": "0.5.2",
"packageManager": "pnpm@8.6.0",

@@ -28,3 +28,3 @@ "description": "AST Toolkit.",

},
"./*": "./*"
"./package.json": "./package.json"
},

@@ -31,0 +31,0 @@ "publishConfig": {

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