Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(developer,common): deps: replace xml2js with fast-xml-parser #12502

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

srl295
Copy link
Member

@srl295 srl295 commented Oct 3, 2024

  • remove vendored xml2js
  • add [email protected]
  • Rewire the KeymanXMLReader / KeymanXMLWriter to use fast-xml-parser

Four small changes to the test data on the generated .kvks:

  • allow " for XML generation (" is legal)
  • use the same XML prologue as the actual .kvks files.
  • treat <key></key> as <key/> since we can't distinguish (removed a "_": "" entry)
  • remove whitespace because we now can ("_": "\n \n \n") on non-leaf nodes. This is ignored by the kvks code, but was difficult to maintain roundtrip.

Fixes: #12208
Supersedes: #12331 (due to the approach in #12482)

@keymanapp-test-bot skip

- remove vendored xml2js
- add [email protected]
- Rewire the KeymanXMLReader / KeymanXMLWriter to use fast-xml-parser

Four small changes to the test data on the generated .kvks:
- allow &quot; for XML generation (" is legal)
- use the same XML prologue as the actual .kvks files.
- treat <key></key> as <key/> since we can't distinguish
  (removed a "_": "" entry)
- remove whitespace because we now can ("_": "\n  \n \n") on non-leaf nodes.
  This is ignored by the kvks code, but was difficult to maintain roundtrip.

Fixes: #12208
@srl295 srl295 self-assigned this Oct 3, 2024
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Oct 3, 2024

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

@github-actions github-actions bot added common/ and removed common/ labels Oct 3, 2024
@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S12 milestone Oct 3, 2024
- because of the form to="" in ldml, we need to distinguish attributes and sub-elements in the ldml xml parsing
- use an attributePrefix, and fixup the object tree afterwards

Fixes: #12208
@github-actions github-actions bot added common/ and removed common/ labels Oct 3, 2024
@srl295 srl295 marked this pull request as ready for review October 3, 2024 18:23
@github-actions github-actions bot added common/ and removed common/ labels Oct 3, 2024
@mcdurdin mcdurdin changed the title chore(developer,common): deps: xml2js / fast-xml-parser chore(developer,common): deps: replace xml2js with fast-xml-parser Oct 7, 2024
Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

developer/src/common/web/utils/src/xml-utils.ts Outdated Show resolved Hide resolved
@github-actions github-actions bot added common/ and removed common/ labels Oct 7, 2024
@srl295 srl295 merged commit a0813b8 into master Oct 7, 2024
6 checks passed
@srl295 srl295 deleted the feat/common/12208-fast-xml-parser3 branch October 7, 2024 22:21
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.123-alpha

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

Successfully merging this pull request may close these issues.

refactor(common): Consider moving from xml2js to fast-xml-parser
3 participants