Ver Fonte

Use relative imports in headless

JC Brand há 2 anos atrás
pai
commit
d1962d0b34

+ 18 - 16
src/headless/index.js

@@ -6,6 +6,8 @@ import dayjs from 'dayjs';
 import i18n from './shared/i18n';
 import { converse } from './shared/api/public.js';
 
+_converse.api = api;
+
 dayjs.extend(advancedFormat);
 
 /* START: Removable components
@@ -13,22 +15,22 @@ dayjs.extend(advancedFormat);
  * Any of the following components may be removed if they're not needed.
  */
 
-import './plugins/bookmarks/index.js'; // XEP-0199 XMPP Ping
-import './plugins/bosh.js'; // XEP-0206 BOSH
-import './plugins/caps/index.js'; // XEP-0115 Entity Capabilities
-import './plugins/chat/index.js'; // RFC-6121 Instant messaging
-import './plugins/chatboxes/index.js';
-import './plugins/disco/index.js'; // XEP-0030 Service discovery
-import './plugins/adhoc/index.js'; // XEP-0050 Ad Hoc Commands
-import './plugins/headlines/index.js'; // Support for headline messages
-import './plugins/mam/index.js'; // XEP-0313 Message Archive Management
-import './plugins/muc/index.js'; // XEP-0045 Multi-user chat
-import './plugins/ping/index.js'; // XEP-0199 XMPP Ping
-import './plugins/pubsub.js'; // XEP-0060 Pubsub
-import './plugins/roster/index.js'; // RFC-6121 Contacts Roster
-import './plugins/smacks/index.js'; // XEP-0198 Stream Management
-import './plugins/status/index.js';
-import './plugins/vcard/index.js'; // XEP-0054 VCard-temp
+import "./plugins/bookmarks/index.js";  // XEP-0199 XMPP Ping
+import "./plugins/bosh.js";             // XEP-0206 BOSH
+import "./plugins/caps/index.js";       // XEP-0115 Entity Capabilities
+import "./plugins/chat/index.js";       // RFC-6121 Instant messaging
+import "./plugins/chatboxes/index.js";
+import "./plugins/disco/index.js";      // XEP-0030 Service discovery
+import "./plugins/adhoc/index.js";      // XEP-0050 Ad Hoc Commands
+import "./plugins/headlines/index.js";  // Support for headline messages
+import "./plugins/mam/index.js";        // XEP-0313 Message Archive Management
+import "./plugins/muc/index.js";        // XEP-0045 Multi-user chat
+import "./plugins/ping/index.js";       // XEP-0199 XMPP Ping
+import "./plugins/pubsub.js";           // XEP-0060 Pubsub
+import "./plugins/roster/index.js";     // RFC-6121 Contacts Roster
+import "./plugins/smacks/index.js";     // XEP-0198 Stream Management
+import "./plugins/status/index.js";
+import "./plugins/vcard/index.js";      // XEP-0054 VCard-temp
 /* END: Removable components */
 
 import log from './log.js';

+ 1 - 1
src/headless/plugins/adhoc/api.js

@@ -1,4 +1,4 @@
-import log from '@converse/headless/log';
+import log from '../../log.js';
 import { _converse, api, converse } from "@converse/headless";
 import { getCommandFields, parseForCommands } from './utils.js';
 

+ 1 - 1
src/headless/plugins/bookmarks/collection.js

@@ -1,6 +1,6 @@
 import "@converse/headless/plugins/muc/index.js";
 import Bookmark from './model.js';
-import log from "@converse/headless/log.js";
+import log from "../../log.js";
 import { _converse, api, converse } from "@converse/headless";
 import { getOpenPromise } from '@converse/openpromise';
 import { initStorage } from '@converse/headless/utils/storage.js';

+ 1 - 1
src/headless/plugins/chat/model.js

@@ -1,7 +1,7 @@
 import ModelWithContact from './model-with-contact.js';
 import isMatch from "lodash-es/isMatch";
 import isObject from "lodash-es/isObject";
