Write a script to convert an already-ready JSM to ESM
Categories
(Core :: XPConnect, task, P3)
Tracking
()
People
(Reporter: zbraniecki, Unassigned)
References
(Blocks 1 open bug)
Details
Once we have the JSM ready to be converted to ESM, we need a script to do that.
Reporter | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
P3
Is this an XPConnect bug? kmag says yes. He will probably be the person to fix it when the time comes.
Comment 2•5 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #1)
P3
Is this an XPConnect bug? kmag says yes. He will probably be the person to fix it when the time comes.
I'm not sure exactly what the right component is, since this is about mass-changing JSM files across the entire tree. But if kmag thinks it's in the right place then happy to leave it here :).
We've been working on a few AST rewrites for other bugs at https://github.com/bgrins/jsm-rewrites and I believe we could automate the rewriting of exports to ESM format using something similar (that, or maybe eslint --fix
and a custom rule) once a module is ready to be converted (fixed up with all the issues identified blocking bug 1308512), and we have initial support for ESM loading (bug 1432901).
Comment 3•2 years ago
|
||
Here's WIP scripts and rules https://github.com/arai-a/jsm-to-esm
for:
EXPORTED_SYMBOLS
toexport
declarationsChromeUtils.import
toChromeUtils.importESM
XPCOMUtils.defineLazyModuleGetters
toChromeUtils.defineESMGetters
- top-level
ChromeUtils.import
toimport
declaration - rename file and modify
moz.build
etc
things not covered are:
- process/window actors API call
Comment 4•2 years ago
|
||
process/window actors API call is also supported in https://github.com/arai-a/jsm-to-esm
Description
•