Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(scope: cdk.Construct, id: string, props: AssetProps) {
super(scope, id);
// stage the asset source (conditionally).
const staging = new assets.Staging(this, 'Stage', {
...props,
sourcePath: path.resolve(props.path),
});
this.sourceHash = props.sourceHash || staging.sourceHash;
this.assetPath = staging.stagedPath;
const packaging = determinePackaging(staging.sourcePath);
// sets isZipArchive based on the type of packaging and file extension
this.isZipArchive = packaging === cdk.FileAssetPackaging.ZIP_DIRECTORY
? true
: ARCHIVE_EXTENSIONS.some(ext => staging.sourcePath.toLowerCase().endsWith(ext));
const stack = cdk.Stack.of(this);