@deepseek-ai/dsh-client-modules 0.0.1-rc.2 → 0.0.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -3,4 +3,4 @@
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/client/modules/README.md
5
5
  README.md: efaff699839b977cc45f89f3c164402241b90dc2
6
- README.zh.md: 772a4870f7ef6730d9d3d4db434ed771d97984f0
6
+ README.zh.md: 6ab3c8494d7ea902e8b891008f236aec41301a35
package/README.zh.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  [English](README.md) | 中文
4
4
 
5
- 客户端模块系统:Node 内部 ESM loader 的浏览器端对等实现,以惰性 CJS 表实现。web 外壳挂载 vendored cordis Loader 来治理配置项(fiber 生命周期、inject 等待、update/refresh),并通过其 `internal` 约定注入该包(package)的 `ClientModuleLoader`;vendored 一侧唯一的消费点是 `EntryTree.import`,因此替换 `internal` 恰好只会替换「插件代码如何到达」,不会改变其他内容。
5
+ 客户端模块系统:Node 内部 ESM loader 的浏览器端对等实现,以惰性 CJS 表实现。web 外壳挂载 vendored cordis Loader 来治理配置项(fiber 生命周期、inject 等待、update/refresh),并通过其 `internal` 约定注入该包的 `ClientModuleLoader`;vendored 一侧唯一的消费点是 `EntryTree.import`,因此替换 `internal` 恰好只会替换「插件代码如何到达」,不会改变其他内容。
6
6
 
7
- 惰性 CJS 模型(web2):执行插件组合包只会注册其 factory(`window.__ModuleLoader__.load({id, factory})`);每个模块主体的副作用(包括 CSS 注入)都位于 factory 闭包中,在物化时运行(`factory(require)` → 导出表层,并在 `loadCache` 中记忆化),不会在脚本执行时运行。如果 factory 依赖另一个已注册但尚未物化的模块,系统会递归物化它,因此加载顺序无需外部编排;require 循环会抛出异常(factory 形式的 CJS 无法提供部分导出)。`<id>/client` 与裸 id 指向同一表层(一个插件组合包就是其包的客户端侧)。
7
+ 惰性 CJS 模型(web2):执行插件 bundle 只会注册其 factory(`window.__ModuleLoader__.load({id, factory})`);每个模块主体的副作用(包括 CSS 注入)都位于 factory 闭包中,在物化时运行(`factory(require)` → 导出表层,并在 `loadCache` 中记忆化),不会在脚本执行时运行。如果 factory 依赖另一个已注册但尚未物化的模块,系统会递归物化它,因此加载顺序无需外部编排;require 循环会抛出异常(factory 形式的 CJS 无法提供部分导出)。`<id>/client` 与裸 id 指向同一表层(一个插件 bundle 就是其包的客户端侧)。
8
8
 
9
- 解析分支顺序(`import(specifier)`):平台种子词 → 外壳实例;记忆化记录 → 表层;外壳自身的静态注册表(`registerStatic`,app-shell)→ 模块;已注册 factory → 物化;模块图记录(`window.__DSH_BOOT__`)→ 加载外部 classic script + 物化;其他情况一律抛出异常。这是构建时组合包纯度门禁的运行时镜像。交给 factory 的同步 `require` 采用相同顺序,但不含异步加载分支,并把观察到的边记录到模块记录中。`prefetch` 是第一阶段到达钩子(只加载脚本并注册 factory;并发调用共享一个进行中的任务);`invalidate` 会丢弃 factory 与物化记录,使下一次 prefetch/import 重新加载脚本;它是 HMR(热模块替换)钩子。
9
+ 解析分支顺序(`import(specifier)`):平台种子词 → 外壳实例;记忆化记录 → 表层;外壳自身的静态注册表(`registerStatic`,app-shell)→ 模块;已注册 factory → 物化;模块图记录(`window.__DSH_BOOT__`)→ 加载外部 classic script + 物化;其他情况一律抛出异常。这是构建时 bundle 纯度门禁的运行时镜像。交给 factory 的同步 `require` 采用相同顺序,但不含异步加载分支,并把观察到的边记录到模块记录中。`prefetch` 是第一阶段到达钩子(只加载脚本并注册 factory;并发调用共享一个进行中的任务);`invalidate` 会丢弃 factory 与物化记录,使下一次 prefetch/import 重新加载脚本;它是 HMR(热模块替换)钩子。
10
10
 
