Skip to content

Commit

Permalink
Add files to fix JS build and test
Browse files Browse the repository at this point in the history
  • Loading branch information
EmergentOrder committed Aug 15, 2024
1 parent 46da32c commit f0c4014
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
53 changes: 53 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
declare module 'onnxruntime-node' {
export * from 'onnxruntime-common';
export { listSupportedBackends } from './backend';

import { Backend, InferenceSession, InferenceSessionHandler } from 'onnxruntime-common';
import { Binding } from './binding';
declare class OnnxruntimeBackend implements Backend {
init(): Promise<void>;
createInferenceSessionHandler(pathOrBuffer: string | Uint8Array, options?: InferenceSession.SessionOptions): Promise<InferenceSessionHandler>;
}
export declare const onnxruntimeBackend: OnnxruntimeBackend;
export declare const listSupportedBackends: () => Binding.SupportedBackend[];
export {};

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;
dispose(): void;
}
interface InferenceSessionConstructor {
new (): InferenceSession;
}
interface SupportedBackend {
name: string;
bundled: boolean;
}
}
export declare const binding: {
InferenceSession: Binding.InferenceSessionConstructor;
listSupportedBackends: () => Binding.SupportedBackend[];
};
export {};
export declare const version = '1.18.0';
}
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"license": "MIT",
"type": "module",
"name": "onnxruntime-common",
"version": "1.18.0",
"repository": {
"url": "https://github.com/Microsoft/onnxruntime.git",
"type": "git"
},
"author": "fs-eire",
"scripts": {
"build:cjs": "tsc --module commonjs --moduleResolution node10 --outDir ./dist/cjs",
"build:esm": "tsc",
"build:bundles": "webpack",
"build": "node ./build.js",
"prepare": "npm run build",
"pretest": "tsc --build ./test",
"test": "mocha ./test/**/*.js --timeout 30000"
},
"devDependencies": {
"typedoc": "^0.25.7"
},
"main": "dist/cjs/index.js",
"keywords": [
"ONNX",
"ONNXRuntime",
"ONNX Runtime"
],
"description": "ONNXRuntime JavaScript API library"
}

0 comments on commit f0c4014

Please sign in to comment.