sync.js
This file
Path
lib/stdio/sync.js
54 lines · 1.7 KiB · JavaScript
Last changed by
Add support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
History of this fileTake it
The walk stopped after 200 commits: lines older than 7122767 point at it.
Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
lines 1–2why, one step back1import {readFileSync} from 'node:fs';2import {bufferToUint8Array} from './uint-array.js';Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767
lines 3–5why, one step back3import {handleInput} from './handle.js';4import {TYPE_TO_MESSAGE} from './type.js';5Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
line 6why, one step back6// Normalize `input`, `inputFile`, `stdin`, `stdout` and `stderr` options, before spawning, in sync modeAdd support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
line 7why, one step back7export const handleInputSync = (options, verboseInfo) => handleInput(addPropertiesSync, options, verboseInfo, true);Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767
lines 8–9why, one step back89const forbiddenIfSync = ({type, optionName}) => {Improve validation of `execaSync()` options (#940)ehmickybefore adoptionf6e1ac1
line 10why, one step back10 throwInvalidSyncValue(optionName, TYPE_TO_MESSAGE[type]);Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767
lines 11–12why, one step back11};12Improve validation of `execaSync()` options (#940)ehmickybefore adoptionf6e1ac1
line 13why, one step back13const forbiddenNativeIfSync = ({optionName, value}) => {Do not allow `overlapped` with `execaSync()` (#949)ehmickybefore adoption7c2f575
line 14why, one step back14 if (value === 'ipc' || value === 'overlapped') {Improve validation of `execaSync()` options (#940)ehmickybefore adoptionf6e1ac1
lines 15–21why, one step back15 throwInvalidSyncValue(optionName, `"${value}"`);16 }1718 return {};19};2021const throwInvalidSyncValue = (optionName, value) => {Improve validation of `execaSync()` `stdio` option (#941)ehmickybefore adoptioncc565f9
line 22why, one step back22 throw new TypeError(`The \`${optionName}\` option cannot be ${value} with synchronous methods.`);Improve validation of `execaSync()` options (#940)ehmickybefore adoptionf6e1ac1
lines 23–24why, one step back23};24Refactor tests (#934)ehmickybefore adoption52c4bde
line 25why, one step back25const addProperties = {Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
lines 26–27why, one step back26 generator() {},27 asyncGenerator: forbiddenIfSync,Refactor tests (#934)ehmickybefore adoption52c4bde
lines 28–29why, one step back28 webStream: forbiddenIfSync,29 nodeStream: forbiddenIfSync,Add support for `std*: TransformStream` option (#938)ehmickybefore adoption45824d6
line 30why, one step back30 webTransform: forbiddenIfSync,Add support for `std*: duplex` option (#937)ehmickybefore adoption6ca44fb
line 31why, one step back31 duplex: forbiddenIfSync,Add support for sync iterables with `execaSync()` (#944)ehmickybefore adoptionf744f7d
line 32why, one step back32 asyncIterable: forbiddenIfSync,Improve validation of `execaSync()` options (#940)ehmickybefore adoptionf6e1ac1
line 33why, one step back33 native: forbiddenNativeIfSync,Refactor tests (#934)ehmickybefore adoption52c4bde
lines 34–35why, one step back34};35Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767
lines 36–37why, one step back36const addPropertiesSync = {37 input: {Refactor tests (#934)ehmickybefore adoption52c4bde
line 38why, one step back38 ...addProperties,Add support for sync iterables with `execaSync()` (#944)ehmickybefore adoptionf744f7d
lines 39–43why, one step back39 fileUrl: ({value}) => ({contents: [bufferToUint8Array(readFileSync(value))]}),40 filePath: ({value: {file}}) => ({contents: [bufferToUint8Array(readFileSync(file))]}),41 iterable: ({value}) => ({contents: [...value]}),42 string: ({value}) => ({contents: [value]}),43 uint8Array: ({value}) => ({contents: [value]}),Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767
lines 44–45why, one step back44 },45 output: {Refactor tests (#934)ehmickybefore adoption52c4bde
line 46why, one step back46 ...addProperties,Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
lines 47–48why, one step back47 fileUrl: ({value}) => ({path: value}),48 filePath: ({value: {file}}) => ({path: file}),Add support for `std*: ['pipe', 'inherit']` with `execaSync()` (#954)ehmickybefore adoptionc15edbc
line 49why, one step back49 fileNumber: ({value}) => ({path: value}),Add support for sync iterables with `execaSync()` (#944)ehmickybefore adoptionf744f7d
line 50why, one step back50 iterable: forbiddenIfSync,Refactor `stdio` option (#927)ehmickybefore adoptionc9cdd2d
line 51why, one step back51 string: forbiddenIfSync,Allow `stdin: uint8Array` option (#670)ehmickybefore adoption2ac81d4
line 52why, one step back52 uint8Array: forbiddenIfSync,Use `async/await` instead of direct `Promise` manipulation (#659)ehmickybefore adoption7122767
lines 53–54why, one step back53 },54};