Skip to content

Commit 1b70ca8

Browse files
committed
fix: debug-info-remapping gitignore
1 parent af5868d commit 1b70ca8

3 files changed

Lines changed: 40 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!scripts
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const debugInfoPath = process.argv[2];
2+
const function_id = Number(process.argv[3]);
3+
const pc_index = Number(process.argv[4] - 1);
4+
5+
if (!debugInfoPath) {
6+
console.error('Please provide the debug info path as the first argument.');
7+
process.exit(1);
8+
}
9+
if (isNaN(function_id) || isNaN(pc_index)) {
10+
console.error('Please provide the valid function_id and pc_index as the second and third arguments.');
11+
process.exit(1);
12+
}
13+
14+
const debugInfo = await import(debugInfoPath, {
15+
with: { type: 'json' },
16+
});
17+
18+
/** @typedef {{line: number, column: number}} Position */
19+
/**@typedef {{line_col: Position[], function_id: number, function_name: string}} FunctionInfo */
20+
/**@typedef {{function_info: FunctionInfo[]}} DebugInfo */
21+
22+
/** @type {DebugInfo} */
23+
const { function_info } = debugInfo.default.lepusNG_debug_info;
24+
25+
// Find the `function_id` is `function_id`
26+
const functionInfo = function_info.find((info) => info.function_id === function_id);
27+
if (!functionInfo) {
28+
console.error(`Can not find the function_info with function_id: ${function_id}`);
29+
process.exit(1);
30+
}
31+
32+
// Find the `pc_index` is `pc_index`
33+
const position = functionInfo.line_col[pc_index];
34+
if (!position) {
35+
console.error(`Can not find the position with pc_index: ${pc_index}`);
36+
process.exit(1);
37+
}
38+
39+
console.log(`The position of function_id: ${function_id}, pc_index: ${pc_index} is ${position.line}:${position.column}`);

packages/skills/reactlynx-best-practice/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "@lynx-js/skill-reactlynx-best-practice",
33
"version": "1.0.0",
4-
"private": true,
54
"type": "module",
65
"files": [
76
"SKILL.md",

0 commit comments

Comments
 (0)