onnxruntime-node 1.19.2 → 1.20.0

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.
Files changed (29) hide show
  1. package/bin/napi-v3/darwin/arm64/{libonnxruntime.1.19.2.dylib → libonnxruntime.1.20.0.dylib} +0 -0
  2. package/bin/napi-v3/darwin/arm64/onnxruntime_binding.node +0 -0
  3. package/bin/napi-v3/darwin/x64/{libonnxruntime.1.19.2.dylib → libonnxruntime.1.20.0.dylib} +0 -0
  4. package/bin/napi-v3/darwin/x64/onnxruntime_binding.node +0 -0
  5. package/bin/napi-v3/linux/arm64/libonnxruntime.so.1 +0 -0
  6. package/bin/napi-v3/linux/arm64/{libonnxruntime.so.1.19.2 → libonnxruntime.so.1.20.0} +0 -0
  7. package/bin/napi-v3/linux/arm64/onnxruntime_binding.node +0 -0
  8. package/bin/napi-v3/linux/x64/libonnxruntime.so.1 +0 -0
  9. package/bin/napi-v3/linux/x64/{libonnxruntime.so.1.19.2 → libonnxruntime.so.1.20.0} +0 -0
  10. package/bin/napi-v3/linux/x64/onnxruntime_binding.node +0 -0
  11. package/bin/napi-v3/win32/arm64/DirectML.dll +0 -0
  12. package/bin/napi-v3/win32/arm64/onnxruntime.dll +0 -0
  13. package/bin/napi-v3/win32/arm64/onnxruntime_binding.node +0 -0
  14. package/bin/napi-v3/win32/x64/DirectML.dll +0 -0
  15. package/bin/napi-v3/win32/x64/onnxruntime.dll +0 -0
  16. package/bin/napi-v3/win32/x64/onnxruntime_binding.node +0 -0
  17. package/dist/backend.js.map +1 -1
  18. package/dist/binding.js.map +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/version.js +1 -1
  21. package/lib/backend.ts +12 -7
  22. package/lib/binding.ts +9 -10
  23. package/lib/index.ts +5 -5
  24. package/lib/version.ts +1 -1
  25. package/package.json +2 -2
  26. package/script/build.js +9 -5
  27. package/script/build.ts +15 -11
  28. package/script/install.js +15 -12
  29. package/script/prepack.ts +1 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ACL,CAAC;CACF;AAEY,QAAA,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAC9C,QAAA,qBAAqB,GAAG,iBAAO,CAAC,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"binding.js","sourceRoot":"","sources":["../lib/binding.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AA2ClC,wBAAwB;AACX,QAAA,OAAO;AAChB,qGAAqG;AACrG,OAAO,CAAC,kBAAkB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,2BAA2B,CAIxF,CAAC"}
