wasm_bundle_directory_path=$payload_directory
mv $wasm_bundle_directory/* $wasm_bundle_directory_path
find $wasm_bundle_directory_path -type d
- wasm_args="--expose_wasm"
+ wasm_args="--experimental-wasm-eh --expose_wasm"
if [ "$javascript_engine" == "v8" ]; then
# for es6 module support
wasm_args="$wasm_args --module"
<Exec WorkingDirectory="bin/$(Configuration)/AppBundle" Command="v8 --expose_wasm --module $(_WasmMainJSFileName) -- $(DOTNET_MONO_LOG_LEVEL) --run $(_SampleAssembly) $(Args)" IgnoreExitCode="true" />
</Target>
<Target Name="RunSampleWithNode" DependsOnTargets="BuildSampleInTree;_ComputeMainJSFileName">
- <Exec WorkingDirectory="bin/$(Configuration)/AppBundle" Command="node --expose_wasm $(_WasmMainJSFileName) -- $(DOTNET_MONO_LOG_LEVEL) --run $(_SampleAssembly) $(Args)" IgnoreExitCode="true" />
+ <Exec WorkingDirectory="bin/$(Configuration)/AppBundle" Command="node --experimental-wasm-eh --expose_wasm $(_WasmMainJSFileName) -- $(DOTNET_MONO_LOG_LEVEL) --run $(_SampleAssembly) $(Args)" IgnoreExitCode="true" />
</Target>
<Target Name="DebugSampleWithNode" DependsOnTargets="BuildSampleInTree;_ComputeMainJSFileName">
- <Exec WorkingDirectory="bin/$(Configuration)/AppBundle" Command="node --expose_wasm $(_WasmMainJSFileName) -- $(DOTNET_MONO_LOG_LEVEL) --run $(_SampleAssembly) $(Args) --inspect=9222" IgnoreExitCode="true" />
+ <Exec WorkingDirectory="bin/$(Configuration)/AppBundle" Command="node --experimental-wasm-eh --expose_wasm $(_WasmMainJSFileName) -- $(DOTNET_MONO_LOG_LEVEL) --run $(_SampleAssembly) $(Args) --inspect=9222" IgnoreExitCode="true" />
</Target>
<Target Name="CheckServe">
<Exec Command="dotnet tool install -g dotnet-serve" IgnoreExitCode="true" />
cd bin/$(CONFIG)/AppBundle && $(V8_PATH) --stack-trace-limit=1000 --single-threaded --expose_wasm --module $(MAIN_JS) -- $(ARGS)
run-console-node:
- cd bin/$(CONFIG)/AppBundle && node --stack-trace-limit=1000 --single-threaded --expose_wasm $(MAIN_JS) $(ARGS)
+ cd bin/$(CONFIG)/AppBundle && node --stack-trace-limit=1000 --single-threaded --experimental-wasm-eh --expose_wasm $(MAIN_JS) $(ARGS)
debug-console-node:
- cd bin/$(CONFIG)/AppBundle && node --inspect=9222 --stack-trace-limit=1000 --single-threaded --expose_wasm $(MAIN_JS) $(ARGS)
\ No newline at end of file
+ cd bin/$(CONFIG)/AppBundle && node --inspect=9222 --stack-trace-limit=1000 --single-threaded --experimental-wasm-eh --expose_wasm $(MAIN_JS) $(ARGS)
\ No newline at end of file
<EmscriptenEnvVars Include="EM_FROZEN_CACHE=True" />
<EmscriptenEnvVars Include="DISABLE_LEGACY_JS_INTEROP=1" Condition="'$(WasmEnableLegacyJsInterop)' == 'false'" />
<EmscriptenEnvVars Include="DISABLE_LEGACY_JS_INTEROP=0" Condition="'$(WasmEnableLegacyJsInterop)' != 'false'" />
+ <EmscriptenEnvVars Include="WASM_ENABLE_SIMD=1" Condition="'$(WasmEnableSIMD)' != 'false'" />
+ <EmscriptenEnvVars Include="WASM_ENABLE_SIMD=0" Condition="'$(WasmEnableSIMD)' == 'false'" />
+ <EmscriptenEnvVars Include="WASM_ENABLE_EH=1" Condition="'$(WasmEnableExceptionHandling)' != 'false'" />
+ <EmscriptenEnvVars Include="WASM_ENABLE_EH=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
<EmscriptenEnvVars Include="ENABLE_AOT_PROFILER=$([System.Convert]::ToInt32($(WasmProfilers.Contains('aot'))))" />
<EmscriptenEnvVars Include="ENABLE_BROWSER_PROFILER=$([System.Convert]::ToInt32($(WasmProfilers.Contains('browser'))))" />
</ItemGroup>
--- /dev/null
+# Browser or JS engine features
+
+dotnet for wasm can be compiled with various MSBuild flags which enable the use of browser features. If you need to target an older version of the browser, then you may need to disable some of the dotnet features or optimizations.
+
+For full set of MSBuild properties [see top of](src\mono\wasm\build\WasmApp.targets)
+For set of [browser WASM features see](https://webassembly.org/roadmap/)
+
+# Multi-threading
+Is enabled by `<WasmEnableThreads>true</WasmEnableThreads>`.
+It requires HTTP headers similar to `Cross-Origin-Embedder-Policy:require-corp` and `Cross-Origin-Opener-Policy:same-origin`.
+See also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
+
+# SIMD - Single instruction, multiple data
+Is performance optimization enabled by default. It requires recent version of browser.
+You can disable it by `<WasmEnableSIMD>false</WasmEnableSIMD><WasmBuildNative>true</WasmBuildNative>`.
+[See also](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md)
+
+# EH - Exception handling
+Is performance optimization enabled by default. It requires recent version of browser.
+You can disable it by `<WasmEnableExceptionHandling>false</WasmEnableExceptionHandling><WasmBuildNative>true</WasmBuildNative>`.
+[See also](https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md)
+
+# BigInt
+Is required if the application uses Int64 marshaling in JS interop.
+[See also](https://github.com/WebAssembly/JS-BigInt-integration)
+
+# fetch browser API
+Is required if the application uses [HttpClient](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient)
+NodeJS needs to install `node-fetch` and `node-abort-controller` npm packages.
+
+# WebSocket browser API
+Is required if the application uses [WebSocketClient](https://learn.microsoft.com/en-us/dotnet/api/system.net.websockets.clientwebsocket)
+NodeJS needs to install `ws` npm package.
+
+# Shell environments - NodeJS & V8
+We pass most of the unit tests with NodeJS v 14 but it's not fully supported target platform. We would like to hear about community use-cases.
+We also use v8 engine version 11 or higher to run some of the tests. The engine is lacking many APIs and features.
\ No newline at end of file
// because we can't pass custom define symbols to acorn optimizer, we use environment variables to pass other build options
const DISABLE_LEGACY_JS_INTEROP = process.env.DISABLE_LEGACY_JS_INTEROP === "1";
+const WASM_ENABLE_SIMD = process.env.WASM_ENABLE_SIMD === "1";
+const WASM_ENABLE_EH = process.env.WASM_ENABLE_EH === "1";
const ENABLE_BROWSER_PROFILER = process.env.ENABLE_BROWSER_PROFILER === "1";
const ENABLE_AOT_PROFILER = process.env.ENABLE_AOT_PROFILER === "1";
const postset = `
DOTNET.setup({ `+
`linkerDisableLegacyJsInterop: ${DISABLE_LEGACY_JS_INTEROP ? "true" : "false"},` +
+ `linkerWasmEnableSIMD: ${WASM_ENABLE_SIMD ? "true" : "false"},` +
+ `linkerWasmEnableEH: ${WASM_ENABLE_EH ? "true" : "false"},` +
`linkerEnableAotProfiler: ${ENABLE_AOT_PROFILER ? "true" : "false"}, ` +
`linkerEnableBrowserProfiler: ${ENABLE_BROWSER_PROFILER ? "true" : "false"}` +
`});
export let loaderHelpers: LoaderHelpers = null as any;
// this is when we link with workload tools. The consts:wasmEnableLegacyJsInterop is when we compile with rollup.
export let linkerDisableLegacyJsInterop = false;
+export let linkerWasmEnableSIMD = true;
+export let linkerWasmEnableEH = true;
export let linkerEnableAotProfiler = false;
export let linkerEnableBrowserProfiler = false;
export let _runtimeModuleLoaded = false; // please keep it in place also as rollup guard
export function passEmscriptenInternals(internals: EmscriptenInternals): void {
ENVIRONMENT_IS_PTHREAD = internals.isPThread;
linkerDisableLegacyJsInterop = internals.linkerDisableLegacyJsInterop;
+ linkerWasmEnableSIMD = internals.linkerWasmEnableSIMD;
+ linkerWasmEnableEH = internals.linkerWasmEnableEH;
linkerEnableAotProfiler = internals.linkerEnableAotProfiler;
linkerEnableBrowserProfiler = internals.linkerEnableBrowserProfiler;
runtimeHelpers.quit = internals.quit_;
function verifyEnvironment() {
if (typeof globalThis.fetch !== "function" || typeof globalThis.AbortController !== "function") {
const message = ENVIRONMENT_IS_NODE
- ? "Please install `node-fetch` and `node-abort-controller` npm packages to enable HTTP client support."
- : "This browser doesn't support fetch API. Please use a modern browser.";
+ ? "Please install `node-fetch` and `node-abort-controller` npm packages to enable HTTP client support. See also https://aka.ms/dotnet-wasm-features"
+ : "This browser doesn't support fetch API. Please use a modern browser. See also https://aka.ms/dotnet-wasm-features";
throw new Error(message);
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+import { exceptions, simd } from "wasm-feature-detect";
+
import type { AssetEntryInternal, GlobalObjects, LoaderHelpers, RuntimeHelpers } from "../types/internal";
import type { MonoConfig, RuntimeAPI } from "../types";
import { assert_runtime_running, is_exited, is_runtime_running, mono_exit } from "./exit";
hasDebuggingEnabled,
invokeLibraryInitializers,
+ // from wasm-feature-detect npm package
+ exceptions,
+ simd,
+
} as Partial<LoaderHelpers>);
}
};
export function verifyEnvironment() {
- mono_assert(ENVIRONMENT_IS_SHELL || typeof globalThis.URL === "function", "This browser/engine doesn't support URL API. Please use a modern version.");
- mono_assert(typeof globalThis.BigInt64Array === "function", "This browser/engine doesn't support BigInt64Array API. Please use a modern version.");
+ mono_assert(ENVIRONMENT_IS_SHELL || typeof globalThis.URL === "function", "This browser/engine doesn't support URL API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features");
+ mono_assert(typeof globalThis.BigInt64Array === "function", "This browser/engine doesn't support BigInt64Array API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features");
if (MonoWasmThreads) {
- mono_assert(!ENVIRONMENT_IS_SHELL && !ENVIRONMENT_IS_NODE, "This build of dotnet is multi-threaded, it doesn't support shell environments like V8 or NodeJS.");
- mono_assert(globalThis.SharedArrayBuffer !== undefined, "SharedArrayBuffer is not enabled on this page. Please use a modern browser and set Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy http headers. See also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements");
- mono_assert(typeof globalThis.EventTarget === "function", "This browser/engine doesn't support EventTarget API. Please use a modern version.");
+ mono_assert(!ENVIRONMENT_IS_SHELL && !ENVIRONMENT_IS_NODE, "This build of dotnet is multi-threaded, it doesn't support shell environments like V8 or NodeJS. See also https://aka.ms/dotnet-wasm-features");
+ mono_assert(globalThis.SharedArrayBuffer !== undefined, "SharedArrayBuffer is not enabled on this page. Please use a modern browser and set Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy http headers. See also https://aka.ms/dotnet-wasm-features");
+ mono_assert(typeof globalThis.EventTarget === "function", "This browser/engine doesn't support EventTarget API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features");
}
-
- // TODO detect other (WASM) features that are required for the runtime
- // See https://github.com/dotnet/runtime/issues/84574
}
export async function detect_features_and_polyfill(module: DotnetModuleInternal): Promise<void> {
+ if (ENVIRONMENT_IS_NODE) {
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore:
+ const process = await import(/* webpackIgnore: true */"process");
+ const minNodeVersion = 14;
+ if (process.versions.node.split(".")[0] < minNodeVersion) {
+ throw new Error(`NodeJS at '${process.execPath}' has too low version '${process.versions.node}', please use at least ${minNodeVersion}. See also https://aka.ms/dotnet-wasm-features`);
+ }
+ }
const scriptUrlQuery =/* webpackIgnore: true */import.meta.url;
const queryIndex = scriptUrlQuery.indexOf("?");
if (ENVIRONMENT_IS_WEB && (module.config! as MonoConfigInternal).forwardConsoleLogsToWS && typeof globalThis.WebSocket != "undefined") {
setup_proxy_console("main", globalThis.console, globalThis.location.origin);
}
- if (ENVIRONMENT_IS_NODE) {
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore:
- const process = await import(/* webpackIgnore: true */"process");
- if (process.versions.node.split(".")[0] < 14) {
- throw new Error(`NodeJS at '${process.execPath}' has too low version '${process.versions.node}'`);
- }
- }
mono_assert(module, "Null moduleConfig");
mono_assert(module.config, "Null moduleConfig.config");
await createEmscripten(module);
];
}
-function initializeModules(es6Modules: [RuntimeModuleExportsInternal, NativeModuleExportsInternal]) {
+async function initializeModules(es6Modules: [RuntimeModuleExportsInternal, NativeModuleExportsInternal]) {
const { initializeExports, initializeReplacements, configureEmscriptenStartup, configureWorkerStartup, setRuntimeGlobals, passEmscriptenInternals } = es6Modules[0];
const { default: emscriptenFactory } = es6Modules[1];
setRuntimeGlobals(globalObjectsRoot);
// TODO call mono_download_assets(); here in parallel ?
const es6Modules = await Promise.all(promises);
- initializeModules(es6Modules as any);
+ await initializeModules(es6Modules as any);
await runtimeHelpers.dotnetReady.promise;
const promises = importModules();
const es6Modules = await Promise.all(promises);
- initializeModules(es6Modules as any);
+ await initializeModules(es6Modules as any);
return module;
}
"fastq": "^1.6.0"
}
},
+ "@rollup/plugin-node-resolve": {
+ "version": "15.1.0",
+ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.1.0.tgz",
+ "integrity": "sha1-n/zY6MRXCA26ibufy1g6Z3jcdX4=",
+ "dev": true,
+ "requires": {
+ "@rollup/pluginutils": "^5.0.1",
+ "@types/resolve": "1.20.2",
+ "deepmerge": "^4.2.2",
+ "is-builtin-module": "^3.2.1",
+ "is-module": "^1.0.0",
+ "resolve": "^1.22.1"
+ }
+ },
"@rollup/plugin-terser": {
"version": "0.4.3",
"resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@rollup/plugin-terser/-/plugin-terser-0.4.3.tgz",
"integrity": "sha1-1w+rpwOdX8pUyDx9urQQUdK29ss=",
"dev": true
},
+ "@types/resolve": {
+ "version": "1.20.2",
+ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@types/resolve/-/resolve-1.20.2.tgz",
+ "integrity": "sha1-l9JuAM1KBCO0r2IKvs8+b0QreXU=",
+ "dev": true
+ },
"@types/semver": {
"version": "7.5.0",
"resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@types/semver/-/semver-7.5.0.tgz",
"integrity": "sha1-KxRqb9cugLT1XSVfNe1Zo6mkG9U=",
"dev": true
},
+ "builtin-modules": {
+ "version": "3.3.0",
+ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/builtin-modules/-/builtin-modules-3.3.0.tgz",
+ "integrity": "sha1-yuYoEriYAellYzbkYiPgMDhr57Y=",
+ "dev": true
+ },
"callsites": {
"version": "3.1.0",
"resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha1-pvLc5hL63S7x9Rm3NVHxfoUZmDE=",
"dev": true
},
+ "deepmerge": {
+ "version": "4.3.1",
+ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/deepmerge/-/deepmerge-4.3.1.tgz",
+ "integrity": "sha1-RLXyFHzTsA1LVhN2hZZvJv0l3Uo=",
+ "dev": true
+ },
"dir-glob": {
"version": "3.0.1",
"resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/dir-glob/-/dir-glob-3.0.1.tgz",
"integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=",
"dev": true
},
+ "is-builtin-module": {
+ "version": "3.2.1",
+ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/is-builtin-module/-/is-builtin-module-3.2.1.tgz",
+ "integrity": "sha1-8DJxcX2GVM/K8HqwRj+qNXFYEWk=",
+ "dev": true,
+ "requires": {
+ "builtin-modules": "^3.3.0"
+ }
+ },
"is-core-module": {
"version": "2.12.1",
"resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/is-core-module/-/is-core-module-2.12.1.tgz",
"is-extglob": "^2.1.1"
}
},
+ "is-module": {
+ "version": "1.0.0",
+ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/is-module/-/is-module-1.0.0.tgz",
+ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=",
+ "dev": true
+ },
"is-number": {
"version": "7.0.0",
"resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/is-number/-/is-number-7.0.0.tgz",
"punycode": "^2.1.0"
}
},
+ "wasm-feature-detect": {
+ "version": "1.5.1",
+ "resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/wasm-feature-detect/-/wasm-feature-detect-1.5.1.tgz",
+ "integrity": "sha1-DbV6fX+MJrdD3ehThiFa4rE154o="
+ },
"which": {
"version": "2.0.2",
"resolved": "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/which/-/which-2.0.2.tgz",
"author": "Microsoft",
"license": "MIT",
"devDependencies": {
+ "@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "0.4.3",
"@rollup/plugin-typescript": "11.1.2",
"@rollup/plugin-virtual": "3.0.1",
"@typescript-eslint/eslint-plugin": "5.59.1",
"@typescript-eslint/parser": "5.59.1",
- "magic-string": "0.30.1",
"eslint": "8.44.0",
"fast-glob": "3.3.0",
"git-commit-info": "2.0.2",
+ "magic-string": "0.30.1",
"rollup": "3.26.2",
"rollup-plugin-dts": "5.3.0",
"terser": "5.19.0",
"tslib": "2.6.0",
"typescript": "5.1.6"
+ },
+ "dependencies": {
+ "wasm-feature-detect": "1.5.1"
}
}
import typescript from "@rollup/plugin-typescript";
import terser from "@rollup/plugin-terser";
import virtual from "@rollup/plugin-virtual";
+import { nodeResolve } from "@rollup/plugin-node-resolve";
import { readFile, writeFile, mkdir } from "fs/promises";
import * as fs from "fs";
import * as path from "path";
const productVersion = process.env.ProductVersion || "8.0.0-dev";
const nativeBinDir = process.env.NativeBinDir ? process.env.NativeBinDir.replace(/"/g, "") : "bin";
const monoWasmThreads = process.env.MonoWasmThreads === "true" ? true : false;
+const wasmEnableSIMD = process.env.WASM_ENABLE_SIMD === "1" ? true : false;
+const wasmEnableExceptionHandling = process.env.WASM_ENABLE_EH === "1" ? true : false;
const wasmEnableLegacyJsInterop = process.env.DISABLE_LEGACY_JS_INTEROP !== "1" ? true : false;
const monoDiagnosticsMock = process.env.MonoDiagnosticsMock === "true" ? true : false;
const terserConfig = {
productVersion,
configuration,
monoWasmThreads,
+ wasmEnableSIMD,
+ wasmEnableExceptionHandling,
monoDiagnosticsMock,
gitHash,
wasmEnableLegacyJsInterop,
}
],
external: externalDependencies,
- plugins: [regexReplace(inlineAssert), regexCheck([checkAssert, checkNoRuntime]), ...outputCodePlugins],
+ plugins: [nodeResolve(), regexReplace(inlineAssert), regexCheck([checkAssert, checkNoRuntime]), ...outputCodePlugins],
onwarn: onwarn
};
const runtimeConfig = {
import WasmEnableLegacyJsInterop from "consts:wasmEnableLegacyJsInterop";
import { DotnetModuleInternal, CharPtrNull } from "./types/internal";
-import { linkerDisableLegacyJsInterop, ENVIRONMENT_IS_PTHREAD, exportedRuntimeAPI, INTERNAL, loaderHelpers, Module, runtimeHelpers, createPromiseController, mono_assert } from "./globals";
+import { linkerDisableLegacyJsInterop, ENVIRONMENT_IS_PTHREAD, exportedRuntimeAPI, INTERNAL, loaderHelpers, Module, runtimeHelpers, createPromiseController, mono_assert, linkerWasmEnableSIMD, linkerWasmEnableEH } from "./globals";
import cwraps, { init_c_exports } from "./cwraps";
import { mono_wasm_raise_debug_event, mono_wasm_runtime_ready } from "./debug";
import { toBase64StringImpl } from "./base64";
(async () => {
try {
// - init the rest of the polyfills
- // - download Module.config from configSrc
await mono_wasm_pre_init_essential_async();
// - start download assets like DLLs
mono_log_debug("mono_wasm_pre_init_essential_async");
Module.addRunDependency("mono_wasm_pre_init_essential_async");
+ if (linkerWasmEnableSIMD) {
+ mono_assert(await loaderHelpers.simd(), "This browser/engine doesn't support WASM SIMD. Please use a modern version. See also https://aka.ms/dotnet-wasm-features");
+ }
+ if (linkerWasmEnableEH) {
+ mono_assert(await loaderHelpers.exceptions(), "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://aka.ms/dotnet-wasm-features");
+ }
+
await init_polyfills_async();
if (MonoWasmThreads) {
isChromium: boolean,
isFirefox: boolean
+
+ // from wasm-feature-detect npm package
+ exceptions: () => Promise<boolean>,
+ simd: () => Promise<boolean>,
}
export type RuntimeHelpers = {
config: MonoConfigInternal;
export type EmscriptenInternals = {
isPThread: boolean,
linkerDisableLegacyJsInterop: boolean,
+ linkerWasmEnableSIMD: boolean,
+ linkerWasmEnableEH: boolean,
linkerEnableAotProfiler: boolean,
linkerEnableBrowserProfiler: boolean,
quit_: Function,
}
if (typeof globalThis.WebSocket !== "function") {
const message = ENVIRONMENT_IS_NODE
- ? "Please install `ws` npm package to enable networking support."
- : "This browser doesn't support WebSocket API. Please use a modern browser.";
+ ? "Please install `ws` npm package to enable networking support. See also https://aka.ms/dotnet-wasm-features"
+ : "This browser doesn't support WebSocket API. Please use a modern browser. See also https://aka.ms/dotnet-wasm-features";
throw new Error(message);
}
}
<ICULibDir Condition="'$(MonoWasmThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib'))</ICULibDir>
<ICULibDir Condition="'$(MonoWasmThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm-threads', 'native', 'lib'))</ICULibDir>
<WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">true</WasmEnableSIMD>
+ <WasmEnableExceptionHandling Condition="'$(WasmEnableExceptionHandling)' == ''">true</WasmEnableExceptionHandling>
<WasmEnableLegacyJsInterop Condition="'$(WasmEnableLegacyJsInterop)' == ''">true</WasmEnableLegacyJsInterop>
<FilterSystemTimeZones Condition="'$(FilterSystemTimeZones)' == ''">false</FilterSystemTimeZones>
<EmccCmd>emcc</EmccCmd>
<CMakeBuildRuntimeCmd>cmake --build . --config $(Configuration) $(CmakeOptions)</CMakeBuildRuntimeCmd>
<CMakeBuildRuntimeCmd Condition="'$(OS)' == 'Windows_NT'">call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && $(CMakeBuildRuntimeCmd)</CMakeBuildRuntimeCmd>
<CMakeBuildRuntimeCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&1 && $(CMakeBuildRuntimeCmd)'</CMakeBuildRuntimeCmd>
- <_DisableLegacyJsInterop Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">1</_DisableLegacyJsInterop>
- <_DisableLegacyJsInterop Condition="'$(WasmEnableLegacyJsInterop)' != 'false'">0</_DisableLegacyJsInterop>
</PropertyGroup>
+ <ItemGroup>
+ <_CmakeEnvironmentVariable Include="DISABLE_LEGACY_JS_INTEROP=1" Condition="'$(WasmEnableLegacyJsInterop)' == 'false'"/>
+ <_CmakeEnvironmentVariable Include="DISABLE_LEGACY_JS_INTEROP=0" Condition="'$(WasmEnableLegacyJsInterop)' != 'false'"/>
+ <_CmakeEnvironmentVariable Include="WASM_ENABLE_SIMD=1" Condition="'$(WasmEnableSIMD)' != 'false'" />
+ <_CmakeEnvironmentVariable Include="WASM_ENABLE_SIMD=0" Condition="'$(WasmEnableSIMD)' == 'false'" />
+ <_CmakeEnvironmentVariable Include="WASM_ENABLE_EH=1" Condition="'$(WasmEnableExceptionHandling)' != 'false'" />
+ <_CmakeEnvironmentVariable Include="WASM_ENABLE_EH=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
+ </ItemGroup>
<Copy SourceFiles="$(PInvokeTableFile)"
DestinationFolder="$(MonoObjDir)"
SkipUnchangedFiles="true" />
<Exec Command="$(CMakeBuildRuntimeConfigureCmd)" WorkingDirectory="$(NativeBinDir)"
- EnvironmentVariables="DISABLE_LEGACY_JS_INTEROP=$(_DisableLegacyJsInterop)" />
+ EnvironmentVariables="@(_CmakeEnvironmentVariable)" />
<Exec Command="$(CMakeBuildRuntimeCmd)" WorkingDirectory="$(NativeBinDir)"
- EnvironmentVariables="DISABLE_LEGACY_JS_INTEROP=$(_DisableLegacyJsInterop)" />
+ EnvironmentVariables="@(_CmakeEnvironmentVariable)" />
<ItemGroup>
<IcuDataFiles Include="$(NativeBinDir)*.dat" />
</ItemGroup>
<Target Name="SetMonoRollupEnvironment" DependsOnTargets="GetProductVersions">
+ <ItemGroup>
+ <_MonoRollupEnvironmentVariable Include="Configuration:$(Configuration)" />
+ <_MonoRollupEnvironmentVariable Include="NativeBinDir:$(NativeBinDir)" />
+ <_MonoRollupEnvironmentVariable Include="ProductVersion:$(ProductVersion)" />
+ <_MonoRollupEnvironmentVariable Include="MonoWasmThreads:$(MonoWasmThreads)" />
+ <_MonoRollupEnvironmentVariable Include="WASM_ENABLE_SIMD:1" Condition="'$(WasmEnableSIMD)' != 'false'" />
+ <_MonoRollupEnvironmentVariable Include="WASM_ENABLE_SIMD:0" Condition="'$(WasmEnableSIMD)' == 'false'" />
+ <_MonoRollupEnvironmentVariable Include="WASM_ENABLE_EH:1" Condition="'$(WasmEnableExceptionHandling)' != 'false'" />
+ <_MonoRollupEnvironmentVariable Include="WASM_ENABLE_EH:0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
+ <_MonoRollupEnvironmentVariable Include="DISABLE_LEGACY_JS_INTEROP:1" Condition="'$(WasmEnableLegacyJsInterop)' == 'false'" />
+ <_MonoRollupEnvironmentVariable Include="DISABLE_LEGACY_JS_INTEROP:0" Condition="'$(WasmEnableLegacyJsInterop)' != 'false'" />
+ <_MonoRollupEnvironmentVariable Include="MonoDiagnosticsMock:$(MonoDiagnosticsMock)" />
+ <_MonoRollupEnvironmentVariable Include="ContinuousIntegrationBuild:$(ContinuousIntegrationBuild)" />
+ </ItemGroup>
+
<PropertyGroup>
- <MonoRollupEnvironment>Configuration:$(Configuration),NativeBinDir:$(NativeBinDir),ProductVersion:$(ProductVersion),MonoWasmThreads:$(MonoWasmThreads),DISABLE_LEGACY_JS_INTEROP:$(_DisableLegacyJsInterop),MonoDiagnosticsMock:$(MonoDiagnosticsMock),ContinuousIntegrationBuild:$(ContinuousIntegrationBuild)</MonoRollupEnvironment>
+ <MonoRollupEnvironment>@(_MonoRollupEnvironmentVariable, ',')</MonoRollupEnvironment>
</PropertyGroup>
<PropertyGroup>