Open bterlson opened 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.
@cellule had some thoughts about ChakraCore's WScript
file-loading functions and CWD.
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
Update:
-Modules
Feature request for a -Module
flag.js
=> .mjs
--experimental-modules
@Cellule was there ever a PR addressing the CWD issue?
@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.
@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.
@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.
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.
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