mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Make babel understand TypeScript 3.7 syntax (#50772)
* Use correct babel plugins * Make one change using new operator * Fix i18n babel config
This commit is contained in:
parent
18cb01ac2d
commit
bbb9421678
5 changed files with 50 additions and 2 deletions
|
@ -27,6 +27,13 @@ const plugins = [
|
|||
//
|
||||
// See https://github.com/babel/proposals/issues/12 for progress
|
||||
require.resolve('@babel/plugin-proposal-class-properties'),
|
||||
|
||||
// Optional Chaining proposal is stage 3 (https://github.com/tc39/proposal-optional-chaining)
|
||||
// Need this since we are using TypeScript 3.7+
|
||||
require.resolve('@babel/plugin-proposal-optional-chaining'),
|
||||
// Nullish coalescing proposal is stage 3 (https://github.com/tc39/proposal-nullish-coalescing)
|
||||
// Need this since we are using TypeScript 3.7+
|
||||
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
|
||||
];
|
||||
const isTestEnv = process.env.BABEL_ENV === 'test' || process.env.NODE_ENV === 'test';
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "^7.5.1",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
|
||||
"@babel/preset-env": "^7.5.5",
|
||||
|
|
|
@ -67,7 +67,16 @@ export function* extractCodeMessages(buffer, reporter) {
|
|||
try {
|
||||
ast = parse(buffer.toString(), {
|
||||
sourceType: 'module',
|
||||
plugins: ['jsx', 'typescript', 'objectRestSpread', 'classProperties', 'asyncGenerators', 'dynamicImport'],
|
||||
plugins: [
|
||||
'jsx',
|
||||
'typescript',
|
||||
'objectRestSpread',
|
||||
'classProperties',
|
||||
'asyncGenerators',
|
||||
'dynamicImport',
|
||||
'nullishCoalescingOperator',
|
||||
'optionalChaining',
|
||||
],
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof SyntaxError) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class RequestAdapter extends EventEmitter {
|
|||
name,
|
||||
startTime: Date.now(),
|
||||
status: RequestStatus.PENDING,
|
||||
id: _.get(params, 'id', uuid()),
|
||||
id: params.id ?? uuid(),
|
||||
};
|
||||
this.requests.set(req.id, req);
|
||||
this._onChange();
|
||||
|
|
30
yarn.lock
30
yarn.lock
|
@ -346,6 +346,14 @@
|
|||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
"@babel/plugin-syntax-json-strings" "^7.2.0"
|
||||
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator@^7.4.4":
|
||||
version "7.4.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.4.4.tgz#41c360d59481d88e0ce3a3f837df10121a769b39"
|
||||
integrity sha512-Amph7Epui1Dh/xxUxS2+K22/MUi6+6JVTvy3P58tja3B6yKTSjwwx0/d83rF7551D6PVSSoplQb8GCwqec7HRw==
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator" "^7.2.0"
|
||||
|
||||
"@babel/plugin-proposal-object-rest-spread@7.5.5", "@babel/plugin-proposal-object-rest-spread@^7.3.2", "@babel/plugin-proposal-object-rest-spread@^7.5.5":
|
||||
version "7.5.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58"
|
||||
|
@ -362,6 +370,14 @@
|
|||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
"@babel/plugin-syntax-optional-catch-binding" "^7.2.0"
|
||||
|
||||
"@babel/plugin-proposal-optional-chaining@^7.6.0":
|
||||
version "7.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.6.0.tgz#e9bf1f9b9ba10c77c033082da75f068389041af8"
|
||||
integrity sha512-kj4gkZ6qUggkprRq3Uh5KP8XnE1MdIO0J7MhdDX8+rAbB6dJ2UrensGIS+0NPZAaaJ1Vr0PN6oLUgXMU1uMcSg==
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
"@babel/plugin-syntax-optional-chaining" "^7.2.0"
|
||||
|
||||
"@babel/plugin-proposal-unicode-property-regex@^7.4.4":
|
||||
version "7.4.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78"
|
||||
|
@ -413,6 +429,13 @@
|
|||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator@^7.2.0":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.2.0.tgz#f75083dfd5ade73e783db729bbd87e7b9efb7624"
|
||||
integrity sha512-lRCEaKE+LTxDQtgbYajI04ddt6WW0WJq57xqkAZ+s11h4YgfRHhVA/Y2VhfPzzFD4qeLHWg32DMp9HooY4Kqlg==
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e"
|
||||
|
@ -427,6 +450,13 @@
|
|||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
"@babel/plugin-syntax-optional-chaining@^7.2.0":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.2.0.tgz#a59d6ae8c167e7608eaa443fda9fa8fa6bf21dff"
|
||||
integrity sha512-HtGCtvp5Uq/jH/WNUPkK6b7rufnCPLLlDAFN7cmACoIjaOOiXxUt3SswU5loHqrhtqTsa/WoLQ1OQ1AGuZqaWA==
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
"@babel/plugin-syntax-typescript@^7.2.0":
|
||||
version "7.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz#a7cc3f66119a9f7ebe2de5383cce193473d65991"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue