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

[1.x] [extensibility] Export all missing modules in compat #4044

Merged
merged 15 commits into from
Oct 2, 2024

Conversation

DavideIadeluca
Copy link
Contributor

@DavideIadeluca DavideIadeluca commented Sep 29, 2024

Fixes #4006 (comment)

Changes proposed in this pull request:

  • Export all missing modules with the Compat API and therefore improve the extensibility of the framework.
  • Fix tsconfig

Reviewers should focus on:

Screenshot

QA

  1. Try to extend/override a newly added component from core
  2. Try to extend/override a newly added component from an extension
  3. Try to use a newly added util which is the default export (i.e. fireDebugWarning)
  4. Try to use a newly added util which is a non default export (i.e. fireDeprecationWarning)

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)

@SychO9
Copy link
Member

SychO9 commented Sep 29, 2024

@DavideIadeluca for 2.x you don't actually need to do anything 👍

In 2.x every module used by the code (core and extensions) is accessible by other extensions. Unless the module is declared but not used (which is not the case currently).

@imorland imorland added this to the 1.8.6 milestone Sep 29, 2024
@imorland imorland added javascript Pull requests that update Javascript code type/extensibility labels Sep 29, 2024
@imorland imorland changed the title Export all missing modules in compat & TBD [1.x] [extensibility] Export all missing modules in compat & TBD Sep 29, 2024
@DavideIadeluca
Copy link
Contributor Author

@DavideIadeluca for 2.x you don't actually need to do anything 👍

In 2.x every module used by the code (core and extensions) is accessible by other extensions. Unless the module is declared but not used (which is not the case currently).

@SychO9 Yeah I was also of the same understanding per the diary you shared on discuss. But I'm kind of confused now what the usage is for the newly added forum.ts files in core and extensions?

import '../common/common';
import '../common/utils/BasicEditorDriver';
import './utils/PostControls';
import './utils/slidable';
import './utils/History';
import './utils/DiscussionControls';
import './utils/UserControls';
import './utils/Pane';
import './states/ComposerState';
import './states/DiscussionListState';
import './states/GlobalSearchState';
import './states/NotificationListState';
import './states/PostStreamState';
import './components/AffixedSidebar';
import './components/DiscussionPage';
import './components/DiscussionListPane';
import './components/Notification';
import './components/LogInButton';
import './components/SessionDropdown';
import './components/HeaderPrimary';
import './components/PostEdited';
import './components/IndexPage';
import './components/DiscussionRenamedNotification';
import './components/DiscussionsSearchSource';
import './components/HeaderSecondary';
import './components/DiscussionList';
import './components/AvatarEditor';
import './components/Post';
import './components/LoadingPost';
import './components/TerminalPost';
import './components/NotificationsDropdown';
import './components/UserPage';
import './components/PostUser';
import './components/UserCard';
import './components/UsersSearchSource';
import './components/PostPreview';
import './components/EventPost';
import './components/DiscussionHero';
import './components/PostMeta';
import './components/DiscussionRenamedPost';
import './components/LogInButtons';
import './components/NotificationList';
import './components/WelcomeHero';
import './components/CommentPost';
import './components/ComposerPostPreview';
import './components/RenameDiscussionModal';
import './components/Search';
import './components/DiscussionListItem';
import './components/PostsUserPage';
import './resolvers/DiscussionPageResolver';
import './routes';
import './ForumApplication';

import './addFlagsToPosts';
import './addFlagControl';
import './addFlagsDropdown';
import './models/Flag';
import './components/FlagList';
import './components/FlagPostModal';
import './components/FlagsPage';
import './components/FlagsDropdown';

@SychO9
Copy link
Member

SychO9 commented Sep 29, 2024

@DavideIadeluca those are mostly the result of automatically converting the old compat files. A lot of the imports there are redundant and add nothing. However because we now lazy load certain components, those files serve as a way to ensure certain components are not lazy loaded, without having to constantly check where they are used.

We'll probably remove those (forum.ts, common.ts, admin.ts) files for the bundled extensions before 2.0 is out.

@DavideIadeluca DavideIadeluca changed the title [1.x] [extensibility] Export all missing modules in compat & TBD [1.x] [extensibility] Export all missing modules in compat Sep 30, 2024
@DavideIadeluca DavideIadeluca force-pushed the di/compat-exports branch 5 times, most recently from 4d6f61b to 68897d0 Compare September 30, 2024 13:48
@DavideIadeluca DavideIadeluca marked this pull request as ready for review October 2, 2024 07:01
@DavideIadeluca DavideIadeluca requested a review from a team as a code owner October 2, 2024 07:01
@imorland imorland merged commit 449ba48 into flarum:1.x Oct 2, 2024
274 checks passed
@imorland imorland deleted the di/compat-exports branch October 2, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code type/extensibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants