@noxfly/noxus 3.0.0-dev.1 → 3.0.0-dev.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.md CHANGED
@@ -451,9 +451,9 @@ class UserRepository {
451
451
 
452
452
  ```ts
453
453
  // preload.ts
454
- import { createPreloadBridge } from '@noxfly/noxus';
454
+ import { exposeNoxusBridge } from '@noxfly/noxus/renderer';
455
455
 
456
- createPreloadBridge(); // exposes window.__noxus__ to the renderer
456
+ exposeNoxusBridge(); // exposes window.__noxus__ to the renderer
457
457
  ```
458
458
 
459
459
  ### IPC client
package/dist/child.js CHANGED
@@ -129,6 +129,9 @@ var init_app_injector = __esm({
129
129
  return this._resolveForwardRef(target);
130
130
  }
131
131
  const k = keyOf(target);
132
+ if (this.singletons.has(k)) {
133
+ return this.singletons.get(k);
134
+ }
132
135
  const binding = this.bindings.get(k);
133
136
  if (!binding) {
134
137
  const name = target instanceof Token ? target.description : target.name ?? "unknown";
package/dist/child.mjs CHANGED
@@ -118,6 +118,9 @@ var init_app_injector = __esm({
118
118
  return this._resolveForwardRef(target);
119
119
  }
120
120
  const k = keyOf(target);
121
+ if (this.singletons.has(k)) {
122
+ return this.singletons.get(k);
123
+ }
121
124
  const binding = this.bindings.get(k);
122
125
  if (!binding) {
123
126
  const name = target instanceof Token ? target.description : target.name ?? "unknown";
package/dist/main.js CHANGED
@@ -133,6 +133,9 @@ var init_app_injector = __esm({
133
133
  return this._resolveForwardRef(target);
134
134
  }
135
135
  const k = keyOf(target);
136
+ if (this.singletons.has(k)) {
137
+ return this.singletons.get(k);
138
+ }
136
139
  const binding = this.bindings.get(k);
137
140
  if (!binding) {
138
141
  const name = target instanceof Token ? target.description : target.name ?? "unknown";
package/dist/main.mjs CHANGED
@@ -122,6 +122,9 @@ var init_app_injector = __esm({
122
122
  return this._resolveForwardRef(target);
123
123
  }
124
124
  const k = keyOf(target);
125
+ if (this.singletons.has(k)) {
126
+ return this.singletons.get(k);
127
+ }
125
128
  const binding = this.bindings.get(k);
126
129
  if (!binding) {
127
130
  const name = target instanceof Token ? target.description : target.name ?? "unknown";
package/dist/renderer.js CHANGED
@@ -95,6 +95,9 @@ var _AppInjector = class _AppInjector {
95
95
  return this._resolveForwardRef(target);
96
96
  }
97
97
  const k = keyOf(target);
98
+ if (this.singletons.has(k)) {
99
+ return this.singletons.get(k);
100
+ }
98
101
  const binding = this.bindings.get(k);
99
102
  if (!binding) {
100
103
  const name = target instanceof Token ? target.description : target.name ?? "unknown";
package/dist/renderer.mjs CHANGED
@@ -66,6 +66,9 @@ var _AppInjector = class _AppInjector {
66
66
  return this._resolveForwardRef(target);
67
67
  }
68
68
  const k = keyOf(target);
69
+ if (this.singletons.has(k)) {
70
+ return this.singletons.get(k);
71
+ }
69
72
  const binding = this.bindings.get(k);
70
73
  if (!binding) {
71
74
  const name = target instanceof Token ? target.description : target.name ?? "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxfly/noxus",
3
- "version": "3.0.0-dev.1",
3
+ "version": "3.0.0-dev.2",
4
4
  "main": "dist/main.js",
5
5
  "module": "dist/main.mjs",
6
6
  "types": "dist/main.d.ts",
@@ -38,6 +38,14 @@
38
38
  "require": "./dist/child.js"
39
39
  }
40
40
  },
41
+ "typesVersions": {
42
+ "*": {
43
+ "main": ["./dist/main.d.ts"],
44
+ "renderer": ["./dist/renderer.d.ts"],
45
+ "preload": ["./dist/preload.d.ts"],
46
+ "child": ["./dist/child.d.ts"]
47
+ }
48
+ },
41
49
  "scripts": {
42
50
  "build": "tsup",
43
51
  "prepublishOnly": "npm run build",
@@ -77,10 +77,19 @@ export class AppInjector {
77
77
  }
78
78
 
79
79
  const k = keyOf(target) as TokenKey<unknown>;
80
+
81
+ if (this.singletons.has(k)) {
82
+ return this.singletons.get(k) as T;
83
+ }
84
+
80
85
  const binding = this.bindings.get(k);
81
86
 
82
87
  if (!binding) {
83
- const name = target instanceof Token ? target.description : (target as Type<unknown>).name ?? 'unknown';
88
+ const name = target instanceof Token
89
+ ? target.description
90
+ : (target as Type<unknown>).name
91
+ ?? 'unknown';
92
+
84
93
  throw new Error(
85
94
  `[Noxus DI] No binding found for "${name}".\n`
86
95
  + `Did you forget to declare it in @Injectable({ deps }) or in bootstrapApplication({ singletons })?`,
@@ -78,6 +78,7 @@ export async function bootstrapApplication(config: BootstrapConfig = {}): Promis
78
78
 
79
79
  // Build override map for the DI flush phase
80
80
  const overrides = new Map<TokenKey, unknown>();
81
+
81
82
  for (const { token, useValue } of config.singletons ?? []) {
82
83
  overrides.set(token, useValue);
83
84
  // Pre-register the binding so the injector knows the token exists