@speedkit/cli 4.36.1 → 4.36.2

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.
Files changed (293) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/base/sk-command.d.ts +41 -0
  3. package/dist/base/sk-command.js +56 -0
  4. package/dist/commands/auto-prewarm.d.ts +6 -4
  5. package/dist/commands/auto-prewarm.js +13 -66
  6. package/dist/commands/autocomplete/fish.d.ts +2 -2
  7. package/dist/commands/autocomplete/fish.js +3 -2
  8. package/dist/commands/browser/clean.d.ts +2 -2
  9. package/dist/commands/browser/clean.js +6 -6
  10. package/dist/commands/browser/list.d.ts +2 -2
  11. package/dist/commands/browser/list.js +6 -7
  12. package/dist/commands/browser/update.d.ts +2 -2
  13. package/dist/commands/browser/update.js +9 -11
  14. package/dist/commands/bulk-deploy.d.ts +4 -2
  15. package/dist/commands/bulk-deploy.js +7 -37
  16. package/dist/commands/config/edit.d.ts +2 -2
  17. package/dist/commands/config/edit.js +2 -2
  18. package/dist/commands/config/setup.d.ts +5 -2
  19. package/dist/commands/config/setup.js +9 -19
  20. package/dist/commands/deploy.d.ts +12 -3
  21. package/dist/commands/deploy.js +14 -20
  22. package/dist/commands/diff-url-parameters.d.ts +3 -2
  23. package/dist/commands/diff-url-parameters.js +19 -16
  24. package/dist/commands/extension/add.d.ts +2 -2
  25. package/dist/commands/extension/add.js +6 -6
  26. package/dist/commands/extension/devtools.d.ts +2 -2
  27. package/dist/commands/extension/devtools.js +6 -7
  28. package/dist/commands/extension/list.d.ts +2 -2
  29. package/dist/commands/extension/list.js +5 -6
  30. package/dist/commands/extension/remove.d.ts +2 -2
  31. package/dist/commands/extension/remove.js +6 -6
  32. package/dist/commands/extension/update.d.ts +2 -2
  33. package/dist/commands/extension/update.js +5 -6
  34. package/dist/commands/find-pops.d.ts +2 -2
  35. package/dist/commands/find-pops.js +10 -11
  36. package/dist/commands/generate-customer-config.d.ts +5 -2
  37. package/dist/commands/generate-customer-config.js +9 -27
  38. package/dist/commands/generate-pop-config.d.ts +2 -2
  39. package/dist/commands/generate-pop-config.js +19 -15
  40. package/dist/commands/login.d.ts +2 -2
  41. package/dist/commands/login.js +6 -9
  42. package/dist/commands/onboarding.d.ts +18 -3
  43. package/dist/commands/onboarding.js +13 -11
  44. package/dist/commands/origin-request.d.ts +4 -2
  45. package/dist/commands/origin-request.js +10 -42
  46. package/dist/commands/prewarm.d.ts +4 -2
  47. package/dist/commands/prewarm.js +12 -56
  48. package/dist/commands/pull.d.ts +4 -2
  49. package/dist/commands/pull.js +9 -14
  50. package/dist/commands/query/parameter.d.ts +4 -2
  51. package/dist/commands/query/parameter.js +12 -19
  52. package/dist/commands/query/prewarm.d.ts +4 -2
  53. package/dist/commands/query/prewarm.js +16 -23
  54. package/dist/commands/revalidate.d.ts +4 -2
  55. package/dist/commands/revalidate.js +13 -56
  56. package/dist/commands/wpt-launcher.d.ts +2 -2
  57. package/dist/commands/wpt-launcher.js +16 -17
  58. package/dist/hooks/init/first-run.js +9 -10
  59. package/dist/models/context.d.ts +24 -0
  60. package/dist/models/context.js +31 -0
  61. package/dist/services/athena/athena-flags.d.ts +18 -0
  62. package/dist/services/athena/athena-flags.js +29 -0
  63. package/dist/services/athena/athena-service-build-context.d.ts +25 -0
  64. package/dist/services/athena/athena-service-build-context.js +4 -0
  65. package/dist/services/athena/athena-service-factory.d.ts +3 -16
  66. package/dist/services/athena/athena-service-factory.js +11 -27
  67. package/dist/services/athena/baqend-athena-service.d.ts +3 -14
  68. package/dist/services/athena/baqend-athena-service.js +8 -16
  69. package/dist/services/athena/index.d.ts +1 -0
  70. package/dist/services/athena/index.js +1 -0
  71. package/dist/services/athena/spec/baqend-athena-service.spec.js +2 -2
  72. package/dist/services/browser-fetch/browser-origin-fetch.d.ts +2 -2
  73. package/dist/services/browser-fetch/browser-origin-fetch.js +1 -1
  74. package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +3 -3
  75. package/dist/services/browser-fetch/browser-origin-fetcher.js +5 -5
  76. package/dist/services/browser-fetch/spec/browser-origin-fetch.spec.js +10 -10
  77. package/dist/services/cli/cli-environment-factory.d.ts +25 -0
  78. package/dist/services/cli/cli-environment-factory.js +30 -0
  79. package/dist/services/cli/cli-environment.d.ts +73 -0
  80. package/dist/services/cli/cli-environment.js +216 -0
  81. package/dist/services/cli/cli-service-build-context.d.ts +10 -0
  82. package/dist/services/cli/cli-service-build-context.js +4 -0
  83. package/dist/services/cli/cli-service-factory.d.ts +7 -7
  84. package/dist/services/cli/cli-service-factory.js +7 -7
  85. package/dist/services/cli/cli-service-model.d.ts +0 -4
  86. package/dist/services/cli/cli-service-model.js +0 -6
  87. package/dist/services/cli/cli-service.d.ts +16 -2
  88. package/dist/services/cli/cli-service.js +17 -18
  89. package/dist/services/cli/cli-settings.d.ts +37 -0
  90. package/dist/services/cli/cli-settings.js +23 -0
  91. package/dist/services/cli/command-build-context.d.ts +23 -0
  92. package/dist/services/cli/index.d.ts +5 -1
  93. package/dist/services/cli/index.js +5 -1
  94. package/dist/services/cli/spec/cli-environment-detection.spec.js +52 -0
  95. package/dist/services/cli/spec/cli-environment.spec.js +125 -0
  96. package/dist/services/cli/spec/cli-service.spec.js +9 -19
  97. package/dist/services/config-api/client.d.ts +3 -3
  98. package/dist/services/config-api/client.js +4 -4
  99. package/dist/services/config-api/config-api-factory.js +3 -3
  100. package/dist/services/config-api/entity-manager-provider.d.ts +11 -0
  101. package/dist/services/config-api/{entity-manager-factory.js → entity-manager-provider.js} +7 -1
  102. package/dist/services/customer-config/customer-config-service-build-context.d.ts +33 -0
  103. package/dist/services/customer-config/customer-config-service-build-context.js +36 -0
  104. package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -4
  105. package/dist/services/customer-config/customer-config-service-factory.js +5 -8
  106. package/dist/services/customer-config/customer-config-service.d.ts +2 -2
  107. package/dist/services/customer-config/index.d.ts +1 -1
  108. package/dist/services/customer-config/index.js +1 -1
  109. package/dist/services/customer-config/site-analyzer/index.d.ts +1 -0
  110. package/dist/services/customer-config/site-analyzer/index.js +1 -0
  111. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.d.ts +6 -0
  112. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.js +4 -0
  113. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +3 -3
  114. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +4 -5
  115. package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +0 -25
  116. package/dist/services/deploy/bulk/bulk-deploy-model.js +1 -27
  117. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.d.ts +51 -0
  118. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.js +50 -0
  119. package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +2 -4
  120. package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +2 -5
  121. package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +3 -2
  122. package/dist/services/deploy/bulk/config-deploy-factory.d.ts +3 -3
  123. package/dist/services/deploy/bulk/config-deploy-factory.js +16 -8
  124. package/dist/services/deploy/bulk/index.d.ts +1 -0
  125. package/dist/services/deploy/bulk/index.js +1 -0
  126. package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
  127. package/dist/services/deploy/checks/activation/customer-approval-check.js +4 -2
  128. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
  129. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +4 -2
  130. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
  131. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +4 -2
  132. package/dist/services/deploy/deploy-service-build-context.d.ts +63 -0
  133. package/dist/services/deploy/deploy-service-build-context.js +64 -0
  134. package/dist/services/deploy/deploy-service-factory.d.ts +5 -8
  135. package/dist/services/deploy/deploy-service-factory.js +28 -19
  136. package/dist/services/deploy/mr/base-config-reader.d.ts +6 -4
  137. package/dist/services/deploy/mr/base-config-reader.js +6 -8
  138. package/dist/services/deploy/mr/index.d.ts +1 -0
  139. package/dist/services/deploy/mr/index.js +1 -0
  140. package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +0 -35
  141. package/dist/services/deploy/mr/merge-request-deploy-model.js +0 -34
  142. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.d.ts +32 -0
  143. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.js +20 -0
  144. package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +2 -4
  145. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +31 -10
  146. package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +3 -2
  147. package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +14 -3
  148. package/dist/services/deploy/spec/checks/activation/customer-approval-check.spec.js +7 -5
  149. package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +2 -1
  150. package/dist/services/diff/diff-service-build-context.d.ts +14 -0
  151. package/dist/services/diff/diff-service-build-context.js +4 -0
  152. package/dist/services/diff/diff-service-factory.d.ts +4 -5
  153. package/dist/services/diff/diff-service-factory.js +4 -7
  154. package/dist/services/diff/index.d.ts +1 -1
  155. package/dist/services/diff/index.js +1 -1
  156. package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.d.ts → document-handler-runtime-model.d.ts} +0 -5
  157. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.d.ts +11 -0
  158. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.js +4 -0
  159. package/dist/services/document-handler-runtime/document-handler-server.js +2 -2
  160. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
  161. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +14 -14
  162. package/dist/services/document-handler-runtime/server/request.js +1 -1
  163. package/dist/services/document-handler-runtime/templates/database-mock.d.ts +1 -1
  164. package/dist/services/document-handler-runtime/templates/database-mock.js +1 -1
  165. package/dist/services/integration-api/customer-config-flags.d.ts +16 -0
  166. package/dist/services/integration-api/customer-config-flags.js +30 -0
  167. package/dist/services/integration-api/handler/install-resource-handler.d.ts +8 -0
  168. package/dist/services/integration-api/handler/install-resource-handler.js +10 -1
  169. package/dist/services/integration-api/index.d.ts +1 -0
  170. package/dist/services/integration-api/index.js +1 -0
  171. package/dist/services/integration-api/integration-api-factory.d.ts +4 -6
  172. package/dist/services/integration-api/integration-api-factory.js +11 -11
  173. package/dist/services/integration-api/integration-api-model.d.ts +0 -9
  174. package/dist/services/integration-api/integration-api-model.js +0 -16
  175. package/dist/services/integration-api/integration-api-service-build-context.d.ts +19 -0
  176. package/dist/services/integration-api/integration-api-service-build-context.js +4 -0
  177. package/dist/services/integration-api/spec/config-plugin.spec.js +1 -1
  178. package/dist/services/integration-api/spec/integration-api-service.spec.js +7 -3
  179. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +9 -2
  180. package/dist/services/integration-api/struct/config-plugin.d.ts +1 -1
  181. package/dist/services/integration-api/struct/config-plugin.js +12 -7
  182. package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +18 -2
  183. package/dist/services/integration-api/struct/speed-kit-config-file.js +22 -12
  184. package/dist/services/integration-api/struct/speed-kit-config.d.ts +1 -1
  185. package/dist/services/onboarding/browser/config/browser-config.d.ts +3 -3
  186. package/dist/services/onboarding/browser/config/browser-config.js +5 -5
  187. package/dist/services/onboarding/browser/executable/executable-validator.d.ts +3 -3
  188. package/dist/services/onboarding/browser/executable/executable-validator.js +17 -15
  189. package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -3
  190. package/dist/services/onboarding/browser/extension/extension-downloader.js +6 -6
  191. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
  192. package/dist/services/onboarding/browser/extension/extension-validator.js +4 -4
  193. package/dist/services/onboarding/file-events/file-watcher.js +1 -0
  194. package/dist/services/onboarding/index.d.ts +1 -1
  195. package/dist/services/onboarding/index.js +1 -1
  196. package/dist/services/onboarding/onboarding-model.d.ts +8 -24
  197. package/dist/services/onboarding/onboarding-model.js +19 -87
  198. package/dist/services/onboarding/onboarding-service-build-context.d.ts +57 -0
  199. package/dist/services/onboarding/onboarding-service-build-context.js +67 -0
  200. package/dist/services/onboarding/onboarding-service-factory.d.ts +2 -5
  201. package/dist/services/onboarding/onboarding-service-factory.js +47 -34
  202. package/dist/services/onboarding/spec/onboarding-model.spec.js +11 -6
  203. package/dist/services/origin-request/index.d.ts +1 -1
  204. package/dist/services/origin-request/index.js +1 -1
  205. package/dist/services/origin-request/origin-request-service-build-context.d.ts +52 -0
  206. package/dist/services/origin-request/origin-request-service-build-context.js +54 -0
  207. package/dist/services/origin-request/origin-request-service-factory.d.ts +2 -5
  208. package/dist/services/origin-request/origin-request-service-factory.js +12 -12
  209. package/dist/services/origin-request/origin-request-service.d.ts +2 -2
  210. package/dist/services/pop-config/index.d.ts +1 -0
  211. package/dist/services/pop-config/index.js +1 -0
  212. package/dist/services/pop-config/pop-config-factory.d.ts +4 -1
  213. package/dist/services/pop-config/pop-config-factory.js +10 -3
  214. package/dist/services/pop-config/pop-config-service-build-context.d.ts +10 -0
  215. package/dist/services/pop-config/pop-config-service-build-context.js +4 -0
  216. package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -31
  217. package/dist/services/prewarm/auto-pre-warm-factory.js +6 -11
  218. package/dist/services/prewarm/auto-pre-warm-service-build-context.d.ts +84 -0
  219. package/dist/services/prewarm/auto-pre-warm-service-build-context.js +68 -0
  220. package/dist/services/prewarm/index.d.ts +2 -0
  221. package/dist/services/prewarm/index.js +2 -0
  222. package/dist/services/prewarm/pre-warm-factory.d.ts +4 -5
  223. package/dist/services/prewarm/pre-warm-factory.js +6 -8
  224. package/dist/services/prewarm/pre-warm-model.d.ts +0 -10
  225. package/dist/services/prewarm/pre-warm-model.js +0 -18
  226. package/dist/services/prewarm/pre-warm-service-build-context.d.ts +47 -0
  227. package/dist/services/prewarm/pre-warm-service-build-context.js +64 -0
  228. package/dist/services/pull/index.d.ts +1 -0
  229. package/dist/services/pull/index.js +1 -0
  230. package/dist/services/pull/pull-service-build-context.d.ts +28 -0
  231. package/dist/services/pull/pull-service-build-context.js +17 -0
  232. package/dist/services/pull/pull-service-factory.d.ts +3 -5
  233. package/dist/services/pull/pull-service-factory.js +13 -14
  234. package/dist/services/pull/pull-service-model.d.ts +0 -5
  235. package/dist/services/pull/pull-service-model.js +0 -9
  236. package/dist/services/query-builder/query-builder-factory.d.ts +9 -7
  237. package/dist/services/query-builder/query-builder-factory.js +26 -15
  238. package/dist/{models/cli-parameters.d.ts → services/query-builder/query-builder-flags.d.ts} +1 -120
  239. package/dist/services/query-builder/query-builder-flags.js +150 -0
  240. package/dist/services/query-builder/query-builder-model.d.ts +1 -14
  241. package/dist/services/query-builder/query-builder-service-build-context.d.ts +113 -0
  242. package/dist/services/query-builder/query-builder-service-build-context.js +68 -0
  243. package/dist/services/query-builder/query-builder-service.d.ts +3 -3
  244. package/dist/services/query-builder/spec/query-builder-flags.spec.d.ts +1 -0
  245. package/dist/{models/spec/cli-parameters.spec.js → services/query-builder/spec/query-builder-flags.spec.js} +1 -1
  246. package/dist/services/revalidate/index.d.ts +1 -0
  247. package/dist/services/revalidate/index.js +1 -0
  248. package/dist/services/revalidate/revalidate-factory.d.ts +3 -5
  249. package/dist/services/revalidate/revalidate-factory.js +2 -6
  250. package/dist/services/revalidate/revalidate-model.d.ts +0 -9
  251. package/dist/services/revalidate/revalidate-model.js +0 -8
  252. package/dist/services/revalidate/revalidate-service-build-context.d.ts +38 -0
  253. package/dist/services/revalidate/revalidate-service-build-context.js +59 -0
  254. package/dist/services/setup/browser/browser-setup-service.d.ts +3 -4
  255. package/dist/services/setup/browser/browser-setup-service.js +16 -18
  256. package/dist/services/setup/difftool/difftool-setup-service.d.ts +3 -4
  257. package/dist/services/setup/difftool/difftool-setup-service.js +5 -7
  258. package/dist/services/setup/extension/extension-setup-service.d.ts +3 -4
  259. package/dist/services/setup/extension/extension-setup-service.js +8 -10
  260. package/dist/services/setup/index.d.ts +1 -1
  261. package/dist/services/setup/index.js +1 -1
  262. package/dist/services/setup/setup-service-build-context.d.ts +27 -0
  263. package/dist/services/setup/setup-service-build-context.js +26 -0
  264. package/dist/services/setup/setup-service-factory.d.ts +2 -6
  265. package/dist/services/setup/setup-service-factory.js +10 -18
  266. package/dist/services/setup/setup-service.d.ts +4 -5
  267. package/dist/services/setup/setup-service.js +6 -7
  268. package/oclif.manifest.json +1 -1
  269. package/package.json +4 -2
  270. package/dist/models/cli-parameters.js +0 -297
  271. package/dist/services/cli/cli-config.d.ts +0 -59
  272. package/dist/services/cli/cli-config.js +0 -180
  273. package/dist/services/cli/environment.d.ts +0 -15
  274. package/dist/services/cli/environment.js +0 -40
  275. package/dist/services/cli/spec/cli-config.spec.js +0 -117
  276. package/dist/services/cli/spec/environment.spec.js +0 -28
  277. package/dist/services/config-api/entity-manager-factory.d.ts +0 -5
  278. package/dist/services/customer-config/customer-config-service-context.d.ts +0 -13
  279. package/dist/services/customer-config/customer-config-service-context.js +0 -21
  280. package/dist/services/deploy/context/deploy-context.d.ts +0 -32
  281. package/dist/services/deploy/context/deploy-context.js +0 -72
  282. package/dist/services/diff/diff-model.d.ts +0 -9
  283. package/dist/services/diff/diff-model.js +0 -12
  284. package/dist/services/origin-request/origin-request-context.d.ts +0 -13
  285. package/dist/services/origin-request/origin-request-context.js +0 -23
  286. package/dist/services/query-builder/query-command.d.ts +0 -28
  287. package/dist/services/query-builder/query-command.js +0 -37
  288. package/dist/services/setup/setup-context.d.ts +0 -14
  289. package/dist/services/setup/setup-context.js +0 -15
  290. /package/dist/{models/spec/cli-parameters.spec.d.ts → services/cli/command-build-context.js} +0 -0
  291. /package/dist/services/cli/spec/{cli-config.spec.d.ts → cli-environment-detection.spec.d.ts} +0 -0
  292. /package/dist/services/cli/spec/{environment.spec.d.ts → cli-environment.spec.d.ts} +0 -0
  293. /package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.js → document-handler-runtime-model.js} +0 -0
