Re: cgjs VS cgj + esm progress



Hi Philip,
  SpiderMonkey already supports ESM indeed, you just need to start the project with a `-m` or `--module=PATH` flag.

If GJS would be so kind to pass along such flag when used, developers could arbitrary decide to start GJS as module or not.

Test case

a.js
```
import {cwd} from './b.js';
print(cwd());
```

b.js
```
const GLib = imports.gi.GLib;
export const cwd = () => GLib.get_current_dir();
```

gjs -m a.js

should not produce syntax error, should pass -m flag along and let SpiderMonkey handle the ESM module system.

Where should I look to pass along flags ?

Thanks!




On Sun, Feb 4, 2018 at 2:18 AM, <philip chimento gmail com> wrote:
On Sat, Feb 3, 2018 at 5:00 AM Andrea Giammarchi <andrea giammarchi gmail com> wrote:
I know CGJS progress is quite slow, I've been busy with other projects, but I wonder if it's possible to know what's the actual ESM status in GJS in general.

It would be awesome to be able to use just `import module from "./file.js"` in GJS so that I can make CGJS also compatible with published ESM which start appearing in npm.

Thanks in advance for any sort of update about this.

Best Regards

P.S. the global process just landed in core https://github.com/cgjs/process#cgjsprocess-

Hi Andrea,

Nothing has happened with this yet.

I would welcome some help. I think enough of ES6 modules are implemented in SpiderMonkey 52 that it should be possible to get a proof of concept working.

Regards,
Philip C



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]