Просмотр исходного кода

feat(build) use core-js to polyfill modern JavaScript features

This should prevent us accidentally breaking compatibility with older
browsers because polyfilling happens automatically based on usage
detection.
factor2
Saúl Ibarra Corretgé 4 месяцев назад
Родитель
Сommit
c27ca779ab

+ 0
- 4
app.js Просмотреть файл

1
 /* Jitsi Meet app main entrypoint. */
1
 /* Jitsi Meet app main entrypoint. */
2
 
2
 
3
-// Polyfill Promise.withReolvers.
4
-// FIXME(saghul) webpack + core-js v3 should polyfill this.
5
-import 'promise.withresolvers/auto';
6
-
7
 // Re-export jQuery
3
 // Re-export jQuery
8
 // FIXME: Remove this requirement from torture tests.
4
 // FIXME: Remove this requirement from torture tests.
9
 import $ from 'jquery';
5
 import $ from 'jquery';

+ 19
- 0
package-lock.json Просмотреть файл

168
         "babel-plugin-optional-require": "0.3.1",
168
         "babel-plugin-optional-require": "0.3.1",
169
         "circular-dependency-plugin": "5.2.0",
169
         "circular-dependency-plugin": "5.2.0",
170
         "clean-css-cli": "4.3.0",
170
         "clean-css-cli": "4.3.0",
171
+        "core-js": "3.40.0",
171
         "css-loader": "6.8.1",
172
         "css-loader": "6.8.1",
172
         "eslint": "8.57.0",
173
         "eslint": "8.57.0",
173
         "eslint-plugin-import": "2.31.0",
174
         "eslint-plugin-import": "2.31.0",
11091
         "toggle-selection": "^1.0.6"
11092
         "toggle-selection": "^1.0.6"
11092
       }
11093
       }
11093
     },
11094
     },
11095
+    "node_modules/core-js": {
11096
+      "version": "3.40.0",
11097
+      "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.40.0.tgz",
11098
+      "integrity": "sha512-7vsMc/Lty6AGnn7uFpYT56QesI5D2Y/UkgKounk87OP9Z2H9Z8kj6jzcSGAxFmUtDOS0ntK6lbQz+Nsa0Jj6mQ==",
11099
+      "dev": true,
11100
+      "hasInstallScript": true,
11101
+      "license": "MIT",
11102
+      "funding": {
11103
+        "type": "opencollective",
11104
+        "url": "https://opencollective.com/core-js"
11105
+      }
11106
+    },
11094
     "node_modules/core-js-compat": {
11107
     "node_modules/core-js-compat": {
11095
       "version": "3.38.1",
11108
       "version": "3.38.1",
11096
       "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz",
11109
       "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz",
33571
         "toggle-selection": "^1.0.6"
33584
         "toggle-selection": "^1.0.6"
33572
       }
33585
       }
33573
     },
33586
     },
