Skip to content

Commit

Permalink
feat: move to individual lodash packages
Browse files Browse the repository at this point in the history
Moves to using individual lodash imports to reduce package size.
  • Loading branch information
43081j committed Jun 25, 2024
1 parent 595d755 commit 6aa6fcb
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 10 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 2 additions & 3 deletions packages/inquirer/lib/objects/choices.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import assert from 'node:assert';
import filter from 'lodash/filter.js';
import map from 'lodash/map.js';
import filter from 'lodash.filter';

import Separator from './separator.js';
import Choice from './choice.js';
Expand Down Expand Up @@ -91,7 +90,7 @@ export default class Choices {
* @return {Array} Selected properties
*/
pluck(propertyName) {
return map(this.realChoices, propertyName);
return this.realChoices.map((choice) => choice[propertyName]);
}

// Expose usual Array methods
Expand Down
4 changes: 2 additions & 2 deletions packages/inquirer/lib/prompts/base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import defaults from 'lodash/defaults.js';
import clone from 'lodash/clone.js';
import defaults from 'lodash.defaults';
import clone from 'lodash.clone';
/**
* Base prompt implementation
* Should be extended by prompt types.
Expand Down
6 changes: 3 additions & 3 deletions packages/inquirer/lib/ui/prompt.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import isPlainObject from 'lodash/isPlainObject.js';
import get from 'lodash/get.js';
import set from 'lodash/set.js';
import isPlainObject from 'lodash.isplainobject';
import get from 'lodash.get';
import set from 'lodash.set';

const _ = {
isPlainObject,
Expand Down
7 changes: 6 additions & 1 deletion packages/inquirer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@
"chalk": "^5.3.0",
"cli-width": "^4.1.0",
"external-editor": "^3.1.0",
"lodash": "^4.17.21",
"lodash.clone": "^4.5.0",
"lodash.defaults": "^4.2.0",
"lodash.filter": "^4.6.0",
"lodash.get": "^4.4.2",
"lodash.isplainobject": "^4.0.6",
"lodash.set": "^4.3.2",
"mute-stream": "1.0.0",
"ora": "^5.4.1",
"run-async": "^3.0.0",
Expand Down
49 changes: 48 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4345,7 +4345,12 @@ __metadata:
chalk: "npm:^5.3.0"
cli-width: "npm:^4.1.0"
external-editor: "npm:^3.1.0"
lodash: "npm:^4.17.21"
lodash.clone: "npm:^4.5.0"
lodash.defaults: "npm:^4.2.0"
lodash.filter: "npm:^4.6.0"
lodash.get: "npm:^4.4.2"
lodash.isplainobject: "npm:^4.0.6"
lodash.set: "npm:^4.3.2"
mute-stream: "npm:1.0.0"
ora: "npm:^5.4.1"
run-async: "npm:^3.0.0"
Expand Down Expand Up @@ -5067,20 +5072,62 @@ __metadata:
languageName: node
linkType: hard

"lodash.clone@npm:^4.5.0":
version: 4.5.0
resolution: "lodash.clone@npm:4.5.0"
checksum: 10/387ca92bb9182197dd8de48cd51f846589abbfbf2b03d7f739eafadcd8f5968be5f4f170d848277edfc2a9b05a23732a1435799b13ddbd85c533c64ea7375dfd
languageName: node
linkType: hard

"lodash.defaults@npm:^4.2.0":
version: 4.2.0
resolution: "lodash.defaults@npm:4.2.0"
checksum: 10/6a2a9ea5ad7585aff8d76836c9e1db4528e5f5fa50fc4ad81183152ba8717d83aef8aec4fa88bf3417ed946fd4b4358f145ee08fbc77fb82736788714d3e12db
languageName: node
linkType: hard

"lodash.filter@npm:^4.6.0":
version: 4.6.0
resolution: "lodash.filter@npm:4.6.0"
checksum: 10/a95c363b6cad0025b1f74a5125d2b156251f9da2ff3d94385524e7622e4c1e4d499dd4c2b4dbc201de6e4c1f753b5af01d7c7696b6062bfb47af15ff4ba8d823
languageName: node
linkType: hard

"lodash.get@npm:^4.4.2":
version: 4.4.2
resolution: "lodash.get@npm:4.4.2"
checksum: 10/2a4925f6e89bc2c010a77a802d1ba357e17ed1ea03c2ddf6a146429f2856a216663e694a6aa3549a318cbbba3fd8b7decb392db457e6ac0b83dc745ed0a17380
languageName: node
linkType: hard

"lodash.ismatch@npm:^4.4.0":
version: 4.4.0
resolution: "lodash.ismatch@npm:4.4.0"
checksum: 10/946a7176cdf4048f7b624378defda00dc0d01a2dad9933c54dad11fbecc253716df4210fbbfcd7d042e6fdb7603463cfe48e0ef576e20bf60d43f7deb1a2fe04
languageName: node
linkType: hard

"lodash.isplainobject@npm:^4.0.6":
version: 4.0.6
resolution: "lodash.isplainobject@npm:4.0.6"
checksum: 10/29c6351f281e0d9a1d58f1a4c8f4400924b4c79f18dfc4613624d7d54784df07efaff97c1ff2659f3e085ecf4fff493300adc4837553104cef2634110b0d5337
languageName: node
linkType: hard

"lodash.merge@npm:^4.6.2":
version: 4.6.2
resolution: "lodash.merge@npm:4.6.2"
checksum: 10/d0ea2dd0097e6201be083865d50c3fb54fbfbdb247d9cc5950e086c991f448b7ab0cdab0d57eacccb43473d3f2acd21e134db39f22dac2d6c9ba6bf26978e3d6
languageName: node
linkType: hard

"lodash.set@npm:^4.3.2":
version: 4.3.2
resolution: "lodash.set@npm:4.3.2"
checksum: 10/f0968109bca5625c8ce1f1beab758634484443604d3950477e46d8d2631562e5ceae4465b9ce8a393fd47f5a411329f9bacf956c7c95530af1290db1a20343ba
languageName: node
linkType: hard

"lodash@npm:^4.17.21":
version: 4.17.21
resolution: "lodash@npm:4.17.21"
Expand Down

0 comments on commit 6aa6fcb

Please sign in to comment.