@turbodocx/html-to-docx 1.21.0 → 1.22.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 +25 -17
- package/dist/html-to-docx.browser.esm.js +17 -0
- package/dist/html-to-docx.browser.js +4 -4
- package/dist/html-to-docx.esm.js +2 -2
- package/dist/html-to-docx.umd.js +2 -2
- package/package.json +25 -6
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
[](https://typescript.org)
|
|
9
9
|
[](https://discord.gg/NYKwz4BcpX)
|
|
10
10
|
[](https://www.npmjs.com/package/@turbodocx/html-to-docx)
|
|
11
|
-
[](https://agentskills.io)
|
|
12
|
+
[](https://github.com/TurboDocx/quickstart)
|
|
13
13
|
[](https://twitter.com/TurboDocx)
|
|
14
14
|
[](https://www.turbodocx.com/use-cases/embedded-api?utm_source=github&utm_medium=repo&utm_campaign=open_source)
|
|
15
15
|
|
|
@@ -44,27 +44,22 @@ Based on the original work and assisted by the original contributors of [private
|
|
|
44
44
|
|
|
45
45
|
🛠️ **Developer Experience** - Full TypeScript support, comprehensive documentation, and extensive examples to get you up and running in minutes.
|
|
46
46
|
|
|
47
|
-
##
|
|
47
|
+
## ⚡ Skip the boilerplate — let an agent scaffold it for you
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Have an AI coding agent (Claude Code, Cursor, Copilot, Codex, Gemini CLI, OpenCode) install `@turbodocx/html-to-docx`, generate a helper module, and write a working framework-appropriate route handler in one step:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
npx skills add TurboDocx/quickstart
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Then
|
|
55
|
+
Then run `/turbodocx-html-to-docx` inside your agent. The skill will:
|
|
56
56
|
|
|
57
|
-
```
|
|
58
|
-
/turbodocx-html-to-docx
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
The skill will:
|
|
62
57
|
1. Install `@turbodocx/html-to-docx` and any required peer dependencies
|
|
63
58
|
2. Detect your project structure (Express, Next.js, Fastify, NestJS, plain Node.js, etc.)
|
|
64
59
|
3. Generate a helper module and a framework-appropriate route/handler that returns a `.docx` response
|
|
65
|
-
4. Add example usage
|
|
60
|
+
4. Add example usage matching your existing code patterns
|
|
66
61
|
|
|
67
|
-
Source
|
|
62
|
+
Source: [github.com/TurboDocx/quickstart](https://github.com/TurboDocx/quickstart).
|
|
68
63
|
|
|
69
64
|
## Installation
|
|
70
65
|
|
|
@@ -205,13 +200,25 @@ The library provides a standalone browser build that bundles all dependencies in
|
|
|
205
200
|
|
|
206
201
|
### Build Outputs
|
|
207
202
|
|
|
208
|
-
When you run `npm run build`,
|
|
203
|
+
When you run `npm run build`, four distribution files are generated:
|
|
209
204
|
|
|
210
205
|
| File | Format | Size | Dependencies | Use Case |
|
|
211
206
|
|------|--------|------|--------------|----------|
|
|
212
|
-
| `dist/html-to-docx.esm.js` | ES Module | ~1.6 MB | External |
|
|
213
|
-
| `dist/html-to-docx.umd.js` | UMD | ~1.6 MB | External | Node.js
|
|
214
|
-
| `dist/html-to-docx.browser.js` |
|
|
207
|
+
| `dist/html-to-docx.esm.js` | ES Module | ~1.6 MB | External | Node.js ESM, server-side bundling |
|
|
208
|
+
| `dist/html-to-docx.umd.js` | UMD | ~1.6 MB | External | Node.js `require`, AMD |
|
|
209
|
+
| `dist/html-to-docx.browser.esm.js` | ES Module | ~1.6 MB | **All bundled** | Browser bundlers (Next.js, Vite, webpack) |
|
|
210
|
+
| `dist/html-to-docx.browser.js` | IIFE | ~1.6 MB | **All bundled** | Direct browser usage via `<script>`, CDN |
|
|
211
|
+
|
|
212
|
+
The package `exports` map points each environment at the right file
|
|
213
|
+
automatically, so consumers don't choose manually:
|
|
214
|
+
|
|
215
|
+
- **Browser bundlers** (Next.js/Turbopack, Vite, webpack) resolve the `browser`
|
|
216
|
+
condition to `html-to-docx.browser.esm.js` — a self-contained ESM build with
|
|
217
|
+
Node polyfills bundled in. `import HTMLtoDOCX from "@turbodocx/html-to-docx"`
|
|
218
|
+
works with **no extra configuration**. See
|
|
219
|
+
[`example/nextjs-example`](example/nextjs-example) for a complete app.
|
|
220
|
+
- **Node.js** resolves `import` → `esm.js` and `require` → `umd.js`.
|
|
221
|
+
- **`<script>` tags / CDNs** use `html-to-docx.browser.js` (IIFE) directly by URL.
|
|
215
222
|
|
|
216
223
|
### Build Commands
|
|
217
224
|
|
|
@@ -347,7 +354,8 @@ You can also host the browser build on a CDN for easy inclusion:
|
|
|
347
354
|
await HTMLtoDOCX(htmlString, headerHTMLString, documentOptions, footerHTMLString)
|
|
348
355
|
```
|
|
349
356
|
|
|
350
|
-
|
|
357
|
+
Full examples can be found under `example/`, including a complete
|
|
358
|
+
[Next.js app](example/nextjs-example) that generates a `.docx` in the browser.
|
|
351
359
|
|
|
352
360
|
### Parameters
|
|
353
361
|
|