Skip to content

Commit 00db01f

Browse files
authored
chore(release): 2.173.3 (#32663)
See CHANGELOG ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
2 parents 3055717 + 2e198d4 commit 00db01f

File tree

5 files changed

+49
-6
lines changed

5 files changed

+49
-6
lines changed

CHANGELOG.v2.alpha.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.173.3-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.2-alpha.0...v2.173.3-alpha.0) (2024-12-26)
6+
57
## [2.173.2-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.1-alpha.0...v2.173.2-alpha.0) (2024-12-17)
68

79
## [2.173.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.0-alpha.0...v2.173.1-alpha.0) (2024-12-14)

CHANGELOG.v2.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.173.3](https://github.com/aws/aws-cdk/compare/v2.173.2...v2.173.3) (2024-12-26)
6+
7+
8+
### Bug Fixes
9+
10+
* **aspects:** "localAspects is not iterable" error ([#32647](https://github.com/aws/aws-cdk/issues/32647)) ([8948ecb](https://github.com/aws/aws-cdk/commit/8948ecb22627ef57498e68fb721b0598aaa530ee)), closes [#32470](https://github.com/aws/aws-cdk/issues/32470)
11+
512
## [2.173.2](https://github.com/aws/aws-cdk/compare/v2.173.1...v2.173.2) (2024-12-17)
613

714

packages/aws-cdk-lib/core/lib/private/synthesis.ts

+18-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { CloudAssembly } from '../../../cx-api';
88
import * as cxapi from '../../../cx-api';
99
import { Annotations } from '../annotations';
1010
import { App } from '../app';
11-
import { AspectApplication, Aspects } from '../aspect';
11+
import { AspectApplication, AspectPriority, Aspects } from '../aspect';
1212
import { FileSystem } from '../fs';
1313
import { Stack } from '../stack';
1414
import { ISynthesisSession } from '../stack-synthesizers/types';
@@ -228,7 +228,7 @@ function invokeAspects(root: IConstruct) {
228228
const node = construct.node;
229229
const aspects = Aspects.of(construct);
230230

231-
let localAspects = aspects.applied;
231+
let localAspects = getAspectApplications(construct);
232232
const allAspectsHere = sortAspectsByPriority(inheritedAspects, localAspects);
233233

234234
const nodeAspectsCount = aspects.all.length;
@@ -290,11 +290,10 @@ function invokeAspectsV2(root: IConstruct) {
290290

291291
function recurse(construct: IConstruct, inheritedAspects: AspectApplication[]): boolean {
292292
const node = construct.node;
293-
const aspects = Aspects.of(construct);
294293

295294
let didSomething = false;
296295

297-
let localAspects = aspects.applied;
296+
let localAspects = getAspectApplications(construct);
298297
const allAspectsHere = sortAspectsByPriority(inheritedAspects, localAspects);
299298

300299
for (const aspectApplication of allAspectsHere) {
@@ -354,6 +353,21 @@ function sortAspectsByPriority(inheritedAspects: AspectApplication[], localAspec
354353
return allAspects;
355354
}
356355

356+
/**
357+
* Helper function to get aspect applications.
358+
* If `Aspects.applied` is available, it is used; otherwise, create AspectApplications from `Aspects.all`.
359+
*/
360+
function getAspectApplications(node: IConstruct): AspectApplication[] {
361+
const aspects = Aspects.of(node);
362+
if (aspects.applied !== undefined) {
363+
return aspects.applied;
364+
}
365+
366+
// Fallback: Create AspectApplications from `aspects.all`
367+
const typedAspects = aspects as Aspects;
368+
return typedAspects.all.map(aspect => new AspectApplication(node, aspect, AspectPriority.DEFAULT));
369+
}
370+
357371
/**
358372
* Find all stacks and add Metadata Resources to all of them
359373
*

packages/aws-cdk-lib/core/test/aspect.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,24 @@ describe('aspect', () => {
309309
}
310310
}
311311
}
312+
313+
test.each([
314+
{ stabilization: true },
315+
{ stabilization: false },
316+
])('Error is not thrown if Aspects.applied does not exist (stabilization: $stabilization)', ({ stabilization }) => {
317+
const app = new App({ context: { '@aws-cdk/core:aspectStabilization': stabilization } });
318+
const root = new Stack(app, 'My-Stack');
319+
320+
Aspects.of(root).add(new Tag('AspectA', 'Visited'));
321+
322+
// "Monkey patching" - Override `applied` to simulate its absence
323+
Object.defineProperty(Aspects.prototype, 'applied', {
324+
value: undefined,
325+
configurable: true,
326+
});
327+
328+
expect(() => {
329+
app.synth();
330+
}).not.toThrow();
331+
});
312332
});

version.v2.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "2.173.2",
3-
"alphaVersion": "2.173.2-alpha.0"
2+
"version": "2.173.3",
3+
"alphaVersion": "2.173.3-alpha.0"
44
}

0 commit comments

Comments
 (0)