@oh-my-pi/pi-natives 12.3.0 → 12.4.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.
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.0",
3
+ "version": "12.4.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.3.0"
40
+ "@oh-my-pi/pi-utils": "12.4.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/bun": "^1.3.9"
package/src/index.ts CHANGED
@@ -55,6 +55,7 @@ export {
55
55
  type ExtractSegmentsResult,
56
56
  extractSegments,
57
57
  type SliceWithWidthResult,
58
+ sanitizeText,
58
59
  sliceWithWidth,
59
60
  truncateToWidth,
60
61
  visibleWidth,
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.