onnxruntime-node 1.20.1 → 1.21.0-dev.20250228-beb1a9242e

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 (37) hide show
  1. package/README.md +1 -1
  2. package/__commit.txt +1 -0
  3. package/bin/napi-v3/darwin/{x64/libonnxruntime.1.20.1.dylib → arm64/libonnxruntime.1.21.0.dylib} +0 -0
  4. package/bin/napi-v3/darwin/arm64/onnxruntime_binding.node +0 -0
  5. package/bin/napi-v3/darwin/{arm64/libonnxruntime.1.20.1.dylib → x64/libonnxruntime.1.21.0.dylib} +0 -0
  6. package/bin/napi-v3/darwin/x64/onnxruntime_binding.node +0 -0
  7. package/bin/napi-v3/linux/arm64/libonnxruntime.so.1 +0 -0
  8. package/bin/napi-v3/linux/arm64/{libonnxruntime.so.1.20.1 → libonnxruntime.so.1.21.0} +0 -0
  9. package/bin/napi-v3/linux/arm64/onnxruntime_binding.node +0 -0
  10. package/bin/napi-v3/linux/x64/libonnxruntime.so.1 +0 -0
  11. package/bin/napi-v3/linux/x64/{libonnxruntime.so.1.20.1 → libonnxruntime.so.1.21.0} +0 -0
  12. package/bin/napi-v3/linux/x64/libonnxruntime_providers_shared.so +0 -0
  13. package/bin/napi-v3/linux/x64/onnxruntime_binding.node +0 -0
  14. package/bin/napi-v3/win32/arm64/DirectML.dll +0 -0
  15. package/bin/napi-v3/win32/arm64/onnxruntime.dll +0 -0
  16. package/bin/napi-v3/win32/arm64/onnxruntime_binding.node +0 -0
  17. package/bin/napi-v3/win32/x64/DirectML.dll +0 -0
  18. package/bin/napi-v3/win32/x64/onnxruntime.dll +0 -0
  19. package/bin/napi-v3/win32/x64/onnxruntime_binding.node +0 -0
  20. package/dist/backend.d.ts +9 -0
  21. package/dist/backend.js +5 -2
  22. package/dist/backend.js.map +1 -1
  23. package/dist/binding.d.ts +40 -0
  24. package/dist/binding.js +32 -1
  25. package/dist/binding.js.map +1 -1
  26. package/dist/index.d.ts +2 -0
  27. package/dist/version.d.ts +1 -0
  28. package/dist/version.js +1 -1
  29. package/dist/version.js.map +1 -1
  30. package/lib/backend.ts +7 -3
  31. package/lib/binding.ts +34 -1
  32. package/lib/version.ts +1 -1
  33. package/package.json +3 -2
  34. package/script/build.js +100 -67
  35. package/script/build.ts +10 -0
  36. package/script/install.js +95 -39
  37. package/script/prepack.js +49 -32
