@stim-cli/metro 1.0.0-rc.13 → 1.0.0-rc.14
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/dist/index.d.mts +2 -1
- package/dist/index.mjs +27 -0
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -129,6 +129,23 @@ function errorMessage(error) {
|
|
|
129
129
|
if (typeof error.message === "string" && error.message) return error.message;
|
|
130
130
|
return formatValue(error);
|
|
131
131
|
}
|
|
132
|
+
function symbolicationMessage(codeFrame) {
|
|
133
|
+
if (!isPlainObject(codeFrame) || typeof codeFrame.content !== "string") return "Call Stack";
|
|
134
|
+
const fileName = typeof codeFrame.fileName === "string" ? codeFrame.fileName : "unknown source";
|
|
135
|
+
const location = isPlainObject(codeFrame.location) ? codeFrame.location : null;
|
|
136
|
+
return `Code: ${fileName}${typeof location?.row === "number" ? `:${location.row}` : ""}${typeof location?.column === "number" ? `:${location.column}` : ""}\n${codeFrame.content}\nCall Stack`;
|
|
137
|
+
}
|
|
138
|
+
function symbolicationStack(stack) {
|
|
139
|
+
if (!Array.isArray(stack)) return [];
|
|
140
|
+
return stack.filter((frame) => isPlainObject(frame) && frame.collapse !== true).map((frame) => {
|
|
141
|
+
const normalized = {};
|
|
142
|
+
if (typeof frame.file === "string") normalized.file = frame.file;
|
|
143
|
+
if (typeof frame.lineNumber === "number") normalized.line = frame.lineNumber;
|
|
144
|
+
if (typeof frame.column === "number") normalized.column = frame.column;
|
|
145
|
+
if (typeof frame.methodName === "string") normalized.fn = frame.methodName;
|
|
146
|
+
return normalized;
|
|
147
|
+
}).filter((frame) => Object.keys(frame).length > 0);
|
|
148
|
+
}
|
|
132
149
|
function ndjsonReporter({ dir } = {}) {
|
|
133
150
|
const logDir = dir || workspaceLogDir(process.cwd());
|
|
134
151
|
let ensured = false;
|
|
@@ -185,6 +202,16 @@ function ndjsonReporter({ dir } = {}) {
|
|
|
185
202
|
write("client.ndjson", record);
|
|
186
203
|
return;
|
|
187
204
|
}
|
|
205
|
+
if (type === "client_symbolication") {
|
|
206
|
+
const stack = symbolicationStack(event.stack);
|
|
207
|
+
if (!(isPlainObject(event.codeFrame) && typeof event.codeFrame.content === "string") && stack.length === 0) return;
|
|
208
|
+
record.src = "client";
|
|
209
|
+
record.level = "info";
|
|
210
|
+
record.msg = symbolicationMessage(event.codeFrame);
|
|
211
|
+
if (stack.length > 0) record.stack = stack;
|
|
212
|
+
write("client.ndjson", record);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
188
215
|
if (type === "bundling_error" || type === "transformer_error") {
|
|
189
216
|
record.level = "error";
|
|
190
217
|
record.msg = errorMessage(event.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stim-cli/metro",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.14",
|
|
4
4
|
"description": "Metro integration for Stim: shared transforms across worktrees and structured logs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@stim-cli/cache": "^1.0.0-rc.
|
|
28
|
-
"@stim-cli/core": "^1.0.0-rc.
|
|
27
|
+
"@stim-cli/cache": "^1.0.0-rc.14",
|
|
28
|
+
"@stim-cli/core": "^1.0.0-rc.14"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"metro-cache": "*"
|