@adguard/agtree 2.1.1 → 2.1.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/dist/agtree.d.ts +5 -2
- package/dist/agtree.js +10 -8
- package/dist/agtree.mjs +10 -8
- package/package.json +1 -1
package/dist/agtree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v2.1.
|
|
2
|
+
* AGTree v2.1.2 (build date: Thu, 19 Sep 2024 15:44:40 GMT)
|
|
3
3
|
* (c) 2024 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -3415,9 +3415,12 @@ declare const SPECIAL_REGEX_SYMBOLS: Set<string>;
|
|
|
3415
3415
|
*/
|
|
3416
3416
|
declare class RegExpUtils {
|
|
3417
3417
|
/**
|
|
3418
|
-
* Checks whether a string is a RegExp pattern.
|
|
3418
|
+
* Checks whether a string possibly is a RegExp pattern.
|
|
3419
3419
|
* Flags are not supported.
|
|
3420
3420
|
*
|
|
3421
|
+
* Note: it does not perform a full validation of the pattern,
|
|
3422
|
+
* it just checks if the string starts and ends with a slash.
|
|
3423
|
+
*
|
|
3421
3424
|
* @param pattern - Pattern to check
|
|
3422
3425
|
* @returns `true` if the string is a RegExp pattern, `false` otherwise
|
|
3423
3426
|
*/
|
package/dist/agtree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v2.1.
|
|
2
|
+
* AGTree v2.1.2 (build date: Thu, 19 Sep 2024 15:44:40 GMT)
|
|
3
3
|
* (c) 2024 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -11566,20 +11566,22 @@ const SPECIAL_REGEX_SYMBOLS = new Set([
|
|
|
11566
11566
|
*/
|
|
11567
11567
|
class RegExpUtils {
|
|
11568
11568
|
/**
|
|
11569
|
-
* Checks whether a string is a RegExp pattern.
|
|
11569
|
+
* Checks whether a string possibly is a RegExp pattern.
|
|
11570
11570
|
* Flags are not supported.
|
|
11571
11571
|
*
|
|
11572
|
+
* Note: it does not perform a full validation of the pattern,
|
|
11573
|
+
* it just checks if the string starts and ends with a slash.
|
|
11574
|
+
*
|
|
11572
11575
|
* @param pattern - Pattern to check
|
|
11573
11576
|
* @returns `true` if the string is a RegExp pattern, `false` otherwise
|
|
11574
11577
|
*/
|
|
11575
11578
|
static isRegexPattern(pattern) {
|
|
11576
11579
|
const trimmedPattern = pattern.trim();
|
|
11577
11580
|
// Avoid false positives
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
return false;
|
|
11581
|
+
return trimmedPattern.length > REGEX_MARKER.length * 2
|
|
11582
|
+
&& trimmedPattern.startsWith(REGEX_MARKER)
|
|
11583
|
+
&& trimmedPattern.endsWith(REGEX_MARKER)
|
|
11584
|
+
&& trimmedPattern[REGEX_MARKER.length - 2] !== ESCAPE_CHARACTER;
|
|
11583
11585
|
}
|
|
11584
11586
|
/**
|
|
11585
11587
|
* Negates a RegExp pattern. Technically, this method wraps the pattern in `^((?!` and `).)*$`.
|
|
@@ -15615,7 +15617,7 @@ class RuleCategorizer {
|
|
|
15615
15617
|
}
|
|
15616
15618
|
}
|
|
15617
15619
|
|
|
15618
|
-
const version = "2.1.
|
|
15620
|
+
const version = "2.1.2";
|
|
15619
15621
|
|
|
15620
15622
|
/**
|
|
15621
15623
|
* @file AGTree version
|
package/dist/agtree.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v2.1.
|
|
2
|
+
* AGTree v2.1.2 (build date: Thu, 19 Sep 2024 15:44:40 GMT)
|
|
3
3
|
* (c) 2024 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -11546,20 +11546,22 @@ const SPECIAL_REGEX_SYMBOLS = new Set([
|
|
|
11546
11546
|
*/
|
|
11547
11547
|
class RegExpUtils {
|
|
11548
11548
|
/**
|
|
11549
|
-
* Checks whether a string is a RegExp pattern.
|
|
11549
|
+
* Checks whether a string possibly is a RegExp pattern.
|
|
11550
11550
|
* Flags are not supported.
|
|
11551
11551
|
*
|
|
11552
|
+
* Note: it does not perform a full validation of the pattern,
|
|
11553
|
+
* it just checks if the string starts and ends with a slash.
|
|
11554
|
+
*
|
|
11552
11555
|
* @param pattern - Pattern to check
|
|
11553
11556
|
* @returns `true` if the string is a RegExp pattern, `false` otherwise
|
|
11554
11557
|
*/
|
|
11555
11558
|
static isRegexPattern(pattern) {
|
|
11556
11559
|
const trimmedPattern = pattern.trim();
|
|
11557
11560
|
// Avoid false positives
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
return false;
|
|
11561
|
+
return trimmedPattern.length > REGEX_MARKER.length * 2
|
|
11562
|
+
&& trimmedPattern.startsWith(REGEX_MARKER)
|
|
11563
|
+
&& trimmedPattern.endsWith(REGEX_MARKER)
|
|
11564
|
+
&& trimmedPattern[REGEX_MARKER.length - 2] !== ESCAPE_CHARACTER;
|
|
11563
11565
|
}
|
|
11564
11566
|
/**
|
|
11565
11567
|
* Negates a RegExp pattern. Technically, this method wraps the pattern in `^((?!` and `).)*$`.
|
|
@@ -15595,7 +15597,7 @@ class RuleCategorizer {
|
|
|
15595
15597
|
}
|
|
15596
15598
|
}
|
|
15597
15599
|
|
|
15598
|
-
const version = "2.1.
|
|
15600
|
+
const version = "2.1.2";
|
|
15599
15601
|
|
|
15600
15602
|
/**
|
|
15601
15603
|
* @file AGTree version
|