@nodefony/frontend 10.0.0-beta.1 → 10.0.0-beta.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 +20 -20
- package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/decorateMetadata.js +1 -1
- package/dist/index.js +2 -2
- package/dist/nodefony/service/FrontendService.js +2 -2
- package/package.json +10 -11
package/README.md
CHANGED
|
@@ -21,16 +21,17 @@ Vite a besoin d'un event-loop et d'un tas V8 pour compiler/HMR. L'exécuter **in
|
|
|
21
21
|
|
|
22
22
|
### 1. Activer `@nodefony/frontend` dans l'app
|
|
23
23
|
|
|
24
|
-
Dans `
|
|
24
|
+
Dans `nodefony.config.ts` :
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
export default defineConfig(() => ({
|
|
28
|
+
modules: [
|
|
29
|
+
"@nodefony/http",
|
|
30
|
+
"@nodefony/framework",
|
|
31
|
+
"@nodefony/frontend", // ← avant ton module consumer
|
|
32
|
+
"@nodefony/mon-module",
|
|
33
|
+
],
|
|
34
|
+
}));
|
|
34
35
|
```
|
|
35
36
|
|
|
36
37
|
> **Ordre important** : `@nodefony/frontend` doit être déclaré AVANT les modules qui appellent `registerEntry()` — sinon le service `frontend` n'existe pas dans le DI Container au moment du `onKernelBoot()` du consumer.
|
|
@@ -163,7 +164,7 @@ Le superviseur Vite démarre automatiquement sur l'event `onServersReady` du ker
|
|
|
163
164
|
|
|
164
165
|
```
|
|
165
166
|
INFO frontend : registered entry: my-module (react19) from "my-module"
|
|
166
|
-
INFO frontend : vite
|
|
167
|
+
INFO frontend : vite [default] ready on 127.0.0.1:5173
|
|
167
168
|
```
|
|
168
169
|
|
|
169
170
|
Va sur `http://127.0.0.1:5151/my-route/` — Nodefony rend l'HTML, le browser tape Vite (5173) pour les assets, HMR fonctionne en édition de `App.tsx`.
|
|
@@ -239,12 +240,13 @@ svc.on("frontend:ready", (status) => {
|
|
|
239
240
|
|
|
240
241
|
```ts
|
|
241
242
|
interface IFrontendService {
|
|
242
|
-
registerEntry(module, declaration): IResolvedFrontendEntry;
|
|
243
243
|
listEntries(): ReadonlyArray<IResolvedFrontendEntry>;
|
|
244
244
|
status(): IViteSupervisorStatus;
|
|
245
|
+
statusAll(): ReadonlyArray<{ family: string; status: IViteSupervisorStatus }>;
|
|
245
246
|
startDev(): Promise<void>; // appelé auto par onServersReady
|
|
246
247
|
stopDev(): Promise<void>;
|
|
247
|
-
|
|
248
|
+
// vite.build() par entrée ; bilan construits / ignorés / en échec
|
|
249
|
+
build(opts?: { force?: boolean }): Promise<IFrontendBuildResult>;
|
|
248
250
|
// `nonce` = `Context.cspNonce` ; `requestHost` = `Context.domain` (sans port),
|
|
249
251
|
// dont l'origine des assets est dérivée en développement.
|
|
250
252
|
renderTags(entryName, nonce?, requestHost?): string;
|
|
@@ -253,20 +255,18 @@ interface IFrontendService {
|
|
|
253
255
|
}
|
|
254
256
|
```
|
|
255
257
|
|
|
258
|
+
`registerEntry(module, declaration)` est porté par la classe `FrontendService`, pas par l'interface.
|
|
259
|
+
|
|
256
260
|
---
|
|
257
261
|
|
|
258
262
|
## Troubleshooting
|
|
259
263
|
|
|
260
264
|
### Page blanche, scripts bloqués par CSP
|
|
261
265
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
"Content-Security-Policy",
|
|
267
|
-
svc.getCspDirectives(),
|
|
268
|
-
);
|
|
269
|
-
```
|
|
266
|
+
En développement, le service déclare les origines Vite au pare-feu (`@nodefony/security`) une fois
|
|
267
|
+
Vite prêt, et ce dernier émet UN seul en-tête CSP avec le nonce de la requête. Vérifie que tu passes
|
|
268
|
+
`this.context?.cspNonce` à `svc.renderTags(…)` / `renderDocument(…)`, et ne réécris jamais l'en-tête
|
|
269
|
+
dans le contrôleur : tu écraserais le nonce.
|
|
270
270
|
|
|
271
271
|
### `Unexpected token '<'` sur `fetch("/api/...")`
|
|
272
272
|
|
|
@@ -319,7 +319,7 @@ FrontendService.startDev()
|
|
|
319
319
|
↓
|
|
320
320
|
ViteProcessSupervisor.start()
|
|
321
321
|
├─ écrit vite.config.generated.mjs (proxy, https, base, env)
|
|
322
|
-
├─ spawn(
|
|
322
|
+
├─ spawn(node, [vite.js, "--config", ...]) (repli npx si le binaire n'est pas résolu)
|
|
323
323
|
├─ parse stdout "Local: https://host:port" → state = "ready"
|
|
324
324
|
├─ attach exit handler (auto-restart si crash inattendu)
|
|
325
325
|
└─ start health check loop (ping HTTP périodique)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/decorate.js
|
|
2
2
|
function __decorate(decorators, target, key, desc) {
|
|
3
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/decorateMetadata.js
|
|
2
2
|
function __decorateMetadata(k, v) {
|
|
3
3
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4
4
|
}
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,8 @@ import { ViteBuilder } from "./nodefony/src/builders/ViteBuilder.js";
|
|
|
10
10
|
import { ViteConfigGenerator } from "./nodefony/service/ViteConfigGenerator.js";
|
|
11
11
|
import { ViteProcessSupervisor } from "./nodefony/service/ViteProcessSupervisor.js";
|
|
12
12
|
import { TemplateHelper } from "./nodefony/src/template/TemplateHelper.js";
|
|
13
|
-
import __decorateMetadata from "./_virtual/_@oxc-project_runtime@0.
|
|
14
|
-
import __decorate from "./_virtual/_@oxc-project_runtime@0.
|
|
13
|
+
import __decorateMetadata from "./_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
14
|
+
import __decorate from "./_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
15
15
|
import FrontendService_default from "./nodefony/service/FrontendService.js";
|
|
16
16
|
import { buildFrontendStatus, createFrontendAdminApi } from "./nodefony/src/FrontendAdminApi.js";
|
|
17
17
|
import FrontendBuild from "./nodefony/command/frontend-build.js";
|
|
@@ -5,8 +5,8 @@ import { allowedHostPatternForTemplate, detectRemoteDev, isLoopbackHostname, isV
|
|
|
5
5
|
import { ViteProcessSupervisor } from "./ViteProcessSupervisor.js";
|
|
6
6
|
import { TemplateHelper } from "../src/template/TemplateHelper.js";
|
|
7
7
|
import { familyPortBlocks, familyPortPlan, isolationGroup } from "../src/isolationGroups.js";
|
|
8
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
9
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
8
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
9
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
10
10
|
import { FRONTEND_CHOICES, Module, Service, extend, injectable, stripTrailingSlashes } from "nodefony";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import fs from "node:fs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodefony/frontend",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.2",
|
|
4
4
|
"description": "Construction et rechargement à chaud des frontends de chaque module Nodefony — Vite intégré, multi-framework (React, Vue, Angular, Svelte)",
|
|
5
5
|
"author": "Christophe CAMENSULI <ccamensuli@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -36,21 +36,20 @@
|
|
|
36
36
|
"esm"
|
|
37
37
|
],
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@nodefony/framework": "^10.0.0-beta.
|
|
40
|
-
"@nodefony/http": "^10.0.0-beta.
|
|
41
|
-
"nodefony": "^10.0.0-beta.
|
|
39
|
+
"@nodefony/framework": "^10.0.0-beta.2",
|
|
40
|
+
"@nodefony/http": "^10.0.0-beta.2",
|
|
41
|
+
"nodefony": "^10.0.0-beta.2",
|
|
42
42
|
"zod": "^4.6.5"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@nodefony/framework": "^10.0.0-beta.
|
|
46
|
-
"@nodefony/http": "^10.0.0-beta.
|
|
45
|
+
"@nodefony/framework": "^10.0.0-beta.2",
|
|
46
|
+
"@nodefony/http": "^10.0.0-beta.2",
|
|
47
47
|
"@types/chai": "5.2.3",
|
|
48
48
|
"@types/node": "26.6.3",
|
|
49
|
-
"@vitest/coverage-v8": "5.0.
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"vitest": "5.0.2"
|
|
49
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
50
|
+
"nodefony": "^10.0.0-beta.2",
|
|
51
|
+
"vite": "8.3.2",
|
|
52
|
+
"vitest": "5.0.3"
|
|
54
53
|
},
|
|
55
54
|
"private": false,
|
|
56
55
|
"engines": {
|