11
- Node 侧会扫描已启用的 Loader 配置项以发现 web `dsh.client` 包,解析每个 `exports["./client"]`,把构建后的组合包哈希写入启动图,并通过 `/plugins` 提供该文件及其 sourcemap。源码启动会把宿主侧导入映射到 TypeScript 源码,但仍消费这一构建后的客户端导出;缺失文件共享一条构建说明,随后以 package/path list 列出各项,而无关的文件系统错误仍是独立故障。
11
+ Node 侧会扫描已启用的 Loader 配置项以发现 web `dsh.client` 包,解析每个 `exports["./client"]`,把构建后的 bundle 哈希写入启动图,并通过 `/plugins` 提供该文件及其 sourcemap。源码启动会把宿主侧导入映射到 TypeScript 源码,但仍消费这一构建后的客户端导出;缺失文件共享一条构建说明,随后以包/路径列表列出各项,而无关的文件系统错误仍是独立故障。
12
12
 
13
13
  ## 模型体验
14
14
 
@@ -20,5 +20,5 @@ Node 侧会扫描已启用的 Loader 配置项以发现 web `dsh.client` 包,
20
20
 
21
21
  ## 已知限制与暂缓事项
22
22
 
23
- - **有意采用扁平模块图**:每个组合包是一个模块节点,其边只指向表中的叶节点;接口(`loadCache`/`edges`/`invalidate`)已经支持通用模块图,因此可以改变 externalization 粒度而不更改接口。
24
- - **自身不记录卸载账目**:样式移除与 fiber 拆卸顺序属于 HMR 驱动器(`@deepseek-ai/dsh-client-hmr`);loader 只在每条记录中登记其拥有的样式标签 id。
23
+ - **有意采用扁平模块图**:每个 bundle 是一个模块节点,其边只指向表中的叶节点;接口(`loadCache`/`edges`/`invalidate`)已经支持通用模块图,因此可以改变 externalization 粒度而不更改接口。
24
+ - **自身不维护卸载记录**:样式移除与 fiber 拆卸顺序属于 HMR 驱动器(`@deepseek-ai/dsh-client-hmr`);loader 只在每条记录中登记其拥有的样式标签 id。
package/lib/index.js CHANGED
@@ -23,7 +23,7 @@ import { Service } from "@deepseek-ai/cordis";
23
23
  * negative "not a client package" verdict) is cached per name and never
24
24
  * expires — plugin-set changes take effect on restart; bundle content
25
25
  * changes reach the graph only through
26
- * {@link ClientModuleHostService.rebuilt}.
26
+ * {@link ClientModuleRegistry.rebuilt}.
27
27
  * @module @deepseek-ai/dsh-client-modules
28
28
  */
29
29
  /** Recovery instruction shared by grouped startup and steady-state bundle diagnostics. */
