diff --git a/build.sh b/build.sh index 8a087c7ac0..36fce19ef1 100755 --- a/build.sh +++ b/build.sh @@ -12,10 +12,10 @@ export PATH=node_modules/.bin:$PATH echo "=============================================================================================" echo "building..." -lerna run build +lerna run build --stream echo "=============================================================================================" echo "testing..." -lerna run test +lerna run test --stream touch $BUILD_INDICATOR diff --git a/packages/jsii-calc/package.json b/packages/jsii-calc/package.json index 9911aaffdd..16be7c15f4 100644 --- a/packages/jsii-calc/package.json +++ b/packages/jsii-calc/package.json @@ -24,6 +24,7 @@ }, "scripts": { "build": "jsii", + "watch": "jsii -w", "test": "node test/test.calc.js && diff-test test/assembly.jsii .jsii" }, "bundledDependencies": [ diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index ecdb75f4c4..686d5771ea 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -2827,9 +2827,15 @@ "kind": "enum", "members": [ { + "docs": { + "comment": "Normal string expression " + }, "name": "Normal" }, { + "docs": { + "comment": "Decorated string expression " + }, "name": "Decorated" } ], @@ -2838,5 +2844,5 @@ } }, "version": "0.6.4", - "fingerprint": "J/33pyDX7y9AI1Vizdu+HEO/87ED05WoSxg41CSYHtw=" + "fingerprint": "A6PSlMkLYrySPqgKflMrn2U4DjO6HO+VAJrO66IcSlo=" } diff --git a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs index 0b09b30c51..5425aa009b 100644 --- a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs +++ b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs @@ -178,7 +178,7 @@ public void UnionTypes() IDictionary map = new Dictionary(); map["Foo"] = new Multiply(new Number(2), new Number(00)); types.UnionMapProperty = map; - + // array types.UnionArrayProperty = new object[] { "Hello", 123, new Number(3) }; @@ -571,7 +571,7 @@ public void InterfaceBuilder() throw new NotImplementedException(); } - + [Fact(DisplayName = Prefix + nameof(SyncOverrides_SyncOverrides))] public void SyncOverrides_SyncOverrides() { diff --git a/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java b/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java index 192ed5dcd7..3c0c142ab5 100644 --- a/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java +++ b/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java @@ -245,11 +245,11 @@ private JsiiObject createNative(final String fqn) { } catch (NoSuchMethodException e) { throw new JsiiException("Cannot create native object of type " + klass.getName() - + " without a constructor that accepts an InitializationMode argument"); + + " without a constructor that accepts an InitializationMode argument", e); } catch (IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new JsiiException("Unable to instantiate a new object for FQN " + fqn + ": " - + e.getMessage()); + + e.getMessage(), e); } } catch (ClassNotFoundException e) { System.err.println("WARNING: Cannot find the class: " + fqn + ". Defaulting to JsiiObject"); diff --git a/packages/jsii-pacmak/test/.gitattributes b/packages/jsii-pacmak/test/.gitattributes new file mode 100644 index 0000000000..5406df2281 --- /dev/null +++ b/packages/jsii-pacmak/test/.gitattributes @@ -0,0 +1,2 @@ +# Generated C# code will have CRLF line endings, making git pretty awkward +.cs eol=crlf diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index ecdb75f4c4..686d5771ea 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -2827,9 +2827,15 @@ "kind": "enum", "members": [ { + "docs": { + "comment": "Normal string expression " + }, "name": "Normal" }, { + "docs": { + "comment": "Decorated string expression " + }, "name": "Decorated" } ], @@ -2838,5 +2844,5 @@ } }, "version": "0.6.4", - "fingerprint": "J/33pyDX7y9AI1Vizdu+HEO/87ED05WoSxg41CSYHtw=" + "fingerprint": "A6PSlMkLYrySPqgKflMrn2U4DjO6HO+VAJrO66IcSlo=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation/CompositionStringStyle.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation/CompositionStringStyle.cs index b20e6ab251..0f163d9da8 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation/CompositionStringStyle.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/composition/CompositeOperation/CompositionStringStyle.cs @@ -6,8 +6,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.composition.CompositeOperation [JsiiEnum(typeof(CompositionStringStyle), "jsii-calc.composition.CompositeOperation.CompositionStringStyle")] public enum CompositionStringStyle { + /// Normal string expression [JsiiEnumMember("Normal")] Normal, + /// Decorated string expression [JsiiEnumMember("Decorated")] Decorated } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java index cbd2427590..1caf2d1f8e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/composition/CompositeOperation.java @@ -80,7 +80,13 @@ public void setStringStyle(final software.amazon.jsii.tests.calculator.compositi */ @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.composition.CompositeOperation.CompositionStringStyle") public enum CompositionStringStyle { + /** + * Normal string expression + */ Normal, + /** + * Decorated string expression + */ Decorated, } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst index 9ba193c252..3f8b23b908 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst +++ b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst @@ -2627,8 +2627,14 @@ CompositeOperation .. py:data:: Normal + Normal string expression + + .. py:data:: Decorated + Decorated string expression + + diff --git a/packages/jsii-spec/lib/spec.ts b/packages/jsii-spec/lib/spec.ts index 8630efa86a..43d239cda7 100644 --- a/packages/jsii-spec/lib/spec.ts +++ b/packages/jsii-spec/lib/spec.ts @@ -228,8 +228,8 @@ export interface NamedTypeReference extends TypeReferenceBase { */ fqn: string; } -export function isNamedTypeReference(ref: TypeReference): ref is NamedTypeReference { - return !!(ref as NamedTypeReference).fqn; +export function isNamedTypeReference(ref: TypeReference | undefined): ref is NamedTypeReference { + return ref != null && !!(ref as NamedTypeReference).fqn; } /** @@ -242,8 +242,8 @@ export interface PrimitiveTypeReference extends TypeReferenceBase { */ primitive: PrimitiveType; } -export function isPrimitiveTypeReference(ref: TypeReference): ref is PrimitiveTypeReference { - return !!(ref as PrimitiveTypeReference).primitive; +export function isPrimitiveTypeReference(ref: TypeReference | undefined): ref is PrimitiveTypeReference { + return ref != null && !!(ref as PrimitiveTypeReference).primitive; } /** @@ -262,8 +262,8 @@ export interface CollectionTypeReference extends TypeReferenceBase { elementtype: TypeReference; }; } -export function isCollectionTypeReference(ref: TypeReference): ref is CollectionTypeReference { - return !!(ref as CollectionTypeReference).collection; +export function isCollectionTypeReference(ref: TypeReference | undefined): ref is CollectionTypeReference { + return ref != null && !!(ref as CollectionTypeReference).collection; } /** @@ -281,8 +281,8 @@ export interface UnionTypeReference extends TypeReferenceBase { types: TypeReference[]; } } -export function isUnionTypeReference(ref: TypeReference): ref is UnionTypeReference { - return !!(ref as UnionTypeReference).union; +export function isUnionTypeReference(ref: TypeReference | undefined): ref is UnionTypeReference { + return ref != null && !!(ref as UnionTypeReference).union; } /** @@ -497,8 +497,8 @@ export interface ClassType extends TypeBase { interfaces?: NamedTypeReference[]; } -export function isClassType(type: Type): type is ClassType { - return type.kind === TypeKind.Class; +export function isClassType(type: Type | undefined): type is ClassType { + return type != null && type.kind === TypeKind.Class; } export interface InterfaceType extends TypeBase { @@ -529,8 +529,8 @@ export interface InterfaceType extends TypeBase { datatype?: boolean; } -export function isInterfaceType(type: Type): type is InterfaceType { - return type.kind === TypeKind.Interface; +export function isInterfaceType(type: Type | undefined): type is InterfaceType { + return type != null && type.kind === TypeKind.Interface; } /** @@ -555,14 +555,14 @@ export interface EnumType extends TypeBase { members: EnumMember[]; } -export function isEnumType(type: Type): type is EnumType { - return type.kind === TypeKind.Enum; +export function isEnumType(type: Type | undefined): type is EnumType { + return type != null && type.kind === TypeKind.Enum; } /** * Return whether this type is a class or interface type */ -export function isClassOrInterfaceType(type: Type): type is (InterfaceType | ClassType) { +export function isClassOrInterfaceType(type: Type | undefined): type is (InterfaceType | ClassType) { return isClassType(type) || isInterfaceType(type); } diff --git a/packages/jsii-spec/test/tsconfig.json b/packages/jsii-spec/test/tsconfig.json deleted file mode 100644 index b8b7a9e63c..0000000000 --- a/packages/jsii-spec/test/tsconfig.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["es2016", "es2017.object", "es2017.string"], /* Specify library files to be included in the compilation: */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* Enable strict null checks. */ - "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - "strictPropertyInitialization": false, /* DO NOT Raise error on class attribute not initialized by constructor. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": false, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": false, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - }, - "include": [ - "**/*.ts" - ], - "exclude": [ - "**/*.d.ts" - ], - "references": [ - { "path": ".." } - ] -} diff --git a/packages/jsii/.npmignore b/packages/jsii/.npmignore index de10b2c441..4d27b48a2d 100644 --- a/packages/jsii/.npmignore +++ b/packages/jsii/.npmignore @@ -1,3 +1,3 @@ -# Don't include original .ts files when doing `npm pack` -*.ts +* +!*.js !*.d.ts diff --git a/packages/jsii/bin/jsii.ts b/packages/jsii/bin/jsii.ts old mode 100755 new mode 100644 index 838a64fcab..5506559e69 --- a/packages/jsii/bin/jsii.ts +++ b/packages/jsii/bin/jsii.ts @@ -1,30 +1,89 @@ -#!/usr/bin/env node -import * as yargs from 'yargs'; -import { bundle } from '../lib/bundle'; +import log4js = require('log4js'); +import path = require('path'); +import process = require('process'); +import ts = require('typescript'); +import yargs = require('yargs'); +import { Compiler, DIAGNOSTICS } from '../lib/compiler'; +import { hasDomain } from '../lib/emitter'; +import { loadProjectInfo } from '../lib/project-info'; +import utils = require('../lib/utils'); import { VERSION } from '../lib/version'; -import { watch } from '../lib/watch'; -process.on('unhandledRejection', err => { +(async () => { + const argv = yargs + .env('JSII') + .option('watch', { alias: 'w', type: 'boolean', desc: 'Watch for file changes and recompile automatically' }) + .option('verbose', { alias: 'v', type: 'count', desc: 'Increase the verbosity of output', global: true }) + .help() + .version(VERSION) + .argv; + + _configureLog4js(argv.verbose); + + const projectRoot = path.normalize(path.resolve(process.cwd(), argv._[0] || '.')); + + const compiler = new Compiler({ + projectInfo: await loadProjectInfo(projectRoot), + watch: argv.watch + }); + return { projectRoot, emitResult: await compiler.emit() }; +})().then(({ projectRoot, emitResult }) => { + for (const diagnostic of emitResult.diagnostics) { + _logDiagnostic(diagnostic, projectRoot); + } + if (emitResult.emitSkipped) { + process.exit(1); + } +}).catch(e => { // tslint:disable-next-line:no-console - console.error(err.stack); - process.exit(1); + console.error(`Error: ${e.stack}`); + process.exit(-1); }); -async function main(dir: string, args: any) { - if (args.watch) { - return await watch(dir); - } +function _configureLog4js(verbosity: number) { + log4js.configure({ + appenders: { + console: { + type: 'stderr', + layout: { type: 'colored' } + }, + diagnostics: { + type: 'stdout', + layout: { type: 'messagePassThrough' } + } + }, + categories: { + default: { appenders: ['console'], level: _logLevel() }, + [DIAGNOSTICS]: { appenders: ['diagnostics'], level: _logLevel() } + } + }); - return await bundle(dir); + function _logLevel(): keyof log4js.Levels { + switch (verbosity) { + case 0: return 'WARN'; + case 1: return 'INFO'; + case 2: return 'DEBUG'; + case 3: return 'TRACE'; + default: return 'ALL'; + } + } } -const argv = yargs - .usage('Usage: jsii [options]') - .option('watch', { alias: 'w', desc: 'alias for tsc --watch (tsconfig.json will be created)' }) - .version(VERSION) - .argv; +function _logDiagnostic(diagnostic: ts.Diagnostic, projectRoot: string) { + const formatDiagnosticsHost = { + getCurrentDirectory: () => projectRoot, + getCanonicalFileName(fileName: string) { return fileName; }, + getNewLine() { return '\n'; } + }; -main(process.cwd(), argv).catch(err => { - process.stderr.write(err.stack + '\n'); - process.exit(1); -}); + let message = diagnostic.file + ? ts.formatDiagnosticsWithColorAndContext([diagnostic], formatDiagnosticsHost) + : ts.formatDiagnostics([diagnostic], formatDiagnosticsHost); + if (hasDomain(diagnostic)) { + // Make sure error codes don't render as ``TS123``, instead e.g: ``JSII123``. + message = message.replace(/([^\w])TS(\d+)([^\w])/, `$1${diagnostic.domain}$2$3`); + } + const logFunc = utils.diagnosticsLogger(log4js.getLogger(DIAGNOSTICS), diagnostic); + if (!logFunc) { return; } + logFunc(message.trim()); +} diff --git a/packages/jsii/lib/assembler.ts b/packages/jsii/lib/assembler.ts new file mode 100644 index 0000000000..ac3063a5a7 --- /dev/null +++ b/packages/jsii/lib/assembler.ts @@ -0,0 +1,879 @@ +import colors = require('colors/safe'); +import crypto = require('crypto'); +import deepEqual = require('deep-equal'); +import fs = require('fs-extra'); +import spec = require('jsii-spec'); +import log4js = require('log4js'); +import path = require('path'); +import ts = require('typescript'); +import { Diagnostic, Emitter } from './emitter'; +import literate = require('./literate'); +import { ProjectInfo } from './project-info'; +import utils = require('./utils'); +import { Validator } from './validator'; + +// tslint:disable:no-var-requires Modules without TypeScript definitions +const sortJson = require('sort-json'); +// tslint:enable:no-var-requires + +const LOG = log4js.getLogger('jsii/assembler'); + +/** + * The JSII Assembler consumes a ``ts.Program`` instance and emits a JSII assembly. + */ +export class Assembler implements Emitter { + private _diagnostics = new Array(); + private _deferred = new Array<() => void>(); + private _types: { [fqn: string]: spec.Type }; + + /** + * @param projectInfo information about the package being assembled + * @param program the TypeScript program to be assembled from + */ + public constructor(public readonly projectInfo: ProjectInfo, + public readonly program: ts.Program) {} + + private get _typeChecker(): ts.TypeChecker { + return this.program.getTypeChecker(); + } + + /** + * Attempt emitting the JSII assembly for the program. + * + * @return the result of the assembly emission. + */ + public async emit(): Promise { + this._diagnostics = []; + if (!this.projectInfo.description) { + this._diagnostic(null, + ts.DiagnosticCategory.Suggestion, + 'A "description" field should be specified in "package.json"'); + } + if (!this.projectInfo.homepage) { + this._diagnostic(null, + ts.DiagnosticCategory.Suggestion, + 'A "homepage" field should be specified in "package.json"'); + } + const readme = await _loadReadme.call(this); + if (!readme) { + this._diagnostic(null, + ts.DiagnosticCategory.Suggestion, + 'There is not "README.md" file. It is recommended to have one.'); + } + + this._types = {}; + this._deferred = []; + const mainFile = this.projectInfo.types.replace(/\.d\.ts(x?)$/, '.ts$1'); + for (const sourceFile of this.program.getSourceFiles().filter(f => !f.isDeclarationFile)) { + if (sourceFile.fileName !== mainFile) { continue; } + if (LOG.isTraceEnabled()) { + LOG.trace(`Processing source file: ${colors.blue(path.relative(this.projectInfo.projectRoot, sourceFile.fileName))}`); + } + const symbol = this._typeChecker.getSymbolAtLocation(sourceFile); + if (!symbol) { continue; } + for (const node of this._typeChecker.getExportsOfModule(symbol)) { + await this._visitNode(node.declarations[0]); + } + } + for (const deferred of this._deferred) { + deferred(); + } + + // Skip emitting if any diagnostic message is an error + if (this._diagnostics.find(diag => diag.category === ts.DiagnosticCategory.Error) != null) { + LOG.debug('Skipping emit due to errors.'); + // Clearing ``this._types`` to allow contents to be garbage-collected. + delete this._types; + try { + return { diagnostics: this._diagnostics, emitSkipped: true }; + } finally { + // Clearing ``this._diagnostics`` and ``this._deferred`` to allow contents to be garbage-collected. + delete this._diagnostics; + delete this._deferred; + } + } + + const assembly = { + schema: spec.SchemaVersion.V1_0, + name: this.projectInfo.name, + version: this.projectInfo.version, + description: this.projectInfo.description || this.projectInfo.name, + license: this.projectInfo.license, + homepage: this.projectInfo.homepage || this.projectInfo.repository.url, + author: this.projectInfo.author, + contributors: this.projectInfo.contributors && [...this.projectInfo.contributors], + repository: this.projectInfo.repository, + dependencies: _toDependencies(this.projectInfo.dependencies), + bundled: this.projectInfo.bundleDependencies, + types: this._types, + targets: this.projectInfo.targets, + readme, + fingerprint: '' + }; + + const validator = new Validator(this.projectInfo, assembly); + const validationResult = await validator.emit(); + if (!validationResult.emitSkipped) { + const assemblyPath = path.join(this.projectInfo.projectRoot, '.jsii'); + LOG.trace(`Emitting assembly: ${colors.blue(assemblyPath)}`); + await fs.writeJson(assemblyPath, _fingerprint(assembly), { replacer: utils.filterEmpty, spaces: 2 }); + } + + // Clearing ``this._types`` to allow contents to be garbage-collected. + delete this._types; + + try { + return { + diagnostics: [...this._diagnostics, ...validationResult.diagnostics], + emitSkipped: validationResult.emitSkipped + }; + } finally { + // Clearing ``this._diagnostics`` and ``this._deferred`` to allow contents to be garbage-collected. + delete this._diagnostics; + delete this._deferred; + } + + async function _loadReadme(this: Assembler) { + const readmePath = path.join(this.projectInfo.projectRoot, 'README.md'); + if (!await fs.pathExists(readmePath)) { return undefined; } + const renderedLines = await literate.includeAndRenderExamples( + await literate.loadFromFile(readmePath), + literate.fileSystemLoader(this.projectInfo.projectRoot) + ); + return { markdown: renderedLines.join('\n') }; + } + } + + /** + * Defer checks for after the program has been entirely processed; useful for verifying type references that may not + * have been discovered yet, and verifying properties about them. + * + * @param cb the function to be called in a deferred way. It will be bound with ``this``, so it can depend on using + * ``this``. + */ + private _defer(cb: () => void) { + this._deferred.push(cb.bind(this)); + } + + /** + * Obtains the ``spec.Type`` for a given ``spec.NamedTypeReference``. + * + * @param ref the type reference to be de-referenced + * + * @returns the de-referenced type, if it was found, otherwise ``undefined``. + */ + private _dereference(ref: spec.NamedTypeReference): spec.Type | undefined { + const [assm, ] = ref.fqn.split('.'); + if (assm === this.projectInfo.name) { + return this._types[ref.fqn]; + } else { + const assembly = this.projectInfo.transitiveDependencies.find(dep => dep.name === assm); + return assembly && assembly.types && assembly.types[ref.fqn]; + } + } + + private _diagnostic(node: ts.Node | null, category: ts.DiagnosticCategory, messageText: string) { + this._diagnostics.push({ + domain: 'JSII', + category, code: 0, + messageText, + file: node != null ? node.getSourceFile() : undefined, + start: node != null ? node.getStart() : undefined, + length: node != null ? node.getEnd() - node.getStart() : undefined + }); + } + + /** + * Compute the JSII fully qualified name corresponding to a ``ts.Type`` instance. If for any reason a name cannot be + * computed for the type, a marker is returned instead, and an ``ts.DiagnosticCategory.Error`` diagnostic is + * inserted in the assembler context. + * + * @param type the type for which a JSII fully qualified name is neede. + * + * @returns the FQN of the type, or some "unknown" marker. + */ + private async _getFQN(type: ts.Type): Promise { + const tsName = this._typeChecker.getFullyQualifiedName(type.symbol); + const groups = tsName.match(/^\"([^\"]+)\"\.(.*)$/); + if (!groups) { + this._diagnostic(type.symbol.valueDeclaration, ts.DiagnosticCategory.Error, `Cannot use private type ${tsName} in exported declarations`); + return tsName; + } + const [, modulePath, typeName, ] = groups; + const pkg = await _findPackageInfo(modulePath); + if (!pkg) { + this._diagnostic(type.symbol.valueDeclaration, ts.DiagnosticCategory.Error, `Could not find module for ${modulePath}`); + return `unknown.${typeName}`; + } + const fqn = `${pkg.name}.${typeName}`; + if (pkg.name !== this.projectInfo.name && !this._dereference({ fqn })) { + this._diagnostic(type.symbol.valueDeclaration, + ts.DiagnosticCategory.Error, + `Use of foreign type not present in the ${pkg.name}'s assembly: ${fqn}`); + } + return fqn; + + async function _findPackageInfo(fromDir: string): Promise { + const filePath = path.join(fromDir, 'package.json'); + if (await fs.pathExists(filePath)) { + return await fs.readJson(filePath); + } + const parent = path.dirname(fromDir); + if (parent === fromDir) { return undefined; } + return await _findPackageInfo(parent); + } + } + + /** + * Register exported types in ``this.types``. + * + * @param node a node found in a module + * @param namePrefix the prefix for the types' namespaces + */ + private async _visitNode(node: ts.Declaration, namePrefix: string[] = []): Promise { + // tslint:disable-next-line:no-bitwise Ignore nodes that are not export declarations + if ((ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export) === 0) { return []; } + + let jsiiType: spec.Type | undefined; + + if (ts.isClassDeclaration(node) && _isExported(node)) { + jsiiType = await this._visitClass(this._typeChecker.getTypeAtLocation(node), namePrefix); + } else if (ts.isInterfaceDeclaration(node) && _isExported(node)) { + jsiiType = await this._visitInterface(this._typeChecker.getTypeAtLocation(node), namePrefix); + } else if (ts.isEnumDeclaration(node) && _isExported(node)) { + jsiiType = await this._visitEnum(this._typeChecker.getTypeAtLocation(node), namePrefix); + } else if (ts.isModuleDeclaration(node)) { + const moduleType = this._typeChecker.getTypeAtLocation(node); + if (LOG.isTraceEnabled()) { + LOG.trace(`Entering namespace: ${colors.cyan([...namePrefix, moduleType.symbol.name].join('.'))}`); + } + const allTypes = new Array(); + for (const prop of moduleType.getProperties()) { + allTypes.push(...await this._visitNode(prop.valueDeclaration, namePrefix.concat(node.name.getText()))); + } + if (LOG.isTraceEnabled()) { + LOG.trace(`Leaving namespace: ${colors.cyan([...namePrefix, moduleType.symbol.name].join('.'))}`); + } + return allTypes; + } else { + this._diagnostic(node, ts.DiagnosticCategory.Message, `Skipping ${ts.SyntaxKind[node.kind]} node`); + } + + if (!jsiiType) { return []; } + if (LOG.isInfoEnabled()) { + LOG.info(`Registering JSII ${colors.magenta(jsiiType.kind)}: ${colors.green(jsiiType.fqn)}`); + } + this._types[jsiiType.fqn] = jsiiType; + + const type = this._typeChecker.getTypeAtLocation(node); + if (type.symbol.exports) { + const nestedPrefix = [...namePrefix, type.symbol.name]; + for (const exportedNode of this._typeChecker.getExportsOfModule(type.symbol).filter(s => s.declarations)) { + const nestedTypes = await this._visitNode(exportedNode.declarations[0], nestedPrefix); + for (const nestedType of nestedTypes) { + if (nestedType.namespace !== nestedPrefix.join('.')) { + this._diagnostic(node, + ts.DiagnosticCategory.Error, + // tslint:disable-next-line:max-line-length + `All child names of a type '${jsiiType.fqn}' must point to concrete types, but '${nestedType.namespace}' is a namespaces, and this structure cannot be supported in all languages (e.g. Java)`); + } + } + } + } + + return [jsiiType]; + } + + private async _visitClass(type: ts.Type, namespace: string[]): Promise { + if (LOG.isTraceEnabled()) { + LOG.trace(`Processing class: ${colors.gray(namespace.join('.'))}.${colors.cyan(type.symbol.name)}`); + } + + const jsiiType: spec.ClassType = { + assembly: this.projectInfo.name, + fqn: `${[this.projectInfo.name, ...namespace].join('.')}.${type.symbol.name}`, + kind: spec.TypeKind.Class, + name: type.symbol.name, + namespace: namespace.join('.') + }; + + if (_isAbstract(type.symbol)) { + jsiiType.abstract = true; + } + for (const base of (type.getBaseTypes() || [])) { + if (jsiiType.base) { + this._diagnostic(base.symbol.valueDeclaration, ts.DiagnosticCategory.Error, `Found multiple base types for ${jsiiType.fqn}`); + continue; + } + const ref = await this._typeReference(base, type.symbol.valueDeclaration); + if (!spec.isNamedTypeReference(ref)) { + this._diagnostic(base.symbol.valueDeclaration, + ts.DiagnosticCategory.Error, + `Base type of ${jsiiType.fqn} is not a named type (${spec.describeTypeReference(ref)})`); + continue; + } + this._defer(() => { + if (!spec.isClassType(this._dereference(ref))) { + this._diagnostic(base.symbol.valueDeclaration, + ts.DiagnosticCategory.Error, + `Base type of ${jsiiType.fqn} is not a class (${spec.describeTypeReference(ref)})`); + } + }); + jsiiType.base = ref; + } + for (const clause of (type.symbol.valueDeclaration as ts.ClassDeclaration).heritageClauses || []) { + if (clause.token === ts.SyntaxKind.ExtendsKeyword) { + // Handled by `getBaseTypes` + continue; + } else if (clause.token !== ts.SyntaxKind.ImplementsKeyword) { + this._diagnostic(clause, ts.DiagnosticCategory.Error, `Ignoring ${ts.SyntaxKind[clause.token]} heritage clause`); + continue; + } + for (const expression of clause.types) { + const iface = this._typeChecker.getTypeFromTypeNode(expression); + const typeRef = await this._typeReference(iface, iface.symbol.valueDeclaration); + if (!spec.isNamedTypeReference(typeRef)) { + this._diagnostic(expression, + ts.DiagnosticCategory.Error, + `Interface of ${jsiiType.fqn} is not a named type (${spec.describeTypeReference(typeRef)})`); + continue; + } + this._defer(() => { + if (!spec.isInterfaceType(this._dereference(typeRef))) { + this._diagnostic(expression, + ts.DiagnosticCategory.Error, + `Implements clause of ${jsiiType.fqn} uses ${spec.describeTypeReference(typeRef)} as an interface`); + } + }); + if (jsiiType.interfaces) { + jsiiType.interfaces.push(typeRef); + } else { + jsiiType.interfaces = [typeRef]; + } + } + } + + for (const memberDecl of (type.symbol.valueDeclaration as ts.ClassDeclaration | ts.InterfaceDeclaration).members) { + const member: ts.Symbol = (memberDecl as any).symbol; + if (!(type.symbol.getDeclarations() || []).find(decl => decl === memberDecl.parent)) { continue; } + if (_isHidden(member)) { continue; } + if (ts.isMethodDeclaration(memberDecl) || ts.isMethodSignature(memberDecl)) { + await this._visitMethod(member, jsiiType); + } else if (ts.isPropertyDeclaration(memberDecl) + || ts.isPropertySignature(memberDecl) + || ts.isAccessor(memberDecl)) { + await this._visitProperty(member, jsiiType); + } else { + this._diagnostic(memberDecl, + ts.DiagnosticCategory.Warning, + `Ignoring un-handled ${ts.SyntaxKind[memberDecl.kind]} member`); + } + } + + const constructor = type.symbol.members && type.symbol.members.get(ts.InternalSymbolName.Constructor); + const ctorDeclaration = constructor && (constructor.declarations[0] as ts.ConstructorDeclaration); + if (constructor && ctorDeclaration) { + // tslint:disable-next-line:no-bitwise + if ((ts.getCombinedModifierFlags(ctorDeclaration) & ts.ModifierFlags.Private) === 0) { + const signature = this._typeChecker.getSignatureFromDeclaration(ctorDeclaration); + jsiiType.initializer = { initializer: true }; + if (signature) { + for (const param of signature.getParameters()) { + jsiiType.initializer.parameters = jsiiType.initializer.parameters || []; + jsiiType.initializer.parameters.push(await this._toParameter(param)); + if (ts.isParameterPropertyDeclaration(param.valueDeclaration)) { + this._visitProperty(param, jsiiType); + } + jsiiType.initializer.variadic = jsiiType.initializer.parameters + && jsiiType.initializer.parameters.find(p => !!p.variadic) != null; + } + } + this._visitDocumentation(constructor, jsiiType.initializer); + } + } else if (jsiiType.base) { + const baseType = this._dereference(jsiiType.base); + if (!baseType) { + this._diagnostic(type.symbol.valueDeclaration, + ts.DiagnosticCategory.Error, + `Unable to resolve type ${jsiiType.base.fqn} (base type of ${jsiiType.fqn})`); + } else if (spec.isClassType(baseType)) { + jsiiType.initializer = baseType.initializer; + } else { + this._diagnostic(type.symbol.valueDeclaration, + ts.DiagnosticCategory.Error, + `Base type of ${jsiiType.fqn} (${jsiiType.base.fqn}) is not a class`); + } + } else { + jsiiType.initializer = { initializer: true }; + } + + return _sortMembers(this._visitDocumentation(type.symbol, jsiiType)); + } + + private async _visitEnum(type: ts.Type, namespace: string[]): Promise { + if (LOG.isTraceEnabled()) { + LOG.trace(`Processing enum: ${colors.gray(namespace.join('.'))}.${colors.cyan(type.symbol.name)}`); + } + + const jsiiType: spec.EnumType = { + assembly: this.projectInfo.name, + fqn: `${[this.projectInfo.name, ...namespace].join('.')}.${type.symbol.name}`, + kind: spec.TypeKind.Enum, + members: ((type as ts.UnionType).types || []) + .map(m => this._visitDocumentation(m.symbol, { name: m.symbol.name })), + name: type.symbol.name, + namespace: namespace.join('.') + }; + + this._visitDocumentation(type.symbol, jsiiType); + + return jsiiType; + } + + /** + * Register documentations on a ``spec.Documentable`` entry. + * + * @param symbol the symbol holding the JSDoc information + * @param documentable the entity being documented + * + * @returns ``documentable`` + */ + private _visitDocumentation(symbol: ts.Symbol | ts.Signature, documentable: T): T { + const comment = ts.displayPartsToString(symbol.getDocumentationComment(this._typeChecker)); + if (comment) { + if (LOG.isTraceEnabled()) { + LOG.trace(`Found documentation comment: ${colors.yellow(comment)}`); + } + if (documentable.docs) { + documentable.docs.comment = comment; + } else { + documentable.docs = { comment }; + } + } + + for (const tagInfo of symbol.getJsDocTags().filter(tag => tag.text && tag.name !== 'param')) { + const tagName = _normalizeTag(tagInfo.name); + if (LOG.isTraceEnabled()) { + LOG.trace(`Found documentation tag ${colors.magenta(tagInfo.name)}: ${colors.yellow(tagInfo.text!)}`); + } + if (documentable.docs) { + documentable.docs[tagName] = tagInfo.text!; + } else { + documentable.docs = { [tagName]: tagInfo.text! }; + } + } + + return documentable; + + function _normalizeTag(name: string): string { + switch (name) { + case 'returns': + return 'return'; + default: + return name; + } + } + } + + private async _visitInterface(type: ts.Type, namespace: string[]): Promise { + if (LOG.isTraceEnabled()) { + LOG.trace(`Processing interface: ${colors.gray(namespace.join('.'))}.${colors.cyan(type.symbol.name)}`); + } + + const jsiiType: spec.InterfaceType = { + assembly: this.projectInfo.name, + fqn: `${[this.projectInfo.name, ...namespace].join('.')}.${type.symbol.name}`, + kind: spec.TypeKind.Interface, + name: type.symbol.name, + namespace: namespace.join('.') + }; + for (const base of (type.getBaseTypes() || [])) { + const ref = await this._typeReference(base, type.symbol.valueDeclaration); + if (!spec.isNamedTypeReference(ref)) { + this._diagnostic(base.symbol.valueDeclaration, + ts.DiagnosticCategory.Error, + `Base type of ${jsiiType.fqn} is not a named type (${spec.describeTypeReference(ref)})`); + continue; + } + if (!spec.isInterfaceType(this._dereference(ref))) { + this._diagnostic(base.symbol.valueDeclaration, + ts.DiagnosticCategory.Error, + `Base type of ${jsiiType.fqn} is not an interface (${spec.describeTypeReference(ref)})`); + continue; + } + if (jsiiType.interfaces) { + jsiiType.interfaces.push(ref); + } else { + jsiiType.interfaces = [ref]; + } + } + for (const member of type.getProperties()) { + if (!(type.symbol.getDeclarations() || []).find(decl => decl === member.valueDeclaration.parent)) { continue; } + if (_isHidden(member)) { continue; } + if (ts.isMethodDeclaration(member.valueDeclaration) || ts.isMethodSignature(member.valueDeclaration)) { + await this._visitMethod(member, jsiiType); + } else if (ts.isPropertyDeclaration(member.valueDeclaration) + || ts.isPropertySignature(member.valueDeclaration) + || ts.isAccessor(member.valueDeclaration)) { + await this._visitProperty(member, jsiiType); + } else { + this._diagnostic(member.valueDeclaration, + ts.DiagnosticCategory.Warning, + `Ignoring un-handled ${ts.SyntaxKind[member.valueDeclaration.kind]} member`); + } + } + if ((jsiiType.methods || []).length === 0 && (jsiiType.properties || []).length > 0) { + jsiiType.datatype = true; + } + + return _sortMembers(this._visitDocumentation(type.symbol, jsiiType)); + } + + private async _visitMethod(symbol: ts.Symbol, type: spec.ClassType | spec.InterfaceType) { + if (LOG.isTraceEnabled()) { + LOG.trace(`Processing method: ${colors.green(type.fqn)}#${colors.cyan(symbol.name)}`); + } + + const declaration = symbol.valueDeclaration as (ts.MethodDeclaration | ts.MethodSignature); + const signature = this._typeChecker.getSignatureFromDeclaration(declaration); + if (!signature) { + this._diagnostic(declaration, ts.DiagnosticCategory.Error, `Unable to compute signature for ${type.fqn}#${symbol.name}`); + return; + } + const returnType = signature.getReturnType(); + const method: spec.Method = { + abstract: _isAbstract(symbol), + name: symbol.name, + parameters: await Promise.all(signature.getParameters().map(p => this._toParameter(p))), + protected: _isProtected(symbol), + returns: _isVoid(returnType) ? undefined : await this._typeReference(returnType, declaration), + static: _isStatic(symbol), + }; + method.variadic = method.parameters && method.parameters.find(p => !!p.variadic) != null; + + this._visitDocumentation(symbol, method); + + type.methods = type.methods || []; + type.methods.push(method); + } + + private async _visitProperty(symbol: ts.Symbol, type: spec.ClassType | spec.InterfaceType) { + if (type.properties && type.properties.find(p => p.name === symbol.name)) { + /* + * Second declaration of the same property. For example, if code specifies a getter & setter signature, + * there will be one pass for each of the signatures, but we can process only the first encountered. The + * typescript compiler will take care of making sure we don't have conflicting declarations, anyway. + */ + return; + } + if (LOG.isTraceEnabled()) { + LOG.trace(`Processing property: ${colors.green(type.fqn)}#${colors.cyan(symbol.name)}`); + } + + const signature = symbol.valueDeclaration as (ts.PropertySignature + | ts.PropertyDeclaration + | ts.AccessorDeclaration + | ts.ParameterPropertyDeclaration); + const property: spec.Property = { + abstract: _isAbstract(symbol), + name: symbol.name, + protected: _isProtected(symbol), + static: _isStatic(symbol), + type: await this._typeReference(this._typeChecker.getTypeOfSymbolAtLocation(symbol, signature), signature), + }; + + if (ts.isGetAccessor(signature)) { + const decls = symbol.getDeclarations() || []; + property.immutable = decls.find(decl => ts.isSetAccessor(decl)) == null; + } else { + // tslint:disable-next-line:no-bitwise + property.immutable = (ts.getCombinedModifierFlags(signature) & ts.ModifierFlags.Readonly) !== 0; + } + + if (property.static && property.immutable && ts.isPropertyDeclaration(signature) && signature.initializer) { + property.const = true; + } + + this._visitDocumentation(symbol, property); + + type.properties = type.properties || []; + type.properties.push(property); + } + + private async _toParameter(paramSymbol: ts.Symbol): Promise { + if (LOG.isTraceEnabled()) { + LOG.trace(`Processing parameter: ${colors.cyan(paramSymbol.name)}`); + } + const parameter: spec.Parameter = { + name: paramSymbol.name, + type: await this._typeReference(this._typeChecker.getTypeAtLocation(paramSymbol.valueDeclaration), paramSymbol.valueDeclaration), + variadic: !!(paramSymbol.valueDeclaration as ts.ParameterDeclaration).dotDotDotToken + }; + if (parameter.variadic) { + parameter.type = (parameter.type as spec.CollectionTypeReference).collection.elementtype; + } + this._visitDocumentation(paramSymbol, parameter); + return parameter; + } + + private async _typeReference(type: ts.Type, declaration: ts.Declaration): Promise { + if (type.isLiteral() && _isEnumLike(type)) { + type = this._typeChecker.getBaseTypeOfLiteralType(type); + } else { + type = this._typeChecker.getApparentType(type); + } + + const primitiveType = _tryMakePrimitiveType(); + if (primitiveType) { return primitiveType; } + + if (type.isUnion() && !_isEnumLike(type)) { + return _unionType.call(this); + } + + if (!type.symbol) { + this._diagnostic(declaration, ts.DiagnosticCategory.Error, `Non-primitive types must have a symbol`); + return { primitive: spec.PrimitiveType.Any }; + } + + if (type.symbol.name === 'Array') { + return await _arrayType.call(this); + } + + if (type.symbol.name === '__type' && type.symbol.members) { + return await _mapType.call(this); + } + + if (type.symbol.escapedName === 'Promise') { + const typeRef = type as ts.TypeReference; + if (!typeRef.typeArguments || typeRef.typeArguments.length !== 1) { + this._diagnostic(declaration, + ts.DiagnosticCategory.Error, + `Un-specified promise type (need to specify as Promise)`); + return { primitive: spec.PrimitiveType.Any, promise: true }; + } else { + return { + ...await this._typeReference(typeRef.typeArguments[0], declaration), + promise: true + }; + } + } + + return { fqn: await this._getFQN(type) }; + + async function _arrayType(this: Assembler): Promise { + const typeRef = type as ts.TypeReference; + let elementtype: spec.TypeReference; + + if (typeRef.typeArguments && typeRef.typeArguments.length === 1) { + elementtype = await this._typeReference(typeRef.typeArguments[0], declaration); + } else { + const count = typeRef.typeArguments ? typeRef.typeArguments.length : 'none'; + this._diagnostic(declaration, + ts.DiagnosticCategory.Error, + `Array references must have exactly one type argument (found ${count})`); + elementtype = { primitive: spec.PrimitiveType.Any }; + } + + return { + collection: { + elementtype, + kind: spec.CollectionKind.Array + } + }; + } + + async function _mapType(this: Assembler): Promise { + let elementtype: spec.TypeReference; + const objectType = type.getStringIndexType(); + if (objectType) { + elementtype = await this._typeReference(objectType, declaration); + } else { + this._diagnostic(declaration, + ts.DiagnosticCategory.Error, + `Only string index maps are supported`); + elementtype = { primitive: spec.PrimitiveType.Any }; + } + return { + collection: { + elementtype, + kind: spec.CollectionKind.Map + } + }; + } + + function _tryMakePrimitiveType(): spec.PrimitiveTypeReference | undefined { + if (!type.symbol) { + // tslint:disable-next-line:no-bitwise + if (type.flags & ts.TypeFlags.Object) { + return { primitive: spec.PrimitiveType.Json }; + } + // tslint:disable-next-line:no-bitwise + if (type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) { + return { primitive: spec.PrimitiveType.Any }; + } + } else { + switch (type.symbol.name) { + case 'Boolean': + return { primitive: spec.PrimitiveType.Boolean }; + case 'Date': + return { primitive: spec.PrimitiveType.Date }; + case 'Number': + return { primitive: spec.PrimitiveType.Number }; + case 'String': + return { primitive: spec.PrimitiveType.String }; + } + } + // Not a primitive type! + return undefined; + } + + async function _unionType(this: Assembler): Promise { + const types = new Array(); + let optional: boolean = false; + + for (const subType of (type as ts.UnionType).types) { + // tslint:disable-next-line:no-bitwise + if (subType.flags & ts.TypeFlags.Undefined) { + optional = true; + continue; + } + const resolvedType = await this._typeReference(subType, declaration); + if (types.find(ref => deepEqual(ref, resolvedType)) != null) { + continue; + } + types.push(resolvedType); + } + + return types.length === 1 + ? { ...types[0], optional } + : { union: { types }, optional }; + } + } +} + +/** + * The result of ``Assembler#emit()``. + */ +export interface EmitResult { + /** + * @return all diagnostic information produced by the assembler's emit process + */ + readonly diagnostics: ts.Diagnostic[]; + + /** + * @return true if the assembly was not written to disk (as the consequence + * of errors, which are visible in ``#diagnostics``) + */ + readonly emitSkipped: boolean; +} + +function _fingerprint(assembly: spec.Assembly): spec.Assembly { + delete assembly.fingerprint; + assembly = sortJson(assembly); + const fingerprint = crypto.createHash('sha256') + .update(JSON.stringify(assembly, utils.filterEmpty)) + .digest('base64'); + return { ...assembly, fingerprint }; +} + +function _isAbstract(symbol: ts.Symbol): boolean { + return !!symbol.valueDeclaration + // tslint:disable-next-line:no-bitwise + && (ts.getCombinedModifierFlags(symbol.valueDeclaration) & ts.ModifierFlags.Abstract) !== 0; +} + +function _isEnumLike(type: ts.Type): type is ts.EnumType { + // tslint:disable-next-line:no-bitwise + return (type.flags & ts.TypeFlags.EnumLike) !== 0; +} + +function _isExported(node: ts.Declaration): boolean { + // tslint:disable-next-line:no-bitwise + return (ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export) !== 0; +} + +/** + * Members with names starting with ``_`` and members that are private are hidden. + * + * @param symbol the symbol which should be assessed + * + * @return ``true`` if the symbol should be hidden + */ +function _isHidden(symbol: ts.Symbol): boolean { + return !symbol.valueDeclaration + || symbol.name.startsWith('_') + // tslint:disable-next-line:no-bitwise + || (ts.getCombinedModifierFlags(symbol.valueDeclaration) & ts.ModifierFlags.Private) !== 0; +} + +function _isProtected(symbol: ts.Symbol): boolean { + return !!symbol.valueDeclaration + // tslint:disable-next-line:no-bitwise + && (ts.getCombinedModifierFlags(symbol.valueDeclaration) & ts.ModifierFlags.Protected) !== 0; +} + +function _isStatic(symbol: ts.Symbol): boolean { + return !!symbol.valueDeclaration + // tslint:disable-next-line:no-bitwise + && (ts.getCombinedModifierFlags(symbol.valueDeclaration) & ts.ModifierFlags.Static) !== 0; +} + +function _isVoid(type: ts.Type): boolean { + // tslint:disable-next-line:no-bitwise + return ((type.flags & ts.TypeFlags.Void) !== 0); +} + +function _sortMembers(type: spec.ClassType): spec.ClassType; +function _sortMembers(type: spec.InterfaceType): spec.InterfaceType; +function _sortMembers(type: spec.ClassType | spec.InterfaceType): spec.ClassType | spec.InterfaceType { + type.methods = type.methods && _sort(type.methods); + type.properties = type.properties && _sort(type.properties); + return type; + + /** + * Sorts a member array such that: + * 1. Static members appear first + * 2. Immutable members appear first + * 3. Non-optional members appear first + * 4. Members appear in lexicographical order + * + * @param values the array of members to be sorted + * + * @return a sorted copy of ``values`` + */ + function _sort(values: T[]): T[] { + if (!values) { return values; } + return values.sort(_comparator); + + function _comparator(lval: T, rval: T): number { + return _format(lval).localeCompare(_format(rval)); + + function _format(val: T): string { + return [ + val.static ? '0' : '1', + val.immutable ? '0' : '1', + !(val.type && val.type.optional) ? '0' : '1', + val.name + ].join('|'); + } + } + } + type TypeMember = { + name?: string; // Methods & Properties + static?: boolean; // Methods & Properties + immutable?: boolean; // Properties + type?: { optional?: boolean; }; // Properties + }; +} + +function _toDependencies(assemblies: ReadonlyArray): { [name: string]: spec.PackageVersion } { + const result: { [name: string]: spec.PackageVersion } = {}; + for (const assembly of assemblies) { + result[assembly.name] = { + version: assembly.version, + targets: assembly.targets, + dependencies: assembly.dependencies + }; + } + return result; +} diff --git a/packages/jsii/lib/bundle.ts b/packages/jsii/lib/bundle.ts deleted file mode 100644 index 222c162f2c..0000000000 --- a/packages/jsii/lib/bundle.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as fs from 'fs-extra'; -import { SPEC_FILE_NAME } from 'jsii-spec'; -import { compilePackage } from './compiler'; -import { filterEmpty } from './util'; - -export async function bundle(moduleRoot: string): Promise { - const spec = await compilePackage(moduleRoot); - await fs.writeJson(SPEC_FILE_NAME, spec, { replacer: filterEmpty, spaces: 2 }); -} diff --git a/packages/jsii/lib/compiler-options.ts b/packages/jsii/lib/compiler-options.ts deleted file mode 100644 index 19b7e464d1..0000000000 --- a/packages/jsii/lib/compiler-options.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as fs from 'fs-extra'; -import * as path from 'path'; -import * as ts from 'typescript'; - -export function getCompilerOptions(): ts.CompilerOptions { - return { - target: ts.ScriptTarget.ES2018, - lib: [ 'es2016', 'es2017.object', 'es2017.string' ], - module: ts.ModuleKind.CommonJS, - declaration: true, - strict: true, - strictPropertyInitialization: true, - noImplicitAny: true, - strictNullChecks: true, - noImplicitThis: true, - alwaysStrict: true, - noUnusedLocals: true, - noUnusedParameters: true, - noImplicitReturns: true, - noFallthroughCasesInSwitch: true, - inlineSourceMap: true, - experimentalDecorators: true, - jsx: ts.JsxEmit.React, - jsxFactory: 'jsx.create' - }; -} - -export async function saveCompilerOptions(packageDir: string) { - const options: any = { compilerOptions: getCompilerOptions() }; - - // HACK: convert a couple of things to strings - options._generated_by_jsii_ = 'generated by jsii - you can delete, and ideally add to your .gitignore'; - options.compilerOptions.target = ts.ScriptTarget[options.compilerOptions.target].toString().toLocaleLowerCase(); - options.compilerOptions.module = ts.ModuleKind[options.compilerOptions.module].toString().toLocaleLowerCase(); - options.compilerOptions.jsx = ts.JsxEmit[options.compilerOptions.jsx].toString().toLocaleLowerCase(); - - const tsconfigPath = path.join(packageDir, 'tsconfig.json'); - if (await fs.pathExists(tsconfigPath)) { - const actual = await fs.readJson(tsconfigPath); - if (!actual._generated_by_jsii_) { - // tslint:disable-next-line:max-line-length - throw new Error('Local tsconfig.json must be generated by jsii.\nIn order to maintain cross-language compatibility, jsII needs to control those options, but it would generate a local tsconfig.json file for IDE support. Bottom line, you should delete the file: ' + tsconfigPath); - } - } else { - // tslint:disable-next-line:no-console - console.error('tsconfig.json created for seamless IDE experience (no need to commit)'); - } - - // overwrite! - await fs.writeJson(tsconfigPath, options, { spaces: 2 }); -} - -export async function saveLinterOptions(packageDir: string) { - const tslintPath = path.join(packageDir, 'tslint.json'); - - if (await fs.pathExists(tslintPath) || await fs.pathExists(path.join(packageDir, 'tslint.yaml'))) { - return; // tslint.json exists, don't override - } - - const rules = { - extends: "tslint:recommended", - rules: { - "semicolon": [ - true, - "always", - "ignore-interfaces" - ], - "no-invalid-template-strings": false, - "quotemark": false, - "interface-name": false, - "max-classes-per-file": false, - "member-access": { - severity: "warning" - }, - "interface-over-type-literal": false, - "eofline": false, - "arrow-parens": false, - "no-namespace": false, - "max-line-length": [ - true, - 150 - ], - "object-literal-sort-keys": false, - "trailing-comma": false, - "no-unused-expression": [ - true, - "allow-new" - ], - "variable-name": [ - true, - "ban-keywords", - "check-format", - "allow-leading-underscore", - "allow-pascal-case" - ] - } - }; - await fs.writeJson(tslintPath, rules, { spaces: 2 }); -} \ No newline at end of file diff --git a/packages/jsii/lib/compiler.ts b/packages/jsii/lib/compiler.ts index 111fee7346..e85509309b 100644 --- a/packages/jsii/lib/compiler.ts +++ b/packages/jsii/lib/compiler.ts @@ -1,1573 +1,178 @@ import Case = require('case'); -import clone = require('clone'); -import crypto = require('crypto'); -import deepEqual = require('deep-equal'); +import colors = require('colors/safe'); import fs = require('fs-extra'); -import glob = require('glob'); -import spec = require('jsii-spec'); +import log4js = require('log4js'); import path = require('path'); import ts = require('typescript'); -import util = require('util'); -import { getCompilerOptions, saveCompilerOptions, saveLinterOptions } from './compiler-options'; -import { fileSystemLoader, includeAndRenderExamples, loadFromFile } from './literate'; -import readPackageMetadata from './package-metadata'; -import { filterEmpty } from './util'; - -// tslint:disable-next-line:no-var-requires -const sortJson = require('sort-json'); - -/** - * Given a CommonJS (npm) typescript package, produces a JSII specification for it. - * @param packageDir Root directory of the package (where package.json resides) - * @param includeDirs list of directories to include - */ -export async function compilePackage(packageDir: string, includeDirs = [ 'test', 'bin' ]): Promise { - // read package.json and validate that we have what we need there - const pkg = await readPackageMetadata(packageDir); - - // determine typescript program entrypoint - if (!await fs.pathExists(pkg.entrypoint)) { - throw new Error('Cannot find entrypoint: ' + pkg.entrypoint); - } - - // glob all ts files in dirs to include - const files = new Array(); - for (const dir of includeDirs) { - const dirFiles = await aglob(`${packageDir}/${dir}/**/*.ts`); - for (const file of dirFiles) { - if (file.endsWith('.d.ts') && dirFiles.indexOf(file.replace(/\.d\.ts$/, '.ts')) !== -1) { - // .d.ts files matching a .ts file should be ignored. - continue; - } - files.push(file); - } - } - - // write a copy of the compiler options to the root of the package so IDEs can find it - // also add to .gitignore to make sure it is not checked in. - await saveCompilerOptions(packageDir); - await saveLinterOptions(packageDir); - - const targets = new Set(Object.keys(pkg.targets)); - const { lookup, dependencies, bundled } = await readDependencies(packageDir, pkg.dependencies, pkg.bundledDependencies, targets); - - const assm: spec.Assembly = { - schema: spec.SchemaVersion.V1_0, - name: pkg.name, - version: pkg.version.replace(/\+.+$/, ''), - license: pkg.license, - description: pkg.description, - homepage: pkg.homepage, - author: pkg.author, - contributors: pkg.contributors, - repository: pkg.repository, - targets: { - ...pkg.targets, - // automatically add a "js" target based on the npm name. - js: { npm: pkg.name } - }, - readme: await loadReadme(packageDir), - dependencies, - bundled, - fingerprint: '', - types: {} - }; - await compileSources(pkg.entrypoint, files, lookup, assm); - - return normalizeAssembly(); - - /** - * Normalizes (aka sorts) and fingerprints the assembly. - */ - function normalizeAssembly() { - const sorted: spec.Assembly = sortJson(assm); - for (const type of Object.values(sorted.types || {})) { - if (spec.isClassOrInterfaceType(type)) { - type.methods = type.methods && _sortMembers(type.methods); - type.properties = type.properties && _sortMembers(type.properties); - } - } - // Not accounting for the 'fingerprint' field when fingerprinting. - delete sorted.fingerprint; - const fingerprint = crypto.createHash('sha256') - .update(JSON.stringify(sorted, filterEmpty)) - .digest('base64'); - return { ...sorted, fingerprint } as spec.Assembly; - - /** - * Sort members (aka Methods or Properties) so that: - * - * - static members are listed before non-static members - * - immutable properties are listed before mutable properties - * - required properties are listed before optional properties - * - members are listed alphanumarically sorted - * - * @param arr the elements to sort - * - * @return a sorted copy of ``arr``. - */ - function _sortMembers(arr: T[]): T[] { - return arr.sort((lval: T, rval: T) => { - return _comparable(lval).localeCompare(_comparable(rval)); - }); - - function _comparable(val: T): string { - return [ - val.static ? '0' : '1', - val.immutable ? '0' : '1', - !(val.type && val.type.optional) ? '0' : '1', - val.name - ].join('|'); - } - } - type ComparableMember = { - name?: string; - static?: boolean; - immutable?: boolean; - type?: { optional?: boolean; }; - }; - } -} - -async function loadReadme(packageDir: string): Promise<{ markdown: string } | undefined> { - const readme = path.join(packageDir, 'README.md'); - - if (!await fs.pathExists(readme)) { - // tslint:disable-next-line:no-console - console.error(`No README.md file found at ${readme} ☹️`); - return undefined; - } - - const renderedLines = await includeAndRenderExamples( - await loadFromFile(readme), - fileSystemLoader(packageDir)); - - return { markdown: renderedLines.join('\n') }; -} - -interface ReferencedFqn { - fqn: string - ctx: string[] -} - -/** - * Compiles a set of source files and returns a spec. Note that the spec will not contain package information. - * @param entrypoint The main source file. - * @param otherSources Other source files to include. - * @param externalTypes Types imported from dependencies - * @params assm The assembly to add types to. - * @param treatWarningsAsErrors Fail on warnings - */ -export async function compileSources(entrypoint: string, - otherSources = new Array(), - externalTypes = new Map(), - assm: spec.Assembly, - treatWarningsAsErrors = false): Promise { - const options = getCompilerOptions(); - const prog = compileProgramSync([ entrypoint, ...otherSources ], options); - const typeChecker = prog.getTypeChecker(); - const sourceFile = prog.getSourceFile(prog.getRootFileNames()[0]); - if (!sourceFile) { throw new Error('No source file found!'); } - const rootModule = typeChecker.getSymbolAtLocation(sourceFile); - - // this is it, start parsing... - const types = new Array(); - - // collect all refs to FQNs so we can validate we don't use unexported types - const typeRefs = new Set(); - - if (rootModule) { - await processModule(rootModule, []); - addTypeInfo(assm, types); - verifyUnexportedTypes(assm, typeRefs, externalTypes); - validateOverriddenSignatures(assm, externalTypes); - normalizeInitializers(assm, externalTypes); - } - - return; // Below this are helper functions - - /** - * Process a module - */ - async function processModule(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - - const moduleExports = symbol.exports && typeChecker.getExportsOfModule(symbol); - if (!moduleExports) { - return; - } - - for (const ex of moduleExports) { - if (isKind(ex, ts.SyntaxKind.ClassDeclaration)) { - const cls = await tryProcessClass(ex, ctx); - if (cls) { - types.push(cls); - } - } - - if (isKind(ex, ts.SyntaxKind.EnumDeclaration)) { - const en = await tryProcessEnum(ex, ctx); - if (en) { - types.push(en); - } - } - - if (isInterface(ex)) { - const iface = await tryProcessInterface(ex, ctx); - if (iface) { - types.push(iface); - } - } - - // both classes and enums can also be namespaces, so we try to recursively process. - await processModule(ex, ctx); - } - } - - function isInterface(sym: ts.Symbol) { - return sym.declarations && - sym.declarations.length > 0 && - sym.declarations[0].kind === ts.SyntaxKind.InterfaceDeclaration; - } - - async function tryProcessBaseType(type: ts.Type, ctx: string[]): Promise { - ctx = newContext(ctx, type.symbol ? type.symbol.name : ''); - - const baseTypes = type.getBaseTypes(); - if (!baseTypes || baseTypes.length === 0) { - return undefined; - } - - if (baseTypes.length !== 1) { - throw error(ctx, 'Only a single base type is allowed: ' + (type.symbol && type.symbol.name)); - } - - const resolvedType = await resolveType(baseTypes[0], ctx); - if (!spec.isNamedTypeReference(resolvedType)) { - throw error(ctx, 'Unexpected base type: ' + JSON.stringify(resolvedType)); - } - - return resolvedType; - } - - async function tryProcessClassInterfaces(decl: ts.ClassDeclaration, ctx: string[]): Promise { - if (!decl.heritageClauses) { - return; - } - - const result = new Array(); - - for (const hc of decl.heritageClauses) { - if (hc.token === ts.SyntaxKind.ExtendsKeyword) { - continue; // base classes are handled in tryProcessBaseClass - } - - if (hc.token !== ts.SyntaxKind.ImplementsKeyword) { - throw error(ctx, 'Invalid heritage clause token ' + ts.SyntaxKind[hc.token]); - } - - for (const expr of hc.types || [ ]) { - const type = typeChecker.getTypeFromTypeNode(expr); - - const ref: spec.NamedTypeReference = { - fqn: await getFullyQualifiedName(type.symbol!, ctx) - }; - - result.push(ref); - } - } - - return result; - } - - async function tryProcessInterface(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - - const name = await getFullyQualifiedName(symbol, ctx); - if (!name) { - throw error(ctx, 'Cannot determine type name'); - } - - const decl = symbol.declarations![0] as ts.InterfaceDeclaration; - - const entity: spec.InterfaceType = { - kind: spec.TypeKind.Interface, - ...makeEntityName(name, ctx) - }; - - checkTypeName(entity.name, ctx); - - addDocumentation(entity, symbol); - - const interfaceType = typeChecker.getDeclaredTypeOfSymbol(symbol); - const bases = new Array(); - const baseTypes = interfaceType.getBaseTypes() || []; - for (const base of baseTypes) { - const fqn = await getFullyQualifiedName(base.symbol!, ctx); - bases.push({ fqn }); - } - entity.interfaces = bases; - entity.methods = []; - entity.properties = []; - - const props = interfaceType.getProperties(); - - if (props) { - for (const mem of props) { - if (!mem.valueDeclaration) { - throw error(ctx, entity.fqn + ' - unexpected error for member: ' + mem.name); - } - - // Skip properties that are not direct members of this type. - if (mem.valueDeclaration.parent !== decl) { - continue; - } - - // interfaces only support methods - if (ts.isMethodSignature(mem.valueDeclaration)) { - const method = await tryProcessMethod(mem, ctx); - if (method) { - if (!entity.methods) { entity.methods = []; } - entity.methods.push(method); - } - continue; - } - - if (mem.valueDeclaration.kind === ts.SyntaxKind.PropertySignature) { - const prop = await tryProcessProperty(mem, ctx); - if (prop) { - entity.properties.push(prop); - } - continue; - } - - throw error(ctx, entity.fqn + ' - unsupported member kind <' + ts.SyntaxKind[mem.valueDeclaration.kind] + '>: ' + mem.name); - } - } - - // if interface only has props, it's considered a datatype. - if (entity.methods.length === 0 && entity.properties.length > 0) { - entity.datatype = true; - } - - return entity; - } - - async function tryProcessClass(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - - const name = await getFullyQualifiedName(symbol, ctx); - if (!name) { - throw error(ctx, 'Cannot determine type name'); - } - - const decl = symbol.valueDeclaration as ts.ClassDeclaration; - - if (isHidden(decl)) { - return undefined; - } - const entity: spec.ClassType = { - kind: spec.TypeKind.Class, - ...makeEntityName(name, ctx) - }; - - checkTypeName(entity.name, ctx); - - addDocumentation(entity, symbol); - - const classType = typeChecker.getDeclaredTypeOfSymbol(symbol); - - const base = await tryProcessBaseType(classType, ctx); - if (base) { - entity.base = base; - } - - entity.interfaces = await tryProcessClassInterfaces(decl, ctx); - - if (isAbstract(decl)) { - entity.abstract = true; - } - - entity.initializer = await tryProcessConstructor(symbol, ctx); - - for (const memberDecl of decl.members) { - const mem = (memberDecl as any).symbol; - - // handle parameter properties (shortcut to defining properties via ctor parameters) - if (ts.isConstructorDeclaration(memberDecl)) { - const sig = typeChecker.getSignatureFromDeclaration(memberDecl); - if (sig) { - for (const p of sig.parameters) { - if (ts.isParameterPropertyDeclaration(p.valueDeclaration!)) { - const prop = await tryProcessProperty(p, ctx); - if (prop) { - entity.properties = entity.properties || []; - entity.properties.push(prop); - } - } - } - } - } - - // Skip properties that are not direct members of this type. - if (!isMemberOfClass(mem, symbol.valueDeclaration)) { - continue; - } - - // filter out private/protected - if (!isPublic(memberDecl)) { - continue; - } - - if (ts.isMethodDeclaration(memberDecl)) { - const method = await tryProcessMethod(mem, ctx); - if (method) { - entity.methods = entity.methods || []; - entity.methods.push(method); - } - continue; - } - - if (ts.isPropertyDeclaration(memberDecl) || ts.isParameterPropertyDeclaration(memberDecl)) { - const prop = await tryProcessProperty(mem, ctx); - if (prop) { - entity.properties = entity.properties || []; - entity.properties.push(prop); - } - continue; - } - - if (ts.isGetAccessorDeclaration(memberDecl)) { - const prop = await tryProcessAccessor(mem, ctx); - if (prop) { - entity.properties = entity.properties || []; - entity.properties.push(prop); - } - continue; - } - - // skip "set" accessors because they are covered by the getter. - if (ts.isSetAccessorDeclaration(memberDecl)) { - continue; - } - - warning(ctx, entity.fqn + ' - unsupported member kind <' + ts.SyntaxKind[memberDecl.kind] + '>: ' + mem.name); - } - - return entity; - } - - async function tryProcessConstructor(classSymbol: ts.Symbol, ctx: string[]) { - ctx = newContext(ctx, '__ctor__'); - - if (!classSymbol.members) { - return undefined; - } - - const member = classSymbol.members.get(ts.InternalSymbolName.Constructor); - if (!member) { - return undefined; - } - - const decl = member.declarations && member.declarations[0]; - if (!decl) { - throw error(ctx, 'Unable to determine constructor declaration'); - } - - const signature = typeChecker.getSignatureFromDeclaration(decl as ts.ConstructorDeclaration); - if (!signature) { - throw error(ctx, 'Unable to determine constructor signature'); - } - - const initializer: spec.Method = { - parameters: [], // So this can be recognized as a Method by `addDocumentation` - initializer: true - }; - - addDocumentation(initializer, member); - - for (const p of signature.getParameters()) { - try { - const param = await processParameter(p, ctx); - initializer.parameters = initializer.parameters || []; - initializer.parameters.push(param); - if (param.variadic) { initializer.variadic = true; } - } catch (e) { - // if a parameter could not be added, but it's optional - // we just stop processing more parameters - if (typeChecker.isOptionalParameter(p.valueDeclaration as ts.ParameterDeclaration)) { - warning(ctx, 'Skipping all parameters from', p.escapedName); - break; - } - - throw e; - } - } - - return initializer; - } - - async function tryProcessEnum(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - - const name = await getFullyQualifiedName(symbol, ctx); - if (!name) { - throw error(ctx, 'Cannot determine type name for enum: ' + symbol.getName()); - } - - if (isHidden(symbol.valueDeclaration as ts.EnumDeclaration)) { - return undefined; - } - - const entity: spec.EnumType = { - kind: spec.TypeKind.Enum, - ...makeEntityName(name, ctx), - members: [] - }; - addDocumentation(entity, symbol); - checkTypeName(entity.name, ctx); - - const decl = symbol.valueDeclaration as ts.EnumDeclaration; - - for (const mem of decl.members) { - entity.members.push({ name: mem.name.getText() }); - } - - return entity; - } - - async function processParameter(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - - const decl = symbol.valueDeclaration as ts.ParameterDeclaration; - - const typeAtLocation = typeChecker.getTypeAtLocation(decl); - const param: spec.Parameter = { - name: decl.name.getText(), - type: await resolveType(typeAtLocation, ctx), - }; - addDocumentation(param, symbol); - - if (decl.dotDotDotToken) { - param.variadic = true; - // TypeScript requires variadic arguments are typed as lists, but JSII represents them as scalars. - if (!spec.isCollectionTypeReference(param.type)) { - throw new Error(`Invalid variadic parameter ${param.name}: type ${JSON.stringify(param.type)} is not a collection`); - } - param.type = param.type.collection.elementtype; - } - - if (spec.isUnionTypeReference(param.type)) { - throw error(ctx, 'Unions are not allowed for parameter types'); - } - - if (typeChecker.isOptionalParameter(decl)) { - param.type = { ...param.type, optional: true }; - } - - return param; - } - - async function tryProcessMethod(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - const decl = symbol.valueDeclaration as ts.MethodDeclaration; - - if (isHidden(decl)) { - return undefined; - } - - const method: spec.Method = { - name: decl.name.getText(), - parameters: [], // So this can be recognized as a Method by `addDocumentation` - }; - - if (hasModifier(decl, ts.SyntaxKind.StaticKeyword)) { - method.static = true; - } - - if (isProtected(decl)) { - method.protected = true; - } - - if (isAbstract(decl)) { - method.abstract = true; - } - - const methodSignature = typeChecker.getSignatureFromDeclaration(decl); - if (!methodSignature) { - throw error(ctx, 'cannot determine signature from method declaration'); - } - - if (methodSignature.getTypeParameters()) { - throw error(ctx, 'Generics are not supported'); - } - - addDocumentation(method, symbol); - // tslint:disable-next-line:no-bitwise - const returnsVoid = methodSignature.getReturnType().flags & ts.TypeFlags.Void; - if (!returnsVoid) { - method.returns = await resolveType(methodSignature.getReturnType(), ctx); - } - - const params = methodSignature.getParameters(); - if (params) { - for (const p of params) { - const param = await processParameter(p, ctx); - method.parameters = method.parameters || []; - method.parameters.push(param); - if (param.variadic) { method.variadic = true; } - } - } - - checkMemberName(method, false, ctx); - - return method; - } - - async function tryProcessAccessor(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - - if (!symbol.declarations) { - throw error(ctx, 'unable to extract declarations'); - } - - let getterDecl: ts.SignatureDeclaration | null = null; - let setterDecl: ts.SignatureDeclaration | null = null; - - for (const decl of symbol.declarations) { - if (ts.isGetAccessorDeclaration(decl)) { - getterDecl = decl; - } else if (ts.isSetAccessorDeclaration(decl)) { - setterDecl = decl; - } else { - throw error(ctx, 'invalid declaration on accessor'); - } - } - - if (!getterDecl) { - throw error(ctx, 'all properties must have a getter (setters are optional)'); - } - - if (isHidden(getterDecl)) { - return undefined; - } - - const signature = typeChecker.getSignatureFromDeclaration(getterDecl); - if (!signature) { - throw error(ctx, 'cannot resolve property signature'); - } - - const prop: spec.Property = { - name: symbol.name, - type: await resolveType(signature.getReturnType(), ctx) - }; - - addDocumentation(prop, symbol); - - if (hasModifier(getterDecl, ts.SyntaxKind.StaticKeyword)) { - prop.static = true; - } - - if (!setterDecl) { - prop.immutable = true; - } - - // in typescript getter and setter must agree on visibility, so we can just check the getter (which must exist). - if (isProtected(getterDecl)) { - prop.protected = true; - } - - checkMemberName(prop, true, ctx); - - return prop; - } - - async function tryProcessProperty(symbol: ts.Symbol, ctx: string[]): Promise { - ctx = newContext(ctx, symbol.name); - - const decl = symbol.valueDeclaration as ts.PropertyDeclaration; - - if (isHidden(decl)) { - return undefined; - } - - const typeAtLocation = typeChecker.getTypeAtLocation(decl); - const prop: spec.Property = { - name: decl.name.getText(), - type: await resolveType(typeAtLocation, ctx) - }; - addDocumentation(prop, symbol); - - if (hasModifier(decl, ts.SyntaxKind.StaticKeyword)) { - prop.static = true; - } - - if (hasModifier(decl, ts.SyntaxKind.ReadonlyKeyword)) { - prop.immutable = true; - } - - if (decl.questionToken) { - prop.type = { ...prop.type, optional: true }; - } - - if (isProtected(decl)) { - prop.protected = true; - } - - if (isAbstract(decl)) { - prop.abstract = true; - } - - // add a "const" hint if this property has an initializer (i.e. "= - // VAL"), is static and immutable. - if (decl.initializer && prop.static && prop.immutable) { - prop.const = true; - } - - checkMemberName(prop, true, ctx); - - return prop; - } - - async function tryResolveCollectionType(type: ts.Type, ctx: string[]) { - if (!type.symbol) { - return undefined; - } - - if (type.symbol.name === 'Array') { - return await resolveArrayType(type, ctx); - } - - // this indicates a map in the form of { [key: s]: v } - if (type.symbol.name === '__type' && type.symbol.members) { - return await resolveMapType(type, ctx); - } - - return undefined; - } - - async function resolveArrayType(type: ts.Type, ctx: string[]): Promise { - const typeRef = type as ts.TypeReference; - if (!typeRef.typeArguments) { - throw error(ctx, 'Array must be defined with a single type argument '); - } - - if (typeRef.typeArguments.length !== 1) { - throw error(ctx, 'Array<> can only have a single type argument'); - } - - return { - collection: { - elementtype: await resolveType(typeRef.typeArguments[0], ctx), - kind: spec.CollectionKind.Array - } - }; - } - - async function resolveMapType(type: ts.Type, ctx: string[]): Promise { - const objectType = type.getStringIndexType(); - if (!objectType) { - throw error(ctx, 'Only string indexes are supported'); - } - - return { - collection: { - elementtype: await await resolveType(objectType, ctx), - kind: spec.CollectionKind.Map - } - }; - } - - function includesType(searched: spec.TypeReference[], item: spec.TypeReference) { - const json = JSON.stringify(item); - return searched.map(x => JSON.stringify(x)).filter(x => x === json).length > 0; - } - - async function resolveUnionType(type: ts.UnionType, ctx: string[]): Promise { - const typeRef: spec.UnionTypeReference = { union: { types: [] } }; - let optional: boolean | undefined; - - for (const subtype of type.types) { - // If a union contains "undefined", it simply means it's an optional - // tslint:disable-next-line:no-bitwise - if (subtype.flags & ts.TypeFlags.Undefined) { - optional = true; - continue; - } - - const resolvedType = await resolveType(subtype, ctx); - if (includesType(typeRef.union.types, resolvedType)) { - continue; - } - - typeRef.union.types.push(resolvedType); - } - - // if the union type only has one type, it was probably because we had , so we can - // convert this to a normal type. - if (typeRef.union.types.length === 1) { - return { ...typeRef.union.types[0], optional }; - } - - return typeRef; - } - - async function resolveType(type: ts.Type, ctx: string[]): Promise { - ctx = newContext(ctx, type.symbol ? type.symbol.name : ''); - - if (type.isLiteral()) { - // Literals need to be represented using their base type. Enums are handled differently, because they are Union types. - type = isEnumLike(type) ? typeChecker.getBaseTypeOfLiteralType(type) - : typeChecker.getApparentType(type); - } else { - // Some types are represented by "intrinsic" types, which need be converted to their "apparent" counterpart. - type = typeChecker.getApparentType(type); - } - - // Enum types are also Union types, but they shouldn't be resolved as unions. - if (type.isUnion() && !isEnumLike(type)) { - return resolveUnionType(type, ctx); - } - - const primitiveType = tryResolvePrimitiveType(type); - if (primitiveType) { - const res: spec.PrimitiveTypeReference = { - primitive: primitiveType - }; - return res; - } - - if (!type.symbol) { - throw error(ctx, 'Non-primitive types are expected to have a name'); - } - - const collectionType = await tryResolveCollectionType(type, ctx); - if (collectionType) { - return collectionType; - } - - const promiseType = tryResolvePromiseType(type); - if (promiseType) { - const resolvedType = await resolveType(promiseType, ctx); - resolvedType.promise = true; - return resolvedType; - } - - const ret: spec.NamedTypeReference = { - fqn: await getFullyQualifiedName(type.symbol, ctx) - }; - - // add this FQN to the list of types referenced by our public APIs. - // this will be crossed referenced later with the list of exported types - // so we won't export unexported types in the public api. - typeRefs.add({ fqn: ret.fqn, ctx }); - - return ret; - - /** - * If `aType` represents a Promise, returns the promised type. - */ - function tryResolvePromiseType(aType: ts.Type) { - const typeAny = aType as any; - - if (aType.symbol && aType.symbol.escapedName === 'Promise') { - if (!typeAny.typeArguments || typeAny.typeArguments.length !== 1) { - throw new Error('Invalid promise type, must be in the form Promise'); - } - - return typeAny.typeArguments[0]; - } - - if (typeAny.promisedTypeOfPromise) { - return typeAny.promisedTypeOfPromise; - } - - return undefined; - } - - /** - * Attempts to resolve the type at hand as a primitive type and returns the name of the - * primitive type if successful. Otherwise returns null. - */ - function tryResolvePrimitiveType(aType: ts.Type): spec.PrimitiveType | undefined { - // tslint:disable-next-line:no-bitwise - if (!aType.symbol && aType.flags & ts.TypeFlags.Object) { - return spec.PrimitiveType.Json; - } - // tslint:disable-next-line:no-bitwise - if (!aType.symbol && aType.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) { - return spec.PrimitiveType.Any; - } - - if (!aType.symbol) { - throw error(ctx, `Unable to resolve type (flags: ${flagNames(aType).join(', ')})`); - } - - if (aType.symbol.name === 'Date') { - return spec.PrimitiveType.Date; - } - - if (aType.symbol.name === 'String') { - return spec.PrimitiveType.String; - } - - if (aType.symbol.name === 'Number') { - return spec.PrimitiveType.Number; - } - - if (aType.symbol.name === 'Boolean') { - return spec.PrimitiveType.Boolean; - } - - return undefined; - } - - function isEnumLike(t: ts.Type): boolean { - // tslint:disable-next-line:no-bitwise - return (t.getFlags() & ts.TypeFlags.EnumLike) !== 0; - } +import { Assembler } from './assembler'; +import { EmitResult, Emitter } from './emitter'; +import { ProjectInfo } from './project-info'; +import utils = require('./utils'); + +const COMPILER_OPTIONS: ts.CompilerOptions = { + alwaysStrict: true, + charset: 'utf8', + declaration: true, + experimentalDecorators: true, + inlineSourceMap: true, + inlineSources: true, + jsx: ts.JsxEmit.React, + jsxFactory: 'jsx.create', + lib: ['lib.es2016.d.ts', 'lib.es2017.object.d.ts', 'lib.es2017.string.d.ts'], + module: ts.ModuleKind.CommonJS, + noEmitOnError: true, + noFallthroughCasesInSwitch: true, + noImplicitAny: true, + noImplicitReturns: true, + noImplicitThis: true, + noUnusedLocals: true, + noUnusedParameters: true, + resolveJsonModule: true, + strict: true, + strictNullChecks: true, + strictPropertyInitialization: false, + target: ts.ScriptTarget.ES2018 +}; + +const LOG = log4js.getLogger('jsii/compiler'); +export const DIAGNOSTICS = 'diagnostics'; + +export interface CompilerOptions { + /** The information about the project to be built */ + projectInfo: ProjectInfo; + /** Whether the compiler should watch for changes or juts compile once */ + watch: boolean; +} - function flagNames(t: ts.Type): string[] { - const result = new Array(); - for (const flag of Object.keys(ts.TypeFlags)) { - // Number-enums have item indexes in Object.keys - if (!isNaN(Number(flag))) { continue; } - const flagValue = (ts.TypeFlags as any)[flag]; - // tslint:disable-next-line:no-bitwise - if (t.getFlags() & flagValue) { - result.push(flag); - } - } - return result; - } - } +export class Compiler implements Emitter { + public constructor(private readonly options: CompilerOptions) {} /** - * Given a type symbol, returns a qualified type name. + * Compiles the configured program. */ - async function getFullyQualifiedName(typeSymbol: ts.Symbol, ctx: string[]) { - ctx = newContext(ctx, typeSymbol.name); - - const fqn = typeChecker.getFullyQualifiedName(typeSymbol); - const groups = /\"([^\"]+)\"\.(.*)/.exec(fqn); - if (!groups) { - throw error(ctx, `Cannot use unexported type '${fqn}' in a public API`); - } - - const modulePath = groups[1]; - const typeName = groups[2]; - - const packageConfig = await findPackageConfig(modulePath); - if (!packageConfig) { - throw error(ctx, 'Cannot find package.json up the tree from: ' + modulePath); - } - - const moduleName = packageConfig.name; - const jsiiName = moduleName + '.' + typeName; - // Record to typeRefs, so the type's validity is verified. - typeRefs.add({ fqn: jsiiName, ctx }); - return jsiiName; - } - - function addDocumentation(target: spec.Documentable, symbol: ts.Symbol) { - for (const tag of symbol.getJsDocTags()) { - // Don't duplicate @params, they're handled on the params themselves... - if (tag.name !== 'param') { - target.docs = target.docs || {}; - target.docs[normalize(tag.name)] = tag.text || ''; - } - } - - const comment = ts.displayPartsToString(symbol.getDocumentationComment(typeChecker)); - if (comment) { - target.docs = target.docs || {}; - target.docs.comment = comment; - } - - function normalize(tagName: string): string { - switch (tagName) { - // JavaDoc is very particular about it being @return. - case 'returns': return 'return'; - default: return tagName; + public async emit(...files: string[]): Promise { + if (this.options.watch) { + if (files.length > 0) { + throw new Error(`Files cannot be specified in watch mode!`); } - } - } - - function isMemberOfClass(memberSymbol: ts.Symbol, classDecl?: ts.Declaration) { - if (!classDecl) { - return false; - } - - if (!memberSymbol.valueDeclaration) { - return false; - } - - if (!memberSymbol.valueDeclaration.parent) { - return false; - } - - // - // NOTE: the reason we also support parent.parent is to accomodate ParameterPropertyDeclaration - // - // constructor(readonly prop: type) - // - // in which case the ctor is the first parent and the class is the second parent. - // - - return memberSymbol.valueDeclaration.parent === classDecl || - memberSymbol.valueDeclaration.parent.parent === classDecl; - } - - function isHidden(decl: ts.NamedDeclaration) { - if (!decl.name) { - return false; - } - - if (decl.name.getText().indexOf('_') === 0) { - return true; - } - - if (hasModifier(decl, ts.SyntaxKind.PrivateKeyword)) { - return true; - } - - return false; - } - - async function findPackageConfig(modulePath: string): Promise { - - if (modulePath === '/') { - return undefined; - } - - const packageFile = path.join(modulePath, 'package.json'); - - const exists = await new Promise(done => fs.exists(packageFile, done)); - if (exists) { - const data = await new Promise((ok, fail) => fs.readFile(packageFile, (err, buf) => err ? fail(err) : ok(buf))); - return JSON.parse(data.toString()); - } - - return await findPackageConfig(path.dirname(modulePath)); - } - - /** - * Determines if the main declaration of the symbol is of a desired kind. - */ - function isKind(symbol: ts.Symbol, kind: ts.SyntaxKind) { - return symbol.valueDeclaration && symbol.valueDeclaration.kind === kind; + return await this._startWatch(); + } else { + if (files.length === 0) { + files = await _findSourceFiles(this.options.projectInfo.projectRoot); + } + return await this._buildOnce(files); + } + } + + private async _buildOnce(files: string[]): Promise { + await this._writeTypeScriptConfig(); + const host = ts.createCompilerHost(COMPILER_OPTIONS); + host.getCurrentDirectory = () => this.options.projectInfo.projectRoot; + const prog = ts.createProgram( + files.concat(_pathOfLibraries(host)), + COMPILER_OPTIONS, + host + ); + return await this._consumeProgram(prog); + } + + private async _startWatch(): Promise { + return new Promise(async () => { + const projectRoot = this.options.projectInfo.projectRoot; + const host = ts.createWatchCompilerHost( + await this._writeTypeScriptConfig(), + COMPILER_OPTIONS, + { ...ts.sys, getCurrentDirectory() { return projectRoot; } } + ); + const orig = host.afterProgramCreate; + host.afterProgramCreate = async builderProgram => { + await this._consumeProgram(builderProgram.getProgram()); + if (orig) { orig.call(host, builderProgram); } + }; + ts.createWatchProgram(host); + // Previous call never returns + }); } - /** - * Returns true if a declaration has a specified modifier. - */ - function hasModifier(decl: ts.Declaration, kind: ts.SyntaxKind) { - if (!decl.modifiers) { - return false; - } - - for (const modifier of decl.modifiers) { - if (modifier.kind === kind) { - return true; - } + private async _consumeProgram(program: ts.Program): Promise { + const emit = program.emit(); + if (emit.emitSkipped) { + LOG.error('Compilation errors prevented the JSII assembly from being created'); + return emit; } - - return false; - } - - function isProtected(decl: ts.Declaration) { - return hasModifier(decl, ts.SyntaxKind.ProtectedKeyword); - } - - function isAbstract(decl: ts.Declaration) { - return hasModifier(decl, ts.SyntaxKind.AbstractKeyword); - } - - /** - * Given a declaration, returns true if this entity should be included. - * For example, if it is 'private', it won't be included. - */ - function isPublic(decl: ts.Declaration) { - return !hasModifier(decl, ts.SyntaxKind.PrivateKeyword); - } - - function makeEntityName(fqn: string, ctx: string[]) { - const [assembly, ...parts] = fqn.split('.'); - - // fqn may be . or ...... - if (parts.length < 1) { - throw error(ctx, `Unable to parse fqn '${fqn}. Expecting at least 2 components`); + const assembler = new Assembler(this.options.projectInfo, program); + const assmEmit = await assembler.emit(); + if (assmEmit.emitSkipped) { + LOG.error('Type model errors prevented the JSII assembly from being created'); } - return { - fqn, - assembly, // First segment is the assembly name - namespace: parts.slice(0, parts.length - 1).join('.'), - name: parts[parts.length - 1] + emitSkipped: assmEmit.emitSkipped, + diagnostics: [...emit.diagnostics, ...assmEmit.diagnostics] }; } - function startsWithUpperCase(symbol: string) { - if (!symbol) { return false; } - const firstChar = symbol.substr(0, 1); - return (firstChar.toLocaleUpperCase() === firstChar); - } - - function checkMemberName(member: spec.Property | spec.Method, isProperty: boolean, ctx: string[]) { - const symbol = member.name; - if (!symbol) { return; } // i.e. initializer - - // static properties should be all-caps (with a potential underscore). all the rest are the same - if (isProperty && member.static) { - - if ((member as any).const) { - - if (Case.pascal(symbol) !== symbol && Case.snake(symbol).toUpperCase() !== symbol && Case.camel(symbol) !== symbol) { - throw error(ctx, `'${symbol}' is a const and must use PascalCase, UPPER_SNAKE_CASE or camelCase`); - } else { - return; - } - } - - if (Case.camel(symbol) !== symbol) { - throw error(ctx, `'${symbol}' is a static property and must use camelCase`); - } else { - return; - } - } - - // symbol must start with a lowercase letter (this is how we determine it is camel-case). - if (Case.camel(symbol) !== symbol) { - throw error(ctx, `'${symbol}' must use camelCase`); - } - - // do not allow props/methods use the form getXxx() or setXxx(v), which is used in Java - // for property methods. - - let paramCount = 0; - if ((member as spec.Method).parameters) { - paramCount = ((member as spec.Method).parameters || []).length; - } - - if (symbol.startsWith('get') && startsWithUpperCase(symbol.substr(3)) && paramCount === 0) { - // tslint:disable-next-line:max-line-length - throw error(ctx, 'Methods and properties cannot have the signature getXxx() since these will conflict with Java property getters by the same name'); - } - - if (symbol.startsWith('set') && startsWithUpperCase(symbol.substr(3)) && paramCount === 1) { - throw error(ctx, 'Methods and properties cannot have the signature setXxx(v) since these will conflict with Java property setters'); - } - } - - function checkTypeName(symbol: string, ctx: string[]) { - if (!symbol) { return; } - - if (Case.pascal(symbol) !== symbol) { - throw error(ctx, `Type names must use PascalCase: ${symbol}`); - } - } - - function warning(ctx: string[], ...args: any[]) { - if (treatWarningsAsErrors) { - return error(ctx, ...args); - } - // tslint:disable-next-line:no-console - console.error(formatMessage('WARNING', ctx, ...args)); - } - - function error(ctx: string[], ...args: any[]) { - throw new Error(formatMessage('ERROR', ctx, ...args)); - } - - function formatMessage(pre: string, ctx: string[], ...args: any[]) { - return util.format(pre, ...args) + '\n --------> Scope: ' + ctx.join('=>'); - } - - function newContext(ctx: string[], value: string) { - return ctx.concat([ value ]); - } -} - -function compileProgramSync(files: string[], options: ts.CompilerOptions) { - const host = ts.createCompilerHost(options); - - // for some odd reason `option.lib` doesn't do what it is expected to do - // so we manually add each lib as a file and remove 'option.lib'. - const libsDir = host.getDefaultLibLocation && host.getDefaultLibLocation(); - if (!libsDir) { - throw new Error('Cannot find typescript "lib" directory'); - } - const libs = options.lib || []; - for (const lib of libs) { - files.push(path.join(libsDir, `lib.${lib}.d.ts`)); - } - delete options.lib; - - const prog = ts.createProgram(files, options, host); - - const result = prog.emit(); - const errors = ts.getPreEmitDiagnostics(prog).concat(result.diagnostics); - - for (const d of errors) { - const file = d.file; - const start = d.start; - if (!file || !start) { - // tslint:disable-next-line:no-console - console.log(`ERROR: ${ts.flattenDiagnosticMessageText(d.messageText, '\n')}`); - } else { - const { line, character } = file.getLineAndCharacterOfPosition(start); - const message = ts.flattenDiagnosticMessageText(d.messageText, '\n'); - // tslint:disable-next-line:no-console - console.log(`ERROR: ${file.fileName} (${line + 1},${character + 1}): ${message}`); - } - } - - if (errors.length > 0) { - throw new Error('Build failed'); - } - - return prog; -} - -/** - * Ensures that all types have an initializer. - * - If there's a base class with an initializer, it will be cloned. - * - If not, an empty initializer is defined. - * This is because JavaScript does that implicitly (but in many languages this is not the case), so we might as well do it here. - */ -function normalizeInitializers(mod: spec.Assembly, externalTypes: Map) { - for (const type of Object.values(mod.types || {})) { - if (type.kind === spec.TypeKind.Class) { - normalize(type as spec.ClassType); - } - } - - function normalize(cls: spec.ClassType) { - // if we already have an initializer, we are done. - if (cls.initializer) { - return; - } - - // if we don't have a base class, produce an initializer without any arguments - if (!cls.base) { - cls.initializer = { initializer: true }; - return; - } - - if (!cls.base.fqn) { - throw new Error('No FQN for base class. Impossible!'); - } - - // normalize initializer for base class first - let base = mod.types![cls.base.fqn] as spec.ClassType; - if (base) { - normalize(base); - } else { - const externalBase = externalTypes.get(cls.base.fqn); - if (!externalBase) { - throw new Error(`Cannot find base type '${cls.base.fqn}' of ${cls.name} neither as local or external type`); - } - - base = externalBase as spec.ClassType; - } - - if (!base.initializer) { - throw new Error(`Missing initializer for base class '${base.name}'`); - } - - // clone from base class - cls.initializer = clone(base.initializer); - } - -} - -function addTypeInfo(assm: spec.Assembly, types: spec.Type[]) { - for (const type of types) { - assm.types = assm.types || {}; - if (type.namespace) { - const ns = `${type.assembly}.${type.namespace}`; - const parentType = Object.values(types).find(t => ns.startsWith(`${t.fqn}.`)); - if (parentType) { - // tslint:disable-next-line:max-line-length - throw new Error(`All child names of a type '${parentType.fqn}' must point to concrete types, but '${ns}' is a namespaces, and this structure cannot be supported in all languages (e.g. Java)`); - } - } - assm.types[type.fqn] = type; - } -} - -/** - * Verify that overridden methods don't change the signature. - * - * Changing the types of arguments or the return type is not allowed in - * some languages (such as C#). - * - * Must be called after verifyUnexportedTypes() which hoists external types. - */ -function validateOverriddenSignatures(mod: spec.Assembly, externalTypes: Map) { - if (!mod.types) { return; } - - for (const typeName of Object.keys(mod.types)) { - // Checking type against self should never fail, and implies - // checking against all ancestors anyway. - checkTypeAgainst(typeName, typeName); - } - - type MethodMap = {[name: string]: spec.Method}; - type PropertyMap = {[name: string]: spec.Property}; - - function checkTypeAgainst(currentFqn: string, ancestorFqn: string) { - const current = getType(currentFqn); - const ancestor = getType(ancestorFqn); - - validateMap(methodMap(current), methodMap(ancestor), validateMethod); - validateMap(propertyMap(current), propertyMap(ancestor), validateProperty); - - // Validate against ancestors of ancestor - if (spec.isClassType(ancestor) && ancestor.base) { - checkTypeAgainst(currentFqn, ancestor.base.fqn); - } - if (spec.isClassOrInterfaceType(ancestor) && ancestor.interfaces) { - for (const extendsInterface of ancestor.interfaces) { - checkTypeAgainst(currentFqn, extendsInterface.fqn); - } - } - - function validateMethod(currentMethod: spec.Method, ancestorMethod: spec.Method) { - const where = `${currentFqn}.${currentMethod.name}`; - if (!typeReferencesEqual(currentMethod.returns, ancestorMethod.returns)) { - const orig = spec.describeTypeReference(ancestorMethod.returns); - const cur = spec.describeTypeReference(currentMethod.returns); - throw new Error(`${where}: return type changed from ${orig} (in ${ancestorFqn}) to ${cur}`); - } - - const currentParams = currentMethod.parameters || []; - const ancestorParams = ancestorMethod.parameters || []; - if (currentParams.length !== ancestorParams.length) { - const orig = ancestorParams.length; - const cur = currentParams.length; - throw new Error(`${where}: parameter count changed from ${orig} (in ${ancestorFqn}) to ${cur}`); - } - for (let i = 0; i < currentParams.length; i++) { - if (currentParams[i].variadic !== ancestorParams[i].variadic || - !typeReferencesEqual(currentParams[i].type, ancestorParams[i].type)) { - const orig = spec.describeTypeReference(ancestorParams[i].type); - const cur = spec.describeTypeReference(currentParams[i].type); - - // tslint:disable-next-line:max-line-length - throw new Error(`${where}: parameter ${i + 1} type changed from ${orig} (in ${ancestorFqn}) to ${cur}`); - } - } - // Register the closest ancestor that is being overridden - if (!currentMethod.overrides && currentFqn !== ancestorFqn) { - currentMethod.overrides = { fqn: ancestorFqn }; - } - } - - function validateProperty(currentProperty: spec.Property, ancestorProperty: spec.Property) { - if (!typeReferencesEqual(currentProperty.type, ancestorProperty.type)) { - const orig = spec.describeTypeReference(ancestorProperty.type); - const cur = spec.describeTypeReference(currentProperty.type); - - throw new Error(`${currentFqn}.${currentProperty.name}: type changed from ${orig} (in ${ancestorFqn}) to ${cur}`); - } - // Register the closest ancestor that is being overridden - if (!currentProperty.overrides && currentFqn !== ancestorFqn) { - currentProperty.overrides = { fqn: ancestorFqn }; - } - } - } - /** - * Execute a validation function against matching elements from two maps + * Creates a `tsconfig.json` file to improve the IDE experience. + * + * @return the fully qualified path to the ``tsconfig.json`` file */ - function validateMap(currentMap: {[key: string]: T}, ancestorMap: {[key: string]: T}, comparisonFn: (a: T, b: T) => void) { - for (const name of Object.keys(currentMap)) { - if (name in ancestorMap) { - comparisonFn(currentMap[name], ancestorMap[name]); + private async _writeTypeScriptConfig(): Promise { + const commentKey = '_generated_by_jsii_'; + const commentValue = 'Generated by jsii - safe to delete, and ideally should be in .gitignore'; + const configPath = path.join(this.options.projectInfo.projectRoot, 'tsconfig.json'); + if (await fs.pathExists(configPath)) { + const currentConfig = await fs.readJson(configPath); + if (!(commentKey in currentConfig)) { + // tslint:disable-next-line:max-line-length + throw new Error(`A '${configPath}' file that was not generated by jsii is in ${this.options.projectInfo.projectRoot}. Aborting instead of overwriting.`); } } - } - - /** - * Return a map of all instance methods of a type - */ - function methodMap(type: spec.Type): MethodMap { - const methods = spec.isClassOrInterfaceType(type) ? (type.methods || []) : []; - // Prepend '_' to avoid collissions with built-in functions on Object such as toString(). - return buildMap(methods.filter(m => !m.static), m => '_' + m.name); - } - - /** - * Return a map of all instance properties of a type - */ - function propertyMap(type: spec.Type): PropertyMap { - const properties = spec.isClassOrInterfaceType(type) ? (type.properties || []) : []; - return buildMap(properties.filter(m => !m.static), m => '_' + m.name); - } - - /** - * Find the Type object for a given fqn - */ - function getType(fqn: string): spec.Type { - if (mod.types && mod.types[fqn]) { return mod.types[fqn]; } - if (externalTypes && externalTypes.has(fqn)) { return externalTypes.get(fqn)!; } - throw new Error(`Unknown type: ${fqn}`); + // tslint:disable-next-line:no-console + LOG.debug(`Creating or updating ${colors.blue(configPath)}`); + await fs.writeJson(configPath, { + compilerOptions: { + ...COMPILER_OPTIONS, + // Need to stip the `lib.` prefix and `.d.ts` suffix + lib: COMPILER_OPTIONS.lib && COMPILER_OPTIONS.lib.map(name => name.slice(4, name.length - 5)), + // Those int-enums, we need to output the names instead + module: COMPILER_OPTIONS.module && ts.ModuleKind[COMPILER_OPTIONS.module], + target: COMPILER_OPTIONS.target && ts.ScriptTarget[COMPILER_OPTIONS.target], + jsx: COMPILER_OPTIONS.jsx && Case.snake(ts.JsxEmit[COMPILER_OPTIONS.jsx]), + }, + [commentKey]: commentValue + }, { replacer: utils.filterEmpty, spaces: 4 }); + return configPath; } } -function verifyUnexportedTypes(mod: spec.Assembly, typeRefs: Set, externalTypes: Map) { - const errors = new Array(); - - for (const ref of typeRefs) { - const localType = mod.types && (ref.fqn in mod.types); - const externalType = externalTypes.has(ref.fqn); - - if (!localType && !externalType) { - errors.push(`${ref.fqn} is referenced from context: ${ref.ctx.join('/')}`); - } - } - - if (errors.length > 0) { - throw new Error(`Found unexported types in the API, which are also not exported by any dependency:\n ${errors.join('\n ')}`); +function _pathOfLibraries(host: ts.CompilerHost | ts.WatchCompilerHost): string[] { + if (!COMPILER_OPTIONS.lib || COMPILER_OPTIONS.lib.length === 0) { return []; } + const lib = host.getDefaultLibLocation && host.getDefaultLibLocation(); + if (!lib) { + throw new Error(`Compiler host doesn't have a default library directory available for ${COMPILER_OPTIONS.lib.join(', ')}`); } + return COMPILER_OPTIONS.lib.map(name => path.join(lib, name)); } -/** - * Reads all jsii deps of a module and creates a lookup table so we can resolve - * external types. Also returns the set of jsii specs for each module, just in case. - * - * @param rootDir The root dir of the module - * @param packageDeps The 'dependencies' section of package.json - */ -async function readDependencies(rootDir: string, packageDeps: any, bundledDeps: undefined | string[], targets: Set) { - const lookup = new Map(); - const dependencies: { [dep: string]: spec.PackageVersion } = { }; - const bundled: { [name: string]: string } = { }; - - bundledDeps = bundledDeps || [ ]; - packageDeps = packageDeps || { }; - - // Used to make sure we don't re-load dependencies that are present multiple times in the tree closure. - const visited = new Set(); - /** - * Loads a dependency assembly, registers the types it declares in the ``lookup`` map, and adds an entry in the - * ``mod.dependencies`` unless the dependency is ``transitive``. - * - * @param packageName the name of the package found in dependencies, which will be registered. - * @param moduleRootDir the root directory of the module that declares the dependency being loaded. - * @param transitive whether this dependeency is transitive (aka it shouldn't be added to ``mod.dependencies``) - */ - async function addDependency(packageName: string, moduleRootDir: string, transitive = false) { - // no need to re-visit transitive dependencies (also handles cycles) - // if this is a direct dependency, we must add it to the assembly - if (visited.has(packageName) && transitive) { - return; - } - - const { jsii, pkg, moduleDir } = await readJsiiForModule(moduleRootDir, packageName); - - // verify that dependencies specify names for all languages defined by this package - // this is required in order for us to be able to resolve jsii symbols in native languages. - for (const target of targets) { - if (!(target in pkg.targets)) { - // tslint:disable-next-line:max-line-length - throw new Error(`Dependent package ${packageName} does not have a configuration specified for target '${target}' which is defined by this module`); - } - } - - const moduleName = jsii.name; - visited.add(moduleName); - if (!transitive) { - dependencies[moduleName] = { - version: jsii.version, - targets: jsii.targets, - dependencies: jsii.dependencies - }; - } - - // add all types to lookup table. - if (jsii.types) { - for (const fqn of Object.keys(jsii.types)) { - lookup.set(fqn, jsii.types[fqn]); +const SOURCE_DIRS = new Set(['bin', 'lib', 'test']); +async function _findSourceFiles(dir: string, isRoot = true): Promise { + const result = new Array(); + for (const name of await fs.readdir(dir)) { + const file = path.join(dir, name); + if ((await fs.stat(file)).isDirectory()) { + // Only consider white-listed source-dirs when in the root. + if (!isRoot || SOURCE_DIRS.has(name)) { + result.push(...await _findSourceFiles(file, false)); } - } - - if (jsii.dependencies) { - for (const name of Object.keys(jsii.dependencies)) { - await addDependency(name, moduleDir, /* transitive */ true); - } - } - } - - for (const packageName of Object.keys(packageDeps)) { - // if this package is defined under 'jsiiBundledDependencies', add it to the "bundled" list - const bundledDepIndex = bundledDeps.indexOf(packageName); - if (bundledDepIndex !== -1) { - bundled[packageName] = packageDeps[packageName]; - bundledDeps.splice(bundledDepIndex, 1); // remove from the expected list continue; } - - await addDependency(packageName, rootDir); - } - - if (bundledDeps.length > 0) { - // tslint:disable-next-line:max-line-length - throw new Error(`There are some dependencies defined as jsiiBundledDependencies but we could not find them under "dependencies": ${bundledDeps.join()}`); - } - - return { lookup, dependencies, bundled }; -} - -async function findModuleRoot(dir: string, packageName: string): Promise { - try { - const paths = [ path.join(dir, 'node_modules') ]; - return path.dirname(require.resolve(path.join(packageName, 'package.json'), { paths })); - } catch (e) { - return undefined; - } -} - -async function readJsiiForModule(rootDir: string, packageName: string) { - const moduleDir = await findModuleRoot(rootDir, packageName); - if (!moduleDir) { - throw new Error(`Cannot find ${packageName} using node module resolution from ${rootDir}`); - } - - const pkg = await readPackageMetadata(moduleDir); - - const jsiiFilePath = path.join(moduleDir, spec.SPEC_FILE_NAME); - const jsii = spec.validateAssembly(await fs.readJson(jsiiFilePath)); - if (jsii.schema !== spec.SchemaVersion.V1_0) { - // tslint:disable-next-line:max-line-length - throw new Error(`The jsii spec of module ${packageName} has version ${jsii.schema} while we expect ${spec.SchemaVersion.V1_0} (TODO: semver)`); - } - - return { pkg, jsii, moduleDir }; -} - -async function aglob(pattern: string) { - return new Promise((ok, fail) => glob(pattern, (err, matches) => err ? fail(err) : ok(matches))); -} - -/** - * Build a map from a list using the given function to derive keys - * - * If the key function returns undefined, the value is not added to the map. - */ -function buildMap(xs: T[], keyFn: (x: T) => (string | undefined)): {[key: string]: T} { - const ret: {[key: string]: T} = {}; - for (const x of xs) { - const key = keyFn(x); - if (key !== undefined) { ret[key] = x; } + if (!isRoot && name === 'tsconfig.json') { + // Part of a different typescript project! + return []; + } + if (!(name.endsWith('.ts') || name.endsWith('.tsx'))) { continue; } + if (name.endsWith('.d.ts') || name.endsWith('.d.tsx')) { continue; } + result.push(file); } - return ret; -} - -/** - * True if the type references refer to the same type - */ -export function typeReferencesEqual(a?: spec.TypeReference, b?: spec.TypeReference): boolean { - return deepEqual(a, b, { strict: true }); + return result; } diff --git a/packages/jsii/lib/emitter.ts b/packages/jsii/lib/emitter.ts new file mode 100644 index 0000000000..af6e6f94b8 --- /dev/null +++ b/packages/jsii/lib/emitter.ts @@ -0,0 +1,45 @@ +import ts = require('typescript'); + +/** + * An object that is capable of emitting stuff. + */ +export interface Emitter { + /** + * Attempts to emit stuff. + * + * @return the result of attempting to emit stuff. + */ + emit(): Promise; +} + +/** + * The result of attempting to emit stuff. + */ +export interface EmitResult { + /** Whether the emit was skipped as a result of errors (found in ``diagnostics``) */ + emitSkipped: boolean; + + /** Diagnostic information created when trying to emit stuff */ + diagnostics: ReadonlyArray; +} + +/** + * A diagnostic message generated while trying to emit stuff. + */ +export interface Diagnostic extends ts.Diagnostic { + /** + * The domain of the diagnostic message. + */ + domain: string; +} + +/** + * Determines if a diagnostic entry has an attached domain or not. + * + * @param diagnostic the entity to be assessed + * + * @returns ``true`` if ``diagnostic`` has a domain. + */ +export function hasDomain(diagnostic: ts.Diagnostic | Diagnostic): diagnostic is Diagnostic { + return !!(diagnostic as Diagnostic).domain; +} diff --git a/packages/jsii/lib/index.ts b/packages/jsii/lib/index.ts deleted file mode 100644 index d7ddc657ed..0000000000 --- a/packages/jsii/lib/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { bundle } from './bundle' -export { compilePackage, compileSources } from './compiler' -import * as spec from 'jsii-spec' -export { spec } diff --git a/packages/jsii/lib/literate.ts b/packages/jsii/lib/literate.ts index 8b11b14201..99dfe1bd9a 100644 --- a/packages/jsii/lib/literate.ts +++ b/packages/jsii/lib/literate.ts @@ -116,9 +116,7 @@ export function contentToLines(content: string): string[] { * Return a file system loader given a base directory */ export function fileSystemLoader(directory: string): FileLoader { - return function(fileName: string) { - return loadFromFile(path.resolve(directory, fileName)); - }; + return fileName => loadFromFile(path.resolve(directory, fileName)); } const RELEVANT_TAG = '/// !show'; @@ -144,7 +142,7 @@ function findRelevantLines(lines: string[]): string[] { } else if (line.trim() === DETAIL_TAG) { inRelevant = false; } else { - if (inRelevant) ret.push(line); + if (inRelevant) { ret.push(line); } } } @@ -156,10 +154,10 @@ function findRelevantLines(lines: string[]): string[] { * Remove common leading whitespace from the given lines */ function stripCommonIndent(lines: string[]): string[] { - const whitespace = /^(\s*)/; - const indents = lines.map(x => whitespace.exec(x)![1].length); + const leadingWhitespace = /^(\s*)/; + const indents = lines.map(l => leadingWhitespace.exec(l)![1].length); const commonIndent = Math.min(...indents); - return lines.map(x => x.substr(commonIndent)); + return lines.map(l => l.substr(commonIndent)); } /** @@ -185,15 +183,12 @@ function markdownify(lines: string[]): string[] { return ret; /** - * Flush typescript lines with a ``` block around it. + * Flush typescript lines with a triple-backtick-ts block around it. */ function flushTS() { if (typescriptLines.length !== 0) { - ret.push('```ts'); - ret.push(...typescriptLines); - ret.push('```'); - + ret.push('```ts', ...typescriptLines, '```'); typescriptLines.splice(0); // Clear } } -} \ No newline at end of file +} diff --git a/packages/jsii/lib/package-metadata.ts b/packages/jsii/lib/package-metadata.ts deleted file mode 100644 index f770210ea9..0000000000 --- a/packages/jsii/lib/package-metadata.ts +++ /dev/null @@ -1,229 +0,0 @@ -import * as fs from 'fs-extra'; -import * as path from 'path'; - -// tslint:disable-next-line:no-var-requires -const spdxLicenceList = require('spdx-license-list'); - -export interface PackageMetadata { - /** - * Package name (package.name) - */ - name: string - - /** - * Description of the module - */ - description: string; - - /** - * The url to the project homepage. - */ - homepage: string; - - /** - * The author of the package. - */ - author: Person; - - /** - * Additional contributors - */ - contributors?: Person[]; - - /** - * The module repository - */ - repository: { - /** - * Type of repository. - */ - type: string; - - /** - * The URL of the repository. - */ - url: string; - }; - - /** - * Package version (package.version) - */ - version: string - - /** - * The SPDX license name for the package. - */ - license: string; - - /** - * The module's entrypoint (package.main) - */ - main: string - - /** - * The entry point of the program (package.types, except with the .d.ts extension replaced with .ts) - */ - entrypoint: string - - /** - * jsii output directory - */ - outdir: string - - /** - * Dependencies bundled within this module - */ - bundledDependencies: string[] - - /** - * Mapping of package manager => configuration - * For example, { "mvn": { basePackage: "com.amazonaws.cdk", groupId: "com.amazonaws.cdk", artifactId: "core" } } - */ - targets: { [name: string]: { [key: string]: any | undefined } }; - - /** - * Package npm dependencies (package.dependencies) - */ - dependencies: { [name: string]: string } -} - -/** - * Information about a person involved with the project. - */ -export interface Person { - /** - * The name of the person - */ - name: string; - - /** - * The roles of the person. - */ - roles: string[]; - - /** - * The email of the person. - */ - email?: string; - - /** - * The URL for the person. - */ - url?: string; - - /** - * Whether the person is an organization - */ - organization?: boolean; -} - -export default async function readPackageMetadata(moduleDir: string): Promise { - const pkgFile = path.resolve(path.join(moduleDir, 'package.json')); - - let pkg: any = { }; - if (await fs.pathExists(pkgFile)) { - pkg = await fs.readJson(pkgFile); - } - - // defaults - if (!pkg.name) { pkg.name = path.basename(moduleDir); } - if (!pkg.version) { throw new Error(`${pkgFile} must contain a "version" field (with value following the semver syntax)`); } - if (!pkg.types) { pkg.types = 'index.d.ts'; } - if (!pkg.jsii) { pkg.jsii = { outdir: '.' }; } - if (!pkg.main) { pkg.main = 'index.js'; } - - if (!pkg.license) { throw new Error(`${pkgFile} must contain a "license" field (with an SPDX license identifier)`); } - if (!(pkg.license in spdxLicenceList)) { - throw new Error(`${pkgFile} has "license" ${pkg.license}, which doesn't appear to be a valid SPDX identifier`); - } - - if (!pkg.repository || !pkg.repository.url) { - throw new Error(`${pkgFile} must contain a "repository" field with "url"`); - } - if (!pkg.repository.type) { - if (pkg.repository.url.startsWith('git:') || pkg.repository.url.endsWith('.git') || pkg.repository.url.indexOf('://github.com/') !== -1) { - pkg.repository.type = 'git'; - } else if (!pkg.repository.url.startsWith('http://') && !pkg.repository.url.startsWith('https://')) { - const matches = pkg.repository.url.match(/^([^:]+):/); - if (matches) { - pkg.repository.type = matches[1]; - } - } - } - // Defaulting repository type failed :( - if (!pkg.repository.type) { - throw new Error(`${pkgFile} must specify the "repository.type" field (could not guess from ${pkg.repository.url})`); - } - - // Not validating presence of "roles", because we have smart defaults - if (!pkg.author || !pkg.author.name) { - throw new Error(`${pkgFile} must contain an "author" field with "name"`); - } - - // Not validating presence of "roles", because we have smart defaults - if (pkg.contributors) { - if (!Array.isArray(pkg.contributors)) { - throw new Error(`${pkgFile}'s "contributors" field must be an array`); - } - for (const contributor of pkg.contributors) { - if (!contributor.name) { - throw new Error(`All elements of the "contributors" field of ${pkgFile} must have a "name"`); - } - } - } - - // default "description" to "name" and "homepage" to repo url - if (!pkg.description) { pkg.description = pkg.name; } - if (!pkg.homepage) { pkg.homepage = pkg.repository.url; } - - if (!pkg.jsii.outdir) { throw new Error(`${pkgFile} must contain a "jsii.outdir" field`); } - if (!pkg.jsii.targets) { throw new Error(`${pkgFile} must contain a "jsii.targets" field`); } - if (!pkg.types.endsWith('.d.ts')) { - const quickFix = pkg.types.endsWith('.ts') ? `Fix this by setting "types" to "${pkg.types.replace(/\.ts$/, '.d.ts')}"` - : ''; - throw new Error(`${pkgFile} "types" field value must end with .d.ts, but "${pkg.types}" was provided. ${quickFix}`); - } - - const main = path.join(moduleDir, pkg.main); - const types = path.join(moduleDir, pkg.types); - const outdir = path.resolve(moduleDir, pkg.jsii.outdir); - - if ('bundledDependencies' in pkg.jsii) { - throw new Error(`"jsii.bundledDependencies" is deprecated. Use the normal "bundledDependencies" instead`); - } - - return { - name: pkg.name, - description: pkg.description, - homepage: pkg.homepage, - author: cleanPerson(pkg.author, 'author'), - contributors: pkg.contributors && pkg.contributors.map((p: Person) => cleanPerson(p, 'contributor')), - repository: pkg.repository, - version: pkg.version, - license: pkg.license, - outdir, - main, - dependencies: pkg.dependencies || {}, - bundledDependencies: pkg.bundledDependencies || [], - targets: pkg.jsii.targets || {}, - entrypoint: types.replace(/\.d\.ts$/, '.ts') - }; -} - -/** - * Ensures a ``Person`` instance does not have any additional fields, and that - * the ``roles`` field (if set) contains no duplicates. - * - * @param person the person to be cleaned. - * - * @returns the cleaned up person. - */ -function cleanPerson(person: Person, defaultRole: string): Person { - return { - name: person.name, - email: person.email, - url: person.url, - roles: (person.roles && [...new Set(person.roles)]) || [defaultRole], - organization: person.organization - }; -} diff --git a/packages/jsii/lib/project-info.ts b/packages/jsii/lib/project-info.ts new file mode 100644 index 0000000000..c3305e9064 --- /dev/null +++ b/packages/jsii/lib/project-info.ts @@ -0,0 +1,156 @@ +import fs = require('fs-extra'); +import spec = require('jsii-spec'); +import log4js = require('log4js'); +import path = require('path'); +import semver = require('semver'); + +// tslint:disable:no-var-requires Modules without TypeScript definitions +const spdx: Set = require('spdx-license-list/simple'); +// tslint:enable:no-var-requires + +const LOG = log4js.getLogger('jsii/package-info'); + +export interface ProjectInfo { + readonly projectRoot: string; + + readonly name: string; + readonly version: string; + readonly author: spec.Person; + readonly license: string; + readonly repository: { + readonly type: string; + readonly url: string; + }; + + readonly main: string; + readonly types: string; + + readonly dependencies: ReadonlyArray; + readonly transitiveDependencies: ReadonlyArray; + readonly bundleDependencies: { readonly [name: string]: string }; + readonly targets: spec.AssemblyTargets; + readonly description?: string; + readonly homepage?: string; + readonly contributors?: ReadonlyArray; +} + +export async function loadProjectInfo(projectRoot: string): Promise { + const pkg = require(path.join(projectRoot, 'package.json')); + + const bundleDependencies: { [name: string]: string } = {}; + (pkg.bundleDependencies || pkg.bundledDependencies || []).forEach((name: string) => { + const version = pkg.dependencies[name]; + if (!version) { + throw new Error(`The "package.json" has "${name}" in "bundleDependencies", but it is not declared in "dependencies"`); + } + bundleDependencies[name] = version; + }); + + const [dependencies, transitiveDependencies] = + await _loadDependencies(pkg.dependencies, projectRoot, new Set(Object.keys(bundleDependencies))); + + return { + projectRoot, + + name: _required(pkg.name, 'The "package.json" file must specify the "name" attribute'), + version: _required(pkg.version, 'The "package.json" file must specify the "version" attribute'), + author: _toPerson(_required(pkg.author, 'The "package.json" file must specify the "author" attribute'), 'author'), + repository: { + url: _required(pkg.repository.url, 'The "package.json" file must specify the "repository.url" attribute'), + type: pkg.repository.type || _guessRepositoryType(pkg.repository.url) + }, + license: _validateLicense(pkg.license), + + main: _required(pkg.main, 'The "package.json" file must specify the "main" attribute'), + types: _required(pkg.types, 'The "package.json" file must specify the "types" attribute'), + + dependencies, + transitiveDependencies, + bundleDependencies, + targets: { + ..._required(pkg.jsii, 'The "package.json" file must specify the "jsii" attribute').targets, + js: { npm: pkg.name } + }, + + description: pkg.description, + homepage: pkg.homepage, + contributors: pkg.contributors + && (pkg.contributors as any[]).map((contrib, index) => _toPerson(contrib, `contributors[${index}]`, 'contributor')) + }; +} + +function _guessRepositoryType(url: string): string { + if (url.endsWith('.git')) { return 'git'; } + const parts = url.match(/^([^:]+):\/\//); + if (parts && parts[1] !== 'http' && parts[1] !== 'https') { + return parts[1]; + } + throw new Error(`The "package.json" file must specify the "repository.type" attribute (could not guess from ${url})`); +} + +async function _loadDependencies(dependencies: { [name: string]: string | spec.PackageVersion } | undefined, + searchPath: string, + bundled: Set = new Set()): Promise<[spec.Assembly[], spec.Assembly[]]> { + if (!dependencies) { return [[], []]; } + const assemblies = new Array(); + const transitiveAssemblies = new Array(); + for (const name of Object.keys(dependencies)) { + if (bundled.has(name)) { continue; } + const dep = dependencies[name]; + const versionString = typeof dep === 'string' ? dep : dep.version; + const version = new semver.Range(versionString); + if (!version) { + throw new Error(`Invalid semver expression for ${name}: ${versionString}`); + } + const pkg = _tryResolve(path.join(name, '.jsii'), searchPath); + LOG.debug(`Resolved dependency ${name} to ${pkg}`); + const assm = spec.validateAssembly(await fs.readJson(pkg)); + if (!version.intersects(new semver.Range(assm.version))) { + throw new Error(`Declared dependency on version ${versionString} of ${name}, but version ${assm.version} was found`); + } + assemblies.push(assm); + transitiveAssemblies.push(assm); + const pkgDir = path.dirname(pkg); + if (assm.dependencies) { + const [depAssemblies, depTransitiveAssemblies, ] = await _loadDependencies(assm.dependencies, pkgDir); + for (const depAssembly of depAssemblies.concat(depTransitiveAssemblies)) { + if (transitiveAssemblies.find(a => a.name === depAssembly.name) != null) { continue; } + transitiveAssemblies.push(depAssembly); + } + } + } + return [assemblies, transitiveAssemblies]; +} + +function _required(value: T, message: string): T { + if (value == null) { + throw new Error(message); + } + return value; +} + +function _toPerson(value: any, field: string, defaultRole: string = field): spec.Person { + return { + name: _required(value.name, `The "package.json" file must specify the "${field}.name" attribute`), + roles: value.roles ? [...new Set(value.roles as string[])] : [defaultRole], + email: value.email, + url: value.url, + organization: value.organization ? value.organization : undefined + }; +} + +function _tryResolve(mod: string, searchPath: string): string { + try { + return require.resolve(mod, { paths: [searchPath] }); + } catch (e) { + throw new Error(`Unable to locate module: ${mod}`); + } +} + +function _validateLicense(id: string): string { + if (id === 'UNLICENSED') { return id; } + if (!spdx.has(id)) { + throw new Error(`Invalid license identifier "${id}", see valid license identifiers at https://spdx.org/licenses/`); + } + return id; +} diff --git a/packages/jsii/lib/util.ts b/packages/jsii/lib/util.ts deleted file mode 100644 index 908f968d05..0000000000 --- a/packages/jsii/lib/util.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Can be passed to JSON.stringify to filter out empty arrays, objects and strings, as well as ``false``. - */ -export function filterEmpty(_key: any, value: any): any { - if (Array.isArray(value) && value.length === 0) { - return undefined; - } - if (typeof value === 'object' && Object.keys(value).length === 0) { - return undefined; - } - if (!value) { - return undefined; - } - - return value; -} diff --git a/packages/jsii/lib/utils.ts b/packages/jsii/lib/utils.ts new file mode 100644 index 0000000000..cebff1a757 --- /dev/null +++ b/packages/jsii/lib/utils.ts @@ -0,0 +1,50 @@ +import log4js = require('log4js'); +import ts = require('typescript'); + +/** + * Obtains the relevant logger to be used for a given diagnostic message. + * + * @param logger the ``log4js.Logger`` to use for emitting the message. + * @param diagnostic the message for which a logger is requested. + * + * @returns a logger method of the ``logger`` for the appropriate level. + */ +export function diagnosticsLogger(logger: log4js.Logger, diagnostic: ts.Diagnostic): ((message: any, ...args: any[]) => void) | undefined { + switch (diagnostic.category) { + case ts.DiagnosticCategory.Error: + if (!logger.isErrorEnabled()) { return undefined; } + return logger.error.bind(logger); + case ts.DiagnosticCategory.Warning: + if (!logger.isWarnEnabled()) { return undefined; } + return logger.warn.bind(logger); + case ts.DiagnosticCategory.Message: + case ts.DiagnosticCategory.Suggestion: + default: + if (!logger.isDebugEnabled()) { return undefined; } + return logger.debug.bind(logger); + } +} + +/** + * A filter function for ``JSON.stringify`` that removes: + * - ``false``-y values (``false``, empty strings, 0) + * - empty arrays + * - empty objects + * + * @param _key the key of the key-value pair being filtered (not used). + * @param value the value of the key-value pair being filtered. + * + * @returns ``value`` or ``undefined`` + */ +export function filterEmpty(_key: string, value: any): any { + if (!value) { + return undefined; + } + if (Array.isArray(value) && value.length === 0) { + return undefined; + } + if (typeof value === 'object' && Object.keys(value).length === 0) { + return undefined; + } + return value; +} diff --git a/packages/jsii/lib/validator.ts b/packages/jsii/lib/validator.ts new file mode 100644 index 0000000000..0d66bb12d9 --- /dev/null +++ b/packages/jsii/lib/validator.ts @@ -0,0 +1,348 @@ +import Case = require('case'); +import spec = require('jsii-spec'); +import ts = require('typescript'); +import { Diagnostic, EmitResult, Emitter } from './emitter'; +import { ProjectInfo } from './project-info'; + +// tslint:disable:no-var-requires not TypeScript modules +const deepEqual = require('deep-equal'); +// tslint:enable:no-var-requires + +export class Validator implements Emitter { + public static VALIDATIONS: ValidationFunction[] = _defaultValidations(); + + private _diagnostics: Diagnostic[] = []; + + public constructor(public readonly projectInfo: ProjectInfo, + public readonly assembly: spec.Assembly) {} + + public async emit(): Promise { + this._diagnostics = []; + + for (const validation of Validator.VALIDATIONS) { + validation(this, this.assembly, this._diagnostic.bind(this)); + } + + try { + return { + diagnostics: this._diagnostics, + emitSkipped: this._diagnostics.find(diag => diag.category === ts.DiagnosticCategory.Error) != null + }; + } finally { + // Clearing ``this._diagnostics`` to allow contents to be garbage-collected. + delete this._diagnostics; + } + } + + private _diagnostic(category: ts.DiagnosticCategory, messageText: string) { + this._diagnostics.push({ + domain: 'JSII', + category, code: 0, + messageText, + file: undefined, + start: undefined, + length: undefined + }); + } +} + +export type DiagnosticEmitter = (category: ts.DiagnosticCategory, messageText: string) => void; +export type ValidationFunction = (validator: Validator, + assembly: spec.Assembly, + diagnostic: DiagnosticEmitter) => void; + +function _defaultValidations(): ValidationFunction[] { + return [ + _typeNamesMustUsePascalCase, + _memberNamesMustUseCamelCase, + _staticConstantNamesMustUseUpperSnakeCase, + _memberNamesMustNotLookLikeJavaGettersOrSetters, + _allTypeReferencesAreValid, + _inehritanceDoesNotChangeContracts + ]; + + function _typeNamesMustUsePascalCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) { + for (const type of _allTypes(assembly)) { + if (type.name !== Case.pascal(type.name)) { + diagnostic(ts.DiagnosticCategory.Error, + `Type names must use PascalCase: ${type.name}`); + } + } + } + + function _memberNamesMustUseCamelCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) { + for (const member of _allMembers(assembly)) { + if (member.static && (member as spec.Property).const) { continue; } + if (member.name && member.name !== Case.camel(member.name)) { + diagnostic(ts.DiagnosticCategory.Error, + `Method and property names must use camelCase: ${member.name}`); + } + } + } + + function _staticConstantNamesMustUseUpperSnakeCase(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) { + for (const member of _allMembers(assembly)) { + if (!member.static || !(member as spec.Property).const) { continue; } + if (member.name + && member.name !== Case.constant(member.name) + && member.name !== Case.pascal(member.name) + && member.name !== Case.camel(member.name)) { + diagnostic(ts.DiagnosticCategory.Error, + `Static constant names must use TRUMP_CASE, PascalCase or camelCase: ${member.name}`); + } + } + } + + function _memberNamesMustNotLookLikeJavaGettersOrSetters(_: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) { + for (const member of _allMembers(assembly)) { + if (!member.name) { continue; } + const snakeName = Case.snake(member.name); + if (snakeName.startsWith('get_') && _isEmpty((member as spec.Method).parameters)) { + diagnostic(ts.DiagnosticCategory.Error, + `Methods and properties cannot have names like getXxx() - those conflict with Java property getters by the same name`); + } else if (snakeName.startsWith('set_') && ((member as spec.Method).parameters || []).length === 1) { + diagnostic(ts.DiagnosticCategory.Error, + `Methods and properties cannot have names like setXxx() - those conflict with Java property setters by the same name`); + } + } + } + + function _allTypeReferencesAreValid(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) { + for (const typeRef of _allTypeReferences(assembly)) { + const [assm, ] = typeRef.fqn.split('.'); + if (assembly.name === assm) { + if (!(typeRef.fqn in (assembly.types || {}))) { + diagnostic(ts.DiagnosticCategory.Error, + `Exported APIs cannot use un-exported type ${typeRef.fqn}`); + } + continue; + } + const foreignAssm = validator.projectInfo.transitiveDependencies.find(dep => dep.name === assm); + if (!foreignAssm) { + diagnostic(ts.DiagnosticCategory.Error, + `Type reference is rooted in unknown module: ${assm}`); + continue; + } + if (!(typeRef.fqn in (foreignAssm.types || {}))) { + diagnostic(ts.DiagnosticCategory.Error, + `Type reference not found in ${assm}: ${typeRef.fqn}`); + } + } + } + + function _inehritanceDoesNotChangeContracts(validator: Validator, assembly: spec.Assembly, diagnostic: DiagnosticEmitter) { + for (const type of _allTypes(assembly)) { + if (spec.isClassType(type)) { + for (const method of type.methods || []) { + _validateMethodOverride(method, type); + } + for (const property of type.properties || []) { + _validatePropertyOverride(property, type); + } + } + if (spec.isClassOrInterfaceType(type) && type.interfaces && type.interfaces.length > 0) { + for (const method of type.methods || []) { + // Overrides "win" over implementations + if (method.overrides) { continue; } + _validateMethodImplementation(method, type); + } + for (const property of type.properties || []) { + _validatePropertyImplementation(property, type); + } + } + } + + function _validateMethodOverride(method: spec.Method, type: spec.ClassType): boolean { + if (!type.base) { return false; } + const baseType = _dereference(type.base, assembly, validator) as spec.ClassType; + if (!baseType) { return false; } + const overridden = (baseType.methods || []).find(m => m.name === method.name); + if (!overridden) { + return _validateMethodOverride(method, baseType); + } + _assertSignaturesMatch(overridden, method, `${type.fqn}#${method.name}`, `overriding ${baseType.fqn}`); + method.overrides = { fqn: baseType.fqn }; + return true; + } + + function _validatePropertyOverride(property: spec.Property, type: spec.ClassType): boolean { + if (!type.base) { return false; } + const baseType = _dereference(type.base, assembly, validator) as spec.ClassType; + if (!baseType) { return false; } + const overridden = (baseType.properties || []).find(p => p.name === property.name); + if (!overridden) { + return _validatePropertyOverride(property, baseType); + } + _assertPropertiesMatch(overridden, property, `${type.fqn}#${property.name}`, `overriding ${baseType.fqn}`); + property.overrides = { fqn: baseType.fqn }; + return true; + } + + function _validateMethodImplementation(method: spec.Method, type: spec.ClassType | spec.InterfaceType): boolean { + if (!type.interfaces) { + // Abstract classes may not directly implement all members, need to check their supertypes... + if (spec.isClassType(type) && type.base && type.abstract) { + return _validateMethodImplementation(method, _dereference(type.base, assembly, validator) as spec.ClassType); + } + return false; + } + for (const iface of type.interfaces) { + const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType; + const implemented = (ifaceType.methods || []).find(m => m.name === method.name); + if (implemented) { + _assertSignaturesMatch(implemented, method, `${type.fqn}#${method.name}`, `implementing ${ifaceType.fqn}`); + method.overrides = { fqn: iface.fqn }; + return true; + } + if (_validateMethodImplementation(method, ifaceType)) { + return true; + } + } + return false; + } + + function _validatePropertyImplementation(property: spec.Property, type: spec.ClassType | spec.InterfaceType): boolean { + if (!type.interfaces) { + // Abstract classes may not directly implement all members, need to check their supertypes... + if (spec.isClassType(type) && type.base && type.abstract) { + return _validatePropertyImplementation(property, _dereference(type.base, assembly, validator) as spec.ClassType); + } + return false; + } + for (const iface of type.interfaces) { + const ifaceType = _dereference(iface, assembly, validator) as spec.InterfaceType; + const implemented = (ifaceType.properties || []).find(p => p.name === property.name); + if (implemented) { + _assertPropertiesMatch(implemented, property, `${type.fqn}#${property.name}`, `implementing ${ifaceType.fqn}`); + property.overrides = { fqn: iface.fqn }; + return true; + } + if (_validatePropertyImplementation(property, ifaceType)) { + return true; + } + } + return false; + } + + function _assertSignaturesMatch(expected: spec.Method, actual: spec.Method, label: string, action: string) { + if (!deepEqual(actual.returns, expected.returns)) { + const expType = spec.describeTypeReference(expected.returns); + const actType = spec.describeTypeReference(actual.returns); + diagnostic(ts.DiagnosticCategory.Error, + `${label} changes the return type when ${action} (expected ${expType}, found ${actType})`); + } + const expectedParams = expected.parameters || []; + const actualParams = actual.parameters || []; + if (expectedParams.length !== actualParams.length) { + diagnostic(ts.DiagnosticCategory.Error, + `${label} changes argument count when ${action} (expected ${expectedParams.length}, found ${actualParams.length})`); + return; + } + for (let i = 0 ; i < expectedParams.length ; i++) { + const expParam = expectedParams[i]; + const actParam = actualParams[i]; + if (!deepEqual(expParam.type, actParam.type)) { + const expType = spec.describeTypeReference(expParam.type); + const actType = spec.describeTypeReference(actParam.type); + diagnostic(ts.DiagnosticCategory.Error, + `${label} changes type of argument ${actParam.name} when ${action} (expected ${expType}, found ${actType}`); + } + // Not-ing those to force the values to a strictly boolean context (they're optional, undefined means false) + if (!expParam.variadic !== !actParam.variadic) { + diagnostic(ts.DiagnosticCategory.Error, + // tslint:disable-next-line:max-line-length + `${label} changes the variadicity of argument ${actParam.name} when ${action} (expected ${expParam.variadic}, found ${actParam.variadic})`); + } + } + } + + function _assertPropertiesMatch(expected: spec.Property, actual: spec.Property, label: string, action: string) { + if (!deepEqual(expected.type, actual.type)) { + const expType = spec.describeTypeReference(expected.type); + const actType = spec.describeTypeReference(actual.type); + diagnostic(ts.DiagnosticCategory.Error, + `${label} changes the type of property when ${action} (expected ${expType}, found ${actType})`); + } + if (expected.immutable !== actual.immutable) { + diagnostic(ts.DiagnosticCategory.Error, + `${label} changes immutability of property when ${action}`); + } + } + } +} + +function _allTypes(assm: spec.Assembly): spec.Type[] { + return Object.values(assm.types || {}); +} + +function _allMethods(assm: spec.Assembly): spec.Method[] { + const methods = new Array(); + for (const type of _allTypes(assm)) { + if (!spec.isClassOrInterfaceType(type)) { continue; } + if (!type.methods) { continue; } + type.methods.forEach(method => methods.push(method)); + } + return methods; +} + +function _allProperties(assm: spec.Assembly): spec.Property[] { + const properties = new Array(); + for (const type of _allTypes(assm)) { + if (!spec.isClassOrInterfaceType(type)) { continue; } + if (!type.properties) { continue; } + type.properties.forEach(property => properties.push(property)); + } + return properties; +} + +function _allMembers(assm: spec.Assembly): Array { + return [..._allMethods(assm), ..._allProperties(assm)]; +} + +function _allTypeReferences(assm: spec.Assembly): spec.NamedTypeReference[] { + const typeReferences = new Array(); + for (const type of _allTypes(assm)) { + if (!spec.isClassOrInterfaceType(type)) { continue; } + if (spec.isClassType(type) && type.base) { + typeReferences.push(type.base); + } + if (type.interfaces) { + type.interfaces.forEach(iface => typeReferences.push(iface)); + } + } + for (const prop of _allProperties(assm)) { + _collectTypeReferences(prop.type); + } + for (const meth of _allMethods(assm)) { + if (meth.returns) { + _collectTypeReferences(meth.returns); + } + for (const param of meth.parameters || []) { + _collectTypeReferences(param.type); + } + } + return typeReferences; + + function _collectTypeReferences(type: spec.TypeReference): void { + if (spec.isNamedTypeReference(type)) { + typeReferences.push(type); + } else if (spec.isCollectionTypeReference(type)) { + _collectTypeReferences(type.collection.elementtype); + } else if (spec.isUnionTypeReference(type)) { + type.union.types.forEach(t => _collectTypeReferences(t)); + } + } +} + +function _dereference(typeRef: spec.NamedTypeReference, assembly: spec.Assembly, validator: Validator): spec.Type | undefined { + const [assm, ] = typeRef.fqn.split('.'); + if (assembly.name === assm) { + return assembly.types && assembly.types[typeRef.fqn]; + } + const foreignAssm = validator.projectInfo.transitiveDependencies.find(dep => dep.name === assm); + return foreignAssm && foreignAssm.types && foreignAssm.types[typeRef.fqn]; +} + +function _isEmpty(array: undefined | any[]): array is undefined { + return array == null || array.length === 0; +} diff --git a/packages/jsii/lib/watch.ts b/packages/jsii/lib/watch.ts deleted file mode 100644 index ac90166ab2..0000000000 --- a/packages/jsii/lib/watch.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { spawn } from 'child_process'; -import * as path from 'path'; -import { saveCompilerOptions, saveLinterOptions } from './compiler-options'; - -export async function watch(cwd: string) { - // create tsconfig.json - await saveCompilerOptions(cwd); - await saveLinterOptions(cwd); - - // find the 'tsc' executable relative to our typescript compiler module to ensure same version - const tsc = path.resolve(path.join(require.resolve('typescript'), '../../bin/tsc')); - - // execute! - const child = spawn(tsc, [ '--watch' ], { cwd, stdio: 'inherit' }); - - // wait until child is done. - return new Promise((ok, fail) => { - child.on('exit', code => { - if (code === 0) { - ok(); - } else { - fail(new Error('non-zero exit code: ' + code)); - } - }); - }); -} diff --git a/packages/jsii/package-lock.json b/packages/jsii/package-lock.json index 442f02674b..f15afdc9af 100644 --- a/packages/jsii/package-lock.json +++ b/packages/jsii/package-lock.json @@ -2,54 +2,161 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz", + "integrity": "sha1-vXHZsZKvl435FYKdOdQJRFZDmgw=", + "requires": { + "@babel/highlight": "7.0.0-beta.51" + } + }, + "@babel/generator": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.51.tgz", + "integrity": "sha1-bHV1/952HQdIXgS67cA5LG2eMPY=", + "requires": { + "@babel/types": "7.0.0-beta.51", + "jsesc": "^2.5.1", + "lodash": "^4.17.5", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + } + } + }, + "@babel/helper-function-name": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz", + "integrity": "sha1-IbSHSiJ8+Z7K/MMKkDAtpaJkBWE=", + "requires": { + "@babel/helper-get-function-arity": "7.0.0-beta.51", + "@babel/template": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz", + "integrity": "sha1-MoGy0EWvlcFyzpGyCCXYXqRnZBE=", + "requires": { + "@babel/types": "7.0.0-beta.51" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz", + "integrity": "sha1-imw/ZsTSZTUvwHdIT59ugKUauXg=", + "requires": { + "@babel/types": "7.0.0-beta.51" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.51.tgz", + "integrity": "sha1-6IRK4loVlcz9QriWI7Q3bKBtIl0=", + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "@babel/parser": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.0.0-beta.51.tgz", + "integrity": "sha1-J87C30Cd9gr1gnDtj2qlVAnqhvY=" + }, + "@babel/template": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.51.tgz", + "integrity": "sha1-lgKkCuvPNXrpZ34lMu9fyBD1+/8=", + "requires": { + "@babel/code-frame": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", + "lodash": "^4.17.5" + } + }, + "@babel/traverse": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.51.tgz", + "integrity": "sha1-mB2vLOw0emIx06odnhgDsDqqpKg=", + "requires": { + "@babel/code-frame": "7.0.0-beta.51", + "@babel/generator": "7.0.0-beta.51", + "@babel/helper-function-name": "7.0.0-beta.51", + "@babel/helper-split-export-declaration": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", + "debug": "^3.1.0", + "globals": "^11.1.0", + "invariant": "^2.2.0", + "lodash": "^4.17.5" + } + }, + "@babel/types": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.51.tgz", + "integrity": "sha1-2AK3tUO1g2x3iqaReXq/APPZfqk=", + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.5", + "to-fast-properties": "^2.0.0" + } + }, "@types/clone": { "version": "0.1.30", "resolved": "https://registry.npmjs.org/@types/clone/-/clone-0.1.30.tgz", "integrity": "sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=" }, + "@types/colors": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/colors/-/colors-1.2.1.tgz", + "integrity": "sha512-7jNkpfN2lVO07nJ1RWzyMnNhH/I5N9iWuMPx9pedptxJ4MODf8rRV0lbJi6RakQ4sKQk231Fw4e2W9n3D7gZ3w==", + "requires": { + "colors": "*" + } + }, "@types/deep-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/deep-equal/-/deep-equal-1.0.1.tgz", "integrity": "sha512-mMUu4nWHLBlHtxXY17Fg6+ucS/MnndyOWyOe7MmwkoMYxvfQU2ajtRaEvqSUv+aVkMqH/C0NCI8UoVfRNQ10yg==" }, - "@types/events": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", - "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==" - }, "@types/fs-extra": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.8.tgz", - "integrity": "sha512-Z5nu9Pbxj9yNeXIK3UwGlRdJth4cZ5sCq05nI7FaI6B0oz28nxkOtp6Lsz0ZnmLHJGvOJfB/VHxSTbVq/i6ujA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.4.tgz", + "integrity": "sha512-DsknoBvD8s+RFfSGjmERJ7ZOP1HI0UZRA3FSI+Zakhrc/Gy26YQsLI+m5V5DHxroHRJqCDLKJp7Hixn8zyaF7g==", "requires": { "@types/node": "*" } }, - "@types/glob": { - "version": "5.0.35", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-5.0.35.tgz", - "integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==", + "@types/log4js": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@types/log4js/-/log4js-2.3.5.tgz", + "integrity": "sha512-SwF8LkSHqHy9A8GQ67NAYJiGl8zzP4Qtx65Wa+IOxDGdMHxKeoQZjg7m2M1erIT6VK0DYHpu2aTbdLkdkuMHjw==", "requires": { - "@types/events": "*", - "@types/minimatch": "*", - "@types/node": "*" + "log4js": "*" } }, - "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" - }, "@types/node": { - "version": "9.6.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.26.tgz", - "integrity": "sha512-3LKKscYUZdZreOuvnly8oWsCA1TOWtmkV3mbcUnV34f+nqDWJic+4SGjRi1C/sPHnZcSs/x209O+Dgy8aWHt2A==" + "version": "8.10.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.24.tgz", + "integrity": "sha512-5YaBKa6oFuWy7ptIFMATyftIcpZTZtvgrzPThEbs+kl4Uu41oUxiRunG0k32QZjD6MXMELls//ry/epNxc11aQ==" }, "@types/nodeunit": { "version": "0.0.30", "resolved": "https://registry.npmjs.org/@types/nodeunit/-/nodeunit-0.0.30.tgz", "integrity": "sha1-SNLCcZoRjHcjuDMGw+gAsRor9ng=" }, + "@types/semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==" + }, "@types/yargs": { "version": "11.1.1", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-11.1.1.tgz", @@ -67,9 +174,17 @@ } }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } }, "argparse": { "version": "1.0.10", @@ -92,14 +207,6 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "requires": { - "lodash": "^4.17.10" - } - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -129,11 +236,6 @@ "tweetnacl": "^0.14.3" } }, - "big.js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", - "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==" - }, "bind-obj-methods": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/bind-obj-methods/-/bind-obj-methods-2.0.0.tgz", @@ -173,6 +275,21 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "circular-json": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.5.tgz", + "integrity": "sha512-13YaR6kiz0kBNmIVM87Io8Hp7bWOo4r61vkEANy8iH9R9bc6avud/1FT0SBpqR1RpIQADOh/Q+yHZDA1iL6ysA==" + }, "clean-yaml-object": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz", @@ -186,21 +303,6 @@ "string-width": "^2.1.1", "strip-ansi": "^4.0.0", "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "requires": { - "ansi-regex": "^3.0.0" - } - } } }, "clone": { @@ -218,11 +320,29 @@ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, + "color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "requires": { + "color-name": "1.1.1" + } + }, + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=" + }, "color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" }, + "colors": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.1.tgz", + "integrity": "sha512-jg/vxRmv430jixZrC+La5kMbUWqIg32/JsYNZb94+JEmzceYbWKTsv1OuTp+7EaqiaWRR2tPcykibwCRgclIsw==" + }, "combined-stream": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", @@ -252,14 +372,22 @@ "log-driver": "^1.2.7", "minimist": "^1.2.0", "request": "^2.85.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } } }, "cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "requires": { "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", "which": "^1.2.9" } }, @@ -271,18 +399,26 @@ "assert-plus": "^1.0.0" } }, + "date-format": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz", + "integrity": "sha1-YV6CjiM90aubua4JUODOzPpuytg=" + }, "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "requires": { "ms": "2.0.0" } }, "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "requires": { + "xregexp": "4.0.0" + } }, "deep-equal": { "version": "1.0.1", @@ -324,11 +460,6 @@ "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.1.tgz", "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==" }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -339,6 +470,11 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, "events-to-array": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/events-to-array/-/events-to-array-1.1.2.tgz", @@ -356,18 +492,6 @@ "p-finally": "^1.0.0", "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - } } }, "extend": { @@ -391,11 +515,11 @@ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "requires": { - "locate-path": "^2.0.0" + "locate-path": "^3.0.0" } }, "foreground-child": { @@ -405,6 +529,17 @@ "requires": { "cross-spawn": "^4", "signal-exit": "^3.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + } } }, "forever-agent": { @@ -428,9 +563,9 @@ "integrity": "sha1-zyVVTKBQ3EmuZla0HeQiWJidy84=" }, "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -478,6 +613,11 @@ "path-is-absolute": "^1.0.0" } }, + "globals": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==" + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -494,14 +634,19 @@ "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" }, "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", "requires": { - "ajv": "^5.1.0", + "ajv": "^5.3.0", "har-schema": "^2.0.0" } }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -531,6 +676,14 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "requires": { + "loose-envify": "^1.0.0" + } + }, "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", @@ -554,8 +707,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "optional": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -567,6 +719,30 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "istanbul-lib-coverage": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", + "integrity": "sha512-nPvSZsVlbG9aLhZYaC3Oi1gT/tpyo3Yt5fNyf6NmcKIayz4VV/txxJFFKAK/gU4dcNn8ehsanBbVHVl0+amOLA==" + }, + "istanbul-lib-instrument": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-2.3.2.tgz", + "integrity": "sha512-l7TD/VnBsIB2OJvSyxaLW/ab1+92dxZNH9wLH7uHPPioy3JZ8tnx2UXUdKmdkgmP2EFPzg64CToUP6dAS3U32Q==", + "requires": { + "@babel/generator": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/template": "7.0.0-beta.51", + "@babel/traverse": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", + "istanbul-lib-coverage": "^2.0.1", + "semver": "^5.5.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" + }, "js-yaml": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", @@ -582,6 +758,11 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "optional": true }, + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=" + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -597,11 +778,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" - }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -634,23 +810,12 @@ "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=" }, - "loader-utils": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", - "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0", - "object-assign": "^4.0.1" - } - }, "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "requires": { - "p-locate": "^2.0.0", + "p-locate": "^3.0.0", "path-exists": "^3.0.0" } }, @@ -664,6 +829,25 @@ "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==" }, + "log4js": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-3.0.4.tgz", + "integrity": "sha512-4rQ1TrOf85lxB0+hBiPF27Zw8pGTHxKZq8FYfum1TNhx/KMUlQ+LL4bMKcdzc7zoAFF992w8+MFQm3BQbUgePA==", + "requires": { + "circular-json": "^0.5.5", + "date-format": "^1.2.0", + "debug": "^3.1.0", + "streamroller": "0.7.0" + } + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, "lru-cache": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", @@ -708,14 +892,14 @@ } }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minipass": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.3.tgz", - "integrity": "sha512-/jAn9/tEX4gnpyRATxgHEOV6xbcyxgT7iUnxo9Y3+OB0zX00TgKIv/2FZCf5brBbICcwbLqVv2ImjvWWrQMSYw==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.4.tgz", + "integrity": "sha512-mlouk1OHlaUE8Odt1drMtG1bAJA4ZA6B/ehysgV0LUIrDHdKgo1KorZq3pK0b/7Z7LJIQ12MNM6aC+Tn6lUZ5w==", "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -734,13 +918,6 @@ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - } } }, "ms": { @@ -771,9 +948,9 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "nyc": { - "version": "11.9.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.9.0.tgz", - "integrity": "sha512-w8OdJAhXL5izerzZMdqzYKMj/pgHJyY3qEPYBjLLxrhcVoHEY9pU5ENIiZyCgG9OR7x3VcUMoD40o6PtVpfR4g==", + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-12.0.2.tgz", + "integrity": "sha1-ikpO1pCWbBHsWH/4fuoMEsl0upk=", "requires": { "archy": "^1.0.0", "arrify": "^1.0.1", @@ -785,12 +962,12 @@ "find-up": "^2.1.0", "foreground-child": "^1.5.3", "glob": "^7.0.6", - "istanbul-lib-coverage": "^1.1.2", + "istanbul-lib-coverage": "^1.2.0", "istanbul-lib-hook": "^1.1.0", - "istanbul-lib-instrument": "^1.10.0", + "istanbul-lib-instrument": "^2.1.0", "istanbul-lib-report": "^1.1.3", - "istanbul-lib-source-maps": "^1.2.3", - "istanbul-reports": "^1.4.0", + "istanbul-lib-source-maps": "^1.2.5", + "istanbul-reports": "^1.4.1", "md5-hex": "^1.2.0", "merge-source-map": "^1.1.0", "micromatch": "^3.1.10", @@ -818,11 +995,7 @@ "bundled": true }, "ansi-regex": { - "version": "2.1.1", - "bundled": true - }, - "ansi-styles": { - "version": "2.2.1", + "version": "3.0.0", "bundled": true }, "append-transform": { @@ -868,84 +1041,6 @@ "version": "2.1.1", "bundled": true }, - "babel-code-frame": { - "version": "6.26.0", - "bundled": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, - "babel-generator": { - "version": "6.26.1", - "bundled": true, - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" - } - }, - "babel-messages": { - "version": "6.23.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-runtime": { - "version": "6.26.0", - "bundled": true, - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - } - }, - "babel-types": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - } - }, - "babylon": { - "version": "6.18.0", - "bundled": true - }, "balanced-match": { "version": "1.0.0", "bundled": true @@ -993,10 +1088,6 @@ "kind-of": "^6.0.2" } }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, "kind-of": { "version": "6.0.2", "bundled": true @@ -1053,12 +1144,6 @@ "to-object-path": "^0.3.0", "union-value": "^1.0.0", "unset-value": "^1.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } } }, "caching-transform": { @@ -1084,17 +1169,6 @@ "lazy-cache": "^1.0.3" } }, - "chalk": { - "version": "1.1.3", - "bundled": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, "class-utils": { "version": "0.3.6", "bundled": true, @@ -1111,10 +1185,6 @@ "requires": { "is-descriptor": "^0.1.0" } - }, - "isobject": { - "version": "3.0.1", - "bundled": true } } }, @@ -1167,10 +1237,6 @@ "version": "0.1.1", "bundled": true }, - "core-js": { - "version": "2.5.6", - "bundled": true - }, "cross-spawn": { "version": "4.0.2", "bundled": true, @@ -1180,7 +1246,7 @@ } }, "debug": { - "version": "2.6.9", + "version": "3.1.0", "bundled": true, "requires": { "ms": "2.0.0" @@ -1236,23 +1302,12 @@ "kind-of": "^6.0.2" } }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, "kind-of": { "version": "6.0.2", "bundled": true } } }, - "detect-indent": { - "version": "4.0.0", - "bundled": true, - "requires": { - "repeating": "^2.0.0" - } - }, "error-ex": { "version": "1.3.1", "bundled": true, @@ -1260,14 +1315,6 @@ "is-arrayish": "^0.2.1" } }, - "escape-string-regexp": { - "version": "1.0.5", - "bundled": true - }, - "esutils": { - "version": "2.0.2", - "bundled": true - }, "execa": { "version": "0.7.0", "bundled": true, @@ -1305,6 +1352,13 @@ "to-regex": "^3.0.1" }, "dependencies": { + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, "define-property": { "version": "0.2.5", "bundled": true, @@ -1477,10 +1531,6 @@ "path-is-absolute": "^1.0.0" } }, - "globals": { - "version": "9.18.0", - "bundled": true - }, "graceful-fs": { "version": "4.1.11", "bundled": true @@ -1504,17 +1554,6 @@ } } }, - "has-ansi": { - "version": "2.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-flag": { - "version": "1.0.0", - "bundled": true - }, "has-value": { "version": "1.0.0", "bundled": true, @@ -1522,12 +1561,6 @@ "get-value": "^2.0.6", "has-values": "^1.0.0", "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } } }, "has-values": { @@ -1538,27 +1571,11 @@ "kind-of": "^4.0.0" }, "dependencies": { - "is-number": { - "version": "3.0.0", + "kind-of": { + "version": "4.0.0", "bundled": true, "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "^1.1.5" } } } @@ -1583,13 +1600,6 @@ "version": "2.0.3", "bundled": true }, - "invariant": { - "version": "2.2.4", - "bundled": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, "invert-kv": { "version": "1.0.0", "bundled": true @@ -1642,13 +1652,6 @@ "version": "0.1.1", "bundled": true }, - "is-finite": { - "version": "1.0.2", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, "is-fullwidth-code-point": { "version": "2.0.0", "bundled": true @@ -1678,12 +1681,6 @@ "bundled": true, "requires": { "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } } }, "is-stream": { @@ -1721,19 +1718,6 @@ "append-transform": "^0.4.0" } }, - "istanbul-lib-instrument": { - "version": "1.10.1", - "bundled": true, - "requires": { - "babel-generator": "^6.18.0", - "babel-template": "^6.16.0", - "babel-traverse": "^6.18.0", - "babel-types": "^6.18.0", - "babylon": "^6.18.0", - "istanbul-lib-coverage": "^1.2.0", - "semver": "^5.3.0" - } - }, "istanbul-lib-report": { "version": "1.1.3", "bundled": true, @@ -1744,6 +1728,10 @@ "supports-color": "^3.1.2" }, "dependencies": { + "has-flag": { + "version": "1.0.0", + "bundled": true + }, "supports-color": { "version": "3.2.3", "bundled": true, @@ -1754,40 +1742,23 @@ } }, "istanbul-lib-source-maps": { - "version": "1.2.3", + "version": "1.2.5", "bundled": true, "requires": { "debug": "^3.1.0", - "istanbul-lib-coverage": "^1.1.2", + "istanbul-lib-coverage": "^1.2.0", "mkdirp": "^0.5.1", "rimraf": "^2.6.1", "source-map": "^0.5.3" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - } } }, "istanbul-reports": { - "version": "1.4.0", + "version": "1.4.1", "bundled": true, "requires": { "handlebars": "^4.0.3" } }, - "js-tokens": { - "version": "3.0.2", - "bundled": true - }, - "jsesc": { - "version": "1.3.0", - "bundled": true - }, "kind-of": { "version": "3.2.2", "bundled": true, @@ -1832,21 +1803,10 @@ } } }, - "lodash": { - "version": "4.17.10", - "bundled": true - }, "longest": { "version": "1.0.1", "bundled": true }, - "loose-envify": { - "version": "1.3.1", - "bundled": true, - "requires": { - "js-tokens": "^3.0.0" - } - }, "lru-cache": { "version": "4.1.3", "bundled": true, @@ -1983,14 +1943,6 @@ "to-regex": "^3.0.1" }, "dependencies": { - "arr-diff": { - "version": "4.0.0", - "bundled": true - }, - "array-unique": { - "version": "0.3.2", - "bundled": true - }, "kind-of": { "version": "6.0.2", "bundled": true @@ -2045,12 +1997,6 @@ "bundled": true, "requires": { "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } } }, "object.pick": { @@ -2058,12 +2004,6 @@ "bundled": true, "requires": { "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } } }, "once": { @@ -2222,10 +2162,6 @@ } } }, - "regenerator-runtime": { - "version": "0.11.1", - "bundled": true - }, "regex-not": { "version": "1.0.2", "bundled": true, @@ -2242,13 +2178,6 @@ "version": "1.6.1", "bundled": true }, - "repeating": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-finite": "^1.0.0" - } - }, "require-directory": { "version": "2.1.1", "bundled": true @@ -2351,6 +2280,13 @@ "use": "^3.1.0" }, "dependencies": { + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, "define-property": { "version": "0.2.5", "bundled": true, @@ -2406,10 +2342,6 @@ "kind-of": "^6.0.2" } }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, "kind-of": { "version": "6.0.2", "bundled": true @@ -2428,10 +2360,10 @@ "bundled": true }, "source-map-resolve": { - "version": "0.5.1", + "version": "0.5.2", "bundled": true, "requires": { - "atob": "^2.0.0", + "atob": "^2.1.1", "decode-uri-component": "^0.2.0", "resolve-url": "^0.2.1", "source-map-url": "^0.4.0", @@ -2508,26 +2440,13 @@ "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } } }, "strip-ansi": { - "version": "3.0.1", + "version": "4.0.0", "bundled": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^3.0.0" } }, "strip-bom": { @@ -2541,10 +2460,6 @@ "version": "1.0.0", "bundled": true }, - "supports-color": { - "version": "2.0.0", - "bundled": true - }, "test-exclude": { "version": "4.2.1", "bundled": true, @@ -2554,434 +2469,200 @@ "object-assign": "^4.1.0", "read-pkg-up": "^1.0.1", "require-main-filename": "^1.0.1" + } + }, + "to-object-path": { + "version": "0.3.0", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "to-regex": { + "version": "3.0.2", + "bundled": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "bundled": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "uglify-js": { + "version": "2.8.29", + "bundled": true, + "optional": true, + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" }, "dependencies": { - "arr-diff": { - "version": "4.0.0", - "bundled": true - }, - "array-unique": { - "version": "0.3.2", - "bundled": true - }, - "braces": { - "version": "2.3.2", + "yargs": { + "version": "3.10.0", "bundled": true, + "optional": true, "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "union-value": { + "version": "1.0.0", + "bundled": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" } }, - "expand-brackets": { - "version": "2.1.4", + "set-value": { + "version": "0.4.3", "bundled": true, "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unset-value": { + "version": "1.0.0", + "bundled": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "bundled": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" }, "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", + "isobject": { + "version": "2.1.0", "bundled": true, "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "bundled": true - } - } - }, - "extglob": { - "version": "2.0.4", - "bundled": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" + "isarray": "1.0.0" } } } }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", + "has-values": { + "version": "0.1.4", "bundled": true - }, - "micromatch": { - "version": "3.1.10", - "bundled": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } } } }, - "to-fast-properties": { - "version": "1.0.3", + "urix": { + "version": "0.1.0", "bundled": true }, - "to-object-path": { - "version": "0.3.0", + "use": { + "version": "3.1.0", "bundled": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "^6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "bundled": true + } } }, - "to-regex": { - "version": "3.0.2", + "validate-npm-package-license": { + "version": "3.0.3", "bundled": true, "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" } }, - "to-regex-range": { - "version": "2.1.1", + "which": { + "version": "1.3.1", "bundled": true, "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - } + "isexe": "^2.0.0" } }, - "trim-right": { - "version": "1.0.1", + "which-module": { + "version": "2.0.0", "bundled": true }, - "uglify-js": { - "version": "2.8.29", - "bundled": true, - "optional": true, - "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" - }, - "dependencies": { - "yargs": { - "version": "3.10.0", - "bundled": true, - "optional": true, - "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", + "window-size": { + "version": "0.1.0", "bundled": true, "optional": true }, - "union-value": { - "version": "1.0.0", + "wordwrap": { + "version": "0.0.3", + "bundled": true + }, + "wrap-ansi": { + "version": "2.1.0", "bundled": true, "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" }, "dependencies": { - "extend-shallow": { - "version": "2.0.1", + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", "bundled": true, "requires": { - "is-extendable": "^0.1.0" + "number-is-nan": "^1.0.0" } }, - "set-value": { - "version": "0.4.3", + "string-width": { + "version": "1.0.2", "bundled": true, "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } - } - } - }, - "unset-value": { - "version": "1.0.0", - "bundled": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "bundled": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "bundled": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "bundled": true }, - "isobject": { + "strip-ansi": { "version": "3.0.1", - "bundled": true - } - } - }, - "urix": { - "version": "0.1.0", - "bundled": true - }, - "use": { - "version": "3.1.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.2" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "validate-npm-package-license": { - "version": "3.0.3", - "bundled": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "which": { - "version": "1.3.0", - "bundled": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "bundled": true - }, - "window-size": { - "version": "0.1.0", - "bundled": true, - "optional": true - }, - "wordwrap": { - "version": "0.0.3", - "bundled": true - }, - "wrap-ansi": { - "version": "2.1.0", - "bundled": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", "bundled": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "ansi-regex": "^2.0.0" } } } @@ -3025,10 +2706,6 @@ "yargs-parser": "^9.0.2" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, "camelcase": { "version": "4.1.0", "bundled": true @@ -3042,13 +2719,6 @@ "wrap-ansi": "^2.0.0" } }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, "yargs-parser": { "version": "9.0.2", "bundled": true, @@ -3074,14 +2744,9 @@ } }, "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, "once": { "version": "1.4.0", @@ -3092,9 +2757,9 @@ } }, "opener": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz", - "integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.0.tgz", + "integrity": "sha512-MD4s/o61y2slS27zm2s4229V2gAUHX0/e3/XOmY/jsXwhysjjCIHN8lx7gqZCrZk19ym+HjCUWHeMKD7YJtKCQ==" }, "os-homedir": { "version": "1.0.2", @@ -3130,25 +2795,25 @@ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", "requires": { - "p-try": "^1.0.0" + "p-try": "^2.0.0" } }, "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "requires": { - "p-limit": "^1.1.0" + "p-limit": "^2.0.0" } }, "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==" }, "path-exists": { "version": "3.0.0", @@ -3173,14 +2838,18 @@ "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "optional": true + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -3195,7 +2864,6 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "optional": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -3207,30 +2875,30 @@ } }, "request": { - "version": "2.87.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", - "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "requires": { "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", + "aws4": "^1.8.0", "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "tough-cookie": "~2.3.3", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" + "uuid": "^3.3.2" } }, "require-directory": { @@ -3261,6 +2929,11 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -3292,6 +2965,13 @@ "detect-indent": "^5.0.0", "detect-newline": "^2.1.0", "minimist": "^1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } } }, "source-map": { @@ -3299,20 +2979,10 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, - "source-map-loader": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.2.3.tgz", - "integrity": "sha512-MYbFX9DYxmTQFfy2v8FC1XZwpwHKYxg3SK8Wb7VPBKuhDjz8gi9re2819MsG4p49HDyiOSUKlmZ+nQBArW5CGw==", - "requires": { - "async": "^2.5.0", - "loader-utils": "~0.2.2", - "source-map": "~0.6.1" - } - }, "source-map-support": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz", - "integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==", + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.8.tgz", + "integrity": "sha512-WqAEWPdb78u25RfKzOF0swBpY0dKrNdjc4GvLwm7ScX/o9bj8Eh/YL8mcMhBHYDGl87UkkSXDOFnW4G7GhWhGg==", "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -3349,6 +3019,17 @@ "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz", "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=" }, + "streamroller": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz", + "integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==", + "requires": { + "date-format": "^1.2.0", + "debug": "^3.1.0", + "mkdirp": "^0.5.1", + "readable-stream": "^2.3.0" + } + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -3356,81 +3037,2378 @@ "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "tap": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/tap/-/tap-12.0.1.tgz", + "integrity": "sha512-iEJytWaZy8risvfRjuV4+ST+Lrrui/MW2ZCWn01ZaMn0NKFej4+PpBy6bXGOg9+cEGNmI7d3Sdka/zTUZUGidA==", + "requires": { + "bind-obj-methods": "^2.0.0", + "bluebird": "^3.5.1", + "clean-yaml-object": "^0.1.0", + "color-support": "^1.1.0", + "coveralls": "^3.0.1", + "foreground-child": "^1.3.3", + "fs-exists-cached": "^1.0.0", + "function-loop": "^1.0.1", + "glob": "^7.0.0", + "isexe": "^2.0.0", + "js-yaml": "^3.11.0", + "minipass": "^2.3.0", + "mkdirp": "^0.5.1", + "nyc": "^11.8.0", + "opener": "^1.4.1", + "os-homedir": "^1.0.2", + "own-or": "^1.0.0", + "own-or-env": "^1.0.1", + "rimraf": "^2.6.2", + "signal-exit": "^3.0.0", + "source-map-support": "^0.5.6", + "stack-utils": "^1.0.0", + "tap-mocha-reporter": "^3.0.7", + "tap-parser": "^7.0.0", + "tmatch": "^4.0.0", + "trivial-deferred": "^1.0.1", + "tsame": "^2.0.0", + "write-file-atomic": "^2.3.0", + "yapool": "^1.0.0" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "nyc": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.9.0.tgz", + "integrity": "sha512-w8OdJAhXL5izerzZMdqzYKMj/pgHJyY3qEPYBjLLxrhcVoHEY9pU5ENIiZyCgG9OR7x3VcUMoD40o6PtVpfR4g==", "requires": { - "ansi-regex": "^3.0.0" + "archy": "^1.0.0", + "arrify": "^1.0.1", + "caching-transform": "^1.0.0", + "convert-source-map": "^1.5.1", + "debug-log": "^1.0.1", + "default-require-extensions": "^1.0.0", + "find-cache-dir": "^0.1.1", + "find-up": "^2.1.0", + "foreground-child": "^1.5.3", + "glob": "^7.0.6", + "istanbul-lib-coverage": "^1.1.2", + "istanbul-lib-hook": "^1.1.0", + "istanbul-lib-instrument": "^1.10.0", + "istanbul-lib-report": "^1.1.3", + "istanbul-lib-source-maps": "^1.2.3", + "istanbul-reports": "^1.4.0", + "md5-hex": "^1.2.0", + "merge-source-map": "^1.1.0", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.0", + "resolve-from": "^2.0.0", + "rimraf": "^2.6.2", + "signal-exit": "^3.0.1", + "spawn-wrap": "^1.4.2", + "test-exclude": "^4.2.0", + "yargs": "11.1.0", + "yargs-parser": "^8.0.0" + }, + "dependencies": { + "align-text": { + "version": "0.1.4", + "bundled": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + } + }, + "amdefine": { + "version": "1.0.1", + "bundled": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "ansi-styles": { + "version": "2.2.1", + "bundled": true + }, + "append-transform": { + "version": "0.4.0", + "bundled": true, + "requires": { + "default-require-extensions": "^1.0.0" + } + }, + "archy": { + "version": "1.0.0", + "bundled": true + }, + "arr-diff": { + "version": "4.0.0", + "bundled": true + }, + "arr-flatten": { + "version": "1.1.0", + "bundled": true + }, + "arr-union": { + "version": "3.1.0", + "bundled": true + }, + "array-unique": { + "version": "0.3.2", + "bundled": true + }, + "arrify": { + "version": "1.0.1", + "bundled": true + }, + "assign-symbols": { + "version": "1.0.0", + "bundled": true + }, + "async": { + "version": "1.5.2", + "bundled": true + }, + "atob": { + "version": "2.1.1", + "bundled": true + }, + "babel-code-frame": { + "version": "6.26.0", + "bundled": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + } + }, + "babel-generator": { + "version": "6.26.1", + "bundled": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + } + }, + "babel-messages": { + "version": "6.23.0", + "bundled": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-runtime": { + "version": "6.26.0", + "bundled": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "bundled": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "bundled": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "bundled": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "bundled": true + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true + }, + "base": { + "version": "0.11.2", + "bundled": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "bundled": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "bundled": true + }, + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "bundled": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "builtin-modules": { + "version": "1.1.1", + "bundled": true + }, + "cache-base": { + "version": "1.0.1", + "bundled": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "bundled": true + } + } + }, + "caching-transform": { + "version": "1.0.1", + "bundled": true, + "requires": { + "md5-hex": "^1.2.0", + "mkdirp": "^0.5.1", + "write-file-atomic": "^1.1.4" + } + }, + "camelcase": { + "version": "1.2.1", + "bundled": true, + "optional": true + }, + "center-align": { + "version": "0.1.3", + "bundled": true, + "optional": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "chalk": { + "version": "1.1.3", + "bundled": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "class-utils": { + "version": "0.3.6", + "bundled": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "bundled": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "isobject": { + "version": "3.0.1", + "bundled": true + } + } + }, + "cliui": { + "version": "2.1.0", + "bundled": true, + "optional": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "bundled": true, + "optional": true + } + } + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true + }, + "collection-visit": { + "version": "1.0.0", + "bundled": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "commondir": { + "version": "1.0.1", + "bundled": true + }, + "component-emitter": { + "version": "1.2.1", + "bundled": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "convert-source-map": { + "version": "1.5.1", + "bundled": true + }, + "copy-descriptor": { + "version": "0.1.1", + "bundled": true + }, + "core-js": { + "version": "2.5.6", + "bundled": true + }, + "cross-spawn": { + "version": "4.0.2", + "bundled": true, + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "debug-log": { + "version": "1.0.1", + "bundled": true + }, + "decamelize": { + "version": "1.2.0", + "bundled": true + }, + "decode-uri-component": { + "version": "0.2.0", + "bundled": true + }, + "default-require-extensions": { + "version": "1.0.0", + "bundled": true, + "requires": { + "strip-bom": "^2.0.0" + } + }, + "define-property": { + "version": "2.0.2", + "bundled": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "bundled": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "bundled": true + }, + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "detect-indent": { + "version": "4.0.0", + "bundled": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "error-ex": { + "version": "1.3.1", + "bundled": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true + }, + "esutils": { + "version": "2.0.2", + "bundled": true + }, + "execa": { + "version": "0.7.0", + "bundled": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "bundled": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "bundled": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "bundled": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "extend-shallow": { + "version": "3.0.2", + "bundled": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "bundled": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "bundled": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "bundled": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "fill-range": { + "version": "4.0.0", + "bundled": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "find-cache-dir": { + "version": "0.1.1", + "bundled": true, + "requires": { + "commondir": "^1.0.1", + "mkdirp": "^0.5.1", + "pkg-dir": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "bundled": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "for-in": { + "version": "1.0.2", + "bundled": true + }, + "foreground-child": { + "version": "1.5.6", + "bundled": true, + "requires": { + "cross-spawn": "^4", + "signal-exit": "^3.0.0" + } + }, + "fragment-cache": { + "version": "0.2.1", + "bundled": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true + }, + "get-caller-file": { + "version": "1.0.2", + "bundled": true + }, + "get-stream": { + "version": "3.0.0", + "bundled": true + }, + "get-value": { + "version": "2.0.6", + "bundled": true + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globals": { + "version": "9.18.0", + "bundled": true + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true + }, + "handlebars": { + "version": "4.0.11", + "bundled": true, + "requires": { + "async": "^1.4.0", + "optimist": "^0.6.1", + "source-map": "^0.4.4", + "uglify-js": "^2.6" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "bundled": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "has-ansi": { + "version": "2.0.0", + "bundled": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "1.0.0", + "bundled": true + }, + "has-value": { + "version": "1.0.0", + "bundled": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "bundled": true + } + } + }, + "has-values": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "bundled": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "bundled": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hosted-git-info": { + "version": "2.6.0", + "bundled": true + }, + "imurmurhash": { + "version": "0.1.4", + "bundled": true + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "invariant": { + "version": "2.2.4", + "bundled": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "invert-kv": { + "version": "1.0.0", + "bundled": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-arrayish": { + "version": "0.2.1", + "bundled": true + }, + "is-buffer": { + "version": "1.1.6", + "bundled": true + }, + "is-builtin-module": { + "version": "1.0.0", + "bundled": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-descriptor": { + "version": "0.1.6", + "bundled": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "bundled": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "bundled": true + }, + "is-finite": { + "version": "1.0.2", + "bundled": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "bundled": true + }, + "is-number": { + "version": "3.0.0", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-odd": { + "version": "2.0.0", + "bundled": true, + "requires": { + "is-number": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "bundled": true + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "bundled": true, + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "bundled": true + } + } + }, + "is-stream": { + "version": "1.1.0", + "bundled": true + }, + "is-utf8": { + "version": "0.2.1", + "bundled": true + }, + "is-windows": { + "version": "1.0.2", + "bundled": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "isexe": { + "version": "2.0.0", + "bundled": true + }, + "isobject": { + "version": "3.0.1", + "bundled": true + }, + "istanbul-lib-coverage": { + "version": "1.2.0", + "bundled": true + }, + "istanbul-lib-hook": { + "version": "1.1.0", + "bundled": true, + "requires": { + "append-transform": "^0.4.0" + } + }, + "istanbul-lib-instrument": { + "version": "1.10.1", + "bundled": true, + "requires": { + "babel-generator": "^6.18.0", + "babel-template": "^6.16.0", + "babel-traverse": "^6.18.0", + "babel-types": "^6.18.0", + "babylon": "^6.18.0", + "istanbul-lib-coverage": "^1.2.0", + "semver": "^5.3.0" + } + }, + "istanbul-lib-report": { + "version": "1.1.3", + "bundled": true, + "requires": { + "istanbul-lib-coverage": "^1.1.2", + "mkdirp": "^0.5.1", + "path-parse": "^1.0.5", + "supports-color": "^3.1.2" + }, + "dependencies": { + "supports-color": { + "version": "3.2.3", + "bundled": true, + "requires": { + "has-flag": "^1.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.3", + "bundled": true, + "requires": { + "debug": "^3.1.0", + "istanbul-lib-coverage": "^1.1.2", + "mkdirp": "^0.5.1", + "rimraf": "^2.6.1", + "source-map": "^0.5.3" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "istanbul-reports": { + "version": "1.4.0", + "bundled": true, + "requires": { + "handlebars": "^4.0.3" + } + }, + "js-tokens": { + "version": "3.0.2", + "bundled": true + }, + "jsesc": { + "version": "1.3.0", + "bundled": true + }, + "kind-of": { + "version": "3.2.2", + "bundled": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "lazy-cache": { + "version": "1.0.4", + "bundled": true, + "optional": true + }, + "lcid": { + "version": "1.0.0", + "bundled": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "bundled": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "bundled": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "bundled": true + } + } + }, + "lodash": { + "version": "4.17.10", + "bundled": true + }, + "longest": { + "version": "1.0.1", + "bundled": true + }, + "loose-envify": { + "version": "1.3.1", + "bundled": true, + "requires": { + "js-tokens": "^3.0.0" + } + }, + "lru-cache": { + "version": "4.1.3", + "bundled": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "map-cache": { + "version": "0.2.2", + "bundled": true + }, + "map-visit": { + "version": "1.0.0", + "bundled": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "md5-hex": { + "version": "1.3.0", + "bundled": true, + "requires": { + "md5-o-matic": "^0.1.1" + } + }, + "md5-o-matic": { + "version": "0.1.1", + "bundled": true + }, + "mem": { + "version": "1.1.0", + "bundled": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "merge-source-map": { + "version": "1.1.0", + "bundled": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "bundled": true + } + } + }, + "micromatch": { + "version": "3.1.10", + "bundled": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "mimic-fn": { + "version": "1.2.0", + "bundled": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true + }, + "mixin-deep": { + "version": "1.3.1", + "bundled": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "bundled": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "nanomatch": { + "version": "1.2.9", + "bundled": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-odd": "^2.0.0", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "bundled": true + }, + "array-unique": { + "version": "0.3.2", + "bundled": true + }, + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "normalize-package-data": { + "version": "2.4.0", + "bundled": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "bundled": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "object-copy": { + "version": "0.1.0", + "bundled": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "bundled": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "bundled": true, + "requires": { + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "bundled": true + } + } + }, + "object.pick": { + "version": "1.3.0", + "bundled": true, + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "bundled": true + } + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "optimist": { + "version": "0.6.1", + "bundled": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true + }, + "os-locale": { + "version": "2.1.0", + "bundled": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "p-finally": { + "version": "1.0.0", + "bundled": true + }, + "p-limit": { + "version": "1.2.0", + "bundled": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "bundled": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "bundled": true + }, + "parse-json": { + "version": "2.2.0", + "bundled": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "pascalcase": { + "version": "0.1.1", + "bundled": true + }, + "path-exists": { + "version": "2.1.0", + "bundled": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "path-key": { + "version": "2.0.1", + "bundled": true + }, + "path-parse": { + "version": "1.0.5", + "bundled": true + }, + "path-type": { + "version": "1.1.0", + "bundled": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "bundled": true + }, + "pinkie": { + "version": "2.0.4", + "bundled": true + }, + "pinkie-promise": { + "version": "2.0.1", + "bundled": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "1.0.0", + "bundled": true, + "requires": { + "find-up": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "bundled": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + } + } + }, + "posix-character-classes": { + "version": "0.1.1", + "bundled": true + }, + "pseudomap": { + "version": "1.0.2", + "bundled": true + }, + "read-pkg": { + "version": "1.1.0", + "bundled": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "bundled": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "bundled": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + } + } + }, + "regenerator-runtime": { + "version": "0.11.1", + "bundled": true + }, + "regex-not": { + "version": "1.0.2", + "bundled": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "repeat-element": { + "version": "1.1.2", + "bundled": true + }, + "repeat-string": { + "version": "1.6.1", + "bundled": true + }, + "repeating": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "require-directory": { + "version": "2.1.1", + "bundled": true + }, + "require-main-filename": { + "version": "1.0.1", + "bundled": true + }, + "resolve-from": { + "version": "2.0.0", + "bundled": true + }, + "resolve-url": { + "version": "0.2.1", + "bundled": true + }, + "ret": { + "version": "0.1.15", + "bundled": true + }, + "right-align": { + "version": "0.1.3", + "bundled": true, + "optional": true, + "requires": { + "align-text": "^0.1.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-regex": { + "version": "1.1.0", + "bundled": true, + "requires": { + "ret": "~0.1.10" + } + }, + "semver": { + "version": "5.5.0", + "bundled": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true + }, + "set-value": { + "version": "2.0.0", + "bundled": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "shebang-command": { + "version": "1.2.0", + "bundled": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "bundled": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true + }, + "slide": { + "version": "1.1.6", + "bundled": true + }, + "snapdragon": { + "version": "0.8.2", + "bundled": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "bundled": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "bundled": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "bundled": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "bundled": true + }, + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "bundled": true, + "requires": { + "kind-of": "^3.2.0" + } + }, + "source-map": { + "version": "0.5.7", + "bundled": true + }, + "source-map-resolve": { + "version": "0.5.1", + "bundled": true, + "requires": { + "atob": "^2.0.0", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "bundled": true + }, + "spawn-wrap": { + "version": "1.4.2", + "bundled": true, + "requires": { + "foreground-child": "^1.5.6", + "mkdirp": "^0.5.0", + "os-homedir": "^1.0.1", + "rimraf": "^2.6.2", + "signal-exit": "^3.0.2", + "which": "^1.3.0" + } + }, + "spdx-correct": { + "version": "3.0.0", + "bundled": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.1.0", + "bundled": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "bundled": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.0", + "bundled": true + }, + "split-string": { + "version": "3.1.0", + "bundled": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "static-extend": { + "version": "0.1.2", + "bundled": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "bundled": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "string-width": { + "version": "2.1.1", + "bundled": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "bundled": true + }, + "strip-ansi": { + "version": "4.0.0", + "bundled": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "bundled": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "bundled": true + }, + "supports-color": { + "version": "2.0.0", + "bundled": true + }, + "test-exclude": { + "version": "4.2.1", + "bundled": true, + "requires": { + "arrify": "^1.0.1", + "micromatch": "^3.1.8", + "object-assign": "^4.1.0", + "read-pkg-up": "^1.0.1", + "require-main-filename": "^1.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "bundled": true + }, + "array-unique": { + "version": "0.3.2", + "bundled": true + }, + "braces": { + "version": "2.3.2", + "bundled": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "bundled": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "bundled": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "bundled": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "bundled": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "bundled": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "bundled": true + } + } + }, + "extglob": { + "version": "2.0.4", + "bundled": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "bundled": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "bundled": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "bundled": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "bundled": true + }, + "kind-of": { + "version": "6.0.2", + "bundled": true + }, + "micromatch": { + "version": "3.1.10", + "bundled": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "to-fast-properties": { + "version": "1.0.3", + "bundled": true + }, + "to-object-path": { + "version": "0.3.0", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "to-regex": { + "version": "3.0.2", + "bundled": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "bundled": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "bundled": true, + "requires": { + "kind-of": "^3.0.2" + } + } + } + }, + "trim-right": { + "version": "1.0.1", + "bundled": true + }, + "uglify-js": { + "version": "2.8.29", + "bundled": true, + "optional": true, + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "dependencies": { + "yargs": { + "version": "3.10.0", + "bundled": true, + "optional": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "union-value": { + "version": "1.0.0", + "bundled": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "bundled": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unset-value": { + "version": "1.0.0", + "bundled": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "bundled": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "bundled": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "bundled": true + }, + "isobject": { + "version": "3.0.1", + "bundled": true + } + } + }, + "urix": { + "version": "0.1.0", + "bundled": true + }, + "use": { + "version": "3.1.0", + "bundled": true, + "requires": { + "kind-of": "^6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "validate-npm-package-license": { + "version": "3.0.3", + "bundled": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "1.3.0", + "bundled": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "bundled": true + }, + "window-size": { + "version": "0.1.0", + "bundled": true, + "optional": true + }, + "wordwrap": { + "version": "0.0.3", + "bundled": true + }, + "wrap-ansi": { + "version": "2.1.0", + "bundled": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "write-file-atomic": { + "version": "1.3.4", + "bundled": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + }, + "y18n": { + "version": "3.2.1", + "bundled": true + }, + "yallist": { + "version": "2.1.2", + "bundled": true + }, + "yargs": { + "version": "11.1.0", + "bundled": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "bundled": true + }, + "camelcase": { + "version": "4.1.0", + "bundled": true + }, + "cliui": { + "version": "4.1.0", + "bundled": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "bundled": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "yargs-parser": { + "version": "9.0.2", + "bundled": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "8.1.0", + "bundled": true, + "requires": { + "camelcase": "^4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "bundled": true + } + } + } } } } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" - }, - "tap": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/tap/-/tap-12.0.1.tgz", - "integrity": "sha512-iEJytWaZy8risvfRjuV4+ST+Lrrui/MW2ZCWn01ZaMn0NKFej4+PpBy6bXGOg9+cEGNmI7d3Sdka/zTUZUGidA==", - "requires": { - "bind-obj-methods": "^2.0.0", - "bluebird": "^3.5.1", - "clean-yaml-object": "^0.1.0", - "color-support": "^1.1.0", - "coveralls": "^3.0.1", - "foreground-child": "^1.3.3", - "fs-exists-cached": "^1.0.0", - "function-loop": "^1.0.1", - "glob": "^7.0.0", - "isexe": "^2.0.0", - "js-yaml": "^3.11.0", - "minipass": "^2.3.0", - "mkdirp": "^0.5.1", - "nyc": "^11.8.0", - "opener": "^1.4.1", - "os-homedir": "^1.0.2", - "own-or": "^1.0.0", - "own-or-env": "^1.0.1", - "rimraf": "^2.6.2", - "signal-exit": "^3.0.0", - "source-map-support": "^0.5.6", - "stack-utils": "^1.0.0", - "tap-mocha-reporter": "^3.0.7", - "tap-parser": "^7.0.0", - "tmatch": "^4.0.0", - "trivial-deferred": "^1.0.1", - "tsame": "^2.0.0", - "write-file-atomic": "^2.3.0", - "yapool": "^1.0.0" - } - }, "tap-mocha-reporter": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-3.0.7.tgz", @@ -3447,6 +5425,14 @@ "unicode-length": "^1.0.0" }, "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, "tap-parser": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-5.4.0.tgz", @@ -3474,14 +5460,25 @@ "resolved": "https://registry.npmjs.org/tmatch/-/tmatch-4.0.0.tgz", "integrity": "sha512-Ynn2Gsp+oCvYScQXeV+cCs7citRDilq0qDXA6tuvFwDgiYyyaq7D5vKUlAPezzZR5NDobc/QMeN6e5guOYmvxg==" }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" + }, "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "requires": { + "psl": "^1.1.24", "punycode": "^1.4.1" } }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" + }, "trivial-deferred": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trivial-deferred/-/trivial-deferred-1.0.1.tgz", @@ -3518,6 +5515,21 @@ "requires": { "punycode": "^1.3.2", "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + } } }, "universalify": { @@ -3528,8 +5540,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "optional": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { "version": "3.3.2", @@ -3568,6 +5579,11 @@ "strip-ansi": "^3.0.1" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -3585,6 +5601,14 @@ "is-fullwidth-code-point": "^1.0.0", "strip-ansi": "^3.0.0" } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } } } }, @@ -3603,10 +5627,15 @@ "signal-exit": "^3.0.2" } }, + "xregexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", + "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==" + }, "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" }, "yallist": { "version": "2.1.2", @@ -3619,13 +5648,13 @@ "integrity": "sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o=" }, "yargs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", - "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.1.tgz", + "integrity": "sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ==", "requires": { "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", + "decamelize": "^2.0.0", + "find-up": "^3.0.0", "get-caller-file": "^1.0.1", "os-locale": "^2.0.0", "require-directory": "^2.1.1", @@ -3633,14 +5662,14 @@ "set-blocking": "^2.0.0", "string-width": "^2.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^10.1.0" } }, "yargs-parser": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", - "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "requires": { "camelcase": "^4.1.0" } diff --git a/packages/jsii/package.json b/packages/jsii/package.json index be92e8ebe1..991b6ba75d 100644 --- a/packages/jsii/package.json +++ b/packages/jsii/package.json @@ -1,53 +1,49 @@ { - "name": "jsii", - "version": "0.6.4", - "description": "TypeScript compiler for jsii", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "bin": { - "jsii": "bin/jsii" - }, - "scripts": { - "watch": "tsc -w", - "build": "/bin/bash generate.sh && tsc && chmod +x bin/jsii", - "test": "nodeunit test/test.*.js", - "package": "package-js" - }, - "keywords": [ - "jsii", - "aws" - ], - "devDependencies": { - "@types/clone": "^0.1.30", - "@types/deep-equal": "^1.0.1", - "@types/fs-extra": "^4.0.8", - "@types/glob": "^5.0.32", - "@types/node": "^9.6.18", - "@types/nodeunit": "0.0.30", - "@types/yargs": "^11.0.0", - "jsii-build-tools": "^0.6.4", - "nodeunit": "^0.11.2" - }, - "dependencies": { - "case": "^1.5.5", - "clone": "^2.1.1", - "deep-equal": "^1.0.1", - "fs-extra": "^4.0.3", - "glob": "^7.1.2", - "jsii-spec": "^0.6.4", - "sort-json": "^2.0.0", - "source-map-loader": "^0.2.3", - "spdx-license-list": "^4.1.0", - "typescript": "^3.0.1", - "yargs": "^11.0.0" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com" - }, - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "https://github.com/awslabs/jsii.git" - } + "name": "jsii", + "version": "0.6.4", + "description": "TypeScript compiler for jsii", + "license": "Apache-2.0", + "author": { + "name": "Amazon Web Services", + "url": "https://aws.amazon.com", + "organization": true + }, + "bin": { + "jsii": "bin/jsii" + }, + "scripts": { + "build": "bash ./generate.sh && tsc", + "watch": "bash ./generate.sh && tsc -w", + "test": "nyc nodeunit test/test.*.js" + }, + "devDependencies": { + "@types/clone": "^0.1.30", + "@types/colors": "^1.2.1", + "@types/deep-equal": "^1.0.1", + "@types/fs-extra": "^5.0.4", + "@types/log4js": "^2.3.5", + "@types/node": "^8.10.24", + "@types/nodeunit": "^0.0.30", + "@types/semver": "^5.5.0", + "@types/yargs": "^11.1.1", + "clone": "^2.1.2", + "nodeunit": "^0.11.3", + "nyc": "^12.0.2" + }, + "dependencies": { + "case": "^1.5.5", + "colors": "^1.3.1", + "deep-equal": "^1.0.1", + "fs-extra": "^7.0.0", + "jsii-spec": "^0.6.4", + "log4js": "^3.0.4", + "semver": "^5.5.0", + "sort-json": "^2.0.0", + "spdx-license-list": "^4.1.0", + "typescript": "^3.0.1", + "yargs": "^12.0.1" + }, + "nyc": { + "reporter": ["lcov", "text"] + } } diff --git a/packages/jsii/test/calc.expected/assembly.jsii b/packages/jsii/test/calc.expected/assembly.jsii deleted file mode 100644 index 04a136133a..0000000000 --- a/packages/jsii/test/calc.expected/assembly.jsii +++ /dev/null @@ -1,136 +0,0 @@ -{ - "schema": "jsii/1.0", - "types": { - "jsii$calc$.Calculator": { - "docs": { - "comment": "A little calculator that could." - }, - "kind": "class", - "methods": [ - { - "parameters": [ - { - "docs": { - "param": "lhs Left-hand side", - "comment": "Left-hand side" - }, - "name": "lhs", - "type": { - "primitive": "number" - } - }, - { - "docs": { - "param": "rhs Right-hand side", - "comment": "Right-hand side" - }, - "name": "rhs", - "type": { - "primitive": "number" - } - } - ], - "docs": { - "returns": "The sum of the two numbers", - "comment": "Adds two numbers." - }, - "name": "add", - "returns": { - "primitive": "number" - } - }, - { - "parameters": [ - { - "docs": { - "param": "lhs Left-hand side", - "comment": "Left-hand side" - }, - "name": "lhs", - "type": { - "primitive": "number" - } - }, - { - "docs": { - "param": "rhs Right-hand side", - "comment": "Right-hand side" - }, - "name": "rhs", - "type": { - "primitive": "number" - } - } - ], - "docs": { - "returns": "The subtraction of lhs from rhs", - "comment": "Subtracts two numbers." - }, - "name": "sub", - "returns": { - "primitive": "number" - } - }, - { - "parameters": [ - { - "docs": { - "param": "lhs Left-hand side", - "comment": "Left-hand side" - }, - "name": "lhs", - "type": { - "primitive": "number" - } - }, - { - "docs": { - "param": "rhs Right-hand side", - "comment": "Right-hand side" - }, - "name": "rhs", - "type": { - "primitive": "number" - } - } - ], - "docs": { - "returns": "The multiplication of the two numbers", - "comment": "Multiplies two numbers." - }, - "name": "mul", - "returns": { - "primitive": "number" - } - } - ], - "fqn": "jsii$calc$.Calculator", - "module": "jsii$calc$", - "namespace": "jsii$calc$", - "name": "Calculator", - "initializer": { - "initializer": true - } - } - }, - "nametree": { - "jsii$calc$": { - "Calculator": { - "_": "jsii$calc$.Calculator" - } - } - }, - "typecount": 1, - "name": "jsii$calc$", - "package": "calc", - "version": "1.0.0", - "names": { - "js": "calc" - }, - "nativenames": { - "jsii$calc$": { - "js": "calc" - } - }, - "code": "var jsii$calc$ =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * A little calculator that could.\n */\nclass Calculator {\n /**\n * Adds two numbers.\n * @param lhs Left-hand side\n * @param rhs Right-hand side\n * @returns The sum of the two numbers\n */\n add(lhs, rhs) {\n return lhs + rhs;\n }\n /**\n * Subtracts two numbers.\n * @param lhs Left-hand side\n * @param rhs Right-hand side\n * @returns The subtraction of lhs from rhs\n */\n sub(lhs, rhs) {\n return lhs - rhs;\n }\n /**\n * Multiplies two numbers.\n * @param lhs Left-hand side\n * @param rhs Right-hand side\n * @returns The multiplication of the two numbers\n */\n mul(lhs, rhs) {\n return lhs * rhs;\n }\n}\nexports.Calculator = Calculator;\n\n\n/***/ })\n/******/ ]);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hbmQgc2lkZVxuICAgKiBAcmV0dXJucyBUaGUgc3VidHJhY3Rpb24gb2YgbGhzIGZyb20gcmhzXG4gICAqL1xuICBzdWIobGhzOiBudW1iZXIsIHJoczogbnVtYmVyKSB7XG4gICAgcmV0dXJuIGxocyAtIHJoc1xuICB9XG5cbiAgLyoqXG4gICAqIE11bHRpcGxpZXMgdHdvIG51bWJlcnMuXG4gICAqIEBwYXJhbSBsaHMgTGVmdC1oYW5kIHNpZGVcbiAgICogQHBhcmFtIHJocyBSaWdodC1oYW5kIHNpZGVcbiAgICogQHJldHVybnMgVGhlIG11bHRpcGxpY2F0aW9uIG9mIHRoZSB0d28gbnVtYmVyc1xuICAgKi9cbiAgbXVsKGxoczogbnVtYmVyLCByaHM6IG51bWJlcikge1xuICAgIHJldHVybiBsaHMgKiByaHNcbiAgfVxufVxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyAuL3Rlc3QvY2FsYy9pbmRleC50cyJdLCJzb3VyY2VSb290IjoiIn0=" -} diff --git a/packages/jsii/test/calc/.gitignore b/packages/jsii/test/calc/.gitignore deleted file mode 100644 index 2c98620a0d..0000000000 --- a/packages/jsii/test/calc/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -dist -tsconfig.json -tslint.json \ No newline at end of file diff --git a/packages/jsii/test/calc/LICENSE b/packages/jsii/test/calc/LICENSE deleted file mode 100644 index 129acd53d9..0000000000 --- a/packages/jsii/test/calc/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/packages/jsii/test/calc/NOTICE b/packages/jsii/test/calc/NOTICE deleted file mode 100644 index dc4ac3f857..0000000000 --- a/packages/jsii/test/calc/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -jsii -Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/jsii/test/calc/index.ts b/packages/jsii/test/calc/index.ts deleted file mode 100644 index f69c3ea161..0000000000 --- a/packages/jsii/test/calc/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * A little calculator that could. - */ -export class Calculator { - /** - * Adds two numbers. - * @param lhs Left-hand side - * @param rhs Right-hand side - * @returns The sum of the two numbers - */ - add(lhs: number, rhs: number) { - return lhs + rhs - } - - /** - * Subtracts two numbers. - * @param lhs Left-hand side - * @param rhs Right-hand side - * @returns The subtraction of lhs from rhs - */ - sub(lhs: number, rhs: number) { - return lhs - rhs - } - - /** - * Multiplies two numbers. - * @param lhs Left-hand side - * @param rhs Right-hand side - * @returns The multiplication of the two numbers - */ - mul(lhs: number, rhs: number) { - return lhs * rhs - } -} \ No newline at end of file diff --git a/packages/jsii/test/calc/package.json b/packages/jsii/test/calc/package.json deleted file mode 100644 index 6eea310849..0000000000 --- a/packages/jsii/test/calc/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "calc", - "version": "1.0.0", - "main": "index.js", - "types": "index.d.ts", - "jsii": { - "outdir": "dist/jsii" - }, - "scripts": { - "build": "tsc && jsii", - "test": "npm run build && nodeunit", - "prepublish": "npm test" - }, - "devDependencies": { - "@types/node": "^8.0.28", - "@types/nodeunit": "0.0.30", - "nodeunit": "^0.11.1", - "typescript": "^2.9.2" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com" - }, - "license": "LicenseRef-LICENSE", - "repository": { - "type": "git", - "url": "git://github.com/awslabs/jsii" - } -} diff --git a/packages/jsii/test/calc/test/test.calculator.ts b/packages/jsii/test/calc/test/test.calculator.ts deleted file mode 100644 index 67e2d6f699..0000000000 --- a/packages/jsii/test/calc/test/test.calculator.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Test } from 'nodeunit' -import { Calculator } from '../index' - -export function calculator(test: Test) { - let calc = new Calculator(); - test.equal(calc.add(123, 44), 123 + 44); - test.equal(calc.mul(33, 88), 33 * 88); - test.equal(calc.sub(99, 199), 99 - 199); - test.done(); -} diff --git a/packages/jsii/test/hello.expected/assembly.jsii b/packages/jsii/test/hello.expected/assembly.jsii deleted file mode 100644 index 40a72f6ffa..0000000000 --- a/packages/jsii/test/hello.expected/assembly.jsii +++ /dev/null @@ -1,58 +0,0 @@ -{ - "schema": "jsii/1.0", - "types": { - "jsii$hello$.World": { - "kind": "class", - "methods": [ - { - "parameters": [ - { - "docs": { - "param": "name Who should we greet?", - "comment": "Who should we greet?" - }, - "name": "name", - "type": { - "primitive": "string" - } - } - ], - "docs": { - "comment": "Makes a commonly used greeting." - }, - "name": "greet", - "returns": { - "primitive": "string" - } - } - ], - "fqn": "jsii$hello$.World", - "module": "jsii$hello$", - "namespace": "jsii$hello$", - "name": "World", - "initializer": { - "initializer": true - } - } - }, - "nametree": { - "jsii$hello$": { - "World": { - "_": "jsii$hello$.World" - } - } - }, - "typecount": 1, - "name": "jsii$hello$", - "package": "hello", - "version": "1.0.0", - "names": { - "js": "hello" - }, - "nativenames": { - "jsii$hello$": { - "js": "hello" - } - }, - "code": "var jsii$hello$ =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass World {\n /**\n * Makes a commonly used greeting.\n * @param name Who should we greet?\n */\n greet(name) {\n return `Hello, ${name}`;\n }\n}\nexports.World = World;\n\n\n/***/ })\n/******/ ]);\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgYmE2YmJmMmIxYjdlN2Y5NGM4NjUiLCJ3ZWJwYWNrOi8vLy4vdGVzdC9oZWxsby9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxhQUFLO0FBQ0w7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxtQ0FBMkIsMEJBQTBCLEVBQUU7QUFDdkQseUNBQWlDLGVBQWU7QUFDaEQ7QUFDQTtBQUNBOztBQUVBO0FBQ0EsOERBQXNELCtEQUErRDs7QUFFckg7QUFDQTs7QUFFQTtBQUNBOzs7Ozs7Ozs7O0FDN0RBO0lBQ0k7OztPQUdHO0lBQ0gsS0FBSyxDQUFDLElBQVk7UUFDZCxPQUFPLFVBQVUsSUFBSSxFQUFFO0lBQzNCLENBQUM7Q0FDSjtBQVJELHNCQVFDIiwiZmlsZSI6ImJ1bmRsZS5qcyIsInNvdXJjZXNDb250ZW50IjpbIiBcdC8vIFRoZSBtb2R1bGUgY2FjaGVcbiBcdHZhciBpbnN0YWxsZWRNb2R1bGVzID0ge307XG5cbiBcdC8vIFRoZSByZXF1aXJlIGZ1bmN0aW9uXG4gXHRmdW5jdGlvbiBfX3dlYnBhY2tfcm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HJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBwcm9wZXJ0eSk7IH07XG5cbiBcdC8vIF9fd2VicGFja19wdWJsaWNfcGF0aF9fXG4gXHRfX3dlYnBhY2tfcmVxdWlyZV9fLnAgPSBcIlwiO1xuXG4gXHQvLyBMb2FkIGVudHJ5IG1vZHVsZSBhbmQgcmV0dXJuIGV4cG9ydHNcbiBcdHJldHVybiBfX3dlYnBhY2tfcmVxdWlyZV9fKF9fd2VicGFja19yZXF1aXJlX18ucyA9IDApO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHdlYnBhY2svYm9vdHN0cmFwIGJhNmJiZjJiMWI3ZTdmOTRjODY1IiwiZXhwb3J0IGNsYXNzIFdvcmxkIHtcbiAgICAvKipcbiAgICAgKiBNYWtlcyBhIGNvbW1vbmx5IHVzZWQgZ3JlZXRpbmcuXG4gICAgICogQHBhcmFtIG5hbWUgV2hvIHNob3VsZCB3ZSBncmVldD9cbiAgICAgKi9cbiAgICBncmVldChuYW1lOiBzdHJpbmcpIHtcbiAgICAgICAgcmV0dXJuIGBIZWxsbywgJHtuYW1lfWBcbiAgICB9XG59XG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIC4vdGVzdC9oZWxsby9pbmRleC50cyJdLCJzb3VyY2VSb290IjoiIn0=" -} diff --git a/packages/jsii/test/hello/.gitignore b/packages/jsii/test/hello/.gitignore deleted file mode 100644 index 2c98620a0d..0000000000 --- a/packages/jsii/test/hello/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -dist -tsconfig.json -tslint.json \ No newline at end of file diff --git a/packages/jsii/test/hello/LICENSE b/packages/jsii/test/hello/LICENSE deleted file mode 100644 index 129acd53d9..0000000000 --- a/packages/jsii/test/hello/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/packages/jsii/test/hello/NOTICE b/packages/jsii/test/hello/NOTICE deleted file mode 100644 index dc4ac3f857..0000000000 --- a/packages/jsii/test/hello/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -jsii -Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/jsii/test/hello/index.ts b/packages/jsii/test/hello/index.ts deleted file mode 100644 index 2369aea331..0000000000 --- a/packages/jsii/test/hello/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class World { - /** - * Makes a commonly used greeting. - * @param name Who should we greet? - */ - greet(name: string) { - return `Hello, ${name}` - } -} \ No newline at end of file diff --git a/packages/jsii/test/hello/package.json b/packages/jsii/test/hello/package.json deleted file mode 100644 index d2892c3d0a..0000000000 --- a/packages/jsii/test/hello/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "hello", - "version": "1.0.0", - "main": "index.js", - "types": "index.d.ts", - "jsii": { - "outdir": "dist/jsii" - }, - "scripts": { - "prepublish": "tsc -d index.ts && jsii" - }, - "devDependencies": { - "typescript": "^2.9.2", - "jsii": "^1.0.0" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com" - }, - "license": "LicenseRef-LICENSE", - "repository": { - "type": "git", - "url": "git://github.com/awslabs/jsii" - } -} diff --git a/packages/jsii/test/jsii-test.expected/assembly.jsii b/packages/jsii/test/jsii-test.expected/assembly.jsii deleted file mode 100644 index 1580993f5c..0000000000 --- a/packages/jsii/test/jsii-test.expected/assembly.jsii +++ /dev/null @@ -1,1254 +0,0 @@ -{ - "schema": "jsii/1.0", - "types": { - "jsii$jsii_test$.Token": { - "kind": "class", - "fqn": "jsii$jsii_test$.Token", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "Token", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.TestClass3": { - "kind": "class", - "properties": [ - { - "name": "hello", - "type": { - "primitive": "string" - } - } - ], - "fqn": "jsii$jsii_test$.TestClass3", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "TestClass3", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.TestClass2": { - "subtypes": [ - "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2" - ], - "kind": "class", - "properties": [ - { - "name": "a", - "type": { - "primitive": "number" - } - }, - { - "name": "b", - "type": { - "primitive": "string" - } - }, - { - "name": "c", - "type": { - "fqn": "jsii$jsii_test$.TestClass3" - } - } - ], - "fqn": "jsii$jsii_test$.TestClass2", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "TestClass2", - "initializer": { - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string" - } - }, - { - "name": "arg2", - "type": { - "fqn": "jsii$jsii_test$.TestClass3" - } - }, - { - "name": "arg3", - "type": { - "primitive": "number", - "optional": true - } - }, - { - "name": "arg4", - "type": { - "primitive": "boolean", - "optional": true - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2": { - "subtypes": [ - "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2.Foo" - ], - "kind": "class", - "properties": [ - { - "name": "yourProp", - "type": { - "primitive": "string", - "optional": true - }, - "immutable": true - } - ], - "fqn": "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$.TestClass2", - "name": "SubTypeOfTestClass2", - "initializer": { - "initializer": true - }, - "parenttype": "jsii$jsii_test$.TestClass2" - }, - "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2.Foo": { - "kind": "class", - "fqn": "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2.Foo", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2", - "name": "Foo", - "initializer": { - "initializer": true - }, - "parenttype": "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2" - }, - "jsii$jsii_test$.BaseClass": { - "kind": "class", - "properties": [ - { - "name": "baseProp", - "type": { - "primitive": "string" - } - } - ], - "fqn": "jsii$jsii_test$.BaseClass", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "BaseClass", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.TestClass": { - "docs": { - "link": "http://amazon.com", - "description": "Description", - "author": "benisrae", - "comment": "This is the comment section" - }, - "kind": "class", - "properties": [ - { - "docs": { - "comment": "This is documentation for readonlyString" - }, - "name": "readonlyString", - "type": { - "primitive": "string" - }, - "immutable": true - }, - { - "name": "mutableNumber", - "type": { - "primitive": "number" - } - }, - { - "docs": { - "comment": "Read only boolean." - }, - "name": "readonlyBoolean", - "type": { - "primitive": "boolean" - }, - "immutable": true - }, - { - "docs": { - "example": "This is an example", - "comment": "Sets the mutable complex object.\nDocumentation for getter" - }, - "name": "mutableComplex", - "type": { - "fqn": "jsii$jsii_test$.TestClass2" - } - }, - { - "name": "optionalMutableBoolean", - "type": { - "primitive": "boolean", - "optional": true - } - }, - { - "name": "optionalReadonlyDate", - "type": { - "primitive": "date", - "optional": true - }, - "immutable": true - }, - { - "name": "listOfStrings", - "type": { - "collection": { - "elementtype": { - "primitive": "string" - }, - "kind": "array" - } - } - }, - { - "name": "optionalListOfNumbers", - "type": { - "collection": { - "elementtype": { - "primitive": "number" - }, - "kind": "array" - }, - "optional": true - } - }, - { - "name": "listOfComplex", - "type": { - "collection": { - "elementtype": { - "fqn": "jsii$jsii_test$.TestClass2" - }, - "kind": "array" - } - } - }, - { - "docs": { - "description": "Map of booleans here", - "comment": "And a comment" - }, - "name": "mapOfBooleans", - "type": { - "collection": { - "elementtype": { - "primitive": "boolean" - }, - "kind": "map" - } - } - }, - { - "name": "mapOfComplex", - "type": { - "collection": { - "elementtype": { - "fqn": "jsii$jsii_test$.TestClass3" - }, - "kind": "map" - } - } - }, - { - "name": "stringOrRef", - "type": { - "union": { - "types": [ - { - "primitive": "string" - }, - { - "fqn": "jsii$jsii_test$.Token" - } - ] - } - } - }, - { - "docs": { - "comment": "Docs on getter prevail.\nDocs on setter are not allowed." - }, - "name": "getterBeforeSetter", - "type": { - "primitive": "string" - } - }, - { - "name": "arrayGetter", - "type": { - "collection": { - "elementtype": { - "fqn": "jsii$jsii_test$.TestEnum" - }, - "kind": "array" - } - }, - "immutable": true - }, - { - "name": "mapGetter", - "type": { - "collection": { - "elementtype": { - "fqn": "jsii$jsii_test$.TestClass2" - }, - "kind": "map" - } - }, - "immutable": true - }, - { - "name": "jsonProperty", - "type": { - "primitive": "json" - } - }, - { - "name": "optionalBooleanOrRef", - "type": { - "union": { - "types": [ - { - "primitive": "boolean" - }, - { - "fqn": "jsii$jsii_test$.Token" - } - ] - }, - "optional": true - } - }, - { - "name": "optionalAsUnion", - "type": { - "primitive": "string", - "optional": true - } - }, - { - "name": "arrayOfOptionals", - "type": { - "collection": { - "elementtype": { - "fqn": "jsii$jsii_test$.TestClass3", - "optional": true - }, - "kind": "array" - } - } - }, - { - "name": "readonlyMapOfOptionalsOrRefs", - "type": { - "collection": { - "elementtype": { - "primitive": "string", - "optional": true - }, - "kind": "map" - } - }, - "immutable": true - } - ], - "methods": [ - { - "docs": { - "comment": "Documentation for method" - }, - "name": "methodWithNoParameters" - }, - { - "parameters": [ - { - "docs": { - "param": "param1 Doc for param1", - "comment": "Doc for param1" - }, - "name": "param1", - "type": { - "primitive": "string" - } - }, - { - "docs": { - "param": "param2 Doc for param2", - "comment": "Doc for param2" - }, - "name": "param2", - "type": { - "primitive": "number" - } - }, - { - "name": "param3", - "type": { - "fqn": "jsii$jsii_test$.TestClass3", - "optional": true - } - }, - { - "name": "param4", - "type": { - "fqn": "jsii$jsii_test$.TestClass2", - "optional": true - } - } - ], - "docs": { - "comment": "Documentation for methodWithParams" - }, - "name": "methodWithParams", - "returns": { - "primitive": "boolean" - } - } - ], - "fqn": "jsii$jsii_test$.TestClass", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "TestClass", - "base": { - "fqn": "jsii$jsii_test$.BaseClass" - }, - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.TestEnum": { - "docs": { - "comment": "This is the documentation for this enum." - }, - "subtypes": [ - "jsii$jsii_test$.TestEnum.SubTypeOfTestEnum" - ], - "kind": "enum", - "members": [ - { - "name": "Value1" - }, - { - "name": "Value2" - }, - { - "name": "Value3" - } - ], - "fqn": "jsii$jsii_test$.TestEnum", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "TestEnum" - }, - "jsii$jsii_test$.TestEnum.SubTypeOfTestEnum": { - "kind": "class", - "properties": [ - { - "name": "myProp", - "type": { - "primitive": "number" - } - } - ], - "fqn": "jsii$jsii_test$.TestEnum.SubTypeOfTestEnum", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$.TestEnum", - "name": "SubTypeOfTestEnum", - "initializer": { - "initializer": true - }, - "parenttype": "jsii$jsii_test$.TestEnum" - }, - "jsii$jsii_test$.TestClass4": { - "kind": "class", - "properties": [ - { - "name": "StringConst", - "static": true, - "type": { - "primitive": "string" - }, - "immutable": true, - "const": true - }, - { - "name": "StringConstWithDoubleQuotes", - "static": true, - "type": { - "primitive": "string" - }, - "immutable": true, - "const": true - }, - { - "name": "NumberConst", - "static": true, - "type": { - "primitive": "number" - }, - "immutable": true, - "const": true - }, - { - "name": "DoubleConst", - "static": true, - "type": { - "primitive": "number" - }, - "immutable": true, - "const": true - }, - { - "name": "BooleanConstValue", - "static": true, - "type": { - "primitive": "boolean" - }, - "immutable": true, - "const": true - }, - { - "name": "BooleanConstTrue", - "static": true, - "type": { - "primitive": "boolean" - }, - "immutable": true, - "const": true - }, - { - "name": "NonLiteralConst", - "static": true, - "type": { - "primitive": "number" - }, - "immutable": true, - "const": true - }, - { - "name": "ObjConst", - "static": true, - "type": { - "fqn": "jsii$jsii_test$.TestClass" - }, - "immutable": true, - "const": true - } - ], - "fqn": "jsii$jsii_test$.TestClass4", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "TestClass4", - "initializer": { - "parameters": [ - { - "name": "p1", - "type": { - "primitive": "string" - } - } - ], - "docs": { - "comment": "p2 cannot be resolved, but it's optional, so we expect the typespec to just include p1" - }, - "initializer": true - } - }, - "jsii$jsii_test$.A": { - "subtypes": [ - "jsii$jsii_test$.A.B" - ], - "kind": "class", - "fqn": "jsii$jsii_test$.A", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "A", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.A.B": { - "subtypes": [ - "jsii$jsii_test$.A.B.C" - ], - "kind": "class", - "fqn": "jsii$jsii_test$.A.B", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$.A", - "name": "B", - "initializer": { - "initializer": true - }, - "parenttype": "jsii$jsii_test$.A" - }, - "jsii$jsii_test$.A.B.C": { - "kind": "class", - "fqn": "jsii$jsii_test$.A.B.C", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$.A.B", - "name": "C", - "initializer": { - "initializer": true - }, - "parenttype": "jsii$jsii_test$.A.B" - }, - "jsii$jsii_test$.ExposeExternalDependency": { - "kind": "class", - "properties": [ - { - "name": "froth", - "type": { - "primitive": "number" - } - } - ], - "fqn": "jsii$jsii_test$.ExposeExternalDependency", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "ExposeExternalDependency", - "base": { - "fqn": "jsii$my_dep$.MyDepType" - }, - "initializer": { - "parameters": [ - { - "name": "p", - "type": { - "primitive": "number" - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.PropertyWithAnyValue": { - "kind": "class", - "properties": [ - { - "name": "myprop", - "type": { - "primitive": "any" - } - } - ], - "fqn": "jsii$jsii_test$.PropertyWithAnyValue", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "PropertyWithAnyValue", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.HasLogic": { - "kind": "class", - "properties": [ - { - "docs": { - "comment": "This property will have logic=true" - }, - "name": "propWithLogic", - "type": { - "primitive": "number" - } - }, - { - "name": "propWithoutLogic", - "type": { - "primitive": "string" - } - } - ], - "fqn": "jsii$jsii_test$.HasLogic", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "HasLogic", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.OptionalRef": { - "kind": "class", - "properties": [ - { - "name": "prop1", - "type": { - "fqn": "jsii$jsii_test$.Token", - "optional": true - } - }, - { - "name": "prop2", - "type": { - "fqn": "jsii$jsii_test$.Token", - "optional": true - } - } - ], - "fqn": "jsii$jsii_test$.OptionalRef", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "OptionalRef", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.UnionProperties": { - "kind": "class", - "properties": [ - { - "name": "withPrimitive1", - "type": { - "union": { - "types": [ - { - "primitive": "string" - }, - { - "fqn": "jsii$jsii_test$.Token" - } - ] - } - } - }, - { - "name": "withPrimitive2", - "type": { - "union": { - "types": [ - { - "primitive": "string" - }, - { - "fqn": "jsii$jsii_test$.Token" - } - ] - } - } - }, - { - "name": "noPrimitive", - "type": { - "union": { - "types": [ - { - "fqn": "jsii$jsii_test$.Token" - }, - { - "fqn": "jsii$jsii_test$.TestClass3" - }, - { - "fqn": "jsii$jsii_test$.TestClass2" - } - ] - } - } - } - ], - "fqn": "jsii$jsii_test$.UnionProperties", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "UnionProperties", - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.EnsureInitializerBase": { - "kind": "class", - "fqn": "jsii$jsii_test$.EnsureInitializerBase", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "EnsureInitializerBase", - "initializer": { - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string" - } - }, - { - "name": "arg2", - "type": { - "primitive": "boolean" - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.EnsureInitializer": { - "kind": "class", - "fqn": "jsii$jsii_test$.EnsureInitializer", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "EnsureInitializer", - "base": { - "fqn": "jsii$jsii_test$.EnsureInitializerBase" - }, - "initializer": { - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string" - } - }, - { - "name": "arg2", - "type": { - "primitive": "boolean" - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.EnsureInitializer2": { - "kind": "class", - "fqn": "jsii$jsii_test$.EnsureInitializer2", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "EnsureInitializer2", - "base": { - "fqn": "jsii$jsii_test$.EnsureInitializer" - }, - "initializer": { - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string" - } - }, - { - "name": "arg2", - "type": { - "primitive": "boolean" - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.EnsureInitializer3": { - "kind": "class", - "fqn": "jsii$jsii_test$.EnsureInitializer3", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "EnsureInitializer3", - "base": { - "fqn": "jsii$jsii_test$.EnsureInitializer2" - }, - "initializer": { - "parameters": [ - { - "name": "ihavemyowninitializer", - "type": { - "primitive": "boolean" - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.EnsureInitializerBase2": { - "kind": "class", - "fqn": "jsii$jsii_test$.EnsureInitializerBase2", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "EnsureInitializerBase2", - "initializer": { - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string", - "optional": true - } - }, - { - "name": "arg2", - "type": { - "primitive": "boolean", - "optional": true - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.EnsureInitializer4": { - "kind": "class", - "fqn": "jsii$jsii_test$.EnsureInitializer4", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "EnsureInitializer4", - "base": { - "fqn": "jsii$jsii_test$.EnsureInitializerBase2" - }, - "initializer": { - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string", - "optional": true - } - }, - { - "name": "arg2", - "type": { - "primitive": "boolean", - "optional": true - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.PropertiesInCtor": { - "kind": "class", - "properties": [ - { - "name": "readonlyProp", - "type": { - "primitive": "string" - }, - "immutable": true - }, - { - "name": "readWriteProp", - "type": { - "primitive": "string" - } - } - ], - "fqn": "jsii$jsii_test$.PropertiesInCtor", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "PropertiesInCtor", - "initializer": { - "parameters": [ - { - "name": "readonlyProp", - "type": { - "primitive": "string" - } - }, - { - "name": "readWriteProp", - "type": { - "primitive": "string" - } - }, - { - "name": "privateProp", - "type": { - "primitive": "string" - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.MyAbstractClass": { - "kind": "class", - "methods": [ - { - "name": "normalMethod" - }, - { - "parameters": [ - { - "name": "value", - "type": { - "primitive": "number" - } - } - ], - "name": "abstractMethod", - "abstract": true, - "returns": { - "primitive": "string" - } - } - ], - "fqn": "jsii$jsii_test$.MyAbstractClass", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "MyAbstractClass", - "abstract": true, - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.DerivedAbstract": { - "kind": "class", - "fqn": "jsii$jsii_test$.DerivedAbstract", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "DerivedAbstract", - "base": { - "fqn": "jsii$jsii_test$.MyAbstractClass" - }, - "abstract": true, - "initializer": { - "initializer": true - } - }, - "jsii$jsii_test$.ClassWithProtectedStuff": { - "kind": "class", - "properties": [ - { - "name": "paramprop", - "type": { - "primitive": "string" - }, - "protected": true - }, - { - "name": "foo", - "type": { - "primitive": "number" - }, - "immutable": true, - "protected": true - }, - { - "name": "goo", - "type": { - "primitive": "number" - }, - "protected": true - } - ], - "methods": [ - { - "parameters": [ - { - "name": "val", - "type": { - "primitive": "string" - } - } - ], - "name": "protectedMethod", - "protected": true, - "returns": { - "primitive": "number" - } - } - ], - "fqn": "jsii$jsii_test$.ClassWithProtectedStuff", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "ClassWithProtectedStuff", - "initializer": { - "parameters": [ - { - "name": "paramprop", - "type": { - "primitive": "string" - } - } - ], - "initializer": true - } - }, - "jsii$jsii_test$.AsyncVirtualMethods": { - "kind": "class", - "methods": [ - { - "name": "overrideMe", - "returns": { - "primitive": "number", - "promise": true - } - }, - { - "name": "dontOverrideMe", - "returns": { - "primitive": "number" - } - } - ], - "fqn": "jsii$jsii_test$.AsyncVirtualMethods", - "module": "jsii$jsii_test$", - "namespace": "jsii$jsii_test$", - "name": "AsyncVirtualMethods", - "initializer": { - "initializer": true - } - } - }, - "nametree": { - "jsii$jsii_test$": { - "Token": { - "_": "jsii$jsii_test$.Token" - }, - "TestClass3": { - "_": "jsii$jsii_test$.TestClass3" - }, - "TestClass2": { - "_": "jsii$jsii_test$.TestClass2", - "SubTypeOfTestClass2": { - "_": "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2", - "Foo": { - "_": "jsii$jsii_test$.TestClass2.SubTypeOfTestClass2.Foo" - } - } - }, - "BaseClass": { - "_": "jsii$jsii_test$.BaseClass" - }, - "TestClass": { - "_": "jsii$jsii_test$.TestClass" - }, - "TestEnum": { - "_": "jsii$jsii_test$.TestEnum", - "SubTypeOfTestEnum": { - "_": "jsii$jsii_test$.TestEnum.SubTypeOfTestEnum" - } - }, - "TestClass4": { - "_": "jsii$jsii_test$.TestClass4" - }, - "A": { - "_": "jsii$jsii_test$.A", - "B": { - "_": "jsii$jsii_test$.A.B", - "C": { - "_": "jsii$jsii_test$.A.B.C" - } - } - }, - "ExposeExternalDependency": { - "_": "jsii$jsii_test$.ExposeExternalDependency" - }, - "PropertyWithAnyValue": { - "_": "jsii$jsii_test$.PropertyWithAnyValue" - }, - "HasLogic": { - "_": "jsii$jsii_test$.HasLogic" - }, - "OptionalRef": { - "_": "jsii$jsii_test$.OptionalRef" - }, - "UnionProperties": { - "_": "jsii$jsii_test$.UnionProperties" - }, - "EnsureInitializerBase": { - "_": "jsii$jsii_test$.EnsureInitializerBase" - }, - "EnsureInitializer": { - "_": "jsii$jsii_test$.EnsureInitializer" - }, - "EnsureInitializer2": { - "_": "jsii$jsii_test$.EnsureInitializer2" - }, - "EnsureInitializer3": { - "_": "jsii$jsii_test$.EnsureInitializer3" - }, - "EnsureInitializerBase2": { - "_": "jsii$jsii_test$.EnsureInitializerBase2" - }, - "EnsureInitializer4": { - "_": "jsii$jsii_test$.EnsureInitializer4" - }, - "PropertiesInCtor": { - "_": "jsii$jsii_test$.PropertiesInCtor" - }, - "MyAbstractClass": { - "_": "jsii$jsii_test$.MyAbstractClass" - }, - "DerivedAbstract": { - "_": "jsii$jsii_test$.DerivedAbstract" - }, - "ClassWithProtectedStuff": { - "_": "jsii$jsii_test$.ClassWithProtectedStuff" - }, - "AsyncVirtualMethods": { - "_": "jsii$jsii_test$.AsyncVirtualMethods" - } - } - }, - "typecount": 29, - "externalTypes": { - "jsii$my_dep$.MyDepType": { - "kind": "class", - "properties": [ - { - "getter": true, - "setter": true, - "name": "foo", - "type": { - "primitive": "string" - } - }, - { - "getter": true, - "setter": true, - "name": "goo", - "type": { - "fqn": "jsii$my_indirect_dep$.IndirectDep" - } - } - ], - "fqn": "jsii$my_dep$.MyDepType", - "module": "jsii$my_dep$", - "namespace": "jsii$my_dep$", - "name": "MyDepType", - "initializer": { - "parameters": [ - { - "name": "p", - "type": { - "primitive": "number" - } - } - ], - "initializer": true - } - } - }, - "name": "jsii$jsii_test$", - "package": "jsii-test", - "version": "42.42.42", - "dependencies": { - "jsii$my_dep$": { - "package": "my-dep", - "version": "2.5.2" - } - }, - "bundled": { - "my-bundled-dep": "1.2.3" - }, - "names": { - "java": "com.amazon.jsii.test", - "js": "jsii-test" - }, - "nativenames": { - "jsii$my_dep$": { - "java": "com.acme.mydep" - }, - "jsii$jsii_test$": { - "java": "com.amazon.jsii.test", - "js": "jsii-test" - } - }, - "code": "var jsii$jsii_test$ =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst mydep = __webpack_require__(1);\nconst my_bundled_dep_1 = __webpack_require__(2);\nclass Token {\n}\nexports.Token = Token;\nclass TestClass3 {\n constructor() {\n this.hello = '';\n }\n}\nexports.TestClass3 = TestClass3;\nclass TestClass2 {\n // last argument is union, but it's optional, so the resulting jsii will just not include it.\n constructor(arg1 = 'hello', arg2, arg3, arg4, arg5) {\n this.a = 0;\n this.b = '';\n this.c = new TestClass3();\n arg1;\n arg2;\n arg3;\n arg4;\n arg5;\n my_bundled_dep_1.hi();\n }\n}\nexports.TestClass2 = TestClass2;\nclass BaseClass {\n constructor() {\n this.baseProp = '';\n }\n}\nexports.BaseClass = BaseClass;\n/**\n * This is the comment section\n * @link http://amazon.com\n * @description Description\n * @author benisrae\n */\nclass TestClass extends BaseClass {\n constructor() {\n // properties\n super(...arguments);\n /**\n * This is documentation for readonlyString\n */\n this.readonlyString = '';\n this.mutableNumber = 0;\n // list\n this.listOfStrings = [];\n this.listOfComplex = [];\n // map\n /**\n * And a comment\n * @description Map of booleans here\n */\n this.mapOfBooleans = {};\n this.mapOfComplex = {};\n // refs\n this.stringOrRef = '';\n this.jsonProperty = {};\n this.optionalAsUnion = '';\n this.arrayOfOptionals = new Array();\n this.readonlyMapOfOptionalsOrRefs = {};\n }\n /**\n * Read only boolean.\n */\n get readonlyBoolean() {\n return false;\n }\n /**\n * Sets the mutable complex object.\n */\n set mutableComplex(value) {\n value;\n }\n /**\n * Documentation for getter\n * @example This is an example\n */\n get mutableComplex() {\n return new TestClass2(\"hello\", new TestClass3(), 122);\n }\n _ignored() {\n // this method should not be included\n }\n // methods\n /**\n * Documentation for method\n */\n methodWithNoParameters() { }\n /**\n * Documentation for methodWithParams\n * @param param1 Doc for param1\n * @param param2 Doc for param2\n */\n methodWithParams(param1, param2, param3, param4) {\n param1;\n param2;\n param3;\n param4;\n this.notVisible();\n return true;\n }\n notVisible() {\n }\n /**\n * Docs on getter prevail.\n */\n get getterBeforeSetter() {\n return 'hello';\n }\n /**\n * Docs on setter are not allowed.\n */\n set getterBeforeSetter(value) {\n value;\n }\n get arrayGetter() {\n return [];\n }\n get mapGetter() {\n return { \"hello\": { a: 1, b: 'hello', c: { hello: 'hello' } } };\n }\n}\nexports.TestClass = TestClass;\n/**\n * This is the documentation for this enum.\n */\nvar TestEnum;\n(function (TestEnum) {\n /**\n * This is doc for Value1\n */\n TestEnum[TestEnum[\"Value1\"] = 0] = \"Value1\";\n /**\n * Doc for value2\n * @author benisrae@\n */\n TestEnum[TestEnum[\"Value2\"] = 1] = \"Value2\";\n TestEnum[\"Value3\"] = \"Hello\";\n})(TestEnum = exports.TestEnum || (exports.TestEnum = {}));\n(function (TestEnum) {\n class SubTypeOfTestEnum {\n constructor() {\n this.myProp = 12;\n }\n }\n TestEnum.SubTypeOfTestEnum = SubTypeOfTestEnum;\n})(TestEnum = exports.TestEnum || (exports.TestEnum = {}));\n(function (TestClass2) {\n class SubTypeOfTestClass2 {\n constructor() {\n this.yourProp = \"Hello\";\n }\n }\n TestClass2.SubTypeOfTestClass2 = SubTypeOfTestClass2;\n})(TestClass2 = exports.TestClass2 || (exports.TestClass2 = {}));\n(function (TestClass2) {\n var SubTypeOfTestClass2;\n (function (SubTypeOfTestClass2) {\n class Foo {\n }\n SubTypeOfTestClass2.Foo = Foo;\n })(SubTypeOfTestClass2 = TestClass2.SubTypeOfTestClass2 || (TestClass2.SubTypeOfTestClass2 = {}));\n})(TestClass2 = exports.TestClass2 || (exports.TestClass2 = {}));\n//\n// Const literals\n// jsii allows constant literals and actually includes the values in the jsii spec\n//\nclass TestClass4 {\n /**\n * p2 cannot be resolved, but it's optional, so we expect the typespec to just include p1\n */\n constructor(p1, p2, p3) {\n p1;\n p2;\n p3;\n TestClass4.NonPrimitive;\n }\n}\n// primitive consts values are allowed but only if they are simple literal data values\n// no math, no evaluation. literally!!\nTestClass4.StringConst = 'Hello';\nTestClass4.StringConstWithDoubleQuotes = \"World\";\nTestClass4.NumberConst = 1234;\nTestClass4.DoubleConst = 1234.44;\nTestClass4.BooleanConstValue = false;\nTestClass4.BooleanConstTrue = false;\n// ignored (with a warning) because it's a non-primitive literal\nTestClass4.NonLiteralConst = 123 + 45;\nTestClass4.ObjConst = new TestClass();\n// private\nTestClass4.NonPrimitive = new TestClass();\nexports.TestClass4 = TestClass4;\n//\n// This is good since there are no namesapces without a type.\n//\nclass A {\n}\nexports.A = A;\n(function (A) {\n class B {\n }\n A.B = B;\n})(A = exports.A || (exports.A = {}));\n(function (A) {\n var B;\n (function (B) {\n class C {\n }\n B.C = C;\n })(B = A.B || (A.B = {}));\n})(A = exports.A || (exports.A = {}));\n//\n// Use a type from an external dependency as a base class\n//\nclass ExposeExternalDependency extends mydep.MyDepType {\n constructor() {\n super(...arguments);\n this.froth = 0;\n }\n}\nexports.ExposeExternalDependency = ExposeExternalDependency;\nclass PropertyWithAnyValue {\n constructor() {\n this.myprop = undefined;\n }\n}\nexports.PropertyWithAnyValue = PropertyWithAnyValue;\n// jsii also indicates whether properties have backing logic or just represent raw data\nclass HasLogic {\n constructor() {\n this.propWithoutLogic = '';\n }\n /**\n * This property will have logic=true\n */\n get propWithLogic() {\n return 12;\n }\n set propWithLogic(val) {\n val;\n }\n}\nexports.HasLogic = HasLogic;\nclass OptionalRef {\n constructor() {\n this.prop2 = new Token();\n }\n}\nexports.OptionalRef = OptionalRef;\nclass UnionProperties {\n constructor() {\n this.withPrimitive1 = '';\n this.withPrimitive2 = '';\n this.noPrimitive = new TestClass3();\n }\n}\nexports.UnionProperties = UnionProperties;\n//\n// jsii is expected to automatically copy the initializer from TestClass3\n//\nclass EnsureInitializerBase {\n constructor(arg1, arg2) {\n arg1;\n arg2;\n }\n}\nexports.EnsureInitializerBase = EnsureInitializerBase;\nclass EnsureInitializer extends EnsureInitializerBase {\n}\nexports.EnsureInitializer = EnsureInitializer;\nclass EnsureInitializer2 extends EnsureInitializer {\n}\nexports.EnsureInitializer2 = EnsureInitializer2;\nclass EnsureInitializer3 extends EnsureInitializer2 {\n constructor(ihavemyowninitializer) {\n super('boo', false);\n ihavemyowninitializer;\n }\n}\nexports.EnsureInitializer3 = EnsureInitializer3;\n// here initializer has only optional values\n// in the meantime we still expect it to be cloned as is for lack of a evidence that we should do something else\nclass EnsureInitializerBase2 {\n constructor(arg1, arg2) {\n arg1;\n arg2;\n }\n}\nexports.EnsureInitializerBase2 = EnsureInitializerBase2;\nclass EnsureInitializer4 extends EnsureInitializerBase2 {\n}\nexports.EnsureInitializer4 = EnsureInitializer4;\nclass PropertiesInCtor {\n constructor(readonlyProp, readWriteProp, privateProp) {\n this.readonlyProp = readonlyProp;\n this.readWriteProp = readWriteProp;\n this.privateProp = privateProp;\n this.readWriteProp = this.privateProp;\n }\n}\nexports.PropertiesInCtor = PropertiesInCtor;\nclass MyAbstractClass {\n normalMethod() {\n }\n}\nexports.MyAbstractClass = MyAbstractClass;\nclass DerivedAbstract extends MyAbstractClass {\n}\nexports.DerivedAbstract = DerivedAbstract;\nclass ClassWithProtectedStuff {\n constructor(paramprop) {\n this.paramprop = paramprop;\n this.foo = 0;\n }\n get goo() {\n return 123;\n }\n set goo(val) {\n val;\n }\n protectedMethod(val) {\n val;\n return 123;\n }\n}\nexports.ClassWithProtectedStuff = ClassWithProtectedStuff;\nclass AsyncVirtualMethods {\n async overrideMe() {\n return 42;\n }\n dontOverrideMe() {\n return 42;\n }\n}\nexports.AsyncVirtualMethods = AsyncVirtualMethods;\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = jsii$my_dep$;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nexports.__esModule = true;\nexports.hi = function () { return 'this is coming from a bundled dependency. this means that its code is going to be included in our bundle.js file'; };\n\n\n/***/ })\n/******/ ]);\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgYmE2Y2ExOTNmOWJhNTY5YmY2NTYiLCJ3ZWJwYWNrOi8vLy4vdGVzdC9qc2lpLXRlc3QvaW5kZXgudHMiLCJ3ZWJwYWNrOi8vL2V4dGVybmFsIFwianNpaSRteV9kZXAkXCIiLCJ3ZWJwYWNrOi8vLy4vdGVzdC9qc2lpLXRlc3Qvbm9kZV9tb2R1bGVzL215LWJ1bmRsZWQtZGVwL2luZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7OztBQUdBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQUs7QUFDTDtBQUNBOztBQUVBO0FBQ0E7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ZVJvb3QiOiIifQ==" -} diff --git a/packages/jsii/test/jsii-test/.gitignore b/packages/jsii/test/jsii-test/.gitignore deleted file mode 100644 index b65ca651bb..0000000000 --- a/packages/jsii/test/jsii-test/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -!node_modules -dist -tsconfig.json -tslint.json \ No newline at end of file diff --git a/packages/jsii/test/jsii-test/LICENSE b/packages/jsii/test/jsii-test/LICENSE deleted file mode 100644 index 129acd53d9..0000000000 --- a/packages/jsii/test/jsii-test/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/packages/jsii/test/jsii-test/NOTICE b/packages/jsii/test/jsii-test/NOTICE deleted file mode 100644 index dc4ac3f857..0000000000 --- a/packages/jsii/test/jsii-test/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -jsii -Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/jsii/test/jsii-test/index.ts b/packages/jsii/test/jsii-test/index.ts deleted file mode 100644 index ce0b442a17..0000000000 --- a/packages/jsii/test/jsii-test/index.ts +++ /dev/null @@ -1,349 +0,0 @@ -import * as mydep from 'my-dep' -import { hi } from 'my-bundled-dep' - -export class Token { } - -export class TestClass3 { - hello: string = ''; -} - -export class TestClass2 { - a: number = 0; - b: string = ''; - c: TestClass3 = new TestClass3(); - - // last argument is union, but it's optional, so the resulting jsii will just not include it. - constructor(arg1 = 'hello', arg2: TestClass3, arg3: number | undefined, arg4?: boolean, arg5?: TestClass3 | TestClass2) { - arg1; arg2; arg3; arg4; arg5; - hi(); - } -} - -export class BaseClass { - baseProp: string = ''; -} - -/** - * This is the comment section - * @link http://amazon.com - * @description Description - * @author benisrae - */ -export class TestClass extends BaseClass { - - // properties - - /** - * This is documentation for readonlyString - */ - readonly readonlyString: string = ''; - mutableNumber: number = 0; - - /** - * Read only boolean. - */ - get readonlyBoolean() { - return false; - } - - /** - * Sets the mutable complex object. - */ - set mutableComplex(value: TestClass2) { - value; - } - - /** - * Documentation for getter - * @example This is an example - */ - get mutableComplex() { - return new TestClass2("hello", new TestClass3(), 122); - } - - _ignored() { - // this method should not be included - } - - // optional properties - - optionalMutableBoolean?: boolean - readonly optionalReadonlyDate?: Date - - // list - - listOfStrings: string[] = []; - optionalListOfNumbers?: number[]; - listOfComplex: TestClass2[] = []; - - // map - - /** - * And a comment - * @description Map of booleans here - */ - mapOfBooleans: { [ key: string ]: boolean } = {}; - mapOfComplex: { [ key: string]: TestClass3 } = {}; - - // refs - - stringOrRef: Token | string = ''; - - // methods - - /** - * Documentation for method - */ - methodWithNoParameters() { } - - /** - * Documentation for methodWithParams - * @param param1 Doc for param1 - * @param param2 Doc for param2 - */ - methodWithParams(param1: string, param2: number, param3?: TestClass3, param4?: TestClass2): boolean { - param1; - param2; - param3; - param4; - this.notVisible(); - return true; - } - - private notVisible() { - - } - - /** - * Docs on getter prevail. - */ - get getterBeforeSetter() { - return 'hello' - } - - /** - * Docs on setter are not allowed. - */ - set getterBeforeSetter(value: string) { - value; - } - - get arrayGetter(): TestEnum[] { - return [] - } - - get mapGetter(): { [key: string]: TestClass2 } { - return { "hello": { a: 1, b: 'hello', c: { hello: 'hello' } } } - } - - jsonProperty: object = {}; - - optionalBooleanOrRef?: boolean | Token - - optionalAsUnion: string | undefined = ''; - - arrayOfOptionals = new Array(); - readonly readonlyMapOfOptionalsOrRefs: { [key: string]: (string | undefined) } = {}; -} - -/** - * This is the documentation for this enum. - */ -export enum TestEnum { - /** - * This is doc for Value1 - */ - Value1, - - /** - * Doc for value2 - * @author benisrae@ - */ - Value2, - Value3 = 'Hello' -} - -export namespace TestEnum { - export class SubTypeOfTestEnum { - myProp = 12 - } -} - -export namespace TestClass2 { - export class SubTypeOfTestClass2 { - readonly yourProp?: string = "Hello" - } -} - -export namespace TestClass2.SubTypeOfTestClass2 { - export class Foo { - - } -} - -// -// Const literals -// jsii allows constant literals and actually includes the values in the jsii spec -// - -export class TestClass4 { - - // primitive consts values are allowed but only if they are simple literal data values - // no math, no evaluation. literally!! - static readonly StringConst = 'Hello'; - static readonly StringConstWithDoubleQuotes = "World"; - static readonly NumberConst = 1234; - static readonly DoubleConst = 1234.44; - static readonly BooleanConstValue = false; - static readonly BooleanConstTrue = false; - - // ignored (with a warning) because it's a non-primitive literal - static readonly NonLiteralConst = 123 + 45; - static readonly ObjConst = new TestClass(); - - // private - private static NonPrimitive = new TestClass(); - - /** - * p2 cannot be resolved, but it's optional, so we expect the typespec to just include p1 - */ - constructor(p1: string, p2?: () => void, p3?: string) { - p1; p2; p3; TestClass4.NonPrimitive; - } -} - -// -// This is good since there are no namesapces without a type. -// - -export class A { } -export namespace A { export class B { } } -export namespace A.B { export class C { } } - -// -// Use a type from an external dependency as a base class -// - -export class ExposeExternalDependency extends mydep.MyDepType { - froth: number = 0; -} - -export class PropertyWithAnyValue { - myprop: any = undefined; -} - -// jsii also indicates whether properties have backing logic or just represent raw data - -export class HasLogic { - - /** - * This property will have logic=true - */ - get propWithLogic() { - return 12 - } - - set propWithLogic(val: number) { - val; - } - - propWithoutLogic: string = ''; -} - -export class OptionalRef { - prop1?: Token - prop2: Token | undefined = new Token(); -} - -export class UnionProperties { - withPrimitive1: Token | string = ''; - withPrimitive2: string | Token = ''; - noPrimitive: Token | TestClass2 | TestClass3 = new TestClass3(); -} - -// -// jsii is expected to automatically copy the initializer from TestClass3 -// - -export class EnsureInitializerBase { - constructor(arg1: string, arg2: boolean) { - arg1; arg2; - } -} - -export class EnsureInitializer extends EnsureInitializerBase { - -} - -export class EnsureInitializer2 extends EnsureInitializer { - -} - -export class EnsureInitializer3 extends EnsureInitializer2 { - constructor(ihavemyowninitializer: boolean) { - super('boo', false) - ihavemyowninitializer; - } -} - -// here initializer has only optional values -// in the meantime we still expect it to be cloned as is for lack of a evidence that we should do something else - -export class EnsureInitializerBase2 { - constructor(arg1?: string, arg2?: boolean) { - arg1; arg2; - } -} - -export class EnsureInitializer4 extends EnsureInitializerBase2 { - -} - -export class PropertiesInCtor { - constructor(readonly readonlyProp: string, public readWriteProp: string, private readonly privateProp: string) { - this.readWriteProp = this.privateProp; - } -} - -export abstract class MyAbstractClass { - normalMethod() { - - } - - abstract abstractMethod(value: number): string; -} - -export abstract class DerivedAbstract extends MyAbstractClass { -} - -export class ClassWithProtectedStuff { - - protected constructor(protected paramprop: string) { - - } - - protected readonly foo: number = 0; - - protected get goo() { - return 123; - } - - protected set goo(val: number) { - val; - } - - protected protectedMethod(val: string): number { - val; - return 123; - } -} - -export class AsyncVirtualMethods { - async overrideMe(): Promise { - return 42 - } - - dontOverrideMe() { - return 42; - } -} \ No newline at end of file diff --git a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/.gitignore b/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/.gitignore deleted file mode 100644 index d4aa116a26..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!*.js diff --git a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/index.d.ts b/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/index.d.ts deleted file mode 100644 index 3ac7f6a6a5..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const hi: () => string; diff --git a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/index.js b/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/index.js deleted file mode 100644 index 12a40cb774..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/index.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -exports.__esModule = true; -exports.hi = function () { return 'this is coming from a bundled dependency. this means that its code is going to be included in our bundle.js file'; }; diff --git a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/package.json b/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/package.json deleted file mode 100644 index dbb62253e5..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-bundled-dep/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "my-bundled-dep", - "version": "1.2.3", - "main": "index.js", - "types": "index.d.ts" -} diff --git a/packages/jsii/test/jsii-test/node_modules/my-dep/.gitignore b/packages/jsii/test/jsii-test/node_modules/my-dep/.gitignore deleted file mode 100644 index cf4bab9ddd..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-dep/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!node_modules diff --git a/packages/jsii/test/jsii-test/node_modules/my-dep/assembly.jsii b/packages/jsii/test/jsii-test/node_modules/my-dep/assembly.jsii deleted file mode 100644 index 1c19810ccd..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-dep/assembly.jsii +++ /dev/null @@ -1,65 +0,0 @@ -{ - "schema": "jsii/1.0", - "types": { - "jsii$my_dep$.MyDepType": { - "kind": "class", - "properties": [ - { - "getter": true, - "setter": true, - "name": "foo", - "type": { - "primitive": "string" - } - }, - { - "getter": true, - "setter": true, - "name": "goo", - "type": { - "fqn": "jsii$my_indirect_dep$.IndirectDep" - } - } - ], - "fqn": "jsii$my_dep$.MyDepType", - "module": "jsii$my_dep$", - "namespace": "jsii$my_dep$", - "name": "MyDepType", - "initializer": { - "parameters": [ - { - "name": "p", - "type": { - "primitive": "number" - } - } - ], - "initializer": true - } - } - }, - "nametree": { - "jsii$my_dep$": { - "MyDepType": { - "_": "jsii$my_dep$.MyDepType" - } - } - }, - "typecount": 1, - "name": "jsii$my_dep$", - "version": "2.5.2", - "package": "my-dep", - "dependencies": { - "jsii$my_indirect_dep$": { - "version": "1.1.1", - "module": "jsii$my_indirect_dep$", - "package": "my-indirect-dep", - "names": { - "java": "com.acme.myindirectdep" - } - } - }, - "names": { - "java": "com.acme.mydep" - } -} \ No newline at end of file diff --git a/packages/jsii/test/jsii-test/node_modules/my-dep/index.ts b/packages/jsii/test/jsii-test/node_modules/my-dep/index.ts deleted file mode 100644 index 86aa767ec5..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-dep/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IndirectDep } from 'my-indirect-dep' - -export class MyDepType { - foo: string = ''; - goo: IndirectDep = new IndirectDep(); - - constructor(p: number) { - p; - } -} \ No newline at end of file diff --git a/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/assembly.jsii b/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/assembly.jsii deleted file mode 100644 index 60ec9c642c..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/assembly.jsii +++ /dev/null @@ -1,38 +0,0 @@ -{ - "schema": "jsii/1.0", - "types": { - "jsii$my_indirect_dep$.IndirectDep": { - "kind": "class", - "properties": [ - { - "getter": true, - "setter": true, - "name": "xoo", - "type": { - "primitive": "string" - } - } - ], - "fqn": "jsii$my_indirect_dep$.IndirectDep", - "module": "jsii$my_indirect_dep$", - "namespace": "jsii$my_indirect_dep$", - "name": "IndirectDep", - "initializer": { - "initializer": true - } - } - }, - "nametree": { - "jsii$my_indirect_dep$": { - "IndirectDep": { - "_": "jsii$my_indirect_dep$.IndirectDep" - } - } - }, - "typecount": 1, - "name": "jsii$my_indirect_dep$", - "version": "1.1.1", - "names": { - "java": "com.acme.myindirectdep" - } -} \ No newline at end of file diff --git a/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/index.ts b/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/index.ts deleted file mode 100644 index aa856ec586..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class IndirectDep { - xoo: string = ''; -} diff --git a/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/package.json b/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/package.json deleted file mode 100644 index c414a3e1e3..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-dep/node_modules/my-indirect-dep/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "my-indirect-dep", - "version": "1.1.1", - "jsii": { - "outdir": ".", - "names": { - "java": "com.acme.myindirectdep" - } - }, - "types": "index/d.ts", - "main": "index.js", - "scripts": { - "build": "jsii" - } -} diff --git a/packages/jsii/test/jsii-test/node_modules/my-dep/package.json b/packages/jsii/test/jsii-test/node_modules/my-dep/package.json deleted file mode 100644 index ce2d7453e9..0000000000 --- a/packages/jsii/test/jsii-test/node_modules/my-dep/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "my-dep", - "version": "2.5.2", - "jsii": { - "outdir": ".", - "names": { - "java": "com.acme.mydep" - } - }, - "types": "index.d.ts", - "main": "index.js", - "scripts": { - "build": "jsii" - }, - "dependencies": { - "my-indirect-dep": "1.1.1" - } -} diff --git a/packages/jsii/test/jsii-test/package.json b/packages/jsii/test/jsii-test/package.json deleted file mode 100644 index 7d23807502..0000000000 --- a/packages/jsii/test/jsii-test/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "jsii-test", - "version": "42.42.42", - "description": "description for jsiitest", - "main": "index.js", - "types": "index.d.ts", - "jsii": { - "outdir": "dist/jsii", - "targets": { - "java": { - "package": "com.amazon.jsii.test" - } - } - }, - "dependencies": { - "my-dep": "^2.5.2", - "my-bundled-dep": "1.2.3" - }, - "bundleDependencies": [ "my-bundled-dep" ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com" - }, - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "git://github.com/awslabs/jsii" - } -} diff --git a/packages/jsii/test/negatives/.gitignore b/packages/jsii/test/negatives/.gitignore new file mode 100644 index 0000000000..63308616bf --- /dev/null +++ b/packages/jsii/test/negatives/.gitignore @@ -0,0 +1 @@ +!mylib.d.ts diff --git a/packages/jsii/test/negatives/mylib.d.ts b/packages/jsii/test/negatives/mylib.d.ts new file mode 100644 index 0000000000..506758dc05 --- /dev/null +++ b/packages/jsii/test/negatives/mylib.d.ts @@ -0,0 +1,2 @@ +export declare class UnexportedType { +} diff --git a/packages/jsii/test/negatives/mylib.ts b/packages/jsii/test/negatives/mylib.ts deleted file mode 100644 index ed00655789..0000000000 --- a/packages/jsii/test/negatives/mylib.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class UnexportedType { - -} \ No newline at end of file diff --git a/packages/jsii/test/negatives/neg.expose-unexported-type-external.ts b/packages/jsii/test/negatives/neg.expose-unexported-type-external.ts index fcb77beccc..00da931f53 100644 --- a/packages/jsii/test/negatives/neg.expose-unexported-type-external.ts +++ b/packages/jsii/test/negatives/neg.expose-unexported-type-external.ts @@ -1,10 +1,10 @@ -///!MATCH_ERROR: Found unexported types in the API, which are also not exported by any dependency +///!MATCH_ERROR: Exported APIs cannot use un-exported type jsii.UnexportedType // Attempt to expose an unexported type defined in another file should fial // because that type will not be available in the module spec. -import { UnexportedType } from './mylib' +import { UnexportedType } from './mylib'; export class ExportedType { - p?: UnexportedType + public p?: UnexportedType; } diff --git a/packages/jsii/test/negatives/neg.expose-unexported-type-internal-in-namespace.ts b/packages/jsii/test/negatives/neg.expose-unexported-type-internal-in-namespace.ts index 972e5fa987..4f35f327d7 100644 --- a/packages/jsii/test/negatives/neg.expose-unexported-type-internal-in-namespace.ts +++ b/packages/jsii/test/negatives/neg.expose-unexported-type-internal-in-namespace.ts @@ -1,4 +1,4 @@ -///!MATCH_ERROR: Cannot use unexported type +///!MATCH_ERROR: Cannot use private type MyNamespace.UnexportedType in exported declarations // Attempt to expose an unexported type defined in this file should fail // because that type will not be available in the module spec. @@ -9,5 +9,5 @@ namespace MyNamespace { } export class ExportedType { - p?: MyNamespace.UnexportedType; + public p?: MyNamespace.UnexportedType; } diff --git a/packages/jsii/test/negatives/neg.expose-unexported-type-internal.ts b/packages/jsii/test/negatives/neg.expose-unexported-type-internal.ts index bbb8e006c6..eadab9e429 100644 --- a/packages/jsii/test/negatives/neg.expose-unexported-type-internal.ts +++ b/packages/jsii/test/negatives/neg.expose-unexported-type-internal.ts @@ -1,4 +1,4 @@ -///!MATCH_ERROR: Cannot use unexported type +///!MATCH_ERROR: Cannot use private type UnexportedType in exported declarations // Attempt to expose an unexported type defined in this file should fail // because that type will not be available in the module spec. @@ -8,5 +8,5 @@ class UnexportedType { } export class ExportedType { - p?: UnexportedType + public p?: UnexportedType; } diff --git a/packages/jsii/test/negatives/neg.implementation-changes-types.1.ts b/packages/jsii/test/negatives/neg.implementation-changes-types.1.ts new file mode 100644 index 0000000000..501d3496d5 --- /dev/null +++ b/packages/jsii/test/negatives/neg.implementation-changes-types.1.ts @@ -0,0 +1,16 @@ +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.Something#returnSomething changes the return type when implementing jsii.ISomething (expected jsii.Superclass, found jsii.Subclass) + +export class Superclass {} +export class Subclass extends Superclass {} + +export interface ISomething { + returnSomething(): Superclass; +} + +export class Something implements ISomething { + public returnSomething(): Subclass { + return 5; + } +} diff --git a/packages/jsii/test/negatives/neg.implementation-changes-types.2.ts b/packages/jsii/test/negatives/neg.implementation-changes-types.2.ts new file mode 100644 index 0000000000..0eb0f843c3 --- /dev/null +++ b/packages/jsii/test/negatives/neg.implementation-changes-types.2.ts @@ -0,0 +1,14 @@ +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.ISomethingElse#returnSomething changes the return type when implementing jsii.ISomething (expected jsii.Superclass, found jsii.Subclass) + +export class Superclass {} +export class Subclass extends Superclass {} + +export interface ISomething { + returnSomething(): Superclass; +} + +export interface ISomethingElse extends ISomething { + returnSomething(): Subclass; +} diff --git a/packages/jsii/test/negatives/neg.implementation-changes-types.3.ts b/packages/jsii/test/negatives/neg.implementation-changes-types.3.ts new file mode 100644 index 0000000000..69d7fe52a7 --- /dev/null +++ b/packages/jsii/test/negatives/neg.implementation-changes-types.3.ts @@ -0,0 +1,16 @@ +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.Something#takeSomething changes type of argument _argument when implementing jsii.ISomething (expected jsii.Superclass, found jsii.Subclass + +export class Superclass {} +export class Subclass extends Superclass {} + +export interface ISomething { + takeSomething(argument: Superclass): void; +} + +export class Something implements ISomething { + public takeSomething(_argument: Subclass): void { + // Nothing + } +} diff --git a/packages/jsii/test/negatives/neg.implementation-changes-types.4.ts b/packages/jsii/test/negatives/neg.implementation-changes-types.4.ts new file mode 100644 index 0000000000..4f7aba8fc9 --- /dev/null +++ b/packages/jsii/test/negatives/neg.implementation-changes-types.4.ts @@ -0,0 +1,14 @@ +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.Something#something changes the type of property when implementing jsii.ISomething (expected jsii.Superclass, found jsii.Subclass) + +export class Superclass {} +export class Subclass extends Superclass {} + +export interface ISomething { + something: Superclass; +} + +export class Something implements ISomething { + public something: Subclass = new Subclass(); +} diff --git a/packages/jsii/test/negatives/neg.implementation-changes-types.5.ts b/packages/jsii/test/negatives/neg.implementation-changes-types.5.ts new file mode 100644 index 0000000000..88f81e43ed --- /dev/null +++ b/packages/jsii/test/negatives/neg.implementation-changes-types.5.ts @@ -0,0 +1,20 @@ +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.ISomethingElse#something changes the type of property when implementing jsii.ISomething (expected jsii.Superclass, found jsii.Subclass) + +export class Superclass {} +export class Subclass extends Superclass {} + +export interface ISomething { + something: Superclass; +} + +export interface ISomethingElse extends ISomething { + addUnrelatedMember: number; +} + +// Should still fail even though 2-level inheritance +export class Something implements ISomethingElse { + public something: Subclass = new Subclass(); + public addUnrelatedMember: number = 1; +} diff --git a/packages/jsii/test/negatives/neg.implements-class.ts b/packages/jsii/test/negatives/neg.implements-class.ts new file mode 100644 index 0000000000..176bb1aa71 --- /dev/null +++ b/packages/jsii/test/negatives/neg.implements-class.ts @@ -0,0 +1,14 @@ +///!MATCH_ERROR: Implements clause of jsii.TryingToImplementClass uses jsii.NotAnInterface as an interface + +export class NotAnInterface { + public meaningOfTheUniverse() { + return 42; + } +} + +// While valid typescript, this is illegal in the vast majority of languages +export class TryingToImplementClass implements NotAnInterface { + public meaningOfTheUniverse() { + return 1337; + } +} diff --git a/packages/jsii/test/negatives/neg.inheritance-changes-types.1.ts b/packages/jsii/test/negatives/neg.inheritance-changes-types.1.ts index 153559c7eb..452e28fbcf 100644 --- a/packages/jsii/test/negatives/neg.inheritance-changes-types.1.ts +++ b/packages/jsii/test/negatives/neg.inheritance-changes-types.1.ts @@ -1,15 +1,18 @@ -// tslint:disable-next-line:comment-format -///!MATCH_ERROR: return type changed +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.SomethingSpecific#returnSomething changes the return type when overriding jsii.Something (expected jsii.Superclass, found jsii.Subclass) export class Superclass {} export class Subclass extends Superclass {} -export interface ISomething { - returnSomething(): Superclass; +export class Something { + public returnSomething(): Superclass { + return new Superclass(); + } } -export class Something implements ISomething { +export class SomethingSpecific extends Something { public returnSomething(): Subclass { return 5; } -} \ No newline at end of file +} diff --git a/packages/jsii/test/negatives/neg.inheritance-changes-types.2.ts b/packages/jsii/test/negatives/neg.inheritance-changes-types.2.ts index 682b550a92..6ecda76456 100644 --- a/packages/jsii/test/negatives/neg.inheritance-changes-types.2.ts +++ b/packages/jsii/test/negatives/neg.inheritance-changes-types.2.ts @@ -1,13 +1,18 @@ -// tslint:disable-next-line:comment-format -///!MATCH_ERROR: return type changed +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.SomethingSpecific#returnSomething changes the return type when overriding jsii.Something (expected jsii.Superclass, found jsii.Subclass) export class Superclass {} export class Subclass extends Superclass {} -export interface ISomething { - returnSomething(): Superclass; +export class Something { + public returnSomething(): Superclass { + return new Superclass(); + } } -export interface ISomethingElse extends ISomething { - returnSomething(): Subclass; -} \ No newline at end of file +export class SomethingSpecific extends Something { + public returnSomething(): Subclass { + return new Subclass(); + } +} diff --git a/packages/jsii/test/negatives/neg.inheritance-changes-types.3.ts b/packages/jsii/test/negatives/neg.inheritance-changes-types.3.ts index 40aee6880e..64ab9e3d0f 100644 --- a/packages/jsii/test/negatives/neg.inheritance-changes-types.3.ts +++ b/packages/jsii/test/negatives/neg.inheritance-changes-types.3.ts @@ -1,15 +1,18 @@ -// tslint:disable-next-line:comment-format -///!MATCH_ERROR: parameter 1 type changed +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.SomethingSpecific#takeSomething changes type of argument _argument when overriding jsii.Something (expected jsii.Superclass, found jsii.Subclass export class Superclass {} export class Subclass extends Superclass {} -export interface ISomething { - takeSomething(argument: Superclass): void; +export class Something { + public takeSomething(_argument: Superclass): void { + // Nothing + } } -export class Something implements ISomething { +export class SomethingSpecific extends Something { public takeSomething(_argument: Subclass): void { // Nothing } -} \ No newline at end of file +} diff --git a/packages/jsii/test/negatives/neg.inheritance-changes-types.4.ts b/packages/jsii/test/negatives/neg.inheritance-changes-types.4.ts index 9206c62b60..352ff13dfa 100644 --- a/packages/jsii/test/negatives/neg.inheritance-changes-types.4.ts +++ b/packages/jsii/test/negatives/neg.inheritance-changes-types.4.ts @@ -1,13 +1,14 @@ -// tslint:disable-next-line:comment-format -///!MATCH_ERROR: type changed +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.SomethingSpecific#something changes the type of property when overriding jsii.Something (expected jsii.Superclass, found jsii.Subclass) export class Superclass {} export class Subclass extends Superclass {} -export interface ISomething { - something: Superclass; +export class Something { + public something: Superclass; } -export class Something implements ISomething { +export class SomethingSpecific extends Something { public something: Subclass = new Subclass(); -} \ No newline at end of file +} diff --git a/packages/jsii/test/negatives/neg.inheritance-changes-types.5.ts b/packages/jsii/test/negatives/neg.inheritance-changes-types.5.ts index 85bbc6cd99..fbf0322b8a 100644 --- a/packages/jsii/test/negatives/neg.inheritance-changes-types.5.ts +++ b/packages/jsii/test/negatives/neg.inheritance-changes-types.5.ts @@ -1,19 +1,20 @@ -// tslint:disable-next-line:comment-format -///!MATCH_ERROR: type changed +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: jsii.SomethingElse#something changes the type of property when overriding jsii.Something (expected jsii.Superclass, found jsii.Subclass) export class Superclass {} export class Subclass extends Superclass {} -export interface ISomething { - something: Superclass; +export class Something { + public something: Superclass; } -export interface ISomethingElse extends ISomething { - addUnrelatedMember: number; +export class SomethingElse extends Something { + public addUnrelatedMember: number; } // Should still fail even though 2-level inheritance -export class Something implements ISomethingElse { +export class SomethingDifferent extends SomethingElse { public something: Subclass = new Subclass(); public addUnrelatedMember: number = 1; -} \ No newline at end of file +} diff --git a/packages/jsii/test/negatives/neg.method-name.1.ts b/packages/jsii/test/negatives/neg.method-name.1.ts index 1277aba511..879da41f56 100644 --- a/packages/jsii/test/negatives/neg.method-name.1.ts +++ b/packages/jsii/test/negatives/neg.method-name.1.ts @@ -1,7 +1,7 @@ -///!MATCH_ERROR: 'METHOD' must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: METHOD export class MyClass { - METHOD() { + public METHOD() { return "hi"; } } diff --git a/packages/jsii/test/negatives/neg.method-name.2.ts b/packages/jsii/test/negatives/neg.method-name.2.ts index 2b5e2d96ca..c4baa80f75 100644 --- a/packages/jsii/test/negatives/neg.method-name.2.ts +++ b/packages/jsii/test/negatives/neg.method-name.2.ts @@ -1,7 +1,7 @@ -///!MATCH_ERROR: ERROR 'hello_world' must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: hello_world export class MyClass { - hello_world() { + public hello_world() { return "hi"; } } diff --git a/packages/jsii/test/negatives/neg.method-name.3.ts b/packages/jsii/test/negatives/neg.method-name.3.ts index 4356d590e8..280f233b81 100644 --- a/packages/jsii/test/negatives/neg.method-name.3.ts +++ b/packages/jsii/test/negatives/neg.method-name.3.ts @@ -1,7 +1,7 @@ -///!MATCH_ERROR: Methods and properties cannot have the signature getXxx() since these will conflict with Java property getters by the same name +///!MATCH_ERROR: Methods and properties cannot have names like getXxx() - those conflict with Java property getters by the same name export class MyClass { - getFoo() { + public getFoo() { return "hi"; } } diff --git a/packages/jsii/test/negatives/neg.method-name.4.ts b/packages/jsii/test/negatives/neg.method-name.4.ts index 05ad325498..b0334729fc 100644 --- a/packages/jsii/test/negatives/neg.method-name.4.ts +++ b/packages/jsii/test/negatives/neg.method-name.4.ts @@ -1,7 +1,7 @@ -///!MATCH_ERROR: Methods and properties cannot have the signature setXxx(v) since these will conflict with Java property setters +///!MATCH_ERROR: Methods and properties cannot have names like setXxx() - those conflict with Java property setters by the same name export class MyClass { - setFoo(_value: string) { + public setFoo(_value: string) { return "hi"; } } diff --git a/packages/jsii/test/negatives/neg.namespace-as-child.ts b/packages/jsii/test/negatives/neg.namespace-as-child.ts deleted file mode 100644 index 6bfea8ba87..0000000000 --- a/packages/jsii/test/negatives/neg.namespace-as-child.ts +++ /dev/null @@ -1,18 +0,0 @@ -///!MATCH_ERROR: this structure cannot be supported in all languages - -// this structure is not supported because it cannot be represented in all languages -// this means that call sub-namespaces must be concrete types - -export class A { - -} - -// Missing a type named A.B - -export namespace A.B { - - export class C { - - } - -} \ No newline at end of file diff --git a/packages/jsii/test/negatives/neg.property-name.1.ts b/packages/jsii/test/negatives/neg.property-name.1.ts index 6110511a0e..1d1e1c9b7c 100644 --- a/packages/jsii/test/negatives/neg.property-name.1.ts +++ b/packages/jsii/test/negatives/neg.property-name.1.ts @@ -1,5 +1,5 @@ -///!MATCH_ERROR: ERROR 'PROP' must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: PROP export class MyClass { - PROP?: number; + public PROP?: number; } diff --git a/packages/jsii/test/negatives/neg.property-name.2.ts b/packages/jsii/test/negatives/neg.property-name.2.ts index 7a1f1e3c79..612a4828a4 100644 --- a/packages/jsii/test/negatives/neg.property-name.2.ts +++ b/packages/jsii/test/negatives/neg.property-name.2.ts @@ -1,5 +1,5 @@ -///!MATCH_ERROR: ERROR 'my_Prop' must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: my_Prop export class MyClass { - my_Prop?: number; + public my_Prop?: number; } diff --git a/packages/jsii/test/negatives/neg.property-name.3.ts b/packages/jsii/test/negatives/neg.property-name.3.ts index 259a5a3a0d..94f4fb0fd1 100644 --- a/packages/jsii/test/negatives/neg.property-name.3.ts +++ b/packages/jsii/test/negatives/neg.property-name.3.ts @@ -1,5 +1,5 @@ -///!MATCH_ERROR: Methods and properties cannot have the signature getXxx() since these will conflict with Java property getters by the same name +///!MATCH_ERROR: Methods and properties cannot have names like getXxx() - those conflict with Java property getters by the same name export class MyClass { - getFoo?: number; + public getFoo?: number; } diff --git a/packages/jsii/test/negatives/neg.static-const-name.ts b/packages/jsii/test/negatives/neg.static-const-name.ts index 7a405c8bff..a550f0d3dd 100644 --- a/packages/jsii/test/negatives/neg.static-const-name.ts +++ b/packages/jsii/test/negatives/neg.static-const-name.ts @@ -1,4 +1,5 @@ -///!MATCH_ERROR: 'snake_case' is a const and must use PascalCase, UPPER_SNAKE_CASE or camelCase +// tslint:disable-next-line:comment-format +///!MATCH_ERROR: Static constant names must use TRUMP_CASE, PascalCase or camelCase: snake_case export class MyClass { static readonly snake_case = 123; diff --git a/packages/jsii/test/negatives/neg.static-method-name.1.ts b/packages/jsii/test/negatives/neg.static-method-name.1.ts index c1effb12fb..ca3671dbf3 100644 --- a/packages/jsii/test/negatives/neg.static-method-name.1.ts +++ b/packages/jsii/test/negatives/neg.static-method-name.1.ts @@ -1,4 +1,4 @@ -///!MATCH_ERROR: ERROR 'MethodIsNotCamelCase' must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: MethodIsNotCamelCase export class MyClass { MethodIsNotCamelCase() { diff --git a/packages/jsii/test/negatives/neg.static-method-name.ts b/packages/jsii/test/negatives/neg.static-method-name.ts index dadaf5365e..5d3fcb0422 100644 --- a/packages/jsii/test/negatives/neg.static-method-name.ts +++ b/packages/jsii/test/negatives/neg.static-method-name.ts @@ -1,4 +1,4 @@ -///!MATCH_ERROR: ERROR 'METHOD' must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: METHOD export class MyClass { METHOD() { diff --git a/packages/jsii/test/negatives/neg.static-prop-name.1.ts b/packages/jsii/test/negatives/neg.static-prop-name.1.ts index bddcf01743..dd5e8b0ec8 100644 --- a/packages/jsii/test/negatives/neg.static-prop-name.1.ts +++ b/packages/jsii/test/negatives/neg.static-prop-name.1.ts @@ -1,4 +1,4 @@ -///!MATCH_ERROR: 'Prop' is a static property and must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: Prop export class MyClass { static get Prop() { diff --git a/packages/jsii/test/negatives/neg.static-prop-name.2.ts b/packages/jsii/test/negatives/neg.static-prop-name.2.ts index e0530b7f09..4551e14a1f 100644 --- a/packages/jsii/test/negatives/neg.static-prop-name.2.ts +++ b/packages/jsii/test/negatives/neg.static-prop-name.2.ts @@ -1,4 +1,4 @@ -///!MATCH_ERROR: 'PROP' is a static property and must use camelCase +///!MATCH_ERROR: Method and property names must use camelCase: PROP export class MyClass { static get PROP() { diff --git a/packages/jsii/test/test.negatives.ts b/packages/jsii/test/test.negatives.ts index a7d497e8cd..2d4b174af2 100644 --- a/packages/jsii/test/test.negatives.ts +++ b/packages/jsii/test/test.negatives.ts @@ -1,72 +1,77 @@ -import fs = require('fs'); -import spec = require('jsii-spec'); -import { Test } from 'nodeunit'; +import fs = require('fs-extra'); +import nodeunit = require('nodeunit'); import path = require('path'); -import { compileSources } from '../lib/compiler'; +import ts = require('typescript'); +import { Compiler } from '../lib/compiler'; +import { ProjectInfo } from '../lib/project-info'; -const tests: any = { }; -const negativesDir = path.join(__dirname, 'negatives'); +const SOURCE_DIR = path.join(__dirname, 'negatives'); -const MATCH_ERROR_MARKER = '///!MATCH_ERROR:'; - -async function getExpectedErrorMessage(filePath: string) { - return new Promise((ok, fail) => { - return fs.readFile(filePath, (err, data) => { - if (err) { return fail(err); } - const matches = data.toString() - .split('\n') - .filter(line => line.startsWith(MATCH_ERROR_MARKER)) - .map(line => line.substr(MATCH_ERROR_MARKER.length)) - .map(line => line.trim()); - - if (matches.length === 0) { - throw new Error(`Expecting at least one ${MATCH_ERROR_MARKER} in each neg. test, none found in ${filePath}`); - } - ok(matches); - }); - }); -} +const testCases: { [name: string]: (test: nodeunit.Test) => void } = {}; -for (const source of fs.readdirSync(negativesDir)) { - if (!source.endsWith('.ts') || source.endsWith('.d.ts')) { continue; } - if (!source.startsWith('neg.')) { continue; } +for (const source of fs.readdirSync(SOURCE_DIR)) { + if (!source.startsWith('neg.') || !source.endsWith('.ts') || source.endsWith('.d.ts')) { continue; } + const filePath = path.join(SOURCE_DIR, source); + testCases[source.replace(/neg\.(.+)\.ts/, '$1')] = async (test: nodeunit.Test) => { + const expectations = await _getExpectedErrorMessage(filePath); + test.ok(expectations.length > 0, `Expected error messages should be specified using ${MATCH_ERROR_MARKER}`); + const compiler = new Compiler({ projectInfo: _makeProjectInfo(source), watch: false }); + const emitResult = await compiler.emit(path.join(SOURCE_DIR, source)); + test.equal(emitResult.emitSkipped, true, `emitSkipped should be true`); + const errors = emitResult.diagnostics.filter(diag => diag.category === ts.DiagnosticCategory.Error); + for (const expectation of expectations) { + test.notEqual(errors.find(e => _messageText(e).indexOf(expectation) !== -1), + null, + `No error contained: ${expectation}. Errors: \n${errors.map((e, i) => `[${i}] ${e.messageText}`).join('\n')}`); + } - tests[source] = async (test: Test) => { - const filePath = path.join(negativesDir, source); - const matchError = await getExpectedErrorMessage(filePath); - let failed = false; - try { - await compileSources(path.join(negativesDir, source), - undefined /* No extra source */, - undefined /* No external types */, - { - schema: spec.SchemaVersion.V1_0, - name: 'foo', - version: 'bar', - license: 'NONE', - author: { name: 'Author', roles: ['author'] }, - fingerprint: 'baz', - description: 'hello', - homepage: 'http://foo', - repository: { - url: 'http://', - type: 'git' - }, - targets: {}, - types: {} - }, - true /* warnings as errors */); - } catch (e) { - for (const match of matchError) { - if (e.message.indexOf(match) === -1) { - test.ifError(new Error(`Compile failed, but error message didn't match expected text "${match}". Error was: ${e.message}`)); - } + // Cleaning up... + for (const file of await fs.readdir(SOURCE_DIR)) { + if (file.startsWith('neg.') && (file.endsWith('.d.ts') || file.endsWith('.js'))) { + await fs.remove(path.join(SOURCE_DIR, file)); } - failed = true; + await fs.remove(path.join(SOURCE_DIR, '.jsii')); + await fs.remove(path.join(SOURCE_DIR, 'tsconfig.json')); } - test.ok(failed, 'Compilation was expected to fail'); + test.done(); }; } -export default tests; +export = nodeunit.testCase({ 'jsii rejections': testCases }); + +const MATCH_ERROR_MARKER = '///!MATCH_ERROR:'; +async function _getExpectedErrorMessage(file: string): Promise { + const data = await fs.readFile(file, { encoding: 'utf8' }); + const lines = data.split('\n'); + const matches = lines.filter(line => line.startsWith(MATCH_ERROR_MARKER)) + .map(line => line.substr(MATCH_ERROR_MARKER.length).trim()); + return matches; +} + +function _messageText(diagnostic: ts.Diagnostic | ts.DiagnosticMessageChain): string { + if (typeof diagnostic.messageText === 'string') { + return diagnostic.messageText; + } + if (diagnostic.messageText.next) { + return diagnostic.messageText.messageText + '|' + _messageText(diagnostic.messageText.next); + } + return diagnostic.messageText.messageText; +} + +function _makeProjectInfo(types: string): ProjectInfo { + return { + projectRoot: SOURCE_DIR, + types, + main: types.replace(/(?:\.d)?\.ts(x?)/, '.js$1'), + name: 'jsii', // That's what package.json would tell if we look up... + version: '0.0.1', + license: 'Apache-2.0', + author: { name: 'John Doe', roles: ['author'] }, + repository: { type: 'git', url: 'https://github.com/awslabs/jsii.git' }, + dependencies: [], + transitiveDependencies: [], + bundleDependencies: {}, + targets: {} + }; +} diff --git a/packages/jsii/test/test.package-metadata.ts b/packages/jsii/test/test.package-metadata.ts deleted file mode 100644 index e49119d2f9..0000000000 --- a/packages/jsii/test/test.package-metadata.ts +++ /dev/null @@ -1,53 +0,0 @@ -import fs = require('fs-extra'); -import nodeunit = require('nodeunit'); -import os = require('os'); -import path = require('path'); -import readPackageMetadata from '../lib/package-metadata'; - -export = nodeunit.testCase({ - readPackageMetadata: { - async 'correctly loads valid file'(test: nodeunit.Test) { - try { - await withTempDir(async (tmpdir) => { - const packageInfo = require('./jsii-test/package.json'); - await fs.writeJson(path.join(tmpdir, 'package.json'), packageInfo); - const md = await readPackageMetadata(tmpdir); - test.notEqual(md, null); - }); - } catch (e) { - test.doesNotThrow(() => { throw e; }); - } finally { - test.done(); - } - }, - async 'rejects package without a version'(test: nodeunit.Test) { - let error: Error; - try { - await withTempDir(async (tmpdir) => { - const packageInfo = require('./jsii-test/package.json'); - delete packageInfo.version; - await fs.writeJson(path.join(tmpdir, 'package.json'), packageInfo); - await readPackageMetadata(tmpdir); - }); - } catch (e) { - error = e; - } finally { - test.throws(() => { - if (error) { throw error; } - }, /must contain a "version" field/); - } - test.done(); - } - } -}); - -async function withTempDir(cb: (dir: string) => T | Promise): Promise { - const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'package-metadata-test')); - try { - return await cb(dir); - } catch (e) { - throw e; - } finally { - await fs.remove(dir); - } -} diff --git a/packages/jsii/test/test.project-info.ts b/packages/jsii/test/test.project-info.ts new file mode 100644 index 0000000000..2595485a14 --- /dev/null +++ b/packages/jsii/test/test.project-info.ts @@ -0,0 +1,243 @@ +import clone = require('clone'); +import fs = require('fs-extra'); +import spec = require('jsii-spec'); +import nodeunit = require('nodeunit'); +import os = require('os'); +import path = require('path'); +import { loadProjectInfo } from '../lib/project-info'; + +const BASE_PROJECT = { + name: 'jsii-test', + version: '1.0.0', + description: 'A test project for jsii ProjectInfo loading', + license: 'Apache-2.0', + author: { name: 'Amazon Web Services', url: 'https://aws.amazon.com', organization: true }, + repository: { url: 'git://github.com/awslabs/jsii.git' }, + main: 'index.js', + types: 'index.d.ts', + jsii: { + targets: { foo: { bar: 'baz' } } + }, + dependencies: { 'jsii-test-dep': '^1.2.3' } +}; + +export = nodeunit.testCase({ + loadProjectInfo: { + async 'loads valid project'(test: nodeunit.Test) { + await _withTestProject(async projectRoot => { + try { + const info = await loadProjectInfo(projectRoot); + test.equal(info.name, BASE_PROJECT.name); + test.equal(info.version, BASE_PROJECT.version); + test.equal(info.description, BASE_PROJECT.description); + test.equal(info.license, BASE_PROJECT.license); + test.deepEqual(_stripUndefined(info.author), { ... BASE_PROJECT.author, roles: ['author'] }); + test.equal(info.main, BASE_PROJECT.main); + test.equal(info.types, BASE_PROJECT.types); + test.equal(info.homepage, undefined); + test.equal(info.repository && info.repository.type, 'git'); + test.equal(info.repository && info.repository.url, BASE_PROJECT.repository.url); + test.deepEqual(info.targets, { ...BASE_PROJECT.jsii.targets, js: { npm: BASE_PROJECT.name } }); + test.deepEqual(info.dependencies, [TEST_DEP_ASSEMBLY]); + test.deepEqual(info.transitiveDependencies, [TEST_DEP_ASSEMBLY, TEST_DEP_DEP_ASSEMBLY]); + } catch (e) { + test.ifError(e); + } finally { + test.done(); + } + }); + }, + + async 'loads valid project (UNLICENSED)'(test: nodeunit.Test) { + await _withTestProject(async projectRoot => { + try { + const info = await loadProjectInfo(projectRoot); + test.equal(info && info.license, 'UNLICENSED'); + } catch (e) { + test.ifError(e); + } finally { + test.done(); + } + }, info => { + info.license = 'UNLICENSED'; + }); + }, + + async 'loads valid project (using bundleDependencies)'(test: nodeunit.Test) { + await _withTestProject(async projectRoot => { + try { + const info = await loadProjectInfo(projectRoot); + test.deepEqual(info.bundleDependencies, { bundled: '^1.2.3' }); + } catch (e) { + test.ifError(e); + } finally { + test.done(); + } + }, info => { + info.dependencies['bundled'] = '^1.2.3'; + info.bundleDependencies = ['bundled']; + }); + }, + + async 'loads valid project (using bundledDependencies)'(test: nodeunit.Test) { + await _withTestProject(async projectRoot => { + try { + const info = await loadProjectInfo(projectRoot); + test.deepEqual(info.bundleDependencies, { bundled: '^1.2.3' }); + } catch (e) { + test.ifError(e); + } finally { + test.done(); + } + }, info => { + info.dependencies['bundled'] = '^1.2.3'; + info.bundledDependencies = ['bundled']; + }); + }, + + async 'loads valid project (with contributors)'(test: nodeunit.Test) { + const contributors = [{ name: 'foo', email: 'nobody@amazon.com' }]; + await _withTestProject(async projectRoot => { + try { + const info = await loadProjectInfo(projectRoot); + test.deepEqual(info && info.contributors && info.contributors.map(_stripUndefined), + contributors.map(c => ({ ...c, roles: ['contributor'] }))); + } catch (e) { + test.ifError(e); + } finally { + test.done(); + } + }, info => info.contributors = contributors); + }, + + async 'rejects un-declared dependency in bundleDependencies'(test: nodeunit.Test) { + await _withTestProject(async projectRoot => { + let error: Error | undefined; + try { + await loadProjectInfo(projectRoot); + } catch (e) { + error = e; + } finally { + test.throws(() => { if (error) { throw error; } }, + /not declared in "dependencies"/i); + test.done(); + } + }, info => { + info.bundledDependencies = ['bundled']; + }); + }, + + async 'rejects invalid license'(test: nodeunit.Test) { + await _withTestProject(async projectRoot => { + let error: Error | undefined; + try { + await loadProjectInfo(projectRoot); + } catch (e) { + error = e; + } finally { + test.throws(() => { if (error) { throw error; } }, + /invalid license identifier/i); + test.done(); + } + }, info => { + info.license = 'Not an SPDX licence ID'; + }); + }, + + async 'rejects incompatible dependency version'(test: nodeunit.Test) { + await _withTestProject(async projectRoot => { + let error: Error | undefined; + try { + await loadProjectInfo(projectRoot); + } catch (e) { + error = e; + } finally { + test.throws(() => { if (error) { throw error; } }, + /declared dependency on version .+ but version .+ was found/i); + test.done(); + } + }, info => { + info.dependencies[TEST_DEP_ASSEMBLY.name] = '^1.2.5'; + }); + } + } +}); + +const TEST_DEP_ASSEMBLY: spec.Assembly = { + schema: spec.SchemaVersion.V1_0, + name: 'jsii-test-dep', + version: '1.2.4', + license: 'Apache-2.0', + description: 'A jsii dependency of jsii-test', + homepage: 'https://github.com/awslabs/jsii', + repository: { type: 'git', url: 'git://github.com/awslabs/jsii.git' }, + author: { name: 'Amazon Web Services', url: 'https://aws.amazon.com', organization: true, roles: ['author'] }, + fingerprint: 'F1NG3RPR1N7', + dependencies: { + 'jsii-test-dep-dep': { + version: '3.2.1' + } + } +}; + +const TEST_DEP_DEP_ASSEMBLY: spec.Assembly = { + schema: spec.SchemaVersion.V1_0, + name: 'jsii-test-dep-dep', + version: '3.2.1', + license: 'Apache-2.0', + description: 'A jsii dependency of jsii-test-dep', + homepage: 'https://github.com/awslabs/jsii', + repository: { type: 'git', url: 'git://github.com/awslabs/jsii.git' }, + author: { name: 'Amazon Web Services', url: 'https://aws.amazon.com', organization: true, roles: ['author'] }, + fingerprint: 'F1NG3RPR1N7' +}; + +/** + * Creates a throw-away directory with a ``package.json`` file. Cleans up after itself. + * + * @param cb a callback that will be invoked with the temporary directory's path + * @param gremlin a function that can modify the content of ``package.json`` before it is written + * + * @return the result of executing ``cb``. + */ +async function _withTestProject(cb: (projectRoot: string) => T | Promise, gremlin?: (packageInfo: any) => void): Promise { + const tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), path.basename(__filename))); + try { + const packageInfo = clone(BASE_PROJECT); + if (gremlin) { gremlin(packageInfo); } + await fs.writeJson(path.join(tmpdir, 'package.json'), packageInfo, { spaces: 2 }); + await fs.writeFile(path.join(tmpdir, 'index.js'), '// There ought to be some javascript'); + await fs.writeFile(path.join(tmpdir, 'index.ts'), '// There ought to be some typescript'); + await fs.writeFile(path.join(tmpdir, 'index.d.ts'), '// There ought to be some typescript definitions'); + + const jsiiTestDep = path.join(tmpdir, 'node_modules', 'jsii-test-dep'); + await fs.mkdirs(jsiiTestDep); + await fs.writeJson(path.join(jsiiTestDep, '.jsii'), TEST_DEP_ASSEMBLY); + const jsiiTestDepDep = path.join(jsiiTestDep, 'node_modules', 'jsii-test-dep-dep'); + await fs.mkdirs(jsiiTestDepDep); + await fs.writeJson(path.join(jsiiTestDepDep, '.jsii'), TEST_DEP_DEP_ASSEMBLY); + + return await cb(tmpdir); + } catch (e) { + throw e; + } finally { + await fs.remove(tmpdir); + } +} + +/** + * Removes keys from an object if the associated value is ``undefined``. + * + * @param obj the object to be stripped. + * + * @return ``obj`` after it has been stripped. + */ +function _stripUndefined(obj: { [key: string]: any } | undefined): { [key: string]: any } | undefined { + if (!obj) { return obj; } + for (const key of Object.keys(obj)) { + if (obj[key] === undefined) { + delete obj[key]; + } + } + return obj; +} diff --git a/packages/jsii/test/util.ts b/packages/jsii/test/util.ts deleted file mode 100644 index f5ba952b86..0000000000 --- a/packages/jsii/test/util.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; - -const readDir = (dir: string) => new Promise((ok, fail) => fs.readdir(dir, (err, files) => err ? fail(err) : ok(files))); -const readFile = (filePath: string) => new Promise((ok, fail) => fs.readFile(filePath, (err, data) => err ? fail(err) : ok(data))); - -// tslint:disable:no-console -export async function assertDirEquals(actualDir: string, expectedDir: string) { - const expectedFiles = (await readDir(expectedDir)).sort().filter(filterHiddenFiles); - const actualFiles = (await readDir(actualDir)).sort().filter(filterHiddenFiles); - - if (actualFiles.length !== expectedFiles.length || expectedFiles.find(f => actualFiles.indexOf(f) === -1)) { - console.error('=========================================='); - console.error('Mismatch in file names or count:'); - console.error(' Expected:', expectedDir, '-', expectedFiles.join(',')); - console.error(' Actual:', actualDir, '-', actualFiles.join(',')); - console.error('=========================================='); - throw new Error('Invalid file names or number of files'); - } - - let errors = false; - - for (const file of expectedFiles) { - const actualFile = path.join(actualDir, file); - const expectedFile = path.join(expectedDir, file); - - const actual = (await readFile(actualFile)).toString(); - const expected = (await readFile(expectedFile)).toString(); - - if (actual !== expected) { - console.error('=========================================='); - console.error(`diff ${expectedFile} ${actualFile}`); - console.error(`cp ${actualFile} ${expectedFile}`); - console.error('===========================================') - errors = true; - } - } - - if (errors) { - throw new Error('Diff failed'); - } -} -function filterHiddenFiles(fileName: string) { - return !fileName.startsWith('.'); -} diff --git a/packages/jsii/tsconfig.json b/packages/jsii/tsconfig.json index 907de24775..f4610314c1 100644 --- a/packages/jsii/tsconfig.json +++ b/packages/jsii/tsconfig.json @@ -1,54 +1,21 @@ { "compilerOptions": { - /* Basic Options */ - "target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["es2016", "es2017.object", "es2017.string"], /* Specify library files to be included in the compilation: */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* Enable strict null checks. */ - "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - "strictPropertyInitialization": false, /* DO NOT Raise error on class attribute not initialized by constructor. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + "target": "ES2018", + "module": "commonjs", + "lib": ["es2016", "es2017.object", "es2017.string"], + "declaration": true, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "noImplicitThis": true, + "alwaysStrict": true, + "strictPropertyInitialization": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "inlineSourceMap": true, + "inlineSources": true, + "experimentalDecorators": true, } }