Every runtime dependency core/ imports is now declared once, in the repo-root package.json, and nowhere else. Deleting the client-side copies does not merely align them: a package installs only into an install root that declares it, so with no second declaration a second copy cannot be created at all — the failure class #1896 was opened for and #1965/#2029 built verify:dep-lockstep to detect. - clients/{web,cli,tui,launcher}: dropped ajv, atomically, chokidar, commander, open, pino, zod, @napi-rs/keyring, hono, @hono/node-server and react, as each applied. clients/cli and clients/launcher now declare no runtime dependencies. - Root hono floor raised ^4.12.18 -> ^4.13.1, keeping the higher of the two ranges that were in the tree rather than silently lowering web's. - tsup external lists: added ajv and zod to all three bundles, plus atomically and open (cli) and atomically (tui). tsup externalizes only what the nearest manifest declares, so a package that moves to the root is inlined unless it is named explicitly. - vitest.shared.mts: repointed the pino, hono, @hono/node-server, atomically, chokidar and @napi-rs/keyring pins from <client>/node_modules to the repo root, joining express, yaml and proper-lockfile. Left behind they would resolve to a directory that no longer exists, or to a transitive copy an unrelated dependency dragged in. react and react-dom stay client-pinned so the pair stays version-matched within an install. - Docs: AGENTS.md dependency placement, the root README and the local-dev skill describe the consolidated layout. verify:dep-lockstep candidate set: 4 -> 2 (hono and pino fell out; only @standard-schema/spec and zod still reach one tsc program from two installs). npm run local:gate and npm run pack:verify both pass. Signed-off-by: cliffhall <cliff@futurescale.com>
66 lines
2.7 KiB
TypeScript
66 lines
2.7 KiB
TypeScript
import { defineConfig } from "tsup";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = path.resolve(dirname, "../..");
|
|
|
|
export default defineConfig({
|
|
entry: ["src/index.ts"],
|
|
format: ["esm"],
|
|
outDir: "build",
|
|
clean: true,
|
|
// No source maps in the published bundle — they roughly double the on-disk
|
|
// size and aren't needed at runtime (debug via `npm run dev` on the source).
|
|
sourcemap: false,
|
|
target: "node22",
|
|
platform: "node",
|
|
noExternal: [/^@inspector\/core/],
|
|
external: [
|
|
// `undici` MUST stay external. It is CommonJS, so inlining it rewrites
|
|
// `import("undici")` to a relative chunk whose `require("assert")` hits
|
|
// esbuild's ESM `__require` shim and throws "Dynamic require of \"assert\"
|
|
// is not supported" — and because the specifier was rewritten at build time,
|
|
// no user-side install can ever satisfy it (#2067). It is declared in the
|
|
// ROOT manifest only, so tsup cannot infer this from a nearest-manifest
|
|
// lookup; the entry has to be explicit.
|
|
"undici",
|
|
"commander",
|
|
"open",
|
|
"pino",
|
|
"hono",
|
|
"@hono/node-server",
|
|
"vite",
|
|
"@vitejs/plugin-react",
|
|
"atomically",
|
|
"chokidar",
|
|
"@napi-rs/keyring",
|
|
// Root-declared (see the repo's dependency-placement rule) and CJS, which
|
|
// is the combination that bites: tsup externalizes what the *client's*
|
|
// package.json declares, so a root-only dependency is bundled unless named
|
|
// here — and inlining a CJS module into an ESM bundle leaves esbuild's
|
|
// `Dynamic require of "path" is not supported` shim, which throws at
|
|
// import time and takes the whole binary down before it parses a flag.
|
|
"proper-lockfile",
|
|
"@modelcontextprotocol/client",
|
|
"@modelcontextprotocol/core",
|
|
// Root-declared and reached through `core/mcp/apps.ts`, so it must be
|
|
// external here like every other root runtime dependency — which client
|
|
// actually reaches it is a function of what `core/` imports, not of this
|
|
// client's own code, so all three lists carry it (AGENTS.md). The CLI was
|
|
// inlining it; the #2067 guard surfaced that.
|
|
"@modelcontextprotocol/ext-apps",
|
|
// Consolidated to the ROOT manifest by #2195, along with every other
|
|
// runtime dependency `core/` imports. tsup externalizes only what the
|
|
// *nearest* package.json declares, so once a client stops declaring one it
|
|
// must be named here or esbuild inlines it — the #2067 failure class, now
|
|
// reached by a manifest edit rather than an omission.
|
|
"ajv",
|
|
"zod",
|
|
],
|
|
esbuildOptions(options) {
|
|
options.alias = {
|
|
"@inspector/core": path.join(repoRoot, "core"),
|
|
};
|
|
},
|
|
});
|