-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
BREAKING: Build packages with tsup
#3998
Conversation
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring: Next stepsTake a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with |
const { transform: transform3 } = await Promise.resolve().then(() => require("sucrase")); | ||
const result = transform3(code, { | ||
+ // https://github.com/egoist/tsup/issues/1087 | ||
+ disableESTransforms: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsup
uses sucrase
to transpile ESM to CJS (unless tree shaking is enabled, but that breaks source maps), and sucrase
enables all polyfills by default. Our environment supports all the features, so we don't need these polyfills. This also improves static analysis in LavaMoat.
constraints.pro
Outdated
% Published packages must not have side effects. | ||
gen_enforced_field(WorkspaceCwd, 'sideEffects', false) :- | ||
\+ workspace_field(WorkspaceCwd, 'private', true). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked every single package for side effects, but it looks like there aren't any. Setting sideEffects: false
improves tree shaking in tools like Webpack.
@SocketSecurity ignore npm/[email protected] These are expected to have shell / network access. @SocketSecurity ignore npm/[email protected] New author is ok. |
@metamaskbot publish-preview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I am not sure why the check failed, but once this branch is updated against |
Explanation
This changes the build system to build all packages with
tsup
, instead oftsc
.tsc
is still used for generating the declaration files and type checking, andtsup
is used for building the.js
and (new).mjs
files. The benefit of this is that we now have a ESM build as well as a CJS build.References
See MetaMask/utils#144.
Changelog
@metamask/accounts-controller
./dist
directly.@metamask/address-book-controller
./dist
directly.@metamask/announcement-controller
./dist
directly.@metamask/approval-controller
./dist
directly.@metamask/assets-controller
./dist
directly.@metamask/base-controller
./dist
directly.@metamask/build-utils
./dist
directly.@metamask/composable-controller
./dist
directly.@metamask/controller-utils
./dist
directly.@metamask/ens-controller
./dist
directly.@metamask/eth-json-rpc-provider
./dist
directly.@metamask/gas-fee-controller
./dist
directly.@metamask/json-rpc-engine
./dist
directly.@metamask/json-rpc-middleware-stream
./dist
directly.@metamask/keyring-controller
./dist
directly.@metamask/logging-controller
./dist
directly.@metamask/message-manager
./dist
directly.@metamask/name-controller
./dist
directly.@metamask/network-controller
./dist
directly.@metamask/notification-controller
./dist
directly.@metamask/permission-controller
./dist
directly.@metamask/permission-log-controller
./dist
directly.@metamask/phishing-controller
./dist
directly.@metamask/polling-controller
./dist
directly.@metamask/preferences-controller
./dist
directly.@metamask/queued-request-controller
./dist
directly.@metamask/rate-limit-controller
./dist
directly.@metamask/selected-network-controller
./dist
directly.@metamask/signature-controller
./dist
directly.@metamask/transaction-controller
./dist
directly.@metamask/user-operation-controller
./dist
directly.Checklist