@ericblade/quagga2 1.11.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEPENDENCIES.md +53 -1
- package/README.md +4 -2
- package/dist/quagga.js +7299 -5335
- package/dist/quagga.min.js +4 -4
- package/docs/contributing.md +18 -1
- package/docs/getting-started.md +1 -1
- package/docs/reference/api.md +42 -0
- package/docs/reference/configuration.md +1 -0
- package/docs/reference/readers.md +66 -1
- package/lib/quagga.js +18303 -12643
- package/package.json +15 -5
- package/type-definitions/quagga.d.ts +5 -1
package/DEPENDENCIES.md
CHANGED
|
@@ -19,6 +19,7 @@ These packages contain code that is **imported by the source code** and **bundle
|
|
|
19
19
|
- **`gl-matrix`** (^3.4.4)
|
|
20
20
|
- **Purpose**: High-performance vector and matrix math operations
|
|
21
21
|
- **Usage**: Used throughout the codebase for geometric calculations
|
|
22
|
+
- **Location**: Listed in `dependencies` (not `devDependencies`) - see [Type Definition Dependencies](#type-definition-dependencies) below
|
|
22
23
|
- **Files**:
|
|
23
24
|
- `src/quagga/quagga.ts` - vec2 operations for bounding boxes
|
|
24
25
|
- `src/quagga/initBuffers.ts` - vec2 for buffer initialization
|
|
@@ -26,6 +27,7 @@ These packages contain code that is **imported by the source code** and **bundle
|
|
|
26
27
|
- `src/common/image_wrapper.ts` - vec2 for image transforms
|
|
27
28
|
- `src/common/cvutils/ImageRef.ts` - vec2, vec3 for computer vision
|
|
28
29
|
- `src/common/cluster.js` - vec2 for clustering algorithms
|
|
30
|
+
- `type-definitions/quagga.d.ts` - vec2 type import for `Moment.vec` property
|
|
29
31
|
|
|
30
32
|
- **`lodash`** (^4.17.21)
|
|
31
33
|
- **Purpose**: Utility functions for object manipulation
|
|
@@ -143,6 +145,18 @@ These packages are **only used during build/development** and are **not bundled
|
|
|
143
145
|
- **Purpose**: Native file watching for better performance
|
|
144
146
|
- **Usage**: Automatically used by Webpack/build tools on macOS
|
|
145
147
|
|
|
148
|
+
- **`ndarray-pixels`** (^5.0.1)
|
|
149
|
+
- **Platform**: Node.js only
|
|
150
|
+
- **Purpose**: Image decoding for `decodeSingle` in Node.js
|
|
151
|
+
- **Usage**: Required for Node.js `decodeSingle()` support; install with `npm install ndarray-pixels sharp`
|
|
152
|
+
- **Note**: Marked external in Node webpack build; not bundled into `lib/quagga.js`
|
|
153
|
+
|
|
154
|
+
- **`sharp`** (^0.34.0)
|
|
155
|
+
- **Platform**: Node.js only
|
|
156
|
+
- **Purpose**: Native image processing (used by `ndarray-pixels` on Node.js)
|
|
157
|
+
- **Usage**: Required for Node.js `decodeSingle()` support; transitive dependency of `ndarray-pixels`
|
|
158
|
+
- **Note**: Marked external in Node webpack build; not bundled into `lib/quagga.js`
|
|
159
|
+
|
|
146
160
|
---
|
|
147
161
|
|
|
148
162
|
## Overrides
|
|
@@ -234,12 +248,50 @@ These are configured in `.ncurc.json` to prevent accidental upgrades via `npm-ch
|
|
|
234
248
|
|
|
235
249
|
---
|
|
236
250
|
|
|
251
|
+
## Type Definition Dependencies
|
|
252
|
+
|
|
253
|
+
### Exception: `gl-matrix` in `dependencies`
|
|
254
|
+
|
|
255
|
+
While most packages in Quagga2 are listed in `devDependencies` because they are bundled (see [Background](#background)), **`gl-matrix` is an exception** and is listed in `dependencies`.
|
|
256
|
+
|
|
257
|
+
**Why?**
|
|
258
|
+
|
|
259
|
+
The TypeScript type definition file (`type-definitions/quagga.d.ts`) imports `vec2` from `gl-matrix`:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import { vec2 } from 'gl-matrix';
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
This type is used in the `Moment` interface:
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
export type Moment = {
|
|
269
|
+
// ... other properties
|
|
270
|
+
vec?: vec2;
|
|
271
|
+
};
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
When TypeScript consumers use Quagga2 with type checking, the TypeScript compiler needs to resolve this import to provide proper type information. If `gl-matrix` were in `devDependencies`, it would not be installed when consumers run `npm install @ericblade/quagga2`, causing TypeScript compilation errors.
|
|
275
|
+
|
|
276
|
+
**Key distinction:**
|
|
277
|
+
|
|
278
|
+
- **Runtime bundling**: `gl-matrix` code IS bundled into `dist/quagga.min.js` - consumers don't need it at runtime
|
|
279
|
+
- **Type resolution**: TypeScript consumers DO need `gl-matrix` installed to resolve types in `quagga.d.ts`
|
|
280
|
+
|
|
281
|
+
This is a special case where type definitions create a true development-time dependency for consumers using TypeScript.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
237
285
|
## FAQ
|
|
238
286
|
|
|
239
287
|
**Q: Why are runtime dependencies in `devDependencies` instead of `dependencies`?**
|
|
240
288
|
|
|
241
289
|
A: Quagga2 is a **bundled library**. Consumers install the package and use the pre-built files (`dist/quagga.min.js` or `lib/quagga.js`), not the source code. They never run `npm install` on Quagga2's dependencies. Therefore, from npm's perspective, all packages are development dependencies (used during build), not runtime dependencies (used after install).
|
|
242
290
|
|
|
291
|
+
**Q: Why is `gl-matrix` in `dependencies` if everything else is in `devDependencies`?**
|
|
292
|
+
|
|
293
|
+
A: This is an exception for TypeScript type resolution. The type definition file (`type-definitions/quagga.d.ts`) imports `vec2` from `gl-matrix` to provide proper typing for the `Moment.vec` property. TypeScript consumers need `gl-matrix` installed to resolve these types during compilation. See [Type Definition Dependencies](#type-definition-dependencies) for details.
|
|
294
|
+
|
|
243
295
|
**Q: How can I tell if a package is actually used in the code?**
|
|
244
296
|
|
|
245
297
|
A: Search the `src/` directory:
|
|
@@ -283,4 +335,4 @@ This document was created in November 2025 following the TypeScript 5.9.3 upgrad
|
|
|
283
335
|
- Security vulnerabilities are discovered and patched
|
|
284
336
|
- Build tooling changes significantly
|
|
285
337
|
|
|
286
|
-
Last updated: 2025-
|
|
338
|
+
Last updated: 2025-12-01
|
package/README.md
CHANGED
|
@@ -42,13 +42,14 @@ Please see <https://github.com/ptc-iot-sharing/ThingworxBarcodeScannerWidget>
|
|
|
42
42
|
|
|
43
43
|
## Using Vue?
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
- **Vue 2**: <https://github.com/DevinNorgarb/vue-quagga-2>
|
|
46
|
+
- **Vue 3**: <https://github.com/nick-0101/vue3-quagga-2>
|
|
46
47
|
|
|
47
48
|
## What is QuaggaJS?
|
|
48
49
|
|
|
49
50
|
QuaggaJS is a barcode-scanner entirely written in JavaScript supporting real-time localization and decoding of various types of barcodes such as __EAN__,
|
|
50
51
|
__CODE 128__, __CODE 39__, __EAN 8__, __UPC-A__, __UPC-C__, __I2of5__,
|
|
51
|
-
__2of5__, __CODE 93__, __CODE 32__ and
|
|
52
|
+
__2of5__, __CODE 93__, __CODE 32__, __CODABAR__, and __PHARMACODE__. The library is also capable of using
|
|
52
53
|
`getUserMedia` to get direct access to the user's camera stream. Although the
|
|
53
54
|
code relies on heavy image-processing even recent smartphones are capable of
|
|
54
55
|
locating and decoding barcodes in real-time.
|
|
@@ -642,6 +643,7 @@ barcodes which should be decoded during the session. Possible values are:
|
|
|
642
643
|
- 2of5_reader
|
|
643
644
|
- code_93_reader
|
|
644
645
|
- code_32_reader
|
|
646
|
+
- pharmacode_reader
|
|
645
647
|
|
|
646
648
|
Why are not all types activated by default? Simply because one should
|
|
647
649
|
explicitly define the set of barcodes for their use-case. More decoders means
|