U8 - importing and exporting symbols from JavaScript files

CommonJS support

Implements almost full CommonJS support; e.g. to use it, include the following in your module (which is to be imported):

// file: some_module.js
function toExport() { //... }

exports.someFunction = toExport;

// or using module.exports:

module.exports = { someFunction: toExport };

and any combinations of above mentioned.

In the source where you want to import it use:

let imported = require('some_module');

// or, using destructuring assignment:

{ someFunction } = { ...require('some_module');

When require'ing file, the .js extension could be omitted. Expected extension is .js.

Import keyword

As for now, the limited support for import keyword is supported:

import { someFunction, SomeClass } from 'some_module'

Expected file name extension is .js. All three of .js .mjs .cjs are allowed but latter two needs to be explicitly specified.