Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add new interfaces for Assets (#12700)
In V2, we want to get rid of the `@aws-cdk/assets` module, as it's considered deprecated in V1. Unfortunately, the module contains an interface, `CopyOptions`, that is used, through interface inheritance, in the public API of many stable CDK modules like ECS, Lambda, ECR, CodeBuild, etc. While we have a `CopyOptions` interface in `@aws-cdk/core`, it unfortunately shares the same name, `follow`, with the property in the "old" `CopyOptions`. But the two different `follow` properties have different types. For that reason, if we're going to remove the "old" `CopyOptions` using JSII's "strip deprecated" option, we can't use the "new" `CopyOptions` in the inheritance hierarchy alongside the "old" `CopyOptions`, as the two definitions of `follow` would conflict. Because of that, create a new `FileCopyOptions` interface which renames the `follow` property to `followSymlinks`. Also add a `FileFingerprintOptions` interface that does a similar trick to the `FingerprintOptions` interface (which extends `CopyOptions`), which is used in the public API of modules that use Docker assets. Also extract a few module-private interfaces to avoid duplication of properties between all of these interfaces. After this change, an interface from one of the non-deprecated assets libraries (S3 or ECR) using `FileOptions` from `@aws-cdk/assets` will look like this: ```ts // this is in @aws-cdk/aws-s3-assets export interface AssetOptions extends assets.CopyOptions, cdk.FileCopyOptions, cdk.AssetOptions { // ... ``` Then, when we enable stripping the deprecated elements using JSII on the V2 branch, this will be turned to: ```ts export interface AssetOptions extends cdk.FileCopyOptions, cdk.AssetOptions { // ... ``` Allowing us to deprecate the `@aws-cdk/assets` module, and not ship it with `aws-cdk-lib`. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information