@babel/plugin-transform-typescript
Advanced tools
Comparing version 7.24.8 to 7.25.0
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.default = transpileEnum; | ||
exports.isSyntacticallyString = isSyntacticallyString; | ||
exports.translateEnumValues = translateEnumValues; | ||
@@ -12,2 +13,3 @@ var _core = require("@babel/core"); | ||
var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure"); | ||
var _helperSkipTransparentExpressionWrappers = require("@babel/helper-skip-transparent-expression-wrappers"); | ||
const ENUMS = new WeakMap(); | ||
@@ -87,3 +89,3 @@ const buildEnumWrapper = _core.template.expression(` | ||
} = translateEnumValues(path, t); | ||
const assignments = x.map(([memberName, memberValue]) => buildEnumMember(t.isStringLiteral(memberValue), { | ||
const assignments = x.map(([memberName, memberValue]) => buildEnumMember(isSyntacticallyString(memberValue), { | ||
ENUM: t.cloneNode(id), | ||
@@ -102,2 +104,17 @@ NAME: memberName, | ||
} | ||
function isSyntacticallyString(expr) { | ||
expr = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes)(expr); | ||
switch (expr.type) { | ||
case "BinaryExpression": | ||
{ | ||
const left = expr.left; | ||
const right = expr.right; | ||
return expr.operator === "+" && (isSyntacticallyString(left) || isSyntacticallyString(right)); | ||
} | ||
case "TemplateLiteral": | ||
case "StringLiteral": | ||
return true; | ||
} | ||
return false; | ||
} | ||
function ReferencedIdentifier(expr, state) { | ||
@@ -104,0 +121,0 @@ const { |
{ | ||
"name": "@babel/plugin-transform-typescript", | ||
"version": "7.24.8", | ||
"version": "7.25.0", | ||
"description": "Transform TypeScript into ES.next", | ||
@@ -21,4 +21,5 @@ "repository": { | ||
"@babel/helper-annotate-as-pure": "^7.24.7", | ||
"@babel/helper-create-class-features-plugin": "^7.24.8", | ||
"@babel/helper-create-class-features-plugin": "^7.25.0", | ||
"@babel/helper-plugin-utils": "^7.24.8", | ||
"@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", | ||
"@babel/plugin-syntax-typescript": "^7.24.7" | ||
@@ -30,6 +31,6 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "^7.24.8", | ||
"@babel/core": "^7.24.9", | ||
"@babel/helper-plugin-test-runner": "^7.24.7", | ||
"@babel/traverse": "^7.24.8", | ||
"@babel/types": "^7.24.8" | ||
"@babel/traverse": "^7.25.0", | ||
"@babel/types": "^7.25.0" | ||
}, | ||
@@ -36,0 +37,0 @@ "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-typescript", |
@@ -23,2 +23,5 @@ /* This file is automatically generated by scripts/generators/tsconfig.js */ | ||
{ | ||
"path": "../../packages/babel-helper-skip-transparent-expression-wrappers" | ||
}, | ||
{ | ||
"path": "../../packages/babel-plugin-syntax-typescript" | ||
@@ -25,0 +28,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199729
1069
6