Comparing version 6.7.0 to 7.0.0
@@ -19,3 +19,4 @@ 'use strict'; | ||
} | ||
this.args.unshift('--js.test262-mode=true'); | ||
this.args.unshift('--experimental-options'); | ||
return super.evalScript(code, options); | ||
@@ -22,0 +23,0 @@ } |
@@ -41,7 +41,7 @@ 'use strict'; | ||
var eshostContext = vm.createContext({ | ||
setTimeout: setTimeout, | ||
require: require, | ||
console: console, | ||
print: function print() { | ||
console.log.apply(console, arguments); | ||
setTimeout, | ||
require, | ||
console, | ||
print(...args) { | ||
console.log(...args); | ||
} | ||
@@ -48,0 +48,0 @@ }); |
@@ -30,2 +30,3 @@ const fs = require('fs'); | ||
// xs: 'xs', | ||
graaljs: 'graaljs', | ||
@@ -32,0 +33,0 @@ /* Browsers */ |
{ | ||
"name": "eshost", | ||
"version": "6.7.0", | ||
"version": "7.0.0", | ||
"description": "Invoke ECMAScript scripts in any command line JS engine.", | ||
@@ -5,0 +5,0 @@ "main": "lib/eshost.js", |
@@ -30,3 +30,3 @@ # eshost | ||
| nashorn | Nashorn | CLI | Any | Build [from source](https://wiki.openjdk.java.net/display/Nashorn/Building+Nashorn) | | | ||
| node | Node.js | CLI | Any | https://nodejs.org | | | ||
| node | Node.js | CLI | Any | https://nodejs.org | [Active LTS versions only](https://nodejs.org/en/about/releases/) | | ||
| qjs<sup>4</sup> | QuickJS | CLI | Any | Build [from source](https://bellard.org/quickjs/) | | | ||
@@ -33,0 +33,0 @@ | xs | Moddable XS | CLI | Any | Build [from source](https://github.com/Moddable-OpenSource/moddable-xst) | | |
@@ -1,25 +0,29 @@ | ||
var $262 = { | ||
global: globalThis, | ||
gc() { | ||
return gc(); | ||
}, | ||
createRealm(options) { | ||
throw new Test262Error('$262.createRealm not yet supported.'); | ||
}, | ||
evalScript(code) { | ||
throw new Test262Error('$262.evalScript not yet supported.'); | ||
}, | ||
getGlobal(name) { | ||
return this.global[name]; | ||
}, | ||
setGlobal(name, value) { | ||
this.global[name] = value; | ||
}, | ||
destroy() { /* noop */ }, | ||
IsHTMLDDA() { return {}; }, | ||
source: $SOURCE, | ||
get agent() { | ||
throw new Test262Error('Agent not yet supported.'); | ||
// No need to create $262 object as it is provided behind --experimental-options --js.test262-mode=true flags | ||
$262.createRealm = function(options) { | ||
options = options || {}; | ||
options.globals = options.globals || {}; | ||
var realm = loadWithNewGlobal({ script: 'this', name: 'createRealm' }); | ||
realm.eval(this.source); | ||
realm.$262.source = this.source; | ||
realm.$262.destroy = function () { | ||
if (options.destroy) { | ||
options.destroy(); | ||
} | ||
}; | ||
for(var glob in options.globals) { | ||
realm.$262.global[glob] = options.globals[glob]; | ||
} | ||
return realm.$262; | ||
}; | ||
$262.gc = function() { | ||
throw new Test262Error('GC not yet supported.'); | ||
}; | ||
$262.getGlobal = function(name) { | ||
return this.global[name]; | ||
}; | ||
$262.setGlobal = function(name, value) { | ||
this.global[name] = value; | ||
}; | ||
$262.destroy = function () { /* noop */ }; | ||
$262.IsHTMLDDA = function() { return {}; }; | ||
$262.source = $SOURCE; |
@@ -1,3 +0,3 @@ | ||
function print() { | ||
console.log.apply(console, arguments); | ||
function print(...args) { | ||
console.log(...args); | ||
} | ||
@@ -7,6 +7,6 @@ var vm = require('vm'); | ||
global: Function('return this')(), | ||
gc: function() { | ||
gc() { | ||
return gc(); | ||
}, | ||
createRealm: function createRealm(options) { | ||
createRealm(options) { | ||
options = options || {}; | ||
@@ -36,8 +36,9 @@ options.globals = options.globals || {}; | ||
}, | ||
evalScript: function evalScript(code) { | ||
evalScript(code) { | ||
const displayErrors = false; | ||
try { | ||
if (this.context) { | ||
vm.runInContext(code, this.context, {displayErrors: false}); | ||
vm.runInContext(code, this.context, {displayErrors}); | ||
} else { | ||
vm.runInESHostContext(code, {displayErrors: false}); | ||
vm.runInESHostContext(code, {displayErrors}); | ||
} | ||
@@ -50,10 +51,10 @@ | ||
}, | ||
getGlobal: function getGlobal(name) { | ||
getGlobal(name) { | ||
return this.global[name]; | ||
}, | ||
setGlobal: function setGlobal(name, value) { | ||
setGlobal(name, value) { | ||
this.global[name] = value; | ||
}, | ||
destroy: function destroy() { /* noop */ }, | ||
IsHTMLDDA: function IsHTMLDDA() { return {}; }, | ||
destroy() { /* noop */ }, | ||
IsHTMLDDA() { return {}; }, | ||
source: $SOURCE | ||
@@ -60,0 +61,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109015
2251