mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 04:29:51 +08:00
refactor(canvas): review fixes for the busy flag, the comparison note and the bundle size check
- busyReason had no reader: the chat engine sets isBusy through the store's generic set, like every other flag. - The isSameDocument comment says the two "same document" rules disagree in both directions, so neither is a subset of the other. - The import boundary test bundles minified with one pako (the MCP core resolves its own copy) and caps the canvas core at 160 KB (134 KB now).
This commit is contained in:
@@ -122,8 +122,11 @@ describe("canvas import boundary", () => {
|
||||
platform: "browser",
|
||||
format: "esm",
|
||||
jsx: "automatic",
|
||||
alias: { "@": root },
|
||||
// The MCP core (packages/mcp-server/src) resolves pako from its
|
||||
// own node_modules; one copy, as the shell build must do
|
||||
alias: { "@": root, pako: path.join(root, "node_modules/pako") },
|
||||
external: ["react", "react-dom", "next/*"],
|
||||
minify: true,
|
||||
logLevel: "silent",
|
||||
})
|
||||
const inputs = result.metafile.inputs
|
||||
@@ -145,5 +148,12 @@ describe("canvas import boundary", () => {
|
||||
.map((specifier) => `${file} -> ${specifier}`),
|
||||
)
|
||||
expect(nextImports).toEqual([])
|
||||
// The canvas core stays small enough for the MCP's browser shell
|
||||
// (134 KB minified, pako once)
|
||||
const stage = Object.values(result.metafile.outputs).find(
|
||||
(output) =>
|
||||
output.entryPoint === "components/canvas/canvas-stage.tsx",
|
||||
)
|
||||
expect(stage?.bytes).toBeLessThan(160 * 1024)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user