Skip to content

Commit b25cc33

Browse files
thaystgpavelsavara
authored andcommitted
- remove runtimeHelpers.loaded_files and repace it with MONO.loaded_files
- disable too agresive Terser minification Co-authored-by: Thays <thaystg@gmail.com>
1 parent 76e68db commit b25cc33

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

src/mono/wasm/runtime/debug.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
import { Module, runtimeHelpers } from "./modules";
4+
import { Module, MONO, runtimeHelpers } from "./modules";
55
import { toBase64StringImpl } from "./base64";
66
import cwraps from "./cwraps";
77
import { VoidPtr } from "./types";
@@ -113,7 +113,7 @@ export function mono_wasm_raise_debug_event(event: WasmEvent, args = {}): void {
113113
// Used by the debugger to enumerate loaded dlls and pdbs
114114
export function mono_wasm_get_loaded_files(): string[] {
115115
cwraps.mono_wasm_set_is_debugger_attached(true);
116-
return runtimeHelpers.loaded_files;
116+
return MONO.loaded_files;
117117
}
118118

119119
function _create_proxy_from_object_id(objectId: string, details: any) {

src/mono/wasm/runtime/exports.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const MONO: MONO = <any>{
7373
mono_wasm_load_runtime: cwraps.mono_wasm_load_runtime,
7474

7575
config: runtimeHelpers.config,
76-
loaded_files: runtimeHelpers.loaded_files,
76+
loaded_files: [],
7777

7878
// generated bindings closure `library_mono`
7979
mono_wasm_new_root_buffer_from_pointer,

src/mono/wasm/runtime/modules.ts

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ let runtime_is_ready = false;
2828
export const runtimeHelpers: RuntimeHelpers = <any>{
2929
namespace: "System.Runtime.InteropServices.JavaScript",
3030
classname: "Runtime",
31-
loaded_files: [],
3231
get mono_wasm_runtime_is_ready() {
3332
return runtime_is_ready;
3433
},

src/mono/wasm/runtime/rollup.config.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import dts from "rollup-plugin-dts";
99
const outputFileName = "runtime.iffe.js";
1010
const isDebug = process.env.Configuration !== "Release";
1111
const nativeBinDir = process.env.NativeBinDir ? process.env.NativeBinDir.replace(/"/g, "") : "bin";
12-
const plugins = isDebug ? [writeOnChangePlugin()] : [terser(), writeOnChangePlugin()];
12+
const terserConfig = {
13+
compress: {
14+
ecma: 2016,
15+
unused: false,
16+
},
17+
};
18+
const plugins = isDebug ? [writeOnChangePlugin()] : [terser(terserConfig), writeOnChangePlugin()];
1319

1420
export default defineConfig([
1521
{

src/mono/wasm/runtime/startup.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
import { INTERNAL, Module, runtimeHelpers } from "./modules";
4+
import { INTERNAL, Module, MONO, runtimeHelpers } from "./modules";
55
import { AssetEntry, CharPtr, CharPtrNull, MonoConfig, TypedArray, VoidPtr, wasm_type_symbol } from "./types";
66
import cwraps from "./cwraps";
77
import { mono_wasm_raise_debug_event, mono_wasm_runtime_ready } from "./debug";
@@ -205,7 +205,7 @@ function _get_fetch_file_cb_from_args(args: MonoConfig): (asset: string) => Prom
205205
}
206206

207207
function _finalize_startup(args: MonoConfig, ctx: MonoInitContext) {
208-
ctx.loaded_files.forEach(value => runtimeHelpers.loaded_files.push(value.url));
208+
ctx.loaded_files.forEach(value => MONO.loaded_files.push(value.url));
209209
if (ctx.tracing) {
210210
console.log("MONO_WASM: loaded_assets: " + JSON.stringify(ctx.loaded_assets));
211211
console.log("MONO_WASM: loaded_files: " + JSON.stringify(ctx.loaded_files));

0 commit comments

Comments
 (0)