Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/preset-typescript

Package Overview
Dependencies
Maintainers
4
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/preset-typescript - npm Package Compare versions

Comparing version 7.22.15 to 7.23.0

30

lib/index.js

@@ -31,2 +31,3 @@ 'use strict';

optimizeConstEnums: "optimizeConstEnums",
rewriteImportExtensions: "rewriteImportExtensions",
allExtensions: "allExtensions",

@@ -51,2 +52,3 @@ isTSX: "isTSX"

const optimizeConstEnums = v.validateBooleanOption(TopLevelOptions.optimizeConstEnums, options.optimizeConstEnums, false);
const rewriteImportExtensions = v.validateBooleanOption(TopLevelOptions.rewriteImportExtensions, options.rewriteImportExtensions, false);
const normalized = {

@@ -59,3 +61,4 @@ ignoreExtensions,

onlyRemoveTypeImports,
optimizeConstEnums
optimizeConstEnums,
rewriteImportExtensions
};

@@ -69,2 +72,23 @@ {

var pluginRewriteTSImports = helperPluginUtils.declare(function ({
types: t
}) {
return {
name: "preset-typescript/plugin-rewrite-ts-imports",
visitor: {
"ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration"({
node
}) {
const {
source
} = node;
const kind = t.isImportDeclaration(node) ? node.importKind : node.exportKind;
if (kind === "value" && source && /[\\/]/.test(source.value)) {
source.value = source.value.replace(/(\.[mc]?)ts$/, "$1js");
}
}
}
};
});
var index = helperPluginUtils.declarePreset((api, opts) => {

@@ -81,3 +105,4 @@ api.assertVersion(7);

onlyRemoveTypeImports,
optimizeConstEnums
optimizeConstEnums,
rewriteImportExtensions
} = normalizeOptions(opts);

@@ -102,2 +127,3 @@ const pluginOptions = disallowAmbiguousJSXLike => ({

return {
plugins: rewriteImportExtensions ? [pluginRewriteTSImports] : [],
overrides: disableExtensionDetect ? [{

@@ -104,0 +130,0 @@ plugins: getPlugins(isTSX, disallowAmbiguousJSXLike)

6

package.json
{
"name": "@babel/preset-typescript",
"version": "7.22.15",
"version": "7.23.0",
"description": "Babel preset for TypeScript.",

@@ -23,3 +23,3 @@ "repository": {

"@babel/plugin-syntax-jsx": "^7.22.5",
"@babel/plugin-transform-modules-commonjs": "^7.22.15",
"@babel/plugin-transform-modules-commonjs": "^7.23.0",
"@babel/plugin-transform-typescript": "^7.22.15"

@@ -31,3 +31,3 @@ },

"devDependencies": {
"@babel/core": "^7.22.15",
"@babel/core": "^7.23.0",
"@babel/helper-plugin-test-runner": "^7.22.5"

@@ -34,0 +34,0 @@ },

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