wattpm 3.28.0-alpha.1 → 3.28.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/lib/commands/pprof.js +18 -7
- package/lib/commands/repl.js +43 -6
- package/package.json +5 -5
- package/schema.json +32 -1
package/lib/commands/pprof.js
CHANGED
|
@@ -11,7 +11,8 @@ export async function pprofStartCommand (logger, args) {
|
|
|
11
11
|
args,
|
|
12
12
|
{
|
|
13
13
|
type: { type: 'string', short: 't', default: 'cpu' },
|
|
14
|
-
'source-maps': { type: 'boolean', short: 's', default: false }
|
|
14
|
+
'source-maps': { type: 'boolean', short: 's', default: false },
|
|
15
|
+
'node-modules-source-maps': { type: 'string', short: 'n' }
|
|
15
16
|
},
|
|
16
17
|
false
|
|
17
18
|
)
|
|
@@ -35,6 +36,11 @@ export async function pprofStartCommand (logger, args) {
|
|
|
35
36
|
options.sourceMaps = true
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
// Add nodeModulesSourceMaps option if provided (comma-separated list of module names)
|
|
40
|
+
if (values['node-modules-source-maps']) {
|
|
41
|
+
options.nodeModulesSourceMaps = values['node-modules-source-maps'].split(',').map(s => s.trim())
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
if (applicationId) {
|
|
39
45
|
// Start profiling for specific application
|
|
40
46
|
const application = runtimeApplications.find(s => s.id === applicationId)
|
|
@@ -163,6 +169,10 @@ export const help = {
|
|
|
163
169
|
{
|
|
164
170
|
name: '--source-maps, -s',
|
|
165
171
|
description: 'Enable source map support to resolve TypeScript and other transpiled code locations in profiles'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: '--node-modules-source-maps, -n',
|
|
175
|
+
description: 'Comma-separated list of node_modules packages to load source maps from (e.g., "next,@next/next-server")'
|
|
166
176
|
}
|
|
167
177
|
],
|
|
168
178
|
args: [
|
|
@@ -183,11 +193,12 @@ export const help = {
|
|
|
183
193
|
footer:
|
|
184
194
|
'Use "pprof start [application]" to start profiling and "pprof stop [application]" to stop and save profile data.\n' +
|
|
185
195
|
'Examples:\n' +
|
|
186
|
-
' wattpm pprof start --type=cpu my-app
|
|
187
|
-
' wattpm pprof start --type=heap my-app
|
|
188
|
-
' wattpm pprof start --source-maps my-app
|
|
189
|
-
' wattpm pprof start --type=cpu --source-maps my-app
|
|
190
|
-
' wattpm pprof
|
|
191
|
-
' wattpm pprof stop --type=
|
|
196
|
+
' wattpm pprof start --type=cpu my-app # Start CPU profiling\n' +
|
|
197
|
+
' wattpm pprof start --type=heap my-app # Start heap profiling\n' +
|
|
198
|
+
' wattpm pprof start --source-maps my-app # Start CPU profiling with source maps\n' +
|
|
199
|
+
' wattpm pprof start --type=cpu --source-maps my-app # Start CPU profiling with source maps\n' +
|
|
200
|
+
' wattpm pprof start -s -n next,@next/next-server my-app # Profile with Next.js source maps\n' +
|
|
201
|
+
' wattpm pprof stop --type=cpu my-app # Stop CPU profiling\n' +
|
|
202
|
+
' wattpm pprof stop --type=heap my-app # Stop heap profiling'
|
|
192
203
|
}
|
|
193
204
|
}
|
package/lib/commands/repl.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { getMatchingRuntime, RuntimeApiClient } from '@platformatic/control'
|
|
2
2
|
import { ensureLoggableError, logFatalError, parseArgs } from '@platformatic/foundation'
|
|
3
|
+
import { bold } from 'colorette'
|
|
3
4
|
import { createInterface } from 'node:readline'
|
|
5
|
+
import { getBorderCharacters, table } from 'table'
|
|
6
|
+
|
|
7
|
+
const tableConfig = {
|
|
8
|
+
/* c8 ignore next */
|
|
9
|
+
border: getBorderCharacters(process.stdout.isTTY ? 'norc' : 'ramac'),
|
|
10
|
+
drawHorizontalLine (index, rowCount) {
|
|
11
|
+
return index < 2 || index === rowCount
|
|
12
|
+
}
|
|
13
|
+
}
|
|
4
14
|
|
|
5
15
|
export async function replCommand (logger, args) {
|
|
6
16
|
const { positionals: allPositionals } = parseArgs(args, {}, false)
|
|
@@ -11,8 +21,28 @@ export async function replCommand (logger, args) {
|
|
|
11
21
|
let application = positionals[0]
|
|
12
22
|
|
|
13
23
|
if (!application) {
|
|
14
|
-
const
|
|
15
|
-
|
|
24
|
+
const { applications } = await client.getRuntimeApplications(runtime.pid)
|
|
25
|
+
|
|
26
|
+
if (applications.length === 1) {
|
|
27
|
+
// Auto-connect if there's only one application
|
|
28
|
+
application = applications[0].id
|
|
29
|
+
} else {
|
|
30
|
+
// List available applications when there are multiple
|
|
31
|
+
console.log('\nAvailable applications:')
|
|
32
|
+
const rows = applications.map(app => {
|
|
33
|
+
const { id, type, entrypoint } = app
|
|
34
|
+
return [id, type, entrypoint ? 'Yes' : 'No']
|
|
35
|
+
})
|
|
36
|
+
console.log(
|
|
37
|
+
table(
|
|
38
|
+
[[bold('Name'), bold('Type'), bold('Entrypoint')], ...rows],
|
|
39
|
+
tableConfig
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
console.log('Usage: wattpm repl <application-name>\n')
|
|
43
|
+
await client.close()
|
|
44
|
+
return
|
|
45
|
+
}
|
|
16
46
|
}
|
|
17
47
|
|
|
18
48
|
const ws = client.getRuntimeApplicationRepl(runtime.pid, application)
|
|
@@ -34,6 +64,13 @@ export async function replCommand (logger, args) {
|
|
|
34
64
|
ws.send(line + '\n')
|
|
35
65
|
})
|
|
36
66
|
|
|
67
|
+
// Handle Ctrl+D (EOF)
|
|
68
|
+
rl.on('close', () => {
|
|
69
|
+
ws.close()
|
|
70
|
+
client.close()
|
|
71
|
+
process.exit(0)
|
|
72
|
+
})
|
|
73
|
+
|
|
37
74
|
// Forward WebSocket output to stdout
|
|
38
75
|
ws.on('message', (data) => {
|
|
39
76
|
process.stdout.write(data.toString())
|
|
@@ -79,17 +116,17 @@ export async function replCommand (logger, args) {
|
|
|
79
116
|
|
|
80
117
|
export const help = {
|
|
81
118
|
repl: {
|
|
82
|
-
usage: 'repl [id]
|
|
119
|
+
usage: 'repl [id] <application>',
|
|
83
120
|
description: 'Starts a REPL session inside a running application',
|
|
84
121
|
args: [
|
|
85
122
|
{
|
|
86
123
|
name: 'id',
|
|
87
124
|
description:
|
|
88
|
-
'The process ID or the name of the
|
|
125
|
+
'The process ID or the name of the runtime (it can be omitted only if there is a single runtime running)'
|
|
89
126
|
},
|
|
90
127
|
{
|
|
91
128
|
name: 'application',
|
|
92
|
-
description: 'The application name (
|
|
129
|
+
description: 'The application name (if omitted, auto-connects when single application or lists available applications)'
|
|
93
130
|
}
|
|
94
131
|
],
|
|
95
132
|
footer: `
|
|
@@ -101,7 +138,7 @@ You have access to:
|
|
|
101
138
|
- config: The application configuration
|
|
102
139
|
- logger: The application logger
|
|
103
140
|
|
|
104
|
-
Press Ctrl+C or type .exit to exit the REPL.
|
|
141
|
+
Press Ctrl+C, Ctrl+D, or type .exit to exit the REPL.
|
|
105
142
|
`
|
|
106
143
|
}
|
|
107
144
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wattpm",
|
|
3
|
-
"version": "3.28.
|
|
3
|
+
"version": "3.28.2",
|
|
4
4
|
"description": "The Node.js Application Server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"pino-pretty": "^13.0.0",
|
|
30
30
|
"split2": "^4.2.0",
|
|
31
31
|
"table": "^6.8.2",
|
|
32
|
-
"@platformatic/
|
|
33
|
-
"@platformatic/
|
|
34
|
-
"@platformatic/
|
|
32
|
+
"@platformatic/foundation": "3.28.2",
|
|
33
|
+
"@platformatic/runtime": "3.28.2",
|
|
34
|
+
"@platformatic/control": "3.28.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"cleaner-spec-reporter": "^0.5.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"neostandard": "^0.12.0",
|
|
43
43
|
"typescript": "^5.5.4",
|
|
44
44
|
"undici": "^7.0.0",
|
|
45
|
-
"@platformatic/node": "3.28.
|
|
45
|
+
"@platformatic/node": "3.28.2"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/wattpm/3.28.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/wattpm/3.28.2.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Runtime Config",
|
|
5
5
|
"type": "object",
|
|
@@ -227,6 +227,12 @@
|
|
|
227
227
|
"sourceMaps": {
|
|
228
228
|
"type": "boolean"
|
|
229
229
|
},
|
|
230
|
+
"nodeModulesSourceMaps": {
|
|
231
|
+
"type": "array",
|
|
232
|
+
"items": {
|
|
233
|
+
"type": "string"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
230
236
|
"packageManager": {
|
|
231
237
|
"type": "string",
|
|
232
238
|
"enum": [
|
|
@@ -525,6 +531,12 @@
|
|
|
525
531
|
"sourceMaps": {
|
|
526
532
|
"type": "boolean"
|
|
527
533
|
},
|
|
534
|
+
"nodeModulesSourceMaps": {
|
|
535
|
+
"type": "array",
|
|
536
|
+
"items": {
|
|
537
|
+
"type": "string"
|
|
538
|
+
}
|
|
539
|
+
},
|
|
528
540
|
"packageManager": {
|
|
529
541
|
"type": "string",
|
|
530
542
|
"enum": [
|
|
@@ -821,6 +833,12 @@
|
|
|
821
833
|
"sourceMaps": {
|
|
822
834
|
"type": "boolean"
|
|
823
835
|
},
|
|
836
|
+
"nodeModulesSourceMaps": {
|
|
837
|
+
"type": "array",
|
|
838
|
+
"items": {
|
|
839
|
+
"type": "string"
|
|
840
|
+
}
|
|
841
|
+
},
|
|
824
842
|
"packageManager": {
|
|
825
843
|
"type": "string",
|
|
826
844
|
"enum": [
|
|
@@ -1117,6 +1135,12 @@
|
|
|
1117
1135
|
"sourceMaps": {
|
|
1118
1136
|
"type": "boolean"
|
|
1119
1137
|
},
|
|
1138
|
+
"nodeModulesSourceMaps": {
|
|
1139
|
+
"type": "array",
|
|
1140
|
+
"items": {
|
|
1141
|
+
"type": "string"
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1120
1144
|
"packageManager": {
|
|
1121
1145
|
"type": "string",
|
|
1122
1146
|
"enum": [
|
|
@@ -2388,6 +2412,13 @@
|
|
|
2388
2412
|
"type": "boolean",
|
|
2389
2413
|
"default": false
|
|
2390
2414
|
},
|
|
2415
|
+
"nodeModulesSourceMaps": {
|
|
2416
|
+
"type": "array",
|
|
2417
|
+
"items": {
|
|
2418
|
+
"type": "string"
|
|
2419
|
+
},
|
|
2420
|
+
"default": []
|
|
2421
|
+
},
|
|
2391
2422
|
"scheduler": {
|
|
2392
2423
|
"type": "array",
|
|
2393
2424
|
"items": {
|