@speedkit/cli 4.17.0 → 4.17.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.17.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.17.0...v4.17.1) (2026-07-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * reFetching the last 10Urls is a big problem for ssrConfigs ([99604b5](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/99604b5f11b853ee11543e141e6aa0f66a7de487))
7
+
1
8
  # [4.17.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.16.0...v4.17.0) (2026-07-17)
2
9
 
3
10
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/4.17.0 linux-x64 node-v22.23.1
24
+ @speedkit/cli/4.17.1 linux-x64 node-v22.23.1
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -7,11 +7,6 @@ export declare class BaqendResponse implements Partial<Protocol.Fetch.FulfillReq
7
7
  private readonly contentType;
8
8
  private readonly contentLength;
9
9
  constructor(body: string | Buffer, contentType?: string, headers?: Protocol.Fetch.HeaderEntry[], status?: number);
10
- /**
11
- * Epoch ms parsed from the `last-modified` header (set when the response was
12
- * built), or 0 if absent/unparseable. Used to order cache entries by recency.
13
- */
14
- getLastModified(): number;
15
10
  setHeader(name: string, value: string): void;
16
11
  protected addCustomHeaders(headers?: Protocol.Fetch.HeaderEntry[]): Protocol.Fetch.HeaderEntry[];
17
12
  }
@@ -23,15 +23,6 @@ export class BaqendResponse {
23
23
  ? body.toString("base64")
24
24
  : Buffer.from(body).toString("base64");
25
25
  }
