{"_id":"sync-child-process","_rev":"5-39b1e661920e11445362260e4eb16b9e","name":"sync-child-process","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"sync-child-process","version":"1.0.0","author":{"name":"Google Inc."},"license":"MIT","_id":"sync-child-process@1.0.0","maintainers":[{"name":"nex3","email":"nex342@gmail.com"}],"homepage":"https://github.com/sass/sync-child-process#readme","bugs":{"url":"https://github.com/sass/sync-child-process/issues"},"dist":{"shasum":"1b29d5e33d7606d960ace7c08fd1b4944e6f900b","tarball":"https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.0.0.tgz","fileCount":13,"integrity":"sha512-kbn3D+9BCU4KNwJXAifmyiYeVJF/kfhX5HWfw8UzQgg1P/tgolcIEpoaZmhm+Qdgojt0lQkLZ7GxxG4y4zOEZA==","signatures":[{"sig":"MEUCIQCqj2sfuM4essNEPMV3xxX+Pbp5nRjM84abjtPznGqeNgIgLw7yuywfcQ6pTBQYZw42ZlnJAgIDPHBXQ0FaPHG7EuQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":57717},"main":"dist/lib/index.js","types":"dist/lib/index.d.ts","engines":{"node":">=16.0.0"},"exports":{"types":"./dist/lib/index.d.ts","default":"./dist/lib/index.js"},"gitHead":"5b8e9bbb11d421e5bc4eada78b1b437ee1f9f4df","scripts":{"fix":"gts fix","test":"jest","check":"npm-run-all check:gts check:tsc","clean":"gts clean","compile":"tsc -p tsconfig.build.json","check:gts":"gts check","check:tsc":"tsc --noEmit"},"_npmUser":{"name":"nex3","email":"nex342@gmail.com"},"repository":{"url":"git+https://github.com/sass/sync-child-process.git","type":"git"},"_npmVersion":"10.7.0","description":"Run a subprocess synchronously and interactively in Node.js","directories":{},"_nodeVersion":"22.2.0","dependencies":{"sync-message-port":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"gts":"^6.0.2","jest":"^29.4.1","ts-jest":"^29.0.5","ts-node":"^10.2.1","typescript":"^5.0.2","@types/jest":"^29.4.0","@types/node":"^22.0.0","npm-run-all":"^4.1.5"},"_npmOperationalInternal":{"tmp":"tmp/sync-child-process_1.0.0_1730413061479_0.7451385408934939","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"sync-child-process","version":"1.0.1","author":{"name":"Google Inc."},"license":"MIT","_id":"sync-child-process@1.0.1","maintainers":[{"name":"nex3","email":"nex342@gmail.com"}],"homepage":"https://github.com/sass/sync-child-process#readme","bugs":{"url":"https://github.com/sass/sync-child-process/issues"},"dist":{"shasum":"74d298fe5449db09e39cdb318262c8a31191f8a9","tarball":"https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.0.1.tgz","fileCount":13,"integrity":"sha512-acr1BU3LMG0hsRibMJQ26fm8d+BaEttt6gsDDMKMawD4286K9GyLzS6Lo7+9V8VGKIT8FIBu6yywgWn3DtYUDw==","signatures":[{"sig":"MEUCIQCtqlUbVed2gbrzykJ9HuWcuP8jh0+z0ygSw8+7+Pm1ZwIgbZP1gW7shs4NxYAL+cRCicJ7aFY+ClByZyVbJIpW2Vw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":58725},"main":"dist/lib/index.js","types":"dist/lib/index.d.ts","engines":{"node":">=16.0.0"},"exports":{"types":"./dist/lib/index.d.ts","default":"./dist/lib/index.js"},"gitHead":"df51425d5b0a5a4cb15f1d641191fdf08a68f28a","scripts":{"fix":"gts fix","test":"jest","check":"npm-run-all check:gts check:tsc","clean":"gts clean","compile":"tsc -p tsconfig.build.json","check:gts":"gts check","check:tsc":"tsc --noEmit"},"_npmUser":{"name":"nex3","email":"nex342@gmail.com"},"repository":{"url":"git+https://github.com/sass/sync-child-process.git","type":"git"},"_npmVersion":"10.9.0","description":"Run a subprocess synchronously and interactively in Node.js","directories":{},"_nodeVersion":"22.11.0","dependencies":{"sync-message-port":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"gts":"^6.0.2","jest":"^29.4.1","ts-jest":"^29.0.5","ts-node":"^10.2.1","typedoc":"^0.26.11","typescript":"^5.0.2","@types/jest":"^29.4.0","@types/node":"^22.0.0","npm-run-all":"^4.1.5"},"_npmOperationalInternal":{"tmp":"tmp/sync-child-process_1.0.1_1730752115008_0.9401003514741739","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"sync-child-process","version":"1.0.2","author":{"name":"Google Inc."},"license":"MIT","_id":"sync-child-process@1.0.2","maintainers":[{"name":"nex3","email":"nex342@gmail.com"}],"homepage":"https://github.com/sass/sync-child-process#readme","bugs":{"url":"https://github.com/sass/sync-child-process/issues"},"dist":{"shasum":"45e7c72e756d1243e80b547ea2e17957ab9e367f","tarball":"https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.0.2.tgz","fileCount":13,"integrity":"sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==","signatures":[{"sig":"MEQCIA59d7FT6T2w5Xu37LqJxn+MDvPowyX7smCa+cSWpm/kAiBHbF8dmb+AmEWnkfH4akgGAEAQUrWi4+GSW9WFXoKbXA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":58760},"main":"dist/lib/index.js","types":"dist/lib/index.d.ts","engines":{"node":">=16.0.0"},"exports":{"types":"./dist/lib/index.d.ts","default":"./dist/lib/index.js"},"gitHead":"a1924b347d16dd49c40993480c9726772697b1c1","scripts":{"doc":"typedoc lib/index.ts","fix":"gts fix","test":"jest","check":"npm-run-all check:gts check:tsc","clean":"gts clean","compile":"tsc -p tsconfig.build.json","check:gts":"gts check","check:tsc":"tsc --noEmit"},"_npmUser":{"name":"nex3","email":"nex342@gmail.com"},"repository":{"url":"git+https://github.com/sass/sync-child-process.git","type":"git"},"_npmVersion":"10.9.0","description":"Run a subprocess synchronously and interactively in Node.js","directories":{},"_nodeVersion":"22.11.0","dependencies":{"sync-message-port":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"gts":"^6.0.2","jest":"^29.4.1","ts-jest":"^29.0.5","ts-node":"^10.2.1","typedoc":"^0.26.11","typescript":"^5.0.2","@types/jest":"^29.4.0","@types/node":"^22.0.0","npm-run-all":"^4.1.5"},"_npmOperationalInternal":{"tmp":"tmp/sync-child-process_1.0.2_1730754212564_0.37212100385481417","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"sync-child-process","version":"1.1.0","author":{"name":"Google Inc."},"license":"MIT","_id":"sync-child-process@1.1.0","maintainers":[{"name":"nex3","email":"nex342@gmail.com"}],"homepage":"https://github.com/sass/sync-child-process#readme","bugs":{"url":"https://github.com/sass/sync-child-process/issues"},"dist":{"shasum":"0fef1ab6c8f23133c3adce055033f39c66370bcd","tarball":"https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.1.0.tgz","fileCount":13,"integrity":"sha512-1LMf/x0kU0CKFSesh5DfYktvj1KhiqYi5LAh5HU2G4SkKk1TGDhsMFBOL47g/E+mNfYpgs365pVNlIYOIHPvlQ==","signatures":[{"sig":"MEYCIQDa1rUDGim73Q8KkH7d/G4vh4MWkTKEuIyEnT9b/7sXEQIhAOwkgPfNW/I7KISBCitB9owJDBxufq/r5xdGgyWjgagv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCQBGZG+C+OnQ0QeKFlZ/B9P5SJVhh8Q36jcNe3WHM1IAIhAPSJ5CAqjN+tp1c8fMe1O/c68GXvyTEHea34G9L6ojiN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/sync-child-process@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":147623},"main":"dist/lib/index.js","types":"dist/lib/index.d.ts","engines":{"node":">=16.0.0"},"exports":{"types":"./dist/lib/index.d.ts","default":"./dist/lib/index.js"},"gitHead":"ea3886972cca7e0b22515a4db0cbcffb5d47cd7a","scripts":{"doc":"typedoc lib/index.ts","fix":"gts fix","test":"jest","check":"npm-run-all check:gts check:tsc","clean":"gts clean","compile":"tsc -p tsconfig.build.json","check:gts":"gts check","check:tsc":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"6fb1138b-de70-497d-ac94-8860607e8e5a"}},"repository":{"url":"git+https://github.com/sass/sync-child-process.git","type":"git"},"_npmVersion":"12.2.0","description":"Run a subprocess synchronously and interactively in Node.js","directories":{},"_nodeVersion":"24.22.0","dependencies":{"sync-message-port":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"gts":"^7.0.0","jest":"^30.0.2","ts-jest":"^29.4.11","ts-node":"^10.2.1","typedoc":"^0.28.0","typescript":"npm:@typescript/typescript6@^6.0.2","@types/jest":"^30.0.0","@types/node":"^26.0.0","npm-run-all":"^4.1.5","@typescript/native":"npm:typescript@^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/sync-child-process_1.1.0_1792112665317_0.31400404554540007","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"_id":"sync-child-process@1.1.1","bugs":{"url":"https://github.com/sass/sync-child-process/issues"},"dist":{"shasum":"b09b8975f12cb6cd07627ee4cc329f280022aa9f","tarball":"https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.1.1.tgz","fileCount":13,"integrity":"sha512-54zMOnH5qgjdKW8SGpCx3daSP+v+TtTfOxgPdhUE3P0hytMMpknZfP67S4JeRcx5IQRWJERz6890yO4dkTywww==","signatures":[{"sig":"MEUCIDiwyRUsTEgk9vgiMCItIQg6Jmu9T6TNb+I3CcKCWVVfAiEAhYbYyW3H3HaP0GTIYI9p8RFJn53yt63UCVYULTW2vaw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCaCBMGPlHFStOeRo3Te2SUKBp1UlBVuZt15fSiuN4CoQIhAJc8sSyAaf8OSDw2pVnIjUFLqLSa9Xmw+egQV9rLsBLS"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/sync-child-process@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":147983},"main":"dist/lib/index.js","name":"sync-child-process","types":"dist/lib/index.d.ts","author":{"name":"Google Inc."},"engines":{"node":">=16.0.0"},"exports":{"types":"./dist/lib/index.d.ts","default":"./dist/lib/index.js"},"gitHead":"51df4f8e4bf81d8721d2d54e50680598c83394e8","license":"MIT","scripts":{"doc":"typedoc lib/index.ts","fix":"gts fix","test":"jest","check":"npm-run-all check:gts check:tsc","clean":"gts clean","compile":"tsc -p tsconfig.build.json","check:gts":"gts check","check:tsc":"tsc --noEmit"},"version":"1.1.1","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"6fb1138b-de70-497d-ac94-8860607e8e5a"}},"homepage":"https://github.com/sass/sync-child-process#readme","repository":{"url":"git+https://github.com/sass/sync-child-process.git","type":"git"},"_npmVersion":"12.2.1","description":"Run a subprocess synchronously and interactively in Node.js","directories":{},"maintainers":[{"name":"nex3","email":"nex342@gmail.com"}],"_nodeVersion":"24.22.1","dependencies":{"sync-message-port":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"gts":"^7.0.0","jest":"^30.0.2","ts-jest":"^29.4.11","ts-node":"^10.2.1","typedoc":"^0.28.0","typescript":"npm:@typescript/typescript6@^6.0.2","@types/jest":"^30.0.0","@types/node":"^26.0.0","npm-run-all":"^4.1.5","@typescript/native":"npm:typescript@^7.0.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sync-child-process_1.1.1_1793050279404_0.9192352061819784"}}},"time":{"created":"2024-10-31T22:17:41.478Z","modified":"2026-10-26T21:31:20.253Z","1.0.0":"2024-10-31T22:17:41.774Z","1.0.1":"2024-11-04T20:28:35.172Z","1.0.2":"2024-11-04T21:03:32.727Z","1.1.0":"2026-10-16T01:04:25.432Z","1.1.1":"2026-10-26T21:31:19.502Z"},"bugs":{"url":"https://github.com/sass/sync-child-process/issues"},"author":{"name":"Google Inc."},"license":"MIT","homepage":"https://github.com/sass/sync-child-process#readme","repository":{"url":"git+https://github.com/sass/sync-child-process.git","type":"git"},"description":"Run a subprocess synchronously and interactively in Node.js","maintainers":[{"name":"nex3","email":"nex342@gmail.com"}],"readme":"# `sync-child-process`\n\nThis package exposes a `SyncChildProcess` class that allows Node.js to run a\nsubprocess synchronously *and* interactively.\n\n[**API Docs**]\n\n[**API Docs**]: https://sass.github.io/sync-child-process/classes/SyncChildProcess.html\n\n## Usage\n\nUse [`new SyncChildProcess()`] to start running a subprocess. This supports the\nsame API as [`child_process.spawn()`] other than a few options. You can send\ninput to the process using [`process.stdin`], and receive events from it\n(stdout, stderr, or exit) using [`process.next()`]. This implements [the\niterator protocol], but *not* the iterable protocol because it's intrinsically\nstateful.\n\n[`new SyncChildProcess()`]: https://sass.github.io/sync-child-process/classes/SyncChildProcess.html#constructor\n[`child_process.spawn()`]: https://nodejs.org/api/child_process.html#child_processspawncommand-args-options\n[`process.stdin`]: https://sass.github.io/sync-child-process/classes/SyncChildProcess.html#stdin\n[`process.next()`]: https://sass.github.io/sync-child-process/classes/SyncChildProcess.html#next\n[the iterator protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterator_protocol\n\n```js\nimport {SyncChildProcess} from 'sync-child-process';\n// or\n// const {SyncChildProcess} = require('sync-child-process');\n\nconst node = new SyncChildProcess('node', ['--interactive']);\n\nfor (;;) {\n  if (node.next().value.data.toString().endsWith('> ')) break;\n}\n\nnode.stdin.write(\"41 * Math.pow(2, 5)\\n\");\nconsole.log((node.next().value.data.toString().split(\"\\n\")[0]));\nnode.stdin.write(\".exit\\n\");\nconsole.log(`Node exited with exit code ${node.next().value.code}`);\n```\n\n## Why synchrony?\n\nSee [the `sync-message-port` documentation] for an explanation of why running\ncode synchronously can be valuable even in an asynchronous ecosystem like\nNode.js\n\n[the `sync-message-port` documentation]: https://github.com/sass/sync-message-port?tab=readme-ov-file#why-synchrony\n\n### Why not `child_process.spawnSync()`?\n\nAlthough Node's built-in [`child_process.spawnSync()`] function does run\nsynchronously, it's not interactive. It only returns once the process has run to\ncompletion and exited, which means it's not suitable for any long-lived\nsubprocess that interleaves sending and receiving data, such as when using the\n[embedded Sass protocol].\n\n[`child_process.spawnSync()`]: https://nodejs.org/api/child_process.html#child_processspawnsynccommand-args-options\n[embedded Sass protocol]: https://github.com/sass/sass/blob/main/spec/embedded-protocol.md\n\n---\n\nDisclaimer: this is not an official Google product.\n","readmeFilename":"README.md"}