@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.
@@ -1,267 +1,18 @@
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/hierarchy.ts
11
- import { getRequestContext, onRequestEnd } from "@fluixi/dom";
12
- import { getOwner } from "@fluixi/reactive/signal";
13
-
14
- // src/injector.ts
15
- import { openReactiveScope, withReactiveScope } from "@fluixi/reactive/signal";
16
-
17
- // src/errors.ts
18
- var InjectionError = class extends Error {
19
- /**
20
- * @param message - What went wrong, with the path rendered into it.
21
- * @param path - The tokens being resolved, outermost first; the last one is the one that failed.
22
- */
23
- constructor(message, path) {
24
- super(message);
25
- this.path = path;
26
- this.name = "InjectionError";
27
- }
28
- };
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/token.ts
48
- function injectionToken(name, options) {
49
- return { id: Symbol(name), name, factory: options?.factory, scope: options?.scope ?? "root" };
50
- }
51
-
52
- // src/tokens.ts
53
- var DestroyRef = injectionToken("DestroyRef");
54
- var INJECTOR = injectionToken("Injector");
55
-
56
- // src/injector.ts
57
- var _records, _created, _hooks, _destroyed, _Injector_instances, home_fn, fromProvider_fn, build_fn, make_fn;
58
- var Injector = class {
59
- /**
60
- * @param parent - Where a token this injector does not hold is looked for next; `null` for the
61
- * top of a chain.
62
- * @param kind - Where the injector sits in the hierarchy; see {@link InjectorKind}.
63
- */
64
- constructor(parent = null, kind = "standalone") {
65
- this.parent = parent;
66
- this.kind = kind;
67
- __privateAdd(this, _Injector_instances);
68
- __privateAdd(this, _records, /* @__PURE__ */ new Map());
69
- __privateAdd(this, _created, []);
70
- __privateAdd(this, _hooks, []);
71
- __privateAdd(this, _destroyed, false);
72
- const self = this;
73
- this.destroyRef = {
74
- onDestroy(fn) {
75
- __privateGet(self, _hooks).push(fn);
76
- return () => {
77
- const i = __privateGet(self, _hooks).indexOf(fn);
78
- if (i >= 0) __privateGet(self, _hooks).splice(i, 1);
79
- };
80
- },
81
- get destroyed() {
82
- return __privateGet(self, _destroyed);
83
- }
84
- };
85
- }
86
- /** Whether {@link Injector.dispose} has run. A disposed injector refuses every `get`. */
87
- get destroyed() {
88
- return __privateGet(this, _destroyed);
89
- }
90
- /**
91
- * Add providers to this injector. A provider for a token already held replaces it, except
92
- * `multi` providers, which extend the token's list. A provider whose token has a test override
93
- * is replaced by the override.
94
- *
95
- * @param providers - The providers to add, in order.
96
- * @returns This injector, for chaining.
97
- */
98
- register(providers) {
99
- for (const given of providers) {
100
- const p = state.overrides.get(given.provide.id) ?? given;
101
- if (p.multi) {
102
- const rec = __privateGet(this, _records).get(p.provide.id);
103
- if (rec?.multi) {
104
- rec.providers.push(p);
105
- rec.built = false;
106
- } else __privateGet(this, _records).set(p.provide.id, { multi: true, providers: [p], built: false, building: false, value: [] });
107
- } else {
108
- __privateGet(this, _records).set(p.provide.id, { multi: false, provider: p, built: false, building: false, value: void 0 });
109
- }
110
- }
111
- return this;
112
- }
113
- get(token, options = {}) {
114
- var _a, _b, _c;
115
- if (__privateGet(this, _destroyed)) throw new InjectionError(`[fluixi/di] "${token.name}" requested from a disposed injector.`, [...state.path, token.name]);
116
- if (token.id === INJECTOR.id) return this;
117
- if (token.id === DestroyRef.id) return this.destroyRef;
118
- let inj = options.skipSelf ? this.parent : this;
119
- while (inj) {
120
- const rec = __privateGet(inj, _records).get(token.id);
121
- if (rec) return __privateMethod(_a = inj, _Injector_instances, build_fn).call(_a, token, rec);
122
- if (options.self || options.host && inj.kind === "owner") break;
123
- inj = inj.parent;
124
- }
125
- const override = state.overrides.get(token.id);
126
- 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);
127
- if (token.factory && !options.self && !options.host) {
128
- 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 });
129
- }
130
- if (options.optional) return null;
131
- const path = [...state.path, token.name];
132
- throw new InjectionError(
133
- `[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 }.`,
134
- path
135
- );
136
- }
137
- /**
138
- * Release this injector: run the hooks registered on its `DestroyRef`, latest first, then the
139
- * `onDestroy()` method of every service it built, latest built first, then forget its
140
- * providers. A hook or `onDestroy()` that throws is logged and the rest still run. Running it
141
- * again does nothing.
142
- *
143
- * Component injectors are disposed when the component unmounts, request roots when the request
144
- * ends; call it yourself only for injectors you created.
145
- */
146
- dispose() {
147
- if (__privateGet(this, _destroyed)) return;
148
- __privateSet(this, _destroyed, true);
149
- const fail = (error) => console.error("[fluixi/di] a destroy hook threw:", error);
150
- for (const hook of __privateGet(this, _hooks).splice(0).reverse()) {
151
- try {
152
- hook();
153
- } catch (error) {
154
- fail(error);
155
- }
156
- }
157
- for (const value of __privateGet(this, _created).splice(0).reverse()) {
158
- const service = value;
159
- if (service && typeof service.onDestroy === "function") {
160
- try {
161
- service.onDestroy();
162
- } catch (error) {
163
- fail(error);
164
- }
165
- }
166
- }
167
- __privateGet(this, _records).clear();
168
- }
169
- };
170
- _records = new WeakMap();
171
- _created = new WeakMap();
172
- _hooks = new WeakMap();
173
- _destroyed = new WeakMap();
174
- _Injector_instances = new WeakSet();
175
- /** The injector a self-providing token builds in: the nearest root, or the platform. */
176
- home_fn = function(scope) {
177
- let inj = this;
178
- if (scope === "platform") {
179
- while (inj.parent) inj = inj.parent;
180
- return inj.kind === "platform" ? inj : platformInjector();
181
- }
182
- let probe = this;
183
- while (probe) {
184
- if (probe.kind === "root") return probe;
185
- probe = probe.parent;
186
- }
187
- while (inj.parent && inj.parent.kind !== "platform") inj = inj.parent;
188
- return inj;
189
- };
190
- fromProvider_fn = function(token, provider) {
191
- let rec = __privateGet(this, _records).get(token.id);
192
- if (!rec) {
193
- rec = { multi: false, provider, built: false, building: false, value: void 0 };
194
- __privateGet(this, _records).set(token.id, rec);
195
- }
196
- return __privateMethod(this, _Injector_instances, build_fn).call(this, token, rec);
197
- };
198
- build_fn = function(token, rec) {
199
- if (rec.built) return rec.value;
200
- if (rec.building) {
201
- const path = [...state.path, token.name];
202
- throw new InjectionError(`[fluixi/di] Circular dependency: ${path.join(" → ")}.`, path);
203
- }
204
- rec.building = true;
205
- state.path.push(token.name);
206
- const previous = state.explicit;
207
- state.explicit = this;
208
- try {
209
- if (rec.multi) {
210
- rec.value = rec.providers.map((p) => __privateMethod(this, _Injector_instances, make_fn).call(this, token, p));
211
- } else {
212
- const module = state.moduleScopes.get(rec.provider);
213
- 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);
214
- }
215
- rec.built = true;
216
- return rec.value;
217
- } finally {
218
- state.explicit = previous;
219
- state.path.pop();
220
- rec.building = false;
221
- }
222
- };
223
- make_fn = function(token, p) {
224
- if ("useValue" in p) return p.useValue;
225
- if ("useExisting" in p) return this.get(p.useExisting);
226
- const deps = (p.deps ?? []).map((d) => "token" in d ? this.get(d.token, d) : this.get(d));
227
- const scope = openReactiveScope({ kind: "service", name: token.name, detail: "useClass" in p ? "useClass" : "useFactory" });
228
- const value = withReactiveScope(scope, () => "useClass" in p ? new p.useClass(...deps) : p.useFactory(...deps));
229
- __privateGet(this, _created).push(value);
230
- return value;
231
- };
232
-
233
- // src/hierarchy.ts
234
- function platformInjector() {
235
- return state.platform ??= new Injector(null, "platform").register(state.platformProviders);
236
- }
237
- function rootInjector() {
238
- const ctx = getRequestContext();
239
- if (ctx) {
240
- let inj = state.requestRoots.get(ctx);
241
- if (!inj) {
242
- const root = new Injector(platformInjector(), "root").register(state.rootProviders);
243
- state.requestRoots.set(ctx, root);
244
- onRequestEnd(() => {
245
- state.requestRoots.delete(ctx);
246
- root.dispose();
247
- });
248
- inj = root;
249
- }
250
- return inj;
251
- }
252
- return state.clientRoot ??= new Injector(platformInjector(), "root").register(state.rootProviders);
253
- }
254
-
255
- // src/initializers.ts
256
- var APP_INITIALIZER = injectionToken("AppInitializer");
257
- function provideAppInitializer(fn) {
258
- return { provide: APP_INITIALIZER, useValue: fn, multi: true };
259
- }
260
- async function runAppInitializers(injector = rootInjector()) {
261
- for (const run of injector.get(APP_INITIALIZER, { optional: true }) ?? []) await run();
262
- }
1
+ import {
2
+ APP_INITIALIZER,
3
+ provideAppInitializer,
4
+ runAppInitializers,
5
+ warnLateInitializers
6
+ } from "./chunk-N62FX7VC.mjs";
7
+ import "./chunk-NZ4DEJ6M.mjs";
8
+ import "./chunk-6Y4QWQA7.mjs";
9
+ import "./chunk-2GEQYTZE.mjs";
10
+ import "./chunk-5BUN4TXK.mjs";
11
+ import "./chunk-E32UTSJA.mjs";
12
+ import "./chunk-I6KKUHEY.mjs";
263
13
  export {
264
14
  APP_INITIALIZER,
265
15
  provideAppInitializer,
266
- runAppInitializers
16
+ runAppInitializers,
17
+ warnLateInitializers
267
18
  };
