@babel/preset-typescript
Advanced tools
Comparing version 7.12.1 to 7.12.7
@@ -12,31 +12,24 @@ "use strict"; | ||
var _helperValidatorOption = require("@babel/helper-validator-option"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = (0, _helperPluginUtils.declare)((api, { | ||
allExtensions = false, | ||
allowDeclareFields, | ||
allowNamespaces, | ||
jsxPragma, | ||
jsxPragmaFrag = "React.Fragment", | ||
isTSX = false, | ||
onlyRemoveTypeImports | ||
}) => { | ||
const v = new _helperValidatorOption.OptionValidator("@babel/preset-typescript"); | ||
var _default = (0, _helperPluginUtils.declare)((api, opts) => { | ||
api.assertVersion(7); | ||
const { | ||
allowDeclareFields, | ||
allowNamespaces, | ||
jsxPragma, | ||
onlyRemoveTypeImports | ||
} = opts; | ||
const jsxPragmaFrag = v.validateStringOption("jsxPragmaFrag", opts.jsxPragmaFrag, "React.Fragment"); | ||
const allExtensions = v.validateBooleanOption("allExtensions", opts.allExtensions, false); | ||
const isTSX = v.validateBooleanOption("isTSX", opts.isTSX, false); | ||
if (typeof jsxPragmaFrag !== "string") { | ||
throw new Error(".jsxPragmaFrag must be a string, or undefined"); | ||
if (isTSX) { | ||
v.invariant(allExtensions, "isTSX:true requires allExtensions:true"); | ||
} | ||
if (typeof allExtensions !== "boolean") { | ||
throw new Error(".allExtensions must be a boolean, or undefined"); | ||
} | ||
if (typeof isTSX !== "boolean") { | ||
throw new Error(".isTSX must be a boolean, or undefined"); | ||
} | ||
if (isTSX && !allExtensions) { | ||
throw new Error("isTSX:true requires allExtensions:true"); | ||
} | ||
const pluginOptions = isTSX => ({ | ||
@@ -43,0 +36,0 @@ allowDeclareFields, |
{ | ||
"name": "@babel/preset-typescript", | ||
"version": "7.12.1", | ||
"version": "7.12.7", | ||
"description": "Babel preset for TypeScript.", | ||
@@ -21,2 +21,3 @@ "repository": { | ||
"@babel/helper-plugin-utils": "^7.10.4", | ||
"@babel/helper-validator-option": "^7.12.1", | ||
"@babel/plugin-transform-typescript": "^7.12.1" | ||
@@ -28,5 +29,5 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.1", | ||
"@babel/core": "7.12.7", | ||
"@babel/helper-plugin-test-runner": "7.10.4" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # @babel/preset-typescript | ||
See our website [@babel/preset-typescript](https://babeljs.io/docs/en/next/babel-preset-typescript.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20typescript%22+is%3Aopen) associated with this package. | ||
See our website [@babel/preset-typescript](https://babeljs.io/docs/en/babel-preset-typescript) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20typescript%22+is%3Aopen) associated with this package. | ||
@@ -8,0 +8,0 @@ ## Install |
3959
4
44