@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 CHANGED
@@ -8,8 +8,8 @@
8
8
  [![Type Script](https://shields.io/badge/TypeScript-3178C6?logo=TypeScript&logoColor=FFF&style=flat-square)](https://typescript.org)
9
9
  [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord)](https://discord.gg/NYKwz4BcpX)
10
10
  [![npm](https://img.shields.io/npm/dm/@turbodocx/html-to-docx)](https://www.npmjs.com/package/@turbodocx/html-to-docx)
11
- [![Agent Skill](https://img.shields.io/badge/agent_skill-agentskills.io-7C3AED)](https://agentskills.io)
12
- [![skills.sh](https://skills.sh/b/TurboDocx/quickstart)](https://skills.sh/TurboDocx/quickstart)
11
+ [![Agent Skills](https://img.shields.io/badge/Agent%20Skills-agentskills.io-8A2BE2)](https://agentskills.io)
12
+ [![Quickstart Skill](https://skills.sh/b/TurboDocx/quickstart)](https://github.com/TurboDocx/quickstart)
13
13
  [![X](https://img.shields.io/badge/X-@TurboDocx-1DA1F2?logo=x&logoColor=white)](https://twitter.com/TurboDocx)
14
14
  [![Embed TurboDocx in Your App in Minutes](https://img.shields.io/badge/Embed%20TurboDocx%20in%20Your%20App%20in%20Minutes-8A2BE2)](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
- ## Install via AI Agent Skill
47
+ ## Skip the boilerplate — let an agent scaffold it for you
48
48
 
49
- Skip the boilerplate. If you use Claude Code, GitHub Copilot, Cursor, OpenCode, OpenAI Codex CLI, or Gemini CLI, you can install the `turbodocx-html-to-docx` [Agent Skill](https://agentskills.io) and have your AI agent install the package, detect your framework, and generate working integration code in one step:
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 in your editor, invoke the skill:
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 that matches your existing code patterns
60
+ 4. Add example usage matching your existing code patterns
66
61
 
67
- Source for the skill lives at [TurboDocx/quickstart](https://github.com/TurboDocx/quickstart).
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`, three distribution files are generated:
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 | Modern bundlers (Webpack, Vite, Rollup) |
213
- | `dist/html-to-docx.umd.js` | UMD | ~1.6 MB | External | Node.js, AMD, or manual dependency management |
214
- | `dist/html-to-docx.browser.js` | IIFE | ~2.4 MB | **All bundled** | Direct browser usage, CDN, quick prototypes |
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
- full fledged examples can be found under `example/`
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