Skip to content

Commit

Permalink
chore: Rename ControllerMessenger to Messenger
Browse files Browse the repository at this point in the history
Rename the `ControllerMessenger` to `Messenger` so that it is clear it
can be used for more than just controllers.

This was decided by this ADR: https://github.com/MetaMask/decisions/blob/main/decisions/core/0001-messaging-non-controllers.md

Previous names have been preserved as aliases to avoid making this a breaking
change.

Relates to #4538
  • Loading branch information
Gudahtt committed Dec 10, 2024
1 parent 1fd0d3a commit d2c1c84
Show file tree
Hide file tree
Showing 9 changed files with 586 additions and 629 deletions.
9 changes: 9 additions & 0 deletions packages/base-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Rename `ControllerMessenger` to `Messenger` ([#5050](https://github.com/MetaMask/core/pull/5050))
- `ControllerMessenger` has been renamed to `Messenger`
- `RestrictedControllerMessengerConstraint` has been renamed to `RestrictedMessengerConstraint`
- `RestrictedControllerMessenger` has been renamed to `RestrictedMessenger`
- The `RestrictedMessenger` constructor parameter `controllerMessenger` has been renamed to `messenger`, though the old name is still accepted
- The old names remain exported as deprecated aliases of the new names, so this is not a breaking change.

## [7.0.2]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/base-controller/src/BaseControllerV1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
countControllerStateMetadata,
getCountMessenger,
} from './BaseControllerV2.test';
import { ControllerMessenger } from './ControllerMessenger';
import { ControllerMessenger } from './Messenger';

const STATE = { name: 'foo' };
const CONFIG = { disabled: true };
Expand Down
4 changes: 2 additions & 2 deletions packages/base-controller/src/BaseControllerV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
getPersistentState,
isBaseController,
} from './BaseControllerV2';
import { ControllerMessenger } from './ControllerMessenger';
import type { RestrictedControllerMessenger } from './RestrictedControllerMessenger';
import { ControllerMessenger } from './Messenger';
import type { RestrictedControllerMessenger } from './RestrictedMessenger';

export const countControllerName = 'CountController';

Expand Down
4 changes: 2 additions & 2 deletions packages/base-controller/src/BaseControllerV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import type {
BaseControllerV1Instance,
StateConstraint as StateConstraintV1,
} from './BaseControllerV1';
import type { ActionConstraint, EventConstraint } from './ControllerMessenger';
import type { ActionConstraint, EventConstraint } from './Messenger';
import type {
RestrictedControllerMessenger,
RestrictedControllerMessengerConstraint,
} from './RestrictedControllerMessenger';
} from './RestrictedMessenger';

enablePatches();

Expand Down
Loading

0 comments on commit d2c1c84

Please sign in to comment.