Skip to content

Commit 036f94e

Browse files
committed
feat(aws-cdk): add deprecation warning for legacy exports
Add a prominent warning message when legacy exports from the aws-cdk package are imported. The warning informs users that these exports were never officially supported and will be removed after 2026-03-01, directing them to migrate to the official CDK Toolkit Library. The warning can be disabled by setting CDK_DISABLE_LEGACY_EXPORT_WARNING=1.
1 parent 742ccfc commit 036f94e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/aws-cdk/lib/legacy-exports.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,24 @@ export const {
8686
data,
8787
prefix,
8888
} = legacy;
89+
90+
if (!process.env.CDK_DISABLE_LEGACY_EXPORT_WARNING) {
91+
// eslint-disable-next-line no-console
92+
console.warn([
93+
'',
94+
'\x1b[43m\x1b[30m █████████████████████████████████████████████████████████████████████████ \x1b[0m',
95+
'\x1b[43m\x1b[30m █ █ \x1b[0m',
96+
'\x1b[43m\x1b[30m █ ⚠ WARNING: You are using LEGACY EXPORTS from the aws-cdk package! █ \x1b[0m',
97+
'\x1b[43m\x1b[30m █ █ \x1b[0m',
98+
'\x1b[43m\x1b[30m █ These exports were never officially supported and will be removed █ \x1b[0m',
99+
'\x1b[43m\x1b[30m █ after 2026-03-01. █ \x1b[0m',
100+
'\x1b[43m\x1b[30m █ Please migrate to using the official CDK Toolkit Library instead: █ \x1b[0m',
101+
'\x1b[43m\x1b[30m █ https://docs.aws.amazon.com/cdk/api/toolkit-lib/ █ \x1b[0m',
102+
'\x1b[43m\x1b[30m █ █ \x1b[0m',
103+
'\x1b[43m\x1b[30m █ For more information: https://github.com/aws/aws-cdk-cli/issues/310 █ \x1b[0m',
104+
'\x1b[43m\x1b[30m █ To disable this warning: CDK_DISABLE_LEGACY_EXPORT_WARNING=1 █ \x1b[0m',
105+
'\x1b[43m\x1b[30m █ █ \x1b[0m',
106+
'\x1b[43m\x1b[30m █████████████████████████████████████████████████████████████████████████ \x1b[0m',
107+
'',
108+
].join('\n'));
109+
}

0 commit comments

Comments
 (0)