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
[v2.0.0] Remove @types dependencies #3395
Conversation
Codecov Report
@@ Coverage Diff @@
## release-2.0.0 #3395 +/- ##
=============================================
Coverage 95% 95%
=============================================
Files 171 171
Lines 5801 5801
Branches 1712 1712
=============================================
Hits 5511 5511
Misses 157 157
Partials 133 133
Continue to review full report at Codecov.
|
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via
or load it into the REPL: |
* Replace Buffer with UInt8Array and get rid of Node types dependency * Git rid of ESTree dependency by using a specialized version of acorn's Node type * Fix test and adjust documentation
* Replace Buffer with UInt8Array and get rid of Node types dependency * Git rid of ESTree dependency by using a specialized version of acorn's Node type * Fix test and adjust documentation
* Replace Buffer with UInt8Array and get rid of Node types dependency * Git rid of ESTree dependency by using a specialized version of acorn's Node type * Fix test and adjust documentation
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Resolves #3108, #2142
Description
I hope this is the last change that is going into 2.0.0.
One problem that was reported repeatedly is that Rollup's dependency on
@types/node
was causing issues for users that were not targeting Node but had conflicting types such as AMD or browser types. Moreover it was not clear why non-TypeScript-users would need to have external type dependencies.One suggestion was to make the types a peerDependency but in our opinion this would have caused unnecessary friction for TypeScript users. This PR finally fixes this by getting rid of the @types dependencies the following way:
Buffer
. A NodeBuffer
however is a sub-class ofUInt8Array
, which is a standard JS type and still very powerful. So this replacesBuffer
everywhere withUInt8Array
.ESTree
types in our public interface, we only hadacorn.Node
as a type internally. This PR replaces allESTree.Node
types with a simplified, copied version ofacorn.Node
that reflects the properties present on all nodes. Note that you will need type casts if you need to access properties of specific node types.I also made sure that the typings test for the public interface that we have in place will ignore all
@types
packages that come from our dev dependencies and will thus ensure that we do not accidentally add a dependency on@types/node
to the published artefact.