@nodefony/frontend 10.0.0-beta.6 → 10.0.0-beta.8

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,4 +1,4 @@
1
- // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
1
+ // \0@oxc-project+runtime@0.158.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);
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { buildFrontendStatus, createFrontendAdminApi } from "./nodefony/src/Fron
5
5
  import FrontendBuild from "./nodefony/command/frontend-build.js";
6
6
  import FrontendDev from "./nodefony/command/frontend-dev.js";
7
7
  import FrontendStatus from "./nodefony/command/frontend-status.js";
8
- import __decorate from "./_virtual/_@oxc-project_runtime@0.157.0/helpers/esm/decorate.js";
8
+ import __decorate from "./_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/decorate.js";
9
9
  import { ViteBuilder } from "./nodefony/src/builders/ViteBuilder.js";
10
10
  import { ViteProcessSupervisor } from "./nodefony/service/ViteProcessSupervisor.js";
11
11
  import { ViteConfigGenerator } from "./nodefony/service/ViteConfigGenerator.js";
@@ -5,7 +5,7 @@ import { FrontendNoEntriesError, FrontendSupervisorStartError } from "../src/err
5
5
  import { devBasePath, familyPortPlan, isolationGroup } from "../src/isolationGroups.js";
6
6
  import config from "../config/config.js";
7
7
  import { summarizeFrontendBoot } from "./bootSummary.js";
8
- import __decorate from "../../_virtual/_@oxc-project_runtime@0.157.0/helpers/esm/decorate.js";
8
+ import __decorate from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/decorate.js";
9
9
  import { FRONTEND_CHOICES, Service, extend, injectable, stripTrailingSlashes } from "nodefony";
10
10
  import path from "node:path";
11
11
  import fs from "node:fs";
@@ -248,6 +248,7 @@ let FrontendService = class FrontendService extends Service {
248
248
  logger: {
249
249
  info: (m) => this.log(`[${family}] ${m}`, "INFO"),
250
250
  error: (m) => this.log(`[${family}] ${m}`, "ERROR"),
251
+ warn: (m) => this.log(`[${family}] ${m}`, "WARNING"),
251
252
  debug: (m) => this.log(`[${family}] ${m}`, "DEBUG")
252
253
  }
253
254
  });
@@ -94,6 +94,22 @@ function isPortInUseMessage(text) {
94
94
  return /EADDRINUSE/i.test(text) || /address already in use/i.test(text) || /port\s+\d+\s+is\s+already\s+in use/i.test(text);
95
95
  }
96
96
  /**
97
+ * Une ligne que Vite écrit sur sa sortie d'ERREUR est-elle un avertissement sur
98
+ * un démarrage RÉUSSI ?
99
+ *
100
+ * Vite émet `Port X is in use on a wildcard address, but H:X is available…` par
101
+ * `logger.warn` (donc sur stderr) après un `listen` qui a RÉUSSI (cf
102
+ * {@link isPortInUseMessage}). Relayée en ERROR, elle laissait une ligne rouge
103
+ * dans un démarrage sain. Vu sous Windows, où la pile réseau signale ce cas
104
+ * quand un autre serveur écoute sur la même plage de ports.
105
+ *
106
+ * @param line - une ligne de sortie, sans codes ANSI ni préfixe `[vite]`.
107
+ * @returns `true` si la ligne doit partir en avertissement, pas en erreur.
108
+ */
109
+ function isViteNonFatalWarning(line) {
110
+ return /port\s+\d+\s+is\s+in use on a wildcard address/i.test(line);
111
+ }
112
+ /**
97
113
  * Message d'échec d'un boot qui n'a jamais rendu la main dans le temps imparti —
98
114
  * en y REPORTANT ce que vite avait déjà dit.
99
115
  *
@@ -259,7 +275,7 @@ var ViteProcessSupervisor = class {
259
275
  } catch (e) {
260
276
  lastErr = e instanceof Error ? e : new Error(String(e));
261
277
  if (this.isPortInUseError(lastErr) && i < maxAttempts) {
262
- this.opts.logger.info(`port ${port} unavailable — retrying on ${port + 1}`);
278
+ this.opts.logger.info(`port ${port} déjà occupé — Vite relancé sur ${port + 1}`);
263
279
  this.portRetries += 1;
264
280
  continue;
265
281
  }
@@ -347,6 +363,7 @@ var ViteProcessSupervisor = class {
347
363
  if (resolved) return;
348
364
  resolved = true;
349
365
  this.state = "errored";
366
+ flushStderr();
350
367
  if (child.exitCode === null && child.signalCode === null) this.signalTree(child, "SIGKILL");
351
368
  const msg = startupTimeoutMessage(this.opts.startupTimeoutMs, buffer);
352
369
  this.lastError = msg;
@@ -356,13 +373,21 @@ var ViteProcessSupervisor = class {
356
373
  const ansiRe = /\x1b\[[0-9;]*m/g;
357
374
  const viteOwnPrefixRe = /^\d{1,2}:\d{2}:\d{2}\s+\[vite\]\s*|^\[vite\]\s*/;
