fetch-css 4.0.9 → 4.0.10
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 +10 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -63,6 +63,15 @@ function isValidCSS(string) {
|
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
function arrayBufferToBufferCycle(ab) {
|
|
67
|
+
const buffer = new Buffer(ab.byteLength);
|
|
68
|
+
const view = new Uint8Array(ab);
|
|
69
|
+
for (let i = 0; i < buffer.length; ++i) {
|
|
70
|
+
buffer[i] = view[i];
|
|
71
|
+
}
|
|
72
|
+
return buffer;
|
|
73
|
+
}
|
|
74
|
+
|
|
66
75
|
function extractCssFromJs(js) {
|
|
67
76
|
let css = "";
|
|
68
77
|
|
|
@@ -100,7 +109,7 @@ async function extensionCss({crx, contentScriptsOnly, strict}) {
|
|
|
100
109
|
const res = await fetch(url);
|
|
101
110
|
validateStatus(res, url, strict);
|
|
102
111
|
|
|
103
|
-
const crxBuffer = await res.
|
|
112
|
+
const crxBuffer = arrayBufferToBufferCycle(await res.arrayBuffer());
|
|
104
113
|
const zipBuffer = Buffer.from(crxToZip(crxBuffer));
|
|
105
114
|
|
|
106
115
|
const files = {};
|