@speedkit/cli 3.43.1 → 4.0.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 +38 -0
- package/README.md +6 -6
- package/bin/dev +2 -15
- package/bin/run +2 -2
- package/dist/commands/build-parameter-query.d.ts +3 -3
- package/dist/commands/build-parameter-query.js +12 -15
- package/dist/commands/build-prewarm-query.d.ts +4 -4
- package/dist/commands/build-prewarm-query.js +13 -16
- package/dist/commands/config/edit.js +7 -11
- package/dist/commands/deploy.d.ts +3 -5
- package/dist/commands/deploy.js +12 -16
- package/dist/commands/diff-url-parameters.d.ts +3 -3
- package/dist/commands/diff-url-parameters.js +27 -30
- package/dist/commands/document-handler.d.ts +4 -4
- package/dist/commands/document-handler.js +13 -17
- package/dist/commands/find-pops.d.ts +2 -2
- package/dist/commands/find-pops.js +22 -24
- package/dist/commands/generate-customer-config.d.ts +2 -2
- package/dist/commands/generate-customer-config.js +13 -16
- package/dist/commands/generate-pop-config.d.ts +7 -7
- package/dist/commands/generate-pop-config.js +32 -41
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.js +13 -17
- package/dist/commands/onboarding.d.ts +3 -5
- package/dist/commands/onboarding.js +10 -13
- package/dist/commands/prewarm.d.ts +9 -9
- package/dist/commands/prewarm.js +25 -28
- package/dist/commands/pull.d.ts +3 -3
- package/dist/commands/pull.js +11 -14
- package/dist/commands/wpt-launcher.d.ts +7 -7
- package/dist/commands/wpt-launcher.js +21 -26
- package/dist/helpers/array-helper.js +1 -4
- package/dist/helpers/build-query-helper.js +5 -12
- package/dist/helpers/cli-config.d.ts +3 -3
- package/dist/helpers/cli-config.js +11 -16
- package/dist/helpers/customer-config.d.ts +4 -8
- package/dist/helpers/customer-config.js +18 -23
- package/dist/helpers/evaluate-speed-kit-config.d.ts +1 -1
- package/dist/helpers/evaluate-speed-kit-config.js +42 -26
- package/dist/helpers/file-helper.js +8 -13
- package/dist/helpers/get-parsed-config.d.ts +1 -1
- package/dist/helpers/get-parsed-config.js +6 -10
- package/dist/helpers/html-format-helper.js +3 -6
- package/dist/helpers/is-directory.js +3 -6
- package/dist/helpers/is-file.js +3 -6
- package/dist/helpers/logging-helper.js +7 -13
- package/dist/helpers/normalize.js +10 -17
- package/dist/helpers/race.d.ts +1 -1
- package/dist/helpers/race.js +3 -9
- package/dist/helpers/safe.js +1 -4
- package/dist/helpers/scrape.d.ts +1 -1
- package/dist/helpers/scrape.js +3 -7
- package/dist/helpers/site-analyzer.js +5 -9
- package/dist/helpers/speed-kit-rule-to-reg-exp.js +1 -4
- package/dist/models/cli-parameters.d.ts +4 -4
- package/dist/models/cli-parameters.js +13 -16
- package/dist/models/files.js +1 -4
- package/dist/models/install.js +1 -2
- package/dist/models/os.js +1 -4
- package/dist/services/athena/athena-service-factory.d.ts +1 -1
- package/dist/services/athena/athena-service-factory.js +15 -19
- package/dist/services/athena/athena-service-model.js +2 -5
- package/dist/services/athena/athena-service.d.ts +1 -1
- package/dist/services/athena/athena-service.js +18 -23
- package/dist/services/athena/error/athena-query-error.d.ts +1 -1
- package/dist/services/athena/error/athena-query-error.js +2 -7
- package/dist/services/athena/error/fetch-credentials-error.d.ts +1 -1
- package/dist/services/athena/error/fetch-credentials-error.js +2 -7
- package/dist/services/athena/index.d.ts +4 -4
- package/dist/services/athena/index.js +4 -7
- package/dist/services/bundler/bundle-service-factory.d.ts +3 -1
- package/dist/services/bundler/bundle-service-factory.js +7 -7
- package/dist/services/bundler/bundle-service.d.ts +9 -12
- package/dist/services/bundler/bundle-service.js +42 -32
- package/dist/services/bundler/error/bundle-fetch-error.d.ts +1 -1
- package/dist/services/bundler/error/bundle-fetch-error.js +2 -7
- package/dist/services/bundler/error/bundle-resolve-error.d.ts +1 -1
- package/dist/services/bundler/error/bundle-resolve-error.js +2 -7
- package/dist/services/bundler/index.d.ts +2 -2
- package/dist/services/bundler/index.js +2 -5
- package/dist/services/cli/cli-service-factory.d.ts +2 -2
- package/dist/services/cli/cli-service-factory.js +6 -10
- package/dist/services/cli/cli-service-model.d.ts +21 -6
- package/dist/services/cli/cli-service-model.js +3 -7
- package/dist/services/cli/cli-service.d.ts +10 -8
- package/dist/services/cli/cli-service.js +64 -61
- package/dist/services/cli/error/cli-type-error.js +1 -4
- package/dist/services/cli/index.d.ts +3 -3
- package/dist/services/cli/index.js +3 -6
- package/dist/services/config-api/client.d.ts +2 -2
- package/dist/services/config-api/client.js +29 -34
- package/dist/services/config-api/config-api-factory.d.ts +2 -2
- package/dist/services/config-api/config-api-factory.js +15 -20
- package/dist/services/config-api/config-api-model.d.ts +2 -2
- package/dist/services/config-api/config-api-model.js +1 -5
- package/dist/services/config-api/config-api-service.d.ts +2 -2
- package/dist/services/config-api/config-api-service.js +1 -5
- package/dist/services/config-api/entity-manager-factory.js +3 -7
- package/dist/services/config-api/error/json-response-error.d.ts +1 -1
- package/dist/services/config-api/error/json-response-error.js +2 -7
- package/dist/services/config-api/error/login-error.d.ts +1 -1
- package/dist/services/config-api/error/login-error.js +2 -7
- package/dist/services/config-api/error/orestes-api-error.d.ts +1 -1
- package/dist/services/config-api/error/orestes-api-error.js +2 -7
- package/dist/services/config-api/index.d.ts +3 -3
- package/dist/services/config-api/index.js +3 -6
- package/dist/services/config-api-service.d.ts +1 -1
- package/dist/services/config-api-service.js +6 -11
- package/dist/services/customer-config/customer-config-service-context.js +3 -7
- package/dist/services/customer-config/customer-config-service-factory.d.ts +1 -1
- package/dist/services/customer-config/customer-config-service-factory.js +6 -10
- package/dist/services/customer-config/customer-config-service-model.js +6 -9
- package/dist/services/customer-config/customer-config-service.d.ts +3 -3
- package/dist/services/customer-config/customer-config-service.js +55 -55
- package/dist/services/customer-config/index.d.ts +4 -4
- package/dist/services/customer-config/index.js +4 -7
- package/dist/services/deploy/builder/install-resource-builder.d.ts +2 -2
- package/dist/services/deploy/builder/install-resource-builder.js +3 -7
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +4 -4
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +19 -24
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +3 -3
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +10 -14
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +3 -3
- package/dist/services/deploy/checks/post-deploy/save-files-check.js +8 -12
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -3
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +14 -20
- package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -3
- package/dist/services/deploy/checks/pre-deploy/split-change-check.js +19 -20
- package/dist/services/deploy/context/deploy-context.d.ts +2 -2
- package/dist/services/deploy/context/deploy-context.js +10 -14
- package/dist/services/deploy/deploy-service-factory.d.ts +3 -3
- package/dist/services/deploy/deploy-service-factory.js +36 -40
- package/dist/services/deploy/deploy-service-model.d.ts +10 -10
- package/dist/services/deploy/deploy-service-model.js +1 -2
- package/dist/services/deploy/deploy-service.d.ts +4 -4
- package/dist/services/deploy/deploy-service.js +10 -15
- package/dist/services/deploy/error/check-module-file-error.d.ts +1 -1
- package/dist/services/deploy/error/check-module-file-error.js +2 -7
- package/dist/services/deploy/error/deploy-install-resource-error.d.ts +1 -1
- package/dist/services/deploy/error/deploy-install-resource-error.js +2 -7
- package/dist/services/deploy/error/deploy-module-file-error.d.ts +1 -1
- package/dist/services/deploy/error/deploy-module-file-error.js +2 -7
- package/dist/services/deploy/error/deploy-server-config-error.d.ts +1 -1
- package/dist/services/deploy/error/deploy-server-config-error.js +2 -7
- package/dist/services/deploy/error/evaluate-sk-config-error.d.ts +1 -1
- package/dist/services/deploy/error/evaluate-sk-config-error.js +2 -7
- package/dist/services/deploy/error/file-handler-error.d.ts +1 -1
- package/dist/services/deploy/error/file-handler-error.js +2 -7
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.d.ts +1 -1
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.js +2 -7
- package/dist/services/deploy/error/safe-file-error.d.ts +1 -1
- package/dist/services/deploy/error/safe-file-error.js +2 -7
- package/dist/services/deploy/handler/customer-config-handler.d.ts +6 -6
- package/dist/services/deploy/handler/customer-config-handler.js +7 -12
- package/dist/services/deploy/handler/install-resource-handler.d.ts +7 -7
- package/dist/services/deploy/handler/install-resource-handler.js +22 -27
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +4 -4
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +1 -4
- package/dist/services/deploy/handler/module-handler.d.ts +6 -6
- package/dist/services/deploy/handler/module-handler.js +12 -18
- package/dist/services/deploy/handler/server-config-handler.d.ts +5 -5
- package/dist/services/deploy/handler/server-config-handler.js +10 -14
- package/dist/services/deploy/interface/deploy-handler-interface.d.ts +1 -1
- package/dist/services/deploy/interface/deploy-handler-interface.js +1 -2
- package/dist/services/deploy/interface/install-configs.js +1 -2
- package/dist/services/deploy/interface/install-resource-processor-interface.d.ts +1 -1
- package/dist/services/deploy/interface/install-resource-processor-interface.js +1 -2
- package/dist/services/deploy/interface/install.d.ts +1 -1
- package/dist/services/deploy/interface/install.js +1 -2
- package/dist/services/deploy/interface/runtime-modifier.d.ts +1 -1
- package/dist/services/deploy/interface/runtime-modifier.js +1 -2
- package/dist/services/deploy/interface/validate-origins-response.js +1 -2
- package/dist/services/diff/diff-model.js +1 -5
- package/dist/services/diff/diff-service-factory.d.ts +1 -1
- package/dist/services/diff/diff-service-factory.js +6 -10
- package/dist/services/diff/diff-service.d.ts +1 -1
- package/dist/services/diff/diff-service.js +19 -24
- package/dist/services/diff/index.d.ts +3 -3
- package/dist/services/diff/index.js +3 -6
- package/dist/services/diff-service.d.ts +1 -1
- package/dist/services/diff-service.js +16 -21
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +30 -34
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +3 -3
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +38 -42
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +7 -11
- package/dist/services/document-handler-runtime/document-handler-server.js +77 -59
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -4
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +5 -5
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +42 -46
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +1 -4
- package/dist/services/document-handler-runtime/interface/template-context-interface.d.ts +2 -3
- package/dist/services/document-handler-runtime/interface/template-context-interface.js +1 -2
- package/dist/services/document-handler-runtime/interface/template-interface.d.ts +2 -2
- package/dist/services/document-handler-runtime/interface/template-interface.js +1 -2
- package/dist/services/document-handler-runtime/interface/template-parameter-interface.js +1 -2
- package/dist/services/document-handler-runtime/server/document-handler-response.d.ts +1 -3
- package/dist/services/document-handler-runtime/server/document-handler-response.js +1 -5
- package/dist/services/document-handler-runtime/server/request.d.ts +4 -10
- package/dist/services/document-handler-runtime/server/request.js +1 -5
- package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +3 -3
- package/dist/services/document-handler-runtime/templates/abstract-template.js +3 -7
- package/dist/services/document-handler-runtime/templates/database-mock.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/database-mock.js +2 -6
- package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/execute-document-handler.js +2 -6
- package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/orestes-mock.js +2 -6
- package/dist/services/document-handler-runtime/templates/package-json.d.ts +3 -5
- package/dist/services/document-handler-runtime/templates/package-json.js +2 -6
- package/dist/services/document-handler-runtime/templates/test.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/test.js +2 -6
- package/dist/services/error-handling/error/application-error.d.ts +1 -1
- package/dist/services/error-handling/error/application-error.js +1 -5
- package/dist/services/error-handling/error/config-file-error.d.ts +1 -1
- package/dist/services/error-handling/error/config-file-error.js +2 -7
- package/dist/services/error-handling/error/connection-error.d.ts +1 -1
- package/dist/services/error-handling/error/connection-error.js +2 -7
- package/dist/services/integration-api/error/customer-config-error.d.ts +1 -1
- package/dist/services/integration-api/error/customer-config-error.js +2 -5
- package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -1
- package/dist/services/integration-api/error/customer-config-legacy-error.js +2 -6
- package/dist/services/integration-api/error/invalid-config-format-error.d.ts +1 -1
- package/dist/services/integration-api/error/invalid-config-format-error.js +4 -7
- package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +1 -1
- package/dist/services/integration-api/error/mandatory-file-missing-error.js +2 -6
- package/dist/services/integration-api/error/origin-error.d.ts +1 -1
- package/dist/services/integration-api/error/origin-error.js +2 -5
- package/dist/services/integration-api/error/read-files-error.d.ts +1 -1
- package/dist/services/integration-api/error/read-files-error.js +2 -7
- package/dist/services/integration-api/external/external-file-reader.d.ts +1 -1
- package/dist/services/integration-api/external/external-file-reader.js +9 -14
- package/dist/services/integration-api/file-list.d.ts +1 -1
- package/dist/services/integration-api/file-list.js +8 -11
- package/dist/services/integration-api/file-reader.js +11 -15
- package/dist/services/integration-api/file-writer.js +4 -8
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +5 -5
- package/dist/services/integration-api/handler/customer-config-handler.js +17 -21
- package/dist/services/integration-api/handler/file-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/file-handler.js +1 -4
- package/dist/services/integration-api/handler/install-resource-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/install-resource-handler.js +6 -10
- package/dist/services/integration-api/handler/module-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/module-handler.js +4 -8
- package/dist/services/integration-api/handler/server-config-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/server-config-handler.js +4 -8
- package/dist/services/integration-api/index.d.ts +3 -3
- package/dist/services/integration-api/index.js +3 -6
- package/dist/services/integration-api/integration-api-factory.d.ts +3 -3
- package/dist/services/integration-api/integration-api-factory.js +23 -28
- package/dist/services/integration-api/integration-api-model.d.ts +17 -19
- package/dist/services/integration-api/integration-api-model.js +16 -21
- package/dist/services/integration-api/integration-api-service.d.ts +5 -5
- package/dist/services/integration-api/integration-api-service.js +6 -12
- package/dist/services/integration-api/spec/customer-config-validator.spec.js +29 -32
- package/dist/services/integration-api/spec/file-list.spec.js +107 -110
- package/dist/services/integration-api/spec/file-reader.spec.js +27 -30
- package/dist/services/integration-api/spec/file-writer.spec.js +34 -37
- package/dist/services/integration-api/spec/integration-api-service.spec.js +42 -45
- package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +48 -51
- package/dist/services/integration-api/struct/customer-config-file.d.ts +1 -1
- package/dist/services/integration-api/struct/customer-config-file.js +10 -15
- package/dist/services/integration-api/struct/customer-config.d.ts +4 -8
- package/dist/services/integration-api/struct/customer-config.js +5 -10
- package/dist/services/integration-api/struct/file.d.ts +1 -1
- package/dist/services/integration-api/struct/file.js +9 -13
- package/dist/services/integration-api/struct/install-resource-file.d.ts +2 -2
- package/dist/services/integration-api/struct/install-resource-file.js +4 -8
- package/dist/services/integration-api/struct/module-file.d.ts +2 -2
- package/dist/services/integration-api/struct/module-file.js +4 -8
- package/dist/services/integration-api/struct/ro-file.d.ts +1 -1
- package/dist/services/integration-api/struct/ro-file.js +1 -5
- package/dist/services/integration-api/struct/server-config-file.d.ts +2 -2
- package/dist/services/integration-api/struct/server-config-file.js +4 -8
- package/dist/services/integration-api/struct/virtual-file.d.ts +1 -1
- package/dist/services/integration-api/struct/virtual-file.js +3 -7
- package/dist/services/integration-api/validator/customer-config-validator.d.ts +1 -1
- package/dist/services/integration-api/validator/customer-config-validator.js +8 -12
- package/dist/services/integration-api/validator/mandatory-files-validator.d.ts +2 -2
- package/dist/services/integration-api/validator/mandatory-files-validator.js +4 -8
- package/dist/services/integration-api/virtual/external-recipe.d.ts +2 -2
- package/dist/services/integration-api/virtual/external-recipe.js +1 -5
- package/dist/services/integration-api/virtual/static-recipe.d.ts +1 -1
- package/dist/services/integration-api/virtual/static-recipe.js +1 -5
- package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +2 -2
- package/dist/services/integration-api/virtual/virtual-file-handler.js +8 -13
- package/dist/services/onboarding/browser/abort-response.js +1 -5
- package/dist/services/onboarding/browser/baqend-response.d.ts +1 -1
- package/dist/services/onboarding/browser/baqend-response.js +1 -5
- package/dist/services/onboarding/browser/config/browser-config.d.ts +1 -1
- package/dist/services/onboarding/browser/config/browser-config.js +15 -20
- package/dist/services/onboarding/browser/executable/executable-validator.d.ts +2 -2
- package/dist/services/onboarding/browser/executable/executable-validator.js +12 -17
- package/dist/services/onboarding/browser/extension/devtools-extension-api.d.ts +1 -1
- package/dist/services/onboarding/browser/extension/devtools-extension-api.js +1 -5
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +2 -2
- package/dist/services/onboarding/browser/extension/extension-downloader.js +24 -30
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
- package/dist/services/onboarding/browser/extension/extension-validator.js +18 -23
- package/dist/services/onboarding/browser/origin-response.d.ts +1 -1
- package/dist/services/onboarding/browser/origin-response.js +1 -5
- package/dist/services/onboarding/config-renderer/install-file-recipe.d.ts +2 -2
- package/dist/services/onboarding/config-renderer/install-file-recipe.js +1 -5
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +3 -3
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +8 -11
- package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +4 -4
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +9 -14
- package/dist/services/onboarding/dashboard/index.d.ts +7 -7
- package/dist/services/onboarding/dashboard/index.js +8 -13
- package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -1
- package/dist/services/onboarding/dashboard/parameter-query-builder.js +9 -13
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +3 -3
- package/dist/services/onboarding/dashboard/request-diff-service.js +14 -19
- package/dist/services/onboarding/error/browser-extension-error.d.ts +1 -1
- package/dist/services/onboarding/error/browser-extension-error.js +1 -5
- package/dist/services/onboarding/error/document-handler-transform-error.js +1 -5
- package/dist/services/onboarding/error/unsupported-encoding-error.d.ts +1 -1
- package/dist/services/onboarding/error/unsupported-encoding-error.js +2 -7
- package/dist/services/onboarding/error/validate-extension-error.d.ts +1 -1
- package/dist/services/onboarding/error/validate-extension-error.js +2 -7
- package/dist/services/onboarding/error/vm-empty-response-error.d.ts +1 -1
- package/dist/services/onboarding/error/vm-empty-response-error.js +2 -7
- package/dist/services/onboarding/error/vm-error.d.ts +1 -1
- package/dist/services/onboarding/error/vm-error.js +2 -7
- package/dist/services/onboarding/fetch-event-handler.d.ts +4 -4
- package/dist/services/onboarding/fetch-event-handler.js +19 -25
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +4 -4
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +15 -20
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +4 -8
- package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/dashboard-request.js +1 -5
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +5 -5
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +1 -5
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +4 -4
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +3 -7
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +5 -5
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +7 -11
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +6 -6
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +4 -8
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +3 -7
- package/dist/services/onboarding/file-events/file-watcher.d.ts +5 -5
- package/dist/services/onboarding/file-events/file-watcher.js +24 -28
- package/dist/services/onboarding/index.d.ts +3 -3
- package/dist/services/onboarding/index.js +3 -8
- package/dist/services/onboarding/onboarding-model.d.ts +21 -23
- package/dist/services/onboarding/onboarding-model.js +22 -27
- package/dist/services/onboarding/onboarding-service-factory.d.ts +3 -3
- package/dist/services/onboarding/onboarding-service-factory.js +102 -108
- package/dist/services/onboarding/onboarding-service.d.ts +6 -6
- package/dist/services/onboarding/onboarding-service.js +12 -18
- package/dist/services/onboarding/request-cache/cache.d.ts +3 -3
- package/dist/services/onboarding/request-cache/cache.js +1 -5
- package/dist/services/onboarding/server-config/index.d.ts +3 -3
- package/dist/services/onboarding/server-config/index.js +6 -11
- package/dist/services/onboarding/templates/install-speed-kit-html-template.d.ts +1 -1
- package/dist/services/onboarding/templates/install-speed-kit-html-template.js +2 -7
- package/dist/services/onboarding/templates/install-speed-kit-js-template.d.ts +1 -1
- package/dist/services/onboarding/templates/install-speed-kit-js-template.js +2 -7
- package/dist/services/onboarding/todo-collector.d.ts +3 -3
- package/dist/services/onboarding/todo-collector.js +3 -7
- package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +2 -2
- package/dist/services/onboarding/virtual-orestes-app/crawler.js +12 -16
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +7 -7
- package/dist/services/onboarding/virtual-orestes-app/index.js +25 -32
- package/dist/services/pop-config/index.d.ts +3 -3
- package/dist/services/pop-config/index.js +3 -6
- package/dist/services/pop-config/pop-config-factory.d.ts +1 -1
- package/dist/services/pop-config/pop-config-factory.js +5 -9
- package/dist/services/pop-config/pop-config-model.d.ts +2 -2
- package/dist/services/pop-config/pop-config-model.js +1 -2
- package/dist/services/pop-config/pop-config-service.d.ts +2 -2
- package/dist/services/pop-config/pop-config-service.js +1 -5
- package/dist/services/prewarm/assets/asset-api-client.d.ts +2 -2
- package/dist/services/prewarm/assets/asset-api-client.js +18 -23
- package/dist/services/prewarm/assets/asset-item.d.ts +1 -1
- package/dist/services/prewarm/assets/asset-item.js +6 -10
- package/dist/services/prewarm/assets/asset-list.d.ts +2 -2
- package/dist/services/prewarm/assets/asset-list.js +6 -10
- package/dist/services/prewarm/csv-reader.js +6 -11
- package/dist/services/prewarm/error/invalid-origin-error.d.ts +1 -1
- package/dist/services/prewarm/error/invalid-origin-error.js +2 -7
- package/dist/services/prewarm/error/read-csv-error.d.ts +1 -1
- package/dist/services/prewarm/error/read-csv-error.js +2 -7
- package/dist/services/prewarm/index.d.ts +3 -3
- package/dist/services/prewarm/index.js +3 -6
- package/dist/services/prewarm/pre-warm-factory.d.ts +1 -1
- package/dist/services/prewarm/pre-warm-factory.js +13 -17
- package/dist/services/prewarm/pre-warm-model.js +16 -20
- package/dist/services/prewarm/pre-warm-service.d.ts +3 -3
- package/dist/services/prewarm/pre-warm-service.js +18 -22
- package/dist/services/pull/index.d.ts +3 -3
- package/dist/services/pull/index.js +3 -6
- package/dist/services/pull/pull-service-factory.d.ts +2 -2
- package/dist/services/pull/pull-service-factory.js +12 -16
- package/dist/services/pull/pull-service-model.js +4 -9
- package/dist/services/pull/pull-service.d.ts +3 -3
- package/dist/services/pull/pull-service.js +14 -19
- package/dist/services/query-builder/error/parse-config-speed-kit-error.d.ts +1 -1
- package/dist/services/query-builder/error/parse-config-speed-kit-error.js +2 -6
- package/dist/services/query-builder/query/parameter.js +1 -5
- package/dist/services/query-builder/query/prewarm.js +1 -5
- package/dist/services/query-builder/query-builder-factory.d.ts +3 -3
- package/dist/services/query-builder/query-builder-factory.js +16 -20
- package/dist/services/query-builder/query-builder-model.d.ts +6 -6
- package/dist/services/query-builder/query-builder-model.js +2 -5
- package/dist/services/query-builder/query-builder-service.d.ts +2 -2
- package/dist/services/query-builder/query-builder-service.js +24 -30
- package/oclif.manifest.json +15 -15
- package/package.json +63 -54
- package/dist/dummy.spec.d.ts +0 -1
- package/dist/dummy.spec.js +0 -18
package/dist/commands/pull.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const cli_config_1 = require("../helpers/cli-config");
|
|
7
|
-
class Pull extends core_1.Command {
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import { CLIParametersChar, CLIParameters, CLIParametersExample, CLI_CUSTOMER_CONFIG, CLI_CONFIG_NAME, } from "../models/cli-parameters.js";
|
|
3
|
+
import { PullContext, PullServiceFactory } from "../services/pull/index.js";
|
|
4
|
+
import { CliConfig } from "../helpers/cli-config.js";
|
|
5
|
+
export default class Pull extends Command {
|
|
8
6
|
static description = "Pull the specified customer config from orestes";
|
|
9
|
-
static args =
|
|
7
|
+
static args = CLI_CUSTOMER_CONFIG;
|
|
10
8
|
static flags = {
|
|
11
|
-
...
|
|
9
|
+
...CLI_CONFIG_NAME,
|
|
12
10
|
};
|
|
13
11
|
static examples = [
|
|
14
|
-
`$ sk pull <${
|
|
15
|
-
`$ sk pull ${
|
|
12
|
+
`$ sk pull <${CLIParameters.CustomerPath}>`,
|
|
13
|
+
`$ sk pull ${CLIParametersExample.CustomerPath} -${CLIParametersChar.ConfigName} ${CLIParametersExample.ConfigName}`,
|
|
16
14
|
];
|
|
17
15
|
async run() {
|
|
18
16
|
const { args: { customerPath }, flags: { configName }, } = await this.parse(Pull);
|
|
19
|
-
const pullContext = new
|
|
20
|
-
const pullService = await new
|
|
17
|
+
const pullContext = new PullContext(customerPath, configName);
|
|
18
|
+
const pullService = await new PullServiceFactory(pullContext, new CliConfig(this.config).load()).buildService();
|
|
21
19
|
await pullService.run();
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
|
-
exports.default = Pull;
|
|
@@ -2,20 +2,20 @@ import { Command } from "@oclif/core";
|
|
|
2
2
|
export default class WptLauncher extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
|
-
urls: import("@oclif/core/
|
|
6
|
-
testId: import("@oclif/core/
|
|
5
|
+
urls: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
testId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
|
-
cookies: import("@oclif/core/
|
|
10
|
-
mobile: import("@oclif/core/
|
|
11
|
-
group: import("@oclif/core/
|
|
9
|
+
cookies: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
mobile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
group: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
13
|
static examples: string[];
|
|
14
14
|
static localhostUrl: string;
|
|
15
15
|
run(): Promise<void>;
|
|
16
16
|
isMobile(mobile: string): boolean;
|
|
17
17
|
getViewPortSize(isMobile: boolean): string;
|
|
18
|
-
allResourceUrls(urls: string):
|
|
19
|
-
getResourceOrigin(urlsArray:
|
|
18
|
+
allResourceUrls(urls: string): string[];
|
|
19
|
+
getResourceOrigin(urlsArray: string[]): string;
|
|
20
20
|
postScript(script: string): Promise<NonNullable<unknown>>;
|
|
21
21
|
}
|
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
-
const cli_parameters_1 = require("../models/cli-parameters");
|
|
8
|
-
const logging_helper_1 = require("../helpers/logging-helper");
|
|
9
|
-
class WptLauncher extends core_1.Command {
|
|
1
|
+
import { Args, Command, Flags } from "@oclif/core";
|
|
2
|
+
import fetch from "node-fetch";
|
|
3
|
+
import { CLIParameters, CLIParametersExample, CLIParametersChar, } from "../models/cli-parameters.js";
|
|
4
|
+
import { logError } from "../helpers/logging-helper.js";
|
|
5
|
+
export default class WptLauncher extends Command {
|
|
10
6
|
static description = "Analyze the performance impact that Speed Kit has compared to the original version.";
|
|
11
7
|
static args = {
|
|
12
|
-
[
|
|
13
|
-
name:
|
|
8
|
+
[CLIParameters.Urls]: Args.string({
|
|
9
|
+
name: CLIParameters.Urls, // name of arg to show in help and reference with args[name]
|
|
14
10
|
required: true, // make the arg required with `required: true`
|
|
15
11
|
}),
|
|
16
|
-
[
|
|
17
|
-
name:
|
|
12
|
+
[CLIParameters.TestId]: Args.string({
|
|
13
|
+
name: CLIParameters.TestId, // name of arg to show in help and reference with args[name]
|
|
18
14
|
required: true, // make the arg required with `required: true`
|
|
19
15
|
}),
|
|
20
16
|
};
|
|
21
17
|
static flags = {
|
|
22
|
-
[
|
|
18
|
+
[CLIParameters.Cookies]: Flags.string({
|
|
23
19
|
default: "",
|
|
24
|
-
char:
|
|
20
|
+
char: CLIParametersChar.Cookies,
|
|
25
21
|
}),
|
|
26
|
-
[
|
|
22
|
+
[CLIParameters.Mobile]: Flags.string({
|
|
27
23
|
default: "no",
|
|
28
|
-
char:
|
|
24
|
+
char: CLIParametersChar.Mobile,
|
|
29
25
|
}),
|
|
30
|
-
[
|
|
26
|
+
[CLIParameters.Group]: Flags.string({
|
|
31
27
|
default: "A",
|
|
32
|
-
char:
|
|
28
|
+
char: CLIParametersChar.Group,
|
|
33
29
|
}),
|
|
34
30
|
};
|
|
35
31
|
static examples = [
|
|
36
|
-
`$ sk wpt-launcher <${
|
|
37
|
-
`$ sk wpt-launcher ${
|
|
32
|
+
`$ sk wpt-launcher <${CLIParameters.Urls}> <${CLIParameters.TestId}> -${CLIParametersChar.Group} <${CLIParameters.Group}> -${CLIParametersChar.Mobile} <${CLIParameters.Mobile}> -${CLIParametersChar.Cookies} <${CLIParameters.Cookies}>`,
|
|
33
|
+
`$ sk wpt-launcher ${CLIParametersExample.Urls} ${CLIParametersExample.TestId} -${CLIParametersChar.Group} ${CLIParametersExample.Group} -${CLIParametersChar.Mobile} ${CLIParametersExample.Mobile} -${CLIParametersChar.Cookies} ${CLIParametersExample.Cookies}`,
|
|
38
34
|
];
|
|
39
35
|
static localhostUrl = "http://localhost:8888/orange.html";
|
|
40
36
|
async run() {
|
|
@@ -52,11 +48,11 @@ class WptLauncher extends core_1.Command {
|
|
|
52
48
|
const postscript = (await this.postScript(script));
|
|
53
49
|
const currentTestIdUrl = `http://wpt.baqend.com/results.php?test=${postscript.wptTestId}`;
|
|
54
50
|
if (!currentTestIdUrl) {
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
logError("Getting testId failed, " + currentTestIdUrl);
|
|
52
|
+
process.exit(1);
|
|
57
53
|
}
|
|
58
54
|
this.log("testUrl: ", currentTestIdUrl);
|
|
59
|
-
|
|
55
|
+
process.exit(0);
|
|
60
56
|
}
|
|
61
57
|
// ---------------------- services----------------
|
|
62
58
|
isMobile(mobile) {
|
|
@@ -85,11 +81,10 @@ class WptLauncher extends core_1.Command {
|
|
|
85
81
|
// ---------------- wpt launcher --------------------------
|
|
86
82
|
async postScript(script) {
|
|
87
83
|
const urlPath = "https://makefast.app.baqend.com/v1/code/testAPI";
|
|
88
|
-
const response = await (
|
|
84
|
+
const response = await fetch(urlPath, {
|
|
89
85
|
body: JSON.stringify({ script }),
|
|
90
86
|
method: "POST",
|
|
91
87
|
});
|
|
92
88
|
return response.json();
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
|
-
exports.default = WptLauncher;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSame = isSame;
|
|
4
1
|
// Check if two arrays are the same, regardless of order
|
|
5
|
-
function isSame(array1, array2) {
|
|
2
|
+
export function isSame(array1, array2) {
|
|
6
3
|
return (array1.length === array2.length &&
|
|
7
4
|
array1.every((value) => array2.includes(value)) &&
|
|
8
5
|
array2.every((value) => array1.includes(value)));
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWhitelistedFilter = getWhitelistedFilter;
|
|
4
|
-
exports.getBlacklistedFilter = getBlacklistedFilter;
|
|
5
|
-
exports.getParameterFilter = getParameterFilter;
|
|
6
|
-
exports.getParameterReplaceFilter = getParameterReplaceFilter;
|
|
7
|
-
exports.getStrippedParameters = getStrippedParameters;
|
|
8
1
|
/**
|
|
9
2
|
* Returns the string between a left bound and a right bound.
|
|
10
3
|
*
|
|
@@ -59,7 +52,7 @@ function getRuleProperty(speedKitRuleValues, key) {
|
|
|
59
52
|
*
|
|
60
53
|
* @param parsedConfig - The speed kit config parsed as an object.
|
|
61
54
|
*/
|
|
62
|
-
function getWhitelistedFilter(parsedConfig) {
|
|
55
|
+
export function getWhitelistedFilter(parsedConfig) {
|
|
63
56
|
const { whitelist, enabledSites } = parsedConfig;
|
|
64
57
|
// TODO: use origins instead here
|
|
65
58
|
const whitelistedFilter = `(\n ${(whitelist[0].host || whitelist[0].url)
|
|
@@ -78,7 +71,7 @@ function getWhitelistedFilter(parsedConfig) {
|
|
|
78
71
|
*
|
|
79
72
|
* @param parsedConfig - The speed kit config parsed as an object.
|
|
80
73
|
*/
|
|
81
|
-
function getBlacklistedFilter(parsedConfig) {
|
|
74
|
+
export function getBlacklistedFilter(parsedConfig) {
|
|
82
75
|
const { blacklist, disabledSites } = parsedConfig;
|
|
83
76
|
const blacklistedPathnamesFilter = getRuleProperty(blacklist, "pathname")
|
|
84
77
|
.map((pathname) => getFilterForProperty(pathname, "url", false, "pathname"))
|
|
@@ -107,7 +100,7 @@ function getBlacklistedFilter(parsedConfig) {
|
|
|
107
100
|
* @param params - The stripped parameters that are named within the speed kit config.
|
|
108
101
|
* @param skConfigVersion - The Speed Kit config ruleset version.
|
|
109
102
|
*/
|
|
110
|
-
function getParameterFilter(parameters, skConfigVersion = 1) {
|
|
103
|
+
export function getParameterFilter(parameters, skConfigVersion = 1) {
|
|
111
104
|
return parameters
|
|
112
105
|
.map((parameter) => {
|
|
113
106
|
// Prefix comparison for strings
|
|
@@ -128,7 +121,7 @@ function getParameterFilter(parameters, skConfigVersion = 1) {
|
|
|
128
121
|
* @param params - The stripped parameters that are named within the speed kit config.
|
|
129
122
|
* @param skConfigVersion - The Speed Kit config ruleset version.
|
|
130
123
|
*/
|
|
131
|
-
function getParameterReplaceFilter(parameters, skConfigVersion = 1) {
|
|
124
|
+
export function getParameterReplaceFilter(parameters, skConfigVersion = 1) {
|
|
132
125
|
const prefixParameters = [];
|
|
133
126
|
const suffixParameters = [];
|
|
134
127
|
const fullMatchParameters = [];
|
|
@@ -206,7 +199,7 @@ function getParameterFullMatchRegExp(parameters, ignoreCase) {
|
|
|
206
199
|
*
|
|
207
200
|
* @param parsedConfig - The speed kit config parsed as an object.
|
|
208
201
|
*/
|
|
209
|
-
function getStrippedParameters(parsedConfig) {
|
|
202
|
+
export function getStrippedParameters(parsedConfig) {
|
|
210
203
|
const parameterArray = parsedConfig.stripQueryParams;
|
|
211
204
|
if (!parameterArray) {
|
|
212
205
|
return [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Config } from "@oclif/core
|
|
2
|
-
export
|
|
1
|
+
import { Config } from "@oclif/core";
|
|
2
|
+
export interface UserCliConfig {
|
|
3
3
|
chromeExtensionPaths: string;
|
|
4
4
|
chromePath: string;
|
|
5
5
|
chromeUserProfilePath: string;
|
|
@@ -11,7 +11,7 @@ export type UserCliConfig = {
|
|
|
11
11
|
tempFolder: string;
|
|
12
12
|
runtimeConfig: Config;
|
|
13
13
|
nodeModulesPath: string;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
export declare class CliConfig {
|
|
16
16
|
private config;
|
|
17
17
|
private userCliConfig;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
6
|
-
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
7
|
-
const node_path_1 = tslib_1.__importStar(require("node:path"));
|
|
8
|
-
dotenv.config();
|
|
1
|
+
import * as dotenv from "dotenv";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path, { resolve } from "node:path";
|
|
4
|
+
dotenv.config({ quiet: true });
|
|
9
5
|
const environmentMapping = {
|
|
10
6
|
chromeExtensionPaths: "CHROME_EXTENSION_PATHS",
|
|
11
7
|
chromePath: "CHROME_PATH",
|
|
@@ -17,7 +13,7 @@ const environmentMapping = {
|
|
|
17
13
|
testApp: "TEST_APP",
|
|
18
14
|
};
|
|
19
15
|
const CONFIG_FILE_NAME = "config.json";
|
|
20
|
-
class CliConfig {
|
|
16
|
+
export class CliConfig {
|
|
21
17
|
config;
|
|
22
18
|
userCliConfig = {
|
|
23
19
|
chromeExtensionPaths: "",
|
|
@@ -42,12 +38,12 @@ class CliConfig {
|
|
|
42
38
|
this.resolveExtensionConfigPaths();
|
|
43
39
|
this.userCliConfig.tempFolder = this.config.cacheDir;
|
|
44
40
|
this.userCliConfig.runtimeConfig = this.config;
|
|
45
|
-
this.userCliConfig.nodeModulesPath =
|
|
41
|
+
this.userCliConfig.nodeModulesPath = resolve(this.config.cacheDir, "additional_node_modules", customerPath || "");
|
|
46
42
|
return this.userCliConfig;
|
|
47
43
|
}
|
|
48
44
|
createEmptyConfigFile() {
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
fs.mkdirSync(path.resolve(this.config.configDir), { recursive: true });
|
|
46
|
+
fs.writeFileSync(this.getConfigFilePath(), JSON.stringify(this.createEmptyUserConfig(), null, `\t`));
|
|
51
47
|
}
|
|
52
48
|
createEmptyUserConfig() {
|
|
53
49
|
return {
|
|
@@ -61,7 +57,7 @@ class CliConfig {
|
|
|
61
57
|
};
|
|
62
58
|
}
|
|
63
59
|
getConfigFilePath() {
|
|
64
|
-
return
|
|
60
|
+
return path.resolve(this.config.configDir, CONFIG_FILE_NAME);
|
|
65
61
|
}
|
|
66
62
|
loadConfigFromConfigFile() {
|
|
67
63
|
const configJson = this.readCliConfigFromFile();
|
|
@@ -98,12 +94,11 @@ class CliConfig {
|
|
|
98
94
|
}
|
|
99
95
|
}
|
|
100
96
|
readCliConfigFromFile() {
|
|
101
|
-
if (!
|
|
97
|
+
if (!fs.existsSync(this.getConfigFilePath())) {
|
|
102
98
|
this.createEmptyConfigFile();
|
|
103
99
|
return;
|
|
104
100
|
}
|
|
105
|
-
const configFileContent =
|
|
101
|
+
const configFileContent = fs.readFileSync(this.getConfigFilePath(), "utf8");
|
|
106
102
|
return JSON.parse(configFileContent);
|
|
107
103
|
}
|
|
108
104
|
}
|
|
109
|
-
exports.CliConfig = CliConfig;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { InstallConfigs } from "../models/install";
|
|
2
|
-
export declare const SPEED_KIT_INSTALL_PATH
|
|
1
|
+
import { InstallConfigs } from "../models/install.js";
|
|
2
|
+
export declare const SPEED_KIT_INSTALL_PATH = "/speed-kit-install.js";
|
|
3
3
|
export declare const INSTALLATION_PROPERTIES: InstallConfigs<string>;
|
|
4
|
-
type Parameters_ =
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
type MultiConfigParameters = {
|
|
8
|
-
[configName: string]: Parameters_;
|
|
9
|
-
};
|
|
4
|
+
type Parameters_ = Record<string, any>;
|
|
5
|
+
type MultiConfigParameters = Record<string, Parameters_>;
|
|
10
6
|
export declare class CustomerConfig implements InstallConfigs<ConfigFile | null> {
|
|
11
7
|
readonly name: string;
|
|
12
8
|
readonly config: ConfigFile | null;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const promises_1 = require("node:fs/promises");
|
|
8
|
-
const logging_helper_1 = require("./logging-helper");
|
|
9
|
-
exports.SPEED_KIT_INSTALL_PATH = "/speed-kit-install.js";
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { isFile } from "./is-file.js";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
import { logWarning } from "./logging-helper.js";
|
|
6
|
+
export const SPEED_KIT_INSTALL_PATH = "/speed-kit-install.js";
|
|
10
7
|
const CUSTOMER_CONFIG_BASENAME = "config_customer.js";
|
|
11
8
|
const SK_CONFIG = "config_SpeedKit.js";
|
|
12
9
|
const RUM_CONFIG = "config_loadHandler.js";
|
|
@@ -17,7 +14,7 @@ const CUSTOM_LOADER = "custom_loader.js";
|
|
|
17
14
|
const CUSTOM_SERVICE_WORKER = "custom_sw.js";
|
|
18
15
|
const CUSTOM_DOCUMENT_HANDLER = "custom_documentHandler.js";
|
|
19
16
|
const CUSTOM_DYNAMIC_FETCHER = "custom_dynamicFetcher.js";
|
|
20
|
-
|
|
17
|
+
export const INSTALLATION_PROPERTIES = {
|
|
21
18
|
config: SK_CONFIG,
|
|
22
19
|
custom: RUM_CONFIG,
|
|
23
20
|
sw: CUSTOM_SERVICE_WORKER,
|
|
@@ -43,7 +40,7 @@ function isString(value) {
|
|
|
43
40
|
function isBoolean(value) {
|
|
44
41
|
return typeof value === "boolean";
|
|
45
42
|
}
|
|
46
|
-
class CustomerConfig {
|
|
43
|
+
export class CustomerConfig {
|
|
47
44
|
name;
|
|
48
45
|
config;
|
|
49
46
|
app;
|
|
@@ -71,7 +68,6 @@ class CustomerConfig {
|
|
|
71
68
|
if (!mainConfig) {
|
|
72
69
|
throw new Error(`Could not find customer config file "${CUSTOMER_CONFIG_BASENAME}".`);
|
|
73
70
|
}
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
75
71
|
return require(mainConfig.filePath);
|
|
76
72
|
}
|
|
77
73
|
static async loadCustomer(directory, configName) {
|
|
@@ -81,13 +77,13 @@ class CustomerConfig {
|
|
|
81
77
|
parameters = customerConfig[configName];
|
|
82
78
|
}
|
|
83
79
|
else {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
logWarning("Use legacy customer config loading format.");
|
|
81
|
+
logWarning("Make sure to export the different app configs under their config names like:");
|
|
82
|
+
logWarning("module.exports = { production, staging }");
|
|
87
83
|
parameters = customerConfig;
|
|
88
84
|
}
|
|
89
85
|
const configs = {};
|
|
90
|
-
for (const [key, path] of Object.entries(
|
|
86
|
+
for (const [key, path] of Object.entries(INSTALLATION_PROPERTIES)) {
|
|
91
87
|
configs[key] = await ConfigFile.loadFile(directory, path, path.replace(".js", ".es6"));
|
|
92
88
|
}
|
|
93
89
|
// Parse config
|
|
@@ -104,7 +100,7 @@ class CustomerConfig {
|
|
|
104
100
|
this.app = optional(isString, parameters, "app");
|
|
105
101
|
this.appDomain = optional(isString, parameters, "appDomain", "*.app.baqend.com");
|
|
106
102
|
this.chromeFlags = optional(Array.isArray, parameters, "chromeFlags", []);
|
|
107
|
-
this.installPath = optional(isString, parameters, "installPath",
|
|
103
|
+
this.installPath = optional(isString, parameters, "installPath", SPEED_KIT_INSTALL_PATH);
|
|
108
104
|
const scope = optional(isString, parameters, "scope", "/");
|
|
109
105
|
this.scope = scope + (scope.endsWith("/") ? "" : "/");
|
|
110
106
|
this.origins = optional(Array.isArray, parameters, "origins", []);
|
|
@@ -114,14 +110,13 @@ class CustomerConfig {
|
|
|
114
110
|
Object.assign(this, configFiles);
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
|
-
|
|
118
|
-
class ConfigFile {
|
|
113
|
+
export class ConfigFile {
|
|
119
114
|
filePath;
|
|
120
115
|
name;
|
|
121
116
|
static async loadFile(basePath, ...alternativeFileNames) {
|
|
122
117
|
for (const fileName of alternativeFileNames) {
|
|
123
|
-
const filePath =
|
|
124
|
-
if (await
|
|
118
|
+
const filePath = path.resolve(basePath, fileName);
|
|
119
|
+
if (await isFile(filePath)) {
|
|
125
120
|
return new ConfigFile(filePath, fileName);
|
|
126
121
|
}
|
|
127
122
|
}
|
|
@@ -135,7 +130,7 @@ class ConfigFile {
|
|
|
135
130
|
this.name = name;
|
|
136
131
|
}
|
|
137
132
|
async readContent() {
|
|
138
|
-
return
|
|
133
|
+
return readFile(this.filePath, "utf-8");
|
|
139
134
|
}
|
|
140
135
|
}
|
|
141
|
-
|
|
136
|
+
/* eslint-enable */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InstallResourceFile } from "../services/integration-api";
|
|
1
|
+
import { InstallResourceFile } from "../services/integration-api/index.js";
|
|
2
2
|
export declare function evaluateLocalSpeedKitConfig(app: string, origin: string, speedKitConfigFile: InstallResourceFile): Promise<{
|
|
3
3
|
split: any;
|
|
4
4
|
splitTestId: any;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const evaluate_sk_config_error_1 = require("../services/deploy/error/evaluate-sk-config-error");
|
|
7
|
-
const vm = tslib_1.__importStar(require("node:vm"));
|
|
8
|
-
const bundler_1 = require("../services/bundler");
|
|
9
|
-
async function evaluateLocalSpeedKitConfig(app, origin, speedKitConfigFile) {
|
|
1
|
+
import { EvaluateSkConfigError } from "../services/deploy/error/evaluate-sk-config-error.js";
|
|
2
|
+
import * as vm from "node:vm";
|
|
3
|
+
import { BundleServiceFactory } from "../services/bundler/index.js";
|
|
4
|
+
import ApplicationError from "../services/error-handling/error/application-error.js";
|
|
5
|
+
export async function evaluateLocalSpeedKitConfig(app, origin, speedKitConfigFile) {
|
|
10
6
|
const localBrowserContext = buildBrowserMock(origin, app);
|
|
11
7
|
const localFileContent = safeFileContentWrapper(await bundle(speedKitConfigFile.getContent(), app));
|
|
12
8
|
vm.runInNewContext(localFileContent, localBrowserContext, {
|
|
@@ -15,11 +11,11 @@ async function evaluateLocalSpeedKitConfig(app, origin, speedKitConfigFile) {
|
|
|
15
11
|
breakOnSigint: true,
|
|
16
12
|
});
|
|
17
13
|
if (localBrowserContext.vmError !== null) {
|
|
18
|
-
throw new
|
|
14
|
+
throw new EvaluateSkConfigError(`[config_Speedkit.js] ${localBrowserContext.vmError?.message}`);
|
|
19
15
|
}
|
|
20
16
|
return localBrowserContext.window.speedKit;
|
|
21
17
|
}
|
|
22
|
-
async function evaluateLocalAndRemoteSpeedKit(app, origin, speedKitConfigFile, activeSpeedKitConfig) {
|
|
18
|
+
export async function evaluateLocalAndRemoteSpeedKit(app, origin, speedKitConfigFile, activeSpeedKitConfig) {
|
|
23
19
|
const localBrowserContext = buildBrowserMock(origin, app);
|
|
24
20
|
const localFileContent = safeFileContentWrapper(await bundle(speedKitConfigFile.getContent(), app));
|
|
25
21
|
vm.runInNewContext(localFileContent, localBrowserContext, {
|
|
@@ -34,10 +30,10 @@ async function evaluateLocalAndRemoteSpeedKit(app, origin, speedKitConfigFile, a
|
|
|
34
30
|
breakOnSigint: true,
|
|
35
31
|
});
|
|
36
32
|
if (localBrowserContext.vmError !== null) {
|
|
37
|
-
throw new
|
|
33
|
+
throw new EvaluateSkConfigError(`[config_Speedkit.js] ${localBrowserContext.vmError?.message}`);
|
|
38
34
|
}
|
|
39
35
|
if (remoteBrowserContext.vmError !== null) {
|
|
40
|
-
throw new
|
|
36
|
+
throw new EvaluateSkConfigError(`[remote_config] ${JSON.stringify(remoteBrowserContext.vmError?.message)}`);
|
|
41
37
|
}
|
|
42
38
|
const localSpeedKit = localBrowserContext.window.speedKit;
|
|
43
39
|
const remoteSpeedKit = remoteBrowserContext.window.speedKit;
|
|
@@ -51,17 +47,19 @@ function buildBrowserMock(origin, app) {
|
|
|
51
47
|
speedKit: {
|
|
52
48
|
split: undefined,
|
|
53
49
|
splitTestId: undefined,
|
|
54
|
-
detectDevice: () => {
|
|
50
|
+
detectDevice: () => {
|
|
51
|
+
/* empty */
|
|
52
|
+
},
|
|
55
53
|
customVariation: [],
|
|
56
54
|
},
|
|
57
55
|
SpeedKit: {},
|
|
58
56
|
serviceWorkerUrl: "",
|
|
59
57
|
screen: { width: 0, height: 0 },
|
|
60
58
|
devicePixelRatio: 1,
|
|
61
|
-
setTimeout: () =>
|
|
62
|
-
clearTimeout: () =>
|
|
63
|
-
addEventListener: () =>
|
|
64
|
-
removeEventListener: () =>
|
|
59
|
+
setTimeout: (callBack, time) => setTimeout(callBack, time),
|
|
60
|
+
clearTimeout: () => clearTimeout,
|
|
61
|
+
addEventListener: () => addEventListener,
|
|
62
|
+
removeEventListener: () => removeEventListener,
|
|
65
63
|
navigator: {
|
|
66
64
|
userAgent: "",
|
|
67
65
|
connection: {},
|
|
@@ -74,11 +72,21 @@ function buildBrowserMock(origin, app) {
|
|
|
74
72
|
window.top = window;
|
|
75
73
|
const document = {
|
|
76
74
|
cookie: "",
|
|
77
|
-
querySelector: () => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
querySelector: () => {
|
|
76
|
+
/* empty */
|
|
77
|
+
},
|
|
78
|
+
querySelectorAll: () => {
|
|
79
|
+
/* empty */
|
|
80
|
+
},
|
|
81
|
+
createElement: () => {
|
|
82
|
+
/* empty */
|
|
83
|
+
},
|
|
84
|
+
addEventListener: () => {
|
|
85
|
+
/* empty */
|
|
86
|
+
},
|
|
87
|
+
removeEventListener: () => {
|
|
88
|
+
/* empty */
|
|
89
|
+
},
|
|
82
90
|
head: {},
|
|
83
91
|
body: {},
|
|
84
92
|
};
|
|
@@ -91,8 +99,12 @@ function buildBrowserMock(origin, app) {
|
|
|
91
99
|
document,
|
|
92
100
|
navigator: { userAgent: "" },
|
|
93
101
|
localStorage: {
|
|
94
|
-
getItem: () => {
|
|
95
|
-
|
|
102
|
+
getItem: () => {
|
|
103
|
+
/* empty */
|
|
104
|
+
},
|
|
105
|
+
setItem: () => {
|
|
106
|
+
/* empty */
|
|
107
|
+
},
|
|
96
108
|
},
|
|
97
109
|
JSON: JSON,
|
|
98
110
|
decodeURIComponent: decodeURIComponent,
|
|
@@ -109,7 +121,10 @@ function safeFileContentWrapper(fileContent) {
|
|
|
109
121
|
`;
|
|
110
122
|
}
|
|
111
123
|
async function bundle(content, app) {
|
|
112
|
-
|
|
124
|
+
if (!content) {
|
|
125
|
+
throw new ApplicationError("Content is empty");
|
|
126
|
+
}
|
|
127
|
+
const bundler = new BundleServiceFactory("./").buildService();
|
|
113
128
|
return bundler.bundle({
|
|
114
129
|
basePaths: {
|
|
115
130
|
"speed-kit-config": "https://www.baqend.com/speed-kit-config/latest/",
|
|
@@ -120,5 +135,6 @@ async function bundle(content, app) {
|
|
|
120
135
|
define: {
|
|
121
136
|
APP: JSON.stringify(app),
|
|
122
137
|
},
|
|
138
|
+
platform: "browser",
|
|
123
139
|
});
|
|
124
140
|
}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const node_fs_1 = require("node:fs");
|
|
7
|
-
const os = tslib_1.__importStar(require("node:os"));
|
|
8
|
-
const path = tslib_1.__importStar(require("node:path"));
|
|
9
|
-
const customer_config_1 = require("./customer-config");
|
|
1
|
+
import { mkdtempSync } from "node:fs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { ConfigFile } from "./customer-config.js";
|
|
10
5
|
/**
|
|
11
6
|
* @deprecated
|
|
12
7
|
*/
|
|
13
|
-
async function createTemporalDirectory() {
|
|
8
|
+
export async function createTemporalDirectory() {
|
|
14
9
|
try {
|
|
15
|
-
return
|
|
10
|
+
return mkdtempSync(path.join(os.tmpdir(), "speed-kit-cli-"));
|
|
16
11
|
}
|
|
17
12
|
catch (error) {
|
|
18
13
|
console.error("Error creating temp folder", error);
|
|
@@ -22,9 +17,9 @@ async function createTemporalDirectory() {
|
|
|
22
17
|
/**
|
|
23
18
|
* @deprecated
|
|
24
19
|
*/
|
|
25
|
-
async function readLocalFile(basePath, fileName) {
|
|
20
|
+
export async function readLocalFile(basePath, fileName) {
|
|
26
21
|
try {
|
|
27
|
-
const file = await
|
|
22
|
+
const file = await ConfigFile.loadFile(basePath, fileName);
|
|
28
23
|
return await file.readContent();
|
|
29
24
|
}
|
|
30
25
|
catch {
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.parseSpeedKitConfig = parseSpeedKitConfig;
|
|
4
|
-
exports.getParsedConfig = getParsedConfig;
|
|
5
|
-
exports.getSpeedKitConfigVersion = getSpeedKitConfigVersion;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
|
-
const vm = tslib_1.__importStar(require("node:vm"));
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import * as vm from "node:vm";
|
|
8
3
|
/**
|
|
9
4
|
* @deprecated
|
|
10
5
|
* @param config
|
|
11
6
|
*/
|
|
12
|
-
function parseSpeedKitConfig(config) {
|
|
7
|
+
export function parseSpeedKitConfig(config) {
|
|
13
8
|
// Replace all properties that use function calls or that are related to other objects like window
|
|
14
9
|
const window = {};
|
|
15
10
|
window.top = window;
|
|
@@ -44,7 +39,7 @@ function parseSpeedKitConfig(config) {
|
|
|
44
39
|
vm.runInNewContext(config, context);
|
|
45
40
|
return window.speedKit;
|
|
46
41
|
}
|
|
47
|
-
async function getParsedConfig(configFile) {
|
|
42
|
+
export async function getParsedConfig(configFile) {
|
|
48
43
|
const configString = configFile ? await configFile.readContent() : undefined;
|
|
49
44
|
if (!configString) {
|
|
50
45
|
throw new Error("Speed Kit config could not be found in directory");
|
|
@@ -61,6 +56,7 @@ async function getParsedConfig(configFile) {
|
|
|
61
56
|
}
|
|
62
57
|
return parsedConfig;
|
|
63
58
|
}
|
|
64
|
-
function getSpeedKitConfigVersion(config) {
|
|
59
|
+
export function getSpeedKitConfigVersion(config) {
|
|
65
60
|
return Number(config.ruleSetConfig?.version) || 1;
|
|
66
61
|
}
|
|
62
|
+
/* eslint-enable */
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const htmlfy_1 = require("htmlfy");
|
|
5
|
-
function formatHtml(html) {
|
|
6
|
-
return (0, htmlfy_1.prettify)(html);
|
|
1
|
+
import { prettify } from "htmlfy";
|
|
2
|
+
export function formatHtml(html) {
|
|
3
|
+
return prettify(html);
|
|
7
4
|
}
|