-
Notifications
You must be signed in to change notification settings - Fork 214
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
vendor node_preamble so the test binary can be used by the Dart SDK #2423
Conversation
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. |
/// | ||
/// If [minified] is true, returns the minified version rather than the | ||
/// human-readable version. | ||
String getPreamble( |
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.
As a drive by comment, if we want to keep the package content as close to the upstream package as possible, this looks good. If however we're forking and want to have less to maintain, you can remove the _minified
content above, and the minified
and additionalGlobals
args here.
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.
Yeah I considered that... but I came to the conclusion it would be easiest to just keep it identical. I don't feel strongly either way.
Do we have any other source where we can get the content for this preamble and not treat it as vendored? @sigmundch do we have any Dart team authored compatibility shim for node? |
We should never use this at runtime in the SDK. What if we create a package stub for |
I would be fine with just putting a stub in the SDK |
Closing in favor of https://dart-review.googlesource.com/c/sdk/+/399221 |
I prefer the idea of the stub too. Also, I worry vendoring this way may not be proper. Embedding third-party code requires following special rules (e.g. always be in a third-party folder at the top of the repo). There isn't a version of this in the SDK already, but one could be created. The contents of the package were largely based on the existing d8 and jsshell preambles (e.g. computeCurrentScript). It just wasn't added in the SDK because it wasn't needed there. |
Two other options:
|
This would be great but isn't feasible to do right now. Maybe some day if we decide to invest in making the test package more pluggable.
Patch files are a nightmare to maintain, they cause constant headaches and should imo be avoided wherever possible, especially as long term solutions. |
Today the Dart SDK does not actually contain all the deps of package:test, which means you can't use the test binary with the SDKs version solve.
It also doesn't allow dependencies from unverified publishers, so vendoring is the easiest option.
This will help unblock potentially moving the SDK to use pub workspaces for resolution instead of a custom package config generator.