Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
975 changes: 197 additions & 778 deletions src/asset-staging.ts

Large diffs are not rendered by default.

399 changes: 29 additions & 370 deletions src/assets.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/aws/aws-asset-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
AssetType,
TerraformAsset,
// ref,
FileAssetPackaging,
} from "cdktn";
import { Construct } from "constructs";
import * as mime from "mime-types";
Expand All @@ -25,7 +26,6 @@ import {
DockerImageAssetLocation,
DockerImageAssetSource,
FileAssetLocation,
FileAssetPackaging,
FileAssetSource,
} from "../assets";

Expand Down Expand Up @@ -165,8 +165,8 @@ export class AwsAssetManager implements IAssetManager {
bucketName: this.bucket!.bucket,
objectKey: s3Asset.key,
httpUrl,
objectUrl: this.buildS3ObjectUrl(s3Asset.key),
s3Url: httpUrl,
s3ObjectUrl: this.buildS3ObjectUrl(s3Asset.key),
};
// Store in the map for future lookups
this.fileAssetMap.set(objectKey, location);
Expand Down
4 changes: 1 addition & 3 deletions src/aws/compute/function-nodejs/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as os from "os";
import * as path from "path";
import { Annotations } from "cdktn";
import { Annotations, AssetHashType, AssetStaging } from "cdktn";
import { IConstruct } from "constructs";
import { Architecture, AssetCode, Code, Runtime } from "..";
import { PackageInstallation } from "./package-installation";
Expand All @@ -15,8 +15,6 @@ import {
getTsconfigCompilerOptions,
isSdkV2Runtime,
} from "./util";
import { AssetStaging } from "../../../asset-staging";
import { AssetHashType } from "../../../assets";
import {
BundlingFileAccess,
BundlingOptions as CoreBundlingOptions,
Expand Down
8 changes: 3 additions & 5 deletions src/aws/storage/assets/image-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as ecr from "..";
import {
AssetStaging,
FileFingerprintOptions,
IgnoreMode,
ValidationError,
UnscopedValidationError,
IAsset,
Expand Down Expand Up @@ -458,7 +457,8 @@ export class DockerImageAsset extends Construct implements IAsset {
throw new ValidationError(`Cannot find file at ${file}`, this);
}

let ignoreMode = props.ignoreMode ?? IgnoreMode.DOCKER;
// Note: ignoreMode is not used in cdktn's AssetStaging
// let ignoreMode = props.ignoreMode ?? IgnoreMode.DOCKER;

let exclude: string[] = props.exclude || [];

Expand Down Expand Up @@ -534,9 +534,7 @@ export class DockerImageAsset extends Construct implements IAsset {

const staging = new AssetStaging(this, "Staging", {
...props,
follow: props.followSymlinks,
exclude,
ignoreMode,
sourcePath: dir,
extraHash:
Object.keys(extraHash).length === 0
Expand All @@ -548,7 +546,7 @@ export class DockerImageAsset extends Construct implements IAsset {
this.sourceHash = this.assetHash;

const stack = AwsStack.ofAwsConstruct(this);
this.assetPath = staging.relativeStagedPath(stack);
this.assetPath = staging.absoluteStagedPath;
this.assetName = props.assetName;
this.dockerBuildArgs = props.buildArgs;
this.dockerBuildSecrets = props.buildSecrets;
Expand Down
5 changes: 2 additions & 3 deletions src/aws/storage/assets/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export class Asset extends Construct implements cdk.IAsset {
const staging = new cdk.AssetStaging(this, "Stage", {
...props,
sourcePath: path.resolve(props.path),
follow: props.followSymlinks,
assetHash: props.assetHash ?? props.sourceHash,
});

Expand All @@ -165,7 +164,7 @@ export class Asset extends Construct implements cdk.IAsset {

const stack = AwsStack.ofAwsConstruct(this);

this.assetPath = staging.relativeStagedPath(stack);
this.assetPath = staging.absoluteStagedPath;

this.isFile = staging.packaging === cdk.FileAssetPackaging.FILE;

Expand All @@ -179,7 +178,7 @@ export class Asset extends Construct implements cdk.IAsset {
});
this.s3BucketName = location.bucketName;
this.s3ObjectKey = location.objectKey;
this.s3ObjectUrl = location.s3ObjectUrl;
this.s3ObjectUrl = location.objectUrl!;
this.httpUrl = location.httpUrl;
this.s3Url = location.httpUrl; // for backwards compatibility

Expand Down
Loading
Loading