@opencode/util 0.0.0-dev-1350 → 0.0.0-dev-1352
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/dist/patch.js +3 -2
- 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 = {}));
|
package/dist/patch.js
CHANGED
|
@@ -125,10 +125,11 @@ function parseAdd(lines, start, end, path) {
|
|
|
125
125
|
}),
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
// Every + line is a whole line of the file, as in Codex, so a final empty + line is a blank last line.
|
|
129
|
+
content.push(`${lines[index].slice(1)}\n`);
|
|
129
130
|
index++;
|
|
130
131
|
}
|
|
131
|
-
return { content: content.join("
|
|
132
|
+
return { content: content.join(""), next: index };
|
|
132
133
|
}
|
|
133
134
|
function parseUpdate(lines, start, end, path, hunk) {
|
|
134
135
|
const chunks = [];
|