Browse Source

Don't import plugins' `index.js` file from other plugins

Importing a plugin's `index.js` file from other plugins means that it's no
longer possible to remove that plugin by removing it from `src/converse.js`.

Instead, all plugins need to be imported in proper order from
`src/headless/headless.js` and `src/converse.js`.

Updates #3026
JC Brand 2 years ago
parent
commit
bd60861c1e

+ 5 - 4
src/converse.js

@@ -17,24 +17,25 @@ import 'shared/styles/index.scss';
  * ------------------------
  * Any of the following plugin imports may be removed if the plugin is not needed
  */
+import "./plugins/modal/index.js";
 import "./plugins/bookmark-views/index.js"; // Views for XEP-0048 Bookmarks
 import "./plugins/chatview/index.js";       // Renders standalone chat boxes for single user chat
 import "./plugins/controlbox/index.js";     // The control box
-import "./plugins/dragresize/index.js";     // Allows chat boxes to be resized by dragging them
-import "./plugins/fullscreen/index.js";
 import "./plugins/headlines-view/index.js";
 import "./plugins/mam-views/index.js";
-import "./plugins/minimize/index.js";       // Allows chat boxes to be minimized
 import "./plugins/muc-views/index.js";      // Views related to MUC
+import "./plugins/minimize/index.js";       // Allows chat boxes to be minimized
 import "./plugins/notifications/index.js";
-import "./plugins/omemo/index.js";
 import "./plugins/profile/index.js";
+import "./plugins/omemo/index.js";
 import "./plugins/push/index.js";           // XEP-0357 Push Notifications
 import "./plugins/register/index.js";       // XEP-0077 In-band registration
 import "./plugins/roomslist/index.js";      // Show currently open chat rooms
 import "./plugins/rootview/index.js";
 import "./plugins/rosterview/index.js";
 import "./plugins/singleton/index.js";
+import "./plugins/dragresize/index.js";     // Allows chat boxes to be resized by dragging them
+import "./plugins/fullscreen/index.js";
 /* END: Removable components */
 
 

+ 0 - 1
src/plugins/chatview/index.js

@@ -3,7 +3,6 @@
  * @license Mozilla Public License (MPLv2)
  */
 import '../chatboxviews/index.js';
-import 'plugins/modal/index.js';
 import 'shared/chat/chat-content.js';
 import 'shared/chat/help-messages.js';
 import 'shared/chat/toolbar.js';

+ 0 - 2
src/plugins/dragresize/index.js

@@ -4,8 +4,6 @@
  * @license Mozilla Public License (MPLv2)
  */
 import './components/dragresize.js';
-import 'plugins/chatview/index.js';
-import 'plugins/controlbox/index.js';
 import { applyDragResistance, onMouseUp, onMouseMove } from './utils.js';
 import DragResizableMixin from './mixin.js';
 import { _converse, api, converse } from '@converse/headless/core';

+ 0 - 4
src/plugins/fullscreen/index.js

@@ -3,10 +3,6 @@
  * @license Mozilla Public License (MPLv2)
  * @copyright 2022, the Converse.js contributors
  */
-import "@converse/headless/plugins/muc/index.js";
-import "plugins/chatview/index.js";
-import "plugins/controlbox/index.js";
-import "plugins/singleton/index.js";
 import { api, converse } from "@converse/headless/core";
 import { isUniView } from '@converse/headless/utils/core.js';
 

+ 0 - 1
src/plugins/minimize/index.js

@@ -5,7 +5,6 @@
  */
 import './view.js';
 import './components/minimized-chat.js';
-import 'plugins/chatview/index.js';
 import debounce from 'lodash-es/debounce';
 import MinimizedChatsToggle from './toggle.js';
 import { _converse, api, converse } from '@converse/headless/core';

+ 0 - 1
src/plugins/muc-views/index.js

@@ -4,7 +4,6 @@
  * @license Mozilla Public License (MPLv2)
  */
 import '../chatboxviews/index.js';
-import 'plugins/modal/index.js';
 import './adhoc-commands.js';
 import MUCView from './muc.js';
 import { api, converse } from '@converse/headless/core';

+ 1 - 2
src/plugins/omemo/index.js

@@ -5,7 +5,6 @@
 import './fingerprints.js';
 import './profile.js';
 import 'shared/modals/user-details.js';
-import 'plugins/profile/index.js';
 import ConverseMixins from './mixins/converse.js';
 import Device from './device.js';
 import DeviceList from './devicelist.js';
@@ -51,7 +50,7 @@ converse.plugins.add('converse-omemo', {
         );
     },
 
-    dependencies: ['converse-chatview', 'converse-pubsub'],
+    dependencies: ['converse-chatview', 'converse-pubsub', 'converse-profile'],
 
     initialize () {
         api.settings.extend({ 'omemo_default': false });

+ 0 - 1
src/plugins/register/index.js

@@ -7,7 +7,6 @@
  * @license Mozilla Public License (MPLv2)
  */
 import './panel.js';
-import '../controlbox/index.js';
 import { __ } from 'i18n';
 import { _converse, api, converse } from '@converse/headless/core';