{"_id":"@dsh-mermaid-renderer/dsh-client-modules","name":"@dsh-mermaid-renderer/dsh-client-modules","dist-tags":{"next":"0.1.0-rc.6-mermaid.10","latest":"0.1.0-rc.6-mermaid.10"},"versions":{"0.1.0-rc.6-mermaid.10":{"name":"@dsh-mermaid-renderer/dsh-client-modules","description":"Client module system, dual-face: node half composes the __DSH_BOOT__ entry graph (incremental dsh.client scan, bundle route, index tap, webPlugins service); browser half is the lazy-CJS module table the vendored cordis Loader consumes as its internal seam","version":"0.1.0-rc.6-mermaid.10","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/dsh-mermaid/dsh-mermaid-release.git","directory":"projects/harness/mermaid-release/packages/client/modules/package.json"},"type":"module","main":"lib/index.js","types":"lib/types/index.d.ts","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./client":{"types":"./lib/types/client/index.d.ts","default":"./lib/client.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"dsh":{"client":{"platform":"web","inject":[],"immediately":true}},"scripts":{"bundle":"tsdown","watch":"tsdown --watch"},"license":"MIT","devDependencies":{"@deepseek-ai/cordis-plugin-loader":"^1.0.2","@deepseek-ai/dsh-host-webserver":"^0.1.0-rc.6","@deepseek-ai/dsh-invariants":"^0.1.0-rc.6","@deepseek-ai/cordis":"^4.0.1"},"peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0-rc.6","@deepseek-ai/cordis":"^4.0.1"},"gitHead":"efbd3fcdd8e770427e81ec31abf3bf7cab5177bc","_id":"@dsh-mermaid-renderer/dsh-client-modules@0.1.0-rc.6-mermaid.10","bugs":{"url":"https://github.com/dsh-mermaid/dsh-mermaid-release/issues"},"homepage":"https://github.com/dsh-mermaid/dsh-mermaid-release#readme","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-E9R2J5wf/Jbjnqd8+tAZFPdEsJf0Buz05pCpd1Q59jItmPdLZJ5LGSw1hAMAJxAHELBZpWYtGgTum0C72gcbrg==","shasum":"5c27c37496bd2ab525617e1572278328475f2967","tarball":"https://registry.npmjs.org/@dsh-mermaid-renderer/dsh-client-modules/-/dsh-client-modules-0.1.0-rc.6-mermaid.10.tgz","fileCount":12,"unpackedSize":53069,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGMFDE2DVRdvLo9xS2SIZk/BMWtEcsShYrHF+xrJqQqgAiBtGXXqyHn85emJBZsJPAAF2CyhOvZZZMr32vbGeyV31A=="}]},"_npmUser":{"name":"feedseawave","email":"xuechenli2021@163.com"},"directories":{},"maintainers":[{"name":"feedseawave","email":"xuechenli2021@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dsh-client-modules_0.1.0-rc.6-mermaid.10_1786914815829_0.24021828235953535"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-16T21:13:35.698Z","0.1.0-rc.6-mermaid.10":"2026-08-16T21:13:35.972Z","modified":"2026-08-16T21:13:36.218Z"},"maintainers":[{"name":"feedseawave","email":"xuechenli2021@163.com"}],"description":"Client module system, dual-face: node half composes the __DSH_BOOT__ entry graph (incremental dsh.client scan, bundle route, index tap, webPlugins service); browser half is the lazy-CJS module table the vendored cordis Loader consumes as its internal seam","homepage":"https://github.com/dsh-mermaid/dsh-mermaid-release#readme","repository":{"type":"git","url":"git+https://github.com/dsh-mermaid/dsh-mermaid-release.git","directory":"projects/harness/mermaid-release/packages/client/modules/package.json"},"bugs":{"url":"https://github.com/dsh-mermaid/dsh-mermaid-release/issues"},"license":"MIT","readme":"# @deepseek-ai/dsh-client-modules\n\n[English](README.md) | 中文\n\n客户端模块系统：Node 内部 ESM loader 的浏览器端对等实现，以惰性 CJS 表实现。web 外壳挂载 vendored cordis Loader 来治理配置项（fiber 生命周期、inject 等待、update/refresh），并通过其 `internal` 约定注入该包的 `ClientModuleLoader`；vendored 一侧唯一的消费点是 `EntryTree.import`，因此替换 `internal` 恰好只会替换「插件代码如何到达」，不会改变其他内容。\n\n惰性 CJS 模型（web2）：执行插件 bundle 只会注册其 factory（`window.__ModuleLoader__.load({id, factory})`）；每个模块主体的副作用（包括 CSS 注入）都位于 factory 闭包中，在物化时运行（`factory(require)` → 导出表层，并在 `loadCache` 中记忆化），不会在脚本执行时运行。如果 factory 依赖另一个已注册但尚未物化的模块，系统会递归物化它，因此加载顺序无需外部编排；require 循环会抛出异常（factory 形式的 CJS 无法提供部分导出）。`<id>/client` 与裸 id 指向同一表层（一个插件 bundle 就是其包的客户端侧）。\n\n解析分支顺序（`import(specifier)`）：平台种子词 → 外壳实例；记忆化记录 → 表层；外壳自身的静态注册表（`registerStatic`，app-shell）→ 模块；已注册 factory → 物化；模块图记录（`window.__DSH_BOOT__`）→ 加载外部 classic script + 物化；其他情况一律抛出异常。这是构建时 bundle 纯度门禁的运行时镜像。交给 factory 的同步 `require` 采用相同顺序，但不含异步加载分支，并把观察到的边记录到模块记录中。`prefetch` 是第一阶段到达钩子（只加载脚本并注册 factory；并发调用共享一个进行中的任务）；`invalidate` 会丢弃 factory 与物化记录，使下一次 prefetch/import 重新加载脚本；它是 HMR（热模块替换）钩子。\n\nNode 侧会扫描已启用的 Loader 配置项以发现 web `dsh.client` 包，解析每个 `exports[\"./client\"]`，把构建后的 bundle 哈希写入启动图，并通过 `/plugins` 提供该文件及其 sourcemap。源码启动会把宿主侧导入映射到 TypeScript 源码，但仍消费这一构建后的客户端导出；缺失文件共享一条构建说明，随后以包／路径列表列出各项，而无关的文件系统错误仍是独立故障。\n\n## 模型体验\n\n无。模块 loader 属于浏览器侧内核机制；这里没有任何内容进入模型请求。\n\n#### KV Cache 影响\n\n无；该包既不组装也不发送提供方请求。\n\n## 已知限制与暂缓事项\n\n- **有意采用扁平模块图**：每个 bundle 是一个模块节点，其边只指向表中的叶节点；接口（`loadCache`/`edges`/`invalidate`）已经支持通用模块图，因此可以改变 externalization 粒度而不更改接口。\n- **自身不维护卸载记录**：样式移除与 fiber 拆卸顺序属于 HMR 驱动器（`@deepseek-ai/dsh-client-hmr`）；loader 只在每条记录中登记其拥有的样式标签 id。\n","readmeFilename":"README.zh.md","_rev":"1-a211ff978d50b39096e452612408a84a"}