Skip to content

Commit

Permalink
[1.x] [extensibility] Export all missing modules in compat (#4044)
Browse files Browse the repository at this point in the history
* chore(emoji): export missing modules in compat API

* chore(flags): export missing modules in compat API

* chore(likes): export missing modules in compat API

* chore(lock): export missing modules in compat API

* chore(markdown): export missing modules in compat API

* chore(mentions): export missing modules in compat API

* chore(nicknames): export missing modules in compat API

* chore(extension-manager): export missing modules in compat API

* chore(statistics): export missing modules in compat API

* chore(sticky): export missing modules in compat API

* chore(subscriptions): export missing modules in compat API

* chore(suspend): export missing modules in compat API

* chore(tags): export missing modules in compat API

* chore(core): export missing modules in compat API

* chore: fix tsconfig
  • Loading branch information
DavideIadeluca authored Oct 2, 2024
1 parent 4d75da3 commit 449ba48
Show file tree
Hide file tree
Showing 32 changed files with 241 additions and 2 deletions.
1 change: 1 addition & 0 deletions extensions/akismet/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/flags/*": ["../../flags/js/dist-typings/*"]
}
}
Expand Down
7 changes: 7 additions & 0 deletions extensions/emoji/js/src/forum/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import AutocompleteDropdown from './fragments/AutocompleteDropdown';
import getEmojiIconCode from './helpers/getEmojiIconCode';

export default {
'emoji/fragments/AutocompleteDropdown': AutocompleteDropdown,
'emoji/helpers/getEmojiIconCode': getEmojiIconCode,
};
6 changes: 6 additions & 0 deletions extensions/emoji/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ app.initializers.add('flarum-emoji', () => {
// render emoji as image in Posts content and title.
renderEmoji();
});

// Expose compat API
import emojiCompat from './compat';
import { compat } from '@flarum/core/forum';

Object.assign(compat, emojiCompat);
2 changes: 2 additions & 0 deletions extensions/flags/js/src/forum/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FlagList from './components/FlagList';
import FlagPostModal from './components/FlagPostModal';
import FlagsPage from './components/FlagsPage';
import FlagsDropdown from './components/FlagsDropdown';
import FlagListState from './states/FlagListState';

export default {
'flags/addFlagsToPosts': addFlagsToPosts,
Expand All @@ -16,4 +17,5 @@ export default {
'flags/components/FlagPostModal': FlagPostModal,
'flags/components/FlagsPage': FlagsPage,
'flags/components/FlagsDropdown': FlagsDropdown,
'flags/states/FlagListState': FlagListState,
};
11 changes: 11 additions & 0 deletions extensions/likes/js/src/forum/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import LikesUserPage from './components/LikesUserPage';
import PostLikedNotification from './components/PostLikedNotification';
import PostLikesModal from './components/PostLikesModal';
import PostLikesModalState from './states/PostLikesModalState';

export default {
'likes/components/LikesUserPage': LikesUserPage,
'likes/components/PostLikedNotification': PostLikedNotification,
'likes/components/PostLikesModal': PostLikesModal,
'likes/states/PostLikesModalState': PostLikesModalState,
};
6 changes: 6 additions & 0 deletions extensions/likes/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ app.initializers.add('flarum-likes', () => {
});
});
});

// Expose compat API
import likesCompat from './compat';
import { compat } from '@flarum/core/forum';

Object.assign(compat, likesCompat);
7 changes: 7 additions & 0 deletions extensions/lock/js/src/forum/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import DiscussionLockedNotification from './components/DiscussionLockedNotification';
import DiscussionLockedPost from './components/DiscussionLockedPost';

export default {
'lock/components/DiscussionLockedNotification': DiscussionLockedNotification,
'lock/components/DiscussionLockedPost': DiscussionLockedPost,
};
6 changes: 6 additions & 0 deletions extensions/lock/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ app.initializers.add('flarum-lock', () => {
});
});
});

// Expose compat API
import lockCompat from './compat';
import { compat } from '@flarum/core/forum';

Object.assign(compat, lockCompat);
5 changes: 5 additions & 0 deletions extensions/markdown/js/src/admin/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import commonCompat from '../common/compat';

export default {
...commonCompat,
};
6 changes: 6 additions & 0 deletions extensions/markdown/js/src/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ import app from 'flarum/admin/app';
import { initialize } from '../common/index';

app.initializers.add('flarum-markdown', initialize);

// Expose compat API
import markdownCompat from './compat';
import { compat } from '@flarum/core/admin';

Object.assign(compat, markdownCompat);
7 changes: 7 additions & 0 deletions extensions/markdown/js/src/common/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import MarkdownButton from './components/MarkdownButton';
import MarkdownToolbar from './components/MarkdownToolbar';

export default {
'markdown/components/MarkdownButton': MarkdownButton,
'markdown/components/MarkdownToolbar': MarkdownToolbar,
};
5 changes: 5 additions & 0 deletions extensions/markdown/js/src/forum/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import commonCompat from '../common/compat';

export default {
...commonCompat,
};
6 changes: 6 additions & 0 deletions extensions/markdown/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ import app from 'flarum/forum/app';
import { initialize } from '../common/index';

app.initializers.add('flarum-markdown', initialize);

// Expose compat API
import markdownCompat from './compat';
import { compat } from '@flarum/core/forum';

Object.assign(compat, markdownCompat);
22 changes: 22 additions & 0 deletions extensions/mentions/js/src/forum/compat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import GroupMentionedNotification from './components/GroupMentionedNotification';
import MentionedByModal from './components/MentionedByModal';
import MentionsDropdownItem from './components/MentionsDropdownItem';
import MentionsUserPage from './components/MentionsUserPage';
import PostMentionedNotification from './components/PostMentionedNotification';
import UserMentionedNotification from './components/UserMentionedNotification';
Expand All @@ -9,13 +11,24 @@ import getMentionText from './utils/getMentionText';
import * as reply from './utils/reply';
import selectedText from './utils/selectedText';
import * as textFormatter from './utils/textFormatter';
import GroupMention from './mentionables/GroupMention';
import MentionableModel from './mentionables/MentionableModel';
import MentionableModels from './mentionables/MentionableModels';
import PostMention from './mentionables/PostMention';
import TagMention from './mentionables/TagMention';
import UserMention from './mentionables/UserMention';
import AtMentionFormat from './mentionables/formats/AtMentionFormat';
import HashMentionFormat from './mentionables/formats/HashMentionFormat';
import MentionFormat from './mentionables/formats/MentionFormat';
import MentionFormats from './mentionables/formats/MentionFormats';
import Mentionables from './extenders/Mentionables';
import MentionedByModalState from './state/MentionedByModalState';

export default {
'mentions/components/MentionsUserPage': MentionsUserPage,
'mentions/components/PostMentionedNotification': PostMentionedNotification,
'mentions/components/MentionedByModal': MentionedByModal,
'mentions/components/MentionsDropdownItem': MentionsDropdownItem,
'mentions/components/UserMentionedNotification': UserMentionedNotification,
'mentions/components/GroupMentionedNotification': GroupMentionedNotification,
'mentions/fragments/AutocompleteDropdown': AutocompleteDropdown,
Expand All @@ -25,7 +38,16 @@ export default {
'mentions/utils/reply': reply,
'mentions/utils/selectedText': selectedText,
'mentions/utils/textFormatter': textFormatter,
'mentions/mentionables/GroupMention': GroupMention,
'mentions/mentionables/MentionableModel': MentionableModel,
'mentions/mentionables/MentionableModels': MentionableModels,
'mentions/mentionables/PostMention': PostMention,
'mentions/mentionables/TagMention': TagMention,
'mentions/mentionables/UserMention': UserMention,
'mentions/mentionables/formats/AtMentionFormat': AtMentionFormat,
'mentions/mentionables/formats/HashMentionFormat': HashMentionFormat,
'mentions/mentionables/formats/MentionFormat': MentionFormat,
'mentions/mentionables/formats/MentionFormats': MentionFormats,
'mentions/extenders/Mentionables': Mentionables,
'mentions/state/MentionedByModalState': MentionedByModalState,
};
5 changes: 5 additions & 0 deletions extensions/nicknames/js/src/forum/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import NicknameModal from './components/NicknameModal';

export default {
'nicknames/components/NicknameModal': NicknameModal,
};
6 changes: 6 additions & 0 deletions extensions/nicknames/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,9 @@ app.initializers.add('flarum/nicknames', () => {
}
});
});

// Expose compat API
import nicknamesCompat from './compat';
import { compat } from '@flarum/core/forum';

Object.assign(compat, nicknamesCompat);
52 changes: 52 additions & 0 deletions extensions/package-manager/js/src/admin/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import AuthMethodModal from './components/AuthMethodModal';
import ConfigureAuth from './components/ConfigureAuth';
import ConfigureComposer from './components/ConfigureComposer';
import ConfigureJson from './components/ConfigureJson';
import ControlSection from './components/ControlSection';
import ExtensionItem from './components/ExtensionItem';
import Installer from './components/Installer';
import Label from './components/Label';
import MajorUpdater from './components/MajorUpdater';
import Pagination from './components/Pagination';
import QueueSection from './components/QueueSection';
import RepositoryModal from './components/RepositoryModal';
import SettingsPage from './components/SettingsPage';
import TaskOutputModal from './components/TaskOutputModal';
import Updater from './components/Updater';
import WhyNotModal from './components/WhyNotModal';

import Task from './models/Task';

import ControlSectionState from './states/ControlSectionState';
import ExtensionManagerState from './states/ExtensionManagerState';
import QueueState from './states/QueueState';

import errorHandler from './utils/errorHandler';
import humanDuration from './utils/humanDuration';
import jumpToQueue from './utils/jumpToQueue';

export default {
'extension-manager/components/AuthMethodModal': AuthMethodModal,
'extension-manager/components/ConfigureAuth': ConfigureAuth,
'extension-manager/components/ConfigureComposer': ConfigureComposer,
'extension-manager/components/ConfigureJson': ConfigureJson,
'extension-manager/components/ControlSection': ControlSection,
'extension-manager/components/ExtensionItem': ExtensionItem,
'extension-manager/components/Installer': Installer,
'extension-manager/components/Label': Label,
'extension-manager/components/MajorUpdater': MajorUpdater,
'extension-manager/components/Pagination': Pagination,
'extension-manager/components/QueueSection': QueueSection,
'extension-manager/components/RepositoryModal': RepositoryModal,
'extension-manager/components/SettingsPage': SettingsPage,
'extension-manager/components/TaskOutputModal': TaskOutputModal,
'extension-manager/components/Updater': Updater,
'extension-manager/components/WhyNotModal': WhyNotModal,
'extension-manager/models/Task': Task,
'extension-manager/states/ControlSectionState': ControlSectionState,
'extension-manager/states/ExtensionManagerState': ExtensionManagerState,
'extension-manager/states/QueueState': QueueState,
'extension-manager/utils/errorHandler': errorHandler,
'extension-manager/utils/humanDuration': humanDuration,
'extension-manager/utils/jumpToQueue': jumpToQueue,
};
6 changes: 6 additions & 0 deletions extensions/package-manager/js/src/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ app.initializers.add('flarum-extension-manager', (app) => {
);
});
});

// Expose compat API
import packageManagerCompat from './compat';
import { compat } from '@flarum/core/admin';

Object.assign(compat, packageManagerCompat);
3 changes: 2 additions & 1 deletion extensions/package-manager/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
}
}
}
11 changes: 11 additions & 0 deletions extensions/statistics/js/src/admin/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import MiniStatisticsWidget from './components/MiniStatisticsWidget';
import StatisticsPage from './components/StatisticsPage';
import StatisticsWidget from './components/StatisticsWidget';
import StatisticsWidgetDateSelectionModal from './components/StatisticsWidgetDateSelectionModal';

export default {
'statistics/components/MiniStatisticsWidget': MiniStatisticsWidget,
'statistics/components/StatisticsPage': StatisticsPage,
'statistics/components/StatisticsWidget': StatisticsWidget,
'statistics/components/StatisticsWidgetDateSelectionModal': StatisticsWidgetDateSelectionModal,
};
6 changes: 6 additions & 0 deletions extensions/statistics/js/src/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ app.initializers.add('flarum-statistics', () => {

app.extensionData.for('flarum-statistics').registerPage(StatisticsPage);
});

// Expose compat API
import statisticsCompat from './compat';
import { compat } from '@flarum/core/admin';

Object.assign(compat, statisticsCompat);
3 changes: 2 additions & 1 deletion extensions/statistics/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
}
}
}
5 changes: 5 additions & 0 deletions extensions/sticky/js/src/forum/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import DiscussionStickiedPost from './components/DiscussionStickiedPost';

export default {
'sticky/components/DiscussionStickiedPost': DiscussionStickiedPost,
};
6 changes: 6 additions & 0 deletions extensions/sticky/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ app.initializers.add('flarum-sticky', () => {
addStickyExcerpt();
addStickyClass();
});

// Expose compat API
import stickyCompat from './compat';
import { compat } from '@flarum/core/forum';

Object.assign(compat, stickyCompat);
9 changes: 9 additions & 0 deletions extensions/subscriptions/js/src/forum/compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import NewPostNotification from './components/NewPostNotification';
import SubscriptionMenu from './components/SubscriptionMenu';
import SubscriptionMenuItem from './components/SubscriptionMenuItem';

export default {
'subscriptions/components/NewPostNotification': NewPostNotification,
'subscriptions/components/SubscriptionMenu': SubscriptionMenu,
'subscriptions/components/SubscriptionMenuItem': SubscriptionMenuItem,
};
6 changes: 6 additions & 0 deletions extensions/subscriptions/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ app.initializers.add('subscriptions', function () {
});
});
});

// Expose compat API
import subscriptionsCompat from './compat';
import { compat } from '@flarum/core/forum';

Object.assign(compat, subscriptionsCompat);
2 changes: 2 additions & 0 deletions extensions/suspend/js/src/forum/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import SuspendUserModal from './components/SuspendUserModal';
import SuspensionInfoModal from './components/SuspensionInfoModal';
import UserSuspendedNotification from './components/UserSuspendedNotification';
import UserUnsuspendedNotification from './components/UserUnsuspendedNotification';
import * as suspensionHelper from './helpers/suspensionHelper';
import checkForSuspension from './checkForSuspension';

export default {
'suspend/components/suspendUserModal': SuspendUserModal,
'suspend/components/suspensionInfoModal': SuspensionInfoModal,
'suspend/components/UserSuspendedNotification': UserSuspendedNotification,
'suspend/components/UserUnsuspendedNotification': UserUnsuspendedNotification,
'suspend/helpers/suspensionHelper': suspensionHelper,
'suspend/checkForSuspension': checkForSuspension,
};
2 changes: 2 additions & 0 deletions extensions/tags/js/src/admin/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import addTagsHomePageOption from './addTagsHomePageOption';
import addTagChangePermission from './addTagChangePermission';
import TagsPage from './components/TagsPage';
import EditTagModal from './components/EditTagModal';
import SelectTagsSettingComponent from './components/SelectTagsSettingComponent';
import addTagPermission from './addTagPermission';
import addTagsPermissionScope from './addTagsPermissionScope';

Expand All @@ -12,6 +13,7 @@ export default Object.assign(compat, {
'tags/addTagChangePermission': addTagChangePermission,
'tags/components/TagsPage': TagsPage,
'tags/components/EditTagModal': EditTagModal,
'tags/components/SelectTagsSettingComponent': SelectTagsSettingComponent,
'tags/addTagPermission': addTagPermission,
'tags/addTagsPermissionScope': addTagsPermissionScope,
});
2 changes: 2 additions & 0 deletions extensions/tags/js/src/forum/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import addTagControl from './addTagControl';
import TagHero from './components/TagHero';
import TagDiscussionModal from './components/TagDiscussionModal';
import TagsPage from './components/TagsPage';
import ToggleButton from './components/ToggleButton';
import DiscussionTaggedPost from './components/DiscussionTaggedPost';
import TagLinkButton from './components/TagLinkButton';
import addTagList from './addTagList';
Expand All @@ -18,6 +19,7 @@ export default Object.assign(compat, {
'tags/components/TagHero': TagHero,
'tags/components/TagDiscussionModal': TagDiscussionModal,
'tags/components/TagsPage': TagsPage,
'tags/components/ToggleButton': ToggleButton,
'tags/components/DiscussionTaggedPost': DiscussionTaggedPost,
'tags/components/TagLinkButton': TagLinkButton,
'tags/addTagList': addTagList,
Expand Down
Loading

0 comments on commit 449ba48

Please sign in to comment.