22export const embedded = false ;
33export const mt = false ;
44
5- // Types: https://github.com/dotnet/runtime/blob/v9.0 .0/src/mono/browser/runtime/dotnet.d.ts
5+ // Types: https://github.com/dotnet/runtime/blob/release/10 .0/src/mono/browser/runtime/dotnet.d.ts
66
77declare interface NativePointer {
88 __brandNativePointer : "NativePointer" ;
@@ -57,11 +57,11 @@ declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Arra
5757interface DotnetHostBuilder {
5858 /**
5959 * @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.
60+ * Note that if you provide resources and don't provide custom configSrc URL, the dotnet .boot.js will be downloaded and applied by default.
6161 */
6262 withConfig ( config : MonoConfig ) : DotnetHostBuilder ;
6363 /**
64- * @param configSrc URL to the configuration file. ./blazor .boot.json is a default config file location.
64+ * @param configSrc URL to the configuration file. ./dotnet .boot.js is a default config file location.
6565 */
6666 withConfigSrc ( configSrc : string ) : DotnetHostBuilder ;
6767 /**
@@ -165,14 +165,6 @@ type MonoConfig = {
165165 * debugLevel < 0 enables debugging and disables debug logging.
166166 */
167167 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 ;
176168 /**
177169 * Configures use of the `integrity` directive for fetching assets
178170 */
@@ -191,6 +183,16 @@ type MonoConfig = {
191183 environmentVariables ?: {
192184 [ i : string ] : string ;
193185 } ;
186+ /**
187+ * Subset of runtimeconfig.json
188+ */
189+ runtimeConfig ?: {
190+ runtimeOptions ?: {
191+ configProperties ?: {
192+ [ i : string ] : string | number | boolean ;
193+ } ;
194+ } ;
195+ } ;
194196 /**
195197 * initial number of workers to add to the emscripten pthread pool
196198 */
@@ -217,10 +219,7 @@ type MonoConfig = {
217219 * Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
218220 */
219221 applicationCulture ?: string ;
220- /**
221- * definition of assets to load along with the runtime.
222- */
223- resources ?: ResourceGroups ;
222+ resources ?: Assets ;
224223 /**
225224 * appsettings files to load to VFS
226225 */
@@ -244,36 +243,90 @@ type MonoConfig = {
244243type ResourceExtensions = {
245244 [ extensionName : string ] : ResourceList ;
246245} ;
247- interface ResourceGroups {
246+ interface Assets {
248247 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 ;
248+ coreAssembly ?: AssemblyAsset [ ] ;
249+ assembly ?: AssemblyAsset [ ] ;
250+ lazyAssembly ?: AssemblyAsset [ ] ;
251+ corePdb ?: PdbAsset [ ] ;
252+ pdb ?: PdbAsset [ ] ;
253+ jsModuleWorker ?: JsAsset [ ] ;
254+ jsModuleDiagnostics ?: JsAsset [ ] ;
255+ jsModuleNative : JsAsset [ ] ;
256+ jsModuleRuntime : JsAsset [ ] ;
257+ wasmSymbols ?: SymbolsAsset [ ] ;
258+ wasmNative : WasmAsset [ ] ;
259+ icu ?: IcuAsset [ ] ;
264260 satelliteResources ?: {
265- [ cultureName : string ] : ResourceList ;
261+ [ cultureName : string ] : AssemblyAsset [ ] ;
266262 } ;
267- modulesAfterConfigLoaded ?: ResourceList ;
268- modulesAfterRuntimeReady ?: ResourceList ;
263+ modulesAfterConfigLoaded ?: JsAsset [ ] ;
264+ modulesAfterRuntimeReady ?: JsAsset [ ] ;
269265 extensions ?: ResourceExtensions ;
270- coreVfs ?: {
271- [ virtualPath : string ] : ResourceList ;
272- } ;
273- vfs ?: {
274- [ virtualPath : string ] : ResourceList ;
275- } ;
266+ coreVfs ?: VfsAsset [ ] ;
267+ vfs ?: VfsAsset [ ] ;
276268}
269+ type Asset = {
270+ /**
271+ * this should be absolute url to the asset
272+ */
273+ resolvedUrl ?: string ;
274+ /**
275+ * If true, the runtime startup would not fail if the asset download was not successful.
276+ */
277+ isOptional ?: boolean ;
278+ /**
279+ * If provided, runtime doesn't have to fetch the data.
280+ * Runtime would set the buffer to null after instantiation to free the memory.
281+ */
282+ buffer ?: ArrayBuffer | Promise < ArrayBuffer > ;
283+ /**
284+ * It's metadata + fetch-like Promise<Response>
285+ * If provided, the runtime doesn't have to initiate the download. It would just await the response.
286+ */
287+ pendingDownload ?: LoadingResource ;
288+ } ;
289+ type WasmAsset = Asset & {
290+ name : string ;
291+ hash ?: string | null | "" ;
292+ cache ?: RequestCache ;
293+ } ;
294+ type AssemblyAsset = Asset & {
295+ virtualPath : string ;
296+ name : string ;
297+ hash ?: string | null | "" ;
298+ cache ?: RequestCache ;
299+ } ;
300+ type PdbAsset = Asset & {
301+ virtualPath : string ;
302+ name : string ;
303+ hash ?: string | null | "" ;
304+ cache ?: RequestCache ;
305+ } ;
306+ type JsAsset = Asset & {
307+ /**
308+ * If provided, runtime doesn't have to import it's JavaScript modules.
309+ * This will not work for multi-threaded runtime.
310+ */
311+ moduleExports ?: any | Promise < any > ;
312+ name ?: string ;
313+ } ;
314+ type SymbolsAsset = Asset & {
315+ name : string ;
316+ cache ?: RequestCache ;
317+ } ;
318+ type VfsAsset = Asset & {
319+ virtualPath : string ;
320+ name : string ;
321+ hash ?: string | null | "" ;
322+ cache ?: RequestCache ;
323+ } ;
324+ type IcuAsset = Asset & {
325+ virtualPath : string ;
326+ name : string ;
327+ hash ?: string | null | "" ;
328+ cache ?: RequestCache ;
329+ } ;
277330/**
278331 * A "key" is name of the file, a "value" is optional hash for integrity check.
279332 */
@@ -291,7 +344,10 @@ type ResourceList = {
291344 * @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
292345 * When returned string is not qualified with `./` or absolute URL, it will be resolved against the application base URI.
293346 */
294- type LoadBootResourceCallback = ( type : WebAssemblyBootResourceType , name : string , defaultUri : string , integrity : string , behavior : AssetBehaviors ) => string | Promise < Response > | null | undefined ;
347+ type LoadBootResourceCallback = ( type : WebAssemblyBootResourceType , name : string , defaultUri : string , integrity : string , behavior : AssetBehaviors ) => string | Promise < Response > | Promise < BootModule > | null | undefined ;
348+ type BootModule = {
349+ config : MonoConfig ;
350+ } ;
295351interface LoadingResource {
296352 name : string ;
297353 url : string ;
@@ -359,6 +415,10 @@ type SingleAssetBehaviors =
359415 * The javascript module for threads.
360416 */
361417 | "js-module-threads"
418+ /**
419+ * The javascript module for diagnostic server and client.
420+ */
421+ | "js-module-diagnostics"
362422 /**
363423 * The javascript module for runtime.
364424 */
@@ -368,21 +428,13 @@ type SingleAssetBehaviors =
368428 */
369429 | "js-module-native"
370430 /**
371- * The javascript module for hybrid globalization.
372- */
373- | "js-module-globalization"
374- /**
375- * Typically blazor.boot.json
431+ * Typically dotnet.boot.js
376432 */
377433 | "manifest"
378434 /**
379435 * The debugging symbols
380436 */
381- | "symbols"
382- /**
383- * Load segmentation rules file for Hybrid Globalization.
384- */
385- | "segmentation-rules" ;
437+ | "symbols" ;
386438type AssetBehaviors = SingleAssetBehaviors |
387439 /**
388440 * Load asset as a managed resource assembly.
@@ -428,11 +480,7 @@ declare const enum GlobalizationMode {
428480 /**
429481 * Use user defined icu file.
430482 */
431- Custom = "custom" ,
432- /**
433- * Operate in hybrid globalization mode with small ICU files, using native platform functions.
434- */
435- Hybrid = "hybrid"
483+ Custom = "custom"
436484}
437485type DotnetModuleConfig = {
438486 config ?: MonoConfig ;
@@ -443,7 +491,7 @@ type DotnetModuleConfig = {
443491 imports ?: any ;
444492 exports ?: string [ ] ;
445493} & Partial < EmscriptenModule > ;
446- type APIType = {
494+ type RunAPIType = {
447495 /**
448496 * Runs the Main() method of the application.
449497 * Note: this will keep the .NET runtime alive and the APIs will be available for further calls.
@@ -493,6 +541,8 @@ type APIType = {
493541 * You can register the scripts using MonoConfig.resources.modulesAfterConfigLoaded and MonoConfig.resources.modulesAfterRuntimeReady.
494542 */
495543 invokeLibraryInitializers : ( functionName : string , args : any [ ] ) => Promise < void > ;
544+ } ;
545+ type MemoryAPIType = {
496546 /**
497547 * Writes to the WASM linear memory
498548 */
@@ -634,6 +684,43 @@ type APIType = {
634684 */
635685 localHeapViewF64 : ( ) => Float64Array ;
636686} ;
687+ type DiagnosticsAPIType = {
688+ /**
689+ * creates diagnostic trace file. Default is 60 seconds.
690+ * It could be opened in PerfView or Visual Studio as is.
691+ */
692+ collectCpuSamples : ( options ?: DiagnosticCommandOptions ) => Promise < Uint8Array [ ] > ;
693+ /**
694+ * creates diagnostic trace file. Default is 60 seconds.
695+ * It could be opened in PerfView or Visual Studio as is.
696+ * It could be summarized by `dotnet-trace report xxx.nettrace topN -n 10`
697+ */
698+ collectMetrics : ( options ?: DiagnosticCommandOptions ) => Promise < Uint8Array [ ] > ;
699+ /**
700+ * creates diagnostic trace file.
701+ * It could be opened in PerfView as is.
702+ * It could be converted for Visual Studio using `dotnet-gcdump convert`.
703+ */
704+ collectGcDump : ( options ?: DiagnosticCommandOptions ) => Promise < Uint8Array [ ] > ;
705+ /**
706+ * changes DOTNET_DiagnosticPorts and makes a new connection to WebSocket on that URL.
707+ */
708+ connectDSRouter ( url : string ) : void ;
709+ } ;
710+ type DiagnosticCommandProviderV2 = {
711+ keywords : [ number , number ] ;
712+ logLevel : number ;
713+ provider_name : string ;
714+ arguments : string | null ;
715+ } ;
716+ type DiagnosticCommandOptions = {
717+ durationSeconds ?: number ;
718+ intervalSeconds ?: number ;
719+ skipDownload ?: boolean ;
720+ circularBufferMB ?: number ;
721+ extraProviders ?: DiagnosticCommandProviderV2 [ ] ;
722+ } ;
723+ type APIType = RunAPIType & MemoryAPIType & DiagnosticsAPIType ;
637724type RuntimeAPI = {
638725 INTERNAL : any ;
639726 Module : EmscriptenModule ;
0 commit comments