Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps(lodash): migrate lodash to lodash-es #16211

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/test/smokehouse/frontends/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/* eslint-disable no-console */

import cloneDeep from 'lodash/cloneDeep.js';
import cloneDeep from 'lodash-es/cloneDeep.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the advantage of tree-shaking to be that we can import everything from the top-level entry point now. For example:

Suggested change
import cloneDeep from 'lodash-es/cloneDeep.js';
import {cloneDeep} from 'lodash-es';

Is this something you could do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will make the changes 👌

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are done


import smokeTests from '../core-tests.js';
import {runSmokehouse, getShardedDefinitions} from '../smokehouse.js';
Expand Down
2 changes: 1 addition & 1 deletion cli/test/smokehouse/frontends/smokehouse-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import path from 'path';
import fs from 'fs';
import url from 'url';

import cloneDeep from 'lodash/cloneDeep.js';
import cloneDeep from 'lodash-es/cloneDeep.js';
import yargs from 'yargs';
import * as yargsHelpers from 'yargs/helpers';
import log from 'lighthouse-logger';
Expand Down
2 changes: 1 addition & 1 deletion cli/test/smokehouse/report-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* against the results actually collected from Lighthouse.
*/

import cloneDeep from 'lodash/cloneDeep.js';
import cloneDeep from 'lodash-es/cloneDeep.js';
import log from 'lighthouse-logger';

import {LocalConsole} from './lib/local-console.js';
Expand Down
2 changes: 1 addition & 1 deletion core/config/config-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import path from 'path';
import {createRequire} from 'module';
import url from 'url';

import isDeepEqual from 'lodash/isEqual.js';
import isDeepEqual from 'lodash-es/isEqual.js';

import * as constants from './constants.js';
import ConfigPlugin from './config-plugin.js';
Expand Down
2 changes: 1 addition & 1 deletion core/gather/base-artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import log from 'lighthouse-logger';
import isDeepEqual from 'lodash/isEqual.js';
import isDeepEqual from 'lodash-es/isEqual.js';

import {
getBrowserVersion, getBenchmarkIndex, getEnvironmentWarnings,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/arbitrary-equality-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import isDeepEqual from 'lodash/isEqual.js';
import isDeepEqual from 'lodash-es/isEqual.js';

/**
* @fileoverview This class is designed to allow maps with arbitrary equality functions.
Expand Down
2 changes: 1 addition & 1 deletion core/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import path from 'path';


import log from 'lighthouse-logger';
import isDeepEqual from 'lodash/isEqual.js';
import isDeepEqual from 'lodash-es/isEqual.js';

import {ReportScoring} from './scoring.js';
import {Audit} from './audits/audit.js';
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/i18n/collect-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {expect} from 'expect';
import tsc from 'typescript';
import MessageParser from '@formatjs/icu-messageformat-parser';
import esMain from 'es-main';
import isDeepEqual from 'lodash/isEqual.js';
import isDeepEqual from 'lodash-es/isEqual.js';

import {Util} from '../../../shared/util.js';
import {collectAndBakeCtcStrings} from './bake-ctc-to-lhl.js';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"@types/google.analytics": "0.0.39",
"@types/jpeg-js": "^0.3.7",
"@types/jsdom": "^16.2.13",
"@types/lodash": "^4.14.178",
"@types/lodash-es": "^4.17.12",
"@types/mocha": "^9.0.0",
"@types/node": "*",
"@types/pako": "^1.0.1",
Expand Down Expand Up @@ -195,7 +195,7 @@
"js-library-detector": "^6.7.0",
"lighthouse-logger": "^2.0.1",
"lighthouse-stack-packs": "1.12.1",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"lookup-closest-locale": "6.2.0",
"metaviewport-parser": "0.3.0",
"open": "^8.4.0",
Expand Down
4 changes: 2 additions & 2 deletions shared/localization/swap-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import _set from 'lodash/set.js';
import _get from 'lodash/get.js';
import _set from 'lodash-es/set.js';
import _get from 'lodash-es/get.js';

import * as format from './format.js';

Expand Down
20 changes: 16 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1458,10 +1458,17 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

"@types/lodash@^4.14.178":
version "4.14.178"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.178.tgz#341f6d2247db528d4a13ddbb374bcdc80406f4f8"
integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==
"@types/lodash-es@^4.17.12":
version "4.17.12"
resolved "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz#65f6d1e5f80539aa7cfbfc962de5def0cf4f341b"
integrity sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==
dependencies:
"@types/lodash" "*"

"@types/lodash@*":
version "4.17.10"
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.10.tgz#64f3edf656af2fe59e7278b73d3e62404144a6e6"
integrity sha512-YpS0zzoduEhuOWjAotS6A5AVCva7X4lVlYLF0FYHAY9sdraBfnatttHItlWeZdGhuEkf+OzMNg2ZYAx8t+52uQ==

"@types/long@^4.0.1":
version "4.0.1"
Expand Down Expand Up @@ -5099,6 +5106,11 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"

lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==

lodash.assign@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
Expand Down