feat(core): update Jint

This commit is contained in:
genteure 2022-10-02 16:37:46 +08:00
parent 13f11f4fde
commit da9c1d9160
2 changed files with 4 additions and 6 deletions

View File

@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Fluid.Core" Version="2.2.15" />
<PackageReference Include="Jint" Version="3.0.0-preview-336" />
<PackageReference Include="Jint" Version="3.0.0-preview-343" />
<PackageReference Include="JsonSubTypes" Version="1.9.0" />
<PackageReference Include="HierarchicalPropertyDefault" Version="0.1.4-beta-g75fdf624b1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />

View File

@ -2,7 +2,6 @@ using System;
using System.Threading;
using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.Core.Scripting.Runtime;
using Esprima;
using Esprima.Ast;
using Jint;
using Jint.Native;
@ -29,9 +28,9 @@ namespace BililiveRecorder.Core.Scripting
static UserScriptRunner()
{
setupScript = new JavaScriptParser(new ParserOptions()).ParseScript(@"
setupScript = Engine.PrepareScript(@"
globalThis.recorderEvents = {};
", "internalSetup.js", true);
", "internalSetup.js");
}
public UserScriptRunner(GlobalConfig config)
@ -73,8 +72,7 @@ globalThis.recorderEvents = {};
return null;
}
var parser = new JavaScriptParser();
var script = parser.ParseScript(source!, "userscript.js", true);
var script = Engine.PrepareScript(source!, "userscript.js");
this.cachedScript = script;
this.cachedScriptSource = source;