tc39 / eshost

A uniform wrapper around a multitude of ECMAScript hosts. CLI: https://github.com/bterlson/eshost-cli
Other
142 stars 36 forks source link

Support Modules in all hosts #20

Open bterlson opened 7 years ago

bterlson commented 7 years ago

Various console hosts now support modules, and some browsers do as well. Need implementations for every agent subclass. Here's a checklist:

/cc @phistuck, @dilijev

bterlson commented 7 years ago

In the following branch I have preliminary support for ChakraCore and SpiderMonkey: https://github.com/bterlson/eshost/tree/module-support (specifically, 6feab854abc92f36ed181745a2e3d5882b37a561). I say preliminary because I have yet to hook up test262-harness and I'm not entirely sure how ChakraCore support is going to work considering it will only ever load from CWD rather than relative to the current module.

dilijev commented 7 years ago

@cellule had some thoughts about ChakraCore's WScript file-loading functions and CWD.

Cellule commented 7 years ago

https://github.com/Microsoft/ChakraCore/pull/3284 is adressing this particular problem. I hope, once merged, we could leverage the same mechanism for WScript.LoadScriptFile / WScript.LoadModuleFile

rwaldron commented 6 years ago

Update:

dilijev commented 6 years ago

@Cellule was there ever a PR addressing the CWD issue?

rhuanjl commented 6 years ago

@dilijev 3284 which Cellule linked above was a PR to resolve the CWD issue.

It was merged but the behaviour was reverted later possibly by mistake.

The test for the behaviour was disabled due to triggering an unrelated nullptr read, and all other module tests had all files in the same folder. So nothing in the test suite was dependent on how module paths were resolved at the time the behaviour was reverted back to be by CWD.

rwaldron commented 6 years ago

@dilijev Instead of relying on WScript APIs for handling, I've opened a feature request for a new flag: Test262/eshost runtime feature request: -module flag for ch #5274. That feature appears to be moving swiftly.

rhuanjl commented 6 years ago

@rwaldron dilijev’s concern is still relevant - it’s the same point I mentioned on the CC issue about path resolving in ch if modules have dependencies in different folders. It may be n/a for test262 but it’s potentially very relevant for other uses of eshost.

dilijev commented 6 years ago

Also concerned for non-module loading. WScript.LoadScriptFile etc is relative to CWD without any way to get or force loading relative to the script dir.

But that's out of scope of this issue.