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

Version Packages (beta) #185

Merged
merged 2 commits into from
Dec 25, 2024
Merged

Version Packages (beta) #185

merged 2 commits into from
Dec 25, 2024

Conversation

Sec-ant
Copy link
Owner

@Sec-ant Sec-ant commented Dec 25, 2024

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.

⚠️⚠️⚠️⚠️⚠️⚠️

main is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on main.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

[email protected]

Major Changes

  • 1a77296: # V2: Breaking Release - Next Major Version

    This release introduces a major refactoring of the underlying Embind APIs and read / write functions. Key changes include transitioning away from Embind Enums toward numeric encoding and decoding, 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

    Renamed & Consolidated Reader Function

    readBarcodes(...) replaces both readBarcodesFromImageFile(...) and readBarcodesFromImageData(...). The new function unifies code paths for Blob and ImageData inputs.

    [!NOTE]

    The v1 reader functions readBarcodesFromImageFile and readBarcodesFromImageData 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:

    1. tryCode39ExtendedMode is now true by default. It was previously false.
    2. eanAddOnSymbol is now "Ignore" by default. It was previously "Read".
    3. textMode is now "HRI" by default. It was previously "Plain".

    Some deprecated options have been removed, see zxing-cpp#704 for more details:

    1. validateCode39CheckSum is now removed. The Code39 symbol has a valid checksum if the third character of the symbologyIdentifier is an odd digit.
    2. validateITFCheckSum is now removed. The ITF symbol has a valid checksum if the third character of the symbologyIdentifier is a '1'.
    3. returnCodabarStartEnd is now removed. The detected results of Codabar symbols now always include the start and end characters.

    eccLevel in Read Result Renamed to ecLevel

    In ReadResult, the eccLevel field has been renamed to ecLevel. It now holds strings like "L", "M", "Q", or "H" or stringified numeric 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(...) replaces writeBarcodeToImageFile(...). The new function is powered by the new zint writer, which supports more barcode formats, supports both string and Uint8Array inputs for generating barcodes from text or binary data, and provides new output formats (e.g. SVG, UTF-8) in addition to the binary image file output.

    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.

    Module Initialization / Caching Overhaul

    prepareZXingModule(...) replaces both setZXingModuleOverrides(...) and getZXingModuleOverrides(...). The new function provides a more flexible way to initialize the ZXing module with custom options.

    [!NOTE]

    The v1 module initialization functions setZXingModuleOverrides and getZXingModuleOverrides 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.

    New Features & Enhancements

    More Barcode Formats Supported in Writer

    The new writeBarcode function supports more barcode formats than the previous writeBarcodeToImageFile. All barcode formats supported by the reader except for DXFilmEdge are now supported by the writer.

    New tryDenoise Option for Reading Barcodes

    The new tryDenoise option in ReaderOptions allows you to enable or disable the denoising algorithm when reading barcodes. This is an experimental feature and by default, it is set to false.

Summary by CodeRabbit

  • New Features

    • Major version release 2.0.0-beta.0 with significant updates to barcode read/write functionalities.
    • Support for additional barcode formats and a new experimental tryDenoise option.
  • Bug Fixes

    • Deprecated functions retained for migration but marked accordingly.
  • Documentation

    • Changelog updated to reflect breaking changes and new functionalities.
  • Chores

    • Package version updated from 1.3.4 to 2.0.0-beta.0.

Copy link

coderabbitai bot commented Dec 25, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces a major version update (2.0.0-beta.0) for the zxing-wasm package, involving significant refactoring of Embind APIs and barcode processing functions. The changes consolidate multiple reader and writer functions, update default options, rename some fields, and modify the module initialization process. The update aims to streamline the library's API while maintaining backward compatibility through deprecated function markers.

Changes

File Change Summary
.changeset/pre.json Added changeset reference "nice-needles-guess"
CHANGELOG.md - Consolidated readBarcodesFromImageFile/ImageData into readBarcodes(...)
- Updated writer function to writeBarcode(...)
- Renamed eccLevel to ecLevel
- Replaced module initialization functions with prepareZXingModule(...)
package.json Updated version from "1.3.4" to "2.0.0-beta.0"

Sequence Diagram

sequenceDiagram
    participant User
    participant ZXingModule
    participant BarcodeReader
    participant BarcodeWriter

    User->>ZXingModule: prepareZXingModule(...)
    User->>BarcodeReader: readBarcodes(input)
    BarcodeReader-->>User: ReadResult
    User->>BarcodeWriter: writeBarcode(...)
    BarcodeWriter-->>User: Encoded Barcode
Loading

Possibly related PRs

  • Version Packages #105: Bumps the zxing-cpp dependency, which aligns with the updates to zxing-wasm package functions

Poem

🐰 Barcodes dancing, APIs refined,
A rabbit's leap through code's design!
From old to new, we hop with glee,
Zxing-wasm, version two-point-oh, you'll see!
Compatibility's our guiding light 🔍


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 47af768 and 51ec3ef.

📒 Files selected for processing (3)
  • .changeset/pre.json (1 hunks)
  • CHANGELOG.md (1 hunks)
  • package.json (1 hunks)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

pkg-pr-new bot commented Dec 25, 2024

Open in Stackblitz

npm i https://pkg.pr.new/zxing-wasm@185

commit: 51ec3ef

@github-actions github-actions bot force-pushed the changeset-release/main branch from 1a799aa to 35f9f75 Compare December 25, 2024 15:14
@Sec-ant Sec-ant merged commit 81a0468 into main Dec 25, 2024
7 checks passed
@Sec-ant Sec-ant deleted the changeset-release/main branch December 25, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant