input.js
This file
Path
lib/stdio/input.js
50 lines · 1.3 KiB · JavaScript
Last changed by
Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
History of this fileTake it
The walk stopped after 200 commits: lines older than 76ff50b point at it.
Validate `input` option's type (#668)ehmickybefore adoption65742c6
line 1why, one step back1import {isReadableStream} from 'is-stream';Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
line 2why, one step back2import {isUint8Array} from './uint-array.js';Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13
line 3why, one step back3import {isUrl, isFilePathString} from './type.js';Refactor `timeout` option to use `async/await` (#650)ehmickybefore adoption76ff50b
line 4why, one step back4Allow using the `input`, `inputFile` and `stdin` options together (#666)ehmickybefore adoptionbeabd25
line 5why, one step back5// Append the `stdin` option with the `input` and `inputFile` optionsRefactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
lines 6–11why, one step back6export const handleInputOptions = ({input, inputFile}, fdNumber) => fdNumber === 07 ? [8 ...handleInputOption(input),9 ...handleInputFileOption(inputFile),10 ]11 : [];Refactor `timeout` option to use `async/await` (#650)ehmickybefore adoption76ff50b
line 12why, one step back12Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
line 13why, one step back13const handleInputOption = input => input === undefined ? [] : [{Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13
line 14why, one step back14 type: getInputType(input),Allow using the `input`, `inputFile` and `stdin` options together (#666)ehmickybefore adoptionbeabd25
lines 15–16why, one step back15 value: input,16 optionName: 'input',Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
line 17why, one step back17}];Refactor `timeout` option to use `async/await` (#650)ehmickybefore adoption76ff50b
line 18why, one step back18Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13
line 19why, one step back19const getInputType = input => {Upgrade `is-stream` to `4.0.1` (#835)ehmickybefore adoption9cd62aa
line 20why, one step back20 if (isReadableStream(input, {checkOpen: false})) {Validate `input` option's type (#668)ehmickybefore adoption65742c6
lines 21–27why, one step back21 return 'nodeStream';22 }2324 if (typeof input === 'string') {25 return 'string';26 }27Allow `stdin: uint8Array` option (#670)ehmickybefore adoption2ac81d4
line 28why, one step back28 if (isUint8Array(input)) {Validate `input` option's type (#668)ehmickybefore adoption65742c6
lines 29–34why, one step back29 return 'uint8Array';30 }3132 throw new Error('The `input` option must be a string, a Uint8Array or a Node.js Readable stream.');33};34Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
line 35why, one step back35const handleInputFileOption = inputFile => inputFile === undefined ? [] : [{Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13
line 36why, one step back36 ...getInputFileType(inputFile),Allow using the `input`, `inputFile` and `stdin` options together (#666)ehmickybefore adoptionbeabd25
line 37why, one step back37 optionName: 'inputFile',Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
line 38why, one step back38}];Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13
lines 39–49why, one step back3940const getInputFileType = inputFile => {41 if (isUrl(inputFile)) {42 return {type: 'fileUrl', value: inputFile};43 }4445 if (isFilePathString(inputFile)) {46 return {type: 'filePath', value: {file: inputFile}};47 }4849 throw new Error('The `inputFile` option must be a file path string or a file URL.');Refactor `timeout` option to use `async/await` (#650)ehmickybefore adoption76ff50b
line 50why, one step back50};