@speedkit/cli 4.51.0-run-control.5 → 4.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +14 -1426
- package/dist/commands/diff.d.ts +1 -7
- package/dist/commands/diff.js +3 -9
- package/dist/commands/login.d.ts +0 -3
- package/dist/commands/login.js +3 -14
- package/dist/commands/onboarding.d.ts +0 -26
- package/dist/commands/onboarding.js +4 -221
- package/dist/commands/origin-request.d.ts +0 -4
- package/dist/commands/origin-request.js +0 -4
- package/dist/services/browser-fetch/device-emulation.d.ts +0 -11
- package/dist/services/browser-fetch/device-emulation.js +0 -14
- package/dist/services/bundler/bundle-service-factory.d.ts +3 -0
- package/dist/services/bundler/bundle-service-factory.js +5 -1
- package/dist/services/bundler/bundle-service.d.ts +10 -1
- package/dist/services/bundler/bundle-service.js +16 -1
- package/dist/services/bundler/error/packjockel-error.d.ts +3 -0
- package/dist/services/bundler/error/packjockel-error.js +3 -0
- package/dist/services/bundler/index.d.ts +1 -0
- package/dist/services/bundler/index.js +1 -0
- package/dist/services/bundler/packjockel-service.d.ts +112 -0
- package/dist/services/bundler/packjockel-service.js +202 -0
- package/dist/services/bundler/spec/packjockel-service.spec.js +186 -0
- package/dist/services/cli/cli-environment-factory.d.ts +0 -3
- package/dist/services/cli/cli-environment-factory.js +0 -1
- package/dist/services/cli/cli-service-build-context.d.ts +0 -3
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +10 -29
- package/dist/services/cli/cli-service.d.ts +11 -60
- package/dist/services/cli/cli-service.js +32 -196
- package/dist/services/cli/index.d.ts +0 -2
- package/dist/services/cli/index.js +0 -2
- package/dist/services/cli/spec/cli-service.spec.js +50 -113
- package/dist/services/deploy/checks/activation/customer-approval-check.js +1 -1
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +2 -3
- package/dist/services/deploy/checks/pre-deploy/split-change-check.js +2 -3
- package/dist/services/deploy/handler/customer-config-handler.d.ts +9 -0
- package/dist/services/deploy/handler/customer-config-handler.js +41 -6
- package/dist/services/deploy/interface/install.d.ts +7 -1
- package/dist/services/deploy/mr/live-state-check.js +21 -2
- package/dist/services/deploy/policy/auto-deploy-policy.js +2 -0
- package/dist/services/deploy/policy/deploy-policy-model.d.ts +4 -0
- package/dist/services/deploy/policy/deploy-policy-model.js +4 -0
- package/dist/services/deploy/policy/testing-deploy-policy.js +2 -0
- package/dist/services/deploy/spec/handler/customer-config-handler.spec.js +98 -0
- package/dist/services/deploy/spec/mr/live-state-check.spec.js +45 -4
- package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +2 -0
- package/dist/services/deploy/spec/policy/testing-deploy-policy.spec.js +3 -1
- package/dist/services/diff/diff-service-build-context.d.ts +0 -12
- package/dist/services/diff/diff-service-build-context.js +1 -45
- package/dist/services/diff/diff-service-factory.d.ts +0 -2
- package/dist/services/diff/diff-service-factory.js +25 -65
- package/dist/services/diff/diff-service.d.ts +0 -11
- package/dist/services/diff/diff-service.js +11 -37
- package/dist/services/diff/page-source.d.ts +0 -12
- package/dist/services/diff/page-source.js +11 -16
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +2 -3
- package/dist/services/diff/sinks/tool-diff-sink.js +2 -3
- package/dist/services/diff/spec/diff-service-build-context.spec.js +0 -19
- package/dist/services/diff/spec/diff-service.spec.js +0 -95
- package/dist/services/document-handler-runtime/document-handler-browser-mock.d.ts +13 -0
- package/dist/services/document-handler-runtime/document-handler-browser-mock.js +69 -0
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +27 -0
- package/dist/services/document-handler-runtime/document-handler-server.js +112 -19
- package/dist/services/document-handler-runtime/spec/document-handler-browser-mock.spec.js +34 -0
- package/dist/services/git/git-repository.d.ts +0 -2
- package/dist/services/git/git-repository.js +0 -6
- package/dist/services/integration-api/customer-config-flags.js +0 -1
- package/dist/services/integration-api/integration-api-model.d.ts +4 -1
- package/dist/services/integration-api/spec/customer-config-file.spec.js +56 -0
- package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +68 -8
- package/dist/services/integration-api/struct/customer-config-file.d.ts +15 -0
- package/dist/services/integration-api/struct/customer-config-file.js +42 -0
- package/dist/services/integration-api/struct/customer-config.d.ts +55 -1
- package/dist/services/integration-api/struct/customer-config.js +70 -3
- package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +11 -4
- package/dist/services/integration-api/struct/speed-kit-config-file.js +31 -10
- package/dist/services/onboarding/browse/browse-service.d.ts +1 -13
- package/dist/services/onboarding/browse/browse-service.js +7 -43
- package/dist/services/onboarding/browser/baqend-response.d.ts +1 -17
- package/dist/services/onboarding/browser/baqend-response.js +0 -23
- package/dist/services/onboarding/browser/emulate-device.d.ts +1 -12
- package/dist/services/onboarding/browser/emulate-device.js +13 -68
- package/dist/services/onboarding/browser/executable/executable-validator.js +2 -4
- package/dist/services/onboarding/browser/extension/extension-bridge.js +3 -5
- package/dist/services/onboarding/browser/extension/extension-downloader.js +8 -17
- package/dist/services/onboarding/browser/extension/extension-validator.js +4 -9
- package/dist/services/onboarding/browser/launch-browser.d.ts +1 -2
- package/dist/services/onboarding/browser/launch-browser.js +1 -6
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +2 -0
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +29 -8
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -3
- package/dist/services/onboarding/dashboard/index.js +2 -7
- package/dist/services/onboarding/fetch-event-handler.d.ts +5 -24
- package/dist/services/onboarding/fetch-event-handler.js +32 -103
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +2 -11
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +0 -14
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +0 -30
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +3 -14
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +10 -29
- package/dist/services/onboarding/file-events/file-watcher.d.ts +4 -43
- package/dist/services/onboarding/file-events/file-watcher.js +21 -119
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +7 -40
- package/dist/services/onboarding/onboarding-model.js +9 -20
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +0 -4
- package/dist/services/onboarding/onboarding-service-build-context.js +1 -7
- package/dist/services/onboarding/onboarding-service-factory.d.ts +1 -17
- package/dist/services/onboarding/onboarding-service-factory.js +35 -152
- package/dist/services/onboarding/onboarding-service.d.ts +1 -40
- package/dist/services/onboarding/onboarding-service.js +23 -139
- package/dist/services/onboarding/request-cache/cache.d.ts +5 -62
- package/dist/services/onboarding/request-cache/cache.js +17 -128
- package/dist/services/onboarding/spec/file-events/file-watcher.spec.js +67 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +3 -39
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -25
- package/dist/services/onboarding/templates/install-speed-kit-js-template.js +5 -0
- package/dist/services/onboarding/todo-collector.d.ts +2 -7
- package/dist/services/onboarding/todo-collector.js +12 -49
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +0 -38
- package/dist/services/onboarding/virtual-orestes-app/index.js +27 -113
- package/dist/services/origin-request/asset-variations.d.ts +0 -14
- package/dist/services/origin-request/asset-variations.js +4 -11
- package/dist/services/origin-request/origin-fetcher.d.ts +0 -7
- package/dist/services/origin-request/origin-fetcher.js +5 -43
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +0 -17
- package/dist/services/origin-request/origin-request-service-build-context.js +0 -8
- package/dist/services/origin-request/origin-request-service-factory.d.ts +5 -0
- package/dist/services/origin-request/origin-request-service-factory.js +30 -2
- package/dist/services/origin-request/origin-request-service.d.ts +6 -121
- package/dist/services/origin-request/origin-request-service.js +49 -273
- package/dist/services/origin-request/runtime-config-source.d.ts +0 -6
- package/dist/services/origin-request/runtime-config-source.js +4 -15
- package/dist/services/origin-request/spec/asset-variations.spec.js +0 -20
- package/dist/services/origin-request/spec/origin-request-service.spec.js +6 -329
- package/dist/services/pull/pull-service.js +23 -5
- package/dist/services/query-builder/query-builder-factory.js +3 -3
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +288 -3409
- package/package.json +3 -20
- package/dist/base/run-control-command.d.ts +0 -15
- package/dist/base/run-control-command.js +0 -20
- package/dist/build-info.json +0 -6
- package/dist/commands/onboarding/browser/click.d.ts +0 -75
- package/dist/commands/onboarding/browser/click.js +0 -19
- package/dist/commands/onboarding/browser/emulate.d.ts +0 -105
- package/dist/commands/onboarding/browser/emulate.js +0 -26
- package/dist/commands/onboarding/browser/navigate.d.ts +0 -75
- package/dist/commands/onboarding/browser/navigate.js +0 -19
- package/dist/commands/onboarding/browser/panel.d.ts +0 -63
- package/dist/commands/onboarding/browser/panel.js +0 -12
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +0 -63
- package/dist/commands/onboarding/browser/reinstall-sw.js +0 -14
- package/dist/commands/onboarding/browser/reset.d.ts +0 -71
- package/dist/commands/onboarding/browser/reset.js +0 -18
- package/dist/commands/onboarding/browser/screenshot.d.ts +0 -77
- package/dist/commands/onboarding/browser/screenshot.js +0 -19
- package/dist/commands/onboarding/browser/state.d.ts +0 -63
- package/dist/commands/onboarding/browser/state.js +0 -12
- package/dist/commands/onboarding/browser/tabs.d.ts +0 -58
- package/dist/commands/onboarding/browser/tabs.js +0 -16
- package/dist/commands/onboarding/cache/clear.d.ts +0 -58
- package/dist/commands/onboarding/cache/clear.js +0 -12
- package/dist/commands/onboarding/cache/errors.d.ts +0 -58
- package/dist/commands/onboarding/cache/errors.js +0 -12
- package/dist/commands/onboarding/cache/evict.d.ts +0 -62
- package/dist/commands/onboarding/cache/evict.js +0 -15
- package/dist/commands/onboarding/cache/get.d.ts +0 -85
- package/dist/commands/onboarding/cache/get.js +0 -17
- package/dist/commands/onboarding/cache/list.d.ts +0 -58
- package/dist/commands/onboarding/cache/list.js +0 -15
- package/dist/commands/onboarding/cache/prewarm.d.ts +0 -73
- package/dist/commands/onboarding/cache/prewarm.js +0 -20
- package/dist/commands/onboarding/cache/refresh.d.ts +0 -62
- package/dist/commands/onboarding/cache/refresh.js +0 -18
- package/dist/commands/onboarding/cdp.d.ts +0 -81
- package/dist/commands/onboarding/cdp.js +0 -18
- package/dist/commands/onboarding/debug/arm.d.ts +0 -83
- package/dist/commands/onboarding/debug/arm.js +0 -19
- package/dist/commands/onboarding/debug/await.d.ts +0 -71
- package/dist/commands/onboarding/debug/await.js +0 -18
- package/dist/commands/onboarding/debug/disarm.d.ts +0 -63
- package/dist/commands/onboarding/debug/disarm.js +0 -12
- package/dist/commands/onboarding/debug/eval.d.ts +0 -75
- package/dist/commands/onboarding/debug/eval.js +0 -16
- package/dist/commands/onboarding/debug/release.d.ts +0 -63
- package/dist/commands/onboarding/debug/release.js +0 -12
- package/dist/commands/onboarding/debug/resume.d.ts +0 -63
- package/dist/commands/onboarding/debug/resume.js +0 -12
- package/dist/commands/onboarding/debug/status.d.ts +0 -63
- package/dist/commands/onboarding/debug/status.js +0 -12
- package/dist/commands/onboarding/debug/step.d.ts +0 -67
- package/dist/commands/onboarding/debug/step.js +0 -15
- package/dist/commands/onboarding/files/list.d.ts +0 -58
- package/dist/commands/onboarding/files/list.js +0 -12
- package/dist/commands/onboarding/files/read.d.ts +0 -73
- package/dist/commands/onboarding/files/read.js +0 -16
- package/dist/commands/onboarding/files/rebuild.d.ts +0 -63
- package/dist/commands/onboarding/files/rebuild.js +0 -18
- package/dist/commands/onboarding/files/validate.d.ts +0 -58
- package/dist/commands/onboarding/files/validate.js +0 -12
- package/dist/commands/onboarding/fouc.d.ts +0 -77
- package/dist/commands/onboarding/fouc.js +0 -16
- package/dist/commands/onboarding/inject/add.d.ts +0 -89
- package/dist/commands/onboarding/inject/add.js +0 -17
- package/dist/commands/onboarding/inject/clear.d.ts +0 -63
- package/dist/commands/onboarding/inject/clear.js +0 -12
- package/dist/commands/onboarding/inject/list.d.ts +0 -63
- package/dist/commands/onboarding/inject/list.js +0 -12
- package/dist/commands/onboarding/inject/read.d.ts +0 -75
- package/dist/commands/onboarding/inject/read.js +0 -18
- package/dist/commands/onboarding/inject/recipes.d.ts +0 -63
- package/dist/commands/onboarding/inject/recipes.js +0 -12
- package/dist/commands/onboarding/inject/remove.d.ts +0 -67
- package/dist/commands/onboarding/inject/remove.js +0 -15
- package/dist/commands/onboarding/list.d.ts +0 -13
- package/dist/commands/onboarding/list.js +0 -12
- package/dist/commands/onboarding/logs.d.ts +0 -41
- package/dist/commands/onboarding/logs.js +0 -257
- package/dist/commands/onboarding/navwalk.d.ts +0 -95
- package/dist/commands/onboarding/navwalk.js +0 -19
- package/dist/commands/onboarding/response.d.ts +0 -67
- package/dist/commands/onboarding/response.js +0 -18
- package/dist/commands/onboarding/rum/beacons.d.ts +0 -75
- package/dist/commands/onboarding/rum/beacons.js +0 -16
- package/dist/commands/onboarding/rum/get.d.ts +0 -77
- package/dist/commands/onboarding/rum/get.js +0 -18
- package/dist/commands/onboarding/rum/key.d.ts +0 -67
- package/dist/commands/onboarding/rum/key.js +0 -13
- package/dist/commands/onboarding/rum/previous.d.ts +0 -63
- package/dist/commands/onboarding/rum/previous.js +0 -12
- package/dist/commands/onboarding/status.d.ts +0 -13
- package/dist/commands/onboarding/status.js +0 -17
- package/dist/commands/onboarding/stop.d.ts +0 -13
- package/dist/commands/onboarding/stop.js +0 -17
- package/dist/commands/onboarding/todo.d.ts +0 -58
- package/dist/commands/onboarding/todo.js +0 -12
- package/dist/commands/onboarding/viewport.d.ts +0 -101
- package/dist/commands/onboarding/viewport.js +0 -18
- package/dist/commands/onboarding/watch.d.ts +0 -93
- package/dist/commands/onboarding/watch.js +0 -16
- package/dist/commands/spec/onboarding.spec.js +0 -127
- package/dist/services/cli/build-info.d.ts +0 -33
- package/dist/services/cli/build-info.js +0 -63
- package/dist/services/cli/sink.d.ts +0 -47
- package/dist/services/cli/sink.js +0 -31
- package/dist/services/cli/spec/build-identity.spec.js +0 -85
- package/dist/services/cli/spec/build-info.spec.js +0 -10
- package/dist/services/cli/spec/cli-service-log.spec.js +0 -133
- package/dist/services/cli/spec/memory-cli.d.ts +0 -9
- package/dist/services/cli/spec/memory-cli.js +0 -9
- package/dist/services/diff/config-at-ref.d.ts +0 -20
- package/dist/services/diff/config-at-ref.js +0 -33
- package/dist/services/diff/run-runtime-config.d.ts +0 -33
- package/dist/services/diff/run-runtime-config.js +0 -74
- package/dist/services/diff/spec/config-at-ref.spec.js +0 -46
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +0 -1
- package/dist/services/diff/spec/run-runtime-config.spec.js +0 -87
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +0 -12
- package/dist/services/onboarding/browser/answer-dialogs.js +0 -25
- package/dist/services/onboarding/browser/console-log.d.ts +0 -9
- package/dist/services/onboarding/browser/console-log.js +0 -27
- package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +0 -14
- package/dist/services/onboarding/browser/resume-restarted-workers.js +0 -26
- package/dist/services/onboarding/control/body-inspect.d.ts +0 -24
- package/dist/services/onboarding/control/body-inspect.js +0 -106
- package/dist/services/onboarding/control/browser-session.d.ts +0 -547
- package/dist/services/onboarding/control/browser-session.js +0 -1337
- package/dist/services/onboarding/control/config-validation.d.ts +0 -17
- package/dist/services/onboarding/control/config-validation.js +0 -46
- package/dist/services/onboarding/control/control-protocol.d.ts +0 -1430
- package/dist/services/onboarding/control/control-protocol.js +0 -58
- package/dist/services/onboarding/control/control-server.d.ts +0 -292
- package/dist/services/onboarding/control/control-server.js +0 -1629
- package/dist/services/onboarding/control/debug-session.d.ts +0 -219
- package/dist/services/onboarding/control/debug-session.js +0 -897
- package/dist/services/onboarding/control/fouc.d.ts +0 -23
- package/dist/services/onboarding/control/fouc.js +0 -151
- package/dist/services/onboarding/control/index.d.ts +0 -4
- package/dist/services/onboarding/control/index.js +0 -4
- package/dist/services/onboarding/control/navigate-wait.d.ts +0 -33
- package/dist/services/onboarding/control/navigate-wait.js +0 -56
- package/dist/services/onboarding/control/navwalk.d.ts +0 -65
- package/dist/services/onboarding/control/navwalk.js +0 -248
- package/dist/services/onboarding/control/preload-registry.d.ts +0 -150
- package/dist/services/onboarding/control/preload-registry.js +0 -829
- package/dist/services/onboarding/control/response-explainer.d.ts +0 -24
- package/dist/services/onboarding/control/response-explainer.js +0 -257
- package/dist/services/onboarding/control/rum.d.ts +0 -8
- package/dist/services/onboarding/control/rum.js +0 -220
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +0 -68
- package/dist/services/onboarding/control/service-worker-tracker.js +0 -120
- package/dist/services/onboarding/control/viewport.d.ts +0 -45
- package/dist/services/onboarding/control/viewport.js +0 -344
- package/dist/services/onboarding/control/watch.d.ts +0 -26
- package/dist/services/onboarding/control/watch.js +0 -157
- package/dist/services/onboarding/request-cache/asset-key.d.ts +0 -61
- package/dist/services/onboarding/request-cache/asset-key.js +0 -115
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +0 -66
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/browser/console-log.spec.js +0 -42
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +0 -45
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/browser-session.spec.js +0 -753
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/control-server.spec.js +0 -371
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/debug-session.spec.js +0 -751
- package/dist/services/onboarding/spec/control/fakes.d.ts +0 -31
- package/dist/services/onboarding/spec/control/fakes.js +0 -67
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/fouc.spec.js +0 -167
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +0 -47
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/navwalk.spec.js +0 -222
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +0 -432
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +0 -324
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/rum.spec.js +0 -222
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +0 -193
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/viewport.spec.js +0 -200
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/watch.spec.js +0 -187
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +0 -219
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +0 -41
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +0 -107
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/todo-collector.spec.js +0 -136
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +0 -65
- package/dist/services/query-builder/rules/rule-match.d.ts +0 -35
- package/dist/services/query-builder/rules/rule-match.js +0 -70
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +0 -1
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +0 -121
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +0 -557
- package/dist/services/run-control/browser/run-browser-contexts.js +0 -91
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +0 -5
- package/dist/services/run-control/browser/run-browser-service-factory.js +0 -7
- package/dist/services/run-control/browser/run-browser-service.d.ts +0 -68
- package/dist/services/run-control/browser/run-browser-service.js +0 -206
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +0 -349
- package/dist/services/run-control/cache/run-cache-contexts.js +0 -51
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +0 -6
- package/dist/services/run-control/cache/run-cache-service-factory.js +0 -12
- package/dist/services/run-control/cache/run-cache-service.d.ts +0 -35
- package/dist/services/run-control/cache/run-cache-service.js +0 -151
- package/dist/services/run-control/control-client.d.ts +0 -36
- package/dist/services/run-control/control-client.js +0 -147
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +0 -416
- package/dist/services/run-control/debug/run-debug-contexts.js +0 -47
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +0 -5
- package/dist/services/run-control/debug/run-debug-service-factory.js +0 -7
- package/dist/services/run-control/debug/run-debug-service.d.ts +0 -39
- package/dist/services/run-control/debug/run-debug-service.js +0 -164
- package/dist/services/run-control/files/run-files-contexts.d.ts +0 -238
- package/dist/services/run-control/files/run-files-contexts.js +0 -26
- package/dist/services/run-control/files/run-files-service-factory.d.ts +0 -5
- package/dist/services/run-control/files/run-files-service-factory.js +0 -7
- package/dist/services/run-control/files/run-files-service.d.ts +0 -29
- package/dist/services/run-control/files/run-files-service.js +0 -120
- package/dist/services/run-control/index.d.ts +0 -32
- package/dist/services/run-control/index.js +0 -31
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +0 -319
- package/dist/services/run-control/inject/run-inject-contexts.js +0 -38
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +0 -5
- package/dist/services/run-control/inject/run-inject-service-factory.js +0 -7
- package/dist/services/run-control/inject/run-inject-service.d.ts +0 -31
- package/dist/services/run-control/inject/run-inject-service.js +0 -227
- package/dist/services/run-control/live-run.d.ts +0 -37
- package/dist/services/run-control/live-run.js +0 -56
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +0 -333
- package/dist/services/run-control/probe/run-probe-contexts.js +0 -73
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +0 -5
- package/dist/services/run-control/probe/run-probe-service-factory.js +0 -7
- package/dist/services/run-control/probe/run-probe-service.d.ts +0 -54
- package/dist/services/run-control/probe/run-probe-service.js +0 -194
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +0 -216
- package/dist/services/run-control/rum/run-rum-contexts.js +0 -34
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +0 -5
- package/dist/services/run-control/rum/run-rum-service-factory.js +0 -7
- package/dist/services/run-control/rum/run-rum-service.d.ts +0 -36
- package/dist/services/run-control/rum/run-rum-service.js +0 -122
- package/dist/services/run-control/run-answer.d.ts +0 -28
- package/dist/services/run-control/run-answer.js +0 -58
- package/dist/services/run-control/run-control-context.d.ts +0 -102
- package/dist/services/run-control/run-control-context.js +0 -36
- package/dist/services/run-control/run-control-flags.d.ts +0 -12
- package/dist/services/run-control/run-control-flags.js +0 -22
- package/dist/services/run-control/run-control-model.d.ts +0 -9
- package/dist/services/run-control/run-control-model.js +0 -1
- package/dist/services/run-control/run-control-service-factory.d.ts +0 -14
- package/dist/services/run-control/run-control-service-factory.js +0 -26
- package/dist/services/run-control/session/run-session-contexts.d.ts +0 -25
- package/dist/services/run-control/session/run-session-contexts.js +0 -20
- package/dist/services/run-control/session/run-session-service-factory.d.ts +0 -8
- package/dist/services/run-control/session/run-session-service-factory.js +0 -18
- package/dist/services/run-control/session/run-session-service.d.ts +0 -32
- package/dist/services/run-control/session/run-session-service.js +0 -151
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +0 -328
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +0 -454
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +0 -113
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/files/run-files-service.spec.js +0 -234
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +0 -251
- package/dist/services/run-control/spec/live-run-fixture.d.ts +0 -32
- package/dist/services/run-control/spec/live-run-fixture.js +0 -109
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +0 -108
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +0 -47
- package/dist/services/run-control/spec/run-answer.spec.d.ts +0 -1
- package/dist/services/run-control/spec/run-answer.spec.js +0 -57
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/session/run-session-service.spec.js +0 -150
- package/dist/services/run-log/crash-mirror.d.ts +0 -31
- package/dist/services/run-log/crash-mirror.js +0 -69
- package/dist/services/run-log/index.d.ts +0 -11
- package/dist/services/run-log/index.js +0 -11
- package/dist/services/run-log/jsonl-appender.d.ts +0 -46
- package/dist/services/run-log/jsonl-appender.js +0 -91
- package/dist/services/run-log/log-event-model.d.ts +0 -104
- package/dist/services/run-log/log-event-model.js +0 -56
- package/dist/services/run-log/log-query-service-factory.d.ts +0 -11
- package/dist/services/run-log/log-query-service-factory.js +0 -14
- package/dist/services/run-log/log-query-service.d.ts +0 -59
- package/dist/services/run-log/log-query-service.js +0 -111
- package/dist/services/run-log/log-reader.d.ts +0 -84
- package/dist/services/run-log/log-reader.js +0 -180
- package/dist/services/run-log/log-summary.d.ts +0 -72
- package/dist/services/run-log/log-summary.js +0 -208
- package/dist/services/run-log/redaction.d.ts +0 -34
- package/dist/services/run-log/redaction.js +0 -124
- package/dist/services/run-log/request-log.d.ts +0 -82
- package/dist/services/run-log/request-log.js +0 -69
- package/dist/services/run-log/request-summary.d.ts +0 -76
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +0 -61
- package/dist/services/run-log/run-log.js +0 -102
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +0 -1
- package/dist/services/run-log/spec/log-query-service.spec.js +0 -197
- package/dist/services/run-log/spec/log-reader.spec.d.ts +0 -1
- package/dist/services/run-log/spec/log-reader.spec.js +0 -109
- package/dist/services/run-log/spec/log-summary.spec.d.ts +0 -1
- package/dist/services/run-log/spec/log-summary.spec.js +0 -153
- package/dist/services/run-log/spec/redaction.spec.d.ts +0 -1
- package/dist/services/run-log/spec/redaction.spec.js +0 -61
- package/dist/services/run-log/spec/request-log.spec.d.ts +0 -1
- package/dist/services/run-log/spec/request-log.spec.js +0 -101
- package/dist/services/run-log/spec/request-summary.spec.d.ts +0 -1
- package/dist/services/run-log/spec/request-summary.spec.js +0 -171
- package/dist/services/run-log/spec/run-log.spec.d.ts +0 -1
- package/dist/services/run-log/spec/run-log.spec.js +0 -122
- package/dist/services/run-registry/exit-classification.d.ts +0 -39
- package/dist/services/run-registry/exit-classification.js +0 -42
- package/dist/services/run-registry/index.d.ts +0 -3
- package/dist/services/run-registry/index.js +0 -3
- package/dist/services/run-registry/process-identity.d.ts +0 -28
- package/dist/services/run-registry/process-identity.js +0 -80
- package/dist/services/run-registry/run-registry-model.d.ts +0 -128
- package/dist/services/run-registry/run-registry-model.js +0 -16
- package/dist/services/run-registry/run-registry.d.ts +0 -155
- package/dist/services/run-registry/run-registry.js +0 -430
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +0 -1
- package/dist/services/run-registry/spec/exit-classification.spec.js +0 -82
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +0 -1
- package/dist/services/run-registry/spec/run-registry.spec.js +0 -526
- /package/dist/{commands/spec/onboarding.spec.d.ts → services/bundler/spec/packjockel-service.spec.d.ts} +0 -0
- /package/dist/services/{cli/spec/build-identity.spec.d.ts → deploy/spec/handler/customer-config-handler.spec.d.ts} +0 -0
- /package/dist/services/{cli/spec/build-info.spec.d.ts → document-handler-runtime/spec/document-handler-browser-mock.spec.d.ts} +0 -0
- /package/dist/services/{cli/spec/cli-service-log.spec.d.ts → integration-api/spec/customer-config-file.spec.d.ts} +0 -0
- /package/dist/services/{diff/spec/config-at-ref.spec.d.ts → onboarding/spec/file-events/file-watcher.spec.d.ts} +0 -0
|
@@ -11,7 +11,6 @@ import { MissingCustomerPathError } from "../error/missing-customer-path-error.j
|
|
|
11
11
|
import { BrowserContext } from "../onboarding-model.js";
|
|
12
12
|
import { OnboardingServiceBuildContext, } from "../onboarding-service-build-context.js";
|
|
13
13
|
import { OnboardingServiceFactory } from "../onboarding-service-factory.js";
|
|
14
|
-
import { RunRegistry } from "../../run-registry/index.js";
|
|
15
14
|
const cli = new Proxy({}, {
|
|
16
15
|
get: (_target, property) => property === "nonInteractive" ? true : () => undefined,
|
|
17
16
|
});
|
|
@@ -44,7 +43,6 @@ function buildContext(values = {}) {
|
|
|
44
43
|
browserFetch: false,
|
|
45
44
|
browse: false,
|
|
46
45
|
inject: false,
|
|
47
|
-
logFile: false,
|
|
48
46
|
...values,
|
|
49
47
|
});
|
|
50
48
|
}
|
|
@@ -84,24 +82,6 @@ describe("OnboardingServiceFactory", () => {
|
|
|
84
82
|
customerChromeFlags: undefined,
|
|
85
83
|
});
|
|
86
84
|
});
|
|
87
|
-
it("serves run control on a recorded browse run", async () => {
|
|
88
|
-
const cacheDirectory = mkdtempSync(join(tmpdir(), "sk-browse-run-"));
|
|
89
|
-
const run = new RunRegistry(cacheDirectory).start({
|
|
90
|
-
domain: "www.example.com",
|
|
91
|
-
configName: "production",
|
|
92
|
-
cliVersion: "1.2.3",
|
|
93
|
-
flags: {
|
|
94
|
-
local: true,
|
|
95
|
-
headless: true,
|
|
96
|
-
useTestConfig: false,
|
|
97
|
-
ignoreContentSecurityPolicy: false,
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
const service = await new RecordingFactory(buildContext({ browse: true, domain: "www.example.com" }), run).getService();
|
|
101
|
-
const { controlServer } = service;
|
|
102
|
-
expect(controlServer?.socketPath).to.equal(join(run.dir, "control.sock"));
|
|
103
|
-
rmSync(cacheDirectory, { recursive: true, force: true });
|
|
104
|
-
});
|
|
105
85
|
it("fails in browse mode without a domain and without a CUSTOMERPATH", async () => {
|
|
106
86
|
const factory = new RecordingFactory(buildContext({ browse: true }));
|
|
107
87
|
const error = await factory.getService().catch((error_) => error_);
|
|
@@ -207,11 +187,7 @@ describe("OnboardingServiceFactory", () => {
|
|
|
207
187
|
});
|
|
208
188
|
}
|
|
209
189
|
it("keeps the extensions and a TCP debug port next to the pipe", () => {
|
|
210
|
-
const options = launchOptions({
|
|
211
|
-
browse: true,
|
|
212
|
-
headless: true,
|
|
213
|
-
debuggingPort: true,
|
|
214
|
-
});
|
|
190
|
+
const options = launchOptions({ browse: true, headless: true });
|
|
215
191
|
expect(options).to.include({ pipe: true, headless: true });
|
|
216
192
|
expect(options["enableExtensions"]).to.deep.equal([
|
|
217
193
|
"/tmp/sk-test-devtools",
|
|
@@ -5,6 +5,11 @@ export class InstallSpeedKitJsTemplate extends AbstractTemplate {
|
|
|
5
5
|
// Config
|
|
6
6
|
{{{config}}}
|
|
7
7
|
|
|
8
|
+
{{#if configPlugins}}
|
|
9
|
+
// The config writes SpeedKit.config, which packjockel exposes; the overrides below change it.
|
|
10
|
+
var speedKit = SpeedKit.config;
|
|
11
|
+
{{/if}}
|
|
12
|
+
|
|
8
13
|
// Reset potential split test parameters
|
|
9
14
|
speedKit.split = 1.0;
|
|
10
15
|
speedKit.splitTestId = 'debug';
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { InstallResourceInterface } from "../integration-api/integration-api-model.js";
|
|
2
2
|
export interface task {
|
|
3
3
|
todo: string;
|
|
4
|
-
/** The three lines beneath it, URI-encoded — see {@link TodoCollector}. */
|
|
5
4
|
context: string;
|
|
6
5
|
file: string;
|
|
7
6
|
line: number;
|
|
8
7
|
}
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Read by two consumers with different needs: the devtools panel, which the
|
|
13
|
-
* messages are shaped for, and `sk onboarding todo` over the control socket. `context` is
|
|
14
|
-
* URI-encoded because the panel's transport expects it that way; the control
|
|
15
|
-
* handler decodes it again rather than handing an agent percent-escapes.
|
|
9
|
+
* Represents a TodoCollector class that collects open tasks from files.
|
|
10
|
+
* This files will then be injected to the current open page, so you or the browser-extension can access and display them
|
|
16
11
|
*/
|
|
17
12
|
export declare class TodoCollector {
|
|
18
13
|
private files;
|
|
@@ -1,35 +1,8 @@
|
|
|
1
1
|
import { FILE_TYPE } from "../integration-api/index.js";
|
|
2
|
+
const TODO_MATCH = /(todo[^\n\r()|]*)((?:(?:\r\n|\r|\n)[^\n\r()|]*){3})/i;
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Global on purpose. It used to be matched with a non-global regex through
|
|
6
|
-
* `String.replace`, which calls its replacer once — so a file with four open
|
|
7
|
-
* tasks reported one, and the other three were invisible to both the devtools
|
|
8
|
-
* panel and anything else that asked.
|
|
9
|
-
*
|
|
10
|
-
* Three further things that each silently dropped a task, all of them found
|
|
11
|
-
* against a real config:
|
|
12
|
-
*
|
|
13
|
-
* - **The context is a lookahead.** Consuming the three lines moved
|
|
14
|
-
* `lastIndex` past them, so a second `TODO` written inside that window was
|
|
15
|
-
* swallowed into the first one's context and never reported. Two notes in a
|
|
16
|
-
* row is the ordinary way people write them.
|
|
17
|
-
* - **Parentheses are allowed.** The text and the context lines used to be
|
|
18
|
-
* `[^\n\r()|]*`, so a `(`, `)` or `|` anywhere in the task or in the three
|
|
19
|
-
* lines beneath it failed the whole match and the task vanished — and a JS
|
|
20
|
-
* config is full of them. `// TODO confirm the wishlist pattern` sitting one
|
|
21
|
-
* line above `/wish(-)?list/i` was invisible.
|
|
22
|
-
* - **Fewer than three lines is enough.** `{3}` required them, so a `TODO` in
|
|
23
|
-
* the last lines of a file matched nothing.
|
|
24
|
-
*/
|
|
25
|
-
const TODO_MATCH = /(todo[^\n\r]*)(?=((?:(?:\r\n|\r|\n)[^\n\r]*){0,3}))/gi;
|
|
26
|
-
/**
|
|
27
|
-
* Collects the open tasks written into a customer's config files.
|
|
28
|
-
*
|
|
29
|
-
* Read by two consumers with different needs: the devtools panel, which the
|
|
30
|
-
* messages are shaped for, and `sk onboarding todo` over the control socket. `context` is
|
|
31
|
-
* URI-encoded because the panel's transport expects it that way; the control
|
|
32
|
-
* handler decodes it again rather than handing an agent percent-escapes.
|
|
4
|
+
* Represents a TodoCollector class that collects open tasks from files.
|
|
5
|
+
* This files will then be injected to the current open page, so you or the browser-extension can access and display them
|
|
33
6
|
*/
|
|
34
7
|
export class TodoCollector {
|
|
35
8
|
files;
|
|
@@ -37,31 +10,21 @@ export class TodoCollector {
|
|
|
37
10
|
this.files = files;
|
|
38
11
|
}
|
|
39
12
|
getOpenTasks() {
|
|
40
|
-
const configFiles = this.files.filter((file) =>
|
|
13
|
+
const configFiles = this.files.filter((file) => {
|
|
14
|
+
return !(file.type === FILE_TYPE.VIRTUAL_FILE);
|
|
15
|
+
});
|
|
41
16
|
const tasks = [];
|
|
42
17
|
for (const configFile of configFiles) {
|
|
43
18
|
const content = configFile.getContent();
|
|
44
|
-
|
|
45
|
-
// calls, so sharing the constant would make every second file start
|
|
46
|
-
// matching from wherever the previous one stopped.
|
|
47
|
-
const pattern = new RegExp(TODO_MATCH.source, TODO_MATCH.flags);
|
|
48
|
-
let match;
|
|
49
|
-
while ((match = pattern.exec(content)) !== null) {
|
|
19
|
+
content.replace(TODO_MATCH, (taskString, task, taskContext) => {
|
|
50
20
|
tasks.push({
|
|
51
|
-
todo:
|
|
52
|
-
context: encodeURI(
|
|
21
|
+
todo: task,
|
|
22
|
+
context: encodeURI(taskContext),
|
|
53
23
|
file: configFile.path,
|
|
54
|
-
|
|
55
|
-
// TODOs in one file both reported the first one's line.
|
|
56
|
-
line: this.lineNumberByIndex(match.index, content),
|
|
24
|
+
line: this.lineNumber(task, content),
|
|
57
25
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// line — which is what leaves the lines beneath it open to match.
|
|
61
|
-
if (match.index === pattern.lastIndex) {
|
|
62
|
-
pattern.lastIndex += 1;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
26
|
+
return taskString;
|
|
27
|
+
});
|
|
65
28
|
}
|
|
66
29
|
return tasks;
|
|
67
30
|
}
|
|
@@ -5,7 +5,6 @@ import { Cache } from "../request-cache/cache.js";
|
|
|
5
5
|
import { CliServiceInterface } from "../../cli/index.js";
|
|
6
6
|
import { OriginFetcher } from "../../origin-request/index.js";
|
|
7
7
|
import { CustomerConfig } from "../../integration-api/index.js";
|
|
8
|
-
import { LocalCacheErrorEntry } from "../control/control-protocol.js";
|
|
9
8
|
import { DevtoolsExtensionApi } from "../browser/extension/devtools-extension-api.js";
|
|
10
9
|
export declare class VirtualOrestesApp {
|
|
11
10
|
private customerConfig;
|
|
@@ -17,30 +16,8 @@ export declare class VirtualOrestesApp {
|
|
|
17
16
|
private removeContentSecurityPolicy;
|
|
18
17
|
private localCacheErrors;
|
|
19
18
|
private prerendererHintShown;
|
|
20
|
-
/** The pages already reported as `break` pages, so each is reported once. */
|
|
21
|
-
private readonly breakPages;
|
|
22
19
|
constructor(customerConfig: CustomerConfig, originFetcher: OriginFetcher, documentHandler: DocumentHandlerServer, cache: Cache, cli: CliServiceInterface, developmentToolsMessages: DevtoolsExtensionApi, removeContentSecurityPolicy?: boolean);
|
|
23
20
|
fetchAssetResponse(event: Protocol.Fetch.RequestPausedEvent): Promise<Partial<Protocol.Fetch.FulfillRequestRequest> | AbortResponse>;
|
|
24
|
-
/** The variations the runtime config names: see {@link OriginFetcher.namedVariations}. */
|
|
25
|
-
namedVariations(): string[];
|
|
26
|
-
/**
|
|
27
|
-
* Build and cache one variation of a url without the browser asking for it.
|
|
28
|
-
*
|
|
29
|
-
* The same path a real asset request takes — {@link buildResponse} fetches
|
|
30
|
-
* the origin with the variation's headers, runs the documentHandler over it
|
|
31
|
-
* and caches the result — with the request synthesised rather than
|
|
32
|
-
* intercepted. That is what makes a variation reachable at all: a browser is
|
|
33
|
-
* one device at a time, so mobile and desktop can never both be in the cache
|
|
34
|
-
* from browsing, and the comparison everyone wants to make is between exactly
|
|
35
|
-
* those two.
|
|
36
|
-
*
|
|
37
|
-
* Throws what the build threw. The caller is asking for one specific entry,
|
|
38
|
-
* so a failure is the answer to its question, not a background detail —
|
|
39
|
-
* unlike {@link refreshEntry}, which is fire-and-forget and logs instead.
|
|
40
|
-
*
|
|
41
|
-
* @returns the cache key the entry was stored under.
|
|
42
|
-
*/
|
|
43
|
-
prewarm(originUrl: string, variation: string): Promise<string>;
|
|
44
21
|
/**
|
|
45
22
|
* Re-warm all cached entries for the given origin url in the background.
|
|
46
23
|
*
|
|
@@ -72,19 +49,6 @@ export declare class VirtualOrestesApp {
|
|
|
72
49
|
private refreshEntry;
|
|
73
50
|
private buildResponse;
|
|
74
51
|
private getResponseText;
|
|
75
|
-
/**
|
|
76
|
-
* The urls the local documentHandler could not build, as they stand now.
|
|
77
|
-
*
|
|
78
|
-
* Already collected for the devtools panel; this is the same list for a
|
|
79
|
-
* reader without one. State rather than history: an entry disappears once the
|
|
80
|
-
* same url and variation builds successfully, so an empty list means nothing
|
|
81
|
-
* is currently failing, not that nothing ever did.
|
|
82
|
-
*
|
|
83
|
-
* `occurredAt` is converted to ISO on the way out — the panel wants epoch
|
|
84
|
-
* milliseconds to sort by, a reader wants a timestamp it can compare against
|
|
85
|
-
* a log line.
|
|
86
|
-
*/
|
|
87
|
-
getLocalCacheErrors(): LocalCacheErrorEntry[];
|
|
88
52
|
private localCacheErrorKey;
|
|
89
53
|
private recordLocalCacheError;
|
|
90
54
|
private clearLocalCacheError;
|
|
@@ -96,8 +60,6 @@ export declare class VirtualOrestesApp {
|
|
|
96
60
|
* `ServerDocumentHandlerAbort`. Answering 500 instead makes the service worker treat
|
|
97
61
|
* the page as an infrastructure failure and disconnect Speed Kit.
|
|
98
62
|
*/
|
|
99
|
-
/** What Orestes answers for an undefined variation: the service worker serves from origin. */
|
|
100
|
-
private returnBreakResponse;
|
|
101
63
|
private returnAbortResponse;
|
|
102
64
|
private reportAbort;
|
|
103
65
|
private warnPrerendererUnreachable;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { assetOriginUrl, assetRequestUrl } from "../request-cache/asset-key.js";
|
|
2
1
|
import { BaqendResponse } from "../browser/baqend-response.js";
|
|
3
2
|
import { ABORT_SERVER_TIMING, ABORT_STATUS_CODE, isDocumentHandlerAbort, isLocalPrerendererUnreachable, LOCAL_PRERENDERER_PORT, prerenderFailure, } from "../../document-handler-runtime/document-handler-abort.js";
|
|
4
3
|
import { isBlockedOriginStatus, ORIGIN_ERROR_STATUS_CODE, originErrorCauseName, originErrorCode, originErrorServerTiming, } from "../../origin-request/index.js";
|
|
@@ -21,13 +20,6 @@ const SECURITY_HEADERS = [
|
|
|
21
20
|
"strict-transport-security",
|
|
22
21
|
"x-frame-options",
|
|
23
22
|
];
|
|
24
|
-
/**
|
|
25
|
-
* The reserved variation a `customVariation` returns to serve a page from origin. Orestes
|
|
26
|
-
* defines no such variation, so it answers a Bad Request and the service worker falls back.
|
|
27
|
-
*/
|
|
28
|
-
const BREAK_VARIATION = "break";
|
|
29
|
-
/** Orestes' `ServerVariationNotDefined`, the error code a `break` request gets. */
|
|
30
|
-
const VARIATION_NOT_DEFINED_CODE = "322";
|
|
31
23
|
export class VirtualOrestesApp {
|
|
32
24
|
customerConfig;
|
|
33
25
|
originFetcher;
|
|
@@ -43,8 +35,6 @@ export class VirtualOrestesApp {
|
|
|
43
35
|
localCacheErrors = new Map();
|
|
44
36
|
// The hint to start the pre-renderer is shown once; every later page gets one line.
|
|
45
37
|
prerendererHintShown = false;
|
|
46
|
-
/** The pages already reported as `break` pages, so each is reported once. */
|
|
47
|
-
breakPages = new Set();
|
|
48
38
|
constructor(customerConfig, originFetcher, documentHandler, cache, cli, developmentToolsMessages, removeContentSecurityPolicy = false) {
|
|
49
39
|
this.customerConfig = customerConfig;
|
|
50
40
|
this.originFetcher = originFetcher;
|
|
@@ -61,32 +51,6 @@ export class VirtualOrestesApp {
|
|
|
61
51
|
}
|
|
62
52
|
return this.buildResponse(event.request.url);
|
|
63
53
|
}
|
|
64
|
-
/** The variations the runtime config names: see {@link OriginFetcher.namedVariations}. */
|
|
65
|
-
namedVariations() {
|
|
66
|
-
return this.originFetcher.namedVariations();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Build and cache one variation of a url without the browser asking for it.
|
|
70
|
-
*
|
|
71
|
-
* The same path a real asset request takes — {@link buildResponse} fetches
|
|
72
|
-
* the origin with the variation's headers, runs the documentHandler over it
|
|
73
|
-
* and caches the result — with the request synthesised rather than
|
|
74
|
-
* intercepted. That is what makes a variation reachable at all: a browser is
|
|
75
|
-
* one device at a time, so mobile and desktop can never both be in the cache
|
|
76
|
-
* from browsing, and the comparison everyone wants to make is between exactly
|
|
77
|
-
* those two.
|
|
78
|
-
*
|
|
79
|
-
* Throws what the build threw. The caller is asking for one specific entry,
|
|
80
|
-
* so a failure is the answer to its question, not a background detail —
|
|
81
|
-
* unlike {@link refreshEntry}, which is fire-and-forget and logs instead.
|
|
82
|
-
*
|
|
83
|
-
* @returns the cache key the entry was stored under.
|
|
84
|
-
*/
|
|
85
|
-
async prewarm(originUrl, variation) {
|
|
86
|
-
const requestUrl = assetRequestUrl(this.customerConfig.appDomain, originUrl, variation);
|
|
87
|
-
await this.buildResponse(requestUrl);
|
|
88
|
-
return requestUrl;
|
|
89
|
-
}
|
|
90
54
|
/**
|
|
91
55
|
* Re-warm all cached entries for the given origin url in the background.
|
|
92
56
|
*
|
|
@@ -102,13 +66,10 @@ export class VirtualOrestesApp {
|
|
|
102
66
|
.map(([key]) => key)
|
|
103
67
|
.filter((key) => key.includes(originUrl));
|
|
104
68
|
if (matchingKeys.length === 0) {
|
|
105
|
-
this.cli.write(`changeDetection for url: ${originUrl} - nothing cached to refresh
|
|
69
|
+
this.cli.write(`changeDetection for url: ${originUrl} - nothing cached to refresh`);
|
|
106
70
|
return;
|
|
107
71
|
}
|
|
108
|
-
this.cli.write(`changeDetection triggered for url: ${originUrl} - refreshing dh-cache in background
|
|
109
|
-
scope: "cache",
|
|
110
|
-
data: { url: originUrl, refreshed: matchingKeys.length },
|
|
111
|
-
});
|
|
72
|
+
this.cli.write(`changeDetection triggered for url: ${originUrl} - refreshing dh-cache in background`);
|
|
112
73
|
for (const key of matchingKeys) {
|
|
113
74
|
await this.refreshEntry(key);
|
|
114
75
|
}
|
|
@@ -130,10 +91,7 @@ export class VirtualOrestesApp {
|
|
|
130
91
|
if (matchingKeys.length === 0) {
|
|
131
92
|
return;
|
|
132
93
|
}
|
|
133
|
-
this.cli.write(`refreshing ${matchingKeys.length} dh-cache entries for current url ${currentUrl} in background
|
|
134
|
-
scope: "cache",
|
|
135
|
-
data: { url: currentUrl, refreshed: matchingKeys.length },
|
|
136
|
-
});
|
|
94
|
+
this.cli.write(`refreshing ${matchingKeys.length} dh-cache entries for current url ${currentUrl} in background`);
|
|
137
95
|
for (const key of matchingKeys) {
|
|
138
96
|
await this.refreshEntry(key);
|
|
139
97
|
}
|
|
@@ -149,7 +107,7 @@ export class VirtualOrestesApp {
|
|
|
149
107
|
const result = await safe(this.buildResponse(requestUrl));
|
|
150
108
|
if (result.success === false) {
|
|
151
109
|
this.cache.removeEntry(requestUrl);
|
|
152
|
-
this.cli.writeError(`failed to refresh dh-cache entry ${requestUrl}: ${result.error}
|
|
110
|
+
this.cli.writeError(`failed to refresh dh-cache entry ${requestUrl}: ${result.error}`);
|
|
153
111
|
}
|
|
154
112
|
}
|
|
155
113
|
async buildResponse(requestUrl) {
|
|
@@ -158,10 +116,6 @@ export class VirtualOrestesApp {
|
|
|
158
116
|
const variation = UrlObject.searchParams.has("bqvariation")
|
|
159
117
|
? UrlObject.searchParams.get("bqvariation").trim()
|
|
160
118
|
: "default";
|
|
161
|
-
if (variation === BREAK_VARIATION &&
|
|
162
|
-
!this.originFetcher.namedVariations().includes(BREAK_VARIATION)) {
|
|
163
|
-
return this.returnBreakResponse(originUrl);
|
|
164
|
-
}
|
|
165
119
|
const fetchResult = await this.originFetcher.fetch(originUrl, variation);
|
|
166
120
|
const response = fetchResult?.response;
|
|
167
121
|
// URL we actually fetched (origin + variation query params); used for the redirect check below
|
|
@@ -191,7 +145,7 @@ export class VirtualOrestesApp {
|
|
|
191
145
|
if (!this.isHtmlContentHeader(response?.headers) ||
|
|
192
146
|
!this.isValidHtmlContent(responseContent)) {
|
|
193
147
|
const customResponse = new BaqendResponse(responseContent, `text/html; charset=${textEncoding}`, customHeaders);
|
|
194
|
-
this.cache.addEntry(requestUrl, customResponse
|
|
148
|
+
this.cache.addEntry(requestUrl, customResponse);
|
|
195
149
|
return customResponse;
|
|
196
150
|
}
|
|
197
151
|
const customResponse = await safe(this.documentHandler.transform(`text/html;charset=${textEncoding}`, responseContent, variation, originUrl, this.convertResponseHeadersToOrestesFormat(response)));
|
|
@@ -229,36 +183,16 @@ export class VirtualOrestesApp {
|
|
|
229
183
|
name: "x-sk-detected-encoding",
|
|
230
184
|
value: textEncoding,
|
|
231
185
|
});
|
|
232
|
-
|
|
233
|
-
const decodedBody = Buffer.isBuffer(skResponse.body)
|
|
186
|
+
const baqendResponse = new BaqendResponse(Buffer.isBuffer(skResponse.body)
|
|
234
187
|
? skResponse.body
|
|
235
|
-
: iconv.encode(skResponse.body, textEncoding);
|
|
236
|
-
|
|
237
|
-
this.cache.addEntry(requestUrl, baqendResponse, decodedBody);
|
|
188
|
+
: iconv.encode(skResponse.body, textEncoding), skResponse.headers["content-type"] ?? `text/html;charset=${textEncoding}`, [...customHeaders, ...originHeaders]);
|
|
189
|
+
this.cache.addEntry(requestUrl, baqendResponse);
|
|
238
190
|
return baqendResponse;
|
|
239
191
|
}
|
|
240
192
|
async getResponseText(response) {
|
|
241
193
|
const { text, charset } = decodeHtml(response?.headers.get("content-type") || "", Buffer.from(await response.arrayBuffer()));
|
|
242
194
|
return { responseContent: text, textEncoding: charset };
|
|
243
195
|
}
|
|
244
|
-
/**
|
|
245
|
-
* The urls the local documentHandler could not build, as they stand now.
|
|
246
|
-
*
|
|
247
|
-
* Already collected for the devtools panel; this is the same list for a
|
|
248
|
-
* reader without one. State rather than history: an entry disappears once the
|
|
249
|
-
* same url and variation builds successfully, so an empty list means nothing
|
|
250
|
-
* is currently failing, not that nothing ever did.
|
|
251
|
-
*
|
|
252
|
-
* `occurredAt` is converted to ISO on the way out — the panel wants epoch
|
|
253
|
-
* milliseconds to sort by, a reader wants a timestamp it can compare against
|
|
254
|
-
* a log line.
|
|
255
|
-
*/
|
|
256
|
-
getLocalCacheErrors() {
|
|
257
|
-
return [...this.localCacheErrors.values()].map((error) => ({
|
|
258
|
-
...error,
|
|
259
|
-
occurredAt: new Date(error.occurredAt).toISOString(),
|
|
260
|
-
}));
|
|
261
|
-
}
|
|
262
196
|
localCacheErrorKey(url, variation) {
|
|
263
197
|
return `${url}|${variation}`;
|
|
264
198
|
}
|
|
@@ -293,24 +227,6 @@ export class VirtualOrestesApp {
|
|
|
293
227
|
* `ServerDocumentHandlerAbort`. Answering 500 instead makes the service worker treat
|
|
294
228
|
* the page as an infrastructure failure and disconnect Speed Kit.
|
|
295
229
|
*/
|
|
296
|
-
/** What Orestes answers for an undefined variation: the service worker serves from origin. */
|
|
297
|
-
returnBreakResponse(originUrl) {
|
|
298
|
-
if (!this.breakPages.has(originUrl)) {
|
|
299
|
-
this.breakPages.add(originUrl);
|
|
300
|
-
this.cli.comment(`${originUrl} has the variation break: served from origin, not accelerated`, false, {
|
|
301
|
-
scope: "cache",
|
|
302
|
-
data: { url: originUrl, variation: BREAK_VARIATION },
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
const message = `Variation ${BREAK_VARIATION} not found.`;
|
|
306
|
-
return new BaqendResponse(message, null, [
|
|
307
|
-
{ name: "x-error", value: message },
|
|
308
|
-
{
|
|
309
|
-
name: "server-timing",
|
|
310
|
-
value: originErrorServerTiming(VARIATION_NOT_DEFINED_CODE),
|
|
311
|
-
},
|
|
312
|
-
], ORIGIN_ERROR_STATUS_CODE);
|
|
313
|
-
}
|
|
314
230
|
returnAbortResponse(customResponse, customHeaders) {
|
|
315
231
|
const message = customResponse.error;
|
|
316
232
|
this.reportAbort(message, customResponse.errorObj);
|
|
@@ -322,17 +238,13 @@ export class VirtualOrestesApp {
|
|
|
322
238
|
this.warnPrerendererUnreachable();
|
|
323
239
|
return;
|
|
324
240
|
}
|
|
325
|
-
const meta = {
|
|
326
|
-
scope: "documentHandler",
|
|
327
|
-
data: { aborted: true, status: ABORT_STATUS_CODE, error: message },
|
|
328
|
-
};
|
|
329
241
|
const failure = prerenderFailure(error);
|
|
330
242
|
if (failure) {
|
|
331
243
|
this.cli.writeError(`[DocumentHandler:local]: SSR failed for ${failure.url} (${failure.variation}): ` +
|
|
332
|
-
`${failure.detailMessage ?? "no error message"}
|
|
244
|
+
`${failure.detailMessage ?? "no error message"}`);
|
|
333
245
|
return;
|
|
334
246
|
}
|
|
335
|
-
this.cli.writeWarning(`[DocumentHandler:local]: ${message}
|
|
247
|
+
this.cli.writeWarning(`[DocumentHandler:local]: ${message}`);
|
|
336
248
|
}
|
|
337
249
|
warnPrerendererUnreachable() {
|
|
338
250
|
const unreachable = `no pre-renderer is listening on localhost:${LOCAL_PRERENDERER_PORT}`;
|
|
@@ -379,18 +291,9 @@ export class VirtualOrestesApp {
|
|
|
379
291
|
return this.returnAbortResponse(customResponse, customHeaders);
|
|
380
292
|
}
|
|
381
293
|
const message = `Could not transform html: - ${customResponse.error}`;
|
|
382
|
-
this.cli.writeError(`[VirtualOrestes]: ${message}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
error: customResponse.error,
|
|
386
|
-
stack: customResponse.errorObj.stack,
|
|
387
|
-
},
|
|
388
|
-
});
|
|
389
|
-
this.cli.comment(customResponse.errorObj.stack, false, {
|
|
390
|
-
scope: "documentHandler",
|
|
391
|
-
level: "debug",
|
|
392
|
-
});
|
|
393
|
-
this.cli.writeWarning("Suggestion: check files: config_documentHandler.es6 | custom_documentHandler.js", false, { scope: "documentHandler" });
|
|
294
|
+
this.cli.writeError(`[VirtualOrestes]: ${message}`);
|
|
295
|
+
this.cli.comment(customResponse.errorObj.stack);
|
|
296
|
+
this.cli.writeWarning("Suggestion: check files: config_documentHandler.es6 | custom_documentHandler.js");
|
|
394
297
|
customHeaders.push({ name: "x-error", value: message });
|
|
395
298
|
return new BaqendResponse(message, null, customHeaders, 500);
|
|
396
299
|
}
|
|
@@ -407,7 +310,7 @@ export class VirtualOrestesApp {
|
|
|
407
310
|
value: response?.headers.get("location") || "",
|
|
408
311
|
});
|
|
409
312
|
const redirectResponse = new BaqendResponse("", null, customHeaders, response.status);
|
|
410
|
-
this.cache.addEntry(requestUrl, redirectResponse
|
|
313
|
+
this.cache.addEntry(requestUrl, redirectResponse);
|
|
411
314
|
return redirectResponse;
|
|
412
315
|
}
|
|
413
316
|
handleCdnRedirect(customHeaders, response, requestUrl) {
|
|
@@ -425,11 +328,22 @@ export class VirtualOrestesApp {
|
|
|
425
328
|
// the CDN redirect surfaced as a bare ClientError (`AssetAPIHandler.ts:200-205`).
|
|
426
329
|
serverTimingHeader.value += ",errorcode;desc=202";
|
|
427
330
|
const redirectResponse = new BaqendResponse("", null, customHeaders, 400);
|
|
428
|
-
this.cache.addEntry(requestUrl, redirectResponse
|
|
331
|
+
this.cache.addEntry(requestUrl, redirectResponse);
|
|
429
332
|
return redirectResponse;
|
|
430
333
|
}
|
|
431
334
|
getAssetUrl(requestUrl) {
|
|
432
|
-
|
|
335
|
+
const url = new URL(requestUrl);
|
|
336
|
+
const parametersToDelete = [];
|
|
337
|
+
for (const [name] of url.searchParams.entries()) {
|
|
338
|
+
if (name.startsWith("bq")) {
|
|
339
|
+
parametersToDelete.push(name);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
for (const parameter of parametersToDelete) {
|
|
343
|
+
url.searchParams.delete(parameter);
|
|
344
|
+
}
|
|
345
|
+
const cleanedUrl = url.toString();
|
|
346
|
+
return cleanedUrl.split("app.baqend.com/v1/asset/")[1];
|
|
433
347
|
}
|
|
434
348
|
getCachedResponse(requestUrl) {
|
|
435
349
|
const response = this.cache.getEntry(requestUrl);
|
|
@@ -19,13 +19,6 @@ export interface AssetVariation {
|
|
|
19
19
|
regex?: string | null;
|
|
20
20
|
/** Which config key produced this entry. Set during resolution, for reporting. */
|
|
21
21
|
matchedKey?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Set during resolution, for reporting: the entry came from a regex key that
|
|
24
|
-
* matched the requested variation, not from a key of that name. Carried on
|
|
25
|
-
* the entry because only the resolution knows it — reading it back off the
|
|
26
|
-
* finished chain cannot tell a named key from a matched template.
|
|
27
|
-
*/
|
|
28
|
-
viaTemplate?: boolean;
|
|
29
22
|
}
|
|
30
23
|
export type AssetVariationMap = Record<string, AssetVariation>;
|
|
31
24
|
/** An entry of the runtime config's `speedKit.originMap`, keyed by origin or by host. */
|
|
@@ -55,13 +48,6 @@ export declare const DEFAULT_TYPE = "default";
|
|
|
55
48
|
export declare const DEFAULT_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15 (compatible; SpeedKit/1.0)";
|
|
56
49
|
export declare const MOBILE_USER_AGENT = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_6_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1 (compatible; SpeedKit/1.0)";
|
|
57
50
|
export declare const TABLET_USER_AGENT = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 (compatible; SpeedKit/1.0)";
|
|
58
|
-
/**
|
|
59
|
-
* The variation types the server resolves whether a config defines them or not.
|
|
60
|
-
*
|
|
61
|
-
* Exported because "which variations exist" is otherwise answered with the config's own keys alone,
|
|
62
|
-
* and a config that defines none reads as "nothing can be passed" while these three still work.
|
|
63
|
-
*/
|
|
64
|
-
export declare const DEVICE_DEFAULT_TYPES: string[];
|
|
65
51
|
/** Thrown where the server would throw UndefinedVariationException. */
|
|
66
52
|
export declare class UndefinedVariationError extends Error {
|
|
67
53
|
constructor(variationType: string);
|
|
@@ -22,13 +22,6 @@ const DEVICE_DEFAULTS = {
|
|
|
22
22
|
mobile: { headers: { "user-agent": MOBILE_USER_AGENT } },
|
|
23
23
|
tablet: { headers: { "user-agent": TABLET_USER_AGENT } },
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
26
|
-
* The variation types the server resolves whether a config defines them or not.
|
|
27
|
-
*
|
|
28
|
-
* Exported because "which variations exist" is otherwise answered with the config's own keys alone,
|
|
29
|
-
* and a config that defines none reads as "nothing can be passed" while these three still work.
|
|
30
|
-
*/
|
|
31
|
-
export const DEVICE_DEFAULT_TYPES = Object.keys(DEVICE_DEFAULTS);
|
|
32
25
|
/** Group names a template captures, e.g. `storeId` from `(?<storeId>.*)`. */
|
|
33
26
|
const CAPTURING_TEMPLATES = /<(\w+)>/g;
|
|
34
27
|
/** Thrown where the server would throw UndefinedVariationException. */
|
|
@@ -71,7 +64,6 @@ function applyTemplate(entry, variationType) {
|
|
|
71
64
|
};
|
|
72
65
|
return {
|
|
73
66
|
matchedKey: entry.matchedKey,
|
|
74
|
-
viaTemplate: true,
|
|
75
67
|
urlPrefix: entry.urlPrefix ? substitute(entry.urlPrefix) : entry.urlPrefix,
|
|
76
68
|
encodePrefixedUrl: entry.encodePrefixedUrl,
|
|
77
69
|
queryParams: (entry.queryParams ?? []).map(substitute),
|
|
@@ -188,15 +180,16 @@ export function resolveRequest(custom, url, variationType, { hostOverride, origi
|
|
|
188
180
|
const originalHost = originEntry?.origin && originEntry.overrideHostHeader
|
|
189
181
|
? parsed.hostname
|
|
190
182
|
: undefined;
|
|
183
|
+
const isTemplate = chain.some((config) => config.matchedKey !== WILD_CARD &&
|
|
184
|
+
!DEVICE_DEFAULTS[config.matchedKey ?? ""]) &&
|
|
185
|
+
!chain.some((config) => config.matchedKey?.startsWith("device-default:"));
|
|
191
186
|
const headers = buildHeaders(chain, hostOverride, originEntry, originalHost);
|
|
192
187
|
const originMapHeaders = Object.entries(originEntry?.headers ?? {})
|
|
193
188
|
.filter(([key, value]) => headers[key.toLowerCase()] === String(value))
|
|
194
189
|
.map(([key]) => key.toLowerCase());
|
|
195
190
|
return {
|
|
196
191
|
appliedKeys: chain.map((config) => config.matchedKey ?? "?"),
|
|
197
|
-
resolutionPath:
|
|
198
|
-
? "template"
|
|
199
|
-
: "named",
|
|
192
|
+
resolutionPath: isTemplate ? "template" : "named",
|
|
200
193
|
...(originMapKey ? { originMapKey, originMapHeaders } : {}),
|
|
201
194
|
url: buildUrl(requestUrl, chain),
|
|
202
195
|
headers,
|
|
@@ -35,13 +35,6 @@ export declare class OriginFetcher {
|
|
|
35
35
|
/** Warnings already shown, so a per-fetch condition is reported once per session. */
|
|
36
36
|
private readonly warned;
|
|
37
37
|
constructor(deps: OriginFetcherDeps);
|
|
38
|
-
/**
|
|
39
|
-
* The variations the runtime config names. The wildcard and the regex
|
|
40
|
-
* templates are not variations of their own, and the device defaults are
|
|
41
|
-
* left out: whether a config ever produces `tablet` is decided in the
|
|
42
|
-
* browser, by `detectDevice` or the user agent, and nothing here can tell.
|
|
43
|
-
*/
|
|
44
|
-
namedVariations(): string[];
|
|
45
38
|
/** The request, without sending it. */
|
|
46
39
|
prepare(originUrl: string, variation?: string): PreparedOriginRequest;
|
|
47
40
|
/**
|
|
@@ -18,18 +18,6 @@ export class OriginFetcher {
|
|
|
18
18
|
constructor(deps) {
|
|
19
19
|
this.deps = deps;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* The variations the runtime config names. The wildcard and the regex
|
|
23
|
-
* templates are not variations of their own, and the device defaults are
|
|
24
|
-
* left out: whether a config ever produces `tablet` is decided in the
|
|
25
|
-
* browser, by `detectDevice` or the user agent, and nothing here can tell.
|
|
26
|
-
*/
|
|
27
|
-
namedVariations() {
|
|
28
|
-
const variations = this.deps.config?.variations ?? {};
|
|
29
|
-
return Object.entries(variations)
|
|
30
|
-
.filter(([key, entry]) => key !== "*" && !key.startsWith("device-default:") && !entry?.regex)
|
|
31
|
-
.map(([key]) => key);
|
|
32
|
-
}
|
|
33
21
|
/** The request, without sending it. */
|
|
34
22
|
prepare(originUrl, variation) {
|
|
35
23
|
// A missing runtime config is not reported here; the load that failed says what it costs.
|
|
@@ -54,38 +42,15 @@ export class OriginFetcher {
|
|
|
54
42
|
async fetch(originUrl, variation) {
|
|
55
43
|
const { url, init } = this.prepare(originUrl, variation);
|
|
56
44
|
const action = `ORIGIN:FETCH:${randomUUID()}`;
|
|
57
|
-
this.deps.cli.startAction(action, `[documentHandler:fetch]: ${url}
|
|
58
|
-
scope: "documentHandler",
|
|
59
|
-
data: { url, originUrl, variation },
|
|
60
|
-
});
|
|
61
|
-
const startedAt = Date.now();
|
|
45
|
+
this.deps.cli.startAction(action, `[documentHandler:fetch]: ${url}`);
|
|
62
46
|
try {
|
|
63
47
|
const response = await originFetch(url, init);
|
|
64
|
-
this.deps.cli.successAction(action
|
|
65
|
-
scope: "documentHandler",
|
|
66
|
-
data: {
|
|
67
|
-
url,
|
|
68
|
-
variation,
|
|
69
|
-
status: response.status,
|
|
70
|
-
durationMs: Date.now() - startedAt,
|
|
71
|
-
},
|
|
72
|
-
});
|
|
48
|
+
this.deps.cli.successAction(action);
|
|
73
49
|
return { response, url };
|
|
74
50
|
}
|
|
75
51
|
catch (error) {
|
|
76
|
-
this.deps.cli.failAction(action, `error while fetching Asset: ${originUrl}
|
|
77
|
-
|
|
78
|
-
data: {
|
|
79
|
-
url,
|
|
80
|
-
originUrl,
|
|
81
|
-
variation,
|
|
82
|
-
durationMs: Date.now() - startedAt,
|
|
83
|
-
error: String(error),
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
this.deps.cli.writeError(String(error), false, {
|
|
87
|
-
scope: "documentHandler",
|
|
88
|
-
});
|
|
52
|
+
this.deps.cli.failAction(action, `error while fetching Asset: ${originUrl}`);
|
|
53
|
+
this.deps.cli.writeError(String(error));
|
|
89
54
|
return undefined;
|
|
90
55
|
}
|
|
91
56
|
}
|
|
@@ -129,9 +94,6 @@ export class OriginFetcher {
|
|
|
129
94
|
if (this.warned.has(key))
|
|
130
95
|
return;
|
|
131
96
|
this.warned.add(key);
|
|
132
|
-
this.deps.cli.writeWarning(message
|
|
133
|
-
scope: "documentHandler",
|
|
134
|
-
data: { once: key },
|
|
135
|
-
});
|
|
97
|
+
this.deps.cli.writeWarning(message);
|
|
136
98
|
}
|
|
137
99
|
}
|