@speedkit/cli 4.25.0 → 4.25.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [4.25.2](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.25.1...v4.25.2) (2026-09-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **revalidate:** repair the escaping in the --pattern examples ([002d350](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/002d3504c4848a99127dce723d871d3bc3f13a67))
7
+
8
+ ## [4.25.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.25.0...v4.25.1) (2026-09-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **revalidate:** stop prefix derivation at a character class ([82a9432](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/82a94327b35b49e0b3403e4caee88356850f4457))
14
+
1
15
  # [4.25.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.24.2...v4.25.0) (2026-09-08)
2
16
 
3
17
 
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.25.0 linux-x64 node-v22.23.2
24
+ @speedkit/cli/4.25.2 linux-x64 node-v22.23.2
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -783,11 +783,11 @@ DESCRIPTION
783
783
  EXAMPLES
784
784
  $ sk revalidate <app> --pattern <regex> [--pattern <regex>] [--dryRun] [--wait]
785
785
 
786
- $ sk revalidate decathlon --pattern '^https://www\\.decathlon\\.de/damen/.*-c(?:1234|5678)(?:/|\\?|$)' --dryRun
786
+ $ sk revalidate example-shop --pattern '^https://www\.example\.com/en/.*-c(?:1234|5678)(?:/|\?|$)' --dryRun
787
787
 
788
- $ sk revalidate decathlon --pattern '^https://www\\.decathlon\\.de/damen/.*-c1234(?:/|\\?|$)' --wait
788
+ $ sk revalidate example-shop --pattern '^https://www\.example\.com/en/.*-c1234(?:/|\?|$)' --wait
789
789
 
790
- $ sk revalidate decathlon --prefix https://www.decathlon.de/damen/ --dryRun
790
+ $ sk revalidate example-shop --prefix https://www.example.com/en/ --dryRun
791
791
  ```
792
792
 
793
793
  ## `sk wpt-launcher URLS TESTID`
@@ -1,5 +1,5 @@
1
1
  import { Args, Command, Flags } from "@oclif/core";
2
- import { CLIParameters, CLIParametersChar, CLIParametersExample, } from "../models/cli-parameters.js";
2
+ import { CLIParameters, CLIParametersChar } from "../models/cli-parameters.js";
3
3
  import { isNonInteractive } from "../helpers/environment.js";
4
4
  import { CONFIRMATION_THRESHOLD, REVALIDATE_TYPES, RevalidateContext, RevalidateFactory, } from "../services/revalidate/index.js";
5
5
  const SAMPLE_SIZE = 10;
@@ -50,9 +50,9 @@ export default class Revalidate extends Command {
50
50
  };
51
51
  static examples = [
52
52
  `$ sk revalidate <${CLIParameters.AppName}> --pattern <regex> [--pattern <regex>] [--${CLIParameters.DryRun}] [--wait]`,
53
- `$ sk revalidate ${CLIParametersExample.AppName} --pattern '^https://www\\\\.decathlon\\\\.de/damen/.*-c(?:1234|5678)(?:/|\\\\?|$)' --${CLIParameters.DryRun}`,
54
- `$ sk revalidate ${CLIParametersExample.AppName} --pattern '^https://www\\\\.decathlon\\\\.de/damen/.*-c1234(?:/|\\\\?|$)' --wait`,
55
- `$ sk revalidate ${CLIParametersExample.AppName} --prefix ${CLIParametersExample.PageUrl}damen/ --${CLIParameters.DryRun}`,
53
+ `$ sk revalidate example-shop --pattern '^https://www\\.example\\.com/en/.*-c(?:1234|5678)(?:/|\\?|$)' --${CLIParameters.DryRun}`,
54
+ `$ sk revalidate example-shop --pattern '^https://www\\.example\\.com/en/.*-c1234(?:/|\\?|$)' --wait`,
55
+ `$ sk revalidate example-shop --prefix https://www.example.com/en/ --${CLIParameters.DryRun}`,
56
56
  ];