package/dist/inject.cjs CHANGED
@@ -39,7 +39,7 @@ __export(inject_exports, {
39
39
  runInInjectionContext: () => runInInjectionContext
40
40
  });
41
41
  module.exports = __toCommonJS(inject_exports);
42
- var import_dom2 = require("@fluixi/dom");
42
+ var import_dom3 = require("@fluixi/dom");
43
43
  var import_signal3 = require("@fluixi/reactive/signal");
44
44
 
45
45
  // src/hierarchy.ts
@@ -270,14 +270,14 @@ function platformInjector() {
270
270
  return state.platform ??= new Injector(null, "platform").register(state.platformProviders);
271
271
  }
272
272
  function rootInjector() {
273
- const ctx = (0, import_dom.getRequestContext)();
274
- if (ctx) {
275
- let inj = state.requestRoots.get(ctx);
273
+ const scope = (0, import_dom.requestScope)();
274
+ if (scope) {
275
+ let inj = state.requestRoots.get(scope);
276
276
  if (!inj) {
277
277
  const root = new Injector(platformInjector(), "root").register(state.rootProviders);
278
- state.requestRoots.set(ctx, root);
278
+ state.requestRoots.set(scope, root);
279
279
  (0, import_dom.onRequestEnd)(() => {
280
- state.requestRoots.delete(ctx);
280
+ state.requestRoots.delete(scope);
281
281
  root.dispose();
282
282
  });
283
283
  inj = root;
@@ -296,7 +296,38 @@ function nearestOwnerInjector(owner) {
296
296
  return null;
297
297
  }
298
298
  function currentInjector() {
299
- return state.explicit ?? nearestOwnerInjector((0, import_signal2.getOwner)()) ?? rootInjector();
299
+ if (state.explicit) return state.explicit;
300
+ const owner = (0, import_signal2.getOwner)();
301
+ if (owner) return nearestOwnerInjector(owner) ?? rootInjector();
302
+ if ((0, import_dom.requestScope)()) return rootInjector();
303
+ throw new Error(
304
+ "[fluixi/di] inject() called outside an injection context (after an await? in an event handler?). Inject during setup and keep the value, or keep the injector (getInjector()) and use runInInjectionContext()."
305
+ );
306
+ }
307
+
308
+ // src/initializers.ts
309
+ var import_dom2 = require("@fluixi/dom");
310
+ var APP_INITIALIZER = injectionToken("AppInitializer");
311
+ async function runAppInitializers(injector = rootInjector()) {
312
+ for (const run of injector.get(APP_INITIALIZER, { optional: true }) ?? []) await runInInjectionContext(injector, run);
313
+ }
314
+ (0, import_dom2.beforeFirstRender)(() => {
315
+ if (!state.rootProviders.some(isInitializer)) return;
316
+ return runAppInitializers();
317
+ });
318
+ var isInitializer = (p) => p.provide.id === APP_INITIALIZER.id;
319
+ function production() {
320
+ try {
321
+ return true;
322
+ } catch {
323
+ return false;
324
+ }
325
+ }
326
+ function warnLateInitializers(providers) {
327
+ if (!(0, import_dom2.renderStarted)() || !providers.some(isInitializer) || production()) return;
328
+ console.warn(
329
+ "[fluixi/di] provideAppInitializer() was registered after the app started rendering, so it did not run before this render, and in the browser it never runs. Register it in an app module (app.config.ts) or the entry."
330
+ );
300
331
  }
301
332
 
302
333
  // src/inject.ts
@@ -318,9 +349,10 @@ function provide(providers) {
318
349
  return inj.register(providers);
319
350
  }
320
351
  function provideRoot(providers) {
352
+ warnLateInitializers(providers);
321
353
  state.rootProviders.push(...providers);
322
354
  state.clientRoot?.register(providers);
323
- const ctx = (0, import_dom2.getRequestContext)();
355
+ const ctx = (0, import_dom3.getRequestContext)();
324
356
  if (ctx) state.requestRoots.get(ctx)?.register(providers);
325
357
  }
326
358
  function providePlatform(providers) {
@@ -337,7 +369,7 @@ function runInInjectionContext(injector, fn) {
337
369
  }
338
370
  }
339
371
  function isInInjectionContext() {
340
- return state.explicit !== null || (0, import_signal3.getOwner)() !== null || (0, import_dom2.getRequestContext)() !== void 0;
372
+ return state.explicit !== null || (0, import_signal3.getOwner)() !== null || (0, import_dom3.getRequestContext)() !== void 0;
341
373
  }
342
374
  function assertInInjectionContext(name) {
343
375
  if (!isInInjectionContext()) {
package/dist/inject.d.ts CHANGED
@@ -4,17 +4,19 @@ import type { Token } from './token.js';
4
4
  /**
5
5
  * Resolve `token` from the current injection context: the injector set by
6
6
  * {@link runInInjectionContext} or building the current service, else the nearest component
7
- * injector up the reactive owner tree, else the root (the request's on the server, the app's in
8
- * the browser).
7
+ * injector up the reactive owner tree (the root when no component provides one), else, during a
8
+ * server request, that request's root.
9
9
  *
10
10
  * Call it during a component's setup, inside a provider's constructor or factory, or inside
11
11
  * {@link runInInjectionContext}. In an event handler or after an `await` there is no component
12
- * owner any more: keep the value, or the injector (`inject(INJECTOR)`), from setup instead.
12
+ * owner any more and it throws: keep the value, or the injector (`inject(INJECTOR)`), from setup
13
+ * instead.
13
14
  *
14
15
  * @param token - What to resolve.
15
16
  * @param options - Where to look and what to do when nothing is found; see {@link InjectOptions}.
16
17
  * @returns The value, or `null` when `optional` is set and nothing provides the token.
17
18
  * @throws {@link InjectionError} When nothing provides the token, or on a dependency cycle.
19
+ * @throws Error When there is no injection context (see {@link isInInjectionContext}).
18
20
  *
19
21
  * @example
20
22
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAClG,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,CAAC,CAAC;AAKvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAapE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,IAAI,CAKpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,IAAI,CAGxE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI3D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAErG"}
1
+ {"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAClG,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,CAAC,CAAC;AAKvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAapE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,IAAI,CAMpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,IAAI,CAGxE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI3D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAErG"}
package/dist/inject.js CHANGED
@@ -9,6 +9,7 @@ import { getOwner, onCleanup } from '@fluixi/reactive/signal';
9
9
  import { currentInjector, nearestOwnerInjector, rootInjector } from './hierarchy.js';
10
10
  import { Injector } from './injector.js';
11
11
  import { state } from './state.js';
12
+ import { warnLateInitializers } from './initializers.js';
12
13
  export function inject(token, options) {
13
14
  return currentInjector().get(token, options ?? {});
14
15
  }
@@ -65,6 +66,7 @@ export function provide(providers) {
65
66
  * ```
66
67
  */
67
68
  export function provideRoot(providers) {
69
+ warnLateInitializers(providers);
68
70
  state.rootProviders.push(...providers);
69
71
  state.clientRoot?.register(providers);
70
72
  const ctx = getRequestContext();