Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
/**
* Verify tree-shaking readiness:
* - sideEffects: false is set in package.json
* - At least 5 named subpath exports are declared
*/
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
const PKG_ROOT = join(import.meta.dirname, "..");
const pkg = JSON.parse(
readFileSync(join(PKG_ROOT, "package.json"), "utf-8")
) as {
sideEffects: boolean | string[];
exports: Record<string, unknown>;
};
describe("tree-shake", () => {
it("sideEffects is false", { timeout: 5000 }, () => {
expect(pkg.sideEffects).toBe(false);
});
it("has at least 5 subpath exports (excluding package.json)", {
timeout: 5000,
}, () => {
const subpaths = Object.keys(pkg.exports).filter(
(k) => k !== "./package.json"
);
expect(subpaths.length).toBeGreaterThanOrEqual(5);
});
it("root export '.' is declared", { timeout: 5000 }, () => {
expect(pkg.exports["."]).toBeDefined();
});
it("cursor subpath export is declared", { timeout: 5000 }, () => {
expect(pkg.exports["./cursor"]).toBeDefined();
});
it("offset subpath export is declared", { timeout: 5000 }, () => {
expect(pkg.exports["./offset"]).toBeDefined();
});
it("keyset subpath export is declared", { timeout: 5000 }, () => {
expect(pkg.exports["./keyset"]).toBeDefined();
});
it("adapters subpath export is declared", { timeout: 5000 }, () => {
expect(pkg.exports["./adapters"]).toBeDefined();
});
it("helpers subpath export is declared", { timeout: 5000 }, () => {
expect(pkg.exports["./helpers"]).toBeDefined();
});
it("errors subpath export is declared", { timeout: 5000 }, () => {
expect(pkg.exports["./errors"]).toBeDefined();
});
it("schemas subpath export is declared", { timeout: 5000 }, () => {
expect(pkg.exports["./schemas"]).toBeDefined();
});
});