Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-typescript

Package Overview
Dependencies
58
Maintainers
4
Versions
122
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.0.0-alpha.4 to 8.0.0-alpha.5

46

lib/index.js

@@ -112,3 +112,4 @@ import { declare } from '@babel/helper-plugin-utils';

function translateEnumValues(path, t) {
const seen = new Map();
const bindingIdentifier = path.scope.getBindingIdentifier(path.node.id.name);
const seen = ENUMS.get(bindingIdentifier) ?? new Map();
let constValue = -1;

@@ -236,9 +237,6 @@ let lastName;

if (seen.has(path.node)) return;
const bindingInitPath = path.resolve();
if (bindingInitPath) {
seen.add(path.node);
value = computeConstantValue(bindingInitPath, undefined, seen);
prevMembers?.set(name, value);
return value;
}
seen.add(path.node);
value = computeConstantValue(path.resolve(), prevMembers, seen);
prevMembers?.set(name, value);
return value;
}

@@ -352,2 +350,15 @@ }

const GLOBAL_TYPES = new WeakMap();
function isGlobalType({
scope
}, name) {
if (scope.hasBinding(name)) return false;
if (GLOBAL_TYPES.get(scope).has(name)) return true;
console.warn(`The exported identifier "${name}" is not declared in Babel's scope tracker\n` + `as a JavaScript value binding, and "@babel/plugin-transform-typescript"\n` + `never encountered it as a TypeScript type declaration.\n` + `It will be treated as a JavaScript value.\n\n` + `This problem is likely caused by another plugin injecting\n` + `"${name}" without registering it in the scope tracker. If you are the author\n` + ` of that plugin, please use "scope.registerDeclaration(declarationPath)".`);
return false;
}
function registerGlobalType(programScope, name) {
GLOBAL_TYPES.get(programScope).add(name);
}
function transpileNamespace(path, allowNamespaces) {

@@ -364,2 +375,4 @@ if (path.node.declare || path.node.id.type === "StringLiteral") {

if (value === null) {
const program = path.findParent(p => p.isProgram());
registerGlobalType(program.scope, name);
path.remove();

@@ -522,16 +535,4 @@ } else if (path.scope.hasOwnBinding(name)) {

}
const GLOBAL_TYPES = new WeakMap();
const NEEDS_EXPLICIT_ESM = new WeakMap();
const PARSED_PARAMS = new WeakSet();
function isGlobalType({
scope
}, name) {
if (scope.hasBinding(name)) return false;
if (GLOBAL_TYPES.get(scope).has(name)) return true;
console.warn(`The exported identifier "${name}" is not declared in Babel's scope tracker\n` + `as a JavaScript value binding, and "@babel/plugin-transform-typescript"\n` + `never encountered it as a TypeScript type declaration.\n` + `It will be treated as a JavaScript value.\n\n` + `This problem is likely caused by another plugin injecting\n` + `"${name}" without registering it in the scope tracker. If you are the author\n` + ` of that plugin, please use "scope.registerDeclaration(declarationPath)".`);
return false;
}
function registerGlobalType(programScope, name) {
GLOBAL_TYPES.get(programScope).add(name);
}
function safeRemove(path) {

@@ -559,3 +560,3 @@ const ids = path.getBindingIdentifiers();

} = api;
api.assertVersion(7);
api.assertVersion("8.0.0-alpha.5");
const JSX_PRAGMA_REGEX = /\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;

@@ -626,3 +627,4 @@ const {

assigns.push(template.statement.ast`
this.${t.cloneNode(id)} = ${t.cloneNode(id)}`);
this.${t.cloneNode(id)} = ${t.cloneNode(id)}
`);
paramPath.replaceWith(paramPath.get("parameter"));

@@ -629,0 +631,0 @@ scope.registerBinding("param", paramPath);

{
"name": "@babel/plugin-transform-typescript",
"version": "8.0.0-alpha.4",
"version": "8.0.0-alpha.5",
"description": "Transform TypeScript into ES.next",

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

"dependencies": {
"@babel/helper-annotate-as-pure": "^8.0.0-alpha.4",
"@babel/helper-create-class-features-plugin": "^8.0.0-alpha.4",
"@babel/helper-plugin-utils": "^8.0.0-alpha.4",
"@babel/plugin-syntax-typescript": "^8.0.0-alpha.4"
"@babel/helper-annotate-as-pure": "^8.0.0-alpha.5",
"@babel/helper-create-class-features-plugin": "^8.0.0-alpha.5",
"@babel/helper-plugin-utils": "^8.0.0-alpha.5",
"@babel/plugin-syntax-typescript": "^8.0.0-alpha.5"
},
"peerDependencies": {
"@babel/core": "^8.0.0-alpha.4"
"@babel/core": "^8.0.0-alpha.5"
},
"devDependencies": {
"@babel/core": "^8.0.0-alpha.4",
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.4",
"@babel/traverse": "^8.0.0-alpha.4",
"@babel/types": "^8.0.0-alpha.4"
"@babel/core": "^8.0.0-alpha.5",
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.5",
"@babel/traverse": "^8.0.0-alpha.5",
"@babel/types": "^8.0.0-alpha.5"
},

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

Sorry, the diff of this file is not supported yet

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