From 4fcf73154bc376323a82841e9904a2e97cdb6982 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Fri, 22 Apr 2022 08:14:59 +0700 Subject: [PATCH] update Babel config --- babel.config.js | 43 ++++++++++++++++++++++++++++++++++++------- package.json | 13 +++++++++++-- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/babel.config.js b/babel.config.js index ebe78f52822a..01b52146c3e6 100644 --- a/babel.config.js +++ b/babel.config.js @@ -2,10 +2,15 @@ module.exports = { // use transforms which does not use ES5+ builtins plugins: [ + ['@babel/proposal-class-static-block'], + // private instance props in IE8- only with polyfills ['@babel/proposal-class-properties'], + ['@babel/proposal-private-methods'], + ['@babel/proposal-private-property-in-object'], ['@babel/proposal-logical-assignment-operators'], ['@babel/proposal-nullish-coalescing-operator'], ['@babel/proposal-numeric-separator'], + ['@babel/proposal-object-rest-spread'], ['@babel/proposal-optional-catch-binding'], ['@babel/proposal-optional-chaining'], ['@babel/transform-member-expression-literals'], @@ -13,17 +18,41 @@ module.exports = { ['@babel/transform-arrow-functions'], ['@babel/transform-block-scoped-functions'], ['@babel/transform-block-scoping'], + // it seems `setClassMethods` unlike `loose` does not work ['@babel/transform-classes', { loose: true }], - ['@babel/transform-computed-properties', { loose: true }], - ['@babel/transform-destructuring', { loose: true }], + ['@babel/transform-computed-properties'], + ['@babel/transform-destructuring'], + ['@babel/transform-exponentiation-operator'], + ['@babel/transform-for-of'], ['@babel/transform-literals'], + ['@babel/transform-new-target'], + ['@babel/transform-object-super'], ['@babel/transform-parameters'], + ['@babel/transform-reserved-words'], ['@babel/transform-shorthand-properties'], - ['@babel/transform-spread', { loose: true }], - ['@babel/transform-template-literals', { loose: true, spec: true }], - ['@babel/transform-exponentiation-operator'], - ['transform-for-of-as-array'], + ['@babel/transform-spread'], + ['@babel/transform-template-literals'], + ['@babel/transform-unicode-regex'], // use it instead of webpack es modules for support engines without descriptors - ['transform-es2015-modules-simple-commonjs'], + ['@babel/transform-modules-commonjs'], ], + assumptions: { + constantReexports: true, + constantSuper: true, + enumerableModuleMeta: true, + iterableIsArray: true, + mutableTemplateObject: true, + noClassCalls: true, + noDocumentAll: true, + noIncompleteNsImportDetection: true, + noNewArrows: true, + objectRestNoSymbols: true, + privateFieldsAsProperties: true, + setClassMethods: true, + setComputedProperties: true, + setPublicClassFields: true, + setSpreadProperties: true, + skipForOfIteratorClosing: true, + superIsCallableConstructor: true, + }, }; diff --git a/package.json b/package.json index 116eed7531c8..a3f3158863ae 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,16 @@ "@babel/cli": "^7.17.6", "@babel/core": "^7.17.9", "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-proposal-class-static-block": "^7.17.6", + "@babel/plugin-proposal-decorators": "^7.17.9", "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", "@babel/plugin-proposal-numeric-separator": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.17.3", "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", "@babel/plugin-proposal-optional-chaining": "^7.16.7", + "@babel/plugin-proposal-private-methods": "^7.16.11", + "@babel/plugin-proposal-private-property-in-object": "^7.16.7", "@babel/plugin-transform-arrow-functions": "^7.16.7", "@babel/plugin-transform-block-scoped-functions": "^7.16.7", "@babel/plugin-transform-block-scoping": "^7.16.7", @@ -16,17 +21,21 @@ "@babel/plugin-transform-computed-properties": "^7.16.7", "@babel/plugin-transform-destructuring": "^7.17.7", "@babel/plugin-transform-exponentiation-operator": "^7.16.7", + "@babel/plugin-transform-for-of": "^7.16.7", "@babel/plugin-transform-literals": "^7.16.7", "@babel/plugin-transform-member-expression-literals": "^7.16.7", + "@babel/plugin-transform-modules-commonjs": "^7.17.9", + "@babel/plugin-transform-new-target": "^7.16.7", + "@babel/plugin-transform-object-super": "^7.16.7", "@babel/plugin-transform-parameters": "^7.16.7", "@babel/plugin-transform-property-literals": "^7.16.7", + "@babel/plugin-transform-reserved-words": "^7.16.7", "@babel/plugin-transform-shorthand-properties": "^7.16.7", "@babel/plugin-transform-spread": "^7.16.7", "@babel/plugin-transform-template-literals": "^7.16.7", + "@babel/plugin-transform-unicode-regex": "^7.16.7", "@onslip/karma-playwright-launcher": "^0.2.1", "babel-loader": "^8.2.5", - "babel-plugin-transform-es2015-modules-simple-commonjs": "~0.3.0", - "babel-plugin-transform-for-of-as-array": "^1.1.1", "confusing-browser-globals": "^1.0.11", "core-js": "file:./packages/core-js", "core-js-builder": "file:./packages/core-js-builder",