Skip to content

Commit 98598fb

Browse files
committed
In JavaScriptEngineSwitcher.Node added support for the Jering.Javascript.NodeJS version 7.0.0 Beta 5
1 parent 7cc2861 commit 98598fb

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/JavaScriptEngineSwitcher.Node/JavaScriptEngineSwitcher.Node.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@
1818
<Import Project="../../build/nuget-for-dotnet-lib.props" />
1919

2020
<PropertyGroup>
21-
<Description>JavaScriptEngineSwitcher.Node contains adapter `NodeJsEngine` (wrapper for the Jering.Javascript.NodeJS (https://github.com/JeringTech/Javascript.NodeJS) version 7.0.0 Beta 4).
21+
<Description>JavaScriptEngineSwitcher.Node contains adapter `NodeJsEngine` (wrapper for the Jering.Javascript.NodeJS (https://github.com/JeringTech/Javascript.NodeJS) version 7.0.0 Beta 5).
2222

2323
This package does not contain the `node.exe`. Therefore, you need to install the Node.js (https://nodejs.org) and add the `node.exe`'s directory to the `Path` environment variable (automatically done by the official installer).</Description>
2424
<PackageTags>$(PackageCommonTags);Node.js;Jering.Javascript.NodeJS</PackageTags>
2525
<PackageIconFullPath>../../Icons/JavaScriptEngineSwitcher_Node_Logo128x128.png</PackageIconFullPath>
26-
<PackageReleaseNotes>1. Jering.Javascript.NodeJS was updated to version 7.0.0 Beta 4;
27-
2. Added support of .NET 7.</PackageReleaseNotes>
26+
<PackageReleaseNotes>Jering.Javascript.NodeJS was updated to version 7.0.0 Beta 5.</PackageReleaseNotes>
2827
</PropertyGroup>
2928

3029
<ItemGroup>
31-
<PackageReference Include="Jering.Javascript.NodeJS" Version="7.0.0-beta.4" />
30+
<PackageReference Include="Jering.Javascript.NodeJS" Version="7.0.0-beta.5" />
3231

3332
<ProjectReference Include="../JavaScriptEngineSwitcher.Core/JavaScriptEngineSwitcher.Core.csproj" />
3433
</ItemGroup>

src/JavaScriptEngineSwitcher.Node/Resources/engine-helpers.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ function getContext(engineId) {
2727

2828
module.exports = {
2929
addContext: (callback, engineId, useBuiltinLibrary) => {
30-
let sandboxPrototype = useBuiltinLibrary ? global : null;
31-
let sandbox = Object.create(sandboxPrototype);
30+
let sandbox;
31+
if (useBuiltinLibrary) {
32+
sandbox = Object.create(global);
33+
if (typeof sandbox['require'] === 'undefined') {
34+
sandbox['require'] = require;
35+
}
36+
}
37+
else {
38+
sandbox = Object.create(null);
39+
}
3240

3341
let context = vm.createContext(sandbox);
3442
contexts.set(engineId, context);

src/JavaScriptEngineSwitcher.Node/readme.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
===========
1414
JavaScriptEngineSwitcher.Node contains adapter `NodeJsEngine` (wrapper for the
1515
Jering.Javascript.NodeJS (https://github.com/JeringTech/Javascript.NodeJS)
16-
version 7.0.0 Beta 4).
16+
version 7.0.0 Beta 5).
1717

1818
This package does not contain the `node.exe`. Therefore, you need to install the
1919
Node.js (https://nodejs.org) and add the `node.exe`'s directory to the `Path`
@@ -22,8 +22,7 @@
2222
=============
2323
RELEASE NOTES
2424
=============
25-
1. Jering.Javascript.NodeJS was updated to version 7.0.0 Beta 4;
26-
2. Added support of .NET 7.
25+
Jering.Javascript.NodeJS was updated to version 7.0.0 Beta 5.
2726

2827
=============
2928
DOCUMENTATION

0 commit comments

Comments
 (0)