@poveste/shared 0.12.3 → 0.13.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/dist/escape-regexp.d.ts +14 -0
- package/dist/escape-regexp.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape a string so a `RegExp` built from it matches that string literally.
|
|
3
|
+
*
|
|
4
|
+
* `RegExp.escape` does exactly this and would be the obvious call, but it
|
|
5
|
+
* landed in Node 24 and every package here still accepts `^22.22.2` — so a
|
|
6
|
+
* contributor on the floor version gets `TypeError: RegExp.escape is not a
|
|
7
|
+
* function` rather than a diagnostic. (TypeScript 5.6 does not type it either,
|
|
8
|
+
* which is the half you notice first and the one that matters less.)
|
|
9
|
+
*
|
|
10
|
+
* It lives in `shared` because four call sites across three packages build a
|
|
11
|
+
* pattern from a name they did not choose, and one of them from the consumer's
|
|
12
|
+
* own project path.
|
|
13
|
+
*/
|
|
14
|
+
export declare function escapeRegExp(value: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape a string so a `RegExp` built from it matches that string literally.
|
|
3
|
+
*
|
|
4
|
+
* `RegExp.escape` does exactly this and would be the obvious call, but it
|
|
5
|
+
* landed in Node 24 and every package here still accepts `^22.22.2` — so a
|
|
6
|
+
* contributor on the floor version gets `TypeError: RegExp.escape is not a
|
|
7
|
+
* function` rather than a diagnostic. (TypeScript 5.6 does not type it either,
|
|
8
|
+
* which is the half you notice first and the one that matters less.)
|
|
9
|
+
*
|
|
10
|
+
* It lives in `shared` because four call sites across three packages build a
|
|
11
|
+
* pattern from a name they did not choose, and one of them from the consumer's
|
|
12
|
+
* own project path.
|
|
13
|
+
*/
|
|
14
|
+
export function escapeRegExp(value) {
|
|
15
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poveste/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.1",
|
|
5
5
|
"description": "Shared utilities for Poveste",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Sorin Gitlan",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"vite": "^8.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@poveste/vendors": "^0.
|
|
42
|
+
"@poveste/vendors": "^0.13.1",
|
|
43
43
|
"@types/fs-extra": "^11.0.4",
|
|
44
44
|
"@types/markdown-it": "^14.1.2",
|
|
45
45
|
"chokidar": "^4.0.1",
|