-
Notifications
You must be signed in to change notification settings - Fork 91
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
[nodejs] add bun backend #101
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c0b1a2d
[nodejs] add bun backend
cdmistman caa1586
Merge branch 'main' of github.com:replit/upm into cad/bun
cdmistman 528a3d7
fix lint
cdmistman c4789b8
add bun backend to cli
cdmistman 20d48da
nodejs-bun -> bun
cdmistman d888c28
Revert Yarn Lockfile parsing abstraction
cdmistman 76dddec
use 'bun pm hash-string' for reading bun lockfile
cdmistman 2f376dd
fix version matching
cdmistman b11e9b1
cleanup comments
cdmistman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
additional env vars that might be helpful:
BUN_CONFIG_SKIP_SAVE_LOCKFILE
BUN_CONFIG_SKIP_LOAD_LOCKFILE
BUN_CONFIG_SKIP_INSTALL_PACKAGES
BUN_INSTALL_VERBOSE
GOMAXPROCS
(control max number of threads used, not in go but didn't want to make up a new env var for this)BUN_MANIFEST_CACHE=0
: no cacheBUN_MANIFEST_CACHE=1
: read the cache, but ignore Cache-Control headersBUN_MANIFEST_CACHE=2
: read the cache & follow Cache-Control headers (default)BUN_INSTALL_CACHE_DIR
BUN_INSTALL
(directory bun was installed in, not bun install)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.
also
bun pm ls --all
could be used to print out the installed package order in node_modules (due to hoisting, will often contain duplicate versions)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.
There is more config in
bunfig.toml
: https://github.com/oven-sh/bun/blob/jarred/new-bundler/src/bunfig.zig#L235-L426There 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.
That's fine, right now UPM only accepts one version per package, which is problematic anyways. The package version that's last in the output will be the one that's reported by UPM
So there seems to be 2 ways of reading the packages and versions in the bun lockfile:
bun.lockb
filebunfig.toml
file?bun pm ls --all
(@[a-z]+\/)?[a-z]+@[0-9]+\.[0-9]+\.[0-9]+
is there any possibility that the regex will break in the future?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.
those env vars are definitely helpful for some other things we have planned with bun, thank you!
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.
bun pm hash-string
might be easier for parsing and we cannot change it because doing so would invalidate lockfiles unexpectedly (we use that to determine if we should bother saving the lockfile)We probably should just add a way to print this info as JSON though.
Also you should set
COLORTERM=0
to ensure ansi color codes don't get included in output. It should be smart enough to detect this, but good to proactively disable thatThere 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.
Though
bun pm hash-string
returns all packages in the lockfile, but not all these packages will ultimately install (bun-webkit-linux-arm64
, for example, is not installed on linux x64 but exists in the lockfile so that the lockfile is consistent across operating systems and CPU architectures)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.
got it, it could be a future feature for UPM to detect platform-specific dependencies and filter/collate them, but that's not a large concern at the moment. Seems
bun pm hash-string
is the best option here - thanks!