@ericblade/quagga2 1.11.0 → 1.12.0
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 +41 -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 +11231 -8042
- package/package.json +9 -3
- 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
|
|
@@ -234,12 +236,50 @@ These are configured in `.ncurc.json` to prevent accidental upgrades via `npm-ch
|
|
|
234
236
|
|
|
235
237
|
---
|
|
236
238
|
|
|
239
|
+
## Type Definition Dependencies
|
|
240
|
+
|
|
241
|
+
### Exception: `gl-matrix` in `dependencies`
|
|
242
|
+
|
|
243
|
+
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`.
|
|
244
|
+
|
|
245
|
+
**Why?**
|
|
246
|
+
|
|
247
|
+
The TypeScript type definition file (`type-definitions/quagga.d.ts`) imports `vec2` from `gl-matrix`:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
import { vec2 } from 'gl-matrix';
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
This type is used in the `Moment` interface:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
export type Moment = {
|
|
257
|
+
// ... other properties
|
|
258
|
+
vec?: vec2;
|
|
259
|
+
};
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
**Key distinction:**
|
|
265
|
+
|
|
266
|
+
- **Runtime bundling**: `gl-matrix` code IS bundled into `dist/quagga.min.js` - consumers don't need it at runtime
|
|
267
|
+
- **Type resolution**: TypeScript consumers DO need `gl-matrix` installed to resolve types in `quagga.d.ts`
|
|
268
|
+
|
|
269
|
+
This is a special case where type definitions create a true development-time dependency for consumers using TypeScript.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
237
273
|
## FAQ
|
|
238
274
|
|
|
239
275
|
**Q: Why are runtime dependencies in `devDependencies` instead of `dependencies`?**
|
|
240
276
|
|
|
241
277
|
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
278
|
|
|
279
|
+
**Q: Why is `gl-matrix` in `dependencies` if everything else is in `devDependencies`?**
|
|
280
|
+
|
|
281
|
+
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.
|
|
282
|
+
|
|
243
283
|
**Q: How can I tell if a package is actually used in the code?**
|
|
244
284
|
|
|
245
285
|
A: Search the `src/` directory:
|
|
@@ -283,4 +323,4 @@ This document was created in November 2025 following the TypeScript 5.9.3 upgrad
|
|
|
283
323
|
- Security vulnerabilities are discovered and patched
|
|
284
324
|
- Build tooling changes significantly
|
|
285
325
|
|
|
286
|
-
Last updated: 2025-
|
|
326
|
+
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
|