瀏覽代碼

feat(deps) replace lodash with lodash-es

The latter supports tree-shaking and we don't need to embed the whole
500KB of lodash.
factor2
Saúl Ibarra Corretgé 1 年之前
父節點
當前提交
b35200648c
共有 34 個檔案被更改,包括 121 行新增104 行删除
  1. 34
    4
      package-lock.json
  2. 2
    2
      package.json
  3. 2
    2
      react/features/base/app/components/BaseApp.tsx
  4. 2
    2
      react/features/base/avatar/functions.ts
  5. 3
    3
      react/features/base/conference/functions.ts
  6. 6
    8
      react/features/base/config/functions.any.ts
  7. 4
    4
      react/features/base/config/reducer.ts
  8. 2
    2
      react/features/base/connection/actions.any.ts
  9. 3
    3
      react/features/base/flags/reducer.ts
  10. 2
    2
      react/features/base/i18n/i18next.ts
  11. 2
    2
      react/features/base/logging/functions.ts
  12. 2
    2
      react/features/base/logging/reducer.ts
  13. 3
    3
      react/features/base/participants/subscriber.ts
  14. 2
    2
      react/features/base/redux/functions.ts
  15. 2
    5
      react/features/base/redux/middleware.ts
  16. 3
    3
      react/features/base/settings/middleware.any.ts
  17. 3
    3
      react/features/base/settings/reducer.ts
  18. 2
    2
      react/features/base/tracks/subscriber.ts
  19. 2
    2
      react/features/base/util/isInsecureRoomName.ts
  20. 3
    3
      react/features/breakout-rooms/actions.ts
  21. 3
    3
      react/features/breakout-rooms/functions.ts
  22. 3
    3
      react/features/conference/components/web/Conference.tsx
  23. 2
    2
      react/features/connection-indicator/statsEmitter.ts
  24. 2
    2
      react/features/filmstrip/components/web/Filmstrip.tsx
  25. 4
    4
      react/features/follow-me/middleware.ts
  26. 7
    7
      react/features/invite/components/add-people-dialog/native/AddPeopleDialog.tsx
  27. 2
    2
      react/features/mobile/audio-mode/components/AudioRoutePickerDialog.tsx
  28. 2
    2
      react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts
  29. 3
    3
      react/features/speaker-stats/functions.ts
  30. 3
    11
      react/features/speaker-stats/reducer.ts
  31. 2
    2
      react/features/toolbox/components/HangupButton.ts
  32. 1
    1
      react/features/toolbox/subscriber.web.ts
  33. 2
    2
      react/features/video-menu/components/native/VolumeSlider.tsx
  34. 1
    1
      react/features/visitors/components/web/JoinMeetingDialog.tsx

+ 34
- 4
package-lock.json 查看文件

@@ -62,7 +62,7 @@
62 62
         "js-sha512": "0.8.0",
63 63
         "jwt-decode": "2.2.0",
64 64
         "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1847.0.0+03eef6de/lib-jitsi-meet.tgz",
65
-        "lodash": "4.17.21",
65
+        "lodash-es": "4.17.21",
66 66
         "moment": "2.29.4",
67 67
         "moment-duration-format": "2.2.2",
68 68
         "null-loader": "4.0.1",
@@ -132,7 +132,7 @@
132 132
         "@types/audioworklet": "0.0.29",
133 133
         "@types/dom-screen-wake-lock": "1.0.1",
134 134
         "@types/js-md5": "0.4.3",
135
-        "@types/lodash": "4.14.182",
135
+        "@types/lodash-es": "4.17.12",
136 136
         "@types/moment-duration-format": "2.2.6",
137 137
         "@types/offscreencanvas": "2019.7.2",
138 138
         "@types/pixelmatch": "5.2.5",
@@ -6254,6 +6254,15 @@
6254 6254
       "integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==",
6255 6255
       "dev": true
6256 6256
     },
