Allow setting 'allowNamespaces' in typescript preset (#10382)
* Support 'allowNamespaces' in typescript preset * Remove default for allowNamespaces
This commit is contained in:
parent
e7fa566442
commit
e5afa57cca
@ -2,7 +2,10 @@ import { declare } from "@babel/helper-plugin-utils";
|
|||||||
import transformTypeScript from "@babel/plugin-transform-typescript";
|
import transformTypeScript from "@babel/plugin-transform-typescript";
|
||||||
|
|
||||||
export default declare(
|
export default declare(
|
||||||
(api, { jsxPragma, allExtensions = false, isTSX = false }) => {
|
(
|
||||||
|
api,
|
||||||
|
{ jsxPragma, allExtensions = false, isTSX = false, allowNamespaces },
|
||||||
|
) => {
|
||||||
api.assertVersion(7);
|
api.assertVersion(7);
|
||||||
|
|
||||||
if (typeof allExtensions !== "boolean") {
|
if (typeof allExtensions !== "boolean") {
|
||||||
@ -20,7 +23,9 @@ export default declare(
|
|||||||
overrides: allExtensions
|
overrides: allExtensions
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
plugins: [[transformTypeScript, { jsxPragma, isTSX }]],
|
plugins: [
|
||||||
|
[transformTypeScript, { jsxPragma, isTSX, allowNamespaces }],
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
@ -28,13 +33,18 @@ export default declare(
|
|||||||
// Only set 'test' if explicitly requested, since it requires that
|
// Only set 'test' if explicitly requested, since it requires that
|
||||||
// Babel is being called`
|
// Babel is being called`
|
||||||
test: /\.ts$/,
|
test: /\.ts$/,
|
||||||
plugins: [[transformTypeScript, { jsxPragma }]],
|
plugins: [[transformTypeScript, { jsxPragma, allowNamespaces }]],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Only set 'test' if explicitly requested, since it requires that
|
// Only set 'test' if explicitly requested, since it requires that
|
||||||
// Babel is being called`
|
// Babel is being called`
|
||||||
test: /\.tsx$/,
|
test: /\.tsx$/,
|
||||||
plugins: [[transformTypeScript, { jsxPragma, isTSX: true }]],
|
plugins: [
|
||||||
|
[
|
||||||
|
transformTypeScript,
|
||||||
|
{ jsxPragma, isTSX: true, allowNamespaces },
|
||||||
|
],
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user