@statorjs/stator 2.11.0-next.2 → 2.11.0-next.3
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/package.json +14 -14
- package/src/server/logger.ts +22 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statorjs/stator",
|
|
3
|
-
"version": "2.11.0-next.
|
|
3
|
+
"version": "2.11.0-next.3",
|
|
4
4
|
"description": "Server-canonical web framework: business logic in composable state machines, UI as a thin renderer binding machine outputs to DOM positions. Ships TypeScript source, loaded natively by its own toolchain — no build step.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -74,16 +74,16 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@hono/node-server": "^1.
|
|
77
|
+
"@hono/node-server": "^1.19.17",
|
|
78
78
|
"chokidar": "^4.0.3",
|
|
79
|
-
"esbuild": "^0.
|
|
80
|
-
"hono": "^4.
|
|
79
|
+
"esbuild": "^0.28.2",
|
|
80
|
+
"hono": "^4.13.13",
|
|
81
81
|
"ioredis": "^5.10.1",
|
|
82
|
-
"pino": "^10.
|
|
83
|
-
"postcss": "^8.5.
|
|
84
|
-
"postcss-selector-parser": "^7.1.
|
|
82
|
+
"pino": "^10.4.0",
|
|
83
|
+
"postcss": "^8.5.31",
|
|
84
|
+
"postcss-selector-parser": "^7.1.7",
|
|
85
85
|
"schema-dts": "^1.1.5",
|
|
86
|
-
"sharp": "^0.
|
|
86
|
+
"sharp": "^0.35.5",
|
|
87
87
|
"typescript": "^5.6.0",
|
|
88
88
|
"zod": "^3.23.0"
|
|
89
89
|
},
|
|
@@ -96,12 +96,12 @@
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@types/node": "^22.
|
|
100
|
-
"happy-dom": "^
|
|
101
|
-
"pino-pretty": "^13.
|
|
102
|
-
"vite": "^6.
|
|
103
|
-
"vitest": "^2.
|
|
104
|
-
"@statorjs/stator": "2.11.0-next.
|
|
99
|
+
"@types/node": "^22.20.5",
|
|
100
|
+
"happy-dom": "^21.0.4",
|
|
101
|
+
"pino-pretty": "^13.2.0",
|
|
102
|
+
"vite": "^6.4.5",
|
|
103
|
+
"vitest": "^3.2.7",
|
|
104
|
+
"@statorjs/stator": "2.11.0-next.3"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"typecheck": "tsc --noEmit",
|
package/src/server/logger.ts
CHANGED
|
@@ -12,15 +12,21 @@ import pino, { type Logger } from 'pino'
|
|
|
12
12
|
* scoped context. The framework uses scoped children for SSE events,
|
|
13
13
|
* fan-out, and HTTP request lines.
|
|
14
14
|
*/
|
|
15
|
+
type PrettyFactory = (opts: Record<string, unknown>) => NodeJS.WritableStream
|
|
16
|
+
|
|
15
17
|
/** pino-pretty is an optional nicety, not a framework dependency — apps add
|
|
16
18
|
* it as a devDependency for colored dev output (the create-stator template
|
|
17
|
-
* does). Without it, dev logs are plain JSON rather than a crash.
|
|
18
|
-
|
|
19
|
+
* does). Without it, dev logs are plain JSON rather than a crash.
|
|
20
|
+
*
|
|
21
|
+
* It runs in-process as pino's destination stream, not as a pino transport:
|
|
22
|
+
* a transport is a worker thread that pino locates by sniffing its callers'
|
|
23
|
+
* script names, which a module evaluated by a Vite SSR runner doesn't have.
|
|
24
|
+
* Dev-only prettifying has no need for a worker. */
|
|
25
|
+
export function loadPinoPretty(): PrettyFactory | null {
|
|
19
26
|
try {
|
|
20
|
-
createRequire(import.meta.url)
|
|
21
|
-
return true
|
|
27
|
+
return createRequire(import.meta.url)('pino-pretty') as PrettyFactory
|
|
22
28
|
} catch {
|
|
23
|
-
return
|
|
29
|
+
return null
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
|
|
@@ -28,22 +34,17 @@ function buildLogger(): Logger {
|
|
|
28
34
|
const isProd = process.env.NODE_ENV === 'production'
|
|
29
35
|
const level = process.env.LOG_LEVEL ?? (isProd ? 'warn' : 'info')
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ignore: 'pid,hostname',
|
|
43
|
-
singleLine: false,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
})
|
|
37
|
+
const pretty = isProd ? null : loadPinoPretty()
|
|
38
|
+
if (!pretty) return pino({ level })
|
|
39
|
+
return pino(
|
|
40
|
+
{ level },
|
|
41
|
+
pretty({
|
|
42
|
+
colorize: true,
|
|
43
|
+
translateTime: 'HH:MM:ss.l',
|
|
44
|
+
ignore: 'pid,hostname',
|
|
45
|
+
singleLine: false,
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export const logger: Logger = buildLogger()
|