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.
- package/SKILL.md +4 -1
- package/dist/otomate.js +4373 -4324
- package/dist/otomate.js.map +1 -1
- package/dist/otomate.umd.cjs +44 -44
- package/dist/otomate.umd.cjs.map +1 -1
- package/guides/html-to-docx-and-back.md +6 -14
- package/package.json +1 -1
|
@@ -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
|
|
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.
|
|
400
|
+
### 10. Running the library in a browser — things that used to break but no longer do
|
|
399
401
|
|
|
400
|
-
|
|
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
|
-
|
|
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
|
|