@opencode/util 0.0.0-dev-1349 → 0.0.0-dev-1351
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/glob.d.ts +4 -0
- package/dist/glob.js +7 -1
- package/package.json +1 -1
package/dist/glob.d.ts
CHANGED
|
@@ -11,4 +11,8 @@ export declare namespace Glob {
|
|
|
11
11
|
function match(pattern: string, filepath: string, options?: {
|
|
12
12
|
dot?: boolean;
|
|
13
13
|
}): boolean;
|
|
14
|
+
/** `match` for one pattern, compiled on first use and reused for every later path. */
|
|
15
|
+
function matcher(pattern: string, options?: {
|
|
16
|
+
dot?: boolean;
|
|
17
|
+
}): (filepath: string) => boolean;
|
|
14
18
|
}
|
package/dist/glob.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { glob } from "glob";
|
|
2
|
-
import { minimatch } from "minimatch";
|
|
2
|
+
import { Minimatch, minimatch } from "minimatch";
|
|
3
3
|
export var Glob;
|
|
4
4
|
(function (Glob) {
|
|
5
5
|
function toGlobOptions(options) {
|
|
@@ -20,4 +20,10 @@ export var Glob;
|
|
|
20
20
|
return minimatch(filepath, pattern, { dot: options.dot ?? true });
|
|
21
21
|
}
|
|
22
22
|
Glob.match = match;
|
|
23
|
+
/** `match` for one pattern, compiled on first use and reused for every later path. */
|
|
24
|
+
function matcher(pattern, options = {}) {
|
|
25
|
+
let compiled;
|
|
26
|
+
return (filepath) => (compiled ??= new Minimatch(pattern, { dot: options.dot ?? true })).match(filepath);
|
|
27
|
+
}
|
|
28
|
+
Glob.matcher = matcher;
|
|
23
29
|
})(Glob || (Glob = {}));
|