@f5-sales-demo/pi-natives 19.51.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/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @f5-sales-demo/pi-natives
2
+
3
+ Native Rust functionality via N-API.
4
+
5
+ ## What's Inside
6
+
7
+ - **Grep**: Regex-based search powered by ripgrep's engine with native file walking and matching
8
+ - **Find**: Glob-based file/directory discovery with gitignore support (pure TypeScript via `globPaths`)
9
+ - **Image**: Image processing via photon-rs (resize, format conversion) exposed through N-API
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { grep, find, PhotonImage, SamplingFilter, ImageFormat } from "@f5-sales-demo/pi-natives";
15
+
16
+ // Grep for a pattern
17
+ const results = await grep({
18
+ pattern: "TODO",
19
+ path: "/path/to/project",
20
+ glob: "*.ts",
21
+ context: 2,
22
+ });
23
+
24
+ // Find files
25
+ const files = await find({
26
+ pattern: "*.rs",
27
+ path: "/path/to/project",
28
+ fileType: "file",
29
+ });
30
+
31
+ // Image processing
32
+ const image = await PhotonImage.parse(bytes);
33
+ const resized = await image.resize(800, 600, SamplingFilter.Lanczos3);
34
+ const pngBytes = await resized.encode(ImageFormat.PNG, 100);
35
+ ```
36
+
37
+ ## Building
38
+
39
+ ```bash
40
+ # Build native addon from workspace root (requires Rust)
41
+ bun run build
42
+
43
+ # Type check
44
+ bun run check
45
+ ```
46
+
47
+ ## Architecture
48
+
49
+ ```
50
+ crates/pi-natives/ # Rust source (workspace member)
51
+ src/lib.rs # N-API exports
52
+ src/image.rs # Image processing (photon-rs)
53
+ Cargo.toml # Rust dependencies
54
+ native/ # Native addon binaries
55
+ pi_natives.<platform>-<arch>-modern.node # x64 modern ISA (AVX2)
56
+ pi_natives.<platform>-<arch>-baseline.node # x64 baseline ISA
57
+ pi_natives.<platform>-<arch>.node # non-x64 build artifact
58
+ src/ # TypeScript wrappers
59
+ native.ts # Native addon loader
60
+ index.ts # Public API
61
+ ```
@@ -0,0 +1,22 @@
1
+
2
+ // AUTOGENERATED FILE -- DO NOT EDIT DIRECTLY
3
+ // See scripts/embed-native.ts
4
+
5
+ /** @typedef {"modern" | "baseline" | "default"} EmbeddedAddonVariant */
6
+
7
+ /**
8
+ * @typedef {Object} EmbeddedAddonFile
9
+ * @property {EmbeddedAddonVariant} variant
10
+ * @property {string} filename
11
+ * @property {string} filePath
12
+ */
13
+
14
+ /**
15
+ * @typedef {Object} EmbeddedAddon
16
+ * @property {string} platformTag
17
+ * @property {string} version
18
+ * @property {EmbeddedAddonFile[]} files
19
+ */
20
+
21
+ /** @type {EmbeddedAddon|null} */
22
+ export const embeddedAddon = null;