smipper 35.0.0 → 37.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/processFrame.js +2 -0
- package/dist/rewriteLocalControl.js +7 -2
- package/dist/rewriteOCA.js +46 -0
- package/package.json +1 -1
package/dist/Rewrite.js
ADDED
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);
|
|
@@ -25,8 +25,13 @@ function findFile(dir, fn) {
|
|
|
25
25
|
return undefined;
|
|
26
26
|
}
|
|
27
27
|
function rewriteLocalControl(smipper, url) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let file = path_1.default.basename(url.substring(6));
|
|
29
|
+
const q = file.indexOf("?");
|
|
30
|
+
if (q !== -1) {
|
|
31
|
+
file = file.substring(0, q);
|
|
32
|
+
}
|
|
33
|
+
const found = findFile(process.cwd(), file);
|
|
34
|
+
smipper.verbose(`Rewriting ${url} in ${process.cwd()} (${file}) => ${found}`);
|
|
30
35
|
if (found) {
|
|
31
36
|
return found;
|
|
32
37
|
}
|
|
@@ -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;
|