From 462b852a693ebccdf52b61903209bffe93b704bb Mon Sep 17 00:00:00 2001 From: Gautam Manchandani Date: Sat, 16 May 2026 21:57:08 +0530 Subject: [PATCH 1/2] fix workerd password export --- package.json | 4 ++++ src/package-json.test.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/package-json.test.ts diff --git a/package.json b/package.json index 3e8ea29..0543261 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,10 @@ "require": "./dist/rsa.cjs" }, "./password": { + "workerd": { + "import": "./dist/password.node.mjs", + "require": "./dist/password.node.cjs" + }, "node": { "import": "./dist/password.node.mjs", "require": "./dist/password.node.cjs" diff --git a/src/package-json.test.ts b/src/package-json.test.ts new file mode 100644 index 0000000..568cead --- /dev/null +++ b/src/package-json.test.ts @@ -0,0 +1,27 @@ +import { readFileSync } from "node:fs"; +import { join } from "node:path"; +import { describe, expect, it } from "vitest"; + +type PackageJSON = { + exports: { + "./password": { + workerd: { + import: string; + require: string; + }; + }; + }; +}; + +describe("package exports", () => { + it("routes workerd password imports to the node-compatible implementation", () => { + const pkg = JSON.parse( + readFileSync(join(process.cwd(), "package.json"), "utf8"), + ) as PackageJSON; + + expect(pkg.exports["./password"].workerd).toEqual({ + import: "./dist/password.node.mjs", + require: "./dist/password.node.cjs", + }); + }); +}); From 090b84b306e59ad17fa534a6285401156d5de77a Mon Sep 17 00:00:00 2001 From: Taesu Date: Wed, 27 May 2026 17:30:12 +0900 Subject: [PATCH 2/2] test: drop package-json test file --- src/package-json.test.ts | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/package-json.test.ts diff --git a/src/package-json.test.ts b/src/package-json.test.ts deleted file mode 100644 index 568cead..0000000 --- a/src/package-json.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { readFileSync } from "node:fs"; -import { join } from "node:path"; -import { describe, expect, it } from "vitest"; - -type PackageJSON = { - exports: { - "./password": { - workerd: { - import: string; - require: string; - }; - }; - }; -}; - -describe("package exports", () => { - it("routes workerd password imports to the node-compatible implementation", () => { - const pkg = JSON.parse( - readFileSync(join(process.cwd(), "package.json"), "utf8"), - ) as PackageJSON; - - expect(pkg.exports["./password"].workerd).toEqual({ - import: "./dist/password.node.mjs", - require: "./dist/password.node.cjs", - }); - }); -});