Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-typescript

Package Overview
Dependencies
61
Maintainers
4
Versions
123
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.17.12 to 7.18.0

54

lib/index.js

@@ -125,28 +125,32 @@ "use strict";

if (path.node.accessibility) path.node.accessibility = null;
const parameterProperties = [];
const assigns = [];
const {
scope
} = path;
for (const param of path.node.params) {
if (param.type === "TSParameterProperty" && !PARSED_PARAMS.has(param.parameter)) {
PARSED_PARAMS.add(param.parameter);
parameterProperties.push(param.parameter);
}
}
for (const paramPath of path.get("params")) {
const param = paramPath.node;
if (parameterProperties.length) {
const assigns = parameterProperties.map(p => {
if (param.type === "TSParameterProperty") {
const parameter = param.parameter;
if (PARSED_PARAMS.has(parameter)) continue;
PARSED_PARAMS.add(parameter);
let id;
if (_core.types.isIdentifier(p)) {
id = p;
} else if (_core.types.isAssignmentPattern(p) && _core.types.isIdentifier(p.left)) {
id = p.left;
if (_core.types.isIdentifier(parameter)) {
id = parameter;
} else if (_core.types.isAssignmentPattern(parameter) && _core.types.isIdentifier(parameter.left)) {
id = parameter.left;
} else {
throw path.buildCodeFrameError("Parameter properties can not be destructuring patterns.");
throw paramPath.buildCodeFrameError("Parameter properties can not be destructuring patterns.");
}
return _core.template.statement.ast`
this.${_core.types.cloneNode(id)} = ${_core.types.cloneNode(id)}`;
});
(0, _helperCreateClassFeaturesPlugin.injectInitialization)(classPath, path, assigns);
assigns.push(_core.template.statement.ast`
this.${_core.types.cloneNode(id)} = ${_core.types.cloneNode(id)}`);
paramPath.replaceWith(paramPath.get("parameter"));
scope.registerBinding("param", paramPath);
}
}
(0, _helperCreateClassFeaturesPlugin.injectInitialization)(classPath, path, assigns);
}

@@ -401,4 +405,3 @@

const {
node,
scope
node
} = path;

@@ -414,11 +417,2 @@ if (node.typeParameters) node.typeParameters = null;

}
const paramsPath = path.get("params");
for (const p of paramsPath) {
if (p.type === "TSParameterProperty") {
p.replaceWith(p.get("parameter"));
scope.registerBinding("param", p);
}
}
},

@@ -474,3 +468,3 @@

TSNonNullExpression(path) {
"TSNonNullExpression|TSInstantiationExpression"(path) {
path.replaceWith(path.node.expression);

@@ -477,0 +471,0 @@ },

{
"name": "@babel/plugin-transform-typescript",
"version": "7.17.12",
"version": "7.18.0",
"description": "Transform TypeScript into ES.next",

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

"dependencies": {
"@babel/helper-create-class-features-plugin": "^7.17.12",
"@babel/helper-create-class-features-plugin": "^7.18.0",
"@babel/helper-plugin-utils": "^7.17.12",

@@ -29,6 +29,6 @@ "@babel/plugin-syntax-typescript": "^7.17.12"

"devDependencies": {
"@babel/core": "^7.17.12",
"@babel/core": "^7.18.0",
"@babel/helper-plugin-test-runner": "^7.16.7",
"@babel/traverse": "^7.17.12",
"@babel/types": "^7.17.12"
"@babel/traverse": "^7.18.0",
"@babel/types": "^7.18.0"
},

@@ -35,0 +35,0 @@ "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-typescript",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc