Open
Conversation
Move the core Mixins mechanism (Mixins, Mixin, IMixin, MixinApplicator, ConstructSelector) from @aws-cdk/mixins-preview to aws-cdk-lib/core.
3a582c9 to
3933a40
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for this change
Mixins enable composable, reusable functionality that attaches to constructs without inheritance. A mixin author implements
supports()andapplyTo(), and consumers apply mixins to any scope usingMixins.of(scope).apply(myMixin). Construct selectors narrow the target set by resource type, path pattern, or ID glob. This composability is the key differentiator from Aspects: where Aspects visit every node in the tree, Mixins give authors fine-grained control over which constructs receive which behavior.Description of changes
The core Mixins types (
Mixins,Mixin,IMixin,MixinApplicator,ConstructSelector, and related interfaces) now live in@aws-cdk-lib/core/lib. TheMIXIN_SYMBOLidentifier changes from the preview value to@aws-cdk/core.Mixin, which deliberately breaks cross-version compatibility checks so that preview mixins and GA mixins remain distinct.The
@aws-cdk/mixins-previewpackage re-exports these types fromaws-cdk-lib/coreinstead of bundling its own copies. Existing code that imports from@aws-cdk/mixins-previewcontinues to work without changes. The preview package keeps its additional features like built-in mixins and EventBridge event patterns.A new "Mixins" section in the
aws-cdk-libREADME documents theMixins.of()entry point, custom mixin creation, construct selection, and error handling withrequireAny()/requireAll(). It sits right before the existing "Aspects" section because the two features are conceptually related.Analytics metadata tracks mixin usage via
aws:cdk:analytics:mixinnode metadata. The FQN of first-party mixins (those with allowed package prefixes) is recorded; third-party or unidentified mixins are redacted to*.Describe any new or updated permissions being added
N/A
Description of how you validated changes
aws-cdk-libcompiles cleanly withtsc --noEmit. Unit tests cover theMixinbase class,MixinApplicator(includingrequireAny/requireAllsemantics and ordering guarantees),ConstructSelectorvariants, and metadata recording with FQN redaction.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license