appium-espresso-driver 10.0.3 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/lib/execute-method-map.d.ts +16 -0
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/espresso-server/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk +0 -0
- package/espresso-server/buildSrc/.gradle/9.7.1/executionHistory/executionHistory.bin +0 -0
- package/espresso-server/buildSrc/.gradle/9.7.1/executionHistory/executionHistory.lock +0 -0
- package/espresso-server/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/espresso-server/buildSrc/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/espresso-server/buildSrc/build/kotlin/compileKotlin/cacheable/last-build.bin +0 -0
- package/espresso-server/gradle/libs.versions.toml +2 -0
- package/espresso-server/library/build.gradle.kts +3 -0
- package/espresso-server/library/src/composeOn/java/io/appium/espressoserver/lib/helpers/ComposeNodeFinder.kt +3 -3
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/handlers/exceptions/XPathLookupException.kt +10 -2
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/helpers/Version.kt +1 -1
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/helpers/ViewFinder.kt +3 -0
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/model/SourceDocument.kt +4 -21
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/model/XPathQuery.kt +64 -0
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/viewmatcher/WithXPath.kt +3 -3
- package/espresso-server/library/src/test/java/io/appium/espressoserver/test/helpers/XPathQueryTests.kt +101 -0
- package/espresso-server/settings.gradle.kts +4 -0
- package/node_modules/@appium/base-driver/build/lib/basedriver/helpers/caps.js +1 -1
- package/node_modules/@appium/base-driver/lib/basedriver/helpers/caps.ts +1 -1
- package/node_modules/@appium/base-driver/package.json +4 -4
- package/node_modules/@appium/logger/CHANGELOG.md +37 -0
- package/node_modules/@appium/logger/package.json +2 -2
- package/node_modules/@appium/schema/package.json +2 -2
- package/node_modules/@appium/support/build/lib/zip.d.ts.map +1 -1
- package/node_modules/@appium/support/build/lib/zip.js +11 -11
- package/node_modules/@appium/support/build/lib/zip.js.map +1 -1
- package/node_modules/@appium/support/lib/zip.ts +11 -12
- package/node_modules/@appium/support/node_modules/teen_process/CHANGELOG.md +1122 -0
- package/node_modules/@appium/support/node_modules/teen_process/LICENSE +201 -0
- package/node_modules/@appium/support/node_modules/teen_process/README.md +270 -0
- package/node_modules/@appium/support/node_modules/teen_process/lib/circular-buffer.ts +60 -0
- package/node_modules/@appium/support/node_modules/teen_process/lib/exec.ts +176 -0
- package/node_modules/@appium/support/node_modules/teen_process/lib/helpers.ts +45 -0
- package/node_modules/@appium/support/node_modules/teen_process/lib/index.ts +4 -0
- package/node_modules/@appium/support/node_modules/teen_process/lib/subprocess.ts +358 -0
- package/node_modules/@appium/support/node_modules/teen_process/lib/types.ts +83 -0
- package/node_modules/@appium/support/node_modules/teen_process/package.json +81 -0
- package/node_modules/@appium/support/package.json +5 -5
- package/node_modules/@appium/types/package.json +5 -5
- package/node_modules/appium-adb/CHANGELOG.md +14 -0
- package/node_modules/appium-adb/node_modules/asyncbox/LICENSE +203 -0
- package/node_modules/appium-adb/node_modules/asyncbox/README.md +272 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts +9 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncfilter.js +36 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncfilter.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts +9 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncmap.js +27 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/asyncmap.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/limit-function.d.ts +7 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/limit-function.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/limit-function.js +35 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/collections/limit-function.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/index.d.ts +12 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/index.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/index.js +10 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/index.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/lock/lock.d.ts +74 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/lock/lock.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/lock/lock.js +302 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/lock/lock.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/errors.d.ts +27 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/errors.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/errors.js +46 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/errors.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/types.d.ts +84 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/types.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/types.js +2 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/shared/types.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/long-sleep.d.ts +15 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/long-sleep.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/long-sleep.js +33 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/long-sleep.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/retry.d.ts +17 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/retry.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/retry.js +53 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/retry.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/sleep.d.ts +20 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/sleep.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/sleep.js +58 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/sleep.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts +18 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/wait-for-condition.js +48 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/wait-for-condition.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/with-timeout.d.ts +16 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/with-timeout.d.ts.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/with-timeout.js +42 -0
- package/node_modules/appium-adb/node_modules/asyncbox/build/lib/time/with-timeout.js.map +1 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/collections/asyncfilter.ts +42 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/collections/asyncmap.ts +33 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/collections/limit-function.ts +34 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/index.ts +28 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/lock/lock.ts +369 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/shared/errors.ts +51 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/shared/types.ts +88 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/time/long-sleep.ts +38 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/time/retry.ts +61 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/time/sleep.ts +79 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/time/wait-for-condition.ts +52 -0
- package/node_modules/appium-adb/node_modules/asyncbox/lib/time/with-timeout.ts +43 -0
- package/node_modules/appium-adb/node_modules/asyncbox/package.json +60 -0
- package/node_modules/appium-adb/package.json +4 -4
- package/node_modules/appium-android-driver/CHANGELOG.md +36 -0
- package/node_modules/appium-android-driver/README.md +4 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/batcher.d.ts +16 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/batcher.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/batcher.js +42 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/batcher.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/capabilities.d.ts +11 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/capabilities.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/capabilities.js +96 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/capabilities.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/constants.d.ts +14 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/constants.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/constants.js +16 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/constants.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/exports.d.ts +42 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/exports.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/exports.js +127 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/exports.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/jpeg.d.ts +6 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/jpeg.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/jpeg.js +17 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/jpeg.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/sps.d.ts +12 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/sps.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/sps.js +196 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/sps.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/stream.d.ts +65 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/stream.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/stream.js +339 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/stream.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/types.d.ts +67 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/types.d.ts.map +1 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/types.js +2 -0
- package/node_modules/appium-android-driver/build/lib/commands/media-stream/types.js.map +1 -0
- package/node_modules/appium-android-driver/build/lib/driver.d.ts +20 -0
- package/node_modules/appium-android-driver/build/lib/driver.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/driver.js +9 -0
- package/node_modules/appium-android-driver/build/lib/driver.js.map +1 -1
- package/node_modules/appium-android-driver/build/lib/execute-method-map.d.ts +16 -0
- package/node_modules/appium-android-driver/build/lib/execute-method-map.d.ts.map +1 -1
- package/node_modules/appium-android-driver/build/lib/execute-method-map.js +16 -0
- package/node_modules/appium-android-driver/build/lib/execute-method-map.js.map +1 -1
- package/node_modules/appium-android-driver/lib/commands/media-stream/batcher.ts +44 -0
- package/node_modules/appium-android-driver/lib/commands/media-stream/capabilities.ts +101 -0
- package/node_modules/appium-android-driver/lib/commands/media-stream/constants.ts +15 -0
- package/node_modules/appium-android-driver/lib/commands/media-stream/exports.ts +182 -0
- package/node_modules/appium-android-driver/lib/commands/media-stream/jpeg.ts +16 -0
- package/node_modules/appium-android-driver/lib/commands/media-stream/sps.ts +208 -0
- package/node_modules/appium-android-driver/lib/commands/media-stream/stream.ts +385 -0
- package/node_modules/appium-android-driver/lib/commands/media-stream/types.ts +65 -0
- package/node_modules/appium-android-driver/lib/driver.ts +16 -0
- package/node_modules/appium-android-driver/lib/execute-method-map.ts +17 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/LICENSE +203 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/README.md +272 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts +9 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncfilter.js +36 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncfilter.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts +9 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncmap.js +27 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/asyncmap.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/limit-function.d.ts +7 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/limit-function.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/limit-function.js +35 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/collections/limit-function.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/index.d.ts +12 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/index.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/index.js +10 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/index.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/lock/lock.d.ts +74 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/lock/lock.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/lock/lock.js +302 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/lock/lock.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/errors.d.ts +27 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/errors.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/errors.js +46 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/errors.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/types.d.ts +84 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/types.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/types.js +2 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/shared/types.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/long-sleep.d.ts +15 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/long-sleep.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/long-sleep.js +33 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/long-sleep.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/retry.d.ts +17 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/retry.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/retry.js +53 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/retry.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/sleep.d.ts +20 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/sleep.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/sleep.js +58 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/sleep.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts +18 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/wait-for-condition.js +48 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/wait-for-condition.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/with-timeout.d.ts +16 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/with-timeout.d.ts.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/with-timeout.js +42 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/build/lib/time/with-timeout.js.map +1 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/collections/asyncfilter.ts +42 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/collections/asyncmap.ts +33 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/collections/limit-function.ts +34 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/index.ts +28 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/lock/lock.ts +369 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/shared/errors.ts +51 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/shared/types.ts +88 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/time/long-sleep.ts +38 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/time/retry.ts +61 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/time/sleep.ts +79 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/time/wait-for-condition.ts +52 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/lib/time/with-timeout.ts +43 -0
- package/node_modules/appium-android-driver/node_modules/asyncbox/package.json +60 -0
- package/node_modules/appium-android-driver/package.json +7 -7
- package/node_modules/appium-chromedriver/CHANGELOG.md +14 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/LICENSE +203 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/README.md +272 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts +9 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncfilter.js +36 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncfilter.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts +9 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncmap.js +27 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/asyncmap.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/limit-function.d.ts +7 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/limit-function.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/limit-function.js +35 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/collections/limit-function.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/index.d.ts +12 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/index.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/index.js +10 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/index.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/lock/lock.d.ts +74 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/lock/lock.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/lock/lock.js +302 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/lock/lock.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/errors.d.ts +27 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/errors.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/errors.js +46 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/errors.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/types.d.ts +84 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/types.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/types.js +2 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/shared/types.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/long-sleep.d.ts +15 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/long-sleep.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/long-sleep.js +33 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/long-sleep.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/retry.d.ts +17 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/retry.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/retry.js +53 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/retry.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/sleep.d.ts +20 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/sleep.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/sleep.js +58 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/sleep.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts +18 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/wait-for-condition.js +48 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/wait-for-condition.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/with-timeout.d.ts +16 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/with-timeout.d.ts.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/with-timeout.js +42 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/build/lib/time/with-timeout.js.map +1 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/collections/asyncfilter.ts +42 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/collections/asyncmap.ts +33 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/collections/limit-function.ts +34 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/index.ts +28 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/lock/lock.ts +369 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/shared/errors.ts +51 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/shared/types.ts +88 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/time/long-sleep.ts +38 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/time/retry.ts +61 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/time/sleep.ts +79 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/time/wait-for-condition.ts +52 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/lib/time/with-timeout.ts +43 -0
- package/node_modules/appium-chromedriver/node_modules/asyncbox/package.json +60 -0
- package/node_modules/appium-chromedriver/package.json +4 -4
- package/node_modules/io.appium.settings/CHANGELOG.md +21 -0
- package/node_modules/io.appium.settings/apks/settings_apk-debug.apk +0 -0
- package/node_modules/io.appium.settings/build/lib/commands/video-stream.d.ts +9 -0
- package/node_modules/io.appium.settings/build/lib/commands/video-stream.d.ts.map +1 -1
- package/node_modules/io.appium.settings/build/lib/commands/video-stream.js +16 -1
- package/node_modules/io.appium.settings/build/lib/commands/video-stream.js.map +1 -1
- package/node_modules/io.appium.settings/build/lib/constants.d.ts +2 -0
- package/node_modules/io.appium.settings/build/lib/constants.d.ts.map +1 -1
- package/node_modules/io.appium.settings/build/lib/constants.js +2 -0
- package/node_modules/io.appium.settings/build/lib/constants.js.map +1 -1
- package/node_modules/io.appium.settings/build/lib/index.d.ts +3 -0
- package/node_modules/io.appium.settings/build/lib/index.d.ts.map +1 -1
- package/node_modules/io.appium.settings/build/lib/utils/streaming-protocol.d.ts +3 -1
- package/node_modules/io.appium.settings/build/lib/utils/streaming-protocol.d.ts.map +1 -1
- package/node_modules/io.appium.settings/build/lib/utils/streaming-protocol.js +2 -0
- package/node_modules/io.appium.settings/build/lib/utils/streaming-protocol.js.map +1 -1
- package/node_modules/io.appium.settings/build/lib/utils/streaming-transport.d.ts +11 -0
- package/node_modules/io.appium.settings/build/lib/utils/streaming-transport.d.ts.map +1 -1
- package/node_modules/io.appium.settings/build/lib/utils/streaming-transport.js +40 -0
- package/node_modules/io.appium.settings/build/lib/utils/streaming-transport.js.map +1 -1
- package/node_modules/io.appium.settings/lib/commands/video-stream.ts +17 -0
- package/node_modules/io.appium.settings/lib/constants.ts +2 -0
- package/node_modules/io.appium.settings/lib/index.ts +3 -0
- package/node_modules/io.appium.settings/lib/utils/streaming-protocol.ts +2 -0
- package/node_modules/io.appium.settings/lib/utils/streaming-transport.ts +43 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/LICENSE +203 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/README.md +272 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts +9 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncfilter.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncfilter.js +36 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncfilter.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts +9 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncmap.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncmap.js +27 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/asyncmap.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/limit-function.d.ts +7 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/limit-function.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/limit-function.js +35 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/collections/limit-function.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/index.d.ts +12 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/index.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/index.js +10 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/index.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/lock/lock.d.ts +74 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/lock/lock.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/lock/lock.js +302 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/lock/lock.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/errors.d.ts +27 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/errors.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/errors.js +46 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/errors.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/types.d.ts +84 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/types.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/types.js +2 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/shared/types.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/long-sleep.d.ts +15 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/long-sleep.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/long-sleep.js +33 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/long-sleep.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/retry.d.ts +17 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/retry.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/retry.js +53 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/retry.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/sleep.d.ts +20 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/sleep.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/sleep.js +58 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/sleep.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts +18 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/wait-for-condition.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/wait-for-condition.js +48 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/wait-for-condition.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/with-timeout.d.ts +16 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/with-timeout.d.ts.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/with-timeout.js +42 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/build/lib/time/with-timeout.js.map +1 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/collections/asyncfilter.ts +42 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/collections/asyncmap.ts +33 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/collections/limit-function.ts +34 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/index.ts +28 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/lock/lock.ts +369 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/shared/errors.ts +51 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/shared/types.ts +88 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/time/long-sleep.ts +38 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/time/retry.ts +61 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/time/sleep.ts +79 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/time/wait-for-condition.ts +52 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/lib/time/with-timeout.ts +43 -0
- package/node_modules/io.appium.settings/node_modules/asyncbox/package.json +60 -0
- package/node_modules/io.appium.settings/package.json +5 -5
- package/node_modules/teen_process/CHANGELOG.md +17 -0
- package/node_modules/teen_process/README.md +2 -2
- package/node_modules/teen_process/build/lib/circular-buffer.d.ts +13 -0
- package/node_modules/teen_process/build/lib/circular-buffer.d.ts.map +1 -0
- package/node_modules/teen_process/build/lib/circular-buffer.js +53 -0
- package/node_modules/teen_process/build/lib/circular-buffer.js.map +1 -0
- package/node_modules/teen_process/build/lib/exec.d.ts +33 -0
- package/node_modules/teen_process/build/lib/exec.d.ts.map +1 -0
- package/node_modules/teen_process/build/lib/exec.js +164 -0
- package/node_modules/teen_process/build/lib/exec.js.map +1 -0
- package/node_modules/teen_process/build/lib/helpers.d.ts +2 -0
- package/node_modules/teen_process/build/lib/helpers.d.ts.map +1 -0
- package/node_modules/teen_process/build/lib/helpers.js +41 -0
- package/node_modules/teen_process/build/lib/helpers.js.map +1 -0
- package/node_modules/teen_process/build/lib/index.d.ts +5 -0
- package/node_modules/teen_process/build/lib/index.d.ts.map +1 -0
- package/node_modules/teen_process/build/lib/index.js +4 -0
- package/node_modules/teen_process/build/lib/index.js.map +1 -0
- package/node_modules/teen_process/build/lib/subprocess.d.ts +131 -0
- package/node_modules/teen_process/build/lib/subprocess.d.ts.map +1 -0
- package/node_modules/teen_process/build/lib/subprocess.js +336 -0
- package/node_modules/teen_process/build/lib/subprocess.js.map +1 -0
- package/node_modules/teen_process/build/lib/types.d.ts +71 -0
- package/node_modules/teen_process/build/lib/types.d.ts.map +1 -0
- package/node_modules/teen_process/build/lib/types.js +2 -0
- package/node_modules/teen_process/build/lib/types.js.map +1 -0
- package/node_modules/teen_process/lib/exec.ts +15 -2
- package/node_modules/teen_process/lib/subprocess.ts +146 -110
- package/node_modules/teen_process/package.json +14 -25
- package/package.json +5 -5
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/circular-buffer.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/circular-buffer.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/circular-buffer.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/circular-buffer.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/exec.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/exec.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/exec.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/exec.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/helpers.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/helpers.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/helpers.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/helpers.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/index.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/index.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/index.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/index.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/subprocess.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/subprocess.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/subprocess.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/subprocess.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/types.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/types.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/types.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/lib/types.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/cjs/package.json +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/circular-buffer.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/circular-buffer.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/circular-buffer.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/circular-buffer.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/exec.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/exec.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/exec.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/exec.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/helpers.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/helpers.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/helpers.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/helpers.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/index.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/index.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/index.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/index.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/subprocess.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/subprocess.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/subprocess.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/subprocess.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/types.d.ts +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/types.d.ts.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/types.js +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/lib/types.js.map +0 -0
- /package/node_modules/{teen_process → @appium/support/node_modules/teen_process}/build/esm/package.json +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { ChildProcess } from 'node:child_process';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import type { SubProcessOptions, StartDetector } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A wrapper around Node's spawn that provides event-driven process management.
|
|
6
|
+
*
|
|
7
|
+
* Extends EventEmitter to provide real-time output streaming and lifecycle events.
|
|
8
|
+
*
|
|
9
|
+
* @template TSubProcessOptions - Options type extending SubProcessOptions
|
|
10
|
+
*
|
|
11
|
+
* @fires SubProcess#output - Emitted when stdout or stderr receives data
|
|
12
|
+
* @fires SubProcess#line-stdout - Emitted for each line of stdout
|
|
13
|
+
* @fires SubProcess#line-stderr - Emitted for each line of stderr
|
|
14
|
+
* @fires SubProcess#lines-stdout - Legacy event emitting stdout lines (deprecated)
|
|
15
|
+
* @fires SubProcess#lines-stderr - Legacy event emitting stderr lines (deprecated)
|
|
16
|
+
* @fires SubProcess#stream-line - Emitted for combined stdout/stderr lines
|
|
17
|
+
* @fires SubProcess#exit - Emitted when process exits
|
|
18
|
+
* @fires SubProcess#stop - Emitted when process is stopped intentionally
|
|
19
|
+
* @fires SubProcess#die - Emitted when process dies unexpectedly with non-zero code
|
|
20
|
+
* @fires SubProcess#end - Emitted when process ends normally with code 0
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const proc = new SubProcess('tail', ['-f', 'logfile.txt']);
|
|
25
|
+
*
|
|
26
|
+
* proc.on('output', (stdout, stderr) => {
|
|
27
|
+
* console.log('Output:', stdout);
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* proc.on('line-stdout', (line) => {
|
|
31
|
+
* console.log('Line:', line);
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* await proc.start();
|
|
35
|
+
* // ... later
|
|
36
|
+
* await proc.stop();
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class SubProcess<TSubProcessOptions extends SubProcessOptions = SubProcessOptions> extends EventEmitter {
|
|
40
|
+
proc: ChildProcess | null;
|
|
41
|
+
readonly rep: string;
|
|
42
|
+
private args;
|
|
43
|
+
private cmd;
|
|
44
|
+
private opts;
|
|
45
|
+
private expectingExit;
|
|
46
|
+
constructor(cmd: string, args?: string[], opts?: TSubProcessOptions);
|
|
47
|
+
get isRunning(): boolean;
|
|
48
|
+
get pid(): number | null;
|
|
49
|
+
/**
|
|
50
|
+
* Starts the subprocess and waits for it to be ready.
|
|
51
|
+
*
|
|
52
|
+
* @param startDetector - Function to detect when process is ready, number for delay in ms,
|
|
53
|
+
* boolean true to detach immediately, or null for default behavior
|
|
54
|
+
* @param timeoutMs - Maximum time to wait for process to start (in ms), or boolean true to detach
|
|
55
|
+
* @param detach - Whether to detach the process (requires 'detached' option)
|
|
56
|
+
*
|
|
57
|
+
* @throws {Error} When process fails to start or times out
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // Wait for any output
|
|
62
|
+
* await proc.start();
|
|
63
|
+
*
|
|
64
|
+
* // Wait 100ms then continue
|
|
65
|
+
* await proc.start(100);
|
|
66
|
+
*
|
|
67
|
+
* // Wait for specific output
|
|
68
|
+
* await proc.start((stdout) => stdout.includes('Server ready'));
|
|
69
|
+
*
|
|
70
|
+
* // With timeout
|
|
71
|
+
* await proc.start(null, 5000);
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
start(startDetector?: StartDetector<TSubProcessOptions> | number | boolean | null, timeoutMs?: number | boolean | null, detach?: boolean): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Stops the running subprocess by sending a signal.
|
|
77
|
+
*
|
|
78
|
+
* @param signal - Signal to send to the process (default: 'SIGTERM')
|
|
79
|
+
* @param timeout - Maximum time to wait for process to exit in ms (default: 10000)
|
|
80
|
+
*
|
|
81
|
+
* @throws {Error} When process is not running or doesn't exit within timeout
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // Graceful stop with SIGTERM
|
|
86
|
+
* await proc.stop();
|
|
87
|
+
*
|
|
88
|
+
* // Force kill with SIGKILL
|
|
89
|
+
* await proc.stop('SIGKILL');
|
|
90
|
+
*
|
|
91
|
+
* // Custom timeout
|
|
92
|
+
* await proc.stop('SIGTERM', 5000);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
stop(signal?: NodeJS.Signals, timeout?: number): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Waits for the process to exit and validates its exit code.
|
|
98
|
+
*
|
|
99
|
+
* @param allowedExitCodes - Array of acceptable exit codes (default: [0])
|
|
100
|
+
* @returns Promise resolving to the exit code
|
|
101
|
+
*
|
|
102
|
+
* @throws {Error} When process is not running or exits with disallowed code
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* // Wait for successful exit (code 0)
|
|
107
|
+
* const code = await proc.join();
|
|
108
|
+
*
|
|
109
|
+
* // Allow multiple exit codes
|
|
110
|
+
* const code = await proc.join([0, 1, 2]);
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
join(allowedExitCodes?: number[]): Promise<number | null>;
|
|
114
|
+
/**
|
|
115
|
+
* Detaches the process so it continues running independently.
|
|
116
|
+
*
|
|
117
|
+
* The process must have been created with the 'detached' option.
|
|
118
|
+
* Once detached, the process will not be killed when the parent exits.
|
|
119
|
+
*
|
|
120
|
+
* @throws {Error} When process was not created with 'detached' option
|
|
121
|
+
*/
|
|
122
|
+
detachProcess(): void;
|
|
123
|
+
private parseStartArgs;
|
|
124
|
+
private assertDetachable;
|
|
125
|
+
private attachErrorHandler;
|
|
126
|
+
private attachExitHandler;
|
|
127
|
+
private attachOutputHandlers;
|
|
128
|
+
private attachLineHandler;
|
|
129
|
+
private emitLines;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=subprocess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subprocess.d.ts","sourceRoot":"","sources":["../../lib/subprocess.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAQzC,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAC;AAI5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,UAAU,CAAC,kBAAkB,SAAS,i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ventEmitter } from 'node:events';
|
|
3
|
+
import { createInterface } from 'node:readline';
|
|
4
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
5
|
+
import { quote } from 'shell-quote';
|
|
6
|
+
import { formatEnoent } from './helpers.js';
|
|
7
|
+
/**
|
|
8
|
+
* A wrapper around Node's spawn that provides event-driven process management.
|
|
9
|
+
*
|
|
10
|
+
* Extends EventEmitter to provide real-time output streaming and lifecycle events.
|
|
11
|
+
*
|
|
12
|
+
* @template TSubProcessOptions - Options type extending SubProcessOptions
|
|
13
|
+
*
|
|
14
|
+
* @fires SubProcess#output - Emitted when stdout or stderr receives data
|
|
15
|
+
* @fires SubProcess#line-stdout - Emitted for each line of stdout
|
|
16
|
+
* @fires SubProcess#line-stderr - Emitted for each line of stderr
|
|
17
|
+
* @fires SubProcess#lines-stdout - Legacy event emitting stdout lines (deprecated)
|
|
18
|
+
* @fires SubProcess#lines-stderr - Legacy event emitting stderr lines (deprecated)
|
|
19
|
+
* @fires SubProcess#stream-line - Emitted for combined stdout/stderr lines
|
|
20
|
+
* @fires SubProcess#exit - Emitted when process exits
|
|
21
|
+
* @fires SubProcess#stop - Emitted when process is stopped intentionally
|
|
22
|
+
* @fires SubProcess#die - Emitted when process dies unexpectedly with non-zero code
|
|
23
|
+
* @fires SubProcess#end - Emitted when process ends normally with code 0
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const proc = new SubProcess('tail', ['-f', 'logfile.txt']);
|
|
28
|
+
*
|
|
29
|
+
* proc.on('output', (stdout, stderr) => {
|
|
30
|
+
* console.log('Output:', stdout);
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* proc.on('line-stdout', (line) => {
|
|
34
|
+
* console.log('Line:', line);
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* await proc.start();
|
|
38
|
+
* // ... later
|
|
39
|
+
* await proc.stop();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export class SubProcess extends EventEmitter {
|
|
43
|
+
proc;
|
|
44
|
+
rep;
|
|
45
|
+
args;
|
|
46
|
+
cmd;
|
|
47
|
+
opts;
|
|
48
|
+
expectingExit;
|
|
49
|
+
constructor(cmd, args = [], opts) {
|
|
50
|
+
super();
|
|
51
|
+
if (!cmd) {
|
|
52
|
+
throw new Error('Command is required');
|
|
53
|
+
}
|
|
54
|
+
if (typeof cmd !== 'string' && !(cmd instanceof String)) {
|
|
55
|
+
throw new Error('Command must be a string');
|
|
56
|
+
}
|
|
57
|
+
if (!Array.isArray(args)) {
|
|
58
|
+
throw new Error('Args must be an array');
|
|
59
|
+
}
|
|
60
|
+
this.cmd = String(cmd);
|
|
61
|
+
this.args = args;
|
|
62
|
+
this.proc = null;
|
|
63
|
+
this.opts = opts ?? {};
|
|
64
|
+
this.expectingExit = false;
|
|
65
|
+
this.rep = quote([String(cmd), ...args]);
|
|
66
|
+
}
|
|
67
|
+
get isRunning() {
|
|
68
|
+
return !!this.proc;
|
|
69
|
+
}
|
|
70
|
+
get pid() {
|
|
71
|
+
return this.proc?.pid ?? null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Starts the subprocess and waits for it to be ready.
|
|
75
|
+
*
|
|
76
|
+
* @param startDetector - Function to detect when process is ready, number for delay in ms,
|
|
77
|
+
* boolean true to detach immediately, or null for default behavior
|
|
78
|
+
* @param timeoutMs - Maximum time to wait for process to start (in ms), or boolean true to detach
|
|
79
|
+
* @param detach - Whether to detach the process (requires 'detached' option)
|
|
80
|
+
*
|
|
81
|
+
* @throws {Error} When process fails to start or times out
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // Wait for any output
|
|
86
|
+
* await proc.start();
|
|
87
|
+
*
|
|
88
|
+
* // Wait 100ms then continue
|
|
89
|
+
* await proc.start(100);
|
|
90
|
+
*
|
|
91
|
+
* // Wait for specific output
|
|
92
|
+
* await proc.start((stdout) => stdout.includes('Server ready'));
|
|
93
|
+
*
|
|
94
|
+
* // With timeout
|
|
95
|
+
* await proc.start(null, 5000);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
async start(startDetector = null, timeoutMs = null, detach = false) {
|
|
99
|
+
const args = this.parseStartArgs(startDetector, timeoutMs, detach);
|
|
100
|
+
let detector = args.detector;
|
|
101
|
+
let startDelayTimer = null;
|
|
102
|
+
let startTimeoutTimer = null;
|
|
103
|
+
return await new Promise((resolve, reject) => {
|
|
104
|
+
this.proc = spawn(this.cmd, this.args, this.opts);
|
|
105
|
+
this.attachErrorHandler(reject);
|
|
106
|
+
this.attachOutputHandlers((stdout, stderr) => {
|
|
107
|
+
try {
|
|
108
|
+
if (detector && detector(stdout, stderr)) {
|
|
109
|
+
detector = null;
|
|
110
|
+
resolve();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
reject(e);
|
|
115
|
+
}
|
|
116
|
+
this.emit('output', stdout, stderr);
|
|
117
|
+
});
|
|
118
|
+
this.attachExitHandler();
|
|
119
|
+
if (!detector) {
|
|
120
|
+
startDelayTimer = setTimeout(() => resolve(), args.startDelay);
|
|
121
|
+
}
|
|
122
|
+
if (typeof args.timeoutMs === 'number' || args.timeoutMs instanceof Number) {
|
|
123
|
+
startTimeoutTimer = setTimeout(() => {
|
|
124
|
+
reject(new Error(`The process did not start within ${args.timeoutMs}ms (cmd: '${this.rep}')`));
|
|
125
|
+
}, Number(args.timeoutMs));
|
|
126
|
+
}
|
|
127
|
+
}).finally(() => {
|
|
128
|
+
if (startDelayTimer) {
|
|
129
|
+
clearTimeout(startDelayTimer);
|
|
130
|
+
}
|
|
131
|
+
if (startTimeoutTimer) {
|
|
132
|
+
clearTimeout(startTimeoutTimer);
|
|
133
|
+
}
|
|
134
|
+
if (args.detach && this.proc) {
|
|
135
|
+
this.proc.unref();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Stops the running subprocess by sending a signal.
|
|
141
|
+
*
|
|
142
|
+
* @param signal - Signal to send to the process (default: 'SIGTERM')
|
|
143
|
+
* @param timeout - Maximum time to wait for process to exit in ms (default: 10000)
|
|
144
|
+
*
|
|
145
|
+
* @throws {Error} When process is not running or doesn't exit within timeout
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* // Graceful stop with SIGTERM
|
|
150
|
+
* await proc.stop();
|
|
151
|
+
*
|
|
152
|
+
* // Force kill with SIGKILL
|
|
153
|
+
* await proc.stop('SIGKILL');
|
|
154
|
+
*
|
|
155
|
+
* // Custom timeout
|
|
156
|
+
* await proc.stop('SIGTERM', 5000);
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
async stop(signal = 'SIGTERM', timeout = 10000) {
|
|
160
|
+
if (!this.isRunning) {
|
|
161
|
+
throw new Error(`Can't stop process; it's not currently running (cmd: '${this.rep}')`);
|
|
162
|
+
}
|
|
163
|
+
return await new Promise((resolve, reject) => {
|
|
164
|
+
const stopTimeoutTimer = setTimeout(() => {
|
|
165
|
+
reject(new Error(`Process didn't end after ${timeout}ms (cmd: '${this.rep}')`));
|
|
166
|
+
}, timeout).unref();
|
|
167
|
+
this.proc?.once('close', () => {
|
|
168
|
+
clearTimeout(stopTimeoutTimer);
|
|
169
|
+
resolve();
|
|
170
|
+
});
|
|
171
|
+
this.expectingExit = true;
|
|
172
|
+
this.proc?.kill(signal);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Waits for the process to exit and validates its exit code.
|
|
177
|
+
*
|
|
178
|
+
* @param allowedExitCodes - Array of acceptable exit codes (default: [0])
|
|
179
|
+
* @returns Promise resolving to the exit code
|
|
180
|
+
*
|
|
181
|
+
* @throws {Error} When process is not running or exits with disallowed code
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* // Wait for successful exit (code 0)
|
|
186
|
+
* const code = await proc.join();
|
|
187
|
+
*
|
|
188
|
+
* // Allow multiple exit codes
|
|
189
|
+
* const code = await proc.join([0, 1, 2]);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
async join(allowedExitCodes = [0]) {
|
|
193
|
+
if (!this.isRunning) {
|
|
194
|
+
throw new Error(`Cannot join process; it is not currently running (cmd: '${this.rep}')`);
|
|
195
|
+
}
|
|
196
|
+
return await new Promise((resolve, reject) => {
|
|
197
|
+
this.proc?.once('exit', (code) => {
|
|
198
|
+
if (code !== null && !allowedExitCodes.includes(code)) {
|
|
199
|
+
reject(new Error(`Process ended with exitcode ${code} (cmd: '${this.rep}')`));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
resolve(code);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Detaches the process so it continues running independently.
|
|
209
|
+
*
|
|
210
|
+
* The process must have been created with the 'detached' option.
|
|
211
|
+
* Once detached, the process will not be killed when the parent exits.
|
|
212
|
+
*
|
|
213
|
+
* @throws {Error} When process was not created with 'detached' option
|
|
214
|
+
*/
|
|
215
|
+
detachProcess() {
|
|
216
|
+
this.assertDetachable();
|
|
217
|
+
if (this.proc) {
|
|
218
|
+
this.proc.unref();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
parseStartArgs(startDetector, timeoutMs, detach) {
|
|
222
|
+
let startDelay = 10;
|
|
223
|
+
const genericStartDetector = (stdout, stderr) => stdout || stderr;
|
|
224
|
+
let detector = null;
|
|
225
|
+
if (startDetector === null) {
|
|
226
|
+
detector = genericStartDetector;
|
|
227
|
+
}
|
|
228
|
+
if (typeof startDetector === 'number' || startDetector instanceof Number) {
|
|
229
|
+
startDelay = Number(startDetector);
|
|
230
|
+
detector = null;
|
|
231
|
+
}
|
|
232
|
+
else if (typeof startDetector === 'function') {
|
|
233
|
+
detector = startDetector;
|
|
234
|
+
}
|
|
235
|
+
if ((typeof startDetector === 'boolean' || startDetector instanceof Boolean) && Boolean(startDetector)) {
|
|
236
|
+
this.assertDetachable();
|
|
237
|
+
detach = true;
|
|
238
|
+
detector = genericStartDetector;
|
|
239
|
+
}
|
|
240
|
+
else if ((typeof timeoutMs === 'boolean' || timeoutMs instanceof Boolean) && Boolean(timeoutMs)) {
|
|
241
|
+
this.assertDetachable();
|
|
242
|
+
detach = true;
|
|
243
|
+
timeoutMs = null;
|
|
244
|
+
}
|
|
245
|
+
return { detector, startDelay, timeoutMs, detach };
|
|
246
|
+
}
|
|
247
|
+
assertDetachable() {
|
|
248
|
+
if (!this.opts.detached) {
|
|
249
|
+
throw new Error(`Unable to detach process that is not started with 'detached' option`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
attachErrorHandler(reject) {
|
|
253
|
+
this.proc?.on('error', async (err) => {
|
|
254
|
+
this.proc?.removeAllListeners('exit');
|
|
255
|
+
this.proc?.kill('SIGINT');
|
|
256
|
+
let error = err;
|
|
257
|
+
if (error.code === 'ENOENT') {
|
|
258
|
+
error = await formatEnoent(error, this.cmd, this.opts?.cwd?.toString());
|
|
259
|
+
}
|
|
260
|
+
reject(error);
|
|
261
|
+
this.proc?.unref();
|
|
262
|
+
this.proc = null;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
attachExitHandler() {
|
|
266
|
+
this.proc?.on('exit', (code, signal) => {
|
|
267
|
+
this.emit('exit', code, signal);
|
|
268
|
+
let event = this.expectingExit ? 'stop' : 'die';
|
|
269
|
+
if (!this.expectingExit && code === 0) {
|
|
270
|
+
event = 'end';
|
|
271
|
+
}
|
|
272
|
+
this.emit(event, code, signal);
|
|
273
|
+
this.proc = null;
|
|
274
|
+
this.expectingExit = false;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
attachOutputHandlers(onOutput) {
|
|
278
|
+
const isBuffer = Boolean(this.opts.isBuffer);
|
|
279
|
+
const encoding = this.opts.encoding || 'utf8';
|
|
280
|
+
const emptyOutput = (isBuffer ? Buffer.alloc(0) : '');
|
|
281
|
+
const attach = (streamName, stream) => {
|
|
282
|
+
// StringDecoder keeps incomplete multi-byte sequences between chunks
|
|
283
|
+
const decoder = isBuffer ? null : new StringDecoder(encoding);
|
|
284
|
+
const emitOutput = (data) => onOutput((streamName === 'stdout' ? data : emptyOutput), (streamName === 'stderr' ? data : emptyOutput));
|
|
285
|
+
stream.on('data', (chunk) => {
|
|
286
|
+
if (!decoder) {
|
|
287
|
+
emitOutput(chunk);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const text = decoder.write(chunk);
|
|
291
|
+
if (text) {
|
|
292
|
+
emitOutput(text);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
if (decoder) {
|
|
296
|
+
stream.on('end', () => {
|
|
297
|
+
const rest = decoder.end();
|
|
298
|
+
if (rest) {
|
|
299
|
+
emitOutput(rest);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
this.attachLineHandler(streamName, stream);
|
|
304
|
+
};
|
|
305
|
+
if (this.proc?.stdout) {
|
|
306
|
+
attach('stdout', this.proc.stdout);
|
|
307
|
+
}
|
|
308
|
+
if (this.proc?.stderr) {
|
|
309
|
+
attach('stderr', this.proc.stderr);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
attachLineHandler(streamName, input) {
|
|
313
|
+
const rl = createInterface({ input });
|
|
314
|
+
rl.on('line', (line) => {
|
|
315
|
+
if (this.listenerCount(`lines-${streamName}`)) {
|
|
316
|
+
this.emit(`lines-${streamName}`, [line]);
|
|
317
|
+
}
|
|
318
|
+
this.emit(`line-${streamName}`, line);
|
|
319
|
+
if (this.listenerCount('stream-line')) {
|
|
320
|
+
this.emitLines(streamName, line);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
emitLines(streamName, lines) {
|
|
325
|
+
const doEmit = (line) => this.emit('stream-line', `[${streamName.toUpperCase()}] ${line}`);
|
|
326
|
+
if (typeof lines === 'string' || lines instanceof String) {
|
|
327
|
+
doEmit(lines);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
for (const line of lines) {
|
|
331
|
+
doEmit(line);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=subprocess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subprocess.js","sourceRoot":"","sources":["../../lib/subprocess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAElC,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAK1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,OAAO,UAA6E,SAAQ,YAAY;IAC5G,IAAI,CAAsB;IACjB,GAAG,CAAS;IACb,IAAI,CAAW;IACf,GAAG,CAAS;IACZ,IAAI,CAAqB;IACzB,aAAa,CAAU;IAE/B,YAAY,GAAW,EAAE,OAAiB,EAAE,EAAE,IAAyB;QACrE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAE,GAAW,YAAY,MAAM,CAAC,EAAE,CAAC;YACjE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;Y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gBAC9C,IAAI,CAAC,IAAI,CAAC,SAAS,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3C,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;YACtC,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,UAAsB,EAAE,KAAgC;QACxE,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAEnG,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAK,KAAa,YAAY,MAAM,EAAE,CAAC;YAClE,MAAM,CAAC,KAAe,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,CAAC,IAAI,CAAC,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { SpawnOptions } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal logger interface used by teen_process for debug output.
|
|
4
|
+
*/
|
|
5
|
+
export type TeenProcessLogger = {
|
|
6
|
+
/** Called for each debug message emitted by exec/SubProcess. */
|
|
7
|
+
debug: (...args: any[]) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Extra options supported by teen_process on top of Node's SpawnOptions.
|
|
11
|
+
*/
|
|
12
|
+
export interface TeenProcessProps {
|
|
13
|
+
/** Ignore and discard all child stdout/stderr (reduces memory use). */
|
|
14
|
+
ignoreOutput?: boolean;
|
|
15
|
+
/** When true, exec/SubProcess emits Buffers; otherwise strings (default). */
|
|
16
|
+
isBuffer?: boolean;
|
|
17
|
+
/** Optional logger for streaming debug output. */
|
|
18
|
+
logger?: TeenProcessLogger;
|
|
19
|
+
/** Maximum bytes retained in the stdout circular buffer. */
|
|
20
|
+
maxStdoutBufferSize?: number;
|
|
21
|
+
/** Maximum bytes retained in the stderr circular buffer. */
|
|
22
|
+
maxStderrBufferSize?: number;
|
|
23
|
+
/** Encoding used when returning string output (default: 'utf8'). */
|
|
24
|
+
encoding?: BufferEncoding;
|
|
25
|
+
}
|
|
26
|
+
/** Options accepted by exec (SpawnOptions + teen_process props). */
|
|
27
|
+
export type TeenProcessExecOptions = SpawnOptions & TeenProcessProps;
|
|
28
|
+
/** Additional properties attached to exec errors. */
|
|
29
|
+
export type TeenProcessExecErrorProps = {
|
|
30
|
+
stdout: string;
|
|
31
|
+
stderr: string;
|
|
32
|
+
code: number | null;
|
|
33
|
+
};
|
|
34
|
+
/** Error thrown by exec on non-zero exit or timeout. */
|
|
35
|
+
export type ExecError = Error & TeenProcessExecErrorProps;
|
|
36
|
+
/**
|
|
37
|
+
* Extracts the isBuffer property from options.
|
|
38
|
+
*/
|
|
39
|
+
export type BufferProp<T extends {
|
|
40
|
+
isBuffer?: boolean;
|
|
41
|
+
}> = T['isBuffer'] extends true ? Buffer : string;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves to the correct exec result shape based on buffer mode.
|
|
44
|
+
* Defaults to string output when isBuffer is false/undefined.
|
|
45
|
+
*/
|
|
46
|
+
export type TeenProcessExecResult<T extends string | Buffer> = {
|
|
47
|
+
stdout: T;
|
|
48
|
+
stderr: T;
|
|
49
|
+
code: number | null;
|
|
50
|
+
};
|
|
51
|
+
/** Supported stdio stream names. */
|
|
52
|
+
export type StreamName = 'stdout' | 'stderr';
|
|
53
|
+
/** Additional SubProcess-only options. */
|
|
54
|
+
export type SubProcessCustomOptions = {
|
|
55
|
+
/** When true, SubProcess emits Buffers instead of strings. */
|
|
56
|
+
isBuffer?: boolean;
|
|
57
|
+
/** Encoding used when isBuffer is false. */
|
|
58
|
+
encoding?: BufferEncoding;
|
|
59
|
+
};
|
|
60
|
+
/** Options accepted by SubProcess (extends spawn options). */
|
|
61
|
+
export type SubProcessOptions = SubProcessCustomOptions & SpawnOptions;
|
|
62
|
+
/** Helper type representing SubProcess buffer mode. */
|
|
63
|
+
export type TIsBufferOpts = {
|
|
64
|
+
isBuffer: true;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Function that detects when a subprocess has started.
|
|
68
|
+
* Receives stdout/stderr as Buffer when isBuffer is true, otherwise strings.
|
|
69
|
+
*/
|
|
70
|
+
export type StartDetector<T extends SubProcessOptions> = (stdout: T extends TIsBufferOpts ? Buffer : string, stderr?: T extends TIsBufferOpts ? Buffer : string) => unknown;
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gEAAgE;IAChE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,oEAAoE;AACpE,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MAAM,GAAG,MAAM,KAC/C,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {spawn} from 'node:child_process';
|
|
2
|
+
import {StringDecoder} from 'node:string_decoder';
|
|
2
3
|
|
|
3
4
|
import {quote} from 'shell-quote';
|
|
4
5
|
|
|
@@ -100,12 +101,24 @@ export async function exec<T extends TeenProcessExecOptions = TeenProcessExecOpt
|
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
const logDebug = typeof opts.logger?.debug === 'function' ? opts.logger.debug.bind(opts.logger) : null;
|
|
105
|
+
// StringDecoder keeps multi-byte characters split across chunks intact in logs
|
|
106
|
+
const decoder = logDebug ? new StringDecoder(opts.encoding) : null;
|
|
103
107
|
stream.on('data', (chunk: Buffer) => {
|
|
104
108
|
buffer.add(chunk);
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
const text = decoder?.write(chunk);
|
|
110
|
+
if (text) {
|
|
111
|
+
logDebug?.(text);
|
|
107
112
|
}
|
|
108
113
|
});
|
|
114
|
+
if (decoder) {
|
|
115
|
+
stream.on('end', () => {
|
|
116
|
+
const rest = decoder.end();
|
|
117
|
+
if (rest) {
|
|
118
|
+
logDebug?.(rest);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
109
122
|
};
|
|
110
123
|
|
|
111
124
|
handleStream('stdout', stdoutBuffer);
|