@oh-my-pi/pi-natives 12.3.0 → 12.5.0
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/native/pi_natives.darwin-arm64.node +0 -0
- package/native/pi_natives.darwin-x64.node +0 -0
- package/native/pi_natives.linux-arm64.node +0 -0
- package/native/pi_natives.linux-x64.node +0 -0
- package/native/pi_natives.win32-x64.node +0 -0
- package/package.json +2 -2
- package/src/glob/index.ts +2 -5
- package/src/glob/types.ts +4 -2
- package/src/index.ts +1 -0
- package/src/native.ts +2 -0
- package/src/text/index.ts +1 -1
- package/src/text/types.ts +5 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.5.0",
|
|
4
4
|
"description": "Native Rust functionality via N-API",
|
|
5
5
|
"keywords": ["napi", "rust", "native", "grep", "text-processing"],
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://github.com/can1357/oh-my-pi/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@oh-my-pi/pi-utils": "12.
|
|
40
|
+
"@oh-my-pi/pi-utils": "12.5.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/bun": "^1.3.9"
|
package/src/glob/index.ts
CHANGED
|
@@ -16,10 +16,6 @@ export { FileType } from "./types";
|
|
|
16
16
|
export async function glob(options: GlobOptions, onMatch?: (match: GlobMatch) => void): Promise<GlobResult> {
|
|
17
17
|
const searchPath = path.resolve(options.path);
|
|
18
18
|
const pattern = options.pattern || "*";
|
|
19
|
-
|
|
20
|
-
// Convert simple patterns to recursive globs if needed
|
|
21
|
-
const globPattern = pattern.includes("/") || pattern.startsWith("**") ? pattern : `**/${pattern}`;
|
|
22
|
-
|
|
23
19
|
// napi-rs ThreadsafeFunction passes (error, value) - skip callback on error
|
|
24
20
|
const cb = onMatch ? (err: Error | null, m: GlobMatch) => !err && onMatch(m) : undefined;
|
|
25
21
|
|
|
@@ -27,9 +23,10 @@ export async function glob(options: GlobOptions, onMatch?: (match: GlobMatch) =>
|
|
|
27
23
|
{
|
|
28
24
|
...options,
|
|
29
25
|
path: searchPath,
|
|
30
|
-
pattern
|
|
26
|
+
pattern,
|
|
31
27
|
hidden: options.hidden ?? false,
|
|
32
28
|
gitignore: options.gitignore ?? true,
|
|
29
|
+
recursive: options.recursive ?? true,
|
|
33
30
|
},
|
|
34
31
|
cb,
|
|
35
32
|
);
|
package/src/glob/types.ts
CHANGED
|
@@ -19,8 +19,10 @@ export interface GlobOptions extends Cancellable {
|
|
|
19
19
|
pattern: string;
|
|
20
20
|
/** Directory to search. */
|
|
21
21
|
path: string;
|
|
22
|
-
/** Filter by file type: "file", "dir", or "symlink". */
|
|
22
|
+
/** Filter by file type: "file", "dir", or "symlink". Symlinks match file/dir filters when their target type matches. */
|
|
23
23
|
fileType?: FileType;
|
|
24
|
+
/** Match simple patterns recursively by default (example: *.ts -> recursive match). Set false to keep patterns relative to the search root only. */
|
|
25
|
+
recursive?: boolean;
|
|
24
26
|
/** Include hidden files (default: false). */
|
|
25
27
|
hidden?: boolean;
|
|
26
28
|
/** Maximum number of results to return. */
|
|
@@ -39,7 +41,7 @@ export interface GlobOptions extends Cancellable {
|
|
|
39
41
|
export interface GlobMatch {
|
|
40
42
|
/** Relative path from the search root. */
|
|
41
43
|
path: string;
|
|
42
|
-
/** Resolved filesystem type for the match. */
|
|
44
|
+
/** Resolved filesystem type for the match (for fileType=file/dir filters, symlink targets are reported as file/dir). */
|
|
43
45
|
fileType: FileType;
|
|
44
46
|
/** Modification time in milliseconds since epoch, if available. */
|
|
45
47
|
mtime?: number;
|
package/src/index.ts
CHANGED
package/src/native.ts
CHANGED
|
@@ -170,6 +170,8 @@ function validateNative(bindings: NativeBindings, source: string): void {
|
|
|
170
170
|
checkFn("supportsLanguage");
|
|
171
171
|
checkFn("getSupportedLanguages");
|
|
172
172
|
checkFn("truncateToWidth");
|
|
173
|
+
checkFn("sanitizeText");
|
|
174
|
+
|
|
173
175
|
checkFn("wrapTextWithAnsi");
|
|
174
176
|
checkFn("sliceWithWidth");
|
|
175
177
|
checkFn("extractSegments");
|
package/src/text/index.ts
CHANGED
|
@@ -41,4 +41,4 @@ export function sliceWithWidth(line: string, startCol: number, length: number, s
|
|
|
41
41
|
return native.sliceWithWidth(line, startCol, length, strict);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export const { wrapTextWithAnsi, visibleWidth, extractSegments } = native;
|
|
44
|
+
export const { wrapTextWithAnsi, visibleWidth, extractSegments, sanitizeText } = native;
|
package/src/text/types.ts
CHANGED
|
@@ -42,6 +42,11 @@ declare module "../bindings" {
|
|
|
42
42
|
* @param pad Whether to pad the output to `maxWidth`.
|
|
43
43
|
*/
|
|
44
44
|
truncateToWidth(text: string, maxWidth: number, ellipsisKind: number, pad: boolean): string;
|
|
45
|
+
/**
|
|
46
|
+
* Sanitize text output: strip ANSI codes, remove binary garbage, normalize line endings.
|
|
47
|
+
*/
|
|
48
|
+
sanitizeText(text: string): string;
|
|
49
|
+
|
|
45
50
|
/**
|
|
46
51
|
* Wrap text to a visible width, preserving ANSI codes across line breaks.
|
|
47
52
|
* @param text UTF-16 input text with optional ANSI escapes.
|