package/README.md CHANGED
@@ -14,7 +14,7 @@ Refer to [ONNX Runtime JavaScript examples](https://github.com/microsoft/onnxrun
14
14
 
15
15
  ## Requirements
16
16
 
17
- ONNXRuntime works on Node.js v16.x+ (recommend v18.x+) or Electron v15.x+ (recommend v28.x+).
17
+ ONNXRuntime works on Node.js v16.x+ (recommend v20.x+) or Electron v15.x+ (recommend v28.x+).
18
18
 
19
19
  The following table lists the supported versions of ONNX Runtime Node.js binding provided with pre-built binaries.
20
20
 
package/__commit.txt ADDED
@@ -0,0 +1 @@
1
+ beb1a9242eaf46ef885f86c75202a94b13dab428
Binary file
@@ -0,0 +1,9 @@
1
+ import { Backend, InferenceSession, InferenceSessionHandler } from 'onnxruntime-common';
2
+ import { Binding } from './binding';
3
+ declare class OnnxruntimeBackend implements Backend {
4
+ init(): Promise<void>;
5
+ createInferenceSessionHandler(pathOrBuffer: string | Uint8Array, options?: InferenceSession.SessionOptions): Promise<InferenceSessionHandler>;
6
+ }
7
+ export declare const onnxruntimeBackend: OnnxruntimeBackend;
8
+ export declare const listSupportedBackends: () => Binding.SupportedBackend[];
9
+ export {};
package/dist/backend.js CHANGED
@@ -19,6 +19,7 @@ const binding_1 = require("./binding");
19
19
  class OnnxruntimeSessionHandler {
20
20
  constructor(pathOrBuffer, options) {
21
21
  _OnnxruntimeSessionHandler_inferenceSession.set(this, void 0);
22
+ (0, binding_1.initOrt)();
22
23
  __classPrivateFieldSet(this, _OnnxruntimeSessionHandler_inferenceSession, new binding_1.binding.InferenceSession(), "f");
23
24
  if (typeof pathOrBuffer === 'string') {
24
25
  __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
@@ -33,10 +34,12 @@ class OnnxruntimeSessionHandler {
33
34
  __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").dispose();
34
35
  }
35
36
  startProfiling() {
36
- // TODO: implement profiling
37
+ // startProfiling is a no-op.
38
+ //
39
+ // if sessionOptions.enableProfiling is true, profiling will be enabled when the model is loaded.
37
40
  }
38
41
  endProfiling() {
39
- // TODO: implement profiling
42
+ __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").endProfiling();
40
43
  }
41
44
  async run(feeds, fetches, options) {
42
45
  return new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"backend.js","sourceRoot":"","sources":["../lib/backend.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;;;;;;;;;;AAIlC,uCAA6C;AAE7C,MAAM,yBAAyB;IAG7B,YAAY,YAAiC,EAAE,OAAwC;QAFvF,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,uBAAA,IAAI,mDAAkB,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAKD,cAAc;QACZ,4BAA4B;IAC9B,CAAC;IACD,YAAY;QACV,4BAA4B;IAC9B,CAAC;IAED,KAAK,CAAC,GAAG,CACP,KAA+B,EAC/B,OAAmC,EACnC,OAAoC;QAEpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,YAAY,CAAC,GAAG,EAAE;gBAChB,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,6BAA6B,CACjC,YAAiC,EACjC,OAAyC;QAEzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,YAAY,CAAC,GAAG,EAAE;gBAChB,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;AAC9C,QAAA,qBAAqB,GAAG,iBAAO,CAAC,qBAAqB,CAAC"}
1
+ {"version":3,"file":"backend.js","sourceRoot":"","sources":["../lib/backend.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;;;;;;;;;;AAIlC,uCAAsD;AAEtD,MAAM,yBAAyB;IAG7B,YAAY,YAAiC,EAAE,OAAwC;QAFvF,8DAA4C;QAG1C,IAAA,iBAAO,GAAE,CAAC;QAEV,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,uBAAA,IAAI,mDAAkB,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAKD,cAAc;QACZ,6BAA6B;QAC7B,EAAE;QACF,iGAAiG;IACnG,CAAC;IACD,YAAY;QACV,uBAAA,IAAI,mDAAkB,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,GAAG,CACP,KAA+B,EAC/B,OAAmC,EACnC,OAAoC;QAEpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,YAAY,CAAC,GAAG,EAAE;gBAChB,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,6BAA6B,CACjC,YAAiC,EACjC,OAAyC;QAEzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,YAAY,CAAC,GAAG,EAAE;gBAChB,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;AAC9C,QAAA,qBAAqB,GAAG,iBAAO,CAAC,qBAAqB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { InferenceSession, OnnxValue, TensorConstructor } from 'onnxruntime-common';
2
+ type SessionOptions = InferenceSession.SessionOptions;
3
+ type FeedsType = {
4
+ [name: string]: OnnxValue;
5
+ };
6
+ type FetchesType = {
7
+ [name: string]: OnnxValue | null;
8
+ };
9
+ type ReturnType = {
10
+ [name: string]: OnnxValue;
11
+ };
12
+ type RunOptions = InferenceSession.RunOptions;
13
+ /**
14
+ * Binding exports a simple synchronized inference session object wrap.
15
+ */
16
+ export declare namespace Binding {
17
+ interface InferenceSession {
18
+ loadModel(modelPath: string, options: SessionOptions): void;
19
+ loadModel(buffer: ArrayBuffer, byteOffset: number, byteLength: number, options: SessionOptions): void;
20
+ readonly inputNames: string[];
21
+ readonly outputNames: string[];
22
+ run(feeds: FeedsType, fetches: FetchesType, options: RunOptions): ReturnType;
23
+ endProfiling(): void;
24
+ dispose(): void;
25
+ }
26
+ interface InferenceSessionConstructor {
27
+ new (): InferenceSession;
28
+ }
29
+ interface SupportedBackend {
30
+ name: string;
31
+ bundled: boolean;
32
+ }
33
+ }
34
+ export declare const binding: {
35
+ InferenceSession: Binding.InferenceSessionConstructor;
36
+ listSupportedBackends: () => Binding.SupportedBackend[];
37
+ initOrtOnce: (logLevel: number, tensorConstructor: TensorConstructor) => void;
38
+ };
39
+ export declare const initOrt: () => void;
40
+ export {};
package/dist/binding.js CHANGED
@@ -2,9 +2,40 @@
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.binding = void 0;
5
+ exports.initOrt = exports.binding = void 0;
6
+ const onnxruntime_common_1 = require("onnxruntime-common");
6
7
  // export native binding
7
8
  exports.binding =
8
9
  // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
9
10
  require(`../bin/napi-v3/${process.platform}/${process.arch}/onnxruntime_binding.node`);
11
+ let ortInitialized = false;
12
+ const initOrt = () => {
13
+ if (!ortInitialized) {
14
+ ortInitialized = true;
15
+ let logLevel = 2;
16
+ if (onnxruntime_common_1.env.logLevel) {
17
+ switch (onnxruntime_common_1.env.logLevel) {
18
+ case 'verbose':
19
+ logLevel = 0;
20
+ break;
21
+ case 'info':
22
+ logLevel = 1;
23
+ break;
24
+ case 'warning':
25
+ logLevel = 2;
26
+ break;
27
+ case 'error':
28
+ logLevel = 3;
29
+ break;
30
+ case 'fatal':
31
+ logLevel = 4;
32
+ break;
33
+ default:
34
+ throw new Error(`Unsupported log level: ${onnxruntime_common_1.env.logLevel}`);
35
+ }
36
+ }
37
+ exports.binding.initOrtOnce(logLevel, onnxruntime_common_1.Tensor);
38
+ }
39
+ };
40
+ exports.initOrt = initOrt;
10
41
  //# sourceMappingURL=binding.js.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"binding.js","sourceRoot":"","sources":["../lib/binding.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAElC,2DAAiG;AA0CjG,wBAAwB;AACX,QAAA,OAAO;AAClB,qGAAqG;AACrG,OAAO,CAAC,kBAAkB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,2BAA2B,CAKpF,CAAC;AAEJ,IAAI,cAAc,GAAG,KAAK,CAAC;AACpB,MAAM,OAAO,GAAG,GAAS,EAAE;IAChC,IAAI,CAAC,cAAc,EAAE;QACnB,cAAc,GAAG,IAAI,CAAC;QACtB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,wBAAG,CAAC,QAAQ,EAAE;YAChB,QAAQ,wBAAG,CAAC,QAAQ,EAAE;gBACpB,KAAK,SAAS;oBACZ,QAAQ,GAAG,CAAC,CAAC;oBACb,MAAM;gBACR,KAAK,MAAM;oBACT,QAAQ,GAAG,CAAC,CAAC;oBACb,MAAM;gBACR,KAAK,SAAS;oBACZ,QAAQ,GAAG,CAAC,CAAC;oBACb,MAAM;gBACR,KAAK,OAAO;oBACV,QAAQ,GAAG,CAAC,CAAC;oBACb,MAAM;gBACR,KAAK,OAAO;oBACV,QAAQ,GAAG,CAAC,CAAC;oBACb,MAAM;gBACR;oBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,wBAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;aAC7D;SACF;QACD,eAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,2BAAM,CAAC,CAAC;KACvC;AACH,CAAC,CAAC;AA3BW,QAAA,OAAO,WA2BlB"}
@@ -0,0 +1,2 @@
1
+ export * from 'onnxruntime-common';
2
+ export { listSupportedBackends } from './backend';
@@ -0,0 +1 @@
1
+ export declare const version = "1.21.0-dev.20250228-beb1a9242e";
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.20.1';
8
+ exports.version = '1.21.0-dev.20250228-beb1a9242e';
9
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../lib/version.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAElC,0DAA0D;AAC1D,uCAAuC;AAE1B,QAAA,OAAO,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../lib/version.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAElC,0DAA0D;AAC1D,uCAAuC;AAE1B,QAAA,OAAO,GAAG,gCAAgC,CAAC"}
package/lib/backend.ts CHANGED
@@ -3,12 +3,14 @@
3
3
 
4
4
  import { Backend, InferenceSession, InferenceSessionHandler, SessionHandler } from 'onnxruntime-common';
5
5
 
6
- import { Binding, binding } from './binding';
6
+ import { Binding, binding, initOrt } from './binding';
7
7
 
8
8
  class OnnxruntimeSessionHandler implements InferenceSessionHandler {
9
9
  #inferenceSession: Binding.InferenceSession;
10
10
 
11
11
  constructor(pathOrBuffer: string | Uint8Array, options: InferenceSession.SessionOptions) {
12
+ initOrt();
13
+
12
14
  this.#inferenceSession = new binding.InferenceSession();
13
15
  if (typeof pathOrBuffer === 'string') {
14
16
  this.#inferenceSession.loadModel(pathOrBuffer, options);
@@ -27,10 +29,12 @@ class OnnxruntimeSessionHandler implements InferenceSessionHandler {
27
29
  readonly outputNames: string[];
28
30
 
29
31
  startProfiling(): void {
30
- // TODO: implement profiling
32
+ // startProfiling is a no-op.
33
+ //
34
+ // if sessionOptions.enableProfiling is true, profiling will be enabled when the model is loaded.
31
35
  }
32
36
  endProfiling(): void {
33
- // TODO: implement profiling
37
+ this.#inferenceSession.endProfiling();
34
38
  }
35
39
 
36
40
  async run(
package/lib/binding.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 { InferenceSession, OnnxValue } from 'onnxruntime-common';
4
+ import { InferenceSession, OnnxValue, Tensor, TensorConstructor, env } from 'onnxruntime-common';
5
5
 
6
6
  type SessionOptions = InferenceSession.SessionOptions;
7
7
  type FeedsType = {
@@ -28,6 +28,8 @@ export declare namespace Binding {
28
28
 
29
29
  run(feeds: FeedsType, fetches: FetchesType, options: RunOptions): ReturnType;
30
30
 
31
+ endProfiling(): void;
32
+
31
33
  dispose(): void;
32
34
  }
33
35
 
@@ -48,4 +50,35 @@ export const binding =
48
50
  // eslint-disable-next-line @typescript-eslint/naming-convention
49
51
  InferenceSession: Binding.InferenceSessionConstructor;
50
52
  listSupportedBackends: () => Binding.SupportedBackend[];
53
+ initOrtOnce: (logLevel: number, tensorConstructor: TensorConstructor) => void;
51
54
  };
55
+
56
+ let ortInitialized = false;
57
+ export const initOrt = (): void => {
58
+ if (!ortInitialized) {
59
+ ortInitialized = true;
60
+ let logLevel = 2;
61
+ if (env.logLevel) {
62
+ switch (env.logLevel) {
63
+ case 'verbose':
64
+ logLevel = 0;
65
+ break;
66
+ case 'info':
67
+ logLevel = 1;
68
+ break;
69
+ case 'warning':
70
+ logLevel = 2;
71
+ break;
72
+ case 'error':
73
+ logLevel = 3;
74
+ break;
75
+ case 'fatal':
76
+ logLevel = 4;
77
+ break;
78
+ default:
79
+ throw new Error(`Unsupported log level: ${env.logLevel}`);
80
+ }
81
+ }
82
+ binding.initOrtOnce(logLevel, Tensor);
83
+ }
84
+ };
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.20.1';
7
+ export const version = '1.21.0-dev.20250228-beb1a9242e';
package/package.json CHANGED
@@ -13,9 +13,10 @@
13
13
  3
14
14
  ]
15
15
  },
16
- "version": "1.20.1",
16
+ "version": "1.21.0-dev.20250228-beb1a9242e",
17
17
  "dependencies": {
18
- "onnxruntime-common": "1.20.1",
18
+ "global-agent": "^3.0.0",
19
+ "onnxruntime-common": "1.21.0-dev.20250206-d981b153d3",
19
20
  "tar": "^7.0.1"
20
21
  },
21
22
  "scripts": {
package/script/build.js CHANGED
@@ -1,49 +1,68 @@
1
- "use strict";
1
+ 'use strict';
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  // Licensed under the MIT License.
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- var desc = Object.getOwnPropertyDescriptor(m, k);
7
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
- desc = { enumerable: true, get: function() { return m[k]; } };
9
- }
10
- Object.defineProperty(o, k2, desc);
11
- }) : (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- o[k2] = m[k];
14
- }));
15
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
- Object.defineProperty(o, "default", { enumerable: true, value: v });
17
- }) : function(o, v) {
18
- o["default"] = v;
19
- });
20
- var __importStar = (this && this.__importStar) || function (mod) {
4
+ var __createBinding =
5
+ (this && this.__createBinding) ||
6
+ (Object.create
7
+ ? function (o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = {
12
+ enumerable: true,
13
+ get: function () {
14
+ return m[k];
15
+ },
16
+ };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }
20
+ : function (o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ });
24
+ var __setModuleDefault =
25
+ (this && this.__setModuleDefault) ||
26
+ (Object.create
27
+ ? function (o, v) {
28
+ Object.defineProperty(o, 'default', { enumerable: true, value: v });
29
+ }
30
+ : function (o, v) {
31
+ o['default'] = v;
32
+ });
33
+ var __importStar =
34
+ (this && this.__importStar) ||
35
+ function (mod) {
21
36
  if (mod && mod.__esModule) return mod;
22
37
  var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38
+ if (mod != null)
39
+ for (var k in mod)
40
+ if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
41
  __setModuleDefault(result, mod);
25
42
  return result;
26
- };
27
- var __importDefault = (this && this.__importDefault) || function (mod) {
28
- return (mod && mod.__esModule) ? mod : { "default": mod };
29
- };
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- const child_process_1 = require("child_process");
32
- const fs = __importStar(require("fs-extra"));
33
- const minimist_1 = __importDefault(require("minimist"));
34
- const os = __importStar(require("os"));
35
- const path = __importStar(require("path"));
43
+ };
44
+ var __importDefault =
45
+ (this && this.__importDefault) ||
46
+ function (mod) {
47
+ return mod && mod.__esModule ? mod : { default: mod };
48
+ };
49
+ Object.defineProperty(exports, '__esModule', { value: true });
50
+ const child_process_1 = require('child_process');
51
+ const fs = __importStar(require('fs-extra'));
52
+ const minimist_1 = __importDefault(require('minimist'));
53
+ const os = __importStar(require('os'));
54
+ const path = __importStar(require('path'));
36
55
  // command line flags
37
56
  const buildArgs = (0, minimist_1.default)(process.argv.slice(2));
38
57
  // --config=Debug|Release|RelWithDebInfo
39
58
  const CONFIG = buildArgs.config || (os.platform() === 'win32' ? 'RelWithDebInfo' : 'Release');
40
59
  if (CONFIG !== 'Debug' && CONFIG !== 'Release' && CONFIG !== 'RelWithDebInfo') {
41
- throw new Error(`unrecognized config: ${CONFIG}`);
60
+ throw new Error(`unrecognized config: ${CONFIG}`);
42
61
  }
43
62
  // --arch=x64|ia32|arm64|arm
44
63
  const ARCH = buildArgs.arch || os.arch();
45
64
  if (ARCH !== 'x64' && ARCH !== 'ia32' && ARCH !== 'arm64' && ARCH !== 'arm') {
46
- throw new Error(`unrecognized architecture: ${ARCH}`);
65
+ throw new Error(`unrecognized architecture: ${ARCH}`);
47
66
  }
48
67
  // --onnxruntime-build-dir=
49
68
  const ONNXRUNTIME_BUILD_DIR = buildArgs['onnxruntime-build-dir'];
@@ -53,6 +72,8 @@ const ONNXRUNTIME_GENERATOR = buildArgs['onnxruntime-generator'];
53
72
  const REBUILD = !!buildArgs.rebuild;
54
73
  // --use_dml
55
74
  const USE_DML = !!buildArgs.use_dml;
75
+ // --use_webgpu
76
+ const USE_WEBGPU = !!buildArgs.use_webgpu;
56
77
  // --use_cuda
57
78
  const USE_CUDA = !!buildArgs.use_cuda;
58
79
  // --use_tensorrt
@@ -61,78 +82,90 @@ const USE_TENSORRT = !!buildArgs.use_tensorrt;
61
82
  const USE_COREML = !!buildArgs.use_coreml;
62
83
  // --use_qnn
63
84
  const USE_QNN = !!buildArgs.use_qnn;
85
+ // --dll_deps=
86
+ const DLL_DEPS = buildArgs.dll_deps;
64
87
  // build path
65
88
  const ROOT_FOLDER = path.join(__dirname, '..');
66
89
  const BIN_FOLDER = path.join(ROOT_FOLDER, 'bin');
67
90
  const BUILD_FOLDER = path.join(ROOT_FOLDER, 'build');
68
91
  // if rebuild, clean up the dist folders
69
92
  if (REBUILD) {
70
- fs.removeSync(BIN_FOLDER);
71
- fs.removeSync(BUILD_FOLDER);
93
+ fs.removeSync(BIN_FOLDER);
94
+ fs.removeSync(BUILD_FOLDER);
72
95
  }
73
96
  const args = [
74
- 'cmake-js',
75
- REBUILD ? 'reconfigure' : 'configure',
76
- `--arch=${ARCH}`,
77
- '--CDnapi_build_version=6',
78
- `--CDCMAKE_BUILD_TYPE=${CONFIG}`,
97
+ 'cmake-js',
98
+ REBUILD ? 'reconfigure' : 'configure',
99
+ `--arch=${ARCH}`,
100
+ '--CDnapi_build_version=6',
101
+ `--CDCMAKE_BUILD_TYPE=${CONFIG}`,
79
102
  ];
80
103
  if (ONNXRUNTIME_BUILD_DIR && typeof ONNXRUNTIME_BUILD_DIR === 'string') {
81
- args.push(`--CDONNXRUNTIME_BUILD_DIR=${ONNXRUNTIME_BUILD_DIR}`);
104
+ args.push(`--CDONNXRUNTIME_BUILD_DIR=${ONNXRUNTIME_BUILD_DIR}`);
82
105
  }
83
106
  if (ONNXRUNTIME_GENERATOR && typeof ONNXRUNTIME_GENERATOR === 'string') {
84
- args.push(`--CDONNXRUNTIME_GENERATOR=${ONNXRUNTIME_GENERATOR}`);
107
+ args.push(`--CDONNXRUNTIME_GENERATOR=${ONNXRUNTIME_GENERATOR}`);
85
108
  }
86
109
  if (USE_DML) {
87
- args.push('--CDUSE_DML=ON');
110
+ args.push('--CDUSE_DML=ON');
111
+ }
112
+ if (USE_WEBGPU) {
113
+ args.push('--CDUSE_WEBGPU=ON');
88
114
  }
89
115
  if (USE_CUDA) {
90
- args.push('--CDUSE_CUDA=ON');
116
+ args.push('--CDUSE_CUDA=ON');
91
117
  }
92
118
  if (USE_TENSORRT) {
93
- args.push('--CDUSE_TENSORRT=ON');
119
+ args.push('--CDUSE_TENSORRT=ON');
94
120
  }
95
121
  if (USE_COREML) {
96
- args.push('--CDUSE_COREML=ON');
122
+ args.push('--CDUSE_COREML=ON');
97
123
  }
98
124
  if (USE_QNN) {
99
- args.push('--CDUSE_QNN=ON');
125
+ args.push('--CDUSE_QNN=ON');
126
+ }
127
+ if (DLL_DEPS) {
128
+ args.push(`--CDORT_NODEJS_DLL_DEPS=${DLL_DEPS}`);
100
129
  }
101
130
  // set CMAKE_OSX_ARCHITECTURES for macOS build
102
131
  if (os.platform() === 'darwin') {
103
- if (ARCH === 'x64') {
104
- args.push('--CDCMAKE_OSX_ARCHITECTURES=x86_64');
105
- }
106
- else if (ARCH === 'arm64') {
107
- args.push('--CDCMAKE_OSX_ARCHITECTURES=arm64');
108
- }
109
- else {
110
- throw new Error(`architecture not supported for macOS build: ${ARCH}`);
111
- }
132
+ if (ARCH === 'x64') {
133
+ args.push('--CDCMAKE_OSX_ARCHITECTURES=x86_64');
134
+ } else if (ARCH === 'arm64') {
135
+ args.push('--CDCMAKE_OSX_ARCHITECTURES=arm64');
136
+ } else {
137
+ throw new Error(`architecture not supported for macOS build: ${ARCH}`);
138
+ }
112
139
  }
113
140
  // In Windows, "npx cmake-js configure" uses a powershell script to detect the Visual Studio installation.
114
141
  // The script uses the environment variable LIB. If an invalid path is specified in LIB, the script will fail.
115
142
  // So we override the LIB environment variable to remove invalid paths.
116
- const envOverride = os.platform() === 'win32' && process.env.LIB
143
+ const envOverride =
144
+ os.platform() === 'win32' && process.env.LIB
117
145
  ? { ...process.env, LIB: process.env.LIB.split(';').filter(fs.existsSync).join(';') }
118
146
  : process.env;
119
147
  // launch cmake-js configure
120
- const procCmakejs = (0, child_process_1.spawnSync)('npx', args, { shell: true, stdio: 'inherit', cwd: ROOT_FOLDER, env: envOverride });
148
+ const procCmakejs = (0, child_process_1.spawnSync)('npx', args, {
149
+ shell: true,
150
+ stdio: 'inherit',
151
+ cwd: ROOT_FOLDER,
152
+ env: envOverride,
153
+ });
121
154
  if (procCmakejs.status !== 0) {
122
- if (procCmakejs.error) {
123
- console.error(procCmakejs.error);
124
- }
125
- process.exit(procCmakejs.status === null ? undefined : procCmakejs.status);
155
+ if (procCmakejs.error) {
156
+ console.error(procCmakejs.error);
157
+ }
158
+ process.exit(procCmakejs.status === null ? undefined : procCmakejs.status);
126
159
  }
127
160
  // launch cmake to build
128
161
  const procCmake = (0, child_process_1.spawnSync)('cmake', ['--build', '.', '--config', CONFIG], {
129
- shell: true,
130
- stdio: 'inherit',
131
- cwd: BUILD_FOLDER,
162
+ shell: true,
163
+ stdio: 'inherit',
164
+ cwd: BUILD_FOLDER,
132
165
  });
133
166
  if (procCmake.status !== 0) {
134
- if (procCmake.error) {
135
- console.error(procCmake.error);
136
- }
137
- process.exit(procCmake.status === null ? undefined : procCmake.status);
167
+ if (procCmake.error) {
168
+ console.error(procCmake.error);
169
+ }
170
+ process.exit(procCmake.status === null ? undefined : procCmake.status);
138
171
  }
package/script/build.ts CHANGED
@@ -29,6 +29,8 @@ const ONNXRUNTIME_GENERATOR = buildArgs['onnxruntime-generator'];
29
29
  const REBUILD = !!buildArgs.rebuild;
30
30
  // --use_dml
31
31
  const USE_DML = !!buildArgs.use_dml;
32
+ // --use_webgpu
33
+ const USE_WEBGPU = !!buildArgs.use_webgpu;
32
34
  // --use_cuda
33
35
  const USE_CUDA = !!buildArgs.use_cuda;
34
36
  // --use_tensorrt
@@ -37,6 +39,8 @@ const USE_TENSORRT = !!buildArgs.use_tensorrt;
37
39
  const USE_COREML = !!buildArgs.use_coreml;
38
40
  // --use_qnn
39
41
  const USE_QNN = !!buildArgs.use_qnn;
42
+ // --dll_deps=
43
+ const DLL_DEPS = buildArgs.dll_deps;
40
44
 
41
45
  // build path
42
46
  const ROOT_FOLDER = path.join(__dirname, '..');
@@ -65,6 +69,9 @@ if (ONNXRUNTIME_GENERATOR && typeof ONNXRUNTIME_GENERATOR === 'string') {
65
69
  if (USE_DML) {
66
70
  args.push('--CDUSE_DML=ON');
67
71
  }
72
+ if (USE_WEBGPU) {
73
+ args.push('--CDUSE_WEBGPU=ON');
74
+ }
68
75
  if (USE_CUDA) {
69
76
  args.push('--CDUSE_CUDA=ON');
70
77
  }
@@ -77,6 +84,9 @@ if (USE_COREML) {
77
84
  if (USE_QNN) {
78
85
  args.push('--CDUSE_QNN=ON');
79
86
  }
87
+ if (DLL_DEPS) {
88
+ args.push(`--CDORT_NODEJS_DLL_DEPS=${DLL_DEPS}`);
89
+ }
80
90
 
81
91
  // set CMAKE_OSX_ARCHITECTURES for macOS build
82
92
  if (os.platform() === 'darwin') {
package/script/install.js CHANGED
@@ -19,9 +19,16 @@
19
19
  // Step.1: Check if we should exit early
20
20
  const os = require('os');
21
21
  const fs = require('fs');
22
+ const https = require('https');
22
23
  const path = require('path');
23
24
  const tar = require('tar');
24
- const { Readable } = require('stream');
25
+ const { execFileSync } = require('child_process');
26
+ const { bootstrap: globalAgentBootstrap } = require('global-agent');
27
+
28
+ // Bootstrap global-agent to honor the proxy settings in
29
+ // environment variables, e.g. GLOBAL_AGENT_HTTPS_PROXY.
30
+ // See https://github.com/gajus/global-agent/blob/v3.0.0/README.md#environment-variables for details.
31
+ globalAgentBootstrap();
25
32
 
26
33
  // commandline flag:
27
34
  // --onnxruntime-node-install-cuda Force install the CUDA EP binaries. Try to detect the CUDA version.
@@ -58,59 +65,108 @@ if (NO_INSTALL || !shouldInstall) {
58
65
 
59
66
  // Step.2: Download the required binaries
60
67
  const artifactUrl = {
61
- 11: `https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-gpu-${
62
- ORT_VERSION
63
- }.tgz`,
64
- 12: `https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-gpu-cuda12-${
68
+ get 11() {
69
+ // TODO: support ORT Cuda v11 binaries
70
+ throw new Error(`CUDA 11 binaries are not supported by this script yet.
71
+
72
+ To use ONNX Runtime Node.js binding with CUDA v11 support, please follow the manual steps:
73
+
74
+ 1. Use "--onnxruntime-node-install-cuda=skip" to skip the auto installation.
75
+ 2. Navigate to https://aiinfra.visualstudio.com/PublicPackages/_artifacts/feed/onnxruntime-cuda-11
76
+ 3. Download the binaries for your platform and architecture
77
+ 4. Extract the following binaries to "node_modules/onnxruntime-node/bin/napi-v3/linux/x64:
78
+ - libonnxruntime_providers_tensorrt.so
79
+ - libonnxruntime_providers_shared.so
80
+ - libonnxruntime.so.${ORT_VERSION}
81
+ - libonnxruntime_providers_cuda.so
82
+ `);
83
+ },
84
+ 12: `https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-gpu-${
65
85
  ORT_VERSION
66
86
  }.tgz`,
67
87
  }[INSTALL_CUDA_FLAG || tryGetCudaVersion()];
68
88
  console.log(`Downloading "${artifactUrl}"...`);
69
- fetch(artifactUrl).then((res) => {
70
- if (!res.ok) {
71
- throw new Error(`Failed to download the binaries: ${res.status} ${res.statusText}.
89
+
90
+ const FILES = new Set([
91
+ 'libonnxruntime_providers_tensorrt.so',
92
+ 'libonnxruntime_providers_shared.so',
93
+ `libonnxruntime.so.${ORT_VERSION}`,
94
+ 'libonnxruntime_providers_cuda.so',
95
+ ]);
96
+
97
+ downloadAndExtract(artifactUrl, BIN_FOLDER, FILES);
98
+
99
+ async function downloadAndExtract(url, dest, files) {
100
+ return new Promise((resolve, reject) => {
101
+ https.get(url, (res) => {
102
+ const { statusCode } = res;
103
+ const contentType = res.headers['content-type'];
104
+
105
+ if (statusCode === 301 || statusCode === 302) {
106
+ downloadAndExtract(res.headers.location, dest, files).then(
107
+ (value) => resolve(value),
108
+ (reason) => reject(reason),
109
+ );
110
+ return;
111
+ } else if (statusCode !== 200) {
112
+ throw new Error(`Failed to download the binaries: ${res.statusCode} ${res.statusMessage}.
72
113
 
73
114
  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.`);
74
- }
115
+ }
75
116
 
76
- // Extract the binaries
77
-
78
- const FILES = new Set([
79
- 'libonnxruntime_providers_tensorrt.so',
80
- 'libonnxruntime_providers_shared.so',
81
- `libonnxruntime.so.${ORT_VERSION}`,
82
- 'libonnxruntime_providers_cuda.so',
83
- ]);
84
-
85
- Readable.fromWeb(res.body)
86
- .pipe(
87
- tar.t({
88
- strict: true,
89
- onentry: (entry) => {
90
- const filename = path.basename(entry.path);
91
- if (entry.type === 'File' && FILES.has(filename)) {
92
- console.log(`Extracting "${filename}" to "${BIN_FOLDER}"...`);
93
- entry.pipe(fs.createWriteStream(path.join(BIN_FOLDER, filename)));
94
- entry.on('finish', () => {
95
- console.log(`Finished extracting "${filename}".`);
96
- });
97
- }
98
- },
99
- }),
100
- )
101
- .on('error', (err) => {
102
- throw new Error(`Failed to extract the binaries: ${err.message}.
117
+ if (!contentType || !/^application\/octet-stream/.test(contentType)) {
118
+ throw new Error(`unexpected content type: ${contentType}`);
119
+ }
120
+
121
+ res
122
+ .pipe(
123
+ tar.t({
124
+ strict: true,
125
+ onentry: (entry) => {
126
+ const filename = path.basename(entry.path);
127
+ if (entry.type === 'File' && files.has(filename)) {
128
+ console.log(`Extracting "${filename}" to "${dest}"...`);
129
+ entry.pipe(fs.createWriteStream(path.join(dest, filename)));
130
+ entry.on('finish', () => {
131
+ console.log(`Finished extracting "${filename}".`);
132
+ });
133
+ }
134
+ },
135
+ }),
136
+ )
137
+ .on('error', (err) => {
138
+ throw new Error(`Failed to extract the binaries: ${err.message}.
103
139
 
104
140
  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.`);
141
+ });
105
142
  });
106
- });
143
+ });
144
+ }
107
145
 
108
146
  function tryGetCudaVersion() {
109
147
  // Should only return 11 or 12.
110
148
 
111
- // TODO: try to get the CUDA version from the system ( `nvcc --version` )
149
+ // try to get the CUDA version from the system ( `nvcc --version` )
150
+ let ver = 12;
151
+ try {
152
+ const nvccVersion = execFileSync('nvcc', ['--version'], { encoding: 'utf8' });
153
+ const match = nvccVersion.match(/release (\d+)/);
154
+ if (match) {
155
+ ver = parseInt(match[1]);
156
+ if (ver !== 11 && ver !== 12) {
157
+ throw new Error(`Unsupported CUDA version: ${ver}`);
158
+ }
159
+ }
160
+ } catch (e) {
161
+ if (e?.code === 'ENOENT') {
162
+ console.warn('`nvcc` not found. Assuming CUDA 12.');
163
+ } else {
164
+ console.warn('Failed to detect CUDA version from `nvcc --version`:', e.message);
165
+ }
166
+ }
112
167
 
113
- return 11;
168
+ // assume CUDA 12 if failed to detect
169
+ return ver;
114
170
  }
115
171
 
116
172
  function parseInstallCudaFlag() {
package/script/prepack.js CHANGED
@@ -1,42 +1,59 @@
1
- "use strict";
1
+ 'use strict';
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  // Licensed under the MIT License.
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- var desc = Object.getOwnPropertyDescriptor(m, k);
7
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
- desc = { enumerable: true, get: function() { return m[k]; } };
9
- }
10
- Object.defineProperty(o, k2, desc);
11
- }) : (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- o[k2] = m[k];
14
- }));
15
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
- Object.defineProperty(o, "default", { enumerable: true, value: v });
17
- }) : function(o, v) {
18
- o["default"] = v;
19
- });
20
- var __importStar = (this && this.__importStar) || function (mod) {
4
+ var __createBinding =
5
+ (this && this.__createBinding) ||
6
+ (Object.create
7
+ ? function (o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = {
12
+ enumerable: true,
13
+ get: function () {
14
+ return m[k];
15
+ },
16
+ };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }
20
+ : function (o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ });
24
+ var __setModuleDefault =
25
+ (this && this.__setModuleDefault) ||
26
+ (Object.create
27
+ ? function (o, v) {
28
+ Object.defineProperty(o, 'default', { enumerable: true, value: v });
29
+ }
30
+ : function (o, v) {
31
+ o['default'] = v;
32
+ });
33
+ var __importStar =
34
+ (this && this.__importStar) ||
35
+ function (mod) {
21
36
  if (mod && mod.__esModule) return mod;
22
37
  var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38
+ if (mod != null)
39
+ for (var k in mod)
40
+ if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
41
  __setModuleDefault(result, mod);
25
42
  return result;
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- const fs = __importStar(require("fs-extra"));
29
- const path = __importStar(require("path"));
43
+ };
44
+ Object.defineProperty(exports, '__esModule', { value: true });
45
+ const fs = __importStar(require('fs-extra'));
46
+ const path = __importStar(require('path'));
30
47
  function updatePackageJson() {
31
- const commonPackageJsonPath = path.join(__dirname, '..', '..', 'common', 'package.json');
32
- const selfPackageJsonPath = path.join(__dirname, '..', 'package.json');
33
- console.log(`=== start to update package.json: ${selfPackageJsonPath}`);
34
- const packageCommon = fs.readJSONSync(commonPackageJsonPath);
35
- const packageSelf = fs.readJSONSync(selfPackageJsonPath);
36
- const version = packageCommon.version;
37
- packageSelf.dependencies['onnxruntime-common'] = `${version}`;
38
- fs.writeJSONSync(selfPackageJsonPath, packageSelf, { spaces: 2 });
39
- console.log('=== finished updating package.json.');
48
+ const commonPackageJsonPath = path.join(__dirname, '..', '..', 'common', 'package.json');
49
+ const selfPackageJsonPath = path.join(__dirname, '..', 'package.json');
50
+ console.log(`=== start to update package.json: ${selfPackageJsonPath}`);
51
+ const packageCommon = fs.readJSONSync(commonPackageJsonPath);
52
+ const packageSelf = fs.readJSONSync(selfPackageJsonPath);
53
+ const version = packageCommon.version;
54
+ packageSelf.dependencies['onnxruntime-common'] = `${version}`;
55
+ fs.writeJSONSync(selfPackageJsonPath, packageSelf, { spaces: 2 });
56
+ console.log('=== finished updating package.json.');
40
57
  }
41
58
  // update version of dependency "onnxruntime-common" before packing
42
59
  updatePackageJson();