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 all commits
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
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';
3 changes: 1 addition & 2 deletions extensions/flags/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"]
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
7 changes: 1 addition & 6 deletions extensions/likes/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/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.
// This causes an inaccurate "duplicate export" error.
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
7 changes: 1 addition & 6 deletions extensions/lock/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/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.
// This causes an inaccurate "duplicate export" error.
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
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
7 changes: 1 addition & 6 deletions extensions/mentions/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
"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.
// This causes an inaccurate "duplicate export" error.
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
"ext:flarum/tags/*": ["../../tags/js/dist-typings/*"]
}
}
}
7 changes: 1 addition & 6 deletions extensions/nicknames/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/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.
// This causes an inaccurate "duplicate export" error.
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
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/*"]
}
}
}
7 changes: 1 addition & 6 deletions extensions/sticky/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/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.
// This causes an inaccurate "duplicate export" error.
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
3 changes: 1 addition & 2 deletions extensions/subscriptions/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"declarationDir": "./dist-typings",
"baseUrl": ".",
"paths": {
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
"@flarum/core/*": ["../vendor/flarum/core/js/dist-typings/*"]
"flarum/*": ["../vendor/flarum/core/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';
7 changes: 1 addition & 6 deletions extensions/suspend/js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"paths": {
"flarum/*": ["../../../framework/core/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.
// This causes an inaccurate "duplicate export" error.
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
}
}
}
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';
Loading