From b91bbb657585ef794ec9d09163002171399dd1c1 Mon Sep 17 00:00:00 2001 From: Mitchell Valine Date: Fri, 16 Jun 2023 13:18:17 -0700 Subject: [PATCH] chore: fix broken v1 lints --- packages/aws-cdk/THIRD_PARTY_LICENSES | 22 ++++++++++++++++++- .../lib/api/aws-auth/credential-plugins.ts | 2 +- .../api/bootstrap/bootstrap-environment.ts | 6 ++--- .../lib/api/bootstrap/deploy-bootstrap.ts | 2 +- .../lib/api/cloudformation-deployments.ts | 6 ++--- .../aws-cdk/lib/api/cxapp/cloud-executable.ts | 4 ++-- .../aws-cdk/lib/api/cxapp/environments.ts | 2 +- packages/aws-cdk/lib/api/deploy-stack.ts | 16 +++++++------- .../aws-cdk/lib/api/hotswap-deployments.ts | 2 +- .../api/hotswap/appsync-mapping-templates.ts | 2 +- .../lib/api/hotswap/code-build-projects.ts | 2 +- .../aws-cdk/lib/api/hotswap/ecs-services.ts | 2 +- .../lib/api/hotswap/lambda-functions.ts | 2 +- .../lib/api/hotswap/s3-bucket-deployments.ts | 2 +- .../hotswap/stepfunctions-state-machines.ts | 2 +- packages/aws-cdk/lib/api/toolkit-info.ts | 2 +- .../aws-cdk/lib/api/util/cloudformation.ts | 2 +- packages/aws-cdk/lib/cdk-toolkit.ts | 2 +- .../aws-cdk/lib/context-providers/index.ts | 12 +++++----- packages/aws-cdk/lib/version.ts | 4 ++-- packages/aws-cdk/test/account-cache.test.ts | 2 +- .../api/cloudformation-deployments.test.ts | 2 +- .../api/hotswap/nested-stacks-hotswap.test.ts | 2 +- .../s3-bucket-hotswap-deployments.test.ts | 2 +- .../aws-cdk/test/api/sdk-provider.test.ts | 2 +- .../test/api/stack-activity-monitor.test.ts | 2 +- packages/aws-cdk/test/assets.test.ts | 6 ++--- packages/aws-cdk/test/cdk-toolkit.test.ts | 2 +- packages/aws-cdk/test/diff.test.ts | 2 +- packages/aws-cdk/test/import.test.ts | 4 ++-- packages/aws-cdk/test/util.ts | 2 +- .../aws-cdk/test/util/cloudformation.test.ts | 2 +- .../aws-cdk/test/util/stack-monitor.test.ts | 2 +- 33 files changed, 74 insertions(+), 54 deletions(-) diff --git a/packages/aws-cdk/THIRD_PARTY_LICENSES b/packages/aws-cdk/THIRD_PARTY_LICENSES index 25df2c59dcacd..8c083e1b5346d 100644 --- a/packages/aws-cdk/THIRD_PARTY_LICENSES +++ b/packages/aws-cdk/THIRD_PARTY_LICENSES @@ -1,6 +1,6 @@ The aws-cdk package includes the following third-party software/licensing: -** @jsii/check-node@1.74.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.74.0 | Apache-2.0 +** @jsii/check-node@1.84.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.84.0 | Apache-2.0 jsii Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -2969,6 +2969,26 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +---------------- + +** semver@7.5.2 - https://www.npmjs.com/package/semver/v/7.5.2 | ISC +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ---------------- ** setprototypeof@1.2.0 - https://www.npmjs.com/package/setprototypeof/v/1.2.0 | ISC diff --git a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts index bcb13a2d90df0..95b8ad2eb9c16 100644 --- a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts +++ b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts @@ -1,6 +1,6 @@ -import { CredentialProviderSource, PluginHost } from '../plugin'; import { debug } from './_env'; import { Mode } from './credentials'; +import { CredentialProviderSource, PluginHost } from '../plugin'; /** * Cache for credential providers. diff --git a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts index a7b63214a3c80..38e78b194c526 100644 --- a/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts +++ b/packages/aws-cdk/lib/api/bootstrap/bootstrap-environment.ts @@ -1,14 +1,14 @@ import { info } from 'console'; import * as path from 'path'; import * as cxapi from '@aws-cdk/cx-api'; +import { BootstrapEnvironmentOptions, BootstrappingParameters } from './bootstrap-props'; +import { BootstrapStack, bootstrapVersionFromTemplate } from './deploy-bootstrap'; +import { legacyBootstrapTemplate } from './legacy-template'; import { warning } from '../../logging'; import { loadStructuredFile, toYAML } from '../../serialize'; import { rootDir } from '../../util/directories'; import { SdkProvider } from '../aws-auth'; import { DeployStackResult } from '../deploy-stack'; -import { BootstrapEnvironmentOptions, BootstrappingParameters } from './bootstrap-props'; -import { BootstrapStack, bootstrapVersionFromTemplate } from './deploy-bootstrap'; -import { legacyBootstrapTemplate } from './legacy-template'; /* eslint-disable max-len */ diff --git a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts index df20bf0f62b63..491eb5ea1383b 100644 --- a/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts +++ b/packages/aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts @@ -3,11 +3,11 @@ import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; +import { BOOTSTRAP_VERSION_OUTPUT, BootstrapEnvironmentOptions, BOOTSTRAP_VERSION_RESOURCE } from './bootstrap-props'; import * as logging from '../../logging'; import { Mode, SdkProvider, ISDK } from '../aws-auth'; import { deployStack, DeployStackResult } from '../deploy-stack'; import { DEFAULT_TOOLKIT_STACK_NAME, ToolkitInfo } from '../toolkit-info'; -import { BOOTSTRAP_VERSION_OUTPUT, BootstrapEnvironmentOptions, BOOTSTRAP_VERSION_RESOURCE } from './bootstrap-props'; /** * A class to hold state around stack bootstrapping diff --git a/packages/aws-cdk/lib/api/cloudformation-deployments.ts b/packages/aws-cdk/lib/api/cloudformation-deployments.ts index 5594c71a42630..e1f64eee7ec9f 100644 --- a/packages/aws-cdk/lib/api/cloudformation-deployments.ts +++ b/packages/aws-cdk/lib/api/cloudformation-deployments.ts @@ -1,8 +1,5 @@ import * as cxapi from '@aws-cdk/cx-api'; import { AssetManifest } from 'cdk-assets'; -import { Tag } from '../cdk-toolkit'; -import { debug, warning } from '../logging'; -import { publishAssets } from '../util/asset-publishing'; import { Mode } from './aws-auth/credentials'; import { ISDK } from './aws-auth/sdk'; import { SdkProvider } from './aws-auth/sdk-provider'; @@ -12,6 +9,9 @@ import { ToolkitInfo } from './toolkit-info'; import { CloudFormationStack, Template, ResourcesToImport, ResourceIdentifierSummaries } from './util/cloudformation'; import { StackActivityProgress } from './util/cloudformation/stack-activity-monitor'; import { replaceEnvPlaceholders } from './util/placeholders'; +import { Tag } from '../cdk-toolkit'; +import { debug, warning } from '../logging'; +import { publishAssets } from '../util/asset-publishing'; /** * SDK obtained by assuming the lookup role diff --git a/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts b/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts index 5b95f7bc8d4d0..5ef89403a27f2 100644 --- a/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts +++ b/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts @@ -1,12 +1,12 @@ import { promises as fs } from 'fs'; import * as cxapi from '@aws-cdk/cx-api'; import { RegionInfo } from '@aws-cdk/region-info'; +import * as semver from 'semver'; +import { CloudAssembly } from './cloud-assembly'; import * as contextproviders from '../../context-providers'; import { debug, warning } from '../../logging'; import { Configuration } from '../../settings'; import { SdkProvider } from '../aws-auth'; -import { CloudAssembly } from './cloud-assembly'; -import * as semver from 'semver'; /** * @returns output directory diff --git a/packages/aws-cdk/lib/api/cxapp/environments.ts b/packages/aws-cdk/lib/api/cxapp/environments.ts index 0220abab3b821..fa1f52d729420 100644 --- a/packages/aws-cdk/lib/api/cxapp/environments.ts +++ b/packages/aws-cdk/lib/api/cxapp/environments.ts @@ -1,6 +1,6 @@ import * as cxapi from '@aws-cdk/cx-api'; -import { SdkProvider } from '../aws-auth'; import { StackCollection } from './cloud-assembly'; +import { SdkProvider } from '../aws-auth'; // namespace object imports won't work in the bundle for function exports // eslint-disable-next-line @typescript-eslint/no-require-imports diff --git a/packages/aws-cdk/lib/api/deploy-stack.ts b/packages/aws-cdk/lib/api/deploy-stack.ts index dd4e596173f3f..90d8e99205226 100644 --- a/packages/aws-cdk/lib/api/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deploy-stack.ts @@ -2,23 +2,23 @@ import * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; import * as fs from 'fs-extra'; import * as uuid from 'uuid'; -import { addMetadataAssetsToManifest } from '../assets'; -import { Tag } from '../cdk-toolkit'; -import { debug, error, print } from '../logging'; -import { toYAML } from '../serialize'; -import { AssetManifestBuilder } from '../util/asset-manifest-builder'; -import { publishAssets } from '../util/asset-publishing'; -import { contentHash } from '../util/content-hash'; import { ISDK, SdkProvider } from './aws-auth'; import { CfnEvaluationException } from './evaluate-cloudformation-template'; -import { tryHotswapDeployment } from './hotswap-deployments'; import { ICON } from './hotswap/common'; +import { tryHotswapDeployment } from './hotswap-deployments'; import { ToolkitInfo } from './toolkit-info'; import { changeSetHasNoChanges, CloudFormationStack, TemplateParameters, waitForChangeSet, waitForStackDeploy, waitForStackDelete, ParameterValues, ParameterChanges, ResourcesToImport, } from './util/cloudformation'; import { StackActivityMonitor, StackActivityProgress } from './util/cloudformation/stack-activity-monitor'; +import { addMetadataAssetsToManifest } from '../assets'; +import { Tag } from '../cdk-toolkit'; +import { debug, error, print } from '../logging'; +import { toYAML } from '../serialize'; +import { AssetManifestBuilder } from '../util/asset-manifest-builder'; +import { publishAssets } from '../util/asset-publishing'; +import { contentHash } from '../util/content-hash'; type TemplateBodyParameter = { TemplateBody?: string diff --git a/packages/aws-cdk/lib/api/hotswap-deployments.ts b/packages/aws-cdk/lib/api/hotswap-deployments.ts index f64e5c16eddfa..af94c97f1df78 100644 --- a/packages/aws-cdk/lib/api/hotswap-deployments.ts +++ b/packages/aws-cdk/lib/api/hotswap-deployments.ts @@ -1,7 +1,6 @@ import * as cfn_diff from '@aws-cdk/cloudformation-diff'; import * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; -import { print } from '../logging'; import { ISDK, Mode, SdkProvider } from './aws-auth'; import { DeployStackResult } from './deploy-stack'; import { EvaluateCloudFormationTemplate, LazyListStackResources } from './evaluate-cloudformation-template'; @@ -14,6 +13,7 @@ import { isHotswappableS3BucketDeploymentChange } from './hotswap/s3-bucket-depl import { isHotswappableStateMachineChange } from './hotswap/stepfunctions-state-machines'; import { loadCurrentTemplateWithNestedStacks, NestedStackNames } from './nested-stack-helpers'; import { CloudFormationStack } from './util/cloudformation'; +import { print } from '../logging'; /** * Perform a hotswap deployment, diff --git a/packages/aws-cdk/lib/api/hotswap/appsync-mapping-templates.ts b/packages/aws-cdk/lib/api/hotswap/appsync-mapping-templates.ts index f7e4570a77b98..24a8f0871d427 100644 --- a/packages/aws-cdk/lib/api/hotswap/appsync-mapping-templates.ts +++ b/packages/aws-cdk/lib/api/hotswap/appsync-mapping-templates.ts @@ -1,7 +1,7 @@ import * as AWS from 'aws-sdk'; +import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate, lowerCaseFirstCharacter, transformObjectKeys } from './common'; import { ISDK } from '../aws-auth'; import { EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; -import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate, lowerCaseFirstCharacter, transformObjectKeys } from './common'; export async function isHotswappableAppSyncChange( logicalId: string, change: HotswappableChangeCandidate, evaluateCfnTemplate: EvaluateCloudFormationTemplate, diff --git a/packages/aws-cdk/lib/api/hotswap/code-build-projects.ts b/packages/aws-cdk/lib/api/hotswap/code-build-projects.ts index 55270d29f8ceb..57fa846a800e1 100644 --- a/packages/aws-cdk/lib/api/hotswap/code-build-projects.ts +++ b/packages/aws-cdk/lib/api/hotswap/code-build-projects.ts @@ -1,7 +1,7 @@ import * as AWS from 'aws-sdk'; +import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate, lowerCaseFirstCharacter, transformObjectKeys } from './common'; import { ISDK } from '../aws-auth'; import { EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; -import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate, lowerCaseFirstCharacter, transformObjectKeys } from './common'; export async function isHotswappableCodeBuildProjectChange( logicalId: string, change: HotswappableChangeCandidate, evaluateCfnTemplate: EvaluateCloudFormationTemplate, diff --git a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts index 1794457d86c9f..a2a2507bd2feb 100644 --- a/packages/aws-cdk/lib/api/hotswap/ecs-services.ts +++ b/packages/aws-cdk/lib/api/hotswap/ecs-services.ts @@ -1,7 +1,7 @@ import * as AWS from 'aws-sdk'; +import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate, lowerCaseFirstCharacter, transformObjectKeys } from './common'; import { ISDK } from '../aws-auth'; import { EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; -import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate, lowerCaseFirstCharacter, transformObjectKeys } from './common'; export async function isHotswappableEcsServiceChange( logicalId: string, change: HotswappableChangeCandidate, evaluateCfnTemplate: EvaluateCloudFormationTemplate, diff --git a/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts b/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts index adcc8b5c1aea8..f0e40751bc4d8 100644 --- a/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts +++ b/packages/aws-cdk/lib/api/hotswap/lambda-functions.ts @@ -1,9 +1,9 @@ import { Writable } from 'stream'; import * as AWS from 'aws-sdk'; +import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate } from './common'; import { flatMap } from '../../util'; import { ISDK } from '../aws-auth'; import { CfnEvaluationException, EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; -import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate } from './common'; // namespace object imports won't work in the bundle for function exports // eslint-disable-next-line @typescript-eslint/no-require-imports diff --git a/packages/aws-cdk/lib/api/hotswap/s3-bucket-deployments.ts b/packages/aws-cdk/lib/api/hotswap/s3-bucket-deployments.ts index 7eebe6d0a9437..edf2a50bd05c8 100644 --- a/packages/aws-cdk/lib/api/hotswap/s3-bucket-deployments.ts +++ b/packages/aws-cdk/lib/api/hotswap/s3-bucket-deployments.ts @@ -1,6 +1,6 @@ +import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate } from './common'; import { ISDK } from '../aws-auth'; import { EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; -import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate } from './common'; /** * This means that the value is required to exist by CloudFormation's API (or our S3 Bucket Deployment Lambda) diff --git a/packages/aws-cdk/lib/api/hotswap/stepfunctions-state-machines.ts b/packages/aws-cdk/lib/api/hotswap/stepfunctions-state-machines.ts index 9f746395e9114..1c35b15c4a3d4 100644 --- a/packages/aws-cdk/lib/api/hotswap/stepfunctions-state-machines.ts +++ b/packages/aws-cdk/lib/api/hotswap/stepfunctions-state-machines.ts @@ -1,6 +1,6 @@ +import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate } from './common'; import { ISDK } from '../aws-auth'; import { EvaluateCloudFormationTemplate } from '../evaluate-cloudformation-template'; -import { ChangeHotswapImpact, ChangeHotswapResult, HotswapOperation, HotswappableChangeCandidate } from './common'; export async function isHotswappableStateMachineChange( logicalId: string, change: HotswappableChangeCandidate, evaluateCfnTemplate: EvaluateCloudFormationTemplate, diff --git a/packages/aws-cdk/lib/api/toolkit-info.ts b/packages/aws-cdk/lib/api/toolkit-info.ts index a7c80fc53aaca..87a772e5253aa 100644 --- a/packages/aws-cdk/lib/api/toolkit-info.ts +++ b/packages/aws-cdk/lib/api/toolkit-info.ts @@ -1,9 +1,9 @@ import * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; -import { debug, warning } from '../logging'; import { ISDK } from './aws-auth'; import { BOOTSTRAP_VERSION_OUTPUT, BUCKET_DOMAIN_NAME_OUTPUT, BUCKET_NAME_OUTPUT } from './bootstrap/bootstrap-props'; import { stabilizeStack, CloudFormationStack } from './util/cloudformation'; +import { debug, warning } from '../logging'; export const DEFAULT_TOOLKIT_STACK_NAME = 'CDKToolkit'; diff --git a/packages/aws-cdk/lib/api/util/cloudformation.ts b/packages/aws-cdk/lib/api/util/cloudformation.ts index e898ea0b0e73d..9a3a033f322e7 100644 --- a/packages/aws-cdk/lib/api/util/cloudformation.ts +++ b/packages/aws-cdk/lib/api/util/cloudformation.ts @@ -1,8 +1,8 @@ import { SSMPARAM_NO_INVALIDATE } from '@aws-cdk/cx-api'; import { CloudFormation } from 'aws-sdk'; +import { StackStatus } from './cloudformation/stack-status'; import { debug } from '../../logging'; import { deserializeStructure } from '../../serialize'; -import { StackStatus } from './cloudformation/stack-status'; export type Template = { Parameters?: Record; diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 3e7c6f38dafbc..efe784b985625 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -5,7 +5,6 @@ import * as chalk from 'chalk'; import * as chokidar from 'chokidar'; import * as fs from 'fs-extra'; import * as promptly from 'promptly'; -import { environmentsFromDescriptors, globEnvironmentsFromStacks, looksLikeGlob } from '../lib/api/cxapp/environments'; import { SdkProvider } from './api/aws-auth'; import { Bootstrapper, BootstrapEnvironmentOptions } from './api/bootstrap'; import { CloudFormationDeployments } from './api/cloudformation-deployments'; @@ -20,6 +19,7 @@ import { data, debug, error, highlight, print, success, warning } from './loggin import { deserializeStructure, serializeStructure } from './serialize'; import { Configuration, PROJECT_CONFIG } from './settings'; import { numberFromBool, partition } from './util'; +import { environmentsFromDescriptors, globEnvironmentsFromStacks, looksLikeGlob } from '../lib/api/cxapp/environments'; export interface CdkToolkitProps { diff --git a/packages/aws-cdk/lib/context-providers/index.ts b/packages/aws-cdk/lib/context-providers/index.ts index 007ffd4268aec..099bd259170fa 100644 --- a/packages/aws-cdk/lib/context-providers/index.ts +++ b/packages/aws-cdk/lib/context-providers/index.ts @@ -1,11 +1,5 @@ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; -import { SdkProvider } from '../api'; -import { PluginHost } from '../api/plugin'; -import { ContextProviderPlugin } from '../api/plugin/context-provider-plugin'; -import { replaceEnvPlaceholders } from '../api/util/placeholders'; -import { debug } from '../logging'; -import { Context, TRANSIENT_CONTEXT_KEY } from '../settings'; import { AmiContextProviderPlugin } from './ami'; import { AZContextProviderPlugin } from './availability-zones'; import { EndpointServiceAZContextProviderPlugin } from './endpoint-service-availability-zones'; @@ -15,6 +9,12 @@ import { LoadBalancerContextProviderPlugin, LoadBalancerListenerContextProviderP import { SecurityGroupContextProviderPlugin } from './security-groups'; import { SSMContextProviderPlugin } from './ssm-parameters'; import { VpcNetworkContextProviderPlugin } from './vpcs'; +import { SdkProvider } from '../api'; +import { PluginHost } from '../api/plugin'; +import { ContextProviderPlugin } from '../api/plugin/context-provider-plugin'; +import { replaceEnvPlaceholders } from '../api/util/placeholders'; +import { debug } from '../logging'; +import { Context, TRANSIENT_CONTEXT_KEY } from '../settings'; export type ContextProviderFactory = ((sdk: SdkProvider) => ContextProviderPlugin); export type ProviderMap = {[name: string]: ContextProviderFactory}; diff --git a/packages/aws-cdk/lib/version.ts b/packages/aws-cdk/lib/version.ts index 72e349a5b9bf8..8e77d9da5ebf3 100644 --- a/packages/aws-cdk/lib/version.ts +++ b/packages/aws-cdk/lib/version.ts @@ -2,10 +2,10 @@ import * as path from 'path'; import * as chalk from 'chalk'; import * as fs from 'fs-extra'; import * as semver from 'semver'; -import { debug, print } from '../lib/logging'; -import { formatAsBanner } from '../lib/util/console-formatters'; import { cdkCacheDir, rootDir } from './util/directories'; import { getLatestVersionFromNpm } from './util/npm'; +import { debug, print } from '../lib/logging'; +import { formatAsBanner } from '../lib/util/console-formatters'; const ONE_DAY_IN_SECONDS = 1 * 24 * 60 * 60; diff --git a/packages/aws-cdk/test/account-cache.test.ts b/packages/aws-cdk/test/account-cache.test.ts index fd98edfda5573..5c338fd42e3e1 100644 --- a/packages/aws-cdk/test/account-cache.test.ts +++ b/packages/aws-cdk/test/account-cache.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import * as fs from 'fs-extra'; -import { AccountAccessKeyCache } from '../lib/api/aws-auth/account-cache'; import { withMocked } from './util'; +import { AccountAccessKeyCache } from '../lib/api/aws-auth/account-cache'; async function makeCache() { const dir = await fs.mkdtemp('/tmp/account-cache-test'); diff --git a/packages/aws-cdk/test/api/cloudformation-deployments.test.ts b/packages/aws-cdk/test/api/cloudformation-deployments.test.ts index d34563d1e0970..57b9dc45584eb 100644 --- a/packages/aws-cdk/test/api/cloudformation-deployments.test.ts +++ b/packages/aws-cdk/test/api/cloudformation-deployments.test.ts @@ -1,13 +1,13 @@ jest.mock('../../lib/api/deploy-stack'); import { CloudFormation } from 'aws-sdk'; +import { FakeCloudformationStack } from './fake-cloudformation-stack'; import { CloudFormationDeployments } from '../../lib/api/cloudformation-deployments'; import { deployStack } from '../../lib/api/deploy-stack'; import { ToolkitInfo } from '../../lib/api/toolkit-info'; import { CloudFormationStack } from '../../lib/api/util/cloudformation'; import { testStack } from '../util'; import { mockBootstrapStack, MockSdkProvider } from '../util/mock-sdk'; -import { FakeCloudformationStack } from './fake-cloudformation-stack'; let sdkProvider: MockSdkProvider; let deployments: CloudFormationDeployments; diff --git a/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts b/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts index b01e94ae4715b..a428e27f1cdbd 100644 --- a/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts +++ b/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts @@ -1,6 +1,6 @@ import { Lambda } from 'aws-sdk'; -import { testStack } from '../../util'; import * as setup from './hotswap-test-setup'; +import { testStack } from '../../util'; let mockUpdateLambdaCode: (params: Lambda.Types.UpdateFunctionCodeRequest) => Lambda.Types.FunctionConfiguration; let mockPublishVersion: jest.Mock; diff --git a/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts index 3a015308fcadc..fe27a641b3d6e 100644 --- a/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts @@ -1,6 +1,6 @@ import { Lambda } from 'aws-sdk'; -import { REQUIRED_BY_CFN } from '../../../lib/api/hotswap/s3-bucket-deployments'; import * as setup from './hotswap-test-setup'; +import { REQUIRED_BY_CFN } from '../../../lib/api/hotswap/s3-bucket-deployments'; let mockLambdaInvoke: (params: Lambda.Types.InvocationRequest) => Lambda.Types.InvocationResponse; let hotswapMockSdkProvider: setup.HotswapMockSdkProvider; diff --git a/packages/aws-cdk/test/api/sdk-provider.test.ts b/packages/aws-cdk/test/api/sdk-provider.test.ts index 9c03a7be0beed..b4c4c2e4116c6 100644 --- a/packages/aws-cdk/test/api/sdk-provider.test.ts +++ b/packages/aws-cdk/test/api/sdk-provider.test.ts @@ -4,12 +4,12 @@ import * as AWS from 'aws-sdk'; import type { ConfigurationOptions } from 'aws-sdk/lib/config-base'; import * as promptly from 'promptly'; import * as uuid from 'uuid'; +import { FakeSts, RegisterRoleOptions, RegisterUserOptions } from './fake-sts'; import { ISDK, Mode, SDK, SdkProvider } from '../../lib/api/aws-auth'; import { PluginHost } from '../../lib/api/plugin'; import * as logging from '../../lib/logging'; import * as bockfs from '../bockfs'; import { withMocked } from '../util'; -import { FakeSts, RegisterRoleOptions, RegisterUserOptions } from './fake-sts'; jest.mock('promptly', () => ({ prompt: jest.fn().mockResolvedValue('1234'), diff --git a/packages/aws-cdk/test/api/stack-activity-monitor.test.ts b/packages/aws-cdk/test/api/stack-activity-monitor.test.ts index 487fcfd8521df..2b9e75b09def1 100644 --- a/packages/aws-cdk/test/api/stack-activity-monitor.test.ts +++ b/packages/aws-cdk/test/api/stack-activity-monitor.test.ts @@ -1,6 +1,6 @@ import { bold, reset, green, yellow, red } from 'chalk'; -import { HistoryActivityPrinter } from '../../lib/api/util/cloudformation/stack-activity-monitor'; import { stderr } from './console-listener'; +import { HistoryActivityPrinter } from '../../lib/api/util/cloudformation/stack-activity-monitor'; let TIMESTAMP: number; let HUMAN_TIME: string; diff --git a/packages/aws-cdk/test/assets.test.ts b/packages/aws-cdk/test/assets.test.ts index c632a0cf620e0..a65679aecc37f 100644 --- a/packages/aws-cdk/test/assets.test.ts +++ b/packages/aws-cdk/test/assets.test.ts @@ -1,10 +1,10 @@ import { AssetMetadataEntry } from '@aws-cdk/cloud-assembly-schema'; -import { ToolkitInfo } from '../lib/api'; -import { addMetadataAssetsToManifest } from '../lib/assets'; -import { AssetManifestBuilder } from '../lib/util/asset-manifest-builder'; import { testStack } from './util'; import { MockSdk } from './util/mock-sdk'; import { MockToolkitInfo } from './util/mock-toolkitinfo'; +import { ToolkitInfo } from '../lib/api'; +import { addMetadataAssetsToManifest } from '../lib/assets'; +import { AssetManifestBuilder } from '../lib/util/asset-manifest-builder'; let toolkit: ToolkitInfo; let assets: AssetManifestBuilder; diff --git a/packages/aws-cdk/test/cdk-toolkit.test.ts b/packages/aws-cdk/test/cdk-toolkit.test.ts index fd77172a9dff7..8cf1db0d3160b 100644 --- a/packages/aws-cdk/test/cdk-toolkit.test.ts +++ b/packages/aws-cdk/test/cdk-toolkit.test.ts @@ -55,6 +55,7 @@ jest.mock('../lib/logging', () => ({ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; +import { instanceMockFrom, MockCloudExecutable, TestStackArtifact } from './util'; import { Bootstrapper } from '../lib/api/bootstrap'; import { CloudFormationDeployments, DeployStackOptions } from '../lib/api/cloudformation-deployments'; import { DeployStackResult } from '../lib/api/deploy-stack'; @@ -62,7 +63,6 @@ import { Template } from '../lib/api/util/cloudformation'; import { CdkToolkit, Tag } from '../lib/cdk-toolkit'; import { RequireApproval } from '../lib/diff'; import { flatten } from '../lib/util'; -import { instanceMockFrom, MockCloudExecutable, TestStackArtifact } from './util'; let cloudExecutable: MockCloudExecutable; let bootstrapper: jest.Mocked; diff --git a/packages/aws-cdk/test/diff.test.ts b/packages/aws-cdk/test/diff.test.ts index efcf5d09d05ab..c7b6f8b41129f 100644 --- a/packages/aws-cdk/test/diff.test.ts +++ b/packages/aws-cdk/test/diff.test.ts @@ -2,9 +2,9 @@ import { Writable } from 'stream'; import { NodeStringDecoder, StringDecoder } from 'string_decoder'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { CloudFormationStackArtifact } from '@aws-cdk/cx-api'; +import { instanceMockFrom, MockCloudExecutable } from './util'; import { CloudFormationDeployments } from '../lib/api/cloudformation-deployments'; import { CdkToolkit } from '../lib/cdk-toolkit'; -import { instanceMockFrom, MockCloudExecutable } from './util'; let cloudExecutable: MockCloudExecutable; let cloudFormation: jest.Mocked; diff --git a/packages/aws-cdk/test/import.test.ts b/packages/aws-cdk/test/import.test.ts index 816b89abd535d..ec970df533daf 100644 --- a/packages/aws-cdk/test/import.test.ts +++ b/packages/aws-cdk/test/import.test.ts @@ -7,10 +7,10 @@ jest.mock('promptly', () => { }); import * as promptly from 'promptly'; -import { CloudFormationDeployments } from '../lib/api/cloudformation-deployments'; -import { ResourceImporter, ImportMap } from '../lib/import'; import { testStack } from './util'; import { MockSdkProvider } from './util/mock-sdk'; +import { CloudFormationDeployments } from '../lib/api/cloudformation-deployments'; +import { ResourceImporter, ImportMap } from '../lib/import'; const promptlyConfirm = promptly.confirm as jest.Mock; const promptlyPrompt = promptly.prompt as jest.Mock; diff --git a/packages/aws-cdk/test/util.ts b/packages/aws-cdk/test/util.ts index 82447948b83cb..14fa2b79398e7 100644 --- a/packages/aws-cdk/test/util.ts +++ b/packages/aws-cdk/test/util.ts @@ -2,9 +2,9 @@ import * as fs from 'fs'; import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; +import { MockSdkProvider } from './util/mock-sdk'; import { CloudExecutable } from '../lib/api/cxapp/cloud-executable'; import { Configuration } from '../lib/settings'; -import { MockSdkProvider } from './util/mock-sdk'; export const DEFAULT_FAKE_TEMPLATE = { No: 'Resources' }; diff --git a/packages/aws-cdk/test/util/cloudformation.test.ts b/packages/aws-cdk/test/util/cloudformation.test.ts index db60e7344c110..fbb27d430a07c 100644 --- a/packages/aws-cdk/test/util/cloudformation.test.ts +++ b/packages/aws-cdk/test/util/cloudformation.test.ts @@ -1,6 +1,6 @@ import { SSMPARAM_NO_INVALIDATE } from '@aws-cdk/cx-api'; -import { CloudFormationStack, TemplateParameters } from '../../lib/api/util/cloudformation'; import { MockedObject, MockSdkProvider, SyncHandlerSubsetOf } from './mock-sdk'; +import { CloudFormationStack, TemplateParameters } from '../../lib/api/util/cloudformation'; const PARAM = 'TheParameter'; const DEFAULT = 'TheDefault'; diff --git a/packages/aws-cdk/test/util/stack-monitor.test.ts b/packages/aws-cdk/test/util/stack-monitor.test.ts index 7e2644b481b9f..67b60c79876ba 100644 --- a/packages/aws-cdk/test/util/stack-monitor.test.ts +++ b/packages/aws-cdk/test/util/stack-monitor.test.ts @@ -1,6 +1,6 @@ +import { MockSdk } from './mock-sdk'; import { StackActivityMonitor, IActivityPrinter, StackActivity } from '../../lib/api/util/cloudformation/stack-activity-monitor'; import { sleep } from '../integ/helpers/aws'; -import { MockSdk } from './mock-sdk'; let sdk: MockSdk; let printer: FakePrinter;