Commit 20359d2
Changed files (5)
build/cli.js
build/core.d.ts
@@ -60,9 +60,11 @@ export interface Shell<S = false, R = S extends true ? ProcessOutput : ProcessPr
export declare const $: Shell & Options;
type ProcessStage = 'initial' | 'halted' | 'running' | 'fulfilled' | 'rejected';
type Resolve = (out: ProcessOutput) => void;
+type PromisifiedStream<D extends Writable> = D & PromiseLike<ProcessOutput & D>;
type PipeMethod = {
(dest: TemplateStringsArray, ...args: any[]): ProcessPromise;
- <D extends Writable>(dest: D): D & PromiseLike<ProcessOutput & D>;
+ (file: string): PromisifiedStream<Writable>;
+ <D extends Writable>(dest: D): PromisifiedStream<D>;
<D extends ProcessPromise>(dest: D): D;
};
export declare class ProcessPromise extends Promise<ProcessOutput> {
src/core.ts
@@ -219,10 +219,13 @@ type ProcessStage = 'initial' | 'halted' | 'running' | 'fulfilled' | 'rejected'
type Resolve = (out: ProcessOutput) => void
+type PromisifiedStream<D extends Writable> = D & PromiseLike<ProcessOutput & D>
+
type PipeDest = Writable | ProcessPromise | TemplateStringsArray | string
type PipeMethod = {
(dest: TemplateStringsArray, ...args: any[]): ProcessPromise
- <D extends Writable>(dest: D): D & PromiseLike<ProcessOutput & D>
+ (file: string): PromisifiedStream<Writable>
+ <D extends Writable>(dest: D): PromisifiedStream<D>
<D extends ProcessPromise>(dest: D): D
}
@@ -378,7 +381,7 @@ export class ProcessPromise extends Promise<ProcessOutput> {
source: keyof TSpawnStore,
dest: PipeDest,
...args: any[]
- ): (Writable & PromiseLike<ProcessPromise & Writable>) | ProcessPromise {
+ ): PromisifiedStream<Writable> | ProcessPromise {
if (isStringLiteral(dest, ...args))
return this.pipe[source](
$({
@@ -426,7 +429,7 @@ export class ProcessPromise extends Promise<ProcessOutput> {
from.once('end', () => dest.emit('end-piped-from')).pipe(dest)
fillEnd()
return promisifyStream(dest, this) as Writable &
- PromiseLike<ProcessPromise & Writable>
+ PromiseLike<ProcessOutput & Writable>
}
abort(reason?: string) {
test-d/core.test-d.ts
@@ -27,6 +27,7 @@ expectType<ProcessPromise>(p.nothrow())
expectType<ProcessPromise>(p.quiet())
expectType<ProcessPromise>(p.pipe($`cmd`))
expectType<ProcessPromise>(p.pipe`cmd`)
+expectType<Writable & PromiseLike<ProcessOutput & Writable>>(p.pipe('file'))
expectType<
typeof process.stdout & PromiseLike<ProcessOutput & typeof process.stdout>
>(p.pipe(process.stdout))
.size-limit.json
@@ -17,7 +17,7 @@
"README.md",
"LICENSE"
],
- "limit": "121.7 kB",
+ "limit": "121.8 kB",
"brotli": false,
"gzip": false
},
@@ -31,21 +31,21 @@
{
"name": "libdefs",
"path": "build/*.d.ts",
- "limit": "40.00 kB",
+ "limit": "40.2 kB",
"brotli": false,
"gzip": false
},
{
"name": "vendor",
"path": "build/vendor-*",
- "limit": "769.10 kB",
+ "limit": "769.1 kB",
"brotli": false,
"gzip": false
},
{
"name": "all",
"path": ["build/*", "man/*", "README.md", "LICENSE"],
- "limit": "872.50 kB",
+ "limit": "872.6 kB",
"brotli": false,
"gzip": false
}