@deepseek-ai/cordis-plugin-loader 1.0.5 → 1.0.6-alpha.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.md CHANGED
@@ -41,6 +41,7 @@ root.loader.update(id, { config: { enabled: false } })
41
41
  | `loader.update(id, options, parent?, position?)` | Update, move, and restart an entry. |
42
42
  | `loader.remove(id)` | Stop and delete an entry. |
43
43
  | `loader.resolve(id)` | Resolve an entry by id, including nested `a:b` ids. |
44
+ | `loader.resolve(id).moduleNamespace` | Raw import result before export normalization; HMR updates it after a successful reload. |
44
45
  | `loader.resolveGroup(id)` | Resolve the root group or a nested group. |
45
46
  | `loader.await()` | Wait for pending entry imports and fiber reloads. |
46
47
  | `loader.locate(fiber?)` | Return the loader entry id that owns a fiber. |
package/lib/index.js CHANGED
@@ -312,6 +312,8 @@ var Entry = class Entry {
312
312
  static key = Symbol.for("cordis.entry");
313
313
  ctx;
314
314
  fiber;
315
+ /** Raw import result before export normalization; HMR updates it after a successful reload. */
316
+ moduleNamespace;
315
317
  parent;
316
318
  options = {};
317
319
  subgroup;
@@ -446,19 +448,20 @@ var Entry = class Entry {
446
448
  this.fiber?.await().then(notify, notify);
447
449
  }
448
450
  async _init() {
449
- let exports;
451
+ let moduleNamespace;
450
452
  try {
451
- exports = await this.parent.tree.import(this.options.name, this.getOuterStack);
453
+ moduleNamespace = await this.parent.tree.import(this.options.name, this.getOuterStack);
452
454
  } catch (error) {
453
455
  this.ctx.logger.error(error);
454
456
  return;
455
457
  } finally {
456
458
  this._initTask = void 0;
457
459
  }
458
- const plugin = this.loader.unwrapExports(exports);
460
+ const plugin = this.loader.unwrapExports(moduleNamespace);
459
461
  this._patchContext([]);
460
462
  this.loader.showLog(this, "apply");
461
463
  this.fiber = this.ctx.registry.plugin(plugin, this.options.config, this.getOuterStack).ctx.fiber;
464
+ this.moduleNamespace = moduleNamespace;
462
465
  }
463
466
  };
464
467
  //#endregion
@@ -23,6 +23,8 @@ export declare class Entry {
23
23
  static readonly key: unique symbol;
24
24
  ctx: Context;
25
25
  fiber?: Fiber;
26
+ /** Raw import result before export normalization; HMR updates it after a successful reload. */
27
+ moduleNamespace: unknown;
26
28
  parent: EntryGroup;
27
29
  options: EntryOptions;
28
30
  subgroup?: EntryGroup;
@@ -1 +1 @@
1
- {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../../src/config/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAc,MAAM,EAAiB,MAAM,qBAAqB,CAAA;AAEvF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAIrC,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,mCAAmC;IACnC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACzB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAmBD,wDAAwD;AACxD,qBAAa,KAAK;IAaG,MAAM,EAAE,MAAM;IAZjC,MAAM,CAAC,QAAQ,CAAC,GAAG,gBAA6B;IAEzC,GAAG,EAAE,OAAO,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,EAAG,UAAU,CAAA;IAEnB,OAAO,EAAS,YAAY,CAAA;IAC5B,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,OAAO,CAAC,EAAE,SAAS,CAAA;IAE1B,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CA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6B;IAEzC,GAAG,EAAE,OAAO,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAA;IACpB,+FAA+F;IACxF,eAAe,EAAE,OAAO,CAAA;IACxB,MAAM,EAAG,UAAU,CAAA;IAEnB,OAAO,EAAS,YAAY,CAAA;IAC5B,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,OAAO,CAAC,EAAE,SAAS,CAAA;IAE1B,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;gBAEN,MAAM,EAAE,MAAM;IAKjC,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,EAAE,WAML;IAED,mEAAmE;IACnE,IAAI,QAAQ,YASX;IAED;;;OAGG;IACH,OAAO,CAAC,UAAU;IAMlB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAIrB,OAAO,CAAC,aAAa;IAUf,OAAO;IAMb,iFAAiF;IAC3E,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,UAAQ,EAAE,KAAK,UAAQ;IAyC1E;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAmCvB,aAAa,iBAQZ;IAED,2EAA2E;IACrE,IAAI;YAaI,KAAK;CAgBpB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/cordis-plugin-loader",
3
3
  "description": "Plugin loader for cordis",
4
- "version": "1.0.5",
4
+ "version": "1.0.6-alpha.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,7 +31,7 @@
31
31
  "license": "MIT",
32
32
  "peerDependencies": {
33
33
  "node-addon-require-builtin": "^0.1.6",
34
- "@deepseek-ai/cordis": "~4.0.4"
34
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "node-addon-require-builtin": {
@@ -39,7 +39,7 @@
39
39
  }
40
40
  },
41
41
  "dependencies": {
42
- "@deepseek-ai/cosmokit": "~1.8.5",
43
- "@deepseek-ai/schemastery": "~3.18.4"
42
+ "@deepseek-ai/cosmokit": "~1.8.6-alpha.1",
43
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
44
44
  }
45
45
  }
@@ -45,6 +45,8 @@ export class Entry {
45
45
 
46
46
  public ctx: Context
47
47
  public fiber?: Fiber
48
+ /** Raw import result before export normalization; HMR updates it after a successful reload. */
49
+ public moduleNamespace: unknown
48
50
  public parent!: EntryGroup
49
51
  // safety: call `entry.update()` immediately after creating an entry
50
52
  public options = {} as EntryOptions
@@ -219,18 +221,19 @@ export class Entry {
219
221
  }
220
222
 
221
223
  private async _init() {
222
- let exports: any
224
+ let moduleNamespace: unknown
223
225
  try {
224
- exports = await this.parent.tree.import(this.options.name, this.getOuterStack)
226
+ moduleNamespace = await this.parent.tree.import(this.options.name, this.getOuterStack)
225
227
  } catch (error) {
226
228
  this.ctx.logger.error(error)
227
229
  return
228
230
  } finally {
229
231
  this._initTask = undefined
230
232
  }
231
- const plugin = this.loader.unwrapExports(exports)
233
+ const plugin = this.loader.unwrapExports(moduleNamespace)
232
234
  this._patchContext([])
233
235
  this.loader.showLog(this, 'apply')
234
236
  this.fiber = this.ctx.registry.plugin(plugin, this.options.config, this.getOuterStack).ctx.fiber
237
+ this.moduleNamespace = moduleNamespace
235
238
  }
236
239
  }