mirror of https://github.com/vladmandic/human
detect react-native
parent
870433ece2
commit
6fb4d04df3
|
@ -9,11 +9,11 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2023/01/29 mandic00@live.com
|
||||
|
||||
|
||||
### **3.0.4** 2023/01/29 mandic00@live.com
|
||||
|
||||
|
||||
### **origin/main** 2023/01/21 mandic00@live.com
|
||||
|
||||
- make naviator calls safe
|
||||
- fix facedetector-only configs
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -31963,11 +31963,20 @@ function canvas(width, height) {
|
|||
throw new Error("canvas error: attempted to run in web worker but OffscreenCanvas is not supported");
|
||||
c = new OffscreenCanvas(width, height);
|
||||
} else {
|
||||
if (typeof document === "undefined")
|
||||
if (typeof document !== "undefined") {
|
||||
c = document.createElement("canvas");
|
||||
c.width = width;
|
||||
c.height = height;
|
||||
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
||||
if (typeof env.Canvas !== "undefined")
|
||||
c = new env.Canvas(width, height);
|
||||
else if (typeof globalThis.Canvas !== "undefined")
|
||||
c = new globalThis.Canvas(width, height);
|
||||
else
|
||||
throw new Error("canvas error: attempted to use canvas in react-native without canvas support installed");
|
||||
} else {
|
||||
throw new Error("canvas error: attempted to run in browser but DOM is not defined");
|
||||
c = document.createElement("canvas");
|
||||
c.width = width;
|
||||
c.height = height;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (typeof env.Canvas !== "undefined")
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -80,7 +80,7 @@
|
|||
"devDependencies": {
|
||||
"@html-eslint/eslint-plugin": "^0.16.0",
|
||||
"@html-eslint/parser": "^0.16.0",
|
||||
"@microsoft/api-extractor": "^7.34.0",
|
||||
"@microsoft/api-extractor": "^7.34.1",
|
||||
"@tensorflow/tfjs-backend-cpu": "^4.2.0",
|
||||
"@tensorflow/tfjs-backend-wasm": "^4.2.0",
|
||||
"@tensorflow/tfjs-backend-webgl": "^4.2.0",
|
||||
|
@ -91,8 +91,8 @@
|
|||
"@tensorflow/tfjs-node-gpu": "^4.2.0",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/offscreencanvas": "^2019.7.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
||||
"@typescript-eslint/parser": "^5.49.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
||||
"@typescript-eslint/parser": "^5.50.0",
|
||||
"@vladmandic/build": "^0.7.15",
|
||||
"@vladmandic/pilogger": "^0.4.7",
|
||||
"@vladmandic/tfjs": "github:vladmandic/tfjs",
|
||||
|
@ -109,6 +109,6 @@
|
|||
"rimraf": "^4.1.2",
|
||||
"tslib": "^2.5.0",
|
||||
"typedoc": "0.23.24",
|
||||
"typescript": "4.9.4"
|
||||
"typescript": "4.9.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,18 @@ export function canvas(width: number, height: number): AnyCanvas {
|
|||
if (typeof OffscreenCanvas === 'undefined') throw new Error('canvas error: attempted to run in web worker but OffscreenCanvas is not supported');
|
||||
c = new OffscreenCanvas(width, height);
|
||||
} else { // otherwise use DOM canvas
|
||||
if (typeof document === 'undefined') throw new Error('canvas error: attempted to run in browser but DOM is not defined');
|
||||
c = document.createElement('canvas');
|
||||
c.width = width;
|
||||
c.height = height;
|
||||
if (typeof document !== 'undefined') {
|
||||
c = document.createElement('canvas');
|
||||
c.width = width;
|
||||
c.height = height;
|
||||
} else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
||||
// @ts-ignore // env.canvas is an external monkey-patch
|
||||
if (typeof env.Canvas !== 'undefined') c = new env.Canvas(width, height);
|
||||
else if (typeof globalThis.Canvas !== 'undefined') c = new globalThis.Canvas(width, height);
|
||||
else throw new Error('canvas error: attempted to use canvas in react-native without canvas support installed');
|
||||
} else {
|
||||
throw new Error('canvas error: attempted to run in browser but DOM is not defined');
|
||||
}
|
||||
}
|
||||
} else { // if not running in browser, there is no "default" canvas object, so we need monkey patch or fail
|
||||
// @ts-ignore // env.canvas is an external monkey-patch
|
||||
|
|
100
test/build.log
100
test/build.log
|
@ -1,50 +1,50 @@
|
|||
2023-01-29 12:08:34 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"3.0.4"}
|
||||
2023-01-29 12:08:34 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"3.0.4"}
|
||||
2023-01-29 12:08:34 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2023-01-29 12:08:34 [36mINFO: [39m Toolchain: {"build":"0.7.15","esbuild":"0.16.17","typescript":"4.9.4","typedoc":"0.23.24","eslint":"8.33.0"}
|
||||
2023-01-29 12:08:34 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1289,"outputBytes":361}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":569,"outputBytes":924}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":80,"inputBytes":672214,"outputBytes":318024}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":577,"outputBytes":928}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":80,"inputBytes":672218,"outputBytes":318028}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":665,"outputBytes":1876}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":80,"inputBytes":673166,"outputBytes":318139}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1375,"outputBytes":670}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":80,"inputBytes":671960,"outputBytes":316599}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":10,"inputBytes":1375,"outputBytes":1151306}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":80,"inputBytes":1822596,"outputBytes":1463846}
|
||||
2023-01-29 12:08:34 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":80,"inputBytes":1822596,"outputBytes":1929881}
|
||||
2023-01-29 12:08:38 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":15}
|
||||
2023-01-29 12:08:40 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
||||
2023-01-29 12:08:40 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6117,"outputBytes":2901}
|
||||
2023-01-29 12:08:40 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":17503,"outputBytes":9403}
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m Lint: {"locations":["**/*.json","src/**/*.ts","test/**/*.js","demo/**/*.js","**/*.md"],"files":169,"errors":0,"warnings":0}
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs-core.d.ts","output":"types/tfjs-core.d.ts"}
|
||||
2023-01-29 12:08:50 [36mINFO: [39m Done...
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs.d.ts","output":"types/tfjs.esm.d.ts"}
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m Copy: {"input":"src/types/tsconfig.json","output":"types/tsconfig.json"}
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m Copy: {"input":"src/types/eslint.json","output":"types/.eslintrc.json"}
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m Copy: {"input":"src/types/tfjs.esm.d.ts","output":"dist/tfjs.esm.d.ts"}
|
||||
2023-01-29 12:08:50 [35mSTATE:[39m Filter: {"input":"types/tfjs-core.d.ts"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":204}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Filter: {"input":"types/human.d.ts"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Write: {"output":"dist/human.esm-nobundle.d.ts"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Write: {"output":"dist/human.esm.d.ts"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Write: {"output":"dist/human.d.ts"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Write: {"output":"dist/human.node-gpu.d.ts"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Write: {"output":"dist/human.node.d.ts"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Write: {"output":"dist/human.node-wasm.d.ts"}
|
||||
2023-01-29 12:08:51 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"./models","models":12}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"../human-models/models","models":41}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2023-01-29 12:08:51 [35mSTATE:[39m Models: {"count":55,"totalSize":372917743}
|
||||
2023-01-29 12:08:51 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
2023-01-31 08:51:47 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"3.0.4"}
|
||||
2023-01-31 08:51:47 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"3.0.4"}
|
||||
2023-01-31 08:51:47 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2023-01-31 08:51:47 [36mINFO: [39m Toolchain: {"build":"0.7.15","esbuild":"0.16.17","typescript":"4.9.5","typedoc":"0.23.24","eslint":"8.33.0"}
|
||||
2023-01-31 08:51:47 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1289,"outputBytes":361}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":569,"outputBytes":924}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":80,"inputBytes":672712,"outputBytes":318340}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":577,"outputBytes":928}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":80,"inputBytes":672716,"outputBytes":318344}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":665,"outputBytes":1876}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":80,"inputBytes":673664,"outputBytes":318455}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1375,"outputBytes":670}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":80,"inputBytes":672458,"outputBytes":316915}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":10,"inputBytes":1375,"outputBytes":1151306}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":80,"inputBytes":1823094,"outputBytes":1464164}
|
||||
2023-01-31 08:51:47 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":80,"inputBytes":1823094,"outputBytes":1930337}
|
||||
2023-01-31 08:51:51 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":15}
|
||||
2023-01-31 08:51:53 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
|
||||
2023-01-31 08:51:53 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6117,"outputBytes":2901}
|
||||
2023-01-31 08:51:53 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":17503,"outputBytes":9403}
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m Lint: {"locations":["**/*.json","src/**/*.ts","test/**/*.js","demo/**/*.js","**/*.md"],"files":169,"errors":0,"warnings":0}
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs-core.d.ts","output":"types/tfjs-core.d.ts"}
|
||||
2023-01-31 08:52:02 [36mINFO: [39m Done...
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs.d.ts","output":"types/tfjs.esm.d.ts"}
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m Copy: {"input":"src/types/tsconfig.json","output":"types/tsconfig.json"}
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m Copy: {"input":"src/types/eslint.json","output":"types/.eslintrc.json"}
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m Copy: {"input":"src/types/tfjs.esm.d.ts","output":"dist/tfjs.esm.d.ts"}
|
||||
2023-01-31 08:52:02 [35mSTATE:[39m Filter: {"input":"types/tfjs-core.d.ts"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":204}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Filter: {"input":"types/human.d.ts"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Write: {"output":"dist/human.esm-nobundle.d.ts"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Write: {"output":"dist/human.esm.d.ts"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Write: {"output":"dist/human.d.ts"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Write: {"output":"dist/human.node-gpu.d.ts"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Write: {"output":"dist/human.node.d.ts"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Write: {"output":"dist/human.node-wasm.d.ts"}
|
||||
2023-01-31 08:52:04 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"./models","models":12}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"../human-models/models","models":41}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2023-01-31 08:52:04 [35mSTATE:[39m Models: {"count":55,"totalSize":372917743}
|
||||
2023-01-31 08:52:04 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
|
|
2002
test/test.log
2002
test/test.log
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue