@speedkit/cli 4.50.5 → 4.51.0-run-control.1
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/README.md +1369 -10
- 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 +6 -1
- package/dist/commands/diff.js +9 -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 +93 -0
- package/dist/commands/onboarding/browser/emulate.js +23 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +67 -0
- package/dist/commands/onboarding/browser/navigate.js +18 -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 +77 -0
- package/dist/commands/onboarding/debug/arm.js +18 -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 +256 -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/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 +220 -3
- 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/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 +8 -0
- package/dist/services/diff/diff-service-build-context.js +40 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +48 -20
- 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/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/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/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/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/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 +521 -0
- package/dist/services/onboarding/control/browser-session.js +1273 -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 +1390 -0
- package/dist/services/onboarding/control/control-protocol.js +69 -0
- package/dist/services/onboarding/control/control-server.d.ts +284 -0
- package/dist/services/onboarding/control/control-server.js +1609 -0
- package/dist/services/onboarding/control/debug-session.d.ts +190 -0
- package/dist/services/onboarding/control/debug-session.js +801 -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/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 +119 -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 +149 -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 +94 -32
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +11 -2
- 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/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +10 -0
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +6 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +131 -17
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +135 -22
- 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/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +526 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +338 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +693 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +66 -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/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 +172 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +202 -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 +37 -0
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -0
- 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/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 +34 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +82 -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.js +9 -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 +541 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +78 -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 +64 -0
- package/dist/services/run-control/browser/run-browser-service.js +199 -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 +411 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +44 -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 +38 -0
- package/dist/services/run-control/debug/run-debug-service.js +161 -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 +32 -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 +203 -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 +193 -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 +25 -0
- package/dist/services/run-control/session/run-session-service.js +95 -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 +327 -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 +224 -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 +101 -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 +80 -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 +150 -0
- package/dist/services/run-registry/run-registry.js +409 -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 +509 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3293 -272
- package/package.json +20 -2
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What service workers the run has seen, kept because nothing can ask.
|
|
3
|
+
*
|
|
4
|
+
* CDP has no "list the registrations" command — `ServiceWorker.enable` starts a
|
|
5
|
+
* stream of `workerRegistrationUpdated` and `workerVersionUpdated` events and
|
|
6
|
+
* that is the only source. A reader arriving later, which every run command is,
|
|
7
|
+
* has missed them. So the run keeps the latest state as it goes.
|
|
8
|
+
*
|
|
9
|
+
* Asking the page instead (`navigator.serviceWorker.getRegistrations()`) looks
|
|
10
|
+
* simpler and answers a different question: it reports scope and script url but
|
|
11
|
+
* no version id and no history, so it cannot tell a locally installed worker
|
|
12
|
+
* from the deployed one that replaced it. That distinction is the reason this
|
|
13
|
+
* exists — a takeover is silent, and with static routing it freezes the routes
|
|
14
|
+
* from the *deployed* config, so locally enabled pages bypass the worker
|
|
15
|
+
* entirely and every navigation reports `SwBooting`. Hours have gone into
|
|
16
|
+
* diagnosing that from the symptom.
|
|
17
|
+
*/
|
|
18
|
+
export class ServiceWorkerTracker {
|
|
19
|
+
registrations = new Map();
|
|
20
|
+
versions = new Map();
|
|
21
|
+
takeovers = 0;
|
|
22
|
+
lastTakeoverAt;
|
|
23
|
+
/** From `ServiceWorker.workerRegistrationUpdated`. */
|
|
24
|
+
recordRegistrations(registrations) {
|
|
25
|
+
for (const registration of registrations) {
|
|
26
|
+
// A deleted registration is kept, not dropped. "There was one here and it
|
|
27
|
+
// is gone" is the answer to a live question — a worker that unregisters
|
|
28
|
+
// itself mid-session looks identical to one that never existed.
|
|
29
|
+
this.registrations.set(registration.registrationId, {
|
|
30
|
+
registrationId: registration.registrationId,
|
|
31
|
+
scopeURL: registration.scopeURL,
|
|
32
|
+
deleted: Boolean(registration.isDeleted),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** From `ServiceWorker.workerVersionUpdated`. */
|
|
37
|
+
recordVersions(versions) {
|
|
38
|
+
for (const version of versions) {
|
|
39
|
+
this.versions.set(version.versionId, {
|
|
40
|
+
versionId: version.versionId,
|
|
41
|
+
registrationId: version.registrationId,
|
|
42
|
+
scriptURL: version.scriptURL,
|
|
43
|
+
status: version.status,
|
|
44
|
+
runningStatus: version.runningStatus,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The run decided a deployed worker took over.
|
|
50
|
+
*
|
|
51
|
+
* Recorded rather than derived: the decision needs `lastServedAt` from the
|
|
52
|
+
* local sw.js route, which lives in the run and not here. This only keeps the
|
|
53
|
+
* verdict so a reader can see it after the fact.
|
|
54
|
+
*/
|
|
55
|
+
recordTakeover(versionId) {
|
|
56
|
+
this.takeovers += 1;
|
|
57
|
+
this.lastTakeoverAt = new Date().toISOString();
|
|
58
|
+
const version = this.versions.get(versionId);
|
|
59
|
+
if (version) {
|
|
60
|
+
this.versions.set(versionId, { ...version, foreign: true });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* What is installed, and which of it is in charge of `pageUrl`.
|
|
65
|
+
*
|
|
66
|
+
* The active version has to be chosen against the page, not off the top of
|
|
67
|
+
* the list. This used to be `versions.find(v => v.status === "activated")` —
|
|
68
|
+
* the first activated version in insertion order, across every registration
|
|
69
|
+
* — and on a shop with scoped workers that is never the page's own. atida
|
|
70
|
+
* registers six (`/basket`, `/checkout`, `/login`, …) and the answer was
|
|
71
|
+
* always the customer's empty `wrapper-sw.js` on `/basket`, through two
|
|
72
|
+
* reinstalls that each replaced the worker actually serving the page.
|
|
73
|
+
*
|
|
74
|
+
* `foreign` is read off this version, so picking the wrong one hid the
|
|
75
|
+
* takeover this tracker exists to report: the run marks the right version in
|
|
76
|
+
* {@link recordTakeover}, and the flag was then read from a different one
|
|
77
|
+
* that nobody had marked. `takeovers` still counted, which is the only
|
|
78
|
+
* reason it was visible at all.
|
|
79
|
+
*/
|
|
80
|
+
state(pageUrl) {
|
|
81
|
+
const versions = [...this.versions.values()];
|
|
82
|
+
const active = this.activeVersionFor(pageUrl);
|
|
83
|
+
return {
|
|
84
|
+
registrations: [...this.registrations.values()],
|
|
85
|
+
versions,
|
|
86
|
+
activeVersionId: active?.versionId,
|
|
87
|
+
// The question a debugger is actually asking. False here means "no
|
|
88
|
+
// takeover *seen*" — a run that started after one would not know.
|
|
89
|
+
foreign: Boolean(active?.foreign),
|
|
90
|
+
takeovers: this.takeovers,
|
|
91
|
+
lastTakeoverAt: this.lastTakeoverAt,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The activated worker controlling this url.
|
|
96
|
+
*
|
|
97
|
+
* A registration controls a url when its scope is a prefix of it, and the
|
|
98
|
+
* narrowest matching scope wins — the rule the browser itself applies, so a
|
|
99
|
+
* page under `/basket` is answered by the `/basket` worker and the homepage
|
|
100
|
+
* by the root one. A deleted registration controls nothing.
|
|
101
|
+
*
|
|
102
|
+
* `undefined` is a real answer: mid-reinstall the new version is still
|
|
103
|
+
* `activating` and no activated worker controls the page. Falling back to
|
|
104
|
+
* "any activated version" would put the original bug back, quietly.
|
|
105
|
+
*/
|
|
106
|
+
activeVersionFor(pageUrl) {
|
|
107
|
+
if (!pageUrl) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const controlling = [...this.registrations.values()]
|
|
111
|
+
.filter((registration) => !registration.deleted && pageUrl.startsWith(registration.scopeURL))
|
|
112
|
+
.sort((a, b) => b.scopeURL.length - a.scopeURL.length)[0];
|
|
113
|
+
if (!controlling) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return [...this.versions.values()].find((version) => version.registrationId === controlling.registrationId &&
|
|
117
|
+
version.status === "activated");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ViewportData } from "./control-protocol.js";
|
|
2
|
+
export declare class BadRangeError extends Error {
|
|
3
|
+
readonly code = "BAD_RANGE";
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* What a width sweep needs from the browser.
|
|
7
|
+
*
|
|
8
|
+
* `resize` rather than a CDP handle, because the override has to be cleared
|
|
9
|
+
* again afterwards and a caller that forgot would leave the run's browser
|
|
10
|
+
* pinned to whatever width the sweep ended on.
|
|
11
|
+
*/
|
|
12
|
+
export interface ViewportBrowser {
|
|
13
|
+
evaluate<T>(expression: string): Promise<T>;
|
|
14
|
+
resize(width: number, height: number): Promise<void>;
|
|
15
|
+
clearResize(): Promise<void>;
|
|
16
|
+
reload(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export interface ViewportOptions {
|
|
19
|
+
min?: number;
|
|
20
|
+
max?: number;
|
|
21
|
+
step?: number;
|
|
22
|
+
settleMs?: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Find the widths where the page's own JavaScript changes the DOM.
|
|
27
|
+
*
|
|
28
|
+
* `tools/sk-breakpoints.mjs` promoted. The question it answers is which device
|
|
29
|
+
* variations a customer actually needs: an SSR snapshot is captured at one
|
|
30
|
+
* width, and serving it at another is only wrong where the frontend *JS* would
|
|
31
|
+
* have rendered something different.
|
|
32
|
+
*
|
|
33
|
+
* Which is why this watches mutations rather than diffing element counts.
|
|
34
|
+
* Pure CSS responsiveness — the same DOM, restyled by a media query — produces
|
|
35
|
+
* no mutation and correctly reports no variation needed, because the CSS
|
|
36
|
+
* re-applies on the client over whatever snapshot was served. A class swap that
|
|
37
|
+
* turns a nav into a hamburger changes no node count at all and is exactly the
|
|
38
|
+
* case that does need one. Only a MutationObserver sees both correctly.
|
|
39
|
+
*
|
|
40
|
+
* Two things it does not do, so they are not mistaken for clean results. It
|
|
41
|
+
* reports at most one breakpoint per coarse step, because the pin stops at the
|
|
42
|
+
* first pixel that mutates; and `bootOnlyBranching` is a yes/no rather than a
|
|
43
|
+
* width, since finding the width would mean a reload per probe.
|
|
44
|
+
*/
|
|
45
|
+
export declare function runViewportSweep(browser: ViewportBrowser, options: ViewportOptions): Promise<ViewportData>;
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
const DEFAULT_MIN = 360;
|
|
2
|
+
const DEFAULT_MAX = 1600;
|
|
3
|
+
const DEFAULT_STEP = 20;
|
|
4
|
+
const DEFAULT_SETTLE_MS = 350;
|
|
5
|
+
const DEFAULT_HEIGHT = 900;
|
|
6
|
+
/** Dwells at the start width, to learn what mutates on its own. */
|
|
7
|
+
const NOISE_DWELLS = 6;
|
|
8
|
+
/** A page with more than this is not telling us about layout breakpoints. */
|
|
9
|
+
const MAX_BREAKPOINTS = 12;
|
|
10
|
+
/**
|
|
11
|
+
* A layout change seen at this share of the coarse steps or more is the page
|
|
12
|
+
* following the width continuously — a slider recomputing which slide is
|
|
13
|
+
* active — rather than a breakpoint.
|
|
14
|
+
*/
|
|
15
|
+
const FLUID_SHARE = 0.5;
|
|
16
|
+
/** How many mutation keys any one list in the answer carries. */
|
|
17
|
+
const KEY_LIMIT = 8;
|
|
18
|
+
export class BadRangeError extends Error {
|
|
19
|
+
code = "BAD_RANGE";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Find the widths where the page's own JavaScript changes the DOM.
|
|
23
|
+
*
|
|
24
|
+
* `tools/sk-breakpoints.mjs` promoted. The question it answers is which device
|
|
25
|
+
* variations a customer actually needs: an SSR snapshot is captured at one
|
|
26
|
+
* width, and serving it at another is only wrong where the frontend *JS* would
|
|
27
|
+
* have rendered something different.
|
|
28
|
+
*
|
|
29
|
+
* Which is why this watches mutations rather than diffing element counts.
|
|
30
|
+
* Pure CSS responsiveness — the same DOM, restyled by a media query — produces
|
|
31
|
+
* no mutation and correctly reports no variation needed, because the CSS
|
|
32
|
+
* re-applies on the client over whatever snapshot was served. A class swap that
|
|
33
|
+
* turns a nav into a hamburger changes no node count at all and is exactly the
|
|
34
|
+
* case that does need one. Only a MutationObserver sees both correctly.
|
|
35
|
+
*
|
|
36
|
+
* Two things it does not do, so they are not mistaken for clean results. It
|
|
37
|
+
* reports at most one breakpoint per coarse step, because the pin stops at the
|
|
38
|
+
* first pixel that mutates; and `bootOnlyBranching` is a yes/no rather than a
|
|
39
|
+
* width, since finding the width would mean a reload per probe.
|
|
40
|
+
*/
|
|
41
|
+
export async function runViewportSweep(browser, options) {
|
|
42
|
+
const min = Math.max(200, options.min ?? DEFAULT_MIN);
|
|
43
|
+
const max = Math.min(4000, options.max ?? DEFAULT_MAX);
|
|
44
|
+
const step = Math.max(1, options.step ?? DEFAULT_STEP);
|
|
45
|
+
const settleMs = Math.max(50, options.settleMs ?? DEFAULT_SETTLE_MS);
|
|
46
|
+
const height = options.height ?? DEFAULT_HEIGHT;
|
|
47
|
+
if (max - min < step) {
|
|
48
|
+
throw new BadRangeError(`${min} to ${max} is narrower than one ${step}px step — widen the range or lower the step`);
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
await browser.resize(min, height);
|
|
52
|
+
await delay(settleMs * 3);
|
|
53
|
+
await install(browser);
|
|
54
|
+
// Everything that fires while the page is standing still is noise:
|
|
55
|
+
// carousels, polling, late hydration. Learned first, so the sweep is not
|
|
56
|
+
// reading a rotating banner as a layout breakpoint.
|
|
57
|
+
const noise = new Set();
|
|
58
|
+
for (let dwell = 0; dwell < NOISE_DWELLS; dwell += 1) {
|
|
59
|
+
await delay(settleMs);
|
|
60
|
+
for (const key of await drain(browser)) {
|
|
61
|
+
noise.add(key);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Inline style is set aside before anything else. A fluid layout — a
|
|
65
|
+
// slider, a sticky header computing its offset — rewrites it on every
|
|
66
|
+
// resize, and a snapshot served at another width is corrected by that same
|
|
67
|
+
// script on the client, so it never needs a variation. Counting it buried
|
|
68
|
+
// the one class swap that does under a thousand style writes.
|
|
69
|
+
const steps = [];
|
|
70
|
+
let styleOnlySteps = 0;
|
|
71
|
+
let previous = min;
|
|
72
|
+
for (let width = min + step; width <= max; width += step) {
|
|
73
|
+
await browser.resize(width, height);
|
|
74
|
+
await delay(settleMs);
|
|
75
|
+
const changed = (await drain(browser)).filter((key) => !noise.has(key));
|
|
76
|
+
const layout = changed.filter((key) => !isStyleOnly(key));
|
|
77
|
+
if (layout.length === 0 && changed.length > 0) {
|
|
78
|
+
styleOnlySteps += 1;
|
|
79
|
+
}
|
|
80
|
+
steps.push({ from: previous, to: width, layout });
|
|
81
|
+
previous = width;
|
|
82
|
+
}
|
|
83
|
+
// What changes at most steps is following the width, not crossing one.
|
|
84
|
+
const fluid = fluidKeys(steps);
|
|
85
|
+
const ignored = new Set([...noise, ...fluid]);
|
|
86
|
+
const intervals = steps
|
|
87
|
+
.map((one) => ({
|
|
88
|
+
...one,
|
|
89
|
+
changed: one.layout.filter((key) => !ignored.has(key)),
|
|
90
|
+
}))
|
|
91
|
+
.filter((one) => one.changed.length > 0);
|
|
92
|
+
const breakpoints = [];
|
|
93
|
+
for (const interval of intervals.slice(0, MAX_BREAKPOINTS)) {
|
|
94
|
+
breakpoints.push(await pin(browser, interval, { height, settleMs, noise: ignored }));
|
|
95
|
+
}
|
|
96
|
+
// Said rather than dropped: a sweep that pinned twelve and stopped used to
|
|
97
|
+
// read as a sweep that ended at the twelfth.
|
|
98
|
+
const unpinned = intervals
|
|
99
|
+
.slice(MAX_BREAKPOINTS)
|
|
100
|
+
.map(({ from, to }) => ({ from, to }));
|
|
101
|
+
const bootOnlyBranching = breakpoints.length === 0
|
|
102
|
+
? await bootDiffers(browser, { min, max, height, settleMs })
|
|
103
|
+
: null;
|
|
104
|
+
return {
|
|
105
|
+
min,
|
|
106
|
+
max,
|
|
107
|
+
step,
|
|
108
|
+
breakpoints,
|
|
109
|
+
unpinned,
|
|
110
|
+
noise: [...noise].slice(0, KEY_LIMIT),
|
|
111
|
+
fluid: fluid.slice(0, KEY_LIMIT),
|
|
112
|
+
styleOnlySteps,
|
|
113
|
+
steps: steps.length,
|
|
114
|
+
bootOnlyBranching,
|
|
115
|
+
verdict: verdictFor({
|
|
116
|
+
breakpoints,
|
|
117
|
+
unpinned,
|
|
118
|
+
bootOnlyBranching,
|
|
119
|
+
styleOnlySteps,
|
|
120
|
+
steps: steps.length,
|
|
121
|
+
}),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
// The run's browser goes back to its own size whatever happened. A sweep
|
|
126
|
+
// that threw halfway and left the window at 360px would look like a bug in
|
|
127
|
+
// everything looked at afterwards.
|
|
128
|
+
await browser.clearResize().catch(() => undefined);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Narrow an interval to the exact pixel, then check it reverses.
|
|
133
|
+
*
|
|
134
|
+
* One pixel at a time, upward from the bottom of the interval, because the
|
|
135
|
+
* mutation fires on the *crossing*: widening past 768 mutates and every other
|
|
136
|
+
* width in the interval does not. That makes the probe a point question rather
|
|
137
|
+
* than a monotone one, and a binary search over it converges on the top of the
|
|
138
|
+
* interval instead of the breakpoint — it needs "true at w implies true above
|
|
139
|
+
* w", which is exactly what is not the case here.
|
|
140
|
+
*
|
|
141
|
+
* The confirmation matters as much as the pin: a real breakpoint mutates in
|
|
142
|
+
* both directions, and one-off churn that happened to land in this interval
|
|
143
|
+
* does not.
|
|
144
|
+
*/
|
|
145
|
+
async function pin(browser, interval, context) {
|
|
146
|
+
// Back to the bottom, and discard what that crossing itself produced.
|
|
147
|
+
await browser.resize(interval.from, context.height);
|
|
148
|
+
await delay(context.settleMs);
|
|
149
|
+
await drain(browser);
|
|
150
|
+
let width = interval.to;
|
|
151
|
+
let changed = interval.changed;
|
|
152
|
+
for (let probe = interval.from + 1; probe <= interval.to; probe += 1) {
|
|
153
|
+
await browser.resize(probe, context.height);
|
|
154
|
+
await delay(context.settleMs);
|
|
155
|
+
const keys = (await drain(browser)).filter((key) => !context.noise.has(key) && !isStyleOnly(key));
|
|
156
|
+
if (keys.length > 0) {
|
|
157
|
+
width = probe;
|
|
158
|
+
changed = keys;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const confirmed = await reverses(browser, width, context);
|
|
163
|
+
return {
|
|
164
|
+
width,
|
|
165
|
+
confirmed,
|
|
166
|
+
changed: changed.slice(0, KEY_LIMIT),
|
|
167
|
+
changedTotal: changed.length,
|
|
168
|
+
hint: hintFor(changed),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** A real breakpoint mutates on the way back down as well as on the way up. */
|
|
172
|
+
async function reverses(browser, width, context) {
|
|
173
|
+
await browser.resize(width, context.height);
|
|
174
|
+
await delay(context.settleMs);
|
|
175
|
+
await drain(browser);
|
|
176
|
+
await browser.resize(width - 1, context.height);
|
|
177
|
+
await delay(context.settleMs);
|
|
178
|
+
return ((await drain(browser)).filter((key) => !context.noise.has(key) && !isStyleOnly(key)).length > 0);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Whether the page renders differently when it is *loaded* at each width.
|
|
182
|
+
*
|
|
183
|
+
* Frontend that reads the width once at mount and never re-renders shows
|
|
184
|
+
* nothing at all to a resize sweep, so a clean sweep is not yet an answer. Two
|
|
185
|
+
* loads and a DOM signature are, and they are cheap enough to be worth taking
|
|
186
|
+
* whenever the sweep found nothing.
|
|
187
|
+
*/
|
|
188
|
+
async function bootDiffers(browser, { min, max, height, settleMs, }) {
|
|
189
|
+
try {
|
|
190
|
+
await browser.resize(min, height);
|
|
191
|
+
await browser.reload();
|
|
192
|
+
await delay(settleMs * 6);
|
|
193
|
+
const atMin = await browser.evaluate(SIGNATURE);
|
|
194
|
+
await browser.resize(max, height);
|
|
195
|
+
await browser.reload();
|
|
196
|
+
await delay(settleMs * 6);
|
|
197
|
+
const atMax = await browser.evaluate(SIGNATURE);
|
|
198
|
+
return atMin !== atMax;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
// A reload that failed says nothing either way, and `null` is the only
|
|
202
|
+
// honest answer for a check that did not happen.
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function verdictFor({ breakpoints, unpinned, bootOnlyBranching, styleOnlySteps, steps, }) {
|
|
207
|
+
const fluidNote = styleOnlySteps > 0
|
|
208
|
+
? ` Inline style alone changed at ${styleOnlySteps} of ${steps} widths — a fluid layout, which needs no variation, so it is not counted.`
|
|
209
|
+
: "";
|
|
210
|
+
if (breakpoints.length > 0) {
|
|
211
|
+
const confirmed = breakpoints.filter((one) => one.confirmed);
|
|
212
|
+
const more = unpinned.length > 0
|
|
213
|
+
? ` ${unpinned.length} more interval${unpinned.length === 1 ? "" : "s"} changed above ${breakpoints[breakpoints.length - 1].width}px and were not pinned; narrow --min/--max to look at them.`
|
|
214
|
+
: "";
|
|
215
|
+
return `${breakpoints.length} width${breakpoints.length === 1 ? "" : "s"} where the frontend re-renders (${confirmed.map((one) => `${one.width}px`).join(", ") || "none"} confirmed) — a snapshot captured on one side of these is wrong on the other.${more}${fluidNote}`;
|
|
216
|
+
}
|
|
217
|
+
if (bootOnlyBranching) {
|
|
218
|
+
return `no resize breakpoint, but the page renders differently when loaded narrow and wide — the frontend branches once at mount, so a variation is still needed.${fluidNote}`;
|
|
219
|
+
}
|
|
220
|
+
if (bootOnlyBranching === false) {
|
|
221
|
+
return `no breakpoint: the DOM is the same at every width and the same when loaded at either end. This is CSS-only responsiveness, so one snapshot serves every device.${fluidNote}`;
|
|
222
|
+
}
|
|
223
|
+
return `no resize breakpoint found, and the load comparison could not be taken.${fluidNote}`;
|
|
224
|
+
}
|
|
225
|
+
/** A change to inline style alone — what a fluid layout writes on every resize. */
|
|
226
|
+
function isStyleOnly(key) {
|
|
227
|
+
return key.endsWith(":attributes[style]");
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Layout changes that fire at most coarse steps: the page following the width
|
|
231
|
+
* rather than crossing a threshold. Needs a few steps to say anything.
|
|
232
|
+
*/
|
|
233
|
+
function fluidKeys(steps) {
|
|
234
|
+
if (steps.length < 4) {
|
|
235
|
+
return [];
|
|
236
|
+
}
|
|
237
|
+
const seen = new Map();
|
|
238
|
+
for (const step of steps) {
|
|
239
|
+
for (const key of new Set(step.layout)) {
|
|
240
|
+
seen.set(key, (seen.get(key) ?? 0) + 1);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const threshold = Math.ceil(steps.length * FLUID_SHARE);
|
|
244
|
+
return [...seen]
|
|
245
|
+
.filter(([, count]) => count >= threshold)
|
|
246
|
+
.sort((a, b) => b[1] - a[1])
|
|
247
|
+
.map(([key]) => key);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* A guess at what kind of change this is.
|
|
251
|
+
*
|
|
252
|
+
* Only ever a hint: the selectors are the evidence and this is a label for
|
|
253
|
+
* skimming. Wrong labels are cheap here, missing evidence would not be.
|
|
254
|
+
*/
|
|
255
|
+
function hintFor(changed) {
|
|
256
|
+
const text = changed.join(" ").toLowerCase();
|
|
257
|
+
for (const [needle, hint] of [
|
|
258
|
+
["hamburger", "hamburger menu"],
|
|
259
|
+
["burger", "hamburger menu"],
|
|
260
|
+
["drawer", "drawer navigation"],
|
|
261
|
+
["mobile", "mobile variant"],
|
|
262
|
+
["desktop", "desktop variant"],
|
|
263
|
+
["nav", "navigation"],
|
|
264
|
+
]) {
|
|
265
|
+
if (text.includes(needle)) {
|
|
266
|
+
return hint;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
/** Element count plus the classes of the first elements that carry any. */
|
|
272
|
+
const SIGNATURE = `(function () {
|
|
273
|
+
var classes = Array.prototype.slice
|
|
274
|
+
.call(document.querySelectorAll("[class]"))
|
|
275
|
+
.slice(0, 200)
|
|
276
|
+
.map(function (element) { return String(element.className); })
|
|
277
|
+
.join("|");
|
|
278
|
+
return document.querySelectorAll("*").length + ":" + classes;
|
|
279
|
+
})()`;
|
|
280
|
+
/**
|
|
281
|
+
* Install the observer, once per document.
|
|
282
|
+
*
|
|
283
|
+
* childList plus the two attributes a responsive frontend actually swaps. A
|
|
284
|
+
* broader filter would drown the signal in style churn that no layout depends
|
|
285
|
+
* on.
|
|
286
|
+
*/
|
|
287
|
+
async function install(browser) {
|
|
288
|
+
await browser.evaluate(`(function () {
|
|
289
|
+
if (window.__sk_viewport) {
|
|
290
|
+
window.__sk_viewport.keys = [];
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
var state = { keys: [] };
|
|
295
|
+
window.__sk_viewport = state;
|
|
296
|
+
|
|
297
|
+
function describe(target) {
|
|
298
|
+
if (!target || target.nodeType !== 1) return "node";
|
|
299
|
+
return (
|
|
300
|
+
target.tagName.toLowerCase() +
|
|
301
|
+
(target.id ? "#" + target.id : "") +
|
|
302
|
+
(target.className ? "." + String(target.className).trim().split(/\\s+/).slice(0, 2).join(".") : "")
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
new MutationObserver(function (records) {
|
|
307
|
+
for (var i = 0; i < records.length; i++) {
|
|
308
|
+
var record = records[i];
|
|
309
|
+
var key = describe(record.target) + ":" + record.type +
|
|
310
|
+
(record.attributeName ? "[" + record.attributeName + "]" : "");
|
|
311
|
+
if (state.keys.indexOf(key) === -1) state.keys.push(key);
|
|
312
|
+
}
|
|
313
|
+
}).observe(document.documentElement, {
|
|
314
|
+
childList: true,
|
|
315
|
+
subtree: true,
|
|
316
|
+
attributes: true,
|
|
317
|
+
attributeFilter: ["class", "style"]
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
return true;
|
|
321
|
+
})()`);
|
|
322
|
+
}
|
|
323
|
+
/** Take what has accumulated and reset, so each step reports only its own. */
|
|
324
|
+
async function drain(browser) {
|
|
325
|
+
const serialized = await browser.evaluate(`(function () {
|
|
326
|
+
var state = window.__sk_viewport;
|
|
327
|
+
if (!state) return "[]";
|
|
328
|
+
var keys = state.keys;
|
|
329
|
+
state.keys = [];
|
|
330
|
+
return JSON.stringify(keys);
|
|
331
|
+
})()`);
|
|
332
|
+
try {
|
|
333
|
+
return JSON.parse(serialized ?? "[]");
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
return [];
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function delay(ms) {
|
|
340
|
+
return new Promise((resolve) => {
|
|
341
|
+
const timer = setTimeout(resolve, ms);
|
|
342
|
+
timer.unref();
|
|
343
|
+
});
|
|
344
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WatchData } from "./control-protocol.js";
|
|
2
|
+
import { PreloadRegistry } from "./preload-registry.js";
|
|
3
|
+
export interface WatchOptions {
|
|
4
|
+
expression: string;
|
|
5
|
+
intervalMs?: number;
|
|
6
|
+
durationMs?: number;
|
|
7
|
+
reload?: boolean;
|
|
8
|
+
full?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Sample an expression across a navigation and report what it did.
|
|
12
|
+
*
|
|
13
|
+
* `tools/sk-watch.mjs` promoted. It exists because an intermittent or
|
|
14
|
+
* good-then-broken symptom cannot be caught by a single evaluation — by the
|
|
15
|
+
* time anyone can ask, the page is in whichever state it ended up in. A preload
|
|
16
|
+
* samples from t=0 of the next load and survives the navigation, so the
|
|
17
|
+
* question becomes "what did this value do" rather than "what is it now".
|
|
18
|
+
*
|
|
19
|
+
* Console messages and page exceptions are collected from inside the page
|
|
20
|
+
* rather than over CDP. That keeps the whole capture in one buffer with one
|
|
21
|
+
* clock, and it needs no subscription that would outlive the call. The cost is
|
|
22
|
+
* real and worth stating: messages the *browser* emits rather than the page —
|
|
23
|
+
* a CSP violation, a failed request — are not console calls and do not appear
|
|
24
|
+
* here.
|
|
25
|
+
*/
|
|
26
|
+
export declare function runWatch(preloads: PreloadRegistry, reload: () => Promise<void>, options: WatchOptions): Promise<WatchData>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
const DEFAULT_INTERVAL_MS = 200;
|
|
2
|
+
const DEFAULT_DURATION_MS = 15_000;
|
|
3
|
+
/** Long enough for a slow load to finish, short enough to be a tool call. */
|
|
4
|
+
const MAX_DURATION_MS = 120_000;
|
|
5
|
+
/** Samples returned, after collapsing. The rest stay in the count. */
|
|
6
|
+
const MAX_RETURNED = 200;
|
|
7
|
+
/**
|
|
8
|
+
* Sample an expression across a navigation and report what it did.
|
|
9
|
+
*
|
|
10
|
+
* `tools/sk-watch.mjs` promoted. It exists because an intermittent or
|
|
11
|
+
* good-then-broken symptom cannot be caught by a single evaluation — by the
|
|
12
|
+
* time anyone can ask, the page is in whichever state it ended up in. A preload
|
|
13
|
+
* samples from t=0 of the next load and survives the navigation, so the
|
|
14
|
+
* question becomes "what did this value do" rather than "what is it now".
|
|
15
|
+
*
|
|
16
|
+
* Console messages and page exceptions are collected from inside the page
|
|
17
|
+
* rather than over CDP. That keeps the whole capture in one buffer with one
|
|
18
|
+
* clock, and it needs no subscription that would outlive the call. The cost is
|
|
19
|
+
* real and worth stating: messages the *browser* emits rather than the page —
|
|
20
|
+
* a CSP violation, a failed request — are not console calls and do not appear
|
|
21
|
+
* here.
|
|
22
|
+
*/
|
|
23
|
+
export async function runWatch(preloads, reload, options) {
|
|
24
|
+
const intervalMs = Math.max(20, options.intervalMs ?? DEFAULT_INTERVAL_MS);
|
|
25
|
+
const durationMs = Math.min(MAX_DURATION_MS, Math.max(intervalMs, options.durationMs ?? DEFAULT_DURATION_MS));
|
|
26
|
+
await preloads.reserve("watch", watchScript(options.expression, intervalMs));
|
|
27
|
+
try {
|
|
28
|
+
if (options.reload) {
|
|
29
|
+
await reload();
|
|
30
|
+
}
|
|
31
|
+
await delay(durationMs);
|
|
32
|
+
const read = await preloads.read("watch", Number.MAX_SAFE_INTEGER);
|
|
33
|
+
const records = (read.records ?? []).map((record) => record);
|
|
34
|
+
const samples = [];
|
|
35
|
+
const console = [];
|
|
36
|
+
const exceptions = [];
|
|
37
|
+
for (const { t, v } of records) {
|
|
38
|
+
if (v?.k === "console") {
|
|
39
|
+
console.push({ t, level: v.level ?? "log", text: v.text ?? "" });
|
|
40
|
+
}
|
|
41
|
+
else if (v?.k === "exception") {
|
|
42
|
+
exceptions.push({ t, level: "error", text: v.text ?? "" });
|
|
43
|
+
}
|
|
44
|
+
else if (v?.k === "sample") {
|
|
45
|
+
samples.push(v.error === undefined ? { t, v: v.v } : { t, error: v.error });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const shown = options.full ? samples : transitions(samples);
|
|
49
|
+
return {
|
|
50
|
+
expression: options.expression,
|
|
51
|
+
intervalMs,
|
|
52
|
+
durationMs,
|
|
53
|
+
reloaded: Boolean(options.reload),
|
|
54
|
+
mode: options.full ? "full" : "transitions",
|
|
55
|
+
samples: shown.slice(0, MAX_RETURNED),
|
|
56
|
+
totalSamples: samples.length,
|
|
57
|
+
dropped: read.dropped,
|
|
58
|
+
console: console.slice(0, MAX_RETURNED),
|
|
59
|
+
exceptions: exceptions.slice(0, MAX_RETURNED),
|
|
60
|
+
truncated: shown.length > MAX_RETURNED,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
// Whatever happened, the sampler does not outlive the call. A watch left
|
|
65
|
+
// running is a timer firing every 200ms in the customer's page for as long
|
|
66
|
+
// as the run lives.
|
|
67
|
+
await preloads.release("watch").catch(() => undefined);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Keep only the ticks where the value changed.
|
|
72
|
+
*
|
|
73
|
+
* A 15-second watch at 200ms is 75 samples of which two usually matter. The
|
|
74
|
+
* first sample is always kept, because "what it started as" is half of what a
|
|
75
|
+
* transition means.
|
|
76
|
+
*/
|
|
77
|
+
function transitions(samples) {
|
|
78
|
+
const kept = [];
|
|
79
|
+
let previous;
|
|
80
|
+
for (const sample of samples) {
|
|
81
|
+
const key = JSON.stringify(sample.error ?? sample.v ?? null);
|
|
82
|
+
if (key !== previous) {
|
|
83
|
+
kept.push(sample);
|
|
84
|
+
previous = key;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return kept;
|
|
88
|
+
}
|
|
89
|
+
function delay(ms) {
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
const timer = setTimeout(resolve, ms);
|
|
92
|
+
timer.unref();
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The sampler, the console wrapper and the error listeners, in one script.
|
|
97
|
+
*
|
|
98
|
+
* All three write through the same `record`, so everything shares one clock and
|
|
99
|
+
* one buffer — which is what makes "the value flipped, and here is the
|
|
100
|
+
* exception thrown half a tick earlier" readable at all.
|
|
101
|
+
*/
|
|
102
|
+
function watchScript(expression, intervalMs) {
|
|
103
|
+
return `
|
|
104
|
+
var take = guard(function () {
|
|
105
|
+
try {
|
|
106
|
+
record({ k: "sample", v: (${expression}) });
|
|
107
|
+
} catch (error) {
|
|
108
|
+
record({ k: "sample", error: String((error && error.message) || error) });
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
take();
|
|
112
|
+
var timer = setInterval(function () {
|
|
113
|
+
if (slot.disabled) { clearInterval(timer); return; }
|
|
114
|
+
take();
|
|
115
|
+
}, ${intervalMs});
|
|
116
|
+
|
|
117
|
+
// Guarded per document rather than per slot: a second watch in the same
|
|
118
|
+
// page must re-install its sampler but must not wrap console twice, which
|
|
119
|
+
// would record every message as many times as watches have run.
|
|
120
|
+
if (!window.__SK_WATCH_TAPPED) {
|
|
121
|
+
window.__SK_WATCH_TAPPED = true;
|
|
122
|
+
["log", "info", "warn", "error", "debug"].forEach(function (level) {
|
|
123
|
+
var original = console[level];
|
|
124
|
+
if (typeof original !== "function") return;
|
|
125
|
+
console[level] = function () {
|
|
126
|
+
try {
|
|
127
|
+
record({
|
|
128
|
+
k: "console",
|
|
129
|
+
level: level,
|
|
130
|
+
text: Array.prototype.slice.call(arguments).map(function (one) {
|
|
131
|
+
return typeof one === "string" ? one : JSON.stringify(summarise(one));
|
|
132
|
+
}).join(" ")
|
|
133
|
+
});
|
|
134
|
+
} catch (ignored) {
|
|
135
|
+
// Recording is best effort; passing the call through is not.
|
|
136
|
+
}
|
|
137
|
+
return original.apply(this, arguments);
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
window.addEventListener("error", function (event) {
|
|
142
|
+
record({ k: "exception", text: String((event && event.message) || "error") });
|
|
143
|
+
});
|
|
144
|
+
window.addEventListener("unhandledrejection", function (event) {
|
|
145
|
+
var reason = event && event.reason;
|
|
146
|
+
record({ k: "exception", text: String((reason && reason.message) || reason) });
|
|
147
|
+
});
|
|
148
|
+
}`;
|
|
149
|
+
}
|