diff --git a/package-lock.json b/package-lock.json index 88bbcaf..6496dde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 0c113b5..1f0217b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/fs/bundle.ts b/src/fs/bundle.ts index a20997d..74588d7 100644 --- a/src/fs/bundle.ts +++ b/src/fs/bundle.ts @@ -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 { this.zip.finalize() - return await new Promise((resolve) => - highland(this.zip).toArray((arr: Array) => 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))) + }) } }