1
+ {"version":3,"file":"binding.js","sourceRoot":"","sources":["../lib/binding.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AA0ClC,wBAAwB;AACX,QAAA,OAAO;AAClB,qGAAqG;AACrG,OAAO,CAAC,kBAAkB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,2BAA2B,CAIpF,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;;;;;;;;;;;;AAElC,qDAAmC;AACnC,qCAAgD;AAAxC,gHAAA,qBAAqB,OAAA;AAC7B,2DAAwD;AACxD,uCAAkC;AAClC,uCAAoE;AAEpE,MAAM,QAAQ,GAAG,IAAA,+BAAqB,GAAE,CAAC;AACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;IAC9B,IAAA,oCAAe,EAAC,OAAO,CAAC,IAAI,EAAE,4BAAkB,EAAE,GAAG,CAAC,CAAC;CACxD;AAED,MAAM,CAAC,cAAc,CAAC,wBAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,iBAAO,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;;;;;;;;;;;;AAElC,qDAAmC;AACnC,qCAAkD;AAAzC,gHAAA,qBAAqB,OAAA;AAC9B,2DAA0D;AAC1D,uCAAoC;AACpC,uCAAsE;AAEtE,MAAM,QAAQ,GAAG,IAAA,+BAAqB,GAAE,CAAC;AACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;IAC9B,IAAA,oCAAe,EAAC,OAAO,CAAC,IAAI,EAAE,4BAAkB,EAAE,GAAG,CAAC,CAAC;CACxD;AAED,MAAM,CAAC,cAAc,CAAC,wBAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,iBAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC"}
package/dist/version.js CHANGED
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.version = void 0;
6
6
  // This file is generated by /js/scripts/update-version.ts
7
7
  // Do not modify file content manually.
8
- exports.version = '1.19.2';
8
+ exports.version = '1.20.0';
9
9
  //# sourceMappingURL=version.js.map
package/lib/backend.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import {Backend, InferenceSession, InferenceSessionHandler, SessionHandler} from 'onnxruntime-common';
4
+ import { Backend, InferenceSession, InferenceSessionHandler, SessionHandler } from 'onnxruntime-common';
5
5
 
6
- import {Binding, binding} from './binding';
6
+ import { Binding, binding } from './binding';
7
7
 
8
8
  class OnnxruntimeSessionHandler implements InferenceSessionHandler {
9
9
  #inferenceSession: Binding.InferenceSession;
10
10
 
11
- constructor(pathOrBuffer: string|Uint8Array, options: InferenceSession.SessionOptions) {
11
+ constructor(pathOrBuffer: string | Uint8Array, options: InferenceSession.SessionOptions) {
12
12
  this.#inferenceSession = new binding.InferenceSession();
13
13
  if (typeof pathOrBuffer === 'string') {
14
14
  this.#inferenceSession.loadModel(pathOrBuffer, options);
@@ -33,8 +33,11 @@ class OnnxruntimeSessionHandler implements InferenceSessionHandler {
33
33
  // TODO: implement profiling
34
34
  }
35
35
 
36
- async run(feeds: SessionHandler.FeedsType, fetches: SessionHandler.FetchesType, options: InferenceSession.RunOptions):
37
- Promise<SessionHandler.ReturnType> {
36
+ async run(
37
+ feeds: SessionHandler.FeedsType,
38
+ fetches: SessionHandler.FetchesType,
39
+ options: InferenceSession.RunOptions,
40
+ ): Promise<SessionHandler.ReturnType> {
38
41
  return new Promise((resolve, reject) => {
39
42
  setImmediate(() => {
40
43
  try {
@@ -53,8 +56,10 @@ class OnnxruntimeBackend implements Backend {
53
56
  return Promise.resolve();
54
57
  }
55
58
 
56
- async createInferenceSessionHandler(pathOrBuffer: string|Uint8Array, options?: InferenceSession.SessionOptions):
57
- Promise<InferenceSessionHandler> {
59
+ async createInferenceSessionHandler(
60
+ pathOrBuffer: string | Uint8Array,
61
+ options?: InferenceSession.SessionOptions,
62
+ ): Promise<InferenceSessionHandler> {
58
63
  return new Promise((resolve, reject) => {
59
64
  setImmediate(() => {
60
65
  try {
package/lib/binding.ts CHANGED
@@ -1,21 +1,20 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import {InferenceSession, OnnxValue} from 'onnxruntime-common';
4
+ import { InferenceSession, OnnxValue } from 'onnxruntime-common';
5
5
 
6
6
  type SessionOptions = InferenceSession.SessionOptions;
7
7
  type FeedsType = {
8
8
  [name: string]: OnnxValue;
9
9
  };
10
10
  type FetchesType = {
11
- [name: string]: OnnxValue|null;
11
+ [name: string]: OnnxValue | null;
12
12
  };
13
13
  type ReturnType = {
14
14
  [name: string]: OnnxValue;
15
15
  };
16
16
  type RunOptions = InferenceSession.RunOptions;
17
17
 
18
-
19
18
  /**
20
19
  * Binding exports a simple synchronized inference session object wrap.
21
20
  */
@@ -33,7 +32,7 @@ export declare namespace Binding {
33
32
  }
34
33
 
35
34
  export interface InferenceSessionConstructor {
36
- new(): InferenceSession;
35
+ new (): InferenceSession;
37
36
  }
38
37
 
39
38
  export interface SupportedBackend {
@@ -44,9 +43,9 @@ export declare namespace Binding {
44
43
 
45
44
  // export native binding
46
45
  export const binding =
47
- // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
48
- require(`../bin/napi-v3/${process.platform}/${process.arch}/onnxruntime_binding.node`) as {
49
- // eslint-disable-next-line @typescript-eslint/naming-convention
50
- InferenceSession: Binding.InferenceSessionConstructor;
51
- listSupportedBackends: () => Binding.SupportedBackend[];
52
- };
46
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
47
+ require(`../bin/napi-v3/${process.platform}/${process.arch}/onnxruntime_binding.node`) as {
48
+ // eslint-disable-next-line @typescript-eslint/naming-convention
49
+ InferenceSession: Binding.InferenceSessionConstructor;
50
+ listSupportedBackends: () => Binding.SupportedBackend[];
51
+ };
package/lib/index.ts CHANGED
@@ -2,14 +2,14 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  export * from 'onnxruntime-common';
5
- export {listSupportedBackends} from './backend';
6
- import {registerBackend, env} from 'onnxruntime-common';
7
- import {version} from './version';
8
- import {onnxruntimeBackend, listSupportedBackends} from './backend';
5
+ export { listSupportedBackends } from './backend';
6
+ import { registerBackend, env } from 'onnxruntime-common';
7
+ import { version } from './version';
8
+ import { onnxruntimeBackend, listSupportedBackends } from './backend';
9
9
 
10
10
  const backends = listSupportedBackends();
11
11
  for (const backend of backends) {
12
12
  registerBackend(backend.name, onnxruntimeBackend, 100);
13
13
  }
14
14
 
15
- Object.defineProperty(env.versions, 'node', {value: version, enumerable: true});
15
+ Object.defineProperty(env.versions, 'node', { value: version, enumerable: true });
package/lib/version.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  // This file is generated by /js/scripts/update-version.ts
5
5
  // Do not modify file content manually.
6
6
 
7
- export const version = '1.19.2';
7
+ export const version = '1.20.0';
package/package.json CHANGED
@@ -13,9 +13,9 @@
13
13
  3
14
14
  ]
15
15
  },
16
- "version": "1.19.2",
16
+ "version": "1.20.0",
17
17
  "dependencies": {
18
- "onnxruntime-common": "1.19.2",
18
+ "onnxruntime-common": "1.20.0",
19
19
  "tar": "^7.0.1"
20
20
  },
21
21
  "scripts": {
package/script/build.js CHANGED
@@ -72,7 +72,7 @@ if (REBUILD) {
72
72
  }
73
73
  const args = [
74
74
  'cmake-js',
75
- (REBUILD ? 'reconfigure' : 'configure'),
75
+ REBUILD ? 'reconfigure' : 'configure',
76
76
  `--arch=${ARCH}`,
77
77
  '--CDnapi_build_version=6',
78
78
  `--CDCMAKE_BUILD_TYPE=${CONFIG}`,
@@ -113,9 +113,9 @@ if (os.platform() === 'darwin') {
113
113
  // In Windows, "npx cmake-js configure" uses a powershell script to detect the Visual Studio installation.
114
114
  // The script uses the environment variable LIB. If an invalid path is specified in LIB, the script will fail.
115
115
  // So we override the LIB environment variable to remove invalid paths.
116
- const envOverride = os.platform() === 'win32' && process.env.LIB ?
117
- { ...process.env, LIB: process.env.LIB.split(';').filter(fs.existsSync).join(';') } :
118
- process.env;
116
+ const envOverride = os.platform() === 'win32' && process.env.LIB
117
+ ? { ...process.env, LIB: process.env.LIB.split(';').filter(fs.existsSync).join(';') }
118
+ : process.env;
119
119
  // launch cmake-js configure
120
120
  const procCmakejs = (0, child_process_1.spawnSync)('npx', args, { shell: true, stdio: 'inherit', cwd: ROOT_FOLDER, env: envOverride });
121
121
  if (procCmakejs.status !== 0) {
@@ -125,7 +125,11 @@ if (procCmakejs.status !== 0) {
125
125
  process.exit(procCmakejs.status === null ? undefined : procCmakejs.status);
126
126
  }
127
127
  // launch cmake to build
128
- const procCmake = (0, child_process_1.spawnSync)('cmake', ['--build', '.', '--config', CONFIG], { shell: true, stdio: 'inherit', cwd: BUILD_FOLDER });
128
+ const procCmake = (0, child_process_1.spawnSync)('cmake', ['--build', '.', '--config', CONFIG], {
129
+ shell: true,
130
+ stdio: 'inherit',
131
+ cwd: BUILD_FOLDER,
132
+ });
129
133
  if (procCmake.status !== 0) {
130
134
  if (procCmake.error) {
131
135
  console.error(procCmake.error);
package/script/build.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import {spawnSync} from 'child_process';
4
+ import { spawnSync } from 'child_process';
5
5
  import * as fs from 'fs-extra';
6
6
  import minimist from 'minimist';
7
7
  import * as os from 'os';
@@ -11,13 +11,13 @@ import * as path from 'path';
11
11
  const buildArgs = minimist(process.argv.slice(2));
12
12
 
13
13
  // --config=Debug|Release|RelWithDebInfo
14
- const CONFIG: 'Debug'|'Release'|'RelWithDebInfo' =
15
- buildArgs.config || (os.platform() === 'win32' ? 'RelWithDebInfo' : 'Release');
14
+ const CONFIG: 'Debug' | 'Release' | 'RelWithDebInfo' =
15
+ buildArgs.config || (os.platform() === 'win32' ? 'RelWithDebInfo' : 'Release');
16
16
  if (CONFIG !== 'Debug' && CONFIG !== 'Release' && CONFIG !== 'RelWithDebInfo') {
17
17
  throw new Error(`unrecognized config: ${CONFIG}`);
18
18
  }
19
19
  // --arch=x64|ia32|arm64|arm
20
- const ARCH: 'x64'|'ia32'|'arm64'|'arm' = buildArgs.arch || os.arch();
20
+ const ARCH: 'x64' | 'ia32' | 'arm64' | 'arm' = buildArgs.arch || os.arch();
21
21
  if (ARCH !== 'x64' && ARCH !== 'ia32' && ARCH !== 'arm64' && ARCH !== 'arm') {
22
22
  throw new Error(`unrecognized architecture: ${ARCH}`);
23
23
  }
@@ -51,7 +51,7 @@ if (REBUILD) {
51
51
 
52
52
  const args = [
53
53
  'cmake-js',
54
- (REBUILD ? 'reconfigure' : 'configure'),
54
+ REBUILD ? 'reconfigure' : 'configure',
55
55
  `--arch=${ARCH}`,
56
56
  '--CDnapi_build_version=6',
57
57
  `--CDCMAKE_BUILD_TYPE=${CONFIG}`,
@@ -92,12 +92,13 @@ if (os.platform() === 'darwin') {
92
92
  // In Windows, "npx cmake-js configure" uses a powershell script to detect the Visual Studio installation.
93
93
  // The script uses the environment variable LIB. If an invalid path is specified in LIB, the script will fail.
94
94
  // So we override the LIB environment variable to remove invalid paths.
95
- const envOverride = os.platform() === 'win32' && process.env.LIB ?
96
- {...process.env, LIB: process.env.LIB.split(';').filter(fs.existsSync).join(';')} :
97
- process.env;
95
+ const envOverride =
96
+ os.platform() === 'win32' && process.env.LIB
97
+ ? { ...process.env, LIB: process.env.LIB.split(';').filter(fs.existsSync).join(';') }
98
+ : process.env;
98
99
 
99
100
  // launch cmake-js configure
100
- const procCmakejs = spawnSync('npx', args, {shell: true, stdio: 'inherit', cwd: ROOT_FOLDER, env: envOverride});
101
+ const procCmakejs = spawnSync('npx', args, { shell: true, stdio: 'inherit', cwd: ROOT_FOLDER, env: envOverride });
101
102
  if (procCmakejs.status !== 0) {
102
103
  if (procCmakejs.error) {
103
104
  console.error(procCmakejs.error);
@@ -106,8 +107,11 @@ if (procCmakejs.status !== 0) {
106
107
  }
107
108
 
108
109
  // launch cmake to build
109
- const procCmake =
110
- spawnSync('cmake', ['--build', '.', '--config', CONFIG], {shell: true, stdio: 'inherit', cwd: BUILD_FOLDER});
110
+ const procCmake = spawnSync('cmake', ['--build', '.', '--config', CONFIG], {
111
+ shell: true,
112
+ stdio: 'inherit',
113
+ cwd: BUILD_FOLDER,
114
+ });
111
115
  if (procCmake.status !== 0) {
112
116
  if (procCmake.error) {
113
117
  console.error(procCmake.error);
package/script/install.js CHANGED
@@ -21,7 +21,7 @@ const os = require('os');
21
21
  const fs = require('fs');
22
22
  const path = require('path');
23
23
  const tar = require('tar');
24
- const {Readable} = require('stream');
24
+ const { Readable } = require('stream');
25
25
 
26
26
  // commandline flag:
27
27
  // --onnxruntime-node-install-cuda Force install the CUDA EP binaries. Try to detect the CUDA version.
@@ -49,7 +49,7 @@ const ORT_VERSION = require('../package.json').version;
49
49
  const npm_config_local_prefix = process.env.npm_config_local_prefix;
50
50
  const npm_package_json = process.env.npm_package_json;
51
51
  const SKIP_LOCAL_INSTALL =
52
- npm_config_local_prefix && npm_package_json && path.dirname(npm_package_json) === npm_config_local_prefix;
52
+ npm_config_local_prefix && npm_package_json && path.dirname(npm_package_json) === npm_config_local_prefix;
53
53
 
54
54
  const shouldInstall = FORCE_INSTALL || (!SKIP_LOCAL_INSTALL && IS_LINUX_X64 && BIN_FOLDER_EXISTS && !CUDA_DLL_EXISTS);
55
55
  if (NO_INSTALL || !shouldInstall) {
@@ -59,12 +59,14 @@ if (NO_INSTALL || !shouldInstall) {
59
59
  // Step.2: Download the required binaries
60
60
  const artifactUrl = {
61
61
  11: `https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-gpu-${
62
- ORT_VERSION}.tgz`,
62
+ ORT_VERSION
63
+ }.tgz`,
63
64
  12: `https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-gpu-cuda12-${
64
- ORT_VERSION}.tgz`
65
+ ORT_VERSION
66
+ }.tgz`,
65
67
  }[INSTALL_CUDA_FLAG || tryGetCudaVersion()];
66
68
  console.log(`Downloading "${artifactUrl}"...`);
67
- fetch(artifactUrl).then(res => {
69
+ fetch(artifactUrl).then((res) => {
68
70
  if (!res.ok) {
69
71
  throw new Error(`Failed to download the binaries: ${res.status} ${res.statusText}.
70
72
 
@@ -81,7 +83,8 @@ Use "--onnxruntime-node-install-cuda=skip" to skip the installation. You will st
81
83
  ]);
82
84
 
83
85
  Readable.fromWeb(res.body)
84
- .pipe(tar.t({
86
+ .pipe(
87
+ tar.t({
85
88
  strict: true,
86
89
  onentry: (entry) => {
87
90
  const filename = path.basename(entry.path);
@@ -92,16 +95,16 @@ Use "--onnxruntime-node-install-cuda=skip" to skip the installation. You will st
92
95
  console.log(`Finished extracting "${filename}".`);
93
96
  });
94
97
  }
95
- }
96
- }))
97
- .on('error', (err) => {
98
- throw new Error(`Failed to extract the binaries: ${err.message}.
98
+ },
99
+ }),
100
+ )
101
+ .on('error', (err) => {
102
+ throw new Error(`Failed to extract the binaries: ${err.message}.
99
103
 
100
104
  Use "--onnxruntime-node-install-cuda=skip" to skip the installation. You will still be able to use ONNX Runtime, but the CUDA EP will not be available.`);
101
- });
105
+ });
102
106
  });
103
107
 
104
-
105
108
  function tryGetCudaVersion() {
106
109
  // Should only return 11 or 12.
107
110
 
package/script/prepack.ts CHANGED
@@ -12,7 +12,7 @@ function updatePackageJson() {
12
12
  const packageSelf = fs.readJSONSync(selfPackageJsonPath);
13
13
  const version = packageCommon.version;
14
14
  packageSelf.dependencies['onnxruntime-common'] = `${version}`;
15
- fs.writeJSONSync(selfPackageJsonPath, packageSelf, {spaces: 2});
15
+ fs.writeJSONSync(selfPackageJsonPath, packageSelf, { spaces: 2 });
16
16
  console.log('=== finished updating package.json.');
17
17
  }
18
18