This MR ports the Shell UI to ESM modules based on the GJS work at gjs/!450 and gjs/!525
Note: DBus services and subprojects (like the Extensions app) will be fully addressed in later MRs.
For the most part this is a 1:1 port between the old and new imports systems, some code must be refactored to work asynchronously:
- Panel indicator loading (to support dynamically checking if NetworkManager and GnomeBluetooth are available)
- Extension loading (all JavaScript sources load asynchronously now) - !2364 (merged)
Extensions
Extensions require changes to support modules (if they want to import Shell files they need to be modules)
Import changes
Extensions use resource://
paths to load shell files.
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
If GJS adds import aliases, we could add something similar to below in a follow up...
import * as PopupMenu from '~/ui/popupMenu.js';
metadata.json Updates
To differentiate from extensions with older formats (all of which will error due to import changes), a "module" key has been added to metadata.json to specify the 43+ entrypoint for each extension.
{
"module": "extension.js"
}
{
"module": "extension42.js"
}
This should simplify extensions shipping multiple versions if they choose to do so and prevents old extensions from loading.