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,18 @@
import { describe, expect, it } from "@suaveplan/testing/runner";
import pkg from "../package.json";
describe("dep-graph", () => {
it("runtime @suaveplan/* deps are exactly the expected set", {
timeout: 5000,
}, () => {
const deps = Object.keys(pkg.dependencies ?? {})
.filter((d) => d.startsWith("@suaveplan/"))
.sort();
expect(deps).toEqual([
"@suaveplan/error",
"@suaveplan/events",
"@suaveplan/types",
]);
});
});

View File

@@ -0,0 +1,52 @@
import { readdir, readFile } from "node:fs/promises";
import { join } from "node:path";
import { describe, expect, it } from "@suaveplan/testing/runner";
const SRC_DIR = join(import.meta.dirname, "../src");
const DISALLOWED = [
"node:fs",
"node:path",
"process.env",
"Buffer",
"document",
"window",
];
async function collectTsFiles(dir: string): Promise<string[]> {
const entries = await readdir(dir, { withFileTypes: true });
const files: string[] = [];
for (const e of entries) {
if (e.name === "__benchmarks__") continue;
if (e.isDirectory()) {
files.push(...(await collectTsFiles(join(dir, e.name))));
} else if (
e.name.endsWith(".ts") &&
!e.name.endsWith(".test.ts") &&
!e.name.endsWith(".bench.ts")
) {
files.push(join(dir, e.name));
}
}
return files;
}
describe("no-disallowed", () => {
it("source files must not use disallowed APIs", {
timeout: 5000,
}, async () => {
const files = await collectTsFiles(SRC_DIR);
const violations: string[] = [];
for (const file of files) {
const content = await readFile(file, "utf-8");
for (const banned of DISALLOWED) {
if (content.includes(banned)) {
violations.push(`${file}: contains "${banned}"`);
}
}
}
expect(violations).toEqual([]);
});
});

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,8 @@
import { describe, expect, it } from "@suaveplan/testing/runner";
import pkg from "../package.json";
describe("tree-shake", () => {
it("sideEffects is false", { timeout: 5000 }, () => {
expect(pkg.sideEffects).toBe(false);
});
});