in src/index.ts [169:199]
public bind(stack: Stack): void {
if (this._stack !== undefined) {
throw new Error('A StackSynthesizer can only be used for one Stack: create a new instance to use with a different Stack');
}
this._stack = stack;
// Function to replace placeholders in the input string as much as possible
//
// We replace:
// - ${AWS::AccountId}, ${AWS::Region}: only if we have the actual values available
// - ${AWS::Partition}: never, since we never have the actual partition value.
const specialize = (s: string | undefined) => {
if (s === undefined) {
return undefined;
}
return cxapi.EnvironmentPlaceholders.replace(s, {
region: resolvedOr(stack.region, cxapi.EnvironmentPlaceholders.CURRENT_REGION),
accountId: resolvedOr(stack.account, cxapi.EnvironmentPlaceholders.CURRENT_ACCOUNT),
partition: cxapi.EnvironmentPlaceholders.CURRENT_PARTITION,
});
};
/* eslint-disable max-len */
this.bucketName = specialize(this.bucketName);
this.repositoryName = specialize(this.repositoryName);
this.fileAssetPublishingRoleArn = specialize(this.fileAssetPublishingRoleArn);
this.imageAssetPublishingRoleArn = specialize(this.imageAssetPublishingRoleArn);
this.fileAssetPrefix = specialize(this.fileAssetPrefix ?? '');
/* eslint-enable max-len */
}