Remove highland as a dependency.

This commit is contained in:
Bryce Gibson
2023-03-22 20:41:44 +11:00
parent 053712c8d3
commit ec8597c124
3 changed files with 13 additions and 23 deletions
-17
View File
@@ -19,7 +19,6 @@
"download": "^8.0.0",
"globby": "^11.0.2",
"got": "^11.8.2",
"highland": "^2.13.5",
"lodash": "^4.17.21",
"meriyah": "^4.3.3",
"minimist": "^1.2.6",
@@ -2515,14 +2514,6 @@
"he": "bin/he"
}
},
"node_modules/highland": {
"version": "2.13.5",
"resolved": "https://registry.npmjs.org/highland/-/highland-2.13.5.tgz",
"integrity": "sha512-dn2flPapIIAa4BtkB2ahjshg8iSJtrJtdhEb9/oiOrS5HMQTR/GuhFpqJ+11YBdtnl3AwWKvbZd1Uxr8uAmA7A==",
"dependencies": {
"util-deprecate": "^1.0.2"
}
},
"node_modules/http-cache-semantics": {
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz",
@@ -7186,14 +7177,6 @@
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true
},
"highland": {
"version": "2.13.5",
"resolved": "https://registry.npmjs.org/highland/-/highland-2.13.5.tgz",
"integrity": "sha512-dn2flPapIIAa4BtkB2ahjshg8iSJtrJtdhEb9/oiOrS5HMQTR/GuhFpqJ+11YBdtnl3AwWKvbZd1Uxr8uAmA7A==",
"requires": {
"util-deprecate": "^1.0.2"
}
},
"http-cache-semantics": {
"version": "3.8.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz",
-1
View File
@@ -54,7 +54,6 @@
"download": "^8.0.0",
"globby": "^11.0.2",
"got": "^11.8.2",
"highland": "^2.13.5",
"lodash": "^4.17.21",
"meriyah": "^4.3.3",
"minimist": "^1.2.6",
+13 -5
View File
@@ -6,14 +6,19 @@ import { argv } from '../options'
import { File } from 'resolve-dependencies'
import MultiStream = require('multistream')
const archiver: any = require('archiver')
const highland: any = require('highland')
function makeRelativeToZip(cwd: string, path: string) {
return '/snapshot/' + relative(cwd, path)
}
export function toStream(content: Buffer | string) {
return highland([content])
const readable = new Readable({
read() {
this.push(content)
this.push(null)
},
})
return readable
}
export class Bundle {
cwd: string
@@ -42,8 +47,11 @@ export class Bundle {
public async toBuffer(): Promise<Buffer> {
this.zip.finalize()
return await new Promise((resolve) =>
highland(this.zip).toArray((arr: Array<Buffer>) => resolve(Buffer.concat(arr)))
)
const zipData: Buffer[] = []
this.zip.on('data', (data: Buffer) => zipData.push(data))
return await new Promise((resolve, reject) => {
this.zip.on('error', (error: Error) => reject(error))
this.zip.on('end', () => resolve(Buffer.concat(zipData)))
})
}
}