@@ -1,3 +1,4 @@
1
1
  export * from "./integration-api-model.js";
2
+ export * from "./integration-api-service-build-context.js";
2
3
  export * from "./integration-api-factory.js";
3
4
  export * from "./integration-api-service.js";
@@ -1,14 +1,12 @@
1
1
  import { IntegrationApiService } from "./integration-api-service.js";
2
- import { CliServiceInterface, UserCliConfig } from "../cli/index.js";
3
- import { IntegrationApiContext } from "./integration-api-model.js";
2
+ import { IntegrationApiServiceBuildContext } from "./integration-api-service-build-context.js";
4
3
  export declare class IntegrationApiFactory {
5
- private context;
6
- private cliConfig;
7
- private cli?;
4
+ private readonly context;
8
5
  service?: IntegrationApiService;
9
6
  private fileReader?;
10
- constructor(context: IntegrationApiContext, cliConfig: UserCliConfig, cli?: CliServiceInterface);
7
+ constructor(context: IntegrationApiServiceBuildContext);
11
8
  buildService(): IntegrationApiService;
12
9
  private build;
10
+ private get whitelist();
13
11
  private getFileReader;
14
12
  }
@@ -7,19 +7,16 @@ import InstallResourceHandler from "./handler/install-resource-handler.js";
7
7
  import ModuleHandler from "./handler/module-handler.js";
