You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 20, 2026. It is now read-only.
refactor(from-package): build target bytes via documents.js's buildDocumentBytes
The DocumentPackage-to-any-format dispatch (pdf writes the layout
directly, every other format rebuilds through the matching buildXPackage,
xlsx/odf rejected outright) now lives in documents.js's own
buildDocumentBytes rather than a local buildBytesForTarget duplicating
the identical switch.
// Every target this command can build a DocumentPackage into, and how: 'pdf' writes the package's own LayoutDocument half directly (no font registry, no positioned formulas -- neither survives the JSON round trip, since both are side channels a DocumentPackage never carries, so a formula renders as nothing and an embedded font falls back to the standard 14 or a vendored substitute; see the documents.js README's own DocumentPackage gotcha), everything else builds a fresh package from the ContentDocument half through the identical buildXPackage function the matching pdf-to-X/bridge conversion already uses, then encodes it with that format's own codec (ooxml.js's for docx/pptx, odf.js's for odt/odp/ods/odg). 'xlsx' and 'odf' have no builder at all -- documents.js deliberately never re-exports ooxml.js's buildXlsxPackage (see the README's own Architecture note), and a formula document has no write path from ContentDocument to begin with -- so both are rejected outright rather than attempted.
thrownewError("this DocumentPackage has no layout -- only a package dumped from a <format>-to-pdf or pdf-to-<format> conversion carries one; a bridge conversion's own dump (e.g. odt-to-docx) never does, so 'pdf' is not a reachable target from it");
thrownewError("'xlsx' cannot be built from a DocumentPackage directly -- documents.js does not re-export a ContentDocument-to-xlsx builder; convert to 'ods' here, then run 'ods-to-xlsx' on the result instead");
55
-
case'odf':
56
-
thrownewError("'odf' (a standalone formula document) cannot be built from a DocumentPackage -- there is no ContentDocument-to-odf builder");
0 commit comments