6257
+    "node_modules/@types/lodash-es": {
6258
+      "version": "4.17.12",
6259
+      "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz",
6260
+      "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==",
6261
+      "dev": true,
6262
+      "dependencies": {
6263
+        "@types/lodash": "*"
6264
+      }
6265
+    },
6257 6266
     "node_modules/@types/long": {
6258 6267
       "version": "4.0.1",
6259 6268
       "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
@@ -12824,7 +12833,13 @@
12824 12833
     "node_modules/lodash": {
12825 12834
       "version": "4.17.21",
12826 12835
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
12827
-      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
12836
+      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
12837
+      "dev": true
12838
+    },
12839
+    "node_modules/lodash-es": {
12840
+      "version": "4.17.21",
12841
+      "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
12842
+      "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
12828 12843
     },
12829 12844
     "node_modules/lodash.clonedeep": {
12830 12845
       "version": "4.5.0",
@@ -23404,6 +23419,15 @@
23404 23419
       "integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==",
23405 23420
       "dev": true
23406 23421
     },
23422
+    "@types/lodash-es": {
23423
+      "version": "4.17.12",
23424
+      "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz",
23425
+      "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==",
23426
+      "dev": true,
23427
+      "requires": {
23428
+        "@types/lodash": "*"
23429
+      }
23430
+    },
23407 23431
     "@types/long": {
23408 23432
       "version": "4.0.1",
23409 23433
       "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
@@ -28254,7 +28278,13 @@
28254 28278
     "lodash": {
28255 28279
       "version": "4.17.21",
28256 28280
       "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
28257
-      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
28281
+      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
28282
+      "dev": true
28283
+    },
28284
+    "lodash-es": {
28285
+      "version": "4.17.21",
28286
+      "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
28287
+      "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
28258 28288
     },
28259 28289
     "lodash.clonedeep": {
28260 28290
       "version": "4.5.0",

+ 2
- 2
package.json 查看文件

@@ -68,7 +68,7 @@
68 68
     "js-sha512": "0.8.0",
69 69
     "jwt-decode": "2.2.0",
70 70
     "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1847.0.0+03eef6de/lib-jitsi-meet.tgz",
71
-    "lodash": "4.17.21",
71
+    "lodash-es": "4.17.21",
72 72
     "moment": "2.29.4",
73 73
     "moment-duration-format": "2.2.2",
74 74
     "null-loader": "4.0.1",
@@ -138,7 +138,7 @@
138 138
     "@types/audioworklet": "0.0.29",
139 139
     "@types/dom-screen-wake-lock": "1.0.1",
140 140
     "@types/js-md5": "0.4.3",
141
-    "@types/lodash": "4.14.182",
141
+    "@types/lodash-es": "4.17.12",
142 142
     "@types/moment-duration-format": "2.2.6",
143 143
     "@types/offscreencanvas": "2019.7.2",
144 144
     "@types/pixelmatch": "5.2.5",

+ 2
- 2
react/features/base/app/components/BaseApp.tsx 查看文件

@@ -1,6 +1,6 @@
1 1
 // @ts-expect-error
2 2
 import { jitsiLocalStorage } from '@jitsi/js-utils';
3
-import _ from 'lodash';
3
+import { isEqual } from 'lodash-es';
4 4
 import React, { Component, ComponentType, Fragment } from 'react';
5 5
 import { I18nextProvider } from 'react-i18next';
6 6
 import { Provider } from 'react-redux';
@@ -254,7 +254,7 @@ export default class BaseApp<P> extends Component<P, IState> {
254 254
         href?: string;
255 255
         props?: Object;
256 256
     }): Promise<any> {
257
-        if (_.isEqual(route, this.state.route)) {
257
+        if (isEqual(route, this.state.route)) {
258 258
             return Promise.resolve();
259 259
         }
260 260
 

+ 2
- 2
react/features/base/avatar/functions.ts 查看文件

@@ -1,5 +1,5 @@
1 1
 import GraphemeSplitter from 'grapheme-splitter';
2
-import _ from 'lodash';
2
+import { split } from 'lodash-es';
3 3
 
4 4
 const AVATAR_COLORS = [
5 5
     '#6A50D3',
@@ -63,7 +63,7 @@ function getFirstGraphemeUpper(word: string) {
63 63
  */
64 64
 export function getInitials(s?: string) {
65 65
     // We don't want to use the domain part of an email address, if it is one
66
-    const initialsBasis = _.split(s, '@')[0];
66
+    const initialsBasis = split(s, '@')[0];
67 67
     const [ firstWord, secondWord ] = initialsBasis.split(wordSplitRegex).filter(Boolean);
68 68
 
69 69
     return getFirstGraphemeUpper(firstWord) + getFirstGraphemeUpper(secondWord);

+ 3
- 3
react/features/base/conference/functions.ts 查看文件

@@ -1,5 +1,5 @@
1 1
 import { sha512_256 as sha512 } from 'js-sha512';
2
-import _ from 'lodash';
2
+import { upperFirst, words } from 'lodash-es';
3 3
 
4 4
 import { getName } from '../../app/functions';
5 5
 import { IReduxState, IStore } from '../../app/types';
@@ -571,7 +571,7 @@ export function sendLocalParticipant(
571 571
  * @returns {string}
572 572
  */
573 573
 function safeStartCase(s = '') {
574
-    return _.words(`${s}`.replace(/['\u2019]/g, '')).reduce(
575
-        (result, word, index) => result + (index ? ' ' : '') + _.upperFirst(word)
574
+    return words(`${s}`.replace(/['\u2019]/g, '')).reduce(
575
+        (result, word, index) => result + (index ? ' ' : '') + upperFirst(word)
576 576
         , '');
577 577
 }

+ 6
- 8
react/features/base/config/functions.any.ts 查看文件

@@ -3,7 +3,7 @@ import { jitsiLocalStorage } from '@jitsi/js-utils';
3 3
 // eslint-disable-next-line lines-around-comment
4 4
 // @ts-ignore
5 5
 import { safeJsonParse } from '@jitsi/js-utils/json';
6
-import _ from 'lodash';
6
+import { isEmpty, mergeWith, pick } from 'lodash-es';
7 7
 
8 8
 import { IReduxState } from '../../app/types';
9 9
 import { getLocalParticipant } from '../participants/functions';
@@ -166,13 +166,11 @@ export function overrideConfigJSON(config: IConfig, interfaceConfig: any, json:
166 166
             const configJSON
167 167
                 = getWhitelistedJSON(configName as 'interfaceConfig' | 'config', json[configName]);
168 168
 
169
-            if (!_.isEmpty(configJSON)) {
170
-                logger.info(
171
-                    `Extending ${configName} with: ${
172
-                        JSON.stringify(configJSON)}`);
169
+            if (!isEmpty(configJSON)) {
170
+                logger.info(`Extending ${configName} with: ${JSON.stringify(configJSON)}`);
173 171
 
174 172
                 // eslint-disable-next-line arrow-body-style
175
-                _.mergeWith(configObj, configJSON, (oldValue, newValue) => {
173
+                mergeWith(configObj, configJSON, (oldValue, newValue) => {
176 174
 
177 175
                     // XXX We don't want to merge the arrays, we want to
178 176
                     // overwrite them.
@@ -196,9 +194,9 @@ export function overrideConfigJSON(config: IConfig, interfaceConfig: any, json:
196 194
  */
197 195
 export function getWhitelistedJSON(configName: 'interfaceConfig' | 'config', configJSON: any): Object {
198 196
     if (configName === 'interfaceConfig') {
199
-        return _.pick(configJSON, INTERFACE_CONFIG_WHITELIST);
197
+        return pick(configJSON, INTERFACE_CONFIG_WHITELIST);
200 198
     } else if (configName === 'config') {
201
-        return _.pick(configJSON, CONFIG_WHITELIST);
199
+        return pick(configJSON, CONFIG_WHITELIST);
202 200
     }
203 201
 
204 202
     return configJSON;

+ 4
- 4
react/features/base/config/reducer.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { merge, union } from 'lodash-es';
2 2
 
3 3
 import { CONFERENCE_INFO } from '../../conference/components/constants';
4 4
 import { TOOLBAR_BUTTONS } from '../../toolbox/constants';
@@ -194,7 +194,7 @@ function _setConfig(state: IConfig, { config }: { config: IConfig; }) {
194 194
         });
195 195
     }
196 196
 
197
-    const newState = _.merge(
197
+    const newState = merge(
198 198
         {},
199 199
         config,
200 200
         hdAudioOptions,
@@ -397,7 +397,7 @@ function _translateLegacyConfig(oldValue: IConfig) {
397 397
                     = (newValue.conferenceInfo?.alwaysVisible ?? [])
398 398
                     .filter(c => !CONFERENCE_HEADER_MAPPING[key].includes(c));
399 399
                 newValue.conferenceInfo.autoHide
400
-                    = _.union(newValue.conferenceInfo.autoHide, CONFERENCE_HEADER_MAPPING[key]);
400
+                    = union(newValue.conferenceInfo.autoHide, CONFERENCE_HEADER_MAPPING[key]);
401 401
             } else {
402 402
                 newValue.conferenceInfo.alwaysVisible
403 403
                     = (newValue.conferenceInfo.alwaysVisible ?? [])
@@ -599,7 +599,7 @@ function _translateLegacyConfig(oldValue: IConfig) {
599 599
  * @returns {Object} The new state after the reduction of the specified action.
600 600
  */
601 601
 function _updateConfig(state: IConfig, { config }: { config: IConfig; }) {
602
-    const newState = _.merge({}, state, config);
602
+    const newState = merge({}, state, config);
603 603
 
604 604
     _cleanupConfig(newState);
605 605
 

+ 2
- 2
react/features/base/connection/actions.any.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { cloneDeep } from 'lodash-es';
2 2
 
3 3
 import { IReduxState, IStore } from '../../app/types';
4 4
 import { conferenceLeft, conferenceWillLeave, redirect } from '../conference/actions';
@@ -113,7 +113,7 @@ export function connectionFailed(
113 113
 export function constructOptions(state: IReduxState) {
114 114
     // Deep clone the options to make sure we don't modify the object in the
115 115
     // redux store.
116
-    const options: IOptions = _.cloneDeep(state['features/base/config']);
116
+    const options: IOptions = cloneDeep(state['features/base/config']);
117 117
 
118 118
     const { locationURL, preferVisitor } = state['features/base/connection'];
119 119
     const params = parseURLParams(locationURL || '');

+ 3
- 3
react/features/base/flags/reducer.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { isEqual, merge } from 'lodash-es';
2 2
 
3 3
 import ReducerRegistry from '../redux/ReducerRegistry';
4 4
 
@@ -25,9 +25,9 @@ export interface IFlagsState {
25 25
 ReducerRegistry.register<IFlagsState>('features/base/flags', (state = DEFAULT_STATE, action): IFlagsState => {
26 26
     switch (action.type) {
27 27
     case UPDATE_FLAGS: {
28
-        const newState = _.merge({}, state, action.flags);
28
+        const newState = merge({}, state, action.flags);
29 29
 
30
-        return _.isEqual(state, newState) ? state : newState;
30
+        return isEqual(state, newState) ? state : newState;
31 31
     }
32 32
     }
33 33
 

+ 2
- 2
react/features/base/i18n/i18next.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import COUNTRIES_RESOURCES from 'i18n-iso-countries/langs/en.json';
2 2
 import i18next from 'i18next';
3 3
 import I18nextXHRBackend, { HttpBackendOptions } from 'i18next-http-backend';
4
-import _ from 'lodash';
4
+import { merge } from 'lodash-es';
5 5
 
6 6
 import LANGUAGES_RESOURCES from '../../../../lang/languages.json';
7 7
 import MAIN_RESOURCES from '../../../../lang/main.json';
@@ -22,7 +22,7 @@ const COUNTRIES_RESOURCES_OVERRIDES = {
22 22
 /**
23 23
  * Merged country names.
24 24
  */
25
-const COUNTRIES = _.merge({}, COUNTRIES_RESOURCES, COUNTRIES_RESOURCES_OVERRIDES);
25
+const COUNTRIES = merge({}, COUNTRIES_RESOURCES, COUNTRIES_RESOURCES_OVERRIDES);
26 26
 
27 27
 /**
28 28
  * The available/supported languages.

+ 2
- 2
react/features/base/logging/functions.ts 查看文件

@@ -1,6 +1,6 @@
1 1
 // @ts-expect-error
2 2
 import Logger, { getLogger as _getLogger } from '@jitsi/logger';
3
-import _ from 'lodash';
3
+import { once } from 'lodash-es';
4 4
 
5 5
 import LogTransport from './LogTransport';
6 6
 
@@ -26,7 +26,7 @@ export function getLogger(id: string) {
26 26
 /**
27 27
  * Initializes native logging. This operations must be done as early as possible.
28 28
  */
29
-export const _initLogging = _.once(() => {
29
+export const _initLogging = once(() => {
30 30
     if (navigator.product !== 'ReactNative') {
31 31
         return;
32 32
     }

+ 2
- 2
react/features/base/logging/reducer.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { merge } from 'lodash-es';
2 2
 import { AnyAction } from 'redux';
3 3
 
4 4
 import ReducerRegistry from '../redux/ReducerRegistry';
@@ -95,7 +95,7 @@ ReducerRegistry.register<ILoggingState>(
95 95
  * reduction of the specified action.
96 96
  */
97 97
 function _setLoggingConfig(state: ILoggingState, action: AnyAction) {
98
-    const newConfig = _.merge({}, DEFAULT_STATE.config, action.config);
98
+    const newConfig = merge({}, DEFAULT_STATE.config, action.config);
99 99
 
100 100
     if (equals(state.config, newConfig)) {
101 101
         return state;

+ 3
- 3
react/features/base/participants/subscriber.ts 查看文件

@@ -1,5 +1,5 @@
1 1
 
2
-import _ from 'lodash';
2
+import { difference } from 'lodash-es';
3 3
 import { batch } from 'react-redux';
4 4
 
5 5
 import { IStore } from '../../app/types';
@@ -64,8 +64,8 @@ function _createOrRemoveVirtualParticipants(
64 64
         store: IStore): void {
65 65
     const { dispatch, getState } = store;
66 66
     const conference = getCurrentConference(getState());
67
-    const removedScreenshareSourceNames = _.difference(oldScreenshareSourceNames, newScreenshareSourceNames);
68
-    const addedScreenshareSourceNames = _.difference(newScreenshareSourceNames, oldScreenshareSourceNames);
67
+    const removedScreenshareSourceNames = difference(oldScreenshareSourceNames, newScreenshareSourceNames);
68
+    const addedScreenshareSourceNames = difference(newScreenshareSourceNames, oldScreenshareSourceNames);
69 69
 
70 70
     if (removedScreenshareSourceNames.length) {
71 71
         removedScreenshareSourceNames.forEach(id => dispatch(participantLeft(id, conference, {

+ 2
- 2
react/features/base/redux/functions.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { isEqual } from 'lodash-es';
2 2
 
3 3
 import { IReduxState, IStore } from '../../app/types';
4 4
 import { IStateful } from '../app/types';
@@ -36,7 +36,7 @@ export function assign<T extends Object>(target: T, source: Partial<T>): T {
36 36
  * comparison); false, otherwise.
37 37
  */
38 38
 export function equals(a: any, b: any) {
39
-    return _.isEqual(a, b);
39
+    return isEqual(a, b);
40 40
 }
41 41
 
42 42
 /**

+ 2
- 5
react/features/base/redux/middleware.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { throttle } from 'lodash-es';
2 2
 
3 3
 import MiddlewareRegistry from './MiddlewareRegistry';
4 4
 import PersistenceRegistry from './PersistenceRegistry';
@@ -13,10 +13,7 @@ const PERSIST_STATE_DELAY = 2000;
13 13
 /**
14 14
  * A throttled function to avoid repetitive state persisting.
15 15
  */
16
-const throttledPersistState
17
-    = _.throttle(
18
-        state => PersistenceRegistry.persistState(state),
19
-        PERSIST_STATE_DELAY);
16
+const throttledPersistState = throttle(state => PersistenceRegistry.persistState(state), PERSIST_STATE_DELAY);
20 17
 
21 18
 // Web only code.
22 19
 // We need the <tt>if</tt> because it appears that on mobile the polyfill is not

+ 3
- 3
react/features/base/settings/middleware.any.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { escape } from 'lodash-es';
2 2
 import { AnyAction } from 'redux';
3 3
 
4 4
 import { IStore } from '../../app/types';
@@ -100,8 +100,8 @@ function _updateLocalParticipantFromUrl({ dispatch, getState }: IStore) {
100 100
     const localParticipant = getLocalParticipant(getState());
101 101
 
102 102
     if (localParticipant) {
103
-        const displayName = _.escape(urlDisplayName);
104
-        const email = _.escape(urlEmail);
103
+        const displayName = escape(urlDisplayName);
104
+        const email = escape(urlEmail);
105 105
 
106 106
         dispatch(participantUpdated({
107 107
             ...localParticipant,

+ 3
- 3
react/features/base/settings/reducer.ts 查看文件

@@ -1,6 +1,6 @@
1 1
 // @ts-expect-error
2 2
 import { jitsiLocalStorage } from '@jitsi/js-utils';
3
-import _ from 'lodash';
3
+import { escape } from 'lodash-es';
4 4
 
5 5
 import { APP_WILL_MOUNT } from '../app/actionTypes';
6 6
 import PersistenceRegistry from '../redux/PersistenceRegistry';
@@ -154,8 +154,8 @@ function _initSettings(featureState: ISettingsState) {
154 154
     // is a defined value, it will override any value found in local storage.
155 155
     // The workaround is sidestepping _.escape when the value is not set in
156 156
     // local storage.
157
-    const displayName = savedDisplayName === null ? undefined : _.escape(savedDisplayName);
158
-    const email = savedEmail === null ? undefined : _.escape(savedEmail);
157
+    const displayName = savedDisplayName === null ? undefined : escape(savedDisplayName);
158
+    const email = savedEmail === null ? undefined : escape(savedEmail);
159 159
 
160 160
     settings = assignIfDefined({
161 161
         displayName,

+ 2
- 2
react/features/base/tracks/subscriber.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { isEqual, sortBy } from 'lodash-es';
2 2
 
3 3
 import { MEDIA_TYPE } from '../media/constants';
4 4
 import { getScreenshareParticipantIds } from '../participants/functions';
@@ -16,7 +16,7 @@ StateListenerRegistry.register(
16 16
             return;
17 17
         }
18 18
 
19
-        if (!_.isEqual(_.sortBy(participantIDs), _.sortBy(previousParticipantIDs))) {
19
+        if (!isEqual(sortBy(participantIDs), sortBy(previousParticipantIDs))) {
20 20
             APP.API.notifySharingParticipantsChanged(participantIDs);
21 21
         }
22 22
     }

+ 2
- 2
react/features/base/util/isInsecureRoomName.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { isEqual } from 'lodash-es';
2 2
 import { NIL, parse as parseUUID } from 'uuid';
3 3
 import zxcvbn from 'zxcvbn';
4 4
 
@@ -22,7 +22,7 @@ function isValidUUID(str: string) {
22 22
         return false;
23 23
     }
24 24
 
25
-    return !_.isEqual(uuid, NIL_UUID);
25
+    return !isEqual(uuid, NIL_UUID);
26 26
 }
27 27
 
28 28
 /**

+ 3
- 3
react/features/breakout-rooms/actions.ts 查看文件

@@ -1,5 +1,5 @@
1 1
 import i18next from 'i18next';
2
-import _ from 'lodash';
2
+import { chunk, filter, shuffle } from 'lodash-es';
3 3
 
4 4
 import { createBreakoutRoomsEvent } from '../analytics/AnalyticsEvents';
5 5
 import { sendAnalytics } from '../analytics/functions';
@@ -129,14 +129,14 @@ export function removeBreakoutRoom(breakoutRoomJid: string) {
129 129
 export function autoAssignToBreakoutRooms() {
130 130
     return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
131 131
         const rooms = getBreakoutRooms(getState);
132
-        const breakoutRooms = _.filter(rooms, room => !room.isMainRoom);
132
+        const breakoutRooms = filter(rooms, room => !room.isMainRoom);
133 133
 
134 134
         if (breakoutRooms) {
135 135
             sendAnalytics(createBreakoutRoomsEvent('auto.assign'));
136 136
             const participantIds = Array.from(getRemoteParticipants(getState).keys());
137 137
             const length = Math.ceil(participantIds.length / breakoutRooms.length);
138 138
 
139
-            _.chunk(_.shuffle(participantIds), length).forEach((group, index) =>
139
+            chunk(shuffle(participantIds), length).forEach((group, index) =>
140 140
                 group.forEach(participantId => {
141 141
                     dispatch(sendParticipantToRoom(participantId, breakoutRooms[index].id));
142 142
                 })

+ 3
- 3
react/features/breakout-rooms/functions.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { find } from 'lodash-es';
2 2
 
3 3
 import { IStateful } from '../base/app/types';
4 4
 import { getCurrentConference } from '../base/conference/functions';
@@ -33,7 +33,7 @@ export const getBreakoutRooms = (stateful: IStateful): IRooms => toState(statefu
33 33
 export const getMainRoom = (stateful: IStateful) => {
34 34
     const rooms = getBreakoutRooms(stateful);
35 35
 
36
-    return _.find(rooms, room => Boolean(room.isMainRoom));
36
+    return find(rooms, room => Boolean(room.isMainRoom));
37 37
 };
38 38
 
39 39
 /**
@@ -135,7 +135,7 @@ export const getRoomsInfo = (stateful: IStateful) => {
135 135
 export const getRoomByJid = (stateful: IStateful, roomJid: string) => {
136 136
     const rooms = getBreakoutRooms(stateful);
137 137
 
138
-    return _.find(rooms, (room: IRoom) => room.jid === roomJid);
138
+    return find(rooms, (room: IRoom) => room.jid === roomJid);
139 139
 };
140 140
 
141 141
 /**

+ 3
- 3
react/features/conference/components/web/Conference.tsx 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { throttle } from 'lodash-es';
2 2
 import React from 'react';
3 3
 import { WithTranslation } from 'react-i18next';
4 4
 import { connect as reactReduxConnect } from 'react-redux';
@@ -133,7 +133,7 @@ class Conference extends AbstractConference<IProps, any> {
133 133
         this._originalOnShowToolbar = this._onShowToolbar;
134 134
         this._originalOnMouseMove = this._onMouseMove;
135 135
 
136
-        this._onShowToolbar = _.throttle(
136
+        this._onShowToolbar = throttle(
137 137
             () => this._originalOnShowToolbar(),
138 138
             100,
139 139
             {
@@ -141,7 +141,7 @@ class Conference extends AbstractConference<IProps, any> {
141 141
                 trailing: false
142 142
             });
143 143
 
144
-        this._onMouseMove = _.throttle(
144
+        this._onMouseMove = throttle(
145 145
             event => this._originalOnMouseMove(event),
146 146
             _mouseMoveCallbackInterval,
147 147
             {

+ 2
- 2
react/features/connection-indicator/statsEmitter.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { union } from 'lodash-es';
2 2
 
3 3
 import { IJitsiConference } from '../base/conference/reducer';
4 4
 import {
@@ -143,7 +143,7 @@ const statsEmitter = {
143 143
         const resolutionUserIds = Object.keys(allUserResolutions);
144 144
         const codecUserIds = Object.keys(allUserCodecs);
145 145
 
146
-        _.union(framerateUserIds, resolutionUserIds, codecUserIds)
146
+        union(framerateUserIds, resolutionUserIds, codecUserIds)
147 147
             .filter(id => id !== localUserId)
148 148
             .forEach(id => {
149 149
                 const remoteUserStats: IStats = {};

+ 2
- 2
react/features/filmstrip/components/web/Filmstrip.tsx 查看文件

@@ -1,5 +1,5 @@
1 1
 import clsx from 'clsx';
2
-import _ from 'lodash';
2
+import { throttle } from 'lodash-es';
3 3
 import React, { PureComponent } from 'react';
4 4
 import { WithTranslation } from 'react-i18next';
5 5
 import { connect } from 'react-redux';
@@ -286,7 +286,7 @@ class Filmstrip extends PureComponent <IProps, IState> {
286 286
         this._onDragMouseUp = this._onDragMouseUp.bind(this);
287 287
         this._onFilmstripResize = this._onFilmstripResize.bind(this);
288 288
 
289
-        this._throttledResize = _.throttle(
289
+        this._throttledResize = throttle(
290 290
             this._onFilmstripResize,
291 291
             50,
292 292
             {

+ 4
- 4
react/features/follow-me/middleware.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { differenceWith, isEqual } from 'lodash-es';
2 2
 
3 3
 import { IStore } from '../app/types';
4 4
 import { CONFERENCE_JOIN_IN_PROGRESS } from '../base/conference/actionTypes';
@@ -184,9 +184,9 @@ function _onFollowMeCommand(attributes: any = {}, id: string, store: IStore) {
184 184
             oldStageParticipants = JSON.parse(oldState.pinnedStageParticipants);
185 185
         }
186 186
 
187
-        if (!_.isEqual(stageParticipants, oldStageParticipants)) {
188
-            const toRemove = _.differenceWith(oldStageParticipants, stageParticipants, _.isEqual);
189
-            const toAdd = _.differenceWith(stageParticipants, oldStageParticipants, _.isEqual);
187
+        if (!isEqual(stageParticipants, oldStageParticipants)) {
188
+            const toRemove = differenceWith(oldStageParticipants, stageParticipants, isEqual);
189
+            const toAdd = differenceWith(stageParticipants, oldStageParticipants, isEqual);
190 190
 
191 191
             toRemove.forEach((p: { participantId: string; }) =>
192 192
                 store.dispatch(removeStageParticipant(p.participantId)));

+ 7
- 7
react/features/invite/components/add-people-dialog/native/AddPeopleDialog.tsx 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { matchesProperty, sortBy } from 'lodash-es';
2 2
 import React, { ReactElement } from 'react';
3 3
 import { WithTranslation } from 'react-i18next';
4 4
 import {
@@ -331,7 +331,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<IProps, IState> {
331 331
             const finderKey = item.type === INVITE_TYPES.PHONE ? 'number' : 'user_id';
332 332
 
333 333
             if (inviteItems.find(
334
-                _.matchesProperty(finderKey, item[finderKey as keyof typeof item]))) {
334
+                matchesProperty(finderKey, item[finderKey as keyof typeof item]))) {
335 335
                 // Item is already selected, need to unselect it.
336 336
                 this.setState({
337 337
                     inviteItems: inviteItems.filter(
@@ -343,7 +343,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<IProps, IState> {
343 343
                 const items = inviteItems.concat(item);
344 344
 
345 345
                 this.setState({
346
-                    inviteItems: _.sortBy(items, [ 'name', 'number' ])
346
+                    inviteItems: sortBy(items, [ 'name', 'number' ])
347 347
                 });
348 348
             }
349 349
         };
@@ -394,7 +394,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<IProps, IState> {
394 394
     _performSearch(query: string) {
395 395
         this._query(query).then(results => {
396 396
             this.setState({
397
-                selectableItems: _.sortBy(results, [ 'name', 'number' ])
397
+                selectableItems: sortBy(results, [ 'name', 'number' ])
398 398
             });
399 399
         })
400 400
         .finally(() => {
@@ -459,13 +459,13 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<IProps, IState> {
459 459
 
460 460
         switch (item.type) {
461 461
         case INVITE_TYPES.PHONE:
462
-            selected = inviteItems.find(_.matchesProperty('number', item.number));
462
+            selected = inviteItems.find(matchesProperty('number', item.number));
463 463
             break;
464 464
         case INVITE_TYPES.USER:
465 465
         case INVITE_TYPES.EMAIL:
466 466
             selected = item.id
467
-                ? inviteItems.find(_.matchesProperty('id', item.id))
468
-                : inviteItems.find(_.matchesProperty('user_id', item.user_id));
467
+                ? inviteItems.find(matchesProperty('id', item.id))
468
+                : inviteItems.find(matchesProperty('user_id', item.user_id));
469 469
             break;
470 470
         default:
471 471
             return null;

+ 2
- 2
react/features/mobile/audio-mode/components/AudioRoutePickerDialog.tsx 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { sortBy } from 'lodash-es';
2 2
 import React, { Component } from 'react';
3 3
 import { NativeModules, Text, TextStyle, TouchableHighlight, View, ViewStyle } from 'react-native';
4 4
 import { connect } from 'react-redux';
@@ -201,7 +201,7 @@ class AudioRoutePickerDialog extends Component<IProps, IState> {
201 201
 
202 202
         // Make sure devices is alphabetically sorted.
203 203
         return {
204
-            devices: _.sortBy(audioDevices, 'text')
204
+            devices: sortBy(audioDevices, 'text')
205 205
         };
206 206
     }
207 207
 

+ 2
- 2
react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts 查看文件

@@ -1,5 +1,5 @@
1
-import { DebouncedFunc } from 'lodash';
2
-import debounce from 'lodash/debounce';
1
+import { debounce } from 'lodash-es';
2
+import type { DebouncedFunc } from 'lodash-es';
3 3
 import { Component } from 'react';
4 4
 import { WithTranslation } from 'react-i18next';
5 5
 

+ 3
- 3
react/features/speaker-stats/functions.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { cloneDeep } from 'lodash-es';
2 2
 
3 3
 import { IReduxState } from '../app/types';
4 4
 import { getConferenceTimestamp } from '../base/conference/functions';
@@ -175,7 +175,7 @@ function getEnhancedStatsForOrdering(state: IReduxState, stats: ISpeakerStats, o
175 175
  * @public
176 176
  */
177 177
 export function filterBySearchCriteria(state: IReduxState, stats?: ISpeakerStats) {
178
-    const filteredStats = _.cloneDeep(stats ?? getSpeakerStats(state));
178
+    const filteredStats = cloneDeep(stats ?? getSpeakerStats(state));
179 179
     const criteria = getSearchCriteria(state);
180 180
 
181 181
     if (criteria !== null) {
@@ -203,7 +203,7 @@ export function filterBySearchCriteria(state: IReduxState, stats?: ISpeakerStats
203 203
  * @public
204 204
  */
205 205
 export function resetHiddenStats(state: IReduxState, stats?: ISpeakerStats) {
206
-    const resetStats = _.cloneDeep(stats ?? getSpeakerStats(state));
206
+    const resetStats = cloneDeep(stats ?? getSpeakerStats(state));
207 207
 
208 208
     for (const id in resetStats) {
209 209
         if (resetStats[id].hidden) {

+ 3
- 11
react/features/speaker-stats/reducer.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { assign } from 'lodash-es';
2 2
 
3 3
 import ReducerRegistry from '../base/redux/ReducerRegistry';
4 4
 import { FaceLandmarks } from '../face-landmarks/types';
@@ -141,11 +141,7 @@ ReducerRegistry.register<ISpeakerStatsState>('features/speaker-stats',
141 141
  * @returns {Object} The new state after the reduction of the specified action.
142 142
  */
143 143
 function _updateCriteria(state: ISpeakerStatsState, { criteria }: { criteria: string | null; }) {
144
-    return _.assign(
145
-        {},
146
-        state,
147
-        { criteria }
148
-    );
144
+    return assign({}, state, { criteria });
149 145
 }
150 146
 
151 147
 /**
@@ -188,9 +184,5 @@ function _updateSortedSpeakerStats(state: ISpeakerStatsState, { participantIds }
188 184
  * @returns {Object} The new state after the reduction of the specified action.
189 185
  */
190 186
 function _initReorderStats(state: ISpeakerStatsState) {
191
-    return _.assign(
192
-        {},
193
-        state,
194
-        { pendingReorder: true }
195
-    );
187
+    return assign({}, state, { pendingReorder: true });
196 188
 }

+ 2
- 2
react/features/toolbox/components/HangupButton.ts 查看文件

@@ -1,4 +1,4 @@
1
-import _ from 'lodash';
1
+import { once } from 'lodash-es';
2 2
 import { connect } from 'react-redux';
3 3
 
4 4
 import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
@@ -29,7 +29,7 @@ class HangupButton extends AbstractHangupButton<AbstractButtonProps> {
29 29
     constructor(props: AbstractButtonProps) {
30 30
         super(props);
31 31
 
32
-        this._hangup = _.once(() => {
32
+        this._hangup = once(() => {
33 33
             sendAnalytics(createToolbarEvent('hangup'));
34 34
             this.props.dispatch(leaveConference());
35 35
         });

+ 1
- 1
react/features/toolbox/subscriber.web.ts 查看文件

@@ -1,4 +1,4 @@
1
-import { throttle } from 'lodash';
1
+import { throttle } from 'lodash-es';
2 2
 
3 3
 import { IReduxState, IStore } from '../app/types';
4 4
 import { getParticipantCount } from '../base/participants/functions';

+ 2
- 2
react/features/video-menu/components/native/VolumeSlider.tsx 查看文件

@@ -1,7 +1,7 @@
1 1
 /* eslint-disable lines-around-comment*/
2 2
 
3 3
 import Slider from '@react-native-community/slider';
4
-import _ from 'lodash';
4
+import { throttle } from 'lodash-es';
5 5
 import React, { PureComponent } from 'react';
6 6
 import { View, ViewStyle } from 'react-native';
7 7
 import { connect } from 'react-redux';
@@ -88,7 +88,7 @@ class VolumeSlider extends PureComponent<IProps, IState> {
88 88
 
89 89
         this._originalVolumeChange = this._onVolumeChange;
90 90
 
91
-        this._onVolumeChange = _.throttle(
91
+        this._onVolumeChange = throttle(
92 92
             volumeLevel => this._originalVolumeChange(volumeLevel), 500
93 93
         );
94 94
     }

+ 1
- 1
react/features/visitors/components/web/JoinMeetingDialog.tsx 查看文件

@@ -1,4 +1,4 @@
1
-import { noop } from 'lodash';
1
+import { noop } from 'lodash-es';
2 2
 import React from 'react';
3 3
 import { useTranslation } from 'react-i18next';
4 4
 import { makeStyles } from 'tss-react/mui';

Loading…
取消
儲存