-import log from '@converse/headless/log';
+import log from '../../log.js';
 import pick from "lodash-es/pick";
 import { Model } from '@converse/skeletor/src/model.js';
 import { TimeoutError } from '../../shared/errors.js';

+ 1 - 1
src/headless/plugins/chat/parsers.js

@@ -1,5 +1,5 @@
 import dayjs from 'dayjs';
-import log from '@converse/headless/log';
+import log from '../../log.js';
 import u from '@converse/headless/utils/core';
 import { _converse, api, converse } from '@converse/headless';
 import { rejectMessage } from '@converse/headless/shared/actions';

+ 1 - 1
src/headless/plugins/disco/api.js

@@ -1,5 +1,5 @@
 import isObject from "lodash-es/isObject";
-import log from "@converse/headless/log.js";
+import log from "../../log.js";
 import { _converse, api, converse } from "@converse/headless";
 import { getOpenPromise } from '@converse/openpromise';
 

+ 1 - 1
src/headless/plugins/disco/entities.js

@@ -1,5 +1,5 @@
 import DiscoEntity from './entity.js';
-import log from "@converse/headless/log.js";
+import log from "../../log.js";
 import { Collection } from "@converse/skeletor/src/collection";
 
 

+ 1 - 1
src/headless/plugins/mam/api.js

@@ -1,4 +1,4 @@
-import log from '@converse/headless/log';
+import log from '../../log.js';
 import sizzle from "sizzle";
 import { RSM } from '@converse/headless/shared/rsm';
 import { TimeoutError } from '../../shared/errors.js';

+ 1 - 1
src/headless/plugins/mam/utils.js

@@ -1,5 +1,5 @@
 import MAMPlaceholderMessage from './placeholder.js';
-import log from '@converse/headless/log';
+import log from '../../log.js';
 import sizzle from 'sizzle';
 import { _converse, api, converse } from '@converse/headless';
 import { parseMUCMessage } from '@converse/headless/plugins/muc/parsers';

+ 1 - 1
src/headless/plugins/ping/api.js

@@ -1,4 +1,4 @@
-import log from '@converse/headless/log.js';
+import log from '../../log.js';
 import { _converse, api, converse } from "@converse/headless";
 import { setLastStanzaDate } from './utils.js';
 

+ 1 - 1
src/headless/plugins/roster/contacts.js

@@ -1,5 +1,5 @@
 import RosterContact from './contact.js';
-import log from "@converse/headless/log";
+import log from "../../log.js";
 import { Collection } from "@converse/skeletor/src/collection";
 import { Model } from "@converse/skeletor/src/model";
 import { _converse, api, converse } from "@converse/headless";

+ 1 - 1
src/headless/plugins/roster/utils.js

@@ -1,4 +1,4 @@
-import log from "@converse/headless/log";
+import log from "../../log.js";
 import { Model } from '@converse/skeletor/src/model.js';
 import { RosterFilter } from '@converse/headless/plugins/roster/filter.js';
 import { STATUS_WEIGHTS } from "../../shared/constants";

+ 1 - 1
src/headless/plugins/vcard/api.js

@@ -1,4 +1,4 @@
-import log from "@converse/headless/log";
+import log from "../../log.js";
 import { _converse, api, converse } from "../../index.js";
 import { createStanza, getVCard } from './utils.js';
 

+ 1 - 1
src/headless/plugins/vcard/utils.js

@@ -1,4 +1,4 @@
-import log from "@converse/headless/log";
+import log from "../../log.js";
 import { _converse, api, converse } from "../../index.js";
 import { initStorage } from '@converse/headless/utils/storage.js';
 import { shouldClearCache } from '@converse/headless/utils/core.js';

+ 1 - 2
src/headless/shared/api/index.js

@@ -1,4 +1,3 @@
-import _converse from '../_converse.js';
 import connection_api from '../connection/api.js';
 import events_api from '../api/events.js';
 import promise_api from '../api/promise.js';
@@ -19,7 +18,7 @@ import { settings_api } from '../settings/api.js';
  * @namespace _converse.api
  * @memberOf _converse
  */
-const api = _converse.api = {
+const api = {
     connection: connection_api,
     settings: settings_api,
     ...send_api,