@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,829 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
/** How many may be registered at once. */
|
|
3
|
+
export const PRELOAD_LIMIT = 8;
|
|
4
|
+
/** Minutes a preload lives for when the caller names no TTL. */
|
|
5
|
+
export const DEFAULT_TTL_MINUTES = 30;
|
|
6
|
+
/** Records one script may buffer in a document before it starts dropping. */
|
|
7
|
+
const PAGE_BUFFER_LIMIT = 500;
|
|
8
|
+
/** Records `read` returns when the caller names no limit. */
|
|
9
|
+
const DEFAULT_READ_LIMIT = 100;
|
|
10
|
+
/** The object every injected script hangs itself off, in the page. */
|
|
11
|
+
const PAGE_NAMESPACE = "__sk_inject";
|
|
12
|
+
export class NoSuchPreloadError extends Error {
|
|
13
|
+
code = "NO_SUCH_PRELOAD";
|
|
14
|
+
}
|
|
15
|
+
export class UnknownRecipeError extends Error {
|
|
16
|
+
recipes;
|
|
17
|
+
code = "UNKNOWN_RECIPE";
|
|
18
|
+
constructor(message, recipes) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.recipes = recipes;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class BadRecipeParamsError extends Error {
|
|
24
|
+
params;
|
|
25
|
+
code = "BAD_RECIPE_PARAMS";
|
|
26
|
+
constructor(message, params) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.params = params;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class InjectSourceRequiredError extends Error {
|
|
32
|
+
code = "INJECT_SOURCE_REQUIRED";
|
|
33
|
+
}
|
|
34
|
+
export class TooManyPreloadsError extends Error {
|
|
35
|
+
registered;
|
|
36
|
+
code = "TOO_MANY_PRELOADS";
|
|
37
|
+
constructor(message, registered) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.registered = registered;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The recipes, and the reason there are recipes at all.
|
|
44
|
+
*
|
|
45
|
+
* Editing `config_loadHandler.js` to test a one-line hypothesis costs a
|
|
46
|
+
* documentHandler rebuild, a service-worker rebuild, an unregister and a
|
|
47
|
+
* reinstall on the next navigation. A preload that wraps the same seam answers
|
|
48
|
+
* the same question in one navigation and rebuilds nothing.
|
|
49
|
+
*
|
|
50
|
+
* These are shapes rather than named seams on purpose. The endpoints plan named
|
|
51
|
+
* four specific ones — `detectDevice`, `SpeedKit.lastNavigate` — and none of
|
|
52
|
+
* them is verifiable from this repo, which vendors `@speedkit/rules` and
|
|
53
|
+
* nothing else of Speed Kit. A shape parameterised by a path is honest about
|
|
54
|
+
* that and covers the named cases as arguments; a preset can be added once a
|
|
55
|
+
* seam has been seen on a real page.
|
|
56
|
+
*/
|
|
57
|
+
const RECIPES = [
|
|
58
|
+
{
|
|
59
|
+
name: "mark-timeline",
|
|
60
|
+
summary: "Wrap `performance.mark` and record every mark with its timestamp. The " +
|
|
61
|
+
"Speed Kit lifecycle is marked throughout — `baqend-blocking-script-start`, " +
|
|
62
|
+
"`sk-prerender-change-detection-end` — so this is the cheapest way to see " +
|
|
63
|
+
"which phases ran, in which order, and which never happened.",
|
|
64
|
+
observes: "`{ mark }` per `performance.mark` call.",
|
|
65
|
+
// The marks that matter are emitted before anything an agent could install
|
|
66
|
+
// by hand, which is precisely why this has to be a preload.
|
|
67
|
+
needsReload: true,
|
|
68
|
+
params: [
|
|
69
|
+
{
|
|
70
|
+
name: "pattern",
|
|
71
|
+
required: false,
|
|
72
|
+
description: "Regular expression the mark name must match. Absent records every mark.",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
build: ({ pattern }) => `
|
|
76
|
+
var test = ${pattern === undefined ? "null" : `new RegExp(${literal(pattern)})`};
|
|
77
|
+
if (typeof performance !== "undefined" && performance.mark) {
|
|
78
|
+
var original = performance.mark;
|
|
79
|
+
performance.mark = function (name) {
|
|
80
|
+
try {
|
|
81
|
+
if (!test || test.test(name)) record({ mark: name });
|
|
82
|
+
} catch (ignored) {
|
|
83
|
+
// A spy must never change what it watches. Recording is best effort;
|
|
84
|
+
// calling through is not.
|
|
85
|
+
}
|
|
86
|
+
return original.apply(this, arguments);
|
|
87
|
+
};
|
|
88
|
+
}`,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "sample",
|
|
92
|
+
summary: "Evaluate an expression on an interval and record a timeline of it. This " +
|
|
93
|
+
"is the one for an intermittent or good-then-broken symptom, which a " +
|
|
94
|
+
"single evaluation cannot catch by construction.",
|
|
95
|
+
observes: "The expression's value per tick, or `{ error }` when it threw.",
|
|
96
|
+
needsReload: false,
|
|
97
|
+
params: [
|
|
98
|
+
{
|
|
99
|
+
name: "expression",
|
|
100
|
+
required: true,
|
|
101
|
+
description: "JavaScript expression returning a JSON-able value. Inlined as code " +
|
|
102
|
+
"and evaluated in the page, so it is as sharp as raw source.",
|
|
103
|
+
code: true,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "intervalMs",
|
|
107
|
+
required: false,
|
|
108
|
+
description: "Milliseconds between samples.",
|
|
109
|
+
default: 200,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
build: ({ expression, intervalMs }) => `
|
|
113
|
+
var take = guard(function () { record(${expression}); });
|
|
114
|
+
take();
|
|
115
|
+
var timer = setInterval(function () {
|
|
116
|
+
if (slot.disabled) { clearInterval(timer); return; }
|
|
117
|
+
take();
|
|
118
|
+
}, ${Number(intervalMs)});`,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "spy",
|
|
122
|
+
summary: "Wrap a function and record every call's arguments, without changing what " +
|
|
123
|
+
"it does. The tracking seam — `dataLayer.push` and its kin — is the case " +
|
|
124
|
+
"this exists for: it answers what the config *would* read.",
|
|
125
|
+
observes: "`{ call, args }` per call, arguments summarised and depth-limited.",
|
|
126
|
+
needsReload: false,
|
|
127
|
+
params: [
|
|
128
|
+
{
|
|
129
|
+
name: "path",
|
|
130
|
+
required: true,
|
|
131
|
+
description: "Dotted path from `window`, e.g. `dataLayer.push`. Waited for, so a " +
|
|
132
|
+
"seam a later script creates is still caught.",
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
build: ({ path }) => `
|
|
136
|
+
whenPresent(${literal(path)}, function (found) {
|
|
137
|
+
var original = found.owner[found.key];
|
|
138
|
+
if (typeof original !== "function") {
|
|
139
|
+
record({ path: ${literal(path)}, notAFunction: typeof original });
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
found.owner[found.key] = function () {
|
|
143
|
+
// Recorded before calling through, so an argument list survives a call
|
|
144
|
+
// that throws — which is the call most worth having a record of.
|
|
145
|
+
record({ call: ${literal(path)}, args: summarise(Array.prototype.slice.call(arguments)) });
|
|
146
|
+
return original.apply(this, arguments);
|
|
147
|
+
};
|
|
148
|
+
});`,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "web-vitals",
|
|
152
|
+
summary: "Record LCP, CLS, INP, FCP and TTFB as the browser reports them, with the " +
|
|
153
|
+
"element behind each: the LCP element and its resource, the nodes every " +
|
|
154
|
+
"layout shift moved. Buffered, so it also catches what happened before it " +
|
|
155
|
+
"was added. Pair it with `mark-timeline` or `sk onboarding debug` to see " +
|
|
156
|
+
"which Speed Kit phase a shift or the LCP fell into.",
|
|
157
|
+
observes: "`{ metric, value, … }` per entry: `lcp` with `element` and `url`, `cls` " +
|
|
158
|
+
"per shift with the running `total` and its `sources`, `inp` per slow " +
|
|
159
|
+
"interaction, `fcp`, `ttfb`. Times are ms on the page's clock.",
|
|
160
|
+
needsReload: false,
|
|
161
|
+
params: [],
|
|
162
|
+
build: () => `
|
|
163
|
+
function describe(node) {
|
|
164
|
+
if (!node || node.nodeType !== 1) return node ? node.nodeName : null;
|
|
165
|
+
var text = node.tagName.toLowerCase();
|
|
166
|
+
if (node.id) text += "#" + node.id;
|
|
167
|
+
var classes = String(node.className || "").trim().split(/\\s+/).filter(Boolean).slice(0, 3);
|
|
168
|
+
if (classes.length) text += "." + classes.join(".");
|
|
169
|
+
return text;
|
|
170
|
+
}
|
|
171
|
+
// Whether Chrome is producing frames at all. A window the compositor does
|
|
172
|
+
// not draw — a hidden workspace — paints nothing, and then "no LCP" is not
|
|
173
|
+
// a measurement but an absence of one.
|
|
174
|
+
record({
|
|
175
|
+
metric: "page",
|
|
176
|
+
visibility: document.visibilityState,
|
|
177
|
+
focused: document.hasFocus()
|
|
178
|
+
});
|
|
179
|
+
function observe(type, handle, options) {
|
|
180
|
+
try {
|
|
181
|
+
new PerformanceObserver(guard(function (list) {
|
|
182
|
+
list.getEntries().forEach(handle);
|
|
183
|
+
})).observe(Object.assign({ type: type, buffered: true }, options || {}));
|
|
184
|
+
} catch (ignored) {
|
|
185
|
+
record({ metric: type, unsupported: true });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
observe("largest-contentful-paint", function (entry) {
|
|
189
|
+
record({
|
|
190
|
+
metric: "lcp",
|
|
191
|
+
value: Math.round(entry.startTime),
|
|
192
|
+
size: entry.size,
|
|
193
|
+
element: describe(entry.element),
|
|
194
|
+
url: entry.url || null
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
var cls = 0;
|
|
198
|
+
var clsLoad = currentLoad();
|
|
199
|
+
observe("layout-shift", function (entry) {
|
|
200
|
+
// A shift right after input is expected, and CLS leaves it out.
|
|
201
|
+
if (entry.hadRecentInput) return;
|
|
202
|
+
// Per page load: a single-page-app navigation starts a new total, where
|
|
203
|
+
// it used to keep climbing across pages.
|
|
204
|
+
if (currentLoad() !== clsLoad) { cls = 0; clsLoad = currentLoad(); }
|
|
205
|
+
cls += entry.value;
|
|
206
|
+
record({
|
|
207
|
+
metric: "cls",
|
|
208
|
+
value: Math.round(entry.value * 10000) / 10000,
|
|
209
|
+
total: Math.round(cls * 10000) / 10000,
|
|
210
|
+
at: Math.round(entry.startTime),
|
|
211
|
+
sources: (entry.sources || []).slice(0, 5).map(function (source) {
|
|
212
|
+
return {
|
|
213
|
+
node: describe(source.node),
|
|
214
|
+
from: source.previousRect && [source.previousRect.x, source.previousRect.y, source.previousRect.width, source.previousRect.height],
|
|
215
|
+
to: source.currentRect && [source.currentRect.x, source.currentRect.y, source.currentRect.width, source.currentRect.height]
|
|
216
|
+
};
|
|
217
|
+
})
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
observe("event", function (entry) {
|
|
221
|
+
if (!entry.interactionId) return;
|
|
222
|
+
record({
|
|
223
|
+
metric: "inp",
|
|
224
|
+
value: Math.round(entry.duration),
|
|
225
|
+
event: entry.name,
|
|
226
|
+
target: describe(entry.target),
|
|
227
|
+
at: Math.round(entry.startTime)
|
|
228
|
+
});
|
|
229
|
+
}, { durationThreshold: 40 });
|
|
230
|
+
observe("paint", function (entry) {
|
|
231
|
+
if (entry.name === "first-contentful-paint") {
|
|
232
|
+
record({ metric: "fcp", value: Math.round(entry.startTime) });
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
observe("navigation", function (entry) {
|
|
236
|
+
record({ metric: "ttfb", value: Math.round(entry.responseStart) });
|
|
237
|
+
});`,
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: "stub",
|
|
241
|
+
summary: "Replace what a path holds, to force a branch without editing the config " +
|
|
242
|
+
"or the environment — a variation signal, a feature probe. The one recipe " +
|
|
243
|
+
"here that changes the page rather than watching it.",
|
|
244
|
+
observes: "`{ replaced }` on install, and `{ call }` per call in `returns` mode.",
|
|
245
|
+
needsReload: false,
|
|
246
|
+
params: [
|
|
247
|
+
{
|
|
248
|
+
name: "path",
|
|
249
|
+
required: true,
|
|
250
|
+
description: "Dotted path from `window` to replace.",
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "value",
|
|
254
|
+
required: false,
|
|
255
|
+
description: "The value to put there, as JSON. Exclusive with `returns`.",
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "returns",
|
|
259
|
+
required: false,
|
|
260
|
+
description: "Replace with a function returning this, as JSON. Exclusive with `value`.",
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
build: ({ path, value, returns }) => {
|
|
264
|
+
if ((value === undefined) === (returns === undefined)) {
|
|
265
|
+
throw new BadRecipeParamsError("`stub` takes exactly one of `value` and `returns` — the first replaces what the path holds, the second replaces it with a function answering that.", recipeByName("stub").params);
|
|
266
|
+
}
|
|
267
|
+
const replacement = returns === undefined
|
|
268
|
+
? literal(value)
|
|
269
|
+
: `function () { record({ call: ${literal(path)} }); return ${literal(returns)}; }`;
|
|
270
|
+
return `
|
|
271
|
+
whenPresent(${literal(path)}, function (found) {
|
|
272
|
+
found.owner[found.key] = ${replacement};
|
|
273
|
+
record({ path: ${literal(path)}, replaced: true });
|
|
274
|
+
});`;
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
];
|
|
278
|
+
/**
|
|
279
|
+
* The preloads a run has registered, and the only thing allowed to add one.
|
|
280
|
+
*
|
|
281
|
+
* Three consumers wanted `Page.addScriptToEvaluateOnNewDocument` — the sampler,
|
|
282
|
+
* the breakpoint bridge's flag delivery, and injected hooks — and three ad-hoc
|
|
283
|
+
* call sites would have meant three ways to leave a script behind. A preload
|
|
284
|
+
* outlives the turn that added it, survives every navigation, and is invisible
|
|
285
|
+
* to the human watching the run's output. So it is registered in one place that
|
|
286
|
+
* can list them, expire them, and switch off the copy already running.
|
|
287
|
+
*/
|
|
288
|
+
export class PreloadRegistry {
|
|
289
|
+
transport;
|
|
290
|
+
onChange;
|
|
291
|
+
registered = new Map();
|
|
292
|
+
/** Set while a retire is in flight, so one notification covers the batch. */
|
|
293
|
+
changed = false;
|
|
294
|
+
counter = 0;
|
|
295
|
+
/** Expired since the last time anyone was told, so an absence is explained. */
|
|
296
|
+
expired = [];
|
|
297
|
+
constructor(transport,
|
|
298
|
+
/**
|
|
299
|
+
* Told whenever what is installed changes.
|
|
300
|
+
*
|
|
301
|
+
* The hook the tab marker hangs off: "an agent has left something in this
|
|
302
|
+
* page" is exactly the set of moments this fires on, and it is the
|
|
303
|
+
* condition worth showing rather than the fact that a tool ran.
|
|
304
|
+
*/
|
|
305
|
+
onChange) {
|
|
306
|
+
this.transport = transport;
|
|
307
|
+
this.onChange = onChange;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* What is installed, without asking the page.
|
|
311
|
+
*
|
|
312
|
+
* `list` needs an evaluation to say whether a script is running; this only
|
|
313
|
+
* answers what is registered, which is all a status label needs and cheap
|
|
314
|
+
* enough to compute on every change.
|
|
315
|
+
*/
|
|
316
|
+
summary() {
|
|
317
|
+
const entries = [...this.registered.values()];
|
|
318
|
+
return {
|
|
319
|
+
count: entries.length,
|
|
320
|
+
origins: [...new Set(entries.map((one) => one.entry.origin))],
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
get size() {
|
|
324
|
+
return this.registered.size;
|
|
325
|
+
}
|
|
326
|
+
recipes() {
|
|
327
|
+
return {
|
|
328
|
+
recipes: RECIPES.map(({ build: _build, ...info }) => info),
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
async add(request) {
|
|
332
|
+
const { recipe, params = {}, source, ttlMinutes } = request;
|
|
333
|
+
if ((recipe === undefined) === (source === undefined)) {
|
|
334
|
+
throw new InjectSourceRequiredError("`add` takes exactly one of `recipe` and `source`. Call `recipes` for the named ones; `source` is the escape hatch.");
|
|
335
|
+
}
|
|
336
|
+
// Reserved entries are another tool's and not the caller's to remove, so
|
|
337
|
+
// counting them here would refuse an add over a budget nobody can free.
|
|
338
|
+
const owned = [...this.registered.values()].filter((registered) => !registered.entry.reserved);
|
|
339
|
+
if (owned.length >= PRELOAD_LIMIT) {
|
|
340
|
+
throw new TooManyPreloadsError(`this run already has ${PRELOAD_LIMIT} preloads registered — remove one before adding another, or \`clear\` them all`, owned.map((registered) => registered.entry.id));
|
|
341
|
+
}
|
|
342
|
+
const definition = recipe === undefined ? undefined : recipeByName(recipe);
|
|
343
|
+
const body = definition === undefined
|
|
344
|
+
? source
|
|
345
|
+
: definition.build(withDefaults(definition, params));
|
|
346
|
+
const preload = `p${(this.counter += 1)}`;
|
|
347
|
+
const ttl = ttlMinutes ?? DEFAULT_TTL_MINUTES;
|
|
348
|
+
const expiresAt = ttl > 0 ? new Date(Date.now() + ttl * 60_000) : null;
|
|
349
|
+
const origin = definition?.name ?? "raw";
|
|
350
|
+
const wrapped = envelope({
|
|
351
|
+
preload,
|
|
352
|
+
origin,
|
|
353
|
+
body,
|
|
354
|
+
expiresAt,
|
|
355
|
+
keepAcrossLoads: true,
|
|
356
|
+
});
|
|
357
|
+
const identifier = await this.transport.addScript(wrapped);
|
|
358
|
+
const entry = {
|
|
359
|
+
id: preload,
|
|
360
|
+
origin,
|
|
361
|
+
addedAt: new Date().toISOString(),
|
|
362
|
+
expiresAt: expiresAt?.toISOString() ?? null,
|
|
363
|
+
sourceSha: createHash("sha256")
|
|
364
|
+
.update(wrapped)
|
|
365
|
+
.digest("hex")
|
|
366
|
+
.slice(0, 12),
|
|
367
|
+
bytes: Buffer.byteLength(wrapped),
|
|
368
|
+
needsReload: definition?.needsReload ?? true,
|
|
369
|
+
};
|
|
370
|
+
const registered = { entry, identifier, source: wrapped };
|
|
371
|
+
this.registered.set(preload, registered);
|
|
372
|
+
this.onChange?.();
|
|
373
|
+
if (expiresAt) {
|
|
374
|
+
// unref'd: a pending expiry is not a reason for the run to stay up.
|
|
375
|
+
registered.timer = setTimeout(() => void this.expire(preload), expiresAt.getTime() - Date.now());
|
|
376
|
+
registered.timer.unref();
|
|
377
|
+
}
|
|
378
|
+
// A preload only ever runs at document start, so one added now does nothing
|
|
379
|
+
// until the next navigation — unless it is a kind that still means something
|
|
380
|
+
// mid-life, in which case running it once here is the difference between a
|
|
381
|
+
// tool that works and one that always answers "reload and ask again".
|
|
382
|
+
if (!entry.needsReload && this.transport.pageAvailable) {
|
|
383
|
+
await this.evaluateQuietly(wrapped);
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
preload: await this.describe(registered),
|
|
387
|
+
recipe: definition?.name,
|
|
388
|
+
expired: this.drainExpired(),
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
async list() {
|
|
392
|
+
const state = await this.pageState();
|
|
393
|
+
return {
|
|
394
|
+
preloads: [...this.registered.values()].map((registered) => describeWith(registered, state)),
|
|
395
|
+
expired: this.drainExpired(),
|
|
396
|
+
limit: PRELOAD_LIMIT,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
async read(preload, limit = DEFAULT_READ_LIMIT) {
|
|
400
|
+
const registered = this.require(preload);
|
|
401
|
+
const state = await this.pageState();
|
|
402
|
+
const slot = state?.[preload];
|
|
403
|
+
if (!slot) {
|
|
404
|
+
return {
|
|
405
|
+
preload,
|
|
406
|
+
origin: registered.entry.origin,
|
|
407
|
+
records: null,
|
|
408
|
+
active: false,
|
|
409
|
+
total: 0,
|
|
410
|
+
truncated: false,
|
|
411
|
+
dropped: 0,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
const records = slot.records ?? [];
|
|
415
|
+
return {
|
|
416
|
+
preload,
|
|
417
|
+
origin: registered.entry.origin,
|
|
418
|
+
// Newest last, so a timeline reads in the direction it happened.
|
|
419
|
+
records: records.slice(Math.max(0, records.length - limit)),
|
|
420
|
+
active: true,
|
|
421
|
+
total: records.length,
|
|
422
|
+
truncated: records.length > limit,
|
|
423
|
+
dropped: slot.dropped ?? 0,
|
|
424
|
+
...(slot.error ? { error: slot.error } : {}),
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
async remove(preload) {
|
|
428
|
+
this.require(preload);
|
|
429
|
+
const stoppedInPage = await this.retire([preload]);
|
|
430
|
+
return {
|
|
431
|
+
removed: [preload],
|
|
432
|
+
remaining: this.registered.size,
|
|
433
|
+
stoppedInPage,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
async clear() {
|
|
437
|
+
const all = [...this.registered.values()]
|
|
438
|
+
.filter((registered) => !registered.entry.reserved)
|
|
439
|
+
.map((registered) => registered.entry.id);
|
|
440
|
+
const stoppedInPage = await this.retire(all);
|
|
441
|
+
return { removed: all, remaining: this.registered.size, stoppedInPage };
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Install a script another tool owns, under a name instead of an id.
|
|
445
|
+
*
|
|
446
|
+
* Registered here rather than straight onto the transport so that one place
|
|
447
|
+
* still knows about every script running in the page: an agent that reads
|
|
448
|
+
* `sk onboarding inject list`, sees nothing, and concludes the page is unmodified while
|
|
449
|
+
* `sk onboarding debug` has hooks in it has been misled by the tool built to prevent
|
|
450
|
+
* exactly that. Replacing an existing reservation is the normal case — arming
|
|
451
|
+
* a different set of breakpoints is a new script under the same name.
|
|
452
|
+
*/
|
|
453
|
+
async reserve(name, body) {
|
|
454
|
+
await this.release(name);
|
|
455
|
+
// Wrapped like any other preload, so a reserved script gets the same
|
|
456
|
+
// containment and the same `record`/`guard`/`summarise` helpers — and so
|
|
457
|
+
// `read` can drain its buffer through the one path that knows the shape.
|
|
458
|
+
const source = envelope({
|
|
459
|
+
preload: name,
|
|
460
|
+
origin: name,
|
|
461
|
+
body,
|
|
462
|
+
expiresAt: null,
|
|
463
|
+
});
|
|
464
|
+
const identifier = await this.transport.addScript(source);
|
|
465
|
+
this.changed = true;
|
|
466
|
+
this.registered.set(name, {
|
|
467
|
+
identifier,
|
|
468
|
+
source,
|
|
469
|
+
entry: {
|
|
470
|
+
id: name,
|
|
471
|
+
origin: name,
|
|
472
|
+
addedAt: new Date().toISOString(),
|
|
473
|
+
expiresAt: null,
|
|
474
|
+
sourceSha: createHash("sha256")
|
|
475
|
+
.update(source)
|
|
476
|
+
.digest("hex")
|
|
477
|
+
.slice(0, 12),
|
|
478
|
+
bytes: Buffer.byteLength(source),
|
|
479
|
+
needsReload: true,
|
|
480
|
+
reserved: true,
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
this.onChange?.();
|
|
484
|
+
}
|
|
485
|
+
async release(name) {
|
|
486
|
+
if (!this.registered.has(name)) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
await this.retire([name]);
|
|
490
|
+
return true;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Register everything again against a session that has just been made.
|
|
494
|
+
*
|
|
495
|
+
* A CDP session does not survive being detached, and the identifiers it
|
|
496
|
+
* handed out do not either. Without this a preload would keep appearing in
|
|
497
|
+
* `list` while no longer running in the browser, which is the one failure
|
|
498
|
+
* this tool cannot afford: every conclusion drawn from an empty buffer would
|
|
499
|
+
* be wrong in the same direction.
|
|
500
|
+
*/
|
|
501
|
+
async reapply() {
|
|
502
|
+
for (const registered of this.registered.values()) {
|
|
503
|
+
registered.identifier = await this.transport.addScript(registered.source);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
/** Whatever is left at the end of the run, dropped without ceremony. */
|
|
507
|
+
dispose() {
|
|
508
|
+
for (const registered of this.registered.values()) {
|
|
509
|
+
clearTimeout(registered.timer);
|
|
510
|
+
}
|
|
511
|
+
const had = this.registered.size > 0;
|
|
512
|
+
this.registered.clear();
|
|
513
|
+
if (had) {
|
|
514
|
+
this.onChange?.();
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
require(preload) {
|
|
518
|
+
const registered = this.registered.get(preload);
|
|
519
|
+
if (!registered) {
|
|
520
|
+
throw new NoSuchPreloadError(`no preload ${preload} on this run${this.registered.size > 0
|
|
521
|
+
? ` — registered: ${[...this.registered.keys()].join(", ")}`
|
|
522
|
+
: " — none are registered"}`);
|
|
523
|
+
}
|
|
524
|
+
return registered;
|
|
525
|
+
}
|
|
526
|
+
async expire(preload) {
|
|
527
|
+
if (!this.registered.has(preload)) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
await this.retire([preload]);
|
|
531
|
+
this.expired.push(preload);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Unregister and switch off, in that order.
|
|
535
|
+
*
|
|
536
|
+
* Unregistering stops the *next* document. The copy already running in this
|
|
537
|
+
* one has already installed its hooks and cannot be taken back out, so it is
|
|
538
|
+
* switched off through the flag every recipe checks before it records. A
|
|
539
|
+
* removal that did only the first half would leave a spy recording into a
|
|
540
|
+
* buffer nothing lists.
|
|
541
|
+
*/
|
|
542
|
+
async retire(preloads) {
|
|
543
|
+
for (const preload of preloads) {
|
|
544
|
+
const registered = this.registered.get(preload);
|
|
545
|
+
if (!registered) {
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
clearTimeout(registered.timer);
|
|
549
|
+
await this.transport.removeScript(registered.identifier).catch(() => {
|
|
550
|
+
// A session that has gone took its registrations with it. Dropping the
|
|
551
|
+
// entry is still right, and reporting a CDP failure here would name the
|
|
552
|
+
// wrong problem.
|
|
553
|
+
});
|
|
554
|
+
this.registered.delete(preload);
|
|
555
|
+
this.changed = true;
|
|
556
|
+
}
|
|
557
|
+
if (this.changed) {
|
|
558
|
+
this.changed = false;
|
|
559
|
+
this.onChange?.();
|
|
560
|
+
}
|
|
561
|
+
if (!this.transport.pageAvailable || preloads.length === 0) {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
return this.evaluateQuietly(`(function () {
|
|
565
|
+
var ns = window.${PAGE_NAMESPACE};
|
|
566
|
+
if (!ns) return false;
|
|
567
|
+
${JSON.stringify(preloads)}.forEach(function (id) {
|
|
568
|
+
if (!ns[id]) return;
|
|
569
|
+
// Disabled first, then dropped. Disabling is what stops the hooks
|
|
570
|
+
// that are already installed; dropping it is what lets the same id
|
|
571
|
+
// install again, which a re-armed debugger and a second watch both
|
|
572
|
+
// need — the envelope's idempotency guard would otherwise refuse.
|
|
573
|
+
ns[id].disabled = true;
|
|
574
|
+
delete ns[id];
|
|
575
|
+
});
|
|
576
|
+
return true;
|
|
577
|
+
})()`);
|
|
578
|
+
}
|
|
579
|
+
/** Every entry's page-side state in one evaluation, or null when there is no page. */
|
|
580
|
+
async pageState() {
|
|
581
|
+
if (!this.transport.pageAvailable) {
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
try {
|
|
585
|
+
const serialized = await this.transport.evaluate(`JSON.stringify(window.${PAGE_NAMESPACE} || null)`);
|
|
586
|
+
return serialized
|
|
587
|
+
? JSON.parse(serialized)
|
|
588
|
+
: null;
|
|
589
|
+
}
|
|
590
|
+
catch {
|
|
591
|
+
// A page that cannot answer is a page with no records to report, not a
|
|
592
|
+
// failed call: `active: false` is the honest answer and the caller still
|
|
593
|
+
// gets the registration it asked about.
|
|
594
|
+
return null;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
async describe(registered) {
|
|
598
|
+
return describeWith(registered, await this.pageState());
|
|
599
|
+
}
|
|
600
|
+
async evaluateQuietly(expression) {
|
|
601
|
+
try {
|
|
602
|
+
await this.transport.evaluate(expression);
|
|
603
|
+
return true;
|
|
604
|
+
}
|
|
605
|
+
catch {
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
drainExpired() {
|
|
610
|
+
const expired = this.expired;
|
|
611
|
+
this.expired = [];
|
|
612
|
+
return expired;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function describeWith(registered, state) {
|
|
616
|
+
const slot = state?.[registered.entry.id];
|
|
617
|
+
return {
|
|
618
|
+
...registered.entry,
|
|
619
|
+
active: Boolean(slot),
|
|
620
|
+
buffered: slot ? (slot.records?.length ?? 0) : null,
|
|
621
|
+
...(slot?.error ? { error: slot.error } : {}),
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
function recipeByName(name) {
|
|
625
|
+
const recipe = RECIPES.find((candidate) => candidate.name === name);
|
|
626
|
+
if (!recipe) {
|
|
627
|
+
throw new UnknownRecipeError(`no recipe ${name} — this run has ${RECIPES.map((one) => one.name).join(", ")}`, RECIPES.map((one) => one.name));
|
|
628
|
+
}
|
|
629
|
+
return recipe;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* The params a recipe will be built with, or the reason it cannot be.
|
|
633
|
+
*
|
|
634
|
+
* An unknown param is refused rather than ignored. A caller that misspells
|
|
635
|
+
* `intervalMs` and is silently given 200 gets a timeline that looks right and
|
|
636
|
+
* is not the one it asked for.
|
|
637
|
+
*/
|
|
638
|
+
function withDefaults(recipe, params) {
|
|
639
|
+
const known = new Set(recipe.params.map((param) => param.name));
|
|
640
|
+
const unknown = Object.keys(params).filter((name) => !known.has(name));
|
|
641
|
+
if (unknown.length > 0) {
|
|
642
|
+
throw new BadRecipeParamsError(`\`${recipe.name}\` takes no param ${unknown.join(", ")} — it takes ${[...known].join(", ")}`, recipe.params);
|
|
643
|
+
}
|
|
644
|
+
const missing = recipe.params.filter((param) => param.required && params[param.name] === undefined);
|
|
645
|
+
if (missing.length > 0) {
|
|
646
|
+
throw new BadRecipeParamsError(`\`${recipe.name}\` needs ${missing.map((param) => param.name).join(", ")}`, recipe.params);
|
|
647
|
+
}
|
|
648
|
+
const resolved = { ...params };
|
|
649
|
+
for (const param of recipe.params) {
|
|
650
|
+
if (resolved[param.name] === undefined && param.default !== undefined) {
|
|
651
|
+
resolved[param.name] = param.default;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return resolved;
|
|
655
|
+
}
|
|
656
|
+
/** A value rendered as source. JSON is a subset of JavaScript literals. */
|
|
657
|
+
function literal(value) {
|
|
658
|
+
return JSON.stringify(value ?? null);
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* What every injected script is wrapped in, recipe or raw alike.
|
|
662
|
+
*
|
|
663
|
+
* Four things it guarantees, each of which has bitten someone:
|
|
664
|
+
*
|
|
665
|
+
* - **It cannot take the page down.** A preload runs in the MAIN world before
|
|
666
|
+
* any page script, so an exception in it is thrown before the site has run a
|
|
667
|
+
* line. The install is wrapped, and every hook a recipe installs is wrapped
|
|
668
|
+
* again, because the second throw comes later and would otherwise land inside
|
|
669
|
+
* the customer's own call stack.
|
|
670
|
+
* - **It is idempotent.** A document that somehow runs it twice — two sessions,
|
|
671
|
+
* a re-apply after a reconnect — must not wrap a seam twice and report every
|
|
672
|
+
* call twice.
|
|
673
|
+
* - **It is bounded.** The buffer has a ceiling and counts what it dropped, so
|
|
674
|
+
* a sampler left running overnight does not grow the tab until it dies, and
|
|
675
|
+
* a truncated timeline says that it is one.
|
|
676
|
+
* - **It is attributable.** `sourceURL` puts a name on it, so an exception in
|
|
677
|
+
* the run's output points here rather than at an anonymous eval.
|
|
678
|
+
*
|
|
679
|
+
* Globals are reached as properties of `window`, never as bare identifiers: a
|
|
680
|
+
* bare identifier that does not exist throws a `ReferenceError` that takes the
|
|
681
|
+
* whole script with it, which is the lesson the breakpoint pause-hook learned.
|
|
682
|
+
*/
|
|
683
|
+
function envelope(options) {
|
|
684
|
+
const { preload, origin, body, expiresAt, keepAcrossLoads } = options;
|
|
685
|
+
return `(function () {
|
|
686
|
+
var ID = ${literal(preload)};
|
|
687
|
+
var NS = window.${PAGE_NAMESPACE} || (window.${PAGE_NAMESPACE} = {});
|
|
688
|
+
if (NS[ID]) return;
|
|
689
|
+
var EXPIRES = ${expiresAt ? expiresAt.getTime() : 0};
|
|
690
|
+
if (EXPIRES && Date.now() > EXPIRES) return;
|
|
691
|
+
|
|
692
|
+
var slot = (NS[ID] = {
|
|
693
|
+
id: ID,
|
|
694
|
+
origin: ${literal(origin)},
|
|
695
|
+
records: [],
|
|
696
|
+
dropped: 0,
|
|
697
|
+
disabled: false
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
// Which page load a record belongs to. A hard load is a new document and a
|
|
701
|
+
// new buffer; a single-page-app navigation or a back/forward-cache restore
|
|
702
|
+
// keeps the document, and without this its records ran on into the next
|
|
703
|
+
// page's: web-vitals' CLS total climbing across two pages. Shared by every
|
|
704
|
+
// preload in the document, so their load ids agree.
|
|
705
|
+
if (!NS.__load) {
|
|
706
|
+
var load = (NS.__load = {
|
|
707
|
+
id: String(Math.round((performance && performance.timeOrigin) || Date.now())),
|
|
708
|
+
nav: 0
|
|
709
|
+
});
|
|
710
|
+
// Best effort: a page without these still records, just without telling
|
|
711
|
+
// its single-page navigations apart.
|
|
712
|
+
try {
|
|
713
|
+
["pushState", "replaceState"].forEach(function (name) {
|
|
714
|
+
var original = history[name];
|
|
715
|
+
if (typeof original !== "function") return;
|
|
716
|
+
history[name] = function () {
|
|
717
|
+
var before = location.href;
|
|
718
|
+
var result = original.apply(this, arguments);
|
|
719
|
+
if (location.href !== before) load.nav++;
|
|
720
|
+
return result;
|
|
721
|
+
};
|
|
722
|
+
});
|
|
723
|
+
addEventListener("popstate", function () { load.nav++; });
|
|
724
|
+
addEventListener("pageshow", function (event) { if (event.persisted) load.nav++; });
|
|
725
|
+
} catch (ignored) {}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function currentLoad() {
|
|
729
|
+
return NS.__load.nav ? NS.__load.id + "." + NS.__load.nav : NS.__load.id;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
function currentUrl() {
|
|
733
|
+
try { return location.href; } catch (ignored) { return null; }
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// A hard navigation is a new document and a new buffer, and the records of
|
|
737
|
+
// the load before went with the old one — the SSR load and the one Speed Kit
|
|
738
|
+
// hands over to are two loads, and the first was simply gone. Kept in
|
|
739
|
+
// sessionStorage across the origin's loads, labelled with their load ids.
|
|
740
|
+
var KEEP = ${keepAcrossLoads ? "true" : "false"};
|
|
741
|
+
var ARCHIVE = "__sk_inject:" + ID;
|
|
742
|
+
if (KEEP) {
|
|
743
|
+
try {
|
|
744
|
+
var kept = JSON.parse(sessionStorage.getItem(ARCHIVE) || "null");
|
|
745
|
+
if (kept && kept.records) {
|
|
746
|
+
slot.records = kept.records.slice(-${PAGE_BUFFER_LIMIT});
|
|
747
|
+
slot.dropped = kept.dropped || 0;
|
|
748
|
+
}
|
|
749
|
+
addEventListener("pagehide", function () {
|
|
750
|
+
try {
|
|
751
|
+
if (slot.disabled) { sessionStorage.removeItem(ARCHIVE); return; }
|
|
752
|
+
sessionStorage.setItem(ARCHIVE, JSON.stringify({
|
|
753
|
+
records: slot.records.slice(-${PAGE_BUFFER_LIMIT}),
|
|
754
|
+
dropped: slot.dropped
|
|
755
|
+
}));
|
|
756
|
+
} catch (ignored) {}
|
|
757
|
+
});
|
|
758
|
+
} catch (ignored) {}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function record(value) {
|
|
762
|
+
if (slot.disabled) return;
|
|
763
|
+
if (EXPIRES && Date.now() > EXPIRES) { slot.disabled = true; return; }
|
|
764
|
+
// Full: the oldest load gives way, so the page in front is always kept.
|
|
765
|
+
if (slot.records.length >= ${PAGE_BUFFER_LIMIT}) { slot.records.shift(); slot.dropped++; }
|
|
766
|
+
slot.records.push({
|
|
767
|
+
t: Math.round(performance.now()),
|
|
768
|
+
v: value,
|
|
769
|
+
load: currentLoad(),
|
|
770
|
+
url: currentUrl()
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
function guard(fn) {
|
|
775
|
+
return function () {
|
|
776
|
+
try { return fn.apply(this, arguments); }
|
|
777
|
+
catch (error) { slot.error = String((error && error.message) || error); }
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function summarise(value, depth) {
|
|
782
|
+
depth = depth || 0;
|
|
783
|
+
if (typeof value === "function") return "[function " + (value.name || "anonymous") + "]";
|
|
784
|
+
if (value && value.nodeType) return "[node " + value.nodeName + "]";
|
|
785
|
+
if (value === null || typeof value !== "object") {
|
|
786
|
+
return typeof value === "string" && value.length > 200 ? value.slice(0, 200) + "\\u2026" : value;
|
|
787
|
+
}
|
|
788
|
+
if (depth >= 3) return "[deep]";
|
|
789
|
+
if (Array.isArray(value)) return value.slice(0, 20).map(function (item) { return summarise(item, depth + 1); });
|
|
790
|
+
var out = {};
|
|
791
|
+
var keys = Object.keys(value).slice(0, 30);
|
|
792
|
+
for (var i = 0; i < keys.length; i++) {
|
|
793
|
+
try { out[keys[i]] = summarise(value[keys[i]], depth + 1); }
|
|
794
|
+
catch (error) { out[keys[i]] = "[unreadable]"; }
|
|
795
|
+
}
|
|
796
|
+
return out;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
function resolvePath(path) {
|
|
800
|
+
var parts = String(path).split(".");
|
|
801
|
+
var key = parts.pop();
|
|
802
|
+
var owner = window;
|
|
803
|
+
for (var i = 0; i < parts.length; i++) {
|
|
804
|
+
if (owner == null) return null;
|
|
805
|
+
owner = owner[parts[i]];
|
|
806
|
+
}
|
|
807
|
+
return owner == null ? null : { owner: owner, key: key };
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
function whenPresent(path, apply) {
|
|
811
|
+
var waited = 0;
|
|
812
|
+
(function attempt() {
|
|
813
|
+
if (slot.disabled) return;
|
|
814
|
+
var found = resolvePath(path);
|
|
815
|
+
if (found && found.owner[found.key] !== undefined) { guard(apply)(found); return; }
|
|
816
|
+
waited += 50;
|
|
817
|
+
if (waited > 10000) { record({ missing: path }); return; }
|
|
818
|
+
setTimeout(attempt, 50);
|
|
819
|
+
})();
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
try {${body}
|
|
823
|
+
} catch (error) {
|
|
824
|
+
slot.error = String((error && error.stack) || error);
|
|
825
|
+
}
|
|
826
|
+
})();
|
|
827
|
+
//# sourceURL=__sk-inject-${preload}.js
|
|
828
|
+
`;
|
|
829
|
+
}
|