3
3
//!
4
4
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js
5
5
6
- //! This is not considered public API with backward compatibility guarantees.
7
-
8
- interface DotnetHostBuilder {
9
- withConfig ( config : MonoConfig ) : DotnetHostBuilder ;
10
- withConfigSrc ( configSrc : string ) : DotnetHostBuilder ;
11
- withApplicationArguments ( ...args : string [ ] ) : DotnetHostBuilder ;
12
- withEnvironmentVariable ( name : string , value : string ) : DotnetHostBuilder ;
13
- withEnvironmentVariables ( variables : {
14
- [ i : string ] : string ;
15
- } ) : DotnetHostBuilder ;
16
- withVirtualWorkingDirectory ( vfsPath : string ) : DotnetHostBuilder ;
17
- withDiagnosticTracing ( enabled : boolean ) : DotnetHostBuilder ;
18
- withDebugging ( level : number ) : DotnetHostBuilder ;
19
- withMainAssembly ( mainAssemblyName : string ) : DotnetHostBuilder ;
20
- withApplicationArgumentsFromQuery ( ) : DotnetHostBuilder ;
21
- create ( ) : Promise < RuntimeAPI > ;
22
- run ( ) : Promise < number > ;
23
- }
6
+ //! This is not considered public API with backward compatibility guarantees.
24
7
25
8
declare interface NativePointer {
26
9
__brandNativePointer : "NativePointer" ;
@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
35
18
__brand : "Int32Ptr" ;
36
19
}
37
20
declare interface EmscriptenModule {
21
+ /** @deprecated Please use growableHeapI8() instead.*/
38
22
HEAP8 : Int8Array ;
23
+ /** @deprecated Please use growableHeapI16() instead.*/
39
24
HEAP16 : Int16Array ;
25
+ /** @deprecated Please use growableHeapI32() instead. */
40
26
HEAP32 : Int32Array ;
27
+ /** @deprecated Please use growableHeapI64() instead. */
28
+ HEAP64 : BigInt64Array ;
29
+ /** @deprecated Please use growableHeapU8() instead. */
41
30
HEAPU8 : Uint8Array ;
31
+ /** @deprecated Please use growableHeapU16() instead. */
42
32
HEAPU16 : Uint16Array ;
33
+ /** @deprecated Please use growableHeapU32() instead */
43
34
HEAPU32 : Uint32Array ;
35
+ /** @deprecated Please use growableHeapF32() instead */
44
36
HEAPF32 : Float32Array ;
37
+ /** @deprecated Please use growableHeapF64() instead. */
45
38
HEAPF64 : Float64Array ;
46
39
_malloc ( size : number ) : VoidPtr ;
47
40
_free ( ptr : VoidPtr ) : void ;
48
- print ( message : string ) : void ;
49
- printErr ( message : string ) : void ;
41
+ out ( message : string ) : void ;
42
+ err ( message : string ) : void ;
50
43
ccall < T > ( ident : string , returnType ?: string | null , argTypes ?: string [ ] , args ?: any [ ] , opts ?: any ) : T ;
51
44
cwrap < T extends Function > ( ident : string , returnType : string , argTypes ?: string [ ] , opts ?: any ) : T ;
52
45
cwrap < T extends Function > ( ident : string , ...args : any [ ] ) : T ;
@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
55
48
getValue ( ptr : number , type : string , noSafe ?: number | boolean ) : number ;
56
49
UTF8ToString ( ptr : CharPtr , maxBytesToRead ?: number ) : string ;
57
50
UTF8ArrayToString ( u8Array : Uint8Array , idx ?: number , maxBytesToRead ?: number ) : string ;
51
+ stringToUTF8Array ( str : string , heap : Uint8Array , outIdx : number , maxBytesToWrite : number ) : void ;
58
52
FS_createPath ( parent : string , path : string , canRead ?: boolean , canWrite ?: boolean ) : string ;
59
53
FS_createDataFile ( parent : string , name : string , data : TypedArray , canRead : boolean , canWrite : boolean , canOwn ?: boolean ) : string ;
60
- FS_readFile ( filename : string , opts : any ) : any ;
61
- removeRunDependency ( id : string ) : void ;
62
- addRunDependency ( id : string ) : void ;
63
54
addFunction ( fn : Function , signature : string ) : number ;
64
- getWasmTableEntry ( index : number ) : any ;
65
55
stackSave ( ) : VoidPtr ;
66
56
stackRestore ( stack : VoidPtr ) : void ;
67
57
stackAlloc ( size : number ) : VoidPtr ;
68
- ready : Promise < unknown > ;
69
58
instantiateWasm ?: InstantiateWasmCallBack ;
70
59
preInit ?: ( ( ) => any ) [ ] | ( ( ) => any ) ;
71
60
preRun ?: ( ( ) => any ) [ ] | ( ( ) => any ) ;
@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
79
68
type InstantiateWasmCallBack = ( imports : WebAssembly . Imports , successCallback : InstantiateWasmSuccessCallback ) => any ;
80
69
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array ;
81
70
71
+ interface DotnetHostBuilder {
72
+ withConfig ( config : MonoConfig ) : DotnetHostBuilder ;
73
+ withConfigSrc ( configSrc : string ) : DotnetHostBuilder ;
74
+ withApplicationArguments ( ...args : string [ ] ) : DotnetHostBuilder ;
75
+ withEnvironmentVariable ( name : string , value : string ) : DotnetHostBuilder ;
76
+ withEnvironmentVariables ( variables : {
77
+ [ i : string ] : string ;
78
+ } ) : DotnetHostBuilder ;
79
+ withVirtualWorkingDirectory ( vfsPath : string ) : DotnetHostBuilder ;
80
+ withDiagnosticTracing ( enabled : boolean ) : DotnetHostBuilder ;
81
+ withDebugging ( level : number ) : DotnetHostBuilder ;
82
+ withMainAssembly ( mainAssemblyName : string ) : DotnetHostBuilder ;
83
+ withApplicationArgumentsFromQuery ( ) : DotnetHostBuilder ;
84
+ withApplicationEnvironment ( applicationEnvironment ?: string ) : DotnetHostBuilder ;
85
+ withApplicationCulture ( applicationCulture ?: string ) : DotnetHostBuilder ;
86
+ /**
87
+ * Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
88
+ * from a custom source, such as an external CDN.
89
+ */
90
+ withResourceLoader ( loadBootResource ?: LoadBootResourceCallback ) : DotnetHostBuilder ;
91
+ create ( ) : Promise < RuntimeAPI > ;
92
+ run ( ) : Promise < number > ;
93
+ }
82
94
type MonoConfig = {
83
95
/**
84
96
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
@@ -115,7 +127,7 @@ type MonoConfig = {
115
127
/**
116
128
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
117
129
* debugLevel == 0 disables debugging and enables interpreter optimizations
118
- * debugLevel < 0 enabled debugging and disables debug logging.
130
+ * debugLevel < 0 enables debugging and disables debug logging.
119
131
*/
120
132
debugLevel ?: number ;
121
133
/**
@@ -136,11 +148,63 @@ type MonoConfig = {
136
148
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
137
149
*/
138
150
startupMemoryCache ?: boolean ;
151
+ /**
152
+ * hash of assets
153
+ */
154
+ assetsHash ?: string ;
139
155
/**
140
156
* application environment
141
157
*/
142
158
applicationEnvironment ?: string ;
159
+ /**
160
+ * Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
161
+ */
162
+ applicationCulture ?: string ;
163
+ /**
164
+ * definition of assets to load along with the runtime.
165
+ */
166
+ resources ?: ResourceGroups ;
167
+ /**
168
+ * config extensions declared in MSBuild items @(WasmBootConfigExtension)
169
+ */
170
+ extensions ?: {
171
+ [ name : string ] : any ;
172
+ } ;
173
+ } ;
174
+ type ResourceExtensions = {
175
+ [ extensionName : string ] : ResourceList ;
176
+ } ;
177
+ interface ResourceGroups {
178
+ readonly hash ?: string ;
179
+ readonly assembly ?: ResourceList ;
180
+ readonly lazyAssembly ?: ResourceList ;
181
+ readonly pdb ?: ResourceList ;
182
+ readonly runtime ?: ResourceList ;
183
+ readonly satelliteResources ?: {
184
+ [ cultureName : string ] : ResourceList ;
185
+ } ;
186
+ readonly libraryInitializers ?: {
187
+ readonly onRuntimeConfigLoaded : ResourceList ;
188
+ readonly onRuntimeReady : ResourceList ;
189
+ } ;
190
+ readonly extensions ?: ResourceExtensions ;
191
+ readonly vfs ?: {
192
+ [ virtualPath : string ] : ResourceList ;
193
+ } ;
194
+ }
195
+ type ResourceList = {
196
+ [ name : string ] : string ;
143
197
} ;
198
+ /**
199
+ * Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
200
+ * from a custom source, such as an external CDN.
201
+ * @param type The type of the resource to be loaded.
202
+ * @param name The name of the resource to be loaded.
203
+ * @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
204
+ * @param integrity The integrity string representing the expected content in the response.
205
+ * @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
206
+ */
207
+ type LoadBootResourceCallback = ( type : WebAssemblyBootResourceType , name : string , defaultUri : string , integrity : string ) => string | Promise < Response > | null | undefined ;
144
208
interface ResourceRequest {
145
209
name : string ;
146
210
behavior : AssetBehaviours ;
@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
180
244
*/
181
245
pendingDownload ?: LoadingResource ;
182
246
}
183
- type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads" ;
184
- type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
185
- "invariant" | // operate in invariant globalization mode.
186
- "auto" ;
247
+ type AssetBehaviours =
248
+ /**
249
+ * Load asset as a managed resource assembly.
250
+ */
251
+ "resource"
252
+ /**
253
+ * Load asset as a managed assembly.
254
+ */
255
+ | "assembly"
256
+ /**
257
+ * Load asset as a managed debugging information.
258
+ */
259
+ | "pdb"
260
+ /**
261
+ * Store asset into the native heap.
262
+ */
263
+ | "heap"
264
+ /**
265
+ * Load asset as an ICU data archive.
266
+ */
267
+ | "icu"
268
+ /**
269
+ * Load asset into the virtual filesystem (for fopen, File.Open, etc).
270
+ */
271
+ | "vfs"
272
+ /**
273
+ * The binary of the dotnet runtime.
274
+ */
275
+ | "dotnetwasm"
276
+ /**
277
+ * The javascript module for threads.
278
+ */
279
+ | "js-module-threads"
280
+ /**
281
+ * The javascript module for threads.
282
+ */
283
+ | "js-module-runtime"
284
+ /**
285
+ * The javascript module for threads.
286
+ */
287
+ | "js-module-dotnet"
288
+ /**
289
+ * The javascript module for threads.
290
+ */
291
+ | "js-module-native"
292
+ /**
293
+ * The javascript module that came from nuget package .
294
+ */
295
+ | "js-module-library-initializer"
296
+ /**
297
+ * The javascript module for threads.
298
+ */
299
+ | "symbols" ;
300
+ declare const enum GlobalizationMode {
301
+ /**
302
+ * Load sharded ICU data.
303
+ */
304
+ Sharded = "sharded" ,
305
+ /**
306
+ * Load all ICU data.
307
+ */
308
+ All = "all" ,
309
+ /**
310
+ * Operate in invariant globalization mode.
311
+ */
312
+ Invariant = "invariant" ,
313
+ /**
314
+ * Use user defined icu file.
315
+ */
316
+ Custom = "custom" ,
317
+ /**
318
+ * Operate in hybrid globalization mode with small ICU files, using native platform functions.
319
+ */
320
+ Hybrid = "hybrid"
321
+ }
187
322
type DotnetModuleConfig = {
188
323
disableDotnet6Compatibility ?: boolean ;
189
324
config ?: MonoConfig ;
190
325
configSrc ?: string ;
191
- onConfigLoaded ?: ( config : MonoConfig & BootJsonData ) => void | Promise < void > ;
326
+ onConfigLoaded ?: ( config : MonoConfig ) => void | Promise < void > ;
192
327
onDotnetReady ?: ( ) => void | Promise < void > ;
193
328
onDownloadResourceProgress ?: ( resourcesLoaded : number , totalResources : number ) => void ;
194
329
getApplicationEnvironment ?: ( bootConfigResponse : Response ) => string | null ;
@@ -203,6 +338,7 @@ type APIType = {
203
338
getAssemblyExports ( assemblyName : string ) : Promise < any > ;
204
339
setModuleImports ( moduleName : string , moduleImports : any ) : void ;
205
340
getConfig : ( ) => MonoConfig ;
341
+ invokeLibraryInitializers : ( functionName : string , args : any [ ] ) => Promise < void > ;
206
342
setHeapB32 : ( offset : NativePointer , value : number | boolean ) => void ;
207
343
setHeapU8 : ( offset : NativePointer , value : number ) => void ;
208
344
setHeapU16 : ( offset : NativePointer , value : number ) => void ;
@@ -227,6 +363,15 @@ type APIType = {
227
363
getHeapI64Big : ( offset : NativePointer ) => bigint ;
228
364
getHeapF32 : ( offset : NativePointer ) => number ;
229
365
getHeapF64 : ( offset : NativePointer ) => number ;
366
+ localHeapViewI8 : ( ) => Int8Array ;
367
+ localHeapViewI16 : ( ) => Int16Array ;
368
+ localHeapViewI32 : ( ) => Int32Array ;
369
+ localHeapViewI64Big : ( ) => BigInt64Array ;
370
+ localHeapViewU8 : ( ) => Uint8Array ;
371
+ localHeapViewU16 : ( ) => Uint16Array ;
372
+ localHeapViewU32 : ( ) => Uint32Array ;
373
+ localHeapViewF32 : ( ) => Float32Array ;
374
+ localHeapViewF64 : ( ) => Float64Array ;
230
375
} ;
231
376
type RuntimeAPI = {
232
377
/**
@@ -250,8 +395,8 @@ type ModuleAPI = {
250
395
dotnet : DotnetHostBuilder ;
251
396
exit : ( code : number , reason ?: any ) => void ;
252
397
} ;
253
- declare function createDotnetRuntime ( moduleFactory : DotnetModuleConfig | ( ( api : RuntimeAPI ) => DotnetModuleConfig ) ) : Promise < RuntimeAPI > ;
254
- type CreateDotnetRuntimeType = typeof createDotnetRuntime ;
398
+ type CreateDotnetRuntimeType = ( moduleFactory : DotnetModuleConfig | ( ( api : RuntimeAPI ) => DotnetModuleConfig ) ) => Promise < RuntimeAPI > ;
399
+ type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration" ;
255
400
256
401
interface IDisposable {
257
402
dispose ( ) : void ;
@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
277
422
get byteLength ( ) : number ;
278
423
}
279
424
280
- declare global {
281
- function getDotnetRuntime ( runtimeId : number ) : RuntimeAPI | undefined ;
282
- }
283
-
284
- declare const dotnet : ModuleAPI [ "dotnet" ] ;
285
- declare const exit : ModuleAPI [ "exit" ] ;
425
+ declare function mono_exit ( exit_code : number , reason ?: any ) : void ;
286
426
287
- interface BootJsonData {
288
- readonly entryAssembly : string ;
289
- readonly resources : ResourceGroups ;
290
- /** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
291
- readonly debugBuild : boolean ;
292
- readonly linkerEnabled : boolean ;
293
- readonly cacheBootResources : boolean ;
294
- readonly config : string [ ] ;
295
- readonly icuDataMode : ICUDataMode ;
296
- readonly startupMemoryCache : boolean | undefined ;
297
- readonly runtimeOptions : string [ ] | undefined ;
298
-
299
- // These properties are tacked on, and not found in the boot.json file
300
- modifiableAssemblies : string | null ;
301
- aspnetCoreBrowserTools : string | null ;
302
- }
427
+ declare const dotnet : DotnetHostBuilder ;
428
+ declare const exit : typeof mono_exit ;
303
429
304
- type BootJsonDataExtension = { [ extensionName : string ] : ResourceList } ;
305
-
306
- interface ResourceGroups {
307
- readonly assembly : ResourceList ;
308
- readonly lazyAssembly : ResourceList ;
309
- readonly pdb ?: ResourceList ;
310
- readonly runtime : ResourceList ;
311
- readonly satelliteResources ?: { [ cultureName : string ] : ResourceList } ;
312
- readonly libraryInitializers ?: ResourceList ,
313
- readonly extensions ?: BootJsonDataExtension
314
- readonly runtimeAssets : ExtendedResourceList ;
315
- }
316
-
317
- type ResourceList = { [ name : string ] : string } ;
318
- type ExtendedResourceList = {
319
- [ name : string ] : {
320
- hash : string ,
321
- behavior : string
322
- }
323
- } ;
324
-
325
- declare const enum ICUDataMode {
326
- Sharded ,
327
- All ,
328
- Invariant ,
329
- Custom
430
+ declare global {
431
+ function getDotnetRuntime ( runtimeId : number ) : RuntimeAPI | undefined ;
330
432
}
433
+ declare const createDotnetRuntime : CreateDotnetRuntimeType ;
331
434
332
- export { AssetEntry , CreateDotnetRuntimeType , DotnetModuleConfig , EmscriptenModule , IMemoryView , ModuleAPI , MonoConfig , ResourceRequest , RuntimeAPI , BootJsonData , ICUDataMode , createDotnetRuntime as default , dotnet , exit } ;
435
+ export { AssetEntry , CreateDotnetRuntimeType , DotnetModuleConfig , EmscriptenModule , GlobalizationMode , IMemoryView , ModuleAPI , MonoConfig , ResourceRequest , RuntimeAPI , createDotnetRuntime as default , dotnet , exit } ;
0 commit comments