33587
+    "core-js": {
33588
+      "version": "3.40.0",
33589
+      "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.40.0.tgz",
33590
+      "integrity": "sha512-7vsMc/Lty6AGnn7uFpYT56QesI5D2Y/UkgKounk87OP9Z2H9Z8kj6jzcSGAxFmUtDOS0ntK6lbQz+Nsa0Jj6mQ==",
33591
+      "dev": true
33592
+    },
33574
     "core-js-compat": {
33593
     "core-js-compat": {
33575
       "version": "3.38.1",
33594
       "version": "3.38.1",
33576
       "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz",
33595
       "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz",

+ 1
- 0
package.json Просмотреть файл

174
     "babel-plugin-optional-require": "0.3.1",
174
     "babel-plugin-optional-require": "0.3.1",
175
     "circular-dependency-plugin": "5.2.0",
175
     "circular-dependency-plugin": "5.2.0",
176
     "clean-css-cli": "4.3.0",
176
     "clean-css-cli": "4.3.0",
177
+    "core-js": "3.40.0",
177
     "css-loader": "6.8.1",
178
     "css-loader": "6.8.1",
178
     "eslint": "8.57.0",
179
     "eslint": "8.57.0",
179
     "eslint-plugin-import": "2.31.0",
180
     "eslint-plugin-import": "2.31.0",

+ 2
- 2
react/features/stream-effects/virtual-background/index.ts Просмотреть файл

6
 import logger from '../../virtual-background/logger';
6
 import logger from '../../virtual-background/logger';
7
 
7
 
8
 import JitsiStreamBackgroundEffect, { IBackgroundEffectOptions } from './JitsiStreamBackgroundEffect';
8
 import JitsiStreamBackgroundEffect, { IBackgroundEffectOptions } from './JitsiStreamBackgroundEffect';
9
-// @ts-expect-error
9
+// @ts-ignore
10
 import createTFLiteModule from './vendor/tflite/tflite';
10
 import createTFLiteModule from './vendor/tflite/tflite';
11
-// @ts-expect-error
11
+// @ts-ignore
12
 import createTFLiteSIMDModule from './vendor/tflite/tflite-simd';
12
 import createTFLiteSIMDModule from './vendor/tflite/tflite-simd';
13
 const models = {
13
 const models = {
14
     modelLandscape: 'libs/selfie_segmentation_landscape.tflite'
14
     modelLandscape: 'libs/selfie_segmentation_landscape.tflite'

+ 2
- 6
react/features/stream-effects/virtual-background/vendor/tflite/tflite-simd.js Просмотреть файл

13
 }
13
 }
14
 );
14
 );
15
 })();
15
 })();
16
-if (typeof exports === 'object' && typeof module === 'object')
17
-  module.exports = createTFLiteSIMDModule;
18
-else if (typeof define === 'function' && define['amd'])
19
-  define([], function() { return createTFLiteSIMDModule; });
20
-else if (typeof exports === 'object')
21
-  exports["createTFLiteSIMDModule"] = createTFLiteSIMDModule;
16
+
17
+export default createTFLiteSIMDModule;

+ 2
- 6
react/features/stream-effects/virtual-background/vendor/tflite/tflite.js Просмотреть файл

13
 }
13
 }
14
 );
14
 );
15
 })();
15
 })();
16
-if (typeof exports === 'object' && typeof module === 'object')
17
-  module.exports = createTFLiteModule;
18
-else if (typeof define === 'function' && define['amd'])
19
-  define([], function() { return createTFLiteModule; });
20
-else if (typeof exports === 'object')
21
-  exports["createTFLiteModule"] = createTFLiteModule;
16
+
17
+export default createTFLiteModule;

+ 11
- 2
webpack.config.js Просмотреть файл

126
                                     electron: 10,
126
                                     electron: 10,
127
                                     firefox: 68,
127
                                     firefox: 68,
128
                                     safari: 14
128
                                     safari: 14
129
-                                }
129
+                                },
130
 
130
 
131
+                                // Consider stage 3 proposals which are implemented by some browsers already.
132
+                                shippedProposals: true,
133
+
134
+                                // Detect usage of modern JavaScript features and automatically polyfill them
135
+                                // with core-js.
136
+                                useBuiltIns: 'usage',
137
+
138
+                                // core-js version to use, must be in sync with the version in package.json.
139
+                                corejs: '3.40'
131
                             }
140
                             }
132
                         ],
141
                         ],
133
                         require.resolve('@babel/preset-react')
142
                         require.resolve('@babel/preset-react')
338
                 ...config.plugins,
347
                 ...config.plugins,
339
                 ...getBundleAnalyzerPlugin(analyzeBundle, 'external_api')
348
                 ...getBundleAnalyzerPlugin(analyzeBundle, 'external_api')
340
             ],
349
             ],
341
-            performance: getPerformanceHints(perfHintOptions, 40 * 1024)
350
+            performance: getPerformanceHints(perfHintOptions, 85 * 1024)
342
         }),
351
         }),
343
         Object.assign({}, config, {
352
         Object.assign({}, config, {
344
             entry: {
353
             entry: {

Загрузка…
Отмена
Сохранить