@dsh-plugin/dsh-loader 1.3.3-dev.33218986978 → 1.3.3-dev.33722395196

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.
@@ -6,9 +6,16 @@ export declare const hostPackageAliases: Record<string, string>;
6
6
  export declare const clientModuleAliases: Record<string, string>;
7
7
  export declare const clientPackageAliases: Record<string, string>;
8
8
  /**
9
- * Install a Module._resolveFilename hook that maps old package names to
10
- * new ones for CJS require() calls. Returns a dispose function that
11
- * removes the hook.
9
+ * Ensure the single Module._resolveFilename hook exists and merge `aliases`
10
+ * into its shared map. Never adds a wrapper: repeat calls (runtime
11
+ * `registerPackageAlias`, HMR re-apply) only mutate the map. When the chain
12
+ * top was replaced without chaining into us (the mapping silently stops
13
+ * applying), the hook is re-pointed at the current top — still the same
14
+ * single wrapper, no growth.
15
+ *
16
+ * Returns a dispose function that rolls back exactly the entries this call
17
+ * set (when unchanged since) and restores the original resolver once the
18
+ * last registrant disposes.
12
19
  */
13
20
  export declare function installHostPackageAliases(aliases: Record<string, string>): Promise<() => void>;
14
21
  /**
@@ -6,6 +6,9 @@ export declare const REMOTE_SERVICE = "remote";
6
6
  export interface ConnectionApiCompatContext {
7
7
  get?(name: string): unknown;
8
8
  inject?(inject: string[], callback: (ctx: ConnectionApiCompatContext) => unknown): unknown;
9
+ /** cordis effect hook: when present, the bridge assignment and the
10
+ * fallback timer are torn down with the fiber (HMR-safe). */
11
+ effect?(fn: () => (() => void) | void): unknown;
9
12
  }
10
13
  /** Bare RpcResult the 0.1.2 Typert remote resolves to. */
11
14
  export interface RpcResultOk<T> {
@@ -53,5 +53,9 @@ interface ClientContextLike {
53
53
  * facade, then publishes it both as the `dshLoaderUi` cordis service
54
54
  * (ordered access) and on `window.__dshLoader__.ui` (ad-hoc access from
55
55
  * non-cordis code).
56
+ *
57
+ * Every patch installClient makes (the load wrapper, the settings fetch
58
+ * interceptor) is registered through `ctx.effect`, so fiber unload / HMR
59
+ * reverts them instead of stacking wrappers on the shared window.
56
60
  */
57
61
  export declare function apply(ctx: ClientContextLike): void;
@@ -124,6 +124,13 @@ interface InstallClientOpts {
124
124
  clientCtx?: {
125
125
  get?: (name: string) => any;
126
126
  };
127
+ /**
128
+ * cordis effect hook (`ctx.effect`): the load wrapper and fetch
129
+ * interceptor register their disposers through it so fiber unload / HMR
130
+ * tears the patches down instead of leaking them. Absent in bare test
131
+ * environments, where patches simply live for the process.
132
+ */
133
+ effect?: (fn: () => (() => void) | void) => unknown;
127
134
  }
128
135
  /**
129
136
  * Install dshloader into a browser-like environment.
@@ -183,5 +190,6 @@ export declare function apply(ctx: {
183
190
  loader?: {
184
191
  internal?: DshModulesLike;
185
192
  };
193
+ effect?: (fn: () => (() => void) | void) => unknown;
186
194
  }): void;
187
195
  export {};
@@ -90,16 +90,19 @@ export interface SettingsAPI {
90
90
  */
91
91
  namespace(id: string): any;
92
92
  /**
93
- * Install the canonical optional-settings consumer wiring (delegates to dsh's
94
- * `installSettingsSection`): register `ns` with `entry` as the `base` layer,
95
- * point the hooks' source thunk at the resolved scope while a settings service
96
- * exists, and fall back to `entry` when it goes away.
93
+ * Install the canonical optional-settings consumer wiring: register `ns`
94
+ * with `entry` as the `base` layer, point the hooks' source thunk at the
95
+ * resolved scope while a settings service exists, and fall back to `entry`
96
+ * when it goes away.
97
97
  *
98
- * Delegated rather than reimplemented the fallback and fiber semantics are
99
- * real upstream behaviour, not something a shim should copy.
98
+ * Delegates to dsh's `installSettingsSection` when the module exports it
99
+ * (dsh 0.1.2-alpha.1); on dsh 0.1.2-alpha.2 (which dropped the export
100
+ * but kept the settings service register() contract identical) the facade
101
+ * runs a faithful port of the same upstream semantics instead.
100
102
  *
101
- * @returns `true` when the wiring was installed, `false` when dsh-settings is
102
- * unavailable (the caller then keeps using its composition entry).
103
+ * @returns `true` when the wiring was installed, `false` when the caller's
104
+ * context cannot inject the settings service (the caller then keeps using
105
+ * its composition entry).
103
106
  */
104
107
  installSection<T>(ctx: any, ns: any, schema: any, entry: T, hooks: {
105
108
  setSource(current: () => T): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plugin/dsh-loader",
3
- "version": "1.3.3-dev.33218986978",
3
+ "version": "1.3.3-dev.33722395196",
4
4
  "description": "Runtime compatibility shim for dsh (DeepSeek Harness) cordis bundle plugins: decouples third-party plugins from real dsh internal service names, module paths, and RPC details via a version-aware adapter registry.",
5
5
  "type": "module",
6
6
  "repository": {