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.6.8 to 0.6.9

25

./dist/index.js

@@ -50,14 +50,23 @@ // src/check.ts

} from "@babel/parser";
function hasPlugin(plugins, plugin) {
return plugins.some((p) => (Array.isArray(p) ? p[0] : p) === plugin);
}
function getParserOptions(lang, options = {}) {
const plugins = [...options.plugins || []];
if (isTs(lang)) {
plugins.push(
lang === "dts" ? ["typescript", { dts: true }] : "typescript",
["importAttributes", { deprecatedAssertSyntax: true }]
);
if (REGEX_LANG_JSX.test(lang))
if (!hasPlugin(plugins, "typescript")) {
plugins.push(
lang === "dts" ? ["typescript", { dts: true }] : "typescript"
);
}
if (!hasPlugin(plugins, "decorators") && !hasPlugin(plugins, "decorators-legacy")) {
plugins.push("decorators-legacy");
}
if (!hasPlugin(plugins, "importAttributes") && !hasPlugin(plugins, "importAssertions")) {
plugins.push(["importAttributes", { deprecatedAssertSyntax: true }]);
}
if (REGEX_LANG_JSX.test(lang) && !hasPlugin(plugins, "jsx")) {
plugins.push("jsx");
if (!plugins.includes("decorators"))
plugins.push("decorators-legacy");
} else {
}
} else if (!hasPlugin(plugins, "jsx")) {
plugins.push("jsx");

@@ -64,0 +73,0 @@ }

@@ -50,14 +50,23 @@ // src/check.ts

} from "@babel/parser";
function hasPlugin(plugins, plugin) {
return plugins.some((p) => (Array.isArray(p) ? p[0] : p) === plugin);
}
function getParserOptions(lang, options = {}) {
const plugins = [...options.plugins || []];
if (isTs(lang)) {
plugins.push(
lang === "dts" ? ["typescript", { dts: true }] : "typescript",
["importAttributes", { deprecatedAssertSyntax: true }]
);
if (REGEX_LANG_JSX.test(lang))
if (!hasPlugin(plugins, "typescript")) {
plugins.push(
lang === "dts" ? ["typescript", { dts: true }] : "typescript"
);
}
if (!hasPlugin(plugins, "decorators") && !hasPlugin(plugins, "decorators-legacy")) {
plugins.push("decorators-legacy");
}
if (!hasPlugin(plugins, "importAttributes") && !hasPlugin(plugins, "importAssertions")) {
plugins.push(["importAttributes", { deprecatedAssertSyntax: true }]);
}
if (REGEX_LANG_JSX.test(lang) && !hasPlugin(plugins, "jsx")) {
plugins.push("jsx");
if (!plugins.includes("decorators"))
plugins.push("decorators-legacy");
} else {
}
} else if (!hasPlugin(plugins, "jsx")) {
plugins.push("jsx");

@@ -64,0 +73,0 @@ }

{
"name": "ast-kit",
"version": "0.6.8",
"version": "0.6.9",
"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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc