Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify build step to generate typescript declaration files. #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ if (${EMSCRIPTEN})

# to check for memory errors
# target_link_options (AssimpJS PUBLIC -sASSERTIONS=1 -sSAFE_HEAP=1 -sWARN_UNALIGNED=1)


target_link_options (AssimpJS PUBLIC --embind-emit-tsd=assimpjs.d.ts)

target_link_options (AssimpJS PUBLIC --bind)
else ()
add_library (AssimpJS ${AssimpJSSourceFiles})
Expand Down
26 changes: 26 additions & 0 deletions dist/assimpjs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export interface File {
GetPath(): ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string;
GetContent(): any;
delete(): void;
}

export interface FileList {
AddFile(_0: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string, _1: any): void;
delete(): void;
}

export interface Result {
IsSuccess(): boolean;
FileCount(): number;
GetFile(_0: number): File;
GetErrorCode(): ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string;
delete(): void;
}

export interface MainModule {
File: {new(): File};
FileList: {new(): FileList};
Result: {new(): Result};
ConvertFileList(_0: FileList, _1: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string): Result;
ConvertFile(_0: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string, _1: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string, _2: any, _3: any, _4: any): Result;
}
12 changes: 5 additions & 7 deletions dist/assimpjs.js

Large diffs are not rendered by default.

Binary file modified dist/assimpjs.wasm
Binary file not shown.
5 changes: 5 additions & 0 deletions dist/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { MainModule } from "./assimpjs.d.ts";

declare module "assimpjs" {
export default function(): Promise<MainModule>;
}
26 changes: 26 additions & 0 deletions docs/dist/assimpjs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export interface File {
GetPath(): ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string;
GetContent(): any;
delete(): void;
}

export interface FileList {
AddFile(_0: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string, _1: any): void;
delete(): void;
}

export interface Result {
IsSuccess(): boolean;
FileCount(): number;
GetFile(_0: number): File;
GetErrorCode(): ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string;
delete(): void;
}

export interface MainModule {
File: {new(): File};
FileList: {new(): FileList};
Result: {new(): Result};
ConvertFileList(_0: FileList, _1: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string): Result;
ConvertFile(_0: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string, _1: ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string, _2: any, _3: any, _4: any): Result;
}
12 changes: 5 additions & 7 deletions docs/dist/assimpjs.js

Large diffs are not rendered by default.

Binary file modified docs/dist/assimpjs.wasm
Binary file not shown.
5 changes: 5 additions & 0 deletions docs/dist/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { MainModule } from "./assimpjs.d.ts";

declare module "assimpjs" {
export default function(): Promise<MainModule>;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Javascript interface for the assimp library.",
"license": "MIT",
"main": "./dist/assimpjs.js",
"types": "./dist/types.d.ts",
"repository": "github:kovacsv/assimpjs",
"keywords": [
"assimp",
Expand Down
2 changes: 2 additions & 0 deletions tools/build_wasm_win_dist.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ call npm run test || goto :error
mkdir dist
copy build_wasm\Release\assimpjs.js dist\assimpjs.js || goto :error
copy build_wasm\Release\assimpjs.wasm dist\assimpjs.wasm || goto :error
copy build_wasm\Release\assimpjs.d.ts dist\assimpjs.d.ts || goto :error
copy types\types.d.ts dist\types.d.ts || goto :error
copy assimp\LICENSE dist\license.assimp.txt || goto :error
copy LICENSE.md dist\license.assimpjs.txt || goto :error
xcopy dist\*.* docs\dist\*.* /K /D /H /Y
Expand Down
4 changes: 2 additions & 2 deletions tools/setup_emscripten_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ pushd %~dp0\..

call git clone https://github.com/emscripten-core/emsdk.git
call cd emsdk
call emsdk install 3.1.35
call emsdk activate 3.1.35
call emsdk install 3.1.48
call emsdk activate 3.1.48
call emsdk install mingw-7.1.0-64bit
call emsdk activate mingw-7.1.0-64bit
call cd ..
Expand Down
5 changes: 5 additions & 0 deletions types/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { MainModule } from "./assimpjs.d.ts";

declare module "assimpjs" {
export default function(): Promise<MainModule>;
}
Loading