358
375
  let buffer = "";
376
+ let heldStderr = "";
377
+ const flushStderr = () => {
378
+ if (heldStderr !== "") pipeClean(heldStderr, "error");
379
+ heldStderr = "";
380
+ };
359
381
  const pipeClean = (raw, level) => {
360
382
  if (!this.opts.pipeLogs) return;
361
383
  for (const line of raw.split(/\r?\n/)) {
362
384
  const stripped = line.replace(ansiRe, "").replace(viteOwnPrefixRe, "").trim();
363
385
  if (!stripped) continue;
364
- if (level === "error") this.opts.logger.error(`[vite] ${stripped}`);
365
- else this.opts.logger.info(`[vite] ${stripped}`);
386
+ const logger = this.opts.logger;
387
+ if (level === "info") logger.info(`[vite] ${stripped}`);
388
+ else if (!isViteNonFatalWarning(stripped)) logger.error(`[vite] ${stripped}`);
389
+ else if (logger.warn) logger.warn(`[vite] ${stripped}`);
390
+ else logger.info(`[vite] ${stripped}`);
366
391
  }
367
392
  };
368
393
  const onStdout = (chunk) => {
@@ -377,14 +402,18 @@ var ViteProcessSupervisor = class {
377
402
  this.healthFailures = 0;
378
403
  resolved = true;
379
404
  buffer = "";
405
+ flushStderr();
380
406
  clearTimeout(timeout);
381
407
  resolve();
382
408
  }
383
409
  };
