Moving CJS to ES6 Modules

I’m trying to move over to ES6 modules but not getting things quite right and wanted someone’s help / pointers.
here is the PR I have so far: https://github.com/purescript/purescript/pull/3379

I have a couple of problems left to get it working (will probably need refactoring) the main one being:

In the compiled JS we now have exported values that match keywords being prefixed with $$ here or $prime here I need to replicate that change in the body of files when using imported functions, ie the use would be Control_Coroutine["await"] but it is exported as $$await. I know where await gets passed in here but I’m can’t seem to use properToJs due to a type miss match Gen1 but need Text.

Feels like this is going to be the wrong place to do this even if I could work out how to do it. Any tips on this would be greatly appreciated.

4 Likes

Where does Gen1 come from?

I think it’s a compiler generated type, I’m going to try take another look this evening. Think that I need to look at where key words are being used in the code prior to reaching the step above and see if I can make the changed there. :slight_smile:

Just noting here that the latest tracking issue on this topic is ES modules #3613.

Also some further discussion in the PR.

To summarize the current roadmap:

  • 0.14 - Add deprecation warnings for the using single quote character (') in names in FFI JS code.
  • 0.15 - Convert to ES Module output
2 Likes