import { extensions } from "sdk/extensions";
import { response } from "sdk/http";
const mainmenu = [];
const menuExtensions = extensions.getExtensions("ide-menu");
for (let i = 0; i < menuExtensions.length; i++) {
const extensionPath = menuExtensions[i];
// To require CommonJS extension
// const menuExtension = require(extensionPath);
// const menu = menuExtension.getMenu();
// Note: ECMA6 imports are always relative, thus providing the relative path to the project root folder.
// In this sample it's assumed that the file is located at "my-project/myFolder/file.mjs"
const { getMenu } = await import(`../../${extensionPath}`);
const menu = getMenu();
mainmenu.push(menu);
}
response.println(JSON.stringify(mainmenu));