Skip to content

Commit

Permalink
refactor: removed most of the polyfills from config-overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabadesso committed Feb 24, 2025
1 parent ea644ef commit eec7214
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1,269 deletions.
12 changes: 6 additions & 6 deletions config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ module.exports = function override(config, env) {
config.resolve = {
...config.resolve,
fallback: {
url: require.resolve('url'),
url: false,
fs: false,
assert: require.resolve('assert'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
http: false,
https: false,
os: require.resolve('os-browserify'),
buffer: require.resolve('buffer'),
stream: require.resolve('stream-browserify'),
vm: require.resolve('vm-browserify'),
path: require.resolve("path-browserify"),
vm: false,
worker_threads: false,
perf_hooks: false,
tls: false,
Expand Down Expand Up @@ -78,7 +78,7 @@ module.exports = function override(config, env) {
...config.plugins.filter(p => !(p instanceof webpack.ProvidePlugin)),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer-shim', 'default']
Buffer: ['buffer', 'Buffer'],
}),
];

Expand Down
82 changes: 22 additions & 60 deletions lavamoat/webpack/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"setTimeout": true
},
"packages": {
"$root$": true,
"@hathor/wallet-lib>bitcore-lib": true,
"@hathor/wallet-lib>bitcore-mnemonic": true,
"@hathor/wallet-lib>crypto-js": true,
Expand All @@ -41,7 +40,6 @@
"process.browser": true
},
"packages": {
"$root$": true,
"@hathor/wallet-lib>bitcore-lib>bech32": true,
"@hathor/wallet-lib>bitcore-lib>bs58": true,
"@hathor/wallet-lib>bitcore-lib>buffer-compare": true,
Expand All @@ -52,8 +50,7 @@
"crypto-browserify>create-ecdh>elliptic": true,
"crypto-browserify>inherits": true,
"cypress>lodash": true,
"process": true,
"url": true
"process": true
}
},
"@hathor/wallet-lib>bitcore-lib>bs58": {
Expand All @@ -73,9 +70,9 @@
"Buffer.isBuffer": true
},
"packages": {
"$root$": true,
"@hathor/wallet-lib>bitcore-lib": true,
"@hathor/wallet-lib>bitcore-mnemonic>unorm": true,
"buffer": true,
"crypto-browserify": true
}
},
Expand Down Expand Up @@ -576,7 +573,7 @@
"setTimeout": true
},
"packages": {
"$root$": true,
"buffer": true,
"process": true
}
},
Expand Down Expand Up @@ -637,7 +634,7 @@
"Buffer.concat": true
},
"packages": {
"$root$": true,
"buffer": true,
"crypto-browserify>browserify-cipher>browserify-aes>buffer-xor": true,
"crypto-browserify>browserify-cipher>evp_bytestokey": true,
"crypto-browserify>create-hash>cipher-base": true,
Expand All @@ -650,7 +647,7 @@
"Buffer": true
},
"packages": {
"$root$": true
"buffer": true
}
},
"crypto-browserify>browserify-cipher>browserify-des": {
Expand Down Expand Up @@ -730,8 +727,8 @@
"crypto-browserify>browserify-sign>readable-stream>safe-buffer": true,
"null-loader>webpack>events": true,
"process": true,
"stream-http>readable-stream>string_decoder": true,
"stream-http>readable-stream>util-deprecate": true
"stream-browserify>readable-stream>string_decoder": true,
"stream-browserify>readable-stream>util-deprecate": true
}
},
"crypto-browserify>browserify-sign>readable-stream>core-util-is": {
Expand All @@ -757,7 +754,7 @@
"Buffer": true
},
"packages": {
"$root$": true,
"buffer": true,
"crypto-browserify>create-ecdh>bn.js": true,
"crypto-browserify>create-ecdh>elliptic": true
}
Expand All @@ -774,6 +771,9 @@
}
},
"crypto-browserify>create-ecdh>elliptic>bn.js": {
"globals": {
"console.error": true
},
"packages": {
"$root$": true
}
Expand Down Expand Up @@ -811,7 +811,7 @@
"crypto-browserify>inherits": true,
"cypress>@cypress/request>safe-buffer": true,
"stream-browserify": true,
"stream-http>readable-stream>string_decoder": true
"stream-browserify>readable-stream>string_decoder": true
}
},
"crypto-browserify>create-hash>md5.js": {
Expand All @@ -836,7 +836,7 @@
"Buffer": true
},
"packages": {
"$root$": true,
"buffer": true,
"crypto-browserify>create-ecdh>bn.js": true,
"crypto-browserify>diffie-hellman>miller-rabin": true,
"crypto-browserify>randombytes": true
Expand Down Expand Up @@ -892,7 +892,7 @@
"Buffer": true
},
"packages": {
"$root$": true,
"buffer": true,
"crypto-browserify>public-encrypt>browserify-rsa>bn.js": true,
"crypto-browserify>randombytes": true
}
Expand All @@ -916,8 +916,7 @@
"buffer": true,
"crypto-browserify>create-ecdh>bn.js": true,
"crypto-browserify>create-ecdh>elliptic>minimalistic-assert": true,
"crypto-browserify>inherits": true,
"vm-browserify": true
"crypto-browserify>inherits": true
}
},
"crypto-browserify>randombytes": {
Expand Down Expand Up @@ -1245,21 +1244,21 @@
"null-loader>webpack>events": true,
"process": true,
"stream-browserify>inherits": true,
"stream-http>readable-stream>string_decoder": true,
"stream-http>readable-stream>util-deprecate": true
"stream-browserify>readable-stream>string_decoder": true,
"stream-browserify>readable-stream>util-deprecate": true
}
},
"stream-http>readable-stream>string_decoder": {
"stream-browserify>readable-stream>string_decoder": {
"packages": {
"stream-http>readable-stream>string_decoder>safe-buffer": true
"stream-browserify>readable-stream>string_decoder>safe-buffer": true
}
},
"stream-http>readable-stream>string_decoder>safe-buffer": {
"stream-browserify>readable-stream>string_decoder>safe-buffer": {
"packages": {
"buffer": true
}
},
"stream-http>readable-stream>util-deprecate": {
"stream-browserify>readable-stream>util-deprecate": {
"globals": {
"console.trace": true,
"console.warn": true,
Expand Down Expand Up @@ -1288,36 +1287,6 @@
"setTimeout": true
}
},
"url": {
"packages": {
"url>punycode": true,
"url>qs": true
}
},
"url>punycode": {
"globals": {
"define": true
}
},
"url>qs": {
"packages": {
"url>qs>side-channel": true
}
},
"url>qs>side-channel": {
"packages": {
"assert>call-bind": true,
"assert>call-bind>es-errors": true,
"assert>call-bind>get-intrinsic": true,
"url>qs>side-channel>object-inspect": true
}
},
"url>qs>side-channel>object-inspect": {
"globals": {
"HTMLElement": true,
"WeakRef": true
}
},
"viz.js": {
"globals": {
"Browser.asyncLoad": true,
Expand Down Expand Up @@ -1368,16 +1337,9 @@
"webkitIndexedDB": true
},
"packages": {
"$root$": true,
"buffer": true,
"process": true
}
},
"vm-browserify": {
"globals": {
"document.body.appendChild": true,
"document.body.removeChild": true,
"document.createElement": true
}
}
}
}
Loading

0 comments on commit eec7214

Please sign in to comment.