Skip to content

Commit

Permalink
Flatten the 'core' directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
skinny85 committed Mar 13, 2019
1 parent 91f3a10 commit b9e1193
Show file tree
Hide file tree
Showing 40 changed files with 70 additions and 71 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cxapi = require('@aws-cdk/cx-api');
import { ConstructOrder, Root } from './core/construct';
import { ConstructOrder, Root } from './construct';
import { FileSystemStore, InMemoryStore, ISynthesisSession, SynthesisSession } from './synthesis';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/aspect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IConstruct } from './core/construct';
import { IConstruct } from './construct';

/**
* Represents an Aspect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export function cloudFormationConcat(left: any | undefined, right: any | undefin
return { 'Fn::Join': ['', minimalCloudFormationJoin('', parts)] };
}

import { minimalCloudFormationJoin } from "../../cloudformation/instrinsics";
import { minimalCloudFormationJoin } from "./cloudformation/instrinsics";
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/cloudformation/arn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fn } from '../cloudformation/fn';
import { unresolved } from '../core/tokens';
import { unresolved } from '../unresolved';
import { Stack } from './stack';

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from '../core/construct';
import { ResolveContext } from '../core/tokens';
import { Construct } from '../construct';
import { ResolveContext } from '../token';
import { CfnRefElement } from './cfn-element';

export interface CfnConditionProps {
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct, IConstruct, PATH_SEP } from "../core/construct";
import { Token } from '../core/tokens';
import { Construct, IConstruct, PATH_SEP } from "../construct";
import { Token } from '../token';

const LOGICAL_ID_MD = 'aws:cdk:logicalId';

Expand Down Expand Up @@ -43,7 +43,7 @@ export abstract class CfnElement extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);

this.node.addMetadata(LOGICAL_ID_MD, new (require("../core/tokens/token").Token)(() => this.logicalId), this.constructor);
this.node.addMetadata(LOGICAL_ID_MD, new (require("../token").Token)(() => this.logicalId), this.constructor);

this._logicalId = this.node.stack.logicalIds.getLogicalId(this);
this.logicalId = new Token(() => this._logicalId).toString();
Expand Down Expand Up @@ -154,4 +154,4 @@ export abstract class CfnRefElement extends CfnElement {
}
}

import { findTokens } from "../core/tokens/resolve";
import { findTokens } from "../resolve";
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Construct } from '../core/construct';
import { Construct } from '../construct';
import { CfnRefElement } from './cfn-element';
import { Fn } from './fn';

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Construct } from '../core/construct';
import { Construct } from '../construct';
import { CfnElement } from './cfn-element';

export interface CfnOutputProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from '../core/construct';
import { Token } from '../core/tokens';
import { Construct } from '../construct';
import { Token } from '../token';
import { CfnRefElement, Ref } from './cfn-element';

export interface CfnParameterProps {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cxapi = require('@aws-cdk/cx-api');
import { Construct, IConstruct } from '../core/construct';
import { TagManager } from '../core/tag-manager';
import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/util';
import { Construct, IConstruct } from '../construct';
import { TagManager } from '../tag-manager';
import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../util';
import { CfnCondition } from './cfn-condition';
import { Reference } from './reference';
import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy';
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from '../core/construct';
import { capitalizePropertyNames } from '../core/util';
import { Construct } from '../construct';
import { capitalizePropertyNames } from '../util';
import { ICfnConditionExpression } from './cfn-condition';
import { CfnRefElement } from './cfn-element';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IConstruct } from "../core/construct";
import { Token } from "../core/tokens";
import { resolve } from "../core/tokens/resolve";
import { IConstruct } from "../construct";
import { resolve } from "../resolve";
import { Token } from "../token";
import { isIntrinsic } from "./instrinsics";

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from "../core/construct";
import { Token } from "../core/tokens";
import { Construct } from "../construct";
import { Token } from "../token";

/**
* Properties for a Dynamic Reference
Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/fn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ResolveContext, Token, unresolved } from '../core/tokens';
import { resolve } from '../core/tokens/resolve';
import { resolve } from '../resolve';
import { ResolveContext, Token } from '../token';
import { unresolved } from '../unresolved';
import { ICfnConditionExpression } from './cfn-condition';
import { minimalCloudFormationJoin } from './instrinsics';

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/cloudformation/include.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Construct } from '../core/construct';
import { Construct } from '../construct';
import { CfnElement } from './cfn-element';

export interface IncludeProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ export function canEvaluateToList(x: any) {
return isIntrinsic(x) && ['Ref', 'Fn::GetAtt', 'Fn::GetAZs', 'Fn::Split', 'Fn::FindInMap', 'Fn::ImportValue'].includes(Object.keys(x)[0]);
}

import { unresolved } from "../core/tokens/unresolved";
import { unresolved } from "../unresolved";
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from '../core/construct';
import { Token } from '../core/tokens';
import { Construct } from '../construct';
import { Token } from '../token';
import { Reference } from './reference';

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/reference.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResolveContext, Token } from "../core/tokens";
import { ResolveContext, Token } from "../token";

/**
* A Token that represents a CloudFormation reference to another resource
Expand Down Expand Up @@ -111,6 +111,6 @@ export class Reference extends Token {

}

import { Construct } from "../core/construct";
import { Construct } from "../construct";
import { CfnOutput } from "./cfn-output";
import { Stack } from "./stack";
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/secret.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from '../core/construct';
import { Token } from '../core/tokens';
import { Construct } from '../construct';
import { Token } from '../token';
import { CfnParameter } from './cfn-parameter';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/cloudformation/stack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cxapi = require('@aws-cdk/cx-api');
import { App } from '../app';
import { Construct, IConstruct, PATH_SEP } from '../core/construct';
import { Construct, IConstruct, PATH_SEP } from '../construct';
import { Environment } from '../environment';
import { ISynthesisSession } from '../synthesis';
import { CfnParameter } from './cfn-parameter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import cxapi = require('@aws-cdk/cx-api');
import { IAspect } from '../aspect';
import { CloudFormationJSON } from '../cloudformation/cloudformation-json';
import { makeUniqueId } from '../uniqueid';
import { IAspect } from './aspect';
import { CloudFormationJSON } from './cloudformation/cloudformation-json';
import { IDependable } from './dependency';
import { Token, unresolved } from './tokens';
import { resolve } from './tokens/resolve';
import { resolve } from './resolve';
import { Token } from './token';
import { makeUniqueId } from './uniqueid';
import { unresolved } from './unresolved';

export const PATH_SEP = '/';

Expand Down Expand Up @@ -737,4 +738,4 @@ export interface Dependency {
}

// Import this _after_ everything else to help node work the classes out in the correct order...
import { Stack } from '../cloudformation/stack';
import { Stack } from './cloudformation/stack';
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cxapi = require('@aws-cdk/cx-api');
import { Construct } from './core/construct';
import { Construct } from './construct';

type ContextProviderProps = {[key: string]: any};
/**
Expand Down
4 changes: 0 additions & 4 deletions packages/@aws-cdk/cdk/lib/core/tokens/index.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions packages/@aws-cdk/cdk/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export * from './aspect';
export * from './tag-aspect';

export * from './core/construct';
export * from './core/tokens';
export * from './core/tag-manager';
export * from './core/dependency';
export * from './construct';
export * from './token';
export * from './unresolved';
export * from './tag-manager';
export * from './dependency';

export * from './cloudformation/cloudformation-json';
export * from './cloudformation/reference';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IConstruct } from '../construct';
import { IConstruct } from './construct';
import { containsListToken, TOKEN_MAP } from "./encoding";
import { RESOLVE_OPTIONS } from "./options";
import { isResolvedValuePostProcessor, RESOLVE_METHOD, ResolveContext, Token } from "./token";
Expand Down Expand Up @@ -153,4 +153,4 @@ export function findTokens(scope: IConstruct, fn: () => any): Token[] {
*/
function isConstruct(x: any): boolean {
return x._children !== undefined && x._metadata !== undefined;
}
}
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Construct } from './core/construct';
import { Construct } from './construct';

