-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
Support for Bun #489
Comments
After a quick look, I see the getPackageResolution() function needs to handle The bun.lockb file is a binary file, and I did some research on how to read it. I looked into how the bun-vscode extension handles displaying the content of When running the command I think the output looks like yarn v1, but I'm not sure. import { spawn } from 'node:child_process'
import lockfile from '@yarnpkg/lockfile'
const { parse: parseYarnLockFile } = lockfile
//
;(async () => {
const lockFileString = await readLockfile('./bun.lockb')
console.log(lockFileString)
const parsedYarnLockFile = parseYarnLockFile(lockFileString)
console.log(parsedYarnLockFile.object)
})()
/**
* @param {string} lockFilePath
* @returns {Promise<string>}
*/
function readLockfile(lockFilePath) {
return new Promise((resolve, reject) => {
const process = spawn('bun', [lockFilePath], {
stdio: ['ignore', 'pipe', 'pipe'],
})
let stdout = ''
process.stdout.on('data', (/** @type {Buffer} */ data) => {
stdout += data.toString()
})
let stderr = ''
process.stderr.on('data', (/** @type {Buffer} */ data) => {
stderr += data.toString()
})
process.on('error', (error) => {
reject(error)
})
process.on('exit', (code) => {
if (code === 0) {
resolve(stdout)
} else {
reject(new Error(`Bun exited with code: ${code}\n${stderr}`))
}
})
})
}
|
I believe so. It says yarn lockfile v1 in the output header. strengthless@Kams-Air test-repository % bun ./bun.lockb
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
# bun ./bun.lockb --hash: 4D7D58732D6A801C-feca8c93e240e793-C2755E71EE387323-f6946a04e0df29e1
"@0no-co/graphql.web@^1.0.1":
version "1.0.4"
resolved "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.0.4.tgz"
integrity sha512-W3ezhHGfO0MS1PtGloaTpg0PbaT8aZSmmaerL7idtU5F7oCI+uu25k+MsMS31BVFlp4aMkHSrNRxiD72IlK8TA==
"@ampproject/remapping@^2.2.0":
version "2.2.1"
resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz"
integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==
dependencies:
"@jridgewell/gen-mapping" "^0.3.0"
"@jridgewell/trace-mapping" "^0.3.9" |
Still doesn't work with Bun 1.1.3 |
@baphony [install.lockfile]
print = "yarn" to your Reference: oven-sh/bun#2336 (comment) |
Thank you for your help @nobkd That didn't work, but removing the yarn.lock generated by yarn did work :) |
Although Bun lockfiles aren't supported by patch-package, you can get Bun to output a yarn.lock to work around it. I did so temporarily, then removed it once I'd generated the patch I needed. ds300/patch-package#489 (comment)
FYI As of bun 1.2, the default lock file format has switched from binary to text-based. |
Bun has it’s own patching mechanism now |
My experience with bun's patching mechanism is that it is so buggy as to be unusable currently. There are many open issues with it. I would definitely still be interested in seeing support from the patch-package side. |
As mentioned in oven-sh/bun#2336 (comment),
Bun has just released their 1.0 version, and its popularity seems to be growing rapidly. Will there ever be support for Bun?
The text was updated successfully, but these errors were encountered: