@tracepanel/js 0.9.2 → 0.10.0
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 +49 -2
- package/dist/api.d.ts +10 -0
- package/dist/api.js +12 -0
- package/dist/api.js.map +1 -1
- package/dist/browser.js +21 -3
- package/dist/browser.js.map +1 -1
- package/dist/bullmq.d.ts +7 -0
- package/dist/bullmq.js +35 -3
- package/dist/bullmq.js.map +1 -1
- package/dist/bun.js +3 -3
- package/dist/bun.js.map +1 -1
- package/dist/calls.js +10 -4
- package/dist/calls.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.js +30 -2
- package/dist/config.js.map +1 -1
- package/dist/console.d.ts +3 -1
- package/dist/console.js +47 -15
- package/dist/console.js.map +1 -1
- package/dist/dumps.d.ts +52 -0
- package/dist/dumps.js +520 -0
- package/dist/dumps.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/locals.d.ts +2 -1
- package/dist/locals.js +8 -6
- package/dist/locals.js.map +1 -1
- package/dist/loggers.js +2 -2
- package/dist/loggers.js.map +1 -1
- package/dist/masking.d.ts +16 -0
- package/dist/masking.js +148 -0
- package/dist/masking.js.map +1 -0
- package/dist/next.js +6 -4
- package/dist/next.js.map +1 -1
- package/dist/nuxt-plugin.js +1 -1
- package/dist/nuxt-plugin.js.map +1 -1
- package/dist/processor.d.ts +7 -1
- package/dist/processor.js +37 -5
- package/dist/processor.js.map +1 -1
- package/dist/profile.d.ts +26 -2
- package/dist/profile.js +36 -9
- package/dist/profile.js.map +1 -1
- package/dist/request.d.ts +3 -2
- package/dist/request.js +6 -6
- package/dist/request.js.map +1 -1
- package/dist/setup.js +6 -4
- package/dist/setup.js.map +1 -1
- package/dist/stack.d.ts +41 -5
- package/dist/stack.js +392 -47
- package/dist/stack.js.map +1 -1
- package/package.json +3 -2
package/dist/dumps.js
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
// A developer's own debug output, as the Python SDK records python-devtools' debug(): a dump the call tree always
|
|
2
|
+
// shows. console.dir() and console.table() are one, and so is console.log(), .debug() or .info() of anything that
|
|
3
|
+
// is not a primitive (an object, an array, a Map, a function): that is looking into a value, not a line of the
|
|
4
|
+
// app's log. Each argument is kept as Node prints it, with its type, its length and the source text it was given
|
|
5
|
+
// as, read from the call's line. Only the app's own calls are dumps; a library's stay log lines.
|
|
6
|
+
import { Console } from "node:console";
|
|
7
|
+
import { isAbsolute } from "node:path";
|
|
8
|
+
import { Writable } from "node:stream";
|
|
9
|
+
import { format, inspect, types } from "node:util";
|
|
10
|
+
import { counted, MASK, masks, sensitive } from "./masking.js";
|
|
11
|
+
import { inApp, originOf, ownFile, parseStack, sourceLines } from "./stack.js";
|
|
12
|
+
/** How long an argument's text is at most, "… (truncated)" included. */
|
|
13
|
+
export const MAX_REPR = 16_384;
|
|
14
|
+
const TRUNCATED = "… (truncated)";
|
|
15
|
+
// A string as long as the whole may be: inspect() cuts one at 10,000 characters.
|
|
16
|
+
const INSPECT = { depth: 6, compact: false, breakLength: 80, colors: false, maxStringLength: MAX_REPR };
|
|
17
|
+
// How far past the call's start its arguments are looked for, in characters.
|
|
18
|
+
const MAX_CALL = 20_000;
|
|
19
|
+
/** The console methods whose calls can be dumps. dir() and table() always are. */
|
|
20
|
+
export const DUMPING = new Set(["log", "debug", "info", "dir", "table"]);
|
|
21
|
+
/** Whether a call to a console method is a dump: dir(), table(), or a log of a value that isn't a primitive. */
|
|
22
|
+
export function isDump(method, args) {
|
|
23
|
+
if (method === "dir" || method === "table")
|
|
24
|
+
return args.length > 0;
|
|
25
|
+
return DUMPING.has(method) && args.some(inspected);
|
|
26
|
+
}
|
|
27
|
+
/** A value that is looked into: an object or a function, not an Error (that is reported, as a log line's). */
|
|
28
|
+
function inspected(value) {
|
|
29
|
+
if (typeof value === "function" || proxy(value))
|
|
30
|
+
return true;
|
|
31
|
+
return value !== null && typeof value === "object" && !(value instanceof Error);
|
|
32
|
+
}
|
|
33
|
+
/** A proxy: looked at without its traps (instanceof and property reads would run them), as inspect() does. */
|
|
34
|
+
function proxy(value) {
|
|
35
|
+
return (typeof value === "object" || typeof value === "function") && value !== null && types.isProxy(value);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The dump of a console call, or null when the call isn't the app's own. `stack`: the stack at the call, the frames
|
|
39
|
+
* of console's wrappers (this package's, a dev overlay's) above the app's.
|
|
40
|
+
*/
|
|
41
|
+
export function dump(method, args, stack, root, sites) {
|
|
42
|
+
const site = callSite(stack, sites);
|
|
43
|
+
if (!site || !inApp(site.file, root))
|
|
44
|
+
return null;
|
|
45
|
+
// dir() and table() print their first argument; the rest are how.
|
|
46
|
+
const values = method === "dir" || method === "table" ? args.slice(0, 1) : args;
|
|
47
|
+
const exprs = expressions(site, args.length);
|
|
48
|
+
// What is shown of each argument: its secrets masked, the keys that name one as the argument's own name does.
|
|
49
|
+
const shown = args.map((value, index) => {
|
|
50
|
+
if (exprs?.[index] && masks(exprs[index], value))
|
|
51
|
+
return { value: MASK, byText: false, text: MASK };
|
|
52
|
+
const copy = masked(value);
|
|
53
|
+
const text = inspectedText(copy.value);
|
|
54
|
+
if (text !== undefined)
|
|
55
|
+
return { ...copy, text: copy.byText ? maskText(text) : text };
|
|
56
|
+
// The copy can't be shown (a class's inspect that reads its #private fields): the value is, its text masked.
|
|
57
|
+
const own = inspectedText(value);
|
|
58
|
+
return { value, byText: true, text: own === undefined ? `<unrepresentable ${typeof value}>` : maskText(own) };
|
|
59
|
+
});
|
|
60
|
+
const dumped = values.map((value, index) => {
|
|
61
|
+
const expr = exprs?.[index] ?? null;
|
|
62
|
+
if (expr !== null && masks(expr, value))
|
|
63
|
+
return { expr, repr: MASK, type: typeOf(value), len: null };
|
|
64
|
+
const repr = cut(shown[index]?.text ?? "");
|
|
65
|
+
const literal = expr !== null && (expr === repr || (typeof value === "string" && /^["'`]/.test(expr)));
|
|
66
|
+
return { expr: literal ? null : expr, repr, type: typeOf(value), len: lengthOf(value) };
|
|
67
|
+
});
|
|
68
|
+
const byText = shown.some((arg) => arg.byText);
|
|
69
|
+
const shownValues = shown.map((arg) => arg.value);
|
|
70
|
+
return {
|
|
71
|
+
time: Date.now() * 1000,
|
|
72
|
+
level: "debug",
|
|
73
|
+
logger: "console",
|
|
74
|
+
// Masked by its text: as console.log() prints it (a table would read a proxy through its traps).
|
|
75
|
+
message: byText
|
|
76
|
+
? maskText(printed(method === "table" ? "log" : method, shownValues))
|
|
77
|
+
: printed(method, shownValues),
|
|
78
|
+
exception: null,
|
|
79
|
+
attrs: {
|
|
80
|
+
"log.kind": "dump",
|
|
81
|
+
"dump.lang": "javascript",
|
|
82
|
+
"dump.args": dumped,
|
|
83
|
+
"code.origin": originOf(site, root),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The frame that called console: the first that is neither this package's, Node's, nor another console wrapper.
|
|
89
|
+
* `sites`: the stack's CallSites (captured()), each line mapped from where its code ran, exactly.
|
|
90
|
+
*/
|
|
91
|
+
function callSite(stack, sites) {
|
|
92
|
+
return parseStack(stack, true, sites).find((frame) => isAbsolute(frame.file) && !ownFile(frame.file) && !/^console\./i.test(frame.function));
|
|
93
|
+
}
|
|
94
|
+
// How deep a value is looked into for secrets: past inspect()'s depth nothing is shown.
|
|
95
|
+
const MASK_DEPTH = INSPECT.depth + 1;
|
|
96
|
+
// An array's, a Map's or a Set's items inspect() shows: those past it aren't looked into.
|
|
97
|
+
const SHOWN_ITEMS = 100;
|
|
98
|
+
/** A key that names a secret: a string's, a symbol's description. */
|
|
99
|
+
function secretKey(key, value) {
|
|
100
|
+
if (typeof key === "string")
|
|
101
|
+
return masks(key, value);
|
|
102
|
+
return typeof key === "symbol" && key.description !== undefined && masks(key.description, value);
|
|
103
|
+
}
|
|
104
|
+
/** An object whose keys and items are looked into: not a proxy (its traps may do anything), a Date, a Buffer… */
|
|
105
|
+
function container(value) {
|
|
106
|
+
if (value === null || typeof value !== "object" || types.isProxy(value))
|
|
107
|
+
return false;
|
|
108
|
+
return (Array.isArray(value) ||
|
|
109
|
+
value instanceof Map ||
|
|
110
|
+
value instanceof Set ||
|
|
111
|
+
!(ArrayBuffer.isView(value) ||
|
|
112
|
+
value instanceof ArrayBuffer ||
|
|
113
|
+
value instanceof Date ||
|
|
114
|
+
value instanceof RegExp ||
|
|
115
|
+
value instanceof Error ||
|
|
116
|
+
value instanceof Promise ||
|
|
117
|
+
value instanceof WeakMap ||
|
|
118
|
+
value instanceof WeakSet ||
|
|
119
|
+
types.isBoxedPrimitive(value)));
|
|
120
|
+
}
|
|
121
|
+
/** Look for keys that name a secret in a value, as far as inspect() shows it, and for proxies. */
|
|
122
|
+
function lookInto(value, depth, seen, found) {
|
|
123
|
+
if (proxy(value))
|
|
124
|
+
found.proxy = true;
|
|
125
|
+
if (!container(value) || depth > MASK_DEPTH || seen.has(value))
|
|
126
|
+
return;
|
|
127
|
+
seen.add(value);
|
|
128
|
+
const inner = (item) => lookInto(item, depth + 1, seen, found);
|
|
129
|
+
if (value instanceof Map) {
|
|
130
|
+
let index = 0;
|
|
131
|
+
for (const [key, item] of Map.prototype.entries.call(value)) {
|
|
132
|
+
if (index++ >= SHOWN_ITEMS)
|
|
133
|
+
break;
|
|
134
|
+
if (secretKey(key, item))
|
|
135
|
+
found.secret = true;
|
|
136
|
+
inner(key);
|
|
137
|
+
inner(item);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (value instanceof Set) {
|
|
141
|
+
let index = 0;
|
|
142
|
+
for (const item of Set.prototype.values.call(value)) {
|
|
143
|
+
if (index++ >= SHOWN_ITEMS)
|
|
144
|
+
break;
|
|
145
|
+
inner(item);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
149
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(value, key);
|
|
150
|
+
if (!descriptor?.enumerable)
|
|
151
|
+
continue;
|
|
152
|
+
if (Array.isArray(value) && typeof key === "string" && Number(key) >= SHOWN_ITEMS)
|
|
153
|
+
continue;
|
|
154
|
+
if (secretKey(key, descriptor.value))
|
|
155
|
+
found.secret = true;
|
|
156
|
+
if ("value" in descriptor)
|
|
157
|
+
inner(descriptor.value);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A value as inspect() is to show it, a secret's value masked: a copy where an object's key, a class's field or a
|
|
162
|
+
* Map's key names a secret (`password`, `apiToken`), with the same prototypes (inspect() names the class) and
|
|
163
|
+
* cycles; the value itself when nothing in it does. The app's value is never changed, and no getter is called. A
|
|
164
|
+
* proxy isn't looked into (its traps could run anything): inspect() shows its target without them, and that text is
|
|
165
|
+
* masked (maskText()).
|
|
166
|
+
*/
|
|
167
|
+
export function masked(value) {
|
|
168
|
+
try {
|
|
169
|
+
const found = { secret: false, proxy: false };
|
|
170
|
+
lookInto(value, 0, new Set(), found);
|
|
171
|
+
return { value: found.secret ? maskedCopy(value, 0, new Map()) : value, byText: found.proxy };
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// A value that couldn't be looked into or copied: its text is masked.
|
|
175
|
+
return { value, byText: true };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function maskedCopy(value, depth, copies) {
|
|
179
|
+
if (!container(value) || depth > MASK_DEPTH)
|
|
180
|
+
return value;
|
|
181
|
+
if (copies.has(value))
|
|
182
|
+
return copies.get(value);
|
|
183
|
+
const inner = (item) => maskedCopy(item, depth + 1, copies);
|
|
184
|
+
let copy;
|
|
185
|
+
if (value instanceof Map) {
|
|
186
|
+
const map = new Map();
|
|
187
|
+
copy = map;
|
|
188
|
+
copies.set(value, copy);
|
|
189
|
+
let index = 0;
|
|
190
|
+
for (const [key, item] of Map.prototype.entries.call(value)) {
|
|
191
|
+
const shown = index++ < SHOWN_ITEMS;
|
|
192
|
+
map.set(shown ? inner(key) : key, shown ? (secretKey(key, item) ? MASK : inner(item)) : item);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if (value instanceof Set) {
|
|
196
|
+
const set = new Set();
|
|
197
|
+
copy = set;
|
|
198
|
+
copies.set(value, copy);
|
|
199
|
+
let index = 0;
|
|
200
|
+
for (const item of Set.prototype.values.call(value))
|
|
201
|
+
set.add(index++ < SHOWN_ITEMS ? inner(item) : item);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
copy = Array.isArray(value) ? new Array(value.length) : {};
|
|
205
|
+
copies.set(value, copy);
|
|
206
|
+
}
|
|
207
|
+
Object.setPrototypeOf(copy, Object.getPrototypeOf(value));
|
|
208
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
209
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(value, key);
|
|
210
|
+
if (!descriptor?.enumerable)
|
|
211
|
+
continue;
|
|
212
|
+
// A getter stays one: inspect() shows [Getter] without calling it.
|
|
213
|
+
if ("value" in descriptor) {
|
|
214
|
+
const past = Array.isArray(value) && typeof key === "string" && Number(key) >= SHOWN_ITEMS;
|
|
215
|
+
descriptor.value = secretKey(key, descriptor.value) ? MASK : past ? descriptor.value : inner(descriptor.value);
|
|
216
|
+
}
|
|
217
|
+
Reflect.defineProperty(copy, key, descriptor);
|
|
218
|
+
}
|
|
219
|
+
return copy;
|
|
220
|
+
}
|
|
221
|
+
/** A value as Node's console prints it, cut at MAX_REPR. */
|
|
222
|
+
export function reprOf(value) {
|
|
223
|
+
const text = inspectedText(value);
|
|
224
|
+
return text === undefined ? `<unrepresentable ${typeof value}>` : cut(text);
|
|
225
|
+
}
|
|
226
|
+
/** A value as inspect() shows it, or undefined when that throws. */
|
|
227
|
+
function inspectedText(value) {
|
|
228
|
+
try {
|
|
229
|
+
return inspect(value, INSPECT);
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/** A text cut at MAX_REPR. */
|
|
236
|
+
function cut(text) {
|
|
237
|
+
return text.length > MAX_REPR ? text.slice(0, MAX_REPR - TRUNCATED.length) + TRUNCATED : text;
|
|
238
|
+
}
|
|
239
|
+
// A key as inspect() prints it before its value: `apiKey: `, `'api-key': `, `[Symbol(token)]: `, a Map's `'token' => `.
|
|
240
|
+
const PRINTED_KEY = /(^|[\s{,([])(?:([A-Za-z_$][\w$-]*)|'((?:[^'\\\n]|\\.)*)'|"((?:[^"\\\n]|\\.)*)"|\[Symbol\(([^)\n]*)\)\])(: | => )/g;
|
|
241
|
+
// `name=value` in a text (a query string, a DSN, a cookie).
|
|
242
|
+
const ASSIGNED = /(^|[^\w$])([A-Za-z_$][\w$-]*)=(?![=>])([^\s&;,'"`)\]}]+)/g;
|
|
243
|
+
/**
|
|
244
|
+
* A text inspect() made with every value under a key that names a secret masked: a quoted string (over several
|
|
245
|
+
* lines too), an object or array to its closing bracket, `[Getter]`, a number; and `name=value` pairs. What is masked
|
|
246
|
+
* reads `'********'`.
|
|
247
|
+
*/
|
|
248
|
+
export function maskText(text) {
|
|
249
|
+
let out = "";
|
|
250
|
+
let from = 0;
|
|
251
|
+
PRINTED_KEY.lastIndex = 0;
|
|
252
|
+
for (let match = PRINTED_KEY.exec(text); match; match = PRINTED_KEY.exec(text)) {
|
|
253
|
+
const name = match[2] ?? match[3] ?? match[4] ?? match[5] ?? "";
|
|
254
|
+
if (!sensitive(name))
|
|
255
|
+
continue;
|
|
256
|
+
const start = match.index + match[0].length;
|
|
257
|
+
const end = valueEnd(text, start);
|
|
258
|
+
// A model's token counts: a number, or numbers only.
|
|
259
|
+
if (countsText(name, text.slice(start, end)))
|
|
260
|
+
continue;
|
|
261
|
+
out += `${text.slice(from, start)}'${MASK}'`;
|
|
262
|
+
from = end;
|
|
263
|
+
PRINTED_KEY.lastIndex = Math.max(end, start);
|
|
264
|
+
}
|
|
265
|
+
out += text.slice(from);
|
|
266
|
+
return out.replace(ASSIGNED, (whole, before, name) => sensitive(name) ? `${before}${name}=${MASK}` : whole);
|
|
267
|
+
}
|
|
268
|
+
/** Whether inspect()'s text of the value under `tokens` is a model's counts: a number, or an array of numbers. */
|
|
269
|
+
function countsText(name, value) {
|
|
270
|
+
return counted(name, 0) && /^(?:-?[\d.e+]+|\[[\s\d.e+,-]*\])$/.test(value.trim());
|
|
271
|
+
}
|
|
272
|
+
/** Where the value inspect() printed at `at` ends. */
|
|
273
|
+
function valueEnd(text, at) {
|
|
274
|
+
let index = at;
|
|
275
|
+
const quote = text[index];
|
|
276
|
+
if (quote === "'" || quote === '"' || quote === "`") {
|
|
277
|
+
for (;;) {
|
|
278
|
+
index = quotedEnd(text, index);
|
|
279
|
+
// A string over several lines: `'a\n' +` and the next part on the next line.
|
|
280
|
+
const more = /^ \+\n\s*(?=['"`])/.exec(text.slice(index, index + 200));
|
|
281
|
+
if (!more)
|
|
282
|
+
return index;
|
|
283
|
+
index += more[0].length;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// A class's name, `Map(2)`, `<ref *1>`, `[Object: null prototype]` before its brackets, or a bare value.
|
|
287
|
+
while (index < text.length) {
|
|
288
|
+
const char = text[index];
|
|
289
|
+
if (char === "{" || char === "[") {
|
|
290
|
+
index = bracketEnd(text, index);
|
|
291
|
+
if (!/^ [{[]/.test(text.slice(index, index + 2)))
|
|
292
|
+
return index;
|
|
293
|
+
index++;
|
|
294
|
+
}
|
|
295
|
+
else if (char === "," || char === "\n" || char === "}" || char === "]" || char === ")") {
|
|
296
|
+
// The space before a closing bracket isn't the value's.
|
|
297
|
+
while (index > at && text[index - 1] === " ")
|
|
298
|
+
index--;
|
|
299
|
+
return index;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
index++;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return index;
|
|
306
|
+
}
|
|
307
|
+
/** Where the quoted string that opens at `open` ends (past its quote). */
|
|
308
|
+
function quotedEnd(text, open) {
|
|
309
|
+
const quote = text[open];
|
|
310
|
+
let index = open + 1;
|
|
311
|
+
while (index < text.length && text[index] !== quote)
|
|
312
|
+
index += text[index] === "\\" ? 2 : 1;
|
|
313
|
+
return Math.min(index + 1, text.length);
|
|
314
|
+
}
|
|
315
|
+
/** Where the bracket that opens at `open` closes (past it), strings inside skipped. */
|
|
316
|
+
function bracketEnd(text, open) {
|
|
317
|
+
let depth = 0;
|
|
318
|
+
for (let index = open; index < text.length; index++) {
|
|
319
|
+
const char = text[index];
|
|
320
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
321
|
+
index = quotedEnd(text, index) - 1;
|
|
322
|
+
}
|
|
323
|
+
else if (char === "{" || char === "[") {
|
|
324
|
+
depth++;
|
|
325
|
+
}
|
|
326
|
+
else if (char === "}" || char === "]") {
|
|
327
|
+
depth--;
|
|
328
|
+
if (depth === 0)
|
|
329
|
+
return index + 1;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return text.length;
|
|
333
|
+
}
|
|
334
|
+
/** A value's type: an object's constructor's name, a primitive's typeof. */
|
|
335
|
+
function typeOf(value) {
|
|
336
|
+
if (value === null)
|
|
337
|
+
return "null";
|
|
338
|
+
if (typeof value !== "object" && typeof value !== "function")
|
|
339
|
+
return typeof value;
|
|
340
|
+
if (proxy(value))
|
|
341
|
+
return "Proxy";
|
|
342
|
+
try {
|
|
343
|
+
const name = Object.getPrototypeOf(value)?.constructor?.name;
|
|
344
|
+
return typeof name === "string" && name !== "" ? name : "Object";
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
return "Object";
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/** An array's, a string's length, a Map's or Set's size; null for anything else. */
|
|
351
|
+
function lengthOf(value) {
|
|
352
|
+
if (proxy(value))
|
|
353
|
+
return null;
|
|
354
|
+
try {
|
|
355
|
+
if (typeof value === "string" || Array.isArray(value))
|
|
356
|
+
return value.length;
|
|
357
|
+
if (ArrayBuffer.isView(value) && "length" in value)
|
|
358
|
+
return Number(value.length);
|
|
359
|
+
if (value instanceof Map || value instanceof Set)
|
|
360
|
+
return value.size;
|
|
361
|
+
}
|
|
362
|
+
catch {
|
|
363
|
+
// A proxy that throws: no length.
|
|
364
|
+
}
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
// What console would print, written here instead: a console of its own, without colors. Its stream takes each
|
|
368
|
+
// write at once, so the text is there when the call returns.
|
|
369
|
+
let output = "";
|
|
370
|
+
const sink = new Console({
|
|
371
|
+
stdout: new Writable({
|
|
372
|
+
decodeStrings: false,
|
|
373
|
+
write(chunk, _encoding, done) {
|
|
374
|
+
output += chunk;
|
|
375
|
+
done();
|
|
376
|
+
},
|
|
377
|
+
}),
|
|
378
|
+
colorMode: false,
|
|
379
|
+
});
|
|
380
|
+
/** The text a console method prints for these arguments, without its last newline. */
|
|
381
|
+
function printed(method, args) {
|
|
382
|
+
output = "";
|
|
383
|
+
try {
|
|
384
|
+
sink[method]?.(...args);
|
|
385
|
+
return output.replace(/\n$/, "");
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
return format(...args);
|
|
389
|
+
}
|
|
390
|
+
finally {
|
|
391
|
+
output = "";
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* The source text of each argument of the call at a frame, read from its source (through its bundle's source map,
|
|
396
|
+
* see stack.ts); null when the source can't be read or the call's arguments can't be told apart (a spread, a call
|
|
397
|
+
* split oddly).
|
|
398
|
+
*/
|
|
399
|
+
export function expressions(site, count) {
|
|
400
|
+
if (site.column === undefined || !Number.isFinite(site.column))
|
|
401
|
+
return null;
|
|
402
|
+
try {
|
|
403
|
+
const lines = sourceLines(site.file);
|
|
404
|
+
if (!lines)
|
|
405
|
+
return null;
|
|
406
|
+
if (site.line < 1 || site.line > lines.length)
|
|
407
|
+
return null;
|
|
408
|
+
const text = lines
|
|
409
|
+
.slice(site.line - 1)
|
|
410
|
+
.join("\n")
|
|
411
|
+
.slice(0, MAX_CALL + (lines[site.line - 1]?.length ?? 0));
|
|
412
|
+
const start = site.column - 1;
|
|
413
|
+
// The stack points at the call: `console.log(`, `log(`, `console.log?.(`; its parenthesis follows.
|
|
414
|
+
const callee = /[\w$.?\s]*?\(/y;
|
|
415
|
+
callee.lastIndex = start;
|
|
416
|
+
if (!callee.exec(text))
|
|
417
|
+
return null;
|
|
418
|
+
const found = argumentsAt(text, callee.lastIndex - 1);
|
|
419
|
+
if (!found || found.length !== count || found.some((expr) => expr.startsWith("...")))
|
|
420
|
+
return null;
|
|
421
|
+
return found;
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* The arguments of the call whose parenthesis is at `open`, as source text without comments: strings, templates and
|
|
429
|
+
* brackets kept whole.
|
|
430
|
+
*/
|
|
431
|
+
export function argumentsAt(text, open) {
|
|
432
|
+
const found = [];
|
|
433
|
+
let arg = "";
|
|
434
|
+
// The closing character each open bracket waits for; "`" while in a template literal's text.
|
|
435
|
+
const closing = [")"];
|
|
436
|
+
for (let at = open + 1; at < text.length; at++) {
|
|
437
|
+
const char = text[at] ?? "";
|
|
438
|
+
if (closing.at(-1) === "`") {
|
|
439
|
+
if (char === "\\") {
|
|
440
|
+
arg += text.slice(at, at + 2);
|
|
441
|
+
at++;
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (char === "`")
|
|
445
|
+
closing.pop();
|
|
446
|
+
else if (char === "$" && text[at + 1] === "{") {
|
|
447
|
+
closing.push("}");
|
|
448
|
+
arg += "${";
|
|
449
|
+
at++;
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
arg += char;
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
if (char === '"' || char === "'") {
|
|
456
|
+
const end = stringEnd(text, at, char);
|
|
457
|
+
if (end < 0)
|
|
458
|
+
return null;
|
|
459
|
+
arg += text.slice(at, end + 1);
|
|
460
|
+
at = end;
|
|
461
|
+
}
|
|
462
|
+
else if (char === "/" && text[at + 1] === "/") {
|
|
463
|
+
at = text.indexOf("\n", at);
|
|
464
|
+
if (at < 0)
|
|
465
|
+
return null;
|
|
466
|
+
arg += "\n";
|
|
467
|
+
}
|
|
468
|
+
else if (char === "/" && text[at + 1] === "*") {
|
|
469
|
+
at = text.indexOf("*/", at + 2);
|
|
470
|
+
if (at < 0)
|
|
471
|
+
return null;
|
|
472
|
+
at++;
|
|
473
|
+
arg += " ";
|
|
474
|
+
}
|
|
475
|
+
else if (char === "," && closing.length === 1) {
|
|
476
|
+
found.push(arg);
|
|
477
|
+
arg = "";
|
|
478
|
+
}
|
|
479
|
+
else if (char === ")" || char === "]" || char === "}") {
|
|
480
|
+
if (closing.pop() !== char)
|
|
481
|
+
return null;
|
|
482
|
+
if (closing.length === 0) {
|
|
483
|
+
found.push(arg);
|
|
484
|
+
// An argument over several lines on one.
|
|
485
|
+
const exprs = found.map((expr) => expr.trim().replace(/\s*\n\s*/g, " "));
|
|
486
|
+
// A trailing comma, and a call without arguments.
|
|
487
|
+
if (exprs.at(-1) === "")
|
|
488
|
+
exprs.pop();
|
|
489
|
+
return exprs;
|
|
490
|
+
}
|
|
491
|
+
arg += char;
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
if (char === "`")
|
|
495
|
+
closing.push("`");
|
|
496
|
+
else if (char === "(")
|
|
497
|
+
closing.push(")");
|
|
498
|
+
else if (char === "[")
|
|
499
|
+
closing.push("]");
|
|
500
|
+
else if (char === "{")
|
|
501
|
+
closing.push("}");
|
|
502
|
+
arg += char;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
/** Where a quoted string that opens at `open` closes, or -1 at the end of its line. */
|
|
508
|
+
function stringEnd(text, open, quote) {
|
|
509
|
+
for (let at = open + 1; at < text.length; at++) {
|
|
510
|
+
const char = text[at];
|
|
511
|
+
if (char === "\\")
|
|
512
|
+
at++;
|
|
513
|
+
else if (char === quote)
|
|
514
|
+
return at;
|
|
515
|
+
else if (char === "\n")
|
|
516
|
+
return -1;
|
|
517
|
+
}
|
|
518
|
+
return -1;
|
|
519
|
+
}
|
|
520
|
+
//# sourceMappingURL=dumps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dumps.js","sourceRoot":"","sources":["../src/dumps.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,kHAAkH;AAClH,+GAA+G;AAC/G,iHAAiH;AACjH,iGAAiG;AAEjG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAmB,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhG,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC/B,MAAM,SAAS,GAAG,eAAe,CAAC;AAClC,iFAAiF;AACjF,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAW,CAAC;AACjH,6EAA6E;AAC7E,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB,kFAAkF;AAClF,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAUzE,gHAAgH;AAChH,MAAM,UAA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I,CAAC,GAAG,CAAC,CAAC;YACzC,GAAG,IAAI,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uFAAuF;AACvF,SAAS,SAAS,CAAC,IAAY,EAAE,IAAY,EAAE,KAAa;IAC1D,KAAK,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;QACtB,IAAI,IAAI,KAAK,IAAI;YAAE,EAAE,EAAE,CAAC;aACnB,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO,EAAE,CAAC;aAC9B,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { TraceOptions, User } from "./api.js";
|
|
2
|
-
export { setUser, span, trace } from "./api.js";
|
|
1
|
+
export type { ProfileOptions, TraceOptions, User } from "./api.js";
|
|
2
|
+
export { profile, setUser, span, trace } from "./api.js";
|
|
3
3
|
export type { Config, Thresholds } from "./config.js";
|
|
4
4
|
export { loadConfig } from "./config.js";
|
|
5
5
|
export type { Trace } from "./model.js";
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/locals.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export type FrameLocals = (Record<string, string> | undefined)[];
|
|
|
3
3
|
/**
|
|
4
4
|
* A value as the console shows it, as Python's reprlib cuts one: a plain object, an array, a Map or a Set by its
|
|
5
5
|
* items, nested two deep, ten of each at most; anything else (a class's instance: a request, a connection) and a
|
|
6
|
-
* string at most 160 characters. Masked under a sensitive name
|
|
6
|
+
* string at most 160 characters. Masked under a sensitive name, and a value under a key that names a secret inside it
|
|
7
|
+
* (`{ password: '********' }`), from inspect()'s text: a proxy is shown as inspect() shows it, without its traps.
|
|
7
8
|
*/
|
|
8
9
|
export declare function repr(name: string, value: unknown): string;
|
|
9
10
|
/** A frame's variables as text, from its scope objects, innermost first: an inner name hides an outer one. */
|
package/dist/locals.js
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
// a pause costs about a millisecond. An error is read where it is first thrown: its frames that run then, not
|
|
9
9
|
// the callers that were waiting on an `await` (those have no locals here). A process run under a debugger
|
|
10
10
|
// (--inspect) is left alone: its pauses would stop the debugger too.
|
|
11
|
-
import { inspect } from "node:util";
|
|
11
|
+
import { inspect, types } from "node:util";
|
|
12
|
+
import { maskText } from "./dumps.js";
|
|
12
13
|
import { call, connect, inspector } from "./inspector.js";
|
|
13
|
-
import { MASK,
|
|
14
|
+
import { MASK, masks } from "./masking.js";
|
|
14
15
|
import { asyncFrames, inApp, parseStack } from "./stack.js";
|
|
15
16
|
// At most this many local variables of a frame, and the app's frames of an error, have their values kept.
|
|
16
17
|
const MAX_LOCALS = 40;
|
|
@@ -31,14 +32,15 @@ let readers = 0;
|
|
|
31
32
|
/**
|
|
32
33
|
* A value as the console shows it, as Python's reprlib cuts one: a plain object, an array, a Map or a Set by its
|
|
33
34
|
* items, nested two deep, ten of each at most; anything else (a class's instance: a request, a connection) and a
|
|
34
|
-
* string at most 160 characters. Masked under a sensitive name
|
|
35
|
+
* string at most 160 characters. Masked under a sensitive name, and a value under a key that names a secret inside it
|
|
36
|
+
* (`{ password: '********' }`), from inspect()'s text: a proxy is shown as inspect() shows it, without its traps.
|
|
35
37
|
*/
|
|
36
38
|
export function repr(name, value) {
|
|
37
|
-
if (
|
|
39
|
+
if (masks(name, value))
|
|
38
40
|
return MASK;
|
|
39
41
|
try {
|
|
40
42
|
// On one line: inspect() lays a long array out in rows.
|
|
41
|
-
const text = inspect(value, INSPECT).replace(/\s*\n\s*/g, " ");
|
|
43
|
+
const text = maskText(inspect(value, INSPECT)).replace(/\s*\n\s*/g, " ");
|
|
42
44
|
const limit = container(value) ? MAX_REPR : MAX_OTHER;
|
|
43
45
|
return text.length > limit ? `${text.slice(0, limit - 3)}...` : text;
|
|
44
46
|
}
|
|
@@ -49,7 +51,7 @@ export function repr(name, value) {
|
|
|
49
51
|
function container(value) {
|
|
50
52
|
if (typeof value === "string")
|
|
51
53
|
return true;
|
|
52
|
-
if (value === null || typeof value !== "object")
|
|
54
|
+
if (value === null || typeof value !== "object" || types.isProxy(value))
|
|
53
55
|
return false;
|
|
54
56
|
const prototype = Object.getPrototypeOf(value);
|
|
55
57
|
return (Array.isArray(value) ||
|