Skip to content

Commit c667f79

Browse files
sethiddenMarcin Kwiatkowski
authored andcommitted
chore: use lodash-es over per-function packages (#1112)
1 parent db439d2 commit c667f79

File tree

8 files changed

+49
-41
lines changed

8 files changed

+49
-41
lines changed

packages/theme/components/CartSidebar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ import {
293293
useContext,
294294
onMounted,
295295
} from '@nuxtjs/composition-api';
296-
import _debounce from 'lodash.debounce';
296+
import { debounce } from 'lodash-es';
297297
import { cartGetters } from '~/getters';
298298
import {
299299
useUiState,
@@ -396,7 +396,7 @@ export default defineComponent({
396396
title: 'Product removed',
397397
});
398398
};
399-
const delayedUpdateItemQty = _debounce(
399+
const delayedUpdateItemQty = debounce(
400400
(params) => updateItemQty(params),
401401
1000,
402402
);

packages/theme/components/Header/SearchBar/SearchBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import { SfButton, SfSearchBar } from '@storefront-ui/vue';
5353
import {
5454
defineComponent, ref, watch, useRoute,
5555
} from '@nuxtjs/composition-api';
56-
import debounce from 'lodash.debounce';
56+
import { debounce } from 'lodash-es';
5757
import { clickOutside } from '~/utilities/directives/click-outside/click-outside-directive';
5858
import SvgImage from '~/components/General/SvgImage.vue';
5959
import { useProduct } from '~/modules/catalog/product/composables/useProduct';

packages/theme/helpers/integrationPlugin/_proxyUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { IncomingMessage } from 'node:http';
22
import { Context as NuxtContext } from '@nuxt/types';
3-
import merge from 'lodash.merge';
3+
import { merge } from 'lodash-es';
44

55
export type ApiClientMethod = (...args: any) => Promise<any>;
66

packages/theme/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = {
4040
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
4141

4242
transformIgnorePatterns: [
43-
'node_modules/(?!(@storefront-ui)|vee-validate/dist/rules|nouislider)',
43+
'node_modules/(?!(@storefront-ui)|vee-validate/dist/rules|nouislider|lodash-es)',
4444
],
4545

4646
testMatch: ['<rootDir>/**/__tests__/**/*spec.[jt]s?(x)'],

packages/theme/nuxt.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export default () => {
207207
],
208208
transpile: [
209209
'vee-validate',
210+
'lodash-es',
210211
/^@storefront-ui/,
211212
],
212213
},

packages/theme/package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
"graphql-tag": "^2.12.6",
5050
"is-https": "^4.0.0",
5151
"isomorphic-dompurify": "^0.18.0",
52-
"lodash.debounce": "^4.0.8",
53-
"lodash.merge": "^4.6.2",
54-
"lodash.unescape": "^4.0.1",
52+
"lodash-es": "^4.17.21",
5553
"nuxt": "^2.15.8",
5654
"nuxt-i18n": "^6.28.0",
5755
"omit-deep": "^0.3.0",
@@ -70,9 +68,7 @@
7068
"@testing-library/jest-dom": "^5.16.4",
7169
"@testing-library/user-event": "^14.2.0",
7270
"@testing-library/vue": "^5.8.3",
73-
"@types/lodash.debounce": "^4.0.6",
74-
"@types/lodash.merge": "^4.6.7",
75-
"@types/lodash.unescape": "^4.0.7",
71+
"@types/lodash-es": "^4.17.6",
7672
"@vue/test-utils": "^1.3.0",
7773
"babel-core": "7.0.0-bridge.0",
7874
"babel-jest": "^27.4.6",

packages/theme/plugins/dompurify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import _unescape from 'lodash.unescape';
1+
import { unescape } from 'lodash-es';
22
import DOMPurify from 'isomorphic-dompurify';
33
import type { Plugin } from '@nuxt/types';
44

@@ -9,7 +9,7 @@ declare module 'vue/types/vue' {
99
}
1010

1111
const plugin : Plugin = (_, inject) => {
12-
inject('dompurify', (html: string): string => _unescape(DOMPurify.sanitize(html)));
12+
inject('dompurify', (html: string): string => unescape(DOMPurify.sanitize(html)));
1313
};
1414

1515
export default plugin;

yarn.lock

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,11 +1964,33 @@
19641964
"@types/yargs" "^16.0.0"
19651965
chalk "^4.0.0"
19661966

1967+
"@jridgewell/gen-mapping@^0.3.0":
1968+
version "0.3.1"
1969+
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz#cf92a983c83466b8c0ce9124fadeaf09f7c66ea9"
1970+
integrity sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==
1971+
dependencies:
1972+
"@jridgewell/set-array" "^1.0.0"
1973+
"@jridgewell/sourcemap-codec" "^1.4.10"
1974+
"@jridgewell/trace-mapping" "^0.3.9"
1975+
19671976
"@jridgewell/resolve-uri@^3.0.3":
19681977
version "3.0.5"
19691978
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz#68eb521368db76d040a6315cdb24bf2483037b9c"
19701979
integrity sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==
19711980

1981+
"@jridgewell/set-array@^1.0.0":
1982+
version "1.1.1"
1983+
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea"
1984+
integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==
1985+
1986+
"@jridgewell/source-map@^0.3.2":
1987+
version "0.3.2"
1988+
resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb"
1989+
integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==
1990+
dependencies:
1991+
"@jridgewell/gen-mapping" "^0.3.0"
1992+
"@jridgewell/trace-mapping" "^0.3.9"
1993+
19721994
"@jridgewell/sourcemap-codec@^1.4.10":
19731995
version "1.4.11"
19741996
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz#771a1d8d744eeb71b6adb35808e1a6c7b9b8c8ec"
@@ -1982,6 +2004,14 @@
19822004
"@jridgewell/resolve-uri" "^3.0.3"
19832005
"@jridgewell/sourcemap-codec" "^1.4.10"
19842006

2007+
"@jridgewell/trace-mapping@^0.3.9":
2008+
version "0.3.13"
2009+
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz#dcfe3e95f224c8fe97a87a5235defec999aa92ea"
2010+
integrity sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==
2011+
dependencies:
2012+
"@jridgewell/resolve-uri" "^3.0.3"
2013+
"@jridgewell/sourcemap-codec" "^1.4.10"
2014+
19852015
19862016
version "4.0.0"
19872017
resolved "https://registry.yarnpkg.com/@lerna/add/-/add-4.0.0.tgz#c36f57d132502a57b9e7058d1548b7a565ef183f"
@@ -3943,24 +3973,10 @@
39433973
resolved "https://registry.yarnpkg.com/@types/less/-/less-3.0.2.tgz#2761d477678c8374cb9897666871662eb1d1115e"
39443974
integrity sha512-62vfe65cMSzYaWmpmhqCMMNl0khen89w57mByPi1OseGfcV/LV03fO8YVrNj7rFQsRWNJo650WWyh6m7p8vZmA==
39453975

3946-
"@types/lodash.debounce@^4.0.6":
3947-
version "4.0.7"
3948-
resolved "https://registry.yarnpkg.com/@types/lodash.debounce/-/lodash.debounce-4.0.7.tgz#0285879defb7cdb156ae633cecd62d5680eded9f"
3949-
integrity sha512-X1T4wMZ+gT000M2/91SYj0d/7JfeNZ9PeeOldSNoE/lunLeQXKvkmIumI29IaKMotU/ln/McOIvgzZcQ/3TrSA==
3950-
dependencies:
3951-
"@types/lodash" "*"
3952-
3953-
"@types/lodash.merge@^4.6.7":
3954-
version "4.6.7"
3955-
resolved "https://registry.yarnpkg.com/@types/lodash.merge/-/lodash.merge-4.6.7.tgz#0af6555dd8bc6568ef73e5e0d820a027362946b1"
3956-
integrity sha512-OwxUJ9E50gw3LnAefSHJPHaBLGEKmQBQ7CZe/xflHkyy/wH2zVyEIAKReHvVrrn7zKdF58p16We9kMfh7v0RRQ==
3957-
dependencies:
3958-
"@types/lodash" "*"
3959-
3960-
"@types/lodash.unescape@^4.0.7":
3961-
version "4.0.7"
3962-
resolved "https://registry.yarnpkg.com/@types/lodash.unescape/-/lodash.unescape-4.0.7.tgz#69f1cab2e755b824151346a44faeaaf93702972b"
3963-
integrity sha512-KGxcfHpWcOnLeK5g71YErXL6m947wQC9XfhVjENlCku85C6WxsqNIxwxpqDCpL06rY5ExQiXZH50KgJDFLzc7Q==
3976+
"@types/lodash-es@^4.17.6":
3977+
version "4.17.6"
3978+
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.6.tgz#c2ed4c8320ffa6f11b43eb89e9eaeec65966a0a0"
3979+
integrity sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg==
39643980
dependencies:
39653981
"@types/lodash" "*"
39663982

@@ -13197,11 +13213,6 @@ lodash.templatesettings@^4.0.0:
1319713213
dependencies:
1319813214
lodash._reinterpolate "^3.0.0"
1319913215

13200-
lodash.unescape@^4.0.1:
13201-
version "4.0.1"
13202-
resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
13203-
integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=
13204-
1320513216
lodash.uniq@^4.5.0:
1320613217
version "4.5.0"
1320713218
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
@@ -17969,7 +17980,7 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
1796917980
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
1797017981
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
1797117982

17972-
source-map@^0.7.3, source-map@~0.7.2:
17983+
source-map@^0.7.3:
1797317984
version "0.7.3"
1797417985
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
1797517986
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
@@ -18716,13 +18727,13 @@ terser@^4.1.2, terser@^4.6.13, terser@^4.6.3:
1871618727
source-map-support "~0.5.12"
1871718728

1871818729
terser@^5.3.4, terser@^5.7.2:
18719-
version "5.11.0"
18720-
resolved "https://registry.yarnpkg.com/terser/-/terser-5.11.0.tgz#2da5506c02e12cd8799947f30ce9c5b760be000f"
18721-
integrity sha512-uCA9DLanzzWSsN1UirKwylhhRz3aKPInlfmpGfw8VN6jHsAtu8HJtIpeeHHK23rxnE/cDc+yvmq5wqkIC6Kn0A==
18730+
version "5.14.0"
18731+
resolved "https://registry.yarnpkg.com/terser/-/terser-5.14.0.tgz#eefeec9af5153f55798180ee2617f390bdd285e2"
18732+
integrity sha512-JC6qfIEkPBd9j1SMO3Pfn+A6w2kQV54tv+ABQLgZr7dA3k/DL/OBoYSWxzVpZev3J+bUHXfr55L8Mox7AaNo6g==
1872218733
dependencies:
18734+
"@jridgewell/source-map" "^0.3.2"
1872318735
acorn "^8.5.0"
1872418736
commander "^2.20.0"
18725-
source-map "~0.7.2"
1872618737
source-map-support "~0.5.20"
1872718738

1872818739
test-exclude@^6.0.0:

0 commit comments

Comments
 (0)