Compare commits

...

4 Commits

Author SHA1 Message Date
autofix-ci[bot]
3367fa6bf9 [autofix.ci] apply automated fixes 2025-11-02 07:15:43 +00:00
Claude Bot
b2e7dad011 Update test snapshots for relative lockfile URLs
All snapshots now reflect the new lockfile format with relative URLs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 07:13:12 +00:00
Claude Bot
492a21fe1f Fix verdaccio IPv4/IPv6 binding issue and update snapshots
- Changed VerdaccioRegistry to bind to 0.0.0.0 instead of just port number
- This fixes IPv4/IPv6 mismatch where verdaccio bound only to IPv6 ::1
- Updated test snapshots to reflect relative lockfile URLs
- Added verdaccio.test.ts to verify registry connectivity

The root cause was that when verdaccio was started with just a port number,
it would bind to [::1]:PORT (IPv6 only), but bun's HTTP client would try
to connect to 127.0.0.1:PORT (IPv4), causing ConnectionRefused errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 07:08:05 +00:00
Claude Bot
cbf29c78e2 Strip registry URL prefix from tarball URLs in bun.lock
This change makes lockfiles more portable across different registries and
proxy configurations by storing tarball URLs as relative paths when they
start with the package's registry URL.

When writing the lockfile:
- If a tarball URL starts with the package's registry URL (from
  scopeForPackageName), strip that prefix
- Store only the relative path (e.g., "/lodash/-/lodash-4.17.21.tgz")

When reading the lockfile:
- If a URL doesn't start with http:// or https://, treat it as relative
- Prepend the package's registry URL to reconstruct the full URL

This allows users with custom registries or proxies to share lockfiles
more easily without URL mismatches.

Manual testing shows:
- Default registry packages now have relative URLs (e.g., "/is-number/-/is-number-7.0.0.tgz")
- Packages resolved from different registries keep full URLs
- Reinstalling from lockfiles works correctly with --frozen-lockfile

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 07:58:24 +00:00
11 changed files with 315 additions and 192 deletions

View File

