ESM: Enable dynamic imports.
This PR enables dynamic imports.
Dynamic imports are a special syntax that is function-like and returns a Promise.
import * as system from 'system';
import('./x.js').then((module) => {
log(module.default);
}).catch(err => {
logError(err);
}).finally(() => {
imports.mainloop.quit();
});
imports.mainloop.run();
Dynamic imports also provide inter-op with legacy GJS scripts...
const { GLib } = imports.gi;
var MyApp = ...
import('./module.js').then((module) => {
log(module.run(MyApp));
}).catch(err => {
logError(err);
});