From 02017050c863baaca41599b8c7625b0401a0f6cc Mon Sep 17 00:00:00 2001 From: Shinrai Date: Sat, 8 Aug 2026 21:41:43 -0700 Subject: [PATCH 1/2] fix(exports): expose ./package.json in the exports map Node's exports map is a strict allowlist: with only "." and "./main" declared, `require.resolve("@cldmv/uuid/package.json")` (and any tool that locates a package by resolving its package.json) throws ERR_PACKAGE_PATH_NOT_EXPORTED. This broke @cldmv/rummage's web build. Add the conventional `"./package.json": "./package.json"` entry so the manifest is resolvable by name, and a regression test that asserts both the exports entry and real Node self-resolution. Fixes #6 --- package.json | 3 +- tests/package-exports.test.vitest.mjs | 40 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/package-exports.test.vitest.mjs diff --git a/package.json b/package.json index 1ac1c4a..3d3afc6 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "import": "./src/uuid.mjs" }, "import": "./dist/uuid.mjs" - } + }, + "./package.json": "./package.json" }, "type": "module", "engines": { diff --git a/tests/package-exports.test.vitest.mjs b/tests/package-exports.test.vitest.mjs new file mode 100644 index 0000000..4a4a0f7 --- /dev/null +++ b/tests/package-exports.test.vitest.mjs @@ -0,0 +1,40 @@ +/** + * @Project: @cldmv/uuid + * @Filename: /tests/package-exports.test.vitest.mjs + * @Date: 2026-08-09T00:00:00-08:00 (1786233600) + * @Author: Nate Corcoran + * @Email: + * ----- + * @Last modified by: Nate Corcoran (Shinrai@users.noreply.github.com) + * @Last modified time: 2026-08-09T00:00:00-08:00 (1786233600) + * ----- + * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved. + */ + +import { test, expect, describe } from "vitest"; +import { readFileSync } from "node:fs"; +import { spawnSync } from "node:child_process"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); + +describe("package exports", () => { + test("the exports map exposes ./package.json", () => { + // Tooling resolves `/package.json` to locate a package's directory on disk; + // omitting it from `exports` makes that throw ERR_PACKAGE_PATH_NOT_EXPORTED. (#6) + const pkg = JSON.parse(readFileSync(path.join(repoRoot, "package.json"), "utf8")); + expect(pkg.exports["./package.json"]).toBe("./package.json"); + }); + + test("Node can resolve @cldmv/uuid/package.json through the exports map", () => { + // Real Node resolution (self-referencing the package by name from the repo root), + // not Vitest's resolver — before the fix this exits non-zero with + // ERR_PACKAGE_PATH_NOT_EXPORTED. + const res = spawnSync(process.execPath, ["--input-type=module", "-e", "import.meta.resolve('@cldmv/uuid/package.json');"], { + cwd: repoRoot, + encoding: "utf8" + }); + expect(res.status).toBe(0); + }); +}); From d4e57226d91bb3dcfe25905506460a56f5bd03e8 Mon Sep 17 00:00:00 2001 From: "cldmv-bot[bot]" <230771808+cldmv-bot[bot]@users.noreply.github.com> Date: Sun, 9 Aug 2026 04:48:22 +0000 Subject: [PATCH 2/2] chore: bump version to 1.1.7 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4766a0..3c79089 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cldmv/uuid", - "version": "1.1.6", + "version": "1.1.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cldmv/uuid", - "version": "1.1.6", + "version": "1.1.7", "license": "Apache-2.0", "devDependencies": { "@cldmv/fix-headers": "^1.2.2", diff --git a/package.json b/package.json index 3d3afc6..7665aae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cldmv/uuid", - "version": "1.1.6", + "version": "1.1.7", "description": "Extended RFC 4122 and RFC 9562 UUID implementation with custom variant structures, issuer-based identification, and timestamp variants", "main": "./index.cjs", "module": "./index.mjs",