Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -16,7 +16,8 @@
"import": "./src/uuid.mjs"
},
"import": "./dist/uuid.mjs"
}
},
"./package.json": "./package.json"
},
"type": "module",
"engines": {
Expand Down
40 changes: 40 additions & 0 deletions tests/package-exports.test.vitest.mjs
Original file line number Diff line number Diff line change
@@ -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 <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (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 `<pkg>/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);
});
});
Loading