@noxfly/noxus 3.0.0-dev.0 → 3.0.0-dev.1
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 +12 -9
- package/dist/child.d.mts +112 -4
- package/dist/child.d.ts +112 -4
- package/dist/child.js +30 -30
- package/dist/child.mjs +30 -30
- package/dist/main.d.mts +450 -6
- package/dist/main.d.ts +450 -6
- package/dist/main.js +229 -229
- package/dist/main.mjs +231 -231
- package/dist/preload.d.mts +28 -0
- package/dist/preload.d.ts +28 -0
- package/dist/preload.js +95 -0
- package/dist/preload.mjs +70 -0
- package/dist/renderer.d.mts +159 -22
- package/dist/renderer.d.ts +159 -22
- package/dist/renderer.js +11 -58
- package/dist/renderer.mjs +7 -53
- package/package.json +18 -13
- package/src/DI/injector-explorer.ts +2 -2
- package/src/decorators/guards.decorator.ts +1 -1
- package/src/decorators/middleware.decorator.ts +1 -1
- package/src/index.ts +2 -5
- package/src/{app.ts → internal/app.ts} +8 -8
- package/src/{bootstrap.ts → internal/bootstrap.ts} +4 -4
- package/src/{request.ts → internal/request.ts} +2 -2
- package/src/{router.ts → internal/router.ts} +9 -9
- package/src/{routes.ts → internal/routes.ts} +2 -2
- package/src/{socket.ts → internal/socket.ts} +2 -2
- package/src/main.ts +7 -7
- package/src/non-electron-process.ts +1 -1
- package/src/preload.ts +10 -0
- package/src/renderer.ts +13 -0
- package/tsup.config.ts +27 -11
- /package/src/{exceptions.ts → internal/exceptions.ts} +0 -0
- /package/src/{preload-bridge.ts → internal/preload-bridge.ts} +0 -0
- /package/src/{renderer-client.ts → internal/renderer-client.ts} +0 -0
- /package/src/{renderer-events.ts → internal/renderer-events.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noxfly/noxus",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.1",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"module": "dist/main.mjs",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"browser": {
|
|
10
|
-
"types":
|
|
11
|
-
"import":
|
|
10
|
+
"types": "./dist/renderer.d.ts",
|
|
11
|
+
"import": "./dist/renderer.mjs",
|
|
12
12
|
"require": "./dist/renderer.js"
|
|
13
13
|
},
|
|
14
14
|
"default": {
|
|
15
|
-
"types":
|
|
16
|
-
"import":
|
|
15
|
+
"types": "./dist/child.d.ts",
|
|
16
|
+
"import": "./dist/child.mjs",
|
|
17
17
|
"require": "./dist/child.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
+
"./main": {
|
|
21
|
+
"types": "./dist/main.d.ts",
|
|
22
|
+
"import": "./dist/main.mjs",
|
|
23
|
+
"require": "./dist/main.js"
|
|
24
|
+
},
|
|
20
25
|
"./renderer": {
|
|
21
|
-
"types":
|
|
22
|
-
"import":
|
|
26
|
+
"types": "./dist/renderer.d.ts",
|
|
27
|
+
"import": "./dist/renderer.mjs",
|
|
23
28
|
"require": "./dist/renderer.js"
|
|
24
29
|
},
|
|
25
|
-
"./
|
|
26
|
-
"types":
|
|
27
|
-
"import":
|
|
28
|
-
"require": "./dist/
|
|
30
|
+
"./preload": {
|
|
31
|
+
"types": "./dist/preload.d.ts",
|
|
32
|
+
"import": "./dist/preload.mjs",
|
|
33
|
+
"require": "./dist/preload.js"
|
|
29
34
|
},
|
|
30
35
|
"./child": {
|
|
31
|
-
"types":
|
|
32
|
-
"import":
|
|
36
|
+
"types": "./dist/child.d.ts",
|
|
37
|
+
"import": "./dist/child.mjs",
|
|
33
38
|
"require": "./dist/child.js"
|
|
34
39
|
}
|
|
35
40
|
},
|
|
@@ -118,7 +118,7 @@ export class InjectorExplorer {
|
|
|
118
118
|
|
|
119
119
|
if (reg.isController) {
|
|
120
120
|
// Lazily import Router to avoid circular dependency at module load time
|
|
121
|
-
const { Router } = require('../router') as { Router: { prototype: { registerController(t: Type<unknown>): void } } };
|
|
121
|
+
const { Router } = require('../internal/router') as { Router: { prototype: { registerController(t: Type<unknown>): void } } };
|
|
122
122
|
const router = RootInjector.resolve(Router as any) as { registerController(t: Type<unknown>, pathPrefix: string, routeGuards: Guard[], routeMiddlewares: Middleware[]): void };
|
|
123
123
|
router.registerController(reg.implementation, reg.pathPrefix ?? '', routeGuards, routeMiddlewares);
|
|
124
124
|
} else if (reg.lifetime !== 'singleton') {
|
|
@@ -135,7 +135,7 @@ export class InjectorExplorer {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
if (reg.isController) {
|
|
138
|
-
const { Router } = require('../router') as { Router: { prototype: { registerController(t: Type<unknown>): void } } };
|
|
138
|
+
const { Router } = require('../internal/router') as { Router: { prototype: { registerController(t: Type<unknown>): void } } };
|
|
139
139
|
const router = RootInjector.resolve(Router as any) as { registerController(t: Type<unknown>): void };
|
|
140
140
|
router.registerController(reg.implementation);
|
|
141
141
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,5 @@
|
|
|
6
6
|
* Entry point for renderer process and preload consumers.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './renderer-events';
|
|
12
|
-
export * from './renderer-client';
|
|
13
|
-
export type { HttpMethod, AtomicHttpMethod } from './decorators/method.decorator';
|
|
9
|
+
// src/index.ts — redirige vers renderer
|
|
10
|
+
export * from './renderer';
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { app, BrowserWindow, ipcMain, MessageChannelMain } from 'electron/main';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { Guard } from "src/main";
|
|
9
|
+
import { Injectable } from '../decorators/injectable.decorator';
|
|
10
|
+
import { Middleware } from '../decorators/middleware.decorator';
|
|
11
|
+
import { inject } from '../DI/app-injector';
|
|
12
|
+
import { InjectorExplorer } from '../DI/injector-explorer';
|
|
13
|
+
import { Logger } from '../utils/logger';
|
|
14
|
+
import { Type } from '../utils/types';
|
|
15
|
+
import { WindowManager } from '../window/window-manager';
|
|
12
16
|
import { IResponse, Request } from './request';
|
|
13
17
|
import { Router } from './router';
|
|
14
18
|
import { NoxSocket } from './socket';
|
|
15
|
-
import { Logger } from './utils/logger';
|
|
16
|
-
import { Type } from './utils/types';
|
|
17
|
-
import { WindowManager } from './window/window-manager';
|
|
18
|
-
import { Guard } from "src/main";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Your application service should implement IApp.
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { app } from 'electron/main';
|
|
8
|
+
import { inject, RootInjector } from '../DI/app-injector';
|
|
9
|
+
import { InjectorExplorer } from '../DI/injector-explorer';
|
|
10
|
+
import { TokenKey } from '../DI/token';
|
|
8
11
|
import { NoxApp } from './app';
|
|
9
|
-
import {
|
|
10
|
-
import { InjectorExplorer } from './DI/injector-explorer';
|
|
11
|
-
import { TokenKey } from './DI/token';
|
|
12
|
-
import { RouteDefinition } from "src/routes";
|
|
12
|
+
import { RouteDefinition } from "./routes";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A singleton value override: provides an already-constructed instance
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
import { AtomicHttpMethod, HttpMethod } from '
|
|
9
|
-
import { AppInjector, RootInjector } from '
|
|
8
|
+
import { AtomicHttpMethod, HttpMethod } from '../decorators/method.decorator';
|
|
9
|
+
import { AppInjector, RootInjector } from '../DI/app-injector';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The Request class represents an HTTP request in the Noxus framework.
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
* @author NoxFly
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getControllerMetadata } from '
|
|
8
|
-
import { Guard } from '
|
|
9
|
-
import { Injectable } from '
|
|
10
|
-
import { getRouteMetadata, isAtomicHttpMethod } from '
|
|
11
|
-
import { Middleware, NextFunction } from '
|
|
12
|
-
import { InjectorExplorer } from '
|
|
7
|
+
import { getControllerMetadata } from '../decorators/controller.decorator';
|
|
8
|
+
import { Guard } from '../decorators/guards.decorator';
|
|
9
|
+
import { Injectable } from '../decorators/injectable.decorator';
|
|
10
|
+
import { getRouteMetadata, isAtomicHttpMethod } from '../decorators/method.decorator';
|
|
11
|
+
import { Middleware, NextFunction } from '../decorators/middleware.decorator';
|
|
12
|
+
import { InjectorExplorer } from '../DI/injector-explorer';
|
|
13
|
+
import { Logger } from '../utils/logger';
|
|
14
|
+
import { RadixTree } from '../utils/radix-tree';
|
|
15
|
+
import { Type } from '../utils/types';
|
|
13
16
|
import {
|
|
14
17
|
BadRequestException,
|
|
15
18
|
NotFoundException,
|
|
@@ -17,9 +20,6 @@ import {
|
|
|
17
20
|
UnauthorizedException
|
|
18
21
|
} from './exceptions';
|
|
19
22
|
import { IBatchRequestItem, IBatchRequestPayload, IBatchResponsePayload, IResponse, Request } from './request';
|
|
20
|
-
import { Logger } from './utils/logger';
|
|
21
|
-
import { RadixTree } from './utils/radix-tree';
|
|
22
|
-
import { Type } from './utils/types';
|
|
23
23
|
|
|
24
24
|
export interface ILazyRoute {
|
|
25
25
|
load: () => Promise<unknown>;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @author NoxFly
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Guard } from '
|
|
8
|
-
import { Middleware } from '
|
|
7
|
+
import { Guard } from '../decorators/guards.decorator';
|
|
8
|
+
import { Middleware } from '../decorators/middleware.decorator';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A single route entry in the application routing table.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* Centralizes MessagePort storage for renderer communication and handles
|
|
9
9
|
* push-event delivery back to renderer processes.
|
|
10
10
|
*/
|
|
11
|
-
import { Injectable } from '
|
|
11
|
+
import { Injectable } from '../decorators/injectable.decorator';
|
|
12
|
+
import { Logger } from '../utils/logger';
|
|
12
13
|
import { createRendererEventMessage } from './request';
|
|
13
|
-
import { Logger } from './utils/logger';
|
|
14
14
|
|
|
15
15
|
interface RendererChannels {
|
|
16
16
|
request: Electron.MessageChannelMain;
|
package/src/main.ts
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
export * from './DI/app-injector';
|
|
10
10
|
export * from './DI/token';
|
|
11
|
-
export * from './router';
|
|
12
|
-
export * from './app';
|
|
13
|
-
export * from './bootstrap';
|
|
14
|
-
export * from './exceptions';
|
|
11
|
+
export * from './internal/router';
|
|
12
|
+
export * from './internal/app';
|
|
13
|
+
export * from './internal/bootstrap';
|
|
14
|
+
export * from './internal/exceptions';
|
|
15
15
|
export * from './decorators/middleware.decorator';
|
|
16
16
|
export * from './decorators/guards.decorator';
|
|
17
17
|
export * from './decorators/controller.decorator';
|
|
@@ -20,7 +20,7 @@ export * from './decorators/method.decorator';
|
|
|
20
20
|
export * from './utils/logger';
|
|
21
21
|
export * from './utils/types';
|
|
22
22
|
export * from './utils/forward-ref';
|
|
23
|
-
export * from './request';
|
|
24
|
-
export * from './socket';
|
|
23
|
+
export * from './internal/request';
|
|
24
|
+
export * from './internal/socket';
|
|
25
25
|
export * from './window/window-manager';
|
|
26
|
-
export * from './routes';
|
|
26
|
+
export * from './internal/routes';
|
package/src/preload.ts
ADDED
package/src/renderer.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright 2025 NoxFly
|
|
3
|
+
* @license MIT
|
|
4
|
+
* @author NoxFly
|
|
5
|
+
*
|
|
6
|
+
* Entry point for renderer web consumers (Angular, React, Vue, Vanilla...).
|
|
7
|
+
* No Electron imports — safe to bundle with any web bundler.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export * from './internal/renderer-client';
|
|
11
|
+
export * from './internal/renderer-events';
|
|
12
|
+
export * from './internal/request';
|
|
13
|
+
export type { HttpMethod, AtomicHttpMethod } from './decorators/method.decorator';
|
package/tsup.config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig } from "tsup";
|
|
1
|
+
import { defineConfig, Options } from "tsup";
|
|
2
2
|
|
|
3
3
|
const copyrights = `
|
|
4
4
|
/**
|
|
@@ -8,19 +8,14 @@ const copyrights = `
|
|
|
8
8
|
*/
|
|
9
9
|
`.trim();
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
entry: {
|
|
13
|
-
renderer: "src/index.ts",
|
|
14
|
-
main: "src/main.ts",
|
|
15
|
-
child: "src/non-electron-process.ts",
|
|
16
|
-
},
|
|
11
|
+
const options: Options = {
|
|
17
12
|
keepNames: true,
|
|
18
13
|
minifyIdentifiers: false,
|
|
19
14
|
name: "noxus",
|
|
20
15
|
format: ["cjs", "esm"],
|
|
21
16
|
dts: true,
|
|
22
17
|
sourcemap: true,
|
|
23
|
-
clean:
|
|
18
|
+
clean: false, // ← false dans le base config
|
|
24
19
|
outDir: "dist",
|
|
25
20
|
external: ["electron"],
|
|
26
21
|
target: "es2020",
|
|
@@ -28,7 +23,28 @@ export default defineConfig({
|
|
|
28
23
|
splitting: false,
|
|
29
24
|
shims: false,
|
|
30
25
|
treeshake: false,
|
|
31
|
-
banner: {
|
|
32
|
-
|
|
26
|
+
banner: { js: copyrights },
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default defineConfig([
|
|
30
|
+
{
|
|
31
|
+
entry: { main: 'src/main.ts' },
|
|
32
|
+
external: ['electron', 'electron/main'],
|
|
33
|
+
clean: true, // ← true uniquement ici
|
|
34
|
+
...options,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
entry: { renderer: 'src/renderer.ts' },
|
|
38
|
+
external: ['electron', 'electron/renderer'],
|
|
39
|
+
...options,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
entry: { preload: 'src/preload.ts' },
|
|
43
|
+
external: ['electron', 'electron/renderer'],
|
|
44
|
+
...options,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
entry: { child: 'src/non-electron-process.ts' },
|
|
48
|
+
...options,
|
|
33
49
|
},
|
|
34
|
-
|
|
50
|
+
]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|