26
- /**
27
- * Epoch ms parsed from the `last-modified` header (set when the response was
28
- * built), or 0 if absent/unparseable. Used to order cache entries by recency.
29
- */
30
- getLastModified() {
31
- const header = this.responseHeaders.find((h) => h.name.toLowerCase() === "last-modified");
32
- const timestamp = header ? Date.parse(header.value) : NaN;
33
- return Number.isNaN(timestamp) ? 0 : timestamp;
34
- }
35
26
  setHeader(name, value) {
36
27
  for (const header of this.responseHeaders) {
37
28
  if (header.name === name) {
@@ -20,10 +20,10 @@ export declare class FileWatcher {
20
20
  setCacheRefresher(cacheRefresher: VirtualOrestesApp): void;
21
21
  /**
22
22
  * Drop the dh-cache after a config change. When a cache refresher is wired
23
- * (local mode) the most recent entries are re-warmed in the background so the
24
- * developer's current pages stay instant and fresh; otherwise the cache is
25
- * simply cleared.
23
+ * (local mode) the currently open page is re-warmed in the background so it
24
+ * stays instant and fresh; otherwise the cache is simply cleared.
26
25
  *
26
+ * @param page the browser page whose current url should be re-warmed
27
27
  * @private
28
28
  */
29
29
  private clearOrRefreshCache;
@@ -28,16 +28,20 @@ export class FileWatcher {
28
28
  }
29
29
  /**
30
30
  * Drop the dh-cache after a config change. When a cache refresher is wired
31
- * (local mode) the most recent entries are re-warmed in the background so the
32
- * developer's current pages stay instant and fresh; otherwise the cache is
33
- * simply cleared.
31
+ * (local mode) the currently open page is re-warmed in the background so it
32
+ * stays instant and fresh; otherwise the cache is simply cleared.
34
33
  *
34
+ * @param page the browser page whose current url should be re-warmed
35
35
  * @private
36
36
  */
37
- clearOrRefreshCache() {
37
+ clearOrRefreshCache(page) {
38
38
  if (this.cacheRefresher) {
39
+ // page.url() carries a hash fragment that never reaches the server, so it
40
+ // is not part of the cache key — strip it before matching.
41
+ const currentUrl = new URL(page.url());
42
+ currentUrl.hash = "";
39
43
  // fire-and-forget: refresh clears the cache first, then re-warms
40
- void this.cacheRefresher.refreshRecent(10);
44
+ void this.cacheRefresher.refreshCurrentUrl(currentUrl.href);
41
45
  return;
42
46
  }
43
47
  this.cache.clear();
@@ -179,7 +183,7 @@ export class FileWatcher {
179
183
  this.cli.writeWarning(`changed file: ${file.name}`);
180
184
  await this.safeClearPageBrowsersCacheStorage(page);
181
185
  await this.documentHandler.buildDocumentHandler();
182
- this.clearOrRefreshCache();
186
+ this.clearOrRefreshCache(page);
183
187
  await installResource.buildContent();
184
188
  }
185
189
  /**
@@ -192,7 +196,7 @@ export class FileWatcher {
192
196
  async onChangeDynamicStyleCallback(file, page) {
193
197
  this.cli.writeWarning(`changed file: ${file.name}`);
194
198
  await this.documentHandler.buildDocumentHandler();
195
- this.clearOrRefreshCache();
199
+ this.clearOrRefreshCache(page);
196
200
  const escapedStyles = encodeURI(file.getContent());
197
201
  const evaluateResult = await safe(race(Promise.all([
198
202
  page.evaluate(this.updateStylesInlineFunction, escapedStyles),
@@ -28,15 +28,15 @@ export declare class VirtualOrestesApp {
28
28
  */
29
29
  refreshUrl(originUrl: string): Promise<void>;
30
30
  /**
31
- * Clear the whole dh-cache, then re-warm the most recently cached entries in
32
- * the background (ordered by their `last-modified` header). Used as a
33
- * replacement for a bare cache clear on config changes: stale entries are
34
- * dropped, but the last `limit` pages are rebuilt proactively so the
35
- * developer's current pages stay instant and fresh.
31
+ * Clear the whole dh-cache, then re-warm only the currently open page's
32
+ * cached entries in the background. Used as a replacement for a bare cache
33
+ * clear on config changes: every stale entry is dropped, but the page the
34
+ * developer is currently looking at is rebuilt proactively so it stays
35
+ * instant and fresh after the change.
36
36
  *
37
- * @param limit how many of the most recently cached entries to re-warm
37
+ * @param currentUrl the url currently open in the browser (page.url())
38
38
  */
39
- refreshRecent(limit?: number): Promise<void>;
39
+ refreshCurrentUrl(currentUrl: string): Promise<void>;
40
40
  /**
41
41
  * Rebuild a single cache entry (by its full asset request url), replacing the
42
42
  * previously cached response. On failure the stale entry is dropped so we
@@ -58,25 +58,24 @@ export class VirtualOrestesApp {
58
58
  }
59
59
  }
60
60
  /**
61
- * Clear the whole dh-cache, then re-warm the most recently cached entries in
62
- * the background (ordered by their `last-modified` header). Used as a
63
- * replacement for a bare cache clear on config changes: stale entries are
64
- * dropped, but the last `limit` pages are rebuilt proactively so the
65
- * developer's current pages stay instant and fresh.
61
+ * Clear the whole dh-cache, then re-warm only the currently open page's
62
+ * cached entries in the background. Used as a replacement for a bare cache
63
+ * clear on config changes: every stale entry is dropped, but the page the
64
+ * developer is currently looking at is rebuilt proactively so it stays
65
+ * instant and fresh after the change.
66
66
  *
67
- * @param limit how many of the most recently cached entries to re-warm
67
+ * @param currentUrl the url currently open in the browser (page.url())
68
68
  */
69
- async refreshRecent(limit = 10) {
70
- const recentKeys = [...this.cache.getAll()]
71
- .sort(([, a], [, b]) => b.getLastModified() - a.getLastModified())
72
- .slice(0, limit)
73
- .map(([key]) => key);
69
+ async refreshCurrentUrl(currentUrl) {
70
+ const matchingKeys = [...this.cache.getAll()]
71
+ .map(([key]) => key)
72
+ .filter((key) => key.includes(currentUrl));
74
73
  this.cache.clear();
75
- if (recentKeys.length === 0) {
74
+ if (matchingKeys.length === 0) {
76
75
  return;
77
76
  }
78
- this.cli.write(`refreshing ${recentKeys.length} recent dh-cache entries in background`);
79
- for (const key of recentKeys) {
77
+ this.cli.write(`refreshing ${matchingKeys.length} dh-cache entries for current url ${currentUrl} in background`);
78
+ for (const key of matchingKeys) {
80
79
  await this.refreshEntry(key);
81
80
  }
82
81
  }
@@ -880,5 +880,5 @@
880
880
  ]
881
881
  }
882
882
  },
883
- "version": "4.17.0"
883
+ "version": "4.17.1"
884
884
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "4.17.0",
4
+ "version": "4.17.1",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"