pierrec / node-eval

Evaluate node require() module content directly
MIT License
93 stars 16 forks source link

fix vm.Script usage on node@10 #17

Closed joaosamouco closed 5 years ago

joaosamouco commented 5 years ago

After node 10, filename is required to be a string.

vm.js:62
      throw new ERR_INVALID_ARG_TYPE('options.filename', 'string', filename);
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.filename" property must be of type string. Received type object
    at new Script (vm.js:62:13)
    at module.exports (/Users/joaosamouco/code/node-eval/eval.js:68:18)
    at Object.<anonymous> (/Users/joaosamouco/code/node-eval/test.js:12:7)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
fgalan commented 5 years ago

I'm facing a problem in my code with eval 0.1.2 that I think would be solved by this PR.

ashishmagicsoft commented 5 years ago

wish i had seen this earlier, struggled entire day due to this.

amadeus-torwell commented 5 years ago

What needs to be done to get this merged with master?

joaosamouco commented 5 years ago

The maintainer looks MIA. It's probably better to fork and publish a new package.

pierrec commented 5 years ago

Sorry for the very late merge. Thanks for the fix.

fgalan commented 5 years ago

Great to see the fix finally merged!

Will be a new version of the package be released and published in the npm registry with the fix, please?

pierrec commented 5 years ago

It is published at version 0.1.3.