openedx / frontend-component-footer

Site footer component for edX frontend apps.
GNU Affero General Public License v3.0
6 stars 98 forks source link

Replace lodash dependency with lodash.isEmpty #443

Open davidjoy opened 4 months ago

davidjoy commented 4 months ago

Currently the Studio footer depends on the entire lodash library. This pulls in significantly more code than we need, as we only use the isEmpty function.

We should replace the lodash dependency with the lodash.isEmpty library; this will take a decently sized chunk out of the bundle sizes of our MFEs.

regisb commented 4 months ago

I ran npx howfat . in this repo and this is what I got. If I'm reading this right, removing lodash is going to remove 1054 files (!!!) and 1.35 MB?

@edx/frontend-component-footer@1.0.0-semantically-released (150 deps, 39.2mb, 8916 files, ©undefined)
├─┬ @fortawesome/fontawesome-svg-core@6.5.2 (1 dep, 1.13mb, 16 files, ©MIT)
│ ╰── @fortawesome/fontawesome-common-types@6.5.2 (771.85kb, 5 files, ©MIT)
├─┬ @fortawesome/free-brands-svg-icons@6.5.2 (1 dep, 2.84mb, 1062 files, ©(CC-BY-4.0 AND MIT))
│ ╰── @fortawesome/fontawesome-common-types@6.5.2 (771.85kb, 5 files, ©MIT)
├─┬ @fortawesome/free-regular-svg-icons@6.5.2 (1 dep, 1.4mb, 526 files, ©(CC-BY-4.0 AND MIT))
│ ╰── @fortawesome/fontawesome-common-types@6.5.2 (771.85kb, 5 files, ©MIT)
├─┬ @fortawesome/free-solid-svg-icons@6.5.2 (1 dep, 5.6mb, 3914 files, ©(CC-BY-4.0 AND MIT))
│ ╰── @fortawesome/fontawesome-common-types@6.5.2 (771.85kb, 5 files, ©MIT)
├─┬ @fortawesome/react-fontawesome@0.2.2 (5 deps, 178.39kb, 44 files, ©MIT)
│ ╰─┬ prop-types@15.8.1 (4 deps, 141.47kb, 38 files, ©MIT)
│   ├─┬ loose-envify@1.4.0 (1 dep, 20.39kb, 13 files, ©MIT)
│   │ ╰── js-tokens@4.0.0 (14.72kb, 5 files, ©MIT)
│   ├── object-assign@4.1.1 (5.36kb, 4 files, ©MIT)
│   ╰── react-is@16.13.1 (23.39kb, 9 files, ©MIT)
├─┬ jest-environment-jsdom@29.7.0 (117 deps, 13.4mb, 1848 files, ©MIT)
│ ├─┬ @jest/environment@29.7.0 (56 deps, 3.68mb, 530 files, ©MIT)
│ │ ├── @jest/fake-timers@29.7.0 (🔗, 55 deps, 3.67mb, 526 files, ©MIT)
│ │ ├── @jest/types@29.6.3 (🔗, 15 deps, 2.7mb, 220 files, ©MIT)
│ │ ├── @types/node@20.14.9 (🔗, 1 dep, 2.06mb, 100 files, ©MIT)
│ │ ╰── jest-mock@29.7.0 (🔗, 26 deps, 3.02mb, 309 files, ©MIT)
│ ├─┬ @jest/fake-timers@29.7.0 (55 deps, 3.67mb, 526 files, ©MIT)
│ │ ├── @jest/types@29.6.3 (🔗, 15 deps, 2.7mb, 220 files, ©MIT)
│ │ ├─┬ @sinonjs/fake-timers@10.3.0 (2 deps, 156.41kb, 63 files, ©BSD-3-Clause)
│ │ │ ╰─┬ @sinonjs/commons@3.0.1 (1 dep, 78.19kb, 59 files, ©BSD-3-Clause)
│ │ │   ╰── type-detect@4.0.8 (41.12kb, 5 files, ©MIT)
│ │ ├── @types/node@20.14.9 (🔗, 1 dep, 2.06mb, 100 files, ©MIT)
│ │ ├─┬ jest-message-util@29.7.0 (42 deps, 3.29mb, 385 files, ©MIT)
│ │ │ ├─┬ @babel/code-frame@7.24.7 (11 deps, 194.28kb, 70 files, ©MIT)
│ │ │ │ ├─┬ @babel/highlight@7.24.7 (10 deps, 170.78kb, 65 files, ©MIT)
│ │ │ │ │ ├── @babel/helper-validator-identifier@7.24.7 (48.15kb, 10 files, ©MIT)
│ │ │ │ │ ├─┬ chalk@2.4.2 (6 deps, 83.07kb, 38 files, ©MIT)
│ │ │ │ │ │ ├─┬ ansi-styles@3.2.1 (2 deps, 44.62kb, 18 files, ©MIT)
│ │ │ │ │ │ │ ╰─┬ color-convert@1.9.3 (1 dep, 35.47kb, 14 files, ©MIT)
│ │ │ │ │ │ │   ╰── color-name@1.1.3 (9.14kb, 7 files, ©MIT)
│ │ │ │ │ │ ├── escape-string-regexp@1.0.5 (2.63kb, 4 files, ©MIT)
│ │ │ │ │ │ ╰─┬ supports-color@5.5.0 (1 dep, 9.53kb, 9 files, ©MIT)
│ │ │ │ │ │   ╰── has-flag@3.0.0 (3.05kb, 4 files, ©MIT)
│ │ │ │ │ ├── js-tokens@4.0.0 (🔗, 14.72kb, 5 files, ©MIT)
│ │ │ │ │ ╰── picocolors@1.0.1 (🔗, 5.03kb, 7 files, ©ISC)
│ │ │ │ ╰── picocolors@1.0.1 (5.03kb, 7 files, ©ISC)
│ │ │ ├── @jest/types@29.6.3 (🔗, 15 deps, 2.7mb, 220 files, ©MIT)
│ │ │ ├── @types/stack-utils@2.0.3 (6.28kb, 5 files, ©MIT)
│ │ │ ├── chalk@4.1.2 (🔗, 5 deps, 95.08kb, 33 files, ©MIT)
│ │ │ ├── graceful-fs@4.2.11 (🔗, 31.77kb, 7 files, ©ISC)
│ │ │ ├─┬ micromatch@4.0.7 (5 deps, 234.52kb, 36 files, ©MIT)
│ │ │ │ ├─┬ braces@3.0.3 (3 deps, 91.73kb, 22 files, ©MIT)
│ │ │ │ │ ╰─┬ fill-range@7.1.1 (2 deps, 48.14kb, 12 files, ©MIT)
│ │ │ │ │   ╰─┬ to-regex-range@5.0.1 (1 dep, 31.79kb, 8 files, ©MIT)
│ │ │ │ │     ╰── is-number@7.0.0 (9.39kb, 4 files, ©MIT)
│ │ │ │ ╰── picomatch@2.3.1 (🔗, 87.84kb, 10 files, ©MIT)
│ │ │ ├─┬ pretty-format@29.7.0 (4 deps, 533.63kb, 76 files, ©MIT)
│ │ │ │ ├── @jest/schemas@29.6.3 (🔗, 1 dep, 437.62kb, 48 files, ©MIT)
│ │ │ │ ├── ansi-styles@5.2.0 (13.28kb, 5 files, ©MIT)
│ │ │ │ ╰── react-is@18.3.1 (23.45kb, 8 files, ©MIT)
│ │ │ ├── slash@3.0.0 (3.42kb, 5 files, ©MIT)
│ │ │ ╰─┬ stack-utils@2.0.6 (1 dep, 17.44kb, 9 files, ©MIT)
│ │ │   ╰── escape-string-regexp@2.0.0 (3.18kb, 5 files, ©MIT)
│ │ ├── jest-mock@29.7.0 (🔗, 26 deps, 3.02mb, 309 files, ©MIT)
│ │ ╰── jest-util@29.7.0 (🔗, 25 deps, 2.97mb, 304 files, ©MIT)
│ ├─┬ @jest/types@29.6.3 (15 deps, 2.7mb, 220 files, ©MIT)
│ │ ├─┬ @jest/schemas@29.6.3 (1 dep, 437.62kb, 48 files, ©MIT)
│ │ │ ╰── @sinclair/typebox@0.27.8 (431.69kb, 43 files, ©MIT)
│ │ ├── @types/istanbul-lib-coverage@2.0.6 (5.32kb, 5 files, ©MIT)
│ │ ├─┬ @types/istanbul-reports@3.0.4 (2 deps, 19.57kb, 15 files, ©MIT)
│ │ │ ╰─┬ @types/istanbul-lib-report@3.0.3 (1 dep, 13.05kb, 10 files, ©MIT)
│ │ │   ╰── @types/istanbul-lib-coverage@2.0.6 (🔗, 5.32kb, 5 files, ©MIT)
│ │ ├── @types/node@20.14.9 (🔗, 1 dep, 2.06mb, 100 files, ©MIT)
│ │ ├─┬ @types/yargs@17.0.32 (1 dep, 67.19kb, 14 files, ©MIT)
│ │ │ ╰── @types/yargs-parser@21.0.3 (8.45kb, 5 files, ©MIT)
│ │ ╰─┬ chalk@4.1.2 (5 deps, 95.08kb, 33 files, ©MIT)
│ │   ├─┬ ansi-styles@4.3.0 (2 deps, 49.67kb, 16 files, ©MIT)
│ │   │ ╰─┬ color-convert@2.0.1 (1 dep, 33.09kb, 11 files, ©MIT)
│ │   │   ╰── color-name@1.1.4 (6.54kb, 4 files, ©MIT)
│ │   ╰─┬ supports-color@7.2.0 (1 dep, 11.19kb, 10 files, ©MIT)
│ │     ╰── has-flag@4.0.0 (4.32kb, 5 files, ©MIT)
│ ├─┬ @types/jsdom@20.0.1 (5 deps, 3.16mb, 243 files, ©MIT)
│ │ ├── @types/node@20.14.9 (🔗, 1 dep, 2.06mb, 100 files, ©MIT)
│ │ ├── @types/tough-cookie@4.0.5 (13.22kb, 5 files, ©MIT)
│ │ ╰─┬ parse5@7.1.2 (1 dep, 1.06mb, 132 files, ©MIT)
│ │   ╰── entities@4.5.0 (403.21kb, 68 files, ©BSD-2-Clause)
│ ├─┬ @types/node@20.14.9 (1 dep, 2.06mb, 100 files, ©MIT)
│ │ ╰── undici-types@5.26.5 (71.34kb, 35 files, ©MIT)
│ ├─┬ jest-mock@29.7.0 (26 deps, 3.02mb, 309 files, ©MIT)
│ │ ├── @jest/types@29.6.3 (🔗, 15 deps, 2.7mb, 220 files, ©MIT)
│ │ ├── @types/node@20.14.9 (🔗, 1 dep, 2.06mb, 100 files, ©MIT)
│ │ ╰── jest-util@29.7.0 (🔗, 25 deps, 2.97mb, 304 files, ©MIT)
│ ├─┬ jest-util@29.7.0 (25 deps, 2.97mb, 304 files, ©MIT)
│ │ ├── @jest/types@29.6.3 (🔗, 15 deps, 2.7mb, 220 files, ©MIT)
│ │ ├── @types/node@20.14.9 (🔗, 1 dep, 2.06mb, 100 files, ©MIT)
│ │ ├─┬ chalk@4.1.2 (5 deps, 95.08kb, 33 files, ©MIT)
│ │ │ ├─┬ ansi-styles@4.3.0 (2 deps, 49.67kb, 16 files, ©MIT)
│ │ │ │ ╰─┬ color-convert@2.0.1 (1 dep, 33.09kb, 11 files, ©MIT)
│ │ │ │   ╰── color-name@1.1.4 (6.54kb, 4 files, ©MIT)
│ │ │ ╰─┬ supports-color@7.2.0 (1 dep, 11.19kb, 10 files, ©MIT)
│ │ │   ╰── has-flag@4.0.0 (4.32kb, 5 files, ©MIT)
│ │ ├── ci-info@3.9.0 (25.45kb, 7 files, ©MIT)
│ │ ├── graceful-fs@4.2.11 (31.77kb, 7 files, ©ISC)
│ │ ╰── picomatch@2.3.1 (87.84kb, 10 files, ©MIT)
│ ╰─┬ jsdom@20.0.3 (55 deps, 8.61mb, 1171 files, ©MIT)
│   ├── abab@2.0.6 (10.2kb, 7 files, ©BSD-3-Clause, ⛔ Use your platform's native atob() a…)
│   ├── acorn@8.12.1 (525kb, 10 files, ©MIT)
│   ├─┬ acorn-globals@7.0.1 (2 deps, 585.6kb, 22 files, ©MIT)
│   │ ├── acorn@8.12.1 (🔗, 525kb, 10 files, ©MIT)
│   │ ╰─┬ acorn-walk@8.3.3 (1 dep, 576.38kb, 18 files, ©MIT)
│   │   ╰── acorn@8.12.1 (🔗, 525kb, 10 files, ©MIT)
│   ├── cssom@0.5.0 (50.84kb, 26 files, ©MIT)
│   ├─┬ cssstyle@2.3.0 (1 dep, 219.94kb, 119 files, ©MIT)
│   │ ╰── cssom@0.3.8 (47.85kb, 24 files, ©MIT)
│   ├─┬ data-urls@3.0.2 (6 deps, 393.59kb, 53 files, ©MIT)
│   │ ├── abab@2.0.6 (🔗, 10.2kb, 7 files, ©BSD-3-Clause, ⛔ Use your platform's native atob() a…)
│   │ ├── whatwg-mimetype@3.0.0 (🔗, 16.42kb, 8 files, ©MIT)
│   │ ╰── whatwg-url@11.0.0 (🔗, 3 deps, 359.1kb, 33 files, ©MIT)
│   ├── decimal.js@10.4.3 (276.16kb, 6 files, ©MIT)
│   ├─┬ domexception@4.0.0 (1 dep, 43.38kb, 15 files, ©MIT, ⛔ Use your platform's native DOMExcep…)
│   │ ╰── webidl-conversions@7.0.0 (🔗, 23.67kb, 4 files, ©BSD-2-Clause)
│   ├─┬ escodegen@2.1.0 (4 deps, 1.25mb, 46 files, ©BSD-2-Clause)
│   │ ├── esprima@4.0.1 (306.99kb, 7 files, ©BSD-2-Clause)
│   │ ├── estraverse@5.3.0 (36.22kb, 6 files, ©BSD-2-Clause)
│   │ ├── esutils@2.0.3 (49.4kb, 7 files, ©BSD-2-Clause)
│   │ ╰── source-map@0.6.1 (786.35kb, 20 files, ©BSD-3-Clause)
│   ├─┬ form-data@4.0.0 (5 deps, 306.73kb, 50 files, ©MIT)
│   │ ├── asynckit@0.4.0 (26.72kb, 20 files, ©MIT)
│   │ ├─┬ combined-stream@1.0.8 (1 dep, 19.08kb, 11 files, ©MIT)
│   │ │ ╰── delayed-stream@1.0.0 (7.83kb, 6 files, ©MIT)
│   │ ╰─┬ mime-types@2.1.35 (1 dep, 218.57kb, 11 files, ©MIT)
│   │   ╰── mime-db@1.52.0 (200.72kb, 6 files, ©MIT)
│   ├─┬ html-encoding-sniffer@3.0.0 (3 deps, 405.6kb, 50 files, ©MIT)
│   │ ╰── whatwg-encoding@2.0.0 (🔗, 2 deps, 394.2kb, 46 files, ©MIT)
│   ├─┬ http-proxy-agent@5.0.0 (4 deps, 114.52kb, 41 files, ©MIT)
│   │ ├── @tootallnate/once@2.0.0 (15.95kb, 12 files, ©MIT)
│   │ ├─┬ agent-base@6.0.2 (2 deps, 81.89kb, 21 files, ©MIT)
│   │ │ ╰── debug@4.3.5 (🔗, 1 dep, 48.12kb, 11 files, ©MIT)
│   │ ╰─┬ debug@4.3.5 (1 dep, 48.12kb, 11 files, ©MIT)
│   │   ╰── ms@2.1.2 (6.68kb, 4 files, ©MIT)
│   ├─┬ https-proxy-agent@5.0.1 (5 deps, 155.4kb, 43 files, ©MIT)
│   │ ├─┬ agent-base@6.0.2 (2 deps, 81.89kb, 21 files, ©MIT)
│   │ │ ╰── debug@4.3.5 (🔗, 1 dep, 48.12kb, 11 files, ©MIT)
│   │ ╰─┬ debug@4.3.5 (1 dep, 48.12kb, 11 files, ©MIT)
│   │   ╰── ms@2.1.2 (6.68kb, 4 files, ©MIT)
│   ├── is-potential-custom-element-name@1.0.1 (3.83kb, 4 files, ©MIT)
│   ├── nwsapi@2.2.10 (78.8kb, 7 files, ©MIT)
│   ├─┬ parse5@7.1.2 (1 dep, 1.06mb, 132 files, ©MIT)
│   │ ╰── entities@4.5.0 (403.21kb, 68 files, ©BSD-2-Clause)
│   ├─┬ saxes@6.0.0 (1 dep, 217.51kb, 23 files, ©ISC)
│   │ ╰── xmlchars@2.2.0 (57.58kb, 18 files, ©MIT)
│   ├── symbol-tree@3.2.4 (55.74kb, 7 files, ©MIT)
│   ├─┬ tough-cookie@4.1.4 (6 deps, 673.84kb, 48 files, ©BSD-3-Clause)
│   │ ├── psl@1.9.0 (450.63kb, 9 files, ©MIT)
│   │ ├── punycode@2.3.1 (32.73kb, 5 files, ©MIT)
│   │ ├── universalify@0.2.0 (4.67kb, 4 files, ©MIT)
│   │ ╰─┬ url-parse@1.5.10 (2 deps, 76.64kb, 18 files, ©MIT)
│   │   ├── querystringify@2.2.0 (6.8kb, 4 files, ©MIT)
│   │   ╰── requires-port@1.0.0 (8.36kb, 7 files, ©MIT)
│   ├─┬ w3c-xmlserializer@4.0.0 (1 dep, 30.79kb, 10 files, ©MIT)
│   │ ╰── xml-name-validator@4.0.0 (🔗, 13.23kb, 4 files, ©Apache-2.0)
│   ├── webidl-conversions@7.0.0 (23.67kb, 4 files, ©BSD-2-Clause)
│   ├─┬ whatwg-encoding@2.0.0 (2 deps, 394.2kb, 46 files, ©MIT)
│   │ ╰─┬ iconv-lite@0.6.3 (1 dep, 381.66kb, 40 files, ©MIT)
│   │   ╰── safer-buffer@2.1.2 (41.31kb, 7 files, ©MIT)
│   ├── whatwg-mimetype@3.0.0 (16.42kb, 8 files, ©MIT)
│   ├─┬ whatwg-url@11.0.0 (3 deps, 359.1kb, 33 files, ©MIT)
│   │ ├─┬ tr46@3.0.0 (1 dep, 242.95kb, 12 files, ©MIT)
│   │ │ ╰── punycode@2.3.1 (🔗, 32.73kb, 5 files, ©MIT)
│   │ ╰── webidl-conversions@7.0.0 (🔗, 23.67kb, 4 files, ©BSD-2-Clause)
│   ├── ws@8.18.0 (143.21kb, 19 files, ©MIT)
│   ╰── xml-name-validator@4.0.0 (13.23kb, 4 files, ©Apache-2.0)
├── lodash@4.17.21 (1.35mb, 1054 files, ©MIT)
╰─┬ ts-jest@29.1.5 (33 deps, 3.8mb, 531 files, ©MIT)
  ├─┬ bs-logger@0.2.6 (1 dep, 63.26kb, 42 files, ©MIT)
  │ ╰── fast-json-stable-stringify@2.1.0 (🔗, 16.56kb, 18 files, ©MIT)
  ├── fast-json-stable-stringify@2.1.0 (16.56kb, 18 files, ©MIT)
  ├─┬ jest-util@29.7.0 (25 deps, 2.97mb, 304 files, ©MIT)
  │ ├── @jest/types@29.6.3 (🔗, 15 deps, 2.7mb, 220 files, ©MIT)
  │ ├── @types/node@20.14.9 (🔗, 1 dep, 2.06mb, 100 files, ©MIT)
  │ ├─┬ chalk@4.1.2 (5 deps, 95.08kb, 33 files, ©MIT)
  │ │ ├─┬ ansi-styles@4.3.0 (2 deps, 49.67kb, 16 files, ©MIT)
  │ │ │ ╰─┬ color-convert@2.0.1 (1 dep, 33.09kb, 11 files, ©MIT)
  │ │ │   ╰── color-name@1.1.4 (6.54kb, 4 files, ©MIT)
  │ │ ╰─┬ supports-color@7.2.0 (1 dep, 11.19kb, 10 files, ©MIT)
  │ │   ╰── has-flag@4.0.0 (4.32kb, 5 files, ©MIT)
  │ ├── ci-info@3.9.0 (25.45kb, 7 files, ©MIT)
  │ ├── graceful-fs@4.2.11 (31.77kb, 7 files, ©ISC)
  │ ╰── picomatch@2.3.1 (87.84kb, 10 files, ©MIT)
  ├── json5@2.2.3 (229.69kb, 20 files, ©MIT)
  ├── lodash.memoize@4.1.2 (19.65kb, 4 files, ©MIT)
  ├── make-error@1.3.6 (12.14kb, 6 files, ©ISC)
  ├── semver@7.6.2 (93.19kb, 52 files, ©ISC)
  ╰── yargs-parser@21.1.1 (125.46kb, 11 files, ©ISC)