From 2027763e579cf5c8795c0f6778db8334fce27927 Mon Sep 17 00:00:00 2001 From: Michele Esposito <34438276+mikesposito@users.noreply.github.com> Date: Fri, 13 Jan 2023 17:10:55 +0100 Subject: [PATCH] Minimize lodash size in dependencies (#16030) * chore: update lavamoat policies * chore: fix build and lavamoat policy * revert: 2f74297 as it increases bundle size * chore: regenerate lavamoat policy * chore: rebuild policy after rebase * chore: added missing resolution * cleanup rebase Co-authored-by: Alex --- lavamoat/browserify/beta/policy.json | 29 +++++++++++++------------- lavamoat/browserify/flask/policy.json | 30 +++++++++++++-------------- lavamoat/browserify/main/policy.json | 29 +++++++++++++------------- package.json | 3 ++- yarn.lock | 25 ++++++++-------------- 5 files changed, 53 insertions(+), 63 deletions(-) diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index d301a614b..297409e17 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -510,12 +510,12 @@ "@ethersproject/providers": true, "@metamask/assets-controllers>@metamask/contract-metadata": true, "@metamask/assets-controllers>abort-controller": true, - "@metamask/assets-controllers>async-mutex": true, "@metamask/assets-controllers>multiformats": true, "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/metamask-eth-abis": true, "browserify>events": true, + "eth-json-rpc-filters>async-mutex": true, "eth-query": true, "eth-rpc-errors": true, "ethereumjs-util": true, @@ -529,14 +529,6 @@ "AbortController": true } }, - "@metamask/assets-controllers>async-mutex": { - "globals": { - "setTimeout": true - }, - "packages": { - "enzyme>cheerio>tslib": true - } - }, "@metamask/assets-controllers>multiformats": { "globals": { "TextDecoder": true, @@ -2182,18 +2174,25 @@ "results": "write" }, "packages": { - "await-semaphore": true, + "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-json-rpc-middleware": true, - "eth-json-rpc-filters>eth-json-rpc-middleware>pify": true, - "eth-json-rpc-filters>json-rpc-engine": true, - "eth-json-rpc-filters>lodash.flatmap": true, "eth-query": true, - "safe-event-emitter": true + "json-rpc-engine": true, + "json-rpc-engine>@metamask/safe-event-emitter": true, + "pify": true + } + }, + "eth-json-rpc-filters>async-mutex": { + "globals": { + "setTimeout": true + }, + "packages": { + "enzyme>cheerio>tslib": true } }, "eth-json-rpc-filters>eth-json-rpc-middleware": { "packages": { - "eth-json-rpc-filters>json-rpc-engine": true + "eth-json-rpc-filters>eth-json-rpc-middleware>json-rpc-engine": true } }, "eth-json-rpc-middleware": { diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index afb3f97ed..c7ca31163 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -510,12 +510,12 @@ "@ethersproject/providers": true, "@metamask/assets-controllers>@metamask/contract-metadata": true, "@metamask/assets-controllers>abort-controller": true, - "@metamask/assets-controllers>async-mutex": true, "@metamask/assets-controllers>multiformats": true, "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/metamask-eth-abis": true, "browserify>events": true, + "eth-json-rpc-filters>async-mutex": true, "eth-query": true, "eth-rpc-errors": true, "ethereumjs-util": true, @@ -529,14 +529,6 @@ "AbortController": true } }, - "@metamask/assets-controllers>async-mutex": { - "globals": { - "setTimeout": true - }, - "packages": { - "enzyme>cheerio>tslib": true - } - }, "@metamask/assets-controllers>multiformats": { "globals": { "TextDecoder": true, @@ -1150,7 +1142,6 @@ "@metamask/snaps-controllers": { "globals": { "URL": true, - "assert": true, "clearTimeout": true, "console.error": true, "console.info": true, @@ -2508,18 +2499,25 @@ "results": "write" }, "packages": { - "await-semaphore": true, + "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-json-rpc-middleware": true, - "eth-json-rpc-filters>eth-json-rpc-middleware>pify": true, - "eth-json-rpc-filters>json-rpc-engine": true, - "eth-json-rpc-filters>lodash.flatmap": true, "eth-query": true, - "safe-event-emitter": true + "json-rpc-engine": true, + "json-rpc-engine>@metamask/safe-event-emitter": true, + "pify": true + } + }, + "eth-json-rpc-filters>async-mutex": { + "globals": { + "setTimeout": true + }, + "packages": { + "enzyme>cheerio>tslib": true } }, "eth-json-rpc-filters>eth-json-rpc-middleware": { "packages": { - "eth-json-rpc-filters>json-rpc-engine": true + "eth-json-rpc-filters>eth-json-rpc-middleware>json-rpc-engine": true } }, "eth-json-rpc-middleware": { diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index d301a614b..297409e17 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -510,12 +510,12 @@ "@ethersproject/providers": true, "@metamask/assets-controllers>@metamask/contract-metadata": true, "@metamask/assets-controllers>abort-controller": true, - "@metamask/assets-controllers>async-mutex": true, "@metamask/assets-controllers>multiformats": true, "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/metamask-eth-abis": true, "browserify>events": true, + "eth-json-rpc-filters>async-mutex": true, "eth-query": true, "eth-rpc-errors": true, "ethereumjs-util": true, @@ -529,14 +529,6 @@ "AbortController": true } }, - "@metamask/assets-controllers>async-mutex": { - "globals": { - "setTimeout": true - }, - "packages": { - "enzyme>cheerio>tslib": true - } - }, "@metamask/assets-controllers>multiformats": { "globals": { "TextDecoder": true, @@ -2182,18 +2174,25 @@ "results": "write" }, "packages": { - "await-semaphore": true, + "eth-json-rpc-filters>async-mutex": true, "eth-json-rpc-filters>eth-json-rpc-middleware": true, - "eth-json-rpc-filters>eth-json-rpc-middleware>pify": true, - "eth-json-rpc-filters>json-rpc-engine": true, - "eth-json-rpc-filters>lodash.flatmap": true, "eth-query": true, - "safe-event-emitter": true + "json-rpc-engine": true, + "json-rpc-engine>@metamask/safe-event-emitter": true, + "pify": true + } + }, + "eth-json-rpc-filters>async-mutex": { + "globals": { + "setTimeout": true + }, + "packages": { + "enzyme>cheerio>tslib": true } }, "eth-json-rpc-filters>eth-json-rpc-middleware": { "packages": { - "eth-json-rpc-filters>json-rpc-engine": true + "eth-json-rpc-filters>eth-json-rpc-middleware>json-rpc-engine": true } }, "eth-json-rpc-middleware": { diff --git a/package.json b/package.json index a060dcd2c..babb60e1e 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "pubnub/superagent-proxy": "^3.0.0", "json-schema": "^0.4.0", "simple-get": "^4.0.1", + "web3-provider-engine/eth-json-rpc-filters": "^5.0.0", "typescript@~4.4.0": "patch:typescript@npm:4.4.4#.yarn/patches/typescript-npm-4.4.4-3fedcc07a3.patch", "acorn@^7.0.0": "patch:acorn@npm:7.4.1#.yarn/patches/acorn-npm-7.4.1-f450b4646c.patch", "acorn@^7.4.1": "patch:acorn@npm:7.4.1#.yarn/patches/acorn-npm-7.4.1-f450b4646c.patch", @@ -261,7 +262,7 @@ "end-of-stream": "^1.4.4", "eth-block-tracker": "^6.0.0", "eth-ens-namehash": "^2.0.8", - "eth-json-rpc-filters": "^4.2.1", + "eth-json-rpc-filters": "^5.0.0", "eth-json-rpc-middleware": "^9.0.1", "eth-keyring-controller": "^8.1.0", "eth-lattice-keyring": "^0.12.3", diff --git a/yarn.lock b/yarn.lock index 5ca697072..5a7103b8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14677,17 +14677,17 @@ __metadata: languageName: node linkType: hard -"eth-json-rpc-filters@npm:^4.2.1": - version: 4.2.1 - resolution: "eth-json-rpc-filters@npm:4.2.1" +"eth-json-rpc-filters@npm:^5.0.0": + version: 5.0.0 + resolution: "eth-json-rpc-filters@npm:5.0.0" dependencies: - await-semaphore: ^0.1.3 + "@metamask/safe-event-emitter": ^2.0.0 + async-mutex: ^0.2.6 eth-json-rpc-middleware: ^6.0.0 eth-query: ^2.1.2 - json-rpc-engine: ^5.3.0 - lodash.flatmap: ^4.5.0 - safe-event-emitter: ^1.0.1 - checksum: 3eef7867c3f1ce4f8a27767586f736ce8031fae49da6ba0454e3a5c9231174aadc1380716d901ccede1f0c2b278a7c7cb0b2bf93869783f0fc417389051a6b2e + json-rpc-engine: ^6.1.0 + pify: ^5.0.0 + checksum: 5ae22c40aaa477e5784e1dd274612e4abd8d649f5c6030704c54899435d56c31fe6d911f60abe2867878141a6f20cdf0024b1c2a0ddc0173b8b40b53e92060e2 languageName: node linkType: hard @@ -21955,13 +21955,6 @@ __metadata: languageName: node linkType: hard -"lodash.flatmap@npm:^4.5.0": - version: 4.5.0 - resolution: "lodash.flatmap@npm:4.5.0" - checksum: c01a47d32e99f8fce75409f0a4a9bd12fbb2d3a46519a0dde14deedb1e527b5ddccc2bf997705c67bdecb915f47749e8a9ffefa7a91c41f0c448e06348ec81c7 - languageName: node - linkType: hard - "lodash.flattendeep@npm:^4.4.0": version: 4.4.0 resolution: "lodash.flattendeep@npm:4.4.0" @@ -22929,7 +22922,7 @@ __metadata: eslint-plugin-storybook: ^0.6.4 eth-block-tracker: ^6.0.0 eth-ens-namehash: ^2.0.8 - eth-json-rpc-filters: ^4.2.1 + eth-json-rpc-filters: ^5.0.0 eth-json-rpc-middleware: ^9.0.1 eth-keyring-controller: ^8.1.0 eth-lattice-keyring: ^0.12.3