fetch-css 4.0.10 → 4.0.12
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 +12 -3
- package/package.json +10 -10
package/index.js
CHANGED
|
@@ -11,6 +11,15 @@ import fetchEnhanced from "fetch-enhanced";
|
|
|
11
11
|
const fetch = fetchEnhanced(undiciFetch, {undici: true});
|
|
12
12
|
const clone = cloner();
|
|
13
13
|
|
|
14
|
+
async function doFetch(url, opts) {
|
|
15
|
+
try {
|
|
16
|
+
return await fetch(url, opts);
|
|
17
|
+
} catch (err) {
|
|
18
|
+
err.message = `${err.message} (${url})`;
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
async function extract(res) {
|
|
15
24
|
const styleUrls = [];
|
|
16
25
|
const styleTags = [];
|
|
@@ -106,7 +115,7 @@ async function extensionCss({crx, contentScriptsOnly, strict}) {
|
|
|
106
115
|
url += `&x=id%3D${crx}`;
|
|
107
116
|
url += `%26uc`;
|
|
108
117
|
|
|
109
|
-
const res = await
|
|
118
|
+
const res = await doFetch(url);
|
|
110
119
|
validateStatus(res, url, strict);
|
|
111
120
|
|
|
112
121
|
const crxBuffer = arrayBufferToBufferCycle(await res.arrayBuffer());
|
|
@@ -176,7 +185,7 @@ export default async function fetchCss(sources) { // eslint-disable-line import/
|
|
|
176
185
|
const sourceResponses = await Promise.all(sources.map(source => {
|
|
177
186
|
if (!source.url) return null;
|
|
178
187
|
const {pathname} = new URL(source.url);
|
|
179
|
-
return pathname.endsWith(".css") || pathname.endsWith(".js") ? null :
|
|
188
|
+
return pathname.endsWith(".css") || pathname.endsWith(".js") ? null : doFetch(source.url, source.fetchOpts);
|
|
180
189
|
}));
|
|
181
190
|
|
|
182
191
|
for (const [index, res] of Object.entries(sourceResponses)) {
|
|
@@ -193,7 +202,7 @@ export default async function fetchCss(sources) { // eslint-disable-line import/
|
|
|
193
202
|
|
|
194
203
|
const fetchResponses = await Promise.all(sources.map(source => {
|
|
195
204
|
if (!source.url) return null;
|
|
196
|
-
return Promise.all(source.urls.map(url =>
|
|
205
|
+
return Promise.all(source.urls.map(url => doFetch(url).then(res => res.text())));
|
|
197
206
|
}));
|
|
198
207
|
|
|
199
208
|
for (const [index, responses] of Object.entries(fetchResponses)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fetch-css",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.12",
|
|
4
4
|
"description": "Extract CSS from websites and browser extensions",
|
|
5
5
|
"author": "silverwind",
|
|
6
6
|
"repository": "silverwind/fetch-css",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"crx-to-zip.js"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"acorn": "8.
|
|
25
|
+
"acorn": "8.10.0",
|
|
26
26
|
"crypto-js": "4.1.1",
|
|
27
|
-
"fetch-enhanced": "11.1.
|
|
27
|
+
"fetch-enhanced": "11.1.2",
|
|
28
28
|
"parse5": "7.1.2",
|
|
29
|
-
"postcss": "8.4.
|
|
29
|
+
"postcss": "8.4.25",
|
|
30
30
|
"rfdc": "1.3.0",
|
|
31
|
-
"undici": "5.22.
|
|
32
|
-
"unzipper": "0.10.
|
|
31
|
+
"undici": "5.22.1",
|
|
32
|
+
"unzipper": "0.10.14",
|
|
33
33
|
"url-toolkit": "2.2.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"eslint": "8.
|
|
37
|
-
"eslint-config-silverwind": "
|
|
38
|
-
"updates": "14.
|
|
39
|
-
"versions": "11.0.
|
|
36
|
+
"eslint": "8.44.0",
|
|
37
|
+
"eslint-config-silverwind": "73.1.2",
|
|
38
|
+
"updates": "14.3.2",
|
|
39
|
+
"versions": "11.0.1"
|
|
40
40
|
}
|
|
41
41
|
}
|