57
57
  async run() {
58
58
  const { args, flags } = await this.parse(Revalidate);
@@ -6,8 +6,14 @@ import { RevalidateFilterInterface, RevalidateJobStatusInterface, RevalidatePrev
6
6
  *
7
7
  * This is the same text MongoDB turns into index bounds, so deriving the prefix
8
8
  * here keeps the two in step: the caller states the pattern once, and the prefix
9
- * cannot drift from it. An escaped character counts as literal, so `\.` yields `.`
10
- * and the host survives. The walk stops at the first metacharacter.
9
+ * cannot drift from it. The walk stops at the first metacharacter.
10
+ *
11
+ * An escape only counts as a literal when it escapes punctuation, so `\.` yields
12
+ * `.` and the host survives. An alphanumeric escape is a character class or a
13
+ * special instead — `\w`, `\d`, `\s`, `\b`, `\n`, a back-reference — and matches
14
+ * no single known character, so the walk has to stop there. Reading `\w` as the
15
+ * letter "w" would build a prefix that matches nothing, and the job would then
16
+ * report zero assets rather than an error.
11
17
  */
12
18
  export declare function derivePrefix(pattern: string): string;
13
19
  export declare class RevalidateService {
@@ -25,8 +25,14 @@ const REGEXP_METACHARACTERS = new Set([
25
25
  *
26
26
  * This is the same text MongoDB turns into index bounds, so deriving the prefix
27
27
  * here keeps the two in step: the caller states the pattern once, and the prefix
28
- * cannot drift from it. An escaped character counts as literal, so `\.` yields `.`
29
- * and the host survives. The walk stops at the first metacharacter.
28
+ * cannot drift from it. The walk stops at the first metacharacter.
29
+ *
30
+ * An escape only counts as a literal when it escapes punctuation, so `\.` yields
31
+ * `.` and the host survives. An alphanumeric escape is a character class or a
32
+ * special instead — `\w`, `\d`, `\s`, `\b`, `\n`, a back-reference — and matches
33
+ * no single known character, so the walk has to stop there. Reading `\w` as the
34
+ * letter "w" would build a prefix that matches nothing, and the job would then
35
+ * report zero assets rather than an error.
30
36
  */
31
37
  export function derivePrefix(pattern) {
32
38
  if (!pattern.startsWith("^")) {
@@ -39,6 +45,8 @@ export function derivePrefix(pattern) {
39
45
  const escaped = pattern[index + 1];
40
46
  if (escaped === undefined)
41
47
  break;
48
+ if (/[A-Za-z0-9]/.test(escaped))
49
+ break;
42
50
  prefix += escaped;
43
51
  index++;
44
52
  continue;
@@ -0,0 +1,31 @@
1
+ import { expect } from "chai";
2
+ import { describe, it } from "mocha";
3
+ import { derivePrefix } from "./revalidate-service.js";
4
+ describe("derivePrefix", () => {
5
+ it("reads the literal head up to the first metacharacter", () => {
6
+ expect(derivePrefix("^https://www\\.example\\.com/en/.*-c1234$")).to.equal("https://www.example.com/en/");
7
+ });
8
+ it("keeps the head before a group, so a locale alternation still yields a prefix", () => {
9
+ expect(derivePrefix("^https://www\\.example\\.com/(?:en|de)/.*-c1234$")).to.equal("https://www.example.com/");
10
+ });
11
+ it("stops at a character class instead of reading it as a letter", () => {
12
+ // Reading `\w` as "w" would yield ".../w" — a prefix that matches nothing,
13
+ // which the job reports as zero assets rather than as an error.
14
+ expect(derivePrefix("^https://www\\.example\\.com/\\w{2}/.*-c1234$")).to.equal("https://www.example.com/");
15
+ expect(derivePrefix("^https://www\\.example\\.com/\\d+/")).to.equal("https://www.example.com/");
16
+ expect(derivePrefix("^https://www\\.example\\.com/\\s")).to.equal("https://www.example.com/");
17
+ });
18
+ it("treats an escaped punctuation character as a literal", () => {
19
+ expect(derivePrefix("^https://www\\.example\\.com/a\\-b/")).to.equal("https://www.example.com/a-b/");
20
+ });
21
+ it("yields nothing for an unanchored pattern", () => {
22
+ expect(derivePrefix("https://www\\.example\\.com/en/")).to.equal("");
23
+ expect(derivePrefix("-c1234$")).to.equal("");
24
+ });
25
+ it("yields nothing when a metacharacter follows the anchor", () => {
26
+ expect(derivePrefix("^(?:a|b)")).to.equal("");
27
+ });
28
+ it("does not run past a trailing backslash", () => {
29
+ expect(derivePrefix("^https://www\\.example\\.com/\\")).to.equal("https://www.example.com/");
30
+ });
31
+ });
@@ -883,9 +883,9 @@
883
883
  "description": "Purge or refresh cached assets by prefix and query. Run it after a config that narrows scope goes live, so returning visitors stop receiving the cached HTML.",
884
884
  "examples": [
885
885
  "$ sk revalidate <app> --pattern <regex> [--pattern <regex>] [--dryRun] [--wait]",
886
- "$ sk revalidate decathlon --pattern '^https://www\\\\.decathlon\\\\.de/damen/.*-c(?:1234|5678)(?:/|\\\\?|$)' --dryRun",
887
- "$ sk revalidate decathlon --pattern '^https://www\\\\.decathlon\\\\.de/damen/.*-c1234(?:/|\\\\?|$)' --wait",
888
- "$ sk revalidate decathlon --prefix https://www.decathlon.de/damen/ --dryRun"
886
+ "$ sk revalidate example-shop --pattern '^https://www\\.example\\.com/en/.*-c(?:1234|5678)(?:/|\\?|$)' --dryRun",
887
+ "$ sk revalidate example-shop --pattern '^https://www\\.example\\.com/en/.*-c1234(?:/|\\?|$)' --wait",
888
+ "$ sk revalidate example-shop --prefix https://www.example.com/en/ --dryRun"
889
889
  ],
890
890
  "flags": {
891
891
  "pattern": {
@@ -1314,5 +1314,5 @@
1314
1314
  ]
1315
1315
  }
1316
1316
  },
1317
- "version": "4.25.0"
1317
+ "version": "4.25.2"
1318
1318
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "4.25.0",
4
+ "version": "4.25.2",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"