@vforsh/argus 0.3.1 → 0.4.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/dist/.tsbuildinfo +1 -1
- package/dist/argus.js +5285 -5575
- package/dist/cdp/resolveCdpEndpoint.d.ts.map +1 -1
- package/dist/cdp/resolveCdpEndpoint.js +2 -1
- package/dist/cdp/resolveCdpEndpoint.js.map +1 -1
- package/dist/cli/defineCommand.d.ts +12 -0
- package/dist/cli/defineCommand.d.ts.map +1 -1
- package/dist/cli/defineCommand.js +71 -1
- package/dist/cli/defineCommand.js.map +1 -1
- package/dist/cli/defineWatcherCommand.d.ts +12 -54
- package/dist/cli/defineWatcherCommand.d.ts.map +1 -1
- package/dist/cli/defineWatcherCommand.js +1 -1
- package/dist/cli/defineWatcherCommand.js.map +1 -1
- package/dist/cli/parse.d.ts +1 -2
- package/dist/cli/parse.d.ts.map +1 -1
- package/dist/cli/parse.js +2 -10
- package/dist/cli/parse.js.map +1 -1
- package/dist/cli/plugins/pluginHost.d.ts.map +1 -1
- package/dist/cli/plugins/pluginHost.js +1 -1
- package/dist/cli/plugins/pluginHost.js.map +1 -1
- package/dist/cli/plugins/registerPlugins.d.ts.map +1 -1
- package/dist/cli/plugins/registerPlugins.js +10 -8
- package/dist/cli/plugins/registerPlugins.js.map +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +4 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/register/authCommands.d.ts.map +1 -1
- package/dist/cli/register/authCommands.js +8 -7
- package/dist/cli/register/authCommands.js.map +1 -1
- package/dist/cli/register/chromeCommands.d.ts.map +1 -1
- package/dist/cli/register/chromeCommands.js +12 -27
- package/dist/cli/register/chromeCommands.js.map +1 -1
- package/dist/cli/register/codeCommands.d.ts.map +1 -1
- package/dist/cli/register/codeCommands.js +7 -6
- package/dist/cli/register/codeCommands.js.map +1 -1
- package/dist/cli/register/dialogCommands.d.ts.map +1 -1
- package/dist/cli/register/dialogCommands.js +3 -2
- package/dist/cli/register/dialogCommands.js.map +1 -1
- package/dist/cli/register/domCommandBuilder.d.ts.map +1 -1
- package/dist/cli/register/domCommandBuilder.js +2 -1
- package/dist/cli/register/domCommandBuilder.js.map +1 -1
- package/dist/cli/register/domCommands.d.ts.map +1 -1
- package/dist/cli/register/domCommands.js +7 -6
- package/dist/cli/register/domCommands.js.map +1 -1
- package/dist/cli/register/evalCommands.d.ts.map +1 -1
- package/dist/cli/register/evalCommands.js +27 -57
- package/dist/cli/register/evalCommands.js.map +1 -1
- package/dist/cli/register/extensionCommands.d.ts.map +1 -1
- package/dist/cli/register/extensionCommands.js +1 -1
- package/dist/cli/register/extensionCommands.js.map +1 -1
- package/dist/cli/register/fillCommand.d.ts.map +1 -1
- package/dist/cli/register/fillCommand.js +5 -5
- package/dist/cli/register/fillCommand.js.map +1 -1
- package/dist/cli/register/hoverCommand.d.ts.map +1 -1
- package/dist/cli/register/hoverCommand.js +2 -1
- package/dist/cli/register/hoverCommand.js.map +1 -1
- package/dist/cli/register/keydownCommand.d.ts.map +1 -1
- package/dist/cli/register/keydownCommand.js +2 -1
- package/dist/cli/register/keydownCommand.js.map +1 -1
- package/dist/cli/register/locateCommands.d.ts.map +1 -1
- package/dist/cli/register/locateCommands.js +2 -1
- package/dist/cli/register/locateCommands.js.map +1 -1
- package/dist/cli/register/logsCommands.d.ts.map +1 -1
- package/dist/cli/register/logsCommands.js +8 -10
- package/dist/cli/register/logsCommands.js.map +1 -1
- package/dist/cli/register/netCommands.d.ts +0 -5
- package/dist/cli/register/netCommands.d.ts.map +1 -1
- package/dist/cli/register/netCommands.js +17 -143
- package/dist/cli/register/netCommands.js.map +1 -1
- package/dist/cli/register/pageCommands.d.ts.map +1 -1
- package/dist/cli/register/pageCommands.js +8 -7
- package/dist/cli/register/pageCommands.js.map +1 -1
- package/dist/cli/register/pluginCommands.d.ts.map +1 -1
- package/dist/cli/register/pluginCommands.js +3 -2
- package/dist/cli/register/pluginCommands.js.map +1 -1
- package/dist/cli/register/quickAccessCommands.d.ts.map +1 -1
- package/dist/cli/register/quickAccessCommands.js +16 -31
- package/dist/cli/register/quickAccessCommands.js.map +1 -1
- package/dist/cli/register/recordCommands.d.ts.map +1 -1
- package/dist/cli/register/recordCommands.js +12 -34
- package/dist/cli/register/recordCommands.js.map +1 -1
- package/dist/cli/register/scrollToCommand.d.ts.map +1 -1
- package/dist/cli/register/scrollToCommand.js +2 -1
- package/dist/cli/register/scrollToCommand.js.map +1 -1
- package/dist/cli/register/sharedOptions.d.ts +11 -0
- package/dist/cli/register/sharedOptions.d.ts.map +1 -0
- package/dist/cli/register/sharedOptions.js +10 -0
- package/dist/cli/register/sharedOptions.js.map +1 -0
- package/dist/cli/register/skillCommands.d.ts.map +1 -1
- package/dist/cli/register/skillCommands.js +2 -1
- package/dist/cli/register/skillCommands.js.map +1 -1
- package/dist/cli/register/snapshotCommands.d.ts.map +1 -1
- package/dist/cli/register/snapshotCommands.js +3 -2
- package/dist/cli/register/snapshotCommands.js.map +1 -1
- package/dist/cli/register/storageCommands.d.ts.map +1 -1
- package/dist/cli/register/storageCommands.js +2 -1
- package/dist/cli/register/storageCommands.js.map +1 -1
- package/dist/cli/register/throttleCommands.d.ts.map +1 -1
- package/dist/cli/register/throttleCommands.js +4 -3
- package/dist/cli/register/throttleCommands.js.map +1 -1
- package/dist/cli/register/traceCommands.d.ts.map +1 -1
- package/dist/cli/register/traceCommands.js +10 -30
- package/dist/cli/register/traceCommands.js.map +1 -1
- package/dist/cli/register/watcherCommands.d.ts.map +1 -1
- package/dist/cli/register/watcherCommands.js +12 -24
- package/dist/cli/register/watcherCommands.js.map +1 -1
- package/dist/cli/validation.d.ts +14 -0
- package/dist/cli/validation.d.ts.map +1 -1
- package/dist/cli/validation.js +17 -6
- package/dist/cli/validation.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +3 -2
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/authCookieSupport.d.ts +4 -2
- package/dist/commands/authCookieSupport.d.ts.map +1 -1
- package/dist/commands/authCookieSupport.js +0 -4
- package/dist/commands/authCookieSupport.js.map +1 -1
- package/dist/commands/authCookies.d.ts +4 -4
- package/dist/commands/authCookies.d.ts.map +1 -1
- package/dist/commands/chrome/authState.d.ts +0 -12
- package/dist/commands/chrome/authState.d.ts.map +1 -1
- package/dist/commands/chrome/authState.js +0 -14
- package/dist/commands/chrome/authState.js.map +1 -1
- package/dist/commands/chrome/browser.d.ts.map +1 -1
- package/dist/commands/chrome/browser.js +2 -1
- package/dist/commands/chrome/browser.js.map +1 -1
- package/dist/commands/chrome/shared.d.ts.map +1 -1
- package/dist/commands/chrome/shared.js +3 -2
- package/dist/commands/chrome/shared.js.map +1 -1
- package/dist/commands/chrome/targets.d.ts.map +1 -1
- package/dist/commands/chrome/targets.js +6 -5
- package/dist/commands/chrome/targets.js.map +1 -1
- package/dist/commands/chromeStart.d.ts +10 -0
- package/dist/commands/chromeStart.d.ts.map +1 -1
- package/dist/commands/chromeStart.js +50 -41
- package/dist/commands/chromeStart.js.map +1 -1
- package/dist/commands/code.d.ts +2 -2
- package/dist/commands/code.d.ts.map +1 -1
- package/dist/commands/codeEdit.d.ts.map +1 -1
- package/dist/commands/codeEdit.js +3 -2
- package/dist/commands/codeEdit.js.map +1 -1
- package/dist/commands/configInit.d.ts +1 -0
- package/dist/commands/configInit.d.ts.map +1 -1
- package/dist/commands/configInit.js +17 -14
- package/dist/commands/configInit.js.map +1 -1
- package/dist/commands/dialog.d.ts +4 -4
- package/dist/commands/dialog.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +14 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/dom/shared.js +1 -1
- package/dist/commands/dom/shared.js.map +1 -1
- package/dist/commands/domAdd.d.ts +1 -1
- package/dist/commands/domAdd.d.ts.map +1 -1
- package/dist/commands/domAdd.js +10 -54
- package/dist/commands/domAdd.js.map +1 -1
- package/dist/commands/domAddScript.d.ts.map +1 -1
- package/dist/commands/domAddScript.js +14 -58
- package/dist/commands/domAddScript.js.map +1 -1
- package/dist/commands/domClick.d.ts +1 -2
- package/dist/commands/domClick.d.ts.map +1 -1
- package/dist/commands/domClick.js +2 -4
- package/dist/commands/domClick.js.map +1 -1
- package/dist/commands/domDrag.d.ts +1 -2
- package/dist/commands/domDrag.d.ts.map +1 -1
- package/dist/commands/domDrag.js +3 -5
- package/dist/commands/domDrag.js.map +1 -1
- package/dist/commands/domFill.d.ts +1 -1
- package/dist/commands/domFill.d.ts.map +1 -1
- package/dist/commands/domFill.js +10 -42
- package/dist/commands/domFill.js.map +1 -1
- package/dist/commands/domFocus.d.ts +1 -1
- package/dist/commands/domFocus.d.ts.map +1 -1
- package/dist/commands/domHover.d.ts +1 -1
- package/dist/commands/domHover.d.ts.map +1 -1
- package/dist/commands/domInfo.d.ts +1 -1
- package/dist/commands/domInfo.d.ts.map +1 -1
- package/dist/commands/domKeydown.d.ts +1 -1
- package/dist/commands/domKeydown.d.ts.map +1 -1
- package/dist/commands/domModify.d.ts.map +1 -1
- package/dist/commands/domModify.js +6 -7
- package/dist/commands/domModify.js.map +1 -1
- package/dist/commands/domRemove.d.ts +1 -1
- package/dist/commands/domRemove.d.ts.map +1 -1
- package/dist/commands/domScroll.d.ts +1 -1
- package/dist/commands/domScroll.d.ts.map +1 -1
- package/dist/commands/domScroll.js +16 -10
- package/dist/commands/domScroll.js.map +1 -1
- package/dist/commands/domScrollTo.d.ts +1 -1
- package/dist/commands/domScrollTo.d.ts.map +1 -1
- package/dist/commands/domSetFile.d.ts +1 -1
- package/dist/commands/domSetFile.d.ts.map +1 -1
- package/dist/commands/domTree.d.ts +1 -1
- package/dist/commands/domTree.d.ts.map +1 -1
- package/dist/commands/eval.d.ts +3 -32
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +14 -33
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/evalBundle.js +2 -1
- package/dist/commands/evalBundle.js.map +1 -1
- package/dist/commands/evalEmit.d.ts +35 -0
- package/dist/commands/evalEmit.d.ts.map +1 -0
- package/dist/commands/evalEmit.js +65 -0
- package/dist/commands/evalEmit.js.map +1 -0
- package/dist/commands/evalIframe.d.ts +16 -0
- package/dist/commands/evalIframe.d.ts.map +1 -0
- package/dist/commands/evalIframe.js +37 -0
- package/dist/commands/evalIframe.js.map +1 -0
- package/dist/commands/evalShared.d.ts +52 -44
- package/dist/commands/evalShared.d.ts.map +1 -1
- package/dist/commands/evalShared.js +64 -192
- package/dist/commands/evalShared.js.map +1 -1
- package/dist/commands/evalUntil.d.ts +4 -32
- package/dist/commands/evalUntil.d.ts.map +1 -1
- package/dist/commands/evalUntil.js +9 -29
- package/dist/commands/evalUntil.js.map +1 -1
- package/dist/commands/extension/attach.d.ts.map +1 -1
- package/dist/commands/extension/attach.js +12 -28
- package/dist/commands/extension/attach.js.map +1 -1
- package/dist/commands/extension/doctor.d.ts.map +1 -1
- package/dist/commands/extension/doctor.js +1 -1
- package/dist/commands/extension/doctor.js.map +1 -1
- package/dist/commands/extension/failures.d.ts +62 -0
- package/dist/commands/extension/failures.d.ts.map +1 -0
- package/dist/commands/extension/failures.js +70 -0
- package/dist/commands/extension/failures.js.map +1 -0
- package/dist/commands/extension/info.d.ts.map +1 -1
- package/dist/commands/extension/info.js +4 -14
- package/dist/commands/extension/info.js.map +1 -1
- package/dist/commands/extension/install.d.ts.map +1 -1
- package/dist/commands/extension/install.js +12 -22
- package/dist/commands/extension/install.js.map +1 -1
- package/dist/commands/extension/nativeHost.d.ts +22 -0
- package/dist/commands/extension/nativeHost.d.ts.map +1 -1
- package/dist/commands/extension/nativeHost.js +38 -7
- package/dist/commands/extension/nativeHost.js.map +1 -1
- package/dist/commands/extension/remove.d.ts.map +1 -1
- package/dist/commands/extension/remove.js +5 -15
- package/dist/commands/extension/remove.js.map +1 -1
- package/dist/commands/extension/resolveExtensionWatcher.d.ts.map +1 -1
- package/dist/commands/extension/resolveExtensionWatcher.js +3 -2
- package/dist/commands/extension/resolveExtensionWatcher.js.map +1 -1
- package/dist/commands/extension/select.js +11 -23
- package/dist/commands/extension/select.js.map +1 -1
- package/dist/commands/extension/setup.d.ts.map +1 -1
- package/dist/commands/extension/setup.js +8 -30
- package/dist/commands/extension/setup.js.map +1 -1
- package/dist/commands/extension/show.d.ts.map +1 -1
- package/dist/commands/extension/show.js +10 -17
- package/dist/commands/extension/show.js.map +1 -1
- package/dist/commands/extension/status.d.ts.map +1 -1
- package/dist/commands/extension/status.js +5 -14
- package/dist/commands/extension/status.js.map +1 -1
- package/dist/commands/extension/tabAttach.d.ts.map +1 -1
- package/dist/commands/extension/tabAttach.js +2 -2
- package/dist/commands/extension/tabAttach.js.map +1 -1
- package/dist/commands/extension/tabSelection.d.ts.map +1 -1
- package/dist/commands/extension/tabSelection.js +1 -1
- package/dist/commands/extension/tabSelection.js.map +1 -1
- package/dist/commands/extension/tabWatcher.d.ts +7 -1
- package/dist/commands/extension/tabWatcher.d.ts.map +1 -1
- package/dist/commands/extension/tabWatcher.js +17 -21
- package/dist/commands/extension/tabWatcher.js.map +1 -1
- package/dist/commands/extension/tabs.d.ts.map +1 -1
- package/dist/commands/extension/tabs.js +6 -31
- package/dist/commands/extension/tabs.js.map +1 -1
- package/dist/commands/extension/targetSelection.d.ts +10 -25
- package/dist/commands/extension/targetSelection.d.ts.map +1 -1
- package/dist/commands/extension/targetSelection.js +2 -2
- package/dist/commands/extension/targetSelection.js.map +1 -1
- package/dist/commands/extension/targets.js +2 -11
- package/dist/commands/extension/targets.js.map +1 -1
- package/dist/commands/iframeHelper.d.ts +13 -0
- package/dist/commands/iframeHelper.d.ts.map +1 -1
- package/dist/commands/iframeHelper.js +7 -1
- package/dist/commands/iframeHelper.js.map +1 -1
- package/dist/commands/inputSource.d.ts +57 -0
- package/dist/commands/inputSource.d.ts.map +1 -0
- package/dist/commands/inputSource.js +75 -0
- package/dist/commands/inputSource.js.map +1 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +14 -6
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/logs.d.ts +3 -3
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/net.d.ts +1 -1
- package/dist/commands/net.d.ts.map +1 -1
- package/dist/commands/netClear.d.ts +1 -1
- package/dist/commands/netClear.d.ts.map +1 -1
- package/dist/commands/netExport.d.ts.map +1 -1
- package/dist/commands/netExport.js +9 -31
- package/dist/commands/netExport.js.map +1 -1
- package/dist/commands/netInspect.d.ts.map +1 -1
- package/dist/commands/netInspect.js +2 -1
- package/dist/commands/netInspect.js.map +1 -1
- package/dist/commands/netMock.d.ts +4 -4
- package/dist/commands/netMock.d.ts.map +1 -1
- package/dist/commands/netMock.js +2 -2
- package/dist/commands/netMock.js.map +1 -1
- package/dist/commands/netRequestClient.d.ts +2 -2
- package/dist/commands/netRequestClient.d.ts.map +1 -1
- package/dist/commands/netRequestClient.js.map +1 -1
- package/dist/commands/netShared.d.ts +22 -0
- package/dist/commands/netShared.d.ts.map +1 -1
- package/dist/commands/netShared.js +43 -16
- package/dist/commands/netShared.js.map +1 -1
- package/dist/commands/netSse.d.ts +1 -1
- package/dist/commands/netSse.d.ts.map +1 -1
- package/dist/commands/netSummary.js +6 -25
- package/dist/commands/netSummary.js.map +1 -1
- package/dist/commands/netWebSocket.d.ts +2 -2
- package/dist/commands/netWebSocket.d.ts.map +1 -1
- package/dist/commands/page.d.ts +8 -0
- package/dist/commands/page.d.ts.map +1 -1
- package/dist/commands/page.js +83 -83
- package/dist/commands/page.js.map +1 -1
- package/dist/commands/pageEmulation.d.ts +3 -3
- package/dist/commands/pageEmulation.d.ts.map +1 -1
- package/dist/commands/pageEmulation.js +17 -12
- package/dist/commands/pageEmulation.js.map +1 -1
- package/dist/commands/pluginConfig.d.ts.map +1 -1
- package/dist/commands/pluginConfig.js +21 -20
- package/dist/commands/pluginConfig.js.map +1 -1
- package/dist/commands/record.d.ts +3 -3
- package/dist/commands/record.d.ts.map +1 -1
- package/dist/commands/record.js +1 -1
- package/dist/commands/record.js.map +1 -1
- package/dist/commands/reload.d.ts +1 -1
- package/dist/commands/reload.d.ts.map +1 -1
- package/dist/commands/resolveTestId.d.ts.map +1 -1
- package/dist/commands/resolveTestId.js +2 -3
- package/dist/commands/resolveTestId.js.map +1 -1
- package/dist/commands/screenshot.d.ts +1 -1
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/snapshot.d.ts +1 -1
- package/dist/commands/snapshot.d.ts.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +6 -28
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/startShared.d.ts.map +1 -1
- package/dist/commands/startShared.js +2 -1
- package/dist/commands/startShared.js.map +1 -1
- package/dist/commands/throttle.d.ts +3 -3
- package/dist/commands/throttle.d.ts.map +1 -1
- package/dist/commands/throttle.js +2 -3
- package/dist/commands/throttle.js.map +1 -1
- package/dist/commands/trace.d.ts.map +1 -1
- package/dist/commands/trace.js +2 -2
- package/dist/commands/trace.js.map +1 -1
- package/dist/commands/watcherNativeHost.d.ts.map +1 -1
- package/dist/commands/watcherNativeHost.js +4 -1
- package/dist/commands/watcherNativeHost.js.map +1 -1
- package/dist/commands/watcherPrune.d.ts.map +1 -1
- package/dist/commands/watcherPrune.js +3 -3
- package/dist/commands/watcherPrune.js.map +1 -1
- package/dist/commands/watcherSession.d.ts.map +1 -1
- package/dist/commands/watcherSession.js +2 -1
- package/dist/commands/watcherSession.js.map +1 -1
- package/dist/commands/watcherStatus.d.ts +1 -1
- package/dist/commands/watcherStatus.d.ts.map +1 -1
- package/dist/commands/watcherStatus.js +5 -0
- package/dist/commands/watcherStatus.js.map +1 -1
- package/dist/commands/watcherStop.d.ts.map +1 -1
- package/dist/commands/watcherStop.js +2 -2
- package/dist/commands/watcherStop.js.map +1 -1
- package/dist/config/configContext.d.ts +27 -0
- package/dist/config/configContext.d.ts.map +1 -0
- package/dist/config/configContext.js +57 -0
- package/dist/config/configContext.js.map +1 -0
- package/dist/config/loadConfig.d.ts.map +1 -1
- package/dist/config/loadConfig.js +3 -2
- package/dist/config/loadConfig.js.map +1 -1
- package/dist/eval/evalClient.d.ts.map +1 -1
- package/dist/eval/evalClient.js +2 -1
- package/dist/eval/evalClient.js.map +1 -1
- package/dist/extension/dist/background/service-worker.js +465 -448
- package/dist/extension/dist/background/service-worker.js.map +4 -4
- package/dist/extension/dist/popup/popup.js +279 -234
- package/dist/extension/dist/popup/popup.js.map +4 -4
- package/dist/extension/manifest.json +1 -1
- package/dist/internal.d.ts +22 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +22 -0
- package/dist/internal.js.map +1 -0
- package/dist/output/io.d.ts +8 -9
- package/dist/output/io.d.ts.map +1 -1
- package/dist/output/io.js.map +1 -1
- package/dist/registry.d.ts +1 -4
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -25
- package/dist/registry.js.map +1 -1
- package/dist/runtime-code/format.d.ts.map +1 -1
- package/dist/runtime-code/format.js +2 -1
- package/dist/runtime-code/format.js.map +1 -1
- package/dist/watchers/queryParams.d.ts +11 -9
- package/dist/watchers/queryParams.d.ts.map +1 -1
- package/dist/watchers/queryParams.js +63 -86
- package/dist/watchers/queryParams.js.map +1 -1
- package/dist/watchers/requestWatcher.d.ts +7 -25
- package/dist/watchers/requestWatcher.d.ts.map +1 -1
- package/dist/watchers/requestWatcher.js +9 -6
- package/dist/watchers/requestWatcher.js.map +1 -1
- package/dist/watchers/resolveWatcher.d.ts.map +1 -1
- package/dist/watchers/resolveWatcher.js +9 -2
- package/dist/watchers/resolveWatcher.js.map +1 -1
- package/package.json +9 -5
- package/dist/time.d.ts +0 -3
- package/dist/time.d.ts.map +0 -1
- package/dist/time.js +0 -19
- package/dist/time.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EvalResponse } from '@vforsh/argus-core';
|
|
2
|
+
import type { Output } from '../output/io.js';
|
|
3
|
+
import { type EvalResultFileOptions } from './evalResultOutput.js';
|
|
4
|
+
/**
|
|
5
|
+
* Where an eval result goes: stdout/stderr, and optionally the `--out` file.
|
|
6
|
+
*
|
|
7
|
+
* Split out of `evalShared.ts`, which had grown to hold five unrelated concerns.
|
|
8
|
+
*/
|
|
9
|
+
/** Format an exception response into a human-readable string. */
|
|
10
|
+
export declare const formatException: (response: EvalResponse) => string;
|
|
11
|
+
/** Failure shape used by eval emitters. */
|
|
12
|
+
export type EvalAttemptFailure = {
|
|
13
|
+
ok: false;
|
|
14
|
+
kind: 'transport' | 'exception';
|
|
15
|
+
error: string;
|
|
16
|
+
response?: EvalResponse;
|
|
17
|
+
attempt: number;
|
|
18
|
+
};
|
|
19
|
+
export type EvalEmitOptions = EvalResultFileOptions & {
|
|
20
|
+
json?: boolean;
|
|
21
|
+
silent?: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** Writes eval results to stdout/stderr and optionally to `--out`. */
|
|
24
|
+
export type EvalEmitter = {
|
|
25
|
+
emitSuccess: (response: EvalResponse, streaming: boolean) => Promise<void>;
|
|
26
|
+
emitError: (error: EvalAttemptFailure | {
|
|
27
|
+
kind: 'until';
|
|
28
|
+
error: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
};
|
|
31
|
+
/** Create stdout/stderr and optional file sinks for eval command output. */
|
|
32
|
+
export declare const createEvalEmitter: (options: EvalEmitOptions, output: Output) => EvalEmitter;
|
|
33
|
+
/** Write a successful eval response to stdout/stderr only. */
|
|
34
|
+
export declare const writeEvalSuccess: (response: EvalResponse, options: EvalEmitOptions, output: Output, streaming: boolean) => void;
|
|
35
|
+
//# sourceMappingURL=evalEmit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evalEmit.d.ts","sourceRoot":"","sources":["../../src/commands/evalEmit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAA4B,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE5F;;;;GAIG;AAEH,iEAAiE;AACjE,eAAO,MAAM,eAAe,GAAI,UAAU,YAAY,KAAG,MAQxD,CAAA;AAMD,2CAA2C;AAC3C,MAAM,MAAM,kBAAkB,GAAG;IAChC,EAAE,EAAE,KAAK,CAAA;IACT,IAAI,EAAE,WAAW,GAAG,WAAW,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG;IACrD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,sEAAsE;AACtE,MAAM,MAAM,WAAW,GAAG;IACzB,WAAW,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1E,SAAS,EAAE,CAAC,KAAK,EAAE,kBAAkB,GAAG;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACjF,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,GAAI,SAAS,eAAe,EAAE,QAAQ,MAAM,KAAG,WAgB5E,CAAA;AAED,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB,GAAI,UAAU,YAAY,EAAE,SAAS,eAAe,EAAE,QAAQ,MAAM,EAAE,WAAW,OAAO,KAAG,IAoBvH,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { previewStringify } from '@vforsh/argus-core';
|
|
2
|
+
import { createEvalResultFileSink } from './evalResultOutput.js';
|
|
3
|
+
/**
|
|
4
|
+
* Where an eval result goes: stdout/stderr, and optionally the `--out` file.
|
|
5
|
+
*
|
|
6
|
+
* Split out of `evalShared.ts`, which had grown to hold five unrelated concerns.
|
|
7
|
+
*/
|
|
8
|
+
/** Format an exception response into a human-readable string. */
|
|
9
|
+
export const formatException = (response) => {
|
|
10
|
+
if (!response.exception) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
if (response.exception.details) {
|
|
14
|
+
return `Exception: ${response.exception.text}\n${previewStringify(response.exception.details)}`;
|
|
15
|
+
}
|
|
16
|
+
return `Exception: ${response.exception.text}`;
|
|
17
|
+
};
|
|
18
|
+
/** Create stdout/stderr and optional file sinks for eval command output. */
|
|
19
|
+
export const createEvalEmitter = (options, output) => {
|
|
20
|
+
const fileSink = createEvalResultFileSink(options);
|
|
21
|
+
return {
|
|
22
|
+
emitSuccess: async (response, streaming) => {
|
|
23
|
+
await fileSink?.write(response, streaming);
|
|
24
|
+
writeEvalSuccess(response, options, output, streaming);
|
|
25
|
+
if (fileSink && !streaming && !options.silent) {
|
|
26
|
+
output.writeHuman(`Result saved: ${fileSink.displayPath}`);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
emitError: (error) => {
|
|
30
|
+
writeEvalError(error, options, output);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** Write a successful eval response to stdout/stderr only. */
|
|
35
|
+
export const writeEvalSuccess = (response, options, output, streaming) => {
|
|
36
|
+
if (options.silent) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (options.json) {
|
|
40
|
+
if (streaming) {
|
|
41
|
+
output.writeJsonLine(response);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
output.writeJson(response);
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (response.exception) {
|
|
49
|
+
output.writeHuman(formatException(response));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
output.writeHuman(previewStringify(response.result));
|
|
53
|
+
};
|
|
54
|
+
/** Write an eval error to stdout/stderr only. */
|
|
55
|
+
const writeEvalError = (error, options, output) => {
|
|
56
|
+
if (options.json && 'response' in error && error.response) {
|
|
57
|
+
output.writeJsonLine(error.response);
|
|
58
|
+
}
|
|
59
|
+
if (error.kind === 'exception' && 'response' in error && error.response?.exception) {
|
|
60
|
+
output.writeWarn(formatException(error.response));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
output.writeWarn(error.error);
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=evalEmit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evalEmit.js","sourceRoot":"","sources":["../../src/commands/evalEmit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EAAE,wBAAwB,EAA8B,MAAM,uBAAuB,CAAA;AAE5F;;;;GAIG;AAEH,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAsB,EAAU,EAAE;IACjE,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,CAAA;IACV,CAAC;IACD,IAAI,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAChC,OAAO,cAAc,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAA;IAChG,CAAC;IACD,OAAO,cAAc,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;AAC/C,CAAC,CAAA;AA0BD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAwB,EAAE,MAAc,EAAe,EAAE;IAC1F,MAAM,QAAQ,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAA;IAElD,OAAO;QACN,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;YAC1C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,UAAU,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC3D,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,UAAU,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;QACpF,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;QACjD,OAAM;IACP,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-frame eval: the CLI can only talk to the top-level page, so an `--iframe` expression is
|
|
3
|
+
* wrapped in a postMessage round-trip that the iframe's Argus helper script answers.
|
|
4
|
+
*/
|
|
5
|
+
/** Configuration for wrapping an expression for iframe eval via postMessage. */
|
|
6
|
+
export type IframeWrapConfig = {
|
|
7
|
+
selector: string;
|
|
8
|
+
namespace: string;
|
|
9
|
+
timeoutMs: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Wrap an expression to eval it in an iframe via postMessage.
|
|
13
|
+
* The iframe must have the argus helper script loaded.
|
|
14
|
+
*/
|
|
15
|
+
export declare const wrapForIframeEval: (code: string, config: IframeWrapConfig) => string;
|
|
16
|
+
//# sourceMappingURL=evalIframe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evalIframe.d.ts","sourceRoot":"","sources":["../../src/commands/evalIframe.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,QAAQ,gBAAgB,KAAG,MA6B1E,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-frame eval: the CLI can only talk to the top-level page, so an `--iframe` expression is
|
|
3
|
+
* wrapped in a postMessage round-trip that the iframe's Argus helper script answers.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Wrap an expression to eval it in an iframe via postMessage.
|
|
7
|
+
* The iframe must have the argus helper script loaded.
|
|
8
|
+
*/
|
|
9
|
+
export const wrapForIframeEval = (code, config) => {
|
|
10
|
+
const { selector, namespace, timeoutMs } = config;
|
|
11
|
+
const evalType = `${namespace}:eval`;
|
|
12
|
+
const resultType = `${namespace}:eval-result`;
|
|
13
|
+
// Escape the code for embedding in a string
|
|
14
|
+
const escapedCode = JSON.stringify(code);
|
|
15
|
+
return `(async () => {
|
|
16
|
+
const iframe = document.querySelector(${JSON.stringify(selector)});
|
|
17
|
+
if (!iframe) throw new Error('Iframe not found: ${selector.replace(/'/g, "\\'")}');
|
|
18
|
+
if (!iframe.contentWindow) throw new Error('Iframe has no contentWindow');
|
|
19
|
+
const id = crypto.randomUUID();
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const timeout = setTimeout(() => {
|
|
22
|
+
window.removeEventListener('message', handler);
|
|
23
|
+
reject(new Error('Iframe eval timeout after ${timeoutMs}ms'));
|
|
24
|
+
}, ${timeoutMs});
|
|
25
|
+
const handler = (e) => {
|
|
26
|
+
if (e.data?.type !== '${resultType}' || e.data.id !== id) return;
|
|
27
|
+
clearTimeout(timeout);
|
|
28
|
+
window.removeEventListener('message', handler);
|
|
29
|
+
if (e.data.ok) resolve(e.data.result);
|
|
30
|
+
else reject(new Error(e.data.error));
|
|
31
|
+
};
|
|
32
|
+
window.addEventListener('message', handler);
|
|
33
|
+
iframe.contentWindow.postMessage({ type: '${evalType}', id, code: ${escapedCode} }, '*');
|
|
34
|
+
});
|
|
35
|
+
})()`;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=evalIframe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evalIframe.js","sourceRoot":"","sources":["../../src/commands/evalIframe.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,MAAwB,EAAU,EAAE;IACnF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,CAAA;IACjD,MAAM,QAAQ,GAAG,GAAG,SAAS,OAAO,CAAA;IACpC,MAAM,UAAU,GAAG,GAAG,SAAS,cAAc,CAAA;IAE7C,4CAA4C;IAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAExC,OAAO;0CACkC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;oDACd,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;;;;;;oDAM7B,SAAS;SACpD,SAAS;;8BAEY,UAAU;;;;;;;gDAOQ,QAAQ,gBAAgB,WAAW;;KAE9E,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type { EvalResponse } from '@vforsh/argus-core';
|
|
2
1
|
import type { Output } from '../output/io.js';
|
|
3
2
|
import { type EvalArgMap, type EvalArgSourceOptions } from './evalArgs.js';
|
|
4
|
-
import { type EvalResultFileOptions } from './evalResultOutput.js';
|
|
5
|
-
export { type EvalArgMap, hasEvalArgs, parseEvalArgFlags as parseEvalArgs } from './evalArgs.js';
|
|
6
|
-
export { formatError, parseNumber } from '../cli/parse.js';
|
|
7
3
|
type ExpressionSourceOptions = {
|
|
8
4
|
file?: string;
|
|
9
5
|
stdin?: boolean;
|
|
@@ -40,8 +36,6 @@ type BundleDecision = {
|
|
|
40
36
|
* Auto-bundle applies when leading script text uses import/export.
|
|
41
37
|
*/
|
|
42
38
|
export declare const resolveBundleDecision: (options: ExpressionSourceOptions, fileContent: string) => BundleDecision;
|
|
43
|
-
/** Read all of stdin into a string. */
|
|
44
|
-
export declare const readStdin: () => Promise<string>;
|
|
45
39
|
/** Parse `--retry` flag into a non-negative integer. */
|
|
46
40
|
export declare const parseRetryCount: (value?: string) => {
|
|
47
41
|
value: number;
|
|
@@ -69,48 +63,62 @@ export declare const parseCount: (value?: string) => {
|
|
|
69
63
|
};
|
|
70
64
|
/** Prepend the reserved `args` binding only when eval arguments were supplied. */
|
|
71
65
|
export declare const wrapExpressionWithArgs: (source: string, args: EvalArgMap) => string;
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
error: string;
|
|
81
|
-
response?: EvalResponse;
|
|
82
|
-
attempt: number;
|
|
83
|
-
};
|
|
84
|
-
export type EvalEmitOptions = EvalResultFileOptions & {
|
|
66
|
+
/**
|
|
67
|
+
* Flags `eval` and `eval-until` both accept.
|
|
68
|
+
*
|
|
69
|
+
* The two commands share their entire expression/args/iframe/out surface; only `--until`
|
|
70
|
+
* versus `--total-timeout` semantics differ. Declaring the shared half once means a new
|
|
71
|
+
* shared flag is added in one place instead of four.
|
|
72
|
+
*/
|
|
73
|
+
export type EvalCommonOptions = {
|
|
85
74
|
json?: boolean;
|
|
75
|
+
await?: boolean;
|
|
76
|
+
timeout?: string;
|
|
77
|
+
returnByValue?: boolean;
|
|
78
|
+
failOnException?: boolean;
|
|
79
|
+
retry?: string;
|
|
86
80
|
silent?: boolean;
|
|
81
|
+
interval?: string;
|
|
82
|
+
count?: string;
|
|
83
|
+
/** Read expression from a file path. */
|
|
84
|
+
file?: string;
|
|
85
|
+
/** Bundle local imports from `--file` before eval. */
|
|
86
|
+
bundle?: boolean;
|
|
87
|
+
/** Do not bundle `--file` (disables auto-bundle for import/export). */
|
|
88
|
+
noBundle?: boolean;
|
|
89
|
+
/** Read expression from stdin. Also activated when expression is `-`. */
|
|
90
|
+
stdin?: boolean;
|
|
91
|
+
/** Read setup code from a file and run it before the expression. */
|
|
92
|
+
inject?: string;
|
|
93
|
+
/** CSS selector for iframe to eval in via postMessage (extension mode). */
|
|
94
|
+
iframe?: string;
|
|
95
|
+
/** Message type prefix for iframe eval (default: argus). */
|
|
96
|
+
iframeNamespace?: string;
|
|
97
|
+
/** Timeout for iframe postMessage response (default: 5000; accepts duration syntax). */
|
|
98
|
+
iframeTimeout?: string;
|
|
99
|
+
/** Repeated key=value arguments exposed to scripts as `args`. */
|
|
100
|
+
arg?: string[];
|
|
101
|
+
/** Load args from a JSON object file. */
|
|
102
|
+
args?: string;
|
|
103
|
+
/** Write the eval result to a file. */
|
|
104
|
+
out?: string;
|
|
87
105
|
};
|
|
88
|
-
/**
|
|
89
|
-
export type
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
/** Create stdout/stderr and optional file sinks for eval command output. */
|
|
97
|
-
export declare const createEvalEmitter: (options: EvalEmitOptions, output: Output) => EvalEmitter;
|
|
98
|
-
/** Write a successful eval response to stdout/stderr only. */
|
|
99
|
-
export declare const printSuccess: (response: EvalResponse, options: EvalEmitOptions, output: Output, streaming: boolean) => void;
|
|
100
|
-
/** Write an eval error to stdout/stderr only. */
|
|
101
|
-
export declare const printError: (error: EvalAttemptFailure | {
|
|
102
|
-
kind: "until";
|
|
103
|
-
error: string;
|
|
104
|
-
}, options: EvalEmitOptions, output: Output) => void;
|
|
105
|
-
/** Configuration for wrapping an expression for iframe eval via postMessage. */
|
|
106
|
-
export type IframeWrapConfig = {
|
|
107
|
-
selector: string;
|
|
108
|
-
namespace: string;
|
|
109
|
-
timeoutMs: number;
|
|
106
|
+
/** Values both eval commands derive from {@link EvalCommonOptions}. */
|
|
107
|
+
export type EvalCommonFlags = {
|
|
108
|
+
/** Retry attempts. `parseRetryCount` defaults this to 0, so it is never absent. */
|
|
109
|
+
retryCount: number;
|
|
110
|
+
intervalMs: number | undefined;
|
|
111
|
+
count: number | undefined;
|
|
112
|
+
timeoutMs: number | undefined;
|
|
110
113
|
};
|
|
111
114
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
115
|
+
* Parse the flags both eval commands share, reporting the first failure.
|
|
116
|
+
*
|
|
117
|
+
* Each command used to walk the same six-rung parse-warn-exit ladder inline.
|
|
118
|
+
*
|
|
119
|
+
* @returns The parsed values, or `null` when a warning has been written and
|
|
120
|
+
* `process.exitCode` set.
|
|
114
121
|
*/
|
|
115
|
-
export declare const
|
|
122
|
+
export declare const parseEvalCommonFlags: (options: EvalCommonOptions, output: Output) => EvalCommonFlags | null;
|
|
123
|
+
export {};
|
|
116
124
|
//# sourceMappingURL=evalShared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evalShared.d.ts","sourceRoot":"","sources":["../../src/commands/evalShared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"evalShared.d.ts","sourceRoot":"","sources":["../../src/commands/evalShared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAgC,MAAM,eAAe,CAAA;AAUxG,KAAK,uBAAuB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mCAAmC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,qBAAqB,GAAG,uBAAuB,GACnD,oBAAoB,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,MA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AC,EAAE,MAAM,CAAA;IACb,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,uEAAuE;AACvE,MAAM,MAAM,eAAe,GAAG;IAC7B,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,iBAAiB,EAAE,QAAQ,MAAM,KAAG,eAAe,GAAG,IAoBnG,CAAA"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { previewStringify } from '@vforsh/argus-core';
|
|
2
1
|
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { formatError
|
|
4
|
-
import { parseDurationMs } from '
|
|
2
|
+
import { formatError } from '../cli/parse.js';
|
|
3
|
+
import { parseDurationMs } from '@vforsh/argus-core';
|
|
5
4
|
import { hasEvalArgs, resolveEvalArgs } from './evalArgs.js';
|
|
6
5
|
import { bundleEvalEntry } from './evalBundle.js';
|
|
7
6
|
import { fileUsesModuleSyntax } from './evalModuleSyntax.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
export { hasEvalArgs, parseEvalArgFlags as parseEvalArgs } from './evalArgs.js';
|
|
11
|
-
// Re-export shared parsers so existing eval imports keep working.
|
|
12
|
-
export { formatError, parseNumber } from '../cli/parse.js';
|
|
7
|
+
import { wrapForIframeEval } from './evalIframe.js';
|
|
8
|
+
import { readTextInput, selectTextInput } from './inputSource.js';
|
|
13
9
|
/** Resolve script input, eval args, and iframe wrapping into the payload sent to the watcher. */
|
|
14
10
|
export const prepareEvalExpression = async (inline, options, output) => {
|
|
15
11
|
const args = await resolveEvalArgs(options, output);
|
|
@@ -50,81 +46,56 @@ export const resolveExpression = async (inline, options, output) => {
|
|
|
50
46
|
return resolved?.expression ?? null;
|
|
51
47
|
};
|
|
52
48
|
const resolveExpressionSource = async (inline, options, output) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (hasInline && hasFile) {
|
|
58
|
-
output.writeWarn('Cannot combine an inline expression with --file');
|
|
49
|
+
// Checked before the source is picked: "--bundle needs --file" is the more actionable message
|
|
50
|
+
// when a user passes --bundle with no expression at all.
|
|
51
|
+
if ((options.bundle || options.noBundle) && options.file == null) {
|
|
52
|
+
output.writeWarn('--bundle and --no-bundle require --file');
|
|
59
53
|
return null;
|
|
60
54
|
}
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
const selection = selectTextInput({ inline, file: options.file, stdin: options.stdin }, EXPRESSION_INPUT_NAMES, output);
|
|
56
|
+
if (!selection) {
|
|
63
57
|
return null;
|
|
64
58
|
}
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
const source = selection.kind === 'file' ? await resolveFileExpression(selection.path, options, output) : await readInlineExpression(selection, output);
|
|
60
|
+
if (!source) {
|
|
67
61
|
return null;
|
|
68
62
|
}
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
const injected = await prependInjectSource(source.expression, options.inject, output);
|
|
64
|
+
return injected == null ? null : { expression: injected, scenario: source.scenario };
|
|
65
|
+
};
|
|
66
|
+
const EXPRESSION_INPUT_NAMES = {
|
|
67
|
+
inline: 'an inline expression',
|
|
68
|
+
file: '--file',
|
|
69
|
+
stdin: '--stdin',
|
|
70
|
+
missing: 'Expression is required. Provide an inline expression, --file, or --stdin (or pass - as expression).',
|
|
71
|
+
};
|
|
72
|
+
const readInlineExpression = async (selection, output) => {
|
|
73
|
+
const expression = await readTextInput(selection, EXPRESSION_INPUT_NAMES, output, 'Expression');
|
|
74
|
+
return expression == null ? null : { expression };
|
|
75
|
+
};
|
|
76
|
+
/** A `--file` expression may be bundled first; `--bundle`/`--no-bundle` and module syntax decide. */
|
|
77
|
+
const resolveFileExpression = async (filePath, options, output) => {
|
|
78
|
+
const fileContent = await readTextInput({ kind: 'file', path: filePath }, EXPRESSION_INPUT_NAMES, output, 'File');
|
|
79
|
+
if (fileContent == null) {
|
|
71
80
|
return null;
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const fileContent = await readFileContent(filePath, options.file, output);
|
|
77
|
-
if (fileContent == null) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
const bundleDecision = resolveBundleDecision(options, fileContent);
|
|
81
|
-
if (bundleDecision.autoEnabled) {
|
|
82
|
-
output.writeWarn('Detected import/export in --file; bundling automatically. Pass --no-bundle to read the file as-is.');
|
|
83
|
-
}
|
|
84
|
-
if (bundleDecision.shouldBundle) {
|
|
85
|
-
const bundled = await bundleEvalEntry(filePath);
|
|
86
|
-
if (!bundled.ok) {
|
|
87
|
-
output.writeWarn(`Failed to bundle --file: ${bundled.error}`);
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
if (!bundled.code.trim()) {
|
|
91
|
-
output.writeWarn(`Bundled file is empty: ${options.file}`);
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
expression = bundled.code;
|
|
95
|
-
scenario = true;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
expression = fileContent;
|
|
99
|
-
}
|
|
82
|
+
const bundleDecision = resolveBundleDecision(options, fileContent);
|
|
83
|
+
if (bundleDecision.autoEnabled) {
|
|
84
|
+
output.writeWarn('Detected import/export in --file; bundling automatically. Pass --no-bundle to read the file as-is.');
|
|
100
85
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const content = await readStdin();
|
|
104
|
-
if (!content.trim()) {
|
|
105
|
-
output.writeWarn('Stdin input is empty');
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
expression = content;
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
output.writeWarn(`Failed to read stdin: ${formatError(error)}`);
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
86
|
+
if (!bundleDecision.shouldBundle) {
|
|
87
|
+
return { expression: fileContent };
|
|
114
88
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
expression = inline;
|
|
89
|
+
const bundled = await bundleEvalEntry(filePath);
|
|
90
|
+
if (!bundled.ok) {
|
|
91
|
+
output.writeWarn(`Failed to bundle --file: ${bundled.error}`);
|
|
92
|
+
return null;
|
|
121
93
|
}
|
|
122
|
-
|
|
123
|
-
output.writeWarn(
|
|
94
|
+
if (!bundled.code.trim()) {
|
|
95
|
+
output.writeWarn(`Bundled file is empty: ${filePath}`);
|
|
124
96
|
return null;
|
|
125
97
|
}
|
|
126
|
-
|
|
127
|
-
return injected == null ? null : { expression: injected, scenario };
|
|
98
|
+
return { expression: bundled.code, scenario: true };
|
|
128
99
|
};
|
|
129
100
|
/**
|
|
130
101
|
* `--no-bundle` wins over `--bundle` and auto-detection.
|
|
@@ -142,20 +113,6 @@ export const resolveBundleDecision = (options, fileContent) => {
|
|
|
142
113
|
}
|
|
143
114
|
return { shouldBundle: true, autoEnabled: true };
|
|
144
115
|
};
|
|
145
|
-
const readFileContent = async (filePath, displayPath, output) => {
|
|
146
|
-
try {
|
|
147
|
-
const content = await readFile(filePath, 'utf8');
|
|
148
|
-
if (!content.trim()) {
|
|
149
|
-
output.writeWarn(`File is empty: ${displayPath}`);
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
return content;
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
output.writeWarn(`Failed to read --file: ${formatError(error)}`);
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
116
|
const prependInjectSource = async (expression, injectPath, output) => {
|
|
160
117
|
if (injectPath == null) {
|
|
161
118
|
return expression;
|
|
@@ -173,17 +130,6 @@ const prependInjectSource = async (expression, injectPath, output) => {
|
|
|
173
130
|
return null;
|
|
174
131
|
}
|
|
175
132
|
};
|
|
176
|
-
/** Read all of stdin into a string. */
|
|
177
|
-
export const readStdin = async () => new Promise((resolve, reject) => {
|
|
178
|
-
let data = '';
|
|
179
|
-
process.stdin.setEncoding('utf8');
|
|
180
|
-
process.stdin.on('data', (chunk) => {
|
|
181
|
-
data += chunk;
|
|
182
|
-
});
|
|
183
|
-
process.stdin.on('end', () => resolve(data));
|
|
184
|
-
process.stdin.on('error', (error) => reject(error));
|
|
185
|
-
process.stdin.resume();
|
|
186
|
-
});
|
|
187
133
|
// ---------------------------------------------------------------------------
|
|
188
134
|
// Parsing helpers
|
|
189
135
|
// ---------------------------------------------------------------------------
|
|
@@ -239,105 +185,31 @@ export const wrapExpressionWithArgs = (source, args) => {
|
|
|
239
185
|
}
|
|
240
186
|
return `const args = Object.freeze(${JSON.stringify(args)});\n${source}`;
|
|
241
187
|
};
|
|
242
|
-
// ---------------------------------------------------------------------------
|
|
243
|
-
// Timing
|
|
244
|
-
// ---------------------------------------------------------------------------
|
|
245
|
-
/** Sleep for `durationMs` milliseconds. */
|
|
246
|
-
export const sleep = async (durationMs) => {
|
|
247
|
-
await new Promise((resolve) => setTimeout(resolve, durationMs));
|
|
248
|
-
};
|
|
249
|
-
// ---------------------------------------------------------------------------
|
|
250
|
-
// Formatting
|
|
251
|
-
// ---------------------------------------------------------------------------
|
|
252
|
-
/** Format an exception response into a human-readable string. */
|
|
253
|
-
export const formatException = (response) => {
|
|
254
|
-
if (!response.exception) {
|
|
255
|
-
return '';
|
|
256
|
-
}
|
|
257
|
-
if (response.exception.details) {
|
|
258
|
-
return `Exception: ${response.exception.text}\n${previewStringify(response.exception.details)}`;
|
|
259
|
-
}
|
|
260
|
-
return `Exception: ${response.exception.text}`;
|
|
261
|
-
};
|
|
262
|
-
/** Create stdout/stderr and optional file sinks for eval command output. */
|
|
263
|
-
export const createEvalEmitter = (options, output) => {
|
|
264
|
-
const fileSink = createEvalResultFileSink(options);
|
|
265
|
-
return {
|
|
266
|
-
emitSuccess: async (response, streaming) => {
|
|
267
|
-
await fileSink?.write(response, streaming);
|
|
268
|
-
writeEvalSuccess(response, options, output, streaming);
|
|
269
|
-
if (fileSink && !streaming && !options.silent) {
|
|
270
|
-
output.writeHuman(`Result saved: ${fileSink.displayPath}`);
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
emitError: (error) => {
|
|
274
|
-
writeEvalError(error, options, output);
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
};
|
|
278
|
-
const writeEvalSuccess = (response, options, output, streaming) => {
|
|
279
|
-
if (options.silent) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
if (options.json) {
|
|
283
|
-
if (streaming) {
|
|
284
|
-
output.writeJsonLine(response);
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
output.writeJson(response);
|
|
288
|
-
}
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
if (response.exception) {
|
|
292
|
-
output.writeHuman(formatException(response));
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
output.writeHuman(previewStringify(response.result));
|
|
296
|
-
};
|
|
297
|
-
const writeEvalError = (error, options, output) => {
|
|
298
|
-
if (options.json && 'response' in error && error.response) {
|
|
299
|
-
output.writeJsonLine(error.response);
|
|
300
|
-
}
|
|
301
|
-
if (error.kind === 'exception' && 'response' in error && error.response?.exception) {
|
|
302
|
-
output.writeWarn(formatException(error.response));
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
output.writeWarn(error.error);
|
|
306
|
-
};
|
|
307
|
-
/** Write a successful eval response to stdout/stderr only. */
|
|
308
|
-
export const printSuccess = writeEvalSuccess;
|
|
309
|
-
/** Write an eval error to stdout/stderr only. */
|
|
310
|
-
export const printError = writeEvalError;
|
|
311
188
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
189
|
+
* Parse the flags both eval commands share, reporting the first failure.
|
|
190
|
+
*
|
|
191
|
+
* Each command used to walk the same six-rung parse-warn-exit ladder inline.
|
|
192
|
+
*
|
|
193
|
+
* @returns The parsed values, or `null` when a warning has been written and
|
|
194
|
+
* `process.exitCode` set.
|
|
314
195
|
*/
|
|
315
|
-
export const
|
|
316
|
-
const
|
|
317
|
-
const
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (e.data?.type !== '${resultType}' || e.data.id !== id) return;
|
|
333
|
-
clearTimeout(timeout);
|
|
334
|
-
window.removeEventListener('message', handler);
|
|
335
|
-
if (e.data.ok) resolve(e.data.result);
|
|
336
|
-
else reject(new Error(e.data.error));
|
|
196
|
+
export const parseEvalCommonFlags = (options, output) => {
|
|
197
|
+
const retryCount = parseRetryCount(options.retry);
|
|
198
|
+
const intervalMs = parseIntervalMs(options.interval);
|
|
199
|
+
const count = parseCount(options.count);
|
|
200
|
+
const timeoutMs = parseTimeoutMs(options.timeout);
|
|
201
|
+
for (const parsed of [retryCount, intervalMs, count, timeoutMs]) {
|
|
202
|
+
if (parsed.error) {
|
|
203
|
+
output.writeWarn(parsed.error);
|
|
204
|
+
process.exitCode = 2;
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
retryCount: retryCount.value,
|
|
210
|
+
intervalMs: intervalMs.value,
|
|
211
|
+
count: count.value,
|
|
212
|
+
timeoutMs: timeoutMs.value,
|
|
337
213
|
};
|
|
338
|
-
window.addEventListener('message', handler);
|
|
339
|
-
iframe.contentWindow.postMessage({ type: '${evalType}', id, code: ${escapedCode} }, '*');
|
|
340
|
-
});
|
|
341
|
-
})()`;
|
|
342
214
|
};
|
|
343
215
|
//# sourceMappingURL=evalShared.js.map
|