Cover *.js and *.jsm.js in the shim for ESM-ified module
Categories
(Core :: XPConnect, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox103 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
As pointed out in bug 1609269 comment #8, non-*.jsm
files are also referred from out-of-tree.
That means:
- we should keep the
*.js
extension - we should cover
*.js
case with the shim - we should directly migrate from
*.js
to.sys.mjs
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
also we need to cover .jsm.js
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 3•2 years ago
|
||
This patch adds the support for the following 2 cases, in addition to *.jsm
to *.sys.mjs
:
- JSM file with
*.js
extension is converted to ESM with*.sys.mjs
- e.g.
services/sync/modules/main.js
toservices/sync/modules/main.sys.mjs
- e.g.
- JSM file with
*.jsm.js
extension is converted to ESM with*.sys.mjs
- e.g.
devtools/client/performance-new/popup/background.jsm.js
todevtools/client/performance-new/popup/background.sys.mjs
- e.g.
So, consumers that imports those modules with the current URL keeps working even if those files are renamed.
This should cover in-tree consumers (to make the migration easier, by making it smaller chunk), and out-of-tree consumers (extensions, etc).
Is there any other cases that I missed here, e.g. in devtools, newtab, remote, sync? also, is there any issue with the above?
Comment 4•2 years ago
|
||
AFAIK, there is no official addon/code running in firefox that is hosted out of the tree for DevTools.
We have the "adp helper addon", but it doesn't run any JS and only distributes executables.
I think that the profiler no longer involves an addon and the profiler icon is now always managed by some in-tree code?
Otherwise, DevTools isn't using any special extension names and sticks to .jsm
(for jsm) or .js
(for common js modules).
Except in performance-new folder, where there is this .jsm.js
trick for typescript.
Comment 5•2 years ago
|
||
Nothing to add on top of what Alex said for DevTools.
For remote/ I also don't think we have any out-of-tree consumer for any of our JSMs. Pinging :whimboo in case I am missing something.
Comment 6•2 years ago
|
||
Yeah, we don't use any addon in the profiler / performance-new code now. The files *.jsm.js are jsm, the js
suffix is to trick typescript to look at these files, as we can't otherwise instruct typescript to look at specific suffixes.
Comment 7•2 years ago
|
||
I'm not aware that there is any code outside of our tree that actually uses our JSM files under /remote
.
Assignee | ||
Comment 8•2 years ago
|
||
I was wrong, there wasn't non-*.jsm file in newtab component.
Comment 9•2 years ago
|
||
That plan sounds great to me for the services/* modules, thanks.
Assignee | ||
Comment 10•2 years ago
|
||
Thank you all!
looks like this will cover most of the cases and we can go with it.
If there's any other issue (such as, .sys.mjs
cannot be used for some reason), we can still keep the compatibility by making a thin wrapper with existing jsm filename, that exposes new ESM file's symbols.
Comment 11•2 years ago
|
||
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/fe7b745e73f1 Support resource URI with *.js and *.jsm.js extension in ESM shim. r=jonco
Comment 12•2 years ago
|
||
bugherder |
Description
•