@authme/engine 2.2.0-rc.6 → 2.2.0-rc.8

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [2.2.0-rc.8](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.7...v2.2.0-rc.8) (2022-12-07)
6
+
7
+ ### Features
8
+
9
+ - update engine-lib to 4.7.0 ([968d200](https://github.com/AuthMe01/web-client-sdk/commit/968d2006d3834a187177384710e314e65bf333a0))
10
+
11
+ ## [2.2.0-rc.7](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.6...v2.2.0-rc.7) (2022-12-07)
12
+
13
+ ### Bug Fixes
14
+
15
+ - cors problem on worker creating ([143cb33](https://github.com/AuthMe01/web-client-sdk/commit/143cb336982777a853b75ea88c038d8fa68e1dce))
16
+
5
17
  ## [2.2.0-rc.6](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.5...v2.2.0-rc.6) (2022-12-05)
6
18
 
7
19
  ## [2.2.0-rc.5](https://github.com/AuthMe01/web-client-sdk/compare/v2.2.0-rc.4...v2.2.0-rc.5) (2022-12-03)
@@ -5,19 +5,12 @@
5
5
 
6
6
  let modelSession = {};
7
7
 
8
- function isSimdSupported() {
9
- try {
10
- // Test for WebAssembly SIMD capability (for both browsers and Node.js)
11
- // This typed array is a WebAssembly program containing SIMD instructions.
12
- return WebAssembly.validate(
13
- new Uint8Array([
14
- 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 9, 1,
15
- 7, 0, 65, 0, 253, 15, 26, 11,
16
- ])
17
- );
18
- } catch (e) {
19
- return false;
20
- }
8
+ function importScriptsViaJsContent(jsContent) {
9
+ const objectUrl = URL.createObjectURL(
10
+ new Blob([jsContent], { type: 'text/javascript' })
11
+ );
12
+ importScripts(objectUrl);
13
+ URL.revokeObjectURL(objectUrl);
21
14
  }
22
15
 
23
16
  function base64toBlob(data) {
@@ -52,7 +45,7 @@
52
45
  }
53
46
  }
54
47
 
55
- async function loadWasm() {
48
+ async function loadWasm({ engineJsContent, engineWasmContent }) {
56
49
  return new Promise((res, rej) => {
57
50
  // console.log('load wasm');
58
51
  if (wasm_loaded || wasm_loading) {
@@ -71,14 +64,11 @@
71
64
  });
72
65
  },
73
66
  };
74
- self.importScripts(
75
- isSimdSupported()
76
- ? `${self.config.scriptPath}ml_engine_web.simd.js`
77
- : `${self.config.scriptPath}ml_engine_web.js`
78
- );
67
+ importScriptsViaJsContent(engineJsContent);
79
68
  let tryInitEngineLib = async () => {
80
69
  try {
81
70
  const module = await AuthmeMLEngineLib({
71
+ wasmBinary: engineWasmContent,
82
72
  print: (msg) => {
83
73
  console.log(msg);
84
74
  postMessage({
@@ -524,8 +514,8 @@
524
514
  };
525
515
  return true;
526
516
  },
527
- loadEngine: async function () {
528
- return await loadWasm();
517
+ loadEngine: async function ({ engineJsContent, engineWasmContent }) {
518
+ return await loadWasm({ engineJsContent, engineWasmContent });
529
519
  },
530
520
  verify: async function (params) {
531
521
  for (let index = 0; index < 20; index++) {