@parcel/utils
Advanced tools
Comparing version 2.0.0-nightly.173 to 2.0.0-nightly.177
@@ -74,4 +74,5 @@ "use strict"; | ||
} | ||
}); | ||
}); // $FlowFixMe Added in Flow 0.121.0 upgrade in #4381 | ||
return (0, _fastGlob.default)(normalizePath(p), options); | ||
} |
@@ -10,2 +10,4 @@ "use strict"; | ||
exports.blobToStream = blobToStream; | ||
exports.streamFromPromise = streamFromPromise; | ||
exports.fallbackStream = fallbackStream; | ||
@@ -52,2 +54,27 @@ var _stream = require("stream"); | ||
return readableFromStringOrBuffer(blob); | ||
} | ||
function streamFromPromise(promise) { | ||
const stream = new _stream.PassThrough(); | ||
promise.then(blob => { | ||
if (blob instanceof _stream.Readable) { | ||
blob.pipe(stream); | ||
} else { | ||
stream.end(blob); | ||
} | ||
}); | ||
return stream; | ||
} | ||
function fallbackStream(stream, fallback) { | ||
const res = new _stream.PassThrough(); | ||
stream.on('error', err => { | ||
if (err.code === 'ENOENT') { | ||
fallback().pipe(res); | ||
} else { | ||
res.emit('error', err); | ||
} | ||
}); | ||
stream.pipe(res); | ||
return res; | ||
} |
{ | ||
"name": "@parcel/utils", | ||
"version": "2.0.0-nightly.173+bac3f05f", | ||
"version": "2.0.0-nightly.177+db7e3a12", | ||
"description": "Blazing fast, zero configuration web application bundler", | ||
@@ -20,6 +20,6 @@ "license": "MIT", | ||
"@iarna/toml": "^2.2.0", | ||
"@parcel/codeframe": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/diagnostic": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/logger": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/markdown-ansi": "2.0.0-nightly.173+bac3f05f", | ||
"@parcel/codeframe": "2.0.0-nightly.177+db7e3a12", | ||
"@parcel/diagnostic": "2.0.0-nightly.177+db7e3a12", | ||
"@parcel/logger": "2.0.0-nightly.177+db7e3a12", | ||
"@parcel/markdown-ansi": "2.0.0-nightly.177+db7e3a12", | ||
"ansi-html": "^0.0.7", | ||
@@ -44,3 +44,3 @@ "chalk": "^2.4.2", | ||
}, | ||
"gitHead": "bac3f05fa31574338f14ab9cd2c9bd78fb1c22ee" | ||
"gitHead": "db7e3a12105630abc44058bff7a88eb612f12e75" | ||
} |
@@ -69,3 +69,4 @@ // @flow | ||
// $FlowFixMe Added in Flow 0.121.0 upgrade in #4381 | ||
return fastGlob(normalizePath(p), options); | ||
} |
// @flow strict-local | ||
import {Readable} from 'stream'; | ||
import {Readable, PassThrough} from 'stream'; | ||
import type {Blob} from '@parcel/types'; | ||
@@ -45,1 +45,31 @@ | ||
} | ||
export function streamFromPromise(promise: Promise<Blob>): Readable { | ||
const stream = new PassThrough(); | ||
promise.then(blob => { | ||
if (blob instanceof Readable) { | ||
blob.pipe(stream); | ||
} else { | ||
stream.end(blob); | ||
} | ||
}); | ||
return stream; | ||
} | ||
export function fallbackStream( | ||
stream: Readable, | ||
fallback: () => Readable, | ||
): Readable { | ||
const res = new PassThrough(); | ||
stream.on('error', err => { | ||
if (err.code === 'ENOENT') { | ||
fallback().pipe(res); | ||
} else { | ||
res.emit('error', err); | ||
} | ||
}); | ||
stream.pipe(res); | ||
return res; | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
132425
4150