@@ -118,8 +118,8 @@ function injectBootManifest(html, graph) {
118
118
  * already-loaded entries aggregates into one loud throw (FAILED fiber; the
119
119
  * boot activation audit reports it).
120
120
  */
121
- var ClientModuleHostService = class extends Service {
122
- static inject = ["httpServer", "loader"];
121
+ var ClientModuleRegistry = class extends Service {
122
+ static inject = ["webServer", "loader"];
123
123
  table = /* @__PURE__ */ new Map();
124
124
  pkgMeta = /* @__PURE__ */ new Map();
125
125
  rebuildListeners = /* @__PURE__ */ new Set();
@@ -130,10 +130,10 @@ var ClientModuleHostService = class extends Service {
130
130
  composed;
131
131
  /**
132
132
  * Build the service: subscribe, seed, and run the activation flush.
133
- * @param ctx - plugin context carrying httpServer and loader.
133
+ * @param ctx - plugin context carrying webServer and loader.
134
134
  */
135
135
  constructor(ctx) {
136
- super(ctx, "clientModuleHost");
136
+ super(ctx, "clientModules");
137
137
  if (ctx.baseUrl === void 0) throw new Error("client-modules: ctx.baseUrl is unset — the node half needs the config-tree anchor to resolve plugin packages");
138
138
  const require = createRequire(ctx.baseUrl);
139
139
  this.resolvePkgJson = (spec) => require.resolve(`${spec}/package.json`);
@@ -155,12 +155,12 @@ var ClientModuleHostService = class extends Service {
155
155
  const failures = [];
156
156
  this.flush((err) => failures.push(err));
157
157
  if (failures.length > 0) throw new ClientPackageCompositionError(failures);
158
- ctx.effect(() => ctx.httpServer.register({
158
+ ctx.effect(() => ctx.webServer.register({
159
159
  kind: "prefix",
160
160
  path: "/plugins",
161
161
  handler: this.serveBundle
162
162
  }), "client-modules: bundle route");
163
- ctx.effect(() => ctx.httpServer.tapIndex((html) => injectBootManifest(html, this.composed)), "client-modules: boot manifest injection");
163
+ ctx.effect(() => ctx.webServer.tapIndex((html) => injectBootManifest(html, this.composed)), "client-modules: boot manifest injection");
164
164
  }
165
165
  /**
166
166
  * Current composed entry graph (stable object between changes).
@@ -344,4 +344,4 @@ var ClientModuleHostService = class extends Service {
344
344
  };
345
345
  };
346
346
  //#endregion
347
- export { ClientModuleHostService, ClientModuleHostService as default, injectBootManifest };
347
+ export { ClientModuleRegistry, ClientModuleRegistry as default, injectBootManifest };
package/lib/invariant.js CHANGED
@@ -19,7 +19,7 @@ const inject = ["invariants"];
19
19
  */
20
20
  const install = (ctx, fail) => {
21
21
  ctx.on("internal/plugin", () => {
22
- const host = ctx.get("clientModuleHost");
22
+ const host = ctx.get("clientModules");
23
23
  if (host === void 0) return;
24
24
  for (const row of host.graph().entries) if (host.clientPath(row.id) === void 0) fail(`web plugin graph row "${row.id}" advertises ${row.url} but resolves no client bundle path — the served __DSH_BOOT__ would 404 on fetch`);
25
25
  }, { global: true });
@@ -16,7 +16,7 @@
16
16
  * negative "not a client package" verdict) is cached per name and never
17
17
  * expires — plugin-set changes take effect on restart; bundle content
18
18
  * changes reach the graph only through
19
- * {@link ClientModuleHostService.rebuilt}.
19
+ * {@link ClientModuleRegistry.rebuilt}.
20
20
  * @module @deepseek-ai/dsh-client-modules
21
21
  */
22
22
  import { Service } from '@deepseek-ai/cordis';
@@ -26,7 +26,7 @@ export type { BootManifest, BootModuleRow, BootPluginRow, WebBootEntry, WebBootG
26
26
  declare module '@deepseek-ai/cordis' {
27
27
  interface Context {
28
28
  /** The web plugin table (provided by the client-modules node half). */
29
- clientModuleHost: ClientModuleHostService;
29
+ clientModules: ClientModuleRegistry;
30
30
  }
31
31
  }
32
32
  /**
@@ -45,7 +45,7 @@ export declare function injectBootManifest(html: string, graph: WebBootGraph): s
45
45
  * already-loaded entries aggregates into one loud throw (FAILED fiber; the
46
46
  * boot activation audit reports it).
47
47
  */
48
- export declare class ClientModuleHostService extends Service {
48
+ export declare class ClientModuleRegistry extends Service {
49
49
  static inject: string[];
50
50
  private readonly table;
51
51
  private readonly pkgMeta;
@@ -57,7 +57,7 @@ export declare class ClientModuleHostService extends Service {
57
57
  private composed;
58
58
  /**
59
59
  * Build the service: subscribe, seed, and run the activation flush.
60
- * @param ctx - plugin context carrying httpServer and loader.
60
+ * @param ctx - plugin context carrying webServer and loader.
61
61
  */
62
62
  constructor(ctx: Context);
63
63
  /**
@@ -107,5 +107,5 @@ export declare class ClientModuleHostService extends Service {
107
107
  private flush;
108
108
  private readonly serveBundle;
109
109
  }
110
- export default ClientModuleHostService;
110
+ export default ClientModuleRegistry;
111
111
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-modules",
3
3
  "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",
4
- "version": "0.0.1-rc.2",
4
+ "version": "0.0.1-rc.3",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -39,8 +39,8 @@
39
39
  "license": "BSD-3-Clause",
40
40
  "devDependencies": {
41
41
  "@deepseek-ai/cordis-plugin-loader": "^1.0.1-rc.1",
42
- "@deepseek-ai/dsh-host-webserver": "^0.0.1-rc.2",
43
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.2",
42
+ "@deepseek-ai/dsh-host-webserver": "^0.0.1-rc.3",
43
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
44
44
  "@deepseek-ai/cordis": "^4.0.1-rc.1"
45
45
  },
46
46
  "files": [
@@ -50,8 +50,8 @@
50
50
  "lib/types/**/*.d.ts"
51
51
  ],
52
52
  "peerDependencies": {
53
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.2",
54
- "@deepseek-ai/cordis": "^4.0.1-rc.1"
53
+ "@deepseek-ai/cordis": "^4.0.1-rc.1",
54
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.3"
55
55
  },
56
56
  "scripts": {
57
57
  "bundle": "tsdown",