otomate 0.3.0 → 0.3.1

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.
@@ -6,7 +6,9 @@ round-trip is lossless. Every step here is backed by a real test at
6
6
  `packages/otomate/src/__tests__/e2e-tracked-changes.test.ts` — if you copy the
7
7
  snippets verbatim they will run.
8
8
 
9
- > **Prerequisites.** Node ≥ 20, `otomate` installed. All `writeDocx` /
9
+ > **Prerequisites.** Node ≥ 20 **or any modern browser** (Deno, Bun, workers,
10
+ > edge runtimes also work — the library uses the Web Crypto API internally
11
+ > and has no Node-specific imports). `otomate` installed. All `writeDocx` /
10
12
  > `readDocx` / `writeDiffDocx` calls are **async** — always `await` them.
11
13
  > `readHtml` / `writeHtml` / `renderDiffHtml` / `diff` are synchronous.
12
14
 
@@ -395,21 +397,11 @@ const buf = readFileSync("input.docx"); // Buffer (subclass of Uint8Array)
395
397
  const tree = await readDocx(buf);
396
398
  ```
397
399
 
398
- ### 10. Tests pass via `tsx` but `tsc --noEmit` fails with `Cannot find name 'Buffer'` or `Cannot find module 'node:crypto'`
400
+ ### 10. Running the library in a browser things that used to break but no longer do
399
401
 
400
- **Symptom.** Running the package's test suite works fine (because it uses `tsx`), but running `tsc --noEmit` over a file that imports from `@otomate/docx` complains about missing Node globals.
402
+ As of `@otomate/docx@0.3.1` / `otomate@0.3.1`, the library has **zero Node-only imports**. Snapshot hashing goes through `globalThis.crypto.subtle.digest` (Web Crypto API) and the base64 fallback in the ZIP reader uses `globalThis.btoa`. Both are available in Node ≥ 20 and every modern browser. If you're on an older version and see `createHash is not a function` or `Buffer is not defined` at load time or runtime, upgrade to ≥ 0.3.1.
401
403
 
402
- **Cause.** The `@otomate/docx` package uses `node:crypto` and `Buffer` for the snapshot hash and base64 fallback. These types come from `@types/node`, which `tsc` only loads if your `tsconfig.json` includes `"types": ["node"]` in `compilerOptions`, or your code does a triple-slash reference. `tsx` loads Node types automatically so this doesn't bite you at runtime.
403
-
404
- **Fix.** In your consuming project's `tsconfig.json`:
405
-
406
- ```json
407
- {
408
- "compilerOptions": {
409
- "types": ["node"]
410
- }
411
- }
412
- ```
404
+ If you're still seeing a `tsc --noEmit` complaint about `Cannot find name 'Buffer'` or `Cannot find module 'node:crypto'` in your own downstream code (not from inside the library), that's a tsconfig issue in your project add `@types/node` to your devDeps if you actually use Node globals, or remove stale references if you don't.
413
405
 
414
406
  And install `@types/node` as a devDep.
415
407
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomate",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Universal document diffing library — structure-aware, string-level, multi-format",
5
5
  "type": "module",
6
6
  "main": "./dist/otomate.umd.cjs",