fix(release): recognize Bun built-in modules (#143436)

This commit is contained in:
Dallin Romney 2026-09-09 15:37:10 -07:00 • committed by GitHub
parent e4a6d50073
commit 2178c8eafc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 0 deletions

View file

@ -26,6 +26,7 @@ export function packageNameFromSpecifier(specifier: string) {
typeof specifier !== "string" ||
specifier.startsWith(".") ||
specifier.startsWith("/") ||
specifier.startsWith("bun:") ||
specifier.startsWith("node:") ||
specifier.startsWith("#")
) {

View file

@ -1151,6 +1151,27 @@ describe("collectInstalledRootDependencyManifestErrors", () => {
}
});
it("accepts Bun built-in modules without npm dependency declarations", () => {
const packageRoot = makeInstalledPackageRoot();
try {
writePackageFile(packageRoot, "package.json", {
version: "2026.9.9",
dependencies: {},
});
mkdirSync(join(packageRoot, "dist"), { recursive: true });
writeFileSync(
join(packageRoot, "dist", "bun-sqlite-library.js"),
'import { Database } from "bun:sqlite";\nconst { dlopen } = require("bun:ffi");\nexport { Database, dlopen };\n',
"utf8",
);
expect(collectInstalledRootDependencyManifestErrors(packageRoot)).toStrictEqual([]);
} finally {
rmSync(packageRoot, { recursive: true, force: true });
}
});
const companionSource = 'const voice = require("@discordjs/voice");\nexport { voice };\n';
const companionOwnership = {
chunks: {

View file

@ -27,6 +27,7 @@ describe("scripts/lib/plugin-package-dependencies.mts", () => {
expect(packageNameFromSpecifier("plain-pkg/subpath")).toBe("plain-pkg");
expect(packageNameFromSpecifier("@scope")).toBeNull();
expect(packageNameFromSpecifier("@scope/")).toBeNull();
expect(packageNameFromSpecifier("bun:sqlite")).toBeNull();
expect(packageNameFromSpecifier("node:fs")).toBeNull();
expect(packageNameFromSpecifier("./local")).toBeNull();
expect(packageNameFromSpecifier("/absolute")).toBeNull();