Comparing version 4.4.0 to 4.5.0
@@ -34,3 +34,3 @@ 'use strict'; | ||
evalScript(code /*, options = {} */) { | ||
evalScript(code, options = {}) { | ||
let tempfile = temp.path({ suffix: '.js' }); | ||
@@ -77,7 +77,8 @@ let temppath = path.dirname(tempfile); | ||
hasDependencies = false; | ||
} | ||
if (options.module || attrs.flags.module || | ||
hasModuleSpecifier(contents)) { | ||
// When testing module or dynamic import code that imports itself, | ||
// we must copy the test file with its actual name. | ||
} | ||
if (hasModuleSpecifier(contents)) { | ||
tempfile = path.join(temppath, sourcebase); | ||
@@ -84,0 +85,0 @@ } |
@@ -9,3 +9,9 @@ 'use strict'; | ||
function hasModuleSpecifier(source) { | ||
return /(import|import\(|from)(\s*)'(.*)'|"(.*)";/g.test(source); | ||
const dynamicImport = /import\((\s*)('(.+)'|"(.*)")(\s*)\)/g.exec(source); | ||
const moduleImport = /(import|from)(?:\s*)('(\.\/.*)'|"(\.\/.*)")/g.exec(source); | ||
if ((dynamicImport && dynamicImport.length) || | ||
(moduleImport && moduleImport.length)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
@@ -12,0 +18,0 @@ |
{ | ||
"name": "eshost", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"description": "Invoke ECMAScript scripts in any command line JS engine.", | ||
@@ -5,0 +5,0 @@ "main": "lib/eshost.js", |
Sorry, the diff of this file is not supported yet
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
92451
1775