@karmaniverous/jeeves-meta 0.11.1 → 0.11.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/cli/jeeves-meta/index.js +9 -3
- package/dist/index.js +9 -3
- package/package.json +1 -1
|
@@ -845,13 +845,19 @@ async function listMetas(config, watcher) {
|
|
|
845
845
|
* @module escapeGlob
|
|
846
846
|
*/
|
|
847
847
|
/**
|
|
848
|
-
* Escape glob metacharacters in a string.
|
|
848
|
+
* Escape glob metacharacters in a string using character-class wrapping.
|
|
849
|
+
*
|
|
850
|
+
* Backslash escaping (`\(`) does not work reliably on Windows where `\` is
|
|
851
|
+
* the path separator. Instead, each metacharacter is wrapped in a character
|
|
852
|
+
* class (e.g. `(` → `[(]`) which is universally supported by glob libraries.
|
|
853
|
+
*
|
|
854
|
+
* Square brackets themselves are escaped as `[[]` and `[]]`.
|
|
849
855
|
*
|
|
850
856
|
* @param s - Raw path string.
|
|
851
|
-
* @returns String with glob metacharacters
|
|
857
|
+
* @returns String with glob metacharacters wrapped in character classes.
|
|
852
858
|
*/
|
|
853
859
|
function escapeGlob(s) {
|
|
854
|
-
return s.replace(/[*?[\]{}()!]/g,
|
|
860
|
+
return s.replace(/[*?[\]{}()!]/g, (ch) => `[${ch}]`);
|
|
855
861
|
}
|
|
856
862
|
|
|
857
863
|
/**
|
package/dist/index.js
CHANGED
|
@@ -837,13 +837,19 @@ async function listMetas(config, watcher) {
|
|
|
837
837
|
* @module escapeGlob
|
|
838
838
|
*/
|
|
839
839
|
/**
|
|
840
|
-
* Escape glob metacharacters in a string.
|
|
840
|
+
* Escape glob metacharacters in a string using character-class wrapping.
|
|
841
|
+
*
|
|
842
|
+
* Backslash escaping (`\(`) does not work reliably on Windows where `\` is
|
|
843
|
+
* the path separator. Instead, each metacharacter is wrapped in a character
|
|
844
|
+
* class (e.g. `(` → `[(]`) which is universally supported by glob libraries.
|
|
845
|
+
*
|
|
846
|
+
* Square brackets themselves are escaped as `[[]` and `[]]`.
|
|
841
847
|
*
|
|
842
848
|
* @param s - Raw path string.
|
|
843
|
-
* @returns String with glob metacharacters
|
|
849
|
+
* @returns String with glob metacharacters wrapped in character classes.
|
|
844
850
|
*/
|
|
845
851
|
function escapeGlob(s) {
|
|
846
|
-
return s.replace(/[*?[\]{}()!]/g,
|
|
852
|
+
return s.replace(/[*?[\]{}()!]/g, (ch) => `[${ch}]`);
|
|
847
853
|
}
|
|
848
854
|
|
|
849
855
|
/**
|