@speedkit/cli 4.25.0 → 4.25.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.25.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.25.0...v4.25.1) (2026-09-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **revalidate:** stop prefix derivation at a character class ([82a9432](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/82a94327b35b49e0b3403e4caee88356850f4457))
7
+
1
8
  # [4.25.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.24.2...v4.25.0) (2026-09-08)
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.25.0 linux-x64 node-v22.23.2
24
+ @speedkit/cli/4.25.1 linux-x64 node-v22.23.2
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -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
+ });
@@ -1314,5 +1314,5 @@
1314
1314
  ]
1315
1315
  }
1316
1316
  },
1317
- "version": "4.25.0"
1317
+ "version": "4.25.1"
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.1",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"