// ----------------------------------------------------------------------
// PROPERTY MAPPERS
Expand Down Expand Up @@ -388,4 +388,4 @@ function isCloudFormationIntrinsic(x: any) {
// Cannot be public because JSII gets confused about es5.d.ts
class CfnSynthesisError extends Error {
public readonly type = 'CfnSynthesisError';
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/tag-aspect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IAspect } from './aspect';
import { CfnResource, ITaggable } from './cloudformation/cfn-resource';
import { IConstruct } from './core/construct';
import { IConstruct } from './construct';

/**
* Properties for a tag
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TagType } from '../cloudformation/cfn-resource';
import { CfnTag } from '../cloudformation/tag';
import { TagType } from './cloudformation/cfn-resource';
import { CfnTag } from './cloudformation/tag';

interface Tag {
key: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IConstruct } from "../construct";
import { IConstruct } from "./construct";
import { TOKEN_MAP } from "./encoding";

/**
Expand Down Expand Up @@ -147,4 +147,4 @@ export interface IResolvedValuePostProcessor {
*/
export function isResolvedValuePostProcessor(x: any): x is IResolvedValuePostProcessor {
return x.postProcess !== undefined;
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/uniqueid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function makeUniqueId(components: string[]) {
}

// Lazy require in order to break a module dependency cycle
const unresolvedTokens = components.filter(c => require('./core/tokens').unresolved(c));
const unresolvedTokens = components.filter(c => require('./unresolved').unresolved(c));
if (unresolvedTokens.length > 0) {
throw new Error(`ID components may not include unresolved tokens: ${unresolvedTokens.join(',')}`);
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IConstruct } from "./construct";
import { IResolvedValuePostProcessor, ResolveContext, Token } from "./tokens";
import { IResolvedValuePostProcessor, ResolveContext, Token } from "./token";

/**
* Given an object, converts all keys to PascalCase given they are currently in camel case.
Expand Down Expand Up @@ -61,4 +61,4 @@ export class PostResolveToken extends Token implements IResolvedValuePostProcess
public postProcess(o: any, _context: ResolveContext): any {
return this.processor(o);
}
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/test/test.aspect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test } from 'nodeunit';
import { IAspect } from '../lib/aspect';
import { IConstruct, Root } from '../lib/core/construct';
import { IConstruct, Root } from '../lib/construct';

class MyConstruct extends Root {
public static IsMyConstruct(x: any): x is MyConstruct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cxapi = require('@aws-cdk/cx-api');
import { Test } from 'nodeunit';
import { ArnComponents, Construct, ConstructOrder, Root, Stack, Token } from '../../lib';
import { ArnComponents, Construct, ConstructOrder, Root, Stack, Token } from '../lib';

// tslint:disable:variable-name
// tslint:disable:max-line-length
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test } from 'nodeunit';
import { TagType } from '../../lib/cloudformation/cfn-resource';
import { TagManager } from '../../lib/core/tag-manager';
import { TagType } from '../lib/cloudformation/cfn-resource';
import { TagManager } from '../lib/tag-manager';

export = {
'#setTag() supports setting a tag regardless of Type'(test: Test) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test } from 'nodeunit';
import { Fn, Root, Token, unresolved } from '../../lib';
import { evaluateCFN } from '../cloudformation/evaluate-cfn';
import { Fn, Root, Token, unresolved } from '../lib';
import { evaluateCFN } from './cloudformation/evaluate-cfn';

export = {
'resolve a plain old object should just return the object'(test: Test) {
Expand Down Expand Up @@ -435,4 +435,4 @@ function tokensThatResolveTo(value: string): Token[] {
*/
function resolve(x: any) {
return new Root().node.resolve(x);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test } from 'nodeunit';
import { Root } from '../../lib';
import { capitalizePropertyNames, ignoreEmpty } from '../../lib/core/util';
import { Root } from '../lib';
import { capitalizePropertyNames, ignoreEmpty } from '../lib/util';

export = {
'capitalizeResourceProperties capitalizes all keys of an object (recursively) from camelCase to PascalCase'(test: Test) {
Expand Down

0 comments on commit b9e1193

Please sign in to comment.