@noxfly/noxus 2.3.2 → 2.5.0
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/child.js +173 -19
- package/dist/child.mjs +173 -19
- package/dist/main.d.mts +100 -22
- package/dist/main.d.ts +100 -22
- package/dist/main.js +236 -390
- package/dist/main.mjs +237 -388
- package/dist/renderer.d.mts +112 -1
- package/dist/renderer.d.ts +112 -1
- package/dist/renderer.js +40 -2
- package/dist/renderer.mjs +39 -2
- package/dist/{index-BxWQVi6C.d.ts → request-CdpZ9qZL.d.ts} +1 -87
- package/dist/{index-DQBQQfMw.d.mts → request-Dx_5Prte.d.mts} +1 -87
- package/package.json +1 -1
- package/src/DI/injector-explorer.ts +120 -15
- package/src/app.ts +50 -2
- package/src/bootstrap.ts +53 -3
- package/src/decorators/injectable.decorator.ts +1 -1
- package/src/index.ts +1 -0
- package/src/main.ts +0 -3
- package/src/router.ts +99 -6
package/dist/main.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { M as MaybeAsync, T as Type } from './app-injector-B3MvgV3k.mjs';
|
|
2
2
|
export { A as AppInjector, F as ForwardRefFn, a as ForwardReference, I as IBinding, L as Lifetime, R as RootInjector, f as forwardRef, i as inject } from './app-injector-B3MvgV3k.mjs';
|
|
3
|
-
import { R as Request,
|
|
4
|
-
export {
|
|
3
|
+
import { R as Request, a as IResponse, h as IGuard } from './request-Dx_5Prte.mjs';
|
|
4
|
+
export { A as AtomicHttpMethod, j as Authorize, D as Delete, G as Get, H as HttpMethod, c as IBatchRequestItem, e as IBatchRequestPayload, d as IBatchResponsePayload, I as IRendererEventMessage, b as IRequest, m as IRouteMetadata, p as Patch, P as Post, o as Put, f as RENDERER_EVENT_TYPE, q as ROUTE_METADATA_KEY, g as createRendererEventMessage, k as getGuardForController, l as getGuardForControllerAction, n as getRouteMetadata, i as isRendererEventMessage } from './request-Dx_5Prte.mjs';
|
|
5
|
+
import { BrowserWindow } from 'electron/main';
|
|
5
6
|
export { BadGatewayException, BadRequestException, ConflictException, ForbiddenException, GatewayTimeoutException, HttpVersionNotSupportedException, INJECTABLE_METADATA_KEY, INJECT_METADATA_KEY, Inject, Injectable, InsufficientStorageException, InternalServerException, LogLevel, Logger, LoopDetectedException, MethodNotAllowedException, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, PaymentRequiredException, RequestTimeoutException, ResponseException, ServiceUnavailableException, TooManyRequestsException, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, getInjectableMetadata, hasInjectableMetadata } from './child.mjs';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -50,6 +51,16 @@ declare function getMiddlewaresForController(controllerName: string): Type<IMidd
|
|
|
50
51
|
declare function getMiddlewaresForControllerAction(controllerName: string, actionName: string): Type<IMiddleware>[];
|
|
51
52
|
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* A lazy route entry maps a path prefix to a dynamic import function.
|
|
56
|
+
* The module is loaded on the first request matching the prefix.
|
|
57
|
+
*/
|
|
58
|
+
interface ILazyRoute {
|
|
59
|
+
/** Path prefix (e.g. "auth", "printing"). Matched against the first segment(s) of the request path. */
|
|
60
|
+
path: string;
|
|
61
|
+
/** Dynamic import function returning the module file. */
|
|
62
|
+
loadModule: () => Promise<unknown>;
|
|
63
|
+
}
|
|
53
64
|
/**
|
|
54
65
|
* IRouteDefinition interface defines the structure of a route in the application.
|
|
55
66
|
* It includes the HTTP method, path, controller class, handler method name,
|
|
@@ -75,6 +86,7 @@ type ControllerAction = (request: Request, response: IResponse) => any;
|
|
|
75
86
|
declare class Router {
|
|
76
87
|
private readonly routes;
|
|
77
88
|
private readonly rootMiddlewares;
|
|
89
|
+
private readonly lazyRoutes;
|
|
78
90
|
/**
|
|
79
91
|
* Registers a controller class with the router.
|
|
80
92
|
* This method extracts the route metadata from the controller class and registers it in the routing tree.
|
|
@@ -82,6 +94,15 @@ declare class Router {
|
|
|
82
94
|
* @param controllerClass - The controller class to register.
|
|
83
95
|
*/
|
|
84
96
|
registerController(controllerClass: Type<unknown>): Router;
|
|
97
|
+
/**
|
|
98
|
+
* Registers a lazy route. The module behind this route prefix will only
|
|
99
|
+
* be imported (and its controllers/services registered in DI) the first
|
|
100
|
+
* time a request targets this prefix.
|
|
101
|
+
*
|
|
102
|
+
* @param pathPrefix - Route prefix (e.g. "auth"). Matched against the first segment of the request path.
|
|
103
|
+
* @param loadModule - A function that returns a dynamic import promise.
|
|
104
|
+
*/
|
|
105
|
+
registerLazyRoute(pathPrefix: string, loadModule: () => Promise<unknown>): Router;
|
|
85
106
|
/**
|
|
86
107
|
* Defines a middleware for the root of the application.
|
|
87
108
|
* This method allows you to register a middleware that will be applied to all requests
|
|
@@ -107,7 +128,28 @@ declare class Router {
|
|
|
107
128
|
* @param request - The Request object containing the method and path to search for.
|
|
108
129
|
* @returns The IRouteDefinition for the matched route.
|
|
109
130
|
*/
|
|
131
|
+
/**
|
|
132
|
+
* Attempts to find a route definition for the given request.
|
|
133
|
+
* Returns undefined instead of throwing when the route is not found,
|
|
134
|
+
* so the caller can try lazy-loading first.
|
|
135
|
+
*/
|
|
136
|
+
private tryFindRoute;
|
|
137
|
+
/**
|
|
138
|
+
* Finds the route definition for a given request.
|
|
139
|
+
* If no eagerly-registered route matches, attempts to load a lazy module
|
|
140
|
+
* whose prefix matches the request path, then retries.
|
|
141
|
+
*/
|
|
110
142
|
private findRoute;
|
|
143
|
+
/**
|
|
144
|
+
* Given a request path, checks whether a lazy route prefix matches
|
|
145
|
+
* and triggers the dynamic import if it hasn't been loaded yet.
|
|
146
|
+
*/
|
|
147
|
+
private tryLoadLazyRoute;
|
|
148
|
+
/**
|
|
149
|
+
* Dynamically imports a lazy module and registers its decorated classes
|
|
150
|
+
* (controllers, services) in the DI container using the two-phase strategy.
|
|
151
|
+
*/
|
|
152
|
+
private loadLazyModule;
|
|
111
153
|
/**
|
|
112
154
|
* Resolves the controller for a given route definition.
|
|
113
155
|
* This method creates an instance of the controller class and prepares the request parameters.
|
|
@@ -185,7 +227,7 @@ declare class NoxSocket {
|
|
|
185
227
|
*/
|
|
186
228
|
interface IApp {
|
|
187
229
|
dispose(): Promise<void>;
|
|
188
|
-
onReady(): Promise<void>;
|
|
230
|
+
onReady(mainWindow?: BrowserWindow): Promise<void>;
|
|
189
231
|
onActivated(): Promise<void>;
|
|
190
232
|
}
|
|
191
233
|
/**
|
|
@@ -196,6 +238,7 @@ declare class NoxApp {
|
|
|
196
238
|
private readonly router;
|
|
197
239
|
private readonly socket;
|
|
198
240
|
private app;
|
|
241
|
+
private mainWindow;
|
|
199
242
|
/**
|
|
200
243
|
*
|
|
201
244
|
*/
|
|
@@ -231,6 +274,39 @@ declare class NoxApp {
|
|
|
231
274
|
* This method is called when all windows are closed, and it cleans up the message channels
|
|
232
275
|
*/
|
|
233
276
|
private onAllWindowsClosed;
|
|
277
|
+
/**
|
|
278
|
+
* Sets the main BrowserWindow that was created early by bootstrapApplication.
|
|
279
|
+
* This window will be passed to IApp.onReady when start() is called.
|
|
280
|
+
* @param window - The BrowserWindow created during bootstrap.
|
|
281
|
+
*/
|
|
282
|
+
setMainWindow(window: BrowserWindow): void;
|
|
283
|
+
/**
|
|
284
|
+
* Registers a lazy-loaded route. The module behind this path prefix
|
|
285
|
+
* will only be dynamically imported when the first IPC request
|
|
286
|
+
* targets this prefix — like Angular's loadChildren.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```ts
|
|
290
|
+
* noxApp.lazy("auth", () => import("./modules/auth/auth.module.js"));
|
|
291
|
+
* noxApp.lazy("printing", () => import("./modules/printing/printing.module.js"));
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @param pathPrefix - The route prefix (e.g. "auth", "cash-register").
|
|
295
|
+
* @param loadModule - A function returning a dynamic import promise.
|
|
296
|
+
* @returns NoxApp instance for method chaining.
|
|
297
|
+
*/
|
|
298
|
+
lazy(pathPrefix: string, loadModule: () => Promise<unknown>): NoxApp;
|
|
299
|
+
/**
|
|
300
|
+
* Eagerly loads one or more modules with a two-phase DI guarantee.
|
|
301
|
+
* Use this when a service needed at startup lives inside a module
|
|
302
|
+
* (e.g. the Application service depends on LoaderService).
|
|
303
|
+
*
|
|
304
|
+
* All dynamic imports run in parallel; bindings are registered first,
|
|
305
|
+
* then singletons are resolved — safe regardless of import ordering.
|
|
306
|
+
*
|
|
307
|
+
* @param importFns - Functions returning dynamic import promises.
|
|
308
|
+
*/
|
|
309
|
+
loadModules(importFns: Array<() => Promise<unknown>>): Promise<void>;
|
|
234
310
|
/**
|
|
235
311
|
* Configures the NoxApp instance with the provided application class.
|
|
236
312
|
* This method allows you to set the application class that will handle lifecycle events.
|
|
@@ -247,21 +323,40 @@ declare class NoxApp {
|
|
|
247
323
|
use(middleware: Type<IMiddleware>): NoxApp;
|
|
248
324
|
/**
|
|
249
325
|
* Should be called after the bootstrapApplication function is called.
|
|
326
|
+
* Passes the early-created BrowserWindow (if any) to the configured IApp service.
|
|
250
327
|
* @returns NoxApp instance for method chaining.
|
|
251
328
|
*/
|
|
252
329
|
start(): NoxApp;
|
|
253
330
|
}
|
|
254
331
|
|
|
255
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Options for bootstrapping the Noxus application.
|
|
335
|
+
*/
|
|
336
|
+
interface BootstrapOptions {
|
|
337
|
+
/**
|
|
338
|
+
* If provided, Noxus creates a BrowserWindow immediately after Electron is ready,
|
|
339
|
+
* before any DI processing occurs. This window is passed to the configured
|
|
340
|
+
* IApp service via onReady(). It allows the user to see a window as fast as possible,
|
|
341
|
+
* even before the application is fully initialized.
|
|
342
|
+
*/
|
|
343
|
+
window?: Electron.BrowserWindowConstructorOptions;
|
|
344
|
+
}
|
|
256
345
|
/**
|
|
257
346
|
* Bootstraps the Noxus application.
|
|
258
347
|
* This function initializes the application by creating an instance of NoxApp,
|
|
259
348
|
* registering the root module, and starting the application.
|
|
349
|
+
*
|
|
350
|
+
* When {@link BootstrapOptions.window} is provided, a BrowserWindow is created
|
|
351
|
+
* immediately after Electron readiness — before DI resolution — so the user
|
|
352
|
+
* sees a window as quickly as possible.
|
|
353
|
+
*
|
|
260
354
|
* @param rootModule - The root module of the application, decorated with @Module.
|
|
355
|
+
* @param options - Optional bootstrap configuration.
|
|
261
356
|
* @return A promise that resolves to the NoxApp instance.
|
|
262
357
|
* @throws Error if the root module is not decorated with @Module, or if the electron process could not start.
|
|
263
358
|
*/
|
|
264
|
-
declare function bootstrapApplication(rootModule
|
|
359
|
+
declare function bootstrapApplication(rootModule?: Type<any> | null, options?: BootstrapOptions): Promise<NoxApp>;
|
|
265
360
|
|
|
266
361
|
|
|
267
362
|
/**
|
|
@@ -304,21 +399,4 @@ declare function Module(metadata: IModuleMetadata): ClassDecorator;
|
|
|
304
399
|
declare function getModuleMetadata(target: Function): IModuleMetadata | undefined;
|
|
305
400
|
declare const MODULE_METADATA_KEY: unique symbol;
|
|
306
401
|
|
|
307
|
-
|
|
308
|
-
interface NoxusPreloadAPI extends IPortRequester {
|
|
309
|
-
}
|
|
310
|
-
interface NoxusPreloadOptions {
|
|
311
|
-
exposeAs?: string;
|
|
312
|
-
initMessageType?: string;
|
|
313
|
-
requestChannel?: string;
|
|
314
|
-
responseChannel?: string;
|
|
315
|
-
targetWindow?: Window;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Exposes a minimal bridge in the isolated preload context so renderer processes
|
|
319
|
-
* can request the two MessagePorts required by Noxus. The bridge forwards both
|
|
320
|
-
* request/response and socket ports to the renderer via window.postMessage.
|
|
321
|
-
*/
|
|
322
|
-
declare function exposeNoxusBridge(options?: NoxusPreloadOptions): NoxusPreloadAPI;
|
|
323
|
-
|
|
324
|
-
export { CONTROLLER_METADATA_KEY, Controller, type ControllerAction, type IApp, type IControllerMetadata, IGuard, type IMiddleware, type IModuleMetadata, IPortRequester, IResponse, type IRouteDefinition, MODULE_METADATA_KEY, MaybeAsync, Module, type NextFunction, NoxApp, NoxSocket, type NoxusPreloadAPI, type NoxusPreloadOptions, Request, Router, Type, UseMiddlewares, bootstrapApplication, exposeNoxusBridge, getControllerMetadata, getMiddlewaresForController, getMiddlewaresForControllerAction, getModuleMetadata };
|
|
402
|
+
export { type BootstrapOptions, CONTROLLER_METADATA_KEY, Controller, type ControllerAction, type IApp, type IControllerMetadata, IGuard, type ILazyRoute, type IMiddleware, type IModuleMetadata, IResponse, type IRouteDefinition, MODULE_METADATA_KEY, MaybeAsync, Module, type NextFunction, NoxApp, NoxSocket, Request, Router, Type, UseMiddlewares, bootstrapApplication, getControllerMetadata, getMiddlewaresForController, getMiddlewaresForControllerAction, getModuleMetadata };
|
package/dist/main.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { M as MaybeAsync, T as Type } from './app-injector-B3MvgV3k.js';
|
|
2
2
|
export { A as AppInjector, F as ForwardRefFn, a as ForwardReference, I as IBinding, L as Lifetime, R as RootInjector, f as forwardRef, i as inject } from './app-injector-B3MvgV3k.js';
|
|
3
|
-
import { R as Request,
|
|
4
|
-
export {
|
|
3
|
+
import { R as Request, a as IResponse, h as IGuard } from './request-CdpZ9qZL.js';
|
|
4
|
+
export { A as AtomicHttpMethod, j as Authorize, D as Delete, G as Get, H as HttpMethod, c as IBatchRequestItem, e as IBatchRequestPayload, d as IBatchResponsePayload, I as IRendererEventMessage, b as IRequest, m as IRouteMetadata, p as Patch, P as Post, o as Put, f as RENDERER_EVENT_TYPE, q as ROUTE_METADATA_KEY, g as createRendererEventMessage, k as getGuardForController, l as getGuardForControllerAction, n as getRouteMetadata, i as isRendererEventMessage } from './request-CdpZ9qZL.js';
|
|
5
|
+
import { BrowserWindow } from 'electron/main';
|
|
5
6
|
export { BadGatewayException, BadRequestException, ConflictException, ForbiddenException, GatewayTimeoutException, HttpVersionNotSupportedException, INJECTABLE_METADATA_KEY, INJECT_METADATA_KEY, Inject, Injectable, InsufficientStorageException, InternalServerException, LogLevel, Logger, LoopDetectedException, MethodNotAllowedException, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, PaymentRequiredException, RequestTimeoutException, ResponseException, ServiceUnavailableException, TooManyRequestsException, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, getInjectableMetadata, hasInjectableMetadata } from './child.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -50,6 +51,16 @@ declare function getMiddlewaresForController(controllerName: string): Type<IMidd
|
|
|
50
51
|
declare function getMiddlewaresForControllerAction(controllerName: string, actionName: string): Type<IMiddleware>[];
|
|
51
52
|
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* A lazy route entry maps a path prefix to a dynamic import function.
|
|
56
|
+
* The module is loaded on the first request matching the prefix.
|
|
57
|
+
*/
|
|
58
|
+
interface ILazyRoute {
|
|
59
|
+
/** Path prefix (e.g. "auth", "printing"). Matched against the first segment(s) of the request path. */
|
|
60
|
+
path: string;
|
|
61
|
+
/** Dynamic import function returning the module file. */
|
|
62
|
+
loadModule: () => Promise<unknown>;
|
|
63
|
+
}
|
|
53
64
|
/**
|
|
54
65
|
* IRouteDefinition interface defines the structure of a route in the application.
|
|
55
66
|
* It includes the HTTP method, path, controller class, handler method name,
|
|
@@ -75,6 +86,7 @@ type ControllerAction = (request: Request, response: IResponse) => any;
|
|
|
75
86
|
declare class Router {
|
|
76
87
|
private readonly routes;
|
|
77
88
|
private readonly rootMiddlewares;
|
|
89
|
+
private readonly lazyRoutes;
|
|
78
90
|
/**
|
|
79
91
|
* Registers a controller class with the router.
|
|
80
92
|
* This method extracts the route metadata from the controller class and registers it in the routing tree.
|
|
@@ -82,6 +94,15 @@ declare class Router {
|
|
|
82
94
|
* @param controllerClass - The controller class to register.
|
|
83
95
|
*/
|
|
84
96
|
registerController(controllerClass: Type<unknown>): Router;
|
|
97
|
+
/**
|
|
98
|
+
* Registers a lazy route. The module behind this route prefix will only
|
|
99
|
+
* be imported (and its controllers/services registered in DI) the first
|
|
100
|
+
* time a request targets this prefix.
|
|
101
|
+
*
|
|
102
|
+
* @param pathPrefix - Route prefix (e.g. "auth"). Matched against the first segment of the request path.
|
|
103
|
+
* @param loadModule - A function that returns a dynamic import promise.
|
|
104
|
+
*/
|
|
105
|
+
registerLazyRoute(pathPrefix: string, loadModule: () => Promise<unknown>): Router;
|
|
85
106
|
/**
|
|
86
107
|
* Defines a middleware for the root of the application.
|
|
87
108
|
* This method allows you to register a middleware that will be applied to all requests
|
|
@@ -107,7 +128,28 @@ declare class Router {
|
|
|
107
128
|
* @param request - The Request object containing the method and path to search for.
|
|
108
129
|
* @returns The IRouteDefinition for the matched route.
|
|
109
130
|
*/
|
|
131
|
+
/**
|
|
132
|
+
* Attempts to find a route definition for the given request.
|
|
133
|
+
* Returns undefined instead of throwing when the route is not found,
|
|
134
|
+
* so the caller can try lazy-loading first.
|
|
135
|
+
*/
|
|
136
|
+
private tryFindRoute;
|
|
137
|
+
/**
|
|
138
|
+
* Finds the route definition for a given request.
|
|
139
|
+
* If no eagerly-registered route matches, attempts to load a lazy module
|
|
140
|
+
* whose prefix matches the request path, then retries.
|
|
141
|
+
*/
|
|
110
142
|
private findRoute;
|
|
143
|
+
/**
|
|
144
|
+
* Given a request path, checks whether a lazy route prefix matches
|
|
145
|
+
* and triggers the dynamic import if it hasn't been loaded yet.
|
|
146
|
+
*/
|
|
147
|
+
private tryLoadLazyRoute;
|
|
148
|
+
/**
|
|
149
|
+
* Dynamically imports a lazy module and registers its decorated classes
|
|
150
|
+
* (controllers, services) in the DI container using the two-phase strategy.
|
|
151
|
+
*/
|
|
152
|
+
private loadLazyModule;
|
|
111
153
|
/**
|
|
112
154
|
* Resolves the controller for a given route definition.
|
|
113
155
|
* This method creates an instance of the controller class and prepares the request parameters.
|
|
@@ -185,7 +227,7 @@ declare class NoxSocket {
|
|
|
185
227
|
*/
|
|
186
228
|
interface IApp {
|
|
187
229
|
dispose(): Promise<void>;
|
|
188
|
-
onReady(): Promise<void>;
|
|
230
|
+
onReady(mainWindow?: BrowserWindow): Promise<void>;
|
|
189
231
|
onActivated(): Promise<void>;
|
|
190
232
|
}
|
|
191
233
|
/**
|
|
@@ -196,6 +238,7 @@ declare class NoxApp {
|
|
|
196
238
|
private readonly router;
|
|
197
239
|
private readonly socket;
|
|
198
240
|
private app;
|
|
241
|
+
private mainWindow;
|
|
199
242
|
/**
|
|
200
243
|
*
|
|
201
244
|
*/
|
|
@@ -231,6 +274,39 @@ declare class NoxApp {
|
|
|
231
274
|
* This method is called when all windows are closed, and it cleans up the message channels
|
|
232
275
|
*/
|
|
233
276
|
private onAllWindowsClosed;
|
|
277
|
+
/**
|
|
278
|
+
* Sets the main BrowserWindow that was created early by bootstrapApplication.
|
|
279
|
+
* This window will be passed to IApp.onReady when start() is called.
|
|
280
|
+
* @param window - The BrowserWindow created during bootstrap.
|
|
281
|
+
*/
|
|
282
|
+
setMainWindow(window: BrowserWindow): void;
|
|
283
|
+
/**
|
|
284
|
+
* Registers a lazy-loaded route. The module behind this path prefix
|
|
285
|
+
* will only be dynamically imported when the first IPC request
|
|
286
|
+
* targets this prefix — like Angular's loadChildren.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```ts
|
|
290
|
+
* noxApp.lazy("auth", () => import("./modules/auth/auth.module.js"));
|
|
291
|
+
* noxApp.lazy("printing", () => import("./modules/printing/printing.module.js"));
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @param pathPrefix - The route prefix (e.g. "auth", "cash-register").
|
|
295
|
+
* @param loadModule - A function returning a dynamic import promise.
|
|
296
|
+
* @returns NoxApp instance for method chaining.
|
|
297
|
+
*/
|
|
298
|
+
lazy(pathPrefix: string, loadModule: () => Promise<unknown>): NoxApp;
|
|
299
|
+
/**
|
|
300
|
+
* Eagerly loads one or more modules with a two-phase DI guarantee.
|
|
301
|
+
* Use this when a service needed at startup lives inside a module
|
|
302
|
+
* (e.g. the Application service depends on LoaderService).
|
|
303
|
+
*
|
|
304
|
+
* All dynamic imports run in parallel; bindings are registered first,
|
|
305
|
+
* then singletons are resolved — safe regardless of import ordering.
|
|
306
|
+
*
|
|
307
|
+
* @param importFns - Functions returning dynamic import promises.
|
|
308
|
+
*/
|
|
309
|
+
loadModules(importFns: Array<() => Promise<unknown>>): Promise<void>;
|
|
234
310
|
/**
|
|
235
311
|
* Configures the NoxApp instance with the provided application class.
|
|
236
312
|
* This method allows you to set the application class that will handle lifecycle events.
|
|
@@ -247,21 +323,40 @@ declare class NoxApp {
|
|
|
247
323
|
use(middleware: Type<IMiddleware>): NoxApp;
|
|
248
324
|
/**
|
|
249
325
|
* Should be called after the bootstrapApplication function is called.
|
|
326
|
+
* Passes the early-created BrowserWindow (if any) to the configured IApp service.
|
|
250
327
|
* @returns NoxApp instance for method chaining.
|
|
251
328
|
*/
|
|
252
329
|
start(): NoxApp;
|
|
253
330
|
}
|
|
254
331
|
|
|
255
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Options for bootstrapping the Noxus application.
|
|
335
|
+
*/
|
|
336
|
+
interface BootstrapOptions {
|
|
337
|
+
/**
|
|
338
|
+
* If provided, Noxus creates a BrowserWindow immediately after Electron is ready,
|
|
339
|
+
* before any DI processing occurs. This window is passed to the configured
|
|
340
|
+
* IApp service via onReady(). It allows the user to see a window as fast as possible,
|
|
341
|
+
* even before the application is fully initialized.
|
|
342
|
+
*/
|
|
343
|
+
window?: Electron.BrowserWindowConstructorOptions;
|
|
344
|
+
}
|
|
256
345
|
/**
|
|
257
346
|
* Bootstraps the Noxus application.
|
|
258
347
|
* This function initializes the application by creating an instance of NoxApp,
|
|
259
348
|
* registering the root module, and starting the application.
|
|
349
|
+
*
|
|
350
|
+
* When {@link BootstrapOptions.window} is provided, a BrowserWindow is created
|
|
351
|
+
* immediately after Electron readiness — before DI resolution — so the user
|
|
352
|
+
* sees a window as quickly as possible.
|
|
353
|
+
*
|
|
260
354
|
* @param rootModule - The root module of the application, decorated with @Module.
|
|
355
|
+
* @param options - Optional bootstrap configuration.
|
|
261
356
|
* @return A promise that resolves to the NoxApp instance.
|
|
262
357
|
* @throws Error if the root module is not decorated with @Module, or if the electron process could not start.
|
|
263
358
|
*/
|
|
264
|
-
declare function bootstrapApplication(rootModule
|
|
359
|
+
declare function bootstrapApplication(rootModule?: Type<any> | null, options?: BootstrapOptions): Promise<NoxApp>;
|
|
265
360
|
|
|
266
361
|
|
|
267
362
|
/**
|
|
@@ -304,21 +399,4 @@ declare function Module(metadata: IModuleMetadata): ClassDecorator;
|
|
|
304
399
|
declare function getModuleMetadata(target: Function): IModuleMetadata | undefined;
|
|
305
400
|
declare const MODULE_METADATA_KEY: unique symbol;
|
|
306
401
|
|
|
307
|
-
|
|
308
|
-
interface NoxusPreloadAPI extends IPortRequester {
|
|
309
|
-
}
|
|
310
|
-
interface NoxusPreloadOptions {
|
|
311
|
-
exposeAs?: string;
|
|
312
|
-
initMessageType?: string;
|
|
313
|
-
requestChannel?: string;
|
|
314
|
-
responseChannel?: string;
|
|
315
|
-
targetWindow?: Window;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Exposes a minimal bridge in the isolated preload context so renderer processes
|
|
319
|
-
* can request the two MessagePorts required by Noxus. The bridge forwards both
|
|
320
|
-
* request/response and socket ports to the renderer via window.postMessage.
|
|
321
|
-
*/
|
|
322
|
-
declare function exposeNoxusBridge(options?: NoxusPreloadOptions): NoxusPreloadAPI;
|
|
323
|
-
|
|
324
|
-
export { CONTROLLER_METADATA_KEY, Controller, type ControllerAction, type IApp, type IControllerMetadata, IGuard, type IMiddleware, type IModuleMetadata, IPortRequester, IResponse, type IRouteDefinition, MODULE_METADATA_KEY, MaybeAsync, Module, type NextFunction, NoxApp, NoxSocket, type NoxusPreloadAPI, type NoxusPreloadOptions, Request, Router, Type, UseMiddlewares, bootstrapApplication, exposeNoxusBridge, getControllerMetadata, getMiddlewaresForController, getMiddlewaresForControllerAction, getModuleMetadata };
|
|
402
|
+
export { type BootstrapOptions, CONTROLLER_METADATA_KEY, Controller, type ControllerAction, type IApp, type IControllerMetadata, IGuard, type ILazyRoute, type IMiddleware, type IModuleMetadata, IResponse, type IRouteDefinition, MODULE_METADATA_KEY, MaybeAsync, Module, type NextFunction, NoxApp, NoxSocket, Request, Router, Type, UseMiddlewares, bootstrapApplication, getControllerMetadata, getMiddlewaresForController, getMiddlewaresForControllerAction, getModuleMetadata };
|