openpencil/packages/pen-mcp/package.json
Fini 0ce113c733 fix(ai): dispatcher imports DSL executor via browser-safe subpath
[Codex P1] The browser-side element-tools-dispatcher imported
runBatchDesignDsl from the \`@zseven-w/pen-mcp\` package barrel.
That barrel re-exports node-only modules — document-manager,
log-utils, theme-presets — which import node:fs / node:path at
top level. Vite / esbuild resolve the barrel BEFORE tree-shaking
can drop those branches, so browser builds failed on unresolved
node built-ins.

Fix:
  - packages/pen-mcp/package.json: add \`./dsl\` subpath export
    pointing at tools/batch-design-dsl.ts — the pure executor
    file already guarded as browser-safe by the adjacent
    regression test.
  - apps/web dispatcher: switch import to
    \`@zseven-w/pen-mcp/dsl\`. No other changes — the re-exported
    symbols (runBatchDesignDsl / OpResult / ImageSearchFetcher /
    RunBatchDesignDslOptions) are identical shape.
  - batch-design-dsl-browser-safe.test.ts: add an assertion that
    package.json's exports field preserves the \`./dsl\` key
    pointing at the expected file. Without this, silently
    removing the subpath would re-introduce the browser-breaking
    resolution path.

The package barrel keeps its current export of runBatchDesignDsl
too (a few internal test files still import from it). Browser
callers should migrate to \`@zseven-w/pen-mcp/dsl\` per the JSDoc
note now in the dispatcher.
2026-04-22 11:15:00 +08:00

50 lines
1.2 KiB
JSON

{
"name": "@zseven-w/pen-mcp",
"version": "0.7.4",
"description": "MCP server, document manager, and tools for OpenPencil",
"homepage": "https://github.com/ZSeven-W/openpencil/tree/main/packages/pen-mcp",
"bugs": {
"url": "https://github.com/ZSeven-W/openpencil/issues"
},
"license": "MIT",
"author": {
"name": "ZSeven-W",
"email": "xkayshen@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/ZSeven-W/openpencil.git",
"directory": "packages/pen-mcp"
},
"files": [
"src"
],
"type": "module",
"exports": {
".": {
"types": "./src/index.ts",
"import": "./src/index.ts"
},
"./dsl": {
"types": "./src/tools/batch-design-dsl.ts",
"import": "./src/tools/batch-design-dsl.ts"
}
},
"scripts": {
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@iconify-json/feather": "^1.2.1",
"@iconify-json/lucide": "^1.2.93",
"@modelcontextprotocol/sdk": "^1.12.1",
"@zseven-w/pen-ai-skills": "workspace:*",
"@zseven-w/pen-core": "workspace:*",
"@zseven-w/pen-engine": "workspace:*",
"@zseven-w/pen-types": "workspace:*",
"nanoid": "^5.1.6"
},
"devDependencies": {
"typescript": "^5.7.2"
}
}