@aponiajs/core 0.3.18 → 0.3.19

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/dist/index.d.mts CHANGED
@@ -31,6 +31,13 @@ declare class AponiaContainer {
31
31
  readonly graph: ModuleGraph;
32
32
  constructor(graph: ModuleGraph);
33
33
  get<T>(token: Token<T>): T;
34
+ /**
35
+ * Framework platform SPI for resolving a provider in its owning module.
36
+ * Application code should use get(), which enforces root-module visibility.
37
+ *
38
+ * @internal
39
+ */
40
+ resolveModuleProvider<T>(module: ModuleDefinition, token: Token<T>): T;
34
41
  initializeModule(module: ModuleDefinition): void;
35
42
  instantiateController<T>(module: ModuleDefinition, controller: ControllerDefinition): T;
36
43
  }
package/dist/index.mjs CHANGED
@@ -83,13 +83,14 @@ var ModuleGraph = class {
83
83
  };
84
84
  function compileModuleGraph(root) {
85
85
  const modules = [];
86
- const modulesById = /* @__PURE__ */ new Map();
86
+ const modulesByIdentity = /* @__PURE__ */ new Map();
87
87
  const visiting = [];
88
88
  const visited = /* @__PURE__ */ new Set();
89
89
  const visit = (module) => {
90
- const registered = modulesById.get(module.id);
90
+ const identity = module.instanceId ?? module.id;
91
+ const registered = modulesByIdentity.get(identity);
91
92
  if (registered && registered !== module) throw new AponiaError("DUPLICATE_MODULE", `Module id "${module.id}" belongs to more than one definition.`, { module: module.id });
92
- modulesById.set(module.id, module);
93
+ modulesByIdentity.set(identity, module);
93
94
  const cycleIndex = visiting.indexOf(module);
94
95
  if (cycleIndex >= 0) {
95
96
  const cycle = [...visiting.slice(cycleIndex), module].map((item) => item.id);
@@ -175,6 +176,16 @@ var AponiaContainer = class {
175
176
  const location = this.graph.locate(this.graph.root, token);
176
177
  return this.#resolve(location);
177
178
  }
179
+ /**
180
+ * Framework platform SPI for resolving a provider in its owning module.
181
+ * Application code should use get(), which enforces root-module visibility.
182
+ *
183
+ * @internal
184
+ */
185
+ resolveModuleProvider(module, token) {
186
+ const location = this.graph.locate(module, token);
187
+ return this.#resolve(location);
188
+ }
178
189
  initializeModule(module) {
179
190
  for (const provider of module.providers) this.#resolve({
180
191
  module,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aponiajs/core",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "description": "Module graph and dependency injection runtime for Aponia.",
5
5
  "homepage": "https://github.com/aponiajs/aponiajs#readme",
6
6
  "bugs": {