smipper 36.0.0 → 38.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/dist/Rewrite.js +2 -0
- package/dist/init.js +10 -2
- package/dist/processFrame.js +6 -1
- package/dist/rewriteOCA.js +46 -0
- package/package.json +1 -1
package/dist/Rewrite.js
ADDED
package/dist/init.js
CHANGED
|
@@ -15,7 +15,8 @@ function init() {
|
|
|
15
15
|
jsc: 0,
|
|
16
16
|
cacheDir: path_1.default.join(os_1.default.homedir(), ".cache", "smipper", "cache"),
|
|
17
17
|
cacheSize: 10,
|
|
18
|
-
sourceMaps: {}
|
|
18
|
+
sourceMaps: {},
|
|
19
|
+
noOriginalUrl: false
|
|
19
20
|
};
|
|
20
21
|
for (const key in process.env) {
|
|
21
22
|
switch (key) {
|
|
@@ -35,9 +36,13 @@ function init() {
|
|
|
35
36
|
}
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
39
|
+
case "SMIPPER_NO_ORIGINAL_URL": {
|
|
40
|
+
smipper.noOriginalUrl = true;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
|
-
const usage = "smipper [stack|-h|--help|-v|--verbose|--version|--jsc|--json|--file=@FILE@|-f=@FILE@|--cache-key=$CACHE_KEY$|--cache-dir=$CACHE_DIR$|--cache-size=$CACHE_SIZE
|
|
45
|
+
const usage = "smipper [stack|-h|--help|-v|--verbose|--version|--jsc|--json|--file=@FILE@|-f=@FILE@|--cache-key=$CACHE_KEY$|--cache-dir=$CACHE_DIR$|--cache-size=$CACHE_SIZE$|--no-original-url|-n|-";
|
|
41
46
|
for (let i = 2; i < process.argv.length; ++i) {
|
|
42
47
|
try {
|
|
43
48
|
const arg = process.argv[i] || "";
|
|
@@ -87,6 +92,9 @@ function init() {
|
|
|
87
92
|
console.log(usage);
|
|
88
93
|
process.exit(0);
|
|
89
94
|
}
|
|
95
|
+
else if (arg === "--no-original-url" || arg == "-n") {
|
|
96
|
+
smipper.noOriginalUrl = true;
|
|
97
|
+
}
|
|
90
98
|
else if (arg === "-") {
|
|
91
99
|
// stdin
|
|
92
100
|
}
|
package/dist/processFrame.js
CHANGED
|
@@ -7,11 +7,13 @@ exports.processFrame = void 0;
|
|
|
7
7
|
const loadUri_1 = require("./loadUri");
|
|
8
8
|
const buildStackLine_1 = require("./buildStackLine");
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const rewriteOCA_1 = require("./rewriteOCA");
|
|
10
11
|
function processFrame(smipper, functionName, url, line, column) {
|
|
11
12
|
smipper.verbose("got frame", functionName, url, line, column);
|
|
12
13
|
if (functionName.endsWith("@")) {
|
|
13
14
|
functionName = functionName.substring(0, functionName.length - 1);
|
|
14
15
|
}
|
|
16
|
+
url = (0, rewriteOCA_1.rewriteOCA)(smipper, url);
|
|
15
17
|
return new Promise((resolve) => {
|
|
16
18
|
let newUrl, newLine, newColumn;
|
|
17
19
|
smipper.verbose("calling loadUri", url);
|
|
@@ -60,7 +62,10 @@ function processFrame(smipper, functionName, url, line, column) {
|
|
|
60
62
|
else {
|
|
61
63
|
let str;
|
|
62
64
|
if (newUrl) {
|
|
63
|
-
str = `${(0, buildStackLine_1.buildStackLine)(functionName, newUrl, newLine, newColumn)}
|
|
65
|
+
str = `${(0, buildStackLine_1.buildStackLine)(functionName, newUrl, newLine, newColumn)}`;
|
|
66
|
+
if (!smipper.noOriginalUrl) {
|
|
67
|
+
str += ` (${(0, buildStackLine_1.buildStackLine)("", url, line, column)})`;
|
|
68
|
+
}
|
|
64
69
|
}
|
|
65
70
|
else {
|
|
66
71
|
str = (0, buildStackLine_1.buildStackLine)(functionName, url, line, column);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteOCA = void 0;
|
|
4
|
+
const rewrites = [
|
|
5
|
+
{
|
|
6
|
+
pattern: /https:\/\/[^/]*nflxso.net\/genc\/nrdp\/milo\/1.0.([0-9]+)-[A-Za-z0-9]*\/milo.prod.js/,
|
|
7
|
+
replacement: [
|
|
8
|
+
"https://build.dta.netflix.com/nrdp/milo/(branch=master&repoBuildNumber=",
|
|
9
|
+
1,
|
|
10
|
+
")/dist/milo.prod.js"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
pattern: /https:\/\/[^/]*nflxso.net\/genc\/nrdp\/poby\/1.0.([0-9]+)-[A-Za-z0-9]*\/poby.prod.js/,
|
|
15
|
+
replacement: [
|
|
16
|
+
"https://build.dta.netflix.com/nrdp/poby/(branch=master&repoBuildNumber=",
|
|
17
|
+
1,
|
|
18
|
+
")/dist/poby.prod.js"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
pattern: /https:\/\/[^/]*nflxso.net\/genc\/nrdp\/bogart\/1.0.([0-9]+)-[A-Za-z0-9]*\/index.release.js/,
|
|
23
|
+
replacement: ["https://build.dta.netflix.com/nrdp/bogart/(repoBuildNumber=", 1, ")/dist/index.release.js"]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
pattern: /https:\/\/[^/]*nflxso.net\/genc\/nrdp\/bogart\/1.0.([0-9]+)-[A-Za-z0-9]*\/worker.release.js/,
|
|
27
|
+
replacement: ["https://build.dta.netflix.com/nrdp/bogart/(repoBuildNumber=", 1, ")/dist/worker.release.js"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
pattern: /https:\/\/[^/]*nflxso.net\/genc\/nrdp\/bogart\/1.0.([0-9]+)-[A-Za-z0-9]*\/animation.release.js/,
|
|
31
|
+
replacement: ["https://build.dta.netflix.com/nrdp/bogart/(repoBuildNumber=", 1, ")/dist/animation.release.js"]
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
function rewriteOCA(smipper, url) {
|
|
35
|
+
for (const rewrite of rewrites) {
|
|
36
|
+
const match = rewrite.pattern.exec(url);
|
|
37
|
+
smipper.verbose("Trying to match", url, "against", rewrite, "=>", match);
|
|
38
|
+
if (match) {
|
|
39
|
+
return rewrite.replacement
|
|
40
|
+
.map((x) => (typeof x === "string" ? x : String(match[x])))
|
|
41
|
+
.join("");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return url;
|
|
45
|
+
}
|
|
46
|
+
exports.rewriteOCA = rewriteOCA;
|