Files
ruflo/v3/@claude-flow/shared/package.json
T
Dragan Spiridonov 41b05582cc fix(shared): declare runtime dependencies and keep tests out of the tarball
@claude-flow/shared 3.0.1-3.0.3 declare only sql.js, but the compiled code
imports zod (core/config) and express, cors, helmet and ws (mcp transports).
They sat in devDependencies, so a clean `npm i @claude-flow/shared` cannot load
`.` or `./core` (Cannot find package 'zod') or `./mcp` (Cannot find package
'express'). ruflo users never saw it because @claude-flow/cli declares the same
packages and npm hoists them.

- Move zod, express, cors, helmet and ws to dependencies, with ranges that
  overlap what @claude-flow/cli declares so a CLI install can dedupe them.
  express is bounded to `^4.22.2 || ^5.0.0` (the patched 4.x floor the repo
  overrides to, and the 5.x the workspace runs) instead of an open `>=`.
- Move @types/ws to dependencies: dist/mcp/transport/websocket.d.ts imports
  `ws`, so a consumer type-checking with skipLibCheck off hit TS7016.
- Exclude *.test.ts / *.spec.ts / __tests__ from the build, and negate them in
  `files` so a stale local dist (composite builds do not clear old outputs)
  cannot ship them either. 3.0.3 ships 6 compiled tests that import vitest.
- HttpTransport: read `req.body ?? {}`. Under Express 5 a POST /rpc with no JSON
  body left req.body undefined and answered 500 instead of the JSON-RPC 400.
  Malformed JSON (body-parser's entity.parse.failed) now answers 400 / -32700
  Parse error instead of 500 / -32603 Internal error, under Express 4 and 5.
- Lockfile: only the shared importer block moves; ws 8.19.0 was referenced by
  nothing else and is dropped. `pnpm@8.15.0 install --frozen-lockfile` passes.
- Tests: __tests__/package-manifest.test.ts scans src/ with the TypeScript
  AST (type-only imports erased, comments/strings ignored) and fails on an
  undeclared runtime import, a missing @types/ws, or removed test exclusions;
  __tests__/mcp/http-transport-body.test.ts (transport bound to port 0) covers
  the bodiless POST and malformed JSON. Every mutant (zod, express, @types/ws,
  spec negation, tsconfig exclude, each HTTP fix reverted) is caught.

Verified: npm pack + clean `npm i <tgz>` imports all 9 exports subpaths
(origin/main and registry 3.0.3 fail on 3 of them) and ships no test files;
HTTP /health 200 and a WebSocket connect work under express 5.3.0 and 4.22.3;
a consumer tsc with skipLibCheck off reports 0 errors; shared tests pass; the
CI recursive build and the CLI type-check pass.

Not included: the version bump and the CLI's exact `@claude-flow/shared`
pin, which belong to the release.
2026-10-12 15:42:37 +02:00

50 lines
1.2 KiB
JSON

{
"name": "@claude-flow/shared",
"version": "3.0.3",
"type": "module",
"description": "Shared module - common types, events, utilities, core interfaces",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": "./dist/index.js",
"./types": "./dist/types/index.js",
"./core": "./dist/core/index.js",
"./events": "./dist/events/index.js",
"./hooks": "./dist/hooks/index.js",
"./mcp": "./dist/mcp/index.js",
"./security": "./dist/security/index.js",
"./resilience": "./dist/resilience/index.js",
"./src/plugin-interface.js": "./dist/plugin-interface.js"
},
"files": [
"dist",
"!dist/**/*.test.*",
"!dist/**/*.spec.*",
"!dist/**/__tests__",
"README.md"
],
"scripts": {
"test": "vitest run",
"build": "tsc"
},
"dependencies": {
"@types/ws": "^8.5.10",
"cors": "^2.8.5",
"express": "^4.22.2 || ^5.0.0",
"helmet": "^7.2.0",
"sql.js": "^1.10.3",
"ws": "^8.21.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/node": "^20.0.0",
"@types/sql.js": "^1.4.9",
"vitest": "^4.1.0"
},
"publishConfig": {
"access": "public"
}
}