From aa626558b8576e5f64f0147295a23051d49d3d8c Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 20 Dec 2024 03:10:26 -0330 Subject: [PATCH 1/2] chore(accouncement): Rename `ControllerMessenger` to `Messenger`. Rename `ControllerMessenger` to `Messenger` in the `@metamask/announcement-controller` package. The `AnnouncementControllerMessenger` type export was renamed to `AnnouncementMessenger`, but the old name is preserved as an alias. Relates to #4538 --- packages/announcement-controller/CHANGELOG.md | 2 ++ .../src/AnnouncementController.test.ts | 6 +++--- .../src/AnnouncementController.ts | 8 ++++---- packages/announcement-controller/src/index.ts | 13 ++++++++++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/packages/announcement-controller/CHANGELOG.md b/packages/announcement-controller/CHANGELOG.md index dfe0e30978f..61e41182241 100644 --- a/packages/announcement-controller/CHANGELOG.md +++ b/packages/announcement-controller/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0` ([#5079](https://github.com/MetaMask/core/pull/5079)) +- Rename `AnnouncementControllerMessenger` to `AnnouncementMessenger` ([#5092](https://github.com/MetaMask/core/pull/5092)) + - The old name is preserved as an alias, so this is not a breaking change. ## [7.0.2] diff --git a/packages/announcement-controller/src/AnnouncementController.test.ts b/packages/announcement-controller/src/AnnouncementController.test.ts index a0834bd0449..56991f6ff53 100644 --- a/packages/announcement-controller/src/AnnouncementController.test.ts +++ b/packages/announcement-controller/src/AnnouncementController.test.ts @@ -1,4 +1,4 @@ -import { ControllerMessenger } from '@metamask/base-controller'; +import { Messenger } from '@metamask/base-controller'; import type { AnnouncementControllerState, @@ -17,11 +17,11 @@ const name = 'AnnouncementController'; * @returns A restricted controller messenger. */ function getRestrictedMessenger() { - const controllerMessenger = new ControllerMessenger< + const messenger = new Messenger< AnnouncementControllerActions, AnnouncementControllerEvents >(); - return controllerMessenger.getRestricted({ + return messenger.getRestricted({ name, allowedActions: [], allowedEvents: [], diff --git a/packages/announcement-controller/src/AnnouncementController.ts b/packages/announcement-controller/src/AnnouncementController.ts index 3e114ff3247..c185db7f11a 100644 --- a/packages/announcement-controller/src/AnnouncementController.ts +++ b/packages/announcement-controller/src/AnnouncementController.ts @@ -1,7 +1,7 @@ import type { ControllerGetStateAction, ControllerStateChangeEvent, - RestrictedControllerMessenger, + RestrictedMessenger, } from '@metamask/base-controller'; import { BaseController } from '@metamask/base-controller'; @@ -66,7 +66,7 @@ const metadata = { }, }; -export type AnnouncementControllerMessenger = RestrictedControllerMessenger< +export type AnnouncementMessenger = RestrictedMessenger< typeof controllerName, AnnouncementControllerActions, AnnouncementControllerEvents, @@ -80,7 +80,7 @@ export type AnnouncementControllerMessenger = RestrictedControllerMessenger< export class AnnouncementController extends BaseController< typeof controllerName, AnnouncementControllerState, - AnnouncementControllerMessenger + AnnouncementMessenger > { /** * Creates a AnnouncementController instance. @@ -95,7 +95,7 @@ export class AnnouncementController extends BaseController< state, allAnnouncements, }: { - messenger: AnnouncementControllerMessenger; + messenger: AnnouncementMessenger; state?: AnnouncementControllerState; allAnnouncements: AnnouncementMap; }) { diff --git a/packages/announcement-controller/src/index.ts b/packages/announcement-controller/src/index.ts index f3ce26e85e4..373ddd93e2f 100644 --- a/packages/announcement-controller/src/index.ts +++ b/packages/announcement-controller/src/index.ts @@ -1 +1,12 @@ -export * from './AnnouncementController'; +export type { + AnnouncementMap, + StateAnnouncementMap, + AnnouncementControllerState, + AnnouncementControllerActions, + AnnouncementControllerEvents, + AnnouncementControllerGetStateAction, + AnnouncementControllerStateChangeEvent, + AnnouncementMessenger, + AnnouncementMessenger as AnnouncementControllerMessenger, +} from './AnnouncementController'; +export { AnnouncementController } from './AnnouncementController'; From b3e8ec5772da788e64b993db7cdaba9adb53b34f Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Thu, 9 Jan 2025 20:48:49 -0330 Subject: [PATCH 2/2] Rename `AnnouncementMessenger` to `AnnouncementControllerMessenger` This reverts the sole functional change. --- packages/announcement-controller/CHANGELOG.md | 2 -- .../announcement-controller/src/AnnouncementController.ts | 6 +++--- packages/announcement-controller/src/index.ts | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/announcement-controller/CHANGELOG.md b/packages/announcement-controller/CHANGELOG.md index 61e41182241..dfe0e30978f 100644 --- a/packages/announcement-controller/CHANGELOG.md +++ b/packages/announcement-controller/CHANGELOG.md @@ -10,8 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0` ([#5079](https://github.com/MetaMask/core/pull/5079)) -- Rename `AnnouncementControllerMessenger` to `AnnouncementMessenger` ([#5092](https://github.com/MetaMask/core/pull/5092)) - - The old name is preserved as an alias, so this is not a breaking change. ## [7.0.2] diff --git a/packages/announcement-controller/src/AnnouncementController.ts b/packages/announcement-controller/src/AnnouncementController.ts index c185db7f11a..8bb1bb35c65 100644 --- a/packages/announcement-controller/src/AnnouncementController.ts +++ b/packages/announcement-controller/src/AnnouncementController.ts @@ -66,7 +66,7 @@ const metadata = { }, }; -export type AnnouncementMessenger = RestrictedMessenger< +export type AnnouncementControllerMessenger = RestrictedMessenger< typeof controllerName, AnnouncementControllerActions, AnnouncementControllerEvents, @@ -80,7 +80,7 @@ export type AnnouncementMessenger = RestrictedMessenger< export class AnnouncementController extends BaseController< typeof controllerName, AnnouncementControllerState, - AnnouncementMessenger + AnnouncementControllerMessenger > { /** * Creates a AnnouncementController instance. @@ -95,7 +95,7 @@ export class AnnouncementController extends BaseController< state, allAnnouncements, }: { - messenger: AnnouncementMessenger; + messenger: AnnouncementControllerMessenger; state?: AnnouncementControllerState; allAnnouncements: AnnouncementMap; }) { diff --git a/packages/announcement-controller/src/index.ts b/packages/announcement-controller/src/index.ts index 373ddd93e2f..86cac4c8a2f 100644 --- a/packages/announcement-controller/src/index.ts +++ b/packages/announcement-controller/src/index.ts @@ -6,7 +6,6 @@ export type { AnnouncementControllerEvents, AnnouncementControllerGetStateAction, AnnouncementControllerStateChangeEvent, - AnnouncementMessenger, - AnnouncementMessenger as AnnouncementControllerMessenger, + AnnouncementControllerMessenger, } from './AnnouncementController'; export { AnnouncementController } from './AnnouncementController';