builder-util-runtime
Advanced tools
Comparing version 8.2.5 to 8.3.0
@@ -15,12 +15,2 @@ "use strict"; | ||
function _bluebirdLst() { | ||
const data = require("bluebird-lst"); | ||
_bluebirdLst = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _crypto() { | ||
@@ -38,12 +28,4 @@ const data = require("crypto"); | ||
function _fsExtraP() { | ||
const data = require("fs-extra-p"); | ||
var _fs = require("fs"); | ||
_fsExtraP = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _stream() { | ||
@@ -228,71 +210,66 @@ const data = require("stream"); | ||
downloadToBuffer(url, options) { | ||
var _this = this; | ||
async downloadToBuffer(url, options) { | ||
return await options.cancellationToken.createPromise((resolve, reject, onCancel) => { | ||
let result = null; | ||
const requestOptions = { | ||
headers: options.headers || undefined, | ||
// because PrivateGitHubProvider requires HttpExecutor.prepareRedirectUrlOptions logic, so, we need to redirect manually | ||
redirect: "manual" | ||
}; | ||
configureRequestUrl(url, requestOptions); | ||
configureRequestOptions(requestOptions); | ||
this.doDownload(requestOptions, { | ||
destination: null, | ||
options, | ||
onCancel, | ||
callback: error => { | ||
if (error == null) { | ||
resolve(result); | ||
} else { | ||
reject(error); | ||
} | ||
}, | ||
responseHandler: (response, callback) => { | ||
const contentLength = safeGetHeader(response, "content-length"); | ||
let position = -1; | ||
return (0, _bluebirdLst().coroutine)(function* () { | ||
return yield options.cancellationToken.createPromise((resolve, reject, onCancel) => { | ||
let result = null; | ||
const requestOptions = { | ||
headers: options.headers || undefined, | ||
// because PrivateGitHubProvider requires HttpExecutor.prepareRedirectUrlOptions logic, so, we need to redirect manually | ||
redirect: "manual" | ||
}; | ||
configureRequestUrl(url, requestOptions); | ||
configureRequestOptions(requestOptions); | ||
if (contentLength != null) { | ||
const size = parseInt(contentLength, 10); | ||
_this.doDownload(requestOptions, { | ||
destination: null, | ||
options, | ||
onCancel, | ||
callback: error => { | ||
if (error == null) { | ||
resolve(result); | ||
} else { | ||
reject(error); | ||
if (size > 0) { | ||
if (size > 5242880) { | ||
callback(new Error("Maximum allowed size is 5 MB")); | ||
return; | ||
} | ||
result = Buffer.alloc(size); | ||
position = 0; | ||
} | ||
}, | ||
responseHandler: (response, callback) => { | ||
const contentLength = safeGetHeader(response, "content-length"); | ||
let position = -1; | ||
} | ||
if (contentLength != null) { | ||
const size = parseInt(contentLength, 10); | ||
response.on("data", chunk => { | ||
if (position !== -1) { | ||
chunk.copy(result, position); | ||
position += chunk.length; | ||
} else if (result == null) { | ||
result = chunk; | ||
} else { | ||
if (result.length > 5242880) { | ||
callback(new Error("Maximum allowed size is 5 MB")); | ||
return; | ||
} | ||
if (size > 0) { | ||
if (size > 5242880) { | ||
callback(new Error("Maximum allowed size is 5 MB")); | ||
return; | ||
} | ||
result = Buffer.alloc(size); | ||
position = 0; | ||
} | ||
result = Buffer.concat([result, chunk]); | ||
} | ||
response.on("data", chunk => { | ||
if (position !== -1) { | ||
chunk.copy(result, position); | ||
position += chunk.length; | ||
} else if (result == null) { | ||
result = chunk; | ||
} else { | ||
if (result.length > 5242880) { | ||
callback(new Error("Maximum allowed size is 5 MB")); | ||
return; | ||
} | ||
result = Buffer.concat([result, chunk]); | ||
} | ||
}); | ||
response.on("end", () => { | ||
if (result != null && position !== -1 && position !== result.length) { | ||
callback(new Error(`Received data length ${position} is not equal to expected ${result.length}`)); | ||
} else { | ||
callback(null); | ||
} | ||
}); | ||
} | ||
}, 0); | ||
}); | ||
})(); | ||
}); | ||
response.on("end", () => { | ||
if (result != null && position !== -1 && position !== result.length) { | ||
callback(new Error(`Received data length ${position} is not equal to expected ${result.length}`)); | ||
} else { | ||
callback(null); | ||
} | ||
}); | ||
} | ||
}, 0); | ||
}); | ||
} | ||
@@ -483,3 +460,3 @@ | ||
const fileOut = (0, _fsExtraP().createWriteStream)(options.destination); | ||
const fileOut = (0, _fs.createWriteStream)(options.destination); | ||
streams.push(fileOut); | ||
@@ -486,0 +463,0 @@ let lastStream = response; |
{ | ||
"name": "builder-util-runtime", | ||
"version": "8.2.5", | ||
"version": "8.3.0", | ||
"main": "out/index.js", | ||
@@ -14,8 +14,6 @@ "author": "Vladimir Krivosheev", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
"node": ">=8.0.0" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.1.1", | ||
"fs-extra-p": "^8.0.2", | ||
"bluebird-lst": "^1.0.9", | ||
"sax": "^1.2.4" | ||
@@ -22,0 +20,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
2
139887
1755
- Removedbluebird-lst@^1.0.9
- Removedfs-extra-p@^8.0.2
- Removedbluebird@3.7.2(transitive)
- Removedbluebird-lst@1.0.9(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedfs-extra-p@8.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removeduniversalify@0.1.2(transitive)