@@ -322,7 +322,7 @@ pub fn loadFromDir(
var buffered_writer = writer_buf.bufferedWriter();
const writer = buffered_writer.writer();
TextLockfile.Stringifier.saveFromBinary(allocator, result.ok.lockfile, &result, writer) catch |err| {
TextLockfile.Stringifier.saveFromBinary(allocator, result.ok.lockfile, &result, &manager.?.options, writer) catch |err| {
Output.panic("failed to convert binary lockfile to text lockfile: {s}", .{@errorName(err)});
};
@@ -1224,7 +1224,7 @@ pub fn saveToDisk(this: *Lockfile, load_result: *const LoadResult, options: *con
var buffered_writer = writer_buf.bufferedWriter();
const writer = buffered_writer.writer();
TextLockfile.Stringifier.saveFromBinary(bun.default_allocator, this, load_result, writer) catch |err| switch (err) {
TextLockfile.Stringifier.saveFromBinary(bun.default_allocator, this, load_result, options, writer) catch |err| switch (err) {
error.OutOfMemory => bun.outOfMemory(),
};

View File

@@ -27,7 +27,16 @@ pub const Stringifier = struct {
// _ = this;
// }
pub fn saveFromBinary(allocator: std.mem.Allocator, lockfile: *BinaryLockfile, load_result: *const LoadResult, writer: anytype) @TypeOf(writer).Error!void {
fn scopeForPackageName(options: *const PackageManager.Options, name: string) *const Npm.Registry.Scope {
if (name.len == 0 or name[0] != '@') return &options.scope;
return options.registries.getPtr(
Npm.Registry.Scope.hash(
Npm.Registry.Scope.getName(name),
),
) orelse &options.scope;
}
pub fn saveFromBinary(allocator: std.mem.Allocator, lockfile: *BinaryLockfile, load_result: *const LoadResult, options: *const PackageManager.Options, writer: anytype) @TypeOf(writer).Error!void {
const buf = lockfile.buffers.string_bytes.items;
const extern_strings = lockfile.buffers.extern_strings.items;
const deps_buf = lockfile.buffers.dependencies.items;
@@ -582,13 +591,19 @@ pub const Stringifier = struct {
res.value.npm.version.fmt(buf),
});
// only write the registry if it's not the default. empty string means default registry
try writer.print("\"{s}\", ", .{
if (strings.hasPrefixComptime(res.value.npm.url.slice(buf), strings.withoutTrailingSlash(Npm.Registry.default_url)))
""
else
res.value.npm.url.slice(buf),
});
// Strip the registry URL prefix if the resolved URL starts with it
// This allows users with proxies or custom registries to more easily share lockfiles
const resolved_url = res.value.npm.url.slice(buf);
const pkg_name_slice = pkg_name.slice(buf);
const scope = scopeForPackageName(options, pkg_name_slice);
const scope_url = strings.withoutTrailingSlash(scope.url.href);
const url_to_write = if (strings.hasPrefix(resolved_url, scope_url))
resolved_url[scope_url.len..]
else
resolved_url;
try writer.print("\"{s}\", ", .{url_to_write});
try writePackageInfoObject(
writer,
@@ -1691,18 +1706,32 @@ pub fn parseIntoBinaryLockfile(
return error.InvalidPackageInfo;
};
if (registry_str.len == 0) {
// If the URL is relative (doesn't start with http:// or https://),
// prepend the registry URL for this package's scope
const resolved_url = if (registry_str.len > 0 and
!strings.hasPrefixComptime(registry_str, "https://") and
!strings.hasPrefixComptime(registry_str, "http://"))
url: {
// Get the registry URL for this package's scope
const scope_url = if (manager) |pm| scope_url: {
const scope = PackageManagerResolution.scopeForPackageName(pm, name.slice(string_buf.bytes.items));
break :scope_url strings.withoutTrailingSlash(scope.url.href);
} else strings.withoutTrailingSlash(Npm.Registry.default_url);
// Concatenate registry URL + relative URL
break :url try std.fmt.allocPrint(allocator, "{s}{s}", .{ scope_url, registry_str });
} else if (registry_str.len == 0) url: {
// Empty string means use the default registry
const url = try ExtractTarball.buildURL(
Npm.Registry.default_url,
strings.StringOrTinyString.init(name.slice(string_buf.bytes.items)),
res.value.npm.version,
string_buf.bytes.items,
);
break :url url;
} else registry_str;
res.value.npm.url = try string_buf.append(url);
} else {
res.value.npm.url = try string_buf.append(registry_str);
}
res.value.npm.url = try string_buf.append(resolved_url);
}
if (lockfile_version != .v0) {
@@ -2202,6 +2231,7 @@ fn parseAppendDependencies(
const string = []const u8;
const ExtractTarball = @import("../extract_tarball.zig");
const PackageManagerResolution = @import("../PackageManager/PackageManagerResolution.zig");
const std = @import("std");
const Integrity = @import("../integrity.zig").Integrity;

View File

@@ -36,7 +36,7 @@ exports[`text lockfile workspace sorting 1`] = `
"c": ["c@workspace:packages/c"],
"no-deps": ["no-deps@1.0.0", "http://localhost:1234/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"no-deps": ["no-deps@1.0.0", "/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
}
}
"
@@ -78,7 +78,7 @@ exports[`text lockfile workspace sorting 2`] = `
"c": ["c@workspace:packages/c"],
"no-deps": ["no-deps@1.0.0", "http://localhost:1234/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"no-deps": ["no-deps@1.0.0", "/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
}
}
"
@@ -103,13 +103,41 @@ exports[`text lockfile --frozen-lockfile 1`] = `
},
},
"packages": {
"a-dep": ["a-dep@1.0.10", "http://localhost:1234/a-dep/-/a-dep-1.0.10.tgz", {}, "sha512-NeQ6Ql9jRW8V+VOiVb+PSQAYOvVoSimW+tXaR0CoJk4kM9RIk/XlAUGCsNtn5XqjlDO4hcH8NcyaL507InevEg=="],
"a-dep": ["a-dep@1.0.10", "/a-dep/-/a-dep-1.0.10.tgz", {}, "sha512-NeQ6Ql9jRW8V+VOiVb+PSQAYOvVoSimW+tXaR0CoJk4kM9RIk/XlAUGCsNtn5XqjlDO4hcH8NcyaL507InevEg=="],
"no-deps": ["no-deps@1.1.0", "http://localhost:1234/no-deps/-/no-deps-1.1.0.tgz", {}, "sha512-ebG2pipYAKINcNI3YxdsiAgFvNGp2gdRwxAKN2LYBm9+YxuH/lHH2sl+GKQTuGiNfCfNZRMHUyyLPEJD6HWm7w=="],
"no-deps": ["no-deps@1.1.0", "/no-deps/-/no-deps-1.1.0.tgz", {}, "sha512-ebG2pipYAKINcNI3YxdsiAgFvNGp2gdRwxAKN2LYBm9+YxuH/lHH2sl+GKQTuGiNfCfNZRMHUyyLPEJD6HWm7w=="],
"package1": ["package1@workspace:packages/pkg1"],
"peer-deps-too": ["peer-deps-too@1.0.0", "http://localhost:1234/peer-deps-too/-/peer-deps-too-1.0.0.tgz", { "peerDependencies": { "no-deps": "*" } }, "sha512-sBx0TKrsB8FkRN2lzkDjMuctPGEKn1TmNUBv3dJOtnZM8nd255o5ZAPRpAI2XFLHZAavBlK/e73cZNwnUxlRog=="],
"peer-deps-too": ["peer-deps-too@1.0.0", "/peer-deps-too/-/peer-deps-too-1.0.0.tgz", { "peerDependencies": { "no-deps": "*" } }, "sha512-sBx0TKrsB8FkRN2lzkDjMuctPGEKn1TmNUBv3dJOtnZM8nd255o5ZAPRpAI2XFLHZAavBlK/e73cZNwnUxlRog=="],
}
}
"
`;
exports[`it should ignore peerDependencies within workspaces 1`] = `
"{
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "foo",
"peerDependencies": {
"no-deps": ">=1.0.0",
},
},
"packages/baz": {
"name": "Baz",
"peerDependencies": {
"a-dep": ">=1.0.1",
},
},
},
"packages": {
"Baz": ["Baz@workspace:packages/baz"],
"a-dep": ["a-dep@1.0.10", "/a-dep/-/a-dep-1.0.10.tgz", {}, "sha512-NeQ6Ql9jRW8V+VOiVb+PSQAYOvVoSimW+tXaR0CoJk4kM9RIk/XlAUGCsNtn5XqjlDO4hcH8NcyaL507InevEg=="],
"no-deps": ["no-deps@2.0.0", "/no-deps/-/no-deps-2.0.0.tgz", {}, "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g=="],
}
}
"
@@ -157,7 +185,7 @@ exports[`binaries root resolution bins 1`] = `
"packages": {
"fooooo": ["fooooo@root:", { "bin": "fooooo.js" }],
"no-deps": ["no-deps@1.0.0", "http://localhost:1234/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"no-deps": ["no-deps@1.0.0", "/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
}
}
"
@@ -177,20 +205,66 @@ exports[`hoisting text lockfile is hoisted 1`] = `
},
},
"packages": {
"hoist-lockfile-1": ["hoist-lockfile-1@1.0.0", "http://localhost:1234/hoist-lockfile-1/-/hoist-lockfile-1-1.0.0.tgz", { "dependencies": { "hoist-lockfile-shared": "*" } }, "sha512-E2nwR7egMFDoYjeRno7CAa59kiwkLGfhTFy2Q335JWp2r2bDkwoAt1LdChd5PdGYkbo7SfViHkW44ga+WXA+eA=="],
"hoist-lockfile-1": ["hoist-lockfile-1@1.0.0", "/hoist-lockfile-1/-/hoist-lockfile-1-1.0.0.tgz", { "dependencies": { "hoist-lockfile-shared": "*" } }, "sha512-E2nwR7egMFDoYjeRno7CAa59kiwkLGfhTFy2Q335JWp2r2bDkwoAt1LdChd5PdGYkbo7SfViHkW44ga+WXA+eA=="],
"hoist-lockfile-2": ["hoist-lockfile-2@1.0.0", "http://localhost:1234/hoist-lockfile-2/-/hoist-lockfile-2-1.0.0.tgz", { "dependencies": { "hoist-lockfile-shared": "^1.0.1" } }, "sha512-7iNRBJF/U078n9oZW7aDvVLkA7+076a2ONEFvITpjKdhT07KWaBei0SzHkFYW4f3foGZPNlHsv0aAgk949TPJg=="],
"hoist-lockfile-2": ["hoist-lockfile-2@1.0.0", "/hoist-lockfile-2/-/hoist-lockfile-2-1.0.0.tgz", { "dependencies": { "hoist-lockfile-shared": "^1.0.1" } }, "sha512-7iNRBJF/U078n9oZW7aDvVLkA7+076a2ONEFvITpjKdhT07KWaBei0SzHkFYW4f3foGZPNlHsv0aAgk949TPJg=="],
"hoist-lockfile-3": ["hoist-lockfile-3@1.0.0", "http://localhost:1234/hoist-lockfile-3/-/hoist-lockfile-3-1.0.0.tgz", { "dependencies": { "hoist-lockfile-shared": ">=1.0.1" } }, "sha512-iGz7jH7jxz/zq4OZM8hhT7kUX2Ye1m+45SoyMVcWTM7ZB+cY306Ff1mQePKTjkn84/pJMITMdRgDv/qF8PuQUw=="],
"hoist-lockfile-3": ["hoist-lockfile-3@1.0.0", "/hoist-lockfile-3/-/hoist-lockfile-3-1.0.0.tgz", { "dependencies": { "hoist-lockfile-shared": ">=1.0.1" } }, "sha512-iGz7jH7jxz/zq4OZM8hhT7kUX2Ye1m+45SoyMVcWTM7ZB+cY306Ff1mQePKTjkn84/pJMITMdRgDv/qF8PuQUw=="],
"hoist-lockfile-shared": ["hoist-lockfile-shared@2.0.2", "http://localhost:1234/hoist-lockfile-shared/-/hoist-lockfile-shared-2.0.2.tgz", {}, "sha512-xPWoyP8lv+/JrbClRzhJx1eUsHqDflSTmWOxx82xvMIEs6mbiIuvIp3/L+Ojc6mqex6y426h7L5j0hjLZE3V9w=="],
"hoist-lockfile-shared": ["hoist-lockfile-shared@2.0.2", "/hoist-lockfile-shared/-/hoist-lockfile-shared-2.0.2.tgz", {}, "sha512-xPWoyP8lv+/JrbClRzhJx1eUsHqDflSTmWOxx82xvMIEs6mbiIuvIp3/L+Ojc6mqex6y426h7L5j0hjLZE3V9w=="],
"hoist-lockfile-2/hoist-lockfile-shared": ["hoist-lockfile-shared@1.0.2", "http://localhost:1234/hoist-lockfile-shared/-/hoist-lockfile-shared-1.0.2.tgz", {}, "sha512-p7IQ/BbkTRLG/GUx6j2cDQ+vTUc/v9OW9Ss9igh/GFysbr0Qjriz/DiETnISkxYaTFitqOkUSOUkEKyeLNJsfQ=="],
"hoist-lockfile-2/hoist-lockfile-shared": ["hoist-lockfile-shared@1.0.2", "/hoist-lockfile-shared/-/hoist-lockfile-shared-1.0.2.tgz", {}, "sha512-p7IQ/BbkTRLG/GUx6j2cDQ+vTUc/v9OW9Ss9igh/GFysbr0Qjriz/DiETnISkxYaTFitqOkUSOUkEKyeLNJsfQ=="],
}
}
"
`;
exports[`duplicate dependency in optionalDependencies maintains sort order 1`] = `
"# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
# bun ./bun.lockb --hash: A1A17280329F8383-20d6659d9c0623de-94508CB3B7915517-4b22a59b37f2f4f6
"@types/is-number@>=1.0.0":
version "2.0.0"
resolved "http://localhost:4873/@types/is-number/-/is-number-2.0.0.tgz"
integrity sha512-GEeIxCB+NpM1NrDBqmkYPeU8bI//i+xPzdOY4E1YHet51IcFmz4js6k57m69fLl/cbn7sOR7wj9RNNw53X8AiA==
a-dep@1.0.1:
version "1.0.1"
resolved "http://localhost:4873/a-dep/-/a-dep-1.0.1.tgz"
integrity sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg==
duplicate-optional@1.0.1:
version "1.0.1"
resolved "http://localhost:4873/duplicate-optional/-/duplicate-optional-1.0.1.tgz"
integrity sha512-tL28+yJiTPehPLq7QnOu9jbRBpRgfBkyTVveaJojKcyae2khKuLaPRvsiX5gXv+iNGpYiYcNnV1eDBLXS+L85A==
dependencies:
a-dep "1.0.1"
what-bin "1.0.0"
optionalDependencies:
no-deps "1.0.1"
no-deps@1.0.1, no-deps@^1.0.0:
version "1.0.1"
resolved "http://localhost:4873/no-deps/-/no-deps-1.0.1.tgz"
integrity sha512-3X6cn4+UJdXJuLPu11v8i/fGLe2PdI6v1yKTELam04lY5esCAFdG/qQts6N6rLrL6g1YRq+MKBAwxbmUQk355A==
two-range-deps@1.0.0:
version "1.0.0"
resolved "http://localhost:4873/two-range-deps/-/two-range-deps-1.0.0.tgz"
integrity sha512-N+6kPy/GxuMncNz/EKuIrwdoYbh1qmvHDnw1UbM3sQE184kBn+6qAQgtf1wgT9dJnt6X+tWcTzSmfDvtJikVBA==
dependencies:
no-deps "^1.0.0"
"@types/is-number" ">=1.0.0"
what-bin@1.0.0:
version "1.0.0"
resolved "http://localhost:4873/what-bin/-/what-bin-1.0.0.tgz"
integrity sha512-sa99On1k5aDqCvpni/TQ6rLzYprUWBlb8fNwWOzbjDlM24fRr7FKDOuaBO/Y9WEIcZuzoPkCW5EkBCpflj8REQ==
"
`;
exports[`outdated normal dep, smaller than column title 1`] = `
"┌──────────┬─────────┬────────┬────────┐
│ \x1B[1m\x1B[34mPackage\x1B[0m │ \x1B[1m\x1B[34mCurrent\x1B[0m │ \x1B[1m\x1B[34mUpdate\x1B[0m │ \x1B[1m\x1B[34mLatest\x1B[0m │
@@ -271,77 +345,3 @@ exports[`outdated NO_COLOR works 1`] = `
|--------------------------------------|
"
`;
exports[`it should ignore peerDependencies within workspaces 1`] = `
"{
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "foo",
"peerDependencies": {
"no-deps": ">=1.0.0",
},
},
"packages/baz": {
"name": "Baz",
"peerDependencies": {
"a-dep": ">=1.0.1",
},
},
},
"packages": {
"Baz": ["Baz@workspace:packages/baz"],
"a-dep": ["a-dep@1.0.10", "http://localhost:1234/a-dep/-/a-dep-1.0.10.tgz", {}, "sha512-NeQ6Ql9jRW8V+VOiVb+PSQAYOvVoSimW+tXaR0CoJk4kM9RIk/XlAUGCsNtn5XqjlDO4hcH8NcyaL507InevEg=="],
"no-deps": ["no-deps@2.0.0", "http://localhost:1234/no-deps/-/no-deps-2.0.0.tgz", {}, "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g=="],
}
}
"
`;
exports[`duplicate dependency in optionalDependencies maintains sort order 1`] = `
"# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
# bun ./bun.lockb --hash: A1A17280329F8383-20d6659d9c0623de-94508CB3B7915517-4b22a59b37f2f4f6
"@types/is-number@>=1.0.0":
version "2.0.0"
resolved "http://localhost:4873/@types/is-number/-/is-number-2.0.0.tgz"
integrity sha512-GEeIxCB+NpM1NrDBqmkYPeU8bI//i+xPzdOY4E1YHet51IcFmz4js6k57m69fLl/cbn7sOR7wj9RNNw53X8AiA==
a-dep@1.0.1:
version "1.0.1"
resolved "http://localhost:4873/a-dep/-/a-dep-1.0.1.tgz"
integrity sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg==
duplicate-optional@1.0.1:
version "1.0.1"
resolved "http://localhost:4873/duplicate-optional/-/duplicate-optional-1.0.1.tgz"
integrity sha512-tL28+yJiTPehPLq7QnOu9jbRBpRgfBkyTVveaJojKcyae2khKuLaPRvsiX5gXv+iNGpYiYcNnV1eDBLXS+L85A==
dependencies:
a-dep "1.0.1"
what-bin "1.0.0"
optionalDependencies:
no-deps "1.0.1"
no-deps@1.0.1, no-deps@^1.0.0:
version "1.0.1"
resolved "http://localhost:4873/no-deps/-/no-deps-1.0.1.tgz"
integrity sha512-3X6cn4+UJdXJuLPu11v8i/fGLe2PdI6v1yKTELam04lY5esCAFdG/qQts6N6rLrL6g1YRq+MKBAwxbmUQk355A==
two-range-deps@1.0.0:
version "1.0.0"
resolved "http://localhost:4873/two-range-deps/-/two-range-deps-1.0.0.tgz"
integrity sha512-N+6kPy/GxuMncNz/EKuIrwdoYbh1qmvHDnw1UbM3sQE184kBn+6qAQgtf1wgT9dJnt6X+tWcTzSmfDvtJikVBA==
dependencies:
no-deps "^1.0.0"
"@types/is-number" ">=1.0.0"
what-bin@1.0.0:
version "1.0.0"
resolved "http://localhost:4873/what-bin/-/what-bin-1.0.0.tgz"
integrity sha512-sa99On1k5aDqCvpni/TQ6rLzYprUWBlb8fNwWOzbjDlM24fRr7FKDOuaBO/Y9WEIcZuzoPkCW5EkBCpflj8REQ==
"
`;

View File

@@ -874,7 +874,7 @@ exports[`dependency on workspace without version in package.json: version: 1 1`]
"resolution": {
"tag": "npm",
"value": "1.1.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-1.1.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-1.1.0.tgz"
},
"dependencies": [],
"integrity": "sha512-ebG2pipYAKINcNI3YxdsiAgFvNGp2gdRwxAKN2LYBm9+YxuH/lHH2sl+GKQTuGiNfCfNZRMHUyyLPEJD6HWm7w==",
@@ -1030,7 +1030,7 @@ exports[`dependency on workspace without version in package.json: version: 1.* 1
"resolution": {
"tag": "npm",
"value": "1.1.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-1.1.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-1.1.0.tgz"
},
"dependencies": [],
"integrity": "sha512-ebG2pipYAKINcNI3YxdsiAgFvNGp2gdRwxAKN2LYBm9+YxuH/lHH2sl+GKQTuGiNfCfNZRMHUyyLPEJD6HWm7w==",
@@ -1186,7 +1186,7 @@ exports[`dependency on workspace without version in package.json: version: 1.1.*
"resolution": {
"tag": "npm",
"value": "1.1.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-1.1.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-1.1.0.tgz"
},
"dependencies": [],
"integrity": "sha512-ebG2pipYAKINcNI3YxdsiAgFvNGp2gdRwxAKN2LYBm9+YxuH/lHH2sl+GKQTuGiNfCfNZRMHUyyLPEJD6HWm7w==",
@@ -1342,7 +1342,7 @@ exports[`dependency on workspace without version in package.json: version: 1.1.0
"resolution": {
"tag": "npm",
"value": "1.1.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-1.1.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-1.1.0.tgz"
},
"dependencies": [],
"integrity": "sha512-ebG2pipYAKINcNI3YxdsiAgFvNGp2gdRwxAKN2LYBm9+YxuH/lHH2sl+GKQTuGiNfCfNZRMHUyyLPEJD6HWm7w==",
@@ -1498,7 +1498,7 @@ exports[`dependency on workspace without version in package.json: version: *-pre
"resolution": {
"tag": "npm",
"value": "2.0.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-2.0.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-2.0.0.tgz"
},
"dependencies": [],
"integrity": "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g==",
@@ -1654,7 +1654,7 @@ exports[`dependency on workspace without version in package.json: version: *+bui
"resolution": {
"tag": "npm",
"value": "2.0.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-2.0.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-2.0.0.tgz"
},
"dependencies": [],
"integrity": "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g==",
@@ -1810,7 +1810,7 @@ exports[`dependency on workspace without version in package.json: version: lates
"resolution": {
"tag": "npm",
"value": "2.0.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-2.0.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-2.0.0.tgz"
},
"dependencies": [],
"integrity": "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g==",
@@ -1966,7 +1966,7 @@ exports[`dependency on workspace without version in package.json: version: 1`]
"resolution": {
"tag": "npm",
"value": "2.0.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-2.0.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-2.0.0.tgz"
},
"dependencies": [],
"integrity": "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g==",
@@ -2122,7 +2122,7 @@ exports[`dependency on same name as workspace and dist-tag: with version 1`] = `
"resolution": {
"tag": "npm",
"value": "2.0.0",
"resolved": "http://localhost:1234/no-deps/-/no-deps-2.0.0.tgz"
"resolved": "https://registry.npmjs.org/no-deps/-/no-deps-2.0.0.tgz"
},
"dependencies": [],
"integrity": "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g==",

View File

@@ -24,9 +24,9 @@ exports[`basic detect changes (bun.lock) 1`] = `
},
},
"packages": {
"a-dep": ["a-dep@1.0.1", "http://localhost:1234/a-dep/-/a-dep-1.0.1.tgz", {}, "sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg=="],
"a-dep": ["a-dep@1.0.1", "/a-dep/-/a-dep-1.0.1.tgz", {}, "sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg=="],
"no-deps": ["no-deps@2.0.0", "http://localhost:1234/no-deps/-/no-deps-2.0.0.tgz", {}, "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g=="],
"no-deps": ["no-deps@2.0.0", "/no-deps/-/no-deps-2.0.0.tgz", {}, "sha512-W3duJKZPcMIG5rA1io5cSK/bhW9rWFz+jFxZsKS/3suK4qHDkQNxUTEXee9/hTaAoDCeHWQqogukWYKzfr6X4g=="],
"pkg1": ["pkg1@workspace:packages/pkg1"],
}
@@ -58,9 +58,9 @@ exports[`basic detect changes (bun.lock) 2`] = `
},
},
"packages": {
"a-dep": ["a-dep@1.0.1", "http://localhost:1234/a-dep/-/a-dep-1.0.1.tgz", {}, "sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg=="],
"a-dep": ["a-dep@1.0.1", "/a-dep/-/a-dep-1.0.1.tgz", {}, "sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg=="],
"no-deps": ["no-deps@1.0.0", "http://localhost:1234/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"no-deps": ["no-deps@1.0.0", "/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"pkg1": ["pkg1@workspace:packages/pkg1"],
}
@@ -92,9 +92,9 @@ exports[`basic detect changes (bun.lock) 3`] = `
},
},
"packages": {
"a-dep": ["a-dep@1.0.10", "http://localhost:1234/a-dep/-/a-dep-1.0.10.tgz", {}, "sha512-NeQ6Ql9jRW8V+VOiVb+PSQAYOvVoSimW+tXaR0CoJk4kM9RIk/XlAUGCsNtn5XqjlDO4hcH8NcyaL507InevEg=="],
"a-dep": ["a-dep@1.0.10", "/a-dep/-/a-dep-1.0.10.tgz", {}, "sha512-NeQ6Ql9jRW8V+VOiVb+PSQAYOvVoSimW+tXaR0CoJk4kM9RIk/XlAUGCsNtn5XqjlDO4hcH8NcyaL507InevEg=="],
"no-deps": ["no-deps@1.0.0", "http://localhost:1234/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"no-deps": ["no-deps@1.0.0", "/no-deps/-/no-deps-1.0.0.tgz", {}, "sha512-v4w12JRjUGvfHDUP8vFDwu0gUWu04j0cv9hLb1Abf9VdaXu4XcrddYFTMVBVvmldKViGWH7jrb6xPJRF0wq6gw=="],
"pkg1": ["pkg1@workspace:packages/pkg1"],
}

View File

@@ -7,6 +7,7 @@ import {
isWindows,
readdirSorted,
runBunInstall,
tempDirWithFiles,
toBeValidBin,
VerdaccioRegistry,
} from "harness";
@@ -615,3 +616,73 @@ it("should include unused resolutions in the lockfile", async () => {
// --frozen-lockfile works
await runBunInstall(env, packageDir, { frozenLockfile: true });
});
it("should strip registry URL from tarball URLs in lockfile", async () => {
// Test with a real npm package using the default npm registry
const packageDir = tempDirWithFiles("lockfile-url-strip", {
"package.json": JSON.stringify({
name: "test-registry-url-stripping",
version: "1.0.0",
dependencies: {
"is-number": "^7.0.0",
},
}),
});
// Run install to generate lockfile
await runBunInstall(env, packageDir);
// Read the lockfile
const lockfileContent = await file(join(packageDir, "bun.lock")).text();
// The lockfile should contain relative URLs (starting with /)
// not full URLs like "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz"
expect(lockfileContent).toContain('"/is-number/-/is-number-7.0.0.tgz"');
expect(lockfileContent).not.toContain('"https://registry.npmjs.org/is-number');
// Now reinstall from the lockfile to ensure it can read the relative URLs correctly
await rm(join(packageDir, "node_modules"), { recursive: true, force: true });
// runBunInstall will throw if the install fails, so just await it
await runBunInstall(env, packageDir, { frozenLockfile: true });
// Verify package was installed correctly
expect(await exists(join(packageDir, "node_modules", "is-number", "package.json"))).toBe(true);
});
it("should preserve full URLs when tarball URL doesn't match registry", async () => {
// When a registry redirects to a different domain (e.g., yarn -> npmjs.org),
// the full URL should be preserved since it doesn't match the configured registry
const packageDir = tempDirWithFiles("lockfile-preserve-full-url", {
"package.json": JSON.stringify({
name: "test-preserve-full-url",
version: "1.0.0",
dependencies: {
"is-number": "^7.0.0",
},
}),
// Configure yarn registry, which redirects tarballs to npmjs.org
"bunfig.toml": `
[install]
registry = "https://registry.yarnpkg.com/"
`,
});
// Run install
await runBunInstall(env, packageDir);
// Read the lockfile
const lockfileContent = await file(join(packageDir, "bun.lock")).text();
// Yarn registry redirects to npmjs.org, so the tarball URL won't match
// the configured registry (yarnpkg.com). The full URL should be preserved.
expect(lockfileContent).toContain('"https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz"');
// Should NOT be a relative URL since it doesn't match the registry
expect(lockfileContent).not.toContain('"/is-number/-/is-number-7.0.0.tgz"');
// Verify reinstall works with the full URL
await rm(join(packageDir, "node_modules"), { recursive: true, force: true });
await runBunInstall(env, packageDir, { frozenLockfile: true });
expect(await exists(join(packageDir, "node_modules", "is-number", "package.json"))).toBe(true);
});

View File

@@ -35,57 +35,57 @@ exports[`pnpm comprehensive migration tests large single package with many depen
},
},
"packages": {
"@emotion/react": ["@emotion/react@11.11.3", "", { "peerDependencies": { "react": "18.2.0" } }, ""],
"@emotion/react": ["@emotion/react@11.11.3", "/@emotion/react/-/react-11.11.3.tgz", { "peerDependencies": { "react": "18.2.0" } }, ""],
"@emotion/styled": ["@emotion/styled@11.11.0", "", { "peerDependencies": { "@emotion/react": "11.11.3", "react": "18.2.0" } }, ""],
"@emotion/styled": ["@emotion/styled@11.11.0", "/@emotion/styled/-/styled-11.11.0.tgz", { "peerDependencies": { "@emotion/react": "11.11.3", "react": "18.2.0" } }, ""],
"@experimental/super-long-scoped-package-name-with-many-words": ["@experimental/super-long-scoped-package-name-with-many-words@0.0.0-experimental-abcdef123456-20250812-build.9876543210", "", {}, "sha512-experimentalAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"@experimental/super-long-scoped-package-name-with-many-words": ["@experimental/super-long-scoped-package-name-with-many-words@0.0.0-experimental-abcdef123456-20250812-build.9876543210", "/@experimental/super-long-scoped-package-name-with-many-words/-/super-long-scoped-package-name-with-many-words-0.0.0-experimental-abcdef123456-20250812-build.9876543210.tgz", {}, "sha512-experimentalAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"@tanstack/react-query": ["@tanstack/react-query@5.17.9", "", { "peerDependencies": { "react": "18.2.0" } }, "sha512-tanstackAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"@tanstack/react-query": ["@tanstack/react-query@5.17.9", "/@tanstack/react-query/-/react-query-5.17.9.tgz", { "peerDependencies": { "react": "18.2.0" } }, "sha512-tanstackAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"@types/node": ["@types/node@20.10.8", "", {}, ""],
"@types/node": ["@types/node@20.10.8", "/@types/node/-/node-20.10.8.tgz", {}, ""],
"@types/react": ["@types/react@18.2.47", "", {}, ""],
"@types/react": ["@types/react@18.2.47", "/@types/react/-/react-18.2.47.tgz", {}, ""],
"accepts": ["accepts@1.3.8", "", { "dependencies": { "mime-types": "2.1.35", "negotiator": "0.6.3" } }, "sha512-acceptsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"accepts": ["accepts@1.3.8", "/accepts/-/accepts-1.3.8.tgz", { "dependencies": { "mime-types": "2.1.35", "negotiator": "0.6.3" } }, "sha512-acceptsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"axios": ["axios@1.6.5", "", {}, ""],
"axios": ["axios@1.6.5", "/axios/-/axios-1.6.5.tgz", {}, ""],
"date-fns": ["date-fns@3.2.0", "", {}, ""],
"date-fns": ["date-fns@3.2.0", "/date-fns/-/date-fns-3.2.0.tgz", {}, ""],
"eslint": ["eslint@8.56.0", "", { "bin": { "eslint": "bin/eslint.js" } }, ""],
"eslint": ["eslint@8.56.0", "/eslint/-/eslint-8.56.0.tgz", { "bin": { "eslint": "bin/eslint.js" } }, ""],
"express": ["express@4.18.2", "", { "dependencies": { "accepts": "1.3.8" } }, "sha512-expressAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"express": ["express@4.18.2", "/express/-/express-4.18.2.tgz", { "dependencies": { "accepts": "1.3.8" } }, "sha512-expressAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-fseventsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"fsevents": ["fsevents@2.3.3", "/fsevents/-/fsevents-2.3.3.tgz", { "os": "darwin" }, "sha512-fseventsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"js-tokens": ["js-tokens@4.0.0", "", {}, ""],
"js-tokens": ["js-tokens@4.0.0", "/js-tokens/-/js-tokens-4.0.0.tgz", {}, ""],
"lodash": ["lodash@4.17.21", "", {}, ""],
"lodash": ["lodash@4.17.21", "/lodash/-/lodash-4.17.21.tgz", {}, ""],
"loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "4.0.0" }, "bin": { "loose-envify": "cli.js" } }, ""],
"loose-envify": ["loose-envify@1.4.0", "/loose-envify/-/loose-envify-1.4.0.tgz", { "dependencies": { "js-tokens": "4.0.0" }, "bin": { "loose-envify": "cli.js" } }, ""],
"mime-types": ["mime-types@2.1.35", "", {}, ""],
"mime-types": ["mime-types@2.1.35", "/mime-types/-/mime-types-2.1.35.tgz", {}, ""],
"negotiator": ["negotiator@0.6.3", "", {}, ""],
"negotiator": ["negotiator@0.6.3", "/negotiator/-/negotiator-0.6.3.tgz", {}, ""],
"next": ["next@14.0.4", "", { "peerDependencies": { "react": "18.2.0", "react-dom": "18.2.0" }, "bin": { "next": "dist/bin/next" } }, "sha512-nextAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"next": ["next@14.0.4", "/next/-/next-14.0.4.tgz", { "peerDependencies": { "react": "18.2.0", "react-dom": "18.2.0" }, "bin": { "next": "dist/bin/next" } }, "sha512-nextAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"prettier": ["prettier@3.1.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-prettierAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"prettier": ["prettier@3.1.1", "/prettier/-/prettier-3.1.1.tgz", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-prettierAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"react": ["react@18.2.0", "", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"react": ["react@18.2.0", "/react/-/react-18.2.0.tgz", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"react-dom": ["react-dom@18.2.0", "", { "dependencies": { "scheduler": "0.23.0" }, "peerDependencies": { "react": "18.2.0" } }, ""],
"react-dom": ["react-dom@18.2.0", "/react-dom/-/react-dom-18.2.0.tgz", { "dependencies": { "scheduler": "0.23.0" }, "peerDependencies": { "react": "18.2.0" } }, ""],
"scheduler": ["scheduler@0.23.0", "", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"scheduler": ["scheduler@0.23.0", "/scheduler/-/scheduler-0.23.0.tgz", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"some-very-long-package-name-that-is-really-really-long": ["some-very-long-package-name-that-is-really-really-long@1.2.3-beta.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20", "", {}, ""],
"some-very-long-package-name-that-is-really-really-long": ["some-very-long-package-name-that-is-really-really-long@1.2.3-beta.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20", "/some-very-long-package-name-that-is-really-really-long/-/some-very-long-package-name-that-is-really-really-long-1.2.3-beta.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.tgz", {}, ""],
"typescript": ["typescript@5.3.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, ""],
"typescript": ["typescript@5.3.3", "/typescript/-/typescript-5.3.3.tgz", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, ""],
"vitest": ["vitest@1.1.3", "", { "bin": { "vitest": "vitest.mjs" } }, ""],
"vitest": ["vitest@1.1.3", "/vitest/-/vitest-1.1.3.tgz", { "bin": { "vitest": "vitest.mjs" } }, ""],
"zod": ["zod@3.22.4", "", {}, ""],
"zod": ["zod@3.22.4", "/zod/-/zod-3.22.4.tgz", {}, ""],
}
}
"
@@ -192,53 +192,53 @@ exports[`pnpm comprehensive migration tests complex monorepo with cross-dependen
"@company/web": ["@company/web@workspace:apps/web"],
"@radix-ui/react-dialog": ["@radix-ui/react-dialog@1.0.5", "", { "peerDependencies": { "react": "18.2.0", "react-dom": "18.2.0" } }, ""],
"@radix-ui/react-dialog": ["@radix-ui/react-dialog@1.0.5", "/@radix-ui/react-dialog/-/react-dialog-1.0.5.tgz", { "peerDependencies": { "react": "18.2.0", "react-dom": "18.2.0" } }, ""],
"@types/cors": ["@types/cors@2.8.17", "", {}, ""],
"@types/cors": ["@types/cors@2.8.17", "/@types/cors/-/cors-2.8.17.tgz", {}, ""],
"@types/express": ["@types/express@4.17.21", "", {}, ""],
"@types/express": ["@types/express@4.17.21", "/@types/express/-/express-4.17.21.tgz", {}, ""],
"@types/node": ["@types/node@20.10.8", "", {}, ""],
"@types/node": ["@types/node@20.10.8", "/@types/node/-/node-20.10.8.tgz", {}, ""],
"@types/react": ["@types/react@18.2.47", "", {}, ""],
"@types/react": ["@types/react@18.2.47", "/@types/react/-/react-18.2.47.tgz", {}, ""],
"chalk": ["chalk@5.3.0", "", {}, ""],
"chalk": ["chalk@5.3.0", "/chalk/-/chalk-5.3.0.tgz", {}, ""],
"class-variance-authority": ["class-variance-authority@0.7.0", "", {}, ""],
"class-variance-authority": ["class-variance-authority@0.7.0", "/class-variance-authority/-/class-variance-authority-0.7.0.tgz", {}, ""],
"clsx": ["clsx@2.1.0", "", {}, "sha512-clsxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"clsx": ["clsx@2.1.0", "/clsx/-/clsx-2.1.0.tgz", {}, "sha512-clsxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"commander": ["commander@11.1.0", "", {}, ""],
"commander": ["commander@11.1.0", "/commander/-/commander-11.1.0.tgz", {}, ""],
"cors": ["cors@2.8.5", "", {}, "sha512-corsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"cors": ["cors@2.8.5", "/cors/-/cors-2.8.5.tgz", {}, "sha512-corsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"date-fns": ["date-fns@3.2.0", "", {}, ""],
"date-fns": ["date-fns@3.2.0", "/date-fns/-/date-fns-3.2.0.tgz", {}, ""],
"dotenv": ["dotenv@16.3.1", "", {}, ""],
"dotenv": ["dotenv@16.3.1", "/dotenv/-/dotenv-16.3.1.tgz", {}, ""],
"express": ["express@4.18.2", "", {}, "sha512-expressAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"express": ["express@4.18.2", "/express/-/express-4.18.2.tgz", {}, "sha512-expressAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"js-tokens": ["js-tokens@4.0.0", "", {}, ""],
"js-tokens": ["js-tokens@4.0.0", "/js-tokens/-/js-tokens-4.0.0.tgz", {}, ""],
"loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "4.0.0" }, "bin": { "loose-envify": "cli.js" } }, ""],
"loose-envify": ["loose-envify@1.4.0", "/loose-envify/-/loose-envify-1.4.0.tgz", { "dependencies": { "js-tokens": "4.0.0" }, "bin": { "loose-envify": "cli.js" } }, ""],
"next": ["next@14.0.4", "", { "peerDependencies": { "react": "18.2.0", "react-dom": "18.2.0" }, "bin": { "next": "dist/bin/next" } }, "sha512-nextAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"next": ["next@14.0.4", "/next/-/next-14.0.4.tgz", { "peerDependencies": { "react": "18.2.0", "react-dom": "18.2.0" }, "bin": { "next": "dist/bin/next" } }, "sha512-nextAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"nodemon": ["nodemon@3.0.2", "", { "bin": { "nodemon": "bin/nodemon.js" } }, ""],
"nodemon": ["nodemon@3.0.2", "/nodemon/-/nodemon-3.0.2.tgz", { "bin": { "nodemon": "bin/nodemon.js" } }, ""],
"prettier": ["prettier@3.1.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-prettierAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"prettier": ["prettier@3.1.1", "/prettier/-/prettier-3.1.1.tgz", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-prettierAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"react": ["react@18.2.0", "", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"react": ["react@18.2.0", "/react/-/react-18.2.0.tgz", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"react-dom": ["react-dom@18.2.0", "", { "dependencies": { "scheduler": "0.23.0" }, "peerDependencies": { "react": "18.2.0" } }, ""],
"react-dom": ["react-dom@18.2.0", "/react-dom/-/react-dom-18.2.0.tgz", { "dependencies": { "scheduler": "0.23.0" }, "peerDependencies": { "react": "18.2.0" } }, ""],
"scheduler": ["scheduler@0.23.0", "", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"scheduler": ["scheduler@0.23.0", "/scheduler/-/scheduler-0.23.0.tgz", { "dependencies": { "loose-envify": "1.4.0" } }, ""],
"turbo": ["turbo@1.11.2", "", { "bin": { "turbo": "bin/turbo" } }, ""],
"turbo": ["turbo@1.11.2", "/turbo/-/turbo-1.11.2.tgz", { "bin": { "turbo": "bin/turbo" } }, ""],
"typescript": ["typescript@5.3.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, ""],
"typescript": ["typescript@5.3.3", "/typescript/-/typescript-5.3.3.tgz", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, ""],
"zod": ["zod@3.22.4", "", {}, ""],
"zod": ["zod@3.22.4", "/zod/-/zod-3.22.4.tgz", {}, ""],
}
}
"
@@ -264,19 +264,19 @@ exports[`pnpm comprehensive migration tests pnpm with patches and overrides: pat
"negotiator@>0.6.0": "0.6.2",
},
"packages": {
"accepts": ["accepts@1.3.8", "", { "dependencies": { "mime-types": "2.1.33", "negotiator": "0.6.2" } }, "sha512-acceptsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"accepts": ["accepts@1.3.8", "/accepts/-/accepts-1.3.8.tgz", { "dependencies": { "mime-types": "2.1.33", "negotiator": "0.6.2" } }, "sha512-acceptsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"array-flatten": ["array-flatten@1.1.1", "", {}, ""],
"array-flatten": ["array-flatten@1.1.1", "/array-flatten/-/array-flatten-1.1.1.tgz", {}, ""],
"express": ["express@4.18.2", "", { "dependencies": { "accepts": "1.3.8", "array-flatten": "1.1.1" } }, "sha512-expressAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"express": ["express@4.18.2", "/express/-/express-4.18.2.tgz", { "dependencies": { "accepts": "1.3.8", "array-flatten": "1.1.1" } }, "sha512-expressAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"is-number": ["is-number@7.0.0", "", {}, ""],
"is-number": ["is-number@7.0.0", "/is-number/-/is-number-7.0.0.tgz", {}, ""],
"mime-db": ["mime-db@1.50.0", "", {}, ""],
"mime-db": ["mime-db@1.50.0", "/mime-db/-/mime-db-1.50.0.tgz", {}, ""],
"mime-types": ["mime-types@2.1.33", "", { "dependencies": { "mime-db": "1.50.0" } }, ""],
"mime-types": ["mime-types@2.1.33", "/mime-types/-/mime-types-2.1.33.tgz", { "dependencies": { "mime-db": "1.50.0" } }, ""],
"negotiator": ["negotiator@0.6.2", "", {}, ""],
"negotiator": ["negotiator@0.6.2", "/negotiator/-/negotiator-0.6.2.tgz", {}, ""],
}
}
"
@@ -301,17 +301,17 @@ exports[`pnpm comprehensive migration tests pnpm with peer dependencies and auto
},
},
"packages": {
"@angular/animations": ["@angular/animations@17.0.8", "", { "dependencies": { "tslib": "2.6.2" }, "peerDependencies": { "@angular/core": "17.0.8" } }, ""],
"@angular/animations": ["@angular/animations@17.0.8", "/@angular/animations/-/animations-17.0.8.tgz", { "dependencies": { "tslib": "2.6.2" }, "peerDependencies": { "@angular/core": "17.0.8" } }, ""],
"@angular/common": ["@angular/common@17.0.8", "", { "dependencies": { "tslib": "2.6.2" }, "peerDependencies": { "@angular/core": "17.0.8", "rxjs": "7.8.1" } }, ""],
"@angular/common": ["@angular/common@17.0.8", "/@angular/common/-/common-17.0.8.tgz", { "dependencies": { "tslib": "2.6.2" }, "peerDependencies": { "@angular/core": "17.0.8", "rxjs": "7.8.1" } }, ""],
"@angular/core": ["@angular/core@17.0.8", "", { "dependencies": { "tslib": "2.6.2" }, "peerDependencies": { "rxjs": "7.8.1", "zone.js": "0.14.2" } }, ""],
"@angular/core": ["@angular/core@17.0.8", "/@angular/core/-/core-17.0.8.tgz", { "dependencies": { "tslib": "2.6.2" }, "peerDependencies": { "rxjs": "7.8.1", "zone.js": "0.14.2" } }, ""],
"rxjs": ["rxjs@7.8.1", "", { "dependencies": { "tslib": "2.6.2" } }, "sha512-rxjsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"rxjs": ["rxjs@7.8.1", "/rxjs/-/rxjs-7.8.1.tgz", { "dependencies": { "tslib": "2.6.2" } }, "sha512-rxjsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"tslib": ["tslib@2.6.2", "", {}, ""],
"tslib": ["tslib@2.6.2", "/tslib/-/tslib-2.6.2.tgz", {}, ""],
"zone.js": ["zone.js@0.14.2", "", {}, "sha512-zoneAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
"zone.js": ["zone.js@0.14.2", "/zone.js/-/zone.js-0.14.2.tgz", {}, "sha512-zoneAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="],
}
}
"

View File

@@ -21,13 +21,13 @@ exports[`basic: bun.lock 1`] = `
},
},
"packages": {
"a-dep": ["a-dep@1.0.1", "http://localhost:1234/a-dep/-/a-dep-1.0.1.tgz", {}, "sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg=="],
"a-dep": ["a-dep@1.0.1", "/a-dep/-/a-dep-1.0.1.tgz", {}, "sha512-6nmTaPgO2U/uOODqOhbjbnaB4xHuZ+UB7AjKUA3g2dT4WRWeNxgp0dC8Db4swXSnO5/uLLUdFmUJKINNBO/3wg=="],
"a-dep-b": ["a-dep-b@1.0.0", "http://localhost:1234/a-dep-b/-/a-dep-b-1.0.0.tgz", { "dependencies": { "b-dep-a": "1.0.0" } }, "sha512-PW1l4ruYaxcIw4rMkOVzb9zcR2srZhTPv2H2aH7QFc7vVxkD7EEMGHg1GPT8ycLFb8vriydUXEPwOy1FcbodaQ=="],
"a-dep-b": ["a-dep-b@1.0.0", "/a-dep-b/-/a-dep-b-1.0.0.tgz", { "dependencies": { "b-dep-a": "1.0.0" } }, "sha512-PW1l4ruYaxcIw4rMkOVzb9zcR2srZhTPv2H2aH7QFc7vVxkD7EEMGHg1GPT8ycLFb8vriydUXEPwOy1FcbodaQ=="],
"b-dep-a": ["b-dep-a@1.0.0", "http://localhost:1234/b-dep-a/-/b-dep-a-1.0.0.tgz", { "dependencies": { "a-dep-b": "1.0.0" } }, "sha512-1owp4Wy5QE893BGgjDQGZm9Oayk38MA++fXmPTQA1WY/NFQv7CcCVpK2Ht/4mU4KejDeHOxaAj7qbzv1dSQA2w=="],
"b-dep-a": ["b-dep-a@1.0.0", "/b-dep-a/-/b-dep-a-1.0.0.tgz", { "dependencies": { "a-dep-b": "1.0.0" } }, "sha512-1owp4Wy5QE893BGgjDQGZm9Oayk38MA++fXmPTQA1WY/NFQv7CcCVpK2Ht/4mU4KejDeHOxaAj7qbzv1dSQA2w=="],
"no-deps": ["no-deps@1.0.1", "http://localhost:1234/no-deps/-/no-deps-1.0.1.tgz", {}, "sha512-3X6cn4+UJdXJuLPu11v8i/fGLe2PdI6v1yKTELam04lY5esCAFdG/qQts6N6rLrL6g1YRq+MKBAwxbmUQk355A=="],
"no-deps": ["no-deps@1.0.1", "/no-deps/-/no-deps-1.0.1.tgz", {}, "sha512-3X6cn4+UJdXJuLPu11v8i/fGLe2PdI6v1yKTELam04lY5esCAFdG/qQts6N6rLrL6g1YRq+MKBAwxbmUQk355A=="],
}
}
"

View File

@@ -157,7 +157,7 @@ userRateLimit:
# max_body_size: 10mb
# https://verdaccio.org/docs/configuration#listen-port
# listen:
listen: 0.0.0.0:4873
# - localhost:4873 # default value
# - http://localhost:4873 # same thing
# - 0.0.0.0:4873 # listen on all addresses (INADDR_ANY)

View File

@@ -0,0 +1,18 @@
import { expect, test } from "bun:test";
import { VerdaccioRegistry } from "harness";
test("verdaccio should work", async () => {
const registry = new VerdaccioRegistry();
await registry.start();
const url = registry.registryUrl();
console.log("Registry URL:", url);
const response = await fetch(`${url}no-deps`);
expect(response.status).toBe(200);
const data = await response.json();
expect(data.name).toBe("no-deps");
registry.stop();
});

View File

@@ -5,6 +5,7 @@
* without always needing to run `bun install` in development.
*/
import * as numeric from "_util/numeric.ts";
import { gc as bunGC, sleepSync, spawnSync, unsafe, which, write } from "bun";
import { heapStats } from "bun:jsc";
import { beforeAll, describe, expect } from "bun:test";
@@ -13,7 +14,6 @@ import { readdir, readFile, readlink, rm, writeFile } from "fs/promises";
import fs, { closeSync, openSync, rmSync } from "node:fs";
import os from "node:os";
import { dirname, isAbsolute, join } from "path";
import * as numeric from "_util/numeric.ts";
export const BREAKING_CHANGES_BUN_1_2 = false;
@@ -1643,15 +1643,19 @@ export class VerdaccioRegistry {
async start(silent: boolean = true) {
await rm(join(dirname(this.configPath), "htpasswd"), { force: true });
this.process = fork(require.resolve("verdaccio/bin/verdaccio"), ["-c", this.configPath, "-l", `${this.port}`], {
silent,
// Prefer using a release build of Bun since it's faster
execPath: isCI ? bunExe() : Bun.which("bun") || bunExe(),
env: {
...(bunEnv as any),
NODE_NO_WARNINGS: "1",
this.process = fork(
require.resolve("verdaccio/bin/verdaccio"),
["-c", this.configPath, "-l", `0.0.0.0:${this.port}`],
{
silent,
// Prefer using a release build of Bun since it's faster
execPath: isCI ? bunExe() : Bun.which("bun") || bunExe(),
env: {
...(bunEnv as any),
NODE_NO_WARNINGS: "1",
},
},
});
);
this.process.stderr?.on("data", data => {
console.error(`[verdaccio] stderr: ${data}`);