@microblink/capture 1.0.0 → 1.0.3
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/README.md +2 -0
- package/dist/capture.js +3061 -3060
- package/dist/capture.umd.cjs +43 -43
- package/dist/resources/advanced/capture-wasm.wasm +0 -0
- package/dist/resources/advanced-threads/capture-wasm.wasm +0 -0
- package/dist/resources/basic/capture-wasm.wasm +0 -0
- package/dist/resources/capture-worker.js +2 -2
- package/package.json +22 -26
- package/types/index.d.ts +2 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var captureWorker=function(
|
|
1
|
+
var captureWorker=function(P){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/const x=Symbol("Comlink.proxy"),N=Symbol("Comlink.endpoint"),
|
|
5
|
+
*/const x=Symbol("Comlink.proxy"),N=Symbol("Comlink.endpoint"),I=Symbol("Comlink.releaseProxy"),m=Symbol("Comlink.finalizer"),h=Symbol("Comlink.thrown"),z=e=>typeof e=="object"&&e!==null||typeof e=="function",F={canHandle:e=>z(e)&&e[x],serialize(e){const{port1:t,port2:r}=new MessageChannel;return M(e,t),[r,[r]]},deserialize(e){return e.start(),_(e)}},H={canHandle:e=>z(e)&&h in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},C=new Map([["proxy",F],["throw",H]]);function V(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function M(e,t=globalThis,r=["*"]){t.addEventListener("message",function a(n){if(!n||!n.data)return;if(!V(r,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}const{id:f,type:s,path:c}=Object.assign({path:[]},n.data),u=(n.data.argumentList||[]).map(y);let o;try{const i=c.slice(0,-1).reduce((l,b)=>l[b],e),d=c.reduce((l,b)=>l[b],e);switch(s){case"GET":o=d;break;case"SET":i[c.slice(-1)[0]]=y(n.data.value),o=!0;break;case"APPLY":o=d.apply(i,u);break;case"CONSTRUCT":{const l=new d(...u);o=T(l)}break;case"ENDPOINT":{const{port1:l,port2:b}=new MessageChannel;M(e,b),o=G(l,[l])}break;case"RELEASE":o=void 0;break;default:return}}catch(i){o={value:i,[h]:0}}Promise.resolve(o).catch(i=>({value:i,[h]:0})).then(i=>{const[d,l]=k(i);t.postMessage(Object.assign(Object.assign({},d),{id:f}),l),s==="RELEASE"&&(t.removeEventListener("message",a),O(t),m in e&&typeof e[m]=="function"&&e[m]())}).catch(i=>{const[d,l]=k({value:new TypeError("Unserializable return value"),[h]:0});t.postMessage(Object.assign(Object.assign({},d),{id:f}),l)})}),t.start&&t.start()}function j(e){return e.constructor.name==="MessagePort"}function O(e){j(e)&&e.close()}function _(e,t){return W(e,[],t)}function A(e){if(e)throw new Error("Proxy has been released and is not useable")}function R(e){return g(e,{type:"RELEASE"}).then(()=>{O(e)})}const E=new WeakMap,S="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(E.get(e)||0)-1;E.set(e,t),t===0&&R(e)});function $(e,t){const r=(E.get(t)||0)+1;E.set(t,r),S&&S.register(e,t,e)}function B(e){S&&S.unregister(e)}function W(e,t=[],r=function(){}){let a=!1;const n=new Proxy(r,{get(f,s){if(A(a),s===I)return()=>{B(n),R(e),a=!0};if(s==="then"){if(t.length===0)return{then:()=>n};const c=g(e,{type:"GET",path:t.map(u=>u.toString())}).then(y);return c.then.bind(c)}return W(e,[...t,s])},set(f,s,c){A(a);const[u,o]=k(c);return g(e,{type:"SET",path:[...t,s].map(i=>i.toString()),value:u},o).then(y)},apply(f,s,c){A(a);const u=t[t.length-1];if(u===N)return g(e,{type:"ENDPOINT"}).then(y);if(u==="bind")return W(e,t.slice(0,-1));const[o,i]=v(c);return g(e,{type:"APPLY",path:t.map(d=>d.toString()),argumentList:o},i).then(y)},construct(f,s){A(a);const[c,u]=v(s);return g(e,{type:"CONSTRUCT",path:t.map(o=>o.toString()),argumentList:c},u).then(y)}});return $(n,e),n}function D(e){return Array.prototype.concat.apply([],e)}function v(e){const t=e.map(k);return[t.map(r=>r[0]),D(t.map(r=>r[1]))]}const L=new WeakMap;function G(e,t){return L.set(e,t),e}function T(e){return Object.assign(e,{[x]:!0})}function k(e){for(const[t,r]of C)if(r.canHandle(e)){const[a,n]=r.serialize(e);return[{type:"HANDLER",name:t,value:a},n]}return[{type:"RAW",value:e},L.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return C.get(e.name).deserialize(e.value);case"RAW":return e.value}}function g(e,t,r){return new Promise(a=>{const n=q();e.addEventListener("message",function f(s){!s.data||!s.data.id||s.data.id!==n||(e.removeEventListener("message",f),a(s.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:n},t),r)})}function q(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const Y=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),X=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1])),J=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,208,112,26,11])),K=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,12,1,10,0,67,0,0,0,0,252,0,26,11])),Q=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,65,0,192,26,11])),Z=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),ee=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));function te(){return/iOS|iPhone|iPad|iPod/i.test(navigator.userAgent)}async function re(){if(!await ee())return!1;if(!("importScripts"in self))throw Error("Not implemented");return te()?!1:"Worker"in self}async function ne(){const e=[X(),J(),Y(),K(),Q()];if(!(await Promise.all(e)).every(Boolean))throw new Error("Browser doesn't meet minimum requirements!");return await Z()?await re()?"advanced-threads":"advanced":"basic"}let p,w;async function se(){const e=await ne();console.log(`Requesting ${e} Wasm build`);const t=self.location.href,r=t.substring(0,t.lastIndexOf("/")),a=`${r}/${e}/capture-wasm.js`;try{importScripts(a)}catch(n){console.error("loading scripts failed",n)}return p=await self.createModule({locateFile:n=>`${r}/${e}/${n}`,mainScriptUrlOrBlob:a.toString(),setStatus:n=>{}}),p[m]=()=>{console.log("finalizer wasmModule")},T(p)}function ae(){return p||console.warn("Wasm is not initialized yet. Call loadWasm() first."),w=new p.Analyzer,w[m]=()=>{console.log("Comlink.finalizer called on Analyzer instance. Deleting instance."),w.delete()},T(w)}function oe(e){const t=w.analyze(e);return self.postMessage({},[e.data.buffer]),e=null,t}const U={createAnalyzer:ae,loadWasm:se,analyze:oe,terminate:()=>self.close(),[m]:()=>{console.log("Comlink.finalizer called on proxyWorker")}};return M(U),P.proxyWorker=U,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),P}({});
|
package/package.json
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microblink/capture",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "",
|
|
4
4
|
"homepage": "https://microblink.com/",
|
|
5
|
-
"repository":
|
|
6
|
-
|
|
7
|
-
"url": "git+https://github.com/BlinkID/capture-browser.git"
|
|
8
|
-
},
|
|
9
|
-
"version": "1.0.0",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"rollup": "api-extractor run --local --verbose",
|
|
12
|
-
"build:js": "vite build",
|
|
13
|
-
"build:js-dev": "vite build --mode development",
|
|
14
|
-
"build:types": "tsc && tsx duplicate-types.mts",
|
|
15
|
-
"build": "concurrently -m 1 pnpm:build:js pnpm:build:types pnpm:rollup",
|
|
16
|
-
"build:dev": "concurrently pnpm:build:js-dev pnpm:build:types",
|
|
17
|
-
"lint:types": "tsc --emitDeclarationOnly false --noEmit",
|
|
18
|
-
"lint:package": "publint && attw --pack . --exclude-entrypoints style.css ",
|
|
19
|
-
"lint": "concurrently pnpm:lint:types pnpm:lint:package",
|
|
20
|
-
"clean": "rimraf .turbo types dist public *.tsbuildinfo"
|
|
21
|
-
},
|
|
5
|
+
"repository": "github:BlinkID/capture-browser",
|
|
6
|
+
"version": "1.0.3",
|
|
22
7
|
"type": "module",
|
|
23
8
|
"files": [
|
|
24
9
|
"dist",
|
|
@@ -43,20 +28,31 @@
|
|
|
43
28
|
},
|
|
44
29
|
"devDependencies": {
|
|
45
30
|
"@arethetypeswrong/cli": "^0.7.0",
|
|
46
|
-
"@mb/utils": "workspace:^",
|
|
47
31
|
"@microsoft/api-extractor": "^7.36.3",
|
|
48
32
|
"concurrently": "^8.2.0",
|
|
49
33
|
"publint": "^0.1.16",
|
|
50
34
|
"rimraf": "^5.0.1",
|
|
51
35
|
"solid-js": "^1.7.8",
|
|
52
|
-
"tsconfig": "workspace:*",
|
|
53
36
|
"tsx": "^3.12.7",
|
|
54
37
|
"vite": "^4.4.6",
|
|
55
|
-
"zx": "^7.2.3"
|
|
38
|
+
"zx": "^7.2.3",
|
|
39
|
+
"@mb/utils": "^0.0.0",
|
|
40
|
+
"tsconfig": "0.0.0"
|
|
56
41
|
},
|
|
57
|
-
"
|
|
58
|
-
"
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"capture-main": "^1.0.0",
|
|
44
|
+
"capture-ui": "^1.0.1"
|
|
59
45
|
},
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
"scripts": {
|
|
47
|
+
"rollup": "api-extractor run --local --verbose",
|
|
48
|
+
"build:js": "vite build",
|
|
49
|
+
"build:js-dev": "vite build --mode development",
|
|
50
|
+
"build:types": "tsc && tsx duplicate-types.mts",
|
|
51
|
+
"build": "concurrently -m 1 pnpm:build:js pnpm:build:types pnpm:rollup",
|
|
52
|
+
"build:dev": "concurrently pnpm:build:js-dev pnpm:build:types",
|
|
53
|
+
"lint:types": "tsc --emitDeclarationOnly false --noEmit",
|
|
54
|
+
"lint:package": "publint && attw --pack . --exclude-entrypoints style.css ",
|
|
55
|
+
"lint": "concurrently pnpm:lint:types pnpm:lint:package",
|
|
56
|
+
"clean": "rimraf .turbo types dist public *.tsbuildinfo"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/types/index.d.ts
CHANGED