Skip to content

Commit

Permalink
Fix main export documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 1, 2024
1 parent a3a4e0a commit 8a4b4e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
No dependencies. Small package size: ![npm package minzipped size](https://img.shields.io/bundlejs/size/nano-spawn) [![Install size](https://packagephobia.com/badge?p=nano-spawn)](https://packagephobia.com/result?p=nano-spawn)

Despite the small size, this is packed with some essential features:
- [Promise-based](#nanospawnfile-arguments-options) interface.
- [Promise-based](#spawnfile-arguments-options-default-export) interface.
- [Iterate](#subprocesssymbolasynciterator) over the output lines.
- [Pipe](#subprocesspipefile-arguments-options) multiple subprocesses and retrieve [intermediate results](#resultpipedfrom).
- Execute [locally installed binaries](#optionspreferlocal) without `npx`.
Expand All @@ -22,7 +22,7 @@ Despite the small size, this is packed with some essential features:
- Get [interleaved output](#resultoutput) from stdout and stderr similar to what is printed on the terminal.
- Strip [unnecessary newlines](#resultstdout).
- Pass strings as [`stdin` input](#optionsstdin-optionsstdout-optionsstderr) to the subprocess.
- Preserve the current [Node.js version and flags](#nanospawnfile-arguments-options).
- Preserve the current [Node.js version and flags](#spawnfile-arguments-options-default-export).
- Simpler syntax to set [environment variables](#optionsenv) or [`stdin`/`stdout`/`stderr`](#optionsstdin-optionsstdout-optionsstderr).
- Compute the command [duration](#resultdurationms).

Expand Down Expand Up @@ -91,7 +91,7 @@ If `file` is `'node'`, the current Node.js version and [flags](https://nodejs.or

##### options.stdio, options.shell, options.timeout, options.signal, options.cwd, options.killSignal, options.serialization, options.detached, options.uid, options.gid, options.windowsVerbatimArguments, options.windowsHide, options.argv0

All [`child_process.spawn()` options](https://nodejs.org/api/child_process.html#child_processspawncommand-args-options) can be passed to `nanoSpawn()`.
All [`child_process.spawn()` options](https://nodejs.org/api/child_process.html#child_processspawncommand-args-options) can be passed to [`spawn()`](#spawnfile-arguments-options-default-export).

##### options.env

Expand Down Expand Up @@ -122,7 +122,7 @@ Subprocess's standard [input](https://en.wikipedia.org/wiki/Standard_streams#Sta

#### Subprocess

Subprocess started by [`nanoSpawn()`](#nanospawnfile-arguments-options).
Subprocess started by [`spawn()`](#spawnfile-arguments-options-default-export).

##### await subprocess

Expand Down Expand Up @@ -165,7 +165,7 @@ Similar to the `|` symbol in shells. [Pipe](https://nodejs.org/api/stream.html#r

This resolves with that second subprocess's [result](#result). If either subprocess is rejected, this is rejected with that subprocess's [error](#subprocesserror) instead.

This follows the same syntax as [`nanoSpawn(file, arguments?, options?)`](#nanospawnfile-arguments-options). It can be done multiple times in a row.
This follows the same syntax as [`spawn(file, arguments?, options?)`](#spawnfile-arguments-options-default-export). It can be done multiple times in a row.

##### await subprocess.nodeChildProcess

Expand Down
8 changes: 4 additions & 4 deletions source/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export type SubprocessError = Error & Result & {
};

/**
Subprocess started by `nanoSpawn()`.
Subprocess started by `spawn()`.
A subprocess is a promise that is either resolved with a successful `result` object or rejected with a `subprocessError`.
Expand Down Expand Up @@ -186,7 +186,7 @@ export type Subprocess = Promise<Result> & AsyncIterable<string> & {
This resolves with that second subprocess's result. If either subprocess is rejected, this is rejected with that subprocess's error instead.
This follows the same syntax as `nanoSpawn(file, arguments?, options?)`. It can be done multiple times in a row.
This follows the same syntax as `spawn(file, arguments?, options?)`. It can be done multiple times in a row.
@param file - The program/script to execute
@param arguments - Arguments to pass to `file` on execution.
Expand Down Expand Up @@ -239,5 +239,5 @@ for await (const line of spawn('ls', ['--oneline'])) {
//=> …
```
*/
export default function nanoSpawn(file: string, arguments?: readonly string[], options?: Options): Subprocess;
export default function nanoSpawn(file: string, options?: Options): Subprocess;
export default function spawn(file: string, arguments?: readonly string[], options?: Options): Subprocess;
export default function spawn(file: string, options?: Options): Subprocess;

0 comments on commit 8a4b4e7

Please sign in to comment.