@speedkit/cli 4.51.0 → 4.52.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 +14 -0
- package/README.md +1426 -14
- package/dist/base/run-control-command.d.ts +15 -0
- package/dist/base/run-control-command.js +20 -0
- package/dist/build-info.json +6 -0
- package/dist/commands/diff.d.ts +7 -1
- package/dist/commands/diff.js +9 -3
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +14 -3
- package/dist/commands/onboarding/browser/click.d.ts +75 -0
- package/dist/commands/onboarding/browser/click.js +19 -0
- package/dist/commands/onboarding/browser/emulate.d.ts +105 -0
- package/dist/commands/onboarding/browser/emulate.js +26 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +75 -0
- package/dist/commands/onboarding/browser/navigate.js +19 -0
- package/dist/commands/onboarding/browser/panel.d.ts +63 -0
- package/dist/commands/onboarding/browser/panel.js +12 -0
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +63 -0
- package/dist/commands/onboarding/browser/reinstall-sw.js +14 -0
- package/dist/commands/onboarding/browser/reset.d.ts +71 -0
- package/dist/commands/onboarding/browser/reset.js +18 -0
- package/dist/commands/onboarding/browser/screenshot.d.ts +77 -0
- package/dist/commands/onboarding/browser/screenshot.js +19 -0
- package/dist/commands/onboarding/browser/state.d.ts +63 -0
- package/dist/commands/onboarding/browser/state.js +12 -0
- package/dist/commands/onboarding/browser/tabs.d.ts +58 -0
- package/dist/commands/onboarding/browser/tabs.js +16 -0
- package/dist/commands/onboarding/cache/clear.d.ts +58 -0
- package/dist/commands/onboarding/cache/clear.js +12 -0
- package/dist/commands/onboarding/cache/errors.d.ts +58 -0
- package/dist/commands/onboarding/cache/errors.js +12 -0
- package/dist/commands/onboarding/cache/evict.d.ts +62 -0
- package/dist/commands/onboarding/cache/evict.js +15 -0
- package/dist/commands/onboarding/cache/get.d.ts +85 -0
- package/dist/commands/onboarding/cache/get.js +17 -0
- package/dist/commands/onboarding/cache/list.d.ts +58 -0
- package/dist/commands/onboarding/cache/list.js +15 -0
- package/dist/commands/onboarding/cache/prewarm.d.ts +73 -0
- package/dist/commands/onboarding/cache/prewarm.js +20 -0
- package/dist/commands/onboarding/cache/refresh.d.ts +62 -0
- package/dist/commands/onboarding/cache/refresh.js +18 -0
- package/dist/commands/onboarding/cdp.d.ts +81 -0
- package/dist/commands/onboarding/cdp.js +18 -0
- package/dist/commands/onboarding/debug/arm.d.ts +83 -0
- package/dist/commands/onboarding/debug/arm.js +19 -0
- package/dist/commands/onboarding/debug/await.d.ts +71 -0
- package/dist/commands/onboarding/debug/await.js +18 -0
- package/dist/commands/onboarding/debug/disarm.d.ts +63 -0
- package/dist/commands/onboarding/debug/disarm.js +12 -0
- package/dist/commands/onboarding/debug/eval.d.ts +75 -0
- package/dist/commands/onboarding/debug/eval.js +16 -0
- package/dist/commands/onboarding/debug/release.d.ts +63 -0
- package/dist/commands/onboarding/debug/release.js +12 -0
- package/dist/commands/onboarding/debug/resume.d.ts +63 -0
- package/dist/commands/onboarding/debug/resume.js +12 -0
- package/dist/commands/onboarding/debug/status.d.ts +63 -0
- package/dist/commands/onboarding/debug/status.js +12 -0
- package/dist/commands/onboarding/debug/step.d.ts +67 -0
- package/dist/commands/onboarding/debug/step.js +15 -0
- package/dist/commands/onboarding/files/list.d.ts +58 -0
- package/dist/commands/onboarding/files/list.js +12 -0
- package/dist/commands/onboarding/files/read.d.ts +73 -0
- package/dist/commands/onboarding/files/read.js +16 -0
- package/dist/commands/onboarding/files/rebuild.d.ts +63 -0
- package/dist/commands/onboarding/files/rebuild.js +18 -0
- package/dist/commands/onboarding/files/validate.d.ts +58 -0
- package/dist/commands/onboarding/files/validate.js +12 -0
- package/dist/commands/onboarding/fouc.d.ts +77 -0
- package/dist/commands/onboarding/fouc.js +16 -0
- package/dist/commands/onboarding/inject/add.d.ts +89 -0
- package/dist/commands/onboarding/inject/add.js +17 -0
- package/dist/commands/onboarding/inject/clear.d.ts +63 -0
- package/dist/commands/onboarding/inject/clear.js +12 -0
- package/dist/commands/onboarding/inject/list.d.ts +63 -0
- package/dist/commands/onboarding/inject/list.js +12 -0
- package/dist/commands/onboarding/inject/read.d.ts +75 -0
- package/dist/commands/onboarding/inject/read.js +18 -0
- package/dist/commands/onboarding/inject/recipes.d.ts +63 -0
- package/dist/commands/onboarding/inject/recipes.js +12 -0
- package/dist/commands/onboarding/inject/remove.d.ts +67 -0
- package/dist/commands/onboarding/inject/remove.js +15 -0
- package/dist/commands/onboarding/list.d.ts +13 -0
- package/dist/commands/onboarding/list.js +12 -0
- package/dist/commands/onboarding/logs.d.ts +41 -0
- package/dist/commands/onboarding/logs.js +257 -0
- package/dist/commands/onboarding/navwalk.d.ts +95 -0
- package/dist/commands/onboarding/navwalk.js +19 -0
- package/dist/commands/onboarding/response.d.ts +67 -0
- package/dist/commands/onboarding/response.js +18 -0
- package/dist/commands/onboarding/rum/beacons.d.ts +75 -0
- package/dist/commands/onboarding/rum/beacons.js +16 -0
- package/dist/commands/onboarding/rum/get.d.ts +77 -0
- package/dist/commands/onboarding/rum/get.js +18 -0
- package/dist/commands/onboarding/rum/key.d.ts +67 -0
- package/dist/commands/onboarding/rum/key.js +13 -0
- package/dist/commands/onboarding/rum/previous.d.ts +63 -0
- package/dist/commands/onboarding/rum/previous.js +12 -0
- package/dist/commands/onboarding/status.d.ts +13 -0
- package/dist/commands/onboarding/status.js +17 -0
- package/dist/commands/onboarding/stop.d.ts +13 -0
- package/dist/commands/onboarding/stop.js +17 -0
- package/dist/commands/onboarding/todo.d.ts +58 -0
- package/dist/commands/onboarding/todo.js +12 -0
- package/dist/commands/onboarding/viewport.d.ts +101 -0
- package/dist/commands/onboarding/viewport.js +18 -0
- package/dist/commands/onboarding/watch.d.ts +93 -0
- package/dist/commands/onboarding/watch.js +16 -0
- package/dist/commands/onboarding.d.ts +26 -0
- package/dist/commands/onboarding.js +221 -4
- package/dist/commands/origin-request.d.ts +4 -0
- package/dist/commands/origin-request.js +4 -0
- package/dist/commands/spec/onboarding.spec.d.ts +1 -0
- package/dist/commands/spec/onboarding.spec.js +127 -0
- package/dist/services/browser-fetch/device-emulation.d.ts +11 -0
- package/dist/services/browser-fetch/device-emulation.js +14 -0
- package/dist/services/cli/build-info.d.ts +33 -0
- package/dist/services/cli/build-info.js +63 -0
- package/dist/services/cli/cli-environment-factory.d.ts +3 -0
- package/dist/services/cli/cli-environment-factory.js +1 -0
- package/dist/services/cli/cli-service-build-context.d.ts +3 -0
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +29 -10
- package/dist/services/cli/cli-service.d.ts +60 -11
- package/dist/services/cli/cli-service.js +196 -32
- package/dist/services/cli/index.d.ts +2 -0
- package/dist/services/cli/index.js +2 -0
- package/dist/services/cli/sink.d.ts +47 -0
- package/dist/services/cli/sink.js +31 -0
- package/dist/services/cli/spec/build-identity.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-identity.spec.js +85 -0
- package/dist/services/cli/spec/build-info.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-info.spec.js +10 -0
- package/dist/services/cli/spec/cli-service-log.spec.d.ts +1 -0
- package/dist/services/cli/spec/cli-service-log.spec.js +133 -0
- package/dist/services/cli/spec/cli-service.spec.js +113 -50
- package/dist/services/cli/spec/memory-cli.d.ts +9 -0
- package/dist/services/cli/spec/memory-cli.js +9 -0
- package/dist/services/diff/config-at-ref.d.ts +20 -0
- package/dist/services/diff/config-at-ref.js +33 -0
- package/dist/services/diff/diff-service-build-context.d.ts +12 -0
- package/dist/services/diff/diff-service-build-context.js +45 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +65 -25
- package/dist/services/diff/diff-service.d.ts +11 -0
- package/dist/services/diff/diff-service.js +37 -11
- package/dist/services/diff/page-source.d.ts +12 -0
- package/dist/services/diff/page-source.js +16 -11
- package/dist/services/diff/run-runtime-config.d.ts +33 -0
- package/dist/services/diff/run-runtime-config.js +74 -0
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +3 -2
- package/dist/services/diff/sinks/tool-diff-sink.js +3 -2
- package/dist/services/diff/spec/config-at-ref.spec.d.ts +1 -0
- package/dist/services/diff/spec/config-at-ref.spec.js +46 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +19 -0
- package/dist/services/diff/spec/diff-service.spec.js +95 -0
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +1 -0
- package/dist/services/diff/spec/run-runtime-config.spec.js +87 -0
- package/dist/services/git/git-repository.d.ts +2 -0
- package/dist/services/git/git-repository.js +6 -0
- package/dist/services/integration-api/customer-config-flags.js +1 -0
- package/dist/services/onboarding/browse/browse-service.d.ts +13 -1
- package/dist/services/onboarding/browse/browse-service.js +43 -7
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +12 -0
- package/dist/services/onboarding/browser/answer-dialogs.js +25 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +17 -1
- package/dist/services/onboarding/browser/baqend-response.js +23 -0
- package/dist/services/onboarding/browser/console-log.d.ts +9 -0
- package/dist/services/onboarding/browser/console-log.js +27 -0
- package/dist/services/onboarding/browser/emulate-device.d.ts +12 -1
- package/dist/services/onboarding/browser/emulate-device.js +68 -13
- package/dist/services/onboarding/browser/executable/executable-validator.js +4 -2
- package/dist/services/onboarding/browser/extension/extension-bridge.js +5 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +17 -8
- package/dist/services/onboarding/browser/extension/extension-validator.js +9 -4
- package/dist/services/onboarding/browser/launch-browser.d.ts +2 -1
- package/dist/services/onboarding/browser/launch-browser.js +6 -1
- package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +14 -0
- package/dist/services/onboarding/browser/resume-restarted-workers.js +26 -0
- package/dist/services/onboarding/control/body-inspect.d.ts +24 -0
- package/dist/services/onboarding/control/body-inspect.js +106 -0
- package/dist/services/onboarding/control/browser-session.d.ts +547 -0
- package/dist/services/onboarding/control/browser-session.js +1337 -0
- package/dist/services/onboarding/control/config-validation.d.ts +17 -0
- package/dist/services/onboarding/control/config-validation.js +46 -0
- package/dist/services/onboarding/control/control-protocol.d.ts +1430 -0
- package/dist/services/onboarding/control/control-protocol.js +58 -0
- package/dist/services/onboarding/control/control-server.d.ts +292 -0
- package/dist/services/onboarding/control/control-server.js +1629 -0
- package/dist/services/onboarding/control/debug-session.d.ts +219 -0
- package/dist/services/onboarding/control/debug-session.js +897 -0
- package/dist/services/onboarding/control/fouc.d.ts +23 -0
- package/dist/services/onboarding/control/fouc.js +151 -0
- package/dist/services/onboarding/control/index.d.ts +4 -0
- package/dist/services/onboarding/control/index.js +4 -0
- package/dist/services/onboarding/control/navigate-wait.d.ts +33 -0
- package/dist/services/onboarding/control/navigate-wait.js +56 -0
- package/dist/services/onboarding/control/navwalk.d.ts +65 -0
- package/dist/services/onboarding/control/navwalk.js +248 -0
- package/dist/services/onboarding/control/preload-registry.d.ts +150 -0
- package/dist/services/onboarding/control/preload-registry.js +829 -0
- package/dist/services/onboarding/control/response-explainer.d.ts +24 -0
- package/dist/services/onboarding/control/response-explainer.js +257 -0
- package/dist/services/onboarding/control/rum.d.ts +8 -0
- package/dist/services/onboarding/control/rum.js +220 -0
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +68 -0
- package/dist/services/onboarding/control/service-worker-tracker.js +120 -0
- package/dist/services/onboarding/control/viewport.d.ts +45 -0
- package/dist/services/onboarding/control/viewport.js +344 -0
- package/dist/services/onboarding/control/watch.d.ts +26 -0
- package/dist/services/onboarding/control/watch.js +157 -0
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +3 -1
- package/dist/services/onboarding/dashboard/index.js +7 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +24 -5
- package/dist/services/onboarding/fetch-event-handler.js +103 -32
- package/dist/services/onboarding/fetch-events/spec/speed-kit-install-js.spec.d.ts +1 -0
- package/dist/services/onboarding/fetch-events/spec/speed-kit-install-js.spec.js +59 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +16 -5
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +30 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +13 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +28 -1
- package/dist/services/onboarding/file-events/file-watcher.d.ts +42 -1
- package/dist/services/onboarding/file-events/file-watcher.js +117 -12
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +40 -7
- package/dist/services/onboarding/onboarding-model.js +20 -9
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +7 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +150 -23
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +139 -23
- package/dist/services/onboarding/request-cache/asset-key.d.ts +61 -0
- package/dist/services/onboarding/request-cache/asset-key.js +115 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +62 -5
- package/dist/services/onboarding/request-cache/cache.js +128 -17
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +66 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +45 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +753 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +371 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +751 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +67 -0
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/fouc.spec.js +167 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +47 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.js +222 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +432 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +324 -0
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/rum.spec.js +222 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +193 -0
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/viewport.spec.js +200 -0
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/watch.spec.js +187 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +219 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +41 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +39 -3
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +25 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +107 -0
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/todo-collector.spec.js +136 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +65 -0
- package/dist/services/onboarding/todo-collector.d.ts +7 -2
- package/dist/services/onboarding/todo-collector.js +49 -12
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +38 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +113 -27
- package/dist/services/origin-request/asset-variations.d.ts +14 -0
- package/dist/services/origin-request/asset-variations.js +11 -4
- package/dist/services/origin-request/origin-fetcher.d.ts +7 -0
- package/dist/services/origin-request/origin-fetcher.js +43 -5
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +17 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +8 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +0 -5
- package/dist/services/origin-request/origin-request-service-factory.js +2 -30
- package/dist/services/origin-request/origin-request-service.d.ts +121 -6
- package/dist/services/origin-request/origin-request-service.js +273 -49
- package/dist/services/origin-request/runtime-config-source.d.ts +6 -0
- package/dist/services/origin-request/runtime-config-source.js +15 -4
- package/dist/services/origin-request/spec/asset-variations.spec.js +20 -0
- package/dist/services/origin-request/spec/origin-request-service.spec.js +329 -6
- package/dist/services/query-builder/rules/rule-match.d.ts +35 -0
- package/dist/services/query-builder/rules/rule-match.js +70 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +1 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +121 -0
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +557 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +91 -0
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +5 -0
- package/dist/services/run-control/browser/run-browser-service-factory.js +7 -0
- package/dist/services/run-control/browser/run-browser-service.d.ts +68 -0
- package/dist/services/run-control/browser/run-browser-service.js +206 -0
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +349 -0
- package/dist/services/run-control/cache/run-cache-contexts.js +51 -0
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +6 -0
- package/dist/services/run-control/cache/run-cache-service-factory.js +12 -0
- package/dist/services/run-control/cache/run-cache-service.d.ts +35 -0
- package/dist/services/run-control/cache/run-cache-service.js +151 -0
- package/dist/services/run-control/control-client.d.ts +36 -0
- package/dist/services/run-control/control-client.js +147 -0
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +416 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +47 -0
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +5 -0
- package/dist/services/run-control/debug/run-debug-service-factory.js +7 -0
- package/dist/services/run-control/debug/run-debug-service.d.ts +39 -0
- package/dist/services/run-control/debug/run-debug-service.js +164 -0
- package/dist/services/run-control/files/run-files-contexts.d.ts +238 -0
- package/dist/services/run-control/files/run-files-contexts.js +26 -0
- package/dist/services/run-control/files/run-files-service-factory.d.ts +5 -0
- package/dist/services/run-control/files/run-files-service-factory.js +7 -0
- package/dist/services/run-control/files/run-files-service.d.ts +29 -0
- package/dist/services/run-control/files/run-files-service.js +120 -0
- package/dist/services/run-control/index.d.ts +32 -0
- package/dist/services/run-control/index.js +31 -0
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +319 -0
- package/dist/services/run-control/inject/run-inject-contexts.js +38 -0
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +5 -0
- package/dist/services/run-control/inject/run-inject-service-factory.js +7 -0
- package/dist/services/run-control/inject/run-inject-service.d.ts +31 -0
- package/dist/services/run-control/inject/run-inject-service.js +227 -0
- package/dist/services/run-control/live-run.d.ts +37 -0
- package/dist/services/run-control/live-run.js +56 -0
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +333 -0
- package/dist/services/run-control/probe/run-probe-contexts.js +73 -0
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +5 -0
- package/dist/services/run-control/probe/run-probe-service-factory.js +7 -0
- package/dist/services/run-control/probe/run-probe-service.d.ts +54 -0
- package/dist/services/run-control/probe/run-probe-service.js +194 -0
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +216 -0
- package/dist/services/run-control/rum/run-rum-contexts.js +34 -0
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +5 -0
- package/dist/services/run-control/rum/run-rum-service-factory.js +7 -0
- package/dist/services/run-control/rum/run-rum-service.d.ts +36 -0
- package/dist/services/run-control/rum/run-rum-service.js +122 -0
- package/dist/services/run-control/run-answer.d.ts +28 -0
- package/dist/services/run-control/run-answer.js +58 -0
- package/dist/services/run-control/run-control-context.d.ts +102 -0
- package/dist/services/run-control/run-control-context.js +36 -0
- package/dist/services/run-control/run-control-flags.d.ts +12 -0
- package/dist/services/run-control/run-control-flags.js +22 -0
- package/dist/services/run-control/run-control-model.d.ts +9 -0
- package/dist/services/run-control/run-control-model.js +1 -0
- package/dist/services/run-control/run-control-service-factory.d.ts +14 -0
- package/dist/services/run-control/run-control-service-factory.js +26 -0
- package/dist/services/run-control/session/run-session-contexts.d.ts +25 -0
- package/dist/services/run-control/session/run-session-contexts.js +20 -0
- package/dist/services/run-control/session/run-session-service-factory.d.ts +8 -0
- package/dist/services/run-control/session/run-session-service-factory.js +18 -0
- package/dist/services/run-control/session/run-session-service.d.ts +32 -0
- package/dist/services/run-control/session/run-session-service.js +151 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +328 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +454 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +113 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.js +234 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +251 -0
- package/dist/services/run-control/spec/live-run-fixture.d.ts +32 -0
- package/dist/services/run-control/spec/live-run-fixture.js +109 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +108 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +47 -0
- package/dist/services/run-control/spec/run-answer.spec.d.ts +1 -0
- package/dist/services/run-control/spec/run-answer.spec.js +57 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.js +150 -0
- package/dist/services/run-log/crash-mirror.d.ts +31 -0
- package/dist/services/run-log/crash-mirror.js +69 -0
- package/dist/services/run-log/index.d.ts +11 -0
- package/dist/services/run-log/index.js +11 -0
- package/dist/services/run-log/jsonl-appender.d.ts +46 -0
- package/dist/services/run-log/jsonl-appender.js +91 -0
- package/dist/services/run-log/log-event-model.d.ts +104 -0
- package/dist/services/run-log/log-event-model.js +56 -0
- package/dist/services/run-log/log-query-service-factory.d.ts +11 -0
- package/dist/services/run-log/log-query-service-factory.js +14 -0
- package/dist/services/run-log/log-query-service.d.ts +59 -0
- package/dist/services/run-log/log-query-service.js +111 -0
- package/dist/services/run-log/log-reader.d.ts +84 -0
- package/dist/services/run-log/log-reader.js +180 -0
- package/dist/services/run-log/log-summary.d.ts +72 -0
- package/dist/services/run-log/log-summary.js +208 -0
- package/dist/services/run-log/redaction.d.ts +34 -0
- package/dist/services/run-log/redaction.js +124 -0
- package/dist/services/run-log/request-log.d.ts +82 -0
- package/dist/services/run-log/request-log.js +69 -0
- package/dist/services/run-log/request-summary.d.ts +76 -0
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +61 -0
- package/dist/services/run-log/run-log.js +102 -0
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-query-service.spec.js +197 -0
- package/dist/services/run-log/spec/log-reader.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-reader.spec.js +109 -0
- package/dist/services/run-log/spec/log-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-summary.spec.js +153 -0
- package/dist/services/run-log/spec/redaction.spec.d.ts +1 -0
- package/dist/services/run-log/spec/redaction.spec.js +61 -0
- package/dist/services/run-log/spec/request-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-log.spec.js +101 -0
- package/dist/services/run-log/spec/request-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-summary.spec.js +171 -0
- package/dist/services/run-log/spec/run-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/run-log.spec.js +122 -0
- package/dist/services/run-registry/exit-classification.d.ts +39 -0
- package/dist/services/run-registry/exit-classification.js +42 -0
- package/dist/services/run-registry/index.d.ts +3 -0
- package/dist/services/run-registry/index.js +3 -0
- package/dist/services/run-registry/process-identity.d.ts +28 -0
- package/dist/services/run-registry/process-identity.js +80 -0
- package/dist/services/run-registry/run-registry-model.d.ts +128 -0
- package/dist/services/run-registry/run-registry-model.js +16 -0
- package/dist/services/run-registry/run-registry.d.ts +155 -0
- package/dist/services/run-registry/run-registry.js +430 -0
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/exit-classification.spec.js +82 -0
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/run-registry.spec.js +526 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3479 -358
- package/package.json +20 -2
|
@@ -12,6 +12,9 @@ import { assertCustomerOrigin } from "./customer-origin.js";
|
|
|
12
12
|
import { stderrLog } from "./diff-log.js";
|
|
13
13
|
import { variationPair, } from "./diff-service-build-context.js";
|
|
14
14
|
import { DiffService } from "./diff-service.js";
|
|
15
|
+
import { configAtRef } from "./config-at-ref.js";
|
|
16
|
+
import { RunRegistry } from "../run-registry/index.js";
|
|
17
|
+
import { DEFAULTS_ONLY, diffRuntimeConfig, liveRunFor, } from "./run-runtime-config.js";
|
|
15
18
|
import { PageSource } from "./page-source.js";
|
|
16
19
|
/**
|
|
17
20
|
* The variations a person can choose from: the device variations and the
|
|
@@ -47,8 +50,11 @@ export class DiffServiceFactory {
|
|
|
47
50
|
async build() {
|
|
48
51
|
const { environment } = this.context;
|
|
49
52
|
const chosenParameters = await this.withChosenParameters();
|
|
50
|
-
|
|
51
|
-
const
|
|
53
|
+
// JSON and a patch own stdout; the progress goes to stderr.
|
|
54
|
+
const ownsStdout = ["json", "patch"].includes(this.context.output);
|
|
55
|
+
const log = ownsStdout
|
|
56
|
+
? stderrLog(environment.cli)
|
|
57
|
+
: environment.cli;
|
|
52
58
|
const files = this.context.customerPath
|
|
53
59
|
? await this.getIntegrationFiles()
|
|
54
60
|
: undefined;
|
|
@@ -59,13 +65,40 @@ export class DiffServiceFactory {
|
|
|
59
65
|
for (const url of [pageUrl, against].filter(Boolean)) {
|
|
60
66
|
assertCustomerOrigin(url, customer.origins, this.context.customerPath);
|
|
61
67
|
}
|
|
62
|
-
applyOriginProxy(customer.chromeFlags,
|
|
63
|
-
}
|
|
64
|
-
const config = await this.loadRuntimeConfig(log, customer?.app);
|
|
65
|
-
if (!config) {
|
|
66
|
-
throw new ApplicationError("no runtime config to build the requests from");
|
|
68
|
+
applyOriginProxy(customer.chromeFlags, ownsStdout ? undefined : environment.cli);
|
|
67
69
|
}
|
|
70
|
+
const config = await diffRuntimeConfig({
|
|
71
|
+
log,
|
|
72
|
+
// A named file wins; else the live run the customer has, so the diff sees what it sees.
|
|
73
|
+
run: this.context.variationsFile
|
|
74
|
+
? undefined
|
|
75
|
+
: liveRunFor({
|
|
76
|
+
registry: new RunRegistry(environment.cacheDir),
|
|
77
|
+
selector: this.context.run,
|
|
78
|
+
customerPath: this.context.customerPath,
|
|
79
|
+
}),
|
|
80
|
+
runNamed: Boolean(this.context.run),
|
|
81
|
+
file: this.context.variationsFile,
|
|
82
|
+
load: () => this.loadRuntimeConfig(log, customer?.app),
|
|
83
|
+
});
|
|
68
84
|
const options = await this.withChosenVariations(chosenParameters, config.variations);
|
|
85
|
+
const fetcher = new OriginFetcher({
|
|
86
|
+
cli: log,
|
|
87
|
+
config,
|
|
88
|
+
host: this.context.host,
|
|
89
|
+
strict: true,
|
|
90
|
+
});
|
|
91
|
+
const ignore = this.context.ignore.map((pattern) => new RegExp(pattern, "g"));
|
|
92
|
+
const pages = new PageSource({
|
|
93
|
+
fetcher,
|
|
94
|
+
documentHandler: this.context.raw || !files
|
|
95
|
+
? undefined
|
|
96
|
+
: await this.buildDocumentHandler(files, this.context.customerPath),
|
|
97
|
+
ignore,
|
|
98
|
+
});
|
|
99
|
+
const base = this.context.base
|
|
100
|
+
? await this.buildBase(log, fetcher, ignore)
|
|
101
|
+
: undefined;
|
|
69
102
|
// Installed last, after everything that can fail: the service closes it.
|
|
70
103
|
const browserFetch = this.context.browserFetch
|
|
71
104
|
? installBrowserOriginFetch({ environment, logger: log, mode: "always" })
|
|
@@ -77,21 +110,28 @@ export class DiffServiceFactory {
|
|
|
77
110
|
options,
|
|
78
111
|
log,
|
|
79
112
|
browserFetch,
|
|
113
|
+
base,
|
|
80
114
|
engine: createDiffEngine(environment, this.context.output),
|
|
81
|
-
pages
|
|
82
|
-
fetcher: new OriginFetcher({
|
|
83
|
-
cli: log,
|
|
84
|
-
config,
|
|
85
|
-
host: this.context.host,
|
|
86
|
-
strict: true,
|
|
87
|
-
}),
|
|
88
|
-
documentHandler: this.context.raw || !files
|
|
89
|
-
? undefined
|
|
90
|
-
: await this.buildDocumentHandler(files),
|
|
91
|
-
ignore: this.context.ignore.map((pattern) => new RegExp(pattern, "g")),
|
|
92
|
-
}),
|
|
115
|
+
pages,
|
|
93
116
|
});
|
|
94
117
|
}
|
|
118
|
+
/** The pages rendered with the customer config at `--base`, from a checkout of it. */
|
|
119
|
+
async buildBase(log, fetcher, ignore) {
|
|
120
|
+
const checkout = await configAtRef(this.context.customerPath, this.context.base);
|
|
121
|
+
log.comment(`--base ${this.context.base}: the config at ${checkout.commit.slice(0, 8)}, where HEAD left it`);
|
|
122
|
+
try {
|
|
123
|
+
const files = await this.getIntegrationFiles(checkout.customerPath);
|
|
124
|
+
const documentHandler = await this.buildDocumentHandler(files, checkout.customerPath);
|
|
125
|
+
return {
|
|
126
|
+
pages: new PageSource({ fetcher, documentHandler, ignore }),
|
|
127
|
+
remove: checkout.remove,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
await checkout.remove();
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
95
135
|
/**
|
|
96
136
|
* The options, with the parameters an empty `--param` asked for added to
|
|
97
137
|
* the ones removed. Asked first, before anything is loaded or fetched.
|
|
@@ -123,7 +163,7 @@ export class DiffServiceFactory {
|
|
|
123
163
|
const chosen = await this.context.environment.cli.multiSelect("Which variations should be compared? One is compared against desktop", variationChoices(variations), (picked) => (picked.length === 1 && picked[0] !== DEFAULT_TYPE) ||
|
|
124
164
|
picked.length === 2 ||
|
|
125
165
|
"Choose one variation to compare against desktop, or two to compare with each other.");
|
|
126
|
-
// A quiet CLI (--output json) does not ask, and answers with no choice.
|
|
166
|
+
// A quiet CLI (--output json or patch) does not ask, and answers with no choice.
|
|
127
167
|
if (chosen.length === 0) {
|
|
128
168
|
throw new ApplicationError("No variation chosen, so nothing to compare.", ["Name them: --variations mobile, or --variations tablet,mobile"]);
|
|
129
169
|
}
|
|
@@ -145,7 +185,7 @@ export class DiffServiceFactory {
|
|
|
145
185
|
async loadRuntimeConfig(log, app) {
|
|
146
186
|
if (!app && !this.context.variationsFile) {
|
|
147
187
|
log.writeWarning("no customer: the requests carry Speed Kit's device defaults only, no variations of an app");
|
|
148
|
-
return
|
|
188
|
+
return DEFAULTS_ONLY;
|
|
149
189
|
}
|
|
150
190
|
return new RuntimeConfigSource({
|
|
151
191
|
cli: log,
|
|
@@ -156,20 +196,20 @@ export class DiffServiceFactory {
|
|
|
156
196
|
}).load(this.context.variationsFile);
|
|
157
197
|
}
|
|
158
198
|
/** The customer's files, with the released document handler unless it brings its own. */
|
|
159
|
-
async getIntegrationFiles() {
|
|
199
|
+
async getIntegrationFiles(customerPath = this.context.customerPath) {
|
|
160
200
|
return new IntegrationApiFactory(new IntegrationApiServiceBuildContext({
|
|
161
201
|
environment: this.context.environment,
|
|
162
|
-
basePath:
|
|
202
|
+
basePath: customerPath,
|
|
163
203
|
configName: this.context.configName,
|
|
164
204
|
whitelist: [],
|
|
165
205
|
}))
|
|
166
206
|
.buildService()
|
|
167
207
|
.run(this.context.raw ? [] : documentHandlerRuntimeFiles());
|
|
168
208
|
}
|
|
169
|
-
async buildDocumentHandler(files) {
|
|
209
|
+
async buildDocumentHandler(files, customerPath) {
|
|
170
210
|
return new DocumentHandlerRuntimeServiceFactory(new DocumentHandlerRuntimeServiceBuildContext({
|
|
171
211
|
environment: this.context.environment,
|
|
172
|
-
customerPath
|
|
212
|
+
customerPath,
|
|
173
213
|
configName: this.context.configName,
|
|
174
214
|
verboseLevel: false,
|
|
175
215
|
}), files).buildDocumentHandlerServer();
|
|
@@ -11,6 +11,11 @@ export interface DiffServiceDeps {
|
|
|
11
11
|
readonly pages: PageSource;
|
|
12
12
|
/** The headless Chrome pages are fetched through; closed when the run ends. */
|
|
13
13
|
readonly browserFetch?: BrowserOriginFetchHandle;
|
|
14
|
+
/** With `--base`: the pages rendered with the config at that ref, and how to remove its checkout. */
|
|
15
|
+
readonly base?: {
|
|
16
|
+
readonly pages: PageSource;
|
|
17
|
+
remove(): Promise<void>;
|
|
18
|
+
};
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
21
|
* `sk diff`: compares one page, as Speed Kit's server would request and the
|
|
@@ -60,6 +65,12 @@ export declare class DiffService {
|
|
|
60
65
|
*/
|
|
61
66
|
run(): Promise<ComparisonOutcome>;
|
|
62
67
|
private check;
|
|
68
|
+
/**
|
|
69
|
+
* One origin page, rendered with the config at `--base` and with the
|
|
70
|
+
* working tree: only what the config change does. The page is requested
|
|
71
|
+
* once, or read from `--html`; an origin failure ends the run.
|
|
72
|
+
*/
|
|
73
|
+
private checkBase;
|
|
63
74
|
/** The page against another page, both in one variation. */
|
|
64
75
|
private checkAgainst;
|
|
65
76
|
private checkVariations;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
1
2
|
import { withoutNoise } from "./noise-baseline.js";
|
|
2
3
|
import ApplicationError from "../error-handling/error/application-error.js";
|
|
3
4
|
import { PageSideFailure } from "./side-failure.js";
|
|
4
5
|
function isFailed(side) {
|
|
5
6
|
return side !== undefined && "failure" in side;
|
|
6
7
|
}
|
|
8
|
+
/** The side a failure Speed Kit's server would also have leaves; any other error ends the run. */
|
|
9
|
+
function failedPage(error, label, url, variation) {
|
|
10
|
+
if (!(error instanceof PageSideFailure))
|
|
11
|
+
throw error;
|
|
12
|
+
return { label, failure: error.failure, details: { url, variation }, error };
|
|
13
|
+
}
|
|
7
14
|
/** The failed side as a sink reports it, without the error object. */
|
|
8
15
|
function withoutError({ error: _error, ...side }) {
|
|
9
16
|
return side;
|
|
@@ -81,11 +88,16 @@ export class DiffService {
|
|
|
81
88
|
finally {
|
|
82
89
|
this.deps.engine.finish();
|
|
83
90
|
await this.deps.browserFetch?.close();
|
|
91
|
+
await this.deps.base?.remove();
|
|
84
92
|
}
|
|
85
93
|
return (OUTCOME_RANK.find((outcome) => this.outcomes.has(outcome)) ?? "equal");
|
|
86
94
|
}
|
|
87
95
|
async check() {
|
|
88
96
|
const { against, variation, variations, params } = this.deps.options;
|
|
97
|
+
if (this.deps.base) {
|
|
98
|
+
await this.checkBase(this.deps.base.pages, variation);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
89
101
|
if (against) {
|
|
90
102
|
await this.checkAgainst(against, variation);
|
|
91
103
|
return;
|
|
@@ -102,6 +114,27 @@ export class DiffService {
|
|
|
102
114
|
await this.checkParameters(each);
|
|
103
115
|
}
|
|
104
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* One origin page, rendered with the config at `--base` and with the
|
|
119
|
+
* working tree: only what the config change does. The page is requested
|
|
120
|
+
* once, or read from `--html`; an origin failure ends the run.
|
|
121
|
+
*/
|
|
122
|
+
async checkBase(basePages, variation) {
|
|
123
|
+
const { pageUrl, base, html } = this.deps.options;
|
|
124
|
+
const page = html === undefined
|
|
125
|
+
? await this.deps.pages.origin(pageUrl, variation)
|
|
126
|
+
: { html: await readFile(html, "utf8") };
|
|
127
|
+
const render = (pages, label) => pages
|
|
128
|
+
.fromHtml(page.html, pageUrl, variation, {
|
|
129
|
+
label,
|
|
130
|
+
contentType: page.contentType,
|
|
131
|
+
})
|
|
132
|
+
.catch((error) => failedPage(error, label, pageUrl, variation));
|
|
133
|
+
const before = await render(basePages, `config at ${base}`);
|
|
134
|
+
const after = await render(this.deps.pages, "working tree");
|
|
135
|
+
this.announce(`Checking the working tree against ${base} (${variation})...`, [`- url: ${pageUrl}`, ...(html === undefined ? [] : [`- html: ${html}`])]);
|
|
136
|
+
await this.compare(before, after);
|
|
137
|
+
}
|
|
105
138
|
/** The page against another page, both in one variation. */
|
|
106
139
|
async checkAgainst(against, variation) {
|
|
107
140
|
const { pageUrl } = this.deps.options;
|
|
@@ -237,7 +270,9 @@ export class DiffService {
|
|
|
237
270
|
reportFailure(left, right) {
|
|
238
271
|
const { log, engine } = this.deps;
|
|
239
272
|
const failed = [left, right].filter(isFailed);
|
|
240
|
-
|
|
273
|
+
// With --base, any rendering failure is the config change's verdict.
|
|
274
|
+
const verdict = (error) => this.deps.base ? error.failure.kind !== "origin" : error.isAbort;
|
|
275
|
+
const outcome = failed.every((side) => verdict(side.error))
|
|
241
276
|
? "uncacheable"
|
|
242
277
|
: "failed";
|
|
243
278
|
for (const { error } of failed) {
|
|
@@ -281,16 +316,7 @@ export class DiffService {
|
|
|
281
316
|
if (!side) {
|
|
282
317
|
side = this.deps.pages
|
|
283
318
|
.fetch(url, variation, label, { baseline: this.deps.options.baseline })
|
|
284
|
-
.catch((error) =>
|
|
285
|
-
if (!(error instanceof PageSideFailure))
|
|
286
|
-
throw error;
|
|
287
|
-
return {
|
|
288
|
-
label,
|
|
289
|
-
failure: error.failure,
|
|
290
|
-
details: { url, variation },
|
|
291
|
-
error,
|
|
292
|
-
};
|
|
293
|
-
});
|
|
319
|
+
.catch((error) => failedPage(error, label, url, variation));
|
|
294
320
|
this.sides.set(key, side);
|
|
295
321
|
}
|
|
296
322
|
return side;
|
|
@@ -19,6 +19,13 @@ export interface PageSourceOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
readonly baseline?: boolean;
|
|
21
21
|
}
|
|
22
|
+
/** A page as the origin answered it. */
|
|
23
|
+
export interface OriginPage {
|
|
24
|
+
readonly html: string;
|
|
25
|
+
readonly contentType?: string;
|
|
26
|
+
/** Where the request went and what it answered, for a sink that reports it. */
|
|
27
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
28
|
+
}
|
|
22
29
|
/**
|
|
23
30
|
* One side of a page diff: the page fetched from origin as Speed Kit's server
|
|
24
31
|
* requests it for a variation, rendered by the customer's local
|
|
@@ -29,6 +36,11 @@ export declare class PageSource {
|
|
|
29
36
|
constructor(deps: PageSourceDeps);
|
|
30
37
|
fetch(url: string, variation: string, label: string, options?: PageSourceOptions): Promise<BaselinedSide>;
|
|
31
38
|
private fetchOnce;
|
|
39
|
+
/**
|
|
40
|
+
* The page as the origin answers Speed Kit's server, before the
|
|
41
|
+
* documentHandler renders it.
|
|
42
|
+
*/
|
|
43
|
+
origin(url: string, variation: string): Promise<OriginPage>;
|
|
32
44
|
/**
|
|
33
45
|
* A side from HTML the caller already has, such as the page a browser
|
|
34
46
|
* shows: rendered and reduced the same way a fetched page is.
|
|
@@ -23,6 +23,19 @@ export class PageSource {
|
|
|
23
23
|
return { ...side, baseline: baselineOf(side.content, again.content) };
|
|
24
24
|
}
|
|
25
25
|
async fetchOnce(url, variation, label, options) {
|
|
26
|
+
const page = await this.origin(url, variation);
|
|
27
|
+
const side = await this.fromHtml(page.html, url, variation, {
|
|
28
|
+
...options,
|
|
29
|
+
label,
|
|
30
|
+
contentType: page.contentType,
|
|
31
|
+
});
|
|
32
|
+
return { ...side, details: { ...side.details, ...page.details } };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The page as the origin answers Speed Kit's server, before the
|
|
36
|
+
* documentHandler renders it.
|
|
37
|
+
*/
|
|
38
|
+
async origin(url, variation) {
|
|
26
39
|
const fetched = await this.deps.fetcher.fetch(url, variation);
|
|
27
40
|
if (!fetched) {
|
|
28
41
|
throw new ApplicationError(`${url} (${variation}) could not be fetched.`);
|
|
@@ -38,18 +51,10 @@ export class PageSource {
|
|
|
38
51
|
failure: originFailure(response.status, response.statusText),
|
|
39
52
|
});
|
|
40
53
|
}
|
|
41
|
-
const side = await this.fromHtml(await response.text(), url, variation, {
|
|
42
|
-
...options,
|
|
43
|
-
label,
|
|
44
|
-
contentType: response.headers.get("content-type") ?? undefined,
|
|
45
|
-
});
|
|
46
54
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
requestUrl: fetched.url,
|
|
51
|
-
status: response.status,
|
|
52
|
-
},
|
|
55
|
+
html: await response.text(),
|
|
56
|
+
contentType: response.headers.get("content-type") ?? undefined,
|
|
57
|
+
details: { requestUrl: fetched.url, status: response.status },
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
60
|
/**
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OriginRequestConfig } from "../origin-request/index.js";
|
|
2
|
+
import { LiveRun } from "../run-control/live-run.js";
|
|
3
|
+
import { RunRegistry } from "../run-registry/index.js";
|
|
4
|
+
import { DiffLog } from "./diff-log.js";
|
|
5
|
+
/** What a request carries without a runtime config: the device defaults only. */
|
|
6
|
+
export declare const DEFAULTS_ONLY: OriginRequestConfig;
|
|
7
|
+
/**
|
|
8
|
+
* The live run whose runtime config `sk diff` follows: the one `--run` names,
|
|
9
|
+
* else the one live run of the customer. Several live runs pick none.
|
|
10
|
+
*/
|
|
11
|
+
export declare function liveRunFor(input: {
|
|
12
|
+
registry: RunRegistry;
|
|
13
|
+
selector?: string;
|
|
14
|
+
customerPath?: string;
|
|
15
|
+
}): LiveRun | undefined;
|
|
16
|
+
export interface DiffRuntimeConfigDeps {
|
|
17
|
+
readonly log: DiffLog;
|
|
18
|
+
/** The live run to follow; absent without one. */
|
|
19
|
+
readonly run?: Pick<LiveRun, "id" | "request">;
|
|
20
|
+
/** Whether `--run` named the run, so a failure to ask it is not hidden. */
|
|
21
|
+
readonly runNamed?: boolean;
|
|
22
|
+
/** `--variationsFile`: the file `load` reads instead of the app's config. */
|
|
23
|
+
readonly file?: string;
|
|
24
|
+
/** The app's or the file's runtime config, as `RuntimeConfigSource` loads it. */
|
|
25
|
+
readonly load: () => Promise<OriginRequestConfig | undefined>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The runtime config `sk diff` builds its requests from: the live run's, so
|
|
29
|
+
* the diff sees what the run sees, else the one `load` reads.
|
|
30
|
+
*
|
|
31
|
+
* @throws {ApplicationError} Without a config: the run loaded none, or `load` read none.
|
|
32
|
+
*/
|
|
33
|
+
export declare function diffRuntimeConfig(deps: DiffRuntimeConfigDeps): Promise<OriginRequestConfig>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import ApplicationError from "../error-handling/error/application-error.js";
|
|
3
|
+
import { ControlError } from "../run-control/control-client.js";
|
|
4
|
+
import { LiveRun } from "../run-control/live-run.js";
|
|
5
|
+
/** What a request carries without a runtime config: the device defaults only. */
|
|
6
|
+
export const DEFAULTS_ONLY = {
|
|
7
|
+
variations: {},
|
|
8
|
+
authentications: [],
|
|
9
|
+
originMap: {},
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The live run whose runtime config `sk diff` follows: the one `--run` names,
|
|
13
|
+
* else the one live run of the customer. Several live runs pick none.
|
|
14
|
+
*/
|
|
15
|
+
export function liveRunFor(input) {
|
|
16
|
+
const { registry, selector, customerPath } = input;
|
|
17
|
+
if (selector)
|
|
18
|
+
return LiveRun.resolve(registry, selector);
|
|
19
|
+
if (!customerPath)
|
|
20
|
+
return undefined;
|
|
21
|
+
const wanted = resolve(customerPath);
|
|
22
|
+
const runs = registry
|
|
23
|
+
.liveRuns()
|
|
24
|
+
.filter((run) => (run.meta.customerDir ?? resolve(run.meta.customerPath)) === wanted);
|
|
25
|
+
return runs.length === 1 ? new LiveRun(runs[0]) : undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The runtime config `sk diff` builds its requests from: the live run's, so
|
|
29
|
+
* the diff sees what the run sees, else the one `load` reads.
|
|
30
|
+
*
|
|
31
|
+
* @throws {ApplicationError} Without a config: the run loaded none, or `load` read none.
|
|
32
|
+
*/
|
|
33
|
+
export async function diffRuntimeConfig(deps) {
|
|
34
|
+
const { log, run, runNamed, file, load } = deps;
|
|
35
|
+
if (run) {
|
|
36
|
+
try {
|
|
37
|
+
const { config } = await run.request({
|
|
38
|
+
op: "config.runtime",
|
|
39
|
+
});
|
|
40
|
+
if (config) {
|
|
41
|
+
log.comment(`runtime config from the live run ${run.id}`);
|
|
42
|
+
return config;
|
|
43
|
+
}
|
|
44
|
+
// The device defaults would hide that the run lacks the variations and the basic auth.
|
|
45
|
+
throw noRuntimeConfig(`the live run ${run.id} loaded no runtime config`, [
|
|
46
|
+
'Run "sk login", then restart the run so it loads the runtime config.',
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// A run of an older build does not know the op; the login still works.
|
|
51
|
+
if (runNamed || !(error instanceof ControlError))
|
|
52
|
+
throw error;
|
|
53
|
+
log.comment(`the live run ${run.id} did not share its runtime config (${error.message}); loading the app's`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const config = await load();
|
|
57
|
+
if (!config && file) {
|
|
58
|
+
throw new ApplicationError(`no runtime config to build the requests from: ${file} could not be read`);
|
|
59
|
+
}
|
|
60
|
+
if (!config) {
|
|
61
|
+
throw noRuntimeConfig("no login", [
|
|
62
|
+
'Run "sk login".',
|
|
63
|
+
"Or pass --run <run> to take it from a live sk onboarding run.",
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
return config;
|
|
67
|
+
}
|
|
68
|
+
/** The refusal without a runtime config; `--variationsFile` always fixes it. */
|
|
69
|
+
function noRuntimeConfig(cause, fixes) {
|
|
70
|
+
return new ApplicationError(`no runtime config to build the requests from: ${cause}`, [
|
|
71
|
+
...fixes,
|
|
72
|
+
"Or pass --variationsFile <file> to use a config you already have.",
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
@@ -11,8 +11,9 @@ export interface ToolDiffSinkDeps {
|
|
|
11
11
|
* IntelliJ IDEA when none is configured.
|
|
12
12
|
*
|
|
13
13
|
* Both sides are written to files under the CLI's cache directory, which
|
|
14
|
-
* outlive the command
|
|
15
|
-
*
|
|
14
|
+
* outlive the command. The right side is read back once the command returns,
|
|
15
|
+
* so an edit made in the tool reaches the caller only when the command blocks
|
|
16
|
+
* until the diff is closed: `idea diff` does, VS Code needs `--wait`.
|
|
16
17
|
*/
|
|
17
18
|
export declare class ToolDiffSink implements DiffSink {
|
|
18
19
|
private readonly deps;
|
|
@@ -18,8 +18,9 @@ function fileName(label) {
|
|
|
18
18
|
* IntelliJ IDEA when none is configured.
|
|
19
19
|
*
|
|
20
20
|
* Both sides are written to files under the CLI's cache directory, which
|
|
21
|
-
* outlive the command
|
|
22
|
-
*
|
|
21
|
+
* outlive the command. The right side is read back once the command returns,
|
|
22
|
+
* so an edit made in the tool reaches the caller only when the command blocks
|
|
23
|
+
* until the diff is closed: `idea diff` does, VS Code needs `--wait`.
|
|
23
24
|
*/
|
|
24
25
|
export class ToolDiffSink {
|
|
25
26
|
deps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { expect } from "chai";
|
|
4
|
+
import { describe, it } from "mocha";
|
|
5
|
+
import { GitRepository } from "../../git/index.js";
|
|
6
|
+
import { configAtRef } from "../config-at-ref.js";
|
|
7
|
+
/** A repository whose merge base with any ref is `fork`, and holds the files in `files`. */
|
|
8
|
+
function repositoryWith(files, seen = []) {
|
|
9
|
+
return new GitRepository("/repo", (args) => {
|
|
10
|
+
seen.push(args);
|
|
11
|
+
if (args[0] === "merge-base")
|
|
12
|
+
return "f0f0f0f0f0\n";
|
|
13
|
+
if (args[0] === "ls-tree")
|
|
14
|
+
return Object.keys(files).join("\n");
|
|
15
|
+
if (args[0] === "show")
|
|
16
|
+
return files[args[1].split(":")[1]];
|
|
17
|
+
throw new Error(`unexpected git ${args.join(" ")}`);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
describe("configAtRef", () => {
|
|
21
|
+
it("writes the customer directory as the ref holds it, and removes it", async () => {
|
|
22
|
+
const checkout = await configAtRef("/repo/customers/shop", "origin/main", repositoryWith({
|
|
23
|
+
"customers/shop/config_customer.json": '{"app":"shop"}',
|
|
24
|
+
"customers/shop/plugins/grid.js": "export {}",
|
|
25
|
+
}));
|
|
26
|
+
expect(checkout.customerPath).to.match(/customers[/\\]shop$/);
|
|
27
|
+
expect(readFileSync(path.join(checkout.customerPath, "plugins/grid.js"), "utf8")).to.equal("export {}");
|
|
28
|
+
await checkout.remove();
|
|
29
|
+
expect(existsSync(checkout.customerPath)).to.equal(false);
|
|
30
|
+
});
|
|
31
|
+
it("refuses a ref without the customer", async () => {
|
|
32
|
+
const error = await configAtRef("/repo/customers/new", "origin/main", repositoryWith({})).catch((error_) => error_);
|
|
33
|
+
expect(error.message).to.contain("no config at origin/main (f0f0f0f0) for customers/new");
|
|
34
|
+
});
|
|
35
|
+
it("reads the files where HEAD left the ref, so later changes on it do not show reversed", async () => {
|
|
36
|
+
const seen = [];
|
|
37
|
+
const checkout = await configAtRef("/repo/customers/shop", "origin/main", repositoryWith({ "customers/shop/config_customer.json": "{}" }, seen));
|
|
38
|
+
await checkout.remove();
|
|
39
|
+
expect(seen[0]).to.deep.equal(["merge-base", "HEAD", "origin/main"]);
|
|
40
|
+
expect(checkout.commit).to.equal("f0f0f0f0f0");
|
|
41
|
+
expect(seen.slice(1).map((args) => args.at(-1))).to.deep.equal([
|
|
42
|
+
"customers/shop",
|
|
43
|
+
"f0f0f0f0f0:customers/shop/config_customer.json",
|
|
44
|
+
]);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -37,6 +37,25 @@ describe("DiffServiceBuildContext", () => {
|
|
|
37
37
|
it("refuses --against the page itself", () => {
|
|
38
38
|
expect(() => create({ against: "https://shop.test/" })).to.throw("with itself");
|
|
39
39
|
});
|
|
40
|
+
it("renders the page with the config at --base, from --html in one variation", () => {
|
|
41
|
+
const context = create({
|
|
42
|
+
base: "origin/main",
|
|
43
|
+
html: "page.html",
|
|
44
|
+
variation: "mobile",
|
|
45
|
+
});
|
|
46
|
+
expect(context.base).to.equal("origin/main");
|
|
47
|
+
expect(context.html).to.equal("page.html");
|
|
48
|
+
expect(context.variation).to.equal("mobile");
|
|
49
|
+
});
|
|
50
|
+
it("refuses --base with the flags of the checks it replaces", () => {
|
|
51
|
+
expect(() => create({ base: "origin/main", params: true, baseline: true })).to.throw("does not take --params, --baseline");
|
|
52
|
+
});
|
|
53
|
+
it("refuses --base with --raw, which has no documentHandler", () => {
|
|
54
|
+
expect(() => create({ base: "origin/main", raw: true })).to.throw("needs the customer path and the documentHandler");
|
|
55
|
+
});
|
|
56
|
+
it("refuses --html without --base", () => {
|
|
57
|
+
expect(() => create({ html: "page.html" })).to.throw("for --base");
|
|
58
|
+
});
|
|
40
59
|
it("refuses --variation next to --variations", () => {
|
|
41
60
|
expect(() => create({ variation: "mobile", variations: ["tablet"] })).to.throw("pass one of them");
|
|
42
61
|
});
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
1
4
|
import { expect } from "chai";
|
|
2
5
|
import { describe, it } from "mocha";
|
|
3
6
|
import { DiffEngine } from "../diff-engine.js";
|
|
@@ -407,3 +410,95 @@ describe("DiffService variation", () => {
|
|
|
407
410
|
]);
|
|
408
411
|
});
|
|
409
412
|
});
|
|
413
|
+
/** A page source that renders whatever origin HTML it is given with `render`. */
|
|
414
|
+
function renderingSource(render) {
|
|
415
|
+
const origins = [];
|
|
416
|
+
const source = {
|
|
417
|
+
origins,
|
|
418
|
+
async origin(url, variation) {
|
|
419
|
+
origins.push(`${variation} ${url}`);
|
|
420
|
+
return { html: "<p>origin</p>" };
|
|
421
|
+
},
|
|
422
|
+
async fromHtml(html, _url, _variation, options) {
|
|
423
|
+
const content = render(html);
|
|
424
|
+
if (content instanceof PageSideFailure)
|
|
425
|
+
throw content;
|
|
426
|
+
return { label: options.label, content };
|
|
427
|
+
},
|
|
428
|
+
};
|
|
429
|
+
return source;
|
|
430
|
+
}
|
|
431
|
+
function baseService(before, after, options = {}) {
|
|
432
|
+
const shown = [];
|
|
433
|
+
const failed = [];
|
|
434
|
+
const removed = [];
|
|
435
|
+
const log = recordingLog();
|
|
436
|
+
const pages = renderingSource(after);
|
|
437
|
+
const diff = new DiffService({
|
|
438
|
+
options: {
|
|
439
|
+
pageUrl: "https://shop.test/c/shoes",
|
|
440
|
+
variation: "default",
|
|
441
|
+
base: "origin/main",
|
|
442
|
+
...options,
|
|
443
|
+
},
|
|
444
|
+
log,
|
|
445
|
+
engine: new DiffEngine({
|
|
446
|
+
sink: {
|
|
447
|
+
async show(result) {
|
|
448
|
+
shown.push(result);
|
|
449
|
+
return undefined;
|
|
450
|
+
},
|
|
451
|
+
fail(comparison) {
|
|
452
|
+
failed.push(comparison);
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
}),
|
|
456
|
+
pages,
|
|
457
|
+
base: {
|
|
458
|
+
pages: renderingSource(before),
|
|
459
|
+
remove: async () => {
|
|
460
|
+
removed.push("base");
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
return { diff, shown, failed, removed, log, pages };
|
|
465
|
+
}
|
|
466
|
+
describe("DiffService base", () => {
|
|
467
|
+
it("renders one origin page with both configs and shows the change", async () => {
|
|
468
|
+
const { diff, shown, removed, pages } = baseService((html) => `${html}<p>old</p>`, (html) => `${html}<p>new</p>`, { variation: "mobile" });
|
|
469
|
+
expect(await diff.run()).to.equal("differs");
|
|
470
|
+
expect(pages.origins).to.deep.equal(["mobile https://shop.test/c/shoes"]);
|
|
471
|
+
expect(shown[0].left.label).to.equal("config at origin/main");
|
|
472
|
+
expect(shown[0].right.label).to.equal("working tree");
|
|
473
|
+
expect(removed).to.deep.equal(["base"]);
|
|
474
|
+
});
|
|
475
|
+
it("finds no diff when the change leaves the page alone", async () => {
|
|
476
|
+
const { diff } = baseService((html) => html, (html) => html);
|
|
477
|
+
expect(await diff.run()).to.equal("equal");
|
|
478
|
+
});
|
|
479
|
+
it("is uncacheable with the handler's message when the working tree throws", async () => {
|
|
480
|
+
const thrown = new PageSideFailure({
|
|
481
|
+
url: "https://shop.test/c/shoes",
|
|
482
|
+
variation: "default",
|
|
483
|
+
failure: documentHandlerFailure(new DocumentHandlerTransformError(new TypeError("grid is undefined"))),
|
|
484
|
+
});
|
|
485
|
+
const { diff, failed, log } = baseService((html) => html, () => thrown);
|
|
486
|
+
expect(await diff.run()).to.equal("uncacheable");
|
|
487
|
+
expect(failed).to.have.length(1);
|
|
488
|
+
expect(log.lines.join("\n")).to.contain("grid is undefined");
|
|
489
|
+
});
|
|
490
|
+
it("renders a saved page instead of requesting it", async () => {
|
|
491
|
+
const dir = mkdtempSync(path.join(tmpdir(), "sk-diff-spec-"));
|
|
492
|
+
const file = path.join(dir, "page.html");
|
|
493
|
+
writeFileSync(file, "<p>saved</p>");
|
|
494
|
+
const { diff, shown, pages } = baseService((html) => html, (html) => html, { html: file });
|
|
495
|
+
try {
|
|
496
|
+
expect(await diff.run()).to.equal("equal");
|
|
497
|
+
expect(pages.origins).to.have.length(0);
|
|
498
|
+
expect(shown[0].left.content).to.equal("<p>saved</p>");
|
|
499
|
+
}
|
|
500
|
+
finally {
|
|
501
|
+
rmSync(dir, { recursive: true });
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|