Skip to content

Commit

Permalink
Update dependency barcode-detector to v3 (#24015)
Browse files Browse the repository at this point in the history
* Update dependency barcode-detector to v3

* fix breaking changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Petar Petrov <[email protected]>
  • Loading branch information
renovate[bot] and MindFreeze authored Feb 6, 2025
1 parent 3918194 commit 79b9f8d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@webcomponents/scoped-custom-element-registry": "0.0.9",
"@webcomponents/webcomponentsjs": "2.8.0",
"app-datepicker": "5.1.1",
"barcode-detector": "2.3.1",
"barcode-detector": "3.0.0",
"color-name": "2.0.0",
"comlink": "4.4.2",
"core-js": "3.40.0",
Expand Down
16 changes: 9 additions & 7 deletions src/components/ha-qr-scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { customElement, property, query, state } from "lit/decorators";
// and "qr-scanner" defaults to a suboptimal implementation if it is not available.
// The following import makes a better implementation available that is based on a
// WebAssembly port of ZXing:
import { setZXingModuleOverrides } from "barcode-detector";
import { prepareZXingModule } from "barcode-detector";
import type QrScanner from "qr-scanner";
import { fireEvent } from "../common/dom/fire_event";
import { stopPropagation } from "../common/dom/stop_propagation";
Expand All @@ -21,12 +21,14 @@ import "./ha-list-item";
import "./ha-textfield";
import type { HaTextField } from "./ha-textfield";

setZXingModuleOverrides({
locateFile: (path: string, prefix: string) => {
if (path.endsWith(".wasm")) {
return "/static/js/zxing_reader.wasm";
}
return prefix + path;
prepareZXingModule({
overrides: {
locateFile: (path: string, prefix: string) => {
if (path.endsWith(".wasm")) {
return "/static/js/zxing_reader.wasm";
}
return prefix + path;
},
},
});

Expand Down
38 changes: 20 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4545,13 +4545,6 @@ __metadata:
languageName: node
linkType: hard

"@types/dom-webcodecs@npm:0.1.11":
version: 0.1.11
resolution: "@types/dom-webcodecs@npm:0.1.11"
checksum: 10/00141b61720110bdfe75d0c0d84e69e44aaeb9a173f921d6252fe42bbbe01394e395e778cf8701d5ddfec3d5258b4ca841f7522210172c00b1d433ffa3d3ea51
languageName: node
linkType: hard

"@types/emscripten@npm:^1.39.13":
version: 1.39.13
resolution: "@types/emscripten@npm:1.39.13"
Expand Down Expand Up @@ -6130,13 +6123,12 @@ __metadata:
languageName: node
linkType: hard

"barcode-detector@npm:2.3.1":
version: 2.3.1
resolution: "barcode-detector@npm:2.3.1"
"barcode-detector@npm:3.0.0":
version: 3.0.0
resolution: "barcode-detector@npm:3.0.0"
dependencies:
"@types/dom-webcodecs": "npm:0.1.11"
zxing-wasm: "npm:1.3.4"
checksum: 10/b58dc62532f3cdec2b05bf9e6252a5c366a9e86ebaa3e7e664426b1432a56292ac78b5c4451c6c3b7a8149975e725b17a30483ccde13db1f899a66b94bd20311
zxing-wasm: "npm:^2.0.1"
checksum: 10/5b2e5cb0787ffa2ee557bca456afe6403742e8eeb3fe69b077117d457bff3d2deb783b5c9c476e6fb7cd08dc940c739eeb18e70b40dd9f46702b51c7ec41efaf
languageName: node
linkType: hard

Expand Down Expand Up @@ -9377,7 +9369,7 @@ __metadata:
app-datepicker: "npm:5.1.1"
babel-loader: "npm:9.2.1"
babel-plugin-template-html-minifier: "npm:4.1.0"
barcode-detector: "npm:2.3.1"
barcode-detector: "npm:3.0.0"
browserslist-useragent-regexp: "npm:4.1.3"
color-name: "npm:2.0.0"
comlink: "npm:4.4.2"
Expand Down Expand Up @@ -14572,6 +14564,13 @@ __metadata:
languageName: node
linkType: hard

"type-fest@npm:^4.33.0":
version: 4.33.0
resolution: "type-fest@npm:4.33.0"
checksum: 10/0d179e66fa765bd0a25a785b12dc797f90f2f92bdb8c9c8a789f3fd8e5a4492444e7ef83551b3b8463aeab24fd6195761e26b03174722de636b4b75aa5726fb7
languageName: node
linkType: hard

"type-is@npm:~1.6.18":
version: 1.6.18
resolution: "type-is@npm:1.6.18"
Expand Down Expand Up @@ -16213,11 +16212,14 @@ __metadata:
languageName: node
linkType: hard

"zxing-wasm@npm:1.3.4":
version: 1.3.4
resolution: "zxing-wasm@npm:1.3.4"
"zxing-wasm@npm:^2.0.1":
version: 2.0.1
resolution: "zxing-wasm@npm:2.0.1"
dependencies:
"@types/emscripten": "npm:^1.39.13"
checksum: 10/bc681ab1ac9ad99e39172b5f449155a0b4e163c3182fa35f8503f8098b7157160f4e55579e7b15be09c79c84910e15c5a811107dfa0c2b502543743f4566e1e1
type-fest: "npm:^4.33.0"
peerDependencies:
"@types/emscripten": ">=1.39.6"
checksum: 10/89b7c379b39becefae8b5d323b776dd3506a44f628fd63f5579af72d287b9dba1b422f33580d38f73e18af011ee8819d9acfaf7c3227a8f2a2ab213ff97a58f6
languageName: node
linkType: hard

0 comments on commit 79b9f8d

Please sign in to comment.