384
410
  const onStderr = (chunk) => {
385
411
  const txt = chunk.toString();
386
- pipeClean(txt, "error");
387
- if (resolved) return;
412
+ if (resolved) {
413
+ pipeClean(txt, "error");
414
+ return;
415
+ }
416
+ heldStderr += txt;
388
417
  buffer += txt.replace(ansiRe, "");
389
418
  const [, , port] = buffer.match(localRe) ?? [];
390
419
  if (port !== void 0) {
@@ -393,6 +422,7 @@ var ViteProcessSupervisor = class {
393
422
  this.healthFailures = 0;
394
423
  resolved = true;
395
424
  buffer = "";
425
+ flushStderr();
396
426
  clearTimeout(timeout);
397
427
  resolve();
398
428
  }
@@ -402,6 +432,7 @@ var ViteProcessSupervisor = class {
402
432
  resolved = true;
403
433
  clearTimeout(timeout);
404
434
  if (this.willingShutdown) {
435
+ heldStderr = "";
405
436
  this.state = "stopped";
406
437
  this.lastError = null;
407
438
  reject(new FrontendSupervisorStartError("arrêt demandé pendant le boot de vite (shutdown, pas une panne)"));
@@ -410,13 +441,19 @@ var ViteProcessSupervisor = class {
410
441
  const msg = exitBeforeReadyMessage(code, signal, buffer);
411
442
  this.state = "errored";
412
443
  this.lastError = msg;
413
- if (isPortInUseMessage(buffer)) reject(new FrontendSupervisorStartError("EADDRINUSE: " + msg));
414
- else reject(new FrontendSupervisorStartError(msg));
444
+ if (isPortInUseMessage(buffer)) {
445
+ heldStderr = "";
446
+ reject(new FrontendSupervisorStartError("EADDRINUSE: " + msg));
447
+ } else {
448
+ flushStderr();
449
+ reject(new FrontendSupervisorStartError(msg));
450
+ }
415
451
  }
416
452
  };
417
453
  const onError = (err) => {
418
454
  if (resolved) return;
419
455
  resolved = true;
456
+ flushStderr();
420
457
  clearTimeout(timeout);
421
458
  this.state = "errored";
422
459
  this.lastError = err.message;
@@ -633,4 +670,4 @@ var ViteProcessSupervisor = class {
633
670
  this.childListeners = [];
634
671
  }
635
672
  };
636
- export { ViteProcessSupervisor, ViteProcessSupervisor as default, browserReachableHost, exitBeforeReadyMessage, isPortInUseMessage, startupTimeoutMessage };
673
+ export { ViteProcessSupervisor, ViteProcessSupervisor as default, browserReachableHost, exitBeforeReadyMessage, isPortInUseMessage, isViteNonFatalWarning, startupTimeoutMessage };
@@ -17,6 +17,11 @@ export declare function browserReachableHost(listenHost: string): string;
17
17
  export interface IViteSupervisorLogger {
18
18
  info(msg: string): void;
19
19
  error(msg: string): void;
20
+ /**
21
+ * Avertissement NON fatal de Vite (cf {@link isViteNonFatalWarning}).
22
+ * Absent → la ligne part en `info`, jamais en `error`.
23
+ */
24
+ warn?(msg: string): void;
20
25
  debug?(msg: string): void;
21
26
  }
22
27
  export interface ViteSupervisorOptions {
@@ -102,6 +107,20 @@ export interface ViteSupervisorOptions {
102
107
  * tenaient en 300 à 700 ms.
103
108
  */
104
109
  export declare function isPortInUseMessage(text: string): boolean;
110
+ /**
111
+ * Une ligne que Vite écrit sur sa sortie d'ERREUR est-elle un avertissement sur
112
+ * un démarrage RÉUSSI ?
113
+ *
114
+ * Vite émet `Port X is in use on a wildcard address, but H:X is available…` par
115
+ * `logger.warn` (donc sur stderr) après un `listen` qui a RÉUSSI (cf
116
+ * {@link isPortInUseMessage}). Relayée en ERROR, elle laissait une ligne rouge
117
+ * dans un démarrage sain. Vu sous Windows, où la pile réseau signale ce cas
118
+ * quand un autre serveur écoute sur la même plage de ports.
119
+ *
120
+ * @param line - une ligne de sortie, sans codes ANSI ni préfixe `[vite]`.
121
+ * @returns `true` si la ligne doit partir en avertissement, pas en erreur.
122
+ */
123
+ export declare function isViteNonFatalWarning(line: string): boolean;
105
124
  /**
106
125
  * Message d'échec d'un boot qui n'a jamais rendu la main dans le temps imparti —
107
126
  * en y REPORTANT ce que vite avait déjà dit.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodefony/frontend",
3
- "version": "10.0.0-beta.6",
3
+ "version": "10.0.0-beta.8",
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,24 +36,24 @@
36
36
  "esm"
37
37
  ],
38
38
  "peerDependencies": {
39
- "@nodefony/framework": "^10.0.0-beta.6",
40
- "@nodefony/http": "^10.0.0-beta.6",
41
- "nodefony": "^10.0.0-beta.6",
39
+ "@nodefony/framework": "^10.0.0-beta.8",
40
+ "@nodefony/http": "^10.0.0-beta.8",
41
+ "nodefony": "^10.0.0-beta.8",
42
42
  "zod": "^4.6.7"
43
43
  },
44
44
  "devDependencies": {
45
- "@nodefony/framework": "^10.0.0-beta.6",
46
- "@nodefony/http": "^10.0.0-beta.6",
45
+ "@nodefony/framework": "^10.0.0-beta.8",
46
+ "@nodefony/http": "^10.0.0-beta.8",
47
47
  "@types/chai": "5.2.3",
48
48
  "@types/node": "26.6.6",
49
49
  "@vitest/coverage-v8": "5.1.0",
50
- "nodefony": "^10.0.0-beta.6",
51
- "vite": "8.3.6",
50
+ "nodefony": "^10.0.0-beta.8",
51
+ "vite": "8.3.8",
52
52
  "vitest": "5.1.0"
53
53
  },
54
54
  "private": false,
55
55
  "engines": {
56
- "node": ">=24.14.0"
56
+ "node": "^24.16.0 || >=26.0.0"
57
57
  },
58
58
  "license": "Apache-2.0",
59
59
  "dependencies": {
@@ -71,7 +71,7 @@
71
71
  "url": "git+https://github.com/nodefony/nodefony-core.git",
72
72
  "directory": "src/packages/@nodefony/frontend"
73
73
  },
74
- "homepage": "https://nodefony.github.io/nodefony-core/",
74
+ "homepage": "https://nodefony.net/",
75
75
  "bugs": {
76
76
  "url": "https://github.com/nodefony/nodefony-core/issues"
77
77
  }