@speedkit/cli 2.18.0 → 2.19.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.
Files changed (122) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +36 -5
  3. package/dist/commands/build-parameter-query.js +5 -5
  4. package/dist/commands/build-prewarm-query.js +4 -4
  5. package/dist/commands/{param-diff.d.ts → diff-url-parameters.d.ts} +3 -1
  6. package/dist/commands/{param-diff.js → diff-url-parameters.js} +26 -24
  7. package/dist/commands/find-pops.js +9 -9
  8. package/dist/commands/generate-customer-config.d.ts +1 -1
  9. package/dist/commands/generate-customer-config.js +7 -7
  10. package/dist/commands/generate-pop-config.js +2 -2
  11. package/dist/commands/login.js +5 -4
  12. package/dist/commands/pop-prewarm.d.ts +3 -3
  13. package/dist/commands/pop-prewarm.js +19 -16
  14. package/dist/commands/prewarm.js +10 -10
  15. package/dist/commands/wpt-launcher.d.ts +1 -1
  16. package/dist/commands/wpt-launcher.js +9 -9
  17. package/dist/helpers/build-query-helper.d.ts +3 -3
  18. package/dist/helpers/build-query-helper.js +70 -69
  19. package/dist/helpers/cli-config.js +6 -5
  20. package/dist/helpers/{CustomerConfig.d.ts → customer-config.d.ts} +6 -6
  21. package/dist/helpers/{CustomerConfig.js → customer-config.js} +39 -39
  22. package/dist/helpers/file-helper.d.ts +1 -1
  23. package/dist/helpers/file-helper.js +5 -5
  24. package/dist/helpers/{getChromePath.js → get-chrome-path.js} +8 -8
  25. package/dist/helpers/get-parsed-config.d.ts +1 -1
  26. package/dist/helpers/get-parsed-config.js +7 -7
  27. package/dist/helpers/is-directory.d.ts +1 -0
  28. package/dist/helpers/{isDirectory.js → is-directory.js} +6 -6
  29. package/dist/helpers/{isExecutable.js → is-executable.js} +3 -3
  30. package/dist/helpers/{isFile.js → is-file.js} +4 -4
  31. package/dist/helpers/logging-helper.d.ts +3 -3
  32. package/dist/helpers/logging-helper.js +6 -6
  33. package/dist/helpers/normalize.d.ts +6 -6
  34. package/dist/helpers/normalize.js +35 -33
  35. package/dist/helpers/safe.d.ts +1 -1
  36. package/dist/helpers/safe.js +12 -12
  37. package/dist/helpers/{speedKitRuleToRegExp.js → speed-kit-rule-to-reg-exp.js} +3 -3
  38. package/dist/helpers/{watchFiles.js → watch-files.js} +2 -2
  39. package/dist/models/cli-parameters.d.ts +3 -3
  40. package/dist/models/cli-parameters.js +3 -3
  41. package/dist/services/athena/athena-service.js +2 -2
  42. package/dist/services/bundler/bundle-service.js +14 -14
  43. package/dist/services/cli/cli-service.js +8 -4
  44. package/dist/services/cli/hooks.js +3 -3
  45. package/dist/services/config-api/client.js +7 -6
  46. package/dist/services/config-api/factory/config-api-service-factory.js +4 -4
  47. package/dist/services/config-api/factory/entity-manager-factory.js +1 -1
  48. package/dist/services/config-api-service.d.ts +1 -1
  49. package/dist/services/config-api-service.js +7 -7
  50. package/dist/services/customer-config/customer-config-service-context.d.ts +2 -2
  51. package/dist/services/customer-config/customer-config-service-context.js +4 -4
  52. package/dist/services/customer-config/customer-config-service.js +45 -44
  53. package/dist/services/deploy/builder/install-resource-builder.d.ts +2 -2
  54. package/dist/services/deploy/builder/install-resource-builder.js +7 -7
  55. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +1 -1
  56. package/dist/services/deploy/checks/post-deploy/save-files-check.js +4 -4
  57. package/dist/services/deploy/deploy-service.js +2 -4
  58. package/dist/services/deploy/error/create-find-temporary-directory-error.d.ts +4 -0
  59. package/dist/services/deploy/error/{create-find-temp-directory-error.js → create-find-temporary-directory-error.js} +2 -2
  60. package/dist/services/deploy/handler/customer-config-handler.js +1 -1
  61. package/dist/services/deploy/handler/install-resource-handler.js +8 -11
  62. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +2 -2
  63. package/dist/services/deploy/handler/module-handler.js +8 -8
  64. package/dist/services/deploy/handler/server-config-handler.js +4 -4
  65. package/dist/services/diff/diff-service.d.ts +2 -2
  66. package/dist/services/diff/diff-service.js +22 -22
  67. package/dist/services/diff-service.d.ts +1 -1
  68. package/dist/services/diff-service.js +13 -13
  69. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +10 -8
  70. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +10 -10
  71. package/dist/services/document-handler-runtime/document-handler-server.js +12 -12
  72. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +2 -2
  73. package/dist/services/document-handler-runtime/interface/template-interface.d.ts +2 -2
  74. package/dist/services/document-handler-runtime/interface/{template-param-interface.d.ts → template-parameter-interface.d.ts} +1 -1
  75. package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +2 -2
  76. package/dist/services/document-handler-runtime/templates/abstract-template.js +3 -3
  77. package/dist/services/error-handling/factory/error-handling-factory.d.ts +1 -4
  78. package/dist/services/error-handling/factory/error-handling-factory.js +2 -1
  79. package/dist/services/integration-api/factory/integration-api-service-factory.js +1 -1
  80. package/dist/services/integration-api/file-list.js +4 -3
  81. package/dist/services/integration-api/file-reader.d.ts +1 -1
  82. package/dist/services/integration-api/file-reader.js +29 -26
  83. package/dist/services/integration-api/file-writer.js +3 -3
  84. package/dist/services/integration-api/handler/file-handler.js +1 -1
  85. package/dist/services/integration-api/handler/install-resource-handler.js +1 -1
  86. package/dist/services/integration-api/handler/module-handler.js +1 -1
  87. package/dist/services/integration-api/handler/server-config-handler.js +1 -1
  88. package/dist/services/integration-api/integration-api-service.js +2 -3
  89. package/dist/services/integration-api/struct/customer-config.d.ts +1 -1
  90. package/dist/services/integration-api/struct/customer-config.js +4 -4
  91. package/dist/services/integration-api/struct/file.js +1 -1
  92. package/dist/services/integration-api/validator/customer-config-validator.js +2 -2
  93. package/dist/services/integration-api/validator/mandatory-files-validator.js +7 -6
  94. package/dist/services/integration-api/virtual/external-recipe.js +2 -1
  95. package/dist/services/onboarding/browser/baqend-response.js +1 -2
  96. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +1 -1
  97. package/dist/services/onboarding/dashboard/index.d.ts +3 -3
  98. package/dist/services/onboarding/dashboard/index.js +12 -12
  99. package/dist/services/onboarding/dashboard/{param-query-builder.d.ts → parameter-query-builder.d.ts} +1 -1
  100. package/dist/services/onboarding/dashboard/{param-query-builder.js → parameter-query-builder.js} +6 -6
  101. package/dist/services/onboarding/dashboard/request-diff-service.js +24 -22
  102. package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +8 -8
  103. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +7 -7
  104. package/dist/services/onboarding/onboarding-model.js +4 -4
  105. package/dist/services/onboarding/onboarding-service-factory.js +3 -3
  106. package/dist/services/onboarding/onboarding-service.js +2 -1
  107. package/dist/services/onboarding/todo-collector.js +1 -1
  108. package/dist/services/prewarm-service.d.ts +1 -1
  109. package/dist/services/prewarm-service.js +8 -7
  110. package/dist/services/pull/pull-service.js +2 -2
  111. package/oclif.manifest.json +45 -42
  112. package/package.json +2 -1
  113. package/dist/helpers/isDirectory.d.ts +0 -1
  114. package/dist/services/context/app-context.d.ts +0 -1
  115. package/dist/services/deploy/error/create-find-temp-directory-error.d.ts +0 -4
  116. package/dist/services/document-handler-runtime/interface/template-param-interface.js +0 -2
  117. /package/dist/helpers/{getChromePath.d.ts → get-chrome-path.d.ts} +0 -0
  118. /package/dist/helpers/{isExecutable.d.ts → is-executable.d.ts} +0 -0
  119. /package/dist/helpers/{isFile.d.ts → is-file.d.ts} +0 -0
  120. /package/dist/helpers/{speedKitRuleToRegExp.d.ts → speed-kit-rule-to-reg-exp.d.ts} +0 -0
  121. /package/dist/helpers/{watchFiles.d.ts → watch-files.d.ts} +0 -0
  122. /package/dist/services/{context/app-context.js → document-handler-runtime/interface/template-parameter-interface.js} +0 -0
@@ -3,20 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Dashboard = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const baqend_response_1 = require("../browser/baqend-response");
6
- const fs_1 = require("fs");
7
- const path_1 = tslib_1.__importDefault(require("path"));
6
+ const node_fs_1 = require("node:fs");
7
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
8
8
  const safe_1 = require("../../../helpers/safe");
9
9
  const json2csv_1 = tslib_1.__importDefault(require("json2csv"));
10
10
  class Dashboard {
11
11
  customerConfig;
12
- paramQueryBuilder;
12
+ parameterQueryBuilder;
13
13
  athenaClient;
14
14
  requestDiffService;
15
15
  cache;
16
16
  athenaLastResult = null;
17
- constructor(customerConfig, paramQueryBuilder, athenaClient, requestDiffService, cache) {
17
+ constructor(customerConfig, parameterQueryBuilder, athenaClient, requestDiffService, cache) {
18
18
  this.customerConfig = customerConfig;
19
- this.paramQueryBuilder = paramQueryBuilder;
19
+ this.parameterQueryBuilder = parameterQueryBuilder;
20
20
  this.athenaClient = athenaClient;
21
21
  this.requestDiffService = requestDiffService;
22
22
  this.cache = cache;
@@ -24,13 +24,13 @@ class Dashboard {
24
24
  async getResponse(request) {
25
25
  const url = new URL(request.url);
26
26
  if (url.pathname === "/") {
27
- const filePath = path_1.default.join(__dirname, "./frontend-dist", "index.html");
28
- const content = (0, fs_1.readFileSync)(filePath, { encoding: "utf-8" });
27
+ const filePath = node_path_1.default.join(__dirname, "./frontend-dist", "index.html");
28
+ const content = (0, node_fs_1.readFileSync)(filePath, { encoding: "utf-8" });
29
29
  return new baqend_response_1.BaqendResponse(content);
30
30
  }
31
31
  if (url.pathname.startsWith("/assets/")) {
32
- const filePath = path_1.default.join(__dirname, "./frontend-dist", url.pathname);
33
- const content = (0, fs_1.readFileSync)(filePath, { encoding: "utf-8" });
32
+ const filePath = node_path_1.default.join(__dirname, "./frontend-dist", url.pathname);
33
+ const content = (0, node_fs_1.readFileSync)(filePath, { encoding: "utf-8" });
34
34
  let contentType = "application/javascript; charset=UTF-8";
35
35
  if (url.pathname.includes(".css")) {
36
36
  contentType = "text/css";
@@ -38,7 +38,7 @@ class Dashboard {
38
38
  return new baqend_response_1.BaqendResponse(content, contentType);
39
39
  }
40
40
  if (url.pathname.startsWith("/query/create")) {
41
- return new baqend_response_1.BaqendResponse(JSON.stringify({ query: this.paramQueryBuilder.getQuery() }), "application/json; charset=UTF-8");
41
+ return new baqend_response_1.BaqendResponse(JSON.stringify({ query: this.parameterQueryBuilder.getQuery() }), "application/json; charset=UTF-8");
42
42
  }
43
43
  if (url.pathname.startsWith("/query/execute")) {
44
44
  const postData = request.postData;
@@ -80,9 +80,9 @@ class Dashboard {
80
80
  }
81
81
  if (url.pathname.startsWith("/cache/get")) {
82
82
  const response = [];
83
- Array.from(this.cache.getAll()).forEach(([url, baqendResponse]) => {
83
+ for (const [url, baqendResponse] of this.cache.getAll()) {
84
84
  response.push({ url, response: baqendResponse });
85
- });
85
+ }
86
86
  return new baqend_response_1.BaqendResponse(JSON.stringify(response), "application/json; charset=UTF-8");
87
87
  }
88
88
  return new baqend_response_1.BaqendResponse("Not implemented");
@@ -1,6 +1,6 @@
1
1
  import { ConfigFileInterface } from "../../integration-api/integration-api-model";
2
2
  import CustomerConfig from "../../integration-api/struct/customer-config";
3
- export declare class ParamQueryBuilder {
3
+ export declare class ParameterQueryBuilder {
4
4
  private customerConfig;
5
5
  private speedKitConfigFile;
6
6
  constructor(customerConfig: CustomerConfig, speedKitConfigFile: ConfigFileInterface);
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParamQueryBuilder = void 0;
3
+ exports.ParameterQueryBuilder = void 0;
4
4
  const build_query_helper_1 = require("../../../helpers/build-query-helper");
5
5
  const get_parsed_config_1 = require("../../../helpers/get-parsed-config");
6
- class ParamQueryBuilder {
6
+ class ParameterQueryBuilder {
7
7
  customerConfig;
8
8
  speedKitConfigFile;
9
9
  constructor(customerConfig, speedKitConfigFile) {
@@ -56,12 +56,12 @@ order by case when potentialGain > cachedUrls and potentialGain > PIs then poten
56
56
  }
57
57
  getQuery() {
58
58
  const parsedConfig = (0, get_parsed_config_1.parseSpeedKitConfig)(this.speedKitConfigFile.getContent());
59
- const params = (0, build_query_helper_1.getStrippedParams)(parsedConfig);
60
- const parameterFilter = (0, build_query_helper_1.getParameterFilter)(params);
59
+ const parameters = (0, build_query_helper_1.getStrippedParameters)(parsedConfig);
60
+ const parameterFilter = (0, build_query_helper_1.getParameterFilter)(parameters);
61
61
  const whitelistedFilter = (0, build_query_helper_1.getWhitelistedFilter)(parsedConfig);
62
62
  const blacklistedFilter = (0, build_query_helper_1.getBlacklistedFilter)(parsedConfig);
63
- const parameterReplaceFilter = (0, build_query_helper_1.getParameterReplaceFilter)(params);
63
+ const parameterReplaceFilter = (0, build_query_helper_1.getParameterReplaceFilter)(parameters);
64
64
  return this.buildParameterQuery(this.customerConfig.app, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter);
65
65
  }
66
66
  }
67
- exports.ParamQueryBuilder = ParamQueryBuilder;
67
+ exports.ParameterQueryBuilder = ParameterQueryBuilder;
@@ -11,14 +11,14 @@ class RequestDiffService {
11
11
  this.documentHandlerRuntime = documentHandlerRuntime;
12
12
  }
13
13
  async postDiff(url, parametersString, autoCheck = false) {
14
- const params = parametersString
14
+ const parameters = parametersString
15
15
  .replace("[", "")
16
16
  .replace("]", "")
17
17
  .split(",")
18
- .map((param) => {
19
- return param.trim();
18
+ .map((parameter) => {
19
+ return parameter.trim();
20
20
  });
21
- const { urlWithParam, urlWithoutParam } = this.createUrlsForDiff(url, params);
21
+ const { urlWithParam, urlWithoutParam } = this.createUrlsForDiff(url, parameters);
22
22
  const result = await (0, safe_1.safe)(this.diffLocal(urlWithParam, urlWithoutParam, autoCheck));
23
23
  if (result.success === true) {
24
24
  return new baqend_response_1.BaqendResponse(JSON.stringify({
@@ -31,19 +31,21 @@ class RequestDiffService {
31
31
  error: result.error,
32
32
  }), "application/json; charset=UTF-8", null, 500);
33
33
  }
34
- async diffLocal(urlWithParam, urlWithoutParam, checkIsEqual = false) {
35
- const htmlWithParam = await this.fetchHtml(urlWithParam);
36
- const htmlWithoutParam = await this.fetchHtml(urlWithoutParam);
34
+ async diffLocal(urlWithParameter, urlWithoutParameter, checkIsEqual = false) {
35
+ const htmlWithParameter = await this.fetchHtml(urlWithParameter);
36
+ const htmlWithoutParameter = await this.fetchHtml(urlWithoutParameter);
37
37
  const replaceRegEx = /<meta[^>]*name="baqend:asset_url"[^>]*>/;
38
38
  // <meta name="baqend:asset_url" content="https://www.kik.de/c/damen/damen-bekleidung-shirts-tops?page=7">
39
- const transformedHtmlWithParam = (await this.documentHandlerRuntime.transform(htmlWithParam, "", urlWithParam, {})).replace(replaceRegEx, "");
40
- const transformedHtmlWithoutParam = (await this.documentHandlerRuntime.transform(htmlWithoutParam, "", urlWithParam, {})).replace(replaceRegEx, "");
39
+ let transformedHtmlWithParameter = await this.documentHandlerRuntime.transform(htmlWithParameter, "", urlWithParameter, {});
40
+ transformedHtmlWithParameter = transformedHtmlWithParameter.replace(replaceRegEx, "");
41
+ let transformedHtmlWithoutParameter = await this.documentHandlerRuntime.transform(htmlWithoutParameter, "", urlWithParameter, {});
42
+ transformedHtmlWithoutParameter = transformedHtmlWithoutParameter.replace(replaceRegEx, "");
41
43
  if (checkIsEqual) {
42
- return this.diffService.isContentEqual(transformedHtmlWithParam, transformedHtmlWithoutParam);
44
+ return this.diffService.isContentEqual(transformedHtmlWithParameter, transformedHtmlWithoutParameter);
43
45
  }
44
- const paramsFilePath = await this.diffService.writeContentToTemporalFile("params", transformedHtmlWithParam);
45
- const pureFilePath = await this.diffService.writeContentToTemporalFile("pure", transformedHtmlWithoutParam);
46
- return await this.diffService.executeDiff(paramsFilePath, pureFilePath);
46
+ const parametersFilePath = await this.diffService.writeContentToTemporalFile("params", transformedHtmlWithParameter);
47
+ const pureFilePath = await this.diffService.writeContentToTemporalFile("pure", transformedHtmlWithoutParameter);
48
+ return await this.diffService.executeDiff(parametersFilePath, pureFilePath);
47
49
  }
48
50
  async doOriginVsContentDiff(url, content) {
49
51
  const html = await this.fetchHtml(url);
@@ -55,17 +57,17 @@ class RequestDiffService {
55
57
  const response = await fetch(url);
56
58
  return await response.text();
57
59
  }
58
- createUrlsForDiff(urlWithParam, params) {
59
- const url = new URL(urlWithParam);
60
- const search_params = url.searchParams;
61
- for (const param of params) {
62
- search_params.delete(param);
60
+ createUrlsForDiff(urlWithParameter, parameters) {
61
+ const url = new URL(urlWithParameter);
62
+ const search_parameters = url.searchParams;
63
+ for (const parameter of parameters) {
64
+ search_parameters.delete(parameter);
63
65
  }
64
- url.search = search_params.toString();
65
- const urlWithoutParam = url.toString();
66
+ url.search = search_parameters.toString();
67
+ const urlWithoutParameter = url.toString();
66
68
  return {
67
- urlWithParam,
68
- urlWithoutParam,
69
+ urlWithParam: urlWithParameter,
70
+ urlWithoutParam: urlWithoutParameter,
69
71
  };
70
72
  }
71
73
  }
@@ -78,15 +78,15 @@ class CustomerDomainDocumentResponse {
78
78
  event.responseStatusCode < 300);
79
79
  }
80
80
  isHtmlContentHeader(responseHeaders) {
81
- const contentType = responseHeaders.filter((headerRecord) => {
81
+ const contentType = responseHeaders.find((headerRecord) => {
82
82
  return headerRecord.name.toLowerCase() === "content-type";
83
- })?.[0]?.["value"];
83
+ })?.["value"];
84
84
  return contentType && contentType.includes("text/html");
85
85
  }
86
86
  async getHtmlContent(client, event) {
87
- const contentType = event.responseHeaders.filter((headerRecord) => {
87
+ const contentType = event.responseHeaders.find((headerRecord) => {
88
88
  return headerRecord.name.toLowerCase() === "content-type";
89
- })?.[0]?.["value"] || "";
89
+ })?.["value"] || "";
90
90
  const charset = contentType.split("charset=")?.[1];
91
91
  const { body, base64Encoded } = await client.send("Fetch.getResponseBody", {
92
92
  requestId: event.requestId,
@@ -107,13 +107,13 @@ class CustomerDomainDocumentResponse {
107
107
  });
108
108
  }
109
109
  rewriteHtmlToLocalConfig(html) {
110
- const DF_CONFIG_PATTERN = /(<script[^>]* id="speed-kit-df-config"[^>]*>)([\s\S]*?)(<\/script>)/g;
111
- const DF_STYLES_PATTERN = /(<style[^>]* id="speed-kit-df-styles"[^>]*>)(?:(?!<\/style>)[\s\S])*(<\/style>)/g;
112
- html = html.replace(DF_CONFIG_PATTERN, (_, tag, body, end) => {
110
+ const DF_CONFIG_PATTERN = /(<script[^>]* id="speed-kit-df-config"[^>]*>)([\S\s]*?)(<\/script>)/g;
111
+ const DF_STYLES_PATTERN = /(<style[^>]* id="speed-kit-df-styles"[^>]*>)(?:(?!<\/style>)[\S\s])*(<\/style>)/g;
112
+ html = html.replaceAll(DF_CONFIG_PATTERN, (_, tag, body, end) => {
113
113
  const injectedConfig = body.match(/window\.dynamicBlockConfig\.appName\s=.*$/s) ?? [""];
114
114
  return `${tag}${this.configDynamicBlock.getContent()}${injectedConfig[0]}${end}`;
115
115
  });
116
- html = html.replace(DF_STYLES_PATTERN, (_, tag, end) => `${tag}${this.configDynamicStyles.getContent()}${end}`);
116
+ html = html.replaceAll(DF_STYLES_PATTERN, (_, tag, end) => `${tag}${this.configDynamicStyles.getContent()}${end}`);
117
117
  return html;
118
118
  }
119
119
  }
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SpeedKitAssetRequest = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const baqend_response_1 = require("../browser/baqend-response");
6
- const https_1 = require("https");
7
- const crypto_1 = tslib_1.__importDefault(require("crypto"));
6
+ const node_https_1 = require("node:https");
7
+ const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
8
8
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
9
- const agent = new https_1.Agent({
9
+ const agent = new node_https_1.Agent({
10
10
  rejectUnauthorized: false,
11
11
  keepAlive: true,
12
- secureOptions: crypto_1.default.constants.SSL_OP_LEGACY_SERVER_CONNECT,
12
+ secureOptions: node_crypto_1.default.constants.SSL_OP_LEGACY_SERVER_CONNECT,
13
13
  });
14
14
  /**
15
15
  * Handles fetch requests for Speed Kit assets and returns customized responses.
@@ -170,11 +170,11 @@ class SpeedKitAssetRequest {
170
170
  return `${head}\n<script src="${this.customerConfig.installPath}" ${this.customerConfig.installParams}></script>`;
171
171
  });
172
172
  }
173
- prepareOriginRequest(variationParam, init) {
174
- if (!this.speedKitServerConfig || !variationParam) {
173
+ prepareOriginRequest(variationParameter, init) {
174
+ if (!this.speedKitServerConfig || !variationParameter) {
175
175
  return init;
176
176
  }
177
- const variation = variationParam.toUpperCase();
177
+ const variation = variationParameter.toUpperCase();
178
178
  if (!(variation in this.speedKitServerConfig.speedKit.variations)) {
179
179
  return init;
180
180
  }
@@ -20,15 +20,15 @@ class BrowserContext {
20
20
  this.domain = domain;
21
21
  this.chromeFlags = chromeFlags || [];
22
22
  this.chromePath = userConfig.chromePath;
23
- const browserArgs = DEFAULT_BROWSER_ARGS;
23
+ const browserArguments = DEFAULT_BROWSER_ARGS;
24
24
  if (userConfig?.chromeExtensionPaths) {
25
- browserArgs.push(`--load-extension=${userConfig?.chromeExtensionPaths}`, `--disable-extensions-except=${userConfig?.chromeExtensionPaths}`);
25
+ browserArguments.push(`--load-extension=${userConfig?.chromeExtensionPaths}`, `--disable-extensions-except=${userConfig?.chromeExtensionPaths}`);
26
26
  }
27
27
  if (userConfig?.chromeUserProfilePath) {
28
- browserArgs.push(`--user-data-dir=${userConfig?.chromeUserProfilePath}`);
28
+ browserArguments.push(`--user-data-dir=${userConfig?.chromeUserProfilePath}`);
29
29
  }
30
30
  this.browserArgs = [
31
- ...browserArgs,
31
+ ...browserArguments,
32
32
  `--unsafely-treat-insecure-origin-as-secure=${domain}`,
33
33
  ...this.chromeFlags,
34
34
  ];
@@ -19,7 +19,7 @@ const external_recipe_1 = require("../integration-api/virtual/external-recipe");
19
19
  const install_file_recipe_1 = require("./config-renderer/install-file-recipe");
20
20
  const speed_kit_install_context_1 = require("./config-renderer/speed-kit-install-context");
21
21
  const dashboard_1 = require("./dashboard");
22
- const param_query_builder_1 = require("./dashboard/param-query-builder");
22
+ const parameter_query_builder_1 = require("./dashboard/parameter-query-builder");
23
23
  const request_diff_service_1 = require("./dashboard/request-diff-service");
24
24
  const fetch_event_handler_1 = require("./fetch-event-handler");
25
25
  const customer_domain_document_response_1 = require("./fetch-events/customer-domain-document-response");
@@ -93,7 +93,7 @@ class OnboardingServiceFactory {
93
93
  }
94
94
  async getFetchEventHandler(files, customerConfig, documentHandler, cache, cli, browserContext) {
95
95
  const configApi = this.getConfigApi(customerConfig.app);
96
- const paramQueryBuilder = new param_query_builder_1.ParamQueryBuilder(customerConfig, files.getByName(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT));
96
+ const parameterQueryBuilder = new parameter_query_builder_1.ParameterQueryBuilder(customerConfig, files.getByName(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT));
97
97
  const DiffService = new diff_1.DiffServiceFactory(new diff_1.DiffContext(this.cliConfig.diffExec, this.cliConfig.diffExecTemplate)).getService();
98
98
  const requestDiffService = new request_diff_service_1.RequestDiffService(DiffService, documentHandler);
99
99
  const handlers = [
@@ -108,7 +108,7 @@ class OnboardingServiceFactory {
108
108
  }
109
109
  const athenaClient = await this.getAthenaClient();
110
110
  if (athenaClient) {
111
- handlers.push(new dashboard_request_1.DashboardRequest(new dashboard_1.Dashboard(customerConfig, paramQueryBuilder, athenaClient, requestDiffService, cache)));
111
+ handlers.push(new dashboard_request_1.DashboardRequest(new dashboard_1.Dashboard(customerConfig, parameterQueryBuilder, athenaClient, requestDiffService, cache)));
112
112
  browserContext.startParameterDashboard = true;
113
113
  }
114
114
  return new fetch_event_handler_1.FetchEventHandler(handlers, customerConfig, cli, configApi);
@@ -34,7 +34,8 @@ class OnboardingService {
34
34
  const page = await this.preparePage(browser);
35
35
  this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
36
36
  if (this.browserContext.startParameterDashboard) {
37
- await (await browser.newPage()).goto("http://skonboarding.local/");
37
+ const { goto } = await browser.newPage();
38
+ await goto("http://skonboarding.local/");
38
39
  }
39
40
  await this.navigate(page, `${this.customerConfig.scope}speed-kit-install.html?url=${this.customerConfig.scope}`);
40
41
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TodoCollector = void 0;
4
4
  const virtual_file_1 = require("../integration-api/struct/virtual-file");
5
- const TODO_MATCH = /(todo[^(\r\n|\r|\n)]*)((?:\r\n|\r|\n)[^(\r\n|\r|\n)]*(?:\r\n|\r|\n)[^(\r\n|\r|\n)]*(?:\r\n|\r|\n)[^(\r\n|\r|\n)]*)/i;
5
+ const TODO_MATCH = /(todo[^\n\r()|]*)((?:(?:\r\n|\r|\n)[^\n\r()|]*){3})/i;
6
6
  /**
7
7
  * Represents a TodoCollector class that collects open tasks from files.
8
8
  * This files will then be injected to the current open page, so you or the browser-extension can access and display them
@@ -1,5 +1,5 @@
1
1
  export default class PrewarmService {
2
2
  static fetchURLByIp(ip: string, url: string, origin: string, variation: string, app: string, token: string): Promise<any>;
3
3
  static fetchURL(url: string, origin: string, variation: string, app: string, token: string, sortParameters: boolean): Promise<any>;
4
- static chunk(arr: any[], len: number): any[];
4
+ static chunk(array: any[], length: number): any[];
5
5
  }
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const normalize_1 = require("../helpers/normalize");
5
5
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
6
- const https_1 = tslib_1.__importDefault(require("https"));
7
- const agent = new https_1.default.Agent({
6
+ const node_https_1 = tslib_1.__importDefault(require("node:https"));
7
+ const agent = new node_https_1.default.Agent({
8
8
  rejectUnauthorized: false,
9
9
  keepAlive: true,
10
10
  });
11
+ // eslint-disable-next-line unicorn/no-static-only-class
11
12
  class PrewarmService {
12
13
  // eslint-disable-next-line max-params
13
14
  static async fetchURLByIp(ip, url, origin, variation, app, token) {
@@ -50,12 +51,12 @@ class PrewarmService {
50
51
  timeout: 10_000,
51
52
  });
52
53
  }
53
- static chunk(arr, len) {
54
+ static chunk(array, length) {
54
55
  const chunks = [];
55
- const n = arr.length;
56
- let i = 0;
57
- while (i < n) {
58
- chunks.push(arr.slice(i, (i += len)));
56
+ const n = array.length;
57
+ let index = 0;
58
+ while (index < n) {
59
+ chunks.push(array.slice(index, (index += length)));
59
60
  }
60
61
  return chunks;
61
62
  }
@@ -6,7 +6,7 @@ const cli_1 = require("../cli");
6
6
  const install_resource_file_1 = tslib_1.__importDefault(require("../integration-api/struct/install-resource-file"));
7
7
  const _1 = require("./");
8
8
  const safe_1 = require("../../helpers/safe");
9
- const child_process_1 = require("child_process");
9
+ const node_child_process_1 = require("node:child_process");
10
10
  class PullService {
11
11
  fileList;
12
12
  cli;
@@ -97,7 +97,7 @@ class PullService {
97
97
  .filter((value) => value.length > 0)
98
98
  .pop();
99
99
  try {
100
- const stdoutBuffer = (0, child_process_1.execSync)("git diff --name-status");
100
+ const stdoutBuffer = (0, node_child_process_1.execSync)("git diff --name-status");
101
101
  const stdout = stdoutBuffer.toString("utf8");
102
102
  {
103
103
  return stdout.includes(customerName);
@@ -143,6 +143,47 @@
143
143
  "deploy.js"
144
144
  ]
145
145
  },
146
+ "diff-url-parameters": {
147
+ "aliases": [
148
+ "param-diff"
149
+ ],
150
+ "args": {
151
+ "pageUrl": {
152
+ "description": "Link of the page",
153
+ "name": "pageUrl",
154
+ "required": true
155
+ }
156
+ },
157
+ "deprecateAliases": true,
158
+ "description": "Shows difference in documents with query parameters on/off",
159
+ "examples": [
160
+ "$ sk prewarm <pageUrl> -h",
161
+ "$ sk prewarm https://www.decathlon.de/ -h"
162
+ ],
163
+ "flags": {
164
+ "hideDiff": {
165
+ "char": "h",
166
+ "description": "Hide the code diff in IDE code diff window",
167
+ "name": "hideDiff",
168
+ "allowNo": false,
169
+ "type": "boolean"
170
+ }
171
+ },
172
+ "hasDynamicHelp": false,
173
+ "hiddenAliases": [],
174
+ "id": "diff-url-parameters",
175
+ "pluginAlias": "@speedkit/cli",
176
+ "pluginName": "@speedkit/cli",
177
+ "pluginType": "core",
178
+ "strict": true,
179
+ "enableJsonFlag": false,
180
+ "isESM": false,
181
+ "relativePath": [
182
+ "dist",
183
+ "commands",
184
+ "diff-url-parameters.js"
185
+ ]
186
+ },
146
187
  "document-handler": {
147
188
  "aliases": [],
148
189
  "args": {
@@ -237,7 +278,7 @@
237
278
  "args": {},
238
279
  "description": "Generates a customer config guided by a wizard 🧙‍",
239
280
  "examples": [
240
- "$ sk generate-customer-config -a <app> -d <customersDir>",
281
+ "$ sk generate-customer-config -a <app> -d <customersDirectory>",
241
282
  "$ sk generate-customer-config -a decathlon -d customers"
242
283
  ],
243
284
  "flags": {
@@ -249,10 +290,10 @@
249
290
  "multiple": false,
250
291
  "type": "option"
251
292
  },
252
- "customersDir": {
293
+ "customersDirectory": {
253
294
  "char": "d",
254
295
  "description": "Name of the sk-onboarding directory where all customer configs are being stored (default: \"customers\")",
255
- "name": "customersDir",
296
+ "name": "customersDirectory",
256
297
  "hasDynamicHelp": false,
257
298
  "multiple": false,
258
299
  "type": "option"
@@ -435,44 +476,6 @@
435
476
  "onboarding.js"
436
477
  ]
437
478
  },
438
- "param-diff": {
439
- "aliases": [],
440
- "args": {
441
- "pageUrl": {
442
- "description": "Link of the page",
443
- "name": "pageUrl",
444
- "required": true
445
- }
446
- },
447
- "description": "Shows difference in documents with query parameters on/off",
448
- "examples": [
449
- "$ sk prewarm <pageUrl> -h",
450
- "$ sk prewarm https://www.decathlon.de/ -h"
451
- ],
452
- "flags": {
453
- "hideDiff": {
454
- "char": "h",
455
- "description": "Hide the code diff in IDE code diff window",
456
- "name": "hideDiff",
457
- "allowNo": false,
458
- "type": "boolean"
459
- }
460
- },
461
- "hasDynamicHelp": false,
462
- "hiddenAliases": [],
463
- "id": "param-diff",
464
- "pluginAlias": "@speedkit/cli",
465
- "pluginName": "@speedkit/cli",
466
- "pluginType": "core",
467
- "strict": true,
468
- "enableJsonFlag": false,
469
- "isESM": false,
470
- "relativePath": [
471
- "dist",
472
- "commands",
473
- "param-diff.js"
474
- ]
475
- },
476
479
  "pop-prewarm": {
477
480
  "aliases": [],
478
481
  "args": {
@@ -696,5 +699,5 @@
696
699
  ]
697
700
  }
698
701
  },
699
- "version": "2.18.0"
702
+ "version": "2.19.0"
700
703
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.18.0",
4
+ "version": "2.19.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"
@@ -117,6 +117,7 @@
117
117
  "eslint": "^8.57",
118
118
  "eslint-config-prettier": "^9.1",
119
119
  "eslint-plugin-prettier": "^5.1",
120
+ "eslint-plugin-unicorn": "^51.0.1",
120
121
  "globby": "^11",
121
122
  "husky": "^8.0.3",
122
123
  "lint-staged": "^14.0.1",
@@ -1 +0,0 @@
1
- export declare function isDirectory(dir: string): Promise<boolean>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import DeployAppError from "./deploy-app-error";
2
- export default class CreateFindTempDirectoryError extends DeployAppError {
3
- constructor();
4
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
File without changes