smipper 14.0.0 → 17.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 +38 -4
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -62,9 +62,44 @@ if (!stack) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
function findFile(dir, fn) {
|
|
66
|
+
const list = fs.readdirSync(dir);
|
|
67
|
+
for (let file of list) {
|
|
68
|
+
const match = (file === fn);
|
|
69
|
+
file = dir + '/' + file;
|
|
70
|
+
const stat = fs.statSync(file);
|
|
71
|
+
if (stat && stat.isDirectory()) {
|
|
72
|
+
const ret = findFile(file, fn);
|
|
73
|
+
if (ret) {
|
|
74
|
+
return ret;
|
|
75
|
+
}
|
|
76
|
+
} else if (match) {
|
|
77
|
+
return "file://" + file;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function rewriteLocalControl(url)
|
|
84
|
+
{
|
|
85
|
+
const found = findFile(process.cwd(), path.basename(url.substring(6)));
|
|
86
|
+
if (found)
|
|
87
|
+
return found;
|
|
88
|
+
throw new Error("Couldn't resolve localcontrol " + url);
|
|
89
|
+
}
|
|
90
|
+
|
|
65
91
|
function load(path)
|
|
66
92
|
{
|
|
67
93
|
return new Promise((resolve, reject) => {
|
|
94
|
+
if (path.startsWith("http://localcontrol.netflix.com/")) {
|
|
95
|
+
try {
|
|
96
|
+
path = rewriteLocalControl(path);
|
|
97
|
+
} catch (err) {
|
|
98
|
+
reject(err);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
68
103
|
if (path.startsWith("file:///")) {
|
|
69
104
|
try {
|
|
70
105
|
resolve(fs.readFileSync(path.substr(7), "utf8"));
|
|
@@ -73,14 +108,12 @@ function load(path)
|
|
|
73
108
|
}
|
|
74
109
|
return;
|
|
75
110
|
}
|
|
111
|
+
|
|
76
112
|
if (!path.startsWith("http://") && !path.startsWith("https://")) {
|
|
77
113
|
reject(new Error("Not a url"));
|
|
78
114
|
return;
|
|
79
115
|
}
|
|
80
|
-
|
|
81
|
-
reject(new Error("No need to resolve this one"));
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
116
|
+
|
|
84
117
|
let retryIndex = 0;
|
|
85
118
|
async function get()
|
|
86
119
|
{
|
|
@@ -127,6 +160,7 @@ function loadUri(path) {
|
|
|
127
160
|
// console.log(mapUrl);
|
|
128
161
|
return (new url.URL(mapUrl, path)).href;
|
|
129
162
|
}).then(mapUrl => {
|
|
163
|
+
// console.log(mapUrl.substr(0, 20));
|
|
130
164
|
if (mapUrl.startsWith("base64,")) {
|
|
131
165
|
return Buffer.from(mapUrl.substr(7), "base64").toString();
|
|
132
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smipper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"bin": {
|
|
10
10
|
"smipper": "index.js"
|
|
11
11
|
},
|
|
12
|
-
"author": "
|
|
13
|
-
"license": "
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"got": "^9.6.0",
|
|
16
|
-
"source-map": "^0.7.
|
|
16
|
+
"source-map": "^0.7.4"
|
|
17
17
|
}
|
|
18
18
|
}
|