Extracts citation-evidence/src/binder/ into this repo as the standalone @citation-evidence/evidence-binder package: headless binding service + in-memory link repo, active-state machine, the SharedContracts §7 rect-registry contract (registry, change pumps, hooks, SVG overlay), and the target-neutral reference FormRenderer. - toolchain mirrors sibling extracted repos (pnpm/tsc/vitest/eslint); imports rewritten from @shared/@engine aliases to the engine's @citation-evidence/engine package specifiers - dependency boundary (engine + anchor only; no source/work/umbrella) enforced via eslint no-restricted-imports - docs: extraction inventory + contract deltas, ADR-0001 (reference UI kept as supported exports), refreshed README/SCOPE/INTENT, populated capabilities index - typecheck + lint green, 37 tests passing Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
import { fileURLToPath } from "node:url";
|
|
|
|
import { defineConfig } from "vitest/config";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
// The binder splits into a pure headless core (bindings, active-state reducer,
|
|
// rect-registry) that is node-safe, and a React surface (provider, form
|
|
// renderer, overlay, registry hooks) exercised in a DOM. Tests whose filename
|
|
// ends in `.dom.test.{ts,tsx}` run under happy-dom; everything else runs in
|
|
// Node, which is faster. The react plugin lets the `.tsx` sources compile.
|
|
//
|
|
// The one runtime dependency, `@citation-evidence/engine`, resolves through its
|
|
// package `exports` map (`.` and `./shared`) via the sibling-checkout link. The
|
|
// engine ships raw TypeScript that uses its own `@shared/*` / `@engine/*` path
|
|
// aliases internally; tsc honours those via tsconfig `paths`, but Vite does
|
|
// not read tsconfig, so we mirror them here as resolve aliases. Nothing in this
|
|
// package imports `citation-evidence` internals — the aliases only exist so the
|
|
// linked engine source resolves.
|
|
const enginePath = (rel: string) =>
|
|
fileURLToPath(new URL(`../citation-engine/src/${rel}`, import.meta.url));
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: [
|
|
{ find: /^@shared\//, replacement: `${enginePath("shared")}/` },
|
|
{ find: /^@engine\//, replacement: `${enginePath("engine")}/` },
|
|
],
|
|
},
|
|
test: {
|
|
environmentMatchGlobs: [["**/*.dom.test.{ts,tsx}", "happy-dom"]],
|
|
globals: false,
|
|
},
|
|
});
|