pi-mono/vitest.base.ts
Mario Zechner e9c0ff4d84 feat(chord): Chord v2 is the package's root
src/next is src (the main export), src/next-node is src/node with short subpaths (/http, /workers, /plugins,
/plugins/runtime, /app, /surfaces, /web, /react, /tui, /tui/launcher); the foundations get /json and /watch;
Chord v1 moves to src/old (/old, /old/node) until p2 runs on v2; tests and docs move likewise (test/, docs/,
test/old, docs/old). Durable and env import the foundations from their subpaths.
2026-11-02 22:36:55 +00:00

100 lines
7.6 KiB
TypeScript

import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
export const workspaceSourcePaths = {
chordIndex: fileURLToPath(new URL("./packages/chord/src/index.ts", import.meta.url)),
chordContext: fileURLToPath(new URL("./packages/chord/src/context/index.ts", import.meta.url)),
chordDelta: fileURLToPath(new URL("./packages/chord/src/delta/index.ts", import.meta.url)),
chordJson: fileURLToPath(new URL("./packages/chord/src/json.ts", import.meta.url)),
chordWatch: fileURLToPath(new URL("./packages/chord/src/watch.ts", import.meta.url)),
chordOutput: fileURLToPath(new URL("./packages/chord/src/output.ts", import.meta.url)),
chordSqlite: fileURLToPath(new URL("./packages/chord/src/sqlite/index.ts", import.meta.url)),
chordSqliteNode: fileURLToPath(new URL("./packages/chord/src/sqlite/node.ts", import.meta.url)),
chordSqliteCloudflare: fileURLToPath(new URL("./packages/chord/src/sqlite/cloudflare.ts", import.meta.url)),
chordTelemetrySqlite: fileURLToPath(new URL("./packages/chord/src/telemetry-sqlite/index.ts", import.meta.url)),
chordHttp: fileURLToPath(new URL("./packages/chord/src/node/http/index.ts", import.meta.url)),
chordWorkers: fileURLToPath(new URL("./packages/chord/src/node/workers/index.ts", import.meta.url)),
chordPlugins: fileURLToPath(new URL("./packages/chord/src/node/plugins/index.ts", import.meta.url)),
chordPluginsRuntime: fileURLToPath(new URL("./packages/chord/src/node/plugins/runtime.ts", import.meta.url)),
chordApp: fileURLToPath(new URL("./packages/chord/src/node/app/index.ts", import.meta.url)),
chordWeb: fileURLToPath(new URL("./packages/chord/src/web/index.ts", import.meta.url)),
chordSurfaces: fileURLToPath(new URL("./packages/chord/src/node/surfaces/index.ts", import.meta.url)),
chordReact: fileURLToPath(new URL("./packages/chord/src/react/index.ts", import.meta.url)),
chordTui: fileURLToPath(new URL("./packages/chord/src/tui/index.ts", import.meta.url)),
chordTuiLauncher: fileURLToPath(new URL("./packages/chord/src/node/tui/index.ts", import.meta.url)),
chordOld: fileURLToPath(new URL("./packages/chord/src/old/index.ts", import.meta.url)),
chordOldNode: fileURLToPath(new URL("./packages/chord/src/old/node.ts", import.meta.url)),
telemetryIndex: fileURLToPath(new URL("./packages/telemetry/src/index.ts", import.meta.url)),
telemetryTesting: fileURLToPath(new URL("./packages/telemetry/src/testing/index.ts", import.meta.url)),
mcpIndex: fileURLToPath(new URL("./packages/mcp/src/index.ts", import.meta.url)),
mcpOAuth: fileURLToPath(new URL("./packages/mcp/src/oauth/index.ts", import.meta.url)),
mcpTesting: fileURLToPath(new URL("./packages/mcp/src/testing/index.ts", import.meta.url)),
aiIndex: fileURLToPath(new URL("./packages/ai/src/index.ts", import.meta.url)),
aiCompat: fileURLToPath(new URL("./packages/ai/src/compat.ts", import.meta.url)),
aiModels: fileURLToPath(new URL("./packages/ai/src/models.ts", import.meta.url)),
aiOAuth: fileURLToPath(new URL("./packages/ai/src/oauth.ts", import.meta.url)),
aiApi: fileURLToPath(new URL("./packages/ai/src/api", import.meta.url)),
aiProviders: fileURLToPath(new URL("./packages/ai/src/providers", import.meta.url)),
aiUtils: fileURLToPath(new URL("./packages/ai/src/utils", import.meta.url)),
agentIndex: fileURLToPath(new URL("./packages/agent/src/index.ts", import.meta.url)),
codemodeIndex: fileURLToPath(new URL("./packages/codemode/src/index.ts", import.meta.url)),
codemodeDeclarations: fileURLToPath(new URL("./packages/codemode/src/declarations.ts", import.meta.url)),
codemodeSource: fileURLToPath(new URL("./packages/codemode/src/source.ts", import.meta.url)),
codingAgentIndex: fileURLToPath(new URL("./packages/coding-agent/src/index.ts", import.meta.url)),
tuiIndex: fileURLToPath(new URL("./packages/tui/src/index.ts", import.meta.url)),
} as const;
export default defineConfig({
resolve: {
alias: [
{ find: /^@earendil-works\/chord$/, replacement: workspaceSourcePaths.chordIndex },
{ find: /^@earendil-works\/chord\/context$/, replacement: workspaceSourcePaths.chordContext },
{ find: /^@earendil-works\/chord\/delta$/, replacement: workspaceSourcePaths.chordDelta },
{ find: /^@earendil-works\/chord\/json$/, replacement: workspaceSourcePaths.chordJson },
{ find: /^@earendil-works\/chord\/watch$/, replacement: workspaceSourcePaths.chordWatch },
{ find: /^@earendil-works\/chord\/output$/, replacement: workspaceSourcePaths.chordOutput },
{ find: /^@earendil-works\/chord\/sqlite$/, replacement: workspaceSourcePaths.chordSqlite },
{ find: /^@earendil-works\/chord\/sqlite\/node$/, replacement: workspaceSourcePaths.chordSqliteNode },
{ find: /^@earendil-works\/chord\/sqlite\/cloudflare$/, replacement: workspaceSourcePaths.chordSqliteCloudflare },
{ find: /^@earendil-works\/chord\/telemetry-sqlite$/, replacement: workspaceSourcePaths.chordTelemetrySqlite },
{ find: /^@earendil-works\/chord\/http$/, replacement: workspaceSourcePaths.chordHttp },
{ find: /^@earendil-works\/chord\/workers$/, replacement: workspaceSourcePaths.chordWorkers },
{ find: /^@earendil-works\/chord\/plugins$/, replacement: workspaceSourcePaths.chordPlugins },
{ find: /^@earendil-works\/chord\/plugins\/runtime$/, replacement: workspaceSourcePaths.chordPluginsRuntime },
{ find: /^@earendil-works\/chord\/app$/, replacement: workspaceSourcePaths.chordApp },
{ find: /^@earendil-works\/chord\/web$/, replacement: workspaceSourcePaths.chordWeb },
{ find: /^@earendil-works\/chord\/surfaces$/, replacement: workspaceSourcePaths.chordSurfaces },
{ find: /^@earendil-works\/chord\/react$/, replacement: workspaceSourcePaths.chordReact },
{ find: /^@earendil-works\/chord\/tui$/, replacement: workspaceSourcePaths.chordTui },
{ find: /^@earendil-works\/chord\/tui\/launcher$/, replacement: workspaceSourcePaths.chordTuiLauncher },
{ find: /^@earendil-works\/chord\/old$/, replacement: workspaceSourcePaths.chordOld },
{ find: /^@earendil-works\/chord\/old\/node$/, replacement: workspaceSourcePaths.chordOldNode },
{ find: /^@earendil-works\/pi-telemetry$/, replacement: workspaceSourcePaths.telemetryIndex },
{ find: /^@earendil-works\/pi-telemetry\/testing$/, replacement: workspaceSourcePaths.telemetryTesting },
{ find: /^@earendil-works\/pi-mcp$/, replacement: workspaceSourcePaths.mcpIndex },
{ find: /^@earendil-works\/pi-mcp\/oauth$/, replacement: workspaceSourcePaths.mcpOAuth },
{ find: /^@earendil-works\/pi-mcp\/testing$/, replacement: workspaceSourcePaths.mcpTesting },
{ find: /^@earendil-works\/pi-ai$/, replacement: workspaceSourcePaths.aiIndex },
{ find: /^@earendil-works\/pi-ai\/compat$/, replacement: workspaceSourcePaths.aiCompat },
{ find: /^@earendil-works\/pi-ai\/models$/, replacement: workspaceSourcePaths.aiModels },
{ find: /^@earendil-works\/pi-ai\/oauth$/, replacement: workspaceSourcePaths.aiOAuth },
{
find: /^@earendil-works\/pi-ai\/utils\/(.+)$/,
replacement: `${workspaceSourcePaths.aiUtils}/$1.ts`,
},
{
find: /^@earendil-works\/pi-ai\/api\/(.+)$/,
replacement: `${workspaceSourcePaths.aiApi}/$1.ts`,
},
{
find: /^@earendil-works\/pi-ai\/providers\/(.+)$/,
replacement: `${workspaceSourcePaths.aiProviders}/$1.ts`,
},
{ find: /^@earendil-works\/pi-agent-core$/, replacement: workspaceSourcePaths.agentIndex },
{ find: /^@earendil-works\/pi-codemode$/, replacement: workspaceSourcePaths.codemodeIndex },
{ find: /^@earendil-works\/pi-codemode\/declarations$/, replacement: workspaceSourcePaths.codemodeDeclarations },
{ find: /^@earendil-works\/pi-codemode\/source$/, replacement: workspaceSourcePaths.codemodeSource },
{ find: /^@earendil-works\/pi-tui$/, replacement: workspaceSourcePaths.tuiIndex },
],
},
});