mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
fix(install): bun pm ls with unresolved dependencies (#24541)
### What does this PR do? Fixes `bun pm ls --all` crash with unresolved optional peer dependencies. Fixes `bun pm ls` crash with empty lockfiles. Fixes #24502 ### How did you verify your code works? Added a test for both crashes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -2007,10 +2007,6 @@ exports[`migrate migrate-bun-lockb-v2-most-features 1`] = `
|
||||
"id": 44,
|
||||
"package_id": 43,
|
||||
},
|
||||
"lodash": {
|
||||
"id": 10,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"loose-envify": {
|
||||
"id": 15,
|
||||
"package_id": 8,
|
||||
|
||||
@@ -23958,18 +23958,10 @@ exports[`ssr works for 100-ish requests 1`] = `
|
||||
"id": 407,
|
||||
"package_id": 61,
|
||||
},
|
||||
"@opentelemetry/api": {
|
||||
"id": 633,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@pkgjs/parseargs": {
|
||||
"id": 599,
|
||||
"package_id": 62,
|
||||
},
|
||||
"@playwright/test": {
|
||||
"id": 634,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@puppeteer/browsers": {
|
||||
"id": 719,
|
||||
"package_id": 63,
|
||||
@@ -24246,18 +24238,10 @@ exports[`ssr works for 100-ish requests 1`] = `
|
||||
"id": 905,
|
||||
"package_id": 131,
|
||||
},
|
||||
"babel-plugin-react-compiler": {
|
||||
"id": 635,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"balanced-match": {
|
||||
"id": 202,
|
||||
"package_id": 132,
|
||||
},
|
||||
"bare-buffer": {
|
||||
"id": 197,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bare-events": {
|
||||
"id": 194,
|
||||
"package_id": 133,
|
||||
@@ -24302,10 +24286,6 @@ exports[`ssr works for 100-ish requests 1`] = `
|
||||
"id": 1014,
|
||||
"package_id": 143,
|
||||
},
|
||||
"bufferutil": {
|
||||
"id": 1005,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bun-types": {
|
||||
"id": 4,
|
||||
"package_id": 144,
|
||||
@@ -24550,10 +24530,6 @@ exports[`ssr works for 100-ish requests 1`] = `
|
||||
"id": 398,
|
||||
"package_id": 204,
|
||||
},
|
||||
"eslint-plugin-import-x": {
|
||||
"id": 416,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"eslint-plugin-jsx-a11y": {
|
||||
"id": 399,
|
||||
"package_id": 205,
|
||||
@@ -25318,10 +25294,6 @@ exports[`ssr works for 100-ish requests 1`] = `
|
||||
"id": 451,
|
||||
"package_id": 395,
|
||||
},
|
||||
"sass": {
|
||||
"id": 638,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"scheduler": {
|
||||
"id": 731,
|
||||
"package_id": 396,
|
||||
@@ -25518,10 +25490,6 @@ exports[`ssr works for 100-ish requests 1`] = `
|
||||
"id": 877,
|
||||
"package_id": 442,
|
||||
},
|
||||
"ts-node": {
|
||||
"id": 701,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"tsconfig-paths": {
|
||||
"id": 436,
|
||||
"package_id": 443,
|
||||
@@ -25578,10 +25546,6 @@ exports[`ssr works for 100-ish requests 1`] = `
|
||||
"id": 138,
|
||||
"package_id": 456,
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"id": 1006,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"util-deprecate": {
|
||||
"id": 705,
|
||||
"package_id": 457,
|
||||
|
||||
@@ -23958,18 +23958,10 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = `
|
||||
"id": 407,
|
||||
"package_id": 61,
|
||||
},
|
||||
"@opentelemetry/api": {
|
||||
"id": 633,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@pkgjs/parseargs": {
|
||||
"id": 599,
|
||||
"package_id": 62,
|
||||
},
|
||||
"@playwright/test": {
|
||||
"id": 634,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@puppeteer/browsers": {
|
||||
"id": 719,
|
||||
"package_id": 63,
|
||||
@@ -24246,18 +24238,10 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = `
|
||||
"id": 905,
|
||||
"package_id": 131,
|
||||
},
|
||||
"babel-plugin-react-compiler": {
|
||||
"id": 635,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"balanced-match": {
|
||||
"id": 202,
|
||||
"package_id": 132,
|
||||
},
|
||||
"bare-buffer": {
|
||||
"id": 197,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bare-events": {
|
||||
"id": 194,
|
||||
"package_id": 133,
|
||||
@@ -24302,10 +24286,6 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = `
|
||||
"id": 1014,
|
||||
"package_id": 143,
|
||||
},
|
||||
"bufferutil": {
|
||||
"id": 1005,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bun-types": {
|
||||
"id": 4,
|
||||
"package_id": 144,
|
||||
@@ -24550,10 +24530,6 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = `
|
||||
"id": 398,
|
||||
"package_id": 204,
|
||||
},
|
||||
"eslint-plugin-import-x": {
|
||||
"id": 416,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"eslint-plugin-jsx-a11y": {
|
||||
"id": 399,
|
||||
"package_id": 205,
|
||||
@@ -25318,10 +25294,6 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = `
|
||||
"id": 451,
|
||||
"package_id": 395,
|
||||
},
|
||||
"sass": {
|
||||
"id": 638,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"scheduler": {
|
||||
"id": 731,
|
||||
"package_id": 396,
|
||||
@@ -25518,10 +25490,6 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = `
|
||||
"id": 877,
|
||||
"package_id": 442,
|
||||
},
|
||||
"ts-node": {
|
||||
"id": 701,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"tsconfig-paths": {
|
||||
"id": 436,
|
||||
"package_id": 443,
|
||||
@@ -25578,10 +25546,6 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = `
|
||||
"id": 138,
|
||||
"package_id": 456,
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"id": 1006,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"util-deprecate": {
|
||||
"id": 705,
|
||||
"package_id": 457,
|
||||
|
||||
@@ -23958,18 +23958,10 @@ exports[`next build works: bun 1`] = `
|
||||
"id": 407,
|
||||
"package_id": 61,
|
||||
},
|
||||
"@opentelemetry/api": {
|
||||
"id": 633,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@pkgjs/parseargs": {
|
||||
"id": 599,
|
||||
"package_id": 62,
|
||||
},
|
||||
"@playwright/test": {
|
||||
"id": 634,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@puppeteer/browsers": {
|
||||
"id": 719,
|
||||
"package_id": 63,
|
||||
@@ -24246,18 +24238,10 @@ exports[`next build works: bun 1`] = `
|
||||
"id": 905,
|
||||
"package_id": 131,
|
||||
},
|
||||
"babel-plugin-react-compiler": {
|
||||
"id": 635,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"balanced-match": {
|
||||
"id": 202,
|
||||
"package_id": 132,
|
||||
},
|
||||
"bare-buffer": {
|
||||
"id": 197,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bare-events": {
|
||||
"id": 194,
|
||||
"package_id": 133,
|
||||
@@ -24302,10 +24286,6 @@ exports[`next build works: bun 1`] = `
|
||||
"id": 1014,
|
||||
"package_id": 143,
|
||||
},
|
||||
"bufferutil": {
|
||||
"id": 1005,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bun-types": {
|
||||
"id": 4,
|
||||
"package_id": 144,
|
||||
@@ -24550,10 +24530,6 @@ exports[`next build works: bun 1`] = `
|
||||
"id": 398,
|
||||
"package_id": 204,
|
||||
},
|
||||
"eslint-plugin-import-x": {
|
||||
"id": 416,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"eslint-plugin-jsx-a11y": {
|
||||
"id": 399,
|
||||
"package_id": 205,
|
||||
@@ -25318,10 +25294,6 @@ exports[`next build works: bun 1`] = `
|
||||
"id": 451,
|
||||
"package_id": 395,
|
||||
},
|
||||
"sass": {
|
||||
"id": 638,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"scheduler": {
|
||||
"id": 731,
|
||||
"package_id": 396,
|
||||
@@ -25518,10 +25490,6 @@ exports[`next build works: bun 1`] = `
|
||||
"id": 877,
|
||||
"package_id": 442,
|
||||
},
|
||||
"ts-node": {
|
||||
"id": 701,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"tsconfig-paths": {
|
||||
"id": 436,
|
||||
"package_id": 443,
|
||||
@@ -25578,10 +25546,6 @@ exports[`next build works: bun 1`] = `
|
||||
"id": 138,
|
||||
"package_id": 456,
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"id": 1006,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"util-deprecate": {
|
||||
"id": 705,
|
||||
"package_id": 457,
|
||||
@@ -49932,18 +49896,10 @@ exports[`next build works: node 1`] = `
|
||||
"id": 407,
|
||||
"package_id": 61,
|
||||
},
|
||||
"@opentelemetry/api": {
|
||||
"id": 633,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@pkgjs/parseargs": {
|
||||
"id": 599,
|
||||
"package_id": 62,
|
||||
},
|
||||
"@playwright/test": {
|
||||
"id": 634,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"@puppeteer/browsers": {
|
||||
"id": 719,
|
||||
"package_id": 63,
|
||||
@@ -50220,18 +50176,10 @@ exports[`next build works: node 1`] = `
|
||||
"id": 905,
|
||||
"package_id": 131,
|
||||
},
|
||||
"babel-plugin-react-compiler": {
|
||||
"id": 635,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"balanced-match": {
|
||||
"id": 202,
|
||||
"package_id": 132,
|
||||
},
|
||||
"bare-buffer": {
|
||||
"id": 197,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bare-events": {
|
||||
"id": 194,
|
||||
"package_id": 133,
|
||||
@@ -50276,10 +50224,6 @@ exports[`next build works: node 1`] = `
|
||||
"id": 1014,
|
||||
"package_id": 143,
|
||||
},
|
||||
"bufferutil": {
|
||||
"id": 1005,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"bun-types": {
|
||||
"id": 4,
|
||||
"package_id": 144,
|
||||
@@ -50524,10 +50468,6 @@ exports[`next build works: node 1`] = `
|
||||
"id": 398,
|
||||
"package_id": 204,
|
||||
},
|
||||
"eslint-plugin-import-x": {
|
||||
"id": 416,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"eslint-plugin-jsx-a11y": {
|
||||
"id": 399,
|
||||
"package_id": 205,
|
||||
@@ -51292,10 +51232,6 @@ exports[`next build works: node 1`] = `
|
||||
"id": 451,
|
||||
"package_id": 395,
|
||||
},
|
||||
"sass": {
|
||||
"id": 638,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"scheduler": {
|
||||
"id": 731,
|
||||
"package_id": 396,
|
||||
@@ -51492,10 +51428,6 @@ exports[`next build works: node 1`] = `
|
||||
"id": 877,
|
||||
"package_id": 442,
|
||||
},
|
||||
"ts-node": {
|
||||
"id": 701,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"tsconfig-paths": {
|
||||
"id": 436,
|
||||
"package_id": 443,
|
||||
@@ -51552,10 +51484,6 @@ exports[`next build works: node 1`] = `
|
||||
"id": 138,
|
||||
"package_id": 456,
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"id": 1006,
|
||||
"package_id": 4294967295,
|
||||
},
|
||||
"util-deprecate": {
|
||||
"id": 705,
|
||||
"package_id": 457,
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { bunEnv, bunExe, runBunInstall, tempDirWithFiles } from "harness";
|
||||
|
||||
test("unresolved optional peers don't crash", async () => {
|
||||
const testDir = tempDirWithFiles("unresolved-optional-peer", {
|
||||
"package.json": JSON.stringify({
|
||||
name: "pkg",
|
||||
peerDependencies: {
|
||||
jquery: "3.7.1",
|
||||
},
|
||||
peerDependenciesMeta: {
|
||||
jquery: {
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
await runBunInstall(bunEnv, testDir);
|
||||
|
||||
const { stdout, stderr, exited } = Bun.spawn({
|
||||
cmd: [bunExe(), "pm", "ls", "--all"],
|
||||
cwd: testDir,
|
||||
stdout: "pipe",
|
||||
stderr: "pipe",
|
||||
});
|
||||
|
||||
expect(await exited).toBe(0);
|
||||
expect(await stdout.text()).toBe("");
|
||||
expect(await stderr.text()).toBe("");
|
||||
});
|
||||
Reference in New Issue
Block a user