@speedkit/cli 2.13.0 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/dist/commands/document-handler.d.ts +1 -1
  4. package/dist/commands/document-handler.js +4 -4
  5. package/dist/commands/find-pops.d.ts +1 -1
  6. package/dist/commands/find-pops.js +21 -18
  7. package/dist/commands/login.d.ts +1 -1
  8. package/dist/commands/login.js +4 -4
  9. package/dist/commands/onboarding.d.ts +1 -1
  10. package/dist/commands/onboarding.js +12 -4
  11. package/dist/commands/param-diff.d.ts +2 -2
  12. package/dist/commands/param-diff.js +16 -16
  13. package/dist/commands/pop-prewarm.d.ts +2 -2
  14. package/dist/commands/pop-prewarm.js +20 -13
  15. package/dist/commands/prewarm.d.ts +2 -2
  16. package/dist/commands/prewarm.js +35 -19
  17. package/dist/commands/pull.d.ts +1 -1
  18. package/dist/commands/pull.js +2 -2
  19. package/dist/commands/wpt-launcher.d.ts +2 -2
  20. package/dist/commands/wpt-launcher.js +35 -19
  21. package/dist/helpers/CustomerConfig.d.ts +1 -1
  22. package/dist/helpers/CustomerConfig.js +36 -35
  23. package/dist/helpers/file-helper.js +6 -6
  24. package/dist/services/onboarding/browser/baqend-response.d.ts +3 -3
  25. package/dist/services/onboarding/browser/baqend-response.js +13 -12
  26. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +4 -4
  27. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +38 -38
  28. package/dist/services/onboarding/dashboard/athena-service.d.ts +1 -1
  29. package/dist/services/onboarding/dashboard/athena-service.js +12 -12
  30. package/dist/services/onboarding/dashboard/index.d.ts +3 -3
  31. package/dist/services/onboarding/dashboard/index.js +14 -14
  32. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +1 -1
  33. package/dist/services/onboarding/dashboard/request-diff-service.js +23 -23
  34. package/dist/services/onboarding/fetch-event-handler.d.ts +6 -6
  35. package/dist/services/onboarding/fetch-event-handler.js +52 -52
  36. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +7 -7
  37. package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +43 -43
  38. package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +2 -2
  39. package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +4 -4
  40. package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +1 -1
  41. package/dist/services/onboarding/fetch-events/dashboard-request.js +2 -2
  42. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +7 -7
  43. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +27 -27
  44. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +2 -2
  45. package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +12 -12
  46. package/dist/services/onboarding/file-events/file-watcher.d.ts +9 -9
  47. package/dist/services/onboarding/file-events/file-watcher.js +67 -67
  48. package/dist/services/onboarding/onboarding-service.d.ts +6 -6
  49. package/dist/services/onboarding/onboarding-service.js +38 -39
  50. package/dist/services/onboarding/request-cache/cache.d.ts +3 -3
  51. package/dist/services/onboarding/request-cache/cache.js +7 -7
  52. package/dist/services/onboarding/server-config/index.js +1 -1
  53. package/dist/services/onboarding/todo-collector.d.ts +1 -1
  54. package/dist/services/onboarding/todo-collector.js +3 -4
  55. package/oclif.manifest.json +1 -1
  56. package/package.json +1 -1
