@babel/preset-typescript
Advanced tools
Comparing version 7.12.7 to 7.12.13
@@ -1,36 +0,51 @@ | ||
"use strict"; | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var helperPluginUtils = require('@babel/helper-plugin-utils'); | ||
var transformTypeScript = require('@babel/plugin-transform-typescript'); | ||
var helperValidatorOption = require('@babel/helper-validator-option'); | ||
var _pluginTransformTypescript = _interopRequireDefault(require("@babel/plugin-transform-typescript")); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var _helperValidatorOption = require("@babel/helper-validator-option"); | ||
var transformTypeScript__default = /*#__PURE__*/_interopDefaultLegacy(transformTypeScript); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const v = new helperValidatorOption.OptionValidator("@babel/preset-typescript"); | ||
function normalizeOptions(options = {}) { | ||
let { | ||
allowNamespaces, | ||
jsxPragma, | ||
onlyRemoveTypeImports | ||
} = options; | ||
const jsxPragmaFrag = v.validateStringOption("jsxPragmaFrag", options.jsxPragmaFrag, "React.Fragment"); | ||
const allExtensions = v.validateBooleanOption("allExtensions", options.allExtensions, false); | ||
const isTSX = v.validateBooleanOption("isTSX", options.isTSX, false); | ||
const v = new _helperValidatorOption.OptionValidator("@babel/preset-typescript"); | ||
if (isTSX) { | ||
v.invariant(allExtensions, "isTSX:true requires allExtensions:true"); | ||
} | ||
var _default = (0, _helperPluginUtils.declare)((api, opts) => { | ||
return { | ||
allExtensions, | ||
allowNamespaces, | ||
isTSX, | ||
jsxPragma, | ||
jsxPragmaFrag, | ||
onlyRemoveTypeImports | ||
}; | ||
} | ||
var index = helperPluginUtils.declare((api, opts) => { | ||
api.assertVersion(7); | ||
const { | ||
allowDeclareFields, | ||
allExtensions, | ||
allowNamespaces, | ||
isTSX, | ||
jsxPragma, | ||
jsxPragmaFrag, | ||
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); | ||
} = normalizeOptions(opts); | ||
if (isTSX) { | ||
v.invariant(allExtensions, "isTSX:true requires allExtensions:true"); | ||
} | ||
const pluginOptions = isTSX => ({ | ||
allowDeclareFields, | ||
allowDeclareFields: opts.allowDeclareFields, | ||
allowNamespaces, | ||
@@ -45,9 +60,9 @@ isTSX, | ||
overrides: allExtensions ? [{ | ||
plugins: [[_pluginTransformTypescript.default, pluginOptions(isTSX)]] | ||
plugins: [[transformTypeScript__default['default'], pluginOptions(isTSX)]] | ||
}] : [{ | ||
test: /\.ts$/, | ||
plugins: [[_pluginTransformTypescript.default, pluginOptions(false)]] | ||
plugins: [[transformTypeScript__default['default'], pluginOptions(false)]] | ||
}, { | ||
test: /\.tsx$/, | ||
plugins: [[_pluginTransformTypescript.default, pluginOptions(true)]] | ||
plugins: [[transformTypeScript__default['default'], pluginOptions(true)]] | ||
}] | ||
@@ -57,2 +72,3 @@ }; | ||
exports.default = _default; | ||
exports.default = index; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/preset-typescript", | ||
"version": "7.12.7", | ||
"version": "7.12.13", | ||
"description": "Babel preset for TypeScript.", | ||
@@ -20,5 +20,5 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.10.4", | ||
"@babel/helper-validator-option": "^7.12.1", | ||
"@babel/plugin-transform-typescript": "^7.12.1" | ||
"@babel/helper-plugin-utils": "^7.12.13", | ||
"@babel/helper-validator-option": "^7.12.11", | ||
"@babel/plugin-transform-typescript": "^7.12.13" | ||
}, | ||
@@ -29,5 +29,7 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "7.12.7", | ||
"@babel/helper-plugin-test-runner": "7.10.4" | ||
} | ||
"@babel/core": "7.12.13", | ||
"@babel/helper-plugin-test-runner": "7.12.13" | ||
}, | ||
"homepage": "https://babel.dev/docs/en/next/babel-preset-typescript", | ||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20typescript%22+is%3Aopen" | ||
} |
9687
5
61