Skip to content

perf(xml): replace fast-xml-parser with @nodable/flexible-xml-parser - #2

Merged
TheYoxy merged 4 commits into
masterfrom
feature/nodable-xml-parser
Sep 14, 2026
Merged

TheYoxy merged 4 commits into
masterfrom
feature/nodable-xml-parser

Conversation

@TheYoxy

@TheYoxy TheYoxy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Replaces the runtime XML parser in peppol-document-schema.ts with @nodable/flexible-xml-parser + @nodable/compact-builder, keeping output parity with the previous fast-xml-parser shape (attribute prefix @, number coercion with hex: false, leadingZeros: false, namespace stripping).

Benchmarks (since removed) showed ~1.6x faster parsing on small invoices and ~2.9x on large (~1MB) ones.

  • New wrapper: src/xml/nodable-parser.ts, also exported from ./xml
  • @nodable/* added to peerDependencies (same pattern as fast-xml)
  • fast-xml-builder stays: no @nodable XML string builder exists
  • fast-xml-parser stays as peer (./xml still exports parserOptions)

Verification: 1901 tests pass, oxlint 0 errors, tsdown build clean.

Known parity notes (outside business data, decoders ignore root attributes):

  • plain @xmlns stripped in wrapper (nodable keeps it, FXP drops it)
  • multiline root @schemaLocation gets XML-spec newline normalization under nodable

Parse PEPPOL documents with @nodable/flexible-xml-parser +
@nodable/compact-builder, matching the previous fast-xml-parser
output shape (attribute prefix, number coercion, ns stripping).

Measured ~1.6x faster on small invoices and ~2.9x on large ones.
fast-xml-builder stays: no @nodable XML string builder exists.
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.1-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Export 25 file-private opaque Schema classes referenced by public
signatures so their types are nameable, re-export XmlNode alongside
parseXmlNodable, and set private-type-leaks off: the rule is opt-in
upstream and 4 remaining cases cannot be exported without silently
dropping identically named schemas from the export-star barrel.
Also drop the stale script-only dependency exemptions for the
@nodable packages now used at runtime.
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.1-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.1-alpha.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@TheYoxy
TheYoxy merged commit 5b7344c into master Sep 14, 2026
4 checks passed
@TheYoxy
TheYoxy deleted the feature/nodable-xml-parser branch September 14, 2026 22:20
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant