Fixed missing webassembly type declarations (npm repo for that went down)
This commit is contained in:
parent
2e8693790f
commit
c8ebb5fd03
9 changed files with 226 additions and 1 deletions
|
@ -5,7 +5,10 @@
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outFile": "WorkerPOW.js"
|
"outFile": "WorkerPOW.js"
|
||||||
},
|
},
|
||||||
|
"include": [
|
||||||
|
"../../types/*.d.ts"
|
||||||
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"pow/POWWorker.ts",
|
"pow/POWWorker.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@
|
||||||
"../js/workers"
|
"../js/workers"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
|
"../types",
|
||||||
"../declarations/imports_*.d.ts",
|
"../declarations/imports_*.d.ts",
|
||||||
"../backend",
|
"../backend",
|
||||||
"../js/**/*.ts"
|
"../js/**/*.ts"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"../js/load.ts"
|
"../js/load.ts"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
|
"../types",
|
||||||
"../declarations/imports_*.d.ts",
|
"../declarations/imports_*.d.ts",
|
||||||
"../declarations/exports_loader.d.ts",
|
"../declarations/exports_loader.d.ts",
|
||||||
"../js/**/*.ts",
|
"../js/**/*.ts",
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
"../types",
|
||||||
"../declarations/imports_*.d.ts",
|
"../declarations/imports_*.d.ts",
|
||||||
"../declarations/exports_packed.d.ts",
|
"../declarations/exports_packed.d.ts",
|
||||||
"../js/load.ts",
|
"../js/load.ts",
|
||||||
|
|
107
shared/types/webassembly-js-api.d.ts
vendored
Normal file
107
shared/types/webassembly-js-api.d.ts
vendored
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
// Type definitions for WebAssembly v1 (MVP)
|
||||||
|
// Project: https://github.com/winksaville/test-webassembly-js-ts
|
||||||
|
// Definitions by: 01alchemist <https://twitter.com/01alchemist>, Wink Saville <wink@saville.com>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The WebAssembly namespace, see [WebAssembly](https://github.com/webassembly)
|
||||||
|
* and [WebAssembly JS API](http://webassembly.org/getting-started/js-api/)
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
declare namespace WebAssembly {
|
||||||
|
/**
|
||||||
|
* WebAssembly.Module
|
||||||
|
*/
|
||||||
|
class Module {
|
||||||
|
constructor(bufferSource: ArrayBuffer | Uint8Array);
|
||||||
|
static customSections(module: Module, sectionName: string): ArrayBuffer[];
|
||||||
|
static exports(module: Module): Array<{
|
||||||
|
name: string;
|
||||||
|
kind: string;
|
||||||
|
}>;
|
||||||
|
static imports(module: Module): Array<{
|
||||||
|
module: string;
|
||||||
|
name: string;
|
||||||
|
kind: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebAssembly.Instance
|
||||||
|
*/
|
||||||
|
class Instance {
|
||||||
|
readonly exports: any;
|
||||||
|
constructor(module: Module, importObject?: any);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebAssembly.Memory
|
||||||
|
* Note: A WebAssembly page has a constant size of 65,536 bytes, i.e., 64KiB.
|
||||||
|
*/
|
||||||
|
interface MemoryDescriptor {
|
||||||
|
initial: number;
|
||||||
|
maximum?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Memory {
|
||||||
|
readonly buffer: ArrayBuffer;
|
||||||
|
constructor(memoryDescriptor: MemoryDescriptor);
|
||||||
|
grow(numPages: number): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebAssembly.Table
|
||||||
|
*/
|
||||||
|
interface TableDescriptor {
|
||||||
|
element: "anyfunc";
|
||||||
|
initial: number;
|
||||||
|
maximum?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Table {
|
||||||
|
readonly length: number;
|
||||||
|
constructor(tableDescriptor: TableDescriptor);
|
||||||
|
get(index: number): (args: any[]) => any;
|
||||||
|
grow(numElements: number): number;
|
||||||
|
set(index: number, value: (args: any[]) => any): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Errors
|
||||||
|
*/
|
||||||
|
class CompileError extends Error {
|
||||||
|
readonly fileName: string;
|
||||||
|
readonly lineNumber: string;
|
||||||
|
readonly columnNumber: string;
|
||||||
|
constructor(message?: string, fileName?: string, lineNumber?: number);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
class LinkError extends Error {
|
||||||
|
readonly fileName: string;
|
||||||
|
readonly lineNumber: string;
|
||||||
|
readonly columnNumber: string;
|
||||||
|
constructor(message?: string, fileName?: string, lineNumber?: number);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RuntimeError extends Error {
|
||||||
|
readonly fileName: string;
|
||||||
|
readonly lineNumber: string;
|
||||||
|
readonly columnNumber: string;
|
||||||
|
constructor(message?: string, fileName?: string, lineNumber?: number);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function compile(bufferSource: ArrayBuffer | Uint8Array): Promise<Module>;
|
||||||
|
|
||||||
|
interface ResultObject {
|
||||||
|
module: Module;
|
||||||
|
instance: Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
function instantiate(bufferSource: ArrayBuffer | Uint8Array, importObject?: any): Promise<ResultObject>;
|
||||||
|
function instantiate(module: Module, importObject?: any): Promise<Instance>;
|
||||||
|
|
||||||
|
function validate(bufferSource: ArrayBuffer | Uint8Array): boolean;
|
||||||
|
}
|
|
@ -5,6 +5,9 @@
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outFile": "WorkerCodec.js"
|
"outFile": "WorkerCodec.js"
|
||||||
},
|
},
|
||||||
|
"include": [
|
||||||
|
"../../types/"
|
||||||
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"codec/CodecWorker.ts",
|
"codec/CodecWorker.ts",
|
||||||
"codec/OpusCodec.ts",
|
"codec/OpusCodec.ts",
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
"../types",
|
||||||
"../declarations/imports_*.d.ts",
|
"../declarations/imports_*.d.ts",
|
||||||
"../js/**/*.ts"
|
"../js/**/*.ts"
|
||||||
]
|
]
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"../js/workers"
|
"../js/workers"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
|
"../types",
|
||||||
"../declarations/imports_*.d.ts",
|
"../declarations/imports_*.d.ts",
|
||||||
"../js/**/*.ts"
|
"../js/**/*.ts"
|
||||||
]
|
]
|
||||||
|
|
107
web/types/webassembly-js-api.d.ts
vendored
Normal file
107
web/types/webassembly-js-api.d.ts
vendored
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
// Type definitions for WebAssembly v1 (MVP)
|
||||||
|
// Project: https://github.com/winksaville/test-webassembly-js-ts
|
||||||
|
// Definitions by: 01alchemist <https://twitter.com/01alchemist>, Wink Saville <wink@saville.com>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The WebAssembly namespace, see [WebAssembly](https://github.com/webassembly)
|
||||||
|
* and [WebAssembly JS API](http://webassembly.org/getting-started/js-api/)
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
declare namespace WebAssembly {
|
||||||
|
/**
|
||||||
|
* WebAssembly.Module
|
||||||
|
*/
|
||||||
|
class Module {
|
||||||
|
constructor(bufferSource: ArrayBuffer | Uint8Array);
|
||||||
|
static customSections(module: Module, sectionName: string): ArrayBuffer[];
|
||||||
|
static exports(module: Module): Array<{
|
||||||
|
name: string;
|
||||||
|
kind: string;
|
||||||
|
}>;
|
||||||
|
static imports(module: Module): Array<{
|
||||||
|
module: string;
|
||||||
|
name: string;
|
||||||
|
kind: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebAssembly.Instance
|
||||||
|
*/
|
||||||
|
class Instance {
|
||||||
|
readonly exports: any;
|
||||||
|
constructor(module: Module, importObject?: any);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebAssembly.Memory
|
||||||
|
* Note: A WebAssembly page has a constant size of 65,536 bytes, i.e., 64KiB.
|
||||||
|
*/
|
||||||
|
interface MemoryDescriptor {
|
||||||
|
initial: number;
|
||||||
|
maximum?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Memory {
|
||||||
|
readonly buffer: ArrayBuffer;
|
||||||
|
constructor(memoryDescriptor: MemoryDescriptor);
|
||||||
|
grow(numPages: number): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebAssembly.Table
|
||||||
|
*/
|
||||||
|
interface TableDescriptor {
|
||||||
|
element: "anyfunc";
|
||||||
|
initial: number;
|
||||||
|
maximum?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Table {
|
||||||
|
readonly length: number;
|
||||||
|
constructor(tableDescriptor: TableDescriptor);
|
||||||
|
get(index: number): (args: any[]) => any;
|
||||||
|
grow(numElements: number): number;
|
||||||
|
set(index: number, value: (args: any[]) => any): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Errors
|
||||||
|
*/
|
||||||
|
class CompileError extends Error {
|
||||||
|
readonly fileName: string;
|
||||||
|
readonly lineNumber: string;
|
||||||
|
readonly columnNumber: string;
|
||||||
|
constructor(message?: string, fileName?: string, lineNumber?: number);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
class LinkError extends Error {
|
||||||
|
readonly fileName: string;
|
||||||
|
readonly lineNumber: string;
|
||||||
|
readonly columnNumber: string;
|
||||||
|
constructor(message?: string, fileName?: string, lineNumber?: number);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RuntimeError extends Error {
|
||||||
|
readonly fileName: string;
|
||||||
|
readonly lineNumber: string;
|
||||||
|
readonly columnNumber: string;
|
||||||
|
constructor(message?: string, fileName?: string, lineNumber?: number);
|
||||||
|
toString(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function compile(bufferSource: ArrayBuffer | Uint8Array): Promise<Module>;
|
||||||
|
|
||||||
|
interface ResultObject {
|
||||||
|
module: Module;
|
||||||
|
instance: Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
function instantiate(bufferSource: ArrayBuffer | Uint8Array, importObject?: any): Promise<ResultObject>;
|
||||||
|
function instantiate(module: Module, importObject?: any): Promise<Instance>;
|
||||||
|
|
||||||
|
function validate(bufferSource: ArrayBuffer | Uint8Array): boolean;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue