/**
* Every path the v1.0.0 tsc output published must still resolve, exporting the
* same names.
*
* v1.0.0's dist/ mirrored src/ one file per module (dist/lib/crypto.js,
* dist/node/env.js, …). A shadow-cljs :esm build emits one FLAT file per
* :modules entry instead, so scripts/gen-subpaths.mjs writes that tree back as
* thin re-export shims. This is the table those shims are checked against — the
* package's own `exports` map is checked in api.test.mjs.
*/
import { test } from "node:test";
import assert from "node:assert/strict";
import { load } from "./helpers/load.mjs";
/** dist path (without .js) -> the names that file exported in v1.0.0 */
const TREE = {
"index": ["ChatClient", "newRoomSecret", "CHAT_SALT", "BoardClient", "BOARD_SALT", "installOrigin",
"installBrowserGlobals", "Identity"],
"chat/index": ["ChatClient", "newRoomSecret", "CHAT_SALT"],
"board/index": ["BoardClient", "BOARD_SALT", "newRoomSecret"],
"lib/crypto": ["randomBytes", "toB64", "fromB64", "toB64url", "fromB64url", "newRoomSecret", "newPeerId",
"Sealer", "AtRestCipher", "RoomCrypto"],
"lib/encryption": ["makeLogEncryption"],
"lib/descriptor": ["resolveRelayConfig"],
"lib/turn": ["IceConfig"],
"lib/access": ["HardenedIPFSAccessController", "signerMatchesIdentity"],
"lib/orbit-identity": ["SuetaIdentityProvider", "registerSuetaProvider"],
"lib/log": ["openHelia", "RoomLog"],
"lib/net": ["newSessionKey", "Net"],
"node/env": ["selfPeerIds", "installOrigin", "installOriginWebSocket", "installBrowserGlobals", "installOriginFetch"],
// types only in the TypeScript original — an empty module, exactly as tsc emitted
"lib/protocol": [],
};
for (const [path, expected] of Object.entries(TREE)) {
test(`dist/${path}.js exports ${expected.length} historical name(s)`, async () => {
const mod = await load(`${path}.js`);
for (const name of expected) {
assert.notEqual(mod[name], undefined, `dist/${path}.js is missing ${name}`);
}
const actual = Object.keys(mod).filter((k) => k !== "default" && k !== "__esModule");
assert.deepEqual(actual.slice().sort(), expected.slice().sort(), `dist/${path}.js export set`);
});
}