@crazx/dsh-client-modules 0.1.5-rc.1.zw.2 → 0.1.6-alpha.1.zw.1
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 +2 -2
- package/README.md +4 -2
- package/README.zh.md +4 -2
- package/lib/client.js +47 -6
- package/lib/index.js +56 -43
- package/lib/types/client/index.d.ts +6 -4
- package/lib/types/client/manifest.d.ts +18 -0
- package/lib/types/index.d.ts +2 -1
- package/package.json +4 -4
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
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
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 7fa555b15a55eecdf1adb7bb69b44eb6990a684f
|
|
6
|
+
README.zh.md: 28bb95e10250587562d7ce5572115618f33e352e
|
package/README.md
CHANGED
|
@@ -71,7 +71,9 @@ The Node half snapshots each client bundle and available source map before publi
|
|
|
71
71
|
|
|
72
72
|
### Boot manifest injection
|
|
73
73
|
|
|
74
|
-
The
|
|
74
|
+
The bundle route follows the injected `webServer` lifetime: it registers when the service is ready and is removed and re-registered when that service is replaced. Module composition and `fetchBundle()` remain available without a Web server.
|
|
75
|
+
|
|
76
|
+
The host contributes structured index rows that inject, into `<head>`: the `window.__ModuleLoader__` queue facade, advisory preloads for every application combo, the parser-blocking bootstrap combo scripts, then the boot graph before the shell reads it. A Web carrier renders those rows into its index response; a shell-owned carrier can render the same rows without a Web server. The facade's `create()` materializes the modules bundle, delegates construction to its `createClientModuleSystem` export, and leaves the same facade in live-registration mode. The shell installs that returned system as its Loader's `internal`; the modules plugin publishes that instance as `ctx.modules`, so separate Cordis trees never select an instance through module-global state.
|
|
75
77
|
|
|
76
78
|
### Source map
|
|
77
79
|
|
|
@@ -80,7 +82,7 @@ The host contributes structured index rows that inject, into `<head>`: the `wind
|
|
|
80
82
|
| [`src/index.ts`](src/index.ts) | Node half: `ClientModuleRegistry`, scan, artifact snapshots, optional combo route, structured index rows |
|
|
81
83
|
| [`src/client/index.ts`](src/client/index.ts) | Browser half: bootstrap export, `ctx.modules` enrollment |
|
|
82
84
|
| [`src/client/system.ts`](src/client/system.ts) | `ClientModuleSystem`: load/materialize/invalidate machinery |
|
|
83
|
-
| [`src/client/manifest.ts`](src/client/manifest.ts) | Wire types
|
|
85
|
+
| [`src/client/manifest.ts`](src/client/manifest.ts) | Wire types, boot-manifest parsing, and the `dsh.client` declaration parser |
|
|
84
86
|
|
|
85
87
|
</details>
|
|
86
88
|
|
package/README.zh.md
CHANGED
|
@@ -71,7 +71,9 @@ Node 半侧会在发布前快照每个客户端 bundle 及其现有 source map
|
|
|
71
71
|
|
|
72
72
|
### 启动 manifest 注入
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
bundle 路由随注入的 `webServer` 生命周期注册:服务就绪时注册,服务被替换时移除并重新注册。模块组合与 `fetchBundle()` 在没有 Web server 时仍可用。
|
|
75
|
+
|
|
76
|
+
宿主贡献结构化 index 行,并向 `<head>` 注入:`window.__ModuleLoader__` queue facade、每个 application combo 的提示性 preload、阻塞 parser 的 bootstrap combo 脚本,然后才是外壳读取前的启动图。Web 载体把这些行渲染进 index 响应;由 shell 持有的载体则可以在没有 Web server 时渲染同一批行。facade 的 `create()` 物化 modules bundle、把构造委托给其 `createClientModuleSystem` 导出,并让同一 facade 进入 live registration 模式。外壳把返回的系统装成自身 Loader 的 `internal`;modules 插件将该实例发布为 `ctx.modules`,因此不同 Cordis 树不会通过模块级全局状态选择实例。
|
|
75
77
|
|
|
76
78
|
### 源码索引
|
|
77
79
|
|
|
@@ -80,7 +82,7 @@ Node 半侧会在发布前快照每个客户端 bundle 及其现有 source map
|
|
|
80
82
|
| [`src/index.ts`](src/index.ts) | Node 半侧:`ClientModuleRegistry`、扫描、产物快照、可选 combo 路由、结构化 index 行 |
|
|
81
83
|
| [`src/client/index.ts`](src/client/index.ts) | 浏览器半侧:bootstrap 导出、`ctx.modules` 登记 |
|
|
82
84
|
| [`src/client/system.ts`](src/client/system.ts) | `ClientModuleSystem`:加载/物化/失效机制 |
|
|
83
|
-
| [`src/client/manifest.ts`](src/client/manifest.ts) |
|
|
85
|
+
| [`src/client/manifest.ts`](src/client/manifest.ts) | 协议类型、启动清单解析与 `dsh.client` 声明解析器 |
|
|
84
86
|
|
|
85
87
|
</details>
|
|
86
88
|
|
package/lib/client.js
CHANGED
|
@@ -50,6 +50,43 @@ window.__ModuleLoader__.load({
|
|
|
50
50
|
return value;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
+
* Narrow an unknown parsed JSON value to the `dsh.client` declaration. Shared
|
|
54
|
+
* by the node half's Loader scan and the roster generator, so both read a
|
|
55
|
+
* package's browser declaration through one validator.
|
|
56
|
+
* @param pkgName - package name used as the diagnostic prefix.
|
|
57
|
+
* @param value - the raw `dsh.client` field of the package manifest.
|
|
58
|
+
* @returns the validated declaration, or undefined when the field is absent.
|
|
59
|
+
* @throws {Error} when the field is present but any member is malformed.
|
|
60
|
+
*/
|
|
61
|
+
function parseDshClient(pkgName, value) {
|
|
62
|
+
if (value === void 0) return void 0;
|
|
63
|
+
if (typeof value !== "object" || value === null) throw new Error(`client-modules: ${pkgName} has a non-object dsh.client declaration`);
|
|
64
|
+
const decl = value;
|
|
65
|
+
if (typeof decl.platform !== "string") throw new Error(`client-modules: ${pkgName} dsh.client.platform must be a string`);
|
|
66
|
+
const inject = optionalStringArray(pkgName, "dsh.client.inject", decl.inject);
|
|
67
|
+
const external = optionalStringArray(pkgName, "dsh.client.external", decl.external);
|
|
68
|
+
if (decl.immediately !== void 0 && typeof decl.immediately !== "boolean") throw new Error(`client-modules: ${pkgName} dsh.client.immediately must be a boolean`);
|
|
69
|
+
return {
|
|
70
|
+
platform: decl.platform,
|
|
71
|
+
...inject !== void 0 ? { inject } : {},
|
|
72
|
+
...external !== void 0 ? { external } : {},
|
|
73
|
+
...decl.immediately !== void 0 ? { immediately: decl.immediately } : {}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The bare package-root specifier `specifier` names, or undefined for a subpath, a path, or any scheme-qualified
|
|
78
|
+
* specifier (`cordis:` builtins, `node:` modules, URLs).
|
|
79
|
+
* @param specifier - Loader row name.
|
|
80
|
+
* @returns the package name, or undefined.
|
|
81
|
+
*/
|
|
82
|
+
function exactPackageSpecifier(specifier) {
|
|
83
|
+
if (specifier.startsWith("@")) {
|
|
84
|
+
const parts = specifier.split("/");
|
|
85
|
+
return parts.length === 2 && parts.every(Boolean) ? specifier : void 0;
|
|
86
|
+
}
|
|
87
|
+
return specifier.length > 0 && !specifier.includes("/") && !specifier.includes(":") ? specifier : void 0;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
53
90
|
* Normalize a module specifier onto the graph row that owns it: a plugin bundle
|
|
54
91
|
* IS its package's client half, so `<id>/client` (the exports subpath external
|
|
55
92
|
* bundles emit) and the bare package name resolve to the same exports. Both the
|
|
@@ -337,37 +374,41 @@ window.__ModuleLoader__.load({
|
|
|
337
374
|
};
|
|
338
375
|
//#endregion
|
|
339
376
|
//#region lib/types/client/index.js
|
|
340
|
-
let moduleSystem;
|
|
341
377
|
/**
|
|
342
378
|
* Build the live module system from the HTML facade's materialized modules bundle.
|
|
343
379
|
* @param target - Stable registration facade whose pending queue becomes the live sink.
|
|
344
380
|
* @param bootstrapModule - This bundle's id and already-materialized exports.
|
|
345
381
|
* @param options - Raw boot graph, platform seed, and optional bundle transport.
|
|
346
|
-
* @returns The created module system
|
|
382
|
+
* @returns The created module system.
|
|
347
383
|
*/
|
|
348
384
|
function createClientModuleSystem(target, bootstrapModule, options) {
|
|
349
|
-
|
|
385
|
+
return new ClientModuleSystem({
|
|
350
386
|
manifest: parseBootManifest(options.boot),
|
|
351
387
|
staticModules: options.staticModules,
|
|
352
388
|
registrationTarget: target,
|
|
353
389
|
bootstrapModule,
|
|
354
390
|
...options.loadBundle === void 0 ? {} : { loadBundle: options.loadBundle }
|
|
355
391
|
});
|
|
356
|
-
return moduleSystem;
|
|
357
392
|
}
|
|
393
|
+
/** Required service: the Loader whose internal module system this plugin publishes. */
|
|
394
|
+
const inject = ["loader"];
|
|
358
395
|
/**
|
|
359
396
|
* Enroll the kernel-built module system as `ctx.modules`.
|
|
360
397
|
* @param ctx - client root context.
|
|
361
398
|
*/
|
|
362
399
|
function apply(ctx) {
|
|
363
|
-
|
|
364
|
-
|
|
400
|
+
const modules = ctx.loader.internal;
|
|
401
|
+
if (modules?.version !== "client") throw new Error("client-modules: the Loader has no client module system");
|
|
402
|
+
ctx.reflect.provide("modules", modules);
|
|
365
403
|
}
|
|
366
404
|
//#endregion
|
|
367
405
|
exports.ClientModuleSystem = ClientModuleSystem;
|
|
368
406
|
exports.apply = apply;
|
|
369
407
|
exports.createClientModuleSystem = createClientModuleSystem;
|
|
408
|
+
exports.exactPackageSpecifier = exactPackageSpecifier;
|
|
409
|
+
exports.inject = inject;
|
|
370
410
|
exports.parseBootManifest = parseBootManifest;
|
|
411
|
+
exports.parseDshClient = parseDshClient;
|
|
371
412
|
exports.stripClientSuffix = stripClientSuffix;
|
|
372
413
|
return module.exports;
|
|
373
414
|
}
|
package/lib/index.js
CHANGED
|
@@ -50,6 +50,43 @@ function optionalStringArray(subject, field, value) {
|
|
|
50
50
|
return value;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
+
* Narrow an unknown parsed JSON value to the `dsh.client` declaration. Shared
|
|
54
|
+
* by the node half's Loader scan and the roster generator, so both read a
|
|
55
|
+
* package's browser declaration through one validator.
|
|
56
|
+
* @param pkgName - package name used as the diagnostic prefix.
|
|
57
|
+
* @param value - the raw `dsh.client` field of the package manifest.
|
|
58
|
+
* @returns the validated declaration, or undefined when the field is absent.
|
|
59
|
+
* @throws {Error} when the field is present but any member is malformed.
|
|
60
|
+
*/
|
|
61
|
+
function parseDshClient(pkgName, value) {
|
|
62
|
+
if (value === void 0) return void 0;
|
|
63
|
+
if (typeof value !== "object" || value === null) throw new Error(`client-modules: ${pkgName} has a non-object dsh.client declaration`);
|
|
64
|
+
const decl = value;
|
|
65
|
+
if (typeof decl.platform !== "string") throw new Error(`client-modules: ${pkgName} dsh.client.platform must be a string`);
|
|
66
|
+
const inject = optionalStringArray(pkgName, "dsh.client.inject", decl.inject);
|
|
67
|
+
const external = optionalStringArray(pkgName, "dsh.client.external", decl.external);
|
|
68
|
+
if (decl.immediately !== void 0 && typeof decl.immediately !== "boolean") throw new Error(`client-modules: ${pkgName} dsh.client.immediately must be a boolean`);
|
|
69
|
+
return {
|
|
70
|
+
platform: decl.platform,
|
|
71
|
+
...inject !== void 0 ? { inject } : {},
|
|
72
|
+
...external !== void 0 ? { external } : {},
|
|
73
|
+
...decl.immediately !== void 0 ? { immediately: decl.immediately } : {}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The bare package-root specifier `specifier` names, or undefined for a subpath, a path, or any scheme-qualified
|
|
78
|
+
* specifier (`cordis:` builtins, `node:` modules, URLs).
|
|
79
|
+
* @param specifier - Loader row name.
|
|
80
|
+
* @returns the package name, or undefined.
|
|
81
|
+
*/
|
|
82
|
+
function exactPackageSpecifier(specifier) {
|
|
83
|
+
if (specifier.startsWith("@")) {
|
|
84
|
+
const parts = specifier.split("/");
|
|
85
|
+
return parts.length === 2 && parts.every(Boolean) ? specifier : void 0;
|
|
86
|
+
}
|
|
87
|
+
return specifier.length > 0 && !specifier.includes("/") && !specifier.includes(":") ? specifier : void 0;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
53
90
|
* Normalize a module specifier onto the graph row that owns it: a plugin bundle
|
|
54
91
|
* IS its package's client half, so `<id>/client` (the exports subpath external
|
|
55
92
|
* bundles emit) and the bare package name resolve to the same exports. Both the
|
|
@@ -71,7 +108,7 @@ function stripClientSuffix(spec) {
|
|
|
71
108
|
* combo scripts plus their source maps,
|
|
72
109
|
* contributes the registration facade, application preloads, bootstrap scripts,
|
|
73
110
|
* and graph to the webserver's index injection table, and provides the
|
|
74
|
-
* `
|
|
111
|
+
* `clientModules` service (the HMR node half's registration/notification
|
|
75
112
|
* face).
|
|
76
113
|
*
|
|
77
114
|
* Scanning is incremental per package — there is no full-rescan code path.
|
|
@@ -87,6 +124,22 @@ function stripClientSuffix(spec) {
|
|
|
87
124
|
* {@link ClientModuleRegistry.rebuilt}.
|
|
88
125
|
* @module @deepseek-ai/dsh-client-modules
|
|
89
126
|
*/
|
|
127
|
+
/**
|
|
128
|
+
* A scoped republish keeps the unscoped name and changes only the scope
|
|
129
|
+
* (`@deepseek-ai/dsh-client-modules` vs `@crazx/dsh-client-modules`). The
|
|
130
|
+
* graph row id stays the Loader specifier; this match only locates the
|
|
131
|
+
* owning manifest.
|
|
132
|
+
*/
|
|
133
|
+
function manifestOwnsLoaderPackage(manifestName, expectedPackageName) {
|
|
134
|
+
if (manifestName === expectedPackageName) return true;
|
|
135
|
+
if (!manifestName.startsWith("@") || !expectedPackageName.startsWith("@")) return false;
|
|
136
|
+
const manifestSlash = manifestName.indexOf("/");
|
|
137
|
+
const expectedSlash = expectedPackageName.indexOf("/");
|
|
138
|
+
if (manifestSlash === -1 || expectedSlash === -1) return false;
|
|
139
|
+
const manifestSuffix = manifestName.slice(manifestSlash + 1);
|
|
140
|
+
const expectedSuffix = expectedPackageName.slice(expectedSlash + 1);
|
|
141
|
+
return expectedSuffix.length > 0 && manifestSuffix === expectedSuffix;
|
|
142
|
+
}
|
|
90
143
|
/** Recovery instruction shared by grouped startup and steady-state bundle diagnostics. */
|
|
91
144
|
const CLIENT_BUNDLE_BUILD_INSTRUCTION = "run `pnpm run build` before launch";
|
|
92
145
|
/** Missing built client export, retained as structured data for activation-error grouping. */
|
|
@@ -128,46 +181,6 @@ const COMBO_REVISION_PLACEHOLDER = "0".repeat(HASH_REVISION_LENGTH);
|
|
|
128
181
|
const SOURCE_MAP_TRAILER = /(?:\r?\n)?\/\/# sourceMappingURL=[^\r\n]*(?:\r?\n)?$/;
|
|
129
182
|
/** Debugger source name appended to page bundles in the WebWorker image. */
|
|
130
183
|
const SOURCE_URL_TRAILER = /(?:\r?\n)?\/\/# sourceURL=([^\r\n]+)(?:\r?\n)?$/;
|
|
131
|
-
/** Return a bare package-root specifier, excluding package subpaths and path-like entries. */
|
|
132
|
-
function exactPackageSpecifier(specifier) {
|
|
133
|
-
if (specifier.startsWith("@")) {
|
|
134
|
-
const parts = specifier.split("/");
|
|
135
|
-
return parts.length === 2 && parts.every(Boolean) ? specifier : void 0;
|
|
136
|
-
}
|
|
137
|
-
return specifier.length > 0 && !specifier.includes("/") ? specifier : void 0;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* A scoped republish keeps the unscoped name and changes only the scope
|
|
141
|
-
* (`@deepseek-ai/dsh-client-modules` vs `@crazx/dsh-client-modules`). The
|
|
142
|
-
* graph row id stays the Loader specifier; this match only locates the
|
|
143
|
-
* owning manifest.
|
|
144
|
-
*/
|
|
145
|
-
function manifestOwnsLoaderPackage(manifestName, expectedPackageName) {
|
|
146
|
-
if (manifestName === expectedPackageName) return true;
|
|
147
|
-
if (!manifestName.startsWith("@") || !expectedPackageName.startsWith("@")) return false;
|
|
148
|
-
const manifestSlash = manifestName.indexOf("/");
|
|
149
|
-
const expectedSlash = expectedPackageName.indexOf("/");
|
|
150
|
-
if (manifestSlash === -1 || expectedSlash === -1) return false;
|
|
151
|
-
const manifestSuffix = manifestName.slice(manifestSlash + 1);
|
|
152
|
-
const expectedSuffix = expectedPackageName.slice(expectedSlash + 1);
|
|
153
|
-
return expectedSuffix.length > 0 && manifestSuffix === expectedSuffix;
|
|
154
|
-
}
|
|
155
|
-
/** Narrow an unknown parsed JSON value to the `dsh.client` declaration, throwing on malformed fields. */
|
|
156
|
-
function parseDshClient(pkgName, value) {
|
|
157
|
-
if (value === void 0) return void 0;
|
|
158
|
-
if (typeof value !== "object" || value === null) throw new Error(`client-modules: ${pkgName} has a non-object dsh.client declaration`);
|
|
159
|
-
const decl = value;
|
|
160
|
-
if (typeof decl.platform !== "string") throw new Error(`client-modules: ${pkgName} dsh.client.platform must be a string`);
|
|
161
|
-
const inject = optionalStringArray(pkgName, "dsh.client.inject", decl.inject);
|
|
162
|
-
const external = optionalStringArray(pkgName, "dsh.client.external", decl.external);
|
|
163
|
-
if (decl.immediately !== void 0 && typeof decl.immediately !== "boolean") throw new Error(`client-modules: ${pkgName} dsh.client.immediately must be a boolean`);
|
|
164
|
-
return {
|
|
165
|
-
platform: decl.platform,
|
|
166
|
-
...inject !== void 0 ? { inject } : {},
|
|
167
|
-
...external !== void 0 ? { external } : {},
|
|
168
|
-
...decl.immediately !== void 0 ? { immediately: decl.immediately } : {}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
184
|
/** Resolve `exports["./client"]` to a relative path, accepting the string and one-level conditional forms. */
|
|
172
185
|
function clientExportOf(pkgName, exportsField) {
|
|
173
186
|
if (typeof exportsField !== "object" || exportsField === null) return void 0;
|
|
@@ -471,6 +484,7 @@ var ClientModuleRegistry = class extends Service {
|
|
|
471
484
|
composed;
|
|
472
485
|
/**
|
|
473
486
|
* Build the service: subscribe, seed, and run the activation flush.
|
|
487
|
+
* Bundle routes follow the optional Web carrier's injected lifecycle.
|
|
474
488
|
* @param ctx - plugin context carrying Loader and an optional Web carrier.
|
|
475
489
|
*/
|
|
476
490
|
constructor(ctx) {
|
|
@@ -500,8 +514,7 @@ var ClientModuleRegistry = class extends Service {
|
|
|
500
514
|
handler: this.serveBundle
|
|
501
515
|
}), "client-modules: bundle route");
|
|
502
516
|
};
|
|
503
|
-
|
|
504
|
-
else registerWebCarrier(ctx);
|
|
517
|
+
ctx.inject(["webServer"], registerWebCarrier);
|
|
505
518
|
ctx.on("webserver/index-inject", (table) => {
|
|
506
519
|
table.push(...bootInjections(this.composed));
|
|
507
520
|
});
|
|
@@ -6,24 +6,26 @@
|
|
|
6
6
|
* parser-preloads this ordinary client bundle into the pending registration
|
|
7
7
|
* queue. The HTML-installed loader facade materializes this bundle and calls
|
|
8
8
|
* its bootstrap export, which constructs the system and retains the same
|
|
9
|
-
* exports for this package's graph row. The plugin face
|
|
10
|
-
*
|
|
9
|
+
* exports for this package's graph row. The plugin face enrolls the module
|
|
10
|
+
* system attached to its own Loader as `ctx.modules`.
|
|
11
11
|
* @module @deepseek-ai/dsh-client-modules/client
|
|
12
12
|
*/
|
|
13
13
|
import type { Context } from '@deepseek-ai/cordis';
|
|
14
14
|
import { ClientModuleSystem } from './system.ts';
|
|
15
15
|
import type { ClientBootstrapModule, ClientModuleCreateOptions, ClientModuleLoaderTarget } from './manifest.ts';
|
|
16
16
|
export { ClientModuleSystem };
|
|
17
|
-
export { parseBootManifest, stripClientSuffix } from './manifest.ts';
|
|
17
|
+
export { exactPackageSpecifier, parseBootManifest, parseDshClient, stripClientSuffix } from './manifest.ts';
|
|
18
18
|
export type { BootManifest, BootModuleRow, BootPluginRow, ClientBootstrapModule, ClientBundleRegistration, ClientModuleCreateOptions, ClientModuleLoader, ClientModuleLoaderTarget, ClientModuleRecord, ClientModuleSystemOptions, DshWindow, WebBootEntry, WebBootGraph, } from './manifest.ts';
|
|
19
19
|
/**
|
|
20
20
|
* Build the live module system from the HTML facade's materialized modules bundle.
|
|
21
21
|
* @param target - Stable registration facade whose pending queue becomes the live sink.
|
|
22
22
|
* @param bootstrapModule - This bundle's id and already-materialized exports.
|
|
23
23
|
* @param options - Raw boot graph, platform seed, and optional bundle transport.
|
|
24
|
-
* @returns The created module system
|
|
24
|
+
* @returns The created module system.
|
|
25
25
|
*/
|
|
26
26
|
export declare function createClientModuleSystem(target: ClientModuleLoaderTarget, bootstrapModule: ClientBootstrapModule, options: ClientModuleCreateOptions): ClientModuleSystem;
|
|
27
|
+
/** Required service: the Loader whose internal module system this plugin publishes. */
|
|
28
|
+
export declare const inject: string[];
|
|
27
29
|
/**
|
|
28
30
|
* Enroll the kernel-built module system as `ctx.modules`.
|
|
29
31
|
* @param ctx - client root context.
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* {@link ClientModuleSystem}. The package root is the host-side service that
|
|
29
29
|
* composes the wire.
|
|
30
30
|
*/
|
|
31
|
+
import type { DshClientManifest } from '@deepseek-ai/dsh-package-manifest';
|
|
31
32
|
import type { ClientModuleSystem } from './system.ts';
|
|
32
33
|
declare module '@deepseek-ai/cordis' {
|
|
33
34
|
interface Context {
|
|
@@ -126,6 +127,23 @@ export interface BootManifest {
|
|
|
126
127
|
* @throws {Error} when the value is present but is not an array of strings.
|
|
127
128
|
*/
|
|
128
129
|
export declare function optionalStringArray(subject: string, field: string, value: unknown): string[] | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Narrow an unknown parsed JSON value to the `dsh.client` declaration. Shared
|
|
132
|
+
* by the node half's Loader scan and the roster generator, so both read a
|
|
133
|
+
* package's browser declaration through one validator.
|
|
134
|
+
* @param pkgName - package name used as the diagnostic prefix.
|
|
135
|
+
* @param value - the raw `dsh.client` field of the package manifest.
|
|
136
|
+
* @returns the validated declaration, or undefined when the field is absent.
|
|
137
|
+
* @throws {Error} when the field is present but any member is malformed.
|
|
138
|
+
*/
|
|
139
|
+
export declare function parseDshClient(pkgName: string, value: unknown): DshClientManifest | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* The bare package-root specifier `specifier` names, or undefined for a subpath, a path, or any scheme-qualified
|
|
142
|
+
* specifier (`cordis:` builtins, `node:` modules, URLs).
|
|
143
|
+
* @param specifier - Loader row name.
|
|
144
|
+
* @returns the package name, or undefined.
|
|
145
|
+
*/
|
|
146
|
+
export declare function exactPackageSpecifier(specifier: string): string | undefined;
|
|
129
147
|
/**
|
|
130
148
|
* Normalize a module specifier onto the graph row that owns it: a plugin bundle
|
|
131
149
|
* IS its package's client half, so `<id>/client` (the exports subpath external
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* combo scripts plus their source maps,
|
|
7
7
|
* contributes the registration facade, application preloads, bootstrap scripts,
|
|
8
8
|
* and graph to the webserver's index injection table, and provides the
|
|
9
|
-
* `
|
|
9
|
+
* `clientModules` service (the HMR node half's registration/notification
|
|
10
10
|
* face).
|
|
11
11
|
*
|
|
12
12
|
* Scanning is incremental per package — there is no full-rescan code path.
|
|
@@ -91,6 +91,7 @@ export declare class ClientModuleRegistry extends Service {
|
|
|
91
91
|
private composed;
|
|
92
92
|
/**
|
|
93
93
|
* Build the service: subscribe, seed, and run the activation flush.
|
|
94
|
+
* Bundle routes follow the optional Web carrier's injected lifecycle.
|
|
94
95
|
* @param ctx - plugin context carrying Loader and an optional Web carrier.
|
|
95
96
|
*/
|
|
96
97
|
constructor(ctx: Context);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crazx/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.1.
|
|
4
|
+
"version": "0.1.6-alpha.1.zw.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
42
|
-
"@deepseek-ai/dsh-host-webserver": "^0.1.
|
|
43
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
42
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.6-alpha.1",
|
|
43
|
+
"@deepseek-ai/dsh-invariants": "^0.1.6-alpha.1",
|
|
44
44
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
45
|
-
"@deepseek-ai/dsh-package-manifest": "^0.1.
|
|
45
|
+
"@deepseek-ai/dsh-package-manifest": "^0.1.6-alpha.1"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"lib/index.js",
|