Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Update dependencies #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Olyno
Copy link

@Olyno Olyno commented Sep 25, 2020

Hi,
Here is a simple pull request to update dependencies of the project. This pull request includes:

  • Added rimraf module to deep delete a directory on Windows (and so fix the test command of the project)
  • Updated Rollup plugins for deprecated ones.
    • rollup-plugin-commonjs --> @rollup/plugin-commonjs
    • rollup-plugin-json --> @rollup/plugin-json
    • rollup-plugin-node-resolve --> @rollup/plugin-node-resolve

WARNING: I tried to fix everything, but a module (browserify-fs) includes a lot of dependencies with security problems (3 included 1 with high danger). I didn't find any alternative, so any feedback about it is welcome.

@Niek
Copy link

Niek commented Oct 27, 2020

Can this be merged?

@Olyno
Copy link
Author

Olyno commented Oct 27, 2020

Yes it can but it still have all browserify-fs security issues that I can't resolve

danimoh added a commit to nimiq/ledger-api that referenced this pull request Nov 13, 2020
readable-stream has circular dependencies which cause inheriting a class which is still
undefined at that moment, resulting in a runtime error.

readable-stream is imported by @ledgerhq/hw-app-btc/src/hashPublicKey > ripemd160 > hash-base.
To fix the build, we replace it by stream which gets polyfilled by rollup-plugin-node-polyfills.
Note that stream and readable-stream are largely compatible and effectively the same code.
However, the stream polyfill used by rollup-plugin-node-polyfills is an older version which has
less problems with circular dependencies. The circular dependencies are currently being resolved
in readable-stream though and once merged (see nodejs/readable-stream#348)
the replacement should be removed or even turned around. Note that without the replacement, the
stream polyfill and readable-stream are both bundled, which is not desirable.

Note that the stream polyfill / older readable-stream version also has circular dependencies but
is able to run.

Other options tried to resolve this issue which didn't help were:
- Update readable-stream: the circular dependencies are still present in the current version of
  readable-stream. See nodejs/readable-stream#348 for progress on that
  issue getting resolved.
- Update rollup-plugin-node-polyfills dependencies and polyfills: While the plugin is not being
  updated and maintained anymore, there has been a recent pull request with updates:
  ionic-team/rollup-plugin-node-polyfills#14. This didn't help though.

Other options which have not been tried:
- Using @rollup/plugin-commonjs option dynamicRequireTargets: replicates the logic for dynamic
  requires and might fix problems with circular dynamic requires.
- rewrite imports as in rollup/rollup#1507 (comment):
  This is in the end similar to what we did.

Note that also re-ordering of the plugin order mitigated the issue of builds that fail to run,
however, still readable-stream has more circular dependencies than the stream polyfill and
therefore we keep this fix for now.
The re-ordering of plugins will be re-visited in a later change / commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants