Update XML reader for quick-xml 0.41 and clean code warnings#894
Update XML reader for quick-xml 0.41 and clean code warnings#894Sachin-Bhat wants to merge 12 commits into
Conversation
Update the workspace dependency set and adapt the XML reader for the quick-xml 0.40 API. Handle GeneralRef events, use normalized attribute decoding, rename EventReader::next to next_event, refresh generated TS bindings for ts-rs 12, and update benches for criterion 0.8. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
Box the large Paragraph, Table, and Run enum variants to satisfy clippy::large_enum_variant. Preserve builder-style APIs by boxing internally, and update the wasm table-cell wrapper for the new variant payloads. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
Apply mechanical clippy fixes across document elements and document metadata code. This removes needless borrows, redundant formatting, needless lifetimes, manual ok conversions, single-character push_str calls, and collapsible matches. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
Derive default enum implementations where possible, simplify XML builder and writer formatting, remove needless question-mark/update patterns, and replace checked unwraps in XML JSON name formatting with explicit Option matching. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
- Bump actions/checkout v4 -> v7, actions/setup-node v4 -> v6, actions/cache v4 -> v6 across all jobs - Switch node-version from pinned 20 to 'node' (latest) - Replace manual wasm-pack/target add installs with moonrepo targets/bins inputs and GITHUB_TOKEN env, and use corepack to manage pnpm - Split wasm build into discrete steps for clearer CI logs - Strip trailing whitespace and normalize working-directory indent Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
Updates quick-xml in docx-core and regenerates the lockfile, pulling in transitive upgrades (autocfg, bytemuck, cc, clap, etc.) and removing the now-unused bitflags 1.x entry. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
Tidy {:?} -> {res:?} at docx-wasm/src/doc.rs:216.
Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
Refreshes docx-wasm/js/json/bindings/* from the latest ts-bindgen output to match the updated Rust schemas: nullable fields are now typed as 'T | null' (previously 'T?'), optional fields on the generated interfaces are now explicitly nullable, and a few type aliases (e.g. AlignmentType) were reformatted. No runtime change. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
Expands the regenerated FrameProperty, Pic, and TablePositionProperty TypeScript bindings with JSDoc copied from the OOXML/ECMA-376 schema descriptions for each property, and converts the optional interfaces to nullable 'T | null' types to align with the rest of the bindings. Includes a reference URL on TablePositionProperty for the underlying schema. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
The generated _pageTypeNum payload now explicitly sets start and chapStyle to null when callers pass undefined, matching the nullable shape produced by the JSON bindings and avoiding 'undefined' entries in the serialized object. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
|
Thanks for tackling this @Sachin-Bhat — the quick-xml The only red check is The fix is small — bump TypeScript and add the disposable lib:
I reproduced the failure on this branch and confirmed the change clears it: |
|
Hey @decebal thanks for your feedback! Will make the relevant changes. |
Bump TypeScript to ^5.5.0 and add ESNext.Disposable to the shared, Node, and web compiler configurations. This allows declarations generated by wasm-bindgen 0.2.126 to type-check when they expose Symbol.dispose. Regenerate the pnpm lockfile with TypeScript 5.9.3. The frozen install, Node and web type checks, all 382 Rust tests, and the WASM builds pass. Jest still reports the two existing architecture-specific image snapshot byte differences. Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
|
@decebal @bokuweb made the relevant changes! TS bumped to ^5.5.0 and resolves to 5.9.3 in Verification:
Caveat: Jest retains the two reported image snapshot byte differences: 89/91 tests and 185/187 snapshots pass. Please review/merge when you find some time. Thanks |
…en normalized before snapshotting Signed-off-by: Sachin Bhat <sachubhat17@gmail.com>
|
@bokuweb updated the test to stop snapshotting exact compressed PNG bytes. In the two failing tests earlier, assert that the decoded preview is a valid PNG, then replace image payloads with placeholders before snapshotting. This remains stable across Thanks! |
What does this change?
Updates the workspace for newer dependency and clippy compatibility.
Primary motivation:
quick-xmlversions before0.41have known security advisories affecting downstream consumers, so this PR moves the workspace off the vulnerable range. As a side effect it picks up the API changes between the old version and0.41.quick-xml0.41(from the previously vulnerable0.40and earlier) indocx-core, and regeneratesCargo.lock. This requires the0.40migration below as a stepping stone.GeneralRefevents, normalized attribute decoding, and broader entity-decoding coverage.EventReader::next()toEventReader::next_event()to match the new API.CommentChild,DeleteChild, andTableCellContentto satisfyclippy::large_enum_variant, with matchingdocx-wasmupdates. This is a breaking change for any consumer constructing these enums directly (use the builder APIs instead).ts-rsoutput format (nullableT | nullfields, JSDoc onFrameProperty/Pic/TablePositionProperty,TablePositionPropertyschema link).actions/checkouttov7,actions/setup-nodetov6,actions/cachetov6; switches the Node version tonode; replaces manualwasm-pack/ target installs withmoonrepo/setup-rusttargets/binsinputs pluscorepackfor pnpm.References
quick-xmlsecurity advisories for< 0.41(RUSTSEC) — see the quick-xml changelog / advisory page for affected CVE IDs and fixed-in version.Screenshots
Not applicable. This is a Rust library/workspace change.
What can I check for bug fixes?
Run:
cargo +nightly clippy --workspace --all-targets --all-features --locked -- -D warnings -W clippy::perf cargo +nightly test --workspace --all-features --locked --libExpected result: clippy completes with no warnings, and the workspace lib tests pass. The XML entity regression is covered by
reader::xml_parser::tests::decodes_xml_entities_in_text_and_attributes.Also verify the
quick-xmlversion indocx-core/Cargo.tomlresolves to0.41.xviacargo tree -p docx-core | grep quick-xml.