chore: update node_modules with new binary files and dependencies

- Add new binary files for nodemon, onnxruntime-web, and xenova/transformers
- Update various JavaScript and TypeScript files in node_modules
- Remove unused files and dependencies
- Add new test fixtures and documentation files
This commit is contained in:
你的名字
2025-07-18 08:41:48 +08:00
parent db8c0adc79
commit 4c2f5c69a1
4655 changed files with 811329 additions and 35112 deletions

29
node_modules/onnxruntime-node/README.md generated vendored Normal file
View File

@@ -0,0 +1,29 @@
# ONNX Runtime Node.js Binding
ONNX Runtime Node.js binding enables Node.js applications to run ONNX model inference.
## Usage
Install the latest stable version:
```
npm install onnxruntime-node
```
Refer to [ONNX Runtime JavaScript examples](https://github.com/microsoft/onnxruntime-inference-examples/tree/main/js) for samples and tutorials.
## Requirements
ONNXRuntime works on Node.js v12.x+ or Electron v5.x+.
Following platforms are supported with pre-built binaries:
- Windows x64 CPU NAPI_v3
- Linux x64 CPU NAPI_v3
- MacOS x64 CPU NAPI_v3
To use on platforms without pre-built binaries, you can build Node.js binding from source and consume it by `npm install <onnxruntime_repo_root>/js/node/`. See also [instructions](https://www.onnxruntime.ai/docs/how-to/build.html#apis-and-language-bindings) for building ONNX Runtime Node.js binding locally.
## License
License information can be found [here](https://github.com/microsoft/onnxruntime/blob/main/README.md#license).

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

7
node_modules/onnxruntime-node/dist/backend.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import { Backend, InferenceSession, SessionHandler } from 'onnxruntime-common';
declare class OnnxruntimeBackend implements Backend {
init(): Promise<void>;
createSessionHandler(pathOrBuffer: string | Uint8Array, options?: InferenceSession.SessionOptions): Promise<SessionHandler>;
}
export declare const onnxruntimeBackend: OnnxruntimeBackend;
export {};

75
node_modules/onnxruntime-node/dist/backend.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _OnnxruntimeSessionHandler_inferenceSession;
Object.defineProperty(exports, "__esModule", { value: true });
exports.onnxruntimeBackend = void 0;
const binding_1 = require("./binding");
class OnnxruntimeSessionHandler {
constructor(pathOrBuffer, options) {
_OnnxruntimeSessionHandler_inferenceSession.set(this, void 0);
__classPrivateFieldSet(this, _OnnxruntimeSessionHandler_inferenceSession, new binding_1.binding.InferenceSession(), "f");
if (typeof pathOrBuffer === 'string') {
__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
}
else {
__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer.buffer, pathOrBuffer.byteOffset, pathOrBuffer.byteLength, options);
}
this.inputNames = __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").inputNames;
this.outputNames = __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").outputNames;
}
async dispose() {
return Promise.resolve();
}
startProfiling() {
// TODO: implement profiling
}
endProfiling() {
// TODO: implement profiling
}
async run(feeds, fetches, options) {
return new Promise((resolve, reject) => {
process.nextTick(() => {
try {
resolve(__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").run(feeds, fetches, options));
}
catch (e) {
// reject if any error is thrown
reject(e);
}
});
});
}
}
_OnnxruntimeSessionHandler_inferenceSession = new WeakMap();
class OnnxruntimeBackend {
async init() {
return Promise.resolve();
}
async createSessionHandler(pathOrBuffer, options) {
return new Promise((resolve, reject) => {
process.nextTick(() => {
try {
resolve(new OnnxruntimeSessionHandler(pathOrBuffer, options || {}));
}
catch (e) {
// reject if any error is thrown
reject(e);
}
});
});
}
}
exports.onnxruntimeBackend = new OnnxruntimeBackend();
//# sourceMappingURL=backend.js.map

1
node_modules/onnxruntime-node/dist/backend.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../lib/backend.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;;;;;;;;;;AAIlC,uCAA2C;AAE3C,MAAM,yBAAyB;IAG7B,YAAY,YAA+B,EAAE,OAAwC;QAFrF,8DAA4C;QAG1C,uBAAA,IAAI,+CAAqB,IAAI,iBAAO,CAAC,gBAAgB,EAAE,MAAA,CAAC;QACxD,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;YACpC,uBAAA,IAAI,mDAAkB,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;SACzD;aAAM;YACL,uBAAA,IAAI,mDAAkB,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;SAClH;QACD,IAAI,CAAC,UAAU,GAAG,uBAAA,IAAI,mDAAkB,CAAC,UAAU,CAAC;QACpD,IAAI,CAAC,WAAW,GAAG,uBAAA,IAAI,mDAAkB,CAAC,WAAW,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAKD,cAAc;QACZ,4BAA4B;IAC9B,CAAC;IACD,YAAY;QACV,4BAA4B;IAC9B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,KAA+B,EAAE,OAAmC,EAAE,OAAoC;QAElH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACpB,IAAI;oBACF,OAAO,CAAC,uBAAA,IAAI,mDAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;iBAC9D;gBAAC,OAAO,CAAC,EAAE;oBACV,gCAAgC;oBAChC,MAAM,CAAC,CAAC,CAAC,CAAC;iBACX;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;;AAED,MAAM,kBAAkB;IACtB,KAAK,CAAC,IAAI;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,YAA+B,EAAE,OAAyC;QAEnG,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACpB,IAAI;oBACF,OAAO,CAAC,IAAI,yBAAyB,CAAC,YAAY,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;iBACrE;gBAAC,OAAO,CAAC,EAAE;oBACV,gCAAgC;oBAChC,MAAM,CAAC,CAAC,CAAC,CAAC;iBACX;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAEY,QAAA,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC"}

31
node_modules/onnxruntime-node/dist/binding.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import { InferenceSession, OnnxValue } from 'onnxruntime-common';
type SessionOptions = InferenceSession.SessionOptions;
type FeedsType = {
[name: string]: OnnxValue;
};
type FetchesType = {
[name: string]: OnnxValue | null;
};
type ReturnType = {
[name: string]: OnnxValue;
};
type RunOptions = InferenceSession.RunOptions;
/**
* Binding exports a simple synchronized inference session object wrap.
*/
export declare namespace Binding {
interface InferenceSession {
loadModel(modelPath: string, options: SessionOptions): void;
loadModel(buffer: ArrayBuffer, byteOffset: number, byteLength: number, options: SessionOptions): void;
readonly inputNames: string[];
readonly outputNames: string[];
run(feeds: FeedsType, fetches: FetchesType, options: RunOptions): ReturnType;
}
interface InferenceSessionConstructor {
new (): InferenceSession;
}
}
export declare const binding: {
InferenceSession: Binding.InferenceSessionConstructor;
};
export {};

10
node_modules/onnxruntime-node/dist/binding.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.binding = void 0;
// export native binding
exports.binding =
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
require(`../bin/napi-v3/${process.platform}/${process.arch}/onnxruntime_binding.node`);
//# sourceMappingURL=binding.js.map

1
node_modules/onnxruntime-node/dist/binding.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../lib/binding.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAoClC,wBAAwB;AACX,QAAA,OAAO;AAChB,qGAAqG;AACrG,OAAO,CAAC,kBAAkB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,2BAA2B,CAE9B,CAAC"}

1
node_modules/onnxruntime-node/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from 'onnxruntime-common';

23
node_modules/onnxruntime-node/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("onnxruntime-common"), exports);
const onnxruntime_common_1 = require("onnxruntime-common");
const backend_1 = require("./backend");
(0, onnxruntime_common_1.registerBackend)('cpu', backend_1.onnxruntimeBackend, 100);
//# sourceMappingURL=index.js.map

1
node_modules/onnxruntime-node/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;;;;;;;;;;;AAElC,qDAAmC;AACnC,2DAAmD;AACnD,uCAA6C;AAE7C,IAAA,oCAAe,EAAC,KAAK,EAAE,4BAAkB,EAAE,GAAG,CAAC,CAAC"}

71
node_modules/onnxruntime-node/lib/backend.ts generated vendored Normal file
View File

@@ -0,0 +1,71 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {Backend, InferenceSession, SessionHandler} from 'onnxruntime-common';
import {Binding, binding} from './binding';
class OnnxruntimeSessionHandler implements SessionHandler {
#inferenceSession: Binding.InferenceSession;
constructor(pathOrBuffer: string|Uint8Array, options: InferenceSession.SessionOptions) {
this.#inferenceSession = new binding.InferenceSession();
if (typeof pathOrBuffer === 'string') {
this.#inferenceSession.loadModel(pathOrBuffer, options);
} else {
this.#inferenceSession.loadModel(pathOrBuffer.buffer, pathOrBuffer.byteOffset, pathOrBuffer.byteLength, options);
}
this.inputNames = this.#inferenceSession.inputNames;
this.outputNames = this.#inferenceSession.outputNames;
}
async dispose(): Promise<void> {
return Promise.resolve();
}
readonly inputNames: string[];
readonly outputNames: string[];
startProfiling(): void {
// TODO: implement profiling
}
endProfiling(): void {
// TODO: implement profiling
}
async run(feeds: SessionHandler.FeedsType, fetches: SessionHandler.FetchesType, options: InferenceSession.RunOptions):
Promise<SessionHandler.ReturnType> {
return new Promise((resolve, reject) => {
process.nextTick(() => {
try {
resolve(this.#inferenceSession.run(feeds, fetches, options));
} catch (e) {
// reject if any error is thrown
reject(e);
}
});
});
}
}
class OnnxruntimeBackend implements Backend {
async init(): Promise<void> {
return Promise.resolve();
}
async createSessionHandler(pathOrBuffer: string|Uint8Array, options?: InferenceSession.SessionOptions):
Promise<SessionHandler> {
return new Promise((resolve, reject) => {
process.nextTick(() => {
try {
resolve(new OnnxruntimeSessionHandler(pathOrBuffer, options || {}));
} catch (e) {
// reject if any error is thrown
reject(e);
}
});
});
}
}
export const onnxruntimeBackend = new OnnxruntimeBackend();

43
node_modules/onnxruntime-node/lib/binding.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {InferenceSession, OnnxValue} from 'onnxruntime-common';
type SessionOptions = InferenceSession.SessionOptions;
type FeedsType = {
[name: string]: OnnxValue;
};
type FetchesType = {
[name: string]: OnnxValue|null;
};
type ReturnType = {
[name: string]: OnnxValue;
};
type RunOptions = InferenceSession.RunOptions;
/**
* Binding exports a simple synchronized inference session object wrap.
*/
export declare namespace Binding {
export interface InferenceSession {
loadModel(modelPath: string, options: SessionOptions): void;
loadModel(buffer: ArrayBuffer, byteOffset: number, byteLength: number, options: SessionOptions): void;
readonly inputNames: string[];
readonly outputNames: string[];
run(feeds: FeedsType, fetches: FetchesType, options: RunOptions): ReturnType;
}
export interface InferenceSessionConstructor {
new(): InferenceSession;
}
}
// export native binding
export const binding =
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
require(`../bin/napi-v3/${process.platform}/${process.arch}/onnxruntime_binding.node`) as
// eslint-disable-next-line @typescript-eslint/naming-convention
{InferenceSession: Binding.InferenceSessionConstructor};

8
node_modules/onnxruntime-node/lib/index.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
export * from 'onnxruntime-common';
import {registerBackend} from 'onnxruntime-common';
import {onnxruntimeBackend} from './backend';
registerBackend('cpu', onnxruntimeBackend, 100);

58
node_modules/onnxruntime-node/package.json generated vendored Normal file
View File

@@ -0,0 +1,58 @@
{
"license": "MIT",
"name": "onnxruntime-node",
"repository": {
"url": "https://github.com/Microsoft/onnxruntime.git",
"type": "git"
},
"author": "fs-eire",
"binary": {
"module_path": "./bin",
"host": "https://onnxruntimetestdata.blob.core.windows.net/onnxruntime-node-prebuild/",
"napi_versions": [
3
]
},
"version": "1.14.0",
"dependencies": {
"onnxruntime-common": "~1.14.0"
},
"scripts": {
"buildr": "tsc && node ./script/build --config=RelWithDebInfo",
"prepare": "tsc --build script test .",
"rebuild": "tsc && node ./script/build --rebuild",
"rebuildd": "tsc && node ./script/build --rebuild --config=Debug",
"buildd": "tsc && node ./script/build --config=Debug",
"build": "tsc && node ./script/build",
"test": "tsc --build ../scripts && node ../scripts/prepare-onnx-node-tests && mocha ./test/test-main",
"prepack": "node ./script/prepack",
"rebuildr": "tsc && node ./script/build --rebuild --config=RelWithDebInfo"
},
"keywords": [
"ONNX",
"ONNXRuntime",
"ONNX Runtime"
],
"devDependencies": {
"@types/fs-extra": "^9.0.6",
"@types/minimist": "^1.2.2",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.37",
"cmake-js": "^6.2.1",
"fs-extra": "^9.1.0",
"jsonc": "^2.0.0",
"minimist": "^1.2.7",
"mocha": "^10.2.0",
"node-addon-api": "^3.1.0",
"onnx-proto": "^4.0.4",
"typescript": "^4.9.4"
},
"main": "dist/index.js",
"os": [
"win32",
"darwin",
"linux"
],
"types": "dist/index.d.ts",
"description": "ONNXRuntime Node.js binding"
}