-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: Add native support for ESM .mjs files on Node 12+
* Rename test/es2017 and update ESLint config to allow for import/export syntax to be used. We don't rely on ESLint to know what is supported in Node.js, our test matrix in CI covers that already. We should probably re-think the way these tests are organized, which I've filed #1511 for. * Update eslint config for src/cli to es2020. The dynamic `import()` statement was only spe'ced in es2020. This is first implemented (without experimental flag) in Node 12. We need to support Node 10. However it looks like Node 10 already tolerated this (maybe it sees it as a normal function, or maybe it was already recognised by the V8 parser it shipped with), so the try-catch suffices there. Again, the CI test matrix verifies for us that stuff works fine on older versions. Ref #1465.
- Loading branch information
Showing
12 changed files
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import sum from "./sum.mjs"; | ||
|
||
QUnit.module( "ESM test suite", () => { | ||
|
||
QUnit.test( "sum()", assert => { | ||
assert.equal( 5, sum( 2, 3 ) ); | ||
} ); | ||
|
||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function sum( a, b ) { | ||
return a + b; | ||
} | ||
|
||
export default sum; |
File renamed without changes.