-
Notifications
You must be signed in to change notification settings - Fork 10
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
Version Packages #193
Version Packages #193
Conversation
WalkthroughThis pull request represents a major version 2.0.0 release of the Changes
Sequence DiagramsequenceDiagram
participant User
participant ZXingModule
participant BarcodeReader
participant BarcodeWriter
User->>ZXingModule: prepareZXingModule(...)
ZXingModule-->>User: Module initialized
User->>BarcodeReader: readBarcodes(input)
BarcodeReader-->>User: ReadResult with ecLevel
User->>BarcodeWriter: writeBarcode(options)
BarcodeWriter-->>User: Generated barcode
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
CHANGELOG.md (3)
51-51
: Consider clarifying the implementation statusThe phrase "under discussion" could be more specific. Consider rewording to clarify the current status and potential changes, e.g., "The API design of the
writeBarcode
function is being finalized."- > The final shape of the `writeBarcode` function is still under discussion. The current implementation is subject to change. + > The API design of the `writeBarcode` function is being finalized. The current implementation is subject to change.🧰 Tools
🪛 LanguageTool
[style] ~51-~51: ‘under discussion’ might be wordy. Consider a shorter alternative.
Context: ...of thewriteBarcode
function is still under discussion. The current implementation is subject ...(EN_WORDINESS_PREMIUM_UNDER_DISCUSSION)
69-71
: Consider adding more details about the denoising algorithmWhile the experimental status is clearly marked, it would be helpful to provide more information about:
- The type of noise this algorithm addresses
- Expected performance impact
- Use cases where it might be beneficial
75-78
: Consider consistent list formattingFor better readability, consider using consistent bullet points throughout:
- 615a321: - Add `DXFilmEdge` writing support. - - Fix subpath exports TS compatibility with types-versions-wildcards strategy. Check [this](https://github.com/andrewbranch/example-subpath-exports-ts-compat/tree/main/examples/node_modules/types-versions-wildcards) for more information. - - Add types to `.wasm` subpath exports. - - Add `ImageData` ambient type export. + 615a321: + - Add `DXFilmEdge` writing support + - Fix subpath exports TS compatibility with types-versions-wildcards strategy. Check [this](https://github.com/andrewbranch/example-subpath-exports-ts-compat/tree/main/examples/node_modules/types-versions-wildcards) for more information + - Add types to `.wasm` subpath exports + - Add `ImageData` ambient type export
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.changeset/healthy-mugs-dress.md
(0 hunks).changeset/nice-needles-guess.md
(0 hunks).changeset/plenty-files-thank.md
(0 hunks).changeset/pre.json
(0 hunks).changeset/stupid-rules-travel.md
(0 hunks).changeset/wise-planes-reply.md
(0 hunks)CHANGELOG.md
(1 hunks)package.json
(1 hunks)
💤 Files with no reviewable changes (6)
- .changeset/wise-planes-reply.md
- .changeset/healthy-mugs-dress.md
- .changeset/plenty-files-thank.md
- .changeset/pre.json
- .changeset/stupid-rules-travel.md
- .changeset/nice-needles-guess.md
✅ Files skipped from review due to trivial changes (1)
- package.json
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md
[style] ~51-~51: ‘under discussion’ might be wordy. Consider a shorter alternative.
Context: ...of the writeBarcode
function is still under discussion. The current implementation is subject ...
(EN_WORDINESS_PREMIUM_UNDER_DISCUSSION)
🔇 Additional comments (2)
CHANGELOG.md (2)
3-10
: Well-structured version announcement!The introduction clearly communicates the scope and impact of this major release, with proper references to external dependencies.
Line range hint
86-392
: Well-maintained version history!The beta releases and previous versions are properly documented with consistent formatting and clear traceability to changes.
🧰 Tools
🪛 LanguageTool
[style] ~51-~51: ‘under discussion’ might be wordy. Consider a shorter alternative.
Context: ...of thewriteBarcode
function is still under discussion. The current implementation is subject ...(EN_WORDINESS_PREMIUM_UNDER_DISCUSSION)
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
CHANGELOG.md (3)
41-41
: Fix grammar and improve concisenessThere are two minor issues in the text:
- Line 41: Remove the duplicate determiner "the" in "...in addition to the an image file blob"
- Line 47: Consider replacing "under discussion" with "in review" or "pending finalization" for better conciseness
-...in addition to the an image file blob. +...in addition to an image file blob. -The final shape of the `writeBarcode` function is still under discussion. +The final shape of the `writeBarcode` function is still in review.Also applies to: 47-47
🧰 Tools
🪛 LanguageTool
[grammar] ~41-~41: Two determiners in a row. Choose either “the” or “an”.
Context: ...ormats (e.g. SVG, UTF-8) in addition to the an image file blob. TheWriterOptions
o...(DT_DT)
7-62
: Consider enhancing migration documentationThe breaking changes are well documented, but developers would benefit from a dedicated migration guide with code examples showing how to transition from v1 to v2. This is particularly important for:
- Transitioning from separate read functions to the unified
readBarcodes
- Updating code that relies on the changed default values
- Migrating from the old module initialization to
prepareZXingModule
Would you like me to help create a migration guide with code examples that demonstrates these transitions?
🧰 Tools
🪛 LanguageTool
[grammar] ~41-~41: Two determiners in a row. Choose either “the” or “an”.
Context: ...ormats (e.g. SVG, UTF-8) in addition to the an image file blob. TheWriterOptions
o...(DT_DT)
[style] ~47-~47: ‘under discussion’ might be wordy. Consider a shorter alternative.
Context: ...of thewriteBarcode
function is still under discussion. The current implementation is subject ...(EN_WORDINESS_PREMIUM_UNDER_DISCUSSION)
69-71
: Enhance visibility of experimental featuresConsider making the experimental status of the
tryDenoise
option more prominent, perhaps by:
- Adding a warning box similar to the NOTE boxes used elsewhere
- Including information about potential impacts on performance or accuracy
- Adding examples of scenarios where denoising might be beneficial
#### New `tryDenoise` Option for Reading Barcodes +> [!WARNING] +> The `tryDenoise` option is experimental and may impact performance or accuracy. + The new `tryDenoise` option in `ReaderOptions` allows you to enable or disable the denoising algorithm when reading barcodes. This is an experimental feature. By default, it is set to `false`.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
CHANGELOG.md
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md
[grammar] ~41-~41: Two determiners in a row. Choose either “the” or “an”.
Context: ...ormats (e.g. SVG, UTF-8) in addition to the an image file blob. The WriterOptions
o...
(DT_DT)
[style] ~47-~47: ‘under discussion’ might be wordy. Consider a shorter alternative.
Context: ...of the writeBarcode
function is still under discussion. The current implementation is subject ...
(EN_WORDINESS_PREMIUM_UNDER_DISCUSSION)
🔇 Additional comments (1)
CHANGELOG.md (1)
73-78
: LGTM! Well-documented bug fixThe TypeScript compatibility fix is well-documented with clear explanations and helpful references to external resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
CHANGELOG.md (4)
7-62
: Enhance breaking changes documentation with migration examplesThe breaking changes section is comprehensive but could be more actionable for users upgrading from v1.x to v2.0.0.
Consider adding:
- A migration guide with code examples showing before/after changes for each breaking change
- Clear deprecation warnings that users will encounter if using old APIs
- A compatibility matrix showing which features are:
- Removed completely
- Deprecated but functional
- New replacements
63-72
: Expand documentation for new featuresThe new features section would benefit from additional details to help users understand and adopt these features effectively.
Consider adding:
- A complete list of newly supported barcode formats
- Technical details about the denoising algorithm:
- How it works
- Performance implications
- Use cases where it's most effective
- Code examples demonstrating these new features
73-78
: Add context for TypeScript compatibility fixThe TypeScript module resolution fix would benefit from additional context to help users understand if they're affected.
Consider adding:
- Symptoms users might have encountered with the old behavior
- Required changes in
tsconfig.json
, if any- Example configurations for different TypeScript environments
1-78
: Enhance changelog structure for better navigationThe changelog is well-documented but could be more user-friendly with some structural improvements.
Consider adding:
- A table of contents at the top with anchor links to each section
- A version comparison table highlighting key differences between v1.x and v2.0.0
- A "Quick Start" section for users wanting to immediately upgrade
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
[email protected]
This release introduces a major refactoring of the underlying Embind APIs and read / write functions. Key changes include a new set of default reader options, enhanced writer capabilities backed by
zint
, and updated APIs for reading and writing barcodes. These changes break backward compatibility, so we are upgrading to the next major version.Breaking Changes
Consolidated Reader Function
readBarcodes(...)
replaces bothreadBarcodesFromImageFile(...)
andreadBarcodesFromImageData(...)
. The new function can accept either aBlob
or anImageData
as its input.Note
The v1 reader functions
readBarcodesFromImageFile
andreadBarcodesFromImageData
are still kept for a smooth migration experience, but marked as deprecated.Updated Reader Options
A few reader options have changed their default values. This change is to align with the latest ZXing C++ library and provide a more consistent experience across different platforms:
tryCode39ExtendedMode
is nowtrue
by default. It was previouslyfalse
.eanAddOnSymbol
is now"Ignore"
by default. It was previously"Read"
.textMode
is now"HRI"
by default. It was previously"Plain"
.Some deprecated options have been removed, see zxing-cpp#704 for more details:
validateCode39CheckSum
is now removed. The Code39 symbol has a valid checksum if the third character of thesymbologyIdentifier
is an odd digit.validateITFCheckSum
is now removed. The ITF symbol has a valid checksum if the third character of thesymbologyIdentifier
is a'1'
.returnCodabarStartEnd
is now removed. The detected results of Codabar symbols now always include the start and end characters.eccLevel
in Read Result Renamed toecLevel
In
ReadResult
, theeccLevel
field has been renamed toecLevel
. It now holds strings like"L"
,"M"
,"Q"
, or"H"
or stringified numeric percentage values for error correction levels. An empty string indicates that the error correction level is not applicable.Note
The
eccLevel
field is still kept for a smooth migration experience, but marked as deprecated.Renamed & Enhanced Writer Function
writeBarcode(...)
replaceswriteBarcodeToImageFile(...)
. This function is now powered by the newzint
backend which supports all available formats that are currently supported by the reader. It accepts either astring
text or anUint8Array
binary data as its input for barcode generation, and provides new output formats (e.g. SVG, UTF-8) in addition to the an image file blob.The
WriterOptions
object has also been updated completely.Note
The final shape of the
writeBarcode
function is still under discussion. The current implementation is subject to change..wasm
Module Initialization / Caching OverhaulprepareZXingModule(...)
replaces bothsetZXingModuleOverrides(...)
andgetZXingModuleOverrides(...)
. The new function provides a more flexible way to initialize the ZXing module with custom options.Note
The v1 module initialization functions
setZXingModuleOverrides
andgetZXingModuleOverrides
are still kept for a smooth migration experience, but marked as deprecated.purgeZXingModule
now only clears the relevant module cache from where it is imported. It no longer resets the global module cache.Redefined
BarcodeFormat
-Family TypesNone
is removed from theBarcodeFormat
union type. New types likeLinearBarcodeFormat
,MatrixBarcodeFormat
andLooseBarcodeFormat
are introduced. SeebarcodeFormat.ts
for more details.New Features & Enhancements
More Barcode Formats Supported in Writer
The new
writeBarcode
function supports more barcode formats than the previouswriteBarcodeToImageFile
. All barcode formats supported by the reader are now supported by the writer.New
tryDenoise
Option for Reading BarcodesThe new
tryDenoise
option inReaderOptions
allows you to enable or disable the denoising algorithm when reading barcodes. This is an experimental feature. By default, it is set tofalse
.Bug Fixes
Fix TS
moduleResolution: node
Subpath Exports ResolutionThe subpath export types are now compatible with TypeScript's
moduleResolution: node
strategy by using the types-versions-wildcards strategy. This package now passes all thearethetypeswrong
checks.Summary by CodeRabbit
Breaking Changes
readBarcodes()
prepareZXingModule()
eccLevel
toecLevel
New Features
tryDenoise
optionImprovements
zxing_writer.wasm
file