Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5018, providing a way for the command-line compiler to output
.mjs
files. The method implemented in this PR simply looks at the filename of the source CoffeeScript file(s), and if the source has an extension of.mcoffee
or.litmcoffee
(or.mcoffee.md
) it is saved with an.mjs
extension.This PR also finally removes the
--join
CLI option, which was deprecated back in version 1.8.0 in 2014.TODO: Need to figure out how to test this, and support ES module tests in general. Using the Node 10 nightly as of 2018-04-01, ES modules still aren’t yet supported except behind the
--experimental-modules
flag, though Node 10 final shouldn’t require the flag. Even aside from that, I don’t see how to get Node to support ES modules when parsing a string, e.g.:The way our tests currently work, CoffeeScript compiles the test code into a string and asks Node to eval the string. This doesn’t look like it’ll work for an
import
statement, though, since apparently the only way to enable support forimport
statements in Node is to explicitly load an.mjs
file. So if I wanted to get the tests to work today, it appears I would need to write the output JS string to disk as an.mjs
file, then spawn Node to evaluate it.