fix node detection in electron environment

pull/233/head
Vladimir Mandic 2021-12-07 17:02:33 -05:00
parent 0ea905ef6f
commit dc20a4df26
15 changed files with 764 additions and 755 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.vscode
node_modules
pnpm-lock.yaml
assets/tf*

View File

@ -9,11 +9,11 @@
## Changelog
### **HEAD -> main** 2021/12/01 mandic00@live.com
### **2.5.5** 2021/12/01 mandic00@live.com
### **origin/main** 2021/11/26 mandic00@live.com
- added human-motion
- add offscreencanvas typedefs
- release preview

View File

@ -1286,7 +1286,7 @@ var Env = class {
__publicField(this, "Image");
__publicField(this, "ImageData");
this.browser = typeof navigator !== "undefined";
this.node = typeof process !== "undefined";
this.node = typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
this.tfjs = { version: version9["tfjs-core"] };
this.offscreen = typeof OffscreenCanvas !== "undefined";
this.initial = true;

File diff suppressed because one or more lines are too long

12
dist/human.esm.js vendored
View File

@ -64429,8 +64429,12 @@ var makeBindGroup = (device, bindGroupLayout, inputs, output, uniforms) => {
var compileProgram2 = (device, program, pipelineLayout, inputsData, output, isFromPixel = false) => {
const outputData = { dtype: output.dtype, shape: output.shape };
const source = makeShader2(inputsData, outputData, program, isFromPixel);
const module = device.createShaderModule({ code: source });
const pipeline = device.createComputePipeline({ layout: pipelineLayout, compute: { module, entryPoint: "main" } });
const module = device.createShaderModule({ code: source, label: program.constructor.name });
const pipeline = device.createComputePipeline({
layout: pipelineLayout,
compute: { module, entryPoint: "main" },
label: program.constructor.name
});
return pipeline;
};
function makeShaderKey2(program, shapes, types, broadcastDimsKey = "", inputShapesEqualsOutShape = "") {
@ -70999,7 +71003,7 @@ registerBackend("wasm", async () => {
const { wasm } = await init();
return new BackendWasm(wasm);
}, WASM_PRIORITY);
var externalVersion = "3.11.0-20211201";
var externalVersion = "3.11.0-20211207";
var version8 = {
tfjs: externalVersion,
"tfjs-core": externalVersion,
@ -72041,7 +72045,7 @@ var Env = class {
__publicField(this, "Image");
__publicField(this, "ImageData");
this.browser = typeof navigator !== "undefined";
this.node = typeof process !== "undefined";
this.node = typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
this.tfjs = { version: version8["tfjs-core"] };
this.offscreen = typeof OffscreenCanvas !== "undefined";
this.initial = true;

File diff suppressed because one or more lines are too long

42
dist/human.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1303,7 +1303,7 @@ var Env = class {
__publicField(this, "Image");
__publicField(this, "ImageData");
this.browser = typeof navigator !== "undefined";
this.node = typeof process !== "undefined";
this.node = typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
this.tfjs = { version: tf3.version["tfjs-core"] };
this.offscreen = typeof OffscreenCanvas !== "undefined";
this.initial = true;

View File

@ -1304,7 +1304,7 @@ var Env = class {
__publicField(this, "Image");
__publicField(this, "ImageData");
this.browser = typeof navigator !== "undefined";
this.node = typeof process !== "undefined";
this.node = typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
this.tfjs = { version: tf3.version["tfjs-core"] };
this.offscreen = typeof OffscreenCanvas !== "undefined";
this.initial = true;

2
dist/human.node.js vendored
View File

@ -1303,7 +1303,7 @@ var Env = class {
__publicField(this, "Image");
__publicField(this, "ImageData");
this.browser = typeof navigator !== "undefined";
this.node = typeof process !== "undefined";
this.node = typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
this.tfjs = { version: tf3.version["tfjs-core"] };
this.offscreen = typeof OffscreenCanvas !== "undefined";
this.initial = true;

12
dist/tfjs.esm.js vendored
View File

@ -4,7 +4,7 @@
author: <https://github.com/vladmandic>'
*/
// node_modules/.pnpm/github.com+vladmandic+tfjs@d896c6c29a2fc558735bc257fce9451a8c59249d/node_modules/@vladmandic/tfjs/dist/tfjs.esm.js
// node_modules/.pnpm/github.com+vladmandic+tfjs@61d53a7c46cea516efb6efaf8c00c3b4a94db146/node_modules/@vladmandic/tfjs/dist/tfjs.esm.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@ -63724,8 +63724,12 @@ var makeBindGroup = (device, bindGroupLayout, inputs, output, uniforms) => {
var compileProgram2 = (device, program, pipelineLayout, inputsData, output, isFromPixel = false) => {
const outputData = { dtype: output.dtype, shape: output.shape };
const source = makeShader2(inputsData, outputData, program, isFromPixel);
const module = device.createShaderModule({ code: source });
const pipeline = device.createComputePipeline({ layout: pipelineLayout, compute: { module, entryPoint: "main" } });
const module = device.createShaderModule({ code: source, label: program.constructor.name });
const pipeline = device.createComputePipeline({
layout: pipelineLayout,
compute: { module, entryPoint: "main" },
label: program.constructor.name
});
return pipeline;
};
function makeShaderKey2(program, shapes, types, broadcastDimsKey = "", inputShapesEqualsOutShape = "") {
@ -70294,7 +70298,7 @@ registerBackend("wasm", async () => {
const { wasm } = await init();
return new BackendWasm(wasm);
}, WASM_PRIORITY);
var externalVersion = "3.11.0-20211201";
var externalVersion = "3.11.0-20211207";
var version8 = {
tfjs: externalVersion,
"tfjs-core": externalVersion,

View File

@ -53,7 +53,7 @@
"tensorflow"
],
"devDependencies": {
"@microsoft/api-extractor": "^7.18.19",
"@microsoft/api-extractor": "^7.18.21",
"@tensorflow/tfjs": "^3.11.0",
"@tensorflow/tfjs-backend-cpu": "^3.11.0",
"@tensorflow/tfjs-backend-wasm": "^3.11.0",
@ -65,17 +65,17 @@
"@tensorflow/tfjs-layers": "^3.11.0",
"@tensorflow/tfjs-node": "^3.11.0",
"@tensorflow/tfjs-node-gpu": "^3.11.0",
"@types/node": "^16.11.11",
"@types/node": "^16.11.12",
"@types/offscreencanvas": "^2019.6.4",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"@vladmandic/build": "^0.6.6",
"@vladmandic/pilogger": "^0.3.5",
"@vladmandic/tfjs": "github:vladmandic/tfjs",
"canvas": "^2.8.0",
"dayjs": "^1.10.7",
"esbuild": "^0.14.1",
"eslint": "8.3.0",
"esbuild": "^0.14.2",
"eslint": "8.4.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.3",

View File

@ -80,7 +80,7 @@ export class Env {
constructor() {
this.browser = typeof navigator !== 'undefined';
this.node = typeof process !== 'undefined';
this.node = (typeof process !== 'undefined') && (typeof process.versions !== 'undefined') && (typeof process.versions.node !== 'undefined');
this.tfjs = { version: tf.version['tfjs-core'] };
this.offscreen = typeof OffscreenCanvas !== 'undefined';
this.initial = true;

View File

@ -1,24 +1,24 @@
2021-12-01 08:21:59 INFO:  Application: {"name":"@vladmandic/human","version":"2.5.5"}
2021-12-01 08:21:59 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2021-12-01 08:21:59 INFO:  Toolchain: {"build":"0.6.6","esbuild":"0.13.15","typescript":"4.5.2","typedoc":"0.22.10","eslint":"8.3.0"}
2021-12-01 08:21:59 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-12-01 08:21:59 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2021-12-01 08:21:59 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1275}
2021-12-01 08:21:59 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":63,"inputBytes":556381,"outputBytes":464684}
2021-12-01 08:21:59 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1283}
2021-12-01 08:21:59 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":63,"inputBytes":556389,"outputBytes":464688}
2021-12-01 08:21:59 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1350}
2021-12-01 08:21:59 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":63,"inputBytes":556456,"outputBytes":464760}
2021-12-01 08:21:59 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1652}
2021-12-01 08:21:59 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2326,"outputBytes":912}
2021-12-01 08:22:00 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":63,"inputBytes":556018,"outputBytes":466446}
2021-12-01 08:22:00 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":2516112}
2021-12-01 08:22:00 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":63,"inputBytes":3071218,"outputBytes":1632539}
2021-12-01 08:22:01 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":63,"inputBytes":3071218,"outputBytes":2989379}
2021-12-01 08:22:22 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":110}
2021-12-01 08:22:29 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":52,"generated":true}
2021-12-01 08:22:29 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5864,"outputBytes":4127}
2021-12-01 08:22:29 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15174,"outputBytes":11794}
2021-12-01 08:23:05 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":93,"errors":0,"warnings":0}
2021-12-01 08:23:05 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-12-01 08:23:05 INFO:  Done...
2021-12-07 16:58:02 INFO:  Application: {"name":"@vladmandic/human","version":"2.5.5"}
2021-12-07 16:58:02 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2021-12-07 16:58:02 INFO:  Toolchain: {"build":"0.6.6","esbuild":"0.13.15","typescript":"4.5.2","typedoc":"0.22.10","eslint":"8.4.1"}
2021-12-07 16:58:02 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-12-07 16:58:02 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2021-12-07 16:58:02 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1275}
2021-12-07 16:58:02 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":63,"inputBytes":556478,"outputBytes":464775}
2021-12-07 16:58:02 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1283}
2021-12-07 16:58:03 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":63,"inputBytes":556486,"outputBytes":464779}
2021-12-07 16:58:03 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1350}
2021-12-07 16:58:03 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":63,"inputBytes":556553,"outputBytes":464851}
2021-12-07 16:58:03 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1652}
2021-12-07 16:58:03 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2326,"outputBytes":912}
2021-12-07 16:58:03 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":63,"inputBytes":556115,"outputBytes":466537}
2021-12-07 16:58:03 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":2516192}
2021-12-07 16:58:03 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":63,"inputBytes":3071395,"outputBytes":1632670}
2021-12-07 16:58:04 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":63,"inputBytes":3071395,"outputBytes":2989550}
2021-12-07 16:58:27 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":110}
2021-12-07 16:58:38 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":52,"generated":true}
2021-12-07 16:58:38 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5864,"outputBytes":4127}
2021-12-07 16:58:38 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15174,"outputBytes":11794}
2021-12-07 16:59:27 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":93,"errors":0,"warnings":0}
2021-12-07 16:59:27 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-12-07 16:59:27 INFO:  Done...

File diff suppressed because it is too large Load Diff