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

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
@@ -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: a1d578850c2518a85dc32f048768b78caf5ffec4
5
+ README.md: efaff699839b977cc45f89f3c164402241b90dc2
6
6
  README.zh.md: 772a4870f7ef6730d9d3d4db434ed771d97984f0
package/README.md CHANGED
@@ -4,7 +4,7 @@ English | [中文](README.zh.md)
4
4
 
5
5
  Client module system: the browser peer of Node's internal ESM loader, built as a lazy CJS table. The web shell mounts the vendored cordis Loader for entry governance (fiber lifecycle, inject waiting, update/refresh) and injects this package's `ClientModuleLoader` through its `internal` contract — the vendored side's only consumption point is `EntryTree.import`, so replacing `internal` replaces exactly "how plugin code arrives" and nothing else.
6
6
 
7
- Lazy CJS model (web2): executing a plugin bundle only REGISTERS its factory (`window.__ModuleLoader__.load({id, factory})`); every module body side effect — CSS injection included — lives in the factory closure and runs at materialization (`factory(require)` → export surface, memoized in `loadCache`), not at script execution. A factory that requires another registered-but-unmaterialized module materializes it recursively, so load order needs no external sequencing; require cycles throw (factory-form CJS cannot deliver partial exports). `<id>/client` and the bare id name the same surface (a plugin bundle IS its package's client half).
7
+ Lazy CJS model (web2): executing a plugin bundle only REGISTERS its factory (`window.__ModuleLoader__.load({id, factory})`); every module body side effect — CSS injection included — lives in the factory closure and runs at materialization (`factory(require)` → exports, memoized in `loadCache`), not at script execution. A factory that requires another registered-but-unmaterialized module materializes it recursively, so load order needs no external sequencing; require cycles throw (factory-form CJS cannot deliver partial exports). `<id>/client` and the bare id resolve to the same exports (a plugin bundle IS its package's client half).
8
8
 
9
9
  Resolution branch order (`import(specifier)`): platform seed word → shell instance; memoized record → surface; shell-own static registry (`registerStatic`, app-shell) → module; registered factory → materialize; graph row (`window.__DSH_BOOT__`) → load its external classic script + materialize; anything else throws — the runtime mirror of the build-time bundle purity gate. The synchronous `require` handed to factories walks the same order minus the asynchronous load branch and records observed edges into the module record. `prefetch` is the stage-one arrival hook (script load and factory registration only; concurrent calls share one in-flight task); `invalidate` drops the factory and materialized record so the next prefetch/import reloads the script (the HMR hook).
10
10
 
package/lib/client.js CHANGED
@@ -23,7 +23,7 @@ window.__ModuleLoader__.load({
23
23
  /**
24
24
  * A plugin bundle IS its package's client half: `<id>/client` (the exports
25
25
  * subpath external bundles emit) and the bare graph id name the same
26
- * surface, so table lookups normalize the suffix away.
26
+ * exports, so table lookups normalize the suffix away.
27
27
  */
28
28
  const stripClientSuffix = (spec) => spec.endsWith("/client") ? spec.slice(0, -7) : spec;
29
29
  /**
@@ -101,7 +101,7 @@ window.__ModuleLoader__.load({
101
101
  const edges = /* @__PURE__ */ new Set();
102
102
  const record = {
103
103
  id,
104
- surface: registered(this.makeRequire(edges)),
104
+ exports: registered(this.makeRequire(edges)),
105
105
  styles: claimStyles(id),
106
106
  edges
107
107
  };
@@ -125,31 +125,31 @@ window.__ModuleLoader__.load({
125
125
  if (this.statics.has(spec)) return this.statics.get(spec);
126
126
  const id = stripClientSuffix(spec);
127
127
  const record = this.loadCache.get(id);
128
- if (record !== void 0) return record.surface;
129
- if (this.factories.has(id)) return this.materialize(id).surface;
128
+ if (record !== void 0) return record.exports;
129
+ if (this.factories.has(id)) return this.materialize(id).exports;
130
130
  throw new Error(`client-modules: require("${spec}") missed the module table — not a platform seed word, not a shell-own module, and no registered factory (a build-time externals drift, or a forbidden cross-plugin value import)`);
131
131
  };
132
132
  }
133
133
  async import(specifier) {
134
134
  if (this.seed.has(specifier)) return this.seed.get(specifier);
135
135
  const existing = this.loadCache.get(specifier);
136
- if (existing !== void 0) return existing.surface;
136
+ if (existing !== void 0) return existing.exports;
137
137
  if (this.statics.has(specifier)) {
138
- const surface = this.statics.get(specifier);
138
+ const exports = this.statics.get(specifier);
139
139
  this.loadCache.set(specifier, {
140
140
  id: specifier,
141
- surface,
141
+ exports,
142
142
  styles: [],
143
143
  edges: /* @__PURE__ */ new Set()
144
144
  });
145
- return surface;
145
+ return exports;
146
146
  }
147
147
  if (!this.factories.has(specifier)) {
148
148
  const row = this.graphRows.get(specifier);
149
149
  if (row === void 0) throw new Error(`client-modules: cannot resolve "${specifier}" — not a seed word, not a shell-own module, and not a row in the boot graph (the runtime mirror of the bundle purity gate)`);
150
150
  await this.arrive(row);
151
151
  }
152
- return this.materialize(specifier).surface;
152
+ return this.materialize(specifier).exports;
153
153
  }
154
154
  registerStatic(id, module) {
155
155
  if (this.statics.has(id)) throw new Error(`client-modules: shell-own module "${id}" registered twice`);
@@ -180,13 +180,13 @@ window.__ModuleLoader__.load({
180
180
  * factory (`window.__ModuleLoader__.load({id, factory})`); every module body
181
181
  * side effect — including CSS injection — lives inside the factory closure
182
182
  * and runs at materialization, not at script execution. Materialization
183
- * (factory(require) → export surface) happens on first import/require and is
183
+ * (factory(require) → exports) happens on first import/require and is
184
184
  * memoized in {@link ClientModuleLoader.loadCache}; a factory that requires
185
185
  * another registered-but-unmaterialized module materializes it recursively,
186
186
  * so load order needs no external sequencing.
187
187
  *
188
188
  * Resolution branch order (import): seed word → shell instance; memoized
189
- * record → surface; static registry (shell-own modules, e.g. app-shell) →
189
+ * record → exports; static registry (shell-own modules, e.g. app-shell) →
190
190
  * module; registered factory → materialize; graph row → load + materialize;
191
191
  * anything else → throw (loud — the runtime mirror of the
192
192
  * build-time bundle purity gate). The synchronous `require` handed to
@@ -10,13 +10,13 @@
10
10
  * factory (`window.__ModuleLoader__.load({id, factory})`); every module body
11
11
  * side effect — including CSS injection — lives inside the factory closure
12
12
  * and runs at materialization, not at script execution. Materialization
13
- * (factory(require) → export surface) happens on first import/require and is
13
+ * (factory(require) → exports) happens on first import/require and is
14
14
  * memoized in {@link ClientModuleLoader.loadCache}; a factory that requires
15
15
  * another registered-but-unmaterialized module materializes it recursively,
16
16
  * so load order needs no external sequencing.
17
17
  *
18
18
  * Resolution branch order (import): seed word → shell instance; memoized
19
- * record → surface; static registry (shell-own modules, e.g. app-shell) →
19
+ * record → exports; static registry (shell-own modules, e.g. app-shell) →
20
20
  * module; registered factory → materialize; graph row → load + materialize;
21
21
  * anything else → throw (loud — the runtime mirror of the
22
22
  * build-time bundle purity gate). The synchronous `require` handed to
@@ -103,12 +103,12 @@ export interface ClientPluginHandoff {
103
103
  id: string;
104
104
  /**
105
105
  * Closure factory holding the whole bundle body: receives the synchronous
106
- * require bound to the module table and returns the bundle's export
107
- * surface. Runs once, at materialization.
106
+ * require bound to the module table and returns the bundle's exports. Runs
107
+ * once, at materialization.
108
108
  */
109
109
  factory: (require: (spec: string) => unknown) => Record<string, unknown>;
110
110
  }
111
- /** Window surface of the web boot protocol: the host-injected graph, the registration sink, and the kernel handoff slot. */
111
+ /** Window API of the web boot protocol: the host-injected graph, registration sink, and kernel handoff slot. */
112
112
  export interface DshWindow {
113
113
  /** Host-composed entry graph, injected before the shell bundle runs; wire-boundary raw until {@link parseBootManifest}. */
114
114
  __DSH_BOOT__?: unknown;
@@ -128,8 +128,8 @@ export interface DshWindow {
128
128
  export interface ClientModuleRecord {
129
129
  /** Module id (entry name / package name). */
130
130
  id: string;
131
- /** The materialized export surface (factory `module.exports`, or the shell module for static registrations). */
132
- surface: unknown;
131
+ /** Materialized exports (`module.exports` from a factory, or a statically registered shell module). */
132
+ exports: unknown;
133
133
  /** Owned `<style data-plugin>` tag ids (`data-plugin-css` values) injected during materialization. */
134
134
  styles: string[];
135
135
  /** Observed `require()` edges (module-graph boundary; only table words can appear today). */
@@ -143,7 +143,7 @@ export interface ClientModuleRecord {
143
143
  export interface ClientModuleLoader {
144
144
  /** Discriminant against Node's internal loader shapes ('v1'/'v2'). */
145
145
  version: 'client';
146
- /** Materialized-module registry: id → record. The governance-side read face for entry export surfaces. */
146
+ /** Materialized-module registry: id → record. The governance-side read API for entry exports. */
147
147
  loadCache: Map<string, ClientModuleRecord>;
148
148
  /**
149
149
  * Internal contract consumed by the vendored Loader's `tree.import`. Resolves
@@ -152,7 +152,7 @@ export interface ClientModuleLoader {
152
152
  * @param specifier - module specifier (entry name or table word).
153
153
  * @param parentURL - importer URL (unused — the client module graph is flat).
154
154
  * @param attrs - Import attributes (unused; interface parity with Node's loader contract).
155
- * @returns the module's export surface.
155
+ * @returns the module's exports.
156
156
  */
157
157
  import(specifier: string, parentURL: string, attrs: Record<string, unknown>): Promise<unknown>;
158
158
  /**
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.1",
4
+ "version": "0.0.1-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -39,9 +39,9 @@
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-invariants": "^0.0.1-rc.1",
43
- "@deepseek-ai/cordis": "^4.0.1-rc.1",
44
- "@deepseek-ai/dsh-host-webserver": "^0.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",
44
+ "@deepseek-ai/cordis": "^4.0.1-rc.1"
45
45
  },
46
46
  "files": [
47
47
  "lib/index.js",
@@ -50,7 +50,7 @@
50
50
  "lib/types/**/*.d.ts"
51
51
  ],
52
52
  "peerDependencies": {
53
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
53
+ "@deepseek-ai/dsh-invariants": "^0.0.1-rc.2",
54
54
  "@deepseek-ai/cordis": "^4.0.1-rc.1"
55
55
  },
56
56
  "scripts": {