Skip to content

Commit 52c215c

Browse files
chore(release): v2.0.0
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 775de46 commit 52c215c

8 files changed

+77
-109
lines changed

.changeset/healthy-mugs-dress.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/nice-needles-guess.md

Lines changed: 0 additions & 71 deletions
This file was deleted.

.changeset/plenty-files-thank.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/pre.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

.changeset/stupid-rules-travel.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/wise-planes-reply.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,81 @@
11
# zxing-wasm
22

3+
## 2.0.0
4+
5+
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.
6+
7+
### Breaking Changes
8+
9+
#### Consolidated Reader Function
10+
11+
`readBarcodes(...)` replaces both `readBarcodesFromImageFile(...)` and `readBarcodesFromImageData(...)`. The new function can accept either a `Blob` or an `ImageData` as its input.
12+
13+
> [!NOTE]
14+
>
15+
> The v1 reader functions `readBarcodesFromImageFile` and `readBarcodesFromImageData` are still kept for a smooth migration experience, but marked as deprecated.
16+
17+
#### Updated Reader Options
18+
19+
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:
20+
21+
1. `tryCode39ExtendedMode` is now `true` by default. It was previously `false`.
22+
2. `eanAddOnSymbol` is now `"Ignore"` by default. It was previously `"Read"`.
23+
3. `textMode` is now `"HRI"` by default. It was previously `"Plain"`.
24+
25+
Some deprecated options have been removed, see [zxing-cpp#704](https://github.com/zxing-cpp/zxing-cpp/discussions/704) for more details:
26+
27+
1. `validateCode39CheckSum` is now removed. The Code39 symbol has a valid checksum if the third character of the `symbologyIdentifier` is an odd digit.
28+
2. `validateITFCheckSum` is now removed. The ITF symbol has a valid checksum if the third character of the `symbologyIdentifier` is a `'1'`.
29+
3. `returnCodabarStartEnd` is now removed. The detected results of Codabar symbols now always include the start and end characters.
30+
31+
#### `eccLevel` in Read Result Renamed to `ecLevel`
32+
33+
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.
34+
35+
> [!NOTE]
36+
>
37+
> The `eccLevel` field is still kept for a smooth migration experience, but marked as deprecated.
38+
39+
#### Renamed & Enhanced Writer Function
40+
41+
`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.
42+
43+
The `WriterOptions` object has also been updated completely.
44+
45+
> [!NOTE]
46+
>
47+
> The final shape of the `writeBarcode` function is still in review. The current implementation is subject to change.
48+
49+
#### `.wasm` Module Initialization / Caching Overhaul
50+
51+
`prepareZXingModule(...)` replaces both `setZXingModuleOverrides(...)` and `getZXingModuleOverrides(...)`. The new function provides a more flexible way to initialize the ZXing module with custom options.
52+
53+
> [!NOTE]
54+
>
55+
> The v1 module initialization functions `setZXingModuleOverrides` and `getZXingModuleOverrides` are still kept for a smooth migration experience, but marked as deprecated.
56+
57+
`purgeZXingModule` now only clears the relevant module cache from where it is imported. It no longer resets the global module cache.
58+
59+
#### Redefined `BarcodeFormat`-Family Types
60+
61+
`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.
62+
63+
### New Features & Enhancements
64+
65+
#### More Barcode Formats Supported in Writer
66+
67+
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.
68+
69+
#### New `tryDenoise` Option for Reading Barcodes
70+
71+
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`.
72+
73+
### Bug Fixes
74+
75+
#### Fix TS `moduleResolution: node` Subpath Exports Resolution
76+
77+
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).
78+
379
## 2.0.0-beta.4
480

581
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "zxing-wasm",
33
"description": "ZXing-C++ WebAssembly as an ES/CJS module with types",
44
"private": false,
5-
"version": "2.0.0-beta.4",
5+
"version": "2.0.0",
66
"type": "module",
77
"files": [
88
"./dist"

0 commit comments

Comments
 (0)