-
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
breaking: v2 #182
breaking: v2 #182
Conversation
🦋 Changeset detectedLatest commit: 69721a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Warning Rate limit exceeded@Sec-ant has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 31 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (265)
📒 Files selected for processing (35)
WalkthroughThis pull request introduces comprehensive changes to the ZXing WASM library, focusing on refactoring the codebase, improving type safety, and streamlining the API. The modifications span across multiple files, including configuration, workflow, and source code. Key changes include the introduction of a new configuration file for project management, updates to submodule handling in workflows, and significant refactoring of barcode reading and writing functions, including the removal of ZXing-specific enum conversions in favor of more direct indexing methods. Changes
Sequence DiagramsequenceDiagram
participant User
participant ZXingModule
participant ModuleFactory
participant BarcodeProcessor
User->>ZXingModule: prepareZXingModule(options)
ZXingModule->>ModuleFactory: prepareZXingModuleWithFactory
ModuleFactory-->>ZXingModule: Module Instance
User->>BarcodeProcessor: readBarcodes(input)
BarcodeProcessor->>ZXingModule: Process Barcode
BarcodeProcessor-->>User: Barcode Results
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
|
commit: |
fb50c1f
to
78239e9
Compare
402e8fc
to
ca2bdca
Compare
ca2bdca
to
5c790e8
Compare
5c790e8
to
eac3648
Compare
7c99368
to
a52b2e6
Compare
a52b2e6
to
b233fe1
Compare
d23f8e1
to
4f813a8
Compare
@coderabbitai generate docstrings |
✅ Actions performedDocstrings generation started. |
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: 2
🔭 Outside diff range comments (1)
README.md (1)
Line range hint
84-96
: Add SRI hash for IIFE scripts.For better security when loading scripts from CDN, consider adding Subresource Integrity (SRI) hashes.
<!-- full --> -<script src="https://cdn.jsdelivr.net/npm/zxing-wasm@<version>/dist/iife/full/index.js"></script> +<script + src="https://cdn.jsdelivr.net/npm/zxing-wasm@<version>/dist/iife/full/index.js" + integrity_no="sha384-[hash]" + crossorigin="anonymous" +></script>
🧹 Nitpick comments (3)
README.md (3)
15-26
: Consider adding version requirements for prerequisites.While the build instructions clearly list the prerequisites (pnpm, CMake, Emscripten), it would be helpful to specify minimum version requirements for each tool to ensure compatibility.
# Install pnpm before executing the next command: # https://pnpm.io/installation +# Minimum version required: X.X.X pnpm i --frozen-lockfile # Install CMake before executing the next command: # https://cmake.org/download/ +# Minimum version required: X.X.X pnpm cmake # Install Emscripten before executing the next command: # https://emscripten.org/docs/getting_started/downloads.html +# Minimum version required: X.X.X pnpm build:wasm
Line range hint
107-140
: Add error handling examples.While the examples demonstrate successful usage, it would be beneficial to show how to handle potential errors, such as invalid images or unsupported formats.
const imageFile = await fetch( "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Hello%20world!", ).then((resp) => resp.blob()); -const imageFileReadResults = await readBarcodes(imageFile, readerOptions); +try { + const imageFileReadResults = await readBarcodes(imageFile, readerOptions); + console.log(imageFileReadResults[0].text); // Hello world! +} catch (error) { + console.error('Failed to read barcode:', error); + // Handle specific error types + if (error instanceof TypeError) { + console.error('Invalid image format'); + } +}
379-401
: Add performance-related FAQ entries.Consider adding FAQ entries about:
- Performance implications of different instantiation strategies
- Memory usage considerations
- Best practices for handling large volumes of barcode operations
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
README.md
(4 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[uncategorized] ~326-~326: Loose punctuation mark.
Context: ...@latest/dist/): - zxing_full.wasm
: ```text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~332-~332: Loose punctuation mark.
Context: ...ll.wasm - **`zxing_reader.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~338-~338: Loose punctuation mark.
Context: ...er.wasm - **`zxing_writer.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
🔇 Additional comments (1)
README.md (1)
414-421
: LGTM!
The license section clearly lists all components and their respective licenses with appropriate links.
Docstrings generation was requested by @Sec-ant. * #182 (comment) The following files were modified: * `src/bindings/barcodeFormat.ts` * `src/bindings/binarizer.ts` * `src/bindings/characterSet.ts` * `src/bindings/contentType.ts` * `src/bindings/eanAddOnSymbol.ts` * `src/bindings/readResult.ts` * `src/bindings/readerOptions.ts` * `src/bindings/textMode.ts` * `src/bindings/writeResult.ts` * `src/bindings/writerOptions.ts` * `src/core.ts` * `src/cpp/ZXingWasm.cpp` * `src/full/index.ts` * `src/reader/index.ts` * `src/writer/index.ts`
Note We have generated docstrings for this pull request, at #184 |
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
♻️ Duplicate comments (4)
src/bindings/contentType.ts (2)
18-20
:⚠️ Potential issueAdd validation for non-existent content types
The function should validate the content type exists in the array to prevent returning -1 for invalid inputs.
export function encodeContentType(contentType: ContentType): number { - return contentTypes.indexOf(contentType); + const index = contentTypes.indexOf(contentType); + if (index === -1) { + throw new Error(`Invalid content type: ${contentType}`); + } + return index; }
28-30
:⚠️ Potential issueAdd bounds checking to prevent runtime errors
The function should validate the input number to prevent accessing invalid array indices.
export function decodeContentType(number: number): ContentType { + if (!Number.isInteger(number) || number < 0 || number >= contentTypes.length) { + throw new Error(`Invalid content type index: ${number}`); + } return contentTypes[number]; }src/bindings/eanAddOnSymbol.ts (2)
11-13
:⚠️ Potential issueAdd validation for non-existent EAN add-on symbols
The function should validate the symbol exists in the array to prevent returning -1 for invalid inputs.
export function encodeEanAddOnSymbol(eanAddOnSymbol: EanAddOnSymbol): number { - return eanAddOnSymbols.indexOf(eanAddOnSymbol); + const index = eanAddOnSymbols.indexOf(eanAddOnSymbol); + if (index === -1) { + throw new Error(`Invalid EAN add-on symbol: ${eanAddOnSymbol}`); + } + return index; }
21-23
:⚠️ Potential issueAdd bounds checking to prevent runtime errors
The function should validate the input number to prevent accessing invalid array indices.
export function decodeEanAddOnSymbol(number: number): EanAddOnSymbol { + if (!Number.isInteger(number) || number < 0 || number >= eanAddOnSymbols.length) { + throw new Error(`Invalid EAN add-on symbol index: ${number}`); + } return eanAddOnSymbols[number]; }
🧹 Nitpick comments (2)
src/bindings/eanAddOnSymbol.ts (1)
1-23
: Consider creating a reusable utility for enum-like array conversionsThe encode/decode pattern is repeated across multiple files (contentType.ts, eanAddOnSymbol.ts). Consider extracting this pattern into a reusable utility to reduce code duplication and ensure consistent validation.
Example implementation:
type TypedArray<T> = readonly T[] & { __brand: T }; function createEnumConverter<T extends string>(values: readonly T[]) { return { encode(value: T): number { const index = values.indexOf(value); if (index === -1) { throw new Error(`Invalid value: ${value}`); } return index; }, decode(index: number): T { if (!Number.isInteger(index) || index < 0 || index >= values.length) { throw new Error(`Invalid index: ${index}`); } return values[index]; } }; } // Usage: const { encode, decode } = createEnumConverter(eanAddOnSymbols);src/bindings/barcodeFormat.ts (1)
86-111
: LGTM! Efficient bitwise format encoding.The implementation efficiently handles format encoding using bitwise operations. Consider adding bounds checking for the format index.
Add bounds checking to prevent potential issues:
default: { + const index = barcodeFormats.indexOf(format); + if (index === -1) { + throw new Error(`Invalid format: ${format}`); + } - return 1 << barcodeFormats.indexOf(format); + return 1 << index; }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
src/bindings/barcodeFormat.ts
(2 hunks)src/bindings/binarizer.ts
(1 hunks)src/bindings/characterSet.ts
(1 hunks)src/bindings/contentType.ts
(1 hunks)src/bindings/eanAddOnSymbol.ts
(1 hunks)src/bindings/readResult.ts
(7 hunks)src/bindings/readerOptions.ts
(9 hunks)src/bindings/textMode.ts
(1 hunks)src/bindings/writeResult.ts
(2 hunks)src/bindings/writerOptions.ts
(1 hunks)src/core.ts
(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
- src/bindings/binarizer.ts
- src/bindings/textMode.ts
- src/bindings/readResult.ts
- src/bindings/writeResult.ts
- src/bindings/characterSet.ts
- src/core.ts
- src/bindings/readerOptions.ts
🔇 Additional comments (8)
src/bindings/writerOptions.ts (4)
72-84
: LGTM! Type-safe interface extension.
The WriterOptions
interface correctly extends ZXingWriterOptions
while making properties optional and handling the format property separately. The documentation clearly lists all supported formats.
88-97
: LGTM! Default values match documentation.
The defaultWriterOptions
object correctly implements all properties with their documented default values.
99-111
: LGTM! Simplified conversion function.
The function has been streamlined to focus solely on format encoding, improving maintainability.
Let's verify the usage of this function across the codebase:
✅ Verification successful
Function changes are safe and properly used
The verification shows that writerOptionsToZXingWriterOptions
is only used in two places:
- Exported in
src/core.ts
- Called in
src/core.ts
with the new signature (single parameter)
All usages are consistent with the new simplified signature, and there are no remaining calls with the old two-parameter format.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining calls with the old signature (with zxingModule parameter)
rg "writerOptionsToZXingWriterOptions.*?,.*?\)" --type ts
Length of output: 59
Script:
#!/bin/bash
# Let's search for all usages of writerOptionsToZXingWriterOptions function
rg "writerOptionsToZXingWriterOptions" --type ts -A 2
Length of output: 535
1-65
: LGTM! Well-documented interface changes.
The restructured ZXingWriterOptions
interface is thoroughly documented with clear default values and type constraints. The breaking changes align with the PR objectives.
Let's verify that all properties are properly documented:
✅ Verification successful
All properties are properly documented with default values
The verification confirms that all 9 properties in the ZXingWriterOptions
interface (format
, readerInit
, forceSquareDataMatrix
, ecLevel
, scale
, sizeHint
, rotate
, withHRT
, withQuietZones
) have corresponding @defaultValue
tags in their documentation. The documentation is complete and accurate.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that all properties in ZXingWriterOptions have @defaultValue tags
rg -U --multiline '^ \w+:.*?(?:\n(?! \w+:).*?)*@defaultValue' src/bindings/writerOptions.ts
Length of output: 357
Script:
#!/bin/bash
# Let's try a simpler approach to verify property documentation
# First, get all property declarations
rg "^\s+\w+:" src/bindings/writerOptions.ts
# Then, get all @defaultValue tags to compare
rg "@defaultValue" src/bindings/writerOptions.ts
Length of output: 781
src/bindings/barcodeFormat.ts (4)
1-50
: LGTM! Excellent type-safe format categorization.
The new metadata-rich format definition with tuple types provides a robust foundation for format categorization. The separation of linear and matrix formats using TypeScript's type system is elegant and maintainable.
60-84
: LGTM! Well-structured type hierarchy.
The type definitions provide clear categorization while maintaining type safety. The breaking changes in type definitions align with the PR objectives.
132-165
: LGTM! Well-implemented format conversion utilities.
The encode/decode implementations efficiently handle multiple formats using bitwise operations. The documentation clearly explains the approach and implementation details.
114-129
:
Add validation for multiple set bits.
The current implementation assumes only one bit is set in the input number. This could lead to incorrect results if multiple bits are set.
Add validation to handle multiple bits:
export function decodeFormat(number: number): ReadOutputBarcodeFormat {
if (number === 0) {
return "None";
}
+ // Check if more than one bit is set
+ if ((number & (number - 1)) !== 0) {
+ throw new Error("Invalid format: multiple bits set");
+ }
const index = 31 - Math.clz32(number);
return barcodeFormats[index];
}
Likely invalid or redundant comment.
711f6af
to
a14e42a
Compare
@CodeRabbit complete the changeset file. |
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: 5
🔭 Outside diff range comments (1)
src/bindings/readResult.ts (1)
Line range hint
20-44
: Breaking changes in ZXingReadResult interfaceThe interface has undergone significant changes:
format
property type changed from string to numbereccLevel
renamed toecLevel
contentType
type changed from ZXingEnum to numberThese changes will require updates in any code directly accessing these properties.
♻️ Duplicate comments (5)
src/bindings/binarizer.ts (2)
16-18
:⚠️ Potential issueAdd input validation to prevent runtime errors.
The
encodeBinarizer
function should validate the input to handle invalid binarizers gracefully.Apply this diff to add validation:
export function encodeBinarizer(binarizer: Binarizer): number { - return binarizers.indexOf(binarizer); + const index = binarizers.indexOf(binarizer); + if (index === -1) { + throw new Error(`Invalid binarizer: ${binarizer}`); + } + return index; }
26-28
:⚠️ Potential issueAdd bounds checking to prevent array access errors.
The
decodeBinarizer
function should validate the input number to prevent accessing invalid array indices.Apply this diff to add validation:
export function decodeBinarizer(number: number): Binarizer { + if (number < 0 || number >= binarizers.length) { + throw new Error(`Invalid binarizer index: ${number}`); + } return binarizers[number]; }main.ts (2)
8-10
:⚠️ Potential issueAdd error handling for the fetch operation.
The fetch operation should handle network errors and invalid responses gracefully.
Apply this diff to add error handling:
const imageFile = await fetch( "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Hello%20world!", -).then((resp) => resp.blob()); +).then((resp) => { + if (!resp.ok) { + throw new Error(`HTTP error! status: ${resp.status}`); + } + return resp.blob(); +}).catch((error) => { + console.error('Failed to fetch QR code:', error); + throw error; +});
22-27
:⚠️ Potential issueFix invalid writer options configuration.
The writer options have two issues:
- Scale of 0 is invalid and would result in an invisible barcode
- The input "12345" is too short for EAN-13 which requires 12 or 13 digits
Apply this diff to fix the issues:
const writerOptions: WriterOptions = { format: "EAN-13", - scale: 0, + scale: 2, withQuietZones: true, withHRT: false, }; -console.log(await writeBarcode("12345", writerOptions)); +console.log(await writeBarcode("123456789012", writerOptions));src/bindings/characterSet.ts (1)
73-74
:⚠️ Potential issueAdd bounds checking to decodeCharacterSet
The function should validate the input number to prevent array out-of-bounds access.
export function decodeCharacterSet(number: number): CharacterSet { + if (number < 0 || number >= characterSets.length) { + throw new Error(`Invalid character set index: ${number}`); + } return characterSets[number]; }
🧹 Nitpick comments (10)
src/bindings/exposedReaderBindings.ts (1)
11-15
: LGTM! Consider adding JSDoc comments for new exports.The new granular types for barcode formats improve type safety and API clarity. Consider adding JSDoc comments to document the purpose and usage of these new exports, especially since this is preparing for a major version change.
src/writer/index.ts (1)
20-34
: Consider adding migration guide for breaking changesThe introduction of
prepareZXingModule
with multiple overloads represents a significant API change. While the deprecated methods are properly marked, users would benefit from a migration guide in the documentation.Consider adding a section in the README or documentation that:
- Explains the benefits of the new module preparation pattern
- Provides examples of migrating from old to new APIs
- Details the differences in behavior between
fireImmediately
optionssrc/bindings/writerOptions.ts (1)
6-65
: Document migration path for removed propertiesThe
ZXingWriterOptions
interface has undergone significant changes:
- Removed: width, height, characterSet, eccLevel, margin
- Added: several new properties with specific behaviors
While the new properties are well-documented, we should provide guidance for users migrating from removed properties.
Consider adding:
- Migration notes for each removed property
- Examples of achieving equivalent functionality with new properties
- Explanation of why these breaking changes were necessary
src/reader/index.ts (2)
81-98
: Consider removing deprecated functions in next major versionThe deprecated
readBarcodesFromImageFile
andreadBarcodesFromImageData
functions are now just wrappers aroundreadBarcodes
. Since this is preparing for a major version:
- Consider removing these functions entirely in the next major version
- Update the deprecation notices to indicate removal in next version
- Ensure the migration guide covers these removals
1-108
: Consider creating a comprehensive migration guideThe changes across these files represent a significant API overhaul that improves consistency and capabilities. However, users will need guidance to migrate:
- Module Preparation:
- Moving from
getZXingModule
toprepareZXingModule
- Understanding
fireImmediately
options- Options Changes:
- Handling removed properties
- Using new format encoding
- Function Consolidation:
- Migrating to unified read/write functions
- Handling new input types
Consider creating a dedicated MIGRATION.md file that:
- Lists all breaking changes
- Provides before/after examples
- Explains the benefits of the new architecture
- Details any performance or behavior changes
src/bindings/readerOptions.ts (1)
40-46
: Document experimental feature limitations and performance impact.The new
tryDenoise
option introduces a morphological closing filter for 2D symbologies. Since this is marked as experimental:
- Consider documenting the performance overhead
- Specify which 2D symbologies are supported
- Add examples showing before/after results
src/cpp/ZXingWasm.cpp (1)
133-136
: Improve error handling granularity.The catch blocks could provide more specific error information by:
- Catching specific exceptions before the generic catch
- Including the exception type in the error message
} catch (const std::exception &e) { - return {{.error = e.what()}}; + return {{.error = std::string(typeid(e).name()) + ": " + e.what()}}; } catch (...) { return {{.error = "Unknown error"}}; }src/core.ts (1)
104-109
: Consider adding cache size limits.The WeakMap cache could grow unbounded if many factory instances are created. Consider:
- Adding a maximum cache size
- Implementing an LRU eviction policy
README.md (2)
223-235
: Consider adding error handling for WASM instantiation.The example should demonstrate proper error handling for file reading and WASM instantiation failures.
const wasmFileBuffer = readFileSync("/path/to/the/zxing_reader.wasm"); prepareZXingModule({ overrides: { instantiateWasm(imports, successCallback) { + try { WebAssembly.instantiate(wasmFileBuffer, imports).then(({ instance }) => successCallback(instance), - ); + ).catch(error => { + console.error("Failed to instantiate WASM:", error); + throw error; + }); + } catch (error) { + console.error("Failed to prepare WASM module:", error); + throw error; + } return {}; }, }, });
402-413
: Consider adding a practical example for Node.js.While the interface definition is helpful, a concrete example of creating a compatible ImageData object in Node.js would make it more actionable.
Add an example like:
// Example: Creating ImageData in Node.js import { createCanvas } from 'canvas'; const canvas = createCanvas(width, height); const ctx = canvas.getContext('2d'); const imageData = ctx.getImageData(0, 0, width, height); const result = await readBarcodes(imageData);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (265)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
tests/__snapshots__/aztec-1/#128/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/slow-180.json
is excluded by!tests/__snapshots__/**
📒 Files selected for processing (35)
.changeset/nice-needles-guess.md
(1 hunks).changeset/pre.json
(1 hunks).coderabbit.yaml
(1 hunks).github/workflows/preview-release.yml
(1 hunks).github/workflows/release.yml
(1 hunks).github/workflows/test.yml
(1 hunks)README.md
(4 hunks)biome.json
(1 hunks)main.ts
(1 hunks)package.json
(1 hunks)src/bindings/barcodeFormat.ts
(2 hunks)src/bindings/binarizer.ts
(1 hunks)src/bindings/characterSet.ts
(1 hunks)src/bindings/contentType.ts
(1 hunks)src/bindings/eanAddOnSymbol.ts
(1 hunks)src/bindings/ecLevel.ts
(1 hunks)src/bindings/eccLevel.ts
(0 hunks)src/bindings/enum.ts
(0 hunks)src/bindings/exposedReaderBindings.ts
(1 hunks)src/bindings/exposedWriterBindings.ts
(1 hunks)src/bindings/index.ts
(1 hunks)src/bindings/readResult.ts
(7 hunks)src/bindings/readerOptions.ts
(9 hunks)src/bindings/textMode.ts
(1 hunks)src/bindings/writeResult.ts
(2 hunks)src/bindings/writerOptions.ts
(1 hunks)src/core.ts
(5 hunks)src/cpp/.clang-format
(1 hunks)src/cpp/CMakeLists.txt
(3 hunks)src/cpp/ZXingWasm.cpp
(5 hunks)src/full/index.ts
(1 hunks)src/global.d.ts
(1 hunks)src/imageData.d.ts
(1 hunks)src/reader/index.ts
(1 hunks)src/writer/index.ts
(1 hunks)
💤 Files with no reviewable changes (2)
- src/bindings/enum.ts
- src/bindings/eccLevel.ts
✅ Files skipped from review due to trivial changes (1)
- .changeset/pre.json
🚧 Files skipped from review as they are similar to previous changes (16)
- .github/workflows/test.yml
- src/cpp/.clang-format
- .github/workflows/release.yml
- .github/workflows/preview-release.yml
- src/global.d.ts
- src/bindings/index.ts
- src/bindings/ecLevel.ts
- src/imageData.d.ts
- .coderabbit.yaml
- src/bindings/contentType.ts
- package.json
- src/bindings/writeResult.ts
- src/bindings/textMode.ts
- src/bindings/eanAddOnSymbol.ts
- src/cpp/CMakeLists.txt
- src/bindings/exposedWriterBindings.ts
🧰 Additional context used
🪛 LanguageTool
README.md
[uncategorized] ~326-~326: Loose punctuation mark.
Context: ...@latest/dist/): - zxing_full.wasm
: ```text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~332-~332: Loose punctuation mark.
Context: ...ll.wasm - **`zxing_reader.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~338-~338: Loose punctuation mark.
Context: ...er.wasm - **`zxing_writer.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
🔇 Additional comments (20)
biome.json (2)
44-53
: LGTM! Reasonable exception for test files.
Disabling the noDelete rule for test files is a common and acceptable practice for cleanup in test suites.
30-42
: Verify the impact of disabling noConfusingVoidType.
The rule disablement for core and index files should be verified to ensure it doesn't mask potential type safety issues.
Let's check the usage of void types in these files:
✅ Verification successful
Disabling noConfusingVoidType rule is appropriate for these files
The usage of void
in these files is legitimate and follows TypeScript best practices:
- Used in function return types for initialization functions (
prepareZXingModule
) - Used in union types with
Promise<T>
for async/sync function overloads - Used in documentation to describe return type behavior
The rule disablement doesn't mask any type safety issues as the void types are used appropriately in API definitions and module initialization patterns.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for void type usage in the specified files
ast-grep --pattern 'void' core.ts full/index.ts reader/index.ts writer/index.ts
Length of output: 321
Script:
#!/bin/bash
# First, let's find the actual paths of these files
fd -t f "core\.ts$|index\.ts$" --full-path
# Then search for void type usage in TypeScript files
ast-grep --pattern '(type_annotation (type_identifier) @id (#eq? @id "void"))'
Length of output: 217
Script:
#!/bin/bash
# Let's check the content of these specific files for any void-related patterns
rg -U "void" "src/core.ts" "src/full/index.ts" "src/reader/index.ts" "src/writer/index.ts" -A 2 -B 2
# Also search for Promise<void> patterns which are common valid use cases
rg -U "Promise<void>" "src/core.ts" "src/full/index.ts" "src/reader/index.ts" "src/writer/index.ts" -A 2 -B 2
Length of output: 2652
src/bindings/characterSet.ts (1)
58-64
: LGTM! Well-handled deprecation with backward compatibility.
The encodeCharacterSet function properly handles the deprecated 'UnicodeBig' value while maintaining backward compatibility. The JSDoc comments clearly document the behavior.
src/writer/index.ts (1)
81-85
: Verify input type expansion impact
The writeBarcode
function now accepts both string
and Uint8Array
inputs. This is a good enhancement for flexibility, but we should ensure all edge cases are handled.
✅ Verification successful
Input type handling is properly implemented
The implementation in src/core.ts
shows proper handling of both input types:
- String inputs are processed using
writeBarcodeFromText
Uint8Array
inputs are handled by allocating appropriate memory, copying the bytes, and usingwriteBarcodeFromBytes
- Memory management is properly handled with
_malloc
for byte arrays
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if there are any existing input validations or type checks
rg -A 5 "writeBarcodeWithFactory.*(?:string|Uint8Array)"
Length of output: 58
Script:
#!/bin/bash
# Let's search for the writeBarcodeWithFactory implementation
ast-grep --pattern 'function writeBarcodeWithFactory($$$)'
# Also search for any type validations or checks on the input parameter
rg "(?:typeof|instanceof).*(?:input|Uint)" -A 3
Length of output: 309
Script:
#!/bin/bash
# Let's look at the complete implementation to understand how Uint8Array is handled
rg -B 5 -A 10 "typeof input === \"string\""
# Also check if there are any tests covering both input types
rg "writeBarcode.*(?:string|Uint)" test/
Length of output: 846
src/bindings/writerOptions.ts (1)
77-80
: Update documentation for new barcode formats
The supported barcode formats have been expanded to include new types like DataBar, MaxiCode, etc. This is a good enhancement, but we should ensure compatibility.
✅ Verification successful
Based on the search results, I can now provide a final response. The evidence shows that:
-
The new barcode formats (DataBar, MaxiCode, etc.) are properly implemented and tested:
- DataBar formats have test coverage in test snapshots
- The formats are properly defined in
barcodeFormatsWithMeta
array - CHANGELOG.md shows improvements to DataBar detection rate and addition of DataBarLimited support
- The formats are properly categorized as either Linear ("L") or Matrix ("M") barcodes
-
The format handling is robust:
- Type definitions ensure format safety
- Format validation is handled through proper encoding/decoding
- Test files show proper format verification
The new barcode formats are properly implemented and compatible
The codebase shows comprehensive implementation with proper type definitions, test coverage, and format handling for all the new barcode formats. The changes are well-documented in the changelog and supported by extensive test cases.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if all new formats are properly implemented
ast-grep --pattern 'case "$_": {
$$$
return $_
}'
Length of output: 55
Script:
#!/bin/bash
# Let's search for barcode format handling in the codebase
rg -i "databar|maxicode|rmqr|codabar" -A 5 -B 5
# Also search for any enum or type definitions related to barcode formats
ast-grep --pattern 'type $_Format = $$$'
ast-grep --pattern 'enum $_Format {
$$$
}'
# Look for switch statements or format handling
ast-grep --pattern 'switch ($format) {
$$$
}'
Length of output: 86463
Script:
#!/bin/bash
# Let's check the changelog for implementation details and test coverage
rg -i "databar|maxicode|rmqr|codabar" CHANGELOG.md
# Look for any format-related type definitions or enums
rg -i "format.*=|enum.*format" -A 5 -B 5
# Check for any format validation or handling code
rg -i "format.*validation|validateformat|checkformat" -A 5 -B 5
Length of output: 9480
src/reader/index.ts (1)
74-78
: Ensure consistent error handling between reader and writer
The new readBarcodes
function consolidates input handling for both Blob and ImageData. This aligns well with the writer module's changes, but we should ensure consistent error handling.
✅ Verification successful
Error handling is consistent between reader and writer modules
Looking at the codebase, both reader and writer modules have consistent error handling:
- The C++ implementation in
ZXingWasm.cpp
shows consistent try-catch blocks that properly capture and return errors for both reading and writing operations. - The writer module returns errors through the
WriteResult
interface with anerror
field that follows the same pattern as the reader'sReadResult.error
. - Both modules handle errors at the native level and propagate them through the same mechanism in the TypeScript layer.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Compare error handling between reader and writer
rg -A 5 "(?:read|write).*(?:Blob|ImageData).*catch"
Length of output: 53
Script:
#!/bin/bash
# Let's first check the error handling in readBarcodesWithFactory
ast-grep --pattern 'function readBarcodesWithFactory($$$) {
$$$
try {
$$$
} catch {
$$$
}
$$$
}'
# Also check the writer's error handling
ast-grep --pattern 'function write($$$) {
$$$
try {
$$$
} catch {
$$$
}
$$$
}'
# Let's also see if there are any throw statements in these modules
rg "throw\s+new" src/
Length of output: 239
Script:
#!/bin/bash
# Let's check the implementation of readBarcodesWithFactory
rg -A 10 "readBarcodesWithFactory" src/
# And check the writer's implementation
rg -A 10 "writeBarcode" src/
# Also check for any error-related code
rg -A 3 "(Error|error)" src/
Length of output: 14519
src/full/index.ts (4)
34-73
: LGTM! Clear deprecation notices with migration examples
The deprecation notices are well-documented with clear migration paths and code examples.
75-99
: LGTM! Consolidated barcode reading API
The consolidation of barcode reading functions into a single readBarcodes
function improves API consistency. The deprecation notices provide clear migration paths.
14-32
: LGTM! Verify impact of new module preparation API
The new prepareZXingModule
function with its overloads provides a cleaner and more type-safe API. The implementation correctly uses the factory pattern.
Let's check for existing usages that might be affected by this breaking change:
✅ Verification successful
Breaking changes detected in module preparation API
The new prepareZXingModule
function is being used internally by both legacy functions getZXingModule
and setZXingModuleOverrides
across multiple files:
src/reader/index.ts
src/writer/index.ts
src/full/index.ts
Since these legacy functions are still maintained and properly use the new API internally, there's no immediate breaking change impact on external consumers. The changes are well-encapsulated within the internal implementation.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for direct module preparation calls that need to be migrated
rg -l "getZXingModule|setZXingModuleOverrides" --type ts
Length of output: 116
Script:
#!/bin/bash
# Check the actual usage of these functions in the identified files
rg "getZXingModule|setZXingModuleOverrides" --type ts -C 3
Length of output: 1916
102-106
: LGTM! Verify impact of renamed write function
The renamed and enhanced writeBarcode
function now supports both string and Uint8Array inputs.
Let's check for existing usages that need to be updated:
✅ Verification successful
Function rename appears safe to proceed
The search results show that writeBarcode
is consistently used across the codebase in its new form, and there are no lingering references to the old writeBarcodeToImageFile
name. The function is:
- Defined in
src/full/index.ts
andsrc/writer/index.ts
- Used in
main.ts
- No instances of the old name were found
The rename appears to have been applied consistently throughout the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for existing writeBarcodeToImageFile calls
rg "writeBarcodeToImageFile" --type ts
Length of output: 38
Script:
#!/bin/bash
# Let's try a broader search for any references to the function name
# First, let's check git history for the function name change
git log -p --all | grep -A 5 -B 5 "writeBarcodeToImageFile"
# Also search for any current usage of writeBarcode
rg "writeBarcode\(" --type ts -A 2 -B 2
Length of output: 526
src/bindings/readResult.ts (2)
Line range hint 109-136
: LGTM! Clean deprecation of eccLevel property
The interface changes provide a clear migration path from eccLevel
to ecLevel
.
139-152
: LGTM! Clean conversion implementation
The zxingReadResultToReadResult
function correctly implements the new type conversions using the decode functions.
src/bindings/barcodeFormat.ts (3)
1-50
: LGTM! Well-structured format definitions with metadata
The new format structure with metadata provides clear categorization and type safety for linear and matrix formats.
86-111
: LGTM! Efficient format encoding implementation
The encode functions use efficient bitwise operations and are well-documented.
114-165
: LGTM! Efficient format decoding with robust error handling
The decode functions use efficient bit manipulation techniques and handle edge cases well. The use of Math.clz32
for finding the highest set bit is particularly clever.
Let's verify the format encoding/decoding implementation:
✅ Verification successful
Implementation verified and correctly used throughout the codebase
The format encoding/decoding implementation is well-designed and properly integrated:
- The
barcodeFormatsWithMeta
array defines all supported formats with their types (Linear/Matrix) - Format encoding/decoding functions are used consistently in reader/writer options and results
- The bit manipulation is safe with proper bounds checking and edge case handling
- The implementation correctly handles special formats like "Linear-Codes", "Matrix-Codes", and "Any"
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for existing format conversion code that might need updates
rg "formatFromString|formatsToString" --type ts
Length of output: 49
Script:
#!/bin/bash
# Let's search for any usage of these format conversion functions
rg "decodeFormat|encodeFormat|decodeFormats|encodeFormats" --type ts -A 2
# Also check for any test files related to barcode formats
fd ".*format.*\.(test|spec)\.ts$"
Length of output: 3062
Script:
#!/bin/bash
# Let's verify the format encoding/decoding implementation by checking the barcode format definitions
ast-grep --pattern 'const barcodeFormats = [
$$$
]'
# Also check for any test files in the bindings directory
fd "\.(test|spec)\.ts$" src/bindings/
Length of output: 95
Script:
#!/bin/bash
# Let's check the entire barcodeFormat.ts file to understand the complete implementation
cat src/bindings/barcodeFormat.ts
# Also check for any direct usages of these functions in the codebase
rg -B 2 "decodeFormat\(|encodeFormat\(|decodeFormats\(|encodeFormats\(" --type ts
Length of output: 7367
src/core.ts (1)
171-241
: Ensure thread-safe module preparation.
The module preparation logic needs to handle race conditions when multiple calls occur simultaneously.
README.md (4)
48-52
: LGTM! Clear TypeScript configuration guidance.
The added note about TypeScript's moduleResolution
settings is valuable for preventing common integration issues.
213-215
: LGTM! Clear introduction to non-web runtime integration.
The section effectively sets expectations about runtime differences and adaptation requirements.
367-368
: LGTM! Clear explanation of equality checking behavior.
The documentation effectively explains the caching behavior and provides guidance for customization.
414-421
: LGTM! Clear and complete license attribution.
The license section properly credits all code sources and their respective licenses.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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 (5)
.changeset/nice-needles-guess.md (3)
5-7
: Consider adding migration guide link.The introduction effectively explains the rationale for breaking changes. Consider adding a link to a detailed migration guide to help users transition from v1 to v2.
33-33
: Fix grammar in Codabar description.Consider rewording for better clarity:
-The Codabar symbol always includes the start and end characters now. +Codabar symbols now always include the start and end characters.🧰 Tools
🪛 LanguageTool
[grammar] ~33-~33: Possible subject-verb agreement error.
Context: ...ar symbol always includes the start and end characters now. ###eccLevel
in Read...(IS_AND_ARE)
69-71
: Enhance documentation for experimental denoising feature.Consider adding:
- Technical details about the denoising algorithm
- Performance implications
- Use cases where denoising might be beneficial
- Examples of before/after results
README.md (2)
Line range hint
134-167
: Add error handling examplesWhile the code examples are clear, they would benefit from demonstrating proper error handling patterns, especially for network requests and barcode operations that might fail.
Consider adding error handling examples:
const imageFile = await fetch( "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Hello%20world!", -).then((resp) => resp.blob()); +).then((resp) => { + if (!resp.ok) { + throw new Error(`Failed to fetch image: ${resp.status} ${resp.statusText}`); + } + return resp.blob(); +}); -const imageFileReadResults = await readBarcodes(imageFile, readerOptions); +try { + const imageFileReadResults = await readBarcodes(imageFile, readerOptions); + console.log(imageFileReadResults[0]?.text ?? 'No barcode found'); +} catch (error) { + console.error('Failed to read barcode:', error); +}
406-440
: Add versioning compatibility information to FAQConsider adding a question about version compatibility between the library and its dependencies.
Add this FAQ entry:
4. **One of the input types of `readBarcodes` is `ImageData`...** + +5. **What versions of Node.js, Bun, and Deno are supported?** + + This library requires: + - Node.js >= 16.0.0 + - Bun >= 1.0.0 + - Deno >= 1.34.0 + + For optimal compatibility, using the latest LTS versions is recommended.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/nice-needles-guess.md
(1 hunks)README.md
(4 hunks)
🧰 Additional context used
🪛 LanguageTool
.changeset/nice-needles-guess.md
[grammar] ~33-~33: Possible subject-verb agreement error.
Context: ...ar symbol always includes the start and end characters now. ### eccLevel
in Read...
(IS_AND_ARE)
[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)
README.md
[uncategorized] ~353-~353: Loose punctuation mark.
Context: ...@latest/dist/): - zxing_full.wasm
: ```text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~359-~359: Loose punctuation mark.
Context: ...ll.wasm - **`zxing_reader.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~365-~365: Loose punctuation mark.
Context: ...er.wasm - **`zxing_writer.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
🔇 Additional comments (5)
.changeset/nice-needles-guess.md (3)
1-4
: LGTM! Version declaration is appropriate.
The major version bump is correctly specified given the extensive breaking changes being introduced.
49-51
: Clarify the stability status of the writer function.
The note about the writer function being "under discussion" may cause uncertainty for users. Consider:
- Adding a link to the ongoing discussion
- Specifying which aspects might change
- Providing guidance on whether it's safe to use in production
🧰 Tools
🪛 LanguageTool
[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)
1-71
: Well-documented changeset addressing previous feedback.
The changeset now provides comprehensive documentation of breaking changes and new features, addressing the concerns raised in previous reviews. The structure is clear and the migration paths are well-explained.
🧰 Tools
🪛 LanguageTool
[grammar] ~33-~33: Possible subject-verb agreement error.
Context: ...ar symbol always includes the start and end characters now. ### eccLevel
in Read...
(IS_AND_ARE)
[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)
README.md (2)
7-32
: Well-structured barcode format support table!
The table provides a clear and comprehensive overview of supported barcode formats, distinguishing between linear and matrix barcodes while indicating reading and writing support.
310-333
: 🛠️ Refactor suggestion
Expand the Base64 Data URL warning
The current "(Not recommended)" note should be expanded to explain the specific drawbacks of this approach.
Add a warning block explaining the drawbacks:
-4. **Use the [`Module.locateFile`](https://emscripten.org/docs/api_reference/module.html?highlight=locatefile#Module.locateFile) API with a Base64-encoded Data URL** _(Not recommended)_
+4. **Use the [`Module.locateFile`](https://emscripten.org/docs/api_reference/module.html?highlight=locatefile#Module.locateFile) API with a Base64-encoded Data URL**
+
+> [!WARNING]
+> This approach is not recommended for the following reasons:
+> - Increased memory usage due to Base64 encoding (33% larger)
+> - Slower parsing and initialization
+> - Potential memory issues with large WASM files
+> - Security implications of embedding binary data in code
Likely invalid or redundant comment.
806d930
to
7410ffc
Compare
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: 1
♻️ Duplicate comments (3)
main.ts (2)
8-10
:⚠️ Potential issueAdd error handling for fetch operation
The fetch operation still lacks proper error handling for network issues or invalid responses.
Apply this diff to add error handling:
-const imageFile = await fetch( - "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Hello%20world!", -).then((resp) => resp.blob()); +const imageFile = await fetch( + "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Hello%20world!", +).then((resp) => { + if (!resp.ok) { + throw new Error(`HTTP error! status: ${resp.status}`); + } + return resp.blob(); +}).catch((error) => { + console.error('Failed to fetch QR code:', error); + throw error; +});
22-27
:⚠️ Potential issueFix invalid writer options configuration
The writer options contain critical issues that would cause the barcode generation to fail.
- Scale of 0 is invalid and would result in an invisible barcode
- EAN-13 format requires 12 or 13 digits
Apply this diff:
const writerOptions: WriterOptions = { format: "EAN-13", - scale: 0, + scale: 2, withQuietZones: true, withHRT: false, };src/cpp/ZXingWasm.cpp (1)
209-214
:⚠️ Potential issueFix memory leak in PNG encoding.
The
stbi_write_png_to_mem
allocates memory that needs to be freed after copying to the Uint8Array.Apply this fix:
uint8_t *bytes = stbi_write_png_to_mem(image.data(), image.rowStride(), image.width(), image.height(), ZXing::PixStride(image.format()), &len); +std::unique_ptr<uint8_t, void(*)(void*)> bytesGuard(bytes, free); return { .svg = ZXing::WriteBarcodeToSVG(barcode, writerOptions), .utf8 = ZXing::WriteBarcodeToUtf8(barcode, writerOptions), - .image = std::move(Uint8Array.new_(val(typed_memory_view(len, bytes)))) + .image = std::move(Uint8Array.new_(val(typed_memory_view(len, bytesGuard.get())))) };
🧹 Nitpick comments (4)
src/bindings/writerOptions.ts (1)
11-65
: Well-documented interface with comprehensive JSDoc comments.The new
ZXingWriterOptions
interface is thoroughly documented with:
- Clear descriptions for each property
- Default values explicitly stated
- Cross-references to related types/interfaces
- Proper internal marking
One suggestion to enhance the documentation further:
Consider adding
@throws
documentation for therotate
property to clarify what happens if an invalid value is provided (not 0, 90, 180, or 270)./** * The rotation of the barcode in degrees. * Valid values are `0`, `90`, `180` and `270`. * * @defaultValue `0` + * @throws {Error} If the rotation value is not one of 0, 90, 180, or 270 */ rotate: number;
src/writer/index.ts (2)
40-78
: Ensure deprecation notices are visible in documentationThe deprecation notices are well-documented with clear migration paths. Consider adding JSDoc
@since
tags to help users understand when these changes were introduced.Add version information:
/** - * @deprecated Use {@link prepareZXingModule | `prepareZXingModule`} instead. + * @deprecated Since v2.0.0. Use {@link prepareZXingModule | `prepareZXingModule`} instead. + * @since 1.0.0 * This function is equivalent to the following:
81-85
: Consider adding input validation for writeBarcodeThe function accepts both string and Uint8Array inputs but might benefit from additional validation.
Consider adding input validation:
export async function writeBarcode( input: string | Uint8Array, writerOptions?: WriterOptions, ) { + if (typeof input === "string" && input.length === 0) { + throw new Error("Input string cannot be empty"); + } + if (input instanceof Uint8Array && input.length === 0) { + throw new Error("Input Uint8Array cannot be empty"); + } return writeBarcodeWithFactory(zxingModuleFactory, input, writerOptions); }.changeset/nice-needles-guess.md (1)
49-51
: Clarify the stability status of the writeBarcode APIConsider being more specific about the potential changes to help users make informed decisions about adoption. For example:
"The writeBarcode API is in beta and may undergo interface changes before the final v2 release."🧰 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)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (265)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
tests/__snapshots__/aztec-1/#128/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#128/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/#217/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/7/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Historico/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/HistoricoLong/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/Z1-sequence4of7/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-19x19C/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-37x37/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-inverted/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/abc-mirrored/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thick/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/az-thin/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/dlusbs/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/gs1-figure-4.15.1-2-31x31/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/hello/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-075x075/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-105x105/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-131x131/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/lorem-151x151/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/mixed-ecis-41x41/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/padding_bs/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/partial-quiet-zone/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-compact-15x15/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/readerinit-full-19x19/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-1/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-223/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-64/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/rune-68/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tableShifts/slow-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-180.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-270.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/fast-90.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/pure-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/slow-0.json
is excluded by!tests/__snapshots__/**
tests/__snapshots__/aztec-1/tag/slow-180.json
is excluded by!tests/__snapshots__/**
📒 Files selected for processing (35)
.changeset/nice-needles-guess.md
(1 hunks).changeset/pre.json
(1 hunks).coderabbit.yaml
(1 hunks).github/workflows/preview-release.yml
(1 hunks).github/workflows/release.yml
(1 hunks).github/workflows/test.yml
(1 hunks)README.md
(4 hunks)biome.json
(1 hunks)main.ts
(1 hunks)package.json
(1 hunks)src/bindings/barcodeFormat.ts
(2 hunks)src/bindings/binarizer.ts
(1 hunks)src/bindings/characterSet.ts
(1 hunks)src/bindings/contentType.ts
(1 hunks)src/bindings/eanAddOnSymbol.ts
(1 hunks)src/bindings/ecLevel.ts
(1 hunks)src/bindings/eccLevel.ts
(0 hunks)src/bindings/enum.ts
(0 hunks)src/bindings/exposedReaderBindings.ts
(1 hunks)src/bindings/exposedWriterBindings.ts
(1 hunks)src/bindings/index.ts
(1 hunks)src/bindings/readResult.ts
(7 hunks)src/bindings/readerOptions.ts
(9 hunks)src/bindings/textMode.ts
(1 hunks)src/bindings/writeResult.ts
(2 hunks)src/bindings/writerOptions.ts
(1 hunks)src/core.ts
(5 hunks)src/cpp/.clang-format
(1 hunks)src/cpp/CMakeLists.txt
(3 hunks)src/cpp/ZXingWasm.cpp
(5 hunks)src/full/index.ts
(1 hunks)src/global.d.ts
(1 hunks)src/imageData.d.ts
(1 hunks)src/reader/index.ts
(1 hunks)src/writer/index.ts
(1 hunks)
💤 Files with no reviewable changes (2)
- src/bindings/enum.ts
- src/bindings/eccLevel.ts
🚧 Files skipped from review as they are similar to previous changes (21)
- .github/workflows/release.yml
- .changeset/pre.json
- src/cpp/.clang-format
- src/global.d.ts
- .coderabbit.yaml
- .github/workflows/test.yml
- src/bindings/ecLevel.ts
- .github/workflows/preview-release.yml
- src/bindings/index.ts
- src/imageData.d.ts
- src/bindings/binarizer.ts
- package.json
- src/bindings/contentType.ts
- src/bindings/textMode.ts
- src/bindings/exposedWriterBindings.ts
- src/bindings/eanAddOnSymbol.ts
- src/bindings/characterSet.ts
- src/cpp/CMakeLists.txt
- src/bindings/exposedReaderBindings.ts
- src/bindings/writeResult.ts
- src/reader/index.ts
🧰 Additional context used
🪛 LanguageTool
.changeset/nice-needles-guess.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)
README.md
[uncategorized] ~353-~353: Loose punctuation mark.
Context: ...@latest/dist/): - zxing_full.wasm
: ```text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~359-~359: Loose punctuation mark.
Context: ...ll.wasm - **`zxing_reader.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~365-~365: Loose punctuation mark.
Context: ...er.wasm - **`zxing_writer.wasm`**:
text https://cdn.jsdelivr.net/n...
(UNLIKELY_OPENING_PUNCTUATION)
🔇 Additional comments (36)
src/bindings/writerOptions.ts (4)
1-2
: LGTM! Clean import statements with proper type imports.
The imports are well-structured and use proper type imports, which is good for tree-shaking.
72-84
: LGTM! Type-safe interface extension with comprehensive format documentation.
The WriterOptions
interface is well-designed:
- Makes all internal options optional through
Partial
- Properly omits the internal numeric format
- Provides clear documentation of all supported barcode formats
88-96
: LGTM! Comprehensive default options matching documentation.
The default values are well-aligned with the JSDoc documentation and provide a good starting point for users.
99-111
: Clean conversion function with improved type safety.
The function has been simplified while maintaining type safety:
- Clear JSDoc documentation
- Proper use of the new
encodeFormat
function - Type-safe spread of options
However, let's verify the usage of this conversion function to ensure all callers have been updated:
✅ Verification successful
All callers have been properly updated to use the new signature
The verification shows that all usages of writerOptionsToZXingWriterOptions
are consistent with the new implementation:
- In
src/core.ts
, it's called with just therequiredWriterOptions
parameter - No other usages found that might use the old signature with
zxingModule
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for all usages of writerOptionsToZXingWriterOptions
# to verify they've been updated to remove the zxingModule parameter
rg "writerOptionsToZXingWriterOptions" --type ts
Length of output: 254
Script:
#!/bin/bash
# Let's check the actual usage in core.ts to verify the parameters
rg "writerOptionsToZXingWriterOptions" -B 2 -A 2 --type ts
Length of output: 804
main.ts (2)
12-16
: LGTM! Well-structured reader options
The reader options are well-configured with appropriate constraints:
tryHarder
for improved accuracy- Specific format targeting (QRCode)
- Reasonable limit on number of symbols
29-29
:
Fix invalid input for EAN-13 format
The input "12345" is too short for EAN-13 format.
Apply this diff:
-console.log(await writeBarcode("12345", writerOptions));
+console.log(await writeBarcode("123456789012", writerOptions));
Likely invalid or redundant comment.
src/writer/index.ts (1)
20-34
: Well-structured function overloads with TypeScript improvements
The prepareZXingModule
implementation with overloads provides excellent type safety and flexibility:
- Clear separation of synchronous and asynchronous paths
- Proper type merging using type-fest's Merge utility
- Consistent implementation using the factory pattern
biome.json (3)
30-42
: LGTM! Well-organized linter configuration
The override for core TypeScript files is well-structured:
- Clear file inclusion patterns
- Specific rule customization for
noConfusingVoidType
44-53
: LGTM! Appropriate test file configuration
The override for test files appropriately disables the noDelete
rule, which is often necessary in test cleanup.
54-61
: LGTM! Type declaration file configuration
The override for imageData.d.ts
correctly disables noBannedTypes
which is often necessary in type declaration files.
src/full/index.ts (5)
1-12
: LGTM! Import declarations are well-organized.
The imports correctly reflect the new module preparation and barcode processing functions.
14-28
: Well-designed type-safe module preparation API!
The function overloads provide excellent type safety and flexibility:
- Returns void when immediate execution isn't needed
- Returns Promise when immediate execution is requested
- Uses TypeScript's Merge utility for clean option types
34-73
: Excellent deprecation handling with clear migration paths!
The deprecated functions are well documented with:
- Comprehensive JSDoc comments
- Example code for migration
- Equivalent functionality using new APIs
75-100
: Clean API consolidation for barcode reading!
The unified readBarcodes
function elegantly handles both Blob and ImageData inputs while maintaining backward compatibility through deprecated functions.
102-117
: Enhanced barcode writing capabilities with flexible input support!
The new writeBarcode
function accepts both string and binary inputs, improving flexibility. The version and hash exports aid in tracking and verification.
src/bindings/readResult.ts (3)
Line range hint 20-44
: Type changes align with the new numeric encoding approach!
The transition from string/enum types to numbers for format and contentType, along with the eccLevel to ecLevel rename, maintains consistency with the documented breaking changes.
Line range hint 109-136
: Well-designed interface with clear migration path!
The ReadResult interface:
- Properly documents all possible format values
- Maintains backward compatibility with deprecated properties
- Uses TypeScript's Omit utility for clean type inheritance
139-154
: Clean implementation of the format conversion logic!
The conversion function properly implements:
- New numeric format decoding
- Content type conversion
- Backward compatible property mapping
src/bindings/barcodeFormat.ts (5)
1-50
: Well-structured type-safe format definitions!
The new metadata-based approach with barcodeFormatsWithMeta
is a clean and maintainable way to handle format capabilities. The type definitions effectively leverage TypeScript's type system for compile-time safety.
86-111
: Clean and efficient format encoding implementation!
The function is well-documented and efficiently implements format encoding using bitwise operations. All cases including special formats are properly handled.
132-165
: Well-implemented format conversion utilities!
The encode/decode format functions are well-documented and efficiently implemented. The use of reduce for encoding and proper iteration for decoding is clean and maintainable.
114-129
: Consider handling multiple set bits.
The use of Math.clz32
for finding the highest set bit is clever, but this implementation assumes only one bit is set. Consider adding validation or handling for cases where multiple bits might be set.
60-84
: Verify documentation for breaking type changes.
The type definitions have been made more strict and precise, which is good for type safety. However, these are breaking changes that need to be properly documented.
src/bindings/readerOptions.ts (4)
1-5
: Clean transition to new encoding system.
The imports have been updated to use the new encode functions, providing a more consistent approach to handling options.
40-46
: Well-documented experimental feature.
The tryDenoise
option is properly marked as experimental with clear documentation. This helps users understand the feature's stability status.
97-102
: Verify impact of error handling changes.
The replacement of specific validation flags with a generic returnErrors
flag represents a breaking change. Ensure this is properly documented and that migration guides are available.
238-256
: Clean options conversion implementation!
The function effectively uses the new encode functions for a clean and maintainable conversion of reader options.
src/cpp/ZXingWasm.cpp (3)
141-147
: Good memory management practices!
The use of std::unique_ptr
with custom deleter ensures proper cleanup of image resources.
159-190
: Well-organized options handling!
The separation of creator and writer options into distinct functions with proper namespacing improves code organization and maintainability.
Line range hint 246-333
: Comprehensive Emscripten bindings!
The bindings provide complete coverage of all options and properly handle experimental features through conditional compilation.
src/core.ts (4)
42-52
: LGTM! Interface changes improve type safety.
The separation of text and binary input handling through distinct methods enhances type safety and makes the API more explicit.
68-72
: LGTM! Type mapping enhances type safety.
The TypeModuleMap
interface provides a robust type-safe mapping between module types and their implementations, improving type inference throughout the codebase.
Line range hint 270-316
: Add bounds checking for memory allocation.
Memory allocation is performed without size validation, which could lead to allocation failures.
The previous review comment's suggestion for adding bounds checking is still applicable here.
104-241
:
Add protection against parallel instantiations.
The caching mechanism is well-implemented with WeakMap, but it lacks protection against race conditions when multiple instantiations occur simultaneously. This could lead to duplicate instantiations or cache inconsistencies.
Consider adding a lock mechanism:
const __CACHE__ = new WeakMap<ZXingModuleFactory, CachedValue>();
+const __LOCKS__ = new WeakMap<ZXingModuleFactory, Promise<void>>();
export function prepareZXingModuleWithFactory<T extends ZXingModuleType>(
zxingModuleFactory: ZXingModuleFactory<T>,
options?: PrepareZXingModuleOptions,
) {
+ // Acquire lock or wait for existing operation
+ const existingLock = __LOCKS__.get(zxingModuleFactory);
+ if (existingLock) {
+ return existingLock.then(() =>
+ prepareZXingModuleWithFactory(zxingModuleFactory, options)
+ );
+ }
+
+ const operationPromise = new Promise<void>(async (resolve) => {
// ... existing preparation logic ...
+ resolve();
+ });
+
+ __LOCKS__.set(zxingModuleFactory, operationPromise);
+ operationPromise.finally(() => {
+ __LOCKS__.delete(zxingModuleFactory);
+ });
+
+ return operationPromise;
}
Likely invalid or redundant comment.
README.md (2)
310-333
: Expand the warning about Base64 Data URLs.
The "Not recommended" warning should be expanded to explain the security and performance implications.
The previous review comment's suggestion to explain increased memory usage, performance impact, and security implications is still valid.
67-71
: Consider uncommenting the demo section.
The demo URL (https://zxing-wasm-demo.deno.dev/) is active and accessible. The demo section provides valuable quick-start information for users.
The previous review comment's verification of the demo URL's accessibility is still valid.
export async function writeBarcodeWithFactory<T extends "writer" | "full">( | ||
zxingModuleFactory: ZXingModuleFactory<T>, | ||
text: string, | ||
input: string | Uint8Array, | ||
writerOptions: WriterOptions = defaultWriterOptions, | ||
) { | ||
const requiredWriterOptions: Required<WriterOptions> = { | ||
...defaultWriterOptions, | ||
...writerOptions, | ||
}; | ||
const zxingModule = await getZXingModuleWithFactory(zxingModuleFactory); | ||
const zxingWriteResult = zxingModule.writeBarcodeToImage( | ||
text, | ||
writerOptionsToZXingWriterOptions(zxingModule, requiredWriterOptions), | ||
const zxingWriterOptions = writerOptionsToZXingWriterOptions( | ||
requiredWriterOptions, | ||
); | ||
const zxingModule = await prepareZXingModuleWithFactory(zxingModuleFactory, { | ||
fireImmediately: true, | ||
}); | ||
if (typeof input === "string") { | ||
return zxingWriteResultToWriteResult( | ||
zxingModule.writeBarcodeFromText(input, zxingWriterOptions), | ||
); | ||
} | ||
const { byteLength } = input; | ||
const bufferPtr = zxingModule._malloc(byteLength); | ||
zxingModule.HEAPU8.set(input, bufferPtr); | ||
const zxingWriteResult = zxingModule.writeBarcodeFromBytes( | ||
bufferPtr, | ||
byteLength, | ||
zxingWriterOptions, | ||
); | ||
zxingModule._free(bufferPtr); | ||
return zxingWriteResultToWriteResult(zxingWriteResult); | ||
} |
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.
🛠️ Refactor suggestion
Ensure consistent memory management across reader and writer functions.
The memory management pattern should be consistent with the reader function. Consider applying the same memory allocation safety checks here.
Apply similar bounds checking as suggested for the reader function:
const { byteLength } = input;
+const maxSize = zxingModule.HEAP8.length;
+if (byteLength > maxSize) {
+ throw new Error(`Input size ${byteLength} exceeds maximum heap size ${maxSize}`);
+}
const bufferPtr = zxingModule._malloc(byteLength);
+if (!bufferPtr) {
+ throw new Error('Memory allocation failed');
+}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export async function writeBarcodeWithFactory<T extends "writer" | "full">( | |
zxingModuleFactory: ZXingModuleFactory<T>, | |
text: string, | |
input: string | Uint8Array, | |
writerOptions: WriterOptions = defaultWriterOptions, | |
) { | |
const requiredWriterOptions: Required<WriterOptions> = { | |
...defaultWriterOptions, | |
...writerOptions, | |
}; | |
const zxingModule = await getZXingModuleWithFactory(zxingModuleFactory); | |
const zxingWriteResult = zxingModule.writeBarcodeToImage( | |
text, | |
writerOptionsToZXingWriterOptions(zxingModule, requiredWriterOptions), | |
const zxingWriterOptions = writerOptionsToZXingWriterOptions( | |
requiredWriterOptions, | |
); | |
const zxingModule = await prepareZXingModuleWithFactory(zxingModuleFactory, { | |
fireImmediately: true, | |
}); | |
if (typeof input === "string") { | |
return zxingWriteResultToWriteResult( | |
zxingModule.writeBarcodeFromText(input, zxingWriterOptions), | |
); | |
} | |
const { byteLength } = input; | |
const bufferPtr = zxingModule._malloc(byteLength); | |
zxingModule.HEAPU8.set(input, bufferPtr); | |
const zxingWriteResult = zxingModule.writeBarcodeFromBytes( | |
bufferPtr, | |
byteLength, | |
zxingWriterOptions, | |
); | |
zxingModule._free(bufferPtr); | |
return zxingWriteResultToWriteResult(zxingWriteResult); | |
} | |
export async function writeBarcodeWithFactory<T extends "writer" | "full">( | |
zxingModuleFactory: ZXingModuleFactory<T>, | |
input: string | Uint8Array, | |
writerOptions: WriterOptions = defaultWriterOptions, | |
) { | |
const requiredWriterOptions: Required<WriterOptions> = { | |
...defaultWriterOptions, | |
...writerOptions, | |
}; | |
const zxingWriterOptions = writerOptionsToZXingWriterOptions( | |
requiredWriterOptions, | |
); | |
const zxingModule = await prepareZXingModuleWithFactory(zxingModuleFactory, { | |
fireImmediately: true, | |
}); | |
if (typeof input === "string") { | |
return zxingWriteResultToWriteResult( | |
zxingModule.writeBarcodeFromText(input, zxingWriterOptions), | |
); | |
} | |
const { byteLength } = input; | |
const maxSize = zxingModule.HEAP8.length; | |
if (byteLength > maxSize) { | |
throw new Error(`Input size ${byteLength} exceeds maximum heap size ${maxSize}`); | |
} | |
const bufferPtr = zxingModule._malloc(byteLength); | |
if (!bufferPtr) { | |
throw new Error('Memory allocation failed'); | |
} | |
zxingModule.HEAPU8.set(input, bufferPtr); | |
const zxingWriteResult = zxingModule.writeBarcodeFromBytes( | |
bufferPtr, | |
byteLength, | |
zxingWriterOptions, | |
); | |
zxingModule._free(bufferPtr); | |
return zxingWriteResultToWriteResult(zxingWriteResult); | |
} |
7410ffc
to
69721a6
Compare
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 bothreadBarcodesFromImageFile(...)
andreadBarcodesFromImageData(...)
. The new function unifies code paths forBlob
andImageData
inputs.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 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(...)
. The new function is powered by the newzint
writer, which supports more barcode formats, supports bothstring
andUint8Array
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 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.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 except forDXFilmEdge
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 and by default, it is set tofalse
.