Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
[Blazor] Finalize the integration between runtime and Blazor by maraf · Pull Request #49385 · dotnet/aspnetcore · GitHub
Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [Blazor] Finalize the integration between runtime and Blazor by maraf · Pull Request #49385 · dotnet/aspnetcore · GitHub
Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [Blazor] Finalize the integration between runtime and Blazor by maraf · Pull Request #49385 · dotnet/aspnetcore · GitHub
Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' [Blazor] Finalize the integration between runtime and Blazor by maraf · Pull Request #49385 · dotnet/aspnetcore · GitHub
Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [Blazor] Finalize the integration between runtime and Blazor by maraf · Pull Request #49385 · dotnet/aspnetcore · GitHub
Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [Blazor] Finalize the integration between runtime and Blazor by maraf · Pull Request #49385 · dotnet/aspnetcore · GitHub
Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); [Blazor] Finalize the integration between runtime and Blazor by maraf · Pull Request #49385 · dotnet/aspnetcore · GitHub
Skip to content
Merged
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
267 changes: 185 additions & 82 deletions src/Components/Web.JS/@types/dotnet/dotnet.d.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,24 +3,7 @@
//!
//! This is generated file, see src/mono/wasm/runtime/rollup.config.js

//! This is not considered public API with backward compatibility guarantees.

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
//! This is not considered public API with backward compatibility guarantees.

