Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Remove unnecessary dependencies from abi-utils #3432

Open
sz-piotr opened this issue Oct 13, 2020 · 3 comments
Open

Remove unnecessary dependencies from abi-utils #3432

sz-piotr opened this issue Oct 13, 2020 · 3 comments

Comments

@sz-piotr
Copy link

sz-piotr commented Oct 13, 2020

The package @truffle/abi-utils is sweet and simple, but requires a lot of potentially unnecessary dependencies. Some examples:

  • ajv
  • crypto-js, debug and ajv from truffle/contract-schema
  • source-map-support
  • change-case and its 12 other dependencies

It would be great for the package to be as lean as possible.

@gnidan
Copy link
Contributor

gnidan commented Oct 13, 2020

Note that we'll want to keep source-map-support, since that's what enables sourcemaps at runtime.

Probably the first thing to do here is to remove the use of @truffle/contract-schema's Abi type, and move that into this package instead... I'm thinking that, in addition to the normalized types that abi-utils provides, we could also provide "loose" types. That would avoid the need to use the autogenerated types altogether.

@sz-piotr
Copy link
Author

I wanted to ask about source map support. Why is it part of all the libraries in truffle instead of being required once somewhere in the user facing part at the top?

I did some research and it seems that it works great if the end user requires it but causes problems when being part of a library. Here a are some examples:

jestjs/jest#10330
TypeStrong/ts-node#268

We also have had a lot of problems in Waffle because of this:
TrueFiEng/Waffle#336

Maybe this dependency can also be reconsidered?

@gnidan
Copy link
Contributor

gnidan commented Oct 13, 2020

Hm, I'll have to do research into that after meetings today. It's possible that we missed something. We decided to use that package just because stacktraces without source maps have been very problematic in the past, and we wanted to solve the problem categorically.

But if that's not best practice, then it's certainly worth reconsidering! cc @haltman-at you also might want to be aware of this discussion.

edit, to answer your question directly:

Why is it part of all the libraries in truffle instead of being required once somewhere in the user facing part at the top?

Because we consider individual @truffle/* packages to be user facing :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants