motely-wasm 0.0.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.
- package/index.mjs +508 -0
- package/package.json +39 -0
- package/types/bindings.g.d.ts +1236 -0
- package/types/boot.d.ts +38 -0
- package/types/config.d.ts +6 -0
- package/types/decoder.d.ts +1 -0
- package/types/dotnet.g.d.ts +697 -0
- package/types/event.d.ts +49 -0
- package/types/exports.d.ts +3 -0
- package/types/imports.d.ts +2 -0
- package/types/index.d.ts +22 -0
- package/types/instances.d.ts +16 -0
- package/types/modules.d.ts +17 -0
- package/types/resources.d.ts +18 -0
- package/types/resources.g.d.ts +3 -0
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
// Resolved when building C# solution.
|
|
2
|
+
export const embedded = false;
|
|
3
|
+
export const mt = false;
|
|
4
|
+
|
|
5
|
+
// Types: https://github.com/dotnet/runtime/blob/v9.0.0/src/mono/browser/runtime/dotnet.d.ts
|
|
6
|
+
|
|
7
|
+
declare interface NativePointer {
|
|
8
|
+
__brandNativePointer: "NativePointer";
|
|
9
|
+
}
|
|
10
|
+
declare interface VoidPtr extends NativePointer {
|
|
11
|
+
__brand: "VoidPtr";
|
|
12
|
+
}
|
|
13
|
+
declare interface CharPtr extends NativePointer {
|
|
14
|
+
__brand: "CharPtr";
|
|
15
|
+
}
|
|
16
|
+
declare interface Int32Ptr extends NativePointer {
|
|
17
|
+
__brand: "Int32Ptr";
|
|
18
|
+
}
|
|
19
|
+
declare interface EmscriptenModule {
|
|
20
|
+
_malloc(size: number): VoidPtr;
|
|
21
|
+
_free(ptr: VoidPtr): void;
|
|
22
|
+
_sbrk(size: number): VoidPtr;
|
|
23
|
+
out(message: string): void;
|
|
24
|
+
err(message: string): void;
|
|
25
|
+
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
|
|
26
|
+
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
|
|
27
|
+
cwrap<T extends Function>(ident: string, ...args: any[]): T;
|
|
28
|
+
setValue(ptr: VoidPtr, value: number, type: string, noSafe?: number | boolean): void;
|
|
29
|
+
setValue(ptr: Int32Ptr, value: number, type: string, noSafe?: number | boolean): void;
|
|
30
|
+
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
|
|
31
|
+
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
|
|
32
|
+
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
|
|
33
|
+
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
|
|
34
|
+
lengthBytesUTF8(str: string): number;
|
|
35
|
+
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
|
|
36
|
+
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
|
|
37
|
+
addFunction(fn: Function, signature: string): number;
|
|
38
|
+
stackSave(): VoidPtr;
|
|
39
|
+
stackRestore(stack: VoidPtr): void;
|
|
40
|
+
stackAlloc(size: number): VoidPtr;
|
|
41
|
+
instantiateWasm?: InstantiateWasmCallBack;
|
|
42
|
+
preInit?: (() => any)[] | (() => any);
|
|
43
|
+
preRun?: (() => any)[] | (() => any);
|
|
44
|
+
onRuntimeInitialized?: () => any;
|
|
45
|
+
postRun?: (() => any)[] | (() => any);
|
|
46
|
+
onAbort?: {
|
|
47
|
+
(error: any): void;
|
|
48
|
+
};
|
|
49
|
+
onExit?: {
|
|
50
|
+
(code: number): void;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: WebAssembly.Module | undefined) => void;
|
|
54
|
+
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
|
|
55
|
+
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
56
|
+
|
|
57
|
+
interface DotnetHostBuilder {
|
|
58
|
+
/**
|
|
59
|
+
* @param config default values for the runtime configuration. It will be merged with the default values.
|
|
60
|
+
* Note that if you provide resources and don't provide custom configSrc URL, the blazor.boot.json will be downloaded and applied by default.
|
|
61
|
+
*/
|
|
62
|
+
withConfig(config: MonoConfig): DotnetHostBuilder;
|
|
63
|
+
/**
|
|
64
|
+
* @param configSrc URL to the configuration file. ./blazor.boot.json is a default config file location.
|
|
65
|
+
*/
|
|
66
|
+
withConfigSrc(configSrc: string): DotnetHostBuilder;
|
|
67
|
+
/**
|
|
68
|
+
* "command line" arguments for the Main() method.
|
|
69
|
+
* @param args
|
|
70
|
+
*/
|
|
71
|
+
withApplicationArguments(...args: string[]): DotnetHostBuilder;
|
|
72
|
+
/**
|
|
73
|
+
* Sets the environment variable for the "process"
|
|
74
|
+
*/
|
|
75
|
+
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
|
|
76
|
+
/**
|
|
77
|
+
* Sets the environment variables for the "process"
|
|
78
|
+
*/
|
|
79
|
+
withEnvironmentVariables(variables: {
|
|
80
|
+
[i: string]: string;
|
|
81
|
+
}): DotnetHostBuilder;
|
|
82
|
+
/**
|
|
83
|
+
* Sets the "current directory" for the "process" on the virtual file system.
|
|
84
|
+
*/
|
|
85
|
+
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
|
|
86
|
+
/**
|
|
87
|
+
* @param enabled if "true", writes diagnostic messages during runtime startup and execution to the browser console.
|
|
88
|
+
*/
|
|
89
|
+
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
|
|
90
|
+
/**
|
|
91
|
+
* @param level
|
|
92
|
+
* level > 0 enables debugging and sets the logging level to debug
|
|
93
|
+
* level == 0 disables debugging and enables interpreter optimizations
|
|
94
|
+
* level < 0 enables debugging and disables debug logging.
|
|
95
|
+
*/
|
|
96
|
+
withDebugging(level: number): DotnetHostBuilder;
|
|
97
|
+
/**
|
|
98
|
+
* @param mainAssemblyName Sets the name of the assembly with the Main() method. Default is the same as the .csproj name.
|
|
99
|
+
*/
|
|
100
|
+
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
|
|
101
|
+
/**
|
|
102
|
+
* Supply "command line" arguments for the Main() method from browser query arguments named "arg". Eg. `index.html?arg=A&arg=B&arg=C`.
|
|
103
|
+
* @param args
|
|
104
|
+
*/
|
|
105
|
+
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
|
|
106
|
+
/**
|
|
107
|
+
* Sets application environment, such as "Development", "Staging", "Production", etc.
|
|
108
|
+
*/
|
|
109
|
+
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
|
|
110
|
+
/**
|
|
111
|
+
* Sets application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
|
|
112
|
+
*/
|
|
113
|
+
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
|
|
114
|
+
/**
|
|
115
|
+
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
|
|
116
|
+
* from a custom source, such as an external CDN.
|
|
117
|
+
*/
|
|
118
|
+
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
|
|
119
|
+
/**
|
|
120
|
+
* Downloads all the assets but doesn't create the runtime instance.
|
|
121
|
+
*/
|
|
122
|
+
download(): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Starts the runtime and returns promise of the API object.
|
|
125
|
+
*/
|
|
126
|
+
create(): Promise<RuntimeAPI>;
|
|
127
|
+
/**
|
|
128
|
+
* Runs the Main() method of the application and exits the runtime.
|
|
129
|
+
* You can provide "command line" arguments for the Main() method using
|
|
130
|
+
* - dotnet.withApplicationArguments(["A", "B", "C"])
|
|
131
|
+
* - dotnet.withApplicationArgumentsFromQuery()
|
|
132
|
+
* Note: after the runtime exits, it would reject all further calls to the API.
|
|
133
|
+
* You can use runMain() if you want to keep the runtime alive.
|
|
134
|
+
*/
|
|
135
|
+
run(): Promise<number>;
|
|
136
|
+
}
|
|
137
|
+
type MonoConfig = {
|
|
138
|
+
/**
|
|
139
|
+
* Additional search locations for assets.
|
|
140
|
+
*/
|
|
141
|
+
remoteSources?: string[];
|
|
142
|
+
/**
|
|
143
|
+
* It will not fail the startup is .pdb files can't be downloaded
|
|
144
|
+
*/
|
|
145
|
+
ignorePdbLoadErrors?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* We are throttling parallel downloads in order to avoid net::ERR_INSUFFICIENT_RESOURCES on chrome. The default value is 16.
|
|
148
|
+
*/
|
|
149
|
+
maxParallelDownloads?: number;
|
|
150
|
+
/**
|
|
151
|
+
* We are making up to 2 more delayed attempts to download same asset. Default true.
|
|
152
|
+
*/
|
|
153
|
+
enableDownloadRetry?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Name of the assembly with main entrypoint
|
|
156
|
+
*/
|
|
157
|
+
mainAssemblyName?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Configures the runtime's globalization mode
|
|
160
|
+
*/
|
|
161
|
+
globalizationMode?: GlobalizationMode;
|
|
162
|
+
/**
|
|
163
|
+
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
|
|
164
|
+
* debugLevel == 0 disables debugging and enables interpreter optimizations
|
|
165
|
+
* debugLevel < 0 enables debugging and disables debug logging.
|
|
166
|
+
*/
|
|
167
|
+
debugLevel?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Gets a value that determines whether to enable caching of the 'resources' inside a CacheStorage instance within the browser.
|
|
170
|
+
*/
|
|
171
|
+
cacheBootResources?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Delay of the purge of the cached resources in milliseconds. Default is 10000 (10 seconds).
|
|
174
|
+
*/
|
|
175
|
+
cachedResourcesPurgeDelay?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Configures use of the `integrity` directive for fetching assets
|
|
178
|
+
*/
|
|
179
|
+
disableIntegrityCheck?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Configures use of the `no-cache` directive for fetching assets
|
|
182
|
+
*/
|
|
183
|
+
disableNoCacheFetch?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Enables diagnostic log messages during startup
|
|
186
|
+
*/
|
|
187
|
+
diagnosticTracing?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Dictionary-style Object containing environment variables
|
|
190
|
+
*/
|
|
191
|
+
environmentVariables?: {
|
|
192
|
+
[i: string]: string;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* initial number of workers to add to the emscripten pthread pool
|
|
196
|
+
*/
|
|
197
|
+
pthreadPoolInitialSize?: number;
|
|
198
|
+
/**
|
|
199
|
+
* number of unused workers kept in the emscripten pthread pool after startup
|
|
200
|
+
*/
|
|
201
|
+
pthreadPoolUnusedSize?: number;
|
|
202
|
+
/**
|
|
203
|
+
* If true, a list of the methods optimized by the interpreter will be saved and used for faster startup
|
|
204
|
+
* on future runs of the application
|
|
205
|
+
*/
|
|
206
|
+
interpreterPgo?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Configures how long to wait before saving the interpreter PGO list. If your application takes
|
|
209
|
+
* a while to start you should adjust this value.
|
|
210
|
+
*/
|
|
211
|
+
interpreterPgoSaveDelay?: number;
|
|
212
|
+
/**
|
|
213
|
+
* application environment
|
|
214
|
+
*/
|
|
215
|
+
applicationEnvironment?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
|
|
218
|
+
*/
|
|
219
|
+
applicationCulture?: string;
|
|
220
|
+
/**
|
|
221
|
+
* definition of assets to load along with the runtime.
|
|
222
|
+
*/
|
|
223
|
+
resources?: ResourceGroups;
|
|
224
|
+
/**
|
|
225
|
+
* appsettings files to load to VFS
|
|
226
|
+
*/
|
|
227
|
+
appsettings?: string[];
|
|
228
|
+
/**
|
|
229
|
+
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
|
|
230
|
+
*/
|
|
231
|
+
extensions?: {
|
|
232
|
+
[name: string]: any;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* This is initial working directory for the runtime on the virtual file system. Default is "/".
|
|
236
|
+
*/
|
|
237
|
+
virtualWorkingDirectory?: string;
|
|
238
|
+
/**
|
|
239
|
+
* This is the arguments to the Main() method of the program when called with dotnet.run() Default is [].
|
|
240
|
+
* Note: RuntimeAPI.runMain() and RuntimeAPI.runMainAndExit() will replace this value, if they provide it.
|
|
241
|
+
*/
|
|
242
|
+
applicationArguments?: string[];
|
|
243
|
+
};
|
|
244
|
+
type ResourceExtensions = {
|
|
245
|
+
[extensionName: string]: ResourceList;
|
|
246
|
+
};
|
|
247
|
+
interface ResourceGroups {
|
|
248
|
+
hash?: string;
|
|
249
|
+
fingerprinting?: {
|
|
250
|
+
[name: string]: string;
|
|
251
|
+
};
|
|
252
|
+
coreAssembly?: ResourceList;
|
|
253
|
+
assembly?: ResourceList;
|
|
254
|
+
lazyAssembly?: ResourceList;
|
|
255
|
+
corePdb?: ResourceList;
|
|
256
|
+
pdb?: ResourceList;
|
|
257
|
+
jsModuleWorker?: ResourceList;
|
|
258
|
+
jsModuleGlobalization?: ResourceList;
|
|
259
|
+
jsModuleNative: ResourceList;
|
|
260
|
+
jsModuleRuntime: ResourceList;
|
|
261
|
+
wasmSymbols?: ResourceList;
|
|
262
|
+
wasmNative: ResourceList;
|
|
263
|
+
icu?: ResourceList;
|
|
264
|
+
satelliteResources?: {
|
|
265
|
+
[cultureName: string]: ResourceList;
|
|
266
|
+
};
|
|
267
|
+
modulesAfterConfigLoaded?: ResourceList;
|
|
268
|
+
modulesAfterRuntimeReady?: ResourceList;
|
|
269
|
+
extensions?: ResourceExtensions;
|
|
270
|
+
coreVfs?: {
|
|
271
|
+
[virtualPath: string]: ResourceList;
|
|
272
|
+
};
|
|
273
|
+
vfs?: {
|
|
274
|
+
[virtualPath: string]: ResourceList;
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* A "key" is name of the file, a "value" is optional hash for integrity check.
|
|
279
|
+
*/
|
|
280
|
+
type ResourceList = {
|
|
281
|
+
[name: string]: string | null | "";
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
|
|
285
|
+
* from a custom source, such as an external CDN.
|
|
286
|
+
* @param type The type of the resource to be loaded.
|
|
287
|
+
* @param name The name of the resource to be loaded.
|
|
288
|
+
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
|
|
289
|
+
* @param integrity The integrity string representing the expected content in the response.
|
|
290
|
+
* @param behavior The detailed behavior/type of the resource to be loaded.
|
|
291
|
+
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
|
|
292
|
+
* When returned string is not qualified with `./` or absolute URL, it will be resolved against the application base URI.
|
|
293
|
+
*/
|
|
294
|
+
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string, behavior: AssetBehaviors) => string | Promise<Response> | null | undefined;
|
|
295
|
+
interface LoadingResource {
|
|
296
|
+
name: string;
|
|
297
|
+
url: string;
|
|
298
|
+
response: Promise<Response>;
|
|
299
|
+
}
|
|
300
|
+
interface AssetEntry {
|
|
301
|
+
/**
|
|
302
|
+
* the name of the asset, including extension.
|
|
303
|
+
*/
|
|
304
|
+
name: string;
|
|
305
|
+
/**
|
|
306
|
+
* determines how the asset will be handled once loaded
|
|
307
|
+
*/
|
|
308
|
+
behavior: AssetBehaviors;
|
|
309
|
+
/**
|
|
310
|
+
* this should be absolute url to the asset
|
|
311
|
+
*/
|
|
312
|
+
resolvedUrl?: string;
|
|
313
|
+
/**
|
|
314
|
+
* the integrity hash of the asset (if any)
|
|
315
|
+
*/
|
|
316
|
+
hash?: string | null | "";
|
|
317
|
+
/**
|
|
318
|
+
* If specified, overrides the path of the asset in the virtual filesystem and similar data structures once downloaded.
|
|
319
|
+
*/
|
|
320
|
+
virtualPath?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Culture code
|
|
323
|
+
*/
|
|
324
|
+
culture?: string;
|
|
325
|
+
/**
|
|
326
|
+
* If true, an attempt will be made to load the asset from each location in MonoConfig.remoteSources.
|
|
327
|
+
*/
|
|
328
|
+
loadRemote?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* If true, the runtime startup would not fail if the asset download was not successful.
|
|
331
|
+
*/
|
|
332
|
+
isOptional?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* If provided, runtime doesn't have to fetch the data.
|
|
335
|
+
* Runtime would set the buffer to null after instantiation to free the memory.
|
|
336
|
+
*/
|
|
337
|
+
buffer?: ArrayBuffer | Promise<ArrayBuffer>;
|
|
338
|
+
/**
|
|
339
|
+
* If provided, runtime doesn't have to import it's JavaScript modules.
|
|
340
|
+
* This will not work for multi-threaded runtime.
|
|
341
|
+
*/
|
|
342
|
+
moduleExports?: any | Promise<any>;
|
|
343
|
+
/**
|
|
344
|
+
* It's metadata + fetch-like Promise<Response>
|
|
345
|
+
* If provided, the runtime doesn't have to initiate the download. It would just await the response.
|
|
346
|
+
*/
|
|
347
|
+
pendingDownload?: LoadingResource;
|
|
348
|
+
}
|
|
349
|
+
type SingleAssetBehaviors =
|
|
350
|
+
/**
|
|
351
|
+
* The binary of the .NET runtime.
|
|
352
|
+
*/
|
|
353
|
+
"dotnetwasm"
|
|
354
|
+
/**
|
|
355
|
+
* The javascript module for loader.
|
|
356
|
+
*/
|
|
357
|
+
| "js-module-dotnet"
|
|
358
|
+
/**
|
|
359
|
+
* The javascript module for threads.
|
|
360
|
+
*/
|
|
361
|
+
| "js-module-threads"
|
|
362
|
+
/**
|
|
363
|
+
* The javascript module for runtime.
|
|
364
|
+
*/
|
|
365
|
+
| "js-module-runtime"
|
|
366
|
+
/**
|
|
367
|
+
* The javascript module for emscripten.
|
|
368
|
+
*/
|
|
369
|
+
| "js-module-native"
|
|
370
|
+
/**
|
|
371
|
+
* The javascript module for hybrid globalization.
|
|
372
|
+
*/
|
|
373
|
+
| "js-module-globalization"
|
|
374
|
+
/**
|
|
375
|
+
* Typically blazor.boot.json
|
|
376
|
+
*/
|
|
377
|
+
| "manifest"
|
|
378
|
+
/**
|
|
379
|
+
* The debugging symbols
|
|
380
|
+
*/
|
|
381
|
+
| "symbols"
|
|
382
|
+
/**
|
|
383
|
+
* Load segmentation rules file for Hybrid Globalization.
|
|
384
|
+
*/
|
|
385
|
+
| "segmentation-rules";
|
|
386
|
+
type AssetBehaviors = SingleAssetBehaviors |
|
|
387
|
+
/**
|
|
388
|
+
* Load asset as a managed resource assembly.
|
|
389
|
+
*/
|
|
390
|
+
"resource"
|
|
391
|
+
/**
|
|
392
|
+
* Load asset as a managed assembly.
|
|
393
|
+
*/
|
|
394
|
+
| "assembly"
|
|
395
|
+
/**
|
|
396
|
+
* Load asset as a managed debugging information.
|
|
397
|
+
*/
|
|
398
|
+
| "pdb"
|
|
399
|
+
/**
|
|
400
|
+
* Store asset into the native heap.
|
|
401
|
+
*/
|
|
402
|
+
| "heap"
|
|
403
|
+
/**
|
|
404
|
+
* Load asset as an ICU data archive.
|
|
405
|
+
*/
|
|
406
|
+
| "icu"
|
|
407
|
+
/**
|
|
408
|
+
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
|
|
409
|
+
*/
|
|
410
|
+
| "vfs"
|
|
411
|
+
/**
|
|
412
|
+
* The javascript module that came from nuget package .
|
|
413
|
+
*/
|
|
414
|
+
| "js-module-library-initializer";
|
|
415
|
+
declare const enum GlobalizationMode {
|
|
416
|
+
/**
|
|
417
|
+
* Load sharded ICU data.
|
|
418
|
+
*/
|
|
419
|
+
Sharded = "sharded",
|
|
420
|
+
/**
|
|
421
|
+
* Load all ICU data.
|
|
422
|
+
*/
|
|
423
|
+
All = "all",
|
|
424
|
+
/**
|
|
425
|
+
* Operate in invariant globalization mode.
|
|
426
|
+
*/
|
|
427
|
+
Invariant = "invariant",
|
|
428
|
+
/**
|
|
429
|
+
* Use user defined icu file.
|
|
430
|
+
*/
|
|
431
|
+
Custom = "custom",
|
|
432
|
+
/**
|
|
433
|
+
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
|
|
434
|
+
*/
|
|
435
|
+
Hybrid = "hybrid"
|
|
436
|
+
}
|
|
437
|
+
type DotnetModuleConfig = {
|
|
438
|
+
config?: MonoConfig;
|
|
439
|
+
configSrc?: string;
|
|
440
|
+
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
|
|
441
|
+
onDotnetReady?: () => void | Promise<void>;
|
|
442
|
+
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
|
|
443
|
+
imports?: any;
|
|
444
|
+
exports?: string[];
|
|
445
|
+
} & Partial<EmscriptenModule>;
|
|
446
|
+
type APIType = {
|
|
447
|
+
/**
|
|
448
|
+
* Runs the Main() method of the application.
|
|
449
|
+
* Note: this will keep the .NET runtime alive and the APIs will be available for further calls.
|
|
450
|
+
* @param mainAssemblyName name of the assembly with the Main() method. Optional. Default is the same as the .csproj name.
|
|
451
|
+
* @param args command line arguments for the Main() method. Optional.
|
|
452
|
+
* @returns exit code of the Main() method.
|
|
453
|
+
*/
|
|
454
|
+
runMain: (mainAssemblyName?: string, args?: string[]) => Promise<number>;
|
|
455
|
+
/**
|
|
456
|
+
* Runs the Main() method of the application and exits the runtime.
|
|
457
|
+
* Note: after the runtime exits, it would reject all further calls to the API.
|
|
458
|
+
* @param mainAssemblyName name of the assembly with the Main() method. Optional. Default is the same as the .csproj name.
|
|
459
|
+
* @param args command line arguments for the Main() method. Optional.
|
|
460
|
+
* @returns exit code of the Main() method.
|
|
461
|
+
*/
|
|
462
|
+
runMainAndExit: (mainAssemblyName?: string, args?: string[]) => Promise<number>;
|
|
463
|
+
/**
|
|
464
|
+
* Exits the runtime.
|
|
465
|
+
* Note: after the runtime exits, it would reject all further calls to the API.
|
|
466
|
+
* @param code "process" exit code.
|
|
467
|
+
* @param reason could be a string or an Error object.
|
|
468
|
+
*/
|
|
469
|
+
exit: (code: number, reason?: any) => void;
|
|
470
|
+
/**
|
|
471
|
+
* Sets the environment variable for the "process"
|
|
472
|
+
* @param name
|
|
473
|
+
* @param value
|
|
474
|
+
*/
|
|
475
|
+
setEnvironmentVariable: (name: string, value: string) => void;
|
|
476
|
+
/**
|
|
477
|
+
* Returns the [JSExport] methods of the assembly with the given name
|
|
478
|
+
* @param assemblyName
|
|
479
|
+
*/
|
|
480
|
+
getAssemblyExports(assemblyName: string): Promise<any>;
|
|
481
|
+
/**
|
|
482
|
+
* Provides functions which could be imported by the managed code using [JSImport]
|
|
483
|
+
* @param moduleName maps to the second parameter of [JSImport]
|
|
484
|
+
* @param moduleImports object with functions which could be imported by the managed code. The keys map to the first parameter of [JSImport]
|
|
485
|
+
*/
|
|
486
|
+
setModuleImports(moduleName: string, moduleImports: any): void;
|
|
487
|
+
/**
|
|
488
|
+
* Returns the configuration object used to start the runtime.
|
|
489
|
+
*/
|
|
490
|
+
getConfig: () => MonoConfig;
|
|
491
|
+
/**
|
|
492
|
+
* Executes scripts which were loaded during runtime bootstrap.
|
|
493
|
+
* You can register the scripts using MonoConfig.resources.modulesAfterConfigLoaded and MonoConfig.resources.modulesAfterRuntimeReady.
|
|
494
|
+
*/
|
|
495
|
+
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
|
|
496
|
+
/**
|
|
497
|
+
* Writes to the WASM linear memory
|
|
498
|
+
*/
|
|
499
|
+
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
|
|
500
|
+
/**
|
|
501
|
+
* Writes to the WASM linear memory
|
|
502
|
+
*/
|
|
503
|
+
setHeapB8: (offset: NativePointer, value: number | boolean) => void;
|
|
504
|
+
/**
|
|
505
|
+
* Writes to the WASM linear memory
|
|
506
|
+
*/
|
|
507
|
+
setHeapU8: (offset: NativePointer, value: number) => void;
|
|
508
|
+
/**
|
|
509
|
+
* Writes to the WASM linear memory
|
|
510
|
+
*/
|
|
511
|
+
setHeapU16: (offset: NativePointer, value: number) => void;
|
|
512
|
+
/**
|
|
513
|
+
* Writes to the WASM linear memory
|
|
514
|
+
*/
|
|
515
|
+
setHeapU32: (offset: NativePointer, value: NativePointer | number) => void;
|
|
516
|
+
/**
|
|
517
|
+
* Writes to the WASM linear memory
|
|
518
|
+
*/
|
|
519
|
+
setHeapI8: (offset: NativePointer, value: number) => void;
|
|
520
|
+
/**
|
|
521
|
+
* Writes to the WASM linear memory
|
|
522
|
+
*/
|
|
523
|
+
setHeapI16: (offset: NativePointer, value: number) => void;
|
|
524
|
+
/**
|
|
525
|
+
* Writes to the WASM linear memory
|
|
526
|
+
*/
|
|
527
|
+
setHeapI32: (offset: NativePointer, value: number) => void;
|
|
528
|
+
/**
|
|
529
|
+
* Writes to the WASM linear memory
|
|
530
|
+
*/
|
|
531
|
+
setHeapI52: (offset: NativePointer, value: number) => void;
|
|
532
|
+
/**
|
|
533
|
+
* Writes to the WASM linear memory
|
|
534
|
+
*/
|
|
535
|
+
setHeapU52: (offset: NativePointer, value: number) => void;
|
|
536
|
+
/**
|
|
537
|
+
* Writes to the WASM linear memory
|
|
538
|
+
*/
|
|
539
|
+
setHeapI64Big: (offset: NativePointer, value: bigint) => void;
|
|
540
|
+
/**
|
|
541
|
+
* Writes to the WASM linear memory
|
|
542
|
+
*/
|
|
543
|
+
setHeapF32: (offset: NativePointer, value: number) => void;
|
|
544
|
+
/**
|
|
545
|
+
* Writes to the WASM linear memory
|
|
546
|
+
*/
|
|
547
|
+
setHeapF64: (offset: NativePointer, value: number) => void;
|
|
548
|
+
/**
|
|
549
|
+
* Reads from the WASM linear memory
|
|
550
|
+
*/
|
|
551
|
+
getHeapB32: (offset: NativePointer) => boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Reads from the WASM linear memory
|
|
554
|
+
*/
|
|
555
|
+
getHeapB8: (offset: NativePointer) => boolean;
|
|
556
|
+
/**
|
|
557
|
+
* Reads from the WASM linear memory
|
|
558
|
+
*/
|
|
559
|
+
getHeapU8: (offset: NativePointer) => number;
|
|
560
|
+
/**
|
|
561
|
+
* Reads from the WASM linear memory
|
|
562
|
+
*/
|
|
563
|
+
getHeapU16: (offset: NativePointer) => number;
|
|
564
|
+
/**
|
|
565
|
+
* Reads from the WASM linear memory
|
|
566
|
+
*/
|
|
567
|
+
getHeapU32: (offset: NativePointer) => number;
|
|
568
|
+
/**
|
|
569
|
+
* Reads from the WASM linear memory
|
|
570
|
+
*/
|
|
571
|
+
getHeapI8: (offset: NativePointer) => number;
|
|
572
|
+
/**
|
|
573
|
+
* Reads from the WASM linear memory
|
|
574
|
+
*/
|
|
575
|
+
getHeapI16: (offset: NativePointer) => number;
|
|
576
|
+
/**
|
|
577
|
+
* Reads from the WASM linear memory
|
|
578
|
+
*/
|
|
579
|
+
getHeapI32: (offset: NativePointer) => number;
|
|
580
|
+
/**
|
|
581
|
+
* Reads from the WASM linear memory
|
|
582
|
+
*/
|
|
583
|
+
getHeapI52: (offset: NativePointer) => number;
|
|
584
|
+
/**
|
|
585
|
+
* Reads from the WASM linear memory
|
|
586
|
+
*/
|
|
587
|
+
getHeapU52: (offset: NativePointer) => number;
|
|
588
|
+
/**
|
|
589
|
+
* Reads from the WASM linear memory
|
|
590
|
+
*/
|
|
591
|
+
getHeapI64Big: (offset: NativePointer) => bigint;
|
|
592
|
+
/**
|
|
593
|
+
* Reads from the WASM linear memory
|
|
594
|
+
*/
|
|
595
|
+
getHeapF32: (offset: NativePointer) => number;
|
|
596
|
+
/**
|
|
597
|
+
* Reads from the WASM linear memory
|
|
598
|
+
*/
|
|
599
|
+
getHeapF64: (offset: NativePointer) => number;
|
|
600
|
+
/**
|
|
601
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
602
|
+
*/
|
|
603
|
+
localHeapViewI8: () => Int8Array;
|
|
604
|
+
/**
|
|
605
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
606
|
+
*/
|
|
607
|
+
localHeapViewI16: () => Int16Array;
|
|
608
|
+
/**
|
|
609
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
610
|
+
*/
|
|
611
|
+
localHeapViewI32: () => Int32Array;
|
|
612
|
+
/**
|
|
613
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
614
|
+
*/
|
|
615
|
+
localHeapViewI64Big: () => BigInt64Array;
|
|
616
|
+
/**
|
|
617
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
618
|
+
*/
|
|
619
|
+
localHeapViewU8: () => Uint8Array;
|
|
620
|
+
/**
|
|
621
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
622
|
+
*/
|
|
623
|
+
localHeapViewU16: () => Uint16Array;
|
|
624
|
+
/**
|
|
625
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
626
|
+
*/
|
|
627
|
+
localHeapViewU32: () => Uint32Array;
|
|
628
|
+
/**
|
|
629
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
630
|
+
*/
|
|
631
|
+
localHeapViewF32: () => Float32Array;
|
|
632
|
+
/**
|
|
633
|
+
* Returns a short term view of the WASM linear memory. Don't store the reference, don't use it after await.
|
|
634
|
+
*/
|
|
635
|
+
localHeapViewF64: () => Float64Array;
|
|
636
|
+
};
|
|
637
|
+
type RuntimeAPI = {
|
|
638
|
+
INTERNAL: any;
|
|
639
|
+
Module: EmscriptenModule;
|
|
640
|
+
runtimeId: number;
|
|
641
|
+
runtimeBuildInfo: {
|
|
642
|
+
productVersion: string;
|
|
643
|
+
gitHash: string;
|
|
644
|
+
buildConfiguration: string;
|
|
645
|
+
wasmEnableThreads: boolean;
|
|
646
|
+
wasmEnableSIMD: boolean;
|
|
647
|
+
wasmEnableExceptionHandling: boolean;
|
|
648
|
+
};
|
|
649
|
+
} & APIType;
|
|
650
|
+
type ModuleAPI = {
|
|
651
|
+
/**
|
|
652
|
+
* The builder for the .NET runtime.
|
|
653
|
+
*/
|
|
654
|
+
dotnet: DotnetHostBuilder;
|
|
655
|
+
/**
|
|
656
|
+
* Terminates the runtime "process" and reject all further calls to the API.
|
|
657
|
+
*/
|
|
658
|
+
exit: (code: number, reason?: any) => void;
|
|
659
|
+
};
|
|
660
|
+
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
|
|
661
|
+
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";
|
|
662
|
+
|
|
663
|
+
interface IDisposable {
|
|
664
|
+
dispose(): void;
|
|
665
|
+
get isDisposed(): boolean;
|
|
666
|
+
}
|
|
667
|
+
interface IMemoryView extends IDisposable {
|
|
668
|
+
/**
|
|
669
|
+
* copies elements from provided source to the wasm memory.
|
|
670
|
+
* target has to have the elements of the same type as the underlying C# array.
|
|
671
|
+
* same as TypedArray.set()
|
|
672
|
+
*/
|
|
673
|
+
set(source: TypedArray, targetOffset?: number): void;
|
|
674
|
+
/**
|
|
675
|
+
* copies elements from wasm memory to provided target.
|
|
676
|
+
* target has to have the elements of the same type as the underlying C# array.
|
|
677
|
+
*/
|
|
678
|
+
copyTo(target: TypedArray, sourceOffset?: number): void;
|
|
679
|
+
/**
|
|
680
|
+
* same as TypedArray.slice()
|
|
681
|
+
*/
|
|
682
|
+
slice(start?: number, end?: number): TypedArray;
|
|
683
|
+
get length(): number;
|
|
684
|
+
get byteLength(): number;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
declare function mono_exit(exit_code: number, reason?: any): void;
|
|
688
|
+
|
|
689
|
+
declare const dotnet: DotnetHostBuilder;
|
|
690
|
+
declare const exit: typeof mono_exit;
|
|
691
|
+
|
|
692
|
+
declare global {
|
|
693
|
+
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
|
|
694
|
+
}
|
|
695
|
+
declare const createDotnetRuntime: CreateDotnetRuntimeType;
|
|
696
|
+
|
|
697
|
+
export { type AssetBehaviors, type AssetEntry, type CreateDotnetRuntimeType, type DotnetHostBuilder, type DotnetModuleConfig, type EmscriptenModule, GlobalizationMode, type IMemoryView, type ModuleAPI, type MonoConfig, type RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
|