@@ -9,39 +9,39 @@ class SpeedKitInstallHtml {
9
9
  customerConfig;
10
10
  browserContext;
11
11
  speedKitInstallHtmlTemplate;
12
- constructor(customerConfig, browserContext, speedKitInstallHtmlTemplate) {
13
- this.customerConfig = customerConfig;
14
- this.browserContext = browserContext;
15
- this.speedKitInstallHtmlTemplate = speedKitInstallHtmlTemplate;
16
- }
17
12
  get patterns() {
18
13
  const result = [];
19
14
  for (const origin of this.customerConfig.origins) {
20
15
  const pattern = [
21
16
  {
22
- requestStage: "Request",
23
- resourceType: "Document",
24
17
  urlPattern: `${origin}${this.customerConfig.scope}speed-kit-install.html*`,
18
+ resourceType: "Document",
19
+ requestStage: "Request",
25
20
  },
26
21
  {
27
- requestStage: "Request",
28
- resourceType: "XHR",
29
22
  urlPattern: `${origin}${this.customerConfig.scope}speed-kit-install.html*`,
23
+ resourceType: "XHR",
24
+ requestStage: "Request",
30
25
  },
31
26
  {
32
- requestStage: "Request",
33
- resourceType: "Fetch",
34
27
  urlPattern: `${origin}${this.customerConfig.scope}speed-kit-install.html*`,
28
+ resourceType: "Fetch",
29
+ requestStage: "Request",
35
30
  },
36
31
  ];
37
32
  result.push(...pattern);
38
33
  }
39
34
  return result;
40
35
  }
36
+ constructor(customerConfig, browserContext, speedKitInstallHtmlTemplate) {
37
+ this.customerConfig = customerConfig;
38
+ this.browserContext = browserContext;
39
+ this.speedKitInstallHtmlTemplate = speedKitInstallHtmlTemplate;
40
+ }
41
41
  async handle() {
42
42
  return new baqend_response_1.BaqendResponse(this.speedKitInstallHtmlTemplate.render({
43
- domain: this.browserContext.domain,
44
43
  installPath: this.customerConfig.installPath,
44
+ domain: this.browserContext.domain,
45
45
  swPath: this.customerConfig.swPath,
46
46
  }));
47
47
  }
@@ -1,10 +1,10 @@
1
- import { Page } from "puppeteer";
2
1
  import { CliService } from "../../cli";
2
+ import { Page } from "puppeteer";
3
+ import CustomerConfig from "../../integration-api/struct/customer-config";
3
4
  import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
5
+ import { Cache } from "../request-cache/cache";
4
6
  import { ConfigFileInterface, FileListInterface } from "../../integration-api/integration-api-model";
5
- import CustomerConfig from "../../integration-api/struct/customer-config";
6
7
  import { BrowserContext } from "../onboarding-model";
7
- import { Cache } from "../request-cache/cache";
8
8
  /**
9
9
  * Add different callbacks that will be executed if a local file is changed.
10
10
  */
@@ -17,13 +17,13 @@ export declare class FileWatcher {
17
17
  private cache;
18
18
  constructor(cli: CliService, customerConfig: CustomerConfig, files: FileListInterface, documentHandler: DocumentHandlerServer, browserContext: BrowserContext, cache: Cache);
19
19
  addCallbackOnFileChange(page: Page, serviceWorkerReinstallCallback: (file: ConfigFileInterface) => Promise<void>): void;
20
- private clearPageFunction;
21
- private clearServiceWorker;
22
- private handleDynamicStyles;
23
- private handleGenericConfigFiles;
24
20
  private handleServiceWorkerDependencies;
25
- private onChangeConfigFileCallback;
26
- private onChangeDynamicStyleCallback;
21
+ private handleGenericConfigFiles;
22
+ private handleDynamicStyles;
27
23
  private onChangeServiceWorkerCallback;
28
24
  private updateStyles;
25
+ private onChangeConfigFileCallback;
26
+ private onChangeDynamicStyleCallback;
27
+ private clearPageFunction;
28
+ private clearServiceWorker;
29
29
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileWatcher = void 0;
4
4
  const safe_1 = require("../../../helpers/safe");
5
- const files_1 = require("../../../models/files");
6
5
  const virtual_file_1 = require("../../integration-api/struct/virtual-file");
6
+ const files_1 = require("../../../models/files");
7
7
  /**
8
8
  * Add different callbacks that will be executed if a local file is changed.
9
9
  */
@@ -28,39 +28,29 @@ class FileWatcher {
28
28
  this.handleGenericConfigFiles(page, installResource);
29
29
  this.handleDynamicStyles(page);
30
30
  }
31
- async clearPageFunction(page) {
32
- const client = await page.target().createCDPSession();
33
- const cacheResponse = await client.send("CacheStorage.requestCacheNames", {
34
- securityOrigin: this.browserContext.domain,
35
- });
36
- for (const cache of cacheResponse.caches) {
37
- if (cache.cacheName.includes("baqend")) {
38
- await client.send("CacheStorage.deleteCache", {
39
- cacheId: cache.cacheId,
40
- });
31
+ handleServiceWorkerDependencies(page, installResource, serviceWorkerReinstallCallback) {
32
+ // add watcher to serviceWorker related files
33
+ const serviceWorkerDependencies = [
34
+ files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT,
35
+ files_1.INTEGRATION_FILES.CONFIG.LOAD_HANDLER,
36
+ files_1.INTEGRATION_FILES.CUSTOM.LOADER,
37
+ files_1.INTEGRATION_FILES.CUSTOM.SW,
38
+ ];
39
+ for (const dependency of serviceWorkerDependencies) {
40
+ if (!this.files.hasFile(dependency)) {
41
+ continue;
41
42
  }
42
- }
43
- }
44
- async clearServiceWorker(page) {
45
- const client = await page.target().createCDPSession();
46
- await client.send("ServiceWorker.enable");
47
- await client.send("ServiceWorker.unregister", {
48
- scopeURL: `https://${this.customerConfig.domain}`,
49
- });
50
- }
51
- handleDynamicStyles(page) {
52
- if (!this.files.hasFile(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES)) {
53
- return;
54
- }
55
- // add watcher that will instantly add changes to current page
56
- this.files
57
- .getByName(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES)
58
- .onChange(async (file) => {
59
- const result = await (0, safe_1.safe)(this.onChangeDynamicStyleCallback(file, page));
60
- if (result.success === false) {
61
- this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
43
+ const file = this.files.getByName(dependency);
44
+ if (file.type === virtual_file_1.VirtualFile) {
45
+ continue;
62
46
  }
63
- });
47
+ file.onChange(async (file) => {
48
+ const result = await (0, safe_1.safe)(this.onChangeServiceWorkerCallback(file, page, installResource, serviceWorkerReinstallCallback));
49
+ if (result.success === false) {
50
+ this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
51
+ }
52
+ });
53
+ }
64
54
  }
65
55
  handleGenericConfigFiles(page, installResource) {
66
56
  // add watcher to configFiles
@@ -86,28 +76,34 @@ class FileWatcher {
86
76
  });
87
77
  }
88
78
  }
89
- handleServiceWorkerDependencies(page, installResource, serviceWorkerReinstallCallback) {
90
- // add watcher to serviceWorker related files
91
- const serviceWorkerDependencies = [
92
- files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT,
93
- files_1.INTEGRATION_FILES.CONFIG.LOAD_HANDLER,
94
- files_1.INTEGRATION_FILES.CUSTOM.LOADER,
95
- files_1.INTEGRATION_FILES.CUSTOM.SW,
96
- ];
97
- for (const dependency of serviceWorkerDependencies) {
98
- if (!this.files.hasFile(dependency)) {
99
- continue;
100
- }
101
- const file = this.files.getByName(dependency);
102
- if (file.type === virtual_file_1.VirtualFile) {
103
- continue;
79
+ handleDynamicStyles(page) {
80
+ if (!this.files.hasFile(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES)) {
81
+ return;
82
+ }
83
+ // add watcher that will instantly add changes to current page
84
+ this.files
85
+ .getByName(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES)
86
+ .onChange(async (file) => {
87
+ const result = await (0, safe_1.safe)(this.onChangeDynamicStyleCallback(file, page));
88
+ if (result.success === false) {
89
+ this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
104
90
  }
105
- file.onChange(async (file) => {
106
- const result = await (0, safe_1.safe)(this.onChangeServiceWorkerCallback(file, page, installResource, serviceWorkerReinstallCallback));
107
- if (result.success === false) {
108
- this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
109
- }
110
- });
91
+ });
92
+ }
93
+ async onChangeServiceWorkerCallback(file, page, installResource, serviceWorkerReinstallCallback) {
94
+ this.cli.writeWarning(`changed file: ${file.name} (reinstall serviceWorker)`);
95
+ // clear speed-kit-service-worker-caches and uninstall serviceWorker
96
+ await this.clearPageFunction(page);
97
+ await this.clearServiceWorker(page);
98
+ // rebuild installResource
99
+ await installResource.buildContent();
100
+ // tell puppeteer to reinstall serviceworker on next navigate
101
+ await serviceWorkerReinstallCallback(file);
102
+ }
103
+ updateStyles(styles) {
104
+ const styleElement = document.querySelector("#speed-kit-df-styles");
105
+ if (styleElement) {
106
+ styleElement.textContent = decodeURI(styles);
111
107
  }
112
108
  }
113
109
  async onChangeConfigFileCallback(page, installResource, file) {
@@ -131,21 +127,25 @@ class FileWatcher {
131
127
  await this.documentHandler.buildDocumentHandler();
132
128
  this.cache.clear();
133
129
  }
134
- async onChangeServiceWorkerCallback(file, page, installResource, serviceWorkerReinstallCallback) {
135
- this.cli.writeWarning(`changed file: ${file.name} (reinstall serviceWorker)`);
136
- // clear speed-kit-service-worker-caches and uninstall serviceWorker
137
- await this.clearPageFunction(page);
138
- await this.clearServiceWorker(page);
139
- // rebuild installResource
140
- await installResource.buildContent();
141
- // tell puppeteer to reinstall serviceworker on next navigate
142
- await serviceWorkerReinstallCallback(file);
143
- }
144
- updateStyles(styles) {
145
- const styleElement = document.querySelector("#speed-kit-df-styles");
146
- if (styleElement) {
147
- styleElement.textContent = decodeURI(styles);
130
+ async clearPageFunction(page) {
131
+ const client = await page.target().createCDPSession();
132
+ const cacheResponse = await client.send("CacheStorage.requestCacheNames", {
133
+ securityOrigin: this.browserContext.domain,
134
+ });
135
+ for (const cache of cacheResponse.caches) {
136
+ if (cache.cacheName.includes("baqend")) {
137
+ await client.send("CacheStorage.deleteCache", {
138
+ cacheId: cache.cacheId,
139
+ });
140
+ }
148
141
  }
149
142
  }
143
+ async clearServiceWorker(page) {
144
+ const client = await page.target().createCDPSession();
145
+ await client.send("ServiceWorker.enable");
146
+ await client.send("ServiceWorker.unregister", {
147
+ scopeURL: `https://${this.customerConfig.domain}`,
148
+ });
149
+ }
150
150
  }
151
151
  exports.FileWatcher = FileWatcher;
@@ -1,8 +1,8 @@
1
- import { CliService } from "../cli";
2
1
  import CustomerConfig from "../integration-api/struct/customer-config";
2
+ import { BrowserContext } from "./onboarding-model";
3
3
  import { FetchEventHandler } from "./fetch-event-handler";
4
4
  import { FileWatcher } from "./file-events/file-watcher";
5
- import { BrowserContext } from "./onboarding-model";
5
+ import { CliService } from "../cli";
6
6
  import { TodoCollector } from "./todo-collector";
7
7
  /**
8
8
  * Represents the OnboardingService which is responsible for setting up the browser to test a config using Puppeteer.
@@ -20,12 +20,12 @@ export declare class OnboardingService {
20
20
  * prepare puppeteerBrowser, add eventListeners and start
21
21
  */
22
22
  run(): Promise<void>;
23
- private findPage;
24
- private navigate;
25
23
  private prepareBrowser;
26
- private prepareCleanState;
27
24
  private preparePage;
25
+ private findPage;
26
+ private prepareCleanState;
27
+ private reinstallSpeedKit;
28
28
  private registerFileWatcher;
29
29
  private registerReinstallSpeedKitOnNavigate;
30
- private reinstallSpeedKit;
30
+ private navigate;
31
31
  }
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OnboardingService = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
5
  const puppeteer_extra_1 = tslib_1.__importDefault(require("puppeteer-extra"));
7
- const safe_1 = require("../../helpers/safe");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
7
  const cli_1 = require("../cli");
8
+ const safe_1 = require("../../helpers/safe");
9
9
  /**
10
10
  * Represents the OnboardingService which is responsible for setting up the browser to test a config using Puppeteer.
11
11
  */
@@ -34,32 +34,17 @@ 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
- // eslint-disable-next-line unicorn/no-await-expression-member
38
37
  await (await browser.newPage()).goto("http://skonboarding.local/");
39
38
  }
40
39
  await this.navigate(page, `${this.customerConfig.scope}speed-kit-install.html?url=${this.customerConfig.scope}`);
41
40
  }
42
- async findPage(browser) {
43
- if (!browser)
44
- throw new Error("Please start a browser first.");
45
- const [page] = await browser.pages();
46
- if (page) {
47
- return page;
48
- }
49
- return browser.newPage();
50
- }
51
- async navigate(page, pathname) {
52
- const goto = new URL(pathname, `${this.browserContext.domain}`);
53
- await page.goto(goto.toString());
54
- await page.bringToFront();
55
- }
56
41
  async prepareBrowser() {
57
42
  const browser = await puppeteer_extra_1.default.launch({
58
- args: this.browserContext.browserArgs,
59
- defaultViewport: null,
60
43
  devtools: true,
61
- executablePath: this.browserContext.chromePath,
44
+ defaultViewport: null,
62
45
  headless: false /* ignoreDefaultArgs: true, */,
46
+ executablePath: this.browserContext.chromePath,
47
+ args: this.browserContext.browserArgs,
63
48
  });
64
49
  for (const target of browser.targets()) {
65
50
  if (target.type() === "browser") {
@@ -72,6 +57,27 @@ class OnboardingService {
72
57
  });
73
58
  return browser;
74
59
  }
60
+ async preparePage(browser) {
61
+ const page = await this.findPage(browser);
62
+ await this.prepareCleanState(page);
63
+ this.registerFileWatcher(page);
64
+ this.registerReinstallSpeedKitOnNavigate(page);
65
+ // inject open Todos from configFiles
66
+ page.on("framenavigated", async (_frame) => {
67
+ const tasks = this.taskCollector.getOpenTasks();
68
+ await (0, safe_1.safe)(page.evaluate(`window.skOnboarding = ${JSON.stringify(tasks)}`));
69
+ });
70
+ return page;
71
+ }
72
+ async findPage(browser) {
73
+ if (!browser)
74
+ throw new Error("Please start a browser first.");
75
+ const [page] = await browser.pages();
76
+ if (page) {
77
+ return page;
78
+ }
79
+ return browser.newPage();
80
+ }
75
81
  async prepareCleanState(page) {
76
82
  const pageClient = await page.target().createCDPSession();
77
83
  pageClient.on("ServiceWorker.workerRegistrationUpdated", ({ registrations, }) => {
@@ -95,17 +101,14 @@ class OnboardingService {
95
101
  await pageClient.send("Emulation.clearDeviceMetricsOverride");
96
102
  await pageClient.send("Emulation.clearGeolocationOverride");
97
103
  }
98
- async preparePage(browser) {
99
- const page = await this.findPage(browser);
100
- await this.prepareCleanState(page);
101
- this.registerFileWatcher(page);
102
- this.registerReinstallSpeedKitOnNavigate(page);
103
- // inject open Todos from configFiles
104
- page.on("framenavigated", async (_frame) => {
105
- const tasks = this.taskCollector.getOpenTasks();
106
- await (0, safe_1.safe)(page.evaluate(`window.skOnboarding = ${JSON.stringify(tasks)}`));
107
- });
108
- return page;
104
+ async reinstallSpeedKit(page, pathname) {
105
+ const url = new URL(page.url());
106
+ let target = url.href;
107
+ if (!pathname.includes("/speed-kit-install.html")) {
108
+ target = `${this.customerConfig.scope}speed-kit-install.html?url=${encodeURIComponent(target)}`;
109
+ }
110
+ this.reinstallOnNextNavigate = false;
111
+ await this.navigate(page, target);
109
112
  }
110
113
  registerFileWatcher(page) {
111
114
  this.fileWatcher.addCallbackOnFileChange(page, async () => {
@@ -123,14 +126,10 @@ class OnboardingService {
123
126
  }
124
127
  });
125
128
  }
126
- async reinstallSpeedKit(page, pathname) {
127
- const url = new URL(page.url());
128
- let target = url.href;
129
- if (!pathname.includes("/speed-kit-install.html")) {
130
- target = `${this.customerConfig.scope}speed-kit-install.html?url=${encodeURIComponent(target)}`;
131
- }
132
- this.reinstallOnNextNavigate = false;
133
- await this.navigate(page, target);
129
+ async navigate(page, pathname) {
130
+ const goto = new URL(pathname, `${this.browserContext.domain}`);
131
+ await page.goto(goto.toString());
132
+ await page.bringToFront();
134
133
  }
135
134
  }
136
135
  exports.OnboardingService = OnboardingService;
@@ -1,5 +1,5 @@
1
- import { CliService } from "../../cli";
2
1
  import { BaqendResponse } from "../browser/baqend-response";
2
+ import { CliService } from "../../cli";
3
3
  /**
4
4
  * This class represents a cache for storing responses from the localDocumentHandler.
5
5
  */
@@ -7,9 +7,9 @@ export declare class Cache {
7
7
  private cli;
8
8
  private inMemoryCache;
9
9
  constructor(cli: CliService);
10
- addEntry(requestUri: string, response: BaqendResponse): void;
11
- clear(): void;
12
10
  getAll(): IterableIterator<[string, BaqendResponse]>;
13
11
  getEntry(requestUri: string): BaqendResponse | void;
12
+ addEntry(requestUri: string, response: BaqendResponse): void;
14
13
  removeEntry(requestUri: string): void;
14
+ clear(): void;
15
15
  }
@@ -10,13 +10,6 @@ class Cache {
10
10
  constructor(cli) {
11
11
  this.cli = cli;
12
12
  }
13
- addEntry(requestUri, response) {
14
- this.inMemoryCache.set(requestUri, response);
15
- }
16
- clear() {
17
- this.cli.writeWarning("clear request-caches");
18
- this.inMemoryCache.clear();
19
- }
20
13
  getAll() {
21
14
  return this.inMemoryCache.entries();
22
15
  }
@@ -25,8 +18,15 @@ class Cache {
25
18
  return this.inMemoryCache.get(requestUri);
26
19
  }
27
20
  }
21
+ addEntry(requestUri, response) {
22
+ this.inMemoryCache.set(requestUri, response);
23
+ }
28
24
  removeEntry(requestUri) {
29
25
  this.inMemoryCache.delete(requestUri);
30
26
  }
27
+ clear() {
28
+ this.cli.writeWarning("clear request-caches");
29
+ this.inMemoryCache.clear();
30
+ }
31
31
  }
32
32
  exports.Cache = Cache;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ServerConfig = void 0;
4
- const safe_1 = require("../../../helpers/safe");
5
4
  const cli_1 = require("../../cli");
5
+ const safe_1 = require("../../../helpers/safe");
6
6
  class ServerConfig {
7
7
  cli;
8
8
  client;
@@ -1,9 +1,9 @@
1
1
  import { FileInterface } from "../integration-api/integration-api-model";
2
2
  export type task = {
3
+ todo: string;
3
4
  context: string;
4
5
  file: string;
5
6
  line: number;
6
- todo: string;
7
7
  };
8
8
  /**
9
9
  * Represents a TodoCollector class that collects open tasks from files.
@@ -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[^\n\r()|]*)((?:(?:\r\n|\r|\n)[^\n\r()|]*){3})/i;
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;
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
@@ -21,10 +21,10 @@ class TodoCollector {
21
21
  const content = configFile.getContent();
22
22
  content.replace(TODO_MATCH, (taskString, task, taskContext) => {
23
23
  tasks.push({
24
+ todo: task,
24
25
  context: encodeURI(taskContext),
25
26
  file: configFile.name,
26
27
  line: this.lineNumber(task, content),
27
- todo: task,
28
28
  });
29
29
  return taskString;
30
30
  });
@@ -36,8 +36,7 @@ class TodoCollector {
36
36
  }
37
37
  lineNumberByIndex(index, string) {
38
38
  // RegExp
39
- let line = 0;
40
- let match;
39
+ let line = 0, match;
41
40
  const re = /(^)[\S\s]/gm;
42
41
  while ((match = re.exec(string))) {
43
42
  if (match.index > index)
@@ -696,5 +696,5 @@
696
696
  ]
697
697
  }
698
698
  },
699
- "version": "2.13.0"
699
+ "version": "2.14.1"
700
700
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.13.0",
4
+ "version": "2.14.1",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"