smipper 7.0.0 → 8.0.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/index.js +48 -46
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,6 +9,53 @@ let verbose = false;
|
|
|
9
9
|
let stack;
|
|
10
10
|
let json = false;
|
|
11
11
|
let retries = 3;
|
|
12
|
+
let jsc = 0;
|
|
13
|
+
|
|
14
|
+
let hasInput = false;
|
|
15
|
+
for (let i=2; i<process.argv.length; ++i) {
|
|
16
|
+
try {
|
|
17
|
+
const arg = process.argv[i];
|
|
18
|
+
if (verbose)
|
|
19
|
+
console.error("got arg", arg);
|
|
20
|
+
if (arg === "-f" || arg === "--file") {
|
|
21
|
+
stack = fs.readFileSync(process.argv[++i]).toString();
|
|
22
|
+
} else if ( arg.startsWith("-f") === 0) {
|
|
23
|
+
stack = fs.readFileSync(arg.substr(2)).toString();
|
|
24
|
+
} else if (arg.startsWith("--file=") === 0) {
|
|
25
|
+
stack = fs.readFileSync(arg.substr(7)).toString();
|
|
26
|
+
} else if (arg === "--verbose" || arg === "-v") {
|
|
27
|
+
verbose = true;
|
|
28
|
+
} else if (arg === "--json") {
|
|
29
|
+
json = true;
|
|
30
|
+
} else if (arg === "--jsc") { // jsc has the wrong column for some reason
|
|
31
|
+
jsc = 1;
|
|
32
|
+
} else if (arg.startsWith("--retries")) {
|
|
33
|
+
retries = parseInt(arg.substr(9));
|
|
34
|
+
if (isNaN(retries) || retries < 0) {
|
|
35
|
+
console.error("smipper [stack|-h|--help|-v|--verbose|--retries=<number>|--jsc|--json|-f=@FILE@|-");
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
} else if (arg === "-h" || arg === "--help") {
|
|
39
|
+
console.error("smipper [stack|-h|--help|-v|--verbose|--retries=<number>|--jsc|--json|-f=@FILE@|-");
|
|
40
|
+
process.exit(0);
|
|
41
|
+
} else if (arg === "-") {
|
|
42
|
+
// stdin
|
|
43
|
+
} else {
|
|
44
|
+
stack = arg;
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error("Error: " + err.toString());
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!stack) {
|
|
53
|
+
stack = fs.readFileSync("/dev/stdin").toString();
|
|
54
|
+
if (!stack) {
|
|
55
|
+
console.error("Nothing to do");
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
12
59
|
|
|
13
60
|
function load(path)
|
|
14
61
|
{
|
|
@@ -86,50 +133,6 @@ function loadUri(path) {
|
|
|
86
133
|
});
|
|
87
134
|
}
|
|
88
135
|
|
|
89
|
-
let hasInput = false;
|
|
90
|
-
for (let i=2; i<process.argv.length; ++i) {
|
|
91
|
-
try {
|
|
92
|
-
const arg = process.argv[i];
|
|
93
|
-
if (verbose)
|
|
94
|
-
console.error("got arg", arg);
|
|
95
|
-
if (arg === "-f" || arg === "--file") {
|
|
96
|
-
stack = fs.readFileSync(process.argv[++i]).toString();
|
|
97
|
-
} else if ( arg.startsWith("-f") === 0) {
|
|
98
|
-
stack = fs.readFileSync(arg.substr(2)).toString();
|
|
99
|
-
} else if (arg.startsWith("--file=") === 0) {
|
|
100
|
-
stack = fs.readFileSync(arg.substr(7)).toString();
|
|
101
|
-
} else if (arg === "--verbose" || arg === "-v") {
|
|
102
|
-
verbose = true;
|
|
103
|
-
} else if (arg === "--json") {
|
|
104
|
-
json = true;
|
|
105
|
-
} else if (arg.startsWith("--retries")) {
|
|
106
|
-
retries = parseInt(arg.substr(9));
|
|
107
|
-
if (isNaN(retries) || retries < 0) {
|
|
108
|
-
console.error("smipper [stack|-h|--help|-v|--verbose|--retries=<number>|--json|-f=@FILE@|-");
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
} else if (arg === "-h" || arg === "--help") {
|
|
112
|
-
console.error("smipper [stack|-h|--help|-v|--verbose|--retries=<number>|--json|-f=@FILE@|-");
|
|
113
|
-
process.exit(0);
|
|
114
|
-
} else if (arg === "-") {
|
|
115
|
-
// stdin
|
|
116
|
-
} else {
|
|
117
|
-
stack = arg;
|
|
118
|
-
}
|
|
119
|
-
} catch (err) {
|
|
120
|
-
console.error("Error: " + err.toString());
|
|
121
|
-
process.exit(1);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (!stack) {
|
|
126
|
-
stack = fs.readFileSync("/dev/stdin").toString();
|
|
127
|
-
if (!stack) {
|
|
128
|
-
console.error("Nothing to do");
|
|
129
|
-
process.exit(0);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
136
|
function processFrame(functionName, url, line, column)
|
|
134
137
|
{
|
|
135
138
|
if (verbose)
|
|
@@ -149,8 +152,7 @@ function processFrame(functionName, url, line, column)
|
|
|
149
152
|
|
|
150
153
|
// it appears that we're supposed to reduce the column
|
|
151
154
|
// number by 1 when we get this from jsc
|
|
152
|
-
|
|
153
|
-
const pos = smap.originalPositionFor({ line, column });
|
|
155
|
+
const pos = smap.originalPositionFor({ line, column: column - jsc });
|
|
154
156
|
if (!pos.source) {
|
|
155
157
|
if (verbose)
|
|
156
158
|
console.error("nothing here", pos);
|