Files
onenote-tools/docs/PORTING.md

5.4 KiB

Port provenance

The desktop .one reader adapts selected structures from the pinned onenote.rs implementation. It is not a line-for-line or complete port.

TypeScript module Upstream path(s) Revision Port scope and deviations
src/onenote/onestore/file-node.ts onestore/desktop/file_structure/file_node_list_fragment.rs, file_node/*, chunk references onenote.rs@5138a39a3f4e72b840932f9872fecde52fa9da60 Selected; immutable byte input, strict range checks, fragment/child cycle detection, and depth/count limits
src/onenote/onestore/property-set.ts onestore/shared/{object_prop_set,prop_set,property,object_stream_header}.rs same Substantial; bounded vectors/counts/nesting and serializable discriminated unions
src/onenote/onestore/desktop-store.ts onestore/desktop/{file_node,file_structure,objects}/* same Selected desktop section path; explicit missing-reference errors; file-data/attachment payloads skipped with diagnostics
src/onenote/one/{constants,section}.ts one/property*, one/property_set/*, onenote/{section,page,page_series,outline,rich_text}.rs same Page metadata, titles, and plain text only; bounded graph traversal; visual/embedded content diagnosed

The browser-native package path has separate MIT provenance:

TypeScript module Upstream path(s) Revision and selected licence Port scope and deviations
src/onenote/onepkg/{cabinet,checksum}.ts rust-cab src/{cabinet,folder,file,ctype,checksum}.rs c5839f5fdfa4c4e7cc9b22f570c79c96af0560e2, MIT CAB reading/checksum adapted for immutable browser bytes, strict normalized paths, checked ranges/checksums, whole-folder extraction, explicit limits, and cancellation/yield hooks; writers are not ported
src/onenote/onepkg/mszip/decoder.ts rust-cab src/mszip.rs; fflate raw DEFLATE rust-cab revision above; fflate 0.8.3, MIT CK framing and persistent 32 KiB folder history follow rust-cab; raw DEFLATE uses fflate with a caller-owned bounded buffer and strict declared-size checks
src/onenote/onepkg/quantum/{bit-reader,budget,decoder,model,tables}.ts compcol src/quantum/{bits,decoder,model,tables}.rs 04a6db2aa7bd487a89c559631d79d1b384139f50, MIT Native TypeScript arithmetic/model/LZ decoder; fixed CAB output, 2 MiB maximum window, strict match/frame/trailer checks, two-block lookahead, operation budget, and cancellation checkpoints
src/onenote/onepkg/lzx/{bit-reader,huffman,decoder}.ts lzxd 0.2.5 src/{bitstream,tree,block,window,lib}.rs 4748e43594e3e30cff2ace3a6ad7a376c9816fdd, MIT option of MIT OR Apache-2.0 Directly translated core with typed arrays, CAB CFDATA boundaries, persistent folder state, strict malformed-stream errors, and operation/window/cancellation limits; delta reference data is omitted

The bounded binary readers, format detection, parser limits/error model, path policy, worker protocol/DTOs, package-to-section boundary, and application UI are original TypeScript implementations guided by the normative specifications and project requirements.

Files adapted from onenote.rs carry an MPL-2.0 notice, SPDX identifier, upstream path/revision, and deviations. Files adapted from rust-cab, compcol, or lzxd carry their MIT provenance, copyright notice, exact revision, and deviations. Licence texts are reproduced in LICENSES/ and included in the release ZIP.

Focused tests cover successful pinned fixtures plus malformed bounds, references, checksums, paths, Huffman trees, compressed blocks, limits, and cancellation. Fixture origins and redistribution terms are recorded separately in tests/fixtures/README.md.