fix(core): upgrade Jint and fix errors

This commit is contained in:
genteure 2022-09-11 19:32:55 +08:00
parent 1440f2c2d9
commit fa18af50a6
2 changed files with 5 additions and 5 deletions

View File

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

View File

@ -29,9 +29,9 @@ namespace BililiveRecorder.Core.Scripting
static UserScriptRunner() static UserScriptRunner()
{ {
setupScript = new JavaScriptParser(@" setupScript = new JavaScriptParser(new ParserOptions()).ParseScript(@"
globalThis.recorderEvents = {}; globalThis.recorderEvents = {};
", new ParserOptions(@"internalSetup.js")).ParseScript(); ", "internalSetup.js", true);
} }
public UserScriptRunner(GlobalConfig config) public UserScriptRunner(GlobalConfig config)
@ -73,8 +73,8 @@ globalThis.recorderEvents = {};
return null; return null;
} }
var parser = new JavaScriptParser(source!, new ParserOptions("userscript.js")); var parser = new JavaScriptParser();
var script = parser.ParseScript(); var script = parser.ParseScript(source!, "userscript.js", true);
this.cachedScript = script; this.cachedScript = script;
this.cachedScriptSource = source; this.cachedScriptSource = source;