8
8
  import ServerConfigHandler from "./handler/server-config-handler.js";
9
9
  import FileWriter from "./file-writer.js";
10
- import { CliServiceFactory, } from "../cli/index.js";
10
+ import { DEFAULT_BLOCKED_FILES, DEFAULT_BLOCKED_FOLDERS, } from "./integration-api-model.js";
11
11
  import { VirtualFileHandler } from "./virtual/virtual-file-handler.js";
12
12
  import fs from "node:fs";
13
+ import { BundleServiceFactory } from "../bundler/index.js";
13
14
  export class IntegrationApiFactory {
14
15
  context;
15
- cliConfig;
16
- cli;
17
16
  service = undefined;
18
17
  fileReader;
19
- constructor(context, cliConfig, cli) {
18
+ constructor(context) {
20
19
  this.context = context;
21
- this.cliConfig = cliConfig;
22
- this.cli = cli;
23
20
  }
24
21
  buildService() {
25
22
  if (!(this.service instanceof IntegrationApiService)) {
@@ -29,18 +26,21 @@ export class IntegrationApiFactory {
29
26
  }
30
27
  build() {
31
28
  const fileReader = this.getFileReader();
32
- const cli = this.cli ?? new CliServiceFactory().getService();
29
+ const cli = this.context.environment.cli;
33
30
  const virtualFileHandler = new VirtualFileHandler(cli);
34
31
  this.service = new IntegrationApiService(fileReader, virtualFileHandler, new MandatoryFilesValidator(), [
35
- new CustomerConfigHandler(fileReader, cli, new CustomerConfigValidator(), this.context.configName, this.cliConfig.testApp, this.context.useTestConfig),
36
- new InstallResourceHandler(fileReader),
32
+ new CustomerConfigHandler(fileReader, cli, new CustomerConfigValidator(), this.context.configName, this.context.environment.settings.testApp, this.context.useTestConfig ?? false),
33
+ new InstallResourceHandler(fileReader, new BundleServiceFactory("./").buildService()),
37
34
  new ServerConfigHandler(fileReader),
38
35
  new ModuleHandler(fileReader),
39
- ], new FileWriter(fs, this.context.basePath), this.context.whitelist.length === 0);
36
+ ], new FileWriter(fs, this.context.basePath), this.whitelist.length === 0);
37
+ }
38
+ get whitelist() {
39
+ return this.context.whitelist ?? [];
40
40
  }
41
41
  getFileReader() {
42
42
  if (!this.fileReader) {
43
- this.fileReader = new FileReader(fs, this.context.configName, this.context.basePath, this.context.whitelist, this.context.blockedFolders, this.context.blockedFiles);
43
+ this.fileReader = new FileReader(fs, this.context.configName, this.context.basePath, this.whitelist, this.context.blockedFolders ?? DEFAULT_BLOCKED_FOLDERS, this.context.blockedFiles ?? DEFAULT_BLOCKED_FILES);
44
44
  }
45
45
  return this.fileReader;
46
46
  }
@@ -109,12 +109,3 @@ export interface VirtualFileConfig {
109
109
  }
110
110
  export declare const DEFAULT_BLOCKED_FOLDERS: string[];
111
111
  export declare const DEFAULT_BLOCKED_FILES: string[];
112
- export declare class IntegrationApiContext {
113
- readonly basePath: string;
114
- readonly configName: string;
115
- readonly whitelist: string[];
116
- readonly blockedFolders: string[];
117
- readonly useTestConfig: boolean;
118
- readonly blockedFiles: string[];
119
- constructor(basePath: string, configName: string, whitelist?: string[], blockedFolders?: string[], useTestConfig?: boolean, blockedFiles?: string[]);
120
- }
@@ -32,19 +32,3 @@ export const DEFAULT_BLOCKED_FOLDERS = [
32
32
  // "_pre-poc": parked pre-PoC files created by the graduation flow of
33
33
  // generate-customer-config — kept for the manual merge, never deployed.
34
34
  export const DEFAULT_BLOCKED_FILES = ["page-examples", "_pre-poc"];
35
- export class IntegrationApiContext {
36
- basePath;
37
- configName;
38
- whitelist;
39
- blockedFolders;
40
- useTestConfig;
41
- blockedFiles;
42
- constructor(basePath, configName, whitelist = [], blockedFolders = DEFAULT_BLOCKED_FOLDERS, useTestConfig = false, blockedFiles = DEFAULT_BLOCKED_FILES) {
43
- this.basePath = basePath;
44
- this.configName = configName;
45
- this.whitelist = whitelist;
46
- this.blockedFolders = blockedFolders;
47
- this.useTestConfig = useTestConfig;
48
- this.blockedFiles = blockedFiles;
49
- }
50
- }
@@ -0,0 +1,19 @@
1
+ import { CommandContextValues } from "../cli/index.js";
2
+ export interface IntegrationApiServiceBuildContextValues extends CommandContextValues {
3
+ /** The customer directory. */
4
+ readonly basePath: string;
5
+ /** Which block of config_customer to read. */
6
+ readonly configName: string;
7
+ /** Logical names of the files to load; empty or left out loads them all. */
8
+ readonly whitelist?: string[];
9
+ /** Folders never read; `DEFAULT_BLOCKED_FOLDERS` when left out. */
10
+ readonly blockedFolders?: string[];
11
+ readonly useTestConfig?: boolean;
12
+ /** Files never read; `DEFAULT_BLOCKED_FILES` when left out. */
13
+ readonly blockedFiles?: string[];
14
+ }
15
+ declare const IntegrationApiServiceBuildContext_base: new (values: IntegrationApiServiceBuildContextValues) => Readonly<IntegrationApiServiceBuildContextValues>;
16
+ /** Which customer directory the integration API reads, and how much of it. */
17
+ export declare class IntegrationApiServiceBuildContext extends IntegrationApiServiceBuildContext_base {
18
+ }
19
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Context } from "../../models/context.js";
2
+ /** Which customer directory the integration API reads, and how much of it. */
3
+ export class IntegrationApiServiceBuildContext extends Context() {
4
+ }
@@ -1,7 +1,7 @@
1
1
  import * as vm from "node:vm";
2
2
  import { expect } from "chai";
3
3
  import { describe, it } from "mocha";
4
- import { SpeedKitConfig } from "../struct/speed-kit-config.js";
4
+ import { SpeedKitConfig, } from "../struct/speed-kit-config.js";
5
5
  /**
6
6
  * The plugin shapes here mirror the published bundles at
7
7
  * `https://www.baqend.com/speed-kit-config/latest/`: a `name`, an `options`,
@@ -1,10 +1,11 @@
1
+ import { BundleServiceFactory } from "../../bundler/index.js";
1
2
  import { expect } from "chai";
2
3
  import { after, before, describe, it } from "mocha";
3
4
  import { VirtualFileHandler, } from "../integration-api-model.js";
4
5
  import { IntegrationApiService } from "../integration-api-service.js";
5
6
  import FileReader from "../file-reader.js";
6
7
  import { fs, vol } from "memfs";
7
- import { CliServiceFactory } from "../../cli/index.js";
8
+ import { CliServiceBuildContext, CliServiceFactory, } from "../../cli/index.js";
8
9
  import FileWriter from "../file-writer.js";
9
10
  import MandatoryFilesValidator from "../validator/mandatory-files-validator.js";
10
11
  import CustomerConfigHandler from "../handler/customer-config-handler.js";
@@ -15,7 +16,10 @@ const afterTest = () => {
15
16
  vol.reset();
16
17
  };
17
18
  function prepareDependencies() {
18
- const cli = new CliServiceFactory().getService();
19
+ const cli = new CliServiceFactory(new CliServiceBuildContext({
20
+ environment: { isCI: true, nonInteractive: true },
21
+ quiet: false,
22
+ })).getService();
19
23
  const virtualFileHandler = new VirtualFileHandler(cli);
20
24
  // @ts-expect-error fs is not compatible
21
25
  const fileReader = new FileReader(fs, "test", "/test_customer", [], []);
@@ -23,7 +27,7 @@ function prepareDependencies() {
23
27
  const validator = new MandatoryFilesValidator();
24
28
  const customerConfigValidator = new CustomerConfigValidator();
25
29
  const customerConfigHandler = new CustomerConfigHandler(fileReader, cli, customerConfigValidator, "test", "test");
26
- const installResourceHandler = new InstallResourceHandler(fileReader);
30
+ const installResourceHandler = new InstallResourceHandler(fileReader, new BundleServiceFactory("./").buildService());
27
31
  return {
28
32
  virtualFileHandler,
29
33
  fileReader,
@@ -2,8 +2,15 @@ import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
3
  import { SpeedKitConfigFile, VirtualSpeedKitConfigFile } from "../index.js";
4
4
  import { INTEGRATION_FILES } from "../../../models/files.js";
5
+ import { BundleServiceFactory } from "../../bundler/index.js";
6
+ const bundler = new BundleServiceFactory("./").buildService();
5
7
  function configFile(source) {
6
- return new SpeedKitConfigFile(INTEGRATION_FILES.CONFIG.SPEED_KIT, "config_SpeedKit.js", source, "config");
8
+ return new SpeedKitConfigFile({
9
+ name: INTEGRATION_FILES.CONFIG.SPEED_KIT,
10
+ path: "config_SpeedKit.js",
11
+ content: source,
12
+ remoteKey: "config",
13
+ }, bundler);
7
14
  }
8
15
  function evaluate(source) {
9
16
  return configFile(source).evaluate("shop-de", "https://www.shop.de");
@@ -100,7 +107,7 @@ describe("SpeedKitConfigFile", () => {
100
107
  });
101
108
  it("should read the deployed config the same way as the local file", async () => {
102
109
  const source = `window.speedKit = { split: 0.5, appName: APP };`;
103
- const remote = await VirtualSpeedKitConfigFile.createRemote(source);
110
+ const remote = await VirtualSpeedKitConfigFile.createRemote(source, bundler);
104
111
  const local = await evaluate(source);
105
112
  const deployed = await remote.evaluate("shop-de", "https://www.shop.de");
106
113
  expect(deployed).to.deep.equal(local);
@@ -24,7 +24,7 @@ import type { EvaluatedSpeedKitConfig } from "./speed-kit-config.js";
24
24
  * here, or the query builder quietly goes back to reading half a config.
25
25
  */
26
26
  /** A plugin instance as the evaluated config registered it. */
27
- export type ConfigPluginLike = Record<string, any>;
27
+ export type ConfigPluginLike = Record<string, unknown>;
28
28
  export interface AppliedConfigPlugins {
29
29
  /** The config as Speed Kit runs it: what the file wrote plus every hook. */
30
30
  readonly config: EvaluatedSpeedKitConfig;
@@ -33,10 +33,10 @@ export function applyConfigPlugins(evaluated, plugins) {
33
33
  // why a plugin declares its hooks as instance fields and its helpers on
34
34
  // the prototype.
35
35
  for (const key of Object.keys(plugin)) {
36
- const hook = plugin[key];
37
- if (typeof hook !== "function") {
36
+ if (typeof plugin[key] !== "function") {
38
37
  continue;
39
38
  }
39
+ const hook = plugin[key];
40
40
  if (key === APPLY_TO_CONFIG) {
41
41
  deferred.push(hook);
42
42
  contributed = true;
@@ -87,7 +87,8 @@ function getConfigValues(hook, configCopy, plugin) {
87
87
  return value;
88
88
  }
89
89
  const name = pluginName(plugin);
90
- const exclude = plugin.options?.exclude;
90
+ const options = plugin.options;
91
+ const exclude = options?.exclude;
91
92
  const rules = exclude ? applyExcludeTag(value, exclude, name) : value;
92
93
  return prepareRules(rules, name);
93
94
  }
@@ -119,7 +120,10 @@ function addDisabledScopes(modification, config) {
119
120
  return;
120
121
  }
121
122
  const scopes = typeof modification === "string" ? [modification] : modification;
122
- config.disabledScopes = [...(config.disabledScopes || []), ...scopes];
123
+ config.disabledScopes = [
124
+ ...(config.disabledScopes || []),
125
+ ...scopes,
126
+ ];
123
127
  }
124
128
  /** `speed-kit/snippet/configplugins/modifiers/addStripQueryParams.ts` */
125
129
  function addStripQueryParams(modification, config) {
@@ -134,8 +138,9 @@ function addStripQueryParams(modification, config) {
134
138
  // Conditions and rules must not be mixed: the service worker converts the
135
139
  // whole property at once, so both sides become rules here.
136
140
  const converted = toStripParamsRules(modification);
137
- config.stripQueryParams = toStripParamsRules(config.stripQueryParams);
138
- config.stripQueryParams.push(...converted);
141
+ const rules = toStripParamsRules(config.stripQueryParams);
142
+ config.stripQueryParams = rules;
143
+ rules.push(...converted);
139
144
  }
140
145
  /** `speed-kit/snippet/configplugins/helpers/isTypeCondition.ts` */
141
146
  function isCondition(value) {
@@ -231,7 +236,7 @@ function deepClone(value, sources = [], clones = []) {
231
236
  clone.lastIndex = source.lastIndex;
232
237
  return clone;
233
238
  }
234
- const out = Array.isArray(value) ? [] : {};
239
+ const out = (Array.isArray(value) ? [] : {});
235
240
  sources.push(value);
236
241
  clones.push(out);
237
242
  for (const key of Object.keys(value)) {
@@ -1,8 +1,17 @@
1
+ import type { BundleService } from "../../bundler/index.js";
1
2
  import type { SpeedKitConfigInterface, VirtualFileInterface, VirtualFileRecipe } from "../integration-api-model.js";
2
3
  import { InstallResourceFile } from "./install-resource-file.js";
3
4
  import { SpeedKitConfig } from "./speed-kit-config.js";
4
5
  /** The name the config deployed to the app is read back under. */
5
6
  export declare const REMOTE_SPEED_KIT_CONFIG = "config_SpeedKit@remote";
7
+ /** The file a {@link SpeedKitConfigFile} stands for. */
8
+ export interface SpeedKitConfigFileInit {
9
+ name: string;
10
+ path: string;
11
+ content: string;
12
+ /** The key the file is uploaded under in the install resource. */
13
+ remoteKey: string;
14
+ }
6
15
  /**
7
16
  * `config_SpeedKit.js` — an install resource that can also read itself.
8
17
  *
@@ -12,12 +21,18 @@ export declare const REMOTE_SPEED_KIT_CONFIG = "config_SpeedKit@remote";
12
21
  * them through {@link evaluate}, so they all read the same config the same way.
13
22
  */
14
23
  export declare class SpeedKitConfigFile extends InstallResourceFile implements SpeedKitConfigInterface {
24
+ private readonly bundler;
15
25
  /**
16
26
  * One evaluation per app and origin. A config branches on
17
27
  * `window.location`, so the same file read for two origins is two different
18
28
  * configs — and bundling one is expensive enough not to repeat per caller.
19
29
  */
20
30
  private readonly evaluations;
31
+ /**
32
+ * @param file the file this config is read from
33
+ * @param bundler bundles the config source before it is run
34
+ */
35
+ constructor(file: SpeedKitConfigFileInit, bundler: BundleService);
21
36
  setContent(content: string): void;
22
37
  /** The config this file describes for one app and origin. */
23
38
  evaluate(app: string, origin: string): Promise<SpeedKitConfig>;
@@ -35,9 +50,10 @@ export declare class VirtualSpeedKitConfigFile extends SpeedKitConfigFile implem
35
50
  * itself.
36
51
  *
37
52
  * @param content the `config` of the active install resource
53
+ * @param bundler bundles it before it is run, as for the local file
38
54
  */
39
- static createRemote(content: string): Promise<VirtualSpeedKitConfigFile>;
40
- constructor(name: string, recipe: VirtualFileRecipe, remoteKey?: string);
55
+ static createRemote(content: string, bundler: BundleService): Promise<VirtualSpeedKitConfigFile>;
56
+ constructor(name: string, recipe: VirtualFileRecipe, bundler: BundleService, remoteKey?: string);
41
57
  buildContent(): Promise<void>;
42
58
  updateFile(): Promise<void>;
43
59
  updateIfChanged(): Promise<void>;
@@ -1,5 +1,4 @@
1
1
  import * as vm from "node:vm";
2
- import { BundleServiceFactory } from "../../bundler/index.js";
3
2
  import { EvaluateSkConfigError } from "../error/evaluate-sk-config-error.js";
4
3
  import ApplicationError from "../../error-handling/error/application-error.js";
5
4
  import { StaticRecipe } from "../virtual/static-recipe.js";
@@ -16,12 +15,21 @@ export const REMOTE_SPEED_KIT_CONFIG = "config_SpeedKit@remote";
16
15
  * them through {@link evaluate}, so they all read the same config the same way.
17
16
  */
18
17
  export class SpeedKitConfigFile extends InstallResourceFile {
18
+ bundler;
19
19
  /**
20
20
  * One evaluation per app and origin. A config branches on
21
21
  * `window.location`, so the same file read for two origins is two different
22
22
  * configs — and bundling one is expensive enough not to repeat per caller.
23
23
  */
24
24
  evaluations = new Map();
25
+ /**
26
+ * @param file the file this config is read from
27
+ * @param bundler bundles the config source before it is run
28
+ */
29
+ constructor(file, bundler) {
30
+ super(file.name, file.path, file.content, file.remoteKey);
31
+ this.bundler = bundler;
32
+ }
25
33
  setContent(content) {
26
34
  super.setContent(content);
27
35
  this.evaluations.clear();
@@ -33,7 +41,9 @@ export class SpeedKitConfigFile extends InstallResourceFile {
33
41
  if (cached) {
34
42
  return cached;
35
43
  }
36
- const evaluation = evaluateSpeedKitConfig(app, origin, this.getContent(), this.path).catch((error) => {
44
+ const evaluation = bundle(this.bundler, this.getContent(), app)
45
+ .then((code) => evaluateSpeedKitConfig(app, origin, code, this.path))
46
+ .catch((error) => {
37
47
  // A failure is not an answer: forget it, so the next caller — or the
38
48
  // next read after the file was fixed — evaluates again.
39
49
  this.evaluations.delete(key);
@@ -56,14 +66,15 @@ export class VirtualSpeedKitConfigFile extends SpeedKitConfigFile {
56
66
  * itself.
57
67
  *
58
68
  * @param content the `config` of the active install resource
69
+ * @param bundler bundles it before it is run, as for the local file
59
70
  */
60
- static async createRemote(content) {
61
- const file = new VirtualSpeedKitConfigFile(REMOTE_SPEED_KIT_CONFIG, new StaticRecipe(content));
71
+ static async createRemote(content, bundler) {
72
+ const file = new VirtualSpeedKitConfigFile(REMOTE_SPEED_KIT_CONFIG, new StaticRecipe(content), bundler);
62
73
  await file.buildContent();
63
74
  return file;
64
75
  }
65
- constructor(name, recipe, remoteKey = "config") {
66
- super(name, name, "", remoteKey);
76
+ constructor(name, recipe, bundler, remoteKey = "config") {
77
+ super({ name, path: name, content: "", remoteKey }, bundler);
67
78
  this.recipe = recipe;
68
79
  }
69
80
  async buildContent() {
@@ -83,17 +94,17 @@ export class VirtualSpeedKitConfigFile extends SpeedKitConfigFile {
83
94
  }
84
95
  }
85
96
  /**
86
- * Run a config source against a browser mock and hand back what it assigned to
97
+ * Run a bundled config against a browser mock and hand back what it assigned to
87
98
  * `window.speedKit`, together with the config plugins it registered.
88
99
  *
89
100
  * @param app the app the config is evaluated for, exposed to it as `APP`
90
101
  * @param origin the origin the config is evaluated for, its `window.location`
91
- * @param content the config source, unbundled
102
+ * @param code the config source, bundled
92
103
  * @param filename what an error in the config is reported under
93
104
  */
94
- async function evaluateSpeedKitConfig(app, origin, content, filename) {
105
+ function evaluateSpeedKitConfig(app, origin, code, filename) {
95
106
  const browserContext = buildBrowserMock(origin, app);
96
- const fileContent = safeFileContentWrapper(await bundle(content, app));
107
+ const fileContent = safeFileContentWrapper(code);
97
108
  vm.runInNewContext(fileContent, browserContext, {
98
109
  filename,
99
110
  displayErrors: false,
@@ -203,11 +214,10 @@ function safeFileContentWrapper(fileContent) {
203
214
  }
204
215
  `;
205
216
  }
206
- async function bundle(content, app) {
217
+ async function bundle(bundler, content, app) {
207
218
  if (!content) {
208
219
  throw new ApplicationError("Content is empty");
209
220
  }
210
- const bundler = new BundleServiceFactory("./").buildService();
211
221
  return bundler.bundle({
212
222
  basePaths: {
213
223
  "speed-kit-config": "https://www.baqend.com/speed-kit-config/latest/",
@@ -3,7 +3,7 @@ import { ConfigPluginLike } from "./config-plugin.js";
3
3
  * The `window.speedKit` a config assigned, exactly as it wrote it — before
4
4
  * anything has been made sense of.
5
5
  */
6
- export type EvaluatedSpeedKitConfig = Record<string, any>;
6
+ export type EvaluatedSpeedKitConfig = Record<string, unknown>;
7
7
  /**
8
8
  * One rule of a rule set.
9
9
  *
@@ -1,11 +1,11 @@
1
- import { UserCliConfig } from "../../../cli/index.js";
1
+ import { CliEnvironment } from "../../../cli/index.js";
2
2
  /**
3
3
  * this class makes sure you always start skOnboarding with a fresh browser,
4
4
  * but still keep your window/devtools-configuration
5
5
  */
6
6
  export declare class BrowserConfig {
7
- private userConfig;
8
- constructor(userConfig: UserCliConfig);
7
+ private environment;
8
+ constructor(environment: CliEnvironment);
9
9
  /**
10
10
  * create a new temporary profileFolder
11
11
  * load browserConfigJsonFile from last profileFolder
@@ -15,9 +15,9 @@ const keysToRemove = new Set([
15
15
  * but still keep your window/devtools-configuration
16
16
  */
17
17
  export class BrowserConfig {
18
- userConfig;
19
- constructor(userConfig) {
20
- this.userConfig = userConfig;
18
+ environment;
19
+ constructor(environment) {
20
+ this.environment = environment;
21
21
  }
22
22
  /**
23
23
  * create a new temporary profileFolder
@@ -25,8 +25,8 @@ export class BrowserConfig {
25
25
  * delete older profiles
26
26
  */
27
27
  loadProfileTempDir() {
28
- const chromeProfilePath = path.resolve(this.userConfig.tempFolder, chromeProfilesParentFolder, String(Date.now()));
29
- const chromeProfilesParentFolderPath = path.resolve(this.userConfig.tempFolder, chromeProfilesParentFolder);
28
+ const chromeProfilePath = path.resolve(this.environment.cacheDir, chromeProfilesParentFolder, String(Date.now()));
29
+ const chromeProfilesParentFolderPath = path.resolve(this.environment.cacheDir, chromeProfilesParentFolder);
30
30
  // create parentFolder if not exists
31
31
  if (!fs.existsSync(chromeProfilesParentFolderPath)) {
32
32
  fs.mkdirSync(chromeProfilesParentFolderPath, { recursive: true });
@@ -1,8 +1,8 @@
1
- import { CliServiceInterface, UserCliConfig } from "../../../cli/index.js";
1
+ import { CliServiceInterface, CliEnvironment } from "../../../cli/index.js";
2
2
  export declare class ExecutableValidator {
3
- readonly userConfig: UserCliConfig;
3
+ readonly environment: CliEnvironment;
4
4
  private cli;
5
- constructor(userConfig: UserCliConfig, cli: CliServiceInterface);
5
+ constructor(environment: CliEnvironment, cli: CliServiceInterface);
6
6
  validateOrInstall(): Promise<string | undefined>;
7
7
  private getCurrentBrowserVersion;
8
8
  private getExecutablePathFromPuppeteer;
@@ -5,15 +5,15 @@ import ApplicationError from "../../../error-handling/error/application-error.js
5
5
  import { Cache } from "@puppeteer/browsers";
6
6
  import { resolve } from "node:path";
7
7
  export class ExecutableValidator {
8
- userConfig;
8
+ environment;
9
9
  cli;
10
- constructor(userConfig, cli) {
11
- this.userConfig = userConfig;
10
+ constructor(environment, cli) {
11
+ this.environment = environment;
12
12
  this.cli = cli;
13
13
  }
14
14
  async validateOrInstall() {
15
15
  // check if a valid browserExecutablePath is configured
16
- const userChromePath = this.userConfig?.chromePath;
16
+ const userChromePath = this.environment?.settings.chromePath;
17
17
  if (this.isValidBrowserExecutable()) {
18
18
  return this.getCurrentBrowserVersion();
19
19
  }
@@ -22,11 +22,12 @@ export class ExecutableValidator {
22
22
  this.cli.writeError(`Invalid "chromePath" configured: ${userChromePath}`);
23
23
  }
24
24
  // check if a browser is installed via puppeteer
25
- const puppeteerCache = new Cache(this.userConfig.tempFolder);
25
+ const puppeteerCache = new Cache(this.environment.cacheDir);
26
26
  const installedBrowsers = puppeteerCache.getInstalledBrowsers();
27
27
  if (installedBrowsers.length > 0) {
28
28
  // found an installed browser, set path to this
29
- this.userConfig.chromePath = installedBrowsers[0].executablePath;
29
+ this.environment.settings.chromePath =
30
+ installedBrowsers[0].executablePath;
30
31
  return this.getCurrentBrowserVersion();
31
32
  }
32
33
  // write warning that no browser is configured
@@ -38,7 +39,7 @@ export class ExecutableValidator {
38
39
  // @todo set more detailed error message here.
39
40
  if (!result) {
40
41
  throw new ApplicationError("No Browser found to use", [
41
- `set path to browser executable (chromePath) in ${this.userConfig.runtimeConfig.configDir}/config.json`,
42
+ `set path to browser executable (chromePath) in ${this.environment.oclif.configDir}/config.json`,
42
43
  `set path to browser executable (CHROME_PATH) in ./.env or as systemwide env`,
43
44
  `let the ci download the latest chrome for you`,
44
45
  ]);
@@ -46,7 +47,8 @@ export class ExecutableValidator {
46
47
  // use puppeteerCli to download chrome
47
48
  await this.installBrowser();
48
49
  // set path to freshly installed chrome
49
- this.userConfig.chromePath = this.getExecutablePathFromPuppeteer();
50
+ this.environment.settings.chromePath =
51
+ this.getExecutablePathFromPuppeteer();
50
52
  return this.getCurrentBrowserVersion();
51
53
  }
52
54
  getCurrentBrowserVersion() {
@@ -54,23 +56,23 @@ export class ExecutableValidator {
54
56
  // so we use a powershell instead. Emit `<ProductName> <FileVersion>` so the
55
57
  // output is shape-compatible with `chrome --version` on macOS/Linux —
56
58
  // downstream consumers (isChromeBrowser, log lines) can stay OS-agnostic.
57
- if (this.userConfig.runtimeConfig.windows) {
58
- return this.cli.execSync(`$i = (Get-Item '${this.userConfig.chromePath}').VersionInfo; "$($i.ProductName) $($i.FileVersion)"`, { shell: "powershell.exe" });
59
+ if (this.environment.oclif.windows) {
60
+ return this.cli.execSync(`$i = (Get-Item '${this.environment.settings.chromePath}').VersionInfo; "$($i.ProductName) $($i.FileVersion)"`, { shell: "powershell.exe" });
59
61
  }
60
- return this.cli.execSync(`"${this.userConfig.chromePath}" --version`);
62
+ return this.cli.execSync(`"${this.environment.settings.chromePath}" --version`);
61
63
  }
62
64
  getExecutablePathFromPuppeteer() {
63
- const puppeteerCache = new Cache(this.userConfig.tempFolder);
65
+ const puppeteerCache = new Cache(this.environment.cacheDir);
64
66
  const installedBrowsers = puppeteerCache.getInstalledBrowsers();
65
67
  return installedBrowsers[0].executablePath;
66
68
  }
67
69
  isValidBrowserExecutable() {
68
- return (this.userConfig?.chromePath.length > 0 &&
69
- existsSync(resolve(this.userConfig?.chromePath.trim())));
70
+ return (this.environment?.settings.chromePath.length > 0 &&
71
+ existsSync(resolve(this.environment?.settings.chromePath.trim())));
70
72
  }
71
73
  async installBrowser() {
72
74
  const puppeteerCli = new CLI({
73
- cachePath: this.userConfig.tempFolder,
75
+ cachePath: this.environment.cacheDir,
74
76
  scriptName: "@puppeteer/browsers",
75
77
  prefixCommand: {
76
78
  cmd: "browsers",
@@ -1,4 +1,4 @@
1
- import { CliServiceInterface, UserCliConfig } from "../../../cli/index.js";
1
+ import { CliServiceInterface, CliEnvironment } from "../../../cli/index.js";
2
2
  interface DevtoolsInstallOptions {
3
3
  /** ask before installing or updating, off for an explicit install command */
4
4
  confirm?: boolean;
@@ -12,9 +12,9 @@ export interface DevtoolsInstallResult {
12
12
  status: "installed" | "updated" | "up-to-date" | "kept" | "declined" | "failed";
13
13
  }
14
14
  export declare class ExtensionDownloader {
15
- private userConfig;
15
+ private environment;
16
16
  private cli;
17
- constructor(userConfig: UserCliConfig, cli: CliServiceInterface);
17
+ constructor(environment: CliEnvironment, cli: CliServiceInterface);
18
18
  /**
19
19
  * path of the devtools extension to load, or undefined when there is none
20
20
  */
@@ -5,10 +5,10 @@ import extract from "extract-zip";
5
5
  import { safe } from "../../../../helpers/safe.js";
6
6
  const devtools = "integration-devtools";
7
7
  export class ExtensionDownloader {
8
- userConfig;
8
+ environment;
9
9
  cli;
10
- constructor(userConfig, cli) {
11
- this.userConfig = userConfig;
10
+ constructor(environment, cli) {
11
+ this.environment = environment;
12
12
  this.cli = cli;
13
13
  }
14
14
  /**
@@ -62,7 +62,7 @@ export class ExtensionDownloader {
62
62
  return result;
63
63
  }
64
64
  get installedPath() {
65
- return path.resolve(this.userConfig.tempFolder, devtools);
65
+ return path.resolve(this.environment.cacheDir, devtools);
66
66
  }
67
67
  async installLatest(status) {
68
68
  this.cli.startAction("ONBOARDING:UPDATE:DEVTOOLS", "update integration-devtools");
@@ -87,14 +87,14 @@ export class ExtensionDownloader {
87
87
  }
88
88
  // resolve path for zipFile, it is removed after extraction, so its name
89
89
  // does not depend on the response
90
- const archivePath = path.resolve(this.userConfig.tempFolder, `${devtools}.zip`);
90
+ const archivePath = path.resolve(this.environment.cacheDir, `${devtools}.zip`);
91
91
  // extract next to the installed version, which is only replaced once
92
92
  // extraction is complete
93
93
  const stagingPath = `${this.installedPath}.download`;
94
94
  // getFileBlob
95
95
  const extensionBlob = await extensionResponse.bytes();
96
96
  assertZipArchive(extensionBlob, extensionResponse);
97
- fs.mkdirSync(this.userConfig.tempFolder, { recursive: true });
97
+ fs.mkdirSync(this.environment.cacheDir, { recursive: true });
98
98
  // write zipFile
99
99
  fs.writeFileSync(archivePath, extensionBlob);
100
100
  try {
@@ -1,4 +1,4 @@
1
- import { CliServiceInterface, UserCliConfig } from "../../../cli/index.js";
1
+ import { CliServiceInterface, CliEnvironment } from "../../../cli/index.js";
2
2
  import { ExtensionDownloader } from "./extension-downloader.js";
3
3
  export interface BrowserExtensions {
4
4
  paths: string[];
@@ -7,9 +7,9 @@ export interface BrowserExtensions {
7
7
  }
8
8
  export declare class ExtensionValidator {
9
9
  private extensionDownloader;
10
- private cliConfig;
10
+ private environment;
11
11
  private cli;
12
- constructor(extensionDownloader: ExtensionDownloader, cliConfig: UserCliConfig, cli: CliServiceInterface);
12
+ constructor(extensionDownloader: ExtensionDownloader, environment: CliEnvironment, cli: CliServiceInterface);
13
13
  getValidBrowserExtensions(): Promise<BrowserExtensions>;
14
14
  /**
15
15
  * manifest of a configured extension path. One inside a local npm project