From a4cbf4d1e9b0a037de75ddcf3326d8df9a030b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20R=C3=A4tzel?= Date: Mon, 15 Jan 2024 21:31:24 +0000 Subject: [PATCH] Clean up compiler interface and configure Jint for compilation scenarios --- implement/elm-time/ElmInteractive/ElmInteractive.cs | 6 +++++- implement/elm-time/JavaScript/JavaScriptEngineJint.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/implement/elm-time/ElmInteractive/ElmInteractive.cs b/implement/elm-time/ElmInteractive/ElmInteractive.cs index 7dbe5fba..bff46a86 100644 --- a/implement/elm-time/ElmInteractive/ElmInteractive.cs +++ b/implement/elm-time/ElmInteractive/ElmInteractive.cs @@ -182,7 +182,11 @@ closestBase is not null new CompileElmInteractiveEnvironmentRequest( modulesTexts: elmModulesTexts, environmentBefore: environmentBefore), - options: new System.Text.Json.JsonSerializerOptions { MaxDepth = 1000 }); + options: new System.Text.Json.JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + MaxDepth = 1000 + }); var responseJson = evalElmPreparedJavaScriptEngine.CallFunction("compileInteractiveEnvironment", argumentsJson).ToString()!; diff --git a/implement/elm-time/JavaScript/JavaScriptEngineJint.cs b/implement/elm-time/JavaScript/JavaScriptEngineJint.cs index 8e16a1e6..ee9f5500 100644 --- a/implement/elm-time/JavaScript/JavaScriptEngineJint.cs +++ b/implement/elm-time/JavaScript/JavaScriptEngineJint.cs @@ -15,7 +15,7 @@ public record FunctionDelegateIntoHost( Func hostFunc, int parameterCount); - private readonly Engine engine = new(); + private readonly Engine engine = new(new Options { Json = new JsonOptions { MaxParseDepth = 1_000 } }); private readonly IReadOnlyList functionDelegatesIntoHost;