@fluixi/di 1.0.0-alpha.108 → 1.0.0-alpha.110

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/inject.mjs CHANGED
@@ -1,324 +1,20 @@
1
- var __typeError = (msg) => {
2
- throw TypeError(msg);
3
- };
4
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
-
10
- // src/inject.ts
11
- import { getRequestContext as getRequestContext2 } from "@fluixi/dom";
12
- import { getOwner as getOwner2, onCleanup } from "@fluixi/reactive/signal";
13
-
14
- // src/hierarchy.ts
15
- import { getRequestContext, onRequestEnd } from "@fluixi/dom";
16
- import { getOwner } from "@fluixi/reactive/signal";
17
-
18
- // src/injector.ts
19
- import { openReactiveScope, withReactiveScope } from "@fluixi/reactive/signal";
20
-
21
- // src/errors.ts
22
- var InjectionError = class extends Error {
23
- /**
24
- * @param message - What went wrong, with the path rendered into it.
25
- * @param path - The tokens being resolved, outermost first; the last one is the one that failed.
26
- */
27
- constructor(message, path) {
28
- super(message);
29
- this.path = path;
30
- this.name = "InjectionError";
31
- }
32
- };
33
-
34
- // src/state.ts
35
- function freshState() {
36
- return {
37
- platformProviders: [],
38
- rootProviders: [],
39
- platform: null,
40
- clientRoot: null,
41
- requestRoots: /* @__PURE__ */ new WeakMap(),
42
- ownerInjectors: /* @__PURE__ */ new WeakMap(),
43
- moduleScopes: /* @__PURE__ */ new WeakMap(),
44
- overrides: /* @__PURE__ */ new Map(),
45
- explicit: null,
46
- path: []
47
- };
48
- }
49
- var state = globalThis[/* @__PURE__ */ Symbol.for("fluixi.di")] ??= freshState();
50
-
51
- // src/token.ts
52
- function injectionToken(name, options) {
53
- return { id: Symbol(name), name, factory: options?.factory, scope: options?.scope ?? "root" };
54
- }
55
-
56
- // src/tokens.ts
57
- var DestroyRef = injectionToken("DestroyRef");
58
- var INJECTOR = injectionToken("Injector");
59
-
60
- // src/injector.ts
61
- var _records, _created, _hooks, _destroyed, _Injector_instances, home_fn, fromProvider_fn, build_fn, make_fn;
62
- var Injector = class {
63
- /**
64
- * @param parent - Where a token this injector does not hold is looked for next; `null` for the
65
- * top of a chain.
66
- * @param kind - Where the injector sits in the hierarchy; see {@link InjectorKind}.
67
- */
68
- constructor(parent = null, kind = "standalone") {
69
- this.parent = parent;
70
- this.kind = kind;
71
- __privateAdd(this, _Injector_instances);
72
- __privateAdd(this, _records, /* @__PURE__ */ new Map());
73
- __privateAdd(this, _created, []);
74
- __privateAdd(this, _hooks, []);
75
- __privateAdd(this, _destroyed, false);
76
- const self = this;
77
- this.destroyRef = {
78
- onDestroy(fn) {
79
- __privateGet(self, _hooks).push(fn);
80
- return () => {
81
- const i = __privateGet(self, _hooks).indexOf(fn);
82
- if (i >= 0) __privateGet(self, _hooks).splice(i, 1);
83
- };
84
- },
85
- get destroyed() {
86
- return __privateGet(self, _destroyed);
87
- }
88
- };
89
- }
90
- /** Whether {@link Injector.dispose} has run. A disposed injector refuses every `get`. */
91
- get destroyed() {
92
- return __privateGet(this, _destroyed);
93
- }
94
- /**
95
- * Add providers to this injector. A provider for a token already held replaces it, except
96
- * `multi` providers, which extend the token's list. A provider whose token has a test override
97
- * is replaced by the override.
98
- *
99
- * @param providers - The providers to add, in order.
100
- * @returns This injector, for chaining.
101
- */
102
- register(providers) {
103
- for (const given of providers) {
104
- const p = state.overrides.get(given.provide.id) ?? given;
105
- if (p.multi) {
106
- const rec = __privateGet(this, _records).get(p.provide.id);
107
- if (rec?.multi) {
108
- rec.providers.push(p);
109
- rec.built = false;
110
- } else __privateGet(this, _records).set(p.provide.id, { multi: true, providers: [p], built: false, building: false, value: [] });
111
- } else {
112
- __privateGet(this, _records).set(p.provide.id, { multi: false, provider: p, built: false, building: false, value: void 0 });
113
- }
114
- }
115
- return this;
116
- }
117
- get(token, options = {}) {
118
- var _a, _b, _c;
119
- if (__privateGet(this, _destroyed)) throw new InjectionError(`[fluixi/di] "${token.name}" requested from a disposed injector.`, [...state.path, token.name]);
120
- if (token.id === INJECTOR.id) return this;
121
- if (token.id === DestroyRef.id) return this.destroyRef;
122
- let inj = options.skipSelf ? this.parent : this;
123
- while (inj) {
124
- const rec = __privateGet(inj, _records).get(token.id);
125
- if (rec) return __privateMethod(_a = inj, _Injector_instances, build_fn).call(_a, token, rec);
126
- if (options.self || options.host && inj.kind === "owner") break;
127
- inj = inj.parent;
128
- }
129
- const override = state.overrides.get(token.id);
130
- if (override && !options.self) return __privateMethod(_b = __privateMethod(this, _Injector_instances, home_fn).call(this, token.scope), _Injector_instances, fromProvider_fn).call(_b, token, override);
131
- if (token.factory && !options.self && !options.host) {
132
- return __privateMethod(_c = __privateMethod(this, _Injector_instances, home_fn).call(this, token.scope), _Injector_instances, fromProvider_fn).call(_c, token, { provide: token, useFactory: token.factory });
133
- }
134
- if (options.optional) return null;
135
- const path = [...state.path, token.name];
136
- throw new InjectionError(
137
- `[fluixi/di] No provider for "${token.name}" (${path.join(" → ")}). Provide it in an app module, with provide() or provideRoot(), or give the token a { factory }.`,
138
- path
139
- );
140
- }
141
- /**
142
- * Release this injector: run the hooks registered on its `DestroyRef`, latest first, then the
143
- * `onDestroy()` method of every service it built, latest built first, then forget its
144
- * providers. A hook or `onDestroy()` that throws is logged and the rest still run. Running it
145
- * again does nothing.
146
- *
147
- * Component injectors are disposed when the component unmounts, request roots when the request
148
- * ends; call it yourself only for injectors you created.
149
- */
150
- dispose() {
151
- if (__privateGet(this, _destroyed)) return;
152
- __privateSet(this, _destroyed, true);
153
- const fail = (error) => console.error("[fluixi/di] a destroy hook threw:", error);
154
- for (const hook of __privateGet(this, _hooks).splice(0).reverse()) {
155
- try {
156
- hook();
157
- } catch (error) {
158
- fail(error);
159
- }
160
- }
161
- for (const value of __privateGet(this, _created).splice(0).reverse()) {
162
- const service = value;
163
- if (service && typeof service.onDestroy === "function") {
164
- try {
165
- service.onDestroy();
166
- } catch (error) {
167
- fail(error);
168
- }
169
- }
170
- }
171
- __privateGet(this, _records).clear();
172
- }
173
- };
174
- _records = new WeakMap();
175
- _created = new WeakMap();
176
- _hooks = new WeakMap();
177
- _destroyed = new WeakMap();
178
- _Injector_instances = new WeakSet();
179
- /** The injector a self-providing token builds in: the nearest root, or the platform. */
180
- home_fn = function(scope) {
181
- let inj = this;
182
- if (scope === "platform") {
183
- while (inj.parent) inj = inj.parent;
184
- return inj.kind === "platform" ? inj : platformInjector();
185
- }
186
- let probe = this;
187
- while (probe) {
188
- if (probe.kind === "root") return probe;
189
- probe = probe.parent;
190
- }
191
- while (inj.parent && inj.parent.kind !== "platform") inj = inj.parent;
192
- return inj;
193
- };
194
- fromProvider_fn = function(token, provider) {
195
- let rec = __privateGet(this, _records).get(token.id);
196
- if (!rec) {
197
- rec = { multi: false, provider, built: false, building: false, value: void 0 };
198
- __privateGet(this, _records).set(token.id, rec);
199
- }
200
- return __privateMethod(this, _Injector_instances, build_fn).call(this, token, rec);
201
- };
202
- build_fn = function(token, rec) {
203
- if (rec.built) return rec.value;
204
- if (rec.building) {
205
- const path = [...state.path, token.name];
206
- throw new InjectionError(`[fluixi/di] Circular dependency: ${path.join(" → ")}.`, path);
207
- }
208
- rec.building = true;
209
- state.path.push(token.name);
210
- const previous = state.explicit;
211
- state.explicit = this;
212
- try {
213
- if (rec.multi) {
214
- rec.value = rec.providers.map((p) => __privateMethod(this, _Injector_instances, make_fn).call(this, token, p));
215
- } else {
216
- const module = state.moduleScopes.get(rec.provider);
217
- rec.value = module ? withReactiveScope(module, () => __privateMethod(this, _Injector_instances, make_fn).call(this, token, rec.provider)) : __privateMethod(this, _Injector_instances, make_fn).call(this, token, rec.provider);
218
- }
219
- rec.built = true;
220
- return rec.value;
221
- } finally {
222
- state.explicit = previous;
223
- state.path.pop();
224
- rec.building = false;
225
- }
226
- };
227
- make_fn = function(token, p) {
228
- if ("useValue" in p) return p.useValue;
229
- if ("useExisting" in p) return this.get(p.useExisting);
230
- const deps = (p.deps ?? []).map((d) => "token" in d ? this.get(d.token, d) : this.get(d));
231
- const scope = openReactiveScope({ kind: "service", name: token.name, detail: "useClass" in p ? "useClass" : "useFactory" });
232
- const value = withReactiveScope(scope, () => "useClass" in p ? new p.useClass(...deps) : p.useFactory(...deps));
233
- __privateGet(this, _created).push(value);
234
- return value;
235
- };
236
-
237
- // src/hierarchy.ts
238
- function platformInjector() {
239
- return state.platform ??= new Injector(null, "platform").register(state.platformProviders);
240
- }
241
- function rootInjector() {
242
- const ctx = getRequestContext();
243
- if (ctx) {
244
- let inj = state.requestRoots.get(ctx);
245
- if (!inj) {
246
- const root = new Injector(platformInjector(), "root").register(state.rootProviders);
247
- state.requestRoots.set(ctx, root);
248
- onRequestEnd(() => {
249
- state.requestRoots.delete(ctx);
250
- root.dispose();
251
- });
252
- inj = root;
253
- }
254
- return inj;
255
- }
256
- return state.clientRoot ??= new Injector(platformInjector(), "root").register(state.rootProviders);
257
- }
258
- function nearestOwnerInjector(owner) {
259
- let o = owner;
260
- while (o) {
261
- const inj = state.ownerInjectors.get(o);
262
- if (inj) return inj;
263
- o = o.parent;
264
- }
265
- return null;
266
- }
267
- function currentInjector() {
268
- return state.explicit ?? nearestOwnerInjector(getOwner()) ?? rootInjector();
269
- }
270
-
271
- // src/inject.ts
272
- function inject(token, options) {
273
- return currentInjector().get(token, options ?? {});
274
- }
275
- function provide(providers) {
276
- const owner = getOwner2();
277
- if (!owner) {
278
- throw new Error("[fluixi/di] provide() runs inside a component. Use provideRoot() for services of the whole app.");
279
- }
280
- let inj = state.ownerInjectors.get(owner);
281
- if (!inj) {
282
- const created = new Injector(nearestOwnerInjector(owner.parent) ?? rootInjector(), "owner");
283
- state.ownerInjectors.set(owner, created);
284
- onCleanup(() => created.dispose());
285
- inj = created;
286
- }
287
- return inj.register(providers);
288
- }
289
- function provideRoot(providers) {
290
- state.rootProviders.push(...providers);
291
- state.clientRoot?.register(providers);
292
- const ctx = getRequestContext2();
293
- if (ctx) state.requestRoots.get(ctx)?.register(providers);
294
- }
295
- function providePlatform(providers) {
296
- state.platformProviders.push(...providers);
297
- state.platform?.register(providers);
298
- }
299
- function runInInjectionContext(injector, fn) {
300
- const previous = state.explicit;
301
- state.explicit = injector;
302
- try {
303
- return fn();
304
- } finally {
305
- state.explicit = previous;
306
- }
307
- }
308
- function isInInjectionContext() {
309
- return state.explicit !== null || getOwner2() !== null || getRequestContext2() !== void 0;
310
- }
311
- function assertInInjectionContext(name) {
312
- if (!isInInjectionContext()) {
313
- throw new Error(`[fluixi/di] ${name}() runs inside a component, a request or runInInjectionContext().`);
314
- }
315
- }
316
- function getInjector() {
317
- return currentInjector();
318
- }
319
- function createInjector(providers, parent) {
320
- return new Injector(parent === void 0 ? rootInjector() : parent, "standalone").register(providers);
321
- }
1
+ import {
2
+ assertInInjectionContext,
3
+ createInjector,
4
+ getInjector,
5
+ inject,
6
+ isInInjectionContext,
7
+ provide,
8
+ providePlatform,
9
+ provideRoot,
10
+ runInInjectionContext
11
+ } from "./chunk-N62FX7VC.mjs";
12
+ import "./chunk-NZ4DEJ6M.mjs";
13
+ import "./chunk-6Y4QWQA7.mjs";
14
+ import "./chunk-2GEQYTZE.mjs";
15
+ import "./chunk-5BUN4TXK.mjs";
16
+ import "./chunk-E32UTSJA.mjs";
17
+ import "./chunk-I6KKUHEY.mjs";
322
18
  export {
323
19
  assertInInjectionContext,
324
20
  createInjector,
package/dist/injector.mjs CHANGED
@@ -1,239 +1,11 @@
1
- var __typeError = (msg) => {
2
- throw TypeError(msg);
3
- };
4
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
-
10
- // src/injector.ts
11
- import { openReactiveScope, withReactiveScope } from "@fluixi/reactive/signal";
12
-
13
- // src/errors.ts
14
- var InjectionError = class extends Error {
15
- /**
16
- * @param message - What went wrong, with the path rendered into it.
17
- * @param path - The tokens being resolved, outermost first; the last one is the one that failed.
18
- */
19
- constructor(message, path) {
20
- super(message);
21
- this.path = path;
22
- this.name = "InjectionError";
23
- }
24
- };
25
-
26
- // src/hierarchy.ts
27
- import { getRequestContext, onRequestEnd } from "@fluixi/dom";
28
- import { getOwner } from "@fluixi/reactive/signal";
29
-
30
- // src/state.ts
31
- function freshState() {
32
- return {
33
- platformProviders: [],
34
- rootProviders: [],
35
- platform: null,
36
- clientRoot: null,
37
- requestRoots: /* @__PURE__ */ new WeakMap(),
38
- ownerInjectors: /* @__PURE__ */ new WeakMap(),
39
- moduleScopes: /* @__PURE__ */ new WeakMap(),
40
- overrides: /* @__PURE__ */ new Map(),
41
- explicit: null,
42
- path: []
43
- };
44
- }
45
- var state = globalThis[/* @__PURE__ */ Symbol.for("fluixi.di")] ??= freshState();
46
-
47
- // src/hierarchy.ts
48
- function platformInjector() {
49
- return state.platform ??= new Injector(null, "platform").register(state.platformProviders);
50
- }
51
-
52
- // src/token.ts
53
- function injectionToken(name, options) {
54
- return { id: Symbol(name), name, factory: options?.factory, scope: options?.scope ?? "root" };
55
- }
56
-
57
- // src/tokens.ts
58
- var DestroyRef = injectionToken("DestroyRef");
59
- var INJECTOR = injectionToken("Injector");
60
-
61
- // src/injector.ts
62
- var _records, _created, _hooks, _destroyed, _Injector_instances, home_fn, fromProvider_fn, build_fn, make_fn;
63
- var Injector = class {
64
- /**
65
- * @param parent - Where a token this injector does not hold is looked for next; `null` for the
66
- * top of a chain.
67
- * @param kind - Where the injector sits in the hierarchy; see {@link InjectorKind}.
68
- */
69
- constructor(parent = null, kind = "standalone") {
70
- this.parent = parent;
71
- this.kind = kind;
72
- __privateAdd(this, _Injector_instances);
73
- __privateAdd(this, _records, /* @__PURE__ */ new Map());
74
- __privateAdd(this, _created, []);
75
- __privateAdd(this, _hooks, []);
76
- __privateAdd(this, _destroyed, false);
77
- const self = this;
78
- this.destroyRef = {
79
- onDestroy(fn) {
80
- __privateGet(self, _hooks).push(fn);
81
- return () => {
82
- const i = __privateGet(self, _hooks).indexOf(fn);
83
- if (i >= 0) __privateGet(self, _hooks).splice(i, 1);
84
- };
85
- },
86
- get destroyed() {
87
- return __privateGet(self, _destroyed);
88
- }
89
- };
90
- }
91
- /** Whether {@link Injector.dispose} has run. A disposed injector refuses every `get`. */
92
- get destroyed() {
93
- return __privateGet(this, _destroyed);
94
- }
95
- /**
96
- * Add providers to this injector. A provider for a token already held replaces it, except
97
- * `multi` providers, which extend the token's list. A provider whose token has a test override
98
- * is replaced by the override.
99
- *
100
- * @param providers - The providers to add, in order.
101
- * @returns This injector, for chaining.
102
- */
103
- register(providers) {
104
- for (const given of providers) {
105
- const p = state.overrides.get(given.provide.id) ?? given;
106
- if (p.multi) {
107
- const rec = __privateGet(this, _records).get(p.provide.id);
108
- if (rec?.multi) {
109
- rec.providers.push(p);
110
- rec.built = false;
111
- } else __privateGet(this, _records).set(p.provide.id, { multi: true, providers: [p], built: false, building: false, value: [] });
112
- } else {
113
- __privateGet(this, _records).set(p.provide.id, { multi: false, provider: p, built: false, building: false, value: void 0 });
114
- }
115
- }
116
- return this;
117
- }
118
- get(token, options = {}) {
119
- var _a, _b, _c;
120
- if (__privateGet(this, _destroyed)) throw new InjectionError(`[fluixi/di] "${token.name}" requested from a disposed injector.`, [...state.path, token.name]);
121
- if (token.id === INJECTOR.id) return this;
122
- if (token.id === DestroyRef.id) return this.destroyRef;
123
- let inj = options.skipSelf ? this.parent : this;
124
- while (inj) {
125
- const rec = __privateGet(inj, _records).get(token.id);
126
- if (rec) return __privateMethod(_a = inj, _Injector_instances, build_fn).call(_a, token, rec);
127
- if (options.self || options.host && inj.kind === "owner") break;
128
- inj = inj.parent;
129
- }
130
- const override = state.overrides.get(token.id);
131
- if (override && !options.self) return __privateMethod(_b = __privateMethod(this, _Injector_instances, home_fn).call(this, token.scope), _Injector_instances, fromProvider_fn).call(_b, token, override);
132
- if (token.factory && !options.self && !options.host) {
133
- return __privateMethod(_c = __privateMethod(this, _Injector_instances, home_fn).call(this, token.scope), _Injector_instances, fromProvider_fn).call(_c, token, { provide: token, useFactory: token.factory });
134
- }
135
- if (options.optional) return null;
136
- const path = [...state.path, token.name];
137
- throw new InjectionError(
138
- `[fluixi/di] No provider for "${token.name}" (${path.join(" → ")}). Provide it in an app module, with provide() or provideRoot(), or give the token a { factory }.`,
139
- path
140
- );
141
- }
142
- /**
143
- * Release this injector: run the hooks registered on its `DestroyRef`, latest first, then the
144
- * `onDestroy()` method of every service it built, latest built first, then forget its
145
- * providers. A hook or `onDestroy()` that throws is logged and the rest still run. Running it
146
- * again does nothing.
147
- *
148
- * Component injectors are disposed when the component unmounts, request roots when the request
149
- * ends; call it yourself only for injectors you created.
150
- */
151
- dispose() {
152
- if (__privateGet(this, _destroyed)) return;
153
- __privateSet(this, _destroyed, true);
154
- const fail = (error) => console.error("[fluixi/di] a destroy hook threw:", error);
155
- for (const hook of __privateGet(this, _hooks).splice(0).reverse()) {
156
- try {
157
- hook();
158
- } catch (error) {
159
- fail(error);
160
- }
161
- }
162
- for (const value of __privateGet(this, _created).splice(0).reverse()) {
163
- const service = value;
164
- if (service && typeof service.onDestroy === "function") {
165
- try {
166
- service.onDestroy();
167
- } catch (error) {
168
- fail(error);
169
- }
170
- }
171
- }
172
- __privateGet(this, _records).clear();
173
- }
174
- };
175
- _records = new WeakMap();
176
- _created = new WeakMap();
177
- _hooks = new WeakMap();
178
- _destroyed = new WeakMap();
179
- _Injector_instances = new WeakSet();
180
- /** The injector a self-providing token builds in: the nearest root, or the platform. */
181
- home_fn = function(scope) {
182
- let inj = this;
183
- if (scope === "platform") {
184
- while (inj.parent) inj = inj.parent;
185
- return inj.kind === "platform" ? inj : platformInjector();
186
- }
187
- let probe = this;
188
- while (probe) {
189
- if (probe.kind === "root") return probe;
190
- probe = probe.parent;
191
- }
192
- while (inj.parent && inj.parent.kind !== "platform") inj = inj.parent;
193
- return inj;
194
- };
195
- fromProvider_fn = function(token, provider) {
196
- let rec = __privateGet(this, _records).get(token.id);
197
- if (!rec) {
198
- rec = { multi: false, provider, built: false, building: false, value: void 0 };
199
- __privateGet(this, _records).set(token.id, rec);
200
- }
201
- return __privateMethod(this, _Injector_instances, build_fn).call(this, token, rec);
202
- };
203
- build_fn = function(token, rec) {
204
- if (rec.built) return rec.value;
205
- if (rec.building) {
206
- const path = [...state.path, token.name];
207
- throw new InjectionError(`[fluixi/di] Circular dependency: ${path.join(" → ")}.`, path);
208
- }
209
- rec.building = true;
210
- state.path.push(token.name);
211
- const previous = state.explicit;
212
- state.explicit = this;
213
- try {
214
- if (rec.multi) {
215
- rec.value = rec.providers.map((p) => __privateMethod(this, _Injector_instances, make_fn).call(this, token, p));
216
- } else {
217
- const module = state.moduleScopes.get(rec.provider);
218
- rec.value = module ? withReactiveScope(module, () => __privateMethod(this, _Injector_instances, make_fn).call(this, token, rec.provider)) : __privateMethod(this, _Injector_instances, make_fn).call(this, token, rec.provider);
219
- }
220
- rec.built = true;
221
- return rec.value;
222
- } finally {
223
- state.explicit = previous;
224
- state.path.pop();
225
- rec.building = false;
226
- }
227
- };
228
- make_fn = function(token, p) {
229
- if ("useValue" in p) return p.useValue;
230
- if ("useExisting" in p) return this.get(p.useExisting);
231
- const deps = (p.deps ?? []).map((d) => "token" in d ? this.get(d.token, d) : this.get(d));
232
- const scope = openReactiveScope({ kind: "service", name: token.name, detail: "useClass" in p ? "useClass" : "useFactory" });
233
- const value = withReactiveScope(scope, () => "useClass" in p ? new p.useClass(...deps) : p.useFactory(...deps));
234
- __privateGet(this, _created).push(value);
235
- return value;
236
- };
1
+ import {
2
+ Injector
3
+ } from "./chunk-NZ4DEJ6M.mjs";
4
+ import "./chunk-6Y4QWQA7.mjs";
5
+ import "./chunk-2GEQYTZE.mjs";
6
+ import "./chunk-5BUN4TXK.mjs";
7
+ import "./chunk-E32UTSJA.mjs";
8
+ import "./chunk-I6KKUHEY.mjs";
237
9
  export {
238
10
  Injector
239
11
  };
package/dist/state.mjs CHANGED
@@ -1,22 +1,9 @@
1
- // src/state.ts
2
- function freshState() {
3
- return {
4
- platformProviders: [],
5
- rootProviders: [],
6
- platform: null,
7
- clientRoot: null,
8
- requestRoots: /* @__PURE__ */ new WeakMap(),
9
- ownerInjectors: /* @__PURE__ */ new WeakMap(),
10
- moduleScopes: /* @__PURE__ */ new WeakMap(),
11
- overrides: /* @__PURE__ */ new Map(),
12
- explicit: null,
13
- path: []
14
- };
15
- }
16
- var state = globalThis[/* @__PURE__ */ Symbol.for("fluixi.di")] ??= freshState();
17
- function setModuleScope(provider, scope) {
18
- state.moduleScopes.set(provider, scope);
19
- }
1
+ import {
2
+ freshState,
3
+ setModuleScope,
4
+ state
5
+ } from "./chunk-E32UTSJA.mjs";
6
+ import "./chunk-I6KKUHEY.mjs";
20
7
  export {
21
8
  freshState,
22
9
  setModuleScope,
package/dist/testing.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @fluixi/di v1.0.0-alpha.108 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/di v1.0.0-alpha.110 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;