WIP: ES6 Modules
Allow for gjs scripts to use es6 import syntax:
-
Import other JS modules -
Import C Modules
(optional)
-
Move GIR import logic to JS
Open Questions:
How do we handle loading scripts (as opposed to modules)?
Module loading forces strict mode so we can't load old scripts as modules. We need a way to distinguishing. Options include:
- Using
.jsm
files (a la node) - Requiring a command line flag like
-m
(a la mozjs shell) - Autodetection of module semantics (a la typescript)
There's also the question when a module wants to import a script. I think the least janky way to do this is to require the use of the legacy imports interface for such a thing, but I'm open to suggestions.
Import resolution semantics
Do we auto-resolve import mod from "foo/bar"
to foo/bar/index.js
if bar is a directory. I think we should.
How does name resolution work for gir imports?
Edited by djrenren