@@ -10,7 +10,7 @@ Ask for the facts you need. Get structured JSON with confidence, evidence, and m
1010[ ![ License: MIT] ( https://img.shields.io/badge/license-MIT-2f80ed.svg )] ( LICENSE )
1111[ ![ Rust 1.88+] ( https://img.shields.io/badge/rust-1.88%2B-orange.svg )] ( https://www.rust-lang.org/ )
1212
13- [ Install] ( docs/INSTALLATION.md ) · [ Quickstart] ( #quickstart ) · [ Browser SDK ] ( #browser-js-sdk ) · [ Execution modes] ( #execution-modes ) · [ Examples] ( #common-recipes ) · [ Formats] ( #supported-formats ) · [ CLI reference] ( docs/CLI-REFERENCE.md )
13+ [ Install] ( docs/INSTALLATION.md ) · [ Quickstart] ( #quickstart ) · [ npm package ] ( #javascript-package ) · [ Execution modes] ( #execution-modes ) · [ Examples] ( #common-recipes ) · [ Formats] ( #supported-formats ) · [ CLI reference] ( docs/CLI-REFERENCE.md )
1414
1515</div >
1616
@@ -171,19 +171,43 @@ printf '%s\n' \
171171 ' {"path":"deck.pptx"}' | deckprobe --jsonl -t @summary
172172```
173173
174- ## Browser JS SDK
174+ ## JavaScript package
175175
176- The independently published ` @deckflow/deckprobe ` package runs the same
177- target-driven Rust engine in WebAssembly. It accepts browser ` File ` , ` Blob ` ,
178- ` ArrayBuffer ` , and ` Uint8Array ` inputs; document bytes do not leave the
179- browser.
176+ The independently published ` @deckflow/deckprobe ` package ships the ` deckprobe `
177+ command for Node and runs the same target-driven Rust engine in WebAssembly for
178+ browsers and Node APIs.
180179
181- ### Install and choose an import
180+ ### Install from npm
182181
183182``` sh
184183npm install @deckflow/deckprobe
185184```
186185
186+ That installs the ` deckprobe ` command as well. It is the same native binary the
187+ standalone installers ship, delivered through a per-platform optional
188+ dependency, so every flag, help page, report, and exit code is identical:
189+
190+ ``` sh
191+ npx @deckflow/deckprobe --help
192+ npx @deckflow/deckprobe -t slide_count deck.pptx
193+ ```
194+
195+ Under Node the package also exposes ` probeFile() ` , which reads a file and
196+ returns the same report the CLI writes for it. Note that it holds the whole
197+ file in memory, while the CLI reads only the paths a probe needs — prefer the
198+ command, or ` --jsonl ` for batches, on large inputs.
199+
200+ ``` ts
201+ import { probeFile } from " @deckflow/deckprobe" ;
202+
203+ const report = await probeFile (" deck.pptx" , { targets: [" @summary" ] });
204+ ```
205+
206+ ### Browser SDK
207+
208+ In the browser it accepts ` File ` , ` Blob ` , ` ArrayBuffer ` , and ` Uint8Array `
209+ inputs; document bytes do not leave the browser.
210+
187211| Need | Import | Use it when |
188212| ---| ---| ---|
189213| Main-thread probe and discovery | ` @deckflow/deckprobe ` | A small, interaction-adjacent probe can use the UI thread. |
@@ -246,6 +270,27 @@ verify that the application's bundler preserves module-worker URLs. Calling
246270the main entry point for discovery and integration tooling. See the
247271[ package guide] ( packages/deckprobe-js/README.md ) for the complete API.
248272
273+ ### Bundler setup
274+
275+ The package resolves its WebAssembly binary relative to its own JavaScript
276+ wrapper, so a bundler that relocates the wrapper without the binary breaks
277+ initialization. ** Vite's dev server does this in every version** and reports
278+ either ` HTTP status code is not ok ` or ` expected magic word 00 61 73 6d ` ,
279+ while ` vite build ` works — exclude the package from dependency
280+ pre-bundling:
281+
282+ ``` ts
283+ // vite.config.ts
284+ export default defineConfig ({
285+ optimizeDeps: { exclude: [" @deckflow/deckprobe" ] },
286+ });
287+ ```
288+
289+ Main-thread-only applications can instead pass the binary URL to
290+ ` initDeckProbe() ` via the ` @deckflow/deckprobe/wasm ` export. See the package
291+ guide's [ bundler notes] ( packages/deckprobe-js/README.md#bundlers ) for both
292+ fixes, the per-version error messages, and the CDN, sub-path, and CSP cases.
293+
249294## Execution modes
250295
251296DeckProbe deliberately exposes different execution modes instead of treating
0 commit comments