feat!: migrate --dump-package and from-package to documents.js 2.0.0's fused package shape - #216
Merged
Merged
Conversation
…s fused package shape
DocumentPackage dropped its separate layout half for formatVersion 2:
content nodes carry their own rendered frames and the package carries the
page sizes those frames index into, so a dump written now holds
{$schema, formatVersion, content, pages} and from-package's pdf target
rebuilds the layout from those recorded positions (layoutDocumentFromPackage)
instead of reading a stored layout tree.
A dump from the documents.js 1.x formatVersion 1 shape still identifies
as a DocumentPackage by its version-agnostic $schema but failed
DocumentPackageSchema.parse with a raw ZodError; from-package now
intercepts that one wrong-version case and names the shape change and
the remedy (re-run the source conversion with --dump-package) instead.
README's --dump-package documentation also drops a stale claim: odf-to-pdf
has populated a package since the formula variant gained a ContentDocument,
its dump carrying the formula content and the one A4 page it renders.
BREAKING CHANGE: from-package no longer reads documents.js 1.x
formatVersion 1 dump files; --dump-package output and the pdf target's
rebuild follow documents.js 2.0.0.
Contributor
|
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
documents.js 2.0.0 replaced the DocumentPackage JSON shape:
{ formatVersion: 1, content, layout }became{ formatVersion: 2, content, pages }with per-nodeframeson content nodes. This migrates the CLI's two DocumentPackage surfaces onto it and bumps the dependency to^2.0.0, superseding the automation's own red bump PR (#215).What changed:
--dump-packageoutput now carries the fused shape — content nodes stamped with their renderedframes, plus thepagesgeometry those frames index into; the separatelayouthalf is gone. The pdf target offrom-packagerebuilds the layout from those recorded positions (documents.js'slayoutDocumentFromPackage→writePdf) instead of writing a stored layout half, so the round trip still closes.DocumentPackageSchema.parsewith a raw ZodError wall. `from-package` now intercepts that wrong-version case and names the shape change and the remedy (`re-run the source conversion with --dump-package`) instead — covered by a new test driving a hand-built 1.x-shape dump through the real command.from-packageand--dump-package), including a correction:odf-to-pdfhas populated a dump since documents.js gained the formulaContentDocumentvariant (its dump carries the formula content and the one A4 page), so the old "every conversion populates one except odf-to-pdf" claim was stale and is now gone. The bridge paragraph's "layoutalwaysundefined" became "pagesalways absent".no pages), and the dump-shape assertions now pinformatVersion2 /pages/frames/ nolayout; a new test exercises the pdf target's rebuild-from-frames path end to end.No Ink TUI surface reads a DocumentPackage — the TUI's
layoutstate isreadPdf's ownLayoutDocument, pdf-codec's unchanged contract — so no TUI change was needed.BREAKING CHANGE:
from-packageno longer reads documents.js 1.x formatVersion 1 dump files;--dump-packageoutput and the pdf target's rebuild follow documents.js 2.0.0.Generated by Claude Code