1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

[PM-25203] Resolve circular dependencies through LooseComponentsModule (#16157)

* Update modules to not import loose-components

Instead they should import their dependencies directly.
Only OssModule imports loose-components.module.ts.

* Remove unused imports and exports
This commit is contained in:
Thomas Rittson
2025-08-27 22:10:32 +10:00
committed by GitHub
parent c72fdebfd9
commit 4f09ae52ab
16 changed files with 38 additions and 77 deletions

View File

@@ -1,6 +1,5 @@
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import { LooseComponentsModule } from "../../../shared/loose-components.module";
import { SharedModule } from "../../../shared/shared.module"; import { SharedModule } from "../../../shared/shared.module";
import { OrganizationBadgeModule } from "../../../vault/individual-vault/organization-badge/organization-badge.module"; import { OrganizationBadgeModule } from "../../../vault/individual-vault/organization-badge/organization-badge.module";
import { ViewComponent } from "../../../vault/individual-vault/view.component"; import { ViewComponent } from "../../../vault/individual-vault/view.component";
@@ -15,7 +14,6 @@ import { VaultComponent } from "./vault.component";
imports: [ imports: [
VaultRoutingModule, VaultRoutingModule,
SharedModule, SharedModule,
LooseComponentsModule,
GroupBadgeModule, GroupBadgeModule,
CollectionNameBadgeComponent, CollectionNameBadgeComponent,
OrganizationBadgeModule, OrganizationBadgeModule,

View File

@@ -6,7 +6,7 @@ import { PasswordCalloutComponent } from "@bitwarden/auth/angular";
import { ScrollLayoutDirective } from "@bitwarden/components"; import { ScrollLayoutDirective } from "@bitwarden/components";
import { OrganizationFreeTrialWarningComponent } from "@bitwarden/web-vault/app/billing/organizations/warnings/components"; import { OrganizationFreeTrialWarningComponent } from "@bitwarden/web-vault/app/billing/organizations/warnings/components";
import { LooseComponentsModule } from "../../../shared"; import { HeaderModule } from "../../../layouts/header/header.module";
import { SharedOrganizationModule } from "../shared"; import { SharedOrganizationModule } from "../shared";
import { BulkConfirmDialogComponent } from "./components/bulk/bulk-confirm-dialog.component"; import { BulkConfirmDialogComponent } from "./components/bulk/bulk-confirm-dialog.component";
@@ -22,10 +22,10 @@ import { MembersComponent } from "./members.component";
@NgModule({ @NgModule({
imports: [ imports: [
SharedOrganizationModule, SharedOrganizationModule,
LooseComponentsModule,
MembersRoutingModule, MembersRoutingModule,
UserDialogModule, UserDialogModule,
PasswordCalloutComponent, PasswordCalloutComponent,
HeaderModule,
ScrollingModule, ScrollingModule,
PasswordStrengthV2Component, PasswordStrengthV2Component,
ScrollLayoutDirective, ScrollLayoutDirective,

View File

@@ -4,7 +4,7 @@ import { NgModule } from "@angular/core";
import { ScrollLayoutDirective } from "@bitwarden/components"; import { ScrollLayoutDirective } from "@bitwarden/components";
import { OrganizationWarningsModule } from "@bitwarden/web-vault/app/billing/organizations/warnings/organization-warnings.module"; import { OrganizationWarningsModule } from "@bitwarden/web-vault/app/billing/organizations/warnings/organization-warnings.module";
import { LooseComponentsModule } from "../../shared"; import { HeaderModule } from "../../layouts/header/header.module";
import { CoreOrganizationModule } from "./core"; import { CoreOrganizationModule } from "./core";
import { GroupAddEditComponent } from "./manage/group-add-edit.component"; import { GroupAddEditComponent } from "./manage/group-add-edit.component";
@@ -19,7 +19,7 @@ import { AccessSelectorModule } from "./shared/components/access-selector";
AccessSelectorModule, AccessSelectorModule,
CoreOrganizationModule, CoreOrganizationModule,
OrganizationsRoutingModule, OrganizationsRoutingModule,
LooseComponentsModule, HeaderModule,
ScrollingModule, ScrollingModule,
ScrollLayoutDirective, ScrollLayoutDirective,
OrganizationWarningsModule, OrganizationWarningsModule,

View File

@@ -1,6 +1,7 @@
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import { LooseComponentsModule, SharedModule } from "../../../shared"; import { HeaderModule } from "../../../layouts/header/header.module";
import { SharedModule } from "../../../shared";
import { DisableSendPolicyComponent } from "./disable-send.component"; import { DisableSendPolicyComponent } from "./disable-send.component";
import { MasterPasswordPolicyComponent } from "./master-password.component"; import { MasterPasswordPolicyComponent } from "./master-password.component";
@@ -17,7 +18,7 @@ import { SingleOrgPolicyComponent } from "./single-org.component";
import { TwoFactorAuthenticationPolicyComponent } from "./two-factor-authentication.component"; import { TwoFactorAuthenticationPolicyComponent } from "./two-factor-authentication.component";
@NgModule({ @NgModule({
imports: [SharedModule, LooseComponentsModule], imports: [SharedModule, HeaderModule],
declarations: [ declarations: [
DisableSendPolicyComponent, DisableSendPolicyComponent,
MasterPasswordPolicyComponent, MasterPasswordPolicyComponent,

View File

@@ -1,19 +1,14 @@
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import { ReportsSharedModule } from "../../../dirt/reports"; import { ReportsSharedModule } from "../../../dirt/reports";
import { LooseComponentsModule } from "../../../shared"; import { HeaderModule } from "../../../layouts/header/header.module";
import { SharedModule } from "../../../shared/shared.module"; import { SharedModule } from "../../../shared/shared.module";
import { OrganizationReportingRoutingModule } from "./organization-reporting-routing.module"; import { OrganizationReportingRoutingModule } from "./organization-reporting-routing.module";
import { ReportsHomeComponent } from "./reports-home.component"; import { ReportsHomeComponent } from "./reports-home.component";
@NgModule({ @NgModule({
imports: [ imports: [SharedModule, ReportsSharedModule, OrganizationReportingRoutingModule, HeaderModule],
SharedModule,
ReportsSharedModule,
OrganizationReportingRoutingModule,
LooseComponentsModule,
],
declarations: [ReportsHomeComponent], declarations: [ReportsHomeComponent],
}) })
export class OrganizationReportingModule {} export class OrganizationReportingModule {}

View File

@@ -2,8 +2,11 @@ import { NgModule } from "@angular/core";
import { ItemModule } from "@bitwarden/components"; import { ItemModule } from "@bitwarden/components";
import { LooseComponentsModule, SharedModule } from "../../../shared"; import { DangerZoneComponent } from "../../../auth/settings/account/danger-zone.component";
import { HeaderModule } from "../../../layouts/header/header.module";
import { SharedModule } from "../../../shared";
import { AccountFingerprintComponent } from "../../../shared/components/account-fingerprint/account-fingerprint.component"; import { AccountFingerprintComponent } from "../../../shared/components/account-fingerprint/account-fingerprint.component";
import { PremiumBadgeComponent } from "../../../vault/components/premium-badge.component";
import { PoliciesModule } from "../../organizations/policies"; import { PoliciesModule } from "../../organizations/policies";
import { AccountComponent } from "./account.component"; import { AccountComponent } from "./account.component";
@@ -13,10 +16,12 @@ import { TwoFactorSetupComponent } from "./two-factor-setup.component";
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, SharedModule,
LooseComponentsModule,
PoliciesModule, PoliciesModule,
OrganizationSettingsRoutingModule, OrganizationSettingsRoutingModule,
AccountFingerprintComponent, AccountFingerprintComponent,
DangerZoneComponent,
HeaderModule,
PremiumBadgeComponent,
ItemModule, ItemModule,
], ],
declarations: [AccountComponent, TwoFactorSetupComponent], declarations: [AccountComponent, TwoFactorSetupComponent],

View File

@@ -33,8 +33,9 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { DialogRef, DialogService, ItemModule } from "@bitwarden/components"; import { DialogRef, DialogService, ItemModule } from "@bitwarden/components";
import { LooseComponentsModule } from "../../../shared/loose-components.module"; import { HeaderModule } from "../../../layouts/header/header.module";
import { SharedModule } from "../../../shared/shared.module"; import { SharedModule } from "../../../shared/shared.module";
import { PremiumBadgeComponent } from "../../../vault/components/premium-badge.component";
import { TwoFactorRecoveryComponent } from "./two-factor-recovery.component"; import { TwoFactorRecoveryComponent } from "./two-factor-recovery.component";
import { TwoFactorSetupAuthenticatorComponent } from "./two-factor-setup-authenticator.component"; import { TwoFactorSetupAuthenticatorComponent } from "./two-factor-setup-authenticator.component";
@@ -47,7 +48,7 @@ import { TwoFactorVerifyComponent } from "./two-factor-verify.component";
@Component({ @Component({
selector: "app-two-factor-setup", selector: "app-two-factor-setup",
templateUrl: "two-factor-setup.component.html", templateUrl: "two-factor-setup.component.html",
imports: [ItemModule, LooseComponentsModule, SharedModule], imports: [ItemModule, HeaderModule, PremiumBadgeComponent, SharedModule],
}) })
export class TwoFactorSetupComponent implements OnInit, OnDestroy { export class TwoFactorSetupComponent implements OnInit, OnDestroy {
organizationId: string; organizationId: string;

View File

@@ -4,7 +4,7 @@ import { NgModule } from "@angular/core";
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { BannerModule } from "../../../../../../libs/components/src/banner/banner.module"; import { BannerModule } from "../../../../../../libs/components/src/banner/banner.module";
import { UserVerificationModule } from "../../auth/shared/components/user-verification"; import { UserVerificationModule } from "../../auth/shared/components/user-verification";
import { LooseComponentsModule } from "../../shared"; import { HeaderModule } from "../../layouts/header/header.module";
import { BillingSharedModule } from "../shared"; import { BillingSharedModule } from "../shared";
import { AdjustSubscription } from "./adjust-subscription.component"; import { AdjustSubscription } from "./adjust-subscription.component";
@@ -29,7 +29,7 @@ import { SubscriptionStatusComponent } from "./subscription-status.component";
UserVerificationModule, UserVerificationModule,
BillingSharedModule, BillingSharedModule,
OrganizationPlansComponent, OrganizationPlansComponent,
LooseComponentsModule, HeaderModule,
BannerModule, BannerModule,
], ],
declarations: [ declarations: [

View File

@@ -3,7 +3,9 @@ import { NgModule } from "@angular/core";
import { AuthModule } from "./auth"; import { AuthModule } from "./auth";
import { LoginModule } from "./auth/login/login.module"; import { LoginModule } from "./auth/login/login.module";
import { TrialInitiationModule } from "./billing/trial-initiation/trial-initiation.module"; import { TrialInitiationModule } from "./billing/trial-initiation/trial-initiation.module";
import { LooseComponentsModule, SharedModule } from "./shared"; import { HeaderModule } from "./layouts/header/header.module";
import { SharedModule } from "./shared";
import { LooseComponentsModule } from "./shared/loose-components.module";
import { AccessComponent } from "./tools/send/send-access/access.component"; import { AccessComponent } from "./tools/send/send-access/access.component";
import { OrganizationBadgeModule } from "./vault/individual-vault/organization-badge/organization-badge.module"; import { OrganizationBadgeModule } from "./vault/individual-vault/organization-badge/organization-badge.module";
import { VaultFilterModule } from "./vault/individual-vault/vault-filter/vault-filter.module"; import { VaultFilterModule } from "./vault/individual-vault/vault-filter/vault-filter.module";
@@ -15,6 +17,7 @@ import "./shared/locales";
imports: [ imports: [
SharedModule, SharedModule,
LooseComponentsModule, LooseComponentsModule,
HeaderModule,
TrialInitiationModule, TrialInitiationModule,
VaultFilterModule, VaultFilterModule,
OrganizationBadgeModule, OrganizationBadgeModule,
@@ -24,7 +27,7 @@ import "./shared/locales";
], ],
exports: [ exports: [
SharedModule, SharedModule,
LooseComponentsModule, HeaderModule,
TrialInitiationModule, TrialInitiationModule,
VaultFilterModule, VaultFilterModule,
OrganizationBadgeModule, OrganizationBadgeModule,

View File

@@ -1,2 +1 @@
export * from "./shared.module"; export * from "./shared.module";
export * from "./loose-components.module";

View File

@@ -1,18 +1,7 @@
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import {
PasswordCalloutComponent,
UserVerificationFormInputComponent,
VaultTimeoutInputComponent,
} from "@bitwarden/auth/angular";
import { LayoutComponent, NavigationModule } from "@bitwarden/components";
import { OrganizationLayoutComponent } from "../admin-console/organizations/layouts/organization-layout.component";
import { VerifyRecoverDeleteOrgComponent } from "../admin-console/organizations/manage/verify-recover-delete-org.component";
import { RecoverDeleteComponent } from "../auth/recover-delete.component"; import { RecoverDeleteComponent } from "../auth/recover-delete.component";
import { RecoverTwoFactorComponent } from "../auth/recover-two-factor.component"; import { RecoverTwoFactorComponent } from "../auth/recover-two-factor.component";
import { DangerZoneComponent } from "../auth/settings/account/danger-zone.component";
import { UserVerificationModule } from "../auth/shared/components/user-verification";
import { VerifyEmailTokenComponent } from "../auth/verify-email-token.component"; import { VerifyEmailTokenComponent } from "../auth/verify-email-token.component";
import { VerifyRecoverDeleteComponent } from "../auth/verify-recover-delete.component"; import { VerifyRecoverDeleteComponent } from "../auth/verify-recover-delete.component";
import { FreeBitwardenFamiliesComponent } from "../billing/members/free-bitwarden-families.component"; import { FreeBitwardenFamiliesComponent } from "../billing/members/free-bitwarden-families.component";
@@ -30,33 +19,15 @@ import { UnsecuredWebsitesReportComponent as OrgUnsecuredWebsitesReportComponent
import { WeakPasswordsReportComponent as OrgWeakPasswordsReportComponent } from "../dirt/reports/pages/organizations/weak-passwords-report.component"; import { WeakPasswordsReportComponent as OrgWeakPasswordsReportComponent } from "../dirt/reports/pages/organizations/weak-passwords-report.component";
import { RemovePasswordComponent } from "../key-management/key-connector/remove-password.component"; import { RemovePasswordComponent } from "../key-management/key-connector/remove-password.component";
import { HeaderModule } from "../layouts/header/header.module"; import { HeaderModule } from "../layouts/header/header.module";
import { PremiumBadgeComponent } from "../vault/components/premium-badge.component";
import { OrganizationBadgeModule } from "../vault/individual-vault/organization-badge/organization-badge.module"; import { OrganizationBadgeModule } from "../vault/individual-vault/organization-badge/organization-badge.module";
import { PipesModule } from "../vault/individual-vault/pipes/pipes.module"; import { PipesModule } from "../vault/individual-vault/pipes/pipes.module";
import { AccountFingerprintComponent } from "./components/account-fingerprint/account-fingerprint.component";
import { SharedModule } from "./shared.module"; import { SharedModule } from "./shared.module";
// Please do not add to this list of declarations - we should refactor these into modules when doing so makes sense until there are none left. // Please do not add to this list of declarations - we should refactor these into modules when doing so makes sense until there are none left.
// If you are building new functionality, please create or extend a feature module instead. // If you are building new functionality, please create or extend a feature module instead.
@NgModule({ @NgModule({
imports: [ imports: [SharedModule, HeaderModule, OrganizationBadgeModule, PipesModule],
SharedModule,
UserVerificationModule,
AccountFingerprintComponent,
OrganizationBadgeModule,
PipesModule,
PasswordCalloutComponent,
UserVerificationFormInputComponent,
DangerZoneComponent,
LayoutComponent,
NavigationModule,
HeaderModule,
OrganizationLayoutComponent,
VerifyRecoverDeleteOrgComponent,
VaultTimeoutInputComponent,
PremiumBadgeComponent,
],
declarations: [ declarations: [
OrgExposedPasswordsReportComponent, OrgExposedPasswordsReportComponent,
OrgInactiveTwoFactorReportComponent, OrgInactiveTwoFactorReportComponent,
@@ -73,25 +44,12 @@ import { SharedModule } from "./shared.module";
VerifyRecoverDeleteComponent, VerifyRecoverDeleteComponent,
], ],
exports: [ exports: [
UserVerificationModule,
PremiumBadgeComponent,
OrganizationLayoutComponent,
OrgExposedPasswordsReportComponent,
OrgInactiveTwoFactorReportComponent,
OrgReusedPasswordsReportComponent,
OrgUnsecuredWebsitesReportComponent,
OrgWeakPasswordsReportComponent,
PremiumBadgeComponent,
RecoverDeleteComponent, RecoverDeleteComponent,
RecoverTwoFactorComponent, RecoverTwoFactorComponent,
RemovePasswordComponent, RemovePasswordComponent,
SponsoredFamiliesComponent, SponsoredFamiliesComponent,
FreeBitwardenFamiliesComponent,
SponsoringOrgRowComponent,
VerifyEmailTokenComponent, VerifyEmailTokenComponent,
VerifyRecoverDeleteComponent, VerifyRecoverDeleteComponent,
HeaderModule,
DangerZoneComponent,
], ],
}) })
export class LooseComponentsModule {} export class LooseComponentsModule {}

View File

@@ -14,13 +14,14 @@ import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { ImportCollectionServiceAbstraction } from "@bitwarden/importer-core"; import { ImportCollectionServiceAbstraction } from "@bitwarden/importer-core";
import { ImportComponent } from "@bitwarden/importer-ui"; import { ImportComponent } from "@bitwarden/importer-ui";
import { LooseComponentsModule, SharedModule } from "../../shared"; import { HeaderModule } from "../../layouts/header/header.module";
import { SharedModule } from "../../shared";
import { ImportCollectionAdminService } from "./import-collection-admin.service"; import { ImportCollectionAdminService } from "./import-collection-admin.service";
@Component({ @Component({
templateUrl: "org-import.component.html", templateUrl: "org-import.component.html",
imports: [SharedModule, ImportComponent, LooseComponentsModule], imports: [SharedModule, ImportComponent, HeaderModule],
providers: [ providers: [
{ {
provide: ImportCollectionServiceAbstraction, provide: ImportCollectionServiceAbstraction,

View File

@@ -5,11 +5,12 @@ import { ActivatedRoute } from "@angular/router";
import { ExportComponent } from "@bitwarden/vault-export-ui"; import { ExportComponent } from "@bitwarden/vault-export-ui";
import { LooseComponentsModule, SharedModule } from "../../shared"; import { HeaderModule } from "../../layouts/header/header.module";
import { SharedModule } from "../../shared";
@Component({ @Component({
templateUrl: "org-vault-export.component.html", templateUrl: "org-vault-export.component.html",
imports: [SharedModule, ExportComponent, LooseComponentsModule], imports: [SharedModule, ExportComponent, HeaderModule],
}) })
export class OrganizationVaultExportComponent implements OnInit { export class OrganizationVaultExportComponent implements OnInit {
protected routeOrgId: string = null; protected routeOrgId: string = null;

View File

@@ -3,7 +3,7 @@ import { NgModule } from "@angular/core";
import { CollectionNameBadgeComponent } from "../../admin-console/organizations/collections"; import { CollectionNameBadgeComponent } from "../../admin-console/organizations/collections";
import { GroupBadgeModule } from "../../admin-console/organizations/collections/group-badge/group-badge.module"; import { GroupBadgeModule } from "../../admin-console/organizations/collections/group-badge/group-badge.module";
import { CollectionDialogComponent } from "../../admin-console/organizations/shared/components/collection-dialog"; import { CollectionDialogComponent } from "../../admin-console/organizations/shared/components/collection-dialog";
import { LooseComponentsModule, SharedModule } from "../../shared"; import { SharedModule } from "../../shared";
import { BulkDialogsModule } from "./bulk-action-dialogs/bulk-dialogs.module"; import { BulkDialogsModule } from "./bulk-action-dialogs/bulk-dialogs.module";
import { OrganizationBadgeModule } from "./organization-badge/organization-badge.module"; import { OrganizationBadgeModule } from "./organization-badge/organization-badge.module";
@@ -20,7 +20,6 @@ import { ViewComponent } from "./view.component";
CollectionNameBadgeComponent, CollectionNameBadgeComponent,
PipesModule, PipesModule,
SharedModule, SharedModule,
LooseComponentsModule,
BulkDialogsModule, BulkDialogsModule,
CollectionDialogComponent, CollectionDialogComponent,
VaultComponent, VaultComponent,

View File

@@ -21,7 +21,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service"; import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
import { TableDataSource, NoItemsModule, ToastService } from "@bitwarden/components"; import { TableDataSource, NoItemsModule, ToastService } from "@bitwarden/components";
import { KeyService } from "@bitwarden/key-management"; import { KeyService } from "@bitwarden/key-management";
import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared"; import { HeaderModule } from "@bitwarden/web-vault/app/layouts/header/header.module";
import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module"; import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module";
@Component({ @Component({
@@ -43,7 +43,7 @@ import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module";
], ],
}), }),
] satisfies SafeProvider[], ] satisfies SafeProvider[],
imports: [SharedModule, NoItemsModule, LooseComponentsModule], imports: [SharedModule, NoItemsModule, HeaderModule],
}) })
export class DeviceApprovalsComponent implements OnInit, OnDestroy { export class DeviceApprovalsComponent implements OnInit, OnDestroy {
tableDataSource = new TableDataSource<PendingAuthRequestWithFingerprintView>(); tableDataSource = new TableDataSource<PendingAuthRequestWithFingerprintView>();

View File

@@ -1,6 +1,6 @@
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared"; import { HeaderModule } from "@bitwarden/web-vault/app/layouts/header/header.module";
import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module"; import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module";
import { SsoComponent } from "../../auth/sso/sso.component"; import { SsoComponent } from "../../auth/sso/sso.component";
@@ -11,7 +11,7 @@ import { ScimComponent } from "./manage/scim.component";
import { OrganizationsRoutingModule } from "./organizations-routing.module"; import { OrganizationsRoutingModule } from "./organizations-routing.module";
@NgModule({ @NgModule({
imports: [SharedModule, OrganizationsRoutingModule, LooseComponentsModule], imports: [SharedModule, OrganizationsRoutingModule, HeaderModule],
declarations: [ declarations: [
SsoComponent, SsoComponent,
ScimComponent, ScimComponent,