> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate to 0.1.0

`@reductoai/docx` 0.1.0 has one layout engine: a native addon in Node, `engine.wasm` in the browser. The TypeScript layout engine of 0.0.x is removed. A document also opens only after the license check passes.

This page lists the changes to make when you move from 0.0.x to 0.1.0 or later. The other pages describe 0.1.0 only.

## Requirements

* Node.js 20.11 or newer.
* `REDUCTO_API_KEY` on each server, from the organization that made your install token.
* A [license proxy](https://docs.reducto.ai/office/licensing/setup.md#3-in-a-browser-add-the-license-proxy) for each browser editor.

## Licensing

| 0.0.x | 0.1.0 |
| - | - |
| Without `REDUCTO_API_KEY`, the package worked and its usage did not show in Reducto | No document opens: `ReductoLicenseError` (`unconfigured`). Set the key. See [Setup](https://docs.reducto.ai/office/licensing/setup.md) |
| A browser editor without a license proxy worked and showed a console warning | It opens no document. Add the proxy, then set `proxyUrl` or call `useProxy` |

If your code reads `error.code`, check it against the list in [Troubleshooting](https://docs.reducto.ai/office/licensing/troubleshooting.md). 0.1.0 adds codes, such as `unconfigured`, `unproxied` and `undelivered`.

## Removed and changed APIs

| 0.0.x | 0.1.0 |
| - | - |
| `layoutDocument(model, measurer, opts)` | `WordDocument.toLayout()`, `runPipeline(path)` (Node) or `layoutDocxInBrowser(bytes)` (browser) |
| `useLayoutEngine` (`@reductoai/docx/node`) | Remove it. Node uses the engine addon, or `engine.wasm` when no addon loads |
| `ParseMemo` (`@reductoai/docx/editor`), `memo` option of `layoutDocxInBrowser` | Remove them. The engine keeps its own memory |
| `parseDocxFile(path)` | `parseDocx(readFileSync(path))` |
| `readOMath` | Removed. Extracted blocks carry equations as LaTeX |
| `metafileScale` in `runPipeline`, `convertDocxToPdf`, `extractDocx` | Remove it. The engine sets the EMF and WMF raster budget |
| `metafile` and `parseFaceIds` in `layoutDocxInBrowser`, `browserLayoutHost`, `createBrowserEditorHost` | Remove them. The engine draws EMF and WMF pictures and loads its own faces |
| `installBrowserMetafileBackend`, `serveMetafileRaster`, `carlitoMetafileFonts` and their option types (`@reductoai/docx/browser`) | Removed. Delete the rasterizer worker and its `@resvg/resvg-wasm` setup |
| `DOCX_LAYOUT` | No effect. `DOCX_ENGINE_NAPI` names the addon |

## Editor

These changes are in the `@reductoai/docx-editor` release that pairs with `@reductoai/docx` 0.1.0.

| 0.0.x | 0.1.0 |
| - | - |
| The engine URL option of `mountDocxEditor`, `<DocxEditor>` and the worker's `configure` message | Its name is `wasmUrl`. Set it only when your bundler does not copy `engine.wasm`. See [Layout engine](https://docs.reducto.ai/office/docx/ui/editor.md#layout-engine) |
| When the engine did not load, the editor laid out in TypeScript | The editor shows `no layout engine` and opens no document |
| `metafile` option of `createDefaultHost`, and a worker of your own that rasterized EMF and WMF pictures | Remove them. The stock worker draws those pictures |

## Browser

A page that Vite, webpack or Next.js bundles needs no change. With another bundler, give the engine's URL with `setLayoutEngine(url)` or the `engine` option, or layout throws `no layout engine`. See [The layout engine](https://docs.reducto.ai/office/docx/js-api/browser.md#the-layout-engine).

## `IncrementalLayout`

`IncrementalLayout` (from `@reductoai/docx/editor`, passed as `incremental`) does not hold layout memory: the engine keeps it.

* `balances` and `hfMemo` are removed. Remove code that reads or clears them.
* `begin()` and `forPass()` throw `TsEngineAbsent`. `editReach()`, `probeReach()` and `keptModel()` return `undefined`. Remove the calls.
* The fields that a layout records for its caller stay: `stats`, `lastDirtyPages`, `lastPageCount`, `lastRestamped`, `lastStaleAfter`, `budgetPages`, `throughPage`, `lastPages`, `settling`, `noteOrdinals` and `provisionalFrom`, with `commit()`, `abandon()` and `reset()`.

To use it, create an `IncrementalLayout`, pass it as `incremental`, and call `reset()` to drop it.

## Types

These types are opaque in the type declarations. Pass them on; do not read their fields:

* `DocModel` (from `parseDocx`)
* `WordPackage`, `WmlPackage`, `ParseMemo`, `FontMeasurer`

`DocxSession` and `IncrementalLayout` keep only their documented members.
