@logbrew/sdk 0.1.26 → 0.1.27
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/issue-stack.cjs +11 -8
- package/package.json +1 -1
package/issue-stack.cjs
CHANGED
|
@@ -49,8 +49,8 @@ function buildIssueStackHelpers({ SdkError }) {
|
|
|
49
49
|
if (!filename || filename.length > 2048 || hasControlCharacter(filename)) {
|
|
50
50
|
throw new SdkError("validation_error", "issue stack frame filename is invalid");
|
|
51
51
|
}
|
|
52
|
-
const line =
|
|
53
|
-
const column =
|
|
52
|
+
const line = frameCoordinateFromText(frame.line);
|
|
53
|
+
const column = frameCoordinateFromText(frame.column);
|
|
54
54
|
if (line === null || column === null || line > 2147483647 || column > 2147483647) {
|
|
55
55
|
throw new SdkError("validation_error", "issue stack frame coordinates must be positive integers");
|
|
56
56
|
}
|
|
@@ -136,12 +136,15 @@ function parseJavaScriptStackFrame(rawLine) {
|
|
|
136
136
|
functionName = generatedFrameFunction(location.slice(0, marker));
|
|
137
137
|
location = location.slice(marker + 1);
|
|
138
138
|
}
|
|
139
|
+
const hermesBytecode = location.startsWith("address at ");
|
|
140
|
+
location = location.replace(/^address at /u, "");
|
|
139
141
|
const parts = location.split(":");
|
|
140
142
|
if (parts.length < 3) {
|
|
141
143
|
return null;
|
|
142
144
|
}
|
|
143
|
-
const
|
|
144
|
-
const lineNumber =
|
|
145
|
+
const rawColumn = parts.pop();
|
|
146
|
+
const lineNumber = frameCoordinateFromText(parts.pop());
|
|
147
|
+
const column = frameCoordinateFromText(rawColumn, hermesBytecode && lineNumber === 1 ? 1 : 0);
|
|
145
148
|
const filename = sanitizeFrameFilename(parts.join(":"));
|
|
146
149
|
if (!filename || lineNumber === null || column === null) {
|
|
147
150
|
return null;
|
|
@@ -184,13 +187,13 @@ function generatedFrameFunction(value) {
|
|
|
184
187
|
return functionName;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
|
-
function
|
|
190
|
+
function frameCoordinateFromText(value, offset = 0) {
|
|
188
191
|
const text = String(value);
|
|
189
|
-
if (!/^[1-9][0-9]
|
|
192
|
+
if (!/^(?:0|[1-9][0-9]*)$/u.test(text)) {
|
|
190
193
|
return null;
|
|
191
194
|
}
|
|
192
|
-
const parsed = Number(text);
|
|
193
|
-
return Number.isSafeInteger(parsed) ? parsed : null;
|
|
195
|
+
const parsed = Number(text) + offset;
|
|
196
|
+
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
function sanitizeFrameFilename(value) {
|