Skip to content

0.2.0

Choose a tag to compare

@plutext plutext released this 23 Sep 21:37
· 21 commits to main since this release

New API, no breaking change, and two docx4j regenerations closing three silent losses. A minor version because the API grew: ^0.1.x will not pick this up.

The package bundles with no bundler configuration (CR-005). The mappings now load from a registry of literal imports (MODULES) rather than a computed import(), which Vite could not resolve without dynamicImportVarsOptions and esbuild expanded to a glob over every .mjs in modules/ — siblings included, a 3.5MB esbuild bundle against 2.0MB now. New: MODULES, modulesFor(root) for a root's module closure, a modules option on getContext for a smaller context, and the ContextOptions type. MODULE_NAMES is unchanged but now derives from the registry. One obstacle remains and is the runtime's: bundled for Node, @docx4j/jsonix loses the @xmldom/xmldom it injects through its UMD wrapper, so a Node bundle needs globalThis.DOMParser and globalThis.XMLSerializer set (jsonix-CR-005; browsers are unaffected).

Three losses closed, each found by round-tripping parts Office wrote:

  • A vmlDrawing part — the legacy drawing behind a comment, form control or OLE picture — could never be unmarshalled: its root is <xml> in no namespace, and the schema declared it in an invented one (docx4j CR-026).
  • A graphic the model does not bind (a slicer, a timeline) was fatal rather than DOM, as was an unknown child of a vmlDrawing root; both wildcards are now lax (docx4j CR-024 §10).
  • mc:Ignorable lost a prefix the table cannot produce because its namespace is written as the default — Excel's mc:Ignorable="x xr10" on slicer, slicer cache and timeline parts (CR-006, new export IGNORABLE_PREFIX_ALIASES).

Also: a re-marshalled settings.xml keeps Word's order for w14:docId and w15:chartTrackingRefBased.

A round-trip fidelity test (CR-004 phase A): 18 parts Office 365 wrote, unmarshalled, marshalled and compared canonically, with two also checked with their mc:Choice taken. Run against 0.1.5 it reports all five losses that release carried. One known difference remains, an xr2:uid docx4j has logged for xlsx4j.

Note for anyone on ^0.1.x: do not use 0.1.5, which cannot load a pptx or xlsx with an equation in a text body; 0.1.6 or this release.