Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export registry #3842

Merged
merged 4 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: remove compat API
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
  • Loading branch information
SychO9 committed Jun 22, 2023
commit 09007014fe9ba48d1007941b6ee56c6a13a5f6d3
2 changes: 1 addition & 1 deletion extensions/akismet/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/flags/*": ["../../flags/js/dist-typings/*"]
"ext:flarum/flags/*": ["../../flags/js/dist-typings/*"]
}
}
}
19 changes: 0 additions & 19 deletions extensions/flags/js/src/forum/compat.js

This file was deleted.

2 changes: 1 addition & 1 deletion extensions/flags/js/src/forum/components/FlagsPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import app from 'flarum/forum/app';
import Page from 'flarum/components/Page';
import Page from 'flarum/common/components/Page';

import FlagList from './FlagList';

Expand Down
10 changes: 10 additions & 0 deletions extensions/flags/js/src/forum/forum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import './addFlagsToPosts';
import './addFlagControl';
import './addFlagsDropdown';

import './models/Flag';

import './components/FlagList';
import './components/FlagPostModal';
import './components/FlagsPage';
import './components/FlagsDropdown';
6 changes: 1 addition & 5 deletions extensions/flags/js/src/forum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,4 @@ app.initializers.add('flarum-flags', () => {
addFlagsToPosts();
});

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

Object.assign(compat, flagsCompat);
import './forum';
31 changes: 0 additions & 31 deletions extensions/mentions/js/src/forum/compat.js

This file was deleted.

14 changes: 14 additions & 0 deletions extensions/mentions/js/src/forum/forum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import './components/GroupMentionedNotification';
import './components/MentionsUserPage';
import './components/PostMentionedNotification';
import './components/UserMentionedNotification';
import './fragments/AutocompleteDropdown';
import './fragments/PostQuoteButton';
import './utils/getCleanDisplayName';
import './utils/getMentionText';
import './utils/reply';
import './utils/selectedText';
import './utils/textFormatter';
import './mentionables/MentionableModel';
import './mentionables/formats/MentionFormat';
import './extenders/Mentionables';
8 changes: 1 addition & 7 deletions extensions/mentions/js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import UserMentionedNotification from './components/UserMentionedNotification';
import GroupMentionedNotification from './components/GroupMentionedNotification';
import UserPage from 'flarum/forum/components/UserPage';
import LinkButton from 'flarum/common/components/LinkButton';
import User from 'flarum/common/models/User';
import Model from 'flarum/common/Model';

export { default as extend } from './extend';

Expand Down Expand Up @@ -90,8 +88,4 @@ app.initializers.add('flarum-mentions', function () {

export * from './utils/textFormatter';

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

Object.assign(compat, mentionsCompat);
import './forum';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import app from 'flarum/forum/app';
import Badge from 'flarum/common/components/Badge';
import highlight from 'flarum/common/helpers/highlight';
import type Tag from 'flarum/tags/common/models/Tag';
import type Tag from 'ext:flarum/tags/common/models/Tag';
import type Mithril from 'mithril';
import MentionableModel from './MentionableModel';
import type HashMentionFormat from './formats/HashMentionFormat';
Expand Down
2 changes: 1 addition & 1 deletion extensions/mentions/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/tags/*": ["../../tags/js/dist-typings/*"],
"ext:flarum/tags/*": ["../../tags/js/dist-typings/*"],
// TODO: remove after export registry system implemented
// Without this, the old-style `@flarum/core` import is resolved to
// source code in flarum/core instead of the dist typings.
Expand Down
2 changes: 1 addition & 1 deletion extensions/pusher/js/src/forum/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import IndexPage from 'flarum/forum/components/IndexPage';
import Button from 'flarum/common/components/Button';
import ItemList from 'flarum/common/utils/ItemList';
import type { Children } from 'mithril';
import type Tag from 'flarum/tags/common/models/Tag';
import type Tag from 'ext:flarum/tags/common/models/Tag';

export type PusherBinding = {
channels: {
Expand Down
2 changes: 1 addition & 1 deletion extensions/pusher/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/tags/*": ["../../tags/js/dist-typings/*"]
"ext:flarum/tags/*": ["../../tags/js/dist-typings/*"]
}
}
}
2 changes: 1 addition & 1 deletion extensions/suspend/js/src/admin/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import app from 'flarum/app';
import app from 'flarum/admin/app';

app.initializers.add('flarum-suspend', () => {
app.extensionData.for('flarum-suspend').registerPermission(
Expand Down
13 changes: 0 additions & 13 deletions extensions/suspend/js/src/forum/compat.js

This file was deleted.

10 changes: 5 additions & 5 deletions extensions/suspend/js/src/forum/components/SuspendUserModal.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import app from 'flarum/forum/app';
import Modal from 'flarum/components/Modal';
import Button from 'flarum/components/Button';

import Stream from 'flarum/utils/Stream';
import withAttr from 'flarum/utils/withAttr';
import Modal from 'flarum/common/components/Modal';
import Button from 'flarum/common/components/Button';
import Stream from 'flarum/common/utils/Stream';
import withAttr from 'flarum/common/utils/withAttr';
import ItemList from 'flarum/common/utils/ItemList';

import { getPermanentSuspensionDate } from '../helpers/suspensionHelper';

export default class SuspendUserModal extends Modal {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import app from 'flarum/forum/app';
import Notification from 'flarum/components/Notification';
import Notification from 'flarum/forum/components/Notification';

import { isPermanentSuspensionDate } from '../helpers/suspensionHelper';

export default class UserSuspendedNotification extends Notification {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import app from 'flarum/forum/app';
import Notification from 'flarum/components/Notification';
import Notification from 'flarum/forum/components/Notification';

export default class UserUnsuspendedNotification extends Notification {
icon() {
Expand Down
6 changes: 6 additions & 0 deletions extensions/suspend/js/src/forum/forum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './components/SuspendUserModal';
import './components/SuspensionInfoModal';
import './components/UserSuspendedNotification';
import './components/UserUnsuspendedNotification';

import './checkForSuspension';
18 changes: 7 additions & 11 deletions extensions/suspend/js/src/forum/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { extend } from 'flarum/extend';
import app from 'flarum/app';
import UserControls from 'flarum/utils/UserControls';
import Button from 'flarum/components/Button';
import Badge from 'flarum/components/Badge';
import User from 'flarum/models/User';
import { extend } from 'flarum/common/extend';
import app from 'flarum/forum/app';
import UserControls from 'flarum/forum/utils/UserControls';
import Button from 'flarum/common/components/Button';
import Badge from 'flarum/common/components/Badge';
import User from 'flarum/common/models/User';

import SuspendUserModal from './components/SuspendUserModal';
import UserSuspendedNotification from './components/UserSuspendedNotification';
Expand Down Expand Up @@ -42,8 +42,4 @@ app.initializers.add('flarum-suspend', () => {
checkForSuspension();
});

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

Object.assign(compat, suspendCompat);
import './forum';
9 changes: 9 additions & 0 deletions extensions/tags/js/src/admin/admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '../common/common';

import './components/TagsPage';
import './components/EditTagModal';

import './addTagsHomePageOption';
import './addTagChangePermission';
import './addTagPermission';
import './addTagsPermissionScope';
17 changes: 0 additions & 17 deletions extensions/tags/js/src/admin/compat.js

This file was deleted.

6 changes: 1 addition & 5 deletions extensions/tags/js/src/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ app.initializers.add('flarum-tags', (app) => {
addTagSelectionSettingComponent();
});

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

Object.assign(compat, tagsCompat);
import './admin';
11 changes: 11 additions & 0 deletions extensions/tags/js/src/common/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import './utils/sortTags';

import './models/Tag';

import './helpers/tagsLabel';
import './helpers/tagIcon';
import './helpers/tagLabel';

import './components/TagSelectionModal';

import './states/TagListState';
17 changes: 0 additions & 17 deletions extensions/tags/js/src/common/compat.js

This file was deleted.

27 changes: 0 additions & 27 deletions extensions/tags/js/src/forum/compat.js

This file was deleted.

15 changes: 15 additions & 0 deletions extensions/tags/js/src/forum/forum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import '../common/common';

import './utils/getSelectableTags';

import './components/TagHero';
import './components/TagDiscussionModal';
import './components/TagsPage';
import './components/DiscussionTaggedPost';
import './components/TagLinkButton';

import './addTagFilter';
import './addTagControl';
import './addTagList';
import './addTagLabels';
import './addTagComposer';
6 changes: 1 addition & 5 deletions extensions/tags/js/src/forum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ app.initializers.add('flarum-tags', function () {
addTagComposer();
});

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

Object.assign(compat, tagsCompat);
import './forum';
Loading