Repository navigation
Improve 0.3 document validation, bundled types and developer tooling - #2952
Open
marcelMaier wants to merge 2 commits into
Open
marcelMaier wants to merge 2 commits into
marcelMaier wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Document authoring currently spans loosely connected runtime errors, external type declarations and an outdated standalone playground. This change brings the 0.3 authoring workflow together while retaining the JavaScript runtime and existing Promise-based API.
Changes
@types/pdfmakewith this build.validateDocument(input, options)with accumulated diagnostics, document paths, strict handling of unknown properties, table/span and reference checks, numeric constraints, cycle/accessor checks and bounded traversal. The structural contract is generated from the shipped declarations and checked for drift.createPdf(definition, { validation: true })preflight. Dynamic callback results, resource decoding/access and final layout remain rendering checks; preflight does not mutate input or execute callbacks.Compatibility
The runtime remains CommonJS in Node and UMD in the browser, with Node ESM default imports tested through interop. This does not introduce a second native-ESM runtime. Node remains supported from version 20; development-tool minimums are documented separately. Definitions are still processed during layout, so callers should construct fresh definitions for independent generation.
This branch now tracks upstream 0.3.13 and current master, including the follow-up fix for reversed lists with nested lists. The version change comes from upstream; bundled declarations, preflight and structured diagnostics remain unreleased additions for maintainer review.
Upstream 0.3.13 compatibility
write()reuse alongside the additional premature-close diagnostics.tableAlignment: 'left' | 'center' | 'right'in bundled types and the generated validation contract, with positive and negative regression cases.Validation
Locally verified on Windows:
@types/pdfmake: CommonJS, Node ESM, browser bundling, negative assertions, font/VFS imports and real PDF output.The workflow prepares a Linux/macOS/Windows and Node 20/22/24 matrix; that hosted matrix has not been run locally.
Companion documentation pull request: pdfmake/docs#25