Socket
Socket
Sign inDemoInstall

ast-kit

Package Overview
Dependencies
3
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.2 to 0.5.0

40

./dist/index.js

@@ -39,2 +39,3 @@ "use strict";

babelParse: () => babelParse,
escapeKey: () => escapeKey,
getLang: () => getLang,

@@ -96,2 +97,3 @@ isCallOf: () => isCallOf,

// src/utils.ts
var import_parser2 = require("@babel/parser");
function isTypeOf(node, types) {

@@ -136,6 +138,19 @@ return types.some((type) => {

}
function escapeKey(rawKey) {
if (String(+rawKey) === rawKey)
return rawKey;
try {
const node = (0, import_parser2.parseExpression)(`({${rawKey}: 1})`);
if (node.properties[0].key.type === "Identifier")
return rawKey;
} catch {
}
return JSON.stringify(rawKey);
}
// src/resolve.ts
function resolveString(node, computed = false) {
if (node.type === "Identifier") {
if (typeof node === "string")
return node;
else if (node.type === "Identifier") {
if (computed)

@@ -380,24 +395,1 @@ throw new TypeError("Invalid Identifier");

}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
REGEX_DTS,
REGEX_LANG_JSX,
REGEX_LANG_TS,
TS_NODE_TYPES,
attachScopes,
babelParse,
getLang,
isCallOf,
isDts,
isFunctionType,
isLiteralType,
isTs,
isTypeOf,
resolveIdentifier,
resolveLiteral,
resolveString,
resolveTemplateLiteral,
unwrapTSNode,
walkAST,
walkImportDeclaration
});

@@ -15,3 +15,3 @@ import { ParserOptions } from '@babel/parser';

declare function resolveString(node: Identifier | Literal | PrivateName | ThisExpression | Super, computed?: boolean): string;
declare function resolveString(node: string | Identifier | Literal | PrivateName | ThisExpression | Super, computed?: boolean): string;
declare function resolveLiteral(node: Literal): string | number | boolean | null | RegExp | bigint;

@@ -37,2 +37,3 @@ declare function resolveTemplateLiteral(node: TemplateLiteral): string;

declare function unwrapTSNode(node: Node): Node;
declare function escapeKey(rawKey: string): string;

@@ -59,2 +60,2 @@ declare const walkAST: <T = Node>(node: T, hooks: {

export { GetNode, ImportBinding, REGEX_DTS, REGEX_LANG_JSX, REGEX_LANG_TS, TS_NODE_TYPES, WithScope, attachScopes, babelParse, getLang, isCallOf, isDts, isFunctionType, isLiteralType, isTs, isTypeOf, resolveIdentifier, resolveLiteral, resolveString, resolveTemplateLiteral, unwrapTSNode, walkAST, walkImportDeclaration };
export { GetNode, ImportBinding, REGEX_DTS, REGEX_LANG_JSX, REGEX_LANG_TS, TS_NODE_TYPES, WithScope, attachScopes, babelParse, escapeKey, getLang, isCallOf, isDts, isFunctionType, isLiteralType, isTs, isTypeOf, resolveIdentifier, resolveLiteral, resolveString, resolveTemplateLiteral, unwrapTSNode, walkAST, walkImportDeclaration };

@@ -39,2 +39,3 @@ "use strict";

babelParse: () => babelParse,
escapeKey: () => escapeKey,
getLang: () => getLang,

@@ -96,2 +97,3 @@ isCallOf: () => isCallOf,

// src/utils.ts
var import_parser2 = require("@babel/parser");
function isTypeOf(node, types) {

@@ -136,6 +138,19 @@ return types.some((type) => {

}
function escapeKey(rawKey) {
if (String(+rawKey) === rawKey)
return rawKey;
try {
const node = (0, import_parser2.parseExpression)(`({${rawKey}: 1})`);
if (node.properties[0].key.type === "Identifier")
return rawKey;
} catch {
}
return JSON.stringify(rawKey);
}
// src/resolve.ts
function resolveString(node, computed = false) {
if (node.type === "Identifier") {
if (typeof node === "string")
return node;
else if (node.type === "Identifier") {
if (computed)

@@ -380,24 +395,1 @@ throw new TypeError("Invalid Identifier");

}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
REGEX_DTS,
REGEX_LANG_JSX,
REGEX_LANG_TS,
TS_NODE_TYPES,
attachScopes,
babelParse,
getLang,
isCallOf,
isDts,
isFunctionType,
isLiteralType,
isTs,
isTypeOf,
resolveIdentifier,
resolveLiteral,
resolveString,
resolveTemplateLiteral,
unwrapTSNode,
walkAST,
walkImportDeclaration
});

2

package.json
{
"name": "ast-kit",
"version": "0.4.2",
"version": "0.5.0",
"packageManager": "pnpm@8.6.0",

@@ -5,0 +5,0 @@ "description": "AST Toolkit.",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc