Skip to content

Commit

Permalink
chore(release): v2.0.0
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Sec-ant and github-actions[bot] authored Jan 5, 2025
1 parent 775de46 commit 52c215c
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 109 deletions.
5 changes: 0 additions & 5 deletions .changeset/healthy-mugs-dress.md

This file was deleted.

71 changes: 0 additions & 71 deletions .changeset/nice-needles-guess.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/plenty-files-thank.md

This file was deleted.

14 changes: 0 additions & 14 deletions .changeset/pre.json

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/stupid-rules-travel.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/wise-planes-reply.md

This file was deleted.

76 changes: 76 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,81 @@
# zxing-wasm

## 2.0.0

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`](https://sourceforge.net/projects/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 both `readBarcodesFromImageFile(...)` and `readBarcodesFromImageData(...)`. The new function can accept either a `Blob` or an `ImageData` as its input.

> [!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](https://github.com/zxing-cpp/zxing-cpp/discussions/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 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(...)` replaces `writeBarcodeToImageFile(...)`. This function is now powered by the new [`zint`](https://sourceforge.net/projects/zint/) backend which supports all available formats that are currently supported by the reader. It accepts either a `string` text or an `Uint8Array` binary data as its input for barcode generation, and provides new output formats (e.g. SVG, UTF-8) in addition to an image file blob.

The `WriterOptions` object has also been updated completely.

> [!NOTE]
>
> The final shape of the `writeBarcode` function is still in review. The current implementation is subject to change.
#### `.wasm` 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.

#### Redefined `BarcodeFormat`-Family Types

`None` is removed from the `BarcodeFormat` union type. New types like `LinearBarcodeFormat`, `MatrixBarcodeFormat` and `LooseBarcodeFormat` are introduced. See [`barcodeFormat.ts`](https://github.com/Sec-ant/zxing-wasm/blob/main/src/bindings/barcodeFormat.ts) for more details.

### 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 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. By default, it is set to `false`.

### Bug Fixes

#### Fix TS `moduleResolution: node` Subpath Exports Resolution

The subpath export types are now compatible with TypeScript's `moduleResolution: node` strategy by using the [types-versions-wildcards strategy](https://github.com/andrewbranch/example-subpath-exports-ts-compat/tree/main/examples/node_modules/types-versions-wildcards). This package now passes all the [`arethetypeswrong` checks](https://arethetypeswrong.github.io/?p=zxing-wasm%402.0.0).

## 2.0.0-beta.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "zxing-wasm",
"description": "ZXing-C++ WebAssembly as an ES/CJS module with types",
"private": false,
"version": "2.0.0-beta.4",
"version": "2.0.0",
"type": "module",
"files": [
"./dist"
Expand Down

0 comments on commit 52c215c

Please sign in to comment.