declare interface NativePointer {
__brandNativePointer: "NativePointer";
Expand All@@ -35,18 +18,28 @@ declare interface Int32Ptr extends NativePointer {
__brand: "Int32Ptr";
}
declare interface EmscriptenModule {
/** @deprecated Please use growableHeapI8() instead.*/
HEAP8: Int8Array;
/** @deprecated Please use growableHeapI16() instead.*/
HEAP16: Int16Array;
/** @deprecated Please use growableHeapI32() instead. */
HEAP32: Int32Array;
/** @deprecated Please use growableHeapI64() instead. */
HEAP64: BigInt64Array;
/** @deprecated Please use growableHeapU8() instead. */
HEAPU8: Uint8Array;
/** @deprecated Please use growableHeapU16() instead. */
HEAPU16: Uint16Array;
/** @deprecated Please use growableHeapU32() instead */
HEAPU32: Uint32Array;
/** @deprecated Please use growableHeapF32() instead */
HEAPF32: Float32Array;
/** @deprecated Please use growableHeapF64() instead. */
HEAPF64: Float64Array;
_malloc(size: number): VoidPtr;
_free(ptr: VoidPtr): void;
print(message: string): void;
printErr(message: string): void;
out(message: string): void;
err(message: string): void;
ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T;
cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T;
cwrap<T extends Function>(ident: string, ...args: any[]): T;
Expand All@@ -55,17 +48,13 @@ declare interface EmscriptenModule {
getValue(ptr: number, type: string, noSafe?: number | boolean): number;
UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string;
UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string;
stringToUTF8Array(str: string, heap: Uint8Array, outIdx: number, maxBytesToWrite: number): void;
FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string;
FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string;
FS_readFile(filename: string, opts: any): any;
removeRunDependency(id: string): void;
addRunDependency(id: string): void;
addFunction(fn: Function, signature: string): number;
getWasmTableEntry(index: number): any;
stackSave(): VoidPtr;
stackRestore(stack: VoidPtr): void;
stackAlloc(size: number): VoidPtr;
ready: Promise<unknown>;
instantiateWasm?: InstantiateWasmCallBack;
preInit?: (() => any)[] | (() => any);
preRun?: (() => any)[] | (() => any);
Expand All@@ -79,6 +68,29 @@ type InstantiateWasmSuccessCallback = (instance: WebAssembly.Instance, module: W
type InstantiateWasmCallBack = (imports: WebAssembly.Imports, successCallback: InstantiateWasmSuccessCallback) => any;
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

interface DotnetHostBuilder {
withConfig(config: MonoConfig): DotnetHostBuilder;
withConfigSrc(configSrc: string): DotnetHostBuilder;
withApplicationArguments(...args: string[]): DotnetHostBuilder;
withEnvironmentVariable(name: string, value: string): DotnetHostBuilder;
withEnvironmentVariables(variables: {
[i: string]: string;
}): DotnetHostBuilder;
withVirtualWorkingDirectory(vfsPath: string): DotnetHostBuilder;
withDiagnosticTracing(enabled: boolean): DotnetHostBuilder;
withDebugging(level: number): DotnetHostBuilder;
withMainAssembly(mainAssemblyName: string): DotnetHostBuilder;
withApplicationArgumentsFromQuery(): DotnetHostBuilder;
withApplicationEnvironment(applicationEnvironment?: string): DotnetHostBuilder;
withApplicationCulture(applicationCulture?: string): DotnetHostBuilder;
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
*/
withResourceLoader(loadBootResource?: LoadBootResourceCallback): DotnetHostBuilder;
create(): Promise<RuntimeAPI>;
run(): Promise<number>;
}
type MonoConfig = {
/**
* The subfolder containing managed assemblies and pdbs. This is relative to dotnet.js script.
Expand DownExpand Up@@ -115,7 +127,7 @@ type MonoConfig = {
/**
* debugLevel > 0 enables debugging and sets the debug log level to debugLevel
* debugLevel == 0 disables debugging and enables interpreter optimizations
* debugLevel < 0 enabled debugging and disables debug logging.
* debugLevel < 0 enables debugging and disables debug logging.
*/
debugLevel?: number;
/**
Expand All@@ -136,11 +148,63 @@ type MonoConfig = {
* If true, the snapshot of runtime's memory will be stored in the browser and used for faster startup next time. Default is false.
*/
startupMemoryCache?: boolean;
/**
* hash of assets
*/
assetsHash?: string;
/**
* application environment
*/
applicationEnvironment?: string;
/**
* Gets the application culture. This is a name specified in the BCP 47 format. See https://tools.ietf.org/html/bcp47
*/
applicationCulture?: string;
/**
* definition of assets to load along with the runtime.
*/
resources?: ResourceGroups;
/**
* config extensions declared in MSBuild items @(WasmBootConfigExtension)
*/
extensions?: {
[name: string]: any;
};
};
type ResourceExtensions = {
[extensionName: string]: ResourceList;
};
interface ResourceGroups {
readonly hash?: string;
readonly assembly?: ResourceList;
readonly lazyAssembly?: ResourceList;
readonly pdb?: ResourceList;
readonly runtime?: ResourceList;
readonly satelliteResources?: {
[cultureName: string]: ResourceList;
};
readonly libraryInitializers?: {
readonly onRuntimeConfigLoaded: ResourceList;
readonly onRuntimeReady: ResourceList;
};
readonly extensions?: ResourceExtensions;
readonly vfs?: {
[virtualPath: string]: ResourceList;
};
}
type ResourceList = {
[name: string]: string;
};
/**
* Overrides the built-in boot resource loading mechanism so that boot resources can be fetched
* from a custom source, such as an external CDN.
* @param type The type of the resource to be loaded.
* @param name The name of the resource to be loaded.
* @param defaultUri The URI from which the framework would fetch the resource by default. The URI may be relative or absolute.
* @param integrity The integrity string representing the expected content in the response.
* @returns A URI string or a Response promise to override the loading process, or null/undefined to allow the default loading behavior.
*/
type LoadBootResourceCallback = (type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string) => string | Promise<Response> | null | undefined;
interface ResourceRequest {
name: string;
behavior: AssetBehaviours;
Expand DownExpand Up@@ -180,15 +244,86 @@ interface AssetEntry extends ResourceRequest {
*/
pendingDownload?: LoadingResource;
}
type AssetBehaviours = "resource" | "assembly" | "pdb" | "heap" | "icu" | "vfs" | "dotnetwasm" | "js-module-threads";
type GlobalizationMode = "icu" | // load ICU globalization data from any runtime assets with behavior "icu".
"invariant" | // operate in invariant globalization mode.
"auto";
type AssetBehaviours =
/**
* Load asset as a managed resource assembly.
*/
"resource"
/**
* Load asset as a managed assembly.
*/
| "assembly"
/**
* Load asset as a managed debugging information.
*/
| "pdb"
/**
* Store asset into the native heap.
*/
| "heap"
/**
* Load asset as an ICU data archive.
*/
| "icu"
/**
* Load asset into the virtual filesystem (for fopen, File.Open, etc).
*/
| "vfs"
/**
* The binary of the dotnet runtime.
*/
| "dotnetwasm"
/**
* The javascript module for threads.
*/
| "js-module-threads"
/**
* The javascript module for threads.
*/
| "js-module-runtime"
/**
* The javascript module for threads.
*/
| "js-module-dotnet"
/**
* The javascript module for threads.
*/
| "js-module-native"
/**
* The javascript module that came from nuget package .
*/
| "js-module-library-initializer"
/**
* The javascript module for threads.
*/
| "symbols";
declare const enum GlobalizationMode {
/**
* Load sharded ICU data.
*/
Sharded = "sharded",
/**
* Load all ICU data.
*/
All = "all",
/**
* Operate in invariant globalization mode.
*/
Invariant = "invariant",
/**
* Use user defined icu file.
*/
Custom = "custom",
/**
* Operate in hybrid globalization mode with small ICU files, using native platform functions.
*/
Hybrid = "hybrid"
}
type DotnetModuleConfig = {
disableDotnet6Compatibility?: boolean;
config?: MonoConfig;
configSrc?: string;
onConfigLoaded?: (config: MonoConfig & BootJsonData) => void | Promise<void>;
onConfigLoaded?: (config: MonoConfig) => void | Promise<void>;
onDotnetReady?: () => void | Promise<void>;
onDownloadResourceProgress?: (resourcesLoaded: number, totalResources: number) => void;
getApplicationEnvironment?: (bootConfigResponse: Response) => string | null;
Expand All@@ -203,6 +338,7 @@ type APIType = {
getAssemblyExports(assemblyName: string): Promise<any>;
setModuleImports(moduleName: string, moduleImports: any): void;
getConfig: () => MonoConfig;
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>;
setHeapB32: (offset: NativePointer, value: number | boolean) => void;
setHeapU8: (offset: NativePointer, value: number) => void;
setHeapU16: (offset: NativePointer, value: number) => void;
Expand All@@ -227,6 +363,15 @@ type APIType = {
getHeapI64Big: (offset: NativePointer) => bigint;
getHeapF32: (offset: NativePointer) => number;
getHeapF64: (offset: NativePointer) => number;
localHeapViewI8: () => Int8Array;
localHeapViewI16: () => Int16Array;
localHeapViewI32: () => Int32Array;
localHeapViewI64Big: () => BigInt64Array;
localHeapViewU8: () => Uint8Array;
localHeapViewU16: () => Uint16Array;
localHeapViewU32: () => Uint32Array;
localHeapViewF32: () => Float32Array;
localHeapViewF64: () => Float64Array;
};
type RuntimeAPI = {
/**
Expand All@@ -250,8 +395,8 @@ type ModuleAPI = {
dotnet: DotnetHostBuilder;
exit: (code: number, reason?: any) => void;
};
declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)): Promise<RuntimeAPI>;
type CreateDotnetRuntimeType = typeof createDotnetRuntime;
type CreateDotnetRuntimeType = (moduleFactory: DotnetModuleConfig | ((api: RuntimeAPI) => DotnetModuleConfig)) => Promise<RuntimeAPI>;
type WebAssemblyBootResourceType = "assembly" | "pdb" | "dotnetjs" | "dotnetwasm" | "globalization" | "manifest" | "configuration";

interface IDisposable {
dispose(): void;
Expand All@@ -277,56 +422,14 @@ interface IMemoryView extends IDisposable {
get byteLength(): number;
}

declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}

declare const dotnet: ModuleAPI["dotnet"];
declare const exit: ModuleAPI["exit"];
declare function mono_exit(exit_code: number, reason?: any): void;

interface BootJsonData {
readonly entryAssembly: string;
readonly resources: ResourceGroups;
/** Gets a value that determines if this boot config was produced from a non-published build (i.e. dotnet build or dotnet run) */
readonly debugBuild: boolean;
readonly linkerEnabled: boolean;
readonly cacheBootResources: boolean;
readonly config: string[];
readonly icuDataMode: ICUDataMode;
readonly startupMemoryCache: boolean | undefined;
readonly runtimeOptions: string[] | undefined;

// These properties are tacked on, and not found in the boot.json file
modifiableAssemblies: string | null;
aspnetCoreBrowserTools: string | null;
}
declare const dotnet: DotnetHostBuilder;
declare const exit: typeof mono_exit;

type BootJsonDataExtension = { [extensionName: string]: ResourceList };

interface ResourceGroups {
readonly assembly: ResourceList;
readonly lazyAssembly: ResourceList;
readonly pdb?: ResourceList;
readonly runtime: ResourceList;
readonly satelliteResources?: { [cultureName: string]: ResourceList };
readonly libraryInitializers?: ResourceList,
readonly extensions?: BootJsonDataExtension
readonly runtimeAssets: ExtendedResourceList;
}

type ResourceList = { [name: string]: string };
type ExtendedResourceList = {
[name: string]: {
hash: string,
behavior: string
}
};

declare const enum ICUDataMode {
Sharded,
All,
Invariant,
Custom
declare global {
function getDotnetRuntime(runtimeId: number): RuntimeAPI | undefined;
}
declare const createDotnetRuntime: CreateDotnetRuntimeType;

export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, BootJsonData, ICUDataMode, createDotnetRuntime as default, dotnet, exit };
export { AssetEntry, CreateDotnetRuntimeType, DotnetModuleConfig, EmscriptenModule, GlobalizationMode, IMemoryView, ModuleAPI, MonoConfig, ResourceRequest, RuntimeAPI, createDotnetRuntime as default, dotnet, exit };
Loading