From ae38599d34723c101236640ad354b1c15beabc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 1 Aug 2017 11:50:33 +0300 Subject: [PATCH 01/61] Created API extractors. --- .gitignore | 269 ++++++++++++++++++++++++++++ package.json | 16 ++ src/extractor/api-extractor.ts | 37 ++++ src/extractor/api-json-generator.ts | 11 ++ src/extractor/parse-config-host.ts | 22 +++ src/extractor/tsconfig-handler.ts | 13 ++ src/index.ts | 0 tsconfig.json | 26 +++ tslint.json | 83 +++++++++ 9 files changed, 477 insertions(+) create mode 100644 .gitignore create mode 100644 package.json create mode 100644 src/extractor/api-extractor.ts create mode 100644 src/extractor/api-json-generator.ts create mode 100644 src/extractor/parse-config-host.ts create mode 100644 src/extractor/tsconfig-handler.ts create mode 100644 src/index.ts create mode 100644 tsconfig.json create mode 100644 tslint.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4d3b9949 --- /dev/null +++ b/.gitignore @@ -0,0 +1,269 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +#**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml +yarn.lock + +packages/react-forms-test + +dist +@types +package-lock.json + +# MacOS +.DS_Store + +# Ignore Rush temporary files +/common/temp/** + +**/webpack.config.js + +**/*.js.map diff --git a/package.json b/package.json new file mode 100644 index 00000000..751a0b39 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "@simplr/ts-docs-gen", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "dependencies": { + "@microsoft/api-extractor": "^2.3.1", + "@types/mz": "0.0.31", + "mz": "^2.6.0", + "typescript": "^2.4.2" + } +} diff --git a/src/extractor/api-extractor.ts b/src/extractor/api-extractor.ts new file mode 100644 index 00000000..f23ff5a1 --- /dev/null +++ b/src/extractor/api-extractor.ts @@ -0,0 +1,37 @@ +import * as ts from "typescript"; +import { Extractor } from "@microsoft/api-extractor"; +import { ApiJsonGenerator, ExtractedApiJson } from "./api-json-generator"; + +export class APIExtractor { + private extractor: Extractor; + + constructor(private compilerOptions: ts.CompilerOptions) { + /** + * We need to ignore @types in these tests + * @see https://github.com/Microsoft/web-build-tools/wiki/API-Extractor-~-Enabling-for-your-project + */ + this.compilerOptions.typeRoots = ["./"]; + + this.extractor = new Extractor({ + compilerOptions: this.compilerOptions + }); + } + + /** + * Invoke the compiler engine to perform semantic analysis, + * and then build up the API Extractor data set. + * @param entryPoint The entry point for your project + * @param otherFiles Any other implicitly included files, e.g. typings/tsd.d.ts is sometimes needed here + */ + public Analyze(entryPoint: string, otherFiles: string[]): void { + this.extractor.analyze({ + entryPointFile: entryPoint, + otherFiles: otherFiles + }); + } + + public JSONGenerator(): ExtractedApiJson { + const apiJsonGenerator = new ApiJsonGenerator(); + return apiJsonGenerator.GetFileContents(this.extractor); + } +} diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts new file mode 100644 index 00000000..2c3d4eea --- /dev/null +++ b/src/extractor/api-json-generator.ts @@ -0,0 +1,11 @@ +import * as path from "path"; +import { ApiJsonGenerator as Generator, Extractor } from "@microsoft/api-extractor"; + +export type ExtractedApiJson = {}; + +export class ApiJsonGenerator extends Generator { + public GetFileContents(extractor: Extractor): ExtractedApiJson { + this.visit(extractor.package, this.jsonOutput); + return this.jsonOutput; + } +} diff --git a/src/extractor/parse-config-host.ts b/src/extractor/parse-config-host.ts new file mode 100644 index 00000000..9fb238ad --- /dev/null +++ b/src/extractor/parse-config-host.ts @@ -0,0 +1,22 @@ +import * as fs from "fs"; +import * as ts from "typescript"; + +export class ParseConfigHost implements ts.ParseConfigHost { + public useCaseSensitiveFileNames: boolean = true; + + public readFile(path: string): string { + return ts.sys.readFile(path); + } + + public readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[] { + return ts.sys.readDirectory(rootDir, extensions, excludes, includes); + } + + /** + * Gets a value indicating whether the specified path exists and is a file. + * @param path The path to test. + */ + public fileExists(path: string): boolean { + return fs.existsSync(path); + } +} diff --git a/src/extractor/tsconfig-handler.ts b/src/extractor/tsconfig-handler.ts new file mode 100644 index 00000000..7b0ee979 --- /dev/null +++ b/src/extractor/tsconfig-handler.ts @@ -0,0 +1,13 @@ +import * as fs from "mz/fs"; +import * as path from "path"; +import * as ts from "typescript"; + +import { ParseConfigHost } from "./parse-config-host"; + +export async function ReadTsconfig(fileLocation: string): Promise { + const rawContent = fs.readFile(fileLocation, "utf-8"); + const parseConfigHost = new ParseConfigHost(); + const configContent = ts.parseJsonConfigFileContent(rawContent, parseConfigHost, path.dirname(fileLocation)); + + return configContent; +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..942de394 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "removeComments": false, + "outDir": "dist", + "rootDir": "src", + "sourceMap": false, + "skipDefaultLibCheck": true, + "declaration": true, + "pretty": true, + "strict": true, + "lib": [ + "es6" + ], + "typeRoots": [ + "./node_modules/@types" + ] + }, + "exclude": [ + "node_modules", + "dist", + "@types", + "__tests__" + ] +} diff --git a/tslint.json b/tslint.json new file mode 100644 index 00000000..2c6ee3a6 --- /dev/null +++ b/tslint.json @@ -0,0 +1,83 @@ +{ + "rules": { + "align": [ true, "parameters", "statements" ], + "class-name": true, + "comment-format": [ false ], + "curly": true, + "eofline": true, + "forin": true, + "indent": [ true, "spaces" ], + "interface-name": [ true, "never-prefix" ], + "jsdoc-format": true, + "max-line-length": [ true, 140 ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-variable": true, + "no-duplicate-super": true, + "prefer-const": [true, { "destructuring": "all" } ], + "semicolon": [ true, "always" ], + "prefer-template": [ true, "allow-single-concat" ], + "no-invalid-this": true, + "no-eval": true, + "no-internal-module": true, + "no-require-imports": true, + "no-trailing-whitespace": true, + "import-spacing": true, + "no-default-export": true, + "no-var-keyword": true, + "no-unnecessary-type-assertion": true, + "space-before-function-paren": [ true, { "asyncArrow": "always", "named": "never", "anonymous": "never", "method": "never", "constructor": "never" } ], + "no-angle-bracket-type-assertion": true, + "no-empty-interface": true, + "no-unnecessary-callback-wrapper": true, + "return-undefined": true, + "no-sparse-arrays": true, + "await-promise": true, + "promise-function-async": true, + "label-position": true, + "array-type": [true, "array-simple"], + "arrow-return-shorthand": [ true, "multiline" ], + "only-arrow-functions": [ true, "allow-declarations", "allow-named-functions" ], + "one-line": [ + true, + "check-catch", + "check-finally", + "check-else", + "check-open-brace", + "check-whitespace" + ], + "member-access": [ true, "check-accessor" ], + "arrow-parens": [ true, "ban-single-arg-parens" ], + "no-consecutive-blank-lines": [ true, 1 ], + "quotemark": [ true, "double", "jsx-double" ], + "no-console": [true, "log"], + "no-empty": true, + "no-reference": true, + "no-shadowed-variable": true, + "no-unused-expression": [ true, "allow-new" ], + "encoding": true, + "typedef": [true, "call-signature", "member-variable-declaration"], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "triple-equals": [ true, "allow-null-check" ], + "variable-name": [ true, "ban-keywords", "check-format", "allow-pascal-case" ], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-type", + "check-typecast" + ] + } +} From 06a6dd1829866795722371832d04976daf04146e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 1 Aug 2017 12:46:35 +0300 Subject: [PATCH 02/61] Added simple test to see if it is generating JSON. --- __tests__/assets/example-1/index.ts | 20 ++++++++++++ __tests__/assets/example-1/package.json | 5 +++ .../assets/example-1/tsconfig.example.json | 32 +++++++++++++++++++ __tests__/index.test.ts | 21 ++++++++++++ __tests__/tsconfig.json | 27 ++++++++++++++++ package.json | 20 +++++++++++- src/extractor/api-extractor.ts | 12 ++++--- src/extractor/api-json-generator.ts | 4 ++- src/extractor/tsconfig-handler.ts | 12 +++---- src/index.ts | 1 + tsconfig.json | 5 ++- 11 files changed, 146 insertions(+), 13 deletions(-) create mode 100644 __tests__/assets/example-1/index.ts create mode 100644 __tests__/assets/example-1/package.json create mode 100644 __tests__/assets/example-1/tsconfig.example.json create mode 100644 __tests__/index.test.ts create mode 100644 __tests__/tsconfig.json diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts new file mode 100644 index 00000000..0d441bdb --- /dev/null +++ b/__tests__/assets/example-1/index.ts @@ -0,0 +1,20 @@ +export interface Foo { + Name: string; + Surname: string; +} + +export interface Bar extends Foo { + Email: string; +} + +export class FooBar { + private bar: Bar; + + public GetSomething(): string { + return "Something"; + } + + public SetBar(bar: Bar): void { + this.bar = bar; + } +} diff --git a/__tests__/assets/example-1/package.json b/__tests__/assets/example-1/package.json new file mode 100644 index 00000000..1a88750e --- /dev/null +++ b/__tests__/assets/example-1/package.json @@ -0,0 +1,5 @@ +{ + "name": "example-1", + "main": "dist/index.js", + "types": "dist/index.d.ts" +} diff --git a/__tests__/assets/example-1/tsconfig.example.json b/__tests__/assets/example-1/tsconfig.example.json new file mode 100644 index 00000000..b71023ad --- /dev/null +++ b/__tests__/assets/example-1/tsconfig.example.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "removeComments": false, + "noEmit": true, + "rootDir": "./", + "jsx": "react", + "sourceMap": true, + "skipDefaultLibCheck": true, + "declaration": true, + "pretty": true, + "strict": true, + "noEmitHelpers": true, + "importHelpers": true, + "lib": [ + "dom", + "dom.iterable", + "es6" + ], + "typeRoots": [ + "../../../node_modules/@types" + ] + }, + "exclude": [ + "node_modules", + "dist", + "@types", + "__tests__", + "tools" + ] +} diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts new file mode 100644 index 00000000..47d0b4e7 --- /dev/null +++ b/__tests__/index.test.ts @@ -0,0 +1,21 @@ +import * as path from "path"; +import { APIExtractor } from "../src/extractor/api-extractor"; +import { GetCompilerOptions } from "../src/extractor/tsconfig-handler"; + +const ENTRY_POINT_1 = path.join(__dirname, "./assets/example-1/index.ts"); + +it("Generate JSON", async done => { + try { + const compilerOptions = await GetCompilerOptions(path.resolve(__dirname, "./assets/example-1/tsconfig.example.json")); + const extractor = new APIExtractor(compilerOptions); + extractor.Analyze(ENTRY_POINT_1, []); + const json = extractor.GetJSON(); + + expect(json).toBeDefined(); + } catch (error) { + done.fail(error); + return; + } + + done(); +}); diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json new file mode 100644 index 00000000..34e2eb51 --- /dev/null +++ b/__tests__/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "removeComments": false, + "jsx": "react", + "sourceMap": false, + "skipDefaultLibCheck": true, + "declaration": true, + "declarationDir": "@types", + "pretty": true, + "strict": true, + "noEmit": true, + "noUnusedLocals": true, + "lib": [ + "dom", + "dom.iterable", + "es6" + ] + }, + "exclude": [ + "node_modules", + "dist", + "@types", + "__tests__" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 751a0b39..0d6181d8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "jest", + "test-watch": "jest --watchAll", + "build": "tsc -p ." }, "author": "", "dependencies": { @@ -12,5 +14,21 @@ "@types/mz": "0.0.31", "mz": "^2.6.0", "typescript": "^2.4.2" + }, + "devDependencies": { + "@types/jest": "^20.0.5", + "jest": "^20.0.4", + "ts-jest": "^20.0.7" + }, + "jest": { + "transform": { + ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" + }, + "testRegex": "/__tests__/.*\\.(test|spec).(ts|tsx|js)$", + "moduleFileExtensions": [ + "ts", + "tsx", + "js" + ] } } diff --git a/src/extractor/api-extractor.ts b/src/extractor/api-extractor.ts index f23ff5a1..a34381e5 100644 --- a/src/extractor/api-extractor.ts +++ b/src/extractor/api-extractor.ts @@ -1,11 +1,11 @@ import * as ts from "typescript"; -import { Extractor } from "@microsoft/api-extractor"; +import { Extractor, ApiErrorHandler } from "@microsoft/api-extractor"; import { ApiJsonGenerator, ExtractedApiJson } from "./api-json-generator"; export class APIExtractor { private extractor: Extractor; - constructor(private compilerOptions: ts.CompilerOptions) { + constructor(private compilerOptions: ts.CompilerOptions, apiErrorHandler?: ApiErrorHandler) { /** * We need to ignore @types in these tests * @see https://github.com/Microsoft/web-build-tools/wiki/API-Extractor-~-Enabling-for-your-project @@ -13,7 +13,8 @@ export class APIExtractor { this.compilerOptions.typeRoots = ["./"]; this.extractor = new Extractor({ - compilerOptions: this.compilerOptions + compilerOptions: this.compilerOptions, + errorHandler: apiErrorHandler }); } @@ -30,7 +31,10 @@ export class APIExtractor { }); } - public JSONGenerator(): ExtractedApiJson { + /** + * Generates JSON. + */ + public GetJSON(): ExtractedApiJson { const apiJsonGenerator = new ApiJsonGenerator(); return apiJsonGenerator.GetFileContents(this.extractor); } diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts index 2c3d4eea..92f246f9 100644 --- a/src/extractor/api-json-generator.ts +++ b/src/extractor/api-json-generator.ts @@ -1,4 +1,3 @@ -import * as path from "path"; import { ApiJsonGenerator as Generator, Extractor } from "@microsoft/api-extractor"; export type ExtractedApiJson = {}; @@ -6,6 +5,9 @@ export type ExtractedApiJson = {}; export class ApiJsonGenerator extends Generator { public GetFileContents(extractor: Extractor): ExtractedApiJson { this.visit(extractor.package, this.jsonOutput); + + // TODO: Add JSON validation scheme. + return this.jsonOutput; } } diff --git a/src/extractor/tsconfig-handler.ts b/src/extractor/tsconfig-handler.ts index 7b0ee979..ec919e99 100644 --- a/src/extractor/tsconfig-handler.ts +++ b/src/extractor/tsconfig-handler.ts @@ -2,12 +2,12 @@ import * as fs from "mz/fs"; import * as path from "path"; import * as ts from "typescript"; -import { ParseConfigHost } from "./parse-config-host"; +// TODO: Fool proof. +export async function GetCompilerOptions(fileLocation: string): Promise { + const rawContent = await fs.readFile(fileLocation, "utf-8"); + const json = JSON.parse(rawContent); -export async function ReadTsconfig(fileLocation: string): Promise { - const rawContent = fs.readFile(fileLocation, "utf-8"); - const parseConfigHost = new ParseConfigHost(); - const configContent = ts.parseJsonConfigFileContent(rawContent, parseConfigHost, path.dirname(fileLocation)); + const compilerOptions = ts.convertCompilerOptionsFromJson(json.compilerOptions, path.dirname(fileLocation)); - return configContent; + return compilerOptions.options; } diff --git a/src/index.ts b/src/index.ts index e69de29b..bf6b8179 100644 --- a/src/index.ts +++ b/src/index.ts @@ -0,0 +1 @@ +console.log("Hello"); diff --git a/tsconfig.json b/tsconfig.json index 942de394..0353c4b6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,8 +10,11 @@ "declaration": true, "pretty": true, "strict": true, + "forceConsistentCasingInFileNames": true, "lib": [ - "es6" + "es5", + "es2015.promise", + "dom" ], "typeRoots": [ "./node_modules/@types" From ca02dfb7e71a27aaeea001a37e4cbf3a4a3655b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 1 Aug 2017 13:40:51 +0300 Subject: [PATCH 03/61] Added sinon and checked error callback. --- __tests__/assets/example-1/index.ts | 9 +++++++++ __tests__/index.test.ts | 5 ++++- package.json | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts index 0d441bdb..6863735c 100644 --- a/__tests__/assets/example-1/index.ts +++ b/__tests__/assets/example-1/index.ts @@ -1,12 +1,21 @@ +/** + * @public + */ export interface Foo { Name: string; Surname: string; } +/** + * @public + */ export interface Bar extends Foo { Email: string; } +/** + * @public + */ export class FooBar { private bar: Bar; diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 47d0b4e7..4a1f9e29 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,4 +1,5 @@ import * as path from "path"; +import * as sinon from "sinon"; import { APIExtractor } from "../src/extractor/api-extractor"; import { GetCompilerOptions } from "../src/extractor/tsconfig-handler"; @@ -6,12 +7,14 @@ const ENTRY_POINT_1 = path.join(__dirname, "./assets/example-1/index.ts"); it("Generate JSON", async done => { try { + const stubCallback = sinon.stub(); const compilerOptions = await GetCompilerOptions(path.resolve(__dirname, "./assets/example-1/tsconfig.example.json")); - const extractor = new APIExtractor(compilerOptions); + const extractor = new APIExtractor(compilerOptions, stubCallback); extractor.Analyze(ENTRY_POINT_1, []); const json = extractor.GetJSON(); expect(json).toBeDefined(); + expect(stubCallback.called).toBe(false); } catch (error) { done.fail(error); return; diff --git a/package.json b/package.json index 0d6181d8..3e88c493 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ }, "devDependencies": { "@types/jest": "^20.0.5", + "@types/sinon": "^2.3.3", "jest": "^20.0.4", + "sinon": "^2.4.1", "ts-jest": "^20.0.7" }, "jest": { From 8b4aecf7e828a1826b15a33b1905fdf159c30d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 1 Aug 2017 16:30:16 +0300 Subject: [PATCH 04/61] Added contracts for API JSON. --- __tests__/assets/example-1/index.ts | 52 ++++++++++++++++ __tests__/index.test.ts | 17 +++++ package.json | 2 + src/extractor/api-extractor.ts | 5 +- src/extractor/api-json-contracts.ts | 96 +++++++++++++++++++++++++++++ src/extractor/api-json-generator.ts | 5 +- src/generator/markdown-generator.ts | 9 +++ 7 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 src/extractor/api-json-contracts.ts create mode 100644 src/generator/markdown-generator.ts diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts index 6863735c..8bc4dca2 100644 --- a/__tests__/assets/example-1/index.ts +++ b/__tests__/assets/example-1/index.ts @@ -11,6 +11,7 @@ export interface Foo { */ export interface Bar extends Foo { Email: string; + GetCode(id: number): string; } /** @@ -19,11 +20,62 @@ export interface Bar extends Foo { export class FooBar { private bar: Bar; + public readonly Foo: string = "Hello"; + public GetSomething(): string { return "Something"; } + /** + * Summary of SetBar method. + */ public SetBar(bar: Bar): void { this.bar = bar; } } + +/** + * @public + */ +export enum Test { + None = 0, + Warning = 8, + Error = 100 +} + +/** + * @public + */ +export enum EventType { + Live = "live", + Test = "test" +} + +/** + * Sum function. + * @public + */ +export function Sum(a: number, b: number): number { + return a + b; +} + +/** + * Package version. + * @public + */ +export const version = 2.11; + +/** + * @public + */ +export namespace CoolStuff { + /** + * Yet another sum function. + * @public + */ + export function YetAnotherSumFunc(x: number, y: number): number { + return x + y; + } + + export const a: string = "aa"; +} diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 4a1f9e29..7f551732 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -2,6 +2,7 @@ import * as path from "path"; import * as sinon from "sinon"; import { APIExtractor } from "../src/extractor/api-extractor"; import { GetCompilerOptions } from "../src/extractor/tsconfig-handler"; +import { MarkdownGenerator } from "../src/generator/markdown-generator"; const ENTRY_POINT_1 = path.join(__dirname, "./assets/example-1/index.ts"); @@ -22,3 +23,19 @@ it("Generate JSON", async done => { done(); }); + +it("Generating MD", async done => { + try { + const compilerOptions = await GetCompilerOptions(path.resolve(__dirname, "./assets/example-1/tsconfig.example.json")); + const extractor = new APIExtractor(compilerOptions); + extractor.Analyze(ENTRY_POINT_1, []); + const json = extractor.GetJSON(); + + const markdownGenerator = new MarkdownGenerator(json); + } catch (error) { + done.fail(error); + return; + } + + done(); +}); diff --git a/package.json b/package.json index 3e88c493..005df205 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "author": "", "dependencies": { "@microsoft/api-extractor": "^2.3.1", + "@types/json2md": "^1.5.0", "@types/mz": "0.0.31", + "json2md": "^1.5.8", "mz": "^2.6.0", "typescript": "^2.4.2" }, diff --git a/src/extractor/api-extractor.ts b/src/extractor/api-extractor.ts index a34381e5..e47c0021 100644 --- a/src/extractor/api-extractor.ts +++ b/src/extractor/api-extractor.ts @@ -1,6 +1,7 @@ import * as ts from "typescript"; import { Extractor, ApiErrorHandler } from "@microsoft/api-extractor"; -import { ApiJsonGenerator, ExtractedApiJson } from "./api-json-generator"; +import { ApiJsonGenerator } from "./api-json-generator"; +import { ApiJson } from "./api-json-contracts"; export class APIExtractor { private extractor: Extractor; @@ -34,7 +35,7 @@ export class APIExtractor { /** * Generates JSON. */ - public GetJSON(): ExtractedApiJson { + public GetJSON(): ApiJson { const apiJsonGenerator = new ApiJsonGenerator(); return apiJsonGenerator.GetFileContents(this.extractor); } diff --git a/src/extractor/api-json-contracts.ts b/src/extractor/api-json-contracts.ts new file mode 100644 index 00000000..da5392da --- /dev/null +++ b/src/extractor/api-json-contracts.ts @@ -0,0 +1,96 @@ +export interface ApiJson { + kind: "package"; + summary: ItemValue[]; + remarks: ItemValue[]; + exports: { [name: string]: Members }; +} + +export interface DefaultInfo { + deprecatedMessage: any[]; + summary: ItemValue[]; + remarks: ItemValue[]; + isBeta: boolean; +} + +export interface ReturnValue { + /** + * Examples: "string", "void" + */ + type: string; + description: string[]; +} + +export interface ItemValue { + kind: string; + value: string; +} + +export type Members = MemberInterface | MemberProperty | MemberNamespace | MemberEnum | MemberClass | MemberFunction; + +export interface MemberInterface extends DefaultInfo { + kind: "interface"; + extends: string; + implements: string; + typeParameters: any[]; + members: { [member: string]: MemberProperty | MemberMethod }; +} + +export interface MemberProperty extends DefaultInfo { + kind: "property"; + /** + * Examples: "string", "void" + */ + type: string; + isOptional: boolean; + isReadOnly: boolean; + isStatic: boolean; +} + +export interface MemberMethod extends DefaultInfo { + kind: "method"; + /** + * Example: 'public Method(arg: string): void;' + */ + signature: string; + /** + * Example: "public" + */ + accessModifier: string; + isOptional: boolean; + isStatic: boolean; + returnType: ReturnValue; + parameters: { + type: string; + description: any[]; + }; +} + +export interface MemberNamespace extends DefaultInfo { + kind: "namespace"; + deprecatedMessage: any[]; + exports: { [members: string]: Members }; +} + +export interface MemberEnum extends DefaultInfo { + kind: "enum"; + values: { [enumValue: string]: MemberEnumValue }; +} + +export interface MemberEnumValue extends DefaultInfo { + kind: "enum value"; + value: string; +} + +export interface MemberClass extends DefaultInfo { + kind: "class"; + extends: string; + implements: string; + typeParameters: any[]; + members: { [member: string]: MemberProperty | MemberMethod }; +} + +export interface MemberFunction extends DefaultInfo { + kind: "function"; + returnValue: ReturnValue; + parameters: any[]; +} diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts index 92f246f9..48071eff 100644 --- a/src/extractor/api-json-generator.ts +++ b/src/extractor/api-json-generator.ts @@ -1,6 +1,5 @@ import { ApiJsonGenerator as Generator, Extractor } from "@microsoft/api-extractor"; - -export type ExtractedApiJson = {}; +import { ExtractedApiJson } from "./api-json-contracts"; export class ApiJsonGenerator extends Generator { public GetFileContents(extractor: Extractor): ExtractedApiJson { @@ -8,6 +7,6 @@ export class ApiJsonGenerator extends Generator { // TODO: Add JSON validation scheme. - return this.jsonOutput; + return this.jsonOutput as ExtractedApiJson; } } diff --git a/src/generator/markdown-generator.ts b/src/generator/markdown-generator.ts new file mode 100644 index 00000000..592ce60b --- /dev/null +++ b/src/generator/markdown-generator.ts @@ -0,0 +1,9 @@ +import * as json2md from "json2md"; + +import { ApiJson } from "../extractor/api-json-contracts"; + +export class MarkdownGenerator { + constructor(protected Json: ApiJson) { + console.log(JSON.stringify(this.Json)); + } +} From c71f233d83f548f7d1316a074c78e7c71815a2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 13:47:31 +0300 Subject: [PATCH 05/61] Updated interface generating. --- __tests__/assets/example-1/index.ts | 4 ++ __tests__/index.test.ts | 6 ++ __tests__/test.md | 15 +++++ src/extractor/api-json-contracts.ts | 12 +++- src/generator/class-generator.ts | 64 ++++++++++++++++++++ src/generator/helpers-generator.ts | 27 +++++++++ src/generator/interface-generator.ts | 90 ++++++++++++++++++++++++++++ src/generator/markdown-generator.ts | 80 ++++++++++++++++++++++++- test.md | 2 + 9 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 __tests__/test.md create mode 100644 src/generator/class-generator.ts create mode 100644 src/generator/helpers-generator.ts create mode 100644 src/generator/interface-generator.ts create mode 100644 test.md diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts index 8bc4dca2..084c2170 100644 --- a/__tests__/assets/example-1/index.ts +++ b/__tests__/assets/example-1/index.ts @@ -11,6 +11,10 @@ export interface Foo { */ export interface Bar extends Foo { Email: string; + /** + * Get Bar model code by id. + * Another line of summary. + */ GetCode(id: number): string; } diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 7f551732..33050df4 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,5 +1,6 @@ import * as path from "path"; import * as sinon from "sinon"; +import * as fs from "mz/fs"; import { APIExtractor } from "../src/extractor/api-extractor"; import { GetCompilerOptions } from "../src/extractor/tsconfig-handler"; import { MarkdownGenerator } from "../src/generator/markdown-generator"; @@ -32,6 +33,11 @@ it("Generating MD", async done => { const json = extractor.GetJSON(); const markdownGenerator = new MarkdownGenerator(json); + const md: string = markdownGenerator.Render(); + + expect(typeof md).toBe("string"); + + await fs.writeFile(path.join(__dirname, "./test.md"), md, "utf8"); } catch (error) { done.fail(error); return; diff --git a/__tests__/test.md b/__tests__/test.md new file mode 100644 index 00000000..834d77f9 --- /dev/null +++ b/__tests__/test.md @@ -0,0 +1,15 @@ +# Package name +## Interfaces +### Bar + +__Extends__ `Foo` + +Name | Type | Summary +--- | --- | --- +Email `*` | string | +GetCode `*` | void | Get Bar model code by id. Another line of summary. +### Foo +Name | Type | Summary +--- | --- | --- +Name `*` | string | +Surname `*` | string | \ No newline at end of file diff --git a/src/extractor/api-json-contracts.ts b/src/extractor/api-json-contracts.ts index da5392da..0103ae67 100644 --- a/src/extractor/api-json-contracts.ts +++ b/src/extractor/api-json-contracts.ts @@ -25,14 +25,24 @@ export interface ItemValue { value: string; } +export interface MemberList { + "interface": MemberInterface; + "property": MemberProperty; + "namespace": MemberNamespace; + "enum": MemberEnum; + "class": MemberClass; + "function": MemberFunction; +} + export type Members = MemberInterface | MemberProperty | MemberNamespace | MemberEnum | MemberClass | MemberFunction; +export type InterfaceMembers = MemberProperty | MemberMethod; export interface MemberInterface extends DefaultInfo { kind: "interface"; extends: string; implements: string; typeParameters: any[]; - members: { [member: string]: MemberProperty | MemberMethod }; + members: { [member: string]: InterfaceMembers }; } export interface MemberProperty extends DefaultInfo { diff --git a/src/generator/class-generator.ts b/src/generator/class-generator.ts new file mode 100644 index 00000000..749b64bf --- /dev/null +++ b/src/generator/class-generator.ts @@ -0,0 +1,64 @@ +import * as json2md from "json2md"; + +import { + ApiJson, + Members, + MemberClass, + MemberProperty, + MemberMethod +} from "../extractor/api-json-contracts"; +import { HelpersGenerator } from "./helpers-generator"; + +export namespace ClassGenerator { + export function renderClass(name: string, memberClass: MemberClass): json2md.DataObject[] { + let md: json2md.DataObject[] = [ + { + h3: name + } + ]; + + // TODO: IsBeta + + // Summary + if (memberClass.summary.length !== 0) { + md.push({ + p: memberClass.summary.map(x => x.value).join("\n") + }); + } + + // Remarks + if (memberClass.remarks.length !== 0) { + md.push({ + p: memberClass.remarks.map(x => x.value).join("\n") + }); + } + + // Extends + if (memberClass.extends !== "") { + md = md.concat(HelpersGenerator.RenderExtends(memberClass.extends)); + } + + // Implements + if (memberClass.implements !== "") { + md = md.concat(HelpersGenerator.RenderImplements(memberClass.implements)); + } + + const properties: { [name: string]: MemberProperty } = {}; + const methods: { [name: string]: MemberMethod } = {}; + for (const memberKey in memberClass.members) { + if (memberClass.members.hasOwnProperty(memberKey)) { + const member = memberClass.members[memberKey]; + switch (member.kind) { + case "method": + methods[memberKey] = member; + break; + case "property": + properties[memberKey] = member; + break; + } + } + } + + return md; + } +} diff --git a/src/generator/helpers-generator.ts b/src/generator/helpers-generator.ts new file mode 100644 index 00000000..4df228f4 --- /dev/null +++ b/src/generator/helpers-generator.ts @@ -0,0 +1,27 @@ +import * as json2md from "json2md"; + +export namespace HelpersGenerator { + export function RenderExtends(what: string): json2md.DataObject[] { + return [ + { + p: `${Bold("Extends")} ${InlineCode(what)}` + } + ]; + } + + export function RenderImplements(what: string): json2md.DataObject[] { + return [ + { + p: `${Bold("Implements")} ${InlineCode(what)}` + } + ]; + } + + export function Bold(text: string): string { + return `__${text}__`; + } + + export function InlineCode(text: string): string { + return `\`${text}\``; + } +} diff --git a/src/generator/interface-generator.ts b/src/generator/interface-generator.ts new file mode 100644 index 00000000..5ec29e5a --- /dev/null +++ b/src/generator/interface-generator.ts @@ -0,0 +1,90 @@ +import * as json2md from "json2md"; +import { MemberInterface, InterfaceMembers } from "../extractor/api-json-contracts"; +import { HelpersGenerator } from "./helpers-generator"; + +interface Table extends json2md.DefaultConverters.TableInput { + headers: string[]; + rows: string[][]; +} + +export namespace InterfaceGenerator { + export function RenderInterface(name: string, memberInterface: MemberInterface): json2md.DataObject[] { + let md: json2md.DataObject[] = [ + { + h3: name + } + ]; + + // Summary + if (memberInterface.summary.length !== 0) { + md.push({ + p: memberInterface.summary.map(x => x.value) + }); + } + + // Remarks + if (memberInterface.remarks.length !== 0) { + md.push({ + p: memberInterface.remarks.map(x => x.value) + }); + } + + // Extends + if (memberInterface.extends !== "") { + md = md.concat(HelpersGenerator.RenderExtends(memberInterface.extends)); + } + + // Implements + if (memberInterface.implements !== "") { + md = md.concat(HelpersGenerator.RenderImplements(memberInterface.implements)); + } + + // Table of members + md.push({ + table: renderInterfaceMembers(memberInterface.members) + }); + + return md; + } + + function renderInterfaceMembers(members: { [member: string]: InterfaceMembers }): Table { + const table: Table = { + headers: ["Name", "Type", "Summary"], + rows: [] + }; + + for (const memberKey in members) { + if (members.hasOwnProperty(memberKey)) { + const member = members[memberKey]; + let row: string[] = []; + let memberName = memberKey; + if (!member.isOptional) { + memberName += " " + HelpersGenerator.InlineCode("*"); + } + + // TODO: Add remarks + switch (member.kind) { + case "method": + row = [ + memberName, + // TODO: Return type description + (member.returnType != null ? member.returnType.type : "void"), + member.summary.map(x => x.value).join(".") + ]; + break; + case "property": + row = [ + memberName, + member.type, + member.summary.map(x => x.value).join(".") + ]; + break; + } + + table.rows.push(row); + } + } + + return table; + } +} diff --git a/src/generator/markdown-generator.ts b/src/generator/markdown-generator.ts index 592ce60b..76994417 100644 --- a/src/generator/markdown-generator.ts +++ b/src/generator/markdown-generator.ts @@ -1,9 +1,85 @@ import * as json2md from "json2md"; -import { ApiJson } from "../extractor/api-json-contracts"; +import { + ApiJson, + Members, + MemberList, + MemberInterface +} from "../extractor/api-json-contracts"; + +import { HelpersGenerator } from "./helpers-generator"; + +import { InterfaceGenerator } from "./interface-generator"; + +type MembersDict = { + [key in keyof MemberList]: { [key: string]: MemberList[key] }; +}; export class MarkdownGenerator { + private markdown: json2md.DataObject[] = []; + constructor(protected Json: ApiJson) { - console.log(JSON.stringify(this.Json)); + // this.Json.exports + this.renderPackage(Json); + this.renderMembers(Json.exports); + } + + public Render(): string { + return json2md(this.markdown); + } + + private renderMembers(members: { [key: string]: Members }): void { + const dict: MembersDict = { + class: {}, + enum: {}, + function: {}, + interface: {}, + namespace: {}, + property: {} + }; + + // Filter + for (const memberKey in members) { + if (members.hasOwnProperty(memberKey)) { + const member = members[memberKey]; + dict[member.kind][memberKey] = member; + } + } + + this.markdown = this.markdown.concat(this.renderInterfaces(dict.interface)); + } + + private renderPackage(pckg: ApiJson): void { + const md: json2md.DataObject[] = [ + { + h1: "Package name" + } + ]; + + // Package summary. + if (pckg.summary.length !== 0) { + md.push({ + p: pckg.summary.map(x => x.value).join("\n") + }); + } + + this.markdown = this.markdown.concat(md); + } + + private renderInterfaces(interfaces: { [key: string]: MemberInterface }): json2md.DataObject[] { + let md: json2md.DataObject[] = [ + { + h2: "Interfaces" + } + ]; + + for (const interfaceKey in interfaces) { + if (interfaces.hasOwnProperty(interfaceKey)) { + const memberInterface = interfaces[interfaceKey]; + md = md.concat(InterfaceGenerator.RenderInterface(interfaceKey, memberInterface)); + } + } + + return md; } } diff --git a/test.md b/test.md new file mode 100644 index 00000000..7a4682cc --- /dev/null +++ b/test.md @@ -0,0 +1,2 @@ +# Package name +## Interfaces \ No newline at end of file From 1d99e804d3cc7d4997f0ad1b67eb99147cff0b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 14:59:14 +0300 Subject: [PATCH 06/61] Updated enum value. --- __tests__/test.md | 14 +++++- src/generator/enum-generator.ts | 72 ++++++++++++++++++++++++++++ src/generator/generator-contracts.ts | 6 +++ src/generator/interface-generator.ts | 6 +-- src/generator/markdown-generator.ts | 30 +++++++++++- 5 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 src/generator/enum-generator.ts create mode 100644 src/generator/generator-contracts.ts diff --git a/__tests__/test.md b/__tests__/test.md index 834d77f9..f0bee28d 100644 --- a/__tests__/test.md +++ b/__tests__/test.md @@ -12,4 +12,16 @@ GetCode `*` | void | Get Bar model code by id. Another line of summary. Name | Type | Summary --- | --- | --- Name `*` | string | -Surname `*` | string | \ No newline at end of file +Surname `*` | string | +## Enums +### EventType +Name | Value | Summary +--- | --- | --- +Live | "live" | +Test | "test" | +### Test +Name | Value | Summary +--- | --- | --- +None | 0 | +Warning | 8 | +Error | 100 | \ No newline at end of file diff --git a/src/generator/enum-generator.ts b/src/generator/enum-generator.ts new file mode 100644 index 00000000..78c7537d --- /dev/null +++ b/src/generator/enum-generator.ts @@ -0,0 +1,72 @@ +import * as json2md from "json2md"; +import { MemberEnum, MemberEnumValue } from "../extractor/api-json-contracts"; +import { HelpersGenerator } from "./helpers-generator"; +import { Table } from "./generator-contracts"; + +export namespace EnumGenerator { + export function RenderEnum(name: string, memberEnum: MemberEnum): json2md.DataObject[] { + const md: json2md.DataObject[] = [ + { + h3: name + } + ]; + + // Summary + if (memberEnum.summary.length !== 0) { + md.push({ + p: memberEnum.summary.map(x => x.value) + }); + } + + // Remarks + if (memberEnum.remarks.length !== 0) { + md.push({ + p: memberEnum.remarks.map(x => x.value) + }); + } + + // Table of values + md.push({ + table: renderEnumValues(memberEnum.values) + }); + + return md; + } + + function renderEnumValues(members: { [member: string]: MemberEnumValue }): Table { + const table: Table = { + headers: ["Name", "Value", "Summary"], + rows: [] + }; + + for (const memberKey in members) { + if (members.hasOwnProperty(memberKey)) { + const member = members[memberKey]; + const row: string[] = [ + memberKey, + member.value, + member.summary.map(x => x.value).join(".") + ]; + + table.rows.push(row); + } + } + + // Sort rows by values + table.rows.sort((x, y) => { + const xValue = x[1]; + const yValue = y[1]; + if (isNumberCheck(xValue) && isNumberCheck(yValue)) { + return xValue - yValue; + } + + return 0; + }); + + return table; + } + + function isNumberCheck(a: string | number): a is number { + return isFinite(a as number); + } +} diff --git a/src/generator/generator-contracts.ts b/src/generator/generator-contracts.ts new file mode 100644 index 00000000..77ead72b --- /dev/null +++ b/src/generator/generator-contracts.ts @@ -0,0 +1,6 @@ +import * as json2md from "json2md"; + +export interface Table extends json2md.DefaultConverters.TableInput { + headers: string[]; + rows: string[][]; +} diff --git a/src/generator/interface-generator.ts b/src/generator/interface-generator.ts index 5ec29e5a..d3edf29b 100644 --- a/src/generator/interface-generator.ts +++ b/src/generator/interface-generator.ts @@ -1,11 +1,7 @@ import * as json2md from "json2md"; import { MemberInterface, InterfaceMembers } from "../extractor/api-json-contracts"; import { HelpersGenerator } from "./helpers-generator"; - -interface Table extends json2md.DefaultConverters.TableInput { - headers: string[]; - rows: string[][]; -} +import { Table } from "./generator-contracts"; export namespace InterfaceGenerator { export function RenderInterface(name: string, memberInterface: MemberInterface): json2md.DataObject[] { diff --git a/src/generator/markdown-generator.ts b/src/generator/markdown-generator.ts index 76994417..af2cb8d9 100644 --- a/src/generator/markdown-generator.ts +++ b/src/generator/markdown-generator.ts @@ -4,12 +4,14 @@ import { ApiJson, Members, MemberList, - MemberInterface + MemberInterface, + MemberEnum } from "../extractor/api-json-contracts"; import { HelpersGenerator } from "./helpers-generator"; import { InterfaceGenerator } from "./interface-generator"; +import { EnumGenerator } from "./enum-generator"; type MembersDict = { [key in keyof MemberList]: { [key: string]: MemberList[key] }; @@ -47,6 +49,7 @@ export class MarkdownGenerator { } this.markdown = this.markdown.concat(this.renderInterfaces(dict.interface)); + this.markdown = this.markdown.concat(this.renderEnums(dict.enum)); } private renderPackage(pckg: ApiJson): void { @@ -67,6 +70,10 @@ export class MarkdownGenerator { } private renderInterfaces(interfaces: { [key: string]: MemberInterface }): json2md.DataObject[] { + if (Object.keys(interfaces).length === 0) { + return []; + } + let md: json2md.DataObject[] = [ { h2: "Interfaces" @@ -82,4 +89,25 @@ export class MarkdownGenerator { return md; } + + private renderEnums(enums: { [key: string]: MemberEnum }): json2md.DataObject[] { + if (Object.keys(enums).length === 0) { + return []; + } + + let md: json2md.DataObject[] = [ + { + h2: "Enums" + } + ]; + + for (const enumKey in enums) { + if (enums.hasOwnProperty(enumKey)) { + const memberEnum = enums[enumKey]; + md = md.concat(EnumGenerator.RenderEnum(enumKey, memberEnum)); + } + } + + return md; + } } From 2b585f1e319e673cf5fa23f501fad1cb1778a09f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 17:02:03 +0300 Subject: [PATCH 07/61] Fixed ApiJsonGenerator: params. --- src/extractor/api-json-generator.ts | 45 +++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts index 48071eff..bd777985 100644 --- a/src/extractor/api-json-generator.ts +++ b/src/extractor/api-json-generator.ts @@ -1,12 +1,51 @@ import { ApiJsonGenerator as Generator, Extractor } from "@microsoft/api-extractor"; -import { ExtractedApiJson } from "./api-json-contracts"; +import ApiParameter from "@microsoft/api-extractor/lib/definitions/ApiParameter"; +import ApiFunction from "@microsoft/api-extractor/lib/definitions/ApiFunction"; +import { ReleaseTag } from "@microsoft/api-extractor/lib/definitions/ApiDocumentation"; +import ApiJsonFile from "@microsoft/api-extractor/lib/generators/ApiJsonFile"; +import { IReturn, IParam } from "@microsoft/api-extractor/lib/IDocElement"; + +import { ApiJson } from "./api-json-contracts"; export class ApiJsonGenerator extends Generator { - public GetFileContents(extractor: Extractor): ExtractedApiJson { + public GetFileContents(extractor: Extractor): ApiJson { this.visit(extractor.package, this.jsonOutput); // TODO: Add JSON validation scheme. - return this.jsonOutput as ExtractedApiJson; + return this.jsonOutput as ApiJson; + } + + protected visitApiFunction(apiFunction: ApiFunction, refObject?: { [key: string]: any }): void { + if (!apiFunction.supportedName) { + return; + } + + const parameters: { [key: string]: IParam } = {}; + + for (const param of apiFunction.params) { + // FIXME: any + parameters[param.name] = {} as any; + + this.visitApiParam(param, parameters[param.name]); + } + const returnValueNode: IReturn = { + type: apiFunction.returnType, + description: apiFunction.documentation.returnsMessage + }; + + const newNode: Object = { + kind: ApiJsonFile.convertKindToJson(apiFunction.kind), + returnValue: returnValueNode, + parameters: parameters, + deprecatedMessage: apiFunction.documentation.deprecatedMessage || [], + summary: apiFunction.documentation.summary || [], + remarks: apiFunction.documentation.remarks || [], + isBeta: apiFunction.documentation.releaseTag === ReleaseTag.Beta + }; + + if (refObject != null) { + refObject[apiFunction.name] = newNode; + } } } From 88781abce3dcd9ed3de41fc696e80124d8e7773d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 17:31:59 +0300 Subject: [PATCH 08/61] Function generating. --- __tests__/assets/example-1/index.ts | 5 +- __tests__/index.test.ts | 2 + __tests__/test.json | 254 ++++++++++++++++++++++++++++ __tests__/test.md | 17 +- src/extractor/api-json-contracts.ts | 10 +- src/generator/function-generator.ts | 104 ++++++++++++ src/generator/helpers-generator.ts | 5 +- src/generator/markdown-generator.ts | 57 ++++++- src/generator/property-generator.ts | 36 ++++ 9 files changed, 480 insertions(+), 10 deletions(-) create mode 100644 __tests__/test.json create mode 100644 src/generator/function-generator.ts create mode 100644 src/generator/property-generator.ts diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts index 084c2170..00a2b81b 100644 --- a/__tests__/assets/example-1/index.ts +++ b/__tests__/assets/example-1/index.ts @@ -56,7 +56,10 @@ export enum EventType { } /** - * Sum function. + * Sum summary + * @param a - First number + * @param b - Second number + * @returns Return summary. * @public */ export function Sum(a: number, b: number): number { diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 33050df4..15dabc66 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -17,6 +17,8 @@ it("Generate JSON", async done => { expect(json).toBeDefined(); expect(stubCallback.called).toBe(false); + + await fs.writeFile(path.join(__dirname, "./test.json"), JSON.stringify(json, undefined, 4), "utf8"); } catch (error) { done.fail(error); return; diff --git a/__tests__/test.json b/__tests__/test.json new file mode 100644 index 00000000..5e8ebd3f --- /dev/null +++ b/__tests__/test.json @@ -0,0 +1,254 @@ +{ + "kind": "package", + "summary": [], + "remarks": [], + "exports": { + "Bar": { + "kind": "interface", + "extends": "Foo", + "implements": "", + "typeParameters": [], + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false, + "members": { + "Email": { + "kind": "property", + "isOptional": false, + "isReadOnly": false, + "isStatic": false, + "type": "string", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "GetCode": { + "kind": "method", + "signature": "GetCode(id: number): string;", + "accessModifier": "", + "isOptional": false, + "isStatic": false, + "returnValue": { + "type": "string", + "description": [] + }, + "parameters": {}, + "deprecatedMessage": [], + "summary": [ + { + "kind": "textDocElement", + "value": "Get Bar model code by id. Another line of summary." + } + ], + "remarks": [], + "isBeta": false + } + } + }, + "CoolStuff": { + "kind": "namespace", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false, + "exports": { + "a": { + "kind": "module variable", + "type": "string", + "value": "\"aa\"", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + } + } + }, + "EventType": { + "kind": "enum", + "values": { + "Live": { + "kind": "enum value", + "value": "\"live\"", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "Test": { + "kind": "enum value", + "value": "\"test\"", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + } + }, + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "Foo": { + "kind": "interface", + "extends": "", + "implements": "", + "typeParameters": [], + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false, + "members": { + "Name": { + "kind": "property", + "isOptional": false, + "isReadOnly": false, + "isStatic": false, + "type": "string", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "Surname": { + "kind": "property", + "isOptional": false, + "isReadOnly": false, + "isStatic": false, + "type": "string", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + } + } + }, + "FooBar": { + "kind": "class", + "extends": "", + "implements": "", + "typeParameters": [], + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false, + "members": { + "Foo": { + "kind": "property", + "isOptional": false, + "isReadOnly": false, + "isStatic": false, + "type": "string", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "GetSomething": { + "kind": "method", + "signature": "public GetSomething(): string;", + "accessModifier": "public", + "isOptional": false, + "isStatic": false, + "returnValue": { + "type": "string", + "description": [] + }, + "parameters": {}, + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "SetBar": { + "kind": "method", + "signature": "public SetBar(bar: Bar): void;", + "accessModifier": "public", + "isOptional": false, + "isStatic": false, + "returnValue": { + "type": "void", + "description": [] + }, + "parameters": {}, + "deprecatedMessage": [], + "summary": [ + { + "kind": "textDocElement", + "value": "Summary of SetBar method." + } + ], + "remarks": [], + "isBeta": false + } + } + }, + "Sum": { + "kind": "function", + "returnValue": { + "type": "number", + "description": [ + { + "kind": "textDocElement", + "value": "Return summary." + } + ] + }, + "parameters": { + "a": { + "isOptional": false, + "isSpread": false, + "type": "number" + }, + "b": { + "isOptional": false, + "isSpread": false, + "type": "number" + } + }, + "deprecatedMessage": [], + "summary": [ + { + "kind": "textDocElement", + "value": "Sum summary" + } + ], + "remarks": [], + "isBeta": false + }, + "Test": { + "kind": "enum", + "values": { + "Error": { + "kind": "enum value", + "value": "100", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "None": { + "kind": "enum value", + "value": "0", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, + "Warning": { + "kind": "enum value", + "value": "8", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + } + }, + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + } + } +} \ No newline at end of file diff --git a/__tests__/test.md b/__tests__/test.md index f0bee28d..5e17d3bf 100644 --- a/__tests__/test.md +++ b/__tests__/test.md @@ -24,4 +24,19 @@ Name | Value | Summary --- | --- | --- None | 0 | Warning | 8 | -Error | 100 | \ No newline at end of file +Error | 100 | +## Functions +### Sum + +Sum summary + +```ts +function Sum(a: number, b: number): number +``` +#### Parameters + + - a: `number` + - b: `number` +#### Returns + +`number` Return summary. diff --git a/src/extractor/api-json-contracts.ts b/src/extractor/api-json-contracts.ts index 0103ae67..e3790f69 100644 --- a/src/extractor/api-json-contracts.ts +++ b/src/extractor/api-json-contracts.ts @@ -1,3 +1,9 @@ +import { IReturn, IParam as Param } from "@microsoft/api-extractor/lib/IDocElement"; + +export { + Param +}; + export interface ApiJson { kind: "package"; summary: ItemValue[]; @@ -17,7 +23,7 @@ export interface ReturnValue { * Examples: "string", "void" */ type: string; - description: string[]; + description: ItemValue[]; } export interface ItemValue { @@ -102,5 +108,5 @@ export interface MemberClass extends DefaultInfo { export interface MemberFunction extends DefaultInfo { kind: "function"; returnValue: ReturnValue; - parameters: any[]; + parameters: { [name: string]: Param }; } diff --git a/src/generator/function-generator.ts b/src/generator/function-generator.ts new file mode 100644 index 00000000..0eee6649 --- /dev/null +++ b/src/generator/function-generator.ts @@ -0,0 +1,104 @@ +import * as json2md from "json2md"; + +import { MemberFunction, Param, ReturnValue } from "../extractor/api-json-contracts"; +import { HelpersGenerator } from "./helpers-generator"; + +export namespace FunctionGenerator { + export function RenderFunction(name: string, memberFunction: MemberFunction): json2md.DataObject[] { + let md: json2md.DataObject[] = [ + { + h3: name + } + ]; + + // Summary + if (memberFunction.summary.length !== 0) { + md.push({ + p: memberFunction.summary.map(x => x.value).join("\n") + }); + } + + // Remarks + if (memberFunction.remarks.length !== 0) { + md.push({ + p: memberFunction.remarks.map(x => x.value).join("\n") + }); + } + + md.push({ + code: { + language: "ts", + content: renderFunctionCode(name, memberFunction.parameters, memberFunction.returnValue) + } + }); + + // Parameters + md = md.concat(renderFunctionParameters(memberFunction.parameters)); + + // Returns value + const returnValueDesc = memberFunction.returnValue.description.map(x => x.value).join("."); + md = md.concat([ + { + h4: "Returns" + }, + { + p: `${HelpersGenerator.InlineCode(memberFunction.returnValue.type)} ${returnValueDesc}` + } + ]); + + return md; + } + + function renderFunctionCode(name: string, parameters: { [key: string]: Param }, returnValue?: ReturnValue): string { + const params: string[] = []; + let returnValueString: string = ""; + + if (returnValue != null) { + returnValueString += `: ${returnValue.type}`; + } + + for (const parameterName in parameters) { + if (parameters.hasOwnProperty(parameterName)) { + const parameter = parameters[parameterName]; + const optional = (parameter.isOptional ? "?" : ""); + params.push(`${parameterName}${optional}: ${parameter.type}`); + } + } + + return `function ${name}(${params.join(", ")})${returnValueString}`; + } + + function renderFunctionParameters(parameters: { [key: string]: Param }): json2md.DataObject[] { + const md: json2md.DataObject[] = [ + { + h4: "Parameters" + } + ]; + const parametersList: string[] = []; + + for (const parameterName in parameters) { + if (parameters.hasOwnProperty(parameterName)) { + const parameter = parameters[parameterName]; + const optional = (parameter.isOptional ? "?" : ""); + const line: string = `${parameterName}${optional}: ${HelpersGenerator.InlineCode(parameter.type)}`; + + // FIXME: When there is description on this param. + // if (parameter.description != null) { + // // line += ` - ${parameter.description.map(x => x.}` + // } + + parametersList.push(line); + } + } + + if (parametersList.length === 0) { + return []; + } + + md.push({ + ul: parametersList + }); + + return md; + } +} diff --git a/src/generator/helpers-generator.ts b/src/generator/helpers-generator.ts index 4df228f4..690e5426 100644 --- a/src/generator/helpers-generator.ts +++ b/src/generator/helpers-generator.ts @@ -21,7 +21,10 @@ export namespace HelpersGenerator { return `__${text}__`; } - export function InlineCode(text: string): string { + export function InlineCode(text?: string): string { + if (text == null) { + return ""; + } return `\`${text}\``; } } diff --git a/src/generator/markdown-generator.ts b/src/generator/markdown-generator.ts index af2cb8d9..ed775308 100644 --- a/src/generator/markdown-generator.ts +++ b/src/generator/markdown-generator.ts @@ -5,13 +5,17 @@ import { Members, MemberList, MemberInterface, - MemberEnum + MemberEnum, + MemberProperty, + MemberFunction } from "../extractor/api-json-contracts"; import { HelpersGenerator } from "./helpers-generator"; import { InterfaceGenerator } from "./interface-generator"; import { EnumGenerator } from "./enum-generator"; +import { PropertyGenerator } from "./property-generator"; +import { FunctionGenerator } from "./function-generator"; type MembersDict = { [key in keyof MemberList]: { [key: string]: MemberList[key] }; @@ -32,12 +36,12 @@ export class MarkdownGenerator { private renderMembers(members: { [key: string]: Members }): void { const dict: MembersDict = { - class: {}, enum: {}, - function: {}, interface: {}, - namespace: {}, - property: {} + function: {}, + property: {}, + class: {}, + namespace: {} }; // Filter @@ -50,6 +54,7 @@ export class MarkdownGenerator { this.markdown = this.markdown.concat(this.renderInterfaces(dict.interface)); this.markdown = this.markdown.concat(this.renderEnums(dict.enum)); + this.markdown = this.markdown.concat(this.renderFunctions(dict.function)); } private renderPackage(pckg: ApiJson): void { @@ -110,4 +115,46 @@ export class MarkdownGenerator { return md; } + + private renderFunctions(functions: { [key: string]: MemberFunction }): json2md.DataObject[] { + if (Object.keys(functions).length === 0) { + return []; + } + + let md: json2md.DataObject[] = [ + { + h2: "Functions" + } + ]; + + for (const functionKey in functions) { + if (functions.hasOwnProperty(functionKey)) { + const memberFunction = functions[functionKey]; + md = md.concat(FunctionGenerator.RenderFunction(functionKey, memberFunction)); + } + } + + return md; + } + + // private renderProperties(properties: { [key: string]: MemberProperty }): json2md.DataObject[] { + // if (Object.keys(properties).length === 0) { + // return []; + // } + + // let md: json2md.DataObject[] = [ + // { + // h2: "Properties" + // } + // ]; + + // for (const enumKey in properties) { + // if (properties.hasOwnProperty(enumKey)) { + // const memberProperty = properties[enumKey]; + // md = md.concat(PropertyGenerator.RenderProperty(enumKey, memberProperty)); + // } + // } + + // return md; + // } } diff --git a/src/generator/property-generator.ts b/src/generator/property-generator.ts new file mode 100644 index 00000000..2631e60f --- /dev/null +++ b/src/generator/property-generator.ts @@ -0,0 +1,36 @@ +import * as json2md from "json2md"; + +import { MemberProperty } from "../extractor/api-json-contracts"; + +export namespace PropertyGenerator { + export function RenderProperty(name: string, memberProperty: MemberProperty): json2md.DataObject[] { + const md: json2md.DataObject[] = [ + { + h3: name + } + ]; + + // Summary + if (memberProperty.summary.length !== 0) { + md.push({ + p: memberProperty.summary.map(x => x.value).join("\n") + }); + } + + // Remarks + if (memberProperty.remarks.length !== 0) { + md.push({ + p: memberProperty.remarks.map(x => x.value).join("\n") + }); + } + + md.push({ + code: { + language: "ts", + content: "" + } + }); + + return md; + } +} From 73e3551eea4843e99ed13fe72db720236e1be6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 19:19:26 +0300 Subject: [PATCH 09/61] Added class generator. --- __tests__/assets/example-1/index.ts | 5 +- __tests__/test.json | 37 +++++++++- __tests__/test.md | 35 ++++++++- src/extractor/api-json-contracts.ts | 7 +- src/extractor/api-json-generator.ts | 62 ++++++++++++++-- src/generator/class-generator.ts | 59 ++++++++++++++- src/generator/helpers-generator.ts | 4 + src/generator/interface-generator.ts | 2 +- src/generator/markdown-generator.ts | 27 ++++++- src/generator/method-generator.ts | 105 +++++++++++++++++++++++++++ src/generator/property-generator.ts | 8 +- 11 files changed, 329 insertions(+), 22 deletions(-) create mode 100644 src/generator/method-generator.ts diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts index 00a2b81b..318fc906 100644 --- a/__tests__/assets/example-1/index.ts +++ b/__tests__/assets/example-1/index.ts @@ -24,7 +24,10 @@ export interface Bar extends Foo { export class FooBar { private bar: Bar; - public readonly Foo: string = "Hello"; + /** + * Hello Foo summary + */ + public Foo: string = "Hello"; public GetSomething(): string { return "Something"; diff --git a/__tests__/test.json b/__tests__/test.json index 5e8ebd3f..ec9d833a 100644 --- a/__tests__/test.json +++ b/__tests__/test.json @@ -34,7 +34,13 @@ "type": "string", "description": [] }, - "parameters": {}, + "parameters": { + "id": { + "isOptional": false, + "isSpread": false, + "type": "number" + } + }, "deprecatedMessage": [], "summary": [ { @@ -141,7 +147,12 @@ "isStatic": false, "type": "string", "deprecatedMessage": [], - "summary": [], + "summary": [ + { + "kind": "textDocElement", + "value": "Hello Foo summary" + } + ], "remarks": [], "isBeta": false }, @@ -171,7 +182,13 @@ "type": "void", "description": [] }, - "parameters": {}, + "parameters": { + "bar": { + "isOptional": false, + "isSpread": false, + "type": "Bar" + } + }, "deprecatedMessage": [], "summary": [ { @@ -197,11 +214,25 @@ }, "parameters": { "a": { + "name": "a", + "description": [ + { + "kind": "textDocElement", + "value": "First number" + } + ], "isOptional": false, "isSpread": false, "type": "number" }, "b": { + "name": "b", + "description": [ + { + "kind": "textDocElement", + "value": "Second number" + } + ], "isOptional": false, "isSpread": false, "type": "number" diff --git a/__tests__/test.md b/__tests__/test.md index 5e17d3bf..46614c95 100644 --- a/__tests__/test.md +++ b/__tests__/test.md @@ -7,7 +7,7 @@ __Extends__ `Foo` Name | Type | Summary --- | --- | --- Email `*` | string | -GetCode `*` | void | Get Bar model code by id. Another line of summary. +GetCode `*` | string | Get Bar model code by id. Another line of summary. ### Foo Name | Type | Summary --- | --- | --- @@ -40,3 +40,36 @@ function Sum(a: number, b: number): number #### Returns `number` Return summary. + +## Classes +### FooBar +#### Properties +##### Foo + +Hello Foo summary + +```ts +Foo: string; +``` +#### Methods +##### GetSomething +```ts +GetSomething(): string +``` +###### Returns + +`string` + +##### SetBar + +Summary of SetBar method. + +```ts +SetBar(bar: Bar): void +``` +###### Parameters + + - bar: `Bar` +###### Returns + +`void` diff --git a/src/extractor/api-json-contracts.ts b/src/extractor/api-json-contracts.ts index e3790f69..de07eed4 100644 --- a/src/extractor/api-json-contracts.ts +++ b/src/extractor/api-json-contracts.ts @@ -74,11 +74,8 @@ export interface MemberMethod extends DefaultInfo { accessModifier: string; isOptional: boolean; isStatic: boolean; - returnType: ReturnValue; - parameters: { - type: string; - description: any[]; - }; + returnValue: ReturnValue; + parameters: { [key: string]: Param }; } export interface MemberNamespace extends DefaultInfo { diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts index bd777985..34b3eb28 100644 --- a/src/extractor/api-json-generator.ts +++ b/src/extractor/api-json-generator.ts @@ -6,6 +6,9 @@ import ApiJsonFile from "@microsoft/api-extractor/lib/generators/ApiJsonFile"; import { IReturn, IParam } from "@microsoft/api-extractor/lib/IDocElement"; import { ApiJson } from "./api-json-contracts"; +import { ApiItemKind } from "@microsoft/api-extractor/lib/definitions/ApiItem"; +import ApiMethod from "@microsoft/api-extractor/lib/definitions/ApiMethod"; +import { AccessModifier } from "@microsoft/api-extractor/lib/definitions/ApiMember"; export class ApiJsonGenerator extends Generator { public GetFileContents(extractor: Extractor): ApiJson { @@ -21,13 +24,13 @@ export class ApiJsonGenerator extends Generator { return; } - const parameters: { [key: string]: IParam } = {}; - for (const param of apiFunction.params) { // FIXME: any - parameters[param.name] = {} as any; + if (apiFunction.documentation.parameters[param.name] == null) { + apiFunction.documentation.parameters[param.name] = {} as any; + } - this.visitApiParam(param, parameters[param.name]); + this.visitApiParam(param, apiFunction.documentation.parameters[param.name]); } const returnValueNode: IReturn = { type: apiFunction.returnType, @@ -37,7 +40,7 @@ export class ApiJsonGenerator extends Generator { const newNode: Object = { kind: ApiJsonFile.convertKindToJson(apiFunction.kind), returnValue: returnValueNode, - parameters: parameters, + parameters: apiFunction.documentation.parameters, deprecatedMessage: apiFunction.documentation.deprecatedMessage || [], summary: apiFunction.documentation.summary || [], remarks: apiFunction.documentation.remarks || [], @@ -48,4 +51,53 @@ export class ApiJsonGenerator extends Generator { refObject[apiFunction.name] = newNode; } } + + protected visitApiMethod(apiMethod: ApiMethod, refObject?: { [key: string]: any }): void { + if (!apiMethod.supportedName) { + return; + } + + for (const param of apiMethod.params) { + if (apiMethod.documentation.parameters[param.name] == null) { + apiMethod.documentation.parameters[param.name] = {} as any; + } + + this.visitApiParam(param, apiMethod.documentation.parameters[param.name]); + } + + let newNode: Object; + if (apiMethod.name === "__constructor") { + newNode = { + kind: ApiJsonFile.convertKindToJson(ApiItemKind.Constructor), + signature: apiMethod.getDeclarationLine(), + parameters: apiMethod.documentation.parameters || {}, + deprecatedMessage: apiMethod.documentation.deprecatedMessage || [], + summary: apiMethod.documentation.summary || [], + remarks: apiMethod.documentation.remarks || [] + }; + } else { + const returnValueNode: IReturn = { + type: apiMethod.returnType, + description: apiMethod.documentation.returnsMessage + }; + + newNode = { + kind: ApiJsonFile.convertKindToJson(apiMethod.kind), + signature: apiMethod.getDeclarationLine(), + accessModifier: apiMethod.accessModifier ? AccessModifier[apiMethod.accessModifier].toLowerCase() : "", + isOptional: !!apiMethod.isOptional, + isStatic: !!apiMethod.isStatic, + returnValue: returnValueNode, + parameters: apiMethod.documentation.parameters, + deprecatedMessage: apiMethod.documentation.deprecatedMessage || [], + summary: apiMethod.documentation.summary || [], + remarks: apiMethod.documentation.remarks || [], + isBeta: apiMethod.documentation.releaseTag === ReleaseTag.Beta + }; + } + + if (refObject != null) { + refObject[apiMethod.name] = newNode; + } + } } diff --git a/src/generator/class-generator.ts b/src/generator/class-generator.ts index 749b64bf..d4595688 100644 --- a/src/generator/class-generator.ts +++ b/src/generator/class-generator.ts @@ -8,17 +8,17 @@ import { MemberMethod } from "../extractor/api-json-contracts"; import { HelpersGenerator } from "./helpers-generator"; +import { PropertyGenerator } from "./property-generator"; +import { MethodGenerator } from "./method-generator"; export namespace ClassGenerator { - export function renderClass(name: string, memberClass: MemberClass): json2md.DataObject[] { + export function RenderClass(name: string, memberClass: MemberClass): json2md.DataObject[] { let md: json2md.DataObject[] = [ { h3: name } ]; - // TODO: IsBeta - // Summary if (memberClass.summary.length !== 0) { md.push({ @@ -59,6 +59,59 @@ export namespace ClassGenerator { } } + md = md.concat(renderProperties(properties)); + md = md.concat(renderMethods(methods)); + + return md; + } + + function renderProperties(properties: { [name: string]: MemberProperty }): json2md.DataObject[] { + let md: json2md.DataObject[] = [ + { + h4: "Properties" + } + ]; + + let list: json2md.DataObject[] = []; + + for (const propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + const memberProperty = properties[propertyName]; + list = list.concat(PropertyGenerator.RenderProperty(propertyName, memberProperty)); + } + } + + if (list.length === 0) { + return []; + } + + md = md.concat(list); + + return md; + } + + function renderMethods(methods: { [name: string]: MemberMethod }): json2md.DataObject[] { + let md: json2md.DataObject[] = [ + { + h4: "Methods" + } + ]; + + let list: json2md.DataObject[] = []; + + for (const methodName in methods) { + if (methods.hasOwnProperty(methodName)) { + const memberMethod = methods[methodName]; + list = list.concat(MethodGenerator.RenderMethod(methodName, memberMethod)); + } + } + + if (list.length === 0) { + return []; + } + + md = md.concat(list); + return md; } } diff --git a/src/generator/helpers-generator.ts b/src/generator/helpers-generator.ts index 690e5426..4a768189 100644 --- a/src/generator/helpers-generator.ts +++ b/src/generator/helpers-generator.ts @@ -27,4 +27,8 @@ export namespace HelpersGenerator { } return `\`${text}\``; } + + export function BreakLine(): string { + return "--------------------------------"; + } } diff --git a/src/generator/interface-generator.ts b/src/generator/interface-generator.ts index d3edf29b..0435e6ec 100644 --- a/src/generator/interface-generator.ts +++ b/src/generator/interface-generator.ts @@ -64,7 +64,7 @@ export namespace InterfaceGenerator { row = [ memberName, // TODO: Return type description - (member.returnType != null ? member.returnType.type : "void"), + (member.returnValue != null ? member.returnValue.type : "void"), member.summary.map(x => x.value).join(".") ]; break; diff --git a/src/generator/markdown-generator.ts b/src/generator/markdown-generator.ts index ed775308..27341805 100644 --- a/src/generator/markdown-generator.ts +++ b/src/generator/markdown-generator.ts @@ -7,7 +7,8 @@ import { MemberInterface, MemberEnum, MemberProperty, - MemberFunction + MemberFunction, + MemberClass } from "../extractor/api-json-contracts"; import { HelpersGenerator } from "./helpers-generator"; @@ -16,6 +17,7 @@ import { InterfaceGenerator } from "./interface-generator"; import { EnumGenerator } from "./enum-generator"; import { PropertyGenerator } from "./property-generator"; import { FunctionGenerator } from "./function-generator"; +import { ClassGenerator } from "./class-generator"; type MembersDict = { [key in keyof MemberList]: { [key: string]: MemberList[key] }; @@ -55,6 +57,7 @@ export class MarkdownGenerator { this.markdown = this.markdown.concat(this.renderInterfaces(dict.interface)); this.markdown = this.markdown.concat(this.renderEnums(dict.enum)); this.markdown = this.markdown.concat(this.renderFunctions(dict.function)); + this.markdown = this.markdown.concat(this.renderClass(dict.class)); } private renderPackage(pckg: ApiJson): void { @@ -137,6 +140,28 @@ export class MarkdownGenerator { return md; } + private renderClass(classes: { [key: string]: MemberClass }): json2md.DataObject[] { + const names = Object.keys(classes); + if (names.length === 0) { + return []; + } + + let md: json2md.DataObject[] = [ + { + h2: "Classes" + } + ]; + + for (const className in classes) { + if (classes.hasOwnProperty(className)) { + const memberClass = classes[className]; + md = md.concat(ClassGenerator.RenderClass(className, memberClass)); + } + } + + return md; + } + // private renderProperties(properties: { [key: string]: MemberProperty }): json2md.DataObject[] { // if (Object.keys(properties).length === 0) { // return []; diff --git a/src/generator/method-generator.ts b/src/generator/method-generator.ts new file mode 100644 index 00000000..ac79b2b7 --- /dev/null +++ b/src/generator/method-generator.ts @@ -0,0 +1,105 @@ +import * as json2md from "json2md"; + +import { MemberMethod, Param, ReturnValue } from "../extractor/api-json-contracts"; +import { HelpersGenerator } from "./helpers-generator"; + +export namespace MethodGenerator { + export function RenderMethod(name: string, memberMethod: MemberMethod): json2md.DataObject[] { + let md: json2md.DataObject[] = [ + { + h5: name + } + ]; + + // Summary + if (memberMethod.summary.length !== 0) { + md.push({ + p: memberMethod.summary.map(x => x.value).join("\n") + }); + } + + // Remarks + if (memberMethod.remarks.length !== 0) { + md.push({ + p: memberMethod.remarks.map(x => x.value).join("\n") + }); + } + + md.push({ + code: { + language: "ts", + content: renderMethodCode(name, memberMethod, memberMethod.returnValue) + } + }); + + // Parameters + md = md.concat(renderMethodParameters(memberMethod.parameters)); + + // Returns value + const returnValueDesc = memberMethod.returnValue.description.map(x => x.value).join("."); + md = md.concat([ + { + h6: "Returns" + }, + { + p: `${HelpersGenerator.InlineCode(memberMethod.returnValue.type)} ${returnValueDesc}` + } + ]); + + return md; + } + + function renderMethodCode(name: string, memberMethod: MemberMethod, returnValue?: ReturnValue): string { + const params: string[] = []; + let returnValueString: string = ""; + + if (returnValue != null) { + returnValueString += `: ${returnValue.type}`; + } + + for (const parameterName in memberMethod.parameters) { + if (memberMethod.parameters.hasOwnProperty(parameterName)) { + const parameter = memberMethod.parameters[parameterName]; + const optional = (parameter.isOptional ? "?" : ""); + params.push(`${parameterName}${optional}: ${parameter.type}`); + } + } + + const staticString = (memberMethod.isStatic ? "static " : ""); + return `${staticString}${name}(${params.join(", ")})${returnValueString}`; + } + + function renderMethodParameters(parameters: { [key: string]: Param }): json2md.DataObject[] { + const md: json2md.DataObject[] = [ + { + h6: "Parameters" + } + ]; + const parametersList: string[] = []; + + for (const parameterName in parameters) { + if (parameters.hasOwnProperty(parameterName)) { + const parameter = parameters[parameterName]; + const optional = (parameter.isOptional ? "?" : ""); + const line: string = `${parameterName}${optional}: ${HelpersGenerator.InlineCode(parameter.type)}`; + + // FIXME: When there is description on this param. + // if (parameter.description != null) { + // // line += ` - ${parameter.description.map(x => x.}` + // } + + parametersList.push(line); + } + } + + if (parametersList.length === 0) { + return []; + } + + md.push({ + ul: parametersList + }); + + return md; + } +} diff --git a/src/generator/property-generator.ts b/src/generator/property-generator.ts index 2631e60f..3b3a48b6 100644 --- a/src/generator/property-generator.ts +++ b/src/generator/property-generator.ts @@ -6,7 +6,7 @@ export namespace PropertyGenerator { export function RenderProperty(name: string, memberProperty: MemberProperty): json2md.DataObject[] { const md: json2md.DataObject[] = [ { - h3: name + h5: name } ]; @@ -24,10 +24,14 @@ export namespace PropertyGenerator { }); } + const staticProperty = (memberProperty.isStatic ? "static " : ""); + const readOnly = (memberProperty.isReadOnly ? "readonly " : ""); + const optional = (memberProperty.isOptional ? "?" : ""); + md.push({ code: { language: "ts", - content: "" + content: `${staticProperty}${readOnly}${name}${optional}: ${memberProperty.type};` } }); From eb1d730dfc6cba2d2612027657a50f61e2a77038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 19:30:40 +0300 Subject: [PATCH 10/61] Updated generating interfaces. --- __tests__/assets/example-1/index.ts | 2 +- __tests__/test.json | 4 +-- __tests__/test.md | 8 +++--- src/generator/interface-generator.ts | 39 +++++++++++++++++++++------- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts index 318fc906..a0fb49ce 100644 --- a/__tests__/assets/example-1/index.ts +++ b/__tests__/assets/example-1/index.ts @@ -15,7 +15,7 @@ export interface Bar extends Foo { * Get Bar model code by id. * Another line of summary. */ - GetCode(id: number): string; + GetCode?(id: number): string; } /** diff --git a/__tests__/test.json b/__tests__/test.json index ec9d833a..42489267 100644 --- a/__tests__/test.json +++ b/__tests__/test.json @@ -26,9 +26,9 @@ }, "GetCode": { "kind": "method", - "signature": "GetCode(id: number): string;", + "signature": "GetCode ?(id: number): string;", "accessModifier": "", - "isOptional": false, + "isOptional": true, "isStatic": false, "returnValue": { "type": "string", diff --git a/__tests__/test.md b/__tests__/test.md index 46614c95..3f6e9450 100644 --- a/__tests__/test.md +++ b/__tests__/test.md @@ -6,13 +6,13 @@ __Extends__ `Foo` Name | Type | Summary --- | --- | --- -Email `*` | string | -GetCode `*` | string | Get Bar model code by id. Another line of summary. +Email* | string | +GetCode?(id: `number`) | string | Get Bar model code by id. Another line of summary. ### Foo Name | Type | Summary --- | --- | --- -Name `*` | string | -Surname `*` | string | +Name* | string | +Surname* | string | ## Enums ### EventType Name | Value | Summary diff --git a/src/generator/interface-generator.ts b/src/generator/interface-generator.ts index 0435e6ec..d7d431e2 100644 --- a/src/generator/interface-generator.ts +++ b/src/generator/interface-generator.ts @@ -1,5 +1,5 @@ import * as json2md from "json2md"; -import { MemberInterface, InterfaceMembers } from "../extractor/api-json-contracts"; +import { MemberInterface, InterfaceMembers, MemberMethod } from "../extractor/api-json-contracts"; import { HelpersGenerator } from "./helpers-generator"; import { Table } from "./generator-contracts"; @@ -49,20 +49,17 @@ export namespace InterfaceGenerator { rows: [] }; - for (const memberKey in members) { - if (members.hasOwnProperty(memberKey)) { - const member = members[memberKey]; + for (const memberName in members) { + if (members.hasOwnProperty(memberName)) { + const member = members[memberName]; let row: string[] = []; - let memberName = memberKey; - if (!member.isOptional) { - memberName += " " + HelpersGenerator.InlineCode("*"); - } + const optional = (member.isOptional ? "" : "*"); // TODO: Add remarks switch (member.kind) { case "method": row = [ - memberName, + `${renderMethodString(memberName, member)}${optional}`, // TODO: Return type description (member.returnValue != null ? member.returnValue.type : "void"), member.summary.map(x => x.value).join(".") @@ -70,7 +67,7 @@ export namespace InterfaceGenerator { break; case "property": row = [ - memberName, + `${memberName}${optional}`, member.type, member.summary.map(x => x.value).join(".") ]; @@ -83,4 +80,26 @@ export namespace InterfaceGenerator { return table; } + + function renderMethodString(name: string, method: MemberMethod): string { + const parametersList: string[] = []; + const optionalName = (method.isOptional ? "?" : ""); + + for (const parameterName in method.parameters) { + if (method.parameters.hasOwnProperty(parameterName)) { + const parameter = method.parameters[parameterName]; + const optional = (parameter.isOptional ? "?" : ""); + const line: string = `${parameterName}${optional}: ${HelpersGenerator.InlineCode(parameter.type)}`; + + // FIXME: When there is description on this param. + // if (parameter.description != null) { + // // line += ` - ${parameter.description.map(x => x.}` + // } + + parametersList.push(line); + } + } + + return `${name}${optionalName}(${parametersList.join(", ")}) `; + } } From 4218eb29c26ca85275c46f0b0653196feb824a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 20:07:20 +0300 Subject: [PATCH 11/61] Added DeclarationLine. --- __tests__/assets/example-1/index.ts | 13 +++++- .../assets/example-1/tsconfig.example.json | 2 - __tests__/test.json | 44 +++++++++++++++++++ __tests__/test.md | 21 +++++++-- src/extractor/api-json-contracts.ts | 3 ++ src/extractor/api-json-generator.ts | 32 ++++++++++++++ src/generator/function-generator.ts | 19 +------- src/generator/method-generator.ts | 23 +--------- src/generator/property-generator.ts | 6 +-- 9 files changed, 111 insertions(+), 52 deletions(-) diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts index a0fb49ce..1148a3dd 100644 --- a/__tests__/assets/example-1/index.ts +++ b/__tests__/assets/example-1/index.ts @@ -22,7 +22,7 @@ export interface Bar extends Foo { * @public */ export class FooBar { - private bar: Bar; + protected LocalBar: Bar; /** * Hello Foo summary @@ -37,7 +37,16 @@ export class FooBar { * Summary of SetBar method. */ public SetBar(bar: Bar): void { - this.bar = bar; + this.LocalBar = bar; + } +} + +/** + * @public + */ +export class FancyFooBar extends FooBar { + public get Bar(): Bar { + return this.LocalBar; } } diff --git a/__tests__/assets/example-1/tsconfig.example.json b/__tests__/assets/example-1/tsconfig.example.json index b71023ad..2b4f89eb 100644 --- a/__tests__/assets/example-1/tsconfig.example.json +++ b/__tests__/assets/example-1/tsconfig.example.json @@ -11,8 +11,6 @@ "declaration": true, "pretty": true, "strict": true, - "noEmitHelpers": true, - "importHelpers": true, "lib": [ "dom", "dom.iterable", diff --git a/__tests__/test.json b/__tests__/test.json index 42489267..a05e8c52 100644 --- a/__tests__/test.json +++ b/__tests__/test.json @@ -15,6 +15,7 @@ "members": { "Email": { "kind": "property", + "declarationLine": "Email: string;", "isOptional": false, "isReadOnly": false, "isStatic": false, @@ -25,6 +26,7 @@ "isBeta": false }, "GetCode": { + "declarationLine": "GetCode ?(id: number): string;", "kind": "method", "signature": "GetCode ?(id: number): string;", "accessModifier": "", @@ -96,6 +98,30 @@ "remarks": [], "isBeta": false }, + "FancyFooBar": { + "kind": "class", + "extends": "FooBar", + "implements": "", + "typeParameters": [], + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false, + "members": { + "Bar": { + "kind": "property", + "declarationLine": "public readonly Bar: Bar;", + "isOptional": false, + "isReadOnly": true, + "isStatic": false, + "type": "Bar", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + } + } + }, "Foo": { "kind": "interface", "extends": "", @@ -108,6 +134,7 @@ "members": { "Name": { "kind": "property", + "declarationLine": "Name: string;", "isOptional": false, "isReadOnly": false, "isStatic": false, @@ -119,6 +146,7 @@ }, "Surname": { "kind": "property", + "declarationLine": "Surname: string;", "isOptional": false, "isReadOnly": false, "isStatic": false, @@ -142,6 +170,7 @@ "members": { "Foo": { "kind": "property", + "declarationLine": "public Foo: string;", "isOptional": false, "isReadOnly": false, "isStatic": false, @@ -157,6 +186,7 @@ "isBeta": false }, "GetSomething": { + "declarationLine": "public GetSomething(): string;", "kind": "method", "signature": "public GetSomething(): string;", "accessModifier": "public", @@ -172,7 +202,20 @@ "remarks": [], "isBeta": false }, + "LocalBar": { + "kind": "property", + "declarationLine": "protected LocalBar: Bar;", + "isOptional": false, + "isReadOnly": false, + "isStatic": false, + "type": "Bar", + "deprecatedMessage": [], + "summary": [], + "remarks": [], + "isBeta": false + }, "SetBar": { + "declarationLine": "public SetBar(bar: Bar): void;", "kind": "method", "signature": "public SetBar(bar: Bar): void;", "accessModifier": "public", @@ -203,6 +246,7 @@ }, "Sum": { "kind": "function", + "declarationLine": "export function Sum(a: number, b: number): number;", "returnValue": { "type": "number", "description": [ diff --git a/__tests__/test.md b/__tests__/test.md index 3f6e9450..c689fe6e 100644 --- a/__tests__/test.md +++ b/__tests__/test.md @@ -31,7 +31,7 @@ Error | 100 | Sum summary ```ts -function Sum(a: number, b: number): number +function Sum(a: number, b: number): number; ``` #### Parameters @@ -42,6 +42,15 @@ function Sum(a: number, b: number): number `number` Return summary. ## Classes +### FancyFooBar + +__Extends__ `FooBar` + +#### Properties +##### Bar +```ts +public readonly Bar: Bar; +``` ### FooBar #### Properties ##### Foo @@ -49,12 +58,16 @@ function Sum(a: number, b: number): number Hello Foo summary ```ts -Foo: string; +public Foo: string; +``` +##### LocalBar +```ts +protected LocalBar: Bar; ``` #### Methods ##### GetSomething ```ts -GetSomething(): string +public GetSomething(): string; ``` ###### Returns @@ -65,7 +78,7 @@ GetSomething(): string Summary of SetBar method. ```ts -SetBar(bar: Bar): void +public SetBar(bar: Bar): void; ``` ###### Parameters diff --git a/src/extractor/api-json-contracts.ts b/src/extractor/api-json-contracts.ts index de07eed4..55b71a67 100644 --- a/src/extractor/api-json-contracts.ts +++ b/src/extractor/api-json-contracts.ts @@ -53,6 +53,7 @@ export interface MemberInterface extends DefaultInfo { export interface MemberProperty extends DefaultInfo { kind: "property"; + declarationLine: string; /** * Examples: "string", "void" */ @@ -64,6 +65,7 @@ export interface MemberProperty extends DefaultInfo { export interface MemberMethod extends DefaultInfo { kind: "method"; + declarationLine: string; /** * Example: 'public Method(arg: string): void;' */ @@ -104,6 +106,7 @@ export interface MemberClass extends DefaultInfo { export interface MemberFunction extends DefaultInfo { kind: "function"; + declarationLine: string; returnValue: ReturnValue; parameters: { [name: string]: Param }; } diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts index 34b3eb28..061253f0 100644 --- a/src/extractor/api-json-generator.ts +++ b/src/extractor/api-json-generator.ts @@ -1,3 +1,4 @@ +import * as ts from "typescript"; import { ApiJsonGenerator as Generator, Extractor } from "@microsoft/api-extractor"; import ApiParameter from "@microsoft/api-extractor/lib/definitions/ApiParameter"; import ApiFunction from "@microsoft/api-extractor/lib/definitions/ApiFunction"; @@ -9,6 +10,7 @@ import { ApiJson } from "./api-json-contracts"; import { ApiItemKind } from "@microsoft/api-extractor/lib/definitions/ApiItem"; import ApiMethod from "@microsoft/api-extractor/lib/definitions/ApiMethod"; import { AccessModifier } from "@microsoft/api-extractor/lib/definitions/ApiMember"; +import ApiProperty from "@microsoft/api-extractor/lib/definitions/ApiProperty"; export class ApiJsonGenerator extends Generator { public GetFileContents(extractor: Extractor): ApiJson { @@ -39,6 +41,7 @@ export class ApiJsonGenerator extends Generator { const newNode: Object = { kind: ApiJsonFile.convertKindToJson(apiFunction.kind), + declarationLine: apiFunction.getDeclarationLine(), returnValue: returnValueNode, parameters: apiFunction.documentation.parameters, deprecatedMessage: apiFunction.documentation.deprecatedMessage || [], @@ -68,6 +71,7 @@ export class ApiJsonGenerator extends Generator { let newNode: Object; if (apiMethod.name === "__constructor") { newNode = { + declarationLine: apiMethod.getDeclarationLine(), kind: ApiJsonFile.convertKindToJson(ApiItemKind.Constructor), signature: apiMethod.getDeclarationLine(), parameters: apiMethod.documentation.parameters || {}, @@ -82,6 +86,7 @@ export class ApiJsonGenerator extends Generator { }; newNode = { + declarationLine: apiMethod.getDeclarationLine(), kind: ApiJsonFile.convertKindToJson(apiMethod.kind), signature: apiMethod.getDeclarationLine(), accessModifier: apiMethod.accessModifier ? AccessModifier[apiMethod.accessModifier].toLowerCase() : "", @@ -100,4 +105,31 @@ export class ApiJsonGenerator extends Generator { refObject[apiMethod.name] = newNode; } } + + protected visitApiProperty(apiProperty: ApiProperty, refObject?: { [key: string]: any }): void { + if (!apiProperty.supportedName) { + return; + } + + if (apiProperty.getDeclaration().kind === ts.SyntaxKind.SetAccessor) { + return; + } + + const newNode: Object = { + kind: ApiJsonFile.convertKindToJson(apiProperty.kind), + declarationLine: apiProperty.getDeclarationLine(), + isOptional: !!apiProperty.isOptional, + isReadOnly: !!apiProperty.isReadOnly, + isStatic: !!apiProperty.isStatic, + type: apiProperty.type, + deprecatedMessage: apiProperty.documentation.deprecatedMessage || [], + summary: apiProperty.documentation.summary || [], + remarks: apiProperty.documentation.remarks || [], + isBeta: apiProperty.documentation.releaseTag === ReleaseTag.Beta + }; + + if (refObject != null) { + refObject[apiProperty.name] = newNode; + } + } } diff --git a/src/generator/function-generator.ts b/src/generator/function-generator.ts index 0eee6649..099953a6 100644 --- a/src/generator/function-generator.ts +++ b/src/generator/function-generator.ts @@ -28,7 +28,7 @@ export namespace FunctionGenerator { md.push({ code: { language: "ts", - content: renderFunctionCode(name, memberFunction.parameters, memberFunction.returnValue) + content: memberFunction.declarationLine.replace("export ", "") } }); @@ -49,24 +49,7 @@ export namespace FunctionGenerator { return md; } - function renderFunctionCode(name: string, parameters: { [key: string]: Param }, returnValue?: ReturnValue): string { - const params: string[] = []; - let returnValueString: string = ""; - if (returnValue != null) { - returnValueString += `: ${returnValue.type}`; - } - - for (const parameterName in parameters) { - if (parameters.hasOwnProperty(parameterName)) { - const parameter = parameters[parameterName]; - const optional = (parameter.isOptional ? "?" : ""); - params.push(`${parameterName}${optional}: ${parameter.type}`); - } - } - - return `function ${name}(${params.join(", ")})${returnValueString}`; - } function renderFunctionParameters(parameters: { [key: string]: Param }): json2md.DataObject[] { const md: json2md.DataObject[] = [ diff --git a/src/generator/method-generator.ts b/src/generator/method-generator.ts index ac79b2b7..1922cbe2 100644 --- a/src/generator/method-generator.ts +++ b/src/generator/method-generator.ts @@ -28,7 +28,8 @@ export namespace MethodGenerator { md.push({ code: { language: "ts", - content: renderMethodCode(name, memberMethod, memberMethod.returnValue) + content: memberMethod.declarationLine + //content: renderMethodCode(name, memberMethod, memberMethod.returnValue) } }); @@ -49,26 +50,6 @@ export namespace MethodGenerator { return md; } - function renderMethodCode(name: string, memberMethod: MemberMethod, returnValue?: ReturnValue): string { - const params: string[] = []; - let returnValueString: string = ""; - - if (returnValue != null) { - returnValueString += `: ${returnValue.type}`; - } - - for (const parameterName in memberMethod.parameters) { - if (memberMethod.parameters.hasOwnProperty(parameterName)) { - const parameter = memberMethod.parameters[parameterName]; - const optional = (parameter.isOptional ? "?" : ""); - params.push(`${parameterName}${optional}: ${parameter.type}`); - } - } - - const staticString = (memberMethod.isStatic ? "static " : ""); - return `${staticString}${name}(${params.join(", ")})${returnValueString}`; - } - function renderMethodParameters(parameters: { [key: string]: Param }): json2md.DataObject[] { const md: json2md.DataObject[] = [ { diff --git a/src/generator/property-generator.ts b/src/generator/property-generator.ts index 3b3a48b6..bb38c4a6 100644 --- a/src/generator/property-generator.ts +++ b/src/generator/property-generator.ts @@ -24,14 +24,10 @@ export namespace PropertyGenerator { }); } - const staticProperty = (memberProperty.isStatic ? "static " : ""); - const readOnly = (memberProperty.isReadOnly ? "readonly " : ""); - const optional = (memberProperty.isOptional ? "?" : ""); - md.push({ code: { language: "ts", - content: `${staticProperty}${readOnly}${name}${optional}: ${memberProperty.type};` + content: memberProperty.declarationLine } }); From dab2d597ee1141f6dda8ed1df830a6473d7cc097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 2 Aug 2017 20:11:18 +0300 Subject: [PATCH 12/61] Removed comment. --- src/extractor/api-json-generator.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts index 061253f0..02c510d3 100644 --- a/src/extractor/api-json-generator.ts +++ b/src/extractor/api-json-generator.ts @@ -27,7 +27,6 @@ export class ApiJsonGenerator extends Generator { } for (const param of apiFunction.params) { - // FIXME: any if (apiFunction.documentation.parameters[param.name] == null) { apiFunction.documentation.parameters[param.name] = {} as any; } From f8f9cc70932d73e810095ba1776a63172f0b0966 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Wed, 15 Nov 2017 19:11:41 +0200 Subject: [PATCH 13/61] Removed all files and dependencies for rewriting. --- package.json | 17 +-- src/extractor/api-extractor.ts | 42 ------ src/extractor/api-json-contracts.ts | 112 ---------------- src/extractor/api-json-generator.ts | 134 ------------------- src/extractor/parse-config-host.ts | 22 ---- src/extractor/tsconfig-handler.ts | 13 -- src/generator/class-generator.ts | 117 ----------------- src/generator/enum-generator.ts | 72 ----------- src/generator/function-generator.ts | 87 ------------- src/generator/generator-contracts.ts | 6 - src/generator/helpers-generator.ts | 34 ----- src/generator/interface-generator.ts | 105 --------------- src/generator/markdown-generator.ts | 185 --------------------------- src/generator/method-generator.ts | 86 ------------- src/generator/property-generator.ts | 36 ------ test.md | 2 - 16 files changed, 6 insertions(+), 1064 deletions(-) delete mode 100644 src/extractor/api-extractor.ts delete mode 100644 src/extractor/api-json-contracts.ts delete mode 100644 src/extractor/api-json-generator.ts delete mode 100644 src/extractor/parse-config-host.ts delete mode 100644 src/extractor/tsconfig-handler.ts delete mode 100644 src/generator/class-generator.ts delete mode 100644 src/generator/enum-generator.ts delete mode 100644 src/generator/function-generator.ts delete mode 100644 src/generator/generator-contracts.ts delete mode 100644 src/generator/helpers-generator.ts delete mode 100644 src/generator/interface-generator.ts delete mode 100644 src/generator/markdown-generator.ts delete mode 100644 src/generator/method-generator.ts delete mode 100644 src/generator/property-generator.ts delete mode 100644 test.md diff --git a/package.json b/package.json index 005df205..c88aca73 100644 --- a/package.json +++ b/package.json @@ -10,19 +10,14 @@ }, "author": "", "dependencies": { - "@microsoft/api-extractor": "^2.3.1", - "@types/json2md": "^1.5.0", - "@types/mz": "0.0.31", - "json2md": "^1.5.8", - "mz": "^2.6.0", - "typescript": "^2.4.2" + "typescript": "^2.6.1" }, "devDependencies": { - "@types/jest": "^20.0.5", - "@types/sinon": "^2.3.3", - "jest": "^20.0.4", - "sinon": "^2.4.1", - "ts-jest": "^20.0.7" + "@types/jest": "^21.1.6", + "@types/sinon": "^4.0.0", + "jest": "^21.2.1", + "sinon": "^4.1.2", + "ts-jest": "^21.2.2" }, "jest": { "transform": { diff --git a/src/extractor/api-extractor.ts b/src/extractor/api-extractor.ts deleted file mode 100644 index e47c0021..00000000 --- a/src/extractor/api-extractor.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as ts from "typescript"; -import { Extractor, ApiErrorHandler } from "@microsoft/api-extractor"; -import { ApiJsonGenerator } from "./api-json-generator"; -import { ApiJson } from "./api-json-contracts"; - -export class APIExtractor { - private extractor: Extractor; - - constructor(private compilerOptions: ts.CompilerOptions, apiErrorHandler?: ApiErrorHandler) { - /** - * We need to ignore @types in these tests - * @see https://github.com/Microsoft/web-build-tools/wiki/API-Extractor-~-Enabling-for-your-project - */ - this.compilerOptions.typeRoots = ["./"]; - - this.extractor = new Extractor({ - compilerOptions: this.compilerOptions, - errorHandler: apiErrorHandler - }); - } - - /** - * Invoke the compiler engine to perform semantic analysis, - * and then build up the API Extractor data set. - * @param entryPoint The entry point for your project - * @param otherFiles Any other implicitly included files, e.g. typings/tsd.d.ts is sometimes needed here - */ - public Analyze(entryPoint: string, otherFiles: string[]): void { - this.extractor.analyze({ - entryPointFile: entryPoint, - otherFiles: otherFiles - }); - } - - /** - * Generates JSON. - */ - public GetJSON(): ApiJson { - const apiJsonGenerator = new ApiJsonGenerator(); - return apiJsonGenerator.GetFileContents(this.extractor); - } -} diff --git a/src/extractor/api-json-contracts.ts b/src/extractor/api-json-contracts.ts deleted file mode 100644 index 55b71a67..00000000 --- a/src/extractor/api-json-contracts.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { IReturn, IParam as Param } from "@microsoft/api-extractor/lib/IDocElement"; - -export { - Param -}; - -export interface ApiJson { - kind: "package"; - summary: ItemValue[]; - remarks: ItemValue[]; - exports: { [name: string]: Members }; -} - -export interface DefaultInfo { - deprecatedMessage: any[]; - summary: ItemValue[]; - remarks: ItemValue[]; - isBeta: boolean; -} - -export interface ReturnValue { - /** - * Examples: "string", "void" - */ - type: string; - description: ItemValue[]; -} - -export interface ItemValue { - kind: string; - value: string; -} - -export interface MemberList { - "interface": MemberInterface; - "property": MemberProperty; - "namespace": MemberNamespace; - "enum": MemberEnum; - "class": MemberClass; - "function": MemberFunction; -} - -export type Members = MemberInterface | MemberProperty | MemberNamespace | MemberEnum | MemberClass | MemberFunction; -export type InterfaceMembers = MemberProperty | MemberMethod; - -export interface MemberInterface extends DefaultInfo { - kind: "interface"; - extends: string; - implements: string; - typeParameters: any[]; - members: { [member: string]: InterfaceMembers }; -} - -export interface MemberProperty extends DefaultInfo { - kind: "property"; - declarationLine: string; - /** - * Examples: "string", "void" - */ - type: string; - isOptional: boolean; - isReadOnly: boolean; - isStatic: boolean; -} - -export interface MemberMethod extends DefaultInfo { - kind: "method"; - declarationLine: string; - /** - * Example: 'public Method(arg: string): void;' - */ - signature: string; - /** - * Example: "public" - */ - accessModifier: string; - isOptional: boolean; - isStatic: boolean; - returnValue: ReturnValue; - parameters: { [key: string]: Param }; -} - -export interface MemberNamespace extends DefaultInfo { - kind: "namespace"; - deprecatedMessage: any[]; - exports: { [members: string]: Members }; -} - -export interface MemberEnum extends DefaultInfo { - kind: "enum"; - values: { [enumValue: string]: MemberEnumValue }; -} - -export interface MemberEnumValue extends DefaultInfo { - kind: "enum value"; - value: string; -} - -export interface MemberClass extends DefaultInfo { - kind: "class"; - extends: string; - implements: string; - typeParameters: any[]; - members: { [member: string]: MemberProperty | MemberMethod }; -} - -export interface MemberFunction extends DefaultInfo { - kind: "function"; - declarationLine: string; - returnValue: ReturnValue; - parameters: { [name: string]: Param }; -} diff --git a/src/extractor/api-json-generator.ts b/src/extractor/api-json-generator.ts deleted file mode 100644 index 02c510d3..00000000 --- a/src/extractor/api-json-generator.ts +++ /dev/null @@ -1,134 +0,0 @@ -import * as ts from "typescript"; -import { ApiJsonGenerator as Generator, Extractor } from "@microsoft/api-extractor"; -import ApiParameter from "@microsoft/api-extractor/lib/definitions/ApiParameter"; -import ApiFunction from "@microsoft/api-extractor/lib/definitions/ApiFunction"; -import { ReleaseTag } from "@microsoft/api-extractor/lib/definitions/ApiDocumentation"; -import ApiJsonFile from "@microsoft/api-extractor/lib/generators/ApiJsonFile"; -import { IReturn, IParam } from "@microsoft/api-extractor/lib/IDocElement"; - -import { ApiJson } from "./api-json-contracts"; -import { ApiItemKind } from "@microsoft/api-extractor/lib/definitions/ApiItem"; -import ApiMethod from "@microsoft/api-extractor/lib/definitions/ApiMethod"; -import { AccessModifier } from "@microsoft/api-extractor/lib/definitions/ApiMember"; -import ApiProperty from "@microsoft/api-extractor/lib/definitions/ApiProperty"; - -export class ApiJsonGenerator extends Generator { - public GetFileContents(extractor: Extractor): ApiJson { - this.visit(extractor.package, this.jsonOutput); - - // TODO: Add JSON validation scheme. - - return this.jsonOutput as ApiJson; - } - - protected visitApiFunction(apiFunction: ApiFunction, refObject?: { [key: string]: any }): void { - if (!apiFunction.supportedName) { - return; - } - - for (const param of apiFunction.params) { - if (apiFunction.documentation.parameters[param.name] == null) { - apiFunction.documentation.parameters[param.name] = {} as any; - } - - this.visitApiParam(param, apiFunction.documentation.parameters[param.name]); - } - const returnValueNode: IReturn = { - type: apiFunction.returnType, - description: apiFunction.documentation.returnsMessage - }; - - const newNode: Object = { - kind: ApiJsonFile.convertKindToJson(apiFunction.kind), - declarationLine: apiFunction.getDeclarationLine(), - returnValue: returnValueNode, - parameters: apiFunction.documentation.parameters, - deprecatedMessage: apiFunction.documentation.deprecatedMessage || [], - summary: apiFunction.documentation.summary || [], - remarks: apiFunction.documentation.remarks || [], - isBeta: apiFunction.documentation.releaseTag === ReleaseTag.Beta - }; - - if (refObject != null) { - refObject[apiFunction.name] = newNode; - } - } - - protected visitApiMethod(apiMethod: ApiMethod, refObject?: { [key: string]: any }): void { - if (!apiMethod.supportedName) { - return; - } - - for (const param of apiMethod.params) { - if (apiMethod.documentation.parameters[param.name] == null) { - apiMethod.documentation.parameters[param.name] = {} as any; - } - - this.visitApiParam(param, apiMethod.documentation.parameters[param.name]); - } - - let newNode: Object; - if (apiMethod.name === "__constructor") { - newNode = { - declarationLine: apiMethod.getDeclarationLine(), - kind: ApiJsonFile.convertKindToJson(ApiItemKind.Constructor), - signature: apiMethod.getDeclarationLine(), - parameters: apiMethod.documentation.parameters || {}, - deprecatedMessage: apiMethod.documentation.deprecatedMessage || [], - summary: apiMethod.documentation.summary || [], - remarks: apiMethod.documentation.remarks || [] - }; - } else { - const returnValueNode: IReturn = { - type: apiMethod.returnType, - description: apiMethod.documentation.returnsMessage - }; - - newNode = { - declarationLine: apiMethod.getDeclarationLine(), - kind: ApiJsonFile.convertKindToJson(apiMethod.kind), - signature: apiMethod.getDeclarationLine(), - accessModifier: apiMethod.accessModifier ? AccessModifier[apiMethod.accessModifier].toLowerCase() : "", - isOptional: !!apiMethod.isOptional, - isStatic: !!apiMethod.isStatic, - returnValue: returnValueNode, - parameters: apiMethod.documentation.parameters, - deprecatedMessage: apiMethod.documentation.deprecatedMessage || [], - summary: apiMethod.documentation.summary || [], - remarks: apiMethod.documentation.remarks || [], - isBeta: apiMethod.documentation.releaseTag === ReleaseTag.Beta - }; - } - - if (refObject != null) { - refObject[apiMethod.name] = newNode; - } - } - - protected visitApiProperty(apiProperty: ApiProperty, refObject?: { [key: string]: any }): void { - if (!apiProperty.supportedName) { - return; - } - - if (apiProperty.getDeclaration().kind === ts.SyntaxKind.SetAccessor) { - return; - } - - const newNode: Object = { - kind: ApiJsonFile.convertKindToJson(apiProperty.kind), - declarationLine: apiProperty.getDeclarationLine(), - isOptional: !!apiProperty.isOptional, - isReadOnly: !!apiProperty.isReadOnly, - isStatic: !!apiProperty.isStatic, - type: apiProperty.type, - deprecatedMessage: apiProperty.documentation.deprecatedMessage || [], - summary: apiProperty.documentation.summary || [], - remarks: apiProperty.documentation.remarks || [], - isBeta: apiProperty.documentation.releaseTag === ReleaseTag.Beta - }; - - if (refObject != null) { - refObject[apiProperty.name] = newNode; - } - } -} diff --git a/src/extractor/parse-config-host.ts b/src/extractor/parse-config-host.ts deleted file mode 100644 index 9fb238ad..00000000 --- a/src/extractor/parse-config-host.ts +++ /dev/null @@ -1,22 +0,0 @@ -import * as fs from "fs"; -import * as ts from "typescript"; - -export class ParseConfigHost implements ts.ParseConfigHost { - public useCaseSensitiveFileNames: boolean = true; - - public readFile(path: string): string { - return ts.sys.readFile(path); - } - - public readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[] { - return ts.sys.readDirectory(rootDir, extensions, excludes, includes); - } - - /** - * Gets a value indicating whether the specified path exists and is a file. - * @param path The path to test. - */ - public fileExists(path: string): boolean { - return fs.existsSync(path); - } -} diff --git a/src/extractor/tsconfig-handler.ts b/src/extractor/tsconfig-handler.ts deleted file mode 100644 index ec919e99..00000000 --- a/src/extractor/tsconfig-handler.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as fs from "mz/fs"; -import * as path from "path"; -import * as ts from "typescript"; - -// TODO: Fool proof. -export async function GetCompilerOptions(fileLocation: string): Promise { - const rawContent = await fs.readFile(fileLocation, "utf-8"); - const json = JSON.parse(rawContent); - - const compilerOptions = ts.convertCompilerOptionsFromJson(json.compilerOptions, path.dirname(fileLocation)); - - return compilerOptions.options; -} diff --git a/src/generator/class-generator.ts b/src/generator/class-generator.ts deleted file mode 100644 index d4595688..00000000 --- a/src/generator/class-generator.ts +++ /dev/null @@ -1,117 +0,0 @@ -import * as json2md from "json2md"; - -import { - ApiJson, - Members, - MemberClass, - MemberProperty, - MemberMethod -} from "../extractor/api-json-contracts"; -import { HelpersGenerator } from "./helpers-generator"; -import { PropertyGenerator } from "./property-generator"; -import { MethodGenerator } from "./method-generator"; - -export namespace ClassGenerator { - export function RenderClass(name: string, memberClass: MemberClass): json2md.DataObject[] { - let md: json2md.DataObject[] = [ - { - h3: name - } - ]; - - // Summary - if (memberClass.summary.length !== 0) { - md.push({ - p: memberClass.summary.map(x => x.value).join("\n") - }); - } - - // Remarks - if (memberClass.remarks.length !== 0) { - md.push({ - p: memberClass.remarks.map(x => x.value).join("\n") - }); - } - - // Extends - if (memberClass.extends !== "") { - md = md.concat(HelpersGenerator.RenderExtends(memberClass.extends)); - } - - // Implements - if (memberClass.implements !== "") { - md = md.concat(HelpersGenerator.RenderImplements(memberClass.implements)); - } - - const properties: { [name: string]: MemberProperty } = {}; - const methods: { [name: string]: MemberMethod } = {}; - for (const memberKey in memberClass.members) { - if (memberClass.members.hasOwnProperty(memberKey)) { - const member = memberClass.members[memberKey]; - switch (member.kind) { - case "method": - methods[memberKey] = member; - break; - case "property": - properties[memberKey] = member; - break; - } - } - } - - md = md.concat(renderProperties(properties)); - md = md.concat(renderMethods(methods)); - - return md; - } - - function renderProperties(properties: { [name: string]: MemberProperty }): json2md.DataObject[] { - let md: json2md.DataObject[] = [ - { - h4: "Properties" - } - ]; - - let list: json2md.DataObject[] = []; - - for (const propertyName in properties) { - if (properties.hasOwnProperty(propertyName)) { - const memberProperty = properties[propertyName]; - list = list.concat(PropertyGenerator.RenderProperty(propertyName, memberProperty)); - } - } - - if (list.length === 0) { - return []; - } - - md = md.concat(list); - - return md; - } - - function renderMethods(methods: { [name: string]: MemberMethod }): json2md.DataObject[] { - let md: json2md.DataObject[] = [ - { - h4: "Methods" - } - ]; - - let list: json2md.DataObject[] = []; - - for (const methodName in methods) { - if (methods.hasOwnProperty(methodName)) { - const memberMethod = methods[methodName]; - list = list.concat(MethodGenerator.RenderMethod(methodName, memberMethod)); - } - } - - if (list.length === 0) { - return []; - } - - md = md.concat(list); - - return md; - } -} diff --git a/src/generator/enum-generator.ts b/src/generator/enum-generator.ts deleted file mode 100644 index 78c7537d..00000000 --- a/src/generator/enum-generator.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as json2md from "json2md"; -import { MemberEnum, MemberEnumValue } from "../extractor/api-json-contracts"; -import { HelpersGenerator } from "./helpers-generator"; -import { Table } from "./generator-contracts"; - -export namespace EnumGenerator { - export function RenderEnum(name: string, memberEnum: MemberEnum): json2md.DataObject[] { - const md: json2md.DataObject[] = [ - { - h3: name - } - ]; - - // Summary - if (memberEnum.summary.length !== 0) { - md.push({ - p: memberEnum.summary.map(x => x.value) - }); - } - - // Remarks - if (memberEnum.remarks.length !== 0) { - md.push({ - p: memberEnum.remarks.map(x => x.value) - }); - } - - // Table of values - md.push({ - table: renderEnumValues(memberEnum.values) - }); - - return md; - } - - function renderEnumValues(members: { [member: string]: MemberEnumValue }): Table { - const table: Table = { - headers: ["Name", "Value", "Summary"], - rows: [] - }; - - for (const memberKey in members) { - if (members.hasOwnProperty(memberKey)) { - const member = members[memberKey]; - const row: string[] = [ - memberKey, - member.value, - member.summary.map(x => x.value).join(".") - ]; - - table.rows.push(row); - } - } - - // Sort rows by values - table.rows.sort((x, y) => { - const xValue = x[1]; - const yValue = y[1]; - if (isNumberCheck(xValue) && isNumberCheck(yValue)) { - return xValue - yValue; - } - - return 0; - }); - - return table; - } - - function isNumberCheck(a: string | number): a is number { - return isFinite(a as number); - } -} diff --git a/src/generator/function-generator.ts b/src/generator/function-generator.ts deleted file mode 100644 index 099953a6..00000000 --- a/src/generator/function-generator.ts +++ /dev/null @@ -1,87 +0,0 @@ -import * as json2md from "json2md"; - -import { MemberFunction, Param, ReturnValue } from "../extractor/api-json-contracts"; -import { HelpersGenerator } from "./helpers-generator"; - -export namespace FunctionGenerator { - export function RenderFunction(name: string, memberFunction: MemberFunction): json2md.DataObject[] { - let md: json2md.DataObject[] = [ - { - h3: name - } - ]; - - // Summary - if (memberFunction.summary.length !== 0) { - md.push({ - p: memberFunction.summary.map(x => x.value).join("\n") - }); - } - - // Remarks - if (memberFunction.remarks.length !== 0) { - md.push({ - p: memberFunction.remarks.map(x => x.value).join("\n") - }); - } - - md.push({ - code: { - language: "ts", - content: memberFunction.declarationLine.replace("export ", "") - } - }); - - // Parameters - md = md.concat(renderFunctionParameters(memberFunction.parameters)); - - // Returns value - const returnValueDesc = memberFunction.returnValue.description.map(x => x.value).join("."); - md = md.concat([ - { - h4: "Returns" - }, - { - p: `${HelpersGenerator.InlineCode(memberFunction.returnValue.type)} ${returnValueDesc}` - } - ]); - - return md; - } - - - - function renderFunctionParameters(parameters: { [key: string]: Param }): json2md.DataObject[] { - const md: json2md.DataObject[] = [ - { - h4: "Parameters" - } - ]; - const parametersList: string[] = []; - - for (const parameterName in parameters) { - if (parameters.hasOwnProperty(parameterName)) { - const parameter = parameters[parameterName]; - const optional = (parameter.isOptional ? "?" : ""); - const line: string = `${parameterName}${optional}: ${HelpersGenerator.InlineCode(parameter.type)}`; - - // FIXME: When there is description on this param. - // if (parameter.description != null) { - // // line += ` - ${parameter.description.map(x => x.}` - // } - - parametersList.push(line); - } - } - - if (parametersList.length === 0) { - return []; - } - - md.push({ - ul: parametersList - }); - - return md; - } -} diff --git a/src/generator/generator-contracts.ts b/src/generator/generator-contracts.ts deleted file mode 100644 index 77ead72b..00000000 --- a/src/generator/generator-contracts.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as json2md from "json2md"; - -export interface Table extends json2md.DefaultConverters.TableInput { - headers: string[]; - rows: string[][]; -} diff --git a/src/generator/helpers-generator.ts b/src/generator/helpers-generator.ts deleted file mode 100644 index 4a768189..00000000 --- a/src/generator/helpers-generator.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as json2md from "json2md"; - -export namespace HelpersGenerator { - export function RenderExtends(what: string): json2md.DataObject[] { - return [ - { - p: `${Bold("Extends")} ${InlineCode(what)}` - } - ]; - } - - export function RenderImplements(what: string): json2md.DataObject[] { - return [ - { - p: `${Bold("Implements")} ${InlineCode(what)}` - } - ]; - } - - export function Bold(text: string): string { - return `__${text}__`; - } - - export function InlineCode(text?: string): string { - if (text == null) { - return ""; - } - return `\`${text}\``; - } - - export function BreakLine(): string { - return "--------------------------------"; - } -} diff --git a/src/generator/interface-generator.ts b/src/generator/interface-generator.ts deleted file mode 100644 index d7d431e2..00000000 --- a/src/generator/interface-generator.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as json2md from "json2md"; -import { MemberInterface, InterfaceMembers, MemberMethod } from "../extractor/api-json-contracts"; -import { HelpersGenerator } from "./helpers-generator"; -import { Table } from "./generator-contracts"; - -export namespace InterfaceGenerator { - export function RenderInterface(name: string, memberInterface: MemberInterface): json2md.DataObject[] { - let md: json2md.DataObject[] = [ - { - h3: name - } - ]; - - // Summary - if (memberInterface.summary.length !== 0) { - md.push({ - p: memberInterface.summary.map(x => x.value) - }); - } - - // Remarks - if (memberInterface.remarks.length !== 0) { - md.push({ - p: memberInterface.remarks.map(x => x.value) - }); - } - - // Extends - if (memberInterface.extends !== "") { - md = md.concat(HelpersGenerator.RenderExtends(memberInterface.extends)); - } - - // Implements - if (memberInterface.implements !== "") { - md = md.concat(HelpersGenerator.RenderImplements(memberInterface.implements)); - } - - // Table of members - md.push({ - table: renderInterfaceMembers(memberInterface.members) - }); - - return md; - } - - function renderInterfaceMembers(members: { [member: string]: InterfaceMembers }): Table { - const table: Table = { - headers: ["Name", "Type", "Summary"], - rows: [] - }; - - for (const memberName in members) { - if (members.hasOwnProperty(memberName)) { - const member = members[memberName]; - let row: string[] = []; - const optional = (member.isOptional ? "" : "*"); - - // TODO: Add remarks - switch (member.kind) { - case "method": - row = [ - `${renderMethodString(memberName, member)}${optional}`, - // TODO: Return type description - (member.returnValue != null ? member.returnValue.type : "void"), - member.summary.map(x => x.value).join(".") - ]; - break; - case "property": - row = [ - `${memberName}${optional}`, - member.type, - member.summary.map(x => x.value).join(".") - ]; - break; - } - - table.rows.push(row); - } - } - - return table; - } - - function renderMethodString(name: string, method: MemberMethod): string { - const parametersList: string[] = []; - const optionalName = (method.isOptional ? "?" : ""); - - for (const parameterName in method.parameters) { - if (method.parameters.hasOwnProperty(parameterName)) { - const parameter = method.parameters[parameterName]; - const optional = (parameter.isOptional ? "?" : ""); - const line: string = `${parameterName}${optional}: ${HelpersGenerator.InlineCode(parameter.type)}`; - - // FIXME: When there is description on this param. - // if (parameter.description != null) { - // // line += ` - ${parameter.description.map(x => x.}` - // } - - parametersList.push(line); - } - } - - return `${name}${optionalName}(${parametersList.join(", ")}) `; - } -} diff --git a/src/generator/markdown-generator.ts b/src/generator/markdown-generator.ts deleted file mode 100644 index 27341805..00000000 --- a/src/generator/markdown-generator.ts +++ /dev/null @@ -1,185 +0,0 @@ -import * as json2md from "json2md"; - -import { - ApiJson, - Members, - MemberList, - MemberInterface, - MemberEnum, - MemberProperty, - MemberFunction, - MemberClass -} from "../extractor/api-json-contracts"; - -import { HelpersGenerator } from "./helpers-generator"; - -import { InterfaceGenerator } from "./interface-generator"; -import { EnumGenerator } from "./enum-generator"; -import { PropertyGenerator } from "./property-generator"; -import { FunctionGenerator } from "./function-generator"; -import { ClassGenerator } from "./class-generator"; - -type MembersDict = { - [key in keyof MemberList]: { [key: string]: MemberList[key] }; -}; - -export class MarkdownGenerator { - private markdown: json2md.DataObject[] = []; - - constructor(protected Json: ApiJson) { - // this.Json.exports - this.renderPackage(Json); - this.renderMembers(Json.exports); - } - - public Render(): string { - return json2md(this.markdown); - } - - private renderMembers(members: { [key: string]: Members }): void { - const dict: MembersDict = { - enum: {}, - interface: {}, - function: {}, - property: {}, - class: {}, - namespace: {} - }; - - // Filter - for (const memberKey in members) { - if (members.hasOwnProperty(memberKey)) { - const member = members[memberKey]; - dict[member.kind][memberKey] = member; - } - } - - this.markdown = this.markdown.concat(this.renderInterfaces(dict.interface)); - this.markdown = this.markdown.concat(this.renderEnums(dict.enum)); - this.markdown = this.markdown.concat(this.renderFunctions(dict.function)); - this.markdown = this.markdown.concat(this.renderClass(dict.class)); - } - - private renderPackage(pckg: ApiJson): void { - const md: json2md.DataObject[] = [ - { - h1: "Package name" - } - ]; - - // Package summary. - if (pckg.summary.length !== 0) { - md.push({ - p: pckg.summary.map(x => x.value).join("\n") - }); - } - - this.markdown = this.markdown.concat(md); - } - - private renderInterfaces(interfaces: { [key: string]: MemberInterface }): json2md.DataObject[] { - if (Object.keys(interfaces).length === 0) { - return []; - } - - let md: json2md.DataObject[] = [ - { - h2: "Interfaces" - } - ]; - - for (const interfaceKey in interfaces) { - if (interfaces.hasOwnProperty(interfaceKey)) { - const memberInterface = interfaces[interfaceKey]; - md = md.concat(InterfaceGenerator.RenderInterface(interfaceKey, memberInterface)); - } - } - - return md; - } - - private renderEnums(enums: { [key: string]: MemberEnum }): json2md.DataObject[] { - if (Object.keys(enums).length === 0) { - return []; - } - - let md: json2md.DataObject[] = [ - { - h2: "Enums" - } - ]; - - for (const enumKey in enums) { - if (enums.hasOwnProperty(enumKey)) { - const memberEnum = enums[enumKey]; - md = md.concat(EnumGenerator.RenderEnum(enumKey, memberEnum)); - } - } - - return md; - } - - private renderFunctions(functions: { [key: string]: MemberFunction }): json2md.DataObject[] { - if (Object.keys(functions).length === 0) { - return []; - } - - let md: json2md.DataObject[] = [ - { - h2: "Functions" - } - ]; - - for (const functionKey in functions) { - if (functions.hasOwnProperty(functionKey)) { - const memberFunction = functions[functionKey]; - md = md.concat(FunctionGenerator.RenderFunction(functionKey, memberFunction)); - } - } - - return md; - } - - private renderClass(classes: { [key: string]: MemberClass }): json2md.DataObject[] { - const names = Object.keys(classes); - if (names.length === 0) { - return []; - } - - let md: json2md.DataObject[] = [ - { - h2: "Classes" - } - ]; - - for (const className in classes) { - if (classes.hasOwnProperty(className)) { - const memberClass = classes[className]; - md = md.concat(ClassGenerator.RenderClass(className, memberClass)); - } - } - - return md; - } - - // private renderProperties(properties: { [key: string]: MemberProperty }): json2md.DataObject[] { - // if (Object.keys(properties).length === 0) { - // return []; - // } - - // let md: json2md.DataObject[] = [ - // { - // h2: "Properties" - // } - // ]; - - // for (const enumKey in properties) { - // if (properties.hasOwnProperty(enumKey)) { - // const memberProperty = properties[enumKey]; - // md = md.concat(PropertyGenerator.RenderProperty(enumKey, memberProperty)); - // } - // } - - // return md; - // } -} diff --git a/src/generator/method-generator.ts b/src/generator/method-generator.ts deleted file mode 100644 index 1922cbe2..00000000 --- a/src/generator/method-generator.ts +++ /dev/null @@ -1,86 +0,0 @@ -import * as json2md from "json2md"; - -import { MemberMethod, Param, ReturnValue } from "../extractor/api-json-contracts"; -import { HelpersGenerator } from "./helpers-generator"; - -export namespace MethodGenerator { - export function RenderMethod(name: string, memberMethod: MemberMethod): json2md.DataObject[] { - let md: json2md.DataObject[] = [ - { - h5: name - } - ]; - - // Summary - if (memberMethod.summary.length !== 0) { - md.push({ - p: memberMethod.summary.map(x => x.value).join("\n") - }); - } - - // Remarks - if (memberMethod.remarks.length !== 0) { - md.push({ - p: memberMethod.remarks.map(x => x.value).join("\n") - }); - } - - md.push({ - code: { - language: "ts", - content: memberMethod.declarationLine - //content: renderMethodCode(name, memberMethod, memberMethod.returnValue) - } - }); - - // Parameters - md = md.concat(renderMethodParameters(memberMethod.parameters)); - - // Returns value - const returnValueDesc = memberMethod.returnValue.description.map(x => x.value).join("."); - md = md.concat([ - { - h6: "Returns" - }, - { - p: `${HelpersGenerator.InlineCode(memberMethod.returnValue.type)} ${returnValueDesc}` - } - ]); - - return md; - } - - function renderMethodParameters(parameters: { [key: string]: Param }): json2md.DataObject[] { - const md: json2md.DataObject[] = [ - { - h6: "Parameters" - } - ]; - const parametersList: string[] = []; - - for (const parameterName in parameters) { - if (parameters.hasOwnProperty(parameterName)) { - const parameter = parameters[parameterName]; - const optional = (parameter.isOptional ? "?" : ""); - const line: string = `${parameterName}${optional}: ${HelpersGenerator.InlineCode(parameter.type)}`; - - // FIXME: When there is description on this param. - // if (parameter.description != null) { - // // line += ` - ${parameter.description.map(x => x.}` - // } - - parametersList.push(line); - } - } - - if (parametersList.length === 0) { - return []; - } - - md.push({ - ul: parametersList - }); - - return md; - } -} diff --git a/src/generator/property-generator.ts b/src/generator/property-generator.ts deleted file mode 100644 index bb38c4a6..00000000 --- a/src/generator/property-generator.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as json2md from "json2md"; - -import { MemberProperty } from "../extractor/api-json-contracts"; - -export namespace PropertyGenerator { - export function RenderProperty(name: string, memberProperty: MemberProperty): json2md.DataObject[] { - const md: json2md.DataObject[] = [ - { - h5: name - } - ]; - - // Summary - if (memberProperty.summary.length !== 0) { - md.push({ - p: memberProperty.summary.map(x => x.value).join("\n") - }); - } - - // Remarks - if (memberProperty.remarks.length !== 0) { - md.push({ - p: memberProperty.remarks.map(x => x.value).join("\n") - }); - } - - md.push({ - code: { - language: "ts", - content: memberProperty.declarationLine - } - }); - - return md; - } -} diff --git a/test.md b/test.md deleted file mode 100644 index 7a4682cc..00000000 --- a/test.md +++ /dev/null @@ -1,2 +0,0 @@ -# Package name -## Interfaces \ No newline at end of file From ee41bc360f104ea32cdfaf812694ba6fb4047db3 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Wed, 15 Nov 2017 19:12:55 +0200 Subject: [PATCH 14/61] Added dependencies. --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c88aca73..c58fcd07 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,10 @@ }, "author": "", "dependencies": { - "typescript": "^2.6.1" + "typescript": "^2.6.1", + "fs-extra": "^4.0.2", + "@types/fs-extra": "^4.0.5", + "ts-extractor": "^0.1.0" }, "devDependencies": { "@types/jest": "^21.1.6", From 49fca96482e16c8157273d3d4988bae751225aa5 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Wed, 15 Nov 2017 19:14:56 +0200 Subject: [PATCH 15/61] Removed tests. --- __tests__/assets/example-1/index.ts | 100 ------ __tests__/assets/example-1/package.json | 5 - .../assets/example-1/tsconfig.example.json | 30 -- __tests__/index.test.ts | 50 +-- __tests__/test.json | 329 ------------------ __tests__/test.md | 88 ----- __tests__/tsconfig.json | 27 -- 7 files changed, 2 insertions(+), 627 deletions(-) delete mode 100644 __tests__/assets/example-1/index.ts delete mode 100644 __tests__/assets/example-1/package.json delete mode 100644 __tests__/assets/example-1/tsconfig.example.json delete mode 100644 __tests__/test.json delete mode 100644 __tests__/test.md delete mode 100644 __tests__/tsconfig.json diff --git a/__tests__/assets/example-1/index.ts b/__tests__/assets/example-1/index.ts deleted file mode 100644 index 1148a3dd..00000000 --- a/__tests__/assets/example-1/index.ts +++ /dev/null @@ -1,100 +0,0 @@ -/** - * @public - */ -export interface Foo { - Name: string; - Surname: string; -} - -/** - * @public - */ -export interface Bar extends Foo { - Email: string; - /** - * Get Bar model code by id. - * Another line of summary. - */ - GetCode?(id: number): string; -} - -/** - * @public - */ -export class FooBar { - protected LocalBar: Bar; - - /** - * Hello Foo summary - */ - public Foo: string = "Hello"; - - public GetSomething(): string { - return "Something"; - } - - /** - * Summary of SetBar method. - */ - public SetBar(bar: Bar): void { - this.LocalBar = bar; - } -} - -/** - * @public - */ -export class FancyFooBar extends FooBar { - public get Bar(): Bar { - return this.LocalBar; - } -} - -/** - * @public - */ -export enum Test { - None = 0, - Warning = 8, - Error = 100 -} - -/** - * @public - */ -export enum EventType { - Live = "live", - Test = "test" -} - -/** - * Sum summary - * @param a - First number - * @param b - Second number - * @returns Return summary. - * @public - */ -export function Sum(a: number, b: number): number { - return a + b; -} - -/** - * Package version. - * @public - */ -export const version = 2.11; - -/** - * @public - */ -export namespace CoolStuff { - /** - * Yet another sum function. - * @public - */ - export function YetAnotherSumFunc(x: number, y: number): number { - return x + y; - } - - export const a: string = "aa"; -} diff --git a/__tests__/assets/example-1/package.json b/__tests__/assets/example-1/package.json deleted file mode 100644 index 1a88750e..00000000 --- a/__tests__/assets/example-1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "example-1", - "main": "dist/index.js", - "types": "dist/index.d.ts" -} diff --git a/__tests__/assets/example-1/tsconfig.example.json b/__tests__/assets/example-1/tsconfig.example.json deleted file mode 100644 index 2b4f89eb..00000000 --- a/__tests__/assets/example-1/tsconfig.example.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "removeComments": false, - "noEmit": true, - "rootDir": "./", - "jsx": "react", - "sourceMap": true, - "skipDefaultLibCheck": true, - "declaration": true, - "pretty": true, - "strict": true, - "lib": [ - "dom", - "dom.iterable", - "es6" - ], - "typeRoots": [ - "../../../node_modules/@types" - ] - }, - "exclude": [ - "node_modules", - "dist", - "@types", - "__tests__", - "tools" - ] -} diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index 15dabc66..b19c71f9 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,49 +1,3 @@ -import * as path from "path"; -import * as sinon from "sinon"; -import * as fs from "mz/fs"; -import { APIExtractor } from "../src/extractor/api-extractor"; -import { GetCompilerOptions } from "../src/extractor/tsconfig-handler"; -import { MarkdownGenerator } from "../src/generator/markdown-generator"; - -const ENTRY_POINT_1 = path.join(__dirname, "./assets/example-1/index.ts"); - -it("Generate JSON", async done => { - try { - const stubCallback = sinon.stub(); - const compilerOptions = await GetCompilerOptions(path.resolve(__dirname, "./assets/example-1/tsconfig.example.json")); - const extractor = new APIExtractor(compilerOptions, stubCallback); - extractor.Analyze(ENTRY_POINT_1, []); - const json = extractor.GetJSON(); - - expect(json).toBeDefined(); - expect(stubCallback.called).toBe(false); - - await fs.writeFile(path.join(__dirname, "./test.json"), JSON.stringify(json, undefined, 4), "utf8"); - } catch (error) { - done.fail(error); - return; - } - - done(); -}); - -it("Generating MD", async done => { - try { - const compilerOptions = await GetCompilerOptions(path.resolve(__dirname, "./assets/example-1/tsconfig.example.json")); - const extractor = new APIExtractor(compilerOptions); - extractor.Analyze(ENTRY_POINT_1, []); - const json = extractor.GetJSON(); - - const markdownGenerator = new MarkdownGenerator(json); - const md: string = markdownGenerator.Render(); - - expect(typeof md).toBe("string"); - - await fs.writeFile(path.join(__dirname, "./test.md"), md, "utf8"); - } catch (error) { - done.fail(error); - return; - } - - done(); +it("Hello World", () => { + expect(true).toBe(true); }); diff --git a/__tests__/test.json b/__tests__/test.json deleted file mode 100644 index a05e8c52..00000000 --- a/__tests__/test.json +++ /dev/null @@ -1,329 +0,0 @@ -{ - "kind": "package", - "summary": [], - "remarks": [], - "exports": { - "Bar": { - "kind": "interface", - "extends": "Foo", - "implements": "", - "typeParameters": [], - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false, - "members": { - "Email": { - "kind": "property", - "declarationLine": "Email: string;", - "isOptional": false, - "isReadOnly": false, - "isStatic": false, - "type": "string", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "GetCode": { - "declarationLine": "GetCode ?(id: number): string;", - "kind": "method", - "signature": "GetCode ?(id: number): string;", - "accessModifier": "", - "isOptional": true, - "isStatic": false, - "returnValue": { - "type": "string", - "description": [] - }, - "parameters": { - "id": { - "isOptional": false, - "isSpread": false, - "type": "number" - } - }, - "deprecatedMessage": [], - "summary": [ - { - "kind": "textDocElement", - "value": "Get Bar model code by id. Another line of summary." - } - ], - "remarks": [], - "isBeta": false - } - } - }, - "CoolStuff": { - "kind": "namespace", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false, - "exports": { - "a": { - "kind": "module variable", - "type": "string", - "value": "\"aa\"", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - } - } - }, - "EventType": { - "kind": "enum", - "values": { - "Live": { - "kind": "enum value", - "value": "\"live\"", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "Test": { - "kind": "enum value", - "value": "\"test\"", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - } - }, - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "FancyFooBar": { - "kind": "class", - "extends": "FooBar", - "implements": "", - "typeParameters": [], - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false, - "members": { - "Bar": { - "kind": "property", - "declarationLine": "public readonly Bar: Bar;", - "isOptional": false, - "isReadOnly": true, - "isStatic": false, - "type": "Bar", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - } - } - }, - "Foo": { - "kind": "interface", - "extends": "", - "implements": "", - "typeParameters": [], - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false, - "members": { - "Name": { - "kind": "property", - "declarationLine": "Name: string;", - "isOptional": false, - "isReadOnly": false, - "isStatic": false, - "type": "string", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "Surname": { - "kind": "property", - "declarationLine": "Surname: string;", - "isOptional": false, - "isReadOnly": false, - "isStatic": false, - "type": "string", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - } - } - }, - "FooBar": { - "kind": "class", - "extends": "", - "implements": "", - "typeParameters": [], - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false, - "members": { - "Foo": { - "kind": "property", - "declarationLine": "public Foo: string;", - "isOptional": false, - "isReadOnly": false, - "isStatic": false, - "type": "string", - "deprecatedMessage": [], - "summary": [ - { - "kind": "textDocElement", - "value": "Hello Foo summary" - } - ], - "remarks": [], - "isBeta": false - }, - "GetSomething": { - "declarationLine": "public GetSomething(): string;", - "kind": "method", - "signature": "public GetSomething(): string;", - "accessModifier": "public", - "isOptional": false, - "isStatic": false, - "returnValue": { - "type": "string", - "description": [] - }, - "parameters": {}, - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "LocalBar": { - "kind": "property", - "declarationLine": "protected LocalBar: Bar;", - "isOptional": false, - "isReadOnly": false, - "isStatic": false, - "type": "Bar", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "SetBar": { - "declarationLine": "public SetBar(bar: Bar): void;", - "kind": "method", - "signature": "public SetBar(bar: Bar): void;", - "accessModifier": "public", - "isOptional": false, - "isStatic": false, - "returnValue": { - "type": "void", - "description": [] - }, - "parameters": { - "bar": { - "isOptional": false, - "isSpread": false, - "type": "Bar" - } - }, - "deprecatedMessage": [], - "summary": [ - { - "kind": "textDocElement", - "value": "Summary of SetBar method." - } - ], - "remarks": [], - "isBeta": false - } - } - }, - "Sum": { - "kind": "function", - "declarationLine": "export function Sum(a: number, b: number): number;", - "returnValue": { - "type": "number", - "description": [ - { - "kind": "textDocElement", - "value": "Return summary." - } - ] - }, - "parameters": { - "a": { - "name": "a", - "description": [ - { - "kind": "textDocElement", - "value": "First number" - } - ], - "isOptional": false, - "isSpread": false, - "type": "number" - }, - "b": { - "name": "b", - "description": [ - { - "kind": "textDocElement", - "value": "Second number" - } - ], - "isOptional": false, - "isSpread": false, - "type": "number" - } - }, - "deprecatedMessage": [], - "summary": [ - { - "kind": "textDocElement", - "value": "Sum summary" - } - ], - "remarks": [], - "isBeta": false - }, - "Test": { - "kind": "enum", - "values": { - "Error": { - "kind": "enum value", - "value": "100", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "None": { - "kind": "enum value", - "value": "0", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - }, - "Warning": { - "kind": "enum value", - "value": "8", - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - } - }, - "deprecatedMessage": [], - "summary": [], - "remarks": [], - "isBeta": false - } - } -} \ No newline at end of file diff --git a/__tests__/test.md b/__tests__/test.md deleted file mode 100644 index c689fe6e..00000000 --- a/__tests__/test.md +++ /dev/null @@ -1,88 +0,0 @@ -# Package name -## Interfaces -### Bar - -__Extends__ `Foo` - -Name | Type | Summary ---- | --- | --- -Email* | string | -GetCode?(id: `number`) | string | Get Bar model code by id. Another line of summary. -### Foo -Name | Type | Summary ---- | --- | --- -Name* | string | -Surname* | string | -## Enums -### EventType -Name | Value | Summary ---- | --- | --- -Live | "live" | -Test | "test" | -### Test -Name | Value | Summary ---- | --- | --- -None | 0 | -Warning | 8 | -Error | 100 | -## Functions -### Sum - -Sum summary - -```ts -function Sum(a: number, b: number): number; -``` -#### Parameters - - - a: `number` - - b: `number` -#### Returns - -`number` Return summary. - -## Classes -### FancyFooBar - -__Extends__ `FooBar` - -#### Properties -##### Bar -```ts -public readonly Bar: Bar; -``` -### FooBar -#### Properties -##### Foo - -Hello Foo summary - -```ts -public Foo: string; -``` -##### LocalBar -```ts -protected LocalBar: Bar; -``` -#### Methods -##### GetSomething -```ts -public GetSomething(): string; -``` -###### Returns - -`string` - -##### SetBar - -Summary of SetBar method. - -```ts -public SetBar(bar: Bar): void; -``` -###### Parameters - - - bar: `Bar` -###### Returns - -`void` diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json deleted file mode 100644 index 34e2eb51..00000000 --- a/__tests__/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es5", - "removeComments": false, - "jsx": "react", - "sourceMap": false, - "skipDefaultLibCheck": true, - "declaration": true, - "declarationDir": "@types", - "pretty": true, - "strict": true, - "noEmit": true, - "noUnusedLocals": true, - "lib": [ - "dom", - "dom.iterable", - "es6" - ] - }, - "exclude": [ - "node_modules", - "dist", - "@types", - "__tests__" - ] -} \ No newline at end of file From 891de6eaedab7312b0786fe45a5f2ad6cd6df9ed Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Fri, 24 Nov 2017 12:33:17 +0200 Subject: [PATCH 16/61] WIP. --- __tests__/index.test.ts | 6 +- __tests__/tsconfig.json | 34 ++++++ examples/simple/exported-const-variables.ts | 3 + examples/simple/exported-functions.ts | 7 ++ examples/simple/index.ts | 117 ++++++++++++++++++++ examples/simple/my-types.ts | 3 + examples/simple/package.json | 6 + examples/simple/tsconfig.json | 25 +++++ package.json | 9 +- src/api-item-printer.ts | 38 +++++++ src/contracts/generator-options.ts | 7 ++ src/debug.ts | 22 ++++ src/extractor-helpers.ts | 3 + src/file-registry.ts | 11 ++ src/generator.ts | 15 +++ src/helpers.ts | 8 ++ src/index.ts | 23 +++- tsconfig.json | 25 +++-- 18 files changed, 348 insertions(+), 14 deletions(-) create mode 100644 __tests__/tsconfig.json create mode 100644 examples/simple/exported-const-variables.ts create mode 100644 examples/simple/exported-functions.ts create mode 100644 examples/simple/index.ts create mode 100644 examples/simple/my-types.ts create mode 100644 examples/simple/package.json create mode 100644 examples/simple/tsconfig.json create mode 100644 src/api-item-printer.ts create mode 100644 src/contracts/generator-options.ts create mode 100644 src/debug.ts create mode 100644 src/extractor-helpers.ts create mode 100644 src/file-registry.ts create mode 100644 src/generator.ts create mode 100644 src/helpers.ts diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index b19c71f9..a0fc5597 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,3 +1,5 @@ -it("Hello World", () => { - expect(true).toBe(true); +describe("debug", () => { + it("Returns a callable thing", () => { + + }); }); diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json new file mode 100644 index 00000000..48e57492 --- /dev/null +++ b/__tests__/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "removeComments": false, + "sourceMap": false, + "skipDefaultLibCheck": true, + "pretty": true, + "noEmit": true, + "experimentalDecorators": false, + "baseUrl": "./", + "typeRoots": [ + "../" + ], + "types": [ + "jest", + "typescript", + "node" + ], + "lib": [ + "es6", + "dom" + ], + "paths": { + "@src/*": [ + "../src/*" + ] + }, + "rootDirs": [ + "./", + "../src" + ] + } +} diff --git a/examples/simple/exported-const-variables.ts b/examples/simple/exported-const-variables.ts new file mode 100644 index 00000000..140d0134 --- /dev/null +++ b/examples/simple/exported-const-variables.ts @@ -0,0 +1,3 @@ +export const Kintamasis = "Hello World!"; +export const Kintamasis2 = "Hello World!"; +export const Kintamasis3 = "Not imported!"; diff --git a/examples/simple/exported-functions.ts b/examples/simple/exported-functions.ts new file mode 100644 index 00000000..6d5cdcfa --- /dev/null +++ b/examples/simple/exported-functions.ts @@ -0,0 +1,7 @@ +export function Foo(): string { + return "foo"; +} + +export function Bar(): string { + return "bar"; +} diff --git a/examples/simple/index.ts b/examples/simple/index.ts new file mode 100644 index 00000000..fc335410 --- /dev/null +++ b/examples/simple/index.ts @@ -0,0 +1,117 @@ +// tslint:disable + +// import { MyInterface } from "./my-types"; + +// export function Foo(): string { +// return "foo"; +// } + +// export function Bar(): string { +// return "bar"; +// } + +// export * from "./exported-functions"; +// export { Kintamasis as Pakeistas } from "./exported-const-variables"; +// export type A = number & { ok(): TValue }; + +// Two types have a one common field +// export type OneCommonField1 = { +// BarName: string; +// FooName: string; +// }; + +// export type OneCommonField2 = { +// BarName: string; +// BazName: string; +// }; + +// export type OneCommonFieldTypeIntersection = OneCommonField1 | OneCommonField2; + +// export interface MyConstraintType { +// myProperty: string; +// } +// export interface MyDefaultType extends MyConstraintType { +// anotherProperty: number; +// } + +// export function Funkcija(): T { +// return { +// myProperty: "asd" +// } as T; +// } + +// export interface MyInterface { +// (param1: TValue, param2: TValue): boolean; +// } + +/** + * Some JSdoc information. + * 2nd line of some JSdoc information. + * @summary Some summary about this package version. + * @summary 2nd of some summary about this package version. + */ +// export const itemsList: string[] = ["a"]; + +// export function Ok(isIt: boolean): boolean { +// return isIt; +// } + +// export function OkWithoutReturnType(isIt: boolean) { +// return isIt; +// } + +// export namespace SomeKindOfModule { +// export const name = "some-kind-of-module"; +// } + +// export enum Uogos { +// Jokie = "jokie", +// Braskes = "braskes" +// } + +// export enum Skaiciai { +// Nulis = 0, +// Vienas = 1, +// Du = 2 +// } + +// export enum Sarasas { +// Pirmas, +// Antras, +// Trecias +// } + +// export interface Boo { +// Boos: string[]; +// } + +// export interface Foo { +// Name: string; +// Surname: string; +// Type: TType; +// } + +export async function GetFoo(): Promise { + return; +} + +// export interface Bar extends Foo, Boo { +// OtherStuff: string[]; +// } + +// export interface A { +// (aa: boolean): string; +// } + +// export abstract class Foo { +// public Name: string; + +// private somePrivateProperty: any; + +// public GetName(ok: string): string; +// public GetName(ok: string, ok2?: string): string { +// return this.Name; +// } + +// public abstract Bar(): string; +// } diff --git a/examples/simple/my-types.ts b/examples/simple/my-types.ts new file mode 100644 index 00000000..8295ca0d --- /dev/null +++ b/examples/simple/my-types.ts @@ -0,0 +1,3 @@ +export interface MyInterface { + foo: string; +} \ No newline at end of file diff --git a/examples/simple/package.json b/examples/simple/package.json new file mode 100644 index 00000000..c6cd7a97 --- /dev/null +++ b/examples/simple/package.json @@ -0,0 +1,6 @@ +{ + "name": "simple", + "dependencies": { + "react": "^15.6.1" + } +} diff --git a/examples/simple/tsconfig.json b/examples/simple/tsconfig.json new file mode 100644 index 00000000..f2f986af --- /dev/null +++ b/examples/simple/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "removeComments": false, + "outDir": "dist", + "rootDir": ".", + "sourceMap": false, + "skipDefaultLibCheck": true, + "declaration": true, + "pretty": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ] + }, + "exclude": [ + "node_modules", + "dist", + "@types", + "__tests__" + ] +} diff --git a/package.json b/package.json index c58fcd07..05c74142 100644 --- a/package.json +++ b/package.json @@ -8,19 +8,20 @@ "test-watch": "jest --watchAll", "build": "tsc -p ." }, + "engine": "node >= 7.5.0", "author": "", "dependencies": { - "typescript": "^2.6.1", - "fs-extra": "^4.0.2", "@types/fs-extra": "^4.0.5", - "ts-extractor": "^0.1.0" + "fs-extra": "^4.0.2", + "ts-extractor": "^1.0.0", + "typescript": "^2.6.1" }, "devDependencies": { "@types/jest": "^21.1.6", "@types/sinon": "^4.0.0", "jest": "^21.2.1", "sinon": "^4.1.2", - "ts-jest": "^21.2.2" + "ts-jest": "^21.2.3" }, "jest": { "transform": { diff --git a/src/api-item-printer.ts b/src/api-item-printer.ts new file mode 100644 index 00000000..4a7d3dcc --- /dev/null +++ b/src/api-item-printer.ts @@ -0,0 +1,38 @@ +import { Contracts, ExtractedApiRegistry } from "ts-extractor"; + +export namespace ApiItemPrinter { + export function ApiCallToString(apiItem: Contracts.ApiCallDto, itemRegistry: ExtractedApiRegistry): string { + const parameters: string[] = []; + const returnType: string = ""; + + for (const item of apiItem.Parameters) { + const [itemName, references] = item; + + const targetApIItem = itemRegistry[references[0]] as Contracts.ApiParameterDto; + + parameters.push(ApiParameterToString(targetApIItem, itemRegistry)); + } + + return `new(${parameters.join(", ")}): ${returnType};`; + } + + export function ApiParameterToString(apiItem: Contracts.ApiParameterDto, itemRegistry: ExtractedApiRegistry): string { + const isSpread = IsSpread(apiItem.IsSpread); + const isOptional = IsOptional(apiItem.IsOptional); + const type = TypeDtoToString(apiItem.Type); + + return `${isSpread}${apiItem.Name}${isOptional}: ${type}`; + } + + export function TypeDtoToString(type: Contracts.TypeDto): string { + return type.Text; + } + + export function IsSpread(isSpread: boolean): string { + return isSpread ? "..." : ""; + } + + export function IsOptional(isOptional: boolean): string { + return isOptional ? "?" : ""; + } +} diff --git a/src/contracts/generator-options.ts b/src/contracts/generator-options.ts new file mode 100644 index 00000000..f695b2f8 --- /dev/null +++ b/src/contracts/generator-options.ts @@ -0,0 +1,7 @@ +import { Contracts } from "ts-extractor"; + +export interface GeneratorOptions { + // TODO: Implement Plugins system. + Plugins: string[]; + ExtractorOptions: Contracts.ExtractorOptions; +} diff --git a/src/debug.ts b/src/debug.ts new file mode 100644 index 00000000..cc002c5e --- /dev/null +++ b/src/debug.ts @@ -0,0 +1,22 @@ +import * as path from "path"; +import * as process from "process"; +import { Extractor, GetCompilerOptions } from "ts-extractor"; + +async function Main(): Promise { + // Full path to projectDirectory + const projectDirectory = process.cwd(); + const pathToTsconfig = path.join(projectDirectory, "./tsconfig.json"); + + const compilerOptions = await GetCompilerOptions(pathToTsconfig); + + const extractor = new Extractor({ + CompilerOptions: compilerOptions, + ProjectDirectory: projectDirectory, + Exclude: [] + }); + + const extractedOutput = extractor.Extract(["./src/index.ts", "./src/another-entry-file.ts"]); + console.log(extractedOutput); +} + +Main(); diff --git a/src/extractor-helpers.ts b/src/extractor-helpers.ts new file mode 100644 index 00000000..cbf83744 --- /dev/null +++ b/src/extractor-helpers.ts @@ -0,0 +1,3 @@ +export namespace ExtractorHelpers { + +} diff --git a/src/file-registry.ts b/src/file-registry.ts new file mode 100644 index 00000000..bbde1dca --- /dev/null +++ b/src/file-registry.ts @@ -0,0 +1,11 @@ +export interface RegistryItem { + UsedReferences: string[]; + Content: string[]; +} + +/** + * Markdown files registry. + */ +export class FileRegistry { + +} diff --git a/src/generator.ts b/src/generator.ts new file mode 100644 index 00000000..747894fa --- /dev/null +++ b/src/generator.ts @@ -0,0 +1,15 @@ +import { Extractor, ExtractDto } from "ts-extractor"; +import { GeneratorOptions } from "./contracts/generator-options"; + +export class Generator { + constructor(options: GeneratorOptions) { + this.extractor = new Extractor(options.ExtractorOptions); + } + + private extractor: Extractor; + + public Generate(files: string[], targetPath: string): void { + const extractedData: ExtractDto = this.extractor.Extract(files); + + } +} diff --git a/src/helpers.ts b/src/helpers.ts new file mode 100644 index 00000000..21f94106 --- /dev/null +++ b/src/helpers.ts @@ -0,0 +1,8 @@ +import { Contracts } from "ts-extractor"; +import { GeneratorOptions } from "./contracts/generator-options"; + +export namespace Helpers { + export function VisitApiItem(apiItem: Contracts.ApiItemDto, options: GeneratorOptions): void { + + } +} diff --git a/src/index.ts b/src/index.ts index bf6b8179..ffb02801 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,22 @@ -console.log("Hello"); +import * as path from "path"; + +import { GetCompilerOptions } from "ts-extractor"; +import { Generator } from "./generator"; + +async function main(): Promise { + const projectDirectory = path.resolve(__dirname, "../examples/simple/"); + const compilerOptions = await GetCompilerOptions(path.join(projectDirectory, "tsconfig.json")); + + const generator = new Generator({ + ExtractorOptions: { + CompilerOptions: compilerOptions, + ProjectDirectory: projectDirectory, + Exclude: [] + }, + Plugins: [] + }); + + generator.Generate(["./index.ts"], path.join()); +} + +main(); diff --git a/tsconfig.json b/tsconfig.json index 0353c4b6..82ceb171 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,29 +1,40 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "removeComments": false, "outDir": "dist", "rootDir": "src", - "sourceMap": false, + "inlineSourceMap": true, + "inlineSources": true, "skipDefaultLibCheck": true, "declaration": true, "pretty": true, "strict": true, "forceConsistentCasingInFileNames": true, + "noUnusedLocals": true, "lib": [ - "es5", - "es2015.promise", - "dom" + "es6", + "es2017.object" + ], + "types": [ + "node" ], "typeRoots": [ "./node_modules/@types" - ] + ], + "baseUrl": ".", + "paths": { + "*": [ + "@types/*" + ] + } }, "exclude": [ "node_modules", "dist", "@types", - "__tests__" + "tests", + "examples" ] } From e8ff98ec1f747e4904c0158776dbfab71ef47295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 28 Nov 2017 15:32:47 +0200 Subject: [PATCH 17/61] Added .vscode. --- .gitignore | 2 ++ .vscode/cSpell.json | 19 +++++++++++++++++++ .vscode/launch.json | 19 +++++++++++++++++++ .vscode/settings.json | 12 ++++++++++++ .vscode/tasks.json | 15 +++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 .vscode/cSpell.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index 4d3b9949..81d6fdbd 100644 --- a/.gitignore +++ b/.gitignore @@ -267,3 +267,5 @@ package-lock.json **/webpack.config.js **/*.js.map + +_src diff --git a/.vscode/cSpell.json b/.vscode/cSpell.json new file mode 100644 index 00000000..5594aef4 --- /dev/null +++ b/.vscode/cSpell.json @@ -0,0 +1,19 @@ +// cSpell Settings +{ + // Version of the setting file. Always 0.1 + "version": "0.1", + // language - current active spelling language + "language": "en", + // words - list of words to be always considered correct + "words": [ + "AGPL", + "loglevel", + "simplrjs" + ], + // flagWords - list of words to be always considered incorrect + // This is useful for offensive words and common spelling errors. + // For example "hte" should be "the" + "flagWords": [ + "hte" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..2adcae64 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,19 @@ +{ + // Use IntelliSense to learn about possible Node.js debug attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "preLaunchTask": "build", + "program": "${workspaceRoot}\\src\\debug.ts", + "outFiles": [ + "${workspaceRoot}\\dist\\**\\*.js" + ], + "sourceMaps": true + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..75ded211 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "eslint.enable": false, + "typescript.tsdk": "node_modules\\typescript\\lib", + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "tests/**/__tests__/**/*.test.ts": true + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..8a9f166d --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "npm", + "script": "build", + "problemMatcher": [ + "$tsc" + ] + } + ] +} From 2dad1a5edb6b2170e3b3c748cb239db23c343c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 28 Nov 2017 15:32:58 +0200 Subject: [PATCH 18/61] Removed old files. --- package.json | 2 +- src/abstractions/api-item-plugin-base.ts | 11 +++++++ src/api-item-printer.ts | 38 ------------------------ src/contracts/generator-options.ts | 7 ----- src/contracts/render-output-dto.ts | 7 +++++ src/debug.ts | 23 +------------- src/extractor-helpers.ts | 3 -- src/file-registry.ts | 11 ------- src/generator.ts | 15 ---------- src/helpers.ts | 8 ----- src/index.ts | 22 -------------- 11 files changed, 20 insertions(+), 127 deletions(-) create mode 100644 src/abstractions/api-item-plugin-base.ts delete mode 100644 src/api-item-printer.ts delete mode 100644 src/contracts/generator-options.ts create mode 100644 src/contracts/render-output-dto.ts delete mode 100644 src/extractor-helpers.ts delete mode 100644 src/file-registry.ts delete mode 100644 src/generator.ts delete mode 100644 src/helpers.ts diff --git a/package.json b/package.json index 05c74142..93868367 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dependencies": { "@types/fs-extra": "^4.0.5", "fs-extra": "^4.0.2", - "ts-extractor": "^1.0.0", + "ts-extractor": "^1.1.1", "typescript": "^2.6.1" }, "devDependencies": { diff --git a/src/abstractions/api-item-plugin-base.ts b/src/abstractions/api-item-plugin-base.ts new file mode 100644 index 00000000..02cf2f00 --- /dev/null +++ b/src/abstractions/api-item-plugin-base.ts @@ -0,0 +1,11 @@ +import { Contracts } from "ts-extractor"; + +import { RenderOutputDto } from "../contracts/render-output-dto"; + +export abstract class ApiItemPluginBase { + public abstract SupportedApiItems(): Contracts.ApiItemDto[]; + + public abstract CheckApiItem(item: Contracts.ApiItemDto): boolean; + + public abstract Render(item: Contracts.ApiItemDto): RenderOutputDto; +} diff --git a/src/api-item-printer.ts b/src/api-item-printer.ts deleted file mode 100644 index 4a7d3dcc..00000000 --- a/src/api-item-printer.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Contracts, ExtractedApiRegistry } from "ts-extractor"; - -export namespace ApiItemPrinter { - export function ApiCallToString(apiItem: Contracts.ApiCallDto, itemRegistry: ExtractedApiRegistry): string { - const parameters: string[] = []; - const returnType: string = ""; - - for (const item of apiItem.Parameters) { - const [itemName, references] = item; - - const targetApIItem = itemRegistry[references[0]] as Contracts.ApiParameterDto; - - parameters.push(ApiParameterToString(targetApIItem, itemRegistry)); - } - - return `new(${parameters.join(", ")}): ${returnType};`; - } - - export function ApiParameterToString(apiItem: Contracts.ApiParameterDto, itemRegistry: ExtractedApiRegistry): string { - const isSpread = IsSpread(apiItem.IsSpread); - const isOptional = IsOptional(apiItem.IsOptional); - const type = TypeDtoToString(apiItem.Type); - - return `${isSpread}${apiItem.Name}${isOptional}: ${type}`; - } - - export function TypeDtoToString(type: Contracts.TypeDto): string { - return type.Text; - } - - export function IsSpread(isSpread: boolean): string { - return isSpread ? "..." : ""; - } - - export function IsOptional(isOptional: boolean): string { - return isOptional ? "?" : ""; - } -} diff --git a/src/contracts/generator-options.ts b/src/contracts/generator-options.ts deleted file mode 100644 index f695b2f8..00000000 --- a/src/contracts/generator-options.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Contracts } from "ts-extractor"; - -export interface GeneratorOptions { - // TODO: Implement Plugins system. - Plugins: string[]; - ExtractorOptions: Contracts.ExtractorOptions; -} diff --git a/src/contracts/render-output-dto.ts b/src/contracts/render-output-dto.ts new file mode 100644 index 00000000..fc09f641 --- /dev/null +++ b/src/contracts/render-output-dto.ts @@ -0,0 +1,7 @@ +import { Contracts } from "ts-extractor"; + +export interface RenderOutputDto { + References: string[]; + RenderOutput: string[]; + ApiItem: Contracts.ApiItemDto; +} diff --git a/src/debug.ts b/src/debug.ts index cc002c5e..1bc789f0 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -1,22 +1 @@ -import * as path from "path"; -import * as process from "process"; -import { Extractor, GetCompilerOptions } from "ts-extractor"; - -async function Main(): Promise { - // Full path to projectDirectory - const projectDirectory = process.cwd(); - const pathToTsconfig = path.join(projectDirectory, "./tsconfig.json"); - - const compilerOptions = await GetCompilerOptions(pathToTsconfig); - - const extractor = new Extractor({ - CompilerOptions: compilerOptions, - ProjectDirectory: projectDirectory, - Exclude: [] - }); - - const extractedOutput = extractor.Extract(["./src/index.ts", "./src/another-entry-file.ts"]); - console.log(extractedOutput); -} - -Main(); +// This is debug file. DO NOT include in compiled package. diff --git a/src/extractor-helpers.ts b/src/extractor-helpers.ts deleted file mode 100644 index cbf83744..00000000 --- a/src/extractor-helpers.ts +++ /dev/null @@ -1,3 +0,0 @@ -export namespace ExtractorHelpers { - -} diff --git a/src/file-registry.ts b/src/file-registry.ts deleted file mode 100644 index bbde1dca..00000000 --- a/src/file-registry.ts +++ /dev/null @@ -1,11 +0,0 @@ -export interface RegistryItem { - UsedReferences: string[]; - Content: string[]; -} - -/** - * Markdown files registry. - */ -export class FileRegistry { - -} diff --git a/src/generator.ts b/src/generator.ts deleted file mode 100644 index 747894fa..00000000 --- a/src/generator.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Extractor, ExtractDto } from "ts-extractor"; -import { GeneratorOptions } from "./contracts/generator-options"; - -export class Generator { - constructor(options: GeneratorOptions) { - this.extractor = new Extractor(options.ExtractorOptions); - } - - private extractor: Extractor; - - public Generate(files: string[], targetPath: string): void { - const extractedData: ExtractDto = this.extractor.Extract(files); - - } -} diff --git a/src/helpers.ts b/src/helpers.ts deleted file mode 100644 index 21f94106..00000000 --- a/src/helpers.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Contracts } from "ts-extractor"; -import { GeneratorOptions } from "./contracts/generator-options"; - -export namespace Helpers { - export function VisitApiItem(apiItem: Contracts.ApiItemDto, options: GeneratorOptions): void { - - } -} diff --git a/src/index.ts b/src/index.ts index ffb02801..e69de29b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,22 +0,0 @@ -import * as path from "path"; - -import { GetCompilerOptions } from "ts-extractor"; -import { Generator } from "./generator"; - -async function main(): Promise { - const projectDirectory = path.resolve(__dirname, "../examples/simple/"); - const compilerOptions = await GetCompilerOptions(path.join(projectDirectory, "tsconfig.json")); - - const generator = new Generator({ - ExtractorOptions: { - CompilerOptions: compilerOptions, - ProjectDirectory: projectDirectory, - Exclude: [] - }, - Plugins: [] - }); - - generator.Generate(["./index.ts"], path.join()); -} - -main(); From ab42e7da22dadc7e249ef842482e7a10e42410e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Tue, 28 Nov 2017 15:49:44 +0200 Subject: [PATCH 19/61] Added simplr-logger. --- package.json | 1 + src/utils/logger.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 src/utils/logger.ts diff --git a/package.json b/package.json index 93868367..bf07809a 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "dependencies": { "@types/fs-extra": "^4.0.5", "fs-extra": "^4.0.2", + "simplr-logger": "^1.0.0", "ts-extractor": "^1.1.1", "typescript": "^2.6.1" }, diff --git a/src/utils/logger.ts b/src/utils/logger.ts new file mode 100644 index 00000000..55b1a36d --- /dev/null +++ b/src/utils/logger.ts @@ -0,0 +1,7 @@ +import { LoggerBuilder, LoggerConfigurationBuilder, LogLevel } from "simplr-logger"; + +const LoggerConfiguration = new LoggerConfigurationBuilder() + .SetDefaultLogLevel(LogLevel.Trace) + .Build(); + +export const Logger = new LoggerBuilder(LoggerConfiguration); From 8fe8b3d0706e4e351e3fa3a27c9f5d1f1c970666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Tue, 28 Nov 2017 16:26:46 +0200 Subject: [PATCH 20/61] Added fast-glob package. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index bf07809a..66b8cf07 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "author": "", "dependencies": { "@types/fs-extra": "^4.0.5", + "fast-glob": "^1.0.1", "fs-extra": "^4.0.2", "simplr-logger": "^1.0.0", "ts-extractor": "^1.1.1", From 8bcf5beb5cc4311a3851f4e5aebf01004f2bfec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Tue, 28 Nov 2017 17:45:21 +0200 Subject: [PATCH 21/61] Added tests-generator. --- tests/.gitignore | 2 ++ tests/build-tests.ts | 37 ++++++++++++++++++++++++ tests/scripts/tests-cleanup.ts | 18 ++++++++++++ tests/scripts/tests-generator.ts | 49 ++++++++++++++++++++++++++++++++ tests/scripts/tests-helpers.ts | 18 ++++++++++++ tests/tsconfig.json | 34 ++++++++++++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 tests/.gitignore create mode 100644 tests/build-tests.ts create mode 100644 tests/scripts/tests-cleanup.ts create mode 100644 tests/scripts/tests-generator.ts create mode 100644 tests/scripts/tests-helpers.ts create mode 100644 tests/tsconfig.json diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 00000000..e25e147d --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,2 @@ +*/__tests__/* +!*/__tests__/**/__snapshots__ diff --git a/tests/build-tests.ts b/tests/build-tests.ts new file mode 100644 index 00000000..d16e9291 --- /dev/null +++ b/tests/build-tests.ts @@ -0,0 +1,37 @@ +import * as os from "os"; +import * as process from "process"; +import * as fs from "fs-extra"; +import { Logger } from "../src/utils/logger"; + +import { TestsGenerator } from "./scripts/tests-generator"; +import { TestsCleanup } from "./scripts/tests-cleanup"; +import { TESTS_DIR_NAME } from "./scripts/tests-helpers"; + +async function StartWatcher(dirName: string): Promise { + return fs.watch(`./${dirName}/`, async (event, fileName) => { + if (fileName.indexOf(TESTS_DIR_NAME) === -1) { + Logger.Info(`Test file was changed in "${dirName}/${fileName}".`); + const startBuild = Logger.Info(`Building tests for "${dirName}"...`); + await TestsGenerator(dirName, __dirname); + Logger.Debug(`Builded tests after ${(Date.now() - startBuild)}ms`); + } + }); +} + +(async (dirNames: string[]) => { + Logger.Info("Starting test builder..."); + for (const dirName of dirNames) { + const startRemove = Logger.Info(`Removing old tests from "${dirName}"...`); + await TestsCleanup(dirName); + Logger.Debug(`Removed old tests after ${(Date.now() - startRemove)}ms`); + + const startBuild = Logger.Info(`Building tests for "${dirName}"...`); + await TestsGenerator(dirName, __dirname); + Logger.Debug(`Builded tests after ${(Date.now() - startBuild)}ms`); + + if (process.argv.indexOf("--watchAll") !== -1) { + Logger.Info(`Started watching "${dirName}" tests.`); + StartWatcher(dirName); + } + } +})(["cases"]); diff --git a/tests/scripts/tests-cleanup.ts b/tests/scripts/tests-cleanup.ts new file mode 100644 index 00000000..6c7664f4 --- /dev/null +++ b/tests/scripts/tests-cleanup.ts @@ -0,0 +1,18 @@ +import * as path from "path"; +import * as fs from "fs-extra"; +import fastGlob from "fast-glob"; + +import { TESTS_DIR_NAME, TESTS_SNAPSHOTS_DIR_NAME } from "../scripts/tests-helpers"; + +export async function TestsCleanup(dirName: string): Promise { + const oldTestFiles = await fastGlob([ + `./${dirName}/${TESTS_DIR_NAME}/*.*`, + `./${dirName}/${TESTS_DIR_NAME}/**/`, + `!./${dirName}/**/${TESTS_SNAPSHOTS_DIR_NAME}/`, + `!./${dirName}/${TESTS_DIR_NAME}/` + ]); + + for (const pathname of oldTestFiles) { + await fs.remove(pathname); + } +} diff --git a/tests/scripts/tests-generator.ts b/tests/scripts/tests-generator.ts new file mode 100644 index 00000000..b0713b34 --- /dev/null +++ b/tests/scripts/tests-generator.ts @@ -0,0 +1,49 @@ +import * as os from "os"; +import * as path from "path"; +import * as fs from "fs-extra"; +import fastGlob from "fast-glob"; +import * as ts from "typescript"; + +import { FixSep, Tab, TESTS_DIR_NAME } from "./tests-helpers"; + +export const EXTRACTOR_COMPILER_OPTIONS: ts.CompilerOptions = { + target: ts.ScriptTarget.Latest, + module: ts.ModuleKind.CommonJS, + skipLibCheck: true, + skipDefaultLibCheck: true +}; + +export async function TestsGenerator(dirName: string, cwd: string): Promise { + const filesList = await fastGlob([ + `./${dirName}/**/*.ts`, + `!./${dirName}/${TESTS_DIR_NAME}/**/*` + ]); + + for (const file of filesList) { + const { dir, name, base, ext } = path.parse(file); + + const moduleName = FixSep(path.join(dir, base)); + + const testDescribe = [ + `import { Extractor } from "@src/extractor";`, + "", + `test("${name}", () => {`, + Tab(1) + `const moduleName = "./${moduleName}";`, + Tab(1) + `const projectDirectory = "${FixSep(cwd)}";`, + "", + Tab(1) + `const extractor = new Extractor({`, + Tab(2) + `CompilerOptions: ${JSON.stringify(EXTRACTOR_COMPILER_OPTIONS, undefined, Tab(3))},`, + Tab(2) + `ProjectDirectory: projectDirectory`, + Tab(1) + `});`, + "", + Tab(1) + `expect(extractor.Extract([moduleName])).toMatchSnapshot();`, + `});`, + "" + ].join(os.EOL); + + const targetDirectory = path.join(dir, "__tests__"); + await fs.ensureDir(targetDirectory); + const targetFilePathname = path.join(targetDirectory, `${name}.test${ext}`); + await fs.writeFile(targetFilePathname, testDescribe); + } +} diff --git a/tests/scripts/tests-helpers.ts b/tests/scripts/tests-helpers.ts new file mode 100644 index 00000000..c3b4eea2 --- /dev/null +++ b/tests/scripts/tests-helpers.ts @@ -0,0 +1,18 @@ +import * as path from "path"; + +const TAB_STRING = " "; + +export function FixSep(pathname: string): string { + return pathname.split(path.sep).join("/"); +} + +export function Tab(size: number = 1): string { + let result: string = ""; + for (let i = 0; i < size; i++) { + result += TAB_STRING; + } + return result; +} + +export const TESTS_DIR_NAME = "__tests__"; +export const TESTS_SNAPSHOTS_DIR_NAME = "__snapshots__"; diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 00000000..48e57492 --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "removeComments": false, + "sourceMap": false, + "skipDefaultLibCheck": true, + "pretty": true, + "noEmit": true, + "experimentalDecorators": false, + "baseUrl": "./", + "typeRoots": [ + "../" + ], + "types": [ + "jest", + "typescript", + "node" + ], + "lib": [ + "es6", + "dom" + ], + "paths": { + "@src/*": [ + "../src/*" + ] + }, + "rootDirs": [ + "./", + "../src" + ] + } +} From 75f8d8cd9df4c09426ab7f281dd40b829355492d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 28 Nov 2017 18:27:29 +0200 Subject: [PATCH 22/61] Created GeneratorConfigurationBuilder. --- package.json | 2 +- src/abstractions/api-item-plugin-base.ts | 3 +- .../generator-configuration-builder.ts | 94 +++++++++++++++++++ src/contracts/generator-configuration.ts | 20 ++++ src/contracts/supported-api-item-kind-type.ts | 7 ++ src/managers/plugin-manager.ts | 37 ++++++++ 6 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 src/builders/generator-configuration-builder.ts create mode 100644 src/contracts/generator-configuration.ts create mode 100644 src/contracts/supported-api-item-kind-type.ts create mode 100644 src/managers/plugin-manager.ts diff --git a/package.json b/package.json index 93868367..f87e8c36 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@types/fs-extra": "^4.0.5", "fs-extra": "^4.0.2", "ts-extractor": "^1.1.1", - "typescript": "^2.6.1" + "typescript": "^2.6.2" }, "devDependencies": { "@types/jest": "^21.1.6", diff --git a/src/abstractions/api-item-plugin-base.ts b/src/abstractions/api-item-plugin-base.ts index 02cf2f00..d30c994f 100644 --- a/src/abstractions/api-item-plugin-base.ts +++ b/src/abstractions/api-item-plugin-base.ts @@ -1,9 +1,10 @@ import { Contracts } from "ts-extractor"; import { RenderOutputDto } from "../contracts/render-output-dto"; +import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; export abstract class ApiItemPluginBase { - public abstract SupportedApiItems(): Contracts.ApiItemDto[]; + public abstract SupportedApiItemsKinds(): SupportedApiItemKindType[]; public abstract CheckApiItem(item: Contracts.ApiItemDto): boolean; diff --git a/src/builders/generator-configuration-builder.ts b/src/builders/generator-configuration-builder.ts new file mode 100644 index 00000000..79957273 --- /dev/null +++ b/src/builders/generator-configuration-builder.ts @@ -0,0 +1,94 @@ +import * as ts from "typescript"; +import * as path from "path"; +import { Extractor, GetCompilerOptions } from "ts-extractor"; + +import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; +import { GeneratorConfiguration, WorkingGeneratorConfiguration } from "../contracts/generator-configuration"; + +import { PluginManager } from "../managers/plugin-manager"; + +// TODO: Add method to read compiler options from tsconfig. +// TODO: Configuration Updater. +export class GeneratorConfigurationBuilder { + constructor(private projectDirectory: string) { } + + private configuration: Partial = {}; + private compilerOptions: Partial; + + public OverrideCompilerOptions(compilerOptions: Partial): this { + this.compilerOptions = { + ...this.compilerOptions, + ...compilerOptions + }; + + return this; + } + + /** + * Override configuration with new configuration object. + * + * @param configuration Partial configuration object. + */ + public OverrideConfiguration(configuration: Partial): this { + this.configuration = { + ...this.configuration, + ...configuration + }; + + return this; + } + + public SetOutputDirectory(outputDirectory: string): this { + this.configuration.OutputDirectory = outputDirectory; + + return this; + } + + public AddPlugins(plugins: ApiItemPluginBase[]): this { + const currentPlugins = this.configuration.Plugins || []; + this.configuration.Plugins = [...plugins, ...currentPlugins]; + + return this; + } + + public async Build(entryFiles: string[]): Promise { + // Register all plugins. + const pluginManager = new PluginManager(); + if (this.configuration.Plugins != null) { + // TODO: Register default plugins. + // Registering given plugins. + for (const plugin of this.configuration.Plugins) { + pluginManager.Register(plugin); + } + + } + + // Resolve tsconfig + let compilerOptions = this.compilerOptions; + if (compilerOptions == null) { + compilerOptions = await GetCompilerOptions(path.join(this.projectDirectory, "tsconfig.json")); + } + + // Extractor + const extractor = new Extractor({ + CompilerOptions: compilerOptions, + ProjectDirectory: this.projectDirectory + }); + + const outputDirectory = this.configuration.OutputDirectory || path.join(this.projectDirectory, "/docs/"); + + return { + EntryFiles: entryFiles, + PluginManager: pluginManager, + ExtractedData: extractor.Extract(entryFiles), + OutputDirectory: outputDirectory + }; + } +} + + +const output = new GeneratorConfigurationBuilder("./") + .AddPlugins([]) + .OverrideCompilerOptions({ typeRoots: ["."] }) + .SetOutputDirectory("./docs") + .Build(["./src/index.ts", "./src/contracts.ts"]); diff --git a/src/contracts/generator-configuration.ts b/src/contracts/generator-configuration.ts new file mode 100644 index 00000000..7ef40ce4 --- /dev/null +++ b/src/contracts/generator-configuration.ts @@ -0,0 +1,20 @@ +import { ExtractDto } from "ts-extractor"; + +import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; +import { PluginManager } from "../managers/plugin-manager"; + +export interface GeneratorConfiguration { + OutputDirectory: string; + EntryFiles: string[]; + PluginManager: PluginManager; + ExtractedData: ExtractDto; +} + +export interface WorkingGeneratorConfiguration { + OutputDirectory: string; + ProjectDirectory: string; + Plugins: ApiItemPluginBase[]; + + Exclude: string[]; + OutputPathSeparator: string; +} diff --git a/src/contracts/supported-api-item-kind-type.ts b/src/contracts/supported-api-item-kind-type.ts new file mode 100644 index 00000000..fb5ca013 --- /dev/null +++ b/src/contracts/supported-api-item-kind-type.ts @@ -0,0 +1,7 @@ +import { Contracts } from "ts-extractor"; + +export enum ApiItemKindsAdditional { + Any = "any" +}; + +export type SupportedApiItemKindType = Contracts.ApiItemKinds | ApiItemKindsAdditional; diff --git a/src/managers/plugin-manager.ts b/src/managers/plugin-manager.ts new file mode 100644 index 00000000..a93a919a --- /dev/null +++ b/src/managers/plugin-manager.ts @@ -0,0 +1,37 @@ +import { Contracts } from "ts-extractor"; + +import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; +import { SupportedApiItemKindType, ApiItemKindsAdditional } from "../contracts/supported-api-item-kind-type"; + +export class PluginManager { + constructor() { + + // Initialize Plugins map. + for (const [, kindValue] of Object.entries(Contracts.ApiItemKinds)) { + this.registeredPlugins.set(kindValue as Contracts.ApiItemKinds, []); + } + } + + private registeredPlugins: Map = new Map(); + + public Register(plugin: ApiItemPluginBase): void { + const supportedKinds = plugin.SupportedApiItemsKinds(); + + if (this.isSupportedKindsHasAny(supportedKinds)) { + for (const [key, value] of this.registeredPlugins) { + this.registeredPlugins.set(key, [plugin, ...value]); + } + return; + } + + // FIXME: Remove `as`. Somehow it doesn't work. + for (const kind of supportedKinds as Contracts.ApiItemKinds[]) { + const registeredPluginsOfKind = this.registeredPlugins.get(kind) || []; + this.registeredPlugins.set(kind, [plugin, ...registeredPluginsOfKind]); + } + } + + private isSupportedKindsHasAny(kinds: SupportedApiItemKindType[]): kinds is ApiItemKindsAdditional[] { + return Boolean(kinds.find(x => x === ApiItemKindsAdditional.Any)); + } +} From 055bf2fa775f0b90302faf89202fc13c4f07dc82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 28 Nov 2017 19:40:09 +0200 Subject: [PATCH 23/61] Added Plugins proccessing. --- package.json | 4 +- src/abstractions/api-item-plugin-base.ts | 4 +- .../generator-configuration-builder.ts | 13 +-- src/contracts/generator-configuration.ts | 5 +- ...utput-dto.ts => render-item-output-dto.ts} | 2 +- src/generator.ts | 60 ++++++++++++++ .../plugin-registry.ts} | 11 ++- tsconfig.json | 8 +- tslint.json | 82 +------------------ 9 files changed, 80 insertions(+), 109 deletions(-) rename src/contracts/{render-output-dto.ts => render-item-output-dto.ts} (74%) create mode 100644 src/generator.ts rename src/{managers/plugin-manager.ts => registries/plugin-registry.ts} (84%) diff --git a/package.json b/package.json index f87e8c36..7276537d 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,10 @@ "@types/jest": "^21.1.6", "@types/sinon": "^4.0.0", "jest": "^21.2.1", + "simplr-tslint": "0.0.1", "sinon": "^4.1.2", - "ts-jest": "^21.2.3" + "ts-jest": "^21.2.3", + "tslint": "^5.8.0" }, "jest": { "transform": { diff --git a/src/abstractions/api-item-plugin-base.ts b/src/abstractions/api-item-plugin-base.ts index d30c994f..99642dfd 100644 --- a/src/abstractions/api-item-plugin-base.ts +++ b/src/abstractions/api-item-plugin-base.ts @@ -1,6 +1,6 @@ import { Contracts } from "ts-extractor"; -import { RenderOutputDto } from "../contracts/render-output-dto"; +import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; export abstract class ApiItemPluginBase { @@ -8,5 +8,5 @@ export abstract class ApiItemPluginBase { public abstract CheckApiItem(item: Contracts.ApiItemDto): boolean; - public abstract Render(item: Contracts.ApiItemDto): RenderOutputDto; + public abstract Render(item: Contracts.ApiItemDto, getItem: (itemId: string) => RenderItemOutputDto): RenderItemOutputDto; } diff --git a/src/builders/generator-configuration-builder.ts b/src/builders/generator-configuration-builder.ts index 79957273..182ea74f 100644 --- a/src/builders/generator-configuration-builder.ts +++ b/src/builders/generator-configuration-builder.ts @@ -5,10 +5,9 @@ import { Extractor, GetCompilerOptions } from "ts-extractor"; import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; import { GeneratorConfiguration, WorkingGeneratorConfiguration } from "../contracts/generator-configuration"; -import { PluginManager } from "../managers/plugin-manager"; +import { PluginRegistry } from "../registries/plugin-registry"; // TODO: Add method to read compiler options from tsconfig. -// TODO: Configuration Updater. export class GeneratorConfigurationBuilder { constructor(private projectDirectory: string) { } @@ -53,7 +52,7 @@ export class GeneratorConfigurationBuilder { public async Build(entryFiles: string[]): Promise { // Register all plugins. - const pluginManager = new PluginManager(); + const pluginManager = new PluginRegistry(); if (this.configuration.Plugins != null) { // TODO: Register default plugins. // Registering given plugins. @@ -78,17 +77,9 @@ export class GeneratorConfigurationBuilder { const outputDirectory = this.configuration.OutputDirectory || path.join(this.projectDirectory, "/docs/"); return { - EntryFiles: entryFiles, PluginManager: pluginManager, ExtractedData: extractor.Extract(entryFiles), OutputDirectory: outputDirectory }; } } - - -const output = new GeneratorConfigurationBuilder("./") - .AddPlugins([]) - .OverrideCompilerOptions({ typeRoots: ["."] }) - .SetOutputDirectory("./docs") - .Build(["./src/index.ts", "./src/contracts.ts"]); diff --git a/src/contracts/generator-configuration.ts b/src/contracts/generator-configuration.ts index 7ef40ce4..6c6b3152 100644 --- a/src/contracts/generator-configuration.ts +++ b/src/contracts/generator-configuration.ts @@ -1,12 +1,11 @@ import { ExtractDto } from "ts-extractor"; import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; -import { PluginManager } from "../managers/plugin-manager"; +import { PluginRegistry } from "../registries/plugin-registry"; export interface GeneratorConfiguration { OutputDirectory: string; - EntryFiles: string[]; - PluginManager: PluginManager; + PluginManager: PluginRegistry; ExtractedData: ExtractDto; } diff --git a/src/contracts/render-output-dto.ts b/src/contracts/render-item-output-dto.ts similarity index 74% rename from src/contracts/render-output-dto.ts rename to src/contracts/render-item-output-dto.ts index fc09f641..26919c09 100644 --- a/src/contracts/render-output-dto.ts +++ b/src/contracts/render-item-output-dto.ts @@ -1,6 +1,6 @@ import { Contracts } from "ts-extractor"; -export interface RenderOutputDto { +export interface RenderItemOutputDto { References: string[]; RenderOutput: string[]; ApiItem: Contracts.ApiItemDto; diff --git a/src/generator.ts b/src/generator.ts new file mode 100644 index 00000000..76bc0c7d --- /dev/null +++ b/src/generator.ts @@ -0,0 +1,60 @@ +import { GeneratorConfiguration } from "./contracts/generator-configuration"; +import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; +import { Contracts } from "ts-extractor"; + +export class Generator { + constructor(private configuration: GeneratorConfiguration) { } + + private renderedItems: Map = new Map(); + private renderedData: any | undefined; + + + private renderApiItem(apiItem: Contracts.ApiItemDto): RenderItemOutputDto { + const plugins = this.configuration.PluginManager.GetPluginsByKind(apiItem.ApiKind); + + for (const plugin of plugins) { + if (plugin.CheckApiItem(apiItem)) { + return plugin.Render(apiItem, this.getRenderedItemById); + } + } + + // FIXME: Implement default plugin. + return undefined as any; + } + + // TODO: Check for infinity loop. + private getRenderedItemById = (itemId: string): RenderItemOutputDto => { + if (!this.renderedItems.has(itemId)) { + const { Registry } = this.configuration.ExtractedData; + const renderedData = this.renderApiItem(Registry[itemId]); + this.renderedItems.set(itemId, renderedData); + + return renderedData; + } + + return this.renderedItems.get(itemId)!; + } + + private onRenderData(): void { + const { Registry } = this.configuration.ExtractedData; + + for (const [itemKey,] of Object.entries(Registry)) { + if (!this.renderedItems.has(itemKey)) { + this.getRenderedItemById(itemKey); + } + } + } + + public GetRenderedData(): any { + let data: any = this.renderedData; + if (data == null) { + data = this.onRenderData(); + } + + return data; + } + + public PrintToFiles(): void { + throw new Error("Not yet implemented!"); + } +} diff --git a/src/managers/plugin-manager.ts b/src/registries/plugin-registry.ts similarity index 84% rename from src/managers/plugin-manager.ts rename to src/registries/plugin-registry.ts index a93a919a..4fed79da 100644 --- a/src/managers/plugin-manager.ts +++ b/src/registries/plugin-registry.ts @@ -3,7 +3,8 @@ import { Contracts } from "ts-extractor"; import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; import { SupportedApiItemKindType, ApiItemKindsAdditional } from "../contracts/supported-api-item-kind-type"; -export class PluginManager { +// TODO: Rename to PluginRegistry. +export class PluginRegistry { constructor() { // Initialize Plugins map. @@ -14,6 +15,10 @@ export class PluginManager { private registeredPlugins: Map = new Map(); + private isSupportedKindsHasAny(kinds: SupportedApiItemKindType[]): kinds is ApiItemKindsAdditional[] { + return Boolean(kinds.find(x => x === ApiItemKindsAdditional.Any)); + } + public Register(plugin: ApiItemPluginBase): void { const supportedKinds = plugin.SupportedApiItemsKinds(); @@ -31,7 +36,7 @@ export class PluginManager { } } - private isSupportedKindsHasAny(kinds: SupportedApiItemKindType[]): kinds is ApiItemKindsAdditional[] { - return Boolean(kinds.find(x => x === ApiItemKindsAdditional.Any)); + public GetPluginsByKind(kind: Contracts.ApiItemKinds): ApiItemPluginBase[] { + return this.registeredPlugins.get(kind) || []; } } diff --git a/tsconfig.json b/tsconfig.json index 82ceb171..9ed45f17 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,13 +22,7 @@ ], "typeRoots": [ "./node_modules/@types" - ], - "baseUrl": ".", - "paths": { - "*": [ - "@types/*" - ] - } + ] }, "exclude": [ "node_modules", diff --git a/tslint.json b/tslint.json index 2c6ee3a6..85c41b83 100644 --- a/tslint.json +++ b/tslint.json @@ -1,83 +1,3 @@ { - "rules": { - "align": [ true, "parameters", "statements" ], - "class-name": true, - "comment-format": [ false ], - "curly": true, - "eofline": true, - "forin": true, - "indent": [ true, "spaces" ], - "interface-name": [ true, "never-prefix" ], - "jsdoc-format": true, - "max-line-length": [ true, 140 ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-variable": true, - "no-duplicate-super": true, - "prefer-const": [true, { "destructuring": "all" } ], - "semicolon": [ true, "always" ], - "prefer-template": [ true, "allow-single-concat" ], - "no-invalid-this": true, - "no-eval": true, - "no-internal-module": true, - "no-require-imports": true, - "no-trailing-whitespace": true, - "import-spacing": true, - "no-default-export": true, - "no-var-keyword": true, - "no-unnecessary-type-assertion": true, - "space-before-function-paren": [ true, { "asyncArrow": "always", "named": "never", "anonymous": "never", "method": "never", "constructor": "never" } ], - "no-angle-bracket-type-assertion": true, - "no-empty-interface": true, - "no-unnecessary-callback-wrapper": true, - "return-undefined": true, - "no-sparse-arrays": true, - "await-promise": true, - "promise-function-async": true, - "label-position": true, - "array-type": [true, "array-simple"], - "arrow-return-shorthand": [ true, "multiline" ], - "only-arrow-functions": [ true, "allow-declarations", "allow-named-functions" ], - "one-line": [ - true, - "check-catch", - "check-finally", - "check-else", - "check-open-brace", - "check-whitespace" - ], - "member-access": [ true, "check-accessor" ], - "arrow-parens": [ true, "ban-single-arg-parens" ], - "no-consecutive-blank-lines": [ true, 1 ], - "quotemark": [ true, "double", "jsx-double" ], - "no-console": [true, "log"], - "no-empty": true, - "no-reference": true, - "no-shadowed-variable": true, - "no-unused-expression": [ true, "allow-new" ], - "encoding": true, - "typedef": [true, "call-signature", "member-variable-declaration"], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "triple-equals": [ true, "allow-null-check" ], - "variable-name": [ true, "ban-keywords", "check-format", "allow-pascal-case" ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-module", - "check-separator", - "check-type", - "check-typecast" - ] - } + "extends": "simplr-tslint" } From dd14ee8bd49f3ca478b2b0dad66a07603280a384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 28 Nov 2017 19:55:50 +0200 Subject: [PATCH 24/61] Fixed TSlint errors. --- src/contracts/supported-api-item-kind-type.ts | 2 +- src/generator.ts | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/contracts/supported-api-item-kind-type.ts b/src/contracts/supported-api-item-kind-type.ts index fb5ca013..727f55f4 100644 --- a/src/contracts/supported-api-item-kind-type.ts +++ b/src/contracts/supported-api-item-kind-type.ts @@ -2,6 +2,6 @@ import { Contracts } from "ts-extractor"; export enum ApiItemKindsAdditional { Any = "any" -}; +} export type SupportedApiItemKindType = Contracts.ApiItemKinds | ApiItemKindsAdditional; diff --git a/src/generator.ts b/src/generator.ts index 76bc0c7d..01e34608 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -2,12 +2,19 @@ import { GeneratorConfiguration } from "./contracts/generator-configuration"; import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; import { Contracts } from "ts-extractor"; +// TODO: Move to contracts. +export type RenderedItems = Map; + +export interface RenderedDto { + RenderedItems: RenderedItems; + EntryFiles: Contracts.ApiSourceFileDto[]; +} + export class Generator { constructor(private configuration: GeneratorConfiguration) { } private renderedItems: Map = new Map(); - private renderedData: any | undefined; - + private renderedData: RenderedDto | undefined; private renderApiItem(apiItem: Contracts.ApiItemDto): RenderItemOutputDto { const plugins = this.configuration.PluginManager.GetPluginsByKind(apiItem.ApiKind); @@ -35,18 +42,23 @@ export class Generator { return this.renderedItems.get(itemId)!; } - private onRenderData(): void { - const { Registry } = this.configuration.ExtractedData; + private onRenderData(): RenderedDto { + const { Registry, EntryFiles } = this.configuration.ExtractedData; - for (const [itemKey,] of Object.entries(Registry)) { + for (const [itemKey] of Object.entries(Registry)) { if (!this.renderedItems.has(itemKey)) { this.getRenderedItemById(itemKey); } } + + return { + EntryFiles: EntryFiles, + RenderedItems: this.renderedItems + }; } - public GetRenderedData(): any { - let data: any = this.renderedData; + public GetRenderedData(): RenderedDto { + let data: RenderedDto | undefined = this.renderedData; if (data == null) { data = this.onRenderData(); } From d5fdfc6bc718b0494dc21fc938d40046178a76b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Wed, 29 Nov 2017 12:31:32 +0200 Subject: [PATCH 25/61] Added ts-node package. --- package.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 66b8cf07..f3da3c87 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,13 @@ "description": "", "main": "index.js", "scripts": { - "test": "jest", - "test-watch": "jest --watchAll", - "build": "tsc -p ." + "pretest": "npm run build -- --noEmit && npm run build-tests", + "test": "npm run tslint && jest && echo All tests passed successfully.", + "test-watch": "start npm run build-tests -- --watchAll && jest --watchAll", + "jest": "jest --maxWorkers=4", + "tslint": "tslint --project . --config ./tslint.json && echo Successfully passed tslint test.", + "build": "tsc -p .", + "build-tests": "cd tests && ts-node ./build-tests.ts -p ./" }, "engine": "node >= 7.5.0", "author": "", @@ -23,7 +27,8 @@ "@types/sinon": "^4.0.0", "jest": "^21.2.1", "sinon": "^4.1.2", - "ts-jest": "^21.2.3" + "ts-jest": "^21.2.3", + "ts-node": "^3.3.0" }, "jest": { "transform": { From da27a871d31713437e8ddd3d19e6381351308f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Wed, 29 Nov 2017 12:37:35 +0200 Subject: [PATCH 26/61] Added simplr-tslint and tslint packages. --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f3da3c87..ee41baf3 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,11 @@ "@types/jest": "^21.1.6", "@types/sinon": "^4.0.0", "jest": "^21.2.1", + "simplr-tslint": "0.0.1", "sinon": "^4.1.2", "ts-jest": "^21.2.3", - "ts-node": "^3.3.0" + "ts-node": "^3.3.0", + "tslint": "^5.8.0" }, "jest": { "transform": { From 45c27cabea9d05843e3de0e5f5712fd1563911bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Wed, 29 Nov 2017 14:07:41 +0200 Subject: [PATCH 27/61] Changed logger texts. --- tests/build-tests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/build-tests.ts b/tests/build-tests.ts index d16e9291..b1f448eb 100644 --- a/tests/build-tests.ts +++ b/tests/build-tests.ts @@ -11,23 +11,23 @@ async function StartWatcher(dirName: string): Promise { return fs.watch(`./${dirName}/`, async (event, fileName) => { if (fileName.indexOf(TESTS_DIR_NAME) === -1) { Logger.Info(`Test file was changed in "${dirName}/${fileName}".`); - const startBuild = Logger.Info(`Building tests for "${dirName}"...`); + const startBuild = Logger.Info(`Generating tests for "${dirName}"...`); await TestsGenerator(dirName, __dirname); - Logger.Debug(`Builded tests after ${(Date.now() - startBuild)}ms`); + Logger.Debug(`Generated tests after ${(Date.now() - startBuild)}ms`); } }); } (async (dirNames: string[]) => { - Logger.Info("Starting test builder..."); + Logger.Info("Starting test generator..."); for (const dirName of dirNames) { const startRemove = Logger.Info(`Removing old tests from "${dirName}"...`); await TestsCleanup(dirName); Logger.Debug(`Removed old tests after ${(Date.now() - startRemove)}ms`); - const startBuild = Logger.Info(`Building tests for "${dirName}"...`); + const startBuild = Logger.Info(`Generating tests for "${dirName}"...`); await TestsGenerator(dirName, __dirname); - Logger.Debug(`Builded tests after ${(Date.now() - startBuild)}ms`); + Logger.Debug(`Generated tests after ${(Date.now() - startBuild)}ms`); if (process.argv.indexOf("--watchAll") !== -1) { Logger.Info(`Started watching "${dirName}" tests.`); From fb3526164f69f9d17aae3322854c703843c0b2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Wed, 29 Nov 2017 18:08:37 +0200 Subject: [PATCH 28/61] Updated jest config. --- package.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package.json b/package.json index ee41baf3..9d080660 100644 --- a/package.json +++ b/package.json @@ -33,10 +33,25 @@ "tslint": "^5.8.0" }, "jest": { + "collectCoverage": true, + "mapCoverage": true, "transform": { ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, + "globals": { + "ts-jest": { + "skipBabel": true, + "tsConfigFile": "tests/tsconfig.json" + } + }, "testRegex": "/__tests__/.*\\.(test|spec).(ts|tsx|js)$", + "moduleNameMapper": { + "@src/(.*)": "/src/$1" + }, + "coveragePathIgnorePatterns": [ + "/node_modules/", + "/tests/" + ], "moduleFileExtensions": [ "ts", "tsx", From 845fdae8e32f2d43ed7e791ab7d25247980f04d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 29 Nov 2017 19:55:05 +0200 Subject: [PATCH 29/61] Added default plugin. --- src/abstractions/api-item-plugin-base.ts | 11 +++++++++-- src/generator.ts | 9 ++++++--- src/plugins/api-default-plugin.ts | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 src/plugins/api-default-plugin.ts diff --git a/src/abstractions/api-item-plugin-base.ts b/src/abstractions/api-item-plugin-base.ts index 99642dfd..eafbe0e2 100644 --- a/src/abstractions/api-item-plugin-base.ts +++ b/src/abstractions/api-item-plugin-base.ts @@ -1,12 +1,19 @@ import { Contracts } from "ts-extractor"; import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; -import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; +import { SupportedApiItemKindType, ApiItemKindsAdditional } from "../contracts/supported-api-item-kind-type"; export abstract class ApiItemPluginBase { + // TODO: Clarify naming. + protected get SupportKind(): typeof Contracts.ApiItemKinds & typeof ApiItemKindsAdditional { + return Object.assign(Contracts.ApiItemKinds, ApiItemKindsAdditional); + } + public abstract SupportedApiItemsKinds(): SupportedApiItemKindType[]; - public abstract CheckApiItem(item: Contracts.ApiItemDto): boolean; + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } public abstract Render(item: Contracts.ApiItemDto, getItem: (itemId: string) => RenderItemOutputDto): RenderItemOutputDto; } diff --git a/src/generator.ts b/src/generator.ts index 01e34608..aaca3801 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -1,6 +1,9 @@ +import { Contracts } from "ts-extractor"; + import { GeneratorConfiguration } from "./contracts/generator-configuration"; import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; -import { Contracts } from "ts-extractor"; + +import { ApiDefaultPlugin } from "./plugins/api-default-plugin"; // TODO: Move to contracts. export type RenderedItems = Map; @@ -25,8 +28,8 @@ export class Generator { } } - // FIXME: Implement default plugin. - return undefined as any; + const defaultPlugin = new ApiDefaultPlugin(); + return defaultPlugin.Render(apiItem, this.getRenderedItemById); } // TODO: Check for infinity loop. diff --git a/src/plugins/api-default-plugin.ts b/src/plugins/api-default-plugin.ts new file mode 100644 index 00000000..3939f1ba --- /dev/null +++ b/src/plugins/api-default-plugin.ts @@ -0,0 +1,24 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownGenerator } from "@simplrjs/markdown"; + +import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; +import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; +import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; + +export class ApiDefaultPlugin extends ApiItemPluginBase { + public SupportedApiItemsKinds(): SupportedApiItemKindType[] { + return [this.SupportKind.Any]; + } + + public Render(item: Contracts.ApiItemDto, getItem: (itemId: string) => RenderItemOutputDto): RenderItemOutputDto { + const output: string[] = [ + MarkdownGenerator.header(`${item.Name}: ${item.ApiKind.toUpperCase()}`, 2) + ]; + + return { + ApiItem: item, + References: [], + RenderOutput: output + }; + } +} From 7e450b5100f864f766305c15c417d301e5f005a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 29 Nov 2017 19:55:20 +0200 Subject: [PATCH 30/61] Added debugger. --- package.json | 1 + src/debug.ts | 19 +++++++++++++++++++ tsconfig.json | 4 +++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7276537d..1a07cc4c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "engine": "node >= 7.5.0", "author": "", "dependencies": { + "@simplrjs/markdown": "0.1.0-beta", "@types/fs-extra": "^4.0.5", "fs-extra": "^4.0.2", "ts-extractor": "^1.1.1", diff --git a/src/debug.ts b/src/debug.ts index 1bc789f0..03b8fab4 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -1 +1,20 @@ // This is debug file. DO NOT include in compiled package. +import * as path from "path"; + +import { GeneratorConfigurationBuilder } from "./builders/generator-configuration-builder"; +import { Generator } from "./generator"; + +async function Main(): Promise { + const projectDirectory = path.join(process.cwd(), "./examples/simple/"); + const entryFiles = ["./index.ts", "./exported-const-variables.ts", "./exported-functions.ts"]; + + const configPromise = new GeneratorConfigurationBuilder(projectDirectory).Build(entryFiles); + const config = await configPromise; + + const generator = new Generator(config); + const renderedData = generator.GetRenderedData(); + console.log(renderedData); + debugger; +} + +Main(); diff --git a/tsconfig.json b/tsconfig.json index 9ed45f17..f8eb4b11 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,6 +29,8 @@ "dist", "@types", "tests", - "examples" + "examples", + "_src", + "__tests__" ] } From 719321eadafcaf14a5fdef9213f6bcc9f68db0a6 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 16:03:10 +0200 Subject: [PATCH 31/61] Printer WIP. --- src/abstractions/printer-base.ts | 3 +++ src/printers/default-printer.ts | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 src/abstractions/printer-base.ts create mode 100644 src/printers/default-printer.ts diff --git a/src/abstractions/printer-base.ts b/src/abstractions/printer-base.ts new file mode 100644 index 00000000..e24d76bd --- /dev/null +++ b/src/abstractions/printer-base.ts @@ -0,0 +1,3 @@ +export class PrinterBase { + public +} diff --git a/src/printers/default-printer.ts b/src/printers/default-printer.ts new file mode 100644 index 00000000..8ac8cd2d --- /dev/null +++ b/src/printers/default-printer.ts @@ -0,0 +1,5 @@ +import { PrinterBase } from "../abstractions/printer-base"; + +export class DefaultPrinter extends PrinterBase { + +} From 2ee433834316af81ca27098174df77558362dd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Thu, 30 Nov 2017 16:46:40 +0200 Subject: [PATCH 32/61] We successfully crawled entry files and added RenderedItems to specific virtual files. --- src/abstractions/printer-base.ts | 6 ++- src/contracts/rendered-dto.ts | 7 +++ src/contracts/rendered-item.ts | 3 ++ src/debug.ts | 3 +- src/generator.ts | 84 ++++++++++++++++++++++++++++---- src/printers/default-printer.ts | 4 ++ 6 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 src/contracts/rendered-dto.ts create mode 100644 src/contracts/rendered-item.ts diff --git a/src/abstractions/printer-base.ts b/src/abstractions/printer-base.ts index e24d76bd..34e57074 100644 --- a/src/abstractions/printer-base.ts +++ b/src/abstractions/printer-base.ts @@ -1,3 +1,5 @@ -export class PrinterBase { - public +import { RenderedDto } from "../contracts/rendered-dto"; + +export abstract class PrinterBase { + public abstract EntryFileCrawler(data: RenderedDto): any; } diff --git a/src/contracts/rendered-dto.ts b/src/contracts/rendered-dto.ts new file mode 100644 index 00000000..c427656d --- /dev/null +++ b/src/contracts/rendered-dto.ts @@ -0,0 +1,7 @@ +import { RenderedItems } from "./rendered-item"; +import { Contracts } from "ts-extractor"; + +export interface RenderedDto { + RenderedItems: RenderedItems; + EntryFiles: Contracts.ApiSourceFileDto[]; +} diff --git a/src/contracts/rendered-item.ts b/src/contracts/rendered-item.ts new file mode 100644 index 00000000..4b071e90 --- /dev/null +++ b/src/contracts/rendered-item.ts @@ -0,0 +1,3 @@ +import { RenderItemOutputDto } from "./render-item-output-dto"; + +export type RenderedItems = Map; diff --git a/src/debug.ts b/src/debug.ts index 03b8fab4..7bd7e4ad 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -12,8 +12,7 @@ async function Main(): Promise { const config = await configPromise; const generator = new Generator(config); - const renderedData = generator.GetRenderedData(); - console.log(renderedData); + generator.PrintToFiles(); debugger; } diff --git a/src/generator.ts b/src/generator.ts index aaca3801..3b295487 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -1,18 +1,18 @@ import { Contracts } from "ts-extractor"; +import * as path from "path"; import { GeneratorConfiguration } from "./contracts/generator-configuration"; import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; +import { RenderedDto } from "./contracts/rendered-dto"; import { ApiDefaultPlugin } from "./plugins/api-default-plugin"; -// TODO: Move to contracts. -export type RenderedItems = Map; - -export interface RenderedDto { - RenderedItems: RenderedItems; - EntryFiles: Contracts.ApiSourceFileDto[]; -} - +/** + * TODO: Aliasias like + * ```ts + * import { Contracts as ExtractorContracts } from "ts-extractor"; + * ``` + */ export class Generator { constructor(private configuration: GeneratorConfiguration) { } @@ -70,6 +70,72 @@ export class Generator { } public PrintToFiles(): void { - throw new Error("Not yet implemented!"); + // ===================================== + // + // First step: Preparing to what files we want to write. + // P.S. move this into separate file. + // + // ===================================== + interface PrinterFileData { + /** + * Relative file location to `OutDir` path. + */ + Location: string; + Items: RenderItemOutputDto[]; + } + + const data = this.GetRenderedData(); + const list: PrinterFileData[] = []; + + for (const entryFile of data.EntryFiles) { + const printerFile: PrinterFileData = { + Location: path.basename(entryFile.Name) + ".md", + Items: this.getItems(data, entryFile, entryFile.Members) + }; + + list.push(printerFile); + } + } + + private getItems( + data: RenderedDto, + entryFile: Contracts.ApiSourceFileDto, + itemsReference: Contracts.ApiItemReferenceTuple + ): RenderItemOutputDto[] { + let items: RenderItemOutputDto[] = []; + + for (const [, references] of itemsReference) { + for (const reference of references) { + // Check if item is ExportSpecifier or ExportDeclaration. + const apiItem = this.configuration.ExtractedData.Registry[reference]; + + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Export: { + const exporterItems = this.getItems(data, entryFile, apiItem.Members); + items = [...items, ...exporterItems]; + break; + } + case Contracts.ApiItemKinds.ExportSpecifier: { + if (apiItem.ApiItems == null) { + console.warn(`ApiItems are missing in "${apiItem.Name}"?`); + break; + } + const exporterItems = this.getItems(data, entryFile, [[apiItem.Name, apiItem.ApiItems]]); + items = [...items, ...exporterItems]; + break; + } + default: { + const renderedItem = data.RenderedItems.get(reference); + if (renderedItem != null) { + items.push(renderedItem); + } else { + console.warn(`Reference "${reference}" is missing in ${entryFile.Name}?`); + } + } + } + } + } + + return items; } } diff --git a/src/printers/default-printer.ts b/src/printers/default-printer.ts index 8ac8cd2d..b5b0109f 100644 --- a/src/printers/default-printer.ts +++ b/src/printers/default-printer.ts @@ -1,5 +1,9 @@ import { PrinterBase } from "../abstractions/printer-base"; +import { RenderedDto } from "../contracts/rendered-dto"; export class DefaultPrinter extends PrinterBase { + public EntryFileCrawler(data: RenderedDto): void { + throw new Error("Method not implemented."); + } } From d8fd69cf15488f63e600342765667a88da7cd21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Thu, 30 Nov 2017 18:53:01 +0200 Subject: [PATCH 33/61] Updated .gitignore file. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 81d6fdbd..0290e5f0 100644 --- a/.gitignore +++ b/.gitignore @@ -269,3 +269,4 @@ package-lock.json **/*.js.map _src +coverage \ No newline at end of file From 619bcbd4bb91cad07ee66ca6316bb0b26405131a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Thu, 30 Nov 2017 18:53:20 +0200 Subject: [PATCH 34/61] Removed unused files. --- __tests__/index.test.ts | 5 ----- __tests__/tsconfig.json | 34 ---------------------------------- 2 files changed, 39 deletions(-) delete mode 100644 __tests__/index.test.ts delete mode 100644 __tests__/tsconfig.json diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts deleted file mode 100644 index a0fc5597..00000000 --- a/__tests__/index.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -describe("debug", () => { - it("Returns a callable thing", () => { - - }); -}); diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json deleted file mode 100644 index 48e57492..00000000 --- a/__tests__/tsconfig.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "removeComments": false, - "sourceMap": false, - "skipDefaultLibCheck": true, - "pretty": true, - "noEmit": true, - "experimentalDecorators": false, - "baseUrl": "./", - "typeRoots": [ - "../" - ], - "types": [ - "jest", - "typescript", - "node" - ], - "lib": [ - "es6", - "dom" - ], - "paths": { - "@src/*": [ - "../src/*" - ] - }, - "rootDirs": [ - "./", - "../src" - ] - } -} From 61b702073ec8f2e4451d99e7bbc8976f40fc8cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Thu, 30 Nov 2017 18:53:40 +0200 Subject: [PATCH 35/61] Updated tests-generator. --- tests/scripts/tests-generator.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/scripts/tests-generator.ts b/tests/scripts/tests-generator.ts index b0713b34..2da09185 100644 --- a/tests/scripts/tests-generator.ts +++ b/tests/scripts/tests-generator.ts @@ -13,6 +13,10 @@ export const EXTRACTOR_COMPILER_OPTIONS: ts.CompilerOptions = { skipDefaultLibCheck: true }; +export interface Configuration { + EntryFiles: string[]; +} + export async function TestsGenerator(dirName: string, cwd: string): Promise { const filesList = await fastGlob([ `./${dirName}/**/*.ts`, @@ -20,30 +24,27 @@ export async function TestsGenerator(dirName: string, cwd: string): Promise {`, - Tab(1) + `const moduleName = "./${moduleName}";`, - Tab(1) + `const projectDirectory = "${FixSep(cwd)}";`, - "", - Tab(1) + `const extractor = new Extractor({`, - Tab(2) + `CompilerOptions: ${JSON.stringify(EXTRACTOR_COMPILER_OPTIONS, undefined, Tab(3))},`, - Tab(2) + `ProjectDirectory: projectDirectory`, - Tab(1) + `});`, + Tab(1) + `const projectDirectory = "${projectDirectory}";`, + Tab(1) + `const entryFiles = ${JSON.stringify(testConfig.EntryFiles)};`, "", - Tab(1) + `expect(extractor.Extract([moduleName])).toMatchSnapshot();`, + Tab(1) + `expect(true).toBe(true);`, `});`, "" ].join(os.EOL); - const targetDirectory = path.join(dir, "__tests__"); + const targetDirectory = path.join(dir, "..", "__tests__"); await fs.ensureDir(targetDirectory); - const targetFilePathname = path.join(targetDirectory, `${name}.test${ext}`); + const targetFilePathname = path.join(targetDirectory, `${path.parse(dir).name}.test${ext}`); await fs.writeFile(targetFilePathname, testDescribe); } } From 90de12fee0c5cf385c4a61a6487f1c3f912ca31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Thu, 30 Nov 2017 18:54:26 +0200 Subject: [PATCH 36/61] Added test cases. --- tests/cases/simple-project-1/index.ts | 5 +++ tests/cases/simple-project-1/package.json | 13 ++++++++ tests/cases/simple-project-1/test-config.json | 7 ++++ tests/cases/simple-project-1/tsconfig.json | 32 +++++++++++++++++++ tests/cases/simple-project-2/foo.ts | 5 +++ tests/cases/simple-project-2/index.ts | 7 ++++ tests/cases/simple-project-2/package.json | 13 ++++++++ tests/cases/simple-project-2/test-config.json | 5 +++ tests/cases/simple-project-2/tsconfig.json | 32 +++++++++++++++++++ 9 files changed, 119 insertions(+) create mode 100644 tests/cases/simple-project-1/index.ts create mode 100644 tests/cases/simple-project-1/package.json create mode 100644 tests/cases/simple-project-1/test-config.json create mode 100644 tests/cases/simple-project-1/tsconfig.json create mode 100644 tests/cases/simple-project-2/foo.ts create mode 100644 tests/cases/simple-project-2/index.ts create mode 100644 tests/cases/simple-project-2/package.json create mode 100644 tests/cases/simple-project-2/test-config.json create mode 100644 tests/cases/simple-project-2/tsconfig.json diff --git a/tests/cases/simple-project-1/index.ts b/tests/cases/simple-project-1/index.ts new file mode 100644 index 00000000..0286763e --- /dev/null +++ b/tests/cases/simple-project-1/index.ts @@ -0,0 +1,5 @@ +export class Foo { + public HandleMessage(message: string): string { + return message; + } +} diff --git a/tests/cases/simple-project-1/package.json b/tests/cases/simple-project-1/package.json new file mode 100644 index 00000000..6d2e250d --- /dev/null +++ b/tests/cases/simple-project-1/package.json @@ -0,0 +1,13 @@ +{ + "name": "simple-project-1", + "private": true, + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/tests/cases/simple-project-1/test-config.json b/tests/cases/simple-project-1/test-config.json new file mode 100644 index 00000000..f4bef8b7 --- /dev/null +++ b/tests/cases/simple-project-1/test-config.json @@ -0,0 +1,7 @@ +{ + "EntryFiles": [ + "./index.ts", + "./index2.ts", + "./index3.ts" + ] +} diff --git a/tests/cases/simple-project-1/tsconfig.json b/tests/cases/simple-project-1/tsconfig.json new file mode 100644 index 00000000..433fcc04 --- /dev/null +++ b/tests/cases/simple-project-1/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "removeComments": false, + "outDir": "dist", + "rootDir": "src", + "inlineSourceMap": true, + "inlineSources": true, + "skipDefaultLibCheck": true, + "declaration": true, + "pretty": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6" + ], + "types": [ + "node" + ], + "typeRoots": [ + "./node_modules/@types" + ] + }, + "exclude": [ + "node_modules", + "dist", + "@types", + "tests", + "examples" + ] +} diff --git a/tests/cases/simple-project-2/foo.ts b/tests/cases/simple-project-2/foo.ts new file mode 100644 index 00000000..38491e67 --- /dev/null +++ b/tests/cases/simple-project-2/foo.ts @@ -0,0 +1,5 @@ +export class Foo { + public GetMessage(message: string): string { + return message; + } +} diff --git a/tests/cases/simple-project-2/index.ts b/tests/cases/simple-project-2/index.ts new file mode 100644 index 00000000..1c5e60c1 --- /dev/null +++ b/tests/cases/simple-project-2/index.ts @@ -0,0 +1,7 @@ +export { Foo } from "./foo"; + +export class FooStart { + public HandleMessage(message: string): string { + return message; + } +} diff --git a/tests/cases/simple-project-2/package.json b/tests/cases/simple-project-2/package.json new file mode 100644 index 00000000..11443f1e --- /dev/null +++ b/tests/cases/simple-project-2/package.json @@ -0,0 +1,13 @@ +{ + "name": "simple-project-2", + "private": true, + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/tests/cases/simple-project-2/test-config.json b/tests/cases/simple-project-2/test-config.json new file mode 100644 index 00000000..a058bc3b --- /dev/null +++ b/tests/cases/simple-project-2/test-config.json @@ -0,0 +1,5 @@ +{ + "EntryFiles": [ + "./index.ts" + ] +} diff --git a/tests/cases/simple-project-2/tsconfig.json b/tests/cases/simple-project-2/tsconfig.json new file mode 100644 index 00000000..433fcc04 --- /dev/null +++ b/tests/cases/simple-project-2/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "removeComments": false, + "outDir": "dist", + "rootDir": "src", + "inlineSourceMap": true, + "inlineSources": true, + "skipDefaultLibCheck": true, + "declaration": true, + "pretty": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6" + ], + "types": [ + "node" + ], + "typeRoots": [ + "./node_modules/@types" + ] + }, + "exclude": [ + "node_modules", + "dist", + "@types", + "tests", + "examples" + ] +} From 758c2612edecb0389130ca2d4ceaaea1776c3799 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 19:56:01 +0200 Subject: [PATCH 37/61] Moved project to packages/ts-docs-gen. --- .gitignore => packages/ts-docs-gen/.gitignore | 0 {.vscode => packages/ts-docs-gen/.vscode}/cSpell.json | 0 {.vscode => packages/ts-docs-gen/.vscode}/launch.json | 0 {.vscode => packages/ts-docs-gen/.vscode}/settings.json | 0 {.vscode => packages/ts-docs-gen/.vscode}/tasks.json | 0 README.md => packages/ts-docs-gen/README.md | 0 .../ts-docs-gen/examples}/simple/exported-const-variables.ts | 0 .../ts-docs-gen/examples}/simple/exported-functions.ts | 0 {examples => packages/ts-docs-gen/examples}/simple/index.ts | 0 {examples => packages/ts-docs-gen/examples}/simple/my-types.ts | 0 {examples => packages/ts-docs-gen/examples}/simple/package.json | 0 {examples => packages/ts-docs-gen/examples}/simple/tsconfig.json | 0 package.json => packages/ts-docs-gen/package.json | 0 .../ts-docs-gen/src}/abstractions/api-item-plugin-base.ts | 0 {src => packages/ts-docs-gen/src}/abstractions/printer-base.ts | 0 .../ts-docs-gen/src}/builders/generator-configuration-builder.ts | 0 .../ts-docs-gen/src}/contracts/generator-configuration.ts | 0 .../ts-docs-gen/src}/contracts/render-item-output-dto.ts | 0 {src => packages/ts-docs-gen/src}/contracts/rendered-dto.ts | 0 {src => packages/ts-docs-gen/src}/contracts/rendered-item.ts | 0 .../ts-docs-gen/src}/contracts/supported-api-item-kind-type.ts | 0 {src => packages/ts-docs-gen/src}/debug.ts | 0 {src => packages/ts-docs-gen/src}/generator.ts | 0 {src => packages/ts-docs-gen/src}/index.ts | 0 {src => packages/ts-docs-gen/src}/plugins/api-default-plugin.ts | 0 {src => packages/ts-docs-gen/src}/printers/default-printer.ts | 0 {src => packages/ts-docs-gen/src}/registries/plugin-registry.ts | 0 {src => packages/ts-docs-gen/src}/utils/logger.ts | 0 {tests => packages/ts-docs-gen/tests}/.gitignore | 0 {tests => packages/ts-docs-gen/tests}/build-tests.ts | 0 .../ts-docs-gen/tests}/cases/simple-project-1/index.ts | 0 .../ts-docs-gen/tests}/cases/simple-project-1/package.json | 0 .../ts-docs-gen/tests}/cases/simple-project-1/test-config.json | 0 .../ts-docs-gen/tests}/cases/simple-project-1/tsconfig.json | 0 .../ts-docs-gen/tests}/cases/simple-project-2/foo.ts | 0 .../ts-docs-gen/tests}/cases/simple-project-2/index.ts | 0 .../ts-docs-gen/tests}/cases/simple-project-2/package.json | 0 .../ts-docs-gen/tests}/cases/simple-project-2/test-config.json | 0 .../ts-docs-gen/tests}/cases/simple-project-2/tsconfig.json | 0 {tests => packages/ts-docs-gen/tests}/scripts/tests-cleanup.ts | 0 {tests => packages/ts-docs-gen/tests}/scripts/tests-generator.ts | 0 {tests => packages/ts-docs-gen/tests}/scripts/tests-helpers.ts | 0 {tests => packages/ts-docs-gen/tests}/tsconfig.json | 0 tsconfig.json => packages/ts-docs-gen/tsconfig.json | 0 tslint.json => packages/ts-docs-gen/tslint.json | 0 45 files changed, 0 insertions(+), 0 deletions(-) rename .gitignore => packages/ts-docs-gen/.gitignore (100%) rename {.vscode => packages/ts-docs-gen/.vscode}/cSpell.json (100%) rename {.vscode => packages/ts-docs-gen/.vscode}/launch.json (100%) rename {.vscode => packages/ts-docs-gen/.vscode}/settings.json (100%) rename {.vscode => packages/ts-docs-gen/.vscode}/tasks.json (100%) rename README.md => packages/ts-docs-gen/README.md (100%) rename {examples => packages/ts-docs-gen/examples}/simple/exported-const-variables.ts (100%) rename {examples => packages/ts-docs-gen/examples}/simple/exported-functions.ts (100%) rename {examples => packages/ts-docs-gen/examples}/simple/index.ts (100%) rename {examples => packages/ts-docs-gen/examples}/simple/my-types.ts (100%) rename {examples => packages/ts-docs-gen/examples}/simple/package.json (100%) rename {examples => packages/ts-docs-gen/examples}/simple/tsconfig.json (100%) rename package.json => packages/ts-docs-gen/package.json (100%) rename {src => packages/ts-docs-gen/src}/abstractions/api-item-plugin-base.ts (100%) rename {src => packages/ts-docs-gen/src}/abstractions/printer-base.ts (100%) rename {src => packages/ts-docs-gen/src}/builders/generator-configuration-builder.ts (100%) rename {src => packages/ts-docs-gen/src}/contracts/generator-configuration.ts (100%) rename {src => packages/ts-docs-gen/src}/contracts/render-item-output-dto.ts (100%) rename {src => packages/ts-docs-gen/src}/contracts/rendered-dto.ts (100%) rename {src => packages/ts-docs-gen/src}/contracts/rendered-item.ts (100%) rename {src => packages/ts-docs-gen/src}/contracts/supported-api-item-kind-type.ts (100%) rename {src => packages/ts-docs-gen/src}/debug.ts (100%) rename {src => packages/ts-docs-gen/src}/generator.ts (100%) rename {src => packages/ts-docs-gen/src}/index.ts (100%) rename {src => packages/ts-docs-gen/src}/plugins/api-default-plugin.ts (100%) rename {src => packages/ts-docs-gen/src}/printers/default-printer.ts (100%) rename {src => packages/ts-docs-gen/src}/registries/plugin-registry.ts (100%) rename {src => packages/ts-docs-gen/src}/utils/logger.ts (100%) rename {tests => packages/ts-docs-gen/tests}/.gitignore (100%) rename {tests => packages/ts-docs-gen/tests}/build-tests.ts (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-1/index.ts (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-1/package.json (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-1/test-config.json (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-1/tsconfig.json (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-2/foo.ts (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-2/index.ts (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-2/package.json (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-2/test-config.json (100%) rename {tests => packages/ts-docs-gen/tests}/cases/simple-project-2/tsconfig.json (100%) rename {tests => packages/ts-docs-gen/tests}/scripts/tests-cleanup.ts (100%) rename {tests => packages/ts-docs-gen/tests}/scripts/tests-generator.ts (100%) rename {tests => packages/ts-docs-gen/tests}/scripts/tests-helpers.ts (100%) rename {tests => packages/ts-docs-gen/tests}/tsconfig.json (100%) rename tsconfig.json => packages/ts-docs-gen/tsconfig.json (100%) rename tslint.json => packages/ts-docs-gen/tslint.json (100%) diff --git a/.gitignore b/packages/ts-docs-gen/.gitignore similarity index 100% rename from .gitignore rename to packages/ts-docs-gen/.gitignore diff --git a/.vscode/cSpell.json b/packages/ts-docs-gen/.vscode/cSpell.json similarity index 100% rename from .vscode/cSpell.json rename to packages/ts-docs-gen/.vscode/cSpell.json diff --git a/.vscode/launch.json b/packages/ts-docs-gen/.vscode/launch.json similarity index 100% rename from .vscode/launch.json rename to packages/ts-docs-gen/.vscode/launch.json diff --git a/.vscode/settings.json b/packages/ts-docs-gen/.vscode/settings.json similarity index 100% rename from .vscode/settings.json rename to packages/ts-docs-gen/.vscode/settings.json diff --git a/.vscode/tasks.json b/packages/ts-docs-gen/.vscode/tasks.json similarity index 100% rename from .vscode/tasks.json rename to packages/ts-docs-gen/.vscode/tasks.json diff --git a/README.md b/packages/ts-docs-gen/README.md similarity index 100% rename from README.md rename to packages/ts-docs-gen/README.md diff --git a/examples/simple/exported-const-variables.ts b/packages/ts-docs-gen/examples/simple/exported-const-variables.ts similarity index 100% rename from examples/simple/exported-const-variables.ts rename to packages/ts-docs-gen/examples/simple/exported-const-variables.ts diff --git a/examples/simple/exported-functions.ts b/packages/ts-docs-gen/examples/simple/exported-functions.ts similarity index 100% rename from examples/simple/exported-functions.ts rename to packages/ts-docs-gen/examples/simple/exported-functions.ts diff --git a/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts similarity index 100% rename from examples/simple/index.ts rename to packages/ts-docs-gen/examples/simple/index.ts diff --git a/examples/simple/my-types.ts b/packages/ts-docs-gen/examples/simple/my-types.ts similarity index 100% rename from examples/simple/my-types.ts rename to packages/ts-docs-gen/examples/simple/my-types.ts diff --git a/examples/simple/package.json b/packages/ts-docs-gen/examples/simple/package.json similarity index 100% rename from examples/simple/package.json rename to packages/ts-docs-gen/examples/simple/package.json diff --git a/examples/simple/tsconfig.json b/packages/ts-docs-gen/examples/simple/tsconfig.json similarity index 100% rename from examples/simple/tsconfig.json rename to packages/ts-docs-gen/examples/simple/tsconfig.json diff --git a/package.json b/packages/ts-docs-gen/package.json similarity index 100% rename from package.json rename to packages/ts-docs-gen/package.json diff --git a/src/abstractions/api-item-plugin-base.ts b/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts similarity index 100% rename from src/abstractions/api-item-plugin-base.ts rename to packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts diff --git a/src/abstractions/printer-base.ts b/packages/ts-docs-gen/src/abstractions/printer-base.ts similarity index 100% rename from src/abstractions/printer-base.ts rename to packages/ts-docs-gen/src/abstractions/printer-base.ts diff --git a/src/builders/generator-configuration-builder.ts b/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts similarity index 100% rename from src/builders/generator-configuration-builder.ts rename to packages/ts-docs-gen/src/builders/generator-configuration-builder.ts diff --git a/src/contracts/generator-configuration.ts b/packages/ts-docs-gen/src/contracts/generator-configuration.ts similarity index 100% rename from src/contracts/generator-configuration.ts rename to packages/ts-docs-gen/src/contracts/generator-configuration.ts diff --git a/src/contracts/render-item-output-dto.ts b/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts similarity index 100% rename from src/contracts/render-item-output-dto.ts rename to packages/ts-docs-gen/src/contracts/render-item-output-dto.ts diff --git a/src/contracts/rendered-dto.ts b/packages/ts-docs-gen/src/contracts/rendered-dto.ts similarity index 100% rename from src/contracts/rendered-dto.ts rename to packages/ts-docs-gen/src/contracts/rendered-dto.ts diff --git a/src/contracts/rendered-item.ts b/packages/ts-docs-gen/src/contracts/rendered-item.ts similarity index 100% rename from src/contracts/rendered-item.ts rename to packages/ts-docs-gen/src/contracts/rendered-item.ts diff --git a/src/contracts/supported-api-item-kind-type.ts b/packages/ts-docs-gen/src/contracts/supported-api-item-kind-type.ts similarity index 100% rename from src/contracts/supported-api-item-kind-type.ts rename to packages/ts-docs-gen/src/contracts/supported-api-item-kind-type.ts diff --git a/src/debug.ts b/packages/ts-docs-gen/src/debug.ts similarity index 100% rename from src/debug.ts rename to packages/ts-docs-gen/src/debug.ts diff --git a/src/generator.ts b/packages/ts-docs-gen/src/generator.ts similarity index 100% rename from src/generator.ts rename to packages/ts-docs-gen/src/generator.ts diff --git a/src/index.ts b/packages/ts-docs-gen/src/index.ts similarity index 100% rename from src/index.ts rename to packages/ts-docs-gen/src/index.ts diff --git a/src/plugins/api-default-plugin.ts b/packages/ts-docs-gen/src/plugins/api-default-plugin.ts similarity index 100% rename from src/plugins/api-default-plugin.ts rename to packages/ts-docs-gen/src/plugins/api-default-plugin.ts diff --git a/src/printers/default-printer.ts b/packages/ts-docs-gen/src/printers/default-printer.ts similarity index 100% rename from src/printers/default-printer.ts rename to packages/ts-docs-gen/src/printers/default-printer.ts diff --git a/src/registries/plugin-registry.ts b/packages/ts-docs-gen/src/registries/plugin-registry.ts similarity index 100% rename from src/registries/plugin-registry.ts rename to packages/ts-docs-gen/src/registries/plugin-registry.ts diff --git a/src/utils/logger.ts b/packages/ts-docs-gen/src/utils/logger.ts similarity index 100% rename from src/utils/logger.ts rename to packages/ts-docs-gen/src/utils/logger.ts diff --git a/tests/.gitignore b/packages/ts-docs-gen/tests/.gitignore similarity index 100% rename from tests/.gitignore rename to packages/ts-docs-gen/tests/.gitignore diff --git a/tests/build-tests.ts b/packages/ts-docs-gen/tests/build-tests.ts similarity index 100% rename from tests/build-tests.ts rename to packages/ts-docs-gen/tests/build-tests.ts diff --git a/tests/cases/simple-project-1/index.ts b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts similarity index 100% rename from tests/cases/simple-project-1/index.ts rename to packages/ts-docs-gen/tests/cases/simple-project-1/index.ts diff --git a/tests/cases/simple-project-1/package.json b/packages/ts-docs-gen/tests/cases/simple-project-1/package.json similarity index 100% rename from tests/cases/simple-project-1/package.json rename to packages/ts-docs-gen/tests/cases/simple-project-1/package.json diff --git a/tests/cases/simple-project-1/test-config.json b/packages/ts-docs-gen/tests/cases/simple-project-1/test-config.json similarity index 100% rename from tests/cases/simple-project-1/test-config.json rename to packages/ts-docs-gen/tests/cases/simple-project-1/test-config.json diff --git a/tests/cases/simple-project-1/tsconfig.json b/packages/ts-docs-gen/tests/cases/simple-project-1/tsconfig.json similarity index 100% rename from tests/cases/simple-project-1/tsconfig.json rename to packages/ts-docs-gen/tests/cases/simple-project-1/tsconfig.json diff --git a/tests/cases/simple-project-2/foo.ts b/packages/ts-docs-gen/tests/cases/simple-project-2/foo.ts similarity index 100% rename from tests/cases/simple-project-2/foo.ts rename to packages/ts-docs-gen/tests/cases/simple-project-2/foo.ts diff --git a/tests/cases/simple-project-2/index.ts b/packages/ts-docs-gen/tests/cases/simple-project-2/index.ts similarity index 100% rename from tests/cases/simple-project-2/index.ts rename to packages/ts-docs-gen/tests/cases/simple-project-2/index.ts diff --git a/tests/cases/simple-project-2/package.json b/packages/ts-docs-gen/tests/cases/simple-project-2/package.json similarity index 100% rename from tests/cases/simple-project-2/package.json rename to packages/ts-docs-gen/tests/cases/simple-project-2/package.json diff --git a/tests/cases/simple-project-2/test-config.json b/packages/ts-docs-gen/tests/cases/simple-project-2/test-config.json similarity index 100% rename from tests/cases/simple-project-2/test-config.json rename to packages/ts-docs-gen/tests/cases/simple-project-2/test-config.json diff --git a/tests/cases/simple-project-2/tsconfig.json b/packages/ts-docs-gen/tests/cases/simple-project-2/tsconfig.json similarity index 100% rename from tests/cases/simple-project-2/tsconfig.json rename to packages/ts-docs-gen/tests/cases/simple-project-2/tsconfig.json diff --git a/tests/scripts/tests-cleanup.ts b/packages/ts-docs-gen/tests/scripts/tests-cleanup.ts similarity index 100% rename from tests/scripts/tests-cleanup.ts rename to packages/ts-docs-gen/tests/scripts/tests-cleanup.ts diff --git a/tests/scripts/tests-generator.ts b/packages/ts-docs-gen/tests/scripts/tests-generator.ts similarity index 100% rename from tests/scripts/tests-generator.ts rename to packages/ts-docs-gen/tests/scripts/tests-generator.ts diff --git a/tests/scripts/tests-helpers.ts b/packages/ts-docs-gen/tests/scripts/tests-helpers.ts similarity index 100% rename from tests/scripts/tests-helpers.ts rename to packages/ts-docs-gen/tests/scripts/tests-helpers.ts diff --git a/tests/tsconfig.json b/packages/ts-docs-gen/tests/tsconfig.json similarity index 100% rename from tests/tsconfig.json rename to packages/ts-docs-gen/tests/tsconfig.json diff --git a/tsconfig.json b/packages/ts-docs-gen/tsconfig.json similarity index 100% rename from tsconfig.json rename to packages/ts-docs-gen/tsconfig.json diff --git a/tslint.json b/packages/ts-docs-gen/tslint.json similarity index 100% rename from tslint.json rename to packages/ts-docs-gen/tslint.json From 3d24cb162ec988a53487230b487dee2a45b9a720 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:10:14 +0200 Subject: [PATCH 38/61] Moved .gitignore to root folder. --- packages/ts-docs-gen/.gitignore => .gitignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/ts-docs-gen/.gitignore => .gitignore (100%) diff --git a/packages/ts-docs-gen/.gitignore b/.gitignore similarity index 100% rename from packages/ts-docs-gen/.gitignore rename to .gitignore From 91c50e4e1809d67025024affafb7dd530f86f65c Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:10:30 +0200 Subject: [PATCH 39/61] Added schema to root folder. --- package.json | 9 ++ rush.json | 12 +++ schemas/rush.schema.json | 205 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 226 insertions(+) create mode 100644 package.json create mode 100644 rush.json create mode 100644 schemas/rush.schema.json diff --git a/package.json b/package.json new file mode 100644 index 00000000..3e26991c --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "ts-docs-gen-repo", + "version": "0.0.0", + "private": true, + "description": "TypeScript documentation generation repository.", + "devDependencies": { + "@microsoft/rush": "^4.0.1" + } +} diff --git a/rush.json b/rush.json new file mode 100644 index 00000000..13d716fd --- /dev/null +++ b/rush.json @@ -0,0 +1,12 @@ +{ + "$schema": "./schemas/rush.schema.json", + "npmVersion": "4.5.0", + "rushVersion": "4.0.1", + "projects": [ + { + "packageName": "ts-docs-gen", + "projectFolder": "packages/ts-docs-gen", + "shouldPublish": false + } + ] +} diff --git a/schemas/rush.schema.json b/schemas/rush.schema.json new file mode 100644 index 00000000..cb4b41bd --- /dev/null +++ b/schemas/rush.schema.json @@ -0,0 +1,205 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Rush Configuration", + "description": "Configuration file for the Rush multi-package build tool", + "type": "object", + + "oneOf": [ + { + "type": "object", + "required": ["npmVersion"], + "properties": { + "npmVersion": { + "description": "The version of the NPM tool to install.", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + } + } + }, + { + "type": "object", + "required": ["pnpmVersion"], + "properties": { + "pnpmVersion": { + "description": "The version of the PNPM tool to install.", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + } + } + } + ], + + "properties": { + + "$schema": { + "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.", + "type": "string" + }, + + "npmVersion": { + "type": "string" + }, + + "pnpmVersion": { + "type": "string" + }, + + "rushVersion": { + "description": "The version of the Rush tool that will be used to build this repository.", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + }, + "nodeSupportedVersionRange": { + "description": "A node-semver expression (e.g. \">=1.2.3 <2.0.0\", see https://github.com/npm/node-semver) indicating which versions of Node.js can safely be used to build this repository. If omitted, no validation is performed.", + "type": "string" + }, + "projectFolderMinDepth": { + "description": "The minimum folder depth for the projectFolder field. The default value is 1, i.e. no slashes in the path name.", + "type": "number" + }, + "hotfixChangeEnabled": { + "description": "Allows creation of hotfix changes. This feature is experimental so it is disabled by default.", + "type": "boolean" + }, + "projectFolderMaxDepth": { + "description": "The maximum folder depth for the projectFolder field. The default value is 2, i.e. a single slash in the path name.", + "type": "number" + }, + "approvedPackagesPolicy": { + "description": "Controls a package review workflow driven by the two config files \"browser-approved-packages.json\" and \"nonbrowser-approved-packages.json\"", + "type": "object", + "properties": { + "reviewCategories": { + "description": "A list of category names that can be applied to each project, and then referenced in \"browser-approved-packages.json\" and \"nonbrowser-approved-packages.json\"", + "type": "array", + "items": { + "type": "string" + } + }, + "ignoredNpmScopes": { + "description": "A list of NPM package scopes that will be excluded from review (e.g. \"@types\")", + "type": "array", + "items": { + "type": "string", + "pattern": "^@" + } + } + }, + "additionalProperties": false + }, + "gitPolicy": { + "description": "If the project is stored in a Git repository, additional settings related to Git", + "type": "object", + "properties": { + "allowedEmailRegExps": { + "description": "A list of regular expressions describing allowable e-mail patterns for Git commits. They are case-insensitive anchored JavaScript RegExps. Example: \".*@example\\.com\"", + "type": "array", + "items": { + "type": "string" + } + }, + "sampleEmail": { + "description": "An example valid e-mail address for \"Mr. Example\" that conforms to one of the allowedEmailRegExps. Example: \"mr-example@contoso\\.com\"", + "type": "string" + } + }, + "additionalProperties": false + }, + "repository": { + "description": "The repository location", + "type": "object", + "properties": { + "url": { + "description": "The remote url of the repository. If a value is provided, \"Rush change\" will use it to find the right remote to compare against.", + "type": "string" + } + }, + "additionalProperties": false + }, + "telemetryEnabled": { + "description": "Indicates whether telemetry data should be collected and stored in the Rush temp folder during Rush runs.", + "type": "boolean" + }, + "projects": { + "description": "A list of projects managed by this tool.", + "type": "array", + "items": { + "type": "object", + "properties": { + "packageName": { + "description": "The NPM package name of the project.", + "type": "string" + }, + "projectFolder": { + "description": "The path to the project folder relative to the Rush config file.", + "type": "string" + }, + "reviewCategory": { + "description": "An optional category for usage in the \"browser-approved-packages.json\" and \"nonbrowser-approved-packages.json\" files. Only strings from reviewCategories are allowed here.", + "type": "string" + }, + "cyclicDependencyProjects": { + "description": "A list of local projects that appear as devDependencies for this project, but cannot be locally linked because it would create a cyclic dependency; instead, the last published version will be installed in the Common folder.", + "type": "array", + "items": { + "type": "string" + } + }, + "shouldPublish": { + "description": "A flag indicating that changes to this project will be published to npm, which affects the Rush change and publish workflows.", + "type": "boolean" + }, + "versionPolicyName": { + "description": "An optional version policy associated with the project. Version policies are defined in \"version-policies.json file.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "packageName", + "projectFolder" + ] + } + }, + "eventHooks": { + "description": "Hooks are customized script actions that Rush executes when specific events occur.", + "type": "object", + "properties": { + "preRushInstall": { + "description": "The list of scripts to run before the Rush install command starts.", + "type": "array", + "items": { + "type": "string" + } + }, + "postRushInstall": { + "description": "The list of scripts to run after the Rush install command finishes.", + "type": "array", + "items": { + "type": "string" + } + }, + "preRushBuild": { + "description": "The list of scripts to run before the Rush build command starts.", + "type": "array", + "items": { + "type": "string" + } + }, + "postRushBuild": { + "description": "The list of scripts to run after the Rush build command finishes.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "rushVersion", + "projects" + ] + } From c633cfe3f024ac33818dfc1068b03b0e19bb59a3 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:11:08 +0200 Subject: [PATCH 40/61] Added schema to root folder. --- package.json | 9 ++ packages/ts-docs-gen/package.json | 2 +- rush.json | 12 ++ schemas/rush.schema.json | 205 ++++++++++++++++++++++++++++++ 4 files changed, 227 insertions(+), 1 deletion(-) create mode 100644 package.json create mode 100644 rush.json create mode 100644 schemas/rush.schema.json diff --git a/package.json b/package.json new file mode 100644 index 00000000..3e26991c --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "ts-docs-gen-repo", + "version": "0.0.0", + "private": true, + "description": "TypeScript documentation generation repository.", + "devDependencies": { + "@microsoft/rush": "^4.0.1" + } +} diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index ac0b4381..66edf41a 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -1,5 +1,5 @@ { - "name": "@simplr/ts-docs-gen", + "name": "ts-docs-gen", "version": "1.0.0", "description": "", "main": "index.js", diff --git a/rush.json b/rush.json new file mode 100644 index 00000000..13d716fd --- /dev/null +++ b/rush.json @@ -0,0 +1,12 @@ +{ + "$schema": "./schemas/rush.schema.json", + "npmVersion": "4.5.0", + "rushVersion": "4.0.1", + "projects": [ + { + "packageName": "ts-docs-gen", + "projectFolder": "packages/ts-docs-gen", + "shouldPublish": false + } + ] +} diff --git a/schemas/rush.schema.json b/schemas/rush.schema.json new file mode 100644 index 00000000..cb4b41bd --- /dev/null +++ b/schemas/rush.schema.json @@ -0,0 +1,205 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Rush Configuration", + "description": "Configuration file for the Rush multi-package build tool", + "type": "object", + + "oneOf": [ + { + "type": "object", + "required": ["npmVersion"], + "properties": { + "npmVersion": { + "description": "The version of the NPM tool to install.", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + } + } + }, + { + "type": "object", + "required": ["pnpmVersion"], + "properties": { + "pnpmVersion": { + "description": "The version of the PNPM tool to install.", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + } + } + } + ], + + "properties": { + + "$schema": { + "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.", + "type": "string" + }, + + "npmVersion": { + "type": "string" + }, + + "pnpmVersion": { + "type": "string" + }, + + "rushVersion": { + "description": "The version of the Rush tool that will be used to build this repository.", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" + }, + "nodeSupportedVersionRange": { + "description": "A node-semver expression (e.g. \">=1.2.3 <2.0.0\", see https://github.com/npm/node-semver) indicating which versions of Node.js can safely be used to build this repository. If omitted, no validation is performed.", + "type": "string" + }, + "projectFolderMinDepth": { + "description": "The minimum folder depth for the projectFolder field. The default value is 1, i.e. no slashes in the path name.", + "type": "number" + }, + "hotfixChangeEnabled": { + "description": "Allows creation of hotfix changes. This feature is experimental so it is disabled by default.", + "type": "boolean" + }, + "projectFolderMaxDepth": { + "description": "The maximum folder depth for the projectFolder field. The default value is 2, i.e. a single slash in the path name.", + "type": "number" + }, + "approvedPackagesPolicy": { + "description": "Controls a package review workflow driven by the two config files \"browser-approved-packages.json\" and \"nonbrowser-approved-packages.json\"", + "type": "object", + "properties": { + "reviewCategories": { + "description": "A list of category names that can be applied to each project, and then referenced in \"browser-approved-packages.json\" and \"nonbrowser-approved-packages.json\"", + "type": "array", + "items": { + "type": "string" + } + }, + "ignoredNpmScopes": { + "description": "A list of NPM package scopes that will be excluded from review (e.g. \"@types\")", + "type": "array", + "items": { + "type": "string", + "pattern": "^@" + } + } + }, + "additionalProperties": false + }, + "gitPolicy": { + "description": "If the project is stored in a Git repository, additional settings related to Git", + "type": "object", + "properties": { + "allowedEmailRegExps": { + "description": "A list of regular expressions describing allowable e-mail patterns for Git commits. They are case-insensitive anchored JavaScript RegExps. Example: \".*@example\\.com\"", + "type": "array", + "items": { + "type": "string" + } + }, + "sampleEmail": { + "description": "An example valid e-mail address for \"Mr. Example\" that conforms to one of the allowedEmailRegExps. Example: \"mr-example@contoso\\.com\"", + "type": "string" + } + }, + "additionalProperties": false + }, + "repository": { + "description": "The repository location", + "type": "object", + "properties": { + "url": { + "description": "The remote url of the repository. If a value is provided, \"Rush change\" will use it to find the right remote to compare against.", + "type": "string" + } + }, + "additionalProperties": false + }, + "telemetryEnabled": { + "description": "Indicates whether telemetry data should be collected and stored in the Rush temp folder during Rush runs.", + "type": "boolean" + }, + "projects": { + "description": "A list of projects managed by this tool.", + "type": "array", + "items": { + "type": "object", + "properties": { + "packageName": { + "description": "The NPM package name of the project.", + "type": "string" + }, + "projectFolder": { + "description": "The path to the project folder relative to the Rush config file.", + "type": "string" + }, + "reviewCategory": { + "description": "An optional category for usage in the \"browser-approved-packages.json\" and \"nonbrowser-approved-packages.json\" files. Only strings from reviewCategories are allowed here.", + "type": "string" + }, + "cyclicDependencyProjects": { + "description": "A list of local projects that appear as devDependencies for this project, but cannot be locally linked because it would create a cyclic dependency; instead, the last published version will be installed in the Common folder.", + "type": "array", + "items": { + "type": "string" + } + }, + "shouldPublish": { + "description": "A flag indicating that changes to this project will be published to npm, which affects the Rush change and publish workflows.", + "type": "boolean" + }, + "versionPolicyName": { + "description": "An optional version policy associated with the project. Version policies are defined in \"version-policies.json file.", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "packageName", + "projectFolder" + ] + } + }, + "eventHooks": { + "description": "Hooks are customized script actions that Rush executes when specific events occur.", + "type": "object", + "properties": { + "preRushInstall": { + "description": "The list of scripts to run before the Rush install command starts.", + "type": "array", + "items": { + "type": "string" + } + }, + "postRushInstall": { + "description": "The list of scripts to run after the Rush install command finishes.", + "type": "array", + "items": { + "type": "string" + } + }, + "preRushBuild": { + "description": "The list of scripts to run before the Rush build command starts.", + "type": "array", + "items": { + "type": "string" + } + }, + "postRushBuild": { + "description": "The list of scripts to run after the Rush build command finishes.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "rushVersion", + "projects" + ] + } From 28d21d66e73c092d3189baef92958c8c1131181f Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:19:33 +0200 Subject: [PATCH 41/61] Updated git ignore. --- .gitignore | 22 +- common/config/rush/npm-shrinkwrap.json | 3059 ++++++++++++++++++ {schemas => common/schemas}/rush.schema.json | 0 rush.json | 2 +- 4 files changed, 3081 insertions(+), 2 deletions(-) create mode 100644 common/config/rush/npm-shrinkwrap.json rename {schemas => common/schemas}/rush.schema.json (100%) diff --git a/.gitignore b/.gitignore index 0290e5f0..4e291813 100644 --- a/.gitignore +++ b/.gitignore @@ -269,4 +269,24 @@ package-lock.json **/*.js.map _src -coverage \ No newline at end of file +coverage + +# Rush files +**/*.build.error.log +**/*.build.log +/common/apiDocs/json/** +/common/last-install.flag +/common/last-install.log +/common/local-npm +/common/local-npm/** +/common/local-rush +/common/local-rush/** +/common/npm-cache +/common/npm-cache/** +/common/npm-local +/common/npm-local/** +/common/npm-tmp +/common/npm-tmp/** +/common/rush-link.json +/common/rush-recycler +package-deps.json diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json new file mode 100644 index 00000000..1c68428e --- /dev/null +++ b/common/config/rush/npm-shrinkwrap.json @@ -0,0 +1,3059 @@ +{ + "name": "rush-common", + "version": "0.0.0", + "dependencies": { + "@rush-temp/ts-docs-gen": { + "version": "0.0.0", + "from": "projects\\ts-docs-gen.tgz", + "resolved": "file:projects\\ts-docs-gen.tgz" + }, + "@simplrjs/markdown": { + "version": "0.1.0-beta", + "from": "@simplrjs/markdown@0.1.0-beta", + "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-0.1.0-beta.tgz" + }, + "@types/fs-extra": { + "version": "4.0.5", + "from": "@types/fs-extra@>=4.0.5 <5.0.0", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.5.tgz" + }, + "@types/jest": { + "version": "21.1.8", + "from": "@types/jest@>=21.1.6 <22.0.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.8.tgz" + }, + "@types/node": { + "version": "8.0.53", + "from": "@types/node@*", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.53.tgz" + }, + "@types/sinon": { + "version": "4.0.0", + "from": "@types/sinon@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.0.0.tgz" + }, + "@types/string": { + "version": "0.0.28", + "from": "@types/string@0.0.28", + "resolved": "https://registry.npmjs.org/@types/string/-/string-0.0.28.tgz" + }, + "abab": { + "version": "1.0.4", + "from": "abab@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz" + }, + "acorn": { + "version": "4.0.13", + "from": "acorn@>=4.0.4 <5.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz" + }, + "acorn-globals": { + "version": "3.1.0", + "from": "acorn-globals@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz" + }, + "ajv": { + "version": "5.5.0", + "from": "ajv@>=5.1.0 <6.0.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.0.tgz" + }, + "amdefine": { + "version": "1.0.1", + "from": "amdefine@>=0.0.4", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz" + }, + "ansi-escapes": { + "version": "3.0.0", + "from": "ansi-escapes@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz" + }, + "ansi-regex": { + "version": "2.1.1", + "from": "ansi-regex@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" + }, + "ansi-styles": { + "version": "3.2.0", + "from": "ansi-styles@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz" + }, + "anymatch": { + "version": "1.3.2", + "from": "anymatch@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "from": "arr-diff@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + }, + "array-unique": { + "version": "0.2.1", + "from": "array-unique@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + }, + "braces": { + "version": "1.8.5", + "from": "braces@>=1.8.2 <2.0.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + }, + "expand-brackets": { + "version": "0.1.5", + "from": "expand-brackets@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + }, + "extglob": { + "version": "0.3.2", + "from": "extglob@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + }, + "micromatch": { + "version": "2.3.11", + "from": "micromatch@>=2.1.5 <3.0.0", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + } + } + }, + "append-transform": { + "version": "0.4.0", + "from": "append-transform@>=0.4.0 <0.5.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz" + }, + "argparse": { + "version": "1.0.9", + "from": "argparse@>=1.0.7 <2.0.0", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz" + }, + "arr-diff": { + "version": "4.0.0", + "from": "arr-diff@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz" + }, + "arr-flatten": { + "version": "1.1.0", + "from": "arr-flatten@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz" + }, + "arr-union": { + "version": "3.1.0", + "from": "arr-union@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz" + }, + "array-equal": { + "version": "1.0.0", + "from": "array-equal@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz" + }, + "array-filter": { + "version": "0.0.1", + "from": "array-filter@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz" + }, + "array-map": { + "version": "0.0.0", + "from": "array-map@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz" + }, + "array-reduce": { + "version": "0.0.0", + "from": "array-reduce@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz" + }, + "array-unique": { + "version": "0.3.2", + "from": "array-unique@>=0.3.2 <0.4.0", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz" + }, + "arrify": { + "version": "1.0.1", + "from": "arrify@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" + }, + "asn1": { + "version": "0.2.3", + "from": "asn1@>=0.2.3 <0.3.0", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz" + }, + "assert-plus": { + "version": "1.0.0", + "from": "assert-plus@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" + }, + "astral-regex": { + "version": "1.0.0", + "from": "astral-regex@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz" + }, + "async": { + "version": "2.6.0", + "from": "async@>=2.1.4 <3.0.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz" + }, + "async-each": { + "version": "1.0.1", + "from": "async-each@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz" + }, + "asynckit": { + "version": "0.4.0", + "from": "asynckit@>=0.4.0 <0.5.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" + }, + "atob": { + "version": "2.0.3", + "from": "atob@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz" + }, + "aws-sign2": { + "version": "0.7.0", + "from": "aws-sign2@>=0.7.0 <0.8.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz" + }, + "aws4": { + "version": "1.6.0", + "from": "aws4@>=1.6.0 <2.0.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz" + }, + "babel-code-frame": { + "version": "6.26.0", + "from": "babel-code-frame@>=6.26.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "from": "ansi-styles@>=2.2.1 <3.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz" + }, + "chalk": { + "version": "1.1.3", + "from": "chalk@>=1.1.3 <2.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz" + }, + "strip-ansi": { + "version": "3.0.1", + "from": "strip-ansi@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + }, + "supports-color": { + "version": "2.0.0", + "from": "supports-color@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" + } + } + }, + "babel-core": { + "version": "6.26.0", + "from": "babel-core@>=6.0.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz" + }, + "babel-generator": { + "version": "6.26.0", + "from": "babel-generator@>=6.18.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz" + }, + "babel-helpers": { + "version": "6.24.1", + "from": "babel-helpers@>=6.24.1 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz" + }, + "babel-jest": { + "version": "21.2.0", + "from": "babel-jest@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.2.0.tgz" + }, + "babel-messages": { + "version": "6.23.0", + "from": "babel-messages@>=6.23.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz" + }, + "babel-plugin-istanbul": { + "version": "4.1.5", + "from": "babel-plugin-istanbul@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz" + }, + "babel-plugin-jest-hoist": { + "version": "21.2.0", + "from": "babel-plugin-jest-hoist@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz" + }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "from": "babel-plugin-syntax-object-rest-spread@>=6.13.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz" + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.0", + "from": "babel-plugin-transform-es2015-modules-commonjs@>=6.24.1 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz" + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "from": "babel-plugin-transform-strict-mode@>=6.24.1 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz" + }, + "babel-preset-jest": { + "version": "21.2.0", + "from": "babel-preset-jest@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz" + }, + "babel-register": { + "version": "6.26.0", + "from": "babel-register@>=6.26.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz" + }, + "babel-runtime": { + "version": "6.26.0", + "from": "babel-runtime@>=6.26.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz" + }, + "babel-template": { + "version": "6.26.0", + "from": "babel-template@>=6.16.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz" + }, + "babel-traverse": { + "version": "6.26.0", + "from": "babel-traverse@>=6.18.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz" + }, + "babel-types": { + "version": "6.26.0", + "from": "babel-types@>=6.18.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz" + }, + "babylon": { + "version": "6.18.0", + "from": "babylon@>=6.18.0 <7.0.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz" + }, + "balanced-match": { + "version": "1.0.0", + "from": "balanced-match@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz" + }, + "base": { + "version": "0.11.2", + "from": "base@>=0.11.1 <0.12.0", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz" + }, + "bash-glob": { + "version": "1.0.2", + "from": "bash-glob@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/bash-glob/-/bash-glob-1.0.2.tgz" + }, + "bash-path": { + "version": "1.0.3", + "from": "bash-path@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/bash-path/-/bash-path-1.0.3.tgz" + }, + "binary-extensions": { + "version": "1.11.0", + "from": "binary-extensions@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz" + }, + "boom": { + "version": "4.3.1", + "from": "boom@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz" + }, + "brace-expansion": { + "version": "1.1.8", + "from": "brace-expansion@>=1.1.7 <2.0.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz" + }, + "braces": { + "version": "2.3.0", + "from": "braces@>=2.3.0 <3.0.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz" + }, + "browser-resolve": { + "version": "1.11.2", + "from": "browser-resolve@>=1.11.2 <2.0.0", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz" + }, + "bser": { + "version": "2.0.0", + "from": "bser@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz" + }, + "builtin-modules": { + "version": "1.1.1", + "from": "builtin-modules@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz" + }, + "cache-base": { + "version": "1.0.1", + "from": "cache-base@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz" + }, + "call-me-maybe": { + "version": "1.0.1", + "from": "call-me-maybe@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz" + }, + "callsites": { + "version": "2.0.0", + "from": "callsites@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz" + }, + "camelcase": { + "version": "4.1.0", + "from": "camelcase@>=4.1.0 <5.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz" + }, + "caseless": { + "version": "0.12.0", + "from": "caseless@>=0.12.0 <0.13.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz" + }, + "chalk": { + "version": "2.3.0", + "from": "chalk@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz" + }, + "chokidar": { + "version": "1.7.0", + "from": "chokidar@>=1.6.0 <2.0.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "dependencies": { + "glob-parent": { + "version": "2.0.0", + "from": "glob-parent@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + } + } + }, + "ci-info": { + "version": "1.1.2", + "from": "ci-info@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.2.tgz" + }, + "class-utils": { + "version": "0.3.5", + "from": "class-utils@>=0.3.5 <0.4.0", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.5.tgz", + "dependencies": { + "define-property": { + "version": "0.2.5", + "from": "define-property@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + }, + "is-descriptor": { + "version": "0.1.6", + "from": "is-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + }, + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "cliui": { + "version": "3.2.0", + "from": "cliui@>=3.2.0 <4.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "dependencies": { + "string-width": { + "version": "1.0.2", + "from": "string-width@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" + }, + "strip-ansi": { + "version": "3.0.1", + "from": "strip-ansi@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + } + } + }, + "co": { + "version": "4.6.0", + "from": "co@>=4.6.0 <5.0.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz" + }, + "code-point-at": { + "version": "1.1.0", + "from": "code-point-at@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz" + }, + "collection-visit": { + "version": "1.0.0", + "from": "collection-visit@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz" + }, + "color-convert": { + "version": "1.9.1", + "from": "color-convert@>=1.9.0 <2.0.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz" + }, + "color-name": { + "version": "1.1.3", + "from": "color-name@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + }, + "combined-stream": { + "version": "1.0.5", + "from": "combined-stream@>=1.0.5 <1.1.0", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz" + }, + "commander": { + "version": "2.12.2", + "from": "commander@>=2.9.0 <3.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz" + }, + "component-emitter": { + "version": "1.2.1", + "from": "component-emitter@>=1.2.1 <2.0.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz" + }, + "concat-map": { + "version": "0.0.1", + "from": "concat-map@0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "content-type-parser": { + "version": "1.0.2", + "from": "content-type-parser@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz" + }, + "convert-source-map": { + "version": "1.5.1", + "from": "convert-source-map@>=1.4.0 <2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz" + }, + "copy-descriptor": { + "version": "0.1.1", + "from": "copy-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz" + }, + "core-js": { + "version": "2.5.1", + "from": "core-js@>=2.4.0 <3.0.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz" + }, + "core-util-is": { + "version": "1.0.2", + "from": "core-util-is@1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" + }, + "cpx": { + "version": "1.5.0", + "from": "cpx@>=1.5.0 <2.0.0", + "resolved": "https://registry.npmjs.org/cpx/-/cpx-1.5.0.tgz" + }, + "cross-spawn": { + "version": "5.1.0", + "from": "cross-spawn@>=5.1.0 <6.0.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz" + }, + "cryptiles": { + "version": "3.1.2", + "from": "cryptiles@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "dependencies": { + "boom": { + "version": "5.2.0", + "from": "boom@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz" + } + } + }, + "cssom": { + "version": "0.3.2", + "from": "cssom@>=0.3.2 <0.4.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz" + }, + "cssstyle": { + "version": "0.2.37", + "from": "cssstyle@>=0.2.37 <0.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz" + }, + "dashdash": { + "version": "1.14.1", + "from": "dashdash@>=1.12.0 <2.0.0", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz" + }, + "debug": { + "version": "2.6.9", + "from": "debug@>=2.2.0 <3.0.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + }, + "decamelize": { + "version": "1.2.0", + "from": "decamelize@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" + }, + "decode-uri-component": { + "version": "0.2.0", + "from": "decode-uri-component@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz" + }, + "deep-is": { + "version": "0.1.3", + "from": "deep-is@>=0.1.3 <0.2.0", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz" + }, + "default-require-extensions": { + "version": "1.0.0", + "from": "default-require-extensions@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz" + }, + "define-property": { + "version": "1.0.0", + "from": "define-property@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz" + }, + "delayed-stream": { + "version": "1.0.0", + "from": "delayed-stream@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" + }, + "detect-indent": { + "version": "4.0.0", + "from": "detect-indent@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz" + }, + "diff": { + "version": "3.4.0", + "from": "diff@>=3.2.0 <4.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz" + }, + "duplexer": { + "version": "0.1.1", + "from": "duplexer@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz" + }, + "errno": { + "version": "0.1.4", + "from": "errno@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz" + }, + "error-ex": { + "version": "1.3.1", + "from": "error-ex@>=1.2.0 <2.0.0", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz" + }, + "es6-promise": { + "version": "4.1.1", + "from": "es6-promise@>=4.1.0 <5.0.0", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz" + }, + "escape-string-regexp": { + "version": "1.0.5", + "from": "escape-string-regexp@>=1.0.5 <2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" + }, + "escodegen": { + "version": "1.9.0", + "from": "escodegen@>=1.6.1 <2.0.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "dependencies": { + "esprima": { + "version": "3.1.3", + "from": "esprima@>=3.1.3 <4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz" + } + } + }, + "esprima": { + "version": "4.0.0", + "from": "esprima@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz" + }, + "estraverse": { + "version": "4.2.0", + "from": "estraverse@>=4.2.0 <5.0.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz" + }, + "esutils": { + "version": "2.0.2", + "from": "esutils@>=2.0.2 <3.0.0", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz" + }, + "exec-sh": { + "version": "0.2.1", + "from": "exec-sh@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz" + }, + "execa": { + "version": "0.7.0", + "from": "execa@>=0.7.0 <0.8.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz" + }, + "expand-brackets": { + "version": "2.1.4", + "from": "expand-brackets@>=2.1.4 <3.0.0", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "dependencies": { + "define-property": { + "version": "0.2.5", + "from": "define-property@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + }, + "is-descriptor": { + "version": "0.1.6", + "from": "is-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + }, + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "expand-range": { + "version": "1.8.2", + "from": "expand-range@>=1.8.1 <2.0.0", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "dependencies": { + "fill-range": { + "version": "2.2.3", + "from": "fill-range@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz" + }, + "is-number": { + "version": "2.1.0", + "from": "is-number@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz" + }, + "isobject": { + "version": "2.1.0", + "from": "isobject@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz" + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + } + } + }, + "expect": { + "version": "21.2.1", + "from": "expect@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-21.2.1.tgz" + }, + "extend": { + "version": "3.0.1", + "from": "extend@>=3.0.1 <3.1.0", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz" + }, + "extend-shallow": { + "version": "2.0.1", + "from": "extend-shallow@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz" + }, + "extglob": { + "version": "2.0.2", + "from": "extglob@>=2.0.2 <3.0.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.2.tgz" + }, + "extsprintf": { + "version": "1.3.0", + "from": "extsprintf@1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" + }, + "fast-deep-equal": { + "version": "1.0.0", + "from": "fast-deep-equal@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz" + }, + "fast-glob": { + "version": "1.0.1", + "from": "fast-glob@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-1.0.1.tgz" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "from": "fast-json-stable-stringify@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz" + }, + "fast-levenshtein": { + "version": "2.0.6", + "from": "fast-levenshtein@>=2.0.4 <2.1.0", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" + }, + "fb-watchman": { + "version": "2.0.0", + "from": "fb-watchman@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz" + }, + "filename-regex": { + "version": "2.0.1", + "from": "filename-regex@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz" + }, + "fileset": { + "version": "2.0.3", + "from": "fileset@>=2.0.2 <3.0.0", + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz" + }, + "fill-range": { + "version": "4.0.0", + "from": "fill-range@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz" + }, + "find-index": { + "version": "0.1.1", + "from": "find-index@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz" + }, + "find-up": { + "version": "2.1.0", + "from": "find-up@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz" + }, + "for-in": { + "version": "1.0.2", + "from": "for-in@>=1.0.2 <2.0.0", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz" + }, + "for-own": { + "version": "0.1.5", + "from": "for-own@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz" + }, + "forever-agent": { + "version": "0.6.1", + "from": "forever-agent@>=0.6.1 <0.7.0", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" + }, + "form-data": { + "version": "2.3.1", + "from": "form-data@>=2.3.1 <2.4.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz" + }, + "formatio": { + "version": "1.2.0", + "from": "formatio@1.2.0", + "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz" + }, + "fragment-cache": { + "version": "0.2.1", + "from": "fragment-cache@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz" + }, + "fs-extra": { + "version": "4.0.2", + "from": "fs-extra@>=4.0.2 <5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz" + }, + "fs.realpath": { + "version": "1.0.0", + "from": "fs.realpath@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + }, + "get-caller-file": { + "version": "1.0.2", + "from": "get-caller-file@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz" + }, + "get-stream": { + "version": "3.0.0", + "from": "get-stream@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz" + }, + "get-value": { + "version": "2.0.6", + "from": "get-value@>=2.0.6 <3.0.0", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz" + }, + "getpass": { + "version": "0.1.7", + "from": "getpass@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz" + }, + "glob": { + "version": "7.1.2", + "from": "glob@>=7.1.2 <8.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz" + }, + "glob-base": { + "version": "0.3.0", + "from": "glob-base@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "dependencies": { + "glob-parent": { + "version": "2.0.0", + "from": "glob-parent@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + } + } + }, + "glob-parent": { + "version": "3.1.0", + "from": "glob-parent@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "dependencies": { + "is-glob": { + "version": "3.1.0", + "from": "is-glob@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz" + } + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "from": "glob-to-regexp@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz" + }, + "glob2base": { + "version": "0.0.12", + "from": "glob2base@>=0.0.12 <0.0.13", + "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz" + }, + "globals": { + "version": "9.18.0", + "from": "globals@>=9.18.0 <10.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz" + }, + "graceful-fs": { + "version": "4.1.11", + "from": "graceful-fs@>=4.1.2 <5.0.0", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz" + }, + "growly": { + "version": "1.3.0", + "from": "growly@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz" + }, + "handlebars": { + "version": "4.0.11", + "from": "handlebars@>=4.0.3 <5.0.0", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "dependencies": { + "async": { + "version": "1.5.2", + "from": "async@>=1.4.0 <2.0.0", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz" + }, + "source-map": { + "version": "0.4.4", + "from": "source-map@>=0.4.4 <0.5.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz" + } + } + }, + "har-schema": { + "version": "2.0.0", + "from": "har-schema@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz" + }, + "har-validator": { + "version": "5.0.3", + "from": "har-validator@>=5.0.3 <5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz" + }, + "has-ansi": { + "version": "2.0.0", + "from": "has-ansi@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz" + }, + "has-flag": { + "version": "2.0.0", + "from": "has-flag@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz" + }, + "has-value": { + "version": "1.0.0", + "from": "has-value@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz" + }, + "has-values": { + "version": "1.0.0", + "from": "has-values@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "dependencies": { + "kind-of": { + "version": "4.0.0", + "from": "kind-of@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz" + } + } + }, + "hawk": { + "version": "6.0.2", + "from": "hawk@>=6.0.2 <6.1.0", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz" + }, + "hoek": { + "version": "4.2.0", + "from": "hoek@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz" + }, + "home-or-tmp": { + "version": "2.0.0", + "from": "home-or-tmp@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz" + }, + "homedir-polyfill": { + "version": "1.0.1", + "from": "homedir-polyfill@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz" + }, + "hosted-git-info": { + "version": "2.5.0", + "from": "hosted-git-info@>=2.1.4 <3.0.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz" + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "from": "html-encoding-sniffer@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz" + }, + "http-signature": { + "version": "1.2.0", + "from": "http-signature@>=1.2.0 <1.3.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz" + }, + "iconv-lite": { + "version": "0.4.19", + "from": "iconv-lite@0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz" + }, + "imurmurhash": { + "version": "0.1.4", + "from": "imurmurhash@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" + }, + "inflight": { + "version": "1.0.6", + "from": "inflight@>=1.0.4 <2.0.0", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + }, + "inherits": { + "version": "2.0.3", + "from": "inherits@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + }, + "invariant": { + "version": "2.2.2", + "from": "invariant@>=2.2.2 <3.0.0", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz" + }, + "invert-kv": { + "version": "1.0.0", + "from": "invert-kv@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz" + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "from": "is-accessor-descriptor@>=0.1.6 <0.2.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "from": "is-arrayish@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" + }, + "is-binary-path": { + "version": "1.0.1", + "from": "is-binary-path@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz" + }, + "is-buffer": { + "version": "1.1.6", + "from": "is-buffer@>=1.1.5 <2.0.0", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" + }, + "is-builtin-module": { + "version": "1.0.0", + "from": "is-builtin-module@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz" + }, + "is-ci": { + "version": "1.0.10", + "from": "is-ci@>=1.0.10 <2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz" + }, + "is-data-descriptor": { + "version": "0.1.4", + "from": "is-data-descriptor@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + } + } + }, + "is-descriptor": { + "version": "1.0.1", + "from": "is-descriptor@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", + "dependencies": { + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "is-dotfile": { + "version": "1.0.3", + "from": "is-dotfile@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz" + }, + "is-equal-shallow": { + "version": "0.1.3", + "from": "is-equal-shallow@>=0.1.3 <0.2.0", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz" + }, + "is-extendable": { + "version": "0.1.1", + "from": "is-extendable@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz" + }, + "is-extglob": { + "version": "2.1.1", + "from": "is-extglob@>=2.1.1 <3.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" + }, + "is-finite": { + "version": "1.0.2", + "from": "is-finite@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "from": "is-fullwidth-code-point@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz" + }, + "is-glob": { + "version": "4.0.0", + "from": "is-glob@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz" + }, + "is-number": { + "version": "3.0.0", + "from": "is-number@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + } + } + }, + "is-odd": { + "version": "1.0.0", + "from": "is-odd@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz" + }, + "is-plain-object": { + "version": "2.0.4", + "from": "is-plain-object@>=2.0.3 <3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz" + }, + "is-posix-bracket": { + "version": "0.1.1", + "from": "is-posix-bracket@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz" + }, + "is-primitive": { + "version": "2.0.0", + "from": "is-primitive@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz" + }, + "is-stream": { + "version": "1.1.0", + "from": "is-stream@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz" + }, + "is-typedarray": { + "version": "1.0.0", + "from": "is-typedarray@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" + }, + "is-utf8": { + "version": "0.2.1", + "from": "is-utf8@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz" + }, + "is-windows": { + "version": "1.0.1", + "from": "is-windows@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz" + }, + "isarray": { + "version": "1.0.0", + "from": "isarray@1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + }, + "isexe": { + "version": "2.0.0", + "from": "isexe@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + }, + "isobject": { + "version": "3.0.1", + "from": "isobject@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz" + }, + "isstream": { + "version": "0.1.2", + "from": "isstream@>=0.1.2 <0.2.0", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" + }, + "istanbul-api": { + "version": "1.2.1", + "from": "istanbul-api@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.2.1.tgz" + }, + "istanbul-lib-coverage": { + "version": "1.1.1", + "from": "istanbul-lib-coverage@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz" + }, + "istanbul-lib-hook": { + "version": "1.1.0", + "from": "istanbul-lib-hook@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz" + }, + "istanbul-lib-instrument": { + "version": "1.9.1", + "from": "istanbul-lib-instrument@>=1.4.2 <2.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz" + }, + "istanbul-lib-report": { + "version": "1.1.2", + "from": "istanbul-lib-report@>=1.1.2 <2.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz", + "dependencies": { + "has-flag": { + "version": "1.0.0", + "from": "has-flag@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz" + }, + "supports-color": { + "version": "3.2.3", + "from": "supports-color@>=3.1.2 <4.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz" + } + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.2", + "from": "istanbul-lib-source-maps@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz", + "dependencies": { + "debug": { + "version": "3.1.0", + "from": "debug@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz" + } + } + }, + "istanbul-reports": { + "version": "1.1.3", + "from": "istanbul-reports@>=1.1.3 <2.0.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.3.tgz" + }, + "jest": { + "version": "21.2.1", + "from": "jest@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-21.2.1.tgz", + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "from": "arr-diff@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + }, + "array-unique": { + "version": "0.2.1", + "from": "array-unique@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + }, + "braces": { + "version": "1.8.5", + "from": "braces@>=1.8.2 <2.0.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + }, + "expand-brackets": { + "version": "0.1.5", + "from": "expand-brackets@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + }, + "extglob": { + "version": "0.3.2", + "from": "extglob@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + }, + "jest-cli": { + "version": "21.2.1", + "from": "jest-cli@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.2.1.tgz" + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + }, + "micromatch": { + "version": "2.3.11", + "from": "micromatch@>=2.3.11 <3.0.0", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + } + } + }, + "jest-changed-files": { + "version": "21.2.0", + "from": "jest-changed-files@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.2.0.tgz" + }, + "jest-config": { + "version": "21.2.1", + "from": "jest-config@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.2.1.tgz" + }, + "jest-diff": { + "version": "21.2.1", + "from": "jest-diff@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.2.1.tgz" + }, + "jest-docblock": { + "version": "21.2.0", + "from": "jest-docblock@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz" + }, + "jest-environment-jsdom": { + "version": "21.2.1", + "from": "jest-environment-jsdom@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz" + }, + "jest-environment-node": { + "version": "21.2.1", + "from": "jest-environment-node@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.2.1.tgz" + }, + "jest-get-type": { + "version": "21.2.0", + "from": "jest-get-type@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.2.0.tgz" + }, + "jest-haste-map": { + "version": "21.2.0", + "from": "jest-haste-map@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-21.2.0.tgz", + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "from": "arr-diff@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + }, + "array-unique": { + "version": "0.2.1", + "from": "array-unique@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + }, + "braces": { + "version": "1.8.5", + "from": "braces@>=1.8.2 <2.0.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + }, + "expand-brackets": { + "version": "0.1.5", + "from": "expand-brackets@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + }, + "extglob": { + "version": "0.3.2", + "from": "extglob@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + }, + "micromatch": { + "version": "2.3.11", + "from": "micromatch@>=2.3.11 <3.0.0", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + } + } + }, + "jest-jasmine2": { + "version": "21.2.1", + "from": "jest-jasmine2@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz" + }, + "jest-matcher-utils": { + "version": "21.2.1", + "from": "jest-matcher-utils@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz" + }, + "jest-message-util": { + "version": "21.2.1", + "from": "jest-message-util@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-21.2.1.tgz", + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "from": "arr-diff@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + }, + "array-unique": { + "version": "0.2.1", + "from": "array-unique@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + }, + "braces": { + "version": "1.8.5", + "from": "braces@>=1.8.2 <2.0.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + }, + "expand-brackets": { + "version": "0.1.5", + "from": "expand-brackets@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + }, + "extglob": { + "version": "0.3.2", + "from": "extglob@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + }, + "micromatch": { + "version": "2.3.11", + "from": "micromatch@>=2.3.11 <3.0.0", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + } + } + }, + "jest-mock": { + "version": "21.2.0", + "from": "jest-mock@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.2.0.tgz" + }, + "jest-regex-util": { + "version": "21.2.0", + "from": "jest-regex-util@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.2.0.tgz" + }, + "jest-resolve": { + "version": "21.2.0", + "from": "jest-resolve@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.2.0.tgz" + }, + "jest-resolve-dependencies": { + "version": "21.2.0", + "from": "jest-resolve-dependencies@>=21.2.0 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz" + }, + "jest-runner": { + "version": "21.2.1", + "from": "jest-runner@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.2.1.tgz" + }, + "jest-runtime": { + "version": "21.2.1", + "from": "jest-runtime@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-21.2.1.tgz", + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "from": "arr-diff@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + }, + "array-unique": { + "version": "0.2.1", + "from": "array-unique@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + }, + "braces": { + "version": "1.8.5", + "from": "braces@>=1.8.2 <2.0.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + }, + "expand-brackets": { + "version": "0.1.5", + "from": "expand-brackets@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + }, + "extglob": { + "version": "0.3.2", + "from": "extglob@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + }, + "micromatch": { + "version": "2.3.11", + "from": "micromatch@>=2.3.11 <3.0.0", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + }, + "strip-bom": { + "version": "3.0.0", + "from": "strip-bom@3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" + } + } + }, + "jest-snapshot": { + "version": "21.2.1", + "from": "jest-snapshot@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.2.1.tgz" + }, + "jest-util": { + "version": "21.2.1", + "from": "jest-util@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.2.1.tgz" + }, + "jest-validate": { + "version": "21.2.1", + "from": "jest-validate@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.2.1.tgz" + }, + "js-tokens": { + "version": "3.0.2", + "from": "js-tokens@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" + }, + "js-yaml": { + "version": "3.10.0", + "from": "js-yaml@>=3.7.0 <4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz" + }, + "jsdom": { + "version": "9.12.0", + "from": "jsdom@>=9.12.0 <10.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz" + }, + "jsesc": { + "version": "1.3.0", + "from": "jsesc@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz" + }, + "json-parse-better-errors": { + "version": "1.0.1", + "from": "json-parse-better-errors@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz" + }, + "json-schema": { + "version": "0.2.3", + "from": "json-schema@0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz" + }, + "json-schema-traverse": { + "version": "0.3.1", + "from": "json-schema-traverse@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz" + }, + "json-stable-stringify": { + "version": "1.0.1", + "from": "json-stable-stringify@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz" + }, + "json-stringify-safe": { + "version": "5.0.1", + "from": "json-stringify-safe@>=5.0.1 <5.1.0", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" + }, + "json5": { + "version": "0.5.1", + "from": "json5@>=0.5.1 <0.6.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz" + }, + "jsonfile": { + "version": "4.0.0", + "from": "jsonfile@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz" + }, + "jsonify": { + "version": "0.0.0", + "from": "jsonify@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz" + }, + "jsprim": { + "version": "1.4.1", + "from": "jsprim@>=1.2.2 <2.0.0", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz" + }, + "just-extend": { + "version": "1.1.27", + "from": "just-extend@>=1.1.26 <2.0.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz" + }, + "kind-of": { + "version": "6.0.1", + "from": "kind-of@>=6.0.0 <7.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.1.tgz" + }, + "lazy-cache": { + "version": "2.0.2", + "from": "lazy-cache@>=2.0.2 <3.0.0", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz" + }, + "lcid": { + "version": "1.0.0", + "from": "lcid@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz" + }, + "leven": { + "version": "2.1.0", + "from": "leven@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz" + }, + "levn": { + "version": "0.3.0", + "from": "levn@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz" + }, + "load-json-file": { + "version": "1.1.0", + "from": "load-json-file@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "dependencies": { + "pify": { + "version": "2.3.0", + "from": "pify@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" + } + } + }, + "locate-path": { + "version": "2.0.0", + "from": "locate-path@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz" + }, + "lodash": { + "version": "4.17.4", + "from": "lodash@>=4.14.0 <5.0.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz" + }, + "lodash.get": { + "version": "4.4.2", + "from": "lodash.get@>=4.4.2 <5.0.0", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz" + }, + "lolex": { + "version": "2.3.1", + "from": "lolex@>=2.2.0 <3.0.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz" + }, + "loose-envify": { + "version": "1.3.1", + "from": "loose-envify@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz" + }, + "lru-cache": { + "version": "4.1.1", + "from": "lru-cache@>=4.0.1 <5.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz" + }, + "make-error": { + "version": "1.3.0", + "from": "make-error@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz" + }, + "makeerror": { + "version": "1.0.11", + "from": "makeerror@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz" + }, + "map-cache": { + "version": "0.2.2", + "from": "map-cache@>=0.2.2 <0.3.0", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz" + }, + "map-visit": { + "version": "1.0.0", + "from": "map-visit@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz" + }, + "mem": { + "version": "1.1.0", + "from": "mem@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz" + }, + "merge": { + "version": "1.2.0", + "from": "merge@>=1.1.3 <2.0.0", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz" + }, + "micromatch": { + "version": "3.1.4", + "from": "micromatch@>=3.0.3 <4.0.0", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.4.tgz" + }, + "mime-db": { + "version": "1.30.0", + "from": "mime-db@>=1.30.0 <1.31.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz" + }, + "mime-types": { + "version": "2.1.17", + "from": "mime-types@>=2.1.17 <2.2.0", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz" + }, + "mimic-fn": { + "version": "1.1.0", + "from": "mimic-fn@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz" + }, + "minimatch": { + "version": "3.0.4", + "from": "minimatch@>=3.0.4 <4.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz" + }, + "minimist": { + "version": "0.0.8", + "from": "minimist@0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" + }, + "mixin-deep": { + "version": "1.2.0", + "from": "mixin-deep@>=1.2.0 <2.0.0", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.2.0.tgz" + }, + "mkdirp": { + "version": "0.5.1", + "from": "mkdirp@>=0.5.1 <0.6.0", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" + }, + "ms": { + "version": "2.0.0", + "from": "ms@2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" + }, + "nanomatch": { + "version": "1.2.6", + "from": "nanomatch@>=1.2.5 <2.0.0", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.6.tgz", + "dependencies": { + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.2 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "natural-compare": { + "version": "1.4.0", + "from": "natural-compare@>=1.4.0 <2.0.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" + }, + "nise": { + "version": "1.2.0", + "from": "nise@>=1.2.0 <2.0.0", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", + "dependencies": { + "lolex": { + "version": "1.6.0", + "from": "lolex@>=1.6.0 <2.0.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz" + } + } + }, + "node-int64": { + "version": "0.4.0", + "from": "node-int64@>=0.4.0 <0.5.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz" + }, + "node-notifier": { + "version": "5.1.2", + "from": "node-notifier@>=5.0.2 <6.0.0", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.1.2.tgz" + }, + "normalize-package-data": { + "version": "2.4.0", + "from": "normalize-package-data@>=2.3.2 <3.0.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz" + }, + "normalize-path": { + "version": "2.1.1", + "from": "normalize-path@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz" + }, + "npm-run-path": { + "version": "2.0.2", + "from": "npm-run-path@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz" + }, + "number-is-nan": { + "version": "1.0.1", + "from": "number-is-nan@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz" + }, + "nwmatcher": { + "version": "1.4.3", + "from": "nwmatcher@>=1.3.9 <2.0.0", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz" + }, + "oauth-sign": { + "version": "0.8.2", + "from": "oauth-sign@>=0.8.2 <0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz" + }, + "object-assign": { + "version": "4.1.1", + "from": "object-assign@>=4.1.0 <5.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" + }, + "object-copy": { + "version": "0.1.0", + "from": "object-copy@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "dependencies": { + "define-property": { + "version": "0.2.5", + "from": "define-property@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + }, + "is-descriptor": { + "version": "0.1.6", + "from": "is-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "dependencies": { + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.3 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + } + } + }, + "object-visit": { + "version": "1.0.1", + "from": "object-visit@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz" + }, + "object.omit": { + "version": "2.0.1", + "from": "object.omit@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz" + }, + "object.pick": { + "version": "1.3.0", + "from": "object.pick@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz" + }, + "once": { + "version": "1.4.0", + "from": "once@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + }, + "optimist": { + "version": "0.6.1", + "from": "optimist@>=0.6.1 <0.7.0", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" + }, + "optionator": { + "version": "0.8.2", + "from": "optionator@>=0.8.1 <0.9.0", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "from": "wordwrap@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" + } + } + }, + "os-homedir": { + "version": "1.0.2", + "from": "os-homedir@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz" + }, + "os-locale": { + "version": "2.1.0", + "from": "os-locale@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz" + }, + "os-tmpdir": { + "version": "1.0.2", + "from": "os-tmpdir@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz" + }, + "p-cancelable": { + "version": "0.3.0", + "from": "p-cancelable@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz" + }, + "p-finally": { + "version": "1.0.0", + "from": "p-finally@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz" + }, + "p-limit": { + "version": "1.1.0", + "from": "p-limit@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz" + }, + "p-locate": { + "version": "2.0.0", + "from": "p-locate@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz" + }, + "parse-glob": { + "version": "3.0.4", + "from": "parse-glob@>=3.0.4 <4.0.0", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + } + } + }, + "parse-json": { + "version": "2.2.0", + "from": "parse-json@>=2.2.0 <3.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz" + }, + "parse-passwd": { + "version": "1.0.0", + "from": "parse-passwd@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz" + }, + "parse5": { + "version": "1.5.1", + "from": "parse5@>=1.5.1 <2.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz" + }, + "pascalcase": { + "version": "0.1.1", + "from": "pascalcase@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz" + }, + "path-dirname": { + "version": "1.0.2", + "from": "path-dirname@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz" + }, + "path-exists": { + "version": "3.0.0", + "from": "path-exists@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" + }, + "path-is-absolute": { + "version": "1.0.1", + "from": "path-is-absolute@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + }, + "path-key": { + "version": "2.0.1", + "from": "path-key@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz" + }, + "path-parse": { + "version": "1.0.5", + "from": "path-parse@>=1.0.5 <2.0.0", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz" + }, + "path-to-regexp": { + "version": "1.7.0", + "from": "path-to-regexp@>=1.7.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "dependencies": { + "isarray": { + "version": "0.0.1", + "from": "isarray@0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + } + } + }, + "path-type": { + "version": "1.1.0", + "from": "path-type@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "dependencies": { + "pify": { + "version": "2.3.0", + "from": "pify@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" + } + } + }, + "performance-now": { + "version": "2.1.0", + "from": "performance-now@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz" + }, + "pify": { + "version": "3.0.0", + "from": "pify@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz" + }, + "pinkie": { + "version": "2.0.4", + "from": "pinkie@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz" + }, + "pinkie-promise": { + "version": "2.0.1", + "from": "pinkie-promise@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" + }, + "pkg-dir": { + "version": "2.0.0", + "from": "pkg-dir@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz" + }, + "posix-character-classes": { + "version": "0.1.1", + "from": "posix-character-classes@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz" + }, + "prelude-ls": { + "version": "1.1.2", + "from": "prelude-ls@>=1.1.2 <1.2.0", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" + }, + "preserve": { + "version": "0.2.0", + "from": "preserve@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz" + }, + "pretty-format": { + "version": "21.2.1", + "from": "pretty-format@>=21.2.1 <22.0.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "from": "ansi-regex@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz" + } + } + }, + "private": { + "version": "0.1.8", + "from": "private@>=0.1.7 <0.2.0", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz" + }, + "process-nextick-args": { + "version": "1.0.7", + "from": "process-nextick-args@>=1.0.6 <1.1.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz" + }, + "prr": { + "version": "0.0.0", + "from": "prr@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz" + }, + "pseudomap": { + "version": "1.0.2", + "from": "pseudomap@>=1.0.2 <2.0.0", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz" + }, + "punycode": { + "version": "1.4.1", + "from": "punycode@>=1.4.1 <2.0.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz" + }, + "qs": { + "version": "6.5.1", + "from": "qs@>=6.5.1 <6.6.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz" + }, + "randomatic": { + "version": "1.1.7", + "from": "randomatic@>=1.1.3 <2.0.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "dependencies": { + "kind-of": { + "version": "4.0.0", + "from": "kind-of@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz" + } + } + }, + "read-package-json": { + "version": "2.0.12", + "from": "read-package-json@>=2.0.12 <3.0.0", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz" + }, + "read-pkg": { + "version": "1.1.0", + "from": "read-pkg@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz" + }, + "read-pkg-up": { + "version": "1.0.1", + "from": "read-pkg-up@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "dependencies": { + "find-up": { + "version": "1.1.2", + "from": "find-up@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz" + }, + "path-exists": { + "version": "2.1.0", + "from": "path-exists@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz" + } + } + }, + "readable-stream": { + "version": "2.3.3", + "from": "readable-stream@>=2.0.2 <3.0.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz" + }, + "readdir-enhanced": { + "version": "1.5.2", + "from": "readdir-enhanced@>=1.5.2 <2.0.0", + "resolved": "https://registry.npmjs.org/readdir-enhanced/-/readdir-enhanced-1.5.2.tgz" + }, + "readdirp": { + "version": "2.1.0", + "from": "readdirp@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz" + }, + "regenerator-runtime": { + "version": "0.11.0", + "from": "regenerator-runtime@>=0.11.0 <0.12.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz" + }, + "regex-cache": { + "version": "0.4.4", + "from": "regex-cache@>=0.4.2 <0.5.0", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz" + }, + "regex-not": { + "version": "1.0.0", + "from": "regex-not@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz" + }, + "remove-trailing-separator": { + "version": "1.1.0", + "from": "remove-trailing-separator@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz" + }, + "repeat-element": { + "version": "1.1.2", + "from": "repeat-element@>=1.1.2 <2.0.0", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz" + }, + "repeat-string": { + "version": "1.6.1", + "from": "repeat-string@>=1.6.1 <2.0.0", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" + }, + "repeating": { + "version": "2.0.1", + "from": "repeating@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz" + }, + "request": { + "version": "2.83.0", + "from": "request@>=2.79.0 <3.0.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz" + }, + "require-directory": { + "version": "2.1.1", + "from": "require-directory@>=2.1.1 <3.0.0", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" + }, + "require-main-filename": { + "version": "1.0.1", + "from": "require-main-filename@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz" + }, + "resolve": { + "version": "1.1.7", + "from": "resolve@1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz" + }, + "resolve-url": { + "version": "0.2.1", + "from": "resolve-url@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz" + }, + "rimraf": { + "version": "2.6.2", + "from": "rimraf@>=2.6.1 <3.0.0", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz" + }, + "safe-buffer": { + "version": "5.1.1", + "from": "safe-buffer@>=5.1.1 <6.0.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + }, + "samsam": { + "version": "1.3.0", + "from": "samsam@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz" + }, + "sane": { + "version": "2.2.0", + "from": "sane@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-2.2.0.tgz", + "dependencies": { + "minimist": { + "version": "1.2.0", + "from": "minimist@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" + } + } + }, + "sax": { + "version": "1.2.4", + "from": "sax@>=1.2.1 <2.0.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz" + }, + "semver": { + "version": "5.4.1", + "from": "semver@>=5.3.0 <6.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz" + }, + "set-blocking": { + "version": "2.0.0", + "from": "set-blocking@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" + }, + "set-getter": { + "version": "0.1.0", + "from": "set-getter@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz" + }, + "set-immediate-shim": { + "version": "1.0.1", + "from": "set-immediate-shim@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz" + }, + "set-value": { + "version": "2.0.0", + "from": "set-value@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz" + }, + "shebang-command": { + "version": "1.2.0", + "from": "shebang-command@>=1.2.0 <2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz" + }, + "shebang-regex": { + "version": "1.0.0", + "from": "shebang-regex@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz" + }, + "shell-quote": { + "version": "1.6.1", + "from": "shell-quote@>=1.6.1 <2.0.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz" + }, + "shellwords": { + "version": "0.1.1", + "from": "shellwords@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz" + }, + "signal-exit": { + "version": "3.0.2", + "from": "signal-exit@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz" + }, + "simplr-logger": { + "version": "1.0.1", + "from": "simplr-logger@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/simplr-logger/-/simplr-logger-1.0.1.tgz" + }, + "simplr-tslint": { + "version": "0.0.1", + "from": "simplr-tslint@0.0.1", + "resolved": "https://registry.npmjs.org/simplr-tslint/-/simplr-tslint-0.0.1.tgz" + }, + "sinon": { + "version": "4.1.2", + "from": "sinon@>=4.1.2 <5.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.2.tgz" + }, + "slash": { + "version": "1.0.0", + "from": "slash@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz" + }, + "snapdragon": { + "version": "0.8.1", + "from": "snapdragon@>=0.8.1 <0.9.0", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", + "dependencies": { + "define-property": { + "version": "0.2.5", + "from": "define-property@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + }, + "is-descriptor": { + "version": "0.1.6", + "from": "is-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + }, + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "from": "snapdragon-node@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz" + }, + "snapdragon-util": { + "version": "3.0.1", + "from": "snapdragon-util@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.2.0 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + } + } + }, + "sntp": { + "version": "2.1.0", + "from": "sntp@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz" + }, + "source-map": { + "version": "0.5.7", + "from": "source-map@>=0.5.6 <0.6.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" + }, + "source-map-resolve": { + "version": "0.5.1", + "from": "source-map-resolve@>=0.5.0 <0.6.0", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz" + }, + "source-map-support": { + "version": "0.4.18", + "from": "source-map-support@>=0.4.15 <0.5.0", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz" + }, + "source-map-url": { + "version": "0.4.0", + "from": "source-map-url@>=0.4.0 <0.5.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz" + }, + "spdx-correct": { + "version": "1.0.2", + "from": "spdx-correct@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz" + }, + "spdx-expression-parse": { + "version": "1.0.4", + "from": "spdx-expression-parse@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz" + }, + "spdx-license-ids": { + "version": "1.2.2", + "from": "spdx-license-ids@>=1.0.2 <2.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz" + }, + "split-string": { + "version": "3.1.0", + "from": "split-string@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "dependencies": { + "extend-shallow": { + "version": "3.0.1", + "from": "extend-shallow@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.1.tgz" + }, + "is-extendable": { + "version": "1.0.1", + "from": "is-extendable@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz" + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "from": "sprintf-js@>=1.0.2 <1.1.0", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" + }, + "sshpk": { + "version": "1.13.1", + "from": "sshpk@>=1.7.0 <2.0.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz" + }, + "static-extend": { + "version": "0.1.2", + "from": "static-extend@>=0.1.1 <0.2.0", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "dependencies": { + "define-property": { + "version": "0.2.5", + "from": "define-property@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + }, + "is-descriptor": { + "version": "0.1.6", + "from": "is-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + }, + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "string": { + "version": "3.3.3", + "from": "string@>=3.3.3 <4.0.0", + "resolved": "https://registry.npmjs.org/string/-/string-3.3.3.tgz" + }, + "string_decoder": { + "version": "1.0.3", + "from": "string_decoder@>=1.0.3 <1.1.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz" + }, + "string-length": { + "version": "2.0.0", + "from": "string-length@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz" + }, + "string-width": { + "version": "2.1.1", + "from": "string-width@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "from": "is-fullwidth-code-point@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz" + } + } + }, + "stringstream": { + "version": "0.0.5", + "from": "stringstream@>=0.0.5 <0.1.0", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" + }, + "strip-ansi": { + "version": "4.0.0", + "from": "strip-ansi@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "from": "ansi-regex@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz" + } + } + }, + "strip-bom": { + "version": "2.0.0", + "from": "strip-bom@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz" + }, + "strip-eof": { + "version": "1.0.0", + "from": "strip-eof@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz" + }, + "strip-json-comments": { + "version": "2.0.1", + "from": "strip-json-comments@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" + }, + "subarg": { + "version": "1.0.0", + "from": "subarg@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "dependencies": { + "minimist": { + "version": "1.2.0", + "from": "minimist@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" + } + } + }, + "supports-color": { + "version": "4.5.0", + "from": "supports-color@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz" + }, + "symbol-tree": { + "version": "3.2.2", + "from": "symbol-tree@>=3.2.1 <4.0.0", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz" + }, + "test-exclude": { + "version": "4.1.1", + "from": "test-exclude@>=4.1.1 <5.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "from": "arr-diff@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + }, + "array-unique": { + "version": "0.2.1", + "from": "array-unique@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + }, + "braces": { + "version": "1.8.5", + "from": "braces@>=1.8.2 <2.0.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + }, + "expand-brackets": { + "version": "0.1.5", + "from": "expand-brackets@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + }, + "extglob": { + "version": "0.3.2", + "from": "extglob@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + }, + "is-extglob": { + "version": "1.0.0", + "from": "is-extglob@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + }, + "is-glob": { + "version": "2.0.1", + "from": "is-glob@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + }, + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + }, + "micromatch": { + "version": "2.3.11", + "from": "micromatch@>=2.3.11 <3.0.0", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + } + } + }, + "text-encoding": { + "version": "0.6.4", + "from": "text-encoding@>=0.6.4 <0.7.0", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz" + }, + "throat": { + "version": "4.1.0", + "from": "throat@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz" + }, + "tmpl": { + "version": "1.0.4", + "from": "tmpl@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz" + }, + "to-fast-properties": { + "version": "1.0.3", + "from": "to-fast-properties@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz" + }, + "to-object-path": { + "version": "0.3.0", + "from": "to-object-path@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "dependencies": { + "kind-of": { + "version": "3.2.2", + "from": "kind-of@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + } + } + }, + "to-regex": { + "version": "3.0.1", + "from": "to-regex@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", + "dependencies": { + "define-property": { + "version": "0.2.5", + "from": "define-property@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + }, + "is-descriptor": { + "version": "0.1.6", + "from": "is-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + }, + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "from": "to-regex-range@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz" + }, + "tough-cookie": { + "version": "2.3.3", + "from": "tough-cookie@>=2.3.2 <3.0.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz" + }, + "tr46": { + "version": "0.0.3", + "from": "tr46@>=0.0.3 <0.1.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + }, + "trim-right": { + "version": "1.0.1", + "from": "trim-right@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz" + }, + "ts-extractor": { + "version": "1.1.1", + "from": "ts-extractor@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-1.1.1.tgz", + "dependencies": { + "simplr-logger": { + "version": "0.4.0", + "from": "simplr-logger@>=0.4.0 <0.5.0", + "resolved": "https://registry.npmjs.org/simplr-logger/-/simplr-logger-0.4.0.tgz" + } + } + }, + "ts-jest": { + "version": "21.2.3", + "from": "ts-jest@>=21.2.3 <22.0.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-21.2.3.tgz", + "dependencies": { + "source-map": { + "version": "0.6.1", + "from": "source-map@>=0.6.0 <0.7.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" + }, + "source-map-support": { + "version": "0.5.0", + "from": "source-map-support@>=0.5.0 <0.6.0", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz" + }, + "yargs": { + "version": "10.0.3", + "from": "yargs@>=10.0.3 <11.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz" + }, + "yargs-parser": { + "version": "8.0.0", + "from": "yargs-parser@>=8.0.0 <9.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz" + } + } + }, + "ts-node": { + "version": "3.3.0", + "from": "ts-node@>=3.3.0 <4.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-3.3.0.tgz", + "dependencies": { + "minimist": { + "version": "1.2.0", + "from": "minimist@>=1.2.0 <2.0.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" + } + } + }, + "tsconfig": { + "version": "6.0.0", + "from": "tsconfig@>=6.0.0 <7.0.0", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz", + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "from": "strip-bom@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" + } + } + }, + "tslib": { + "version": "1.8.0", + "from": "tslib@>=1.8.0 <2.0.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + }, + "tslint": { + "version": "5.8.0", + "from": "tslint@>=5.8.0 <6.0.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.8.0.tgz", + "dependencies": { + "resolve": { + "version": "1.5.0", + "from": "resolve@>=1.3.2 <2.0.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz" + } + } + }, + "tsutils": { + "version": "2.13.0", + "from": "tsutils@>=2.12.1 <3.0.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.13.0.tgz" + }, + "tunnel-agent": { + "version": "0.6.0", + "from": "tunnel-agent@>=0.6.0 <0.7.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz" + }, + "type-check": { + "version": "0.3.2", + "from": "type-check@>=0.3.2 <0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" + }, + "type-detect": { + "version": "4.0.5", + "from": "type-detect@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz" + }, + "typescript": { + "version": "2.6.2", + "from": "typescript@>=2.6.2 <3.0.0", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz" + }, + "union-value": { + "version": "1.0.0", + "from": "union-value@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "dependencies": { + "set-value": { + "version": "0.4.3", + "from": "set-value@>=0.4.3 <0.5.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz" + } + } + }, + "universalify": { + "version": "0.1.1", + "from": "universalify@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz" + }, + "unset-value": { + "version": "1.0.0", + "from": "unset-value@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "dependencies": { + "has-value": { + "version": "0.3.1", + "from": "has-value@>=0.3.1 <0.4.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "dependencies": { + "isobject": { + "version": "2.1.0", + "from": "isobject@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz" + } + } + }, + "has-values": { + "version": "0.1.4", + "from": "has-values@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz" + } + } + }, + "urix": { + "version": "0.1.0", + "from": "urix@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz" + }, + "use": { + "version": "2.0.2", + "from": "use@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", + "dependencies": { + "define-property": { + "version": "0.2.5", + "from": "define-property@>=0.2.5 <0.3.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + }, + "is-descriptor": { + "version": "0.1.6", + "from": "is-descriptor@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + }, + "kind-of": { + "version": "5.1.0", + "from": "kind-of@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "from": "util-deprecate@>=1.0.1 <1.1.0", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + }, + "uuid": { + "version": "3.1.0", + "from": "uuid@>=3.1.0 <4.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz" + }, + "v8flags": { + "version": "3.0.1", + "from": "v8flags@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.1.tgz" + }, + "validate-npm-package-license": { + "version": "3.0.1", + "from": "validate-npm-package-license@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz" + }, + "verror": { + "version": "1.10.0", + "from": "verror@1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz" + }, + "walker": { + "version": "1.0.7", + "from": "walker@>=1.0.5 <1.1.0", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz" + }, + "watch": { + "version": "0.18.0", + "from": "watch@>=0.18.0 <0.19.0", + "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", + "dependencies": { + "minimist": { + "version": "1.2.0", + "from": "minimist@>=1.2.0 <2.0.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" + } + } + }, + "webidl-conversions": { + "version": "4.0.2", + "from": "webidl-conversions@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz" + }, + "whatwg-encoding": { + "version": "1.0.3", + "from": "whatwg-encoding@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz" + }, + "whatwg-url": { + "version": "4.8.0", + "from": "whatwg-url@>=4.3.0 <5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz", + "dependencies": { + "webidl-conversions": { + "version": "3.0.1", + "from": "webidl-conversions@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + } + } + }, + "which": { + "version": "1.3.0", + "from": "which@>=1.2.9 <2.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz" + }, + "which-module": { + "version": "2.0.0", + "from": "which-module@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz" + }, + "wordwrap": { + "version": "0.0.3", + "from": "wordwrap@>=0.0.2 <0.1.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + }, + "worker-farm": { + "version": "1.5.2", + "from": "worker-farm@>=1.3.1 <2.0.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.2.tgz" + }, + "wrap-ansi": { + "version": "2.1.0", + "from": "wrap-ansi@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "dependencies": { + "string-width": { + "version": "1.0.2", + "from": "string-width@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" + }, + "strip-ansi": { + "version": "3.0.1", + "from": "strip-ansi@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + } + } + }, + "wrappy": { + "version": "1.0.2", + "from": "wrappy@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + }, + "write-file-atomic": { + "version": "2.3.0", + "from": "write-file-atomic@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz" + }, + "xml-name-validator": { + "version": "2.0.1", + "from": "xml-name-validator@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz" + }, + "xtend": { + "version": "4.0.1", + "from": "xtend@>=4.0.1 <5.0.0", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + }, + "y18n": { + "version": "3.2.1", + "from": "y18n@>=3.2.1 <4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz" + }, + "yallist": { + "version": "2.1.2", + "from": "yallist@>=2.1.2 <3.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz" + }, + "yargs": { + "version": "9.0.1", + "from": "yargs@>=9.0.0 <10.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", + "dependencies": { + "load-json-file": { + "version": "2.0.0", + "from": "load-json-file@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz" + }, + "path-type": { + "version": "2.0.0", + "from": "path-type@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz" + }, + "pify": { + "version": "2.3.0", + "from": "pify@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" + }, + "read-pkg": { + "version": "2.0.0", + "from": "read-pkg@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz" + }, + "read-pkg-up": { + "version": "2.0.0", + "from": "read-pkg-up@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz" + }, + "strip-bom": { + "version": "3.0.0", + "from": "strip-bom@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" + } + } + }, + "yargs-parser": { + "version": "7.0.0", + "from": "yargs-parser@>=7.0.0 <8.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz" + }, + "yn": { + "version": "2.0.0", + "from": "yn@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz" + } + } +} diff --git a/schemas/rush.schema.json b/common/schemas/rush.schema.json similarity index 100% rename from schemas/rush.schema.json rename to common/schemas/rush.schema.json diff --git a/rush.json b/rush.json index 13d716fd..27cf2d0e 100644 --- a/rush.json +++ b/rush.json @@ -1,5 +1,5 @@ { - "$schema": "./schemas/rush.schema.json", + "$schema": "./common/schemas/rush.schema.json", "npmVersion": "4.5.0", "rushVersion": "4.0.1", "projects": [ From cf6fb56d833ab1d8509fdc79cb97831480909c6b Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:37:26 +0200 Subject: [PATCH 42/61] Fixed tslint errors. --- packages/ts-docs-gen/src/debug.ts | 1 + packages/ts-docs-gen/src/generator.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ts-docs-gen/src/debug.ts b/packages/ts-docs-gen/src/debug.ts index 7bd7e4ad..a6a1ac62 100644 --- a/packages/ts-docs-gen/src/debug.ts +++ b/packages/ts-docs-gen/src/debug.ts @@ -13,6 +13,7 @@ async function Main(): Promise { const generator = new Generator(config); generator.PrintToFiles(); + // tslint:disable-next-line:no-debugger debugger; } diff --git a/packages/ts-docs-gen/src/generator.ts b/packages/ts-docs-gen/src/generator.ts index 3b295487..ec3251e7 100644 --- a/packages/ts-docs-gen/src/generator.ts +++ b/packages/ts-docs-gen/src/generator.ts @@ -72,7 +72,7 @@ export class Generator { public PrintToFiles(): void { // ===================================== // - // First step: Preparing to what files we want to write. + // First step: Preparing to what files we want to write. // P.S. move this into separate file. // // ===================================== From 75c8db479007e5b31f26845f30b02c95f8260272 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:37:36 +0200 Subject: [PATCH 43/61] Added command line. --- common/config/rush/command-line.json | 12 ++ common/schemas/command-line.schema.json | 155 ++++++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 common/config/rush/command-line.json create mode 100644 common/schemas/command-line.schema.json diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json new file mode 100644 index 00000000..95a78a50 --- /dev/null +++ b/common/config/rush/command-line.json @@ -0,0 +1,12 @@ +{ + "$schema": "../../schemas/command-line.schema.json", + "customCommands": [ + { + "name": "test", + "documentation": "Testing packages", + "parallelized": true, + "summary": "Testing packages" + } + ], + "customOptions": {} +} diff --git a/common/schemas/command-line.schema.json b/common/schemas/command-line.schema.json new file mode 100644 index 00000000..b817a03d --- /dev/null +++ b/common/schemas/command-line.schema.json @@ -0,0 +1,155 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Rush Configuration", + "description": "Configuration file for the Rush multi-package build tool", + + "type": "object", + "additionalProperties": false, + + "properties": { + "$schema": { + "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.", + "type": "string" + }, + + "customCommands": { + "title": "Custom Commands", + "description": "A list of custom commands that can be invoked from the Rush command line", + "type": "array", + "items": { + "title": "Custom Command", + "type": "object", + "additionalProperties": false, + "required": [ "name", "summary", "documentation", "parallelized" ], + "properties": { + "name": { + "title": "Custom Command Name", + "description": "The name of the custom command, which can be invoked via \"rush \"", + "type": "string" + }, + "summary": { + "title": "Custom Command Summary", + "description": "A short summary of the custom command, which will appear when printing command line usage (e.g. \"rush --help\")", + "type": "string" + }, + "documentation": { + "title": "Custom Command Documentation", + "description": "A detailed description of the command, which appears when requesting command-line help for this command. If omitted, the summary will be used.", + "type": "string" + }, + "parallelized": { + "title": "Is Parallelized", + "description": "Describes whether or not this command can be run in parallel (with multiple instances running on several projects simultaneously). Defaults to 'true'.", + "type": "boolean" + } + } + } + }, + + "customOptions": { + "title": "Custom Options", + "description": "A list of custom options that can be associated with commands", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^--[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$": { + "title": "Custom Option", + "type": "object", + + "required": [ + "description", + "associatedCommands" + ], + + "properties": { + "description": { + "title": "Description", + "type": "string" + }, + + "associatedCommands": { + "title": "Supported Commands", + "description": "A list of commands which this option can be used with", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + + "shortName": { + "title": "Shortened Name", + "description": "A optional shortened value for the flag (e.g. --verbose might become -v)", + "type": "string", + "pattern": "^-[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$" + }, + + "optionType": { + "type": "string", + "enum": [ + "flag", + "enum" + ] + } + }, + + "oneOf": [ + { + "type": "object", + "required": [ "optionType" ], + "properties": { + "optionType": { + "type": "string", + "enum": [ + "flag" + ] + } + } + }, + { + "type": "object", + "required": [ "optionType", "enumValues" ], + "properties": { + "optionType": { + "type": "string", + "enum": [ + "enum" + ] + }, + + "enumValues": { + "title": "Enum Values", + "description": "A list of possible options for this flag", + "type": "array", + "minItems": 1, + + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "name", "description" ], + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "title": "Description", + "type": "string" + } + } + } + }, + + "defaultValue": { + "title": "Default Value", + "description": "If this flag is omitted, use this value by default", + "type": "string" + } + } + } + ] + } + } + } + } + } From 84796343ae2fcda9f6a9993152400d9d640583a1 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:48:43 +0200 Subject: [PATCH 44/61] Updated package.json. --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e26991c..5e6bbe37 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,11 @@ "name": "ts-docs-gen-repo", "version": "0.0.0", "private": true, - "description": "TypeScript documentation generation repository.", + "description": "Generating documentation for TypeScript code.", + "scripts": { + "rush-install": "rush install", + "rush-test": "rush test" + }, "devDependencies": { "@microsoft/rush": "^4.0.1" } From da55316f52ca3f52d8d803169caa3372bae1f4b2 Mon Sep 17 00:00:00 2001 From: Martynas Zilinskas Date: Thu, 30 Nov 2017 20:49:11 +0200 Subject: [PATCH 45/61] Added travis file. --- .travis.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c569127e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: node_js +notifications: + email: + on_success: never + on_failure: change +branches: + only: + - master + - dev + - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ +node_js: +- "node" +script: +- npm run rush-install +- npm run rush-test From 75201dbcd68605463d2b277f491dfc94ed016ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Thu, 30 Nov 2017 22:04:29 +0200 Subject: [PATCH 46/61] Fixed comment. --- packages/ts-docs-gen/src/generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ts-docs-gen/src/generator.ts b/packages/ts-docs-gen/src/generator.ts index ec3251e7..b2fec265 100644 --- a/packages/ts-docs-gen/src/generator.ts +++ b/packages/ts-docs-gen/src/generator.ts @@ -72,7 +72,7 @@ export class Generator { public PrintToFiles(): void { // ===================================== // - // First step: Preparing to what files we want to write. + // Preparing files we want to write / output / fill. // P.S. move this into separate file. // // ===================================== From 7def7a5690235d0e2ef71f5d4082ff1becb68137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Thu, 30 Nov 2017 22:05:37 +0200 Subject: [PATCH 47/61] Updated package.json. --- packages/ts-docs-gen/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index 66edf41a..32a6c5fc 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -1,7 +1,7 @@ { "name": "ts-docs-gen", - "version": "1.0.0", - "description": "", + "version": "0.1.0", + "description": "Generating documentation for TypeScript code", "main": "index.js", "scripts": { "pretest": "npm run build -- --noEmit && npm run build-tests", @@ -13,7 +13,7 @@ "build-tests": "cd tests && ts-node ./build-tests.ts -p ./" }, "engine": "node >= 7.5.0", - "author": "", + "author": "simplrjs (https://github.com/simplrjs)", "dependencies": { "@simplrjs/markdown": "0.1.0-beta", "@types/fs-extra": "^4.0.5", From c30581a0e2e918282e3ac5f9ecab477f7a5f1243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Tue, 5 Dec 2017 18:06:04 +0200 Subject: [PATCH 48/61] Feature: Remake (#3) --- .coveralls.yml | 1 + .gitattributes | 4 + .../docs/api/exported-const-variables.md | 33 ++++ .../simple/docs/api/exported-functions.md | 5 + .../examples/simple/docs/api/index.md | 28 +++ .../simple/exported-const-variables.ts | 5 +- packages/ts-docs-gen/examples/simple/index.ts | 15 +- .../src/abstractions/api-item-plugin-base.ts | 5 +- .../src/abstractions/file-manager-base.ts | 9 + .../src/abstractions/printer-base.ts | 5 - .../generator-configuration-builder.ts | 6 + .../src/contracts/file-output-dto.ts | 4 + .../ts-docs-gen/src/contracts/plugin-data.ts | 9 + .../src/contracts/reference-tuple.ts | 4 + .../src/contracts/render-item-output-dto.ts | 4 + packages/ts-docs-gen/src/debug.ts | 8 +- packages/ts-docs-gen/src/default-plugins.ts | 5 + packages/ts-docs-gen/src/extractor-helpers.ts | 47 +++++ packages/ts-docs-gen/src/file-manager.ts | 81 +++++++++ packages/ts-docs-gen/src/generator-helpers.ts | 66 +++++++ packages/ts-docs-gen/src/generator.ts | 166 +++++++----------- .../src/plugins/api-default-plugin.ts | 11 +- .../src/plugins/api-variable-plugin.ts | 50 ++++++ .../src/printers/default-printer.ts | 9 - packages/ts-docs-gen/src/utils/helpers.ts | 11 ++ .../simple-project-1.test.ts.snap | 15 ++ .../simple-project-2.test.ts.snap | 24 +++ .../cases/simple-project-1/test-config.json | 4 +- .../cases/simple-project-2/test-config.json | 3 +- .../tests/scripts/tests-generator.ts | 17 +- 30 files changed, 513 insertions(+), 141 deletions(-) create mode 100644 .coveralls.yml create mode 100644 .gitattributes create mode 100644 packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md create mode 100644 packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md create mode 100644 packages/ts-docs-gen/examples/simple/docs/api/index.md create mode 100644 packages/ts-docs-gen/src/abstractions/file-manager-base.ts delete mode 100644 packages/ts-docs-gen/src/abstractions/printer-base.ts create mode 100644 packages/ts-docs-gen/src/contracts/file-output-dto.ts create mode 100644 packages/ts-docs-gen/src/contracts/plugin-data.ts create mode 100644 packages/ts-docs-gen/src/contracts/reference-tuple.ts create mode 100644 packages/ts-docs-gen/src/default-plugins.ts create mode 100644 packages/ts-docs-gen/src/extractor-helpers.ts create mode 100644 packages/ts-docs-gen/src/file-manager.ts create mode 100644 packages/ts-docs-gen/src/generator-helpers.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-variable-plugin.ts delete mode 100644 packages/ts-docs-gen/src/printers/default-printer.ts create mode 100644 packages/ts-docs-gen/src/utils/helpers.ts create mode 100644 packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap create mode 100644 packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 00000000..3255b143 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1 @@ +service_name: travis-ci diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..4d9e87f5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +@types/* linguist-generated=true +dist/* linguist-generated=true +**/__snapshots__/* linguist-generated=true +**/examples/* linguist-generated=true diff --git a/packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md b/packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md new file mode 100644 index 00000000..7fe3fe2f --- /dev/null +++ b/packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md @@ -0,0 +1,33 @@ +# exported-const-variables + +## Kintamasis + +First const variable in the exported items. + +```ts +const Kintamasis: "Hello World!"; +``` + +### Type + +"Hello World!" + +## Kintamasis2 + +```ts +const Kintamasis2: "World, Hello!"; +``` + +### Type + +"World, Hello!" + +## Kintamasis3 + +```ts +const Kintamasis3: "Not imported!"; +``` + +### Type + +"Not imported!" diff --git a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md new file mode 100644 index 00000000..6b8e6e49 --- /dev/null +++ b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md @@ -0,0 +1,5 @@ +# exported-functions + +## function: Foo + +## function: Bar diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md new file mode 100644 index 00000000..a0f98148 --- /dev/null +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -0,0 +1,28 @@ +[ClassDeclaration-0]: index.md#class-world +[ClassDeclaration-1]: index.md#class-earth +[FunctionDeclaration-0]: exported-functions.md#function-foo +# index + +## class: World + +## class: Earth + +## Hello + +```typescript +const Hello: World & Earth; +``` + +### Type + +[World][ClassDeclaration-0] & [Earth][ClassDeclaration-1] + +## FooFunc + +```typescript +const FooFunc: () => string; +``` + +### Type + +[Foo][FunctionDeclaration-0] diff --git a/packages/ts-docs-gen/examples/simple/exported-const-variables.ts b/packages/ts-docs-gen/examples/simple/exported-const-variables.ts index 140d0134..42aca37f 100644 --- a/packages/ts-docs-gen/examples/simple/exported-const-variables.ts +++ b/packages/ts-docs-gen/examples/simple/exported-const-variables.ts @@ -1,3 +1,6 @@ +/** + * First const variable in the exported items. + */ export const Kintamasis = "Hello World!"; -export const Kintamasis2 = "Hello World!"; +export const Kintamasis2 = "World, Hello!"; export const Kintamasis3 = "Not imported!"; diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index fc335410..abb00c30 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -1,6 +1,13 @@ // tslint:disable -// import { MyInterface } from "./my-types"; +import { Foo } from "./exported-functions"; + +export class World { } +export class Earth { } + +export declare const Hello: World & Earth; + +export const FooFunc = Foo; // export function Foo(): string { // return "foo"; @@ -91,9 +98,9 @@ // Type: TType; // } -export async function GetFoo(): Promise { - return; -} +// export async function GetFoo(): Promise { +// return; +// } // export interface Bar extends Foo, Boo { // OtherStuff: string[]; diff --git a/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts b/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts index eafbe0e2..734aa81a 100644 --- a/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts +++ b/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts @@ -2,8 +2,9 @@ import { Contracts } from "ts-extractor"; import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; import { SupportedApiItemKindType, ApiItemKindsAdditional } from "../contracts/supported-api-item-kind-type"; +import { PluginData } from "../contracts/plugin-data"; -export abstract class ApiItemPluginBase { +export abstract class ApiItemPluginBase { // TODO: Clarify naming. protected get SupportKind(): typeof Contracts.ApiItemKinds & typeof ApiItemKindsAdditional { return Object.assign(Contracts.ApiItemKinds, ApiItemKindsAdditional); @@ -15,5 +16,5 @@ export abstract class ApiItemPluginBase { return true; } - public abstract Render(item: Contracts.ApiItemDto, getItem: (itemId: string) => RenderItemOutputDto): RenderItemOutputDto; + public abstract Render(data: PluginData): RenderItemOutputDto; } diff --git a/packages/ts-docs-gen/src/abstractions/file-manager-base.ts b/packages/ts-docs-gen/src/abstractions/file-manager-base.ts new file mode 100644 index 00000000..95931b4e --- /dev/null +++ b/packages/ts-docs-gen/src/abstractions/file-manager-base.ts @@ -0,0 +1,9 @@ +import { Contracts } from "ts-extractor"; +import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; +import { FileOutputDto } from "../contracts/file-output-dto"; + +export abstract class FileManagerBaseBase { + public abstract AddItem(entryFile: Contracts.ApiSourceFileDto, item: RenderItemOutputDto, referenceId: string): void; + + public abstract ToFilesOutput(): FileOutputDto[]; +} diff --git a/packages/ts-docs-gen/src/abstractions/printer-base.ts b/packages/ts-docs-gen/src/abstractions/printer-base.ts deleted file mode 100644 index 34e57074..00000000 --- a/packages/ts-docs-gen/src/abstractions/printer-base.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { RenderedDto } from "../contracts/rendered-dto"; - -export abstract class PrinterBase { - public abstract EntryFileCrawler(data: RenderedDto): any; -} diff --git a/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts b/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts index 182ea74f..5098e2c0 100644 --- a/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts +++ b/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts @@ -6,6 +6,7 @@ import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; import { GeneratorConfiguration, WorkingGeneratorConfiguration } from "../contracts/generator-configuration"; import { PluginRegistry } from "../registries/plugin-registry"; +import { DefaultPlugins } from "../default-plugins"; // TODO: Add method to read compiler options from tsconfig. export class GeneratorConfigurationBuilder { @@ -53,6 +54,11 @@ export class GeneratorConfigurationBuilder { public async Build(entryFiles: string[]): Promise { // Register all plugins. const pluginManager = new PluginRegistry(); + // Register default plugins + for (const item of DefaultPlugins) { + pluginManager.Register(item); + } + if (this.configuration.Plugins != null) { // TODO: Register default plugins. // Registering given plugins. diff --git a/packages/ts-docs-gen/src/contracts/file-output-dto.ts b/packages/ts-docs-gen/src/contracts/file-output-dto.ts new file mode 100644 index 00000000..6fde6c5d --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/file-output-dto.ts @@ -0,0 +1,4 @@ +export interface FileOutputDto { + FileLocation: string; + Output: string[]; +} diff --git a/packages/ts-docs-gen/src/contracts/plugin-data.ts b/packages/ts-docs-gen/src/contracts/plugin-data.ts new file mode 100644 index 00000000..6d9845c8 --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/plugin-data.ts @@ -0,0 +1,9 @@ +import { ReferenceTuple } from "./reference-tuple"; +import { RenderItemOutputDto } from "./render-item-output-dto"; +import { Contracts } from "ts-extractor"; + +export interface PluginData { + Reference: ReferenceTuple; + ApiItem: TKind; + GetItem(entryFile: Contracts.ApiSourceFileDto, reference: ReferenceTuple): RenderItemOutputDto; +} diff --git a/packages/ts-docs-gen/src/contracts/reference-tuple.ts b/packages/ts-docs-gen/src/contracts/reference-tuple.ts new file mode 100644 index 00000000..857d01a2 --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/reference-tuple.ts @@ -0,0 +1,4 @@ +/** + * [referenceId, alias] + */ +export type ReferenceTuple = [string, string]; diff --git a/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts b/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts index 26919c09..ba62e2d1 100644 --- a/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts +++ b/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts @@ -2,6 +2,10 @@ import { Contracts } from "ts-extractor"; export interface RenderItemOutputDto { References: string[]; + /** + * Heading is used for navigation in documentation. It should be the same in the render output. + */ + Heading: string; RenderOutput: string[]; ApiItem: Contracts.ApiItemDto; } diff --git a/packages/ts-docs-gen/src/debug.ts b/packages/ts-docs-gen/src/debug.ts index a6a1ac62..0392b129 100644 --- a/packages/ts-docs-gen/src/debug.ts +++ b/packages/ts-docs-gen/src/debug.ts @@ -6,15 +6,17 @@ import { Generator } from "./generator"; async function Main(): Promise { const projectDirectory = path.join(process.cwd(), "./examples/simple/"); - const entryFiles = ["./index.ts", "./exported-const-variables.ts", "./exported-functions.ts"]; + // const entryFiles = ["./index.ts", "./exported-const-variables.ts", "./exported-functions.ts"]; + const entryFiles = ["./index.ts", "./exported-functions.ts"]; const configPromise = new GeneratorConfigurationBuilder(projectDirectory).Build(entryFiles); const config = await configPromise; const generator = new Generator(config); - generator.PrintToFiles(); + // tslint:disable-next-line:no-console + console.log(generator.OutputData); // tslint:disable-next-line:no-debugger - debugger; + await generator.WriteToFiles(); } Main(); diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts new file mode 100644 index 00000000..b6d52aea --- /dev/null +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -0,0 +1,5 @@ +import { ApiVariablePlugin } from "./plugins/api-variable-plugin"; + +export const DefaultPlugins = [ + new ApiVariablePlugin() +]; diff --git a/packages/ts-docs-gen/src/extractor-helpers.ts b/packages/ts-docs-gen/src/extractor-helpers.ts new file mode 100644 index 00000000..7b9d7af4 --- /dev/null +++ b/packages/ts-docs-gen/src/extractor-helpers.ts @@ -0,0 +1,47 @@ +import { Contracts, ExtractDto } from "ts-extractor"; +import { ReferenceTuple } from "./contracts/reference-tuple"; + +export namespace ExtractorHelpers { + export function GetReferenceTuples( + extractedData: ExtractDto, + entryFile: Contracts.ApiSourceFileDto, + itemsReference: Contracts.ApiItemReferenceTuple + ): ReferenceTuple[] { + let list: ReferenceTuple[] = []; + + for (const [alias, references] of itemsReference) { + for (const referenceId of references) { + // Check if item is ExportSpecifier or ExportDeclaration. + const apiItem = extractedData.Registry[referenceId]; + + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Export: { + const referenceTuples = GetReferenceTuples(extractedData, entryFile, apiItem.Members); + list = list.concat(referenceTuples); + break; + } + case Contracts.ApiItemKinds.ExportSpecifier: { + if (apiItem.ApiItems == null) { + console.warn(`ApiItems are missing in "${apiItem.Name}"?`); + break; + } + const referenceTuples = GetReferenceTuples(extractedData, entryFile, [[apiItem.Name, apiItem.ApiItems]]); + list = list.concat(referenceTuples); + break; + } + default: { + list.push([referenceId, alias]); + } + } + } + } + + return list; + } + + export function ApiVariableToString(item: Contracts.ApiVariableDto, alias?: string): string { + const name = alias != null ? alias : item.Name; + + return `${item.VariableDeclarationType} ${name}: ${item.Type.Text};`; + } +} diff --git a/packages/ts-docs-gen/src/file-manager.ts b/packages/ts-docs-gen/src/file-manager.ts new file mode 100644 index 00000000..40892827 --- /dev/null +++ b/packages/ts-docs-gen/src/file-manager.ts @@ -0,0 +1,81 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownGenerator } from "@simplrjs/markdown"; +import * as path from "path"; + +import { FileManagerBaseBase } from "./abstractions/file-manager-base"; +import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; +import { FileOutputDto } from "./contracts/file-output-dto"; +import { Helpers } from "./utils/helpers"; + +interface OutputData { + RenderOutput: string[]; +} + +type RenderedItem = Array; + +export class FileManager extends FileManagerBaseBase { + private filesList: Map = new Map(); + private referenceToFile: Map = new Map(); + + private fileHeader(entryFile: Contracts.ApiSourceFileDto): OutputData { + const heading = path.basename(entryFile.Name, path.extname(entryFile.Name)); + + const output: string[] = [ + MarkdownGenerator.header(`${heading}`, 1) + ]; + + return { + RenderOutput: output + }; + } + + private getDefaultEntryFile(entryFile: Contracts.ApiSourceFileDto): RenderedItem { + return [ + this.fileHeader(entryFile) + ]; + } + + private renderItemIsItemOutputDto(item: RenderItemOutputDto | OutputData): item is RenderItemOutputDto { + return (item as RenderItemOutputDto).ApiItem != null; + } + + public AddItem(entryFile: Contracts.ApiSourceFileDto, item: RenderItemOutputDto, referenceId: string): void { + const fileName = path.basename(entryFile.Name, path.extname(entryFile.Name)) + ".md"; + const items = this.filesList.get(fileName) || this.getDefaultEntryFile(entryFile); + items.push(item); + + // Add reference link. + this.referenceToFile.set(referenceId, `${fileName}#${Helpers.HeadingToAnchor(item.Heading)}`); + + this.filesList.set(fileName, items); + } + + public ToFilesOutput(): FileOutputDto[] { + const output: FileOutputDto[] = []; + + for (const [fileLocation, items] of this.filesList) { + // Link definitions to file location. + const references: string[] = []; + for (const item of items) { + if (this.renderItemIsItemOutputDto(item)) { + item.References + .forEach(referenceId => + references.push( + MarkdownGenerator.linkDefinition(referenceId, this.referenceToFile.get(referenceId) || "#__error") + ) + ); + } + } + + output.push({ + FileLocation: fileLocation, + Output: [ + ...references, + ...Helpers.Flatten(items.map(x => [x.RenderOutput, ""])) + ] + }); + } + + return output; + } +} diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts new file mode 100644 index 00000000..7f15fd6b --- /dev/null +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -0,0 +1,66 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownGenerator } from "@simplrjs/markdown"; + +export namespace GeneratorHelpers { + export interface TypeToStringDto { + References: string[]; + Text: string; + } + + export function TypeDtoToMarkdownString(type: Contracts.TypeDto): TypeToStringDto { + let references: string[] = []; + let text: string = ""; + + switch (type.ApiTypeKind) { + case Contracts.TypeKinds.Union: + case Contracts.TypeKinds.Intersection: { + const symbol = type.ApiTypeKind === Contracts.TypeKinds.Union ? "|" : "&"; + + type.Types + .map(TypeDtoToMarkdownString) + .forEach(typeItem => { + references = references.concat(typeItem.References); + + if (text === "") { + text = typeItem.Text; + } else { + text += ` ${symbol} ${typeItem.Text}`; + } + }); + break; + } + case Contracts.TypeKinds.Reference: { + references.push(type.ReferenceId); + + // Link to definition + text = `${MarkdownGenerator.link(type.Name || "???", type.ReferenceId, true)}`; + + // Generics + if (type.Generics != null) { + const generics = type.Generics.map(TypeDtoToMarkdownString); + references = references.concat(...generics.map(x => x.References)); + + text += `<${generics.map(x => x.Text).join(", ")}>`; + } + break; + } + case Contracts.TypeKinds.Basic: + default: { + text = type.Name || type.Text; + + // Generics + if (type.Name != null && type.Generics != null) { + const generics = type.Generics.map(TypeDtoToMarkdownString); + references = references.concat(...generics.map(x => x.References)); + + text += `<${generics.map(x => x.Text).join(", ")}>`; + } + } + } + + return { + References: references, + Text: text + }; + } +} diff --git a/packages/ts-docs-gen/src/generator.ts b/packages/ts-docs-gen/src/generator.ts index b2fec265..8d089c27 100644 --- a/packages/ts-docs-gen/src/generator.ts +++ b/packages/ts-docs-gen/src/generator.ts @@ -1,141 +1,95 @@ import { Contracts } from "ts-extractor"; import * as path from "path"; +import * as fs from "fs-extra"; import { GeneratorConfiguration } from "./contracts/generator-configuration"; +import { FileManager } from "./file-manager"; import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; -import { RenderedDto } from "./contracts/rendered-dto"; - +import { ReferenceTuple } from "./contracts/reference-tuple"; import { ApiDefaultPlugin } from "./plugins/api-default-plugin"; -/** - * TODO: Aliasias like - * ```ts - * import { Contracts as ExtractorContracts } from "ts-extractor"; - * ``` - */ +import { ExtractorHelpers } from "./extractor-helpers"; +import { FileOutputDto } from "./contracts/file-output-dto"; + export class Generator { - constructor(private configuration: GeneratorConfiguration) { } + constructor(private configuration: GeneratorConfiguration) { + this.fileManager = new FileManager(); + const { ExtractedData } = this.configuration; - private renderedItems: Map = new Map(); - private renderedData: RenderedDto | undefined; + for (const entryFile of this.configuration.ExtractedData.EntryFiles) { + const referenceTuples = ExtractorHelpers.GetReferenceTuples(ExtractedData, entryFile, entryFile.Members); - private renderApiItem(apiItem: Contracts.ApiItemDto): RenderItemOutputDto { - const plugins = this.configuration.PluginManager.GetPluginsByKind(apiItem.ApiKind); + for (const reference of referenceTuples) { + const [referenceId] = reference; - for (const plugin of plugins) { - if (plugin.CheckApiItem(apiItem)) { - return plugin.Render(apiItem, this.getRenderedItemById); + const renderedItem = this.getRenderedItemByReference(entryFile, reference); + this.fileManager.AddItem(entryFile, renderedItem, referenceId); } } - const defaultPlugin = new ApiDefaultPlugin(); - return defaultPlugin.Render(apiItem, this.getRenderedItemById); + this.outputData = this.fileManager.ToFilesOutput(); } - // TODO: Check for infinity loop. - private getRenderedItemById = (itemId: string): RenderItemOutputDto => { - if (!this.renderedItems.has(itemId)) { - const { Registry } = this.configuration.ExtractedData; - const renderedData = this.renderApiItem(Registry[itemId]); - this.renderedItems.set(itemId, renderedData); - - return renderedData; - } + private renderedItems: Map = new Map(); + private fileManager: FileManager; + private outputData: FileOutputDto[]; - return this.renderedItems.get(itemId)!; + public get OutputData(): ReadonlyArray { + return this.outputData; } - private onRenderData(): RenderedDto { - const { Registry, EntryFiles } = this.configuration.ExtractedData; - - for (const [itemKey] of Object.entries(Registry)) { - if (!this.renderedItems.has(itemKey)) { - this.getRenderedItemById(itemKey); + public async WriteToFiles(): Promise { + for (const item of this.outputData) { + const fullLocation = path.join(this.configuration.OutputDirectory, "api", item.FileLocation); + + try { + // Ensure output directory + await fs.ensureDir(path.dirname(fullLocation)); + // Output file + await fs.writeFile(fullLocation, item.Output.join("\n")); + } catch (error) { + console.error(error); } } - - return { - EntryFiles: EntryFiles, - RenderedItems: this.renderedItems - }; } - public GetRenderedData(): RenderedDto { - let data: RenderedDto | undefined = this.renderedData; - if (data == null) { - data = this.onRenderData(); - } + private getRenderedItemByReference = (entryFile: Contracts.ApiSourceFileDto, reference: ReferenceTuple): RenderItemOutputDto => { + const [referenceId] = reference; + const renderedItem = this.renderedItems.get(reference); - return data; - } + if (renderedItem == null) { + const { Registry } = this.configuration.ExtractedData; + const renderedData = this.renderApiItem(reference, entryFile, Registry[referenceId]); + this.renderedItems.set(reference, renderedData); - public PrintToFiles(): void { - // ===================================== - // - // Preparing files we want to write / output / fill. - // P.S. move this into separate file. - // - // ===================================== - interface PrinterFileData { - /** - * Relative file location to `OutDir` path. - */ - Location: string; - Items: RenderItemOutputDto[]; + return renderedData; } - const data = this.GetRenderedData(); - const list: PrinterFileData[] = []; - - for (const entryFile of data.EntryFiles) { - const printerFile: PrinterFileData = { - Location: path.basename(entryFile.Name) + ".md", - Items: this.getItems(data, entryFile, entryFile.Members) - }; - - list.push(printerFile); - } + return renderedItem; } - private getItems( - data: RenderedDto, + private renderApiItem( + reference: ReferenceTuple, entryFile: Contracts.ApiSourceFileDto, - itemsReference: Contracts.ApiItemReferenceTuple - ): RenderItemOutputDto[] { - let items: RenderItemOutputDto[] = []; - - for (const [, references] of itemsReference) { - for (const reference of references) { - // Check if item is ExportSpecifier or ExportDeclaration. - const apiItem = this.configuration.ExtractedData.Registry[reference]; - - switch (apiItem.ApiKind) { - case Contracts.ApiItemKinds.Export: { - const exporterItems = this.getItems(data, entryFile, apiItem.Members); - items = [...items, ...exporterItems]; - break; - } - case Contracts.ApiItemKinds.ExportSpecifier: { - if (apiItem.ApiItems == null) { - console.warn(`ApiItems are missing in "${apiItem.Name}"?`); - break; - } - const exporterItems = this.getItems(data, entryFile, [[apiItem.Name, apiItem.ApiItems]]); - items = [...items, ...exporterItems]; - break; - } - default: { - const renderedItem = data.RenderedItems.get(reference); - if (renderedItem != null) { - items.push(renderedItem); - } else { - console.warn(`Reference "${reference}" is missing in ${entryFile.Name}?`); - } - } - } + apiItem: Contracts.ApiItemDto + ): RenderItemOutputDto { + const plugins = this.configuration.PluginManager.GetPluginsByKind(apiItem.ApiKind); + + for (const plugin of plugins) { + if (plugin.CheckApiItem(apiItem)) { + return plugin.Render({ + Reference: reference, + ApiItem: apiItem, + GetItem: this.getRenderedItemByReference + }); } } - return items; + const defaultPlugin = new ApiDefaultPlugin(); + return defaultPlugin.Render({ + Reference: reference, + ApiItem: apiItem, + GetItem: this.getRenderedItemByReference + }); } } diff --git a/packages/ts-docs-gen/src/plugins/api-default-plugin.ts b/packages/ts-docs-gen/src/plugins/api-default-plugin.ts index 3939f1ba..0aa5c753 100644 --- a/packages/ts-docs-gen/src/plugins/api-default-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-default-plugin.ts @@ -1,22 +1,25 @@ -import { Contracts } from "ts-extractor"; import { MarkdownGenerator } from "@simplrjs/markdown"; import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; +import { PluginData } from "../contracts/plugin-data"; export class ApiDefaultPlugin extends ApiItemPluginBase { public SupportedApiItemsKinds(): SupportedApiItemKindType[] { return [this.SupportKind.Any]; } - public Render(item: Contracts.ApiItemDto, getItem: (itemId: string) => RenderItemOutputDto): RenderItemOutputDto { + public Render(data: PluginData): RenderItemOutputDto { + const [, alias] = data.Reference; + const heading = `${data.ApiItem.ApiKind}: ${alias}`; const output: string[] = [ - MarkdownGenerator.header(`${item.Name}: ${item.ApiKind.toUpperCase()}`, 2) + MarkdownGenerator.header(heading, 2) ]; return { - ApiItem: item, + Heading: heading, + ApiItem: data.ApiItem, References: [], RenderOutput: output }; diff --git a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts new file mode 100644 index 00000000..05765cc5 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts @@ -0,0 +1,50 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownGenerator } from "@simplrjs/markdown"; + +import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; +import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; +import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; +import { PluginData } from "../contracts/plugin-data"; +import { ExtractorHelpers } from "../extractor-helpers"; +import { GeneratorHelpers } from "../generator-helpers"; + +export class ApiVariablePlugin extends ApiItemPluginBase { + public SupportedApiItemsKinds(): SupportedApiItemKindType[] { + return [this.SupportKind.Variable]; + } + + public Render(data: PluginData): RenderItemOutputDto { + const [, alias] = data.Reference; + let references: string[] = []; + const heading = alias; + + let documentationComment: string[] = []; + if (data.ApiItem.Metadata.DocumentationComment.length > 0) { + documentationComment = [ + ...data.ApiItem.Metadata.DocumentationComment.map(x => x.text), + "" + ]; + } + + const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); + references = references.concat(typeStringDto.References); + + const output: string[] = [ + MarkdownGenerator.header(heading, 2), + "", + ...documentationComment, + ...MarkdownGenerator.code(ExtractorHelpers.ApiVariableToString(data.ApiItem), { lang: "typescript" }), + "", + MarkdownGenerator.header("Type", 3), + "", + typeStringDto.Text + ]; + + return { + Heading: heading, + ApiItem: data.ApiItem, + References: references, + RenderOutput: output + }; + } +} diff --git a/packages/ts-docs-gen/src/printers/default-printer.ts b/packages/ts-docs-gen/src/printers/default-printer.ts deleted file mode 100644 index b5b0109f..00000000 --- a/packages/ts-docs-gen/src/printers/default-printer.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { PrinterBase } from "../abstractions/printer-base"; -import { RenderedDto } from "../contracts/rendered-dto"; - -export class DefaultPrinter extends PrinterBase { - public EntryFileCrawler(data: RenderedDto): void { - throw new Error("Method not implemented."); - } - -} diff --git a/packages/ts-docs-gen/src/utils/helpers.ts b/packages/ts-docs-gen/src/utils/helpers.ts new file mode 100644 index 00000000..adbe288f --- /dev/null +++ b/packages/ts-docs-gen/src/utils/helpers.ts @@ -0,0 +1,11 @@ +export namespace Helpers { + export function Flatten(arr: any[][]): any[] { + return arr.reduce((flat, toFlatten) => + flat.concat(Array.isArray(toFlatten) ? Flatten(toFlatten) : toFlatten), []); + } + + // TODO: Move this to @simplrjs/markdown package. + export function HeadingToAnchor(heading: string): string { + return heading.trim().toLowerCase().replace(/[^\w\- ]+/g, "").replace(/\s/g, "-").replace(/\-+$/, ""); + } +} diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap new file mode 100644 index 00000000..1b490680 --- /dev/null +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`index 1`] = ` +Array [ + Object { + "FileLocation": "index.md", + "Output": Array [ + "# index", + "", + "## class: Foo", + "", + ], + }, +] +`; diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap new file mode 100644 index 00000000..387ccdc0 --- /dev/null +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`index 1`] = ` +Array [ + Object { + "FileLocation": "index.md", + "Output": Array [ + "# index", + "", + "## class: FooStart", + "", + ], + }, + Object { + "FileLocation": "foo.md", + "Output": Array [ + "# foo", + "", + "## class: Foo", + "", + ], + }, +] +`; diff --git a/packages/ts-docs-gen/tests/cases/simple-project-1/test-config.json b/packages/ts-docs-gen/tests/cases/simple-project-1/test-config.json index f4bef8b7..a058bc3b 100644 --- a/packages/ts-docs-gen/tests/cases/simple-project-1/test-config.json +++ b/packages/ts-docs-gen/tests/cases/simple-project-1/test-config.json @@ -1,7 +1,5 @@ { "EntryFiles": [ - "./index.ts", - "./index2.ts", - "./index3.ts" + "./index.ts" ] } diff --git a/packages/ts-docs-gen/tests/cases/simple-project-2/test-config.json b/packages/ts-docs-gen/tests/cases/simple-project-2/test-config.json index a058bc3b..182bf979 100644 --- a/packages/ts-docs-gen/tests/cases/simple-project-2/test-config.json +++ b/packages/ts-docs-gen/tests/cases/simple-project-2/test-config.json @@ -1,5 +1,6 @@ { "EntryFiles": [ - "./index.ts" + "./index.ts", + "./foo.ts" ] } diff --git a/packages/ts-docs-gen/tests/scripts/tests-generator.ts b/packages/ts-docs-gen/tests/scripts/tests-generator.ts index 2da09185..d9b33dfb 100644 --- a/packages/ts-docs-gen/tests/scripts/tests-generator.ts +++ b/packages/ts-docs-gen/tests/scripts/tests-generator.ts @@ -32,13 +32,24 @@ export async function TestsGenerator(dirName: string, cwd: string): Promise {`, + `test("${name}", async done => {`, Tab(1) + `const projectDirectory = "${projectDirectory}";`, Tab(1) + `const entryFiles = ${JSON.stringify(testConfig.EntryFiles)};`, "", - Tab(1) + `expect(true).toBe(true);`, - `});`, + Tab(1) + "try {", + Tab(2) + "const configuration = await new GeneratorConfigurationBuilder(projectDirectory)", + Tab(3) + ".Build(entryFiles);", + "", + Tab(2) + "const generator = new Generator(configuration);", + "", + Tab(2) + "expect(generator.OutputData).toMatchSnapshot();", + Tab(2) + "done();", + Tab(1) + "} catch (error) {", + Tab(2) + "done.fail(error);", + Tab(1) + "}", + "});", "" ].join(os.EOL); From a26eded9093f5cc142f543853e13752d7a699540 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Wed, 6 Dec 2017 19:56:35 +0200 Subject: [PATCH 49/61] Feature: enum plugin (#4) --- common/config/rush/npm-shrinkwrap.json | 32 ++--- .../examples/simple/docs/api/index.md | 110 ++++++++++++++-- packages/ts-docs-gen/examples/simple/index.ts | 100 +++++++++++---- packages/ts-docs-gen/package.json | 2 +- .../ts-docs-gen/src/contracts/plugin-data.ts | 4 +- packages/ts-docs-gen/src/default-plugins.ts | 4 +- packages/ts-docs-gen/src/extractor-helpers.ts | 56 ++++++++ packages/ts-docs-gen/src/file-manager.ts | 4 +- packages/ts-docs-gen/src/generator-helpers.ts | 2 +- packages/ts-docs-gen/src/generator.ts | 3 + .../src/plugins/api-default-plugin.ts | 2 +- .../src/plugins/api-enum-plugin.ts | 121 ++++++++++++++++++ .../src/plugins/api-variable-plugin.ts | 37 +++--- .../simple-project-1.test.ts.snap | 68 ++++++++++ .../simple-project-2.test.ts.snap | 2 + .../tests/cases/simple-project-1/index.ts | 39 ++++++ 16 files changed, 501 insertions(+), 85 deletions(-) create mode 100644 packages/ts-docs-gen/src/plugins/api-enum-plugin.ts diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index 1c68428e..1915ea3f 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -8,9 +8,9 @@ "resolved": "file:projects\\ts-docs-gen.tgz" }, "@simplrjs/markdown": { - "version": "0.1.0-beta", - "from": "@simplrjs/markdown@0.1.0-beta", - "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-0.1.0-beta.tgz" + "version": "1.0.0", + "from": "@simplrjs/markdown@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.0.tgz" }, "@types/fs-extra": { "version": "4.0.5", @@ -23,9 +23,9 @@ "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.8.tgz" }, "@types/node": { - "version": "8.0.53", + "version": "8.0.55", "from": "@types/node@*", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.53.tgz" + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.55.tgz" }, "@types/sinon": { "version": "4.0.0", @@ -33,9 +33,9 @@ "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.0.0.tgz" }, "@types/string": { - "version": "0.0.28", - "from": "@types/string@0.0.28", - "resolved": "https://registry.npmjs.org/@types/string/-/string-0.0.28.tgz" + "version": "0.0.29", + "from": "@types/string@0.0.29", + "resolved": "https://registry.npmjs.org/@types/string/-/string-0.0.29.tgz" }, "abab": { "version": "1.0.4", @@ -53,9 +53,9 @@ "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz" }, "ajv": { - "version": "5.5.0", + "version": "5.5.1", "from": "ajv@>=5.1.0 <6.0.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.0.tgz" + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.1.tgz" }, "amdefine": { "version": "1.0.1", @@ -861,9 +861,9 @@ "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz" }, "fs-extra": { - "version": "4.0.2", + "version": "4.0.3", "from": "fs-extra@>=4.0.2 <5.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz" + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz" }, "fs.realpath": { "version": "1.0.0", @@ -1669,9 +1669,9 @@ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz" }, "kind-of": { - "version": "6.0.1", + "version": "6.0.2", "from": "kind-of@>=6.0.0 <7.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.1.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz" }, "lazy-cache": { "version": "2.0.2", @@ -2717,9 +2717,9 @@ } }, "ts-jest": { - "version": "21.2.3", + "version": "21.2.4", "from": "ts-jest@>=21.2.3 <22.0.0", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-21.2.3.tgz", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-21.2.4.tgz", "dependencies": { "source-map": { "version": "0.6.1", diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index a0f98148..8c08ae16 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,28 +1,112 @@ -[ClassDeclaration-0]: index.md#class-world -[ClassDeclaration-1]: index.md#class-earth -[FunctionDeclaration-0]: exported-functions.md#function-foo # index -## class: World +## Uogos -## class: Earth +Some information +2nd line of some information +3rd line of some information +4th line of some information +5th line of some information. -## Hello +deprecated +beta ```typescript -const Hello: World & Earth; +enum Uogos { + Jokie = "jokie", + Braskes = "braskes" +} ``` -### Type +| Name | Value | +| ------- | --------- | +| Jokie | "jokie" | +| Braskes | "braskes" | + +## Skaiciai + + + +```typescript +enum Skaiciai { + Nulis = 0, + Vienas = 1, + Du = 2 +} +``` + +| Name | Value | +| ------ | ----- | +| Nulis | 0 | +| Vienas | 1 | +| Du | 2 | + +## Sarasas + + + +```typescript +enum Sarasas { + Pirmas = 0, + Antras = 1, + Trecias = 2 +} +``` + +| Name | Value | Description | +| ------- | ----- | ---------------------- | +| Pirmas | 0 | Pirmo description'as. | +| Antras | 1 | Antro description'as. | +| Trecias | 2 | Trečio description'as. | + +## ConstSkaiciai + + + +```typescript +enum ConstSkaiciai { + PirmasC = 0, + AntrasC = 1, + TreciasC = 2 +} +``` + +| Name | Value | +| -------- | ----- | +| PirmasC | 0 | +| AntrasC | 1 | +| TreciasC | 2 | + +## ConstSarasas -[World][ClassDeclaration-0] & [Earth][ClassDeclaration-1] -## FooFunc ```typescript -const FooFunc: () => string; +enum ConstSarasas { + PirmasC = 0, + AntrasC = 1, + TreciasC = 2 +} ``` -### Type +| Name | Value | Description | +| -------- | ----- | ---------------------- | +| PirmasC | 0 | Pirmo description'as. | +| AntrasC | 1 | Antro description'as. | +| TreciasC | 2 | Trečio description'as. | + +## ConstUogos + + + +```typescript +enum ConstUogos { + Jokie = "jokie", + Braskes = "braskes" +} +``` -[Foo][FunctionDeclaration-0] +| Name | Value | +| ------- | --------- | +| Jokie | "jokie" | +| Braskes | "braskes" | diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index abb00c30..63042ba2 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -1,13 +1,13 @@ // tslint:disable -import { Foo } from "./exported-functions"; +// import { Foo } from "./exported-functions"; -export class World { } -export class Earth { } +// export class World { } +// export class Earth { } -export declare const Hello: World & Earth; +// export declare const Hello: World & Earth; -export const FooFunc = Foo; +// export const FooFunc = Foo; // export function Foo(): string { // return "foo"; @@ -51,12 +51,12 @@ export const FooFunc = Foo; // (param1: TValue, param2: TValue): boolean; // } -/** - * Some JSdoc information. - * 2nd line of some JSdoc information. - * @summary Some summary about this package version. - * @summary 2nd of some summary about this package version. - */ +// /** +// * Some JSdoc information. +// * 2nd line of some JSdoc information. +// * @summary Some summary about this package version. +// * @summary 2nd of some summary about this package version. +// */ // export const itemsList: string[] = ["a"]; // export function Ok(isIt: boolean): boolean { @@ -71,22 +71,68 @@ export const FooFunc = Foo; // export const name = "some-kind-of-module"; // } -// export enum Uogos { -// Jokie = "jokie", -// Braskes = "braskes" -// } - -// export enum Skaiciai { -// Nulis = 0, -// Vienas = 1, -// Du = 2 -// } - -// export enum Sarasas { -// Pirmas, -// Antras, -// Trecias -// } +/** + * Some information + * 2nd line of some information + * 3rd line of some information + * 4th line of some information + * 5th line of some information + * @summary Some summary about this package version. + * @summary 2nd of some summary about this package version. + * @deprecated + * @beta + */ +export enum Uogos { + Jokie = "jokie", + Braskes = "braskes" +} + +export enum Skaiciai { + Nulis = 0, + Vienas = 1, + Du = 2 +} + +export enum Sarasas { + /** + * Pirmo description'as + */ + Pirmas, + /** + * Antro description'as + */ + Antras, + /** + * Trečio description'as + */ + Trecias +} + +export const enum ConstSkaiciai { + PirmasC = 0, + AntrasC = 1, + TreciasC = 2 +} + +export const enum ConstSarasas { + /** + * Pirmo description'as + */ + PirmasC, + /** + * Antro description'as + */ + AntrasC, + /** + * Trečio description'as + */ + TreciasC +} + +export const enum ConstUogos { + Jokie = "jokie", + Braskes = "braskes" +} // export interface Boo { // Boos: string[]; diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index 32a6c5fc..674499a1 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -15,7 +15,7 @@ "engine": "node >= 7.5.0", "author": "simplrjs (https://github.com/simplrjs)", "dependencies": { - "@simplrjs/markdown": "0.1.0-beta", + "@simplrjs/markdown": "^1.0.0", "@types/fs-extra": "^4.0.5", "fast-glob": "^1.0.1", "fs-extra": "^4.0.2", diff --git a/packages/ts-docs-gen/src/contracts/plugin-data.ts b/packages/ts-docs-gen/src/contracts/plugin-data.ts index 6d9845c8..e3315a02 100644 --- a/packages/ts-docs-gen/src/contracts/plugin-data.ts +++ b/packages/ts-docs-gen/src/contracts/plugin-data.ts @@ -1,9 +1,11 @@ +import { Contracts, ExtractDto } from "ts-extractor"; + import { ReferenceTuple } from "./reference-tuple"; import { RenderItemOutputDto } from "./render-item-output-dto"; -import { Contracts } from "ts-extractor"; export interface PluginData { Reference: ReferenceTuple; ApiItem: TKind; + ExtractedData: ExtractDto; GetItem(entryFile: Contracts.ApiSourceFileDto, reference: ReferenceTuple): RenderItemOutputDto; } diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index b6d52aea..a291cba3 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -1,5 +1,7 @@ import { ApiVariablePlugin } from "./plugins/api-variable-plugin"; +import { ApiEnumPlugin } from "./plugins/api-enum-plugin"; export const DefaultPlugins = [ - new ApiVariablePlugin() + new ApiVariablePlugin(), + new ApiEnumPlugin() ]; diff --git a/packages/ts-docs-gen/src/extractor-helpers.ts b/packages/ts-docs-gen/src/extractor-helpers.ts index 7b9d7af4..c5bd13d7 100644 --- a/packages/ts-docs-gen/src/extractor-helpers.ts +++ b/packages/ts-docs-gen/src/extractor-helpers.ts @@ -44,4 +44,60 @@ export namespace ExtractorHelpers { return `${item.VariableDeclarationType} ${name}: ${item.Type.Text};`; } + + export function ReconstructEnumCode(alias: string, memberItems: Contracts.ApiEnumMemberDto[]): string[] { + // Constructing enum body. + const membersStrings = memberItems.map((memberItem, index, array) => { + // Add an enum name + let memberString = `${ExtractorHelpers.Tab()} ${memberItem.Name}`; + + // Add an enum member value if it exists. + if (memberItem.Value) { + memberString += ` = ${memberItem.Value}`; + } + + // Add a comma if current item is not the last item + if (index !== memberItems.length - 1) { + memberString += ","; + } + + return memberString; + }); + + // Construct enum code output + return [ + `enum ${alias} {`, + ...membersStrings, + "}" + ]; + } + + // TODO: reconsider location + const TAB_STRING = " "; + + export function Tab(size: number = 1): string { + let result: string = ""; + for (let i = 0; i < size; i++) { + result += TAB_STRING; + } + return result; + } + // --------------------------------------------------- + + export const DEFAULT_CODE_OPTIONS = { + lang: "typescript" + }; + + export function FixSentence(sentence: string, punctuationMark: string = "."): string { + const trimmedSentence = sentence.trim(); + const punctuationMarks = ".!:;,-"; + + const lastSymbol = trimmedSentence[trimmedSentence.length - 1]; + + if (punctuationMarks.indexOf(lastSymbol) !== -1) { + return trimmedSentence; + } + + return trimmedSentence + punctuationMark; + } } diff --git a/packages/ts-docs-gen/src/file-manager.ts b/packages/ts-docs-gen/src/file-manager.ts index 40892827..d0c55974 100644 --- a/packages/ts-docs-gen/src/file-manager.ts +++ b/packages/ts-docs-gen/src/file-manager.ts @@ -21,7 +21,7 @@ export class FileManager extends FileManagerBaseBase { const heading = path.basename(entryFile.Name, path.extname(entryFile.Name)); const output: string[] = [ - MarkdownGenerator.header(`${heading}`, 1) + MarkdownGenerator.Header(`${heading}`, 1) ]; return { @@ -61,7 +61,7 @@ export class FileManager extends FileManagerBaseBase { item.References .forEach(referenceId => references.push( - MarkdownGenerator.linkDefinition(referenceId, this.referenceToFile.get(referenceId) || "#__error") + MarkdownGenerator.LinkDefinition(referenceId, this.referenceToFile.get(referenceId) || "#__error") ) ); } diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 7f15fd6b..4e01ecc8 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -33,7 +33,7 @@ export namespace GeneratorHelpers { references.push(type.ReferenceId); // Link to definition - text = `${MarkdownGenerator.link(type.Name || "???", type.ReferenceId, true)}`; + text = `${MarkdownGenerator.Link(type.Name || "???", type.ReferenceId, true)}`; // Generics if (type.Generics != null) { diff --git a/packages/ts-docs-gen/src/generator.ts b/packages/ts-docs-gen/src/generator.ts index 8d089c27..35ffa6cd 100644 --- a/packages/ts-docs-gen/src/generator.ts +++ b/packages/ts-docs-gen/src/generator.ts @@ -1,3 +1,4 @@ + import { Contracts } from "ts-extractor"; import * as path from "path"; import * as fs from "fs-extra"; @@ -78,6 +79,7 @@ export class Generator { for (const plugin of plugins) { if (plugin.CheckApiItem(apiItem)) { return plugin.Render({ + ExtractedData: this.configuration.ExtractedData, Reference: reference, ApiItem: apiItem, GetItem: this.getRenderedItemByReference @@ -87,6 +89,7 @@ export class Generator { const defaultPlugin = new ApiDefaultPlugin(); return defaultPlugin.Render({ + ExtractedData: this.configuration.ExtractedData, Reference: reference, ApiItem: apiItem, GetItem: this.getRenderedItemByReference diff --git a/packages/ts-docs-gen/src/plugins/api-default-plugin.ts b/packages/ts-docs-gen/src/plugins/api-default-plugin.ts index 0aa5c753..93001e90 100644 --- a/packages/ts-docs-gen/src/plugins/api-default-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-default-plugin.ts @@ -14,7 +14,7 @@ export class ApiDefaultPlugin extends ApiItemPluginBase { const [, alias] = data.Reference; const heading = `${data.ApiItem.ApiKind}: ${alias}`; const output: string[] = [ - MarkdownGenerator.header(heading, 2) + MarkdownGenerator.Header(heading, 2) ]; return { diff --git a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts new file mode 100644 index 00000000..4b9a31a8 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts @@ -0,0 +1,121 @@ +import { Contracts, ExtractDto } from "ts-extractor"; +import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; + +import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; +import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; +import { PluginData } from "../contracts/plugin-data"; +import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; +import { ExtractorHelpers } from "../extractor-helpers"; + +// TODO: const enums implementation. +export class ApiEnumPlugin extends ApiItemPluginBase { + public SupportedApiItemsKinds(): SupportedApiItemKindType[] { + return [this.SupportKind.Enum]; + } + + private resolveDocumentationComment(metaData: Contracts.ApiMetadataDto): string[] { + if (metaData.DocumentationComment.length === 0) { + return []; + } + + // TODO: implement ExtractorHelpers.FixSentence when comments separation implemented in `ts-extractor`. + return metaData.DocumentationComment.map(commentItem => commentItem.text); + } + + // TODO: improve output text of @beta and @deprecated JSDocTags. + /** + * Resolves "@beta" and "@deprecated" JSDocTags. + */ + private resolveJSDocTags(metaData: Contracts.ApiMetadataDto): string[] { + return metaData.JSDocTags + .filter(tag => tag.name === "deprecated" || tag.name === "beta") + .map(tag => { + if (tag.text) { + return `${tag.name} - ${tag.text}`; + } + + return tag.name; + }); + } + + private constructEnumTable(members: Contracts.ApiEnumMemberDto[]): string[] { + // Table header. + const header = ["Name", "Value"]; + + // Assuming that enum members are not described separately. + let descriptionFound = false; + + // Generating table content. + const content = members.map(member => { + const row: string[] = [member.Name, member.Value]; + const comments = member.Metadata.DocumentationComment; + + // Handling enum member comments. + if (comments.length > 0) { + descriptionFound = true; + + const commentSeparator = " "; + let description = ""; + + // Reducing comments into a single description. + comments.forEach((comment, index, array) => { + description += ExtractorHelpers.FixSentence(comment.text); + + if (index !== array.length - 1) { + description += commentSeparator; + } + }); + + row.push(description); + } + + return row; + }); + + // Add description cell in header if at least one enum member have comment. + if (descriptionFound) { + header.push("Description"); + } + + return MarkdownGenerator.Table(header, content); + } + + /** + * Resolve api items of an enum from ApiItemReferenceTuple. + */ + private getEnumMembers(members: Contracts.ApiItemReferenceTuple, extractedData: ExtractDto): Contracts.ApiEnumMemberDto[] { + const apiItems: Contracts.ApiEnumMemberDto[] = []; + + for (const memberReferences of members) { + const [, references] = memberReferences; + for (const reference of references) { + const apiItem = extractedData.Registry[reference] as Contracts.ApiEnumMemberDto; + apiItems.push(apiItem); + } + } + + return apiItems; + } + + public Render(data: PluginData): RenderItemOutputDto { + const [, alias] = data.Reference; + const enumMembers = this.getEnumMembers(data.ApiItem.Members, data.ExtractedData); + const builder = new MarkdownBuilder() + .Header(alias, 2) + .EmptyLine() + .Text(this.resolveDocumentationComment(data.ApiItem.Metadata)) + .EmptyLine() + .Text(this.resolveJSDocTags(data.ApiItem.Metadata)) + .EmptyLine() + .Code(ExtractorHelpers.ReconstructEnumCode(alias, enumMembers), ExtractorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine() + .Text(this.constructEnumTable(enumMembers)); + + return { + Heading: "Enum", + ApiItem: data.ApiItem, + References: [], + RenderOutput: builder.GetOutput() + }; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts index 05765cc5..1ad4c45e 100644 --- a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts @@ -1,5 +1,5 @@ import { Contracts } from "ts-extractor"; -import { MarkdownGenerator } from "@simplrjs/markdown"; +import { MarkdownBuilder } from "@simplrjs/markdown"; import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; @@ -15,36 +15,29 @@ export class ApiVariablePlugin extends ApiItemPluginBase): RenderItemOutputDto { const [, alias] = data.Reference; - let references: string[] = []; const heading = alias; + const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); + + const builder = new MarkdownBuilder() + .Header(heading, 2) + .EmptyLine(); - let documentationComment: string[] = []; if (data.ApiItem.Metadata.DocumentationComment.length > 0) { - documentationComment = [ - ...data.ApiItem.Metadata.DocumentationComment.map(x => x.text), - "" - ]; + builder.Text(data.ApiItem.Metadata.DocumentationComment.map(x => x.text)); } - const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); - references = references.concat(typeStringDto.References); - - const output: string[] = [ - MarkdownGenerator.header(heading, 2), - "", - ...documentationComment, - ...MarkdownGenerator.code(ExtractorHelpers.ApiVariableToString(data.ApiItem), { lang: "typescript" }), - "", - MarkdownGenerator.header("Type", 3), - "", - typeStringDto.Text - ]; + builder + .Code(ExtractorHelpers.ApiVariableToString(data.ApiItem), ExtractorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine() + .Header("Type", 3) + .EmptyLine() + .Text(typeStringDto.Text); return { Heading: heading, ApiItem: data.ApiItem, - References: references, - RenderOutput: output + References: typeStringDto.References, + RenderOutput: builder.GetOutput() }; } } diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index 1b490680..9113bab0 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -7,6 +7,74 @@ Array [ "Output": Array [ "# index", "", + "## EnumList", + "", + "Simple list.", + "", + "", + "\`\`\`typescript", + "enum EnumList {", + " FirstOption = 0,", + " SecondOption = 1,", + " ThirdOption = 2", + "}", + "\`\`\`", + "", + "| Name | Value | Description |", + "| ------------ | ----- | ------------------------------ |", + "| FirstOption | 0 | Description for First option. |", + "| SecondOption | 1 | Description for Second option. |", + "| ThirdOption | 2 | Description for Third option. |", + "", + "## EnumListWithNumberValues", + "", + "List with number values with no punctuation at the end of description.", + "", + "", + "\`\`\`typescript", + "enum EnumListWithNumberValues {", + " FirstOption = 1,", + " SecondOption = 2,", + " ThirdOption = 3", + "}", + "\`\`\`", + "", + "| Name | Value |", + "| ------------ | ----- |", + "| FirstOption | 1 |", + "| SecondOption | 2 |", + "| ThirdOption | 3 |", + "", + "## EnumListWithStringValues", + "", + "", + "beta", + "deprecated", + "", + "\`\`\`typescript", + "enum EnumListWithStringValues {", + " FirstOption = \\"first\\",", + " SecondOption = \\"second\\",", + " ThirdOption = \\"third\\"", + "}", + "\`\`\`", + "", + "| Name | Value |", + "| ------------ | -------- |", + "| FirstOption | \\"first\\" |", + "| SecondOption | \\"second\\" |", + "| ThirdOption | \\"third\\" |", + "", + "## SampleConst", + "", + "\`\`\`typescript", + "const SampleConst: string;", + "\`\`\`", + "", + "### Type", + "", + "string", + "", "## class: Foo", "", ], diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap index 387ccdc0..4939fde2 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -7,6 +7,8 @@ Array [ "Output": Array [ "# index", "", + "## class: Foo", + "", "## class: FooStart", "", ], diff --git a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts index 0286763e..c3a40955 100644 --- a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts +++ b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts @@ -1,3 +1,42 @@ +/** + * Simple list. + */ +export enum EnumList { + /** + * Description for First option. + */ + FirstOption, + /** + * Description for Second option. + */ + SecondOption, + /** + * Description for Third option. + */ + ThirdOption +} + +/** + * List with number values with no punctuation at the end of description + */ +export enum EnumListWithNumberValues { + FirstOption = 1, + SecondOption = 2, + ThirdOption = 3 +} + +/** + * @beta + * @deprecated + */ +export enum EnumListWithStringValues { + FirstOption = "first", + SecondOption = "second", + ThirdOption = "third" +} + +export const SampleConst: string = "sample-const"; + export class Foo { public HandleMessage(message: string): string { return message; From 6dc62d455743740bb5f6b0b40367c77efba65d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Fri, 8 Dec 2017 19:52:24 +0200 Subject: [PATCH 50/61] Feature: ApiType plugin (#5) --- common/config/rush/npm-shrinkwrap.json | 53 ++++++------- .../examples/simple/docs/api/index.md | 48 +++++++----- packages/ts-docs-gen/examples/simple/index.ts | 7 +- packages/ts-docs-gen/package.json | 16 ++-- packages/ts-docs-gen/src/default-plugins.ts | 4 +- packages/ts-docs-gen/src/extractor-helpers.ts | 6 ++ packages/ts-docs-gen/src/generator-helpers.ts | 76 ++++++++++++++----- .../src/plugins/api-enum-plugin.ts | 72 ++---------------- .../src/plugins/api-type-plugin.ts | 39 ++++++++++ .../src/plugins/api-variable-plugin.ts | 9 +-- 10 files changed, 181 insertions(+), 149 deletions(-) create mode 100644 packages/ts-docs-gen/src/plugins/api-type-plugin.ts diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index 1915ea3f..c04d6058 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -8,9 +8,9 @@ "resolved": "file:projects\\ts-docs-gen.tgz" }, "@simplrjs/markdown": { - "version": "1.0.0", - "from": "@simplrjs/markdown@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.0.tgz" + "version": "1.0.1", + "from": "@simplrjs/markdown@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.1.tgz" }, "@types/fs-extra": { "version": "4.0.5", @@ -19,18 +19,18 @@ }, "@types/jest": { "version": "21.1.8", - "from": "@types/jest@>=21.1.6 <22.0.0", + "from": "@types/jest@>=21.1.8 <22.0.0", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.8.tgz" }, "@types/node": { - "version": "8.0.55", + "version": "8.0.57", "from": "@types/node@*", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.55.tgz" + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.57.tgz" }, "@types/sinon": { - "version": "4.0.0", - "from": "@types/sinon@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.0.0.tgz" + "version": "4.1.0", + "from": "@types/sinon@>=4.1.0 <5.0.0", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.1.0.tgz" }, "@types/string": { "version": "0.0.29", @@ -862,7 +862,7 @@ }, "fs-extra": { "version": "4.0.3", - "from": "fs-extra@>=4.0.2 <5.0.0", + "from": "fs-extra@>=4.0.3 <5.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz" }, "fs.realpath": { @@ -2208,9 +2208,9 @@ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz" }, "regenerator-runtime": { - "version": "0.11.0", + "version": "0.11.1", "from": "regenerator-runtime@>=0.11.0 <0.12.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz" + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz" }, "regex-cache": { "version": "0.4.4", @@ -2351,7 +2351,7 @@ }, "simplr-logger": { "version": "1.0.1", - "from": "simplr-logger@>=1.0.0 <2.0.0", + "from": "simplr-logger@>=1.0.1 <2.0.0", "resolved": "https://registry.npmjs.org/simplr-logger/-/simplr-logger-1.0.1.tgz" }, "simplr-tslint": { @@ -2360,9 +2360,9 @@ "resolved": "https://registry.npmjs.org/simplr-tslint/-/simplr-tslint-0.0.1.tgz" }, "sinon": { - "version": "4.1.2", - "from": "sinon@>=4.1.2 <5.0.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.2.tgz" + "version": "4.1.3", + "from": "sinon@>=4.1.3 <5.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.3.tgz" }, "slash": { "version": "1.0.0", @@ -2705,20 +2705,13 @@ "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz" }, "ts-extractor": { - "version": "1.1.1", - "from": "ts-extractor@>=1.1.1 <2.0.0", - "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-1.1.1.tgz", - "dependencies": { - "simplr-logger": { - "version": "0.4.0", - "from": "simplr-logger@>=0.4.0 <0.5.0", - "resolved": "https://registry.npmjs.org/simplr-logger/-/simplr-logger-0.4.0.tgz" - } - } + "version": "2.0.0", + "from": "ts-extractor@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-2.0.0.tgz" }, "ts-jest": { "version": "21.2.4", - "from": "ts-jest@>=21.2.3 <22.0.0", + "from": "ts-jest@>=21.2.4 <22.0.0", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-21.2.4.tgz", "dependencies": { "source-map": { @@ -2768,9 +2761,9 @@ } }, "tslib": { - "version": "1.8.0", + "version": "1.8.1", "from": "tslib@>=1.8.0 <2.0.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz" + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz" }, "tslint": { "version": "5.8.0", @@ -2801,7 +2794,7 @@ }, "type-detect": { "version": "4.0.5", - "from": "type-detect@>=4.0.0 <5.0.0", + "from": "type-detect@>=4.0.5 <5.0.0", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz" }, "typescript": { diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index 8c08ae16..9fc91565 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,15 +1,20 @@ +[EnumDeclaration-0]: index.md#uogos # index +## class: World + ## Uogos +Warning: Beta! + Some information 2nd line of some information 3rd line of some information 4th line of some information -5th line of some information. +5th line of some information + +> Some summary about this package version. -deprecated -beta ```typescript enum Uogos { @@ -26,7 +31,6 @@ enum Uogos { ## Skaiciai - ```typescript enum Skaiciai { Nulis = 0, @@ -44,7 +48,6 @@ enum Skaiciai { ## Sarasas - ```typescript enum Sarasas { Pirmas = 0, @@ -53,16 +56,15 @@ enum Sarasas { } ``` -| Name | Value | Description | -| ------- | ----- | ---------------------- | -| Pirmas | 0 | Pirmo description'as. | -| Antras | 1 | Antro description'as. | -| Trecias | 2 | Trečio description'as. | +| Name | Value | Description | +| ------- | ----- | --------------------- | +| Pirmas | 0 | Pirmo description'as | +| Antras | 1 | Antro description'as | +| Trecias | 2 | Trečio description'as | ## ConstSkaiciai - ```typescript enum ConstSkaiciai { PirmasC = 0, @@ -80,7 +82,6 @@ enum ConstSkaiciai { ## ConstSarasas - ```typescript enum ConstSarasas { PirmasC = 0, @@ -89,16 +90,15 @@ enum ConstSarasas { } ``` -| Name | Value | Description | -| -------- | ----- | ---------------------- | -| PirmasC | 0 | Pirmo description'as. | -| AntrasC | 1 | Antro description'as. | -| TreciasC | 2 | Trečio description'as. | +| Name | Value | Description | +| -------- | ----- | --------------------- | +| PirmasC | 0 | Pirmo description'as | +| AntrasC | 1 | Antro description'as | +| TreciasC | 2 | Trečio description'as | ## ConstUogos - ```typescript enum ConstUogos { Jokie = "jokie", @@ -110,3 +110,15 @@ enum ConstUogos { | ------- | --------- | | Jokie | "jokie" | | Braskes | "braskes" | + +## Hello + +Deprecated: Use uogos instead ;)! + +```typescript +type Hello = Uogos; +``` + +### Type + +[Uogos][EnumDeclaration-0] diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index 63042ba2..ffc6f84e 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -2,7 +2,7 @@ // import { Foo } from "./exported-functions"; -// export class World { } +export class World { } // export class Earth { } // export declare const Hello: World & Earth; @@ -168,3 +168,8 @@ export const enum ConstUogos { // public abstract Bar(): string; // } + +/** + * @deprecated Use uogos instead ;) + */ +export type Hello = Uogos; diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index 674499a1..f729119a 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -15,21 +15,21 @@ "engine": "node >= 7.5.0", "author": "simplrjs (https://github.com/simplrjs)", "dependencies": { - "@simplrjs/markdown": "^1.0.0", + "@simplrjs/markdown": "^1.0.1", "@types/fs-extra": "^4.0.5", "fast-glob": "^1.0.1", - "fs-extra": "^4.0.2", - "simplr-logger": "^1.0.0", - "ts-extractor": "^1.1.1", + "fs-extra": "^4.0.3", + "simplr-logger": "^1.0.1", + "ts-extractor": "^2.0.0", "typescript": "^2.6.2" }, "devDependencies": { - "@types/jest": "^21.1.6", - "@types/sinon": "^4.0.0", + "@types/jest": "^21.1.8", + "@types/sinon": "^4.1.0", "jest": "^21.2.1", "simplr-tslint": "0.0.1", - "sinon": "^4.1.2", - "ts-jest": "^21.2.3", + "sinon": "^4.1.3", + "ts-jest": "^21.2.4", "ts-node": "^3.3.0", "tslint": "^5.8.0" }, diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index a291cba3..02b7b9ea 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -1,7 +1,9 @@ import { ApiVariablePlugin } from "./plugins/api-variable-plugin"; import { ApiEnumPlugin } from "./plugins/api-enum-plugin"; +import { ApiTypePlugin } from "./plugins/api-type-plugin"; export const DefaultPlugins = [ new ApiVariablePlugin(), - new ApiEnumPlugin() + new ApiEnumPlugin(), + new ApiTypePlugin() ]; diff --git a/packages/ts-docs-gen/src/extractor-helpers.ts b/packages/ts-docs-gen/src/extractor-helpers.ts index c5bd13d7..f0198fc6 100644 --- a/packages/ts-docs-gen/src/extractor-helpers.ts +++ b/packages/ts-docs-gen/src/extractor-helpers.ts @@ -100,4 +100,10 @@ export namespace ExtractorHelpers { return trimmedSentence + punctuationMark; } + + export function ApiTypeToString(item: Contracts.ApiTypeDto, alias?: string): string { + const name = alias != null ? alias : item.Name; + + return `type ${name} = ${item.Type.Text};`; + } } diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 4e01ecc8..2173b10f 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -1,5 +1,5 @@ import { Contracts } from "ts-extractor"; -import { MarkdownGenerator } from "@simplrjs/markdown"; +import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; export namespace GeneratorHelpers { export interface TypeToStringDto { @@ -16,6 +16,12 @@ export namespace GeneratorHelpers { case Contracts.TypeKinds.Intersection: { const symbol = type.ApiTypeKind === Contracts.TypeKinds.Union ? "|" : "&"; + if (type.ReferenceId != null) { + text = MarkdownGenerator.Link(type.Name || type.Text, type.ReferenceId, true); + references.push(type.ReferenceId); + break; + } + type.Types .map(TypeDtoToMarkdownString) .forEach(typeItem => { @@ -29,25 +35,8 @@ export namespace GeneratorHelpers { }); break; } - case Contracts.TypeKinds.Reference: { - references.push(type.ReferenceId); - - // Link to definition - text = `${MarkdownGenerator.Link(type.Name || "???", type.ReferenceId, true)}`; - - // Generics - if (type.Generics != null) { - const generics = type.Generics.map(TypeDtoToMarkdownString); - references = references.concat(...generics.map(x => x.References)); - - text += `<${generics.map(x => x.Text).join(", ")}>`; - } - break; - } case Contracts.TypeKinds.Basic: default: { - text = type.Name || type.Text; - // Generics if (type.Name != null && type.Generics != null) { const generics = type.Generics.map(TypeDtoToMarkdownString); @@ -55,6 +44,14 @@ export namespace GeneratorHelpers { text += `<${generics.map(x => x.Text).join(", ")}>`; } + + // Basic type with reference. + if (type.ReferenceId != null) { + text = MarkdownGenerator.Link(type.Name || type.Text, type.ReferenceId, true); + references.push(type.ReferenceId); + } else { + text = type.Name || type.Text; + } } } @@ -63,4 +60,47 @@ export namespace GeneratorHelpers { Text: text }; } + + export enum JSDocTags { + Beta = "beta", + Deprecated = "deprecated", + Summary = "summary" + } + + export function RenderApiItemMetadata(apiItem: Contracts.ApiItemDto): string[] { + const builder = new MarkdownBuilder(); + + // Optimise? + const isBeta = apiItem.Metadata.JSDocTags.findIndex(x => x.name.toLowerCase() === JSDocTags.Beta) !== -1; + const deprecated = apiItem.Metadata.JSDocTags.find(x => x.name.toLowerCase() === JSDocTags.Deprecated); + const summary = apiItem.Metadata.JSDocTags.find(x => x.name.toLowerCase() === JSDocTags.Summary); + const jSDocComment = apiItem.Metadata.DocumentationComment; + + if (isBeta) { + builder + .Text(`Warning: Beta!`) + .EmptyLine(); + } + + if (deprecated != null) { + const message = Boolean(deprecated.text) ? `: ${deprecated.text}` : ""; + builder + .Text(`Deprecated${message}!`) + .EmptyLine(); + } + + if (jSDocComment.length > 0) { + builder + .Text(jSDocComment) + .EmptyLine(); + } + + if (summary != null && Boolean(summary.text)) { + builder + .Blockquote(summary.text!.split("\n")) + .EmptyLine(); + } + + return builder.GetOutput(); + } } diff --git a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts index 4b9a31a8..015d5b47 100644 --- a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts @@ -6,6 +6,7 @@ import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-t import { PluginData } from "../contracts/plugin-data"; import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; import { ExtractorHelpers } from "../extractor-helpers"; +import { GeneratorHelpers } from "../generator-helpers"; // TODO: const enums implementation. export class ApiEnumPlugin extends ApiItemPluginBase { @@ -13,71 +14,12 @@ export class ApiEnumPlugin extends ApiItemPluginBase { return [this.SupportKind.Enum]; } - private resolveDocumentationComment(metaData: Contracts.ApiMetadataDto): string[] { - if (metaData.DocumentationComment.length === 0) { - return []; - } - - // TODO: implement ExtractorHelpers.FixSentence when comments separation implemented in `ts-extractor`. - return metaData.DocumentationComment.map(commentItem => commentItem.text); - } - - // TODO: improve output text of @beta and @deprecated JSDocTags. - /** - * Resolves "@beta" and "@deprecated" JSDocTags. - */ - private resolveJSDocTags(metaData: Contracts.ApiMetadataDto): string[] { - return metaData.JSDocTags - .filter(tag => tag.name === "deprecated" || tag.name === "beta") - .map(tag => { - if (tag.text) { - return `${tag.name} - ${tag.text}`; - } - - return tag.name; - }); - } - private constructEnumTable(members: Contracts.ApiEnumMemberDto[]): string[] { // Table header. - const header = ["Name", "Value"]; - - // Assuming that enum members are not described separately. - let descriptionFound = false; - - // Generating table content. - const content = members.map(member => { - const row: string[] = [member.Name, member.Value]; - const comments = member.Metadata.DocumentationComment; + const header = ["Name", "Value", "Description"]; + const content = members.map(x => [x.Name, x.Value, x.Metadata.DocumentationComment]); - // Handling enum member comments. - if (comments.length > 0) { - descriptionFound = true; - - const commentSeparator = " "; - let description = ""; - - // Reducing comments into a single description. - comments.forEach((comment, index, array) => { - description += ExtractorHelpers.FixSentence(comment.text); - - if (index !== array.length - 1) { - description += commentSeparator; - } - }); - - row.push(description); - } - - return row; - }); - - // Add description cell in header if at least one enum member have comment. - if (descriptionFound) { - header.push("Description"); - } - - return MarkdownGenerator.Table(header, content); + return MarkdownGenerator.Table(header, content, { removeColumnIfEmpty: true }); } /** @@ -103,16 +45,14 @@ export class ApiEnumPlugin extends ApiItemPluginBase { const builder = new MarkdownBuilder() .Header(alias, 2) .EmptyLine() - .Text(this.resolveDocumentationComment(data.ApiItem.Metadata)) - .EmptyLine() - .Text(this.resolveJSDocTags(data.ApiItem.Metadata)) + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) .EmptyLine() .Code(ExtractorHelpers.ReconstructEnumCode(alias, enumMembers), ExtractorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() .Text(this.constructEnumTable(enumMembers)); return { - Heading: "Enum", + Heading: alias, ApiItem: data.ApiItem, References: [], RenderOutput: builder.GetOutput() diff --git a/packages/ts-docs-gen/src/plugins/api-type-plugin.ts b/packages/ts-docs-gen/src/plugins/api-type-plugin.ts new file mode 100644 index 00000000..7709a1c7 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-type-plugin.ts @@ -0,0 +1,39 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; +import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; +import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; +import { PluginData } from "../contracts/plugin-data"; +import { ExtractorHelpers } from "../extractor-helpers"; +import { GeneratorHelpers } from "../generator-helpers"; + +export class ApiTypePlugin extends ApiItemPluginBase { + public SupportedApiItemsKinds(): SupportedApiItemKindType[] { + return [this.SupportKind.Type]; + } + + public Render(data: PluginData): RenderItemOutputDto { + const [, alias] = data.Reference; + const heading = alias; + const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); + + // Header + const builder = new MarkdownBuilder() + .Header(heading, 2) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Code(ExtractorHelpers.ApiTypeToString(data.ApiItem), ExtractorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine() + .Header("Type", 3) + .EmptyLine() + .Text(typeStringDto.Text); + + return { + Heading: heading, + ApiItem: data.ApiItem, + References: typeStringDto.References, + RenderOutput: builder.GetOutput() + }; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts index 1ad4c45e..095ed0a5 100644 --- a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts @@ -20,13 +20,8 @@ export class ApiVariablePlugin extends ApiItemPluginBase 0) { - builder.Text(data.ApiItem.Metadata.DocumentationComment.map(x => x.text)); - } - - builder + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) .Code(ExtractorHelpers.ApiVariableToString(data.ApiItem), ExtractorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() .Header("Type", 3) From 970c95306bbb68e851f890816a0b1ad7e3a3642a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donatas=20Bra=C5=BEionis?= Date: Mon, 18 Dec 2017 14:47:09 +0200 Subject: [PATCH 51/61] Feature: Tests generator tool (#6) --- .gitignore | 4 + common/config/rush/npm-shrinkwrap.json | 4194 ++++++++++++----- packages/ts-docs-gen/package.json | 6 +- packages/ts-docs-gen/tests/.gitignore | 2 - packages/ts-docs-gen/tests/build-tests.ts | 37 - packages/ts-docs-gen/tests/default.test.tpl | 20 + .../tests/scripts/tests-cleanup.ts | 18 - .../tests/scripts/tests-generator.ts | 61 - .../tests/scripts/tests-helpers.ts | 18 - rush.json | 7 +- tools/test-generator-cli/package.json | 31 + tools/test-generator-cli/src/cli-arguments.ts | 21 + tools/test-generator-cli/src/cli-contracts.ts | 20 + tools/test-generator-cli/src/cli-helpers.ts | 21 + tools/test-generator-cli/src/index.ts | 39 + tools/test-generator-cli/src/tests-cleanup.ts | 22 + .../test-generator-cli/src/tests-generator.ts | 67 + tools/test-generator-cli/src/tests-helpers.ts | 23 + tools/test-generator-cli/src/utils/logger.ts | 7 + tools/test-generator-cli/tsconfig.json | 33 + tools/test-generator-cli/tslint.json | 3 + 21 files changed, 3295 insertions(+), 1359 deletions(-) delete mode 100644 packages/ts-docs-gen/tests/.gitignore delete mode 100644 packages/ts-docs-gen/tests/build-tests.ts create mode 100644 packages/ts-docs-gen/tests/default.test.tpl delete mode 100644 packages/ts-docs-gen/tests/scripts/tests-cleanup.ts delete mode 100644 packages/ts-docs-gen/tests/scripts/tests-generator.ts delete mode 100644 packages/ts-docs-gen/tests/scripts/tests-helpers.ts create mode 100644 tools/test-generator-cli/package.json create mode 100644 tools/test-generator-cli/src/cli-arguments.ts create mode 100644 tools/test-generator-cli/src/cli-contracts.ts create mode 100644 tools/test-generator-cli/src/cli-helpers.ts create mode 100644 tools/test-generator-cli/src/index.ts create mode 100644 tools/test-generator-cli/src/tests-cleanup.ts create mode 100644 tools/test-generator-cli/src/tests-generator.ts create mode 100644 tools/test-generator-cli/src/tests-helpers.ts create mode 100644 tools/test-generator-cli/src/utils/logger.ts create mode 100644 tools/test-generator-cli/tsconfig.json create mode 100644 tools/test-generator-cli/tslint.json diff --git a/.gitignore b/.gitignore index 4e291813..4f108f96 100644 --- a/.gitignore +++ b/.gitignore @@ -290,3 +290,7 @@ coverage /common/rush-link.json /common/rush-recycler package-deps.json + +# Tests +*/__tests__/* +!*/__tests__/**/__snapshots__ diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index c04d6058..285b9fda 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -1,3052 +1,4808 @@ { "name": "rush-common", "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, "dependencies": { + "@rush-temp/test-generator-cli": { + "version": "file:projects/test-generator-cli.tgz", + "integrity": "sha1-7hRxKrHs2nw/Tg3difiN7wlLcpI=", + "requires": { + "@types/fs-extra": "4.0.6", + "@types/handlebars": "4.0.36", + "@types/yargs": "10.0.0", + "fast-glob": "1.0.1", + "fs-extra": "4.0.3", + "handlebars": "4.0.11", + "simplr-logger": "1.0.1", + "simplr-tslint": "0.0.1", + "tslint": "5.8.0", + "typescript": "2.6.2", + "yargs": "10.0.3" + } + }, "@rush-temp/ts-docs-gen": { - "version": "0.0.0", - "from": "projects\\ts-docs-gen.tgz", - "resolved": "file:projects\\ts-docs-gen.tgz" + "version": "file:projects/ts-docs-gen.tgz", + "integrity": "sha1-q5PE2Czi6RYJoEbNl8S7rSkODP4=", + "requires": { + "@simplrjs/markdown": "1.0.1", + "@types/fs-extra": "4.0.6", + "@types/jest": "21.1.8", + "@types/sinon": "4.1.1", + "fast-glob": "1.0.1", + "fs-extra": "4.0.3", + "jest": "21.2.1", + "simplr-logger": "1.0.1", + "simplr-tslint": "0.0.1", + "sinon": "4.1.3", + "ts-extractor": "2.0.0", + "ts-jest": "21.2.4", + "tslint": "5.8.0", + "typescript": "2.6.2" + } }, "@simplrjs/markdown": { "version": "1.0.1", - "from": "@simplrjs/markdown@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.1.tgz", + "integrity": "sha512-5cRr5I/CVRwo8bLJOmui8Jf9iwXgVcr81+9rO93IyLutm5GBrkSA8ZSwzovVuWlgA36sml9Dklrl1xP4GQEurA==", + "requires": { + "@types/string": "0.0.29", + "string": "3.3.3" + } }, "@types/fs-extra": { - "version": "4.0.5", - "from": "@types/fs-extra@>=4.0.5 <5.0.0", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.5.tgz" + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.6.tgz", + "integrity": "sha512-SVQDcOe1t7qSRzJFjkMx4V/0hc3TcGX/f51Dxx3Q/rpeg7nvFiort6QJTpJATOZH/YqhzJ1xt0qjvotxOJiCkQ==", + "requires": { + "@types/node": "8.0.58" + } + }, + "@types/handlebars": { + "version": "4.0.36", + "resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.36.tgz", + "integrity": "sha512-LjNiTX7TY7wtuC6y3QwC93hKMuqYhgV9A1uXBKNvZtVC8ZvyWAjZkJ5BvT0K7RKqORRYRLMrqCxpw5RgS+MdrQ==" }, "@types/jest": { "version": "21.1.8", - "from": "@types/jest@>=21.1.8 <22.0.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.8.tgz" + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.8.tgz", + "integrity": "sha512-hQbL8aBM/g5S++sM1gb4yC73Dg+FK3uYE+Ioht1RPy629+LV/RmH6q+e+jbQEwKJdWAP/YE4s67CPO+ElkMivg==" }, "@types/node": { - "version": "8.0.57", - "from": "@types/node@*", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.57.tgz" + "version": "8.0.58", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.58.tgz", + "integrity": "sha512-V746iUU7eHNdzQipoACuguDlVhC7IHK8CES1jSkuFt352wwA84BCWPXaGekBd7R5XdNK5ReHONDVKxlL9IreAw==" }, "@types/sinon": { - "version": "4.1.0", - "from": "@types/sinon@>=4.1.0 <5.0.0", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.1.0.tgz" + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.1.1.tgz", + "integrity": "sha512-4TaA0fxqXNhx8ph+cylpN/hBrkxru0LviHlfZU6Yljl6ztUL7enUFnJ3XMYruSsyycnZgfGqOiw1kiynKlXLNw==" }, "@types/string": { "version": "0.0.29", - "from": "@types/string@0.0.29", - "resolved": "https://registry.npmjs.org/@types/string/-/string-0.0.29.tgz" + "resolved": "https://registry.npmjs.org/@types/string/-/string-0.0.29.tgz", + "integrity": "sha512-p8YTvb6vTWL38JxSe1rCduwP2l0jNRZpHlDUWqLt5A3F4SOc7yBPPd3jBiSk3b66urjs2tFM2QOhf4yEzz9wiQ==" + }, + "@types/yargs": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-10.0.0.tgz", + "integrity": "sha512-c1v82fFxticW/Iy49M8tbYy/4OTxuNAZHBVJTFlTYiW6JZrZxA0Yepj8c8qHgS3ZUxqW8M49awWaaF1DUJf/Ow==" }, "abab": { "version": "1.0.4", - "from": "abab@>=1.0.3 <2.0.0", - "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz" + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", + "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" }, "acorn": { "version": "4.0.13", - "from": "acorn@>=4.0.4 <5.0.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz" + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=" }, "acorn-globals": { "version": "3.1.0", - "from": "acorn-globals@>=3.1.0 <4.0.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz" + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz", + "integrity": "sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8=", + "requires": { + "acorn": "4.0.13" + } }, "ajv": { "version": "5.5.1", - "from": "ajv@>=5.1.0 <6.0.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.1.tgz" + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.1.tgz", + "integrity": "sha1-s4u4h22ehr7plJVqBOch6IskjrI=", + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } }, "amdefine": { "version": "1.0.1", - "from": "amdefine@>=0.0.4", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" }, "ansi-escapes": { "version": "3.0.0", - "from": "ansi-escapes@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==" }, "ansi-regex": { "version": "2.1.1", - "from": "ansi-regex@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { - "version": "3.2.0", - "from": "ansi-styles@>=3.1.0 <4.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "anymatch": { "version": "1.3.2", - "from": "anymatch@>=1.3.0 <2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "requires": { + "micromatch": "2.3.11", + "normalize-path": "2.1.1" + }, "dependencies": { "arr-diff": { "version": "2.0.0", - "from": "arr-diff@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "1.1.0" + } }, "array-unique": { "version": "0.2.1", - "from": "array-unique@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, "braces": { "version": "1.8.5", - "from": "braces@>=1.8.2 <2.0.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } }, "expand-brackets": { "version": "0.1.5", - "from": "expand-brackets@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "0.1.1" + } }, "extglob": { "version": "0.3.2", - "from": "extglob@>=0.3.1 <0.4.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "1.0.0" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } }, "micromatch": { "version": "2.3.11", - "from": "micromatch@>=2.1.5 <3.0.0", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } } } }, "append-transform": { "version": "0.4.0", - "from": "append-transform@>=0.4.0 <0.5.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz" + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", + "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", + "requires": { + "default-require-extensions": "1.0.0" + } }, "argparse": { "version": "1.0.9", - "from": "argparse@>=1.0.7 <2.0.0", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz" + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "requires": { + "sprintf-js": "1.0.3" + } }, "arr-diff": { "version": "4.0.0", - "from": "arr-diff@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" }, "arr-flatten": { "version": "1.1.0", - "from": "arr-flatten@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" }, "arr-union": { "version": "3.1.0", - "from": "arr-union@>=3.1.0 <4.0.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz" + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" }, "array-equal": { "version": "1.0.0", - "from": "array-equal@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" }, "array-filter": { "version": "0.0.1", - "from": "array-filter@>=0.0.0 <0.1.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz" + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=" }, "array-map": { "version": "0.0.0", - "from": "array-map@>=0.0.0 <0.1.0", - "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz" + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=" }, "array-reduce": { "version": "0.0.0", - "from": "array-reduce@>=0.0.0 <0.1.0", - "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz" + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=" }, "array-unique": { "version": "0.3.2", - "from": "array-unique@>=0.3.2 <0.4.0", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" }, "arrify": { "version": "1.0.1", - "from": "arrify@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" }, "asn1": { "version": "0.2.3", - "from": "asn1@>=0.2.3 <0.3.0", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz" + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" }, "assert-plus": { "version": "1.0.0", - "from": "assert-plus@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, "astral-regex": { "version": "1.0.0", - "from": "astral-regex@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==" }, "async": { - "version": "2.6.0", - "from": "async@>=2.1.4 <3.0.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz" + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" }, "async-each": { "version": "1.0.1", - "from": "async-each@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=" }, "asynckit": { "version": "0.4.0", - "from": "asynckit@>=0.4.0 <0.5.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "atob": { "version": "2.0.3", - "from": "atob@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz" + "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", + "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=" }, "aws-sign2": { "version": "0.7.0", - "from": "aws-sign2@>=0.7.0 <0.8.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz" + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { "version": "1.6.0", - "from": "aws4@>=1.6.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz" + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, "babel-code-frame": { "version": "6.26.0", - "from": "babel-code-frame@>=6.26.0 <7.0.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "from": "ansi-styles@>=2.2.1 <3.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz" - }, "chalk": { "version": "1.1.3", - "from": "chalk@>=1.1.3 <2.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz" - }, - "strip-ansi": { - "version": "3.0.1", - "from": "strip-ansi@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" - }, - "supports-color": { - "version": "2.0.0", - "from": "supports-color@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } } } }, "babel-core": { "version": "6.26.0", - "from": "babel-core@>=6.0.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", + "requires": { + "babel-code-frame": "6.26.0", + "babel-generator": "6.26.0", + "babel-helpers": "6.24.1", + "babel-messages": "6.23.0", + "babel-register": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "convert-source-map": "1.5.1", + "debug": "2.6.9", + "json5": "0.5.1", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "path-is-absolute": "1.0.1", + "private": "0.1.8", + "slash": "1.0.0", + "source-map": "0.5.7" + } }, "babel-generator": { "version": "6.26.0", - "from": "babel-generator@>=6.18.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", + "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-helpers": { "version": "6.24.1", - "from": "babel-helpers@>=6.24.1 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz" + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } }, "babel-jest": { "version": "21.2.0", - "from": "babel-jest@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.2.0.tgz", + "integrity": "sha512-O0W2qLoWu1QOoOGgxiR2JID4O6WSpxPiQanrkyi9SSlM0PJ60Ptzlck47lhtnr9YZO3zYOsxHwnyeWJ6AffoBQ==", + "requires": { + "babel-plugin-istanbul": "4.1.5", + "babel-preset-jest": "21.2.0" + } }, "babel-messages": { "version": "6.23.0", - "from": "babel-messages@>=6.23.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz" + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "requires": { + "babel-runtime": "6.26.0" + } }, "babel-plugin-istanbul": { "version": "4.1.5", - "from": "babel-plugin-istanbul@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz" + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz", + "integrity": "sha1-Z2DN2Xf0EdPhdbsGTyvDJ9mbK24=", + "requires": { + "find-up": "2.1.0", + "istanbul-lib-instrument": "1.9.1", + "test-exclude": "4.1.1" + } }, "babel-plugin-jest-hoist": { "version": "21.2.0", - "from": "babel-plugin-jest-hoist@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz", + "integrity": "sha512-yi5QuiVyyvhBUDLP4ButAnhYzkdrUwWDtvUJv71hjH3fclhnZg4HkDeqaitcR2dZZx/E67kGkRcPVjtVu+SJfQ==" }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", - "from": "babel-plugin-syntax-object-rest-spread@>=6.13.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz" + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=" }, "babel-plugin-transform-es2015-modules-commonjs": { "version": "6.26.0", - "from": "babel-plugin-transform-es2015-modules-commonjs@>=6.24.1 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz", + "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", + "requires": { + "babel-plugin-transform-strict-mode": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-types": "6.26.0" + } }, "babel-plugin-transform-strict-mode": { "version": "6.24.1", - "from": "babel-plugin-transform-strict-mode@>=6.24.1 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz" + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } }, "babel-preset-jest": { "version": "21.2.0", - "from": "babel-preset-jest@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz", + "integrity": "sha512-hm9cBnr2h3J7yXoTtAVV0zg+3vg0Q/gT2GYuzlreTU0EPkJRtlNgKJJ3tBKEn0+VjAi3JykV6xCJkuUYttEEfA==", + "requires": { + "babel-plugin-jest-hoist": "21.2.0", + "babel-plugin-syntax-object-rest-spread": "6.13.0" + } }, "babel-register": { "version": "6.26.0", - "from": "babel-register@>=6.26.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "requires": { + "babel-core": "6.26.0", + "babel-runtime": "6.26.0", + "core-js": "2.5.3", + "home-or-tmp": "2.0.0", + "lodash": "4.17.4", + "mkdirp": "0.5.1", + "source-map-support": "0.4.18" + } }, "babel-runtime": { "version": "6.26.0", - "from": "babel-runtime@>=6.26.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "2.5.3", + "regenerator-runtime": "0.11.1" + } }, "babel-template": { "version": "6.26.0", - "from": "babel-template@>=6.16.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "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", - "from": "babel-traverse@>=6.18.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "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.9", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + } }, "babel-types": { "version": "6.26.0", - "from": "babel-types@>=6.18.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz" + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "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", - "from": "babylon@>=6.18.0 <7.0.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz" + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" }, "balanced-match": { "version": "1.0.0", - "from": "balanced-match@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", - "from": "base@>=0.11.1 <0.12.0", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz" + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "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.3.0", + "pascalcase": "0.1.1" + } }, "bash-glob": { "version": "1.0.2", - "from": "bash-glob@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/bash-glob/-/bash-glob-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/bash-glob/-/bash-glob-1.0.2.tgz", + "integrity": "sha512-E0TTxH9T/tklSXt5R5X0zwxjW56su2VIE+sAruXbd8AtMjYZxtvioybVdptbRk0/0Nvdz0TVVShKhN9sH5dMpg==", + "requires": { + "async-each": "1.0.1", + "bash-path": "1.0.3", + "component-emitter": "1.2.1", + "cross-spawn": "5.1.0", + "extend-shallow": "2.0.1", + "is-extglob": "2.1.1", + "is-glob": "4.0.0" + } }, "bash-path": { "version": "1.0.3", - "from": "bash-path@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/bash-path/-/bash-path-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/bash-path/-/bash-path-1.0.3.tgz", + "integrity": "sha512-mGrYvOa6yTY/qNCiZkPFJqWmODK68y6kmVRAJ1NNbWlNoJrUrsFxu7FU2EKg7gbrer6ttrKkF2s/E/lhRy7/OA==", + "requires": { + "arr-union": "3.1.0", + "is-windows": "1.0.1" + } }, "binary-extensions": { "version": "1.11.0", - "from": "binary-extensions@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz" + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=" }, "boom": { "version": "4.3.1", - "from": "boom@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz" + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "requires": { + "hoek": "4.2.0" + } }, "brace-expansion": { "version": "1.1.8", - "from": "brace-expansion@>=1.1.7 <2.0.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz" + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } }, "braces": { "version": "2.3.0", - "from": "braces@>=2.3.0 <3.0.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz" + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz", + "integrity": "sha512-P4O8UQRdGiMLWSizsApmXVQDBS6KCt7dSexgLKBmH5Hr1CZq7vsnscFh8oR1sP1ab1Zj0uCHCEzZeV6SfUf3rA==", + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "define-property": "1.0.0", + "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.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.1" + } }, "browser-resolve": { "version": "1.11.2", - "from": "browser-resolve@>=1.11.2 <2.0.0", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz" + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", + "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" + } + } }, "bser": { "version": "2.0.0", - "from": "bser@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz", + "integrity": "sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk=", + "requires": { + "node-int64": "0.4.0" + } }, "builtin-modules": { "version": "1.1.1", - "from": "builtin-modules@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz" + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" }, "cache-base": { "version": "1.0.1", - "from": "cache-base@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "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" + } }, "call-me-maybe": { "version": "1.0.1", - "from": "call-me-maybe@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=" }, "callsites": { "version": "2.0.0", - "from": "callsites@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=" }, "camelcase": { "version": "4.1.0", - "from": "camelcase@>=4.1.0 <5.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz" + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" }, "caseless": { "version": "0.12.0", - "from": "caseless@>=0.12.0 <0.13.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz" + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "chalk": { "version": "2.3.0", - "from": "chalk@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz" + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "requires": { + "color-convert": "1.9.1" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "requires": { + "has-flag": "2.0.0" + } + } + } }, "chokidar": { "version": "1.7.0", - "from": "chokidar@>=1.6.0 <2.0.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "requires": { + "anymatch": "1.3.2", + "async-each": "1.0.1", + "glob-parent": "2.0.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "2.0.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0" + }, "dependencies": { "glob-parent": { "version": "2.0.0", - "from": "glob-parent@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "requires": { + "is-glob": "2.0.1" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } } } }, "ci-info": { "version": "1.1.2", - "from": "ci-info@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.2.tgz" + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.2.tgz", + "integrity": "sha512-uTGIPNx/nSpBdsF6xnseRXLLtfr9VLqkz8ZqHXr3Y7b6SftyRxBGjwMtJj1OhNbmlc1wZzLNAlAcvyIiE8a6ZA==" }, "class-utils": { "version": "0.3.5", - "from": "class-utils@>=0.3.5 <0.4.0", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.5.tgz", + "integrity": "sha1-F+eTEDdQ+WJ7IXbqNM/RtWWQPIA=", + "requires": { + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "lazy-cache": "2.0.2", + "static-extend": "0.1.2" + }, "dependencies": { "define-property": { "version": "0.2.5", - "from": "define-property@>=0.2.5 <0.3.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "0.1.6" + } }, "is-descriptor": { "version": "0.1.6", - "from": "is-descriptor@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } }, "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "cliui": { "version": "3.2.0", - "from": "cliui@>=3.2.0 <4.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, "dependencies": { "string-width": { "version": "1.0.2", - "from": "string-width@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" - }, - "strip-ansi": { - "version": "3.0.1", - "from": "strip-ansi@>=3.0.1 <4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } } } }, "co": { "version": "4.6.0", - "from": "co@>=4.6.0 <5.0.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz" + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" }, "code-point-at": { "version": "1.1.0", - "from": "code-point-at@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "collection-visit": { "version": "1.0.0", - "from": "collection-visit@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "requires": { + "map-visit": "1.0.0", + "object-visit": "1.0.1" + } }, "color-convert": { "version": "1.9.1", - "from": "color-convert@>=1.9.0 <2.0.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz" + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", + "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "requires": { + "color-name": "1.1.3" + } }, "color-name": { "version": "1.1.3", - "from": "color-name@>=1.1.1 <2.0.0", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "combined-stream": { "version": "1.0.5", - "from": "combined-stream@>=1.0.5 <1.1.0", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz" + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "requires": { + "delayed-stream": "1.0.0" + } }, "commander": { "version": "2.12.2", - "from": "commander@>=2.9.0 <3.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz" + "resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz", + "integrity": "sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA==" }, "component-emitter": { "version": "1.2.1", - "from": "component-emitter@>=1.2.1 <2.0.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz" + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" }, "concat-map": { "version": "0.0.1", - "from": "concat-map@0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "content-type-parser": { "version": "1.0.2", - "from": "content-type-parser@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", + "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==" }, "convert-source-map": { "version": "1.5.1", - "from": "convert-source-map@>=1.4.0 <2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz" + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=" }, "copy-descriptor": { "version": "0.1.1", - "from": "copy-descriptor@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" }, "core-js": { - "version": "2.5.1", - "from": "core-js@>=2.4.0 <3.0.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz" + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", + "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=" }, "core-util-is": { "version": "1.0.2", - "from": "core-util-is@1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cpx": { "version": "1.5.0", - "from": "cpx@>=1.5.0 <2.0.0", - "resolved": "https://registry.npmjs.org/cpx/-/cpx-1.5.0.tgz" + "resolved": "https://registry.npmjs.org/cpx/-/cpx-1.5.0.tgz", + "integrity": "sha1-GFvgGFEdhycN7czCkxceN2VauI8=", + "requires": { + "babel-runtime": "6.26.0", + "chokidar": "1.7.0", + "duplexer": "0.1.1", + "glob": "7.1.2", + "glob2base": "0.0.12", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "resolve": "1.5.0", + "safe-buffer": "5.1.1", + "shell-quote": "1.6.1", + "subarg": "1.0.0" + } }, "cross-spawn": { "version": "5.1.0", - "from": "cross-spawn@>=5.1.0 <6.0.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } }, "cryptiles": { "version": "3.1.2", - "from": "cryptiles@>=3.0.0 <4.0.0", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.2.0" + }, "dependencies": { "boom": { "version": "5.2.0", - "from": "boom@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz" + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.2.0" + } } } }, "cssom": { "version": "0.3.2", - "from": "cssom@>=0.3.2 <0.4.0", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", + "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=" }, "cssstyle": { "version": "0.2.37", - "from": "cssstyle@>=0.2.37 <0.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz" + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", + "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", + "requires": { + "cssom": "0.3.2" + } }, "dashdash": { "version": "1.14.1", - "from": "dashdash@>=1.12.0 <2.0.0", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz" + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "1.0.0" + } }, "debug": { "version": "2.6.9", - "from": "debug@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } }, "decamelize": { "version": "1.2.0", - "from": "decamelize@>=1.1.1 <2.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { "version": "0.2.0", - "from": "decode-uri-component@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz" + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, "deep-is": { "version": "0.1.3", - "from": "deep-is@>=0.1.3 <0.2.0", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz" + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" }, "default-require-extensions": { "version": "1.0.0", - "from": "default-require-extensions@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", + "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", + "requires": { + "strip-bom": "2.0.0" + } }, "define-property": { "version": "1.0.0", - "from": "define-property@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "1.0.1" + } }, "delayed-stream": { "version": "1.0.0", - "from": "delayed-stream@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "detect-indent": { "version": "4.0.0", - "from": "detect-indent@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "requires": { + "repeating": "2.0.1" + } }, "diff": { "version": "3.4.0", - "from": "diff@>=3.2.0 <4.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz" + "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", + "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==" }, "duplexer": { "version": "0.1.1", - "from": "duplexer@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" }, "errno": { - "version": "0.1.4", - "from": "errno@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz" + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.6.tgz", + "integrity": "sha512-IsORQDpaaSwcDP4ZZnHxgE85werpo34VYn1Ud3mq+eUsF593faR8oCZNXrROVkpFu2TsbrNhHin0aUrTsQ9vNw==", + "requires": { + "prr": "1.0.1" + } }, "error-ex": { "version": "1.3.1", - "from": "error-ex@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz" + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "requires": { + "is-arrayish": "0.2.1" + } }, "es6-promise": { "version": "4.1.1", - "from": "es6-promise@>=4.1.0 <5.0.0", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz" + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz", + "integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng==" }, "escape-string-regexp": { "version": "1.0.5", - "from": "escape-string-regexp@>=1.0.5 <2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { "version": "1.9.0", - "from": "escodegen@>=1.6.1 <2.0.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", + "requires": { + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.5.7" + }, "dependencies": { "esprima": { "version": "3.1.3", - "from": "esprima@>=3.1.3 <4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz" + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" } } }, "esprima": { "version": "4.0.0", - "from": "esprima@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" }, "estraverse": { "version": "4.2.0", - "from": "estraverse@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz" + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" }, "esutils": { "version": "2.0.2", - "from": "esutils@>=2.0.2 <3.0.0", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz" + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" }, "exec-sh": { "version": "0.2.1", - "from": "exec-sh@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz", + "integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==", + "requires": { + "merge": "1.2.0" + } }, "execa": { "version": "0.7.0", - "from": "execa@>=0.7.0 <0.8.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz" + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } }, "expand-brackets": { "version": "2.1.4", - "from": "expand-brackets@>=2.1.4 <3.0.0", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" + }, "dependencies": { "define-property": { "version": "0.2.5", - "from": "define-property@>=0.2.5 <0.3.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "0.1.6" + } }, "is-descriptor": { "version": "0.1.6", - "from": "is-descriptor@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } }, "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "expand-range": { "version": "1.8.2", - "from": "expand-range@>=1.8.1 <2.0.0", "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "requires": { + "fill-range": "2.2.3" + }, "dependencies": { "fill-range": { "version": "2.2.3", - "from": "fill-range@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz" + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } }, "is-number": { "version": "2.1.0", - "from": "is-number@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "requires": { + "kind-of": "3.2.2" + } }, "isobject": { "version": "2.1.0", - "from": "isobject@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "expect": { "version": "21.2.1", - "from": "expect@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/expect/-/expect-21.2.1.tgz", + "integrity": "sha512-orfQQqFRTX0jH7znRIGi8ZMR8kTNpXklTTz8+HGTpmTKZo3Occ6JNB5FXMb8cRuiiC/GyDqsr30zUa66ACYlYw==", + "requires": { + "ansi-styles": "3.2.0", + "jest-diff": "21.2.1", + "jest-get-type": "21.2.0", + "jest-matcher-utils": "21.2.1", + "jest-message-util": "21.2.1", + "jest-regex-util": "21.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "requires": { + "color-convert": "1.9.1" + } + } + } }, "extend": { "version": "3.0.1", - "from": "extend@>=3.0.1 <3.1.0", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" }, "extend-shallow": { "version": "2.0.1", - "from": "extend-shallow@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "0.1.1" + } }, "extglob": { "version": "2.0.2", - "from": "extglob@>=2.0.2 <3.0.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.2.tgz" + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.2.tgz", + "integrity": "sha512-I0+eZBH+jFGL8F5BnIz2ON2nKCjTS3AS3H/5PeSmCp7UVC70Ym8IhdRiQly2juKYQ//f7z1aj1BRpQniFJoU1w==", + "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" + } }, "extsprintf": { "version": "1.3.0", - "from": "extsprintf@1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, "fast-deep-equal": { "version": "1.0.0", - "from": "fast-deep-equal@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, "fast-glob": { "version": "1.0.1", - "from": "fast-glob@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-1.0.1.tgz", + "integrity": "sha512-C2VHbdBwSkaQDyavjQZDflZzmZKrsUK3fTdJtsOnED0L0vtHCw+NL0h8pRcydbpRHlNJLZ4/LbOfEdJKspK91A==", + "requires": { + "bash-glob": "1.0.2", + "glob-parent": "3.1.0", + "micromatch": "3.1.4", + "readdir-enhanced": "1.5.2" + } }, "fast-json-stable-stringify": { "version": "2.0.0", - "from": "fast-json-stable-stringify@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, "fast-levenshtein": { "version": "2.0.6", - "from": "fast-levenshtein@>=2.0.4 <2.1.0", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, "fb-watchman": { "version": "2.0.0", - "from": "fb-watchman@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", + "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", + "requires": { + "bser": "2.0.0" + } }, "filename-regex": { "version": "2.0.1", - "from": "filename-regex@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=" }, "fileset": { "version": "2.0.3", - "from": "fileset@>=2.0.2 <3.0.0", - "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz" + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "requires": { + "glob": "7.1.2", + "minimatch": "3.0.4" + } }, "fill-range": { "version": "4.0.0", - "from": "fill-range@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + } }, "find-index": { "version": "0.1.1", - "from": "find-index@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", + "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=" }, "find-up": { "version": "2.1.0", - "from": "find-up@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "2.0.0" + } }, "for-in": { "version": "1.0.2", - "from": "for-in@>=1.0.2 <2.0.0", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" }, "for-own": { "version": "0.1.5", - "from": "for-own@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz" + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "requires": { + "for-in": "1.0.2" + } }, "forever-agent": { "version": "0.6.1", - "from": "forever-agent@>=0.6.1 <0.7.0", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { "version": "2.3.1", - "from": "form-data@>=2.3.1 <2.4.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz" + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } }, "formatio": { "version": "1.2.0", - "from": "formatio@1.2.0", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", + "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", + "requires": { + "samsam": "1.3.0" + } }, "fragment-cache": { "version": "0.2.1", - "from": "fragment-cache@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "requires": { + "map-cache": "0.2.2" + } }, "fs-extra": { "version": "4.0.3", - "from": "fs-extra@>=4.0.3 <5.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz" + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "4.0.0", + "universalify": "0.1.1" + } }, "fs.realpath": { "version": "1.0.0", - "from": "fs.realpath@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "get-caller-file": { "version": "1.0.2", - "from": "get-caller-file@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=" }, "get-stream": { "version": "3.0.0", - "from": "get-stream@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" }, "get-value": { "version": "2.0.6", - "from": "get-value@>=2.0.6 <3.0.0", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz" + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" }, "getpass": { "version": "0.1.7", - "from": "getpass@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz" + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "1.0.0" + } }, "glob": { "version": "7.1.2", - "from": "glob@>=7.1.2 <8.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz" + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } }, "glob-base": { "version": "0.3.0", - "from": "glob-base@>=0.3.0 <0.4.0", "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + }, "dependencies": { "glob-parent": { "version": "2.0.0", - "from": "glob-parent@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "requires": { + "is-glob": "2.0.1" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } } } }, "glob-parent": { "version": "3.1.0", - "from": "glob-parent@>=3.1.0 <4.0.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "requires": { + "is-glob": "3.1.0", + "path-dirname": "1.0.2" + }, "dependencies": { "is-glob": { "version": "3.1.0", - "from": "is-glob@>=3.1.0 <4.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "requires": { + "is-extglob": "2.1.1" + } } } }, "glob-to-regexp": { "version": "0.3.0", - "from": "glob-to-regexp@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz" + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=" }, "glob2base": { "version": "0.0.12", - "from": "glob2base@>=0.0.12 <0.0.13", - "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz" + "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", + "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "requires": { + "find-index": "0.1.1" + } }, "globals": { "version": "9.18.0", - "from": "globals@>=9.18.0 <10.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz" + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" }, "graceful-fs": { "version": "4.1.11", - "from": "graceful-fs@>=4.1.2 <5.0.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz" + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, "growly": { "version": "1.3.0", - "from": "growly@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" }, "handlebars": { "version": "4.0.11", - "from": "handlebars@>=4.0.3 <5.0.0", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4" + }, "dependencies": { - "async": { - "version": "1.5.2", - "from": "async@>=1.4.0 <2.0.0", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz" - }, "source-map": { "version": "0.4.4", - "from": "source-map@>=0.4.4 <0.5.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz" + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "requires": { + "amdefine": "1.0.1" + } } } }, "har-schema": { "version": "2.0.0", - "from": "har-schema@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" }, "har-validator": { "version": "5.0.3", - "from": "har-validator@>=5.0.3 <5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz" + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "5.5.1", + "har-schema": "2.0.0" + } }, "has-ansi": { "version": "2.0.0", - "from": "has-ansi@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "2.1.1" + } }, "has-flag": { "version": "2.0.0", - "from": "has-flag@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" }, "has-value": { "version": "1.0.0", - "from": "has-value@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "requires": { + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" + } }, "has-values": { "version": "1.0.0", - "from": "has-values@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, "dependencies": { "kind-of": { "version": "4.0.0", - "from": "kind-of@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "hawk": { "version": "6.0.2", - "from": "hawk@>=6.0.2 <6.1.0", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz" + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "sntp": "2.1.0" + } }, "hoek": { "version": "4.2.0", - "from": "hoek@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz" + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" }, "home-or-tmp": { "version": "2.0.0", - "from": "home-or-tmp@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz" - }, - "homedir-polyfill": { - "version": "1.0.1", - "from": "homedir-polyfill@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } }, "hosted-git-info": { "version": "2.5.0", - "from": "hosted-git-info@>=2.1.4 <3.0.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz" + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==" }, "html-encoding-sniffer": { "version": "1.0.2", - "from": "html-encoding-sniffer@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "requires": { + "whatwg-encoding": "1.0.3" + } }, "http-signature": { "version": "1.2.0", - "from": "http-signature@>=1.2.0 <1.3.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } }, "iconv-lite": { "version": "0.4.19", - "from": "iconv-lite@0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz" + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" }, "imurmurhash": { "version": "0.1.4", - "from": "imurmurhash@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" }, "inflight": { "version": "1.0.6", - "from": "inflight@>=1.0.4 <2.0.0", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } }, "inherits": { "version": "2.0.3", - "from": "inherits@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "invariant": { "version": "2.2.2", - "from": "invariant@>=2.2.2 <3.0.0", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz" + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "requires": { + "loose-envify": "1.3.1" + } }, "invert-kv": { "version": "1.0.0", - "from": "invert-kv@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, "is-accessor-descriptor": { "version": "0.1.6", - "from": "is-accessor-descriptor@>=0.1.6 <0.2.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + }, "dependencies": { "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "is-arrayish": { "version": "0.2.1", - "from": "is-arrayish@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" }, "is-binary-path": { "version": "1.0.1", - "from": "is-binary-path@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "requires": { + "binary-extensions": "1.11.0" + } }, "is-buffer": { "version": "1.1.6", - "from": "is-buffer@>=1.1.5 <2.0.0", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "is-builtin-module": { "version": "1.0.0", - "from": "is-builtin-module@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "requires": { + "builtin-modules": "1.1.1" + } }, "is-ci": { "version": "1.0.10", - "from": "is-ci@>=1.0.10 <2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz" + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", + "integrity": "sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4=", + "requires": { + "ci-info": "1.1.2" + } }, "is-data-descriptor": { "version": "0.1.4", - "from": "is-data-descriptor@>=0.1.4 <0.2.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + }, "dependencies": { "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "is-descriptor": { "version": "1.0.1", - "from": "is-descriptor@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", + "integrity": "sha512-G3fFVFTqfaqu7r4YuSBHKBAuOaLz8Sy7ekklUpFEliaLMP1Y2ZjoN9jS62YWCAPQrQpMUQSitRlrzibbuCZjdA==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, "dependencies": { "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "is-dotfile": { "version": "1.0.3", - "from": "is-dotfile@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=" }, "is-equal-shallow": { "version": "0.1.3", - "from": "is-equal-shallow@>=0.1.3 <0.2.0", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz" + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "requires": { + "is-primitive": "2.0.0" + } }, "is-extendable": { "version": "0.1.1", - "from": "is-extendable@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" }, "is-extglob": { "version": "2.1.1", - "from": "is-extglob@>=2.1.1 <3.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-finite": { "version": "1.0.2", - "from": "is-finite@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "requires": { + "number-is-nan": "1.0.1" + } }, "is-fullwidth-code-point": { "version": "1.0.0", - "from": "is-fullwidth-code-point@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "1.0.1" + } }, "is-glob": { "version": "4.0.0", - "from": "is-glob@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "requires": { + "is-extglob": "2.1.1" + } }, "is-number": { "version": "3.0.0", - "from": "is-number@>=3.0.0 <4.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "3.2.2" + }, "dependencies": { "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "is-odd": { "version": "1.0.0", - "from": "is-odd@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", + "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", + "requires": { + "is-number": "3.0.0" + } }, "is-plain-object": { "version": "2.0.4", - "from": "is-plain-object@>=2.0.3 <3.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz" + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "3.0.1" + } }, "is-posix-bracket": { "version": "0.1.1", - "from": "is-posix-bracket@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=" }, "is-primitive": { "version": "2.0.0", - "from": "is-primitive@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" }, "is-stream": { "version": "1.1.0", - "from": "is-stream@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" }, "is-typedarray": { "version": "1.0.0", - "from": "is-typedarray@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "is-utf8": { "version": "0.2.1", - "from": "is-utf8@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" }, "is-windows": { "version": "1.0.1", - "from": "is-windows@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", + "integrity": "sha1-MQ23D3QtJZoWo2kgK1GvhCMzENk=" }, "isarray": { "version": "1.0.0", - "from": "isarray@1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", - "from": "isexe@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, "isobject": { "version": "3.0.1", - "from": "isobject@>=3.0.1 <4.0.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, "isstream": { "version": "0.1.2", - "from": "isstream@>=0.1.2 <0.2.0", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "istanbul-api": { "version": "1.2.1", - "from": "istanbul-api@>=1.1.1 <2.0.0", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.2.1.tgz" + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.2.1.tgz", + "integrity": "sha512-oFCwXvd65amgaPCzqrR+a2XjanS1MvpXN6l/MlMUTv6uiA1NOgGX+I0uyq8Lg3GDxsxPsaP1049krz3hIJ5+KA==", + "requires": { + "async": "2.6.0", + "fileset": "2.0.3", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-hook": "1.1.0", + "istanbul-lib-instrument": "1.9.1", + "istanbul-lib-report": "1.1.2", + "istanbul-lib-source-maps": "1.2.2", + "istanbul-reports": "1.1.3", + "js-yaml": "3.10.0", + "mkdirp": "0.5.1", + "once": "1.4.0" + }, + "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.4" + } + } + } }, "istanbul-lib-coverage": { "version": "1.1.1", - "from": "istanbul-lib-coverage@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz" + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", + "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==" }, "istanbul-lib-hook": { "version": "1.1.0", - "from": "istanbul-lib-hook@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz", + "integrity": "sha512-U3qEgwVDUerZ0bt8cfl3dSP3S6opBoOtk3ROO5f2EfBr/SRiD9FQqzwaZBqFORu8W7O0EXpai+k7kxHK13beRg==", + "requires": { + "append-transform": "0.4.0" + } }, "istanbul-lib-instrument": { "version": "1.9.1", - "from": "istanbul-lib-instrument@>=1.4.2 <2.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz" + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz", + "integrity": "sha512-RQmXeQ7sphar7k7O1wTNzVczF9igKpaeGQAG9qR2L+BS4DCJNTI9nytRmIVYevwO0bbq+2CXvJmYDuz0gMrywA==", + "requires": { + "babel-generator": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "istanbul-lib-coverage": "1.1.1", + "semver": "5.4.1" + } }, "istanbul-lib-report": { "version": "1.1.2", - "from": "istanbul-lib-report@>=1.1.2 <2.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz", + "integrity": "sha512-UTv4VGx+HZivJQwAo1wnRwe1KTvFpfi/NYwN7DcsrdzMXwpRT/Yb6r4SBPoHWj4VuQPakR32g4PUUeyKkdDkBA==", + "requires": { + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "path-parse": "1.0.5", + "supports-color": "3.2.3" + }, "dependencies": { "has-flag": { "version": "1.0.0", - "from": "has-flag@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=" }, "supports-color": { "version": "3.2.3", - "from": "supports-color@>=3.1.2 <4.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz" + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "requires": { + "has-flag": "1.0.0" + } } } }, "istanbul-lib-source-maps": { "version": "1.2.2", - "from": "istanbul-lib-source-maps@>=1.1.0 <2.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz", + "integrity": "sha512-8BfdqSfEdtip7/wo1RnrvLpHVEd8zMZEDmOFEnpC6dg0vXflHt9nvoAyQUzig2uMSXfF2OBEYBV3CVjIL9JvaQ==", + "requires": { + "debug": "3.1.0", + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "source-map": "0.5.7" + }, "dependencies": { "debug": { "version": "3.1.0", - "from": "debug@>=3.1.0 <4.0.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz" + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } } } }, "istanbul-reports": { "version": "1.1.3", - "from": "istanbul-reports@>=1.1.3 <2.0.0", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.3.tgz" + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.3.tgz", + "integrity": "sha512-ZEelkHh8hrZNI5xDaKwPMFwDsUf5wIEI2bXAFGp1e6deR2mnEKBPhLJEgr4ZBt8Gi6Mj38E/C8kcy9XLggVO2Q==", + "requires": { + "handlebars": "4.0.11" + } }, "jest": { "version": "21.2.1", - "from": "jest@>=21.2.1 <22.0.0", "resolved": "https://registry.npmjs.org/jest/-/jest-21.2.1.tgz", + "integrity": "sha512-mXN0ppPvWYoIcC+R+ctKxAJ28xkt/Z5Js875padm4GbgUn6baeR5N4Ng6LjatIRpUQDZVJABT7Y4gucFjPryfw==", + "requires": { + "jest-cli": "21.2.1" + }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, "arr-diff": { "version": "2.0.0", - "from": "arr-diff@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "1.1.0" + } }, "array-unique": { "version": "0.2.1", - "from": "array-unique@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, "braces": { "version": "1.8.5", - "from": "braces@>=1.8.2 <2.0.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } }, "expand-brackets": { "version": "0.1.5", - "from": "expand-brackets@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "0.1.1" + } }, "extglob": { "version": "0.3.2", - "from": "extglob@>=0.3.1 <0.4.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "1.0.0" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } }, "jest-cli": { "version": "21.2.1", - "from": "jest-cli@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.2.1.tgz", + "integrity": "sha512-T1BzrbFxDIW/LLYQqVfo94y/hhaj1NzVQkZgBumAC+sxbjMROI7VkihOdxNR758iYbQykL2ZOWUBurFgkQrzdg==", + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "is-ci": "1.0.10", + "istanbul-api": "1.2.1", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-instrument": "1.9.1", + "istanbul-lib-source-maps": "1.2.2", + "jest-changed-files": "21.2.0", + "jest-config": "21.2.1", + "jest-environment-jsdom": "21.2.1", + "jest-haste-map": "21.2.0", + "jest-message-util": "21.2.1", + "jest-regex-util": "21.2.0", + "jest-resolve-dependencies": "21.2.0", + "jest-runner": "21.2.1", + "jest-runtime": "21.2.1", + "jest-snapshot": "21.2.1", + "jest-util": "21.2.1", + "micromatch": "2.3.11", + "node-notifier": "5.1.2", + "pify": "3.0.0", + "slash": "1.0.0", + "string-length": "2.0.0", + "strip-ansi": "4.0.0", + "which": "1.3.0", + "worker-farm": "1.5.2", + "yargs": "9.0.1" + } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } }, "micromatch": { "version": "2.3.11", - "from": "micromatch@>=2.3.11 <3.0.0", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "requires": { + "pify": "2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.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-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "yargs": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", + "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "requires": { + "camelcase": "4.1.0" + } } } }, "jest-changed-files": { "version": "21.2.0", - "from": "jest-changed-files@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.2.0.tgz", + "integrity": "sha512-+lCNP1IZLwN1NOIvBcV5zEL6GENK6TXrDj4UxWIeLvIsIDa+gf6J7hkqsW2qVVt/wvH65rVvcPwqXdps5eclTQ==", + "requires": { + "throat": "4.1.0" + } }, "jest-config": { "version": "21.2.1", - "from": "jest-config@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.2.1.tgz", + "integrity": "sha512-fJru5HtlD/5l2o25eY9xT0doK3t2dlglrqoGpbktduyoI0T5CwuB++2YfoNZCrgZipTwPuAGonYv0q7+8yDc/A==", + "requires": { + "chalk": "2.3.0", + "glob": "7.1.2", + "jest-environment-jsdom": "21.2.1", + "jest-environment-node": "21.2.1", + "jest-get-type": "21.2.0", + "jest-jasmine2": "21.2.1", + "jest-regex-util": "21.2.0", + "jest-resolve": "21.2.0", + "jest-util": "21.2.1", + "jest-validate": "21.2.1", + "pretty-format": "21.2.1" + } }, "jest-diff": { "version": "21.2.1", - "from": "jest-diff@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.2.1.tgz", + "integrity": "sha512-E5fu6r7PvvPr5qAWE1RaUwIh/k6Zx/3OOkZ4rk5dBJkEWRrUuSgbMt2EO8IUTPTd6DOqU3LW6uTIwX5FRvXoFA==", + "requires": { + "chalk": "2.3.0", + "diff": "3.4.0", + "jest-get-type": "21.2.0", + "pretty-format": "21.2.1" + } }, "jest-docblock": { "version": "21.2.0", - "from": "jest-docblock@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", + "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==" }, "jest-environment-jsdom": { "version": "21.2.1", - "from": "jest-environment-jsdom@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz", + "integrity": "sha512-mecaeNh0eWmzNrUNMWARysc0E9R96UPBamNiOCYL28k7mksb1d0q6DD38WKP7ABffjnXyUWJPVaWRgUOivwXwg==", + "requires": { + "jest-mock": "21.2.0", + "jest-util": "21.2.1", + "jsdom": "9.12.0" + } }, "jest-environment-node": { "version": "21.2.1", - "from": "jest-environment-node@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.2.1.tgz", + "integrity": "sha512-R211867wx9mVBVHzrjGRGTy5cd05K7eqzQl/WyZixR/VkJ4FayS8qkKXZyYnwZi6Rxo6WEV81cDbiUx/GfuLNw==", + "requires": { + "jest-mock": "21.2.0", + "jest-util": "21.2.1" + } }, "jest-get-type": { "version": "21.2.0", - "from": "jest-get-type@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.2.0.tgz", + "integrity": "sha512-y2fFw3C+D0yjNSDp7ab1kcd6NUYfy3waPTlD8yWkAtiocJdBRQqNoRqVfMNxgj+IjT0V5cBIHJO0z9vuSSZ43Q==" }, "jest-haste-map": { "version": "21.2.0", - "from": "jest-haste-map@>=21.2.0 <22.0.0", "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-21.2.0.tgz", + "integrity": "sha512-5LhsY/loPH7wwOFRMs+PT4aIAORJ2qwgbpMFlbWbxfN0bk3ZCwxJ530vrbSiTstMkYLao6JwBkLhCJ5XbY7ZHw==", + "requires": { + "fb-watchman": "2.0.0", + "graceful-fs": "4.1.11", + "jest-docblock": "21.2.0", + "micromatch": "2.3.11", + "sane": "2.2.0", + "worker-farm": "1.5.2" + }, "dependencies": { "arr-diff": { "version": "2.0.0", - "from": "arr-diff@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "1.1.0" + } }, "array-unique": { "version": "0.2.1", - "from": "array-unique@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, "braces": { "version": "1.8.5", - "from": "braces@>=1.8.2 <2.0.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } }, "expand-brackets": { "version": "0.1.5", - "from": "expand-brackets@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "0.1.1" + } }, "extglob": { "version": "0.3.2", - "from": "extglob@>=0.3.1 <0.4.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "1.0.0" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } }, "micromatch": { "version": "2.3.11", - "from": "micromatch@>=2.3.11 <3.0.0", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } } } }, "jest-jasmine2": { "version": "21.2.1", - "from": "jest-jasmine2@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz", + "integrity": "sha512-lw8FXXIEekD+jYNlStfgNsUHpfMWhWWCgHV7n0B7mA/vendH7vBFs8xybjQsDzJSduptBZJHqQX9SMssya9+3A==", + "requires": { + "chalk": "2.3.0", + "expect": "21.2.1", + "graceful-fs": "4.1.11", + "jest-diff": "21.2.1", + "jest-matcher-utils": "21.2.1", + "jest-message-util": "21.2.1", + "jest-snapshot": "21.2.1", + "p-cancelable": "0.3.0" + } }, "jest-matcher-utils": { "version": "21.2.1", - "from": "jest-matcher-utils@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz", + "integrity": "sha512-kn56My+sekD43dwQPrXBl9Zn9tAqwoy25xxe7/iY4u+mG8P3ALj5IK7MLHZ4Mi3xW7uWVCjGY8cm4PqgbsqMCg==", + "requires": { + "chalk": "2.3.0", + "jest-get-type": "21.2.0", + "pretty-format": "21.2.1" + } }, "jest-message-util": { "version": "21.2.1", - "from": "jest-message-util@>=21.2.1 <22.0.0", "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-21.2.1.tgz", + "integrity": "sha512-EbC1X2n0t9IdeMECJn2BOg7buOGivCvVNjqKMXTzQOu7uIfLml+keUfCALDh8o4rbtndIeyGU8/BKfoTr/LVDQ==", + "requires": { + "chalk": "2.3.0", + "micromatch": "2.3.11", + "slash": "1.0.0" + }, "dependencies": { "arr-diff": { "version": "2.0.0", - "from": "arr-diff@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "1.1.0" + } }, "array-unique": { "version": "0.2.1", - "from": "array-unique@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, "braces": { "version": "1.8.5", - "from": "braces@>=1.8.2 <2.0.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } }, "expand-brackets": { "version": "0.1.5", - "from": "expand-brackets@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "0.1.1" + } }, "extglob": { "version": "0.3.2", - "from": "extglob@>=0.3.1 <0.4.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "1.0.0" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } }, "micromatch": { "version": "2.3.11", - "from": "micromatch@>=2.3.11 <3.0.0", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } } } }, "jest-mock": { "version": "21.2.0", - "from": "jest-mock@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.2.0.tgz", + "integrity": "sha512-aZDfyVf0LEoABWiY6N0d+O963dUQSyUa4qgzurHR3TBDPen0YxKCJ6l2i7lQGh1tVdsuvdrCZ4qPj+A7PievCw==" }, "jest-regex-util": { "version": "21.2.0", - "from": "jest-regex-util@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.2.0.tgz", + "integrity": "sha512-BKQ1F83EQy0d9Jen/mcVX7D+lUt2tthhK/2gDWRgLDJRNOdRgSp1iVqFxP8EN1ARuypvDflRfPzYT8fQnoBQFQ==" }, "jest-resolve": { "version": "21.2.0", - "from": "jest-resolve@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.2.0.tgz", + "integrity": "sha512-vefQ/Lr+VdNvHUZFQXWtOqHX3HEdOc2MtSahBO89qXywEbUxGPB9ZLP9+BHinkxb60UT2Q/tTDOS6rYc6Mwigw==", + "requires": { + "browser-resolve": "1.11.2", + "chalk": "2.3.0", + "is-builtin-module": "1.0.0" + } }, "jest-resolve-dependencies": { "version": "21.2.0", - "from": "jest-resolve-dependencies@>=21.2.0 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz" + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz", + "integrity": "sha512-ok8ybRFU5ScaAcfufIQrCbdNJSRZ85mkxJ1EhUp8Bhav1W1/jv/rl1Q6QoVQHObNxmKnbHVKrfLZbCbOsXQ+bQ==", + "requires": { + "jest-regex-util": "21.2.0" + } }, "jest-runner": { "version": "21.2.1", - "from": "jest-runner@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.2.1.tgz", + "integrity": "sha512-Anb72BOQlHqF/zETqZ2K20dbYsnqW/nZO7jV8BYENl+3c44JhMrA8zd1lt52+N7ErnsQMd2HHKiVwN9GYSXmrg==", + "requires": { + "jest-config": "21.2.1", + "jest-docblock": "21.2.0", + "jest-haste-map": "21.2.0", + "jest-jasmine2": "21.2.1", + "jest-message-util": "21.2.1", + "jest-runtime": "21.2.1", + "jest-util": "21.2.1", + "pify": "3.0.0", + "throat": "4.1.0", + "worker-farm": "1.5.2" + } }, "jest-runtime": { "version": "21.2.1", - "from": "jest-runtime@>=21.2.1 <22.0.0", "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-21.2.1.tgz", + "integrity": "sha512-6omlpA3+NSE+rHwD0PQjNEjZeb2z+oRmuehMfM1tWQVum+E0WV3pFt26Am0DUfQkkPyTABvxITRjCUclYgSOsA==", + "requires": { + "babel-core": "6.26.0", + "babel-jest": "21.2.0", + "babel-plugin-istanbul": "4.1.5", + "chalk": "2.3.0", + "convert-source-map": "1.5.1", + "graceful-fs": "4.1.11", + "jest-config": "21.2.1", + "jest-haste-map": "21.2.0", + "jest-regex-util": "21.2.0", + "jest-resolve": "21.2.0", + "jest-util": "21.2.1", + "json-stable-stringify": "1.0.1", + "micromatch": "2.3.11", + "slash": "1.0.0", + "strip-bom": "3.0.0", + "write-file-atomic": "2.3.0", + "yargs": "9.0.1" + }, "dependencies": { "arr-diff": { "version": "2.0.0", - "from": "arr-diff@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "1.1.0" + } }, "array-unique": { "version": "0.2.1", - "from": "array-unique@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, "braces": { "version": "1.8.5", - "from": "braces@>=1.8.2 <2.0.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } }, "expand-brackets": { "version": "0.1.5", - "from": "expand-brackets@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "0.1.1" + } }, "extglob": { "version": "0.3.2", - "from": "extglob@>=0.3.1 <0.4.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "1.0.0" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } }, "micromatch": { "version": "2.3.11", - "from": "micromatch@>=2.3.11 <3.0.0", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "requires": { + "pify": "2.3.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } }, "strip-bom": { "version": "3.0.0", - "from": "strip-bom@3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "yargs": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", + "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "requires": { + "camelcase": "4.1.0" + } } } }, "jest-snapshot": { "version": "21.2.1", - "from": "jest-snapshot@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.2.1.tgz", + "integrity": "sha512-bpaeBnDpdqaRTzN8tWg0DqOTo2DvD3StOemxn67CUd1p1Po+BUpvePAp44jdJ7Pxcjfg+42o4NHw1SxdCA2rvg==", + "requires": { + "chalk": "2.3.0", + "jest-diff": "21.2.1", + "jest-matcher-utils": "21.2.1", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "pretty-format": "21.2.1" + } }, "jest-util": { "version": "21.2.1", - "from": "jest-util@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.2.1.tgz", + "integrity": "sha512-r20W91rmHY3fnCoO7aOAlyfC51x2yeV3xF+prGsJAUsYhKeV670ZB8NO88Lwm7ASu8SdH0S+U+eFf498kjhA4g==", + "requires": { + "callsites": "2.0.0", + "chalk": "2.3.0", + "graceful-fs": "4.1.11", + "jest-message-util": "21.2.1", + "jest-mock": "21.2.0", + "jest-validate": "21.2.1", + "mkdirp": "0.5.1" + } }, "jest-validate": { "version": "21.2.1", - "from": "jest-validate@>=21.2.1 <22.0.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.2.1.tgz" + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.2.1.tgz", + "integrity": "sha512-k4HLI1rZQjlU+EC682RlQ6oZvLrE5SCh3brseQc24vbZTxzT/k/3urar5QMCVgjadmSO7lECeGdc6YxnM3yEGg==", + "requires": { + "chalk": "2.3.0", + "jest-get-type": "21.2.0", + "leven": "2.1.0", + "pretty-format": "21.2.1" + } }, "js-tokens": { "version": "3.0.2", - "from": "js-tokens@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, "js-yaml": { "version": "3.10.0", - "from": "js-yaml@>=3.7.0 <4.0.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz" + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } }, "jsdom": { "version": "9.12.0", - "from": "jsdom@>=9.12.0 <10.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz" + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz", + "integrity": "sha1-6MVG//ywbADUgzyoRBD+1/igl9Q=", + "requires": { + "abab": "1.0.4", + "acorn": "4.0.13", + "acorn-globals": "3.1.0", + "array-equal": "1.0.0", + "content-type-parser": "1.0.2", + "cssom": "0.3.2", + "cssstyle": "0.2.37", + "escodegen": "1.9.0", + "html-encoding-sniffer": "1.0.2", + "nwmatcher": "1.4.3", + "parse5": "1.5.1", + "request": "2.83.0", + "sax": "1.2.4", + "symbol-tree": "3.2.2", + "tough-cookie": "2.3.3", + "webidl-conversions": "4.0.2", + "whatwg-encoding": "1.0.3", + "whatwg-url": "4.8.0", + "xml-name-validator": "2.0.1" + } }, "jsesc": { "version": "1.3.0", - "from": "jsesc@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=" }, "json-parse-better-errors": { "version": "1.0.1", - "from": "json-parse-better-errors@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", + "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==" }, "json-schema": { "version": "0.2.3", - "from": "json-schema@0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz" + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" }, "json-schema-traverse": { "version": "0.3.1", - "from": "json-schema-traverse@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz" + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, "json-stable-stringify": { "version": "1.0.1", - "from": "json-stable-stringify@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "requires": { + "jsonify": "0.0.0" + } }, "json-stringify-safe": { "version": "5.0.1", - "from": "json-stringify-safe@>=5.0.1 <5.1.0", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, "json5": { "version": "0.5.1", - "from": "json5@>=0.5.1 <0.6.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz" + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" }, "jsonfile": { "version": "4.0.0", - "from": "jsonfile@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "4.1.11" + } }, "jsonify": { "version": "0.0.0", - "from": "jsonify@>=0.0.0 <0.1.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz" + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, "jsprim": { "version": "1.4.1", - "from": "jsprim@>=1.2.2 <2.0.0", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz" + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } }, "just-extend": { "version": "1.1.27", - "from": "just-extend@>=1.1.26 <2.0.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz" + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-1.1.27.tgz", + "integrity": "sha512-mJVp13Ix6gFo3SBAy9U/kL+oeZqzlYYYLQBwXVBlVzIsZwBqGREnOro24oC/8s8aox+rJhtZ2DiQof++IrkA+g==" }, "kind-of": { "version": "6.0.2", - "from": "kind-of@>=6.0.0 <7.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" }, "lazy-cache": { "version": "2.0.2", - "from": "lazy-cache@>=2.0.2 <3.0.0", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz" + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", + "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "requires": { + "set-getter": "0.1.0" + } }, "lcid": { "version": "1.0.0", - "from": "lcid@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "requires": { + "invert-kv": "1.0.0" + } }, "leven": { "version": "2.1.0", - "from": "leven@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=" }, "levn": { "version": "0.3.0", - "from": "levn@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz" + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } }, "load-json-file": { "version": "1.1.0", - "from": "load-json-file@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + }, "dependencies": { "pify": { "version": "2.3.0", - "from": "pify@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" } } }, "locate-path": { "version": "2.0.0", - "from": "locate-path@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" + } }, "lodash": { "version": "4.17.4", - "from": "lodash@>=4.14.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, "lodash.get": { "version": "4.4.2", - "from": "lodash.get@>=4.4.2 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz" + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" }, "lolex": { "version": "2.3.1", - "from": "lolex@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz" + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", + "integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==" }, "loose-envify": { "version": "1.3.1", - "from": "loose-envify@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz" + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "requires": { + "js-tokens": "3.0.2" + } }, "lru-cache": { "version": "4.1.1", - "from": "lru-cache@>=4.0.1 <5.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz" - }, - "make-error": { - "version": "1.3.0", - "from": "make-error@>=1.1.1 <2.0.0", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } }, "makeerror": { "version": "1.0.11", - "from": "makeerror@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz" + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "requires": { + "tmpl": "1.0.4" + } }, "map-cache": { "version": "0.2.2", - "from": "map-cache@>=0.2.2 <0.3.0", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz" + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, "map-visit": { "version": "1.0.0", - "from": "map-visit@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "requires": { + "object-visit": "1.0.1" + } }, "mem": { "version": "1.1.0", - "from": "mem@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "requires": { + "mimic-fn": "1.1.0" + } }, "merge": { "version": "1.2.0", - "from": "merge@>=1.1.3 <2.0.0", - "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", + "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=" }, "micromatch": { "version": "3.1.4", - "from": "micromatch@>=3.0.3 <4.0.0", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.4.tgz" + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.4.tgz", + "integrity": "sha512-kFRtviKYoAJT+t7HggMl0tBFGNAKLw/S7N+CO9qfEQyisob1Oy4pao+geRbkyeEd+V9aOkvZ4mhuyPvI/q9Sfg==", + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.0", + "define-property": "1.0.0", + "extend-shallow": "2.0.1", + "extglob": "2.0.2", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.6", + "object.pick": "1.3.0", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" + } }, "mime-db": { "version": "1.30.0", - "from": "mime-db@>=1.30.0 <1.31.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz" + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" }, "mime-types": { "version": "2.1.17", - "from": "mime-types@>=2.1.17 <2.2.0", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz" + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "requires": { + "mime-db": "1.30.0" + } }, "mimic-fn": { "version": "1.1.0", - "from": "mimic-fn@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=" }, "minimatch": { "version": "3.0.4", - "from": "minimatch@>=3.0.4 <4.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz" + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "1.1.8" + } }, "minimist": { - "version": "0.0.8", - "from": "minimist@0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" }, "mixin-deep": { - "version": "1.2.0", - "from": "mixin-deep@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.2.0.tgz" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz", + "integrity": "sha512-dgaCvoh6i1nosAUBKb0l0pfJ78K8+S9fluyIR2YvAeUD/QuMahnFnF3xYty5eYXMjhGSsB0DsW6A0uAZyetoAg==", + "requires": { + "for-in": "1.0.2", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "2.0.4" + } + } + } }, "mkdirp": { "version": "0.5.1", - "from": "mkdirp@>=0.5.1 <0.6.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "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": { "version": "2.0.0", - "from": "ms@2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "nanomatch": { "version": "1.2.6", - "from": "nanomatch@>=1.2.5 <2.0.0", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.6.tgz", + "integrity": "sha512-WJ6XTCbvWXUFPbi/bDwKcYkCeOGUHzaJj72KbuPqGn78Ba/F5Vu26Zlo6SuMQbCIst1RGKL1zfWBCOGAlbRLAg==", + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "1.0.0", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "is-odd": "1.0.0", + "kind-of": "5.1.0", + "object.pick": "1.3.0", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" + }, "dependencies": { "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.2 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "natural-compare": { "version": "1.4.0", - "from": "natural-compare@>=1.4.0 <2.0.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" }, "nise": { "version": "1.2.0", - "from": "nise@>=1.2.0 <2.0.0", "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", + "integrity": "sha512-q9jXh3UNsMV28KeqI43ILz5+c3l+RiNW8mhurEwCKckuHQbL+hTJIKKTiUlCPKlgQ/OukFvSnKB/Jk3+sFbkGA==", + "requires": { + "formatio": "1.2.0", + "just-extend": "1.1.27", + "lolex": "1.6.0", + "path-to-regexp": "1.7.0", + "text-encoding": "0.6.4" + }, "dependencies": { "lolex": { "version": "1.6.0", - "from": "lolex@>=1.6.0 <2.0.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz" + "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", + "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=" } } }, "node-int64": { "version": "0.4.0", - "from": "node-int64@>=0.4.0 <0.5.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz" + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=" }, "node-notifier": { "version": "5.1.2", - "from": "node-notifier@>=5.0.2 <6.0.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.1.2.tgz" + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.1.2.tgz", + "integrity": "sha1-L6nhJgX6EACdRFSdb82KY93g5P8=", + "requires": { + "growly": "1.3.0", + "semver": "5.4.1", + "shellwords": "0.1.1", + "which": "1.3.0" + } }, "normalize-package-data": { "version": "2.4.0", - "from": "normalize-package-data@>=2.3.2 <3.0.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz" + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "requires": { + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.1" + } }, "normalize-path": { "version": "2.1.1", - "from": "normalize-path@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz" + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "requires": { + "remove-trailing-separator": "1.1.0" + } }, "npm-run-path": { "version": "2.0.2", - "from": "npm-run-path@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz" + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "2.0.1" + } }, "number-is-nan": { "version": "1.0.1", - "from": "number-is-nan@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "nwmatcher": { "version": "1.4.3", - "from": "nwmatcher@>=1.3.9 <2.0.0", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz" + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", + "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==" }, "oauth-sign": { "version": "0.8.2", - "from": "oauth-sign@>=0.8.2 <0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz" + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" }, "object-assign": { "version": "4.1.1", - "from": "object-assign@>=4.1.0 <5.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "object-copy": { "version": "0.1.0", - "from": "object-copy@>=0.1.0 <0.2.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "requires": { + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" + }, "dependencies": { "define-property": { "version": "0.2.5", - "from": "define-property@>=0.2.5 <0.3.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "0.1.6" + } }, "is-descriptor": { "version": "0.1.6", - "from": "is-descriptor@>=0.1.0 <0.2.0", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, "dependencies": { "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.3 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "object-visit": { "version": "1.0.1", - "from": "object-visit@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "requires": { + "isobject": "3.0.1" + } }, "object.omit": { "version": "2.0.1", - "from": "object.omit@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } }, "object.pick": { "version": "1.3.0", - "from": "object.pick@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "3.0.1" + } }, "once": { "version": "1.4.0", - "from": "once@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1.0.2" + } }, "optimist": { "version": "0.6.1", - "from": "optimist@>=0.6.1 <0.7.0", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + } }, "optionator": { "version": "0.8.2", - "from": "optionator@>=0.8.1 <0.9.0", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + }, "dependencies": { "wordwrap": { "version": "1.0.0", - "from": "wordwrap@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" } } }, "os-homedir": { "version": "1.0.2", - "from": "os-homedir@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" }, "os-locale": { "version": "2.1.0", - "from": "os-locale@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } }, "os-tmpdir": { "version": "1.0.2", - "from": "os-tmpdir@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "p-cancelable": { "version": "0.3.0", - "from": "p-cancelable@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz" + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" }, "p-finally": { "version": "1.0.0", - "from": "p-finally@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, "p-limit": { "version": "1.1.0", - "from": "p-limit@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=" }, "p-locate": { "version": "2.0.0", - "from": "p-locate@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "1.1.0" + } }, "parse-glob": { "version": "3.0.4", - "from": "parse-glob@>=3.0.4 <4.0.0", "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + }, "dependencies": { "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } } } }, "parse-json": { "version": "2.2.0", - "from": "parse-json@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz" - }, - "parse-passwd": { - "version": "1.0.0", - "from": "parse-passwd@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "1.3.1" + } }, "parse5": { "version": "1.5.1", - "from": "parse5@>=1.5.1 <2.0.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz" + "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", + "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=" }, "pascalcase": { "version": "0.1.1", - "from": "pascalcase@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" }, "path-dirname": { "version": "1.0.2", - "from": "path-dirname@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" }, "path-exists": { "version": "3.0.0", - "from": "path-exists@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" }, "path-is-absolute": { "version": "1.0.1", - "from": "path-is-absolute@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-key": { "version": "2.0.1", - "from": "path-key@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" }, "path-parse": { "version": "1.0.5", - "from": "path-parse@>=1.0.5 <2.0.0", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz" + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" }, "path-to-regexp": { "version": "1.7.0", - "from": "path-to-regexp@>=1.7.0 <2.0.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "requires": { + "isarray": "0.0.1" + }, "dependencies": { "isarray": { "version": "0.0.1", - "from": "isarray@0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" } } }, "path-type": { "version": "1.1.0", - "from": "path-type@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "requires": { + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + }, "dependencies": { "pify": { "version": "2.3.0", - "from": "pify@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" } } }, "performance-now": { "version": "2.1.0", - "from": "performance-now@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "pify": { "version": "3.0.0", - "from": "pify@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" }, "pinkie": { "version": "2.0.4", - "from": "pinkie@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz" + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" }, "pinkie-promise": { "version": "2.0.1", - "from": "pinkie-promise@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "2.0.4" + } }, "pkg-dir": { "version": "2.0.0", - "from": "pkg-dir@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "requires": { + "find-up": "2.1.0" + } }, "posix-character-classes": { "version": "0.1.1", - "from": "posix-character-classes@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" }, "prelude-ls": { "version": "1.1.2", - "from": "prelude-ls@>=1.1.2 <1.2.0", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" }, "preserve": { "version": "0.2.0", - "from": "preserve@>=0.2.0 <0.3.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz" + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=" }, "pretty-format": { "version": "21.2.1", - "from": "pretty-format@>=21.2.1 <22.0.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", + "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", + "requires": { + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" + }, "dependencies": { "ansi-regex": { "version": "3.0.0", - "from": "ansi-regex@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "requires": { + "color-convert": "1.9.1" + } } } }, "private": { "version": "0.1.8", - "from": "private@>=0.1.7 <0.2.0", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz" + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "process-nextick-args": { "version": "1.0.7", - "from": "process-nextick-args@>=1.0.6 <1.1.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz" + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, "prr": { - "version": "0.0.0", - "from": "prr@>=0.0.0 <0.1.0", - "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" }, "pseudomap": { "version": "1.0.2", - "from": "pseudomap@>=1.0.2 <2.0.0", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" }, "punycode": { "version": "1.4.1", - "from": "punycode@>=1.4.1 <2.0.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz" + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" }, "qs": { "version": "6.5.1", - "from": "qs@>=6.5.1 <6.6.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz" + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "randomatic": { "version": "1.1.7", - "from": "randomatic@>=1.1.3 <2.0.0", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, "dependencies": { "kind-of": { "version": "4.0.0", - "from": "kind-of@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "read-package-json": { "version": "2.0.12", - "from": "read-package-json@>=2.0.12 <3.0.0", - "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz" + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", + "integrity": "sha512-m7/I0+tP6D34EVvSlzCtuVA4D/dHL6OpLcn2e4XVP5X57pCKGUy1JjRSBVKHWpB+vUU91sL85h84qX0MdXzBSw==", + "requires": { + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "json-parse-better-errors": "1.0.1", + "normalize-package-data": "2.4.0", + "slash": "1.0.0" + } }, "read-pkg": { "version": "1.1.0", - "from": "read-pkg@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" + } }, "read-pkg-up": { "version": "1.0.1", - "from": "read-pkg-up@>=1.0.1 <2.0.0", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + }, "dependencies": { "find-up": { "version": "1.1.2", - "from": "find-up@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz" + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } }, "path-exists": { "version": "2.1.0", - "from": "path-exists@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "2.0.1" + } } } }, "readable-stream": { "version": "2.3.3", - "from": "readable-stream@>=2.0.2 <3.0.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz" + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } }, "readdir-enhanced": { "version": "1.5.2", - "from": "readdir-enhanced@>=1.5.2 <2.0.0", - "resolved": "https://registry.npmjs.org/readdir-enhanced/-/readdir-enhanced-1.5.2.tgz" + "resolved": "https://registry.npmjs.org/readdir-enhanced/-/readdir-enhanced-1.5.2.tgz", + "integrity": "sha1-YUYwSGkKxqRVt1ti+nioj43IXlM=", + "requires": { + "call-me-maybe": "1.0.1", + "es6-promise": "4.1.1", + "glob-to-regexp": "0.3.0" + } }, "readdirp": { "version": "2.1.0", - "from": "readdirp@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "requires": { + "graceful-fs": "4.1.11", + "minimatch": "3.0.4", + "readable-stream": "2.3.3", + "set-immediate-shim": "1.0.1" + } }, "regenerator-runtime": { "version": "0.11.1", - "from": "regenerator-runtime@>=0.11.0 <0.12.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz" + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" }, "regex-cache": { "version": "0.4.4", - "from": "regex-cache@>=0.4.2 <0.5.0", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz" + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "requires": { + "is-equal-shallow": "0.1.3" + } }, "regex-not": { "version": "1.0.0", - "from": "regex-not@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", + "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", + "requires": { + "extend-shallow": "2.0.1" + } }, "remove-trailing-separator": { "version": "1.1.0", - "from": "remove-trailing-separator@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz" + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" }, "repeat-element": { "version": "1.1.2", - "from": "repeat-element@>=1.1.2 <2.0.0", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz" + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=" }, "repeat-string": { "version": "1.6.1", - "from": "repeat-string@>=1.6.1 <2.0.0", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, "repeating": { "version": "2.0.1", - "from": "repeating@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "requires": { + "is-finite": "1.0.2" + } }, "request": { "version": "2.83.0", - "from": "request@>=2.79.0 <3.0.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz" + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.1", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "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", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.6.0", + "uuid": "3.1.0" + } }, "require-directory": { "version": "2.1.1", - "from": "require-directory@>=2.1.1 <3.0.0", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" }, "require-main-filename": { "version": "1.0.1", - "from": "require-main-filename@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" }, "resolve": { - "version": "1.1.7", - "from": "resolve@1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "requires": { + "path-parse": "1.0.5" + } }, "resolve-url": { "version": "0.2.1", - "from": "resolve-url@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" }, "rimraf": { "version": "2.6.2", - "from": "rimraf@>=2.6.1 <3.0.0", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz" + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "requires": { + "glob": "7.1.2" + } }, "safe-buffer": { "version": "5.1.1", - "from": "safe-buffer@>=5.1.1 <6.0.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "samsam": { "version": "1.3.0", - "from": "samsam@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.3.0.tgz", + "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==" }, "sane": { "version": "2.2.0", - "from": "sane@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/sane/-/sane-2.2.0.tgz", + "integrity": "sha512-OSJxhHO0CgPUw3lUm3GhfREAfza45smvEI9ozuFrxKG10GHVo0ryW9FK5VYlLvxj0SV7HVKHW0voYJIRu27GWg==", + "requires": { + "anymatch": "1.3.2", + "exec-sh": "0.2.1", + "fb-watchman": "2.0.0", + "minimatch": "3.0.4", + "minimist": "1.2.0", + "walker": "1.0.7", + "watch": "0.18.0" + }, "dependencies": { "minimist": { "version": "1.2.0", - "from": "minimist@>=1.1.1 <2.0.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } }, "sax": { "version": "1.2.4", - "from": "sax@>=1.2.1 <2.0.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz" + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "semver": { "version": "5.4.1", - "from": "semver@>=5.3.0 <6.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz" + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" }, "set-blocking": { "version": "2.0.0", - "from": "set-blocking@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-getter": { "version": "0.1.0", - "from": "set-getter@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz" + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", + "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "requires": { + "to-object-path": "0.3.0" + } }, "set-immediate-shim": { "version": "1.0.1", - "from": "set-immediate-shim@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" }, "set-value": { "version": "2.0.0", - "from": "set-value@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" + } }, "shebang-command": { "version": "1.2.0", - "from": "shebang-command@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "1.0.0" + } }, "shebang-regex": { "version": "1.0.0", - "from": "shebang-regex@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, "shell-quote": { "version": "1.6.1", - "from": "shell-quote@>=1.6.1 <2.0.0", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz" + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", + "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", + "requires": { + "array-filter": "0.0.1", + "array-map": "0.0.0", + "array-reduce": "0.0.0", + "jsonify": "0.0.0" + } }, "shellwords": { "version": "0.1.1", - "from": "shellwords@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==" }, "signal-exit": { "version": "3.0.2", - "from": "signal-exit@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz" + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "simplr-logger": { "version": "1.0.1", - "from": "simplr-logger@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/simplr-logger/-/simplr-logger-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/simplr-logger/-/simplr-logger-1.0.1.tgz", + "integrity": "sha512-lyDPiwbPi3jlOMj1Zufdmy60ibE3EyHgJ3nH/FzFNe9pfSz15mWYOt4FT860XFvxVQkZX7RxrqzPMoPSgAU3nQ==", + "requires": { + "tslib": "1.8.1" + } }, "simplr-tslint": { "version": "0.0.1", - "from": "simplr-tslint@0.0.1", - "resolved": "https://registry.npmjs.org/simplr-tslint/-/simplr-tslint-0.0.1.tgz" + "resolved": "https://registry.npmjs.org/simplr-tslint/-/simplr-tslint-0.0.1.tgz", + "integrity": "sha512-Piq9BsldiMj5oJVWqMZvxZhr1HBj+OMhzUNNrzkhqkg567dSBFZVHlJepy6IA2o4RpM3V85e/TWygQ9fyhAu7g==" }, "sinon": { "version": "4.1.3", - "from": "sinon@>=4.1.3 <5.0.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.3.tgz" + "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.3.tgz", + "integrity": "sha512-c7u0ZuvBRX1eXuB4jN3BRCAOGiUTlM8SE3TxbJHrNiHUKL7wonujMOB6Fi1gQc00U91IscFORQHDga/eccqpbw==", + "requires": { + "diff": "3.4.0", + "formatio": "1.2.0", + "lodash.get": "4.4.2", + "lolex": "2.3.1", + "nise": "1.2.0", + "supports-color": "4.5.0", + "type-detect": "4.0.5" + }, + "dependencies": { + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "requires": { + "has-flag": "2.0.0" + } + } + } }, "slash": { "version": "1.0.0", - "from": "slash@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" }, "snapdragon": { "version": "0.8.1", - "from": "snapdragon@>=0.8.1 <0.9.0", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", + "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", + "requires": { + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.1", + "use": "2.0.2" + }, "dependencies": { "define-property": { "version": "0.2.5", - "from": "define-property@>=0.2.5 <0.3.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "0.1.6" + } }, "is-descriptor": { "version": "0.1.6", - "from": "is-descriptor@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } }, "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "snapdragon-node": { "version": "2.1.1", - "from": "snapdragon-node@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz" + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "requires": { + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" + } }, "snapdragon-util": { "version": "3.0.1", - "from": "snapdragon-util@>=3.0.1 <4.0.0", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "requires": { + "kind-of": "3.2.2" + }, "dependencies": { "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.2.0 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "sntp": { "version": "2.1.0", - "from": "sntp@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "requires": { + "hoek": "4.2.0" + } }, "source-map": { "version": "0.5.7", - "from": "source-map@>=0.5.6 <0.6.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" }, "source-map-resolve": { "version": "0.5.1", - "from": "source-map-resolve@>=0.5.0 <0.6.0", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz" + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", + "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", + "requires": { + "atob": "2.0.3", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" + } }, "source-map-support": { "version": "0.4.18", - "from": "source-map-support@>=0.4.15 <0.5.0", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz" + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "requires": { + "source-map": "0.5.7" + } }, "source-map-url": { "version": "0.4.0", - "from": "source-map-url@>=0.4.0 <0.5.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz" + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" }, "spdx-correct": { "version": "1.0.2", - "from": "spdx-correct@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "requires": { + "spdx-license-ids": "1.2.2" + } }, "spdx-expression-parse": { "version": "1.0.4", - "from": "spdx-expression-parse@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz" + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=" }, "spdx-license-ids": { "version": "1.2.2", - "from": "spdx-license-ids@>=1.0.2 <2.0.0", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz" + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=" }, "split-string": { "version": "3.1.0", - "from": "split-string@>=3.0.2 <4.0.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "requires": { + "extend-shallow": "3.0.1" + }, "dependencies": { "extend-shallow": { "version": "3.0.1", - "from": "extend-shallow@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.1.tgz", + "integrity": "sha512-Fg1xXAv+qXKdwHiJFMcZSqsMcbPlkzsZtf8KkLJ2fqnP+lqg2RjEKgDcSfO9CO1+p4LZKgApDBUUUqKaaRhwZQ==", + "requires": { + "is-extendable": "1.0.1" + } }, "is-extendable": { "version": "1.0.1", - "from": "is-extendable@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "2.0.4" + } } } }, "sprintf-js": { "version": "1.0.3", - "from": "sprintf-js@>=1.0.2 <1.1.0", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { "version": "1.13.1", - "from": "sshpk@>=1.7.0 <2.0.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz" + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "dashdash": "1.14.1", + "getpass": "0.1.7" + } }, "static-extend": { "version": "0.1.2", - "from": "static-extend@>=0.1.1 <0.2.0", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "requires": { + "define-property": "0.2.5", + "object-copy": "0.1.0" + }, "dependencies": { "define-property": { "version": "0.2.5", - "from": "define-property@>=0.2.5 <0.3.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "0.1.6" + } }, "is-descriptor": { "version": "0.1.6", - "from": "is-descriptor@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } }, "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "string": { "version": "3.3.3", - "from": "string@>=3.3.3 <4.0.0", - "resolved": "https://registry.npmjs.org/string/-/string-3.3.3.tgz" + "resolved": "https://registry.npmjs.org/string/-/string-3.3.3.tgz", + "integrity": "sha1-XqIRzZLSKOGEKUmQpsyXs2anfLA=" }, "string_decoder": { "version": "1.0.3", - "from": "string_decoder@>=1.0.3 <1.1.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" + } }, "string-length": { "version": "2.0.0", - "from": "string-length@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "requires": { + "astral-regex": "1.0.0", + "strip-ansi": "4.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" + } + } + } }, "string-width": { "version": "2.1.1", - "from": "string-width@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.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=" + }, "is-fullwidth-code-point": { "version": "2.0.0", - "from": "is-fullwidth-code-point@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "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" + } } } }, "stringstream": { "version": "0.0.5", - "from": "stringstream@>=0.0.5 <0.1.0", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" }, "strip-ansi": { - "version": "4.0.0", - "from": "strip-ansi@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "from": "ansi-regex@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz" - } + "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.1.1" } }, "strip-bom": { "version": "2.0.0", - "from": "strip-bom@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "requires": { + "is-utf8": "0.2.1" + } }, "strip-eof": { "version": "1.0.0", - "from": "strip-eof@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz" - }, - "strip-json-comments": { - "version": "2.0.1", - "from": "strip-json-comments@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" }, "subarg": { "version": "1.0.0", - "from": "subarg@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", + "requires": { + "minimist": "1.2.0" + }, "dependencies": { "minimist": { "version": "1.2.0", - "from": "minimist@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } }, "supports-color": { - "version": "4.5.0", - "from": "supports-color@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "symbol-tree": { "version": "3.2.2", - "from": "symbol-tree@>=3.2.1 <4.0.0", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=" }, "test-exclude": { "version": "4.1.1", - "from": "test-exclude@>=4.1.1 <5.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", + "integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==", + "requires": { + "arrify": "1.0.1", + "micromatch": "2.3.11", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "require-main-filename": "1.0.1" + }, "dependencies": { "arr-diff": { "version": "2.0.0", - "from": "arr-diff@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "requires": { + "arr-flatten": "1.1.0" + } }, "array-unique": { "version": "0.2.1", - "from": "array-unique@>=0.2.1 <0.3.0", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz" + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, "braces": { "version": "1.8.5", - "from": "braces@>=1.8.2 <2.0.0", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } }, "expand-brackets": { "version": "0.1.5", - "from": "expand-brackets@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz" + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "requires": { + "is-posix-bracket": "0.1.1" + } }, "extglob": { "version": "0.3.2", - "from": "extglob@>=0.3.1 <0.4.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "requires": { + "is-extglob": "1.0.0" + } }, "is-extglob": { "version": "1.0.0", - "from": "is-extglob@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-glob": { "version": "2.0.1", - "from": "is-glob@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "requires": { + "is-extglob": "1.0.0" + } }, "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } }, "micromatch": { "version": "2.3.11", - "from": "micromatch@>=2.3.11 <3.0.0", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz" + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } } } }, "text-encoding": { "version": "0.6.4", - "from": "text-encoding@>=0.6.4 <0.7.0", - "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz" + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=" }, "throat": { "version": "4.1.0", - "from": "throat@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz" + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=" }, "tmpl": { "version": "1.0.4", - "from": "tmpl@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz" + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" }, "to-fast-properties": { "version": "1.0.3", - "from": "to-fast-properties@>=1.0.3 <2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" }, "to-object-path": { "version": "0.3.0", - "from": "to-object-path@>=0.3.0 <0.4.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "requires": { + "kind-of": "3.2.2" + }, "dependencies": { "kind-of": { "version": "3.2.2", - "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } } } }, "to-regex": { "version": "3.0.1", - "from": "to-regex@>=3.0.1 <4.0.0", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", + "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", + "requires": { + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "regex-not": "1.0.0" + }, "dependencies": { "define-property": { "version": "0.2.5", - "from": "define-property@>=0.2.5 <0.3.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "0.1.6" + } }, "is-descriptor": { "version": "0.1.6", - "from": "is-descriptor@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } }, "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "to-regex-range": { "version": "2.1.1", - "from": "to-regex-range@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz" + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "3.0.0", + "repeat-string": "1.6.1" + } }, "tough-cookie": { "version": "2.3.3", - "from": "tough-cookie@>=2.3.2 <3.0.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz" + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "requires": { + "punycode": "1.4.1" + } }, "tr46": { "version": "0.0.3", - "from": "tr46@>=0.0.3 <0.1.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "trim-right": { "version": "1.0.1", - "from": "trim-right@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, "ts-extractor": { "version": "2.0.0", - "from": "ts-extractor@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-2.0.0.tgz", + "integrity": "sha512-snSSnVkhc/jDo0ppJa8t3/aIbMcI3qg6HsB/iC0UdG+5KzAKHGQBuM5QwaFng6O7KKbk/Ljb8RgwN5uwd1DYHA==", + "requires": { + "@types/fs-extra": "4.0.6", + "fs-extra": "4.0.3", + "read-package-json": "2.0.12", + "simplr-logger": "1.0.1", + "typescript": "2.6.2" + } }, "ts-jest": { "version": "21.2.4", - "from": "ts-jest@>=21.2.4 <22.0.0", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-21.2.4.tgz", + "integrity": "sha512-Plk49Us+DcncpQcC8fhYwDUdhW96QB0Dv02etOLhzq+2HAvXfrEUys3teZ/BeyQ+r1rHxfGdNj4dB0Q5msZR3g==", + "requires": { + "babel-core": "6.26.0", + "babel-plugin-istanbul": "4.1.5", + "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", + "babel-preset-jest": "21.2.0", + "cpx": "1.5.0", + "fs-extra": "4.0.3", + "jest-config": "21.2.1", + "pkg-dir": "2.0.0", + "source-map-support": "0.5.0", + "yargs": "10.0.3" + }, "dependencies": { "source-map": { "version": "0.6.1", - "from": "source-map@>=0.6.0 <0.7.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { "version": "0.5.0", - "from": "source-map-support@>=0.5.0 <0.6.0", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz" - }, - "yargs": { - "version": "10.0.3", - "from": "yargs@>=10.0.3 <11.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz" - }, - "yargs-parser": { - "version": "8.0.0", - "from": "yargs-parser@>=8.0.0 <9.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz" - } - } - }, - "ts-node": { - "version": "3.3.0", - "from": "ts-node@>=3.3.0 <4.0.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-3.3.0.tgz", - "dependencies": { - "minimist": { - "version": "1.2.0", - "from": "minimist@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" - } - } - }, - "tsconfig": { - "version": "6.0.0", - "from": "tsconfig@>=6.0.0 <7.0.0", - "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz", - "dependencies": { - "strip-bom": { - "version": "3.0.0", - "from": "strip-bom@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz", + "integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==", + "requires": { + "source-map": "0.6.1" + } } } }, "tslib": { "version": "1.8.1", - "from": "tslib@>=1.8.0 <2.0.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz" + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz", + "integrity": "sha1-aUavLR1lGnsYY7Ux1uWvpBqkTqw=" }, "tslint": { "version": "5.8.0", - "from": "tslint@>=5.8.0 <6.0.0", "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.8.0.tgz", - "dependencies": { - "resolve": { - "version": "1.5.0", - "from": "resolve@>=1.3.2 <2.0.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz" - } + "integrity": "sha1-H0mtWy53x2w69N3K5VKuTjYS6xM=", + "requires": { + "babel-code-frame": "6.26.0", + "builtin-modules": "1.1.1", + "chalk": "2.3.0", + "commander": "2.12.2", + "diff": "3.4.0", + "glob": "7.1.2", + "minimatch": "3.0.4", + "resolve": "1.5.0", + "semver": "5.4.1", + "tslib": "1.8.1", + "tsutils": "2.13.0" } }, "tsutils": { "version": "2.13.0", - "from": "tsutils@>=2.12.1 <3.0.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.13.0.tgz" + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.13.0.tgz", + "integrity": "sha512-FuWzNJbMsp3gcZMbI3b5DomhW4Ia41vMxjN63nKWI0t7f+I3UmHfRl0TrXJTwI2LUduDG+eR1Mksp3pvtlyCFQ==", + "requires": { + "tslib": "1.8.1" + } }, "tunnel-agent": { "version": "0.6.0", - "from": "tunnel-agent@>=0.6.0 <0.7.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz" + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "5.1.1" + } }, "type-check": { "version": "0.3.2", - "from": "type-check@>=0.3.2 <0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "requires": { + "prelude-ls": "1.1.2" + } }, "type-detect": { "version": "4.0.5", - "from": "type-detect@>=4.0.5 <5.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz" + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz", + "integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ==" }, "typescript": { "version": "2.6.2", - "from": "typescript@>=2.6.2 <3.0.0", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz" + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz", + "integrity": "sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=" }, "union-value": { "version": "1.0.0", - "from": "union-value@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "requires": { + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" + }, "dependencies": { "set-value": { "version": "0.4.3", - "from": "set-value@>=0.4.3 <0.5.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz" + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + } } } }, "universalify": { "version": "0.1.1", - "from": "universalify@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz" + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", + "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" }, "unset-value": { "version": "1.0.0", - "from": "unset-value@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "requires": { + "has-value": "0.3.1", + "isobject": "3.0.1" + }, "dependencies": { "has-value": { "version": "0.3.1", - "from": "has-value@>=0.3.1 <0.4.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "requires": { + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" + }, "dependencies": { "isobject": { "version": "2.1.0", - "from": "isobject@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz" + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } } } }, "has-values": { "version": "0.1.4", - "from": "has-values@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz" + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" } } }, "urix": { "version": "0.1.0", - "from": "urix@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz" + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" }, "use": { "version": "2.0.2", - "from": "use@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", + "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", + "requires": { + "define-property": "0.2.5", + "isobject": "3.0.1", + "lazy-cache": "2.0.2" + }, "dependencies": { "define-property": { "version": "0.2.5", - "from": "define-property@>=0.2.5 <0.3.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "0.1.6" + } }, "is-descriptor": { "version": "0.1.6", - "from": "is-descriptor@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } }, "kind-of": { "version": "5.1.0", - "from": "kind-of@>=5.0.0 <6.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" } } }, "util-deprecate": { "version": "1.0.2", - "from": "util-deprecate@>=1.0.1 <1.1.0", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { "version": "3.1.0", - "from": "uuid@>=3.1.0 <4.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz" - }, - "v8flags": { - "version": "3.0.1", - "from": "v8flags@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" }, "validate-npm-package-license": { "version": "3.0.1", - "from": "validate-npm-package-license@>=3.0.1 <4.0.0", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } }, "verror": { "version": "1.10.0", - "from": "verror@1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz" + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } }, "walker": { "version": "1.0.7", - "from": "walker@>=1.0.5 <1.1.0", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz" + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "requires": { + "makeerror": "1.0.11" + } }, "watch": { "version": "0.18.0", - "from": "watch@>=0.18.0 <0.19.0", "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", + "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", + "requires": { + "exec-sh": "0.2.1", + "minimist": "1.2.0" + }, "dependencies": { "minimist": { "version": "1.2.0", - "from": "minimist@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } }, "webidl-conversions": { "version": "4.0.2", - "from": "webidl-conversions@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz" + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" }, "whatwg-encoding": { "version": "1.0.3", - "from": "whatwg-encoding@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", + "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", + "requires": { + "iconv-lite": "0.4.19" + } }, "whatwg-url": { "version": "4.8.0", - "from": "whatwg-url@>=4.3.0 <5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz", + "integrity": "sha1-0pgaqRSMHgCkHFphMRZqtGg7vMA=", + "requires": { + "tr46": "0.0.3", + "webidl-conversions": "3.0.1" + }, "dependencies": { "webidl-conversions": { "version": "3.0.1", - "from": "webidl-conversions@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" } } }, "which": { "version": "1.3.0", - "from": "which@>=1.2.9 <2.0.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "requires": { + "isexe": "2.0.0" + } }, "which-module": { "version": "2.0.0", - "from": "which-module@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz" + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, "wordwrap": { "version": "0.0.3", - "from": "wordwrap@>=0.0.2 <0.1.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" }, "worker-farm": { "version": "1.5.2", - "from": "worker-farm@>=1.3.1 <2.0.0", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.2.tgz" + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.2.tgz", + "integrity": "sha512-XxiQ9kZN5n6mmnW+mFJ+wXjNNI/Nx4DIdaAKLX1Bn6LYBWlN/zaBhu34DQYPZ1AJobQuu67S2OfDdNSVULvXkQ==", + "requires": { + "errno": "0.1.6", + "xtend": "4.0.1" + } }, "wrap-ansi": { "version": "2.1.0", - "from": "wrap-ansi@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1" + }, "dependencies": { "string-width": { "version": "1.0.2", - "from": "string-width@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" - }, - "strip-ansi": { - "version": "3.0.1", - "from": "strip-ansi@>=3.0.1 <4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } } } }, "wrappy": { "version": "1.0.2", - "from": "wrappy@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { "version": "2.3.0", - "from": "write-file-atomic@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz" + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" + } }, "xml-name-validator": { "version": "2.0.1", - "from": "xml-name-validator@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz", + "integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=" }, "xtend": { "version": "4.0.1", - "from": "xtend@>=4.0.1 <5.0.0", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" }, "y18n": { "version": "3.2.1", - "from": "y18n@>=3.2.1 <4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz" + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" }, "yallist": { "version": "2.1.2", - "from": "yallist@>=2.1.2 <3.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz" + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" }, "yargs": { - "version": "9.0.1", - "from": "yargs@>=9.0.0 <10.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", - "dependencies": { - "load-json-file": { - "version": "2.0.0", - "from": "load-json-file@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz" - }, - "path-type": { - "version": "2.0.0", - "from": "path-type@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz" - }, - "pify": { - "version": "2.3.0", - "from": "pify@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" - }, - "read-pkg": { - "version": "2.0.0", - "from": "read-pkg@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz" - }, - "read-pkg-up": { - "version": "2.0.0", - "from": "read-pkg-up@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz" - }, - "strip-bom": { - "version": "3.0.0", - "from": "strip-bom@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" - } + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", + "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", + "requires": { + "cliui": "3.2.0", + "decamelize": "1.2.0", + "find-up": "2.1.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "8.0.0" } }, "yargs-parser": { - "version": "7.0.0", - "from": "yargs-parser@>=7.0.0 <8.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz" - }, - "yn": { - "version": "2.0.0", - "from": "yn@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz" + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", + "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", + "requires": { + "camelcase": "4.1.0" + } } } } diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index f729119a..0647a35c 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -10,7 +10,7 @@ "jest": "jest --maxWorkers=4", "tslint": "tslint --project . --config ./tslint.json && echo Successfully passed tslint test.", "build": "tsc -p .", - "build-tests": "cd tests && ts-node ./build-tests.ts -p ./" + "build-tests": "node ../../tools/test-generator-cli/dist/index.js" }, "engine": "node >= 7.5.0", "author": "simplrjs (https://github.com/simplrjs)", @@ -30,7 +30,6 @@ "simplr-tslint": "0.0.1", "sinon": "^4.1.3", "ts-jest": "^21.2.4", - "ts-node": "^3.3.0", "tslint": "^5.8.0" }, "jest": { @@ -57,6 +56,7 @@ "ts", "tsx", "js" - ] + ], + "verbose": true } } diff --git a/packages/ts-docs-gen/tests/.gitignore b/packages/ts-docs-gen/tests/.gitignore deleted file mode 100644 index e25e147d..00000000 --- a/packages/ts-docs-gen/tests/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*/__tests__/* -!*/__tests__/**/__snapshots__ diff --git a/packages/ts-docs-gen/tests/build-tests.ts b/packages/ts-docs-gen/tests/build-tests.ts deleted file mode 100644 index b1f448eb..00000000 --- a/packages/ts-docs-gen/tests/build-tests.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as os from "os"; -import * as process from "process"; -import * as fs from "fs-extra"; -import { Logger } from "../src/utils/logger"; - -import { TestsGenerator } from "./scripts/tests-generator"; -import { TestsCleanup } from "./scripts/tests-cleanup"; -import { TESTS_DIR_NAME } from "./scripts/tests-helpers"; - -async function StartWatcher(dirName: string): Promise { - return fs.watch(`./${dirName}/`, async (event, fileName) => { - if (fileName.indexOf(TESTS_DIR_NAME) === -1) { - Logger.Info(`Test file was changed in "${dirName}/${fileName}".`); - const startBuild = Logger.Info(`Generating tests for "${dirName}"...`); - await TestsGenerator(dirName, __dirname); - Logger.Debug(`Generated tests after ${(Date.now() - startBuild)}ms`); - } - }); -} - -(async (dirNames: string[]) => { - Logger.Info("Starting test generator..."); - for (const dirName of dirNames) { - const startRemove = Logger.Info(`Removing old tests from "${dirName}"...`); - await TestsCleanup(dirName); - Logger.Debug(`Removed old tests after ${(Date.now() - startRemove)}ms`); - - const startBuild = Logger.Info(`Generating tests for "${dirName}"...`); - await TestsGenerator(dirName, __dirname); - Logger.Debug(`Generated tests after ${(Date.now() - startBuild)}ms`); - - if (process.argv.indexOf("--watchAll") !== -1) { - Logger.Info(`Started watching "${dirName}" tests.`); - StartWatcher(dirName); - } - } -})(["cases"]); diff --git a/packages/ts-docs-gen/tests/default.test.tpl b/packages/ts-docs-gen/tests/default.test.tpl new file mode 100644 index 00000000..17493e2b --- /dev/null +++ b/packages/ts-docs-gen/tests/default.test.tpl @@ -0,0 +1,20 @@ +import { Generator } from "@src/generator"; +import { GeneratorConfigurationBuilder } from "@src/builders/generator-configuration-builder"; + +test("{{caseName}}", async done => { + const projectDirectory = "{{projectDirectory}}"; + const testConfig = {{{json testConfig}}}; + const entryFiles = testConfig.EntryFiles; + + try { + const configuration = await new GeneratorConfigurationBuilder(projectDirectory) + .Build(entryFiles); + + const generator = new Generator(configuration); + + expect(generator.OutputData).toMatchSnapshot(); + done(); + } catch (error) { + done.fail(error); + } +}); diff --git a/packages/ts-docs-gen/tests/scripts/tests-cleanup.ts b/packages/ts-docs-gen/tests/scripts/tests-cleanup.ts deleted file mode 100644 index 6c7664f4..00000000 --- a/packages/ts-docs-gen/tests/scripts/tests-cleanup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import * as path from "path"; -import * as fs from "fs-extra"; -import fastGlob from "fast-glob"; - -import { TESTS_DIR_NAME, TESTS_SNAPSHOTS_DIR_NAME } from "../scripts/tests-helpers"; - -export async function TestsCleanup(dirName: string): Promise { - const oldTestFiles = await fastGlob([ - `./${dirName}/${TESTS_DIR_NAME}/*.*`, - `./${dirName}/${TESTS_DIR_NAME}/**/`, - `!./${dirName}/**/${TESTS_SNAPSHOTS_DIR_NAME}/`, - `!./${dirName}/${TESTS_DIR_NAME}/` - ]); - - for (const pathname of oldTestFiles) { - await fs.remove(pathname); - } -} diff --git a/packages/ts-docs-gen/tests/scripts/tests-generator.ts b/packages/ts-docs-gen/tests/scripts/tests-generator.ts deleted file mode 100644 index d9b33dfb..00000000 --- a/packages/ts-docs-gen/tests/scripts/tests-generator.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as os from "os"; -import * as path from "path"; -import * as fs from "fs-extra"; -import fastGlob from "fast-glob"; -import * as ts from "typescript"; - -import { FixSep, Tab, TESTS_DIR_NAME } from "./tests-helpers"; - -export const EXTRACTOR_COMPILER_OPTIONS: ts.CompilerOptions = { - target: ts.ScriptTarget.Latest, - module: ts.ModuleKind.CommonJS, - skipLibCheck: true, - skipDefaultLibCheck: true -}; - -export interface Configuration { - EntryFiles: string[]; -} - -export async function TestsGenerator(dirName: string, cwd: string): Promise { - const filesList = await fastGlob([ - `./${dirName}/**/*.ts`, - `!./${dirName}/${TESTS_DIR_NAME}/**/*` - ]); - - for (const file of filesList) { - const { dir, name, base, ext, root } = path.parse(file); - - const moduleName = FixSep(path.join(dir, base)); - const projectDirectory = FixSep(path.join(cwd, dir, ".")); - const testConfigPath = FixSep(path.join(projectDirectory, "test-config.json")); - const testConfig = await fs.readJSON(testConfigPath) as Configuration; - const testDescribe = [ - `import { Generator } from "@src/generator";`, - `import { GeneratorConfigurationBuilder } from "@src/builders/generator-configuration-builder";`, - "", - `test("${name}", async done => {`, - Tab(1) + `const projectDirectory = "${projectDirectory}";`, - Tab(1) + `const entryFiles = ${JSON.stringify(testConfig.EntryFiles)};`, - "", - Tab(1) + "try {", - Tab(2) + "const configuration = await new GeneratorConfigurationBuilder(projectDirectory)", - Tab(3) + ".Build(entryFiles);", - "", - Tab(2) + "const generator = new Generator(configuration);", - "", - Tab(2) + "expect(generator.OutputData).toMatchSnapshot();", - Tab(2) + "done();", - Tab(1) + "} catch (error) {", - Tab(2) + "done.fail(error);", - Tab(1) + "}", - "});", - "" - ].join(os.EOL); - - const targetDirectory = path.join(dir, "..", "__tests__"); - await fs.ensureDir(targetDirectory); - const targetFilePathname = path.join(targetDirectory, `${path.parse(dir).name}.test${ext}`); - await fs.writeFile(targetFilePathname, testDescribe); - } -} diff --git a/packages/ts-docs-gen/tests/scripts/tests-helpers.ts b/packages/ts-docs-gen/tests/scripts/tests-helpers.ts deleted file mode 100644 index c3b4eea2..00000000 --- a/packages/ts-docs-gen/tests/scripts/tests-helpers.ts +++ /dev/null @@ -1,18 +0,0 @@ -import * as path from "path"; - -const TAB_STRING = " "; - -export function FixSep(pathname: string): string { - return pathname.split(path.sep).join("/"); -} - -export function Tab(size: number = 1): string { - let result: string = ""; - for (let i = 0; i < size; i++) { - result += TAB_STRING; - } - return result; -} - -export const TESTS_DIR_NAME = "__tests__"; -export const TESTS_SNAPSHOTS_DIR_NAME = "__snapshots__"; diff --git a/rush.json b/rush.json index 27cf2d0e..2b0a59a5 100644 --- a/rush.json +++ b/rush.json @@ -1,12 +1,17 @@ { "$schema": "./common/schemas/rush.schema.json", - "npmVersion": "4.5.0", + "npmVersion": "5.3.0", "rushVersion": "4.0.1", "projects": [ { "packageName": "ts-docs-gen", "projectFolder": "packages/ts-docs-gen", "shouldPublish": false + }, + { + "packageName": "test-generator-cli", + "projectFolder": "tools/test-generator-cli", + "shouldPublish": false } ] } diff --git a/tools/test-generator-cli/package.json b/tools/test-generator-cli/package.json new file mode 100644 index 00000000..6a86fc84 --- /dev/null +++ b/tools/test-generator-cli/package.json @@ -0,0 +1,31 @@ +{ + "name": "test-generator-cli", + "private": true, + "version": "0.1.0", + "description": "Generating tests.", + "main": "index.js", + "scripts": { + "build": "tsc -p .", + "watch": "tsc -w", + "pretest": "npm run build -- --noEmit", + "test": "npm run tslint", + "tslint": "tslint --project . --config ./tslint.json && echo Successfully passed tslint test." + }, + "keywords": [], + "author": "simplrjs (https://github.com/simplrjs)", + "dependencies": { + "@types/fs-extra": "^4.0.5", + "@types/handlebars": "^4.0.36", + "@types/yargs": "^10.0.0", + "fast-glob": "^1.0.1", + "fs-extra": "^4.0.2", + "handlebars": "^4.0.11", + "simplr-logger": "^1.0.0", + "typescript": "^2.6.2", + "yargs": "^10.0.3" + }, + "devDependencies": { + "simplr-tslint": "0.0.1", + "tslint": "^5.8.0" + } +} diff --git a/tools/test-generator-cli/src/cli-arguments.ts b/tools/test-generator-cli/src/cli-arguments.ts new file mode 100644 index 00000000..b37ea4b2 --- /dev/null +++ b/tools/test-generator-cli/src/cli-arguments.ts @@ -0,0 +1,21 @@ +import * as yargs from "yargs"; + +import { GetVersion } from "./cli-helpers"; +import { CLIArgumentsObject } from "./cli-contracts"; + +/** + * Handles all CLI commands and arguments. + */ +export const CLIHandler = yargs + .showHelpOnFail(true) + .help("h", "Show help") + .alias("h", "help") + .version(`Current version: ${GetVersion()}`) + .alias("v", "version") + // CLI options + .option("project", { + describe: "Project directory path.", + type: "string" + }) + .alias("p", "project") + .argv as CLIArgumentsObject; diff --git a/tools/test-generator-cli/src/cli-contracts.ts b/tools/test-generator-cli/src/cli-contracts.ts new file mode 100644 index 00000000..7b33725c --- /dev/null +++ b/tools/test-generator-cli/src/cli-contracts.ts @@ -0,0 +1,20 @@ +import { Arguments } from "yargs"; + +/** + * Base properties of `package.json`. + */ +export interface BasePackage { + name: string; + version: string; + description?: string; + main: string; + author?: string; + license?: string; +} + +/** + * Argument of CLI. + */ +export interface CLIArgumentsObject extends Arguments { + path?: string; +} diff --git a/tools/test-generator-cli/src/cli-helpers.ts b/tools/test-generator-cli/src/cli-helpers.ts new file mode 100644 index 00000000..cf825bb4 --- /dev/null +++ b/tools/test-generator-cli/src/cli-helpers.ts @@ -0,0 +1,21 @@ +import * as fs from "fs-extra"; +import * as path from "path"; + +import { BasePackage } from "./cli-contracts"; + +/** + * Path from current file to a `package.json`. + */ +const PACKAGE_JSON_PATH = "../package.json"; + +/** + * Object of `package.json`. + */ +export const PACKAGE_JSON = fs.readJSONSync(path.join(__dirname, PACKAGE_JSON_PATH)) as BasePackage; + +/** + * Get version string from `package.json`. + */ +export function GetVersion(): string { + return PACKAGE_JSON.version; +} diff --git a/tools/test-generator-cli/src/index.ts b/tools/test-generator-cli/src/index.ts new file mode 100644 index 00000000..73d24417 --- /dev/null +++ b/tools/test-generator-cli/src/index.ts @@ -0,0 +1,39 @@ +import * as fs from "fs-extra"; +import * as path from "path"; + +import { Logger } from "./utils/logger"; +import { TestsGenerator } from "./tests-generator"; +import { FixSep, TESTS_DIR_NAME, CASES_DIR_NAME } from "./tests-helpers"; +import { TestsCleanup } from "./tests-cleanup"; +import { CLIHandler } from "./cli-arguments"; +import { CLIArgumentsObject } from "./cli-contracts"; + +async function StartWatcher(testsCasesPath: string): Promise { + return fs.watch(`${testsCasesPath}/`, async (event, fileName) => { + if (fileName.indexOf(TESTS_DIR_NAME) === -1) { + Logger.Info(`Test file was changed in "${testsCasesPath}/${fileName}".`); + const startBuild = Logger.Info(`Generating tests for "${testsCasesPath}"...`); + await TestsGenerator(testsCasesPath); + Logger.Debug(`Generated tests after ${(Date.now() - startBuild)}ms`); + } + }); +} + +(async (argumentsObject: CLIArgumentsObject) => { + const cwd = argumentsObject.path || process.cwd(); + const testsCasesPath = FixSep(path.join(cwd, TESTS_DIR_NAME, CASES_DIR_NAME)); + + Logger.Info("Starting test generator..."); + const startRemove = Logger.Info(`Removing old tests from "${testsCasesPath}"...`); + await TestsCleanup(testsCasesPath); + Logger.Debug(`Removed old tests after ${(Date.now() - startRemove)}ms`); + + const startBuild = Logger.Info(`Generating tests for "${testsCasesPath}"...`); + await TestsGenerator(testsCasesPath); + Logger.Debug(`Generated tests after ${(Date.now() - startBuild)}ms`); + + if (process.argv.indexOf("--watchAll") !== -1) { + Logger.Info(`Started watching "${testsCasesPath}" tests.`); + StartWatcher(testsCasesPath); + } +})(CLIHandler); diff --git a/tools/test-generator-cli/src/tests-cleanup.ts b/tools/test-generator-cli/src/tests-cleanup.ts new file mode 100644 index 00000000..1fde9c3a --- /dev/null +++ b/tools/test-generator-cli/src/tests-cleanup.ts @@ -0,0 +1,22 @@ +import * as fs from "fs-extra"; +import * as path from "path"; +import fastGlob from "fast-glob"; + +import { + GENERATED_TESTS_DIR_NAME, + TESTS_SNAPSHOTS_DIR_NAME, + FixSep +} from "./tests-helpers"; + +export async function TestsCleanup(testsCasesPath: string): Promise { + const generatedTestsDirPath = FixSep(path.join(testsCasesPath, GENERATED_TESTS_DIR_NAME)); + + const oldTestFiles = await fastGlob(`${generatedTestsDirPath}/**/*`, { + onlyFiles: true, + ignore: [`**/${TESTS_SNAPSHOTS_DIR_NAME}/**`] + }); + + for (const pathname of oldTestFiles) { + await fs.remove(pathname); + } +} diff --git a/tools/test-generator-cli/src/tests-generator.ts b/tools/test-generator-cli/src/tests-generator.ts new file mode 100644 index 00000000..1eaa752e --- /dev/null +++ b/tools/test-generator-cli/src/tests-generator.ts @@ -0,0 +1,67 @@ +import * as path from "path"; +import * as fs from "fs-extra"; +import fastGlob from "fast-glob"; +import * as handlebars from "handlebars"; + +import { + FixSep, + GENERATED_TESTS_DIR_NAME, + TESTS_CONFIG_FILE_NAME, + DEFAULT_TEMPLATE_FILE_NAME, + CASE_TEMPLATE_FILE_NAME, + RegisterJSONStringifyHandlebarHelper +} from "./tests-helpers"; +import { Logger } from "./utils/logger"; + +export interface Configuration { + EntryFiles: string[]; +} + +export async function TestsGenerator(testsCasesPath: string): Promise { + const defaultTemplatePath = FixSep(path.join(testsCasesPath, "..", DEFAULT_TEMPLATE_FILE_NAME)); + if (!await fs.pathExists(defaultTemplatePath)) { + Logger.Error(`Not found package default template. Expected file location: "${defaultTemplatePath}"`); + return; + } + + const casesDirPaths = await fastGlob( + [ + `${testsCasesPath}/*` + ], + { + onlyDirs: true, + ignore: [`**/${GENERATED_TESTS_DIR_NAME}/**`] + }); + + const targetDirectory = path.join(testsCasesPath, GENERATED_TESTS_DIR_NAME); + await fs.ensureDir(targetDirectory); + + RegisterJSONStringifyHandlebarHelper(); + + for (const caseDirPath of casesDirPaths) { + const { name } = path.parse(caseDirPath); + + const caseTemplatePath = FixSep(path.join(caseDirPath, CASE_TEMPLATE_FILE_NAME)); + let templatePath: string; + if (await fs.pathExists(caseTemplatePath)) { + templatePath = caseTemplatePath; + } else { + templatePath = defaultTemplatePath; + } + + const testConfigPath = FixSep(path.join(caseDirPath, TESTS_CONFIG_FILE_NAME)); + const testConfig = await fs.readJSON(testConfigPath) as Configuration; + + const source = await fs.readFile(templatePath, "utf8"); + const template = handlebars.compile(source); + const data = { + "caseName": name, + "projectDirectory": caseDirPath, + "testConfig": testConfig + }; + const testDescribe = template(data); + + const targetFilePathName = path.join(targetDirectory, `${name}.test.ts`); + await fs.writeFile(targetFilePathName, testDescribe); + } +} diff --git a/tools/test-generator-cli/src/tests-helpers.ts b/tools/test-generator-cli/src/tests-helpers.ts new file mode 100644 index 00000000..500b2a71 --- /dev/null +++ b/tools/test-generator-cli/src/tests-helpers.ts @@ -0,0 +1,23 @@ +import * as path from "path"; +import * as handlebars from "handlebars"; + +export function FixSep(pathname: string): string { + return pathname.split(path.sep).join("/"); +} + +export function RegisterJSONStringifyHandlebarHelper(): void { + handlebars.registerHelper("json", (value: any) => + new handlebars.SafeString( + JSON.stringify(value) + )); +} + +export const TESTS_DIR_NAME = "tests"; +export const CASES_DIR_NAME = "cases"; + +export const GENERATED_TESTS_DIR_NAME = "__tests__"; +export const TESTS_SNAPSHOTS_DIR_NAME = "__snapshots__"; + +export const TESTS_CONFIG_FILE_NAME = "test-config.json"; +export const DEFAULT_TEMPLATE_FILE_NAME = "default.test.tpl"; +export const CASE_TEMPLATE_FILE_NAME = "case.test.tpl"; diff --git a/tools/test-generator-cli/src/utils/logger.ts b/tools/test-generator-cli/src/utils/logger.ts new file mode 100644 index 00000000..55b1a36d --- /dev/null +++ b/tools/test-generator-cli/src/utils/logger.ts @@ -0,0 +1,7 @@ +import { LoggerBuilder, LoggerConfigurationBuilder, LogLevel } from "simplr-logger"; + +const LoggerConfiguration = new LoggerConfigurationBuilder() + .SetDefaultLogLevel(LogLevel.Trace) + .Build(); + +export const Logger = new LoggerBuilder(LoggerConfiguration); diff --git a/tools/test-generator-cli/tsconfig.json b/tools/test-generator-cli/tsconfig.json new file mode 100644 index 00000000..2fe54924 --- /dev/null +++ b/tools/test-generator-cli/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "removeComments": false, + "outDir": "dist", + "rootDir": "src", + "inlineSourceMap": true, + "inlineSources": true, + "skipDefaultLibCheck": true, + "declaration": true, + "pretty": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noUnusedLocals": true, + "skipLibCheck": true, + "lib": [ + "es6", + "es2017.object" + ], + "types": [ + "node" + ], + "typeRoots": [ + "./node_modules/@types" + ] + }, + "exclude": [ + "node_modules", + "dist", + "@types" + ] +} diff --git a/tools/test-generator-cli/tslint.json b/tools/test-generator-cli/tslint.json new file mode 100644 index 00000000..3385cef2 --- /dev/null +++ b/tools/test-generator-cli/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "simplr-tslint" +} From 8a885a91db6d5b98a20d20d32dc0fba946ecd1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Mon, 18 Dec 2017 15:03:52 +0200 Subject: [PATCH 52/61] Feature: File manager upgrade (#7) --- .../docs/api/exported-const-variables.md | 33 ----- .../simple/docs/api/exported-functions.md | 2 - .../examples/simple/docs/api/index.md | 10 +- .../simple/docs/api/index/boonamespace.md | 5 + .../api/index/boonamespace/boonamespace2.md | 12 ++ packages/ts-docs-gen/examples/simple/index.ts | 8 ++ .../src/abstractions/api-item-plugin-base.ts | 20 --- .../src/abstractions/file-manager-base.ts | 9 -- .../generator-configuration-builder.ts | 4 +- .../src/contracts/api-item-reference.ts | 4 + .../ts-docs-gen/src/contracts/file-manager.ts | 7 + .../src/contracts/file-output-dto.ts | 4 - .../ts-docs-gen/src/contracts/file-result.ts | 4 + .../src/contracts/generator-configuration.ts | 4 +- .../ts-docs-gen/src/contracts/plugin-data.ts | 11 -- packages/ts-docs-gen/src/contracts/plugin.ts | 52 ++++++++ .../src/contracts/reference-tuple.ts | 4 - .../src/contracts/render-item-output-dto.ts | 11 -- .../ts-docs-gen/src/contracts/rendered-dto.ts | 7 - .../src/contracts/rendered-item.ts | 3 - .../contracts/supported-api-item-kind-type.ts | 7 - packages/ts-docs-gen/src/default-plugins.ts | 4 +- packages/ts-docs-gen/src/extractor-helpers.ts | 109 ---------------- packages/ts-docs-gen/src/file-manager.ts | 106 ++++++++-------- packages/ts-docs-gen/src/generator-helpers.ts | 120 +++++++++++++++++- packages/ts-docs-gen/src/generator.ts | 69 +++++----- .../src/plugins/api-default-plugin.ts | 37 ++++-- .../src/plugins/api-enum-plugin.ts | 38 +++--- .../src/plugins/api-namespace-plugin.ts | 92 ++++++++++++++ .../src/plugins/api-type-plugin.ts | 36 +++--- .../src/plugins/api-variable-plugin.ts | 36 +++--- .../src/registries/plugin-registry.ts | 13 +- 32 files changed, 498 insertions(+), 383 deletions(-) delete mode 100644 packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md create mode 100644 packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace.md create mode 100644 packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace/boonamespace2.md delete mode 100644 packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts delete mode 100644 packages/ts-docs-gen/src/abstractions/file-manager-base.ts create mode 100644 packages/ts-docs-gen/src/contracts/api-item-reference.ts create mode 100644 packages/ts-docs-gen/src/contracts/file-manager.ts delete mode 100644 packages/ts-docs-gen/src/contracts/file-output-dto.ts create mode 100644 packages/ts-docs-gen/src/contracts/file-result.ts delete mode 100644 packages/ts-docs-gen/src/contracts/plugin-data.ts create mode 100644 packages/ts-docs-gen/src/contracts/plugin.ts delete mode 100644 packages/ts-docs-gen/src/contracts/reference-tuple.ts delete mode 100644 packages/ts-docs-gen/src/contracts/render-item-output-dto.ts delete mode 100644 packages/ts-docs-gen/src/contracts/rendered-dto.ts delete mode 100644 packages/ts-docs-gen/src/contracts/rendered-item.ts delete mode 100644 packages/ts-docs-gen/src/contracts/supported-api-item-kind-type.ts delete mode 100644 packages/ts-docs-gen/src/extractor-helpers.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts diff --git a/packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md b/packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md deleted file mode 100644 index 7fe3fe2f..00000000 --- a/packages/ts-docs-gen/examples/simple/docs/api/exported-const-variables.md +++ /dev/null @@ -1,33 +0,0 @@ -# exported-const-variables - -## Kintamasis - -First const variable in the exported items. - -```ts -const Kintamasis: "Hello World!"; -``` - -### Type - -"Hello World!" - -## Kintamasis2 - -```ts -const Kintamasis2: "World, Hello!"; -``` - -### Type - -"World, Hello!" - -## Kintamasis3 - -```ts -const Kintamasis3: "Not imported!"; -``` - -### Type - -"Not imported!" diff --git a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md index 6b8e6e49..9f5ee535 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md @@ -1,5 +1,3 @@ -# exported-functions - ## function: Foo ## function: Bar diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index 9fc91565..781e8fb2 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,12 +1,13 @@ [EnumDeclaration-0]: index.md#uogos -# index - +[ModuleDeclaration-1]: index\boonamespace.md#boonamespace ## class: World ## Uogos Warning: Beta! +Deprecated! + Some information 2nd line of some information 3rd line of some information @@ -122,3 +123,8 @@ type Hello = Uogos; ### Type [Uogos][EnumDeclaration-0] + +# FooNamespace + +## [BooNamespace][ModuleDeclaration-1] + diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace.md b/packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace.md new file mode 100644 index 00000000..30f8cf31 --- /dev/null +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace.md @@ -0,0 +1,5 @@ +[ModuleDeclaration-2]: boonamespace\boonamespace2.md#boonamespace2 +# BooNamespace + +## [BooNamespace2][ModuleDeclaration-2] + diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace/boonamespace2.md b/packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace/boonamespace2.md new file mode 100644 index 00000000..42007d6d --- /dev/null +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/boonamespace/boonamespace2.md @@ -0,0 +1,12 @@ +# BooNamespace2 + +## Hello + +```typescript +const Hello: "World!"; +``` + +### Type + +"World!" + diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index ffc6f84e..49451dc1 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -173,3 +173,11 @@ export const enum ConstUogos { * @deprecated Use uogos instead ;) */ export type Hello = Uogos; + +export namespace FooNamespace { + export namespace BooNamespace { + export namespace BooNamespace2 { + export const Hello = "World!"; + } + } +} diff --git a/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts b/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts deleted file mode 100644 index 734aa81a..00000000 --- a/packages/ts-docs-gen/src/abstractions/api-item-plugin-base.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Contracts } from "ts-extractor"; - -import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; -import { SupportedApiItemKindType, ApiItemKindsAdditional } from "../contracts/supported-api-item-kind-type"; -import { PluginData } from "../contracts/plugin-data"; - -export abstract class ApiItemPluginBase { - // TODO: Clarify naming. - protected get SupportKind(): typeof Contracts.ApiItemKinds & typeof ApiItemKindsAdditional { - return Object.assign(Contracts.ApiItemKinds, ApiItemKindsAdditional); - } - - public abstract SupportedApiItemsKinds(): SupportedApiItemKindType[]; - - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } - - public abstract Render(data: PluginData): RenderItemOutputDto; -} diff --git a/packages/ts-docs-gen/src/abstractions/file-manager-base.ts b/packages/ts-docs-gen/src/abstractions/file-manager-base.ts deleted file mode 100644 index 95931b4e..00000000 --- a/packages/ts-docs-gen/src/abstractions/file-manager-base.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Contracts } from "ts-extractor"; -import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; -import { FileOutputDto } from "../contracts/file-output-dto"; - -export abstract class FileManagerBaseBase { - public abstract AddItem(entryFile: Contracts.ApiSourceFileDto, item: RenderItemOutputDto, referenceId: string): void; - - public abstract ToFilesOutput(): FileOutputDto[]; -} diff --git a/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts b/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts index 5098e2c0..f92bbeea 100644 --- a/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts +++ b/packages/ts-docs-gen/src/builders/generator-configuration-builder.ts @@ -2,8 +2,8 @@ import * as ts from "typescript"; import * as path from "path"; import { Extractor, GetCompilerOptions } from "ts-extractor"; -import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; import { GeneratorConfiguration, WorkingGeneratorConfiguration } from "../contracts/generator-configuration"; +import { Plugin } from "../contracts/plugin"; import { PluginRegistry } from "../registries/plugin-registry"; import { DefaultPlugins } from "../default-plugins"; @@ -44,7 +44,7 @@ export class GeneratorConfigurationBuilder { return this; } - public AddPlugins(plugins: ApiItemPluginBase[]): this { + public AddPlugins(plugins: Plugin[]): this { const currentPlugins = this.configuration.Plugins || []; this.configuration.Plugins = [...plugins, ...currentPlugins]; diff --git a/packages/ts-docs-gen/src/contracts/api-item-reference.ts b/packages/ts-docs-gen/src/contracts/api-item-reference.ts new file mode 100644 index 00000000..628a8231 --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/api-item-reference.ts @@ -0,0 +1,4 @@ +export interface ApiItemReference { + Id: string; + Alias: string; +} diff --git a/packages/ts-docs-gen/src/contracts/file-manager.ts b/packages/ts-docs-gen/src/contracts/file-manager.ts new file mode 100644 index 00000000..5caf6b4b --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/file-manager.ts @@ -0,0 +1,7 @@ +import { PluginResult } from "./plugin"; +import { FileResult } from "./file-result"; + +export interface FileManager { + AddItem(itemResult: PluginResult, filePath: string): void; + ToFilesOutput(): FileResult[]; +} diff --git a/packages/ts-docs-gen/src/contracts/file-output-dto.ts b/packages/ts-docs-gen/src/contracts/file-output-dto.ts deleted file mode 100644 index 6fde6c5d..00000000 --- a/packages/ts-docs-gen/src/contracts/file-output-dto.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface FileOutputDto { - FileLocation: string; - Output: string[]; -} diff --git a/packages/ts-docs-gen/src/contracts/file-result.ts b/packages/ts-docs-gen/src/contracts/file-result.ts new file mode 100644 index 00000000..a89583f4 --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/file-result.ts @@ -0,0 +1,4 @@ +export interface FileResult { + FileLocation: string; + Result: string[]; +} diff --git a/packages/ts-docs-gen/src/contracts/generator-configuration.ts b/packages/ts-docs-gen/src/contracts/generator-configuration.ts index 6c6b3152..e6a8a665 100644 --- a/packages/ts-docs-gen/src/contracts/generator-configuration.ts +++ b/packages/ts-docs-gen/src/contracts/generator-configuration.ts @@ -1,7 +1,7 @@ import { ExtractDto } from "ts-extractor"; -import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; import { PluginRegistry } from "../registries/plugin-registry"; +import { Plugin } from "./plugin"; export interface GeneratorConfiguration { OutputDirectory: string; @@ -12,7 +12,7 @@ export interface GeneratorConfiguration { export interface WorkingGeneratorConfiguration { OutputDirectory: string; ProjectDirectory: string; - Plugins: ApiItemPluginBase[]; + Plugins: Plugin[]; Exclude: string[]; OutputPathSeparator: string; diff --git a/packages/ts-docs-gen/src/contracts/plugin-data.ts b/packages/ts-docs-gen/src/contracts/plugin-data.ts deleted file mode 100644 index e3315a02..00000000 --- a/packages/ts-docs-gen/src/contracts/plugin-data.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Contracts, ExtractDto } from "ts-extractor"; - -import { ReferenceTuple } from "./reference-tuple"; -import { RenderItemOutputDto } from "./render-item-output-dto"; - -export interface PluginData { - Reference: ReferenceTuple; - ApiItem: TKind; - ExtractedData: ExtractDto; - GetItem(entryFile: Contracts.ApiSourceFileDto, reference: ReferenceTuple): RenderItemOutputDto; -} diff --git a/packages/ts-docs-gen/src/contracts/plugin.ts b/packages/ts-docs-gen/src/contracts/plugin.ts new file mode 100644 index 00000000..da7f3f7e --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/plugin.ts @@ -0,0 +1,52 @@ +import { Contracts, ExtractDto } from "ts-extractor"; + +import { ApiItemReference } from "./api-item-reference"; + +export enum ApiItemKindsAdditional { + Any = "any" +} + +export type SupportedApiItemKindType = Contracts.ApiItemKinds | ApiItemKindsAdditional; + +export interface PluginHeading { + Heading: string; + ApiItemId: string; +} + +export interface PluginMember { + Reference: ApiItemReference; + PluginResult: PluginResult; +} + +export type GetItemPluginResultHandler = (reference: ApiItemReference) => PluginResult; + +export interface PluginOptions { + Reference: ApiItemReference; + ApiItem: TKind; + ExtractedData: ExtractDto; + GetItemPluginResult: GetItemPluginResultHandler; +} + +export interface PluginResult { + Reference: ApiItemReference; + ApiItem: TKind; + /** + * All headings used in `Result` with ApiItemIds. + */ + Headings: PluginHeading[]; + /** + * References that were used in rendering `Result`. + */ + UsedReferences: string[]; + /** + * Plugin rendered result. + */ + Result: string[]; + Members?: PluginMember[]; +} + +export interface Plugin { + SupportedApiItemKinds(): SupportedApiItemKindType[]; + CheckApiItem(item: TKind): boolean; + Render(options: PluginOptions): PluginResult; +} diff --git a/packages/ts-docs-gen/src/contracts/reference-tuple.ts b/packages/ts-docs-gen/src/contracts/reference-tuple.ts deleted file mode 100644 index 857d01a2..00000000 --- a/packages/ts-docs-gen/src/contracts/reference-tuple.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * [referenceId, alias] - */ -export type ReferenceTuple = [string, string]; diff --git a/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts b/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts deleted file mode 100644 index ba62e2d1..00000000 --- a/packages/ts-docs-gen/src/contracts/render-item-output-dto.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Contracts } from "ts-extractor"; - -export interface RenderItemOutputDto { - References: string[]; - /** - * Heading is used for navigation in documentation. It should be the same in the render output. - */ - Heading: string; - RenderOutput: string[]; - ApiItem: Contracts.ApiItemDto; -} diff --git a/packages/ts-docs-gen/src/contracts/rendered-dto.ts b/packages/ts-docs-gen/src/contracts/rendered-dto.ts deleted file mode 100644 index c427656d..00000000 --- a/packages/ts-docs-gen/src/contracts/rendered-dto.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { RenderedItems } from "./rendered-item"; -import { Contracts } from "ts-extractor"; - -export interface RenderedDto { - RenderedItems: RenderedItems; - EntryFiles: Contracts.ApiSourceFileDto[]; -} diff --git a/packages/ts-docs-gen/src/contracts/rendered-item.ts b/packages/ts-docs-gen/src/contracts/rendered-item.ts deleted file mode 100644 index 4b071e90..00000000 --- a/packages/ts-docs-gen/src/contracts/rendered-item.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { RenderItemOutputDto } from "./render-item-output-dto"; - -export type RenderedItems = Map; diff --git a/packages/ts-docs-gen/src/contracts/supported-api-item-kind-type.ts b/packages/ts-docs-gen/src/contracts/supported-api-item-kind-type.ts deleted file mode 100644 index 727f55f4..00000000 --- a/packages/ts-docs-gen/src/contracts/supported-api-item-kind-type.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Contracts } from "ts-extractor"; - -export enum ApiItemKindsAdditional { - Any = "any" -} - -export type SupportedApiItemKindType = Contracts.ApiItemKinds | ApiItemKindsAdditional; diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index 02b7b9ea..d7761689 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -1,9 +1,11 @@ import { ApiVariablePlugin } from "./plugins/api-variable-plugin"; import { ApiEnumPlugin } from "./plugins/api-enum-plugin"; import { ApiTypePlugin } from "./plugins/api-type-plugin"; +import { ApiNamespacePlugin } from "./plugins/api-namespace-plugin"; export const DefaultPlugins = [ new ApiVariablePlugin(), new ApiEnumPlugin(), - new ApiTypePlugin() + new ApiTypePlugin(), + new ApiNamespacePlugin() ]; diff --git a/packages/ts-docs-gen/src/extractor-helpers.ts b/packages/ts-docs-gen/src/extractor-helpers.ts deleted file mode 100644 index f0198fc6..00000000 --- a/packages/ts-docs-gen/src/extractor-helpers.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { Contracts, ExtractDto } from "ts-extractor"; -import { ReferenceTuple } from "./contracts/reference-tuple"; - -export namespace ExtractorHelpers { - export function GetReferenceTuples( - extractedData: ExtractDto, - entryFile: Contracts.ApiSourceFileDto, - itemsReference: Contracts.ApiItemReferenceTuple - ): ReferenceTuple[] { - let list: ReferenceTuple[] = []; - - for (const [alias, references] of itemsReference) { - for (const referenceId of references) { - // Check if item is ExportSpecifier or ExportDeclaration. - const apiItem = extractedData.Registry[referenceId]; - - switch (apiItem.ApiKind) { - case Contracts.ApiItemKinds.Export: { - const referenceTuples = GetReferenceTuples(extractedData, entryFile, apiItem.Members); - list = list.concat(referenceTuples); - break; - } - case Contracts.ApiItemKinds.ExportSpecifier: { - if (apiItem.ApiItems == null) { - console.warn(`ApiItems are missing in "${apiItem.Name}"?`); - break; - } - const referenceTuples = GetReferenceTuples(extractedData, entryFile, [[apiItem.Name, apiItem.ApiItems]]); - list = list.concat(referenceTuples); - break; - } - default: { - list.push([referenceId, alias]); - } - } - } - } - - return list; - } - - export function ApiVariableToString(item: Contracts.ApiVariableDto, alias?: string): string { - const name = alias != null ? alias : item.Name; - - return `${item.VariableDeclarationType} ${name}: ${item.Type.Text};`; - } - - export function ReconstructEnumCode(alias: string, memberItems: Contracts.ApiEnumMemberDto[]): string[] { - // Constructing enum body. - const membersStrings = memberItems.map((memberItem, index, array) => { - // Add an enum name - let memberString = `${ExtractorHelpers.Tab()} ${memberItem.Name}`; - - // Add an enum member value if it exists. - if (memberItem.Value) { - memberString += ` = ${memberItem.Value}`; - } - - // Add a comma if current item is not the last item - if (index !== memberItems.length - 1) { - memberString += ","; - } - - return memberString; - }); - - // Construct enum code output - return [ - `enum ${alias} {`, - ...membersStrings, - "}" - ]; - } - - // TODO: reconsider location - const TAB_STRING = " "; - - export function Tab(size: number = 1): string { - let result: string = ""; - for (let i = 0; i < size; i++) { - result += TAB_STRING; - } - return result; - } - // --------------------------------------------------- - - export const DEFAULT_CODE_OPTIONS = { - lang: "typescript" - }; - - export function FixSentence(sentence: string, punctuationMark: string = "."): string { - const trimmedSentence = sentence.trim(); - const punctuationMarks = ".!:;,-"; - - const lastSymbol = trimmedSentence[trimmedSentence.length - 1]; - - if (punctuationMarks.indexOf(lastSymbol) !== -1) { - return trimmedSentence; - } - - return trimmedSentence + punctuationMark; - } - - export function ApiTypeToString(item: Contracts.ApiTypeDto, alias?: string): string { - const name = alias != null ? alias : item.Name; - - return `type ${name} = ${item.Type.Text};`; - } -} diff --git a/packages/ts-docs-gen/src/file-manager.ts b/packages/ts-docs-gen/src/file-manager.ts index d0c55974..e36df055 100644 --- a/packages/ts-docs-gen/src/file-manager.ts +++ b/packages/ts-docs-gen/src/file-manager.ts @@ -1,81 +1,81 @@ -import { Contracts } from "ts-extractor"; import { MarkdownGenerator } from "@simplrjs/markdown"; import * as path from "path"; -import { FileManagerBaseBase } from "./abstractions/file-manager-base"; -import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; -import { FileOutputDto } from "./contracts/file-output-dto"; +import { FileManager as FileManagerInterface } from "./contracts/file-manager"; import { Helpers } from "./utils/helpers"; +import { PluginResult } from "./contracts/plugin"; +import { FileResult } from "./contracts/file-result"; +import { GeneratorHelpers } from "./generator-helpers"; interface OutputData { - RenderOutput: string[]; + Result: string[]; + UsedReferences: string[]; } -type RenderedItem = Array; +type RenderedItemList = Array; -export class FileManager extends FileManagerBaseBase { - private filesList: Map = new Map(); +export class FileManager implements FileManagerInterface { + /** + * + */ + private filesList: Map = new Map(); + /** + * + */ private referenceToFile: Map = new Map(); - private fileHeader(entryFile: Contracts.ApiSourceFileDto): OutputData { - const heading = path.basename(entryFile.Name, path.extname(entryFile.Name)); - - const output: string[] = [ - MarkdownGenerator.Header(`${heading}`, 1) - ]; - - return { - RenderOutput: output - }; - } - - private getDefaultEntryFile(entryFile: Contracts.ApiSourceFileDto): RenderedItem { - return [ - this.fileHeader(entryFile) - ]; - } - - private renderItemIsItemOutputDto(item: RenderItemOutputDto | OutputData): item is RenderItemOutputDto { - return (item as RenderItemOutputDto).ApiItem != null; - } - - public AddItem(entryFile: Contracts.ApiSourceFileDto, item: RenderItemOutputDto, referenceId: string): void { - const fileName = path.basename(entryFile.Name, path.extname(entryFile.Name)) + ".md"; - const items = this.filesList.get(fileName) || this.getDefaultEntryFile(entryFile); - items.push(item); - - // Add reference link. - this.referenceToFile.set(referenceId, `${fileName}#${Helpers.HeadingToAnchor(item.Heading)}`); + public AddItem(itemResult: PluginResult, filePath: string): void { + const items = this.filesList.get(filePath) || []; + items.push(itemResult); + this.filesList.set(filePath, items); + // Adding headings. + for (const heading of itemResult.Headings) { + this.referenceToFile.set(heading.ApiItemId, `${filePath}#${Helpers.HeadingToAnchor(heading.Heading)}`); + } - this.filesList.set(fileName, items); + // HeadingsMap + if (itemResult.Members != null) { + for (const member of itemResult.Members) { + const baseName = path.basename(filePath, path.extname(filePath)); + const targetFileNPath = path.join( + path.dirname(filePath), + baseName, + member.PluginResult.ApiItem.Name + GeneratorHelpers.MARKDOWN_EXT + ).toLowerCase(); + + this.AddItem(member.PluginResult, targetFileNPath); + } + } } - public ToFilesOutput(): FileOutputDto[] { - const output: FileOutputDto[] = []; + public ToFilesOutput(): FileResult[] { + const files: FileResult[] = []; for (const [fileLocation, items] of this.filesList) { // Link definitions to file location. - const references: string[] = []; + const linkDefinitions: string[] = []; for (const item of items) { - if (this.renderItemIsItemOutputDto(item)) { - item.References - .forEach(referenceId => - references.push( - MarkdownGenerator.LinkDefinition(referenceId, this.referenceToFile.get(referenceId) || "#__error") - ) + item.UsedReferences + .forEach(referenceId => { + const filePath = path.dirname(fileLocation); + const resolvePath = path.relative(filePath, this.referenceToFile.get(referenceId) || "#__error"); + linkDefinitions.push( + MarkdownGenerator.LinkDefinition(referenceId, resolvePath) ); - } + }); } - output.push({ + const itemsResult = Helpers.Flatten(items.map(x => [x.Result, ""])); + + files.push({ FileLocation: fileLocation, - Output: [ - ...references, - ...Helpers.Flatten(items.map(x => [x.RenderOutput, ""])) + Result: [ + ...linkDefinitions, + ...itemsResult ] }); } - return output; + return files; } } diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 2173b10f..041d6dab 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -1,7 +1,18 @@ -import { Contracts } from "ts-extractor"; +import { Contracts, ExtractDto } from "ts-extractor"; import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; +import { ApiItemReference } from "./contracts/api-item-reference"; +import { ApiItemKindsAdditional } from "./contracts/plugin"; export namespace GeneratorHelpers { + export const MARKDOWN_EXT = ".md"; + + export const ApiItemKinds: typeof ApiItemKindsAdditional & typeof Contracts.ApiItemKinds = + Object.assign(ApiItemKindsAdditional, Contracts.ApiItemKinds); + + export function GetApiItemKinds(): typeof Contracts.ApiItemKinds & typeof ApiItemKindsAdditional { + return Object.assign(Contracts.ApiItemKinds, ApiItemKindsAdditional); + } + export interface TypeToStringDto { References: string[]; Text: string; @@ -103,4 +114,111 @@ export namespace GeneratorHelpers { return builder.GetOutput(); } + + export function GetApiItemReferences( + extractedData: ExtractDto, + itemsReference: Contracts.ApiItemReferenceTuple + ): ApiItemReference[] { + let list: ApiItemReference[] = []; + + for (const [alias, references] of itemsReference) { + for (const referenceId of references) { + // Check if item is ExportSpecifier or ExportDeclaration. + const apiItem = extractedData.Registry[referenceId]; + + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Export: { + const referenceTuples = GetApiItemReferences(extractedData, apiItem.Members); + list = list.concat(referenceTuples); + break; + } + case Contracts.ApiItemKinds.ExportSpecifier: { + if (apiItem.ApiItems == null) { + console.warn(`ApiItems are missing in "${apiItem.Name}"?`); + break; + } + const referenceTuples = GetApiItemReferences(extractedData, [[apiItem.Name, apiItem.ApiItems]]); + list = list.concat(referenceTuples); + break; + } + default: { + list.push({ + Id: referenceId, + Alias: alias + }); + } + } + } + } + + return list; + } + + export function ApiVariableToString(item: Contracts.ApiVariableDto, alias?: string): string { + const name = alias != null ? alias : item.Name; + + return `${item.VariableDeclarationType} ${name}: ${item.Type.Text};`; + } + + export function ReconstructEnumCode(alias: string, memberItems: Contracts.ApiEnumMemberDto[]): string[] { + // Constructing enum body. + const membersStrings = memberItems.map((memberItem, index, array) => { + // Add an enum name + let memberString = `${GeneratorHelpers.Tab()} ${memberItem.Name}`; + + // Add an enum member value if it exists. + if (memberItem.Value) { + memberString += ` = ${memberItem.Value}`; + } + + // Add a comma if current item is not the last item + if (index !== memberItems.length - 1) { + memberString += ","; + } + + return memberString; + }); + + // Construct enum code output + return [ + `enum ${alias} {`, + ...membersStrings, + "}" + ]; + } + + // TODO: reconsider location + const TAB_STRING = " "; + + export function Tab(size: number = 1): string { + let result: string = ""; + for (let i = 0; i < size; i++) { + result += TAB_STRING; + } + return result; + } + // --------------------------------------------------- + + export const DEFAULT_CODE_OPTIONS = { + lang: "typescript" + }; + + export function FixSentence(sentence: string, punctuationMark: string = "."): string { + const trimmedSentence = sentence.trim(); + const punctuationMarks = ".!:;,-"; + + const lastSymbol = trimmedSentence[trimmedSentence.length - 1]; + + if (punctuationMarks.indexOf(lastSymbol) !== -1) { + return trimmedSentence; + } + + return trimmedSentence + punctuationMark; + } + + export function ApiTypeToString(item: Contracts.ApiTypeDto, alias?: string): string { + const name = alias != null ? alias : item.Name; + + return `type ${name} = ${item.Type.Text};`; + } } diff --git a/packages/ts-docs-gen/src/generator.ts b/packages/ts-docs-gen/src/generator.ts index 35ffa6cd..617a0369 100644 --- a/packages/ts-docs-gen/src/generator.ts +++ b/packages/ts-docs-gen/src/generator.ts @@ -1,16 +1,15 @@ - import { Contracts } from "ts-extractor"; import * as path from "path"; import * as fs from "fs-extra"; import { GeneratorConfiguration } from "./contracts/generator-configuration"; import { FileManager } from "./file-manager"; -import { RenderItemOutputDto } from "./contracts/render-item-output-dto"; -import { ReferenceTuple } from "./contracts/reference-tuple"; import { ApiDefaultPlugin } from "./plugins/api-default-plugin"; -import { ExtractorHelpers } from "./extractor-helpers"; -import { FileOutputDto } from "./contracts/file-output-dto"; +import { ApiItemReference } from "./contracts/api-item-reference"; +import { PluginResult, PluginOptions, GetItemPluginResultHandler } from "./contracts/plugin"; +import { FileResult } from "./contracts/file-result"; +import { GeneratorHelpers } from "./generator-helpers"; export class Generator { constructor(private configuration: GeneratorConfiguration) { @@ -18,24 +17,29 @@ export class Generator { const { ExtractedData } = this.configuration; for (const entryFile of this.configuration.ExtractedData.EntryFiles) { - const referenceTuples = ExtractorHelpers.GetReferenceTuples(ExtractedData, entryFile, entryFile.Members); - - for (const reference of referenceTuples) { - const [referenceId] = reference; + const apiItemsReferences = GeneratorHelpers.GetApiItemReferences(ExtractedData, entryFile.Members); - const renderedItem = this.getRenderedItemByReference(entryFile, reference); - this.fileManager.AddItem(entryFile, renderedItem, referenceId); + for (const reference of apiItemsReferences) { + const renderedItem = this.getItemPluginResult(reference); + this.fileManager.AddItem(renderedItem, this.getFilePathFromEntryFile(entryFile)); } } this.outputData = this.fileManager.ToFilesOutput(); } - private renderedItems: Map = new Map(); + /** + * Reference check.... how Map Works here. + */ + private renderedItems: Map = new Map(); private fileManager: FileManager; - private outputData: FileOutputDto[]; + private outputData: FileResult[]; - public get OutputData(): ReadonlyArray { + private getFilePathFromEntryFile(entryFile: Contracts.ApiSourceFileDto): string { + return path.basename(entryFile.Name, path.extname(entryFile.Name)) + ".md"; + } + + public get OutputData(): ReadonlyArray { return this.outputData; } @@ -47,21 +51,20 @@ export class Generator { // Ensure output directory await fs.ensureDir(path.dirname(fullLocation)); // Output file - await fs.writeFile(fullLocation, item.Output.join("\n")); + await fs.writeFile(fullLocation, item.Result.join("\n")); } catch (error) { console.error(error); } } } - private getRenderedItemByReference = (entryFile: Contracts.ApiSourceFileDto, reference: ReferenceTuple): RenderItemOutputDto => { - const [referenceId] = reference; - const renderedItem = this.renderedItems.get(reference); + private getItemPluginResult: GetItemPluginResultHandler = (apiItemReference: ApiItemReference): PluginResult => { + const renderedItem = this.renderedItems.get(apiItemReference); if (renderedItem == null) { const { Registry } = this.configuration.ExtractedData; - const renderedData = this.renderApiItem(reference, entryFile, Registry[referenceId]); - this.renderedItems.set(reference, renderedData); + const renderedData = this.renderApiItem(apiItemReference, Registry[apiItemReference.Id]); + this.renderedItems.set(apiItemReference, renderedData); return renderedData; } @@ -70,29 +73,25 @@ export class Generator { } private renderApiItem( - reference: ReferenceTuple, - entryFile: Contracts.ApiSourceFileDto, + apiItemReference: ApiItemReference, apiItem: Contracts.ApiItemDto - ): RenderItemOutputDto { + ): PluginResult { const plugins = this.configuration.PluginManager.GetPluginsByKind(apiItem.ApiKind); + const pluginOptions: PluginOptions = { + ExtractedData: this.configuration.ExtractedData, + Reference: apiItemReference, + ApiItem: apiItem, + GetItemPluginResult: this.getItemPluginResult + }; + for (const plugin of plugins) { if (plugin.CheckApiItem(apiItem)) { - return plugin.Render({ - ExtractedData: this.configuration.ExtractedData, - Reference: reference, - ApiItem: apiItem, - GetItem: this.getRenderedItemByReference - }); + return plugin.Render(pluginOptions); } } const defaultPlugin = new ApiDefaultPlugin(); - return defaultPlugin.Render({ - ExtractedData: this.configuration.ExtractedData, - Reference: reference, - ApiItem: apiItem, - GetItem: this.getRenderedItemByReference - }); + return defaultPlugin.Render(pluginOptions); } } diff --git a/packages/ts-docs-gen/src/plugins/api-default-plugin.ts b/packages/ts-docs-gen/src/plugins/api-default-plugin.ts index 93001e90..484584a7 100644 --- a/packages/ts-docs-gen/src/plugins/api-default-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-default-plugin.ts @@ -1,27 +1,36 @@ +import { Contracts } from "ts-extractor"; import { MarkdownGenerator } from "@simplrjs/markdown"; +import { Plugin, PluginOptions, PluginResult, SupportedApiItemKindType, PluginHeading } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; -import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; -import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; -import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; -import { PluginData } from "../contracts/plugin-data"; +export class ApiDefaultPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Any]; + } -export class ApiDefaultPlugin extends ApiItemPluginBase { - public SupportedApiItemsKinds(): SupportedApiItemKindType[] { - return [this.SupportKind.Any]; + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; } - public Render(data: PluginData): RenderItemOutputDto { - const [, alias] = data.Reference; - const heading = `${data.ApiItem.ApiKind}: ${alias}`; - const output: string[] = [ + public Render(data: PluginOptions): PluginResult { + const heading = `${data.ApiItem.ApiKind}: ${data.Reference.Alias}`; + const headings: PluginHeading[] = [ + { + ApiItemId: data.Reference.Id, + Heading: heading + } + ]; + + const result: string[] = [ MarkdownGenerator.Header(heading, 2) ]; return { - Heading: heading, ApiItem: data.ApiItem, - References: [], - RenderOutput: output + Reference: data.Reference, + Headings: headings, + UsedReferences: [], + Result: result, }; } } diff --git a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts index 015d5b47..7debeea3 100644 --- a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts @@ -1,17 +1,17 @@ import { Contracts, ExtractDto } from "ts-extractor"; import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; -import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; -import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; -import { PluginData } from "../contracts/plugin-data"; -import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; -import { ExtractorHelpers } from "../extractor-helpers"; import { GeneratorHelpers } from "../generator-helpers"; +import { Plugin, SupportedApiItemKindType, PluginResult, PluginOptions, PluginHeading } from "../contracts/plugin"; // TODO: const enums implementation. -export class ApiEnumPlugin extends ApiItemPluginBase { - public SupportedApiItemsKinds(): SupportedApiItemKindType[] { - return [this.SupportKind.Enum]; +export class ApiEnumPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Enum]; + } + + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; } private constructEnumTable(members: Contracts.ApiEnumMemberDto[]): string[] { @@ -39,23 +39,31 @@ export class ApiEnumPlugin extends ApiItemPluginBase { return apiItems; } - public Render(data: PluginData): RenderItemOutputDto { - const [, alias] = data.Reference; + public Render(data: PluginOptions): PluginResult { + const heading: string = data.Reference.Alias; + const headings: PluginHeading[] = [ + { + ApiItemId: data.Reference.Id, + Heading: heading + } + ]; + const enumMembers = this.getEnumMembers(data.ApiItem.Members, data.ExtractedData); const builder = new MarkdownBuilder() - .Header(alias, 2) + .Header(heading, 2) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) .EmptyLine() - .Code(ExtractorHelpers.ReconstructEnumCode(alias, enumMembers), ExtractorHelpers.DEFAULT_CODE_OPTIONS) + .Code(GeneratorHelpers.ReconstructEnumCode(data.Reference.Alias, enumMembers), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() .Text(this.constructEnumTable(enumMembers)); return { - Heading: alias, ApiItem: data.ApiItem, - References: [], - RenderOutput: builder.GetOutput() + Reference: data.Reference, + Headings: headings, + UsedReferences: [], + Result: builder.GetOutput() }; } } diff --git a/packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts b/packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts new file mode 100644 index 00000000..056316c2 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts @@ -0,0 +1,92 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +import { GeneratorHelpers } from "../generator-helpers"; +import { PluginMember, Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; + +interface RenderItems { + References: string[]; + Output: string[]; + Members: PluginMember[]; +} + +export class ApiNamespacePlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Namespace]; + } + + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + private renderItems(data: PluginOptions): RenderItems { + const references = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); + const referencesList: string[] = []; + const members: PluginMember[] = []; + const builder = new MarkdownBuilder(); + + for (const reference of references) { + const apiItem = data.ExtractedData.Registry[reference.Id]; + + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Namespace: + case Contracts.ApiItemKinds.Class: { + + const renderedItem = data.GetItemPluginResult(reference); + members.push({ + Reference: reference, + PluginResult: renderedItem + }); + + builder + .Text(md => md.Header(md.Link(renderedItem.ApiItem.Name, reference.Id, true), 2)) + .EmptyLine(); + referencesList.push(reference.Id); + break; + } + default: { + const renderedItem = data.GetItemPluginResult(reference); + // Something to do with heading. Maybe heading reference registry? + builder + .Text(renderedItem.Result) + .EmptyLine(); + } + } + } + + return { + References: referencesList, + Output: builder.GetOutput(), + Members: members + }; + } + + public Render(data: PluginOptions): PluginResult { + const heading = data.Reference.Alias; + const headings: PluginHeading[] = [ + { + Heading: heading, + ApiItemId: data.Reference.Id + } + ]; + + const renderedItems = this.renderItems(data); + const references: string[] = renderedItems.References; + + // Header + const builder = new MarkdownBuilder() + .Header(heading, 1) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Text(renderedItems.Output); + + return { + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: headings, + UsedReferences: references, + Result: builder.GetOutput(), + Members: renderedItems.Members + }; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-type-plugin.ts b/packages/ts-docs-gen/src/plugins/api-type-plugin.ts index 7709a1c7..bd652f03 100644 --- a/packages/ts-docs-gen/src/plugins/api-type-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-type-plugin.ts @@ -1,21 +1,26 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; -import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; -import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; -import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; -import { PluginData } from "../contracts/plugin-data"; -import { ExtractorHelpers } from "../extractor-helpers"; import { GeneratorHelpers } from "../generator-helpers"; +import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; -export class ApiTypePlugin extends ApiItemPluginBase { - public SupportedApiItemsKinds(): SupportedApiItemKindType[] { - return [this.SupportKind.Type]; +export class ApiTypePlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Type]; } - public Render(data: PluginData): RenderItemOutputDto { - const [, alias] = data.Reference; - const heading = alias; + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + public Render(data: PluginOptions): PluginResult { + const heading = data.Reference.Alias; + const headings: PluginHeading[] = [ + { + Heading: heading, + ApiItemId: data.Reference.Id + } + ]; const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); // Header @@ -23,17 +28,18 @@ export class ApiTypePlugin extends ApiItemPluginBase { .Header(heading, 2) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(ExtractorHelpers.ApiTypeToString(data.ApiItem), ExtractorHelpers.DEFAULT_CODE_OPTIONS) + .Code(GeneratorHelpers.ApiTypeToString(data.ApiItem), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() .Header("Type", 3) .EmptyLine() .Text(typeStringDto.Text); return { - Heading: heading, ApiItem: data.ApiItem, - References: typeStringDto.References, - RenderOutput: builder.GetOutput() + Reference: data.Reference, + Headings: headings, + UsedReferences: typeStringDto.References, + Result: builder.GetOutput() }; } } diff --git a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts index 095ed0a5..d2757500 100644 --- a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts @@ -1,38 +1,44 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; -import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; -import { SupportedApiItemKindType } from "../contracts/supported-api-item-kind-type"; -import { RenderItemOutputDto } from "../contracts/render-item-output-dto"; -import { PluginData } from "../contracts/plugin-data"; -import { ExtractorHelpers } from "../extractor-helpers"; import { GeneratorHelpers } from "../generator-helpers"; +import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; -export class ApiVariablePlugin extends ApiItemPluginBase { - public SupportedApiItemsKinds(): SupportedApiItemKindType[] { - return [this.SupportKind.Variable]; +export class ApiVariablePlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Variable]; } - public Render(data: PluginData): RenderItemOutputDto { - const [, alias] = data.Reference; - const heading = alias; + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + public Render(data: PluginOptions): PluginResult { + const heading = data.Reference.Alias; + const headings: PluginHeading[] = [ + { + Heading: heading, + ApiItemId: data.Reference.Id + } + ]; const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); const builder = new MarkdownBuilder() .Header(heading, 2) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(ExtractorHelpers.ApiVariableToString(data.ApiItem), ExtractorHelpers.DEFAULT_CODE_OPTIONS) + .Code(GeneratorHelpers.ApiVariableToString(data.ApiItem), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() .Header("Type", 3) .EmptyLine() .Text(typeStringDto.Text); return { - Heading: heading, ApiItem: data.ApiItem, - References: typeStringDto.References, - RenderOutput: builder.GetOutput() + Reference: data.Reference, + Headings: headings, + Result: builder.GetOutput(), + UsedReferences: typeStringDto.References }; } } diff --git a/packages/ts-docs-gen/src/registries/plugin-registry.ts b/packages/ts-docs-gen/src/registries/plugin-registry.ts index 4fed79da..3f8e203b 100644 --- a/packages/ts-docs-gen/src/registries/plugin-registry.ts +++ b/packages/ts-docs-gen/src/registries/plugin-registry.ts @@ -1,9 +1,6 @@ import { Contracts } from "ts-extractor"; +import { Plugin, SupportedApiItemKindType, ApiItemKindsAdditional } from "../contracts/plugin"; -import { ApiItemPluginBase } from "../abstractions/api-item-plugin-base"; -import { SupportedApiItemKindType, ApiItemKindsAdditional } from "../contracts/supported-api-item-kind-type"; - -// TODO: Rename to PluginRegistry. export class PluginRegistry { constructor() { @@ -13,14 +10,14 @@ export class PluginRegistry { } } - private registeredPlugins: Map = new Map(); + private registeredPlugins: Map = new Map(); private isSupportedKindsHasAny(kinds: SupportedApiItemKindType[]): kinds is ApiItemKindsAdditional[] { return Boolean(kinds.find(x => x === ApiItemKindsAdditional.Any)); } - public Register(plugin: ApiItemPluginBase): void { - const supportedKinds = plugin.SupportedApiItemsKinds(); + public Register(plugin: Plugin): void { + const supportedKinds = plugin.SupportedApiItemKinds(); if (this.isSupportedKindsHasAny(supportedKinds)) { for (const [key, value] of this.registeredPlugins) { @@ -36,7 +33,7 @@ export class PluginRegistry { } } - public GetPluginsByKind(kind: Contracts.ApiItemKinds): ApiItemPluginBase[] { + public GetPluginsByKind(kind: Contracts.ApiItemKinds): Plugin[] { return this.registeredPlugins.get(kind) || []; } } From 91dee16c7c700c09e564744f839f28c8ef7622d6 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 21 Dec 2017 17:32:30 +0200 Subject: [PATCH 53/61] Feature: function plugin (#8) --- .gitignore | 4 +- common/config/rush/npm-shrinkwrap.json | 86 +++--- .../simple/docs/api/exported-functions.md | 22 +- .../examples/simple/docs/api/index.md | 130 +------- packages/ts-docs-gen/examples/simple/index.ts | 189 +++++++----- packages/ts-docs-gen/package.json | 2 +- packages/ts-docs-gen/src/default-plugins.ts | 2 + packages/ts-docs-gen/src/file-manager.ts | 10 +- packages/ts-docs-gen/src/generator-helpers.ts | 110 ++++++- .../src/plugins/api-enum-plugin.ts | 25 +- .../src/plugins/api-function-plugin.ts | 170 ++++++++++ .../simple-project-1.test.ts.snap | 290 +++++++++++++++++- .../simple-project-2.test.ts.snap | 10 +- .../tests/cases/simple-project-1/index.ts | 96 ++++++ 14 files changed, 857 insertions(+), 289 deletions(-) create mode 100644 packages/ts-docs-gen/src/plugins/api-function-plugin.ts diff --git a/.gitignore b/.gitignore index 4f108f96..ccdfc1e3 100644 --- a/.gitignore +++ b/.gitignore @@ -292,5 +292,5 @@ coverage package-deps.json # Tests -*/__tests__/* -!*/__tests__/**/__snapshots__ +**/tests/cases/__tests__/*.test.ts + diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index 285b9fda..e5fe5a84 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -6,9 +6,9 @@ "dependencies": { "@rush-temp/test-generator-cli": { "version": "file:projects/test-generator-cli.tgz", - "integrity": "sha1-7hRxKrHs2nw/Tg3difiN7wlLcpI=", + "integrity": "sha1-poL86JfifvnYdj6kO8BwW/R5VEA=", "requires": { - "@types/fs-extra": "4.0.6", + "@types/fs-extra": "4.0.7", "@types/handlebars": "4.0.36", "@types/yargs": "10.0.0", "fast-glob": "1.0.1", @@ -23,12 +23,12 @@ }, "@rush-temp/ts-docs-gen": { "version": "file:projects/ts-docs-gen.tgz", - "integrity": "sha1-q5PE2Czi6RYJoEbNl8S7rSkODP4=", + "integrity": "sha1-IIM5lH+f0v1NDXEIhk/erutcOrQ=", "requires": { - "@simplrjs/markdown": "1.0.1", - "@types/fs-extra": "4.0.6", - "@types/jest": "21.1.8", - "@types/sinon": "4.1.1", + "@simplrjs/markdown": "1.0.3", + "@types/fs-extra": "4.0.7", + "@types/jest": "21.1.9", + "@types/sinon": "4.1.2", "fast-glob": "1.0.1", "fs-extra": "4.0.3", "jest": "21.2.1", @@ -42,20 +42,20 @@ } }, "@simplrjs/markdown": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.1.tgz", - "integrity": "sha512-5cRr5I/CVRwo8bLJOmui8Jf9iwXgVcr81+9rO93IyLutm5GBrkSA8ZSwzovVuWlgA36sml9Dklrl1xP4GQEurA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.3.tgz", + "integrity": "sha512-QkC79ttUek7d9w1yysaETZnsD7WO7JOLCbAIX8kCAeZhMY/21ZRULWjb3Pl7SBm6QqqYTOnKl8rvikmbVaGtLA==", "requires": { "@types/string": "0.0.29", "string": "3.3.3" } }, "@types/fs-extra": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.6.tgz", - "integrity": "sha512-SVQDcOe1t7qSRzJFjkMx4V/0hc3TcGX/f51Dxx3Q/rpeg7nvFiort6QJTpJATOZH/YqhzJ1xt0qjvotxOJiCkQ==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.7.tgz", + "integrity": "sha512-BN48b/2F3kL0Ual7tjcHjj0Fl+nuYKtHa0G/xT3Q43HuCpN7rQD5vIx6Aqnl9x10oBI5xMJh8Ly+FQpP205JlA==", "requires": { - "@types/node": "8.0.58" + "@types/node": "8.5.2" } }, "@types/handlebars": { @@ -64,19 +64,19 @@ "integrity": "sha512-LjNiTX7TY7wtuC6y3QwC93hKMuqYhgV9A1uXBKNvZtVC8ZvyWAjZkJ5BvT0K7RKqORRYRLMrqCxpw5RgS+MdrQ==" }, "@types/jest": { - "version": "21.1.8", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.8.tgz", - "integrity": "sha512-hQbL8aBM/g5S++sM1gb4yC73Dg+FK3uYE+Ioht1RPy629+LV/RmH6q+e+jbQEwKJdWAP/YE4s67CPO+ElkMivg==" + "version": "21.1.9", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.9.tgz", + "integrity": "sha512-81wGgp3KLAhcrDQBeGADeuH1SvOmgZty5XF/mdPBOSxjEgAT9rcLr4CQCk2cRRjZE8vzmx7S1SPL6D/Z8OOR6A==" }, "@types/node": { - "version": "8.0.58", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.58.tgz", - "integrity": "sha512-V746iUU7eHNdzQipoACuguDlVhC7IHK8CES1jSkuFt352wwA84BCWPXaGekBd7R5XdNK5ReHONDVKxlL9IreAw==" + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.2.tgz", + "integrity": "sha512-KA4GKOpgXnrqEH2eCVhiv2CsxgXGQJgV1X0vsGlh+WCnxbeAE1GT44ZsTU1IN5dEeV/gDupKa7gWo08V5IxWVQ==" }, "@types/sinon": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.1.1.tgz", - "integrity": "sha512-4TaA0fxqXNhx8ph+cylpN/hBrkxru0LviHlfZU6Yljl6ztUL7enUFnJ3XMYruSsyycnZgfGqOiw1kiynKlXLNw==" + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.1.2.tgz", + "integrity": "sha512-fL6bJHYRzbw/7ofbKiJ65SOAasoe5mZhHNSYKxWsF3sGl/arhRwDPwXJqM1xofKNTQD14HNX9VruicM7pm++mQ==" }, "@types/string": { "version": "0.0.29", @@ -107,9 +107,9 @@ } }, "ajv": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.1.tgz", - "integrity": "sha1-s4u4h22ehr7plJVqBOch6IskjrI=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "requires": { "co": "4.6.0", "fast-deep-equal": "1.0.0", @@ -299,6 +299,11 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, "astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -1525,7 +1530,7 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "ajv": "5.5.1", + "ajv": "5.5.2", "har-schema": "2.0.0" } }, @@ -4024,14 +4029,15 @@ "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "requires": { - "extend-shallow": "3.0.1" + "extend-shallow": "3.0.2" }, "dependencies": { "extend-shallow": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.1.tgz", - "integrity": "sha512-Fg1xXAv+qXKdwHiJFMcZSqsMcbPlkzsZtf8KkLJ2fqnP+lqg2RjEKgDcSfO9CO1+p4LZKgApDBUUUqKaaRhwZQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "requires": { + "assign-symbols": "1.0.0", "is-extendable": "1.0.1" } }, @@ -4411,7 +4417,7 @@ "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-2.0.0.tgz", "integrity": "sha512-snSSnVkhc/jDo0ppJa8t3/aIbMcI3qg6HsB/iC0UdG+5KzAKHGQBuM5QwaFng6O7KKbk/Ljb8RgwN5uwd1DYHA==", "requires": { - "@types/fs-extra": "4.0.6", + "@types/fs-extra": "4.0.7", "fs-extra": "4.0.3", "read-package-json": "2.0.12", "simplr-logger": "1.0.1", @@ -4470,13 +4476,13 @@ "resolve": "1.5.0", "semver": "5.4.1", "tslib": "1.8.1", - "tsutils": "2.13.0" + "tsutils": "2.13.1" } }, "tsutils": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.13.0.tgz", - "integrity": "sha512-FuWzNJbMsp3gcZMbI3b5DomhW4Ia41vMxjN63nKWI0t7f+I3UmHfRl0TrXJTwI2LUduDG+eR1Mksp3pvtlyCFQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.13.1.tgz", + "integrity": "sha512-XMOEvc2TiYesVSOJMI7OYPnBMSgcvERuGW5Li/J+2A0TuH607BPQnOLQ82oSPZCssB8c9+QGi6qhTBa/f1xQRA==", "requires": { "tslib": "1.8.1" } @@ -4793,13 +4799,13 @@ "string-width": "2.1.1", "which-module": "2.0.0", "y18n": "3.2.1", - "yargs-parser": "8.0.0" + "yargs-parser": "8.1.0" } }, "yargs-parser": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", - "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", + "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", "requires": { "camelcase": "4.1.0" } diff --git a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md index 9f5ee535..848a1922 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md @@ -1,3 +1,21 @@ -## function: Foo +## Foo() + +```typescript +function Foo(): string +``` + +### Return type + +string + + +## Bar() + +```typescript +function Bar(): string +``` + +### Return type + +string -## function: Bar diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index 781e8fb2..af7b4273 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,130 +1,16 @@ -[EnumDeclaration-0]: index.md#uogos -[ModuleDeclaration-1]: index\boonamespace.md#boonamespace -## class: World - -## Uogos - -Warning: Beta! - -Deprecated! - -Some information -2nd line of some information -3rd line of some information -4th line of some information -5th line of some information - -> Some summary about this package version. - - -```typescript -enum Uogos { - Jokie = "jokie", - Braskes = "braskes" -} -``` - -| Name | Value | -| ------- | --------- | -| Jokie | "jokie" | -| Braskes | "braskes" | - -## Skaiciai - - -```typescript -enum Skaiciai { - Nulis = 0, - Vienas = 1, - Du = 2 -} -``` - -| Name | Value | -| ------ | ----- | -| Nulis | 0 | -| Vienas | 1 | -| Du | 2 | - -## Sarasas - - -```typescript -enum Sarasas { - Pirmas = 0, - Antras = 1, - Trecias = 2 -} -``` - -| Name | Value | Description | -| ------- | ----- | --------------------- | -| Pirmas | 0 | Pirmo description'as | -| Antras | 1 | Antro description'as | -| Trecias | 2 | Trečio description'as | - -## ConstSkaiciai - - -```typescript -enum ConstSkaiciai { - PirmasC = 0, - AntrasC = 1, - TreciasC = 2 -} -``` - -| Name | Value | -| -------- | ----- | -| PirmasC | 0 | -| AntrasC | 1 | -| TreciasC | 2 | - -## ConstSarasas - - -```typescript -enum ConstSarasas { - PirmasC = 0, - AntrasC = 1, - TreciasC = 2 -} -``` - -| Name | Value | Description | -| -------- | ----- | --------------------- | -| PirmasC | 0 | Pirmo description'as | -| AntrasC | 1 | Antro description'as | -| TreciasC | 2 | Trečio description'as | - -## ConstUogos - - -```typescript -enum ConstUogos { - Jokie = "jokie", - Braskes = "braskes" -} -``` - -| Name | Value | -| ------- | --------- | -| Jokie | "jokie" | -| Braskes | "braskes" | - -## Hello - -Deprecated: Use uogos instead ;)! +## MyFunction() ```typescript -type Hello = Uogos; +function MyFunction(): T ``` -### Type +### Type parameters -[Uogos][EnumDeclaration-0] +| Name | Constraint type | Default type | +| ---- | -------------------------------------------------------------- | ------------------------- | +| T | \{ myProperty: string; myPropertyTwo?: number \| undefined; \} | \{ myProperty: string; \} | -# FooNamespace +### Return type -## [BooNamespace][ModuleDeclaration-1] +T diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index 49451dc1..0e7421ba 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -2,21 +2,59 @@ // import { Foo } from "./exported-functions"; -export class World { } +// export class World { } +// export class Earth { } // export class Earth { } // export declare const Hello: World & Earth; // export const FooFunc = Foo; +//--------------------------------------------------------- + + +// #region Parameters + +// #endregion Parameters + // export function Foo(): string { // return "foo"; // } -// export function Bar(): string { +// /** +// * Some general comment about Bar function. +// * +// * @beta Some comment on beta. +// * @deprecated +// */ +// export function Bar(parameter1: string, parameter2: number): string { // return "bar"; // } +// #region Return types +// export function FunctionWithoutReturnType>(parameter1: string, parameter2: Promise) { +// return "bar"; +// } + +// export function FunctionWithGenericReturnType(): Array { +// return []; +// } + +// export function FunctionWithPrimitiveReturnType(): boolean { +// return true; +// } + +// export function FunctionWithUnionReturnType(): "something" | "nothing" { +// return "nothing"; +// } + +// export function FunctionWithIntersectionReturnType(): Earth & World { +// return {}; +// } +// #endregion Return types + +// ------------------------------------------------------ + // export * from "./exported-functions"; // export { Kintamasis as Pakeistas } from "./exported-const-variables"; // export type A = number & { ok(): TValue }; @@ -41,11 +79,11 @@ export class World { } // anotherProperty: number; // } -// export function Funkcija(): T { -// return { -// myProperty: "asd" -// } as T; -// } +export function MyFunction(): T { + return { + myProperty: "sampleString" + } as T; +} // export interface MyInterface { // (param1: TValue, param2: TValue): boolean; @@ -71,68 +109,63 @@ export class World { } // export const name = "some-kind-of-module"; // } -/** - * Some information - * 2nd line of some information - * 3rd line of some information - * 4th line of some information - * 5th line of some information - * @summary Some summary about this package version. - * @summary 2nd of some summary about this package version. - * @deprecated - * @beta - */ -export enum Uogos { - Jokie = "jokie", - Braskes = "braskes" -} - -export enum Skaiciai { - Nulis = 0, - Vienas = 1, - Du = 2 -} +// /** +// * Some information +// * 2nd line of some information +// * 3rd line of some information +// * 4th line of some information +// * 5th line of some information +// * @summary Some summary about this package version. +// * @summary 2nd of some summary about this package version. +// * @deprecated +// * @beta +// */ +// export enum Uogos { +// Jokie = "jokie", +// Braskes = "braskes" +// } -export enum Sarasas { - /** - * Pirmo description'as - */ - Pirmas, - /** - * Antro description'as - */ - Antras, - /** - * Trečio description'as - */ - Trecias -} +// export enum Skaiciai { +// Nulis = 0, +// Vienas = 1, +// Du = 2 +// } -export const enum ConstSkaiciai { - PirmasC = 0, - AntrasC = 1, - TreciasC = 2 -} +// export enum Sarasas { +// /** +// * Pirmo description'as +// */ +// Pirmas, +// /** +// * Antro description'as +// */ +// Antras, +// /** +// * Trečio description'as +// */ +// Trecias +// } -export const enum ConstSarasas { - /** - * Pirmo description'as - */ - PirmasC, - /** - * Antro description'as - */ - AntrasC, - /** - * Trečio description'as - */ - TreciasC -} +// export const enum ConstSkaiciai { +// PirmasC = 0, +// AntrasC = 1, +// TreciasC = 2 +// } -export const enum ConstUogos { - Jokie = "jokie", - Braskes = "braskes" -} +// export const enum ConstSarasas { +// /** +// * Pirmo description'as +// */ +// PirmasC, +// /** +// * Antro description'as +// */ +// AntrasC, +// /** +// * Trečio description'as +// */ +// TreciasC +// } // export interface Boo { // Boos: string[]; @@ -144,10 +177,6 @@ export const enum ConstUogos { // Type: TType; // } -// export async function GetFoo(): Promise { -// return; -// } - // export interface Bar extends Foo, Boo { // OtherStuff: string[]; // } @@ -169,15 +198,15 @@ export const enum ConstUogos { // public abstract Bar(): string; // } -/** - * @deprecated Use uogos instead ;) - */ -export type Hello = Uogos; +// /** +// * @deprecated Use uogos instead ;) +// */ +// export type Hello = Uogos; -export namespace FooNamespace { - export namespace BooNamespace { - export namespace BooNamespace2 { - export const Hello = "World!"; - } - } -} +// export namespace FooNamespace { +// export namespace BooNamespace { +// export namespace BooNamespace2 { +// export const Hello = "World!"; +// } +// } +// } diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index 0647a35c..32048ed8 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -15,7 +15,7 @@ "engine": "node >= 7.5.0", "author": "simplrjs (https://github.com/simplrjs)", "dependencies": { - "@simplrjs/markdown": "^1.0.1", + "@simplrjs/markdown": "^1.0.3", "@types/fs-extra": "^4.0.5", "fast-glob": "^1.0.1", "fs-extra": "^4.0.3", diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index d7761689..38f555a7 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -1,11 +1,13 @@ import { ApiVariablePlugin } from "./plugins/api-variable-plugin"; import { ApiEnumPlugin } from "./plugins/api-enum-plugin"; +import { ApiFunctionPlugin } from "./plugins/api-function-plugin"; import { ApiTypePlugin } from "./plugins/api-type-plugin"; import { ApiNamespacePlugin } from "./plugins/api-namespace-plugin"; export const DefaultPlugins = [ new ApiVariablePlugin(), new ApiEnumPlugin(), + new ApiFunctionPlugin(), new ApiTypePlugin(), new ApiNamespacePlugin() ]; diff --git a/packages/ts-docs-gen/src/file-manager.ts b/packages/ts-docs-gen/src/file-manager.ts index e36df055..fce83990 100644 --- a/packages/ts-docs-gen/src/file-manager.ts +++ b/packages/ts-docs-gen/src/file-manager.ts @@ -55,13 +55,21 @@ export class FileManager implements FileManagerInterface { // Link definitions to file location. const linkDefinitions: string[] = []; for (const item of items) { + item.UsedReferences .forEach(referenceId => { const filePath = path.dirname(fileLocation); - const resolvePath = path.relative(filePath, this.referenceToFile.get(referenceId) || "#__error"); + + const referenceString = this.referenceToFile.get(referenceId); + const resolvePath = path.relative(filePath, referenceString || "#__error"); + linkDefinitions.push( MarkdownGenerator.LinkDefinition(referenceId, resolvePath) ); + + if (!referenceString) { + console.warn(`Reference "${referenceId}" not found. Check ${fileLocation}.`); + } }); } diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 041d6dab..9026d5cf 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -1,9 +1,17 @@ +import * as ts from "typescript"; import { Contracts, ExtractDto } from "ts-extractor"; -import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; +import { MarkdownGenerator, MarkdownBuilder, Contracts as MarkdownContracts } from "@simplrjs/markdown"; import { ApiItemReference } from "./contracts/api-item-reference"; import { ApiItemKindsAdditional } from "./contracts/plugin"; export namespace GeneratorHelpers { + export type TypeToStringDto = ReferenceDto; + + export interface ReferenceDto { + References: string[]; + Text: T; + } + export const MARKDOWN_EXT = ".md"; export const ApiItemKinds: typeof ApiItemKindsAdditional & typeof Contracts.ApiItemKinds = @@ -13,11 +21,12 @@ export namespace GeneratorHelpers { return Object.assign(Contracts.ApiItemKinds, ApiItemKindsAdditional); } - export interface TypeToStringDto { - References: string[]; - Text: string; + // TODO: reexport InternalSymbolName in ts-extractor. + export function IsTypeScriptInternalSymbolName(name: string): boolean { + return Object.values(ts.InternalSymbolName).indexOf(name) !== -1; } + // TODO: implement type literal and function type. export function TypeDtoToMarkdownString(type: Contracts.TypeDto): TypeToStringDto { let references: string[] = []; let text: string = ""; @@ -57,11 +66,16 @@ export namespace GeneratorHelpers { } // Basic type with reference. - if (type.ReferenceId != null) { - text = MarkdownGenerator.Link(type.Name || type.Text, type.ReferenceId, true); - references.push(type.ReferenceId); + if (type.Name == null || IsTypeScriptInternalSymbolName(type.Name)) { + text = type.Text; } else { - text = type.Name || type.Text; + // FIXME: do not use flag string. Exclude Type parameters references. + if (type.ReferenceId != null && type.FlagsString !== "TypeParameter") { + text = MarkdownGenerator.Link(type.Name || type.Text, type.ReferenceId, true); + references.push(type.ReferenceId); + } else { + text = type.Name; + } } } } @@ -203,6 +217,10 @@ export namespace GeneratorHelpers { lang: "typescript" }; + export const DEFAULT_TABLE_OPTIONS: MarkdownContracts.TableOptions = { + removeColumnIfEmpty: true + }; + export function FixSentence(sentence: string, punctuationMark: string = "."): string { const trimmedSentence = sentence.trim(); const punctuationMarks = ".!:;,-"; @@ -221,4 +239,80 @@ export namespace GeneratorHelpers { return `type ${name} = ${item.Type.Text};`; } + + /** + * From ApiFunction to build function head. + * + * Return example: `function foo(arg: TValue): void` + */ + export function ApiFunctionToString( + apiItem: Contracts.ApiFunctionDto, + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + alias?: string + ): string { + const name = alias || apiItem.Name; + + // TypeParameters + let typeParametersString: string; + if (typeParameters != null && typeParameters.length > 0) { + const params: string[] = typeParameters.map(TypeParameterToString); + typeParametersString = `<${params.join(", ")}>`; + } else { + typeParametersString = ""; + } + + // Parameters + let parametersString: string; + if (parameters != null && parameters.length > 0) { + parametersString = parameters + .map(x => `${x.Name}: ${x.Type.Text}`) + .join(", "); + } else { + parametersString = ""; + } + + // ReturnType + const returnType = apiItem.ReturnType != null ? `: ${apiItem.ReturnType.Text}` : ""; + + return `function ${name}${typeParametersString}(${parametersString})${returnType}`; + } + + export function TypeParameterToString(apiItem: Contracts.ApiTypeParameterDto): string { + const $extends = apiItem.ConstraintType != null ? ` extends ${apiItem.ConstraintType.Text}` : ""; + const defaultType = apiItem.DefaultType != null ? ` = ${apiItem.DefaultType.Text}` : ""; + + return `${apiItem.Name}${$extends}${defaultType}`; + } + + export function ApiFunctionToSimpleString( + alias: string, + apiItem: Contracts.ApiFunctionDto, + parametersApiItems: Contracts.ApiParameterDto[] + ): string { + const name = alias || apiItem.Name; + const parametersString = parametersApiItems + .map(x => x.Name) + .join(", "); + + return `${name}(${parametersString})`; + } + + export function GetApiItemsFromReferenceTuple( + items: Contracts.ApiItemReferenceTuple, + extractedData: ExtractDto + ): T[] { + const apiItems: T[] = []; + + for (const itemReferences of items) { + const [, references] = itemReferences; + + for (const reference of references) { + const apiItem = extractedData.Registry[reference] as T; + apiItems.push(apiItem); + } + } + + return apiItems; + } } diff --git a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts index 7debeea3..481d6234 100644 --- a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts @@ -1,10 +1,11 @@ -import { Contracts, ExtractDto } from "ts-extractor"; +import { Contracts } from "ts-extractor"; import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; import { GeneratorHelpers } from "../generator-helpers"; import { Plugin, SupportedApiItemKindType, PluginResult, PluginOptions, PluginHeading } from "../contracts/plugin"; // TODO: const enums implementation. + export class ApiEnumPlugin implements Plugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Enum]; @@ -22,23 +23,6 @@ export class ApiEnumPlugin implements Plugin { return MarkdownGenerator.Table(header, content, { removeColumnIfEmpty: true }); } - /** - * Resolve api items of an enum from ApiItemReferenceTuple. - */ - private getEnumMembers(members: Contracts.ApiItemReferenceTuple, extractedData: ExtractDto): Contracts.ApiEnumMemberDto[] { - const apiItems: Contracts.ApiEnumMemberDto[] = []; - - for (const memberReferences of members) { - const [, references] = memberReferences; - for (const reference of references) { - const apiItem = extractedData.Registry[reference] as Contracts.ApiEnumMemberDto; - apiItems.push(apiItem); - } - } - - return apiItems; - } - public Render(data: PluginOptions): PluginResult { const heading: string = data.Reference.Alias; const headings: PluginHeading[] = [ @@ -48,7 +32,10 @@ export class ApiEnumPlugin implements Plugin { } ]; - const enumMembers = this.getEnumMembers(data.ApiItem.Members, data.ExtractedData); + const enumMembers = GeneratorHelpers.GetApiItemsFromReferenceTuple( + data.ApiItem.Members, + data.ExtractedData + ); const builder = new MarkdownBuilder() .Header(heading, 2) .EmptyLine() diff --git a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts new file mode 100644 index 00000000..1ce9adfd --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts @@ -0,0 +1,170 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; + +import { GeneratorHelpers } from "../generator-helpers"; +import { SupportedApiItemKindType, Plugin, PluginResult, PluginOptions, PluginHeading } from "../contracts/plugin"; +import { ApiFunctionDto } from "ts-extractor/dist/contracts"; + +export class ApiFunctionPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Function]; + } + + public CheckApiItem(item: ApiFunctionDto): boolean { + return true; + } + + // TODO: add description from @param jsdoc tag. + private resolveFunctionParameters(parameters: Contracts.ApiParameterDto[]): GeneratorHelpers.ReferenceDto { + if (parameters.length === 0) { + return { + References: [], + Text: [] + }; + } + + let referenceIds: string[] = []; + const header = ["Name", "Type", "Description"]; + + const content = parameters.map(parameter => { + const parameterTypeDto = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); + + referenceIds = referenceIds.concat(parameterTypeDto.References); + + return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text)]; + }); + + const text = new MarkdownBuilder() + .Header("Parameters", 3) + .EmptyLine() + .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) + .EmptyLine() + .GetOutput(); + + return { + Text: text, + References: referenceIds + }; + } + + // TODO: add description from @template jsdoc tag. + private resolveFunctionTypeParameters(typeParameters: Contracts.ApiTypeParameterDto[]): GeneratorHelpers.ReferenceDto { + let referenceIds: string[] = []; + + if (typeParameters.length === 0) { + return { + References: [], + Text: [] + }; + } + + const header = ["Name", "Constraint type", "Default type"]; + const content = typeParameters.map(typeParameter => { + let constraintType: string = ""; + let defaultType: string = ""; + + if (typeParameter.ConstraintType) { + const parsedConstraintType = GeneratorHelpers.TypeDtoToMarkdownString(typeParameter.ConstraintType); + + referenceIds = referenceIds.concat(parsedConstraintType.References); + constraintType = MarkdownGenerator.EscapeString(parsedConstraintType.Text); + } + + if (typeParameter.DefaultType) { + const parsedDefaultType = GeneratorHelpers.TypeDtoToMarkdownString(typeParameter.DefaultType); + + referenceIds = referenceIds.concat(parsedDefaultType.References); + defaultType = MarkdownGenerator.EscapeString(parsedDefaultType.Text); + } + + return [typeParameter.Name, constraintType, defaultType]; + }); + + const text = new MarkdownBuilder() + .Header("Type parameters", 3) + .EmptyLine() + .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) + .EmptyLine() + .GetOutput(); + + return { + References: referenceIds, + Text: text + }; + } + + private resolveReturnType(typeDto?: Contracts.TypeDto): GeneratorHelpers.ReferenceDto { + if (typeDto == null) { + return { + References: [], + Text: [] + }; + } + + const parsedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(typeDto); + + const text = new MarkdownBuilder() + .Header("Return type", 3) + .EmptyLine() + .Text(parsedReturnType.Text) + .EmptyLine() + .GetOutput(); + + return { + Text: text, + References: parsedReturnType.References + }; + } + + public Render(data: PluginOptions): PluginResult { + const alias = data.Reference.Alias; + + const headings: PluginHeading[] = [ + { + ApiItemId: data.Reference.Id, + Heading: alias + } + ]; + + const parameters = GeneratorHelpers.GetApiItemsFromReferenceTuple( + data.ApiItem.Parameters, + data.ExtractedData + ); + const resolvedParametersDto = this.resolveFunctionParameters(parameters); + + const typeParameters = GeneratorHelpers.GetApiItemsFromReferenceTuple( + data.ApiItem.TypeParameters, + data.ExtractedData + ); + const resolvedTypeParametersDto = this.resolveFunctionTypeParameters(typeParameters); + + const resolvedReturnTypeDto = this.resolveReturnType(data.ApiItem.ReturnType); + + const builder = new MarkdownBuilder() + .Header(GeneratorHelpers.ApiFunctionToSimpleString(alias, data.ApiItem, parameters), 2) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Code(GeneratorHelpers.ApiFunctionToString( + data.ApiItem, + typeParameters, + parameters, + data.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine() + .Text(resolvedTypeParametersDto.Text) + .Text(resolvedParametersDto.Text) + .Text(resolvedReturnTypeDto.Text); + + return { + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: headings, + UsedReferences: [ + ...resolvedParametersDto.References, + ...resolvedTypeParametersDto.References, + ...resolvedReturnTypeDto.References + ], + Result: builder.GetOutput() + }; + } +} diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index 9113bab0..c1d33630 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`index 1`] = ` +exports[`simple-project-1 1`] = ` Array [ Object { "FileLocation": "index.md", - "Output": Array [ - "# index", - "", + "Result": Array [ + "[ClassDeclaration-2]: index.md#class-earth", + "[ClassDeclaration-1]: index.md#class-world", "## EnumList", "", "Simple list.", @@ -28,7 +28,7 @@ Array [ "", "## EnumListWithNumberValues", "", - "List with number values with no punctuation at the end of description.", + "List with number values with no punctuation at the end of description", "", "", "\`\`\`typescript", @@ -47,9 +47,10 @@ Array [ "", "## EnumListWithStringValues", "", + "Warning: Beta!", + "", + "Deprecated!", "", - "beta", - "deprecated", "", "\`\`\`typescript", "enum EnumListWithStringValues {", @@ -77,6 +78,281 @@ Array [ "", "## class: Foo", "", + "## class: World", + "", + "## class: Earth", + "", + "## AnotherFoo(parameter1, parameter2)", + "", + "\`\`\`typescript", + "function AnotherFoo(parameter1: string, parameter2: Promise): string", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name | Constraint type |", + "| ---- | --------------- |", + "| T | Object |", + "", + "### Parameters", + "", + "| Name | Type |", + "| ---------- | ------- |", + "| parameter1 | string |", + "| parameter2 | Promise |", + "", + "### Return type", + "", + "string", + "", + "", + "## GetFoo()", + "", + "\`\`\`typescript", + "function GetFoo(): Promise", + "\`\`\`", + "", + "### Return type", + "", + "Promise", + "", + "", + "## FunctionWithOneParameter(parameter)", + "", + "\`\`\`typescript", + "function FunctionWithOneParameter(parameter: string): void", + "\`\`\`", + "", + "### Parameters", + "", + "| Name | Type |", + "| --------- | ------ |", + "| parameter | string |", + "", + "### Return type", + "", + "void", + "", + "", + "## FunctionWithNoParameters()", + "", + "\`\`\`typescript", + "function FunctionWithNoParameters(): void", + "\`\`\`", + "", + "### Return type", + "", + "void", + "", + "", + "## FunctionWithMultipleParameters(parameter1, parameter2)", + "", + "\`\`\`typescript", + "function FunctionWithMultipleParameters(parameter1: string, parameter2: number): void", + "\`\`\`", + "", + "### Parameters", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | number |", + "", + "### Return type", + "", + "void", + "", + "", + "## Bar(parameter1, parameter2)", + "", + "Warning: Beta!", + "", + "Deprecated!", + "", + "Some general comment about Bar function.", + "", + "\`\`\`typescript", + "function Bar(parameter1: string, parameter2: number): string", + "\`\`\`", + "", + "### Parameters", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | number |", + "", + "### Return type", + "", + "string", + "", + "", + "## FunctionWithMultipleTypeParameters(parameter1, parameter2)", + "", + "Comment on Function with multiple type parameters.", + "", + "\`\`\`typescript", + "function FunctionWithMultipleTypeParameters(parameter1: T, parameter2: P): string", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name | Constraint type |", + "| ---- | --------------- |", + "| T | Object |", + "| P | |", + "", + "### Parameters", + "", + "| Name | Type |", + "| ---------- | ---- |", + "| parameter1 | T |", + "| parameter2 | P |", + "", + "### Return type", + "", + "string", + "", + "", + "## FunctionWithTypeParameterDefault(parameter1, parameter2)", + "", + "Some general comment about Function with type parameter default function.", + "", + "\`\`\`typescript", + "function FunctionWithTypeParameterDefault(parameter1: string, parameter2: T): string", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name | Constraint type | Default type |", + "| ---- | --------------- | ------------ |", + "| T | Object | \\\\{\\\\} |", + "", + "### Parameters", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | T |", + "", + "### Return type", + "", + "string", + "", + "", + "## FunctionWithTypeParameterConstraint(parameter1, parameter2)", + "", + "Some general comment about AnotherBar function.", + "", + "\`\`\`typescript", + "function FunctionWithTypeParameterConstraint(parameter1: string, parameter2: T): string", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name | Constraint type |", + "| ---- | --------------- |", + "| T | Object |", + "", + "### Parameters", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | T |", + "", + "### Return type", + "", + "string", + "", + "", + "## FunctionWithoutReturnType(parameter1, parameter2)", + "", + "\`\`\`typescript", + "function FunctionWithoutReturnType(parameter1: string, parameter2: Promise): string", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name | Constraint type |", + "| ---- | --------------- |", + "| T | Array |", + "", + "### Parameters", + "", + "| Name | Type |", + "| ---------- | ------- |", + "| parameter1 | string |", + "| parameter2 | Promise |", + "", + "### Return type", + "", + "string", + "", + "", + "## FunctionWithGenericReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithGenericReturnType(): string[]", + "\`\`\`", + "", + "### Return type", + "", + "Array", + "", + "", + "## FunctionWithPrimitiveReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithPrimitiveReturnType(): boolean", + "\`\`\`", + "", + "### Return type", + "", + "true | false", + "", + "", + "## FunctionWithUnionReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithUnionReturnType(): \\"something\\" | \\"nothing\\"", + "\`\`\`", + "", + "### Return type", + "", + "\\"something\\" | \\"nothing\\"", + "", + "", + "## FunctionWithIntersectionReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithIntersectionReturnType(): Earth & World", + "\`\`\`", + "", + "### Return type", + "", + "[Earth][ClassDeclaration-2] & [World][ClassDeclaration-1]", + "", + "", + "## MyFunction()", + "", + "Function with TypeParameter as TypeLiteral.", + "", + "\`\`\`typescript", + "function MyFunction(): T", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name | Constraint type | Default type |", + "| ---- | -------------------------------------------------------------- | ------------------------- |", + "| T | \\\\{ myProperty: string; myPropertyTwo?: number \\\\| undefined; \\\\} | \\\\{ myProperty: string; \\\\} |", + "", + "### Return type", + "", + "T", + "", + "", ], }, ] diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap index 4939fde2..5ef537ea 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -1,12 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`index 1`] = ` +exports[`simple-project-2 1`] = ` Array [ Object { "FileLocation": "index.md", - "Output": Array [ - "# index", - "", + "Result": Array [ "## class: Foo", "", "## class: FooStart", @@ -15,9 +13,7 @@ Array [ }, Object { "FileLocation": "foo.md", - "Output": Array [ - "# foo", - "", + "Result": Array [ "## class: Foo", "", ], diff --git a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts index c3a40955..eeaf5349 100644 --- a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts +++ b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts @@ -1,3 +1,4 @@ +// #region Enums /** * Simple list. */ @@ -35,6 +36,8 @@ export enum EnumListWithStringValues { ThirdOption = "third" } +// #endregion Enums + export const SampleConst: string = "sample-const"; export class Foo { @@ -42,3 +45,96 @@ export class Foo { return message; } } + +export class World { } +export class Earth { } + +// #region Functions + +export function AnotherFoo(parameter1: string, parameter2: Promise): string { + return "bar"; +} + +export async function GetFoo(): Promise { + return; +} + +export function FunctionWithOneParameter(parameter: string): void { + return; +} + +export function FunctionWithNoParameters(): void { + return; +} + +export function FunctionWithMultipleParameters(parameter1: string, parameter2: number): void { + return; +} + +/** + * Some general comment about Bar function. + * + * @beta Some comment on beta. + * @deprecated + */ +export function Bar(parameter1: string, parameter2: number): string { + return "bar"; +} + +/** + * Comment on Function with multiple type parameters. + * + * @template T Parameter T comment + * @template P Parameter P comment + * @param parameter1 Parameter one comment + * @param parameter2 Parameter two comment + * @returns Return type comment + */ +export function FunctionWithMultipleTypeParameters(parameter1: T, parameter2: P): string { + return "bar"; +} + +/** + * Some general comment about Function with type parameter default function. + */ +export function FunctionWithTypeParameterDefault(parameter1: string, parameter2: T): string { + return "bar"; +} + +/** + * Some general comment about AnotherBar function. + */ +export function FunctionWithTypeParameterConstraint(parameter1: string, parameter2: T): string { + return "bar"; +} + +export function FunctionWithoutReturnType(parameter1: string, parameter2: Promise): string { + return "bar"; +} + +export function FunctionWithGenericReturnType(): string[] { + return []; +} + +export function FunctionWithPrimitiveReturnType(): boolean { + return true; +} + +export function FunctionWithUnionReturnType(): "something" | "nothing" { + return "nothing"; +} + +export function FunctionWithIntersectionReturnType(): Earth & World { + return {}; +} + +/** + * Function with TypeParameter as TypeLiteral. + */ +export function MyFunction(): T { + return { + myProperty: "sampleString" + } as T; +} + +// #endregion Functions From 16fd42e9479953457e9f2cd0452ad8917eaa7560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Fri, 22 Dec 2017 12:45:57 +0200 Subject: [PATCH 54/61] Feature: Upgrade ts-extractor (#9) --- .travis.yml | 3 +- common/config/rush/command-line.json | 4 +- common/config/rush/npm-shrinkwrap.json | 921 ++++++++++-------- package.json | 5 +- .../simple/docs/api/exported-functions.md | 3 + .../examples/simple/docs/api/index.md | 6 + .../simple/docs/api/index/foonamespace.md | 5 + .../index/{ => foonamespace}/boonamespace.md | 0 .../boonamespace/boonamespace2.md | 0 packages/ts-docs-gen/examples/simple/index.ts | 14 +- packages/ts-docs-gen/package.json | 16 +- .../ts-docs-gen/src/contracts/file-manager.ts | 7 - packages/ts-docs-gen/src/default-plugins.ts | 2 + packages/ts-docs-gen/src/file-manager.ts | 22 +- packages/ts-docs-gen/src/generator-helpers.ts | 81 +- packages/ts-docs-gen/src/generator.ts | 18 +- .../src/plugins/api-enum-plugin.ts | 2 +- .../src/plugins/api-function-plugin.ts | 4 +- .../src/plugins/api-source-file-plugin.ts | 94 ++ .../simple-project-1.test.ts.snap | 35 +- .../simple-project-2.test.ts.snap | 30 + tools/test-generator-cli/package.json | 1 + 22 files changed, 761 insertions(+), 512 deletions(-) create mode 100644 packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace.md rename packages/ts-docs-gen/examples/simple/docs/api/index/{ => foonamespace}/boonamespace.md (100%) rename packages/ts-docs-gen/examples/simple/docs/api/index/{ => foonamespace}/boonamespace/boonamespace2.md (100%) delete mode 100644 packages/ts-docs-gen/src/contracts/file-manager.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts diff --git a/.travis.yml b/.travis.yml index c569127e..3206e0a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,5 @@ node_js: - "node" script: - npm run rush-install -- npm run rush-test +- npm run rush-rebuild +- npm run test-ci diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 95a78a50..c77828a0 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -2,9 +2,9 @@ "$schema": "../../schemas/command-line.schema.json", "customCommands": [ { - "name": "test", + "name": "test-ci", "documentation": "Testing packages", - "parallelized": true, + "parallelized": false, "summary": "Testing packages" } ], diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index e5fe5a84..d181315d 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -4,9 +4,19 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.35", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.35.tgz", + "integrity": "sha512-l0SE8cl9DUIY4hYAFAKTLX3F2Yr14Qri7uTsuI7iegB5E4KyQy4XY72L3VOxmj6kwR/RDQURoKYr2NzyETGo7A==", + "requires": { + "chalk": "2.3.0", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + } + }, "@rush-temp/test-generator-cli": { "version": "file:projects/test-generator-cli.tgz", - "integrity": "sha1-poL86JfifvnYdj6kO8BwW/R5VEA=", + "integrity": "sha1-JJJ6MyfmltDVjIVMJwQ1+5PfnzY=", "requires": { "@types/fs-extra": "4.0.7", "@types/handlebars": "4.0.36", @@ -23,22 +33,42 @@ }, "@rush-temp/ts-docs-gen": { "version": "file:projects/ts-docs-gen.tgz", - "integrity": "sha1-IIM5lH+f0v1NDXEIhk/erutcOrQ=", + "integrity": "sha1-AGcTehH/O+/1KBdtdw3/lnlFnlQ=", "requires": { "@simplrjs/markdown": "1.0.3", - "@types/fs-extra": "4.0.7", + "@types/fs-extra": "5.0.0", "@types/jest": "21.1.9", "@types/sinon": "4.1.2", "fast-glob": "1.0.1", - "fs-extra": "4.0.3", - "jest": "21.2.1", + "fs-extra": "5.0.0", + "jest": "22.0.3", "simplr-logger": "1.0.1", "simplr-tslint": "0.0.1", "sinon": "4.1.3", - "ts-extractor": "2.0.0", - "ts-jest": "21.2.4", + "ts-extractor": "3.0.1", + "ts-jest": "22.0.0", "tslint": "5.8.0", "typescript": "2.6.2" + }, + "dependencies": { + "@types/fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-qtxDULQKUenuaDLW003CgC+0T0eiAfH3BrH+vSt87GLzbz5EZ6Ox6mv9rMttvhDOatbb9nYh0E1m7ydoYwUrAg==", + "requires": { + "@types/node": "8.5.2" + } + }, + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "4.0.0", + "universalify": "0.1.1" + } + } } }, "@simplrjs/markdown": { @@ -94,16 +124,16 @@ "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" }, "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", + "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==" }, "acorn-globals": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz", - "integrity": "sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz", + "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", "requires": { - "acorn": "4.0.13" + "acorn": "5.2.1" } }, "ajv": { @@ -414,12 +444,12 @@ } }, "babel-jest": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.2.0.tgz", - "integrity": "sha512-O0W2qLoWu1QOoOGgxiR2JID4O6WSpxPiQanrkyi9SSlM0PJ60Ptzlck47lhtnr9YZO3zYOsxHwnyeWJ6AffoBQ==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-22.0.3.tgz", + "integrity": "sha512-vIJAdq0YuLwg5TF6DDvcSFYx+Cqb9f2pTzC3ZcpGUBeysUUzPxZ6J3WVvuFMzpxgHa23tDKlNivDN9C4jIAKUQ==", "requires": { "babel-plugin-istanbul": "4.1.5", - "babel-preset-jest": "21.2.0" + "babel-preset-jest": "22.0.3" } }, "babel-messages": { @@ -441,9 +471,9 @@ } }, "babel-plugin-jest-hoist": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz", - "integrity": "sha512-yi5QuiVyyvhBUDLP4ButAnhYzkdrUwWDtvUJv71hjH3fclhnZg4HkDeqaitcR2dZZx/E67kGkRcPVjtVu+SJfQ==" + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.0.3.tgz", + "integrity": "sha512-Z0pOZFs0xDctwF0bPEKrnAzvbbgDi2vDFbQ0EdofnLI2bOa3P1H66gNLb2vMJJaa00VDjfiGhIocsHvBkqtyEQ==" }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", @@ -471,11 +501,11 @@ } }, "babel-preset-jest": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz", - "integrity": "sha512-hm9cBnr2h3J7yXoTtAVV0zg+3vg0Q/gT2GYuzlreTU0EPkJRtlNgKJJ3tBKEn0+VjAi3JykV6xCJkuUYttEEfA==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-22.0.3.tgz", + "integrity": "sha512-FbMMniSMXFvkKldCf+e4Tuol/v3XMaIpIp8xiT1WFlEW3ZapTKDW9YgVt3hqcpZXsIGFf6eUF3Owxom7yFlI8w==", "requires": { - "babel-plugin-jest-hoist": "21.2.0", + "babel-plugin-jest-hoist": "22.0.3", "babel-plugin-syntax-object-rest-spread": "6.13.0" } }, @@ -491,6 +521,16 @@ "lodash": "4.17.4", "mkdirp": "0.5.1", "source-map-support": "0.4.18" + }, + "dependencies": { + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "requires": { + "source-map": "0.5.7" + } + } } }, "babel-runtime": { @@ -628,6 +668,11 @@ "to-regex": "3.0.1" } }, + "browser-process-hrtime": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", + "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=" + }, "browser-resolve": { "version": "1.11.2", "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", @@ -1000,6 +1045,15 @@ "strip-bom": "2.0.0" } }, + "define-properties": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", + "requires": { + "foreach": "2.0.5", + "object-keys": "1.0.11" + } + }, "define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", @@ -1021,24 +1075,26 @@ "repeating": "2.0.1" } }, + "detect-newline": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=" + }, "diff": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==" }, + "domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.0.tgz", + "integrity": "sha512-WpwuBlZ2lQRFa4H/4w49deb9rJLot9KmqrKKjMc9qBl7CID+DdC2swoa34ccRl+anL2B6bLp6TjFdIdnzekMBQ==" + }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" }, - "errno": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.6.tgz", - "integrity": "sha512-IsORQDpaaSwcDP4ZZnHxgE85werpo34VYn1Ud3mq+eUsF593faR8oCZNXrROVkpFu2TsbrNhHin0aUrTsQ9vNw==", - "requires": { - "prr": "1.0.1" - } - }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", @@ -1047,6 +1103,28 @@ "is-arrayish": "0.2.1" } }, + "es-abstract": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.10.0.tgz", + "integrity": "sha512-/uh/DhdqIOSkAWifU+8nG78vlQxdLckUdI/sPgy0VhuXi2qJ7T8czBmqIYtLQVpCIFYafChnsRsB5pyb1JdmCQ==", + "requires": { + "es-to-primitive": "1.1.1", + "function-bind": "1.1.1", + "has": "1.0.1", + "is-callable": "1.1.3", + "is-regex": "1.0.4" + } + }, + "es-to-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", + "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", + "requires": { + "is-callable": "1.1.3", + "is-date-object": "1.0.1", + "is-symbol": "1.0.1" + } + }, "es6-promise": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz", @@ -1199,16 +1277,16 @@ } }, "expect": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-21.2.1.tgz", - "integrity": "sha512-orfQQqFRTX0jH7znRIGi8ZMR8kTNpXklTTz8+HGTpmTKZo3Occ6JNB5FXMb8cRuiiC/GyDqsr30zUa66ACYlYw==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/expect/-/expect-22.0.3.tgz", + "integrity": "sha512-QapzeQkcA3jCx4pDnD07I4SPPxScKbey8TD/WwrnzmpHmL5q0dUtXfUt5OIFOjVBCg+C4zn4Y1zK9Rb9SIDL1g==", "requires": { "ansi-styles": "3.2.0", - "jest-diff": "21.2.1", - "jest-get-type": "21.2.0", - "jest-matcher-utils": "21.2.1", - "jest-message-util": "21.2.1", - "jest-regex-util": "21.2.0" + "jest-diff": "22.0.3", + "jest-get-type": "22.0.3", + "jest-matcher-utils": "22.0.3", + "jest-message-util": "22.0.3", + "jest-regex-util": "22.0.3" }, "dependencies": { "ansi-styles": { @@ -1339,6 +1417,11 @@ "for-in": "1.0.2" } }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1385,6 +1468,11 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, "get-caller-file": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", @@ -1534,6 +1622,14 @@ "har-schema": "2.0.0" } }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "requires": { + "function-bind": "1.1.1" + } + }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -1705,6 +1801,11 @@ "builtin-modules": "1.1.1" } }, + "is-callable": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", + "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=" + }, "is-ci": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", @@ -1731,6 +1832,11 @@ } } }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + }, "is-descriptor": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", @@ -1839,11 +1945,24 @@ "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "requires": { + "has": "1.0.1" + } + }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" }, + "is-symbol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=" + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -1991,11 +2110,11 @@ } }, "jest": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-21.2.1.tgz", - "integrity": "sha512-mXN0ppPvWYoIcC+R+ctKxAJ28xkt/Z5Js875padm4GbgUn6baeR5N4Ng6LjatIRpUQDZVJABT7Y4gucFjPryfw==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest/-/jest-22.0.3.tgz", + "integrity": "sha512-90H1wLqiNR3tLhQUgwhC6GWHfRCG+Da14m7vxD608Mt/QTKR0TA751D+QH09x5bvcrLfvxLtxArtA0VEC0ORow==", "requires": { - "jest-cli": "21.2.1" + "jest-cli": "22.0.3" }, "dependencies": { "ansi-regex": { @@ -2056,9 +2175,9 @@ } }, "jest-cli": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.2.1.tgz", - "integrity": "sha512-T1BzrbFxDIW/LLYQqVfo94y/hhaj1NzVQkZgBumAC+sxbjMROI7VkihOdxNR758iYbQykL2ZOWUBurFgkQrzdg==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.0.3.tgz", + "integrity": "sha512-aX71DL4q9aLxbSmYI8uuPVlXVRyREU4VbApOdiuD79oqqqSGYu9E5S1SLXRm/PB5lJPh5xd8bVRrdsrMVs2hyw==", "requires": { "ansi-escapes": "3.0.0", "chalk": "2.3.0", @@ -2069,26 +2188,28 @@ "istanbul-lib-coverage": "1.1.1", "istanbul-lib-instrument": "1.9.1", "istanbul-lib-source-maps": "1.2.2", - "jest-changed-files": "21.2.0", - "jest-config": "21.2.1", - "jest-environment-jsdom": "21.2.1", - "jest-haste-map": "21.2.0", - "jest-message-util": "21.2.1", - "jest-regex-util": "21.2.0", - "jest-resolve-dependencies": "21.2.0", - "jest-runner": "21.2.1", - "jest-runtime": "21.2.1", - "jest-snapshot": "21.2.1", - "jest-util": "21.2.1", + "jest-changed-files": "22.0.3", + "jest-config": "22.0.3", + "jest-environment-jsdom": "22.0.3", + "jest-get-type": "22.0.3", + "jest-haste-map": "22.0.3", + "jest-message-util": "22.0.3", + "jest-regex-util": "22.0.3", + "jest-resolve-dependencies": "22.0.3", + "jest-runner": "22.0.3", + "jest-runtime": "22.0.3", + "jest-snapshot": "22.0.3", + "jest-util": "22.0.3", + "jest-worker": "22.0.3", "micromatch": "2.3.11", "node-notifier": "5.1.2", - "pify": "3.0.0", + "realpath-native": "1.0.0", + "rimraf": "2.6.2", "slash": "1.0.0", "string-length": "2.0.0", "strip-ansi": "4.0.0", "which": "1.3.0", - "worker-farm": "1.5.2", - "yargs": "9.0.1" + "yargs": "10.0.3" } }, "kind-of": { @@ -2099,24 +2220,6 @@ "is-buffer": "1.1.6" } }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "strip-bom": "3.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } - } - }, "micromatch": { "version": "2.3.11", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", @@ -2137,40 +2240,6 @@ "regex-cache": "0.4.4" } }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "requires": { - "pify": "2.3.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } - } - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "requires": { - "load-json-file": "2.0.0", - "normalize-package-data": "2.4.0", - "path-type": "2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "requires": { - "find-up": "2.1.0", - "read-pkg": "2.0.0" - } - }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -2178,119 +2247,89 @@ "requires": { "ansi-regex": "3.0.0" } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" - }, - "yargs": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", - "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", - "requires": { - "camelcase": "4.1.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "read-pkg-up": "2.0.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "7.0.0" - } - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "requires": { - "camelcase": "4.1.0" - } } } }, "jest-changed-files": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.2.0.tgz", - "integrity": "sha512-+lCNP1IZLwN1NOIvBcV5zEL6GENK6TXrDj4UxWIeLvIsIDa+gf6J7hkqsW2qVVt/wvH65rVvcPwqXdps5eclTQ==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-22.0.3.tgz", + "integrity": "sha512-CG7eNJNO9x1O/3J4Uhe2QXra1MnC9+KS1f2NeOg+7iQ+8dDCgxCtpusmKfu44TnEyKwkIDhDr6htPfPaI+Fwbw==", "requires": { "throat": "4.1.0" } }, "jest-config": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.2.1.tgz", - "integrity": "sha512-fJru5HtlD/5l2o25eY9xT0doK3t2dlglrqoGpbktduyoI0T5CwuB++2YfoNZCrgZipTwPuAGonYv0q7+8yDc/A==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-22.0.3.tgz", + "integrity": "sha512-omqyzFPhRm+YaHku+jPuqpSFJ0QD61G/hqR+m09r2IajJbaRjV9XDezCIOD+rJiQlAyfFfo+DAc+u1mLy2IEaA==", "requires": { "chalk": "2.3.0", "glob": "7.1.2", - "jest-environment-jsdom": "21.2.1", - "jest-environment-node": "21.2.1", - "jest-get-type": "21.2.0", - "jest-jasmine2": "21.2.1", - "jest-regex-util": "21.2.0", - "jest-resolve": "21.2.0", - "jest-util": "21.2.1", - "jest-validate": "21.2.1", - "pretty-format": "21.2.1" + "jest-environment-jsdom": "22.0.3", + "jest-environment-node": "22.0.3", + "jest-get-type": "22.0.3", + "jest-jasmine2": "22.0.3", + "jest-regex-util": "22.0.3", + "jest-resolve": "22.0.3", + "jest-util": "22.0.3", + "jest-validate": "22.0.3", + "pretty-format": "22.0.3" } }, "jest-diff": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.2.1.tgz", - "integrity": "sha512-E5fu6r7PvvPr5qAWE1RaUwIh/k6Zx/3OOkZ4rk5dBJkEWRrUuSgbMt2EO8IUTPTd6DOqU3LW6uTIwX5FRvXoFA==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-22.0.3.tgz", + "integrity": "sha512-Y7xN9Lc/NgFvR14lvjrJXB6x2x1LLe5NnMyzLvilBSSOyjy9uAVnR2Bt1YgzdfRrfaxsx7xFUVcqXLUnPkrJcA==", "requires": { "chalk": "2.3.0", "diff": "3.4.0", - "jest-get-type": "21.2.0", - "pretty-format": "21.2.1" + "jest-get-type": "22.0.3", + "pretty-format": "22.0.3" } }, "jest-docblock": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", - "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==" + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-22.0.3.tgz", + "integrity": "sha512-LhviP2rqIg2IzS6m97W7T032oMrT699Tr6Njjhhl4FCLj+75BUy9CsSmGgfoVEql1uc+myBkssvcbn7T9xDR+A==", + "requires": { + "detect-newline": "2.1.0" + } }, "jest-environment-jsdom": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz", - "integrity": "sha512-mecaeNh0eWmzNrUNMWARysc0E9R96UPBamNiOCYL28k7mksb1d0q6DD38WKP7ABffjnXyUWJPVaWRgUOivwXwg==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-22.0.3.tgz", + "integrity": "sha512-LrR9flT6I4IZKIA/dmoAiTmTzGi7W8sP5mCXbgsTjFop1Jh3rNluza/xnf6VfK/aOZvBglJIVYbKqGxtcm0KsQ==", "requires": { - "jest-mock": "21.2.0", - "jest-util": "21.2.1", - "jsdom": "9.12.0" + "jest-mock": "22.0.3", + "jest-util": "22.0.3", + "jsdom": "11.5.1" } }, "jest-environment-node": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.2.1.tgz", - "integrity": "sha512-R211867wx9mVBVHzrjGRGTy5cd05K7eqzQl/WyZixR/VkJ4FayS8qkKXZyYnwZi6Rxo6WEV81cDbiUx/GfuLNw==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-22.0.3.tgz", + "integrity": "sha512-Kk7FYtCQZ+CFwwCL1t3DJ/Lxvjoda4qRt/NJh/6jsAEWM7VcSBAzmmayA5JcMRpQQ4FRiUcLrvrKEfO01/Fgsw==", "requires": { - "jest-mock": "21.2.0", - "jest-util": "21.2.1" + "jest-mock": "22.0.3", + "jest-util": "22.0.3" } }, "jest-get-type": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.2.0.tgz", - "integrity": "sha512-y2fFw3C+D0yjNSDp7ab1kcd6NUYfy3waPTlD8yWkAtiocJdBRQqNoRqVfMNxgj+IjT0V5cBIHJO0z9vuSSZ43Q==" + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.0.3.tgz", + "integrity": "sha512-TaJnc/lnJQ3jwry+NUWkqaJmKrM/Ut3XdK89HfiqdI3DMRLd6Zb4wyKjwuNP37MEQqlNg0YWH4sbBR8D4exjCA==" }, "jest-haste-map": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-21.2.0.tgz", - "integrity": "sha512-5LhsY/loPH7wwOFRMs+PT4aIAORJ2qwgbpMFlbWbxfN0bk3ZCwxJ530vrbSiTstMkYLao6JwBkLhCJ5XbY7ZHw==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-22.0.3.tgz", + "integrity": "sha512-VosIMOFQFu1rTF+MvOWVuv2KVmZ9eTkRgfwW2yUAs6/AhwmIfXRl/tih+fIOYcHzU4Auu1G8Fvl2kkF5g0k6/A==", "requires": { "fb-watchman": "2.0.0", "graceful-fs": "4.1.11", - "jest-docblock": "21.2.0", + "jest-docblock": "22.0.3", + "jest-worker": "22.0.3", "micromatch": "2.3.11", - "sane": "2.2.0", - "worker-farm": "1.5.2" + "sane": "2.2.0" }, "dependencies": { "arr-diff": { @@ -2376,38 +2415,49 @@ } }, "jest-jasmine2": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz", - "integrity": "sha512-lw8FXXIEekD+jYNlStfgNsUHpfMWhWWCgHV7n0B7mA/vendH7vBFs8xybjQsDzJSduptBZJHqQX9SMssya9+3A==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-22.0.3.tgz", + "integrity": "sha512-0Gz3pFZytCjbCKssBJWzx5NolNLg179gkT0Zfe+fWrJS9Ap9EH7eTB9UHoiT2O3lRNBfaYTzrXhOMgf4l/jCMg==", "requires": { + "callsites": "2.0.0", "chalk": "2.3.0", - "expect": "21.2.1", + "expect": "22.0.3", "graceful-fs": "4.1.11", - "jest-diff": "21.2.1", - "jest-matcher-utils": "21.2.1", - "jest-message-util": "21.2.1", - "jest-snapshot": "21.2.1", - "p-cancelable": "0.3.0" + "jest-diff": "22.0.3", + "jest-matcher-utils": "22.0.3", + "jest-message-util": "22.0.3", + "jest-snapshot": "22.0.3", + "source-map-support": "0.5.0" + } + }, + "jest-leak-detector": { + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-22.0.3.tgz", + "integrity": "sha512-xyVdAmcG8M3jWtVeadDUU6MAHLBrjkP4clz2UtTZ1gpe5bRLk27VjQOpzTwK20MkV/6iZQhSuRVuzHS5kD0HpA==", + "requires": { + "pretty-format": "22.0.3" } }, "jest-matcher-utils": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz", - "integrity": "sha512-kn56My+sekD43dwQPrXBl9Zn9tAqwoy25xxe7/iY4u+mG8P3ALj5IK7MLHZ4Mi3xW7uWVCjGY8cm4PqgbsqMCg==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-22.0.3.tgz", + "integrity": "sha512-FJbKpCR3K7YYE/Pnvy5OrLFgPEswpYWIfVtdwT2NC6pBARbYGX39KF3bTxS9yg2mv0YL2zHe3UbwzFsi9nFpVA==", "requires": { "chalk": "2.3.0", - "jest-get-type": "21.2.0", - "pretty-format": "21.2.1" + "jest-get-type": "22.0.3", + "pretty-format": "22.0.3" } }, "jest-message-util": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-21.2.1.tgz", - "integrity": "sha512-EbC1X2n0t9IdeMECJn2BOg7buOGivCvVNjqKMXTzQOu7uIfLml+keUfCALDh8o4rbtndIeyGU8/BKfoTr/LVDQ==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-22.0.3.tgz", + "integrity": "sha512-AVBdCx7Oj5wBpMOH089lx7Zgwpdz9HbReA82HuVAlIT4kEQRvCy6Sl9yVWDGJwHTgB/OYQGkgmbv/P/K8TkWNw==", "requires": { + "@babel/code-frame": "7.0.0-beta.35", "chalk": "2.3.0", "micromatch": "2.3.11", - "slash": "1.0.0" + "slash": "1.0.0", + "stack-utils": "1.0.1" }, "dependencies": { "arr-diff": { @@ -2493,72 +2543,72 @@ } }, "jest-mock": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.2.0.tgz", - "integrity": "sha512-aZDfyVf0LEoABWiY6N0d+O963dUQSyUa4qgzurHR3TBDPen0YxKCJ6l2i7lQGh1tVdsuvdrCZ4qPj+A7PievCw==" + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-22.0.3.tgz", + "integrity": "sha512-donODXcDG03EAEavc9xfJ7fBF/LNVjoZYkmj9DLrQ1B9YcT6wh8Xx7IYg25b8V/8F/eXPMAE0KK5q6Fqe6yAeg==" }, "jest-regex-util": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.2.0.tgz", - "integrity": "sha512-BKQ1F83EQy0d9Jen/mcVX7D+lUt2tthhK/2gDWRgLDJRNOdRgSp1iVqFxP8EN1ARuypvDflRfPzYT8fQnoBQFQ==" + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-22.0.3.tgz", + "integrity": "sha512-mplC9chiAotES3ClzNhy0SJcfHB2DivooKJZW+2hDdvP8LLB+OUI+D6bJd7sncbKUsyFcmblEvpm/zz/hef7HA==" }, "jest-resolve": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.2.0.tgz", - "integrity": "sha512-vefQ/Lr+VdNvHUZFQXWtOqHX3HEdOc2MtSahBO89qXywEbUxGPB9ZLP9+BHinkxb60UT2Q/tTDOS6rYc6Mwigw==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-22.0.3.tgz", + "integrity": "sha512-UHpim1kXTXH5hlftIpVOUkh0n+wd36/QNuYgpZnzwX8PsB8DizBuaPJbl5VvorHBpRouz21Ty0K0QM1pPny9cw==", "requires": { "browser-resolve": "1.11.2", - "chalk": "2.3.0", - "is-builtin-module": "1.0.0" + "chalk": "2.3.0" } }, "jest-resolve-dependencies": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz", - "integrity": "sha512-ok8ybRFU5ScaAcfufIQrCbdNJSRZ85mkxJ1EhUp8Bhav1W1/jv/rl1Q6QoVQHObNxmKnbHVKrfLZbCbOsXQ+bQ==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-22.0.3.tgz", + "integrity": "sha512-u9MUNJIa9GJ0YFhvM0+Scr4tyX84nC42d3w18Cly1doY7pTT+9momm+TncpuDlFyB2aNmS8SfdEbiLr1e6tBwg==", "requires": { - "jest-regex-util": "21.2.0" + "jest-regex-util": "22.0.3" } }, "jest-runner": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.2.1.tgz", - "integrity": "sha512-Anb72BOQlHqF/zETqZ2K20dbYsnqW/nZO7jV8BYENl+3c44JhMrA8zd1lt52+N7ErnsQMd2HHKiVwN9GYSXmrg==", - "requires": { - "jest-config": "21.2.1", - "jest-docblock": "21.2.0", - "jest-haste-map": "21.2.0", - "jest-jasmine2": "21.2.1", - "jest-message-util": "21.2.1", - "jest-runtime": "21.2.1", - "jest-util": "21.2.1", - "pify": "3.0.0", - "throat": "4.1.0", - "worker-farm": "1.5.2" + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-22.0.3.tgz", + "integrity": "sha512-b/Eh+bPFLU09R0AULy4/IcUQ4Cgiao7YcmCehI7eailVj2xGQAfhmzSlhDpVIYmvoRZFyReOseihZXXRsdFafA==", + "requires": { + "jest-config": "22.0.3", + "jest-docblock": "22.0.3", + "jest-haste-map": "22.0.3", + "jest-jasmine2": "22.0.3", + "jest-leak-detector": "22.0.3", + "jest-message-util": "22.0.3", + "jest-runtime": "22.0.3", + "jest-util": "22.0.3", + "jest-worker": "22.0.3", + "throat": "4.1.0" } }, "jest-runtime": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-21.2.1.tgz", - "integrity": "sha512-6omlpA3+NSE+rHwD0PQjNEjZeb2z+oRmuehMfM1tWQVum+E0WV3pFt26Am0DUfQkkPyTABvxITRjCUclYgSOsA==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-22.0.3.tgz", + "integrity": "sha512-SSOiAde16JhEtVtNaWV2OmimmyxP8lmUdHxYde5rwv7iibkRy/o4QtalmmmH48oUxwy/epZVDaEyBKBA/iDFBg==", "requires": { "babel-core": "6.26.0", - "babel-jest": "21.2.0", + "babel-jest": "22.0.3", "babel-plugin-istanbul": "4.1.5", "chalk": "2.3.0", "convert-source-map": "1.5.1", "graceful-fs": "4.1.11", - "jest-config": "21.2.1", - "jest-haste-map": "21.2.0", - "jest-regex-util": "21.2.0", - "jest-resolve": "21.2.0", - "jest-util": "21.2.1", + "jest-config": "22.0.3", + "jest-haste-map": "22.0.3", + "jest-regex-util": "22.0.3", + "jest-resolve": "22.0.3", + "jest-util": "22.0.3", "json-stable-stringify": "1.0.1", "micromatch": "2.3.11", + "realpath-native": "1.0.0", "slash": "1.0.0", "strip-bom": "3.0.0", "write-file-atomic": "2.3.0", - "yargs": "9.0.1" + "yargs": "10.0.3" }, "dependencies": { "arr-diff": { @@ -2621,17 +2671,6 @@ "is-buffer": "1.1.6" } }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "strip-bom": "3.0.0" - } - }, "micromatch": { "version": "2.3.11", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", @@ -2652,109 +2691,57 @@ "regex-cache": "0.4.4" } }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "requires": { - "pify": "2.3.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "requires": { - "load-json-file": "2.0.0", - "normalize-package-data": "2.4.0", - "path-type": "2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "requires": { - "find-up": "2.1.0", - "read-pkg": "2.0.0" - } - }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" - }, - "yargs": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", - "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", - "requires": { - "camelcase": "4.1.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "read-pkg-up": "2.0.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "7.0.0" - } - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "requires": { - "camelcase": "4.1.0" - } } } }, "jest-snapshot": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.2.1.tgz", - "integrity": "sha512-bpaeBnDpdqaRTzN8tWg0DqOTo2DvD3StOemxn67CUd1p1Po+BUpvePAp44jdJ7Pxcjfg+42o4NHw1SxdCA2rvg==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-22.0.3.tgz", + "integrity": "sha512-e/a/EvMsY5XROWy4QWX6PvYziuJ8ttD6+QcnbogODWtx2LGhvVQOb7pmqGTo0tL/p0vzFetZA9GlZSh/EfMepg==", "requires": { "chalk": "2.3.0", - "jest-diff": "21.2.1", - "jest-matcher-utils": "21.2.1", + "jest-diff": "22.0.3", + "jest-matcher-utils": "22.0.3", "mkdirp": "0.5.1", "natural-compare": "1.4.0", - "pretty-format": "21.2.1" + "pretty-format": "22.0.3" } }, "jest-util": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.2.1.tgz", - "integrity": "sha512-r20W91rmHY3fnCoO7aOAlyfC51x2yeV3xF+prGsJAUsYhKeV670ZB8NO88Lwm7ASu8SdH0S+U+eFf498kjhA4g==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-22.0.3.tgz", + "integrity": "sha512-iDnKIw4P+9433L7II90UGYZ4rQOatbbcjZO/+1+Fga+rNUF1wEijDfTDjGQil98smAquvB02RBrDgfbquUHLmg==", "requires": { "callsites": "2.0.0", "chalk": "2.3.0", "graceful-fs": "4.1.11", - "jest-message-util": "21.2.1", - "jest-mock": "21.2.0", - "jest-validate": "21.2.1", + "is-ci": "1.0.10", + "jest-message-util": "22.0.3", + "jest-validate": "22.0.3", "mkdirp": "0.5.1" } }, "jest-validate": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.2.1.tgz", - "integrity": "sha512-k4HLI1rZQjlU+EC682RlQ6oZvLrE5SCh3brseQc24vbZTxzT/k/3urar5QMCVgjadmSO7lECeGdc6YxnM3yEGg==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-22.0.3.tgz", + "integrity": "sha512-GmlLmPCtrSQ3iB4A1uxcfjawaaQnwESCDcUg5tMxJKeBbmPdcWPAb6EWzvANxULPUV7hfPKLwg4xIPpi7cx1/g==", "requires": { "chalk": "2.3.0", - "jest-get-type": "21.2.0", + "jest-get-type": "22.0.3", "leven": "2.1.0", - "pretty-format": "21.2.1" + "pretty-format": "22.0.3" + } + }, + "jest-worker": { + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-22.0.3.tgz", + "integrity": "sha512-fPdCTnogFQiR0CP6whEsIly2RfcHxvalqyLjhui6qa1SnOmHiX7L8k4Umo8CBIp5ndWY0+ej1o7OTE5MlzPabg==", + "requires": { + "merge-stream": "1.0.1" } }, "js-tokens": { @@ -2772,28 +2759,33 @@ } }, "jsdom": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz", - "integrity": "sha1-6MVG//ywbADUgzyoRBD+1/igl9Q=", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.5.1.tgz", + "integrity": "sha512-89ztIZ03aYK9f1uUrLXLsZndRge/JnZjzjpaN+lrse3coqz+8PR/dX4WLHpbF5fIKTXhDjFODOJw2328lPJ90g==", "requires": { "abab": "1.0.4", - "acorn": "4.0.13", - "acorn-globals": "3.1.0", + "acorn": "5.2.1", + "acorn-globals": "4.1.0", "array-equal": "1.0.0", + "browser-process-hrtime": "0.1.2", "content-type-parser": "1.0.2", "cssom": "0.3.2", "cssstyle": "0.2.37", + "domexception": "1.0.0", "escodegen": "1.9.0", "html-encoding-sniffer": "1.0.2", + "left-pad": "1.2.0", "nwmatcher": "1.4.3", - "parse5": "1.5.1", + "parse5": "3.0.3", + "pn": "1.0.0", "request": "2.83.0", + "request-promise-native": "1.0.5", "sax": "1.2.4", "symbol-tree": "3.2.2", "tough-cookie": "2.3.3", "webidl-conversions": "4.0.2", "whatwg-encoding": "1.0.3", - "whatwg-url": "4.8.0", + "whatwg-url": "6.4.0", "xml-name-validator": "2.0.1" } }, @@ -2885,6 +2877,11 @@ "invert-kv": "1.0.0" } }, + "left-pad": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.2.0.tgz", + "integrity": "sha1-0wpzxrggHY99jnlWupYWCHpo4O4=" + }, "leven": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", @@ -2909,13 +2906,6 @@ "pify": "2.3.0", "pinkie-promise": "2.0.1", "strip-bom": "2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } } }, "locate-path": { @@ -2937,6 +2927,11 @@ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" + }, "lolex": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", @@ -2993,6 +2988,14 @@ "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=" }, + "merge-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", + "requires": { + "readable-stream": "2.3.3" + } + }, "micromatch": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.4.tgz", @@ -3240,6 +3243,11 @@ } } }, + "object-keys": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", + "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=" + }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -3248,6 +3256,15 @@ "isobject": "3.0.1" } }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "requires": { + "define-properties": "1.1.2", + "es-abstract": "1.10.0" + } + }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", @@ -3322,11 +3339,6 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, - "p-cancelable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", - "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" - }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -3380,9 +3392,12 @@ } }, "parse5": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", - "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=" + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "requires": { + "@types/node": "8.5.2" + } }, "pascalcase": { "version": "0.1.1", @@ -3437,13 +3452,6 @@ "graceful-fs": "4.1.11", "pify": "2.3.0", "pinkie-promise": "2.0.1" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } } }, "performance-now": { @@ -3452,9 +3460,9 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" }, "pinkie": { "version": "2.0.4", @@ -3477,6 +3485,11 @@ "find-up": "2.1.0" } }, + "pn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.0.0.tgz", + "integrity": "sha1-HPWjCw2AbNGPiPxBprXUrWFbO6k=" + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -3493,9 +3506,9 @@ "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=" }, "pretty-format": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", - "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-22.0.3.tgz", + "integrity": "sha512-qXbDFJ2/Kk3HFIaLdOblbsCKQ09kZu4MKbXB+m/EaqD7PZ/wXe2XcRREmQleMh4wmerxlma6eJTh3nxCXYUmmA==", "requires": { "ansi-regex": "3.0.0", "ansi-styles": "3.2.0" @@ -3526,11 +3539,6 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" - }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -3650,6 +3658,14 @@ "set-immediate-shim": "1.0.1" } }, + "realpath-native": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.0.0.tgz", + "integrity": "sha512-XJtlRJ9jf0E1H1SLeJyQ9PGzQD7S65h1pRXEcAeK48doKOnKxcgPeNohJvD5u/2sI9J1oke6E8bZHS/fmW1UiQ==", + "requires": { + "util.promisify": "1.0.0" + } + }, "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", @@ -3723,6 +3739,24 @@ "uuid": "3.1.0" } }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "requires": { + "lodash": "4.17.4" + } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "1.1.1", + "tough-cookie": "2.3.3" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3994,11 +4028,18 @@ } }, "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz", + "integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==", "requires": { - "source-map": "0.5.7" + "source-map": "0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } } }, "source-map-url": { @@ -4067,6 +4108,11 @@ "getpass": "0.1.7" } }, + "stack-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=" + }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -4101,6 +4147,11 @@ } } }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + }, "string": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/string/-/string-3.3.3.tgz", @@ -4403,9 +4454,19 @@ } }, "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" + } + } }, "trim-right": { "version": "1.0.1", @@ -4413,47 +4474,52 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, "ts-extractor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-2.0.0.tgz", - "integrity": "sha512-snSSnVkhc/jDo0ppJa8t3/aIbMcI3qg6HsB/iC0UdG+5KzAKHGQBuM5QwaFng6O7KKbk/Ljb8RgwN5uwd1DYHA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-3.0.1.tgz", + "integrity": "sha512-ghuDQd1kVvQ+A7WbcclGXzSVukXVNKjwaB2AO/oeOYpkw1we7FkgGvVFFogtvo2jJyVBsBQDmKtB92UHcW9FsQ==", "requires": { - "@types/fs-extra": "4.0.7", - "fs-extra": "4.0.3", + "@types/fs-extra": "5.0.0", + "fs-extra": "5.0.0", "read-package-json": "2.0.12", "simplr-logger": "1.0.1", "typescript": "2.6.2" + }, + "dependencies": { + "@types/fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-qtxDULQKUenuaDLW003CgC+0T0eiAfH3BrH+vSt87GLzbz5EZ6Ox6mv9rMttvhDOatbb9nYh0E1m7ydoYwUrAg==", + "requires": { + "@types/node": "8.5.2" + } + }, + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "4.0.0", + "universalify": "0.1.1" + } + } } }, "ts-jest": { - "version": "21.2.4", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-21.2.4.tgz", - "integrity": "sha512-Plk49Us+DcncpQcC8fhYwDUdhW96QB0Dv02etOLhzq+2HAvXfrEUys3teZ/BeyQ+r1rHxfGdNj4dB0Q5msZR3g==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-22.0.0.tgz", + "integrity": "sha512-ATHKHtTzJPczvIj/4xrQxyTvmCUo/NL8pf5KWgLNLQX3dZYA65oJm9liBnegZLfphdhFerCKRtuBFGsmghYy1Q==", "requires": { "babel-core": "6.26.0", "babel-plugin-istanbul": "4.1.5", "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", - "babel-preset-jest": "21.2.0", + "babel-preset-jest": "22.0.3", "cpx": "1.5.0", "fs-extra": "4.0.3", - "jest-config": "21.2.1", + "jest-config": "22.0.3", "pkg-dir": "2.0.0", "source-map-support": "0.5.0", "yargs": "10.0.3" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" - }, - "source-map-support": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz", - "integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==", - "requires": { - "source-map": "0.6.1" - } - } } }, "tslib": { @@ -4623,6 +4689,15 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "requires": { + "define-properties": "1.1.2", + "object.getownpropertydescriptors": "2.0.3" + } + }, "uuid": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", @@ -4685,19 +4760,13 @@ } }, "whatwg-url": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz", - "integrity": "sha1-0pgaqRSMHgCkHFphMRZqtGg7vMA=", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.4.0.tgz", + "integrity": "sha512-Z0CVh/YE217Foyb488eo+iBv+r7eAQ0wSTyApi9n06jhcA3z6Nidg/EGvl0UFkg7kMdKxfBzzr+o9JF+cevgMg==", "requires": { - "tr46": "0.0.3", - "webidl-conversions": "3.0.1" - }, - "dependencies": { - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" - } + "lodash.sortby": "4.7.0", + "tr46": "1.0.1", + "webidl-conversions": "4.0.2" } }, "which": { @@ -4718,15 +4787,6 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" }, - "worker-farm": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.2.tgz", - "integrity": "sha512-XxiQ9kZN5n6mmnW+mFJ+wXjNNI/Nx4DIdaAKLX1Bn6LYBWlN/zaBhu34DQYPZ1AJobQuu67S2OfDdNSVULvXkQ==", - "requires": { - "errno": "0.1.6", - "xtend": "4.0.1" - } - }, "wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", @@ -4768,11 +4828,6 @@ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz", "integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=" }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, "y18n": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", diff --git a/package.json b/package.json index 5e6bbe37..788a264d 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,9 @@ "private": true, "description": "Generating documentation for TypeScript code.", "scripts": { - "rush-install": "rush install", - "rush-test": "rush test" + "test-ci": "rush test-ci", + "rush-rebuild": "rush rebuild", + "rush-install": "rush install" }, "devDependencies": { "@microsoft/rush": "^4.0.1" diff --git a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md index 848a1922..ac02df3f 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md @@ -1,3 +1,5 @@ +# exported-functions + ## Foo() ```typescript @@ -19,3 +21,4 @@ function Bar(): string string + diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index af7b4273..b028f9f1 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,3 +1,6 @@ +[ModuleDeclaration-0]: index\foonamespace.md#foonamespace +# index + ## MyFunction() ```typescript @@ -14,3 +17,6 @@ function MyFunction (https://github.com/simplrjs)", "dependencies": { "@simplrjs/markdown": "^1.0.3", - "@types/fs-extra": "^4.0.5", + "@types/fs-extra": "^5.0.0", "fast-glob": "^1.0.1", - "fs-extra": "^4.0.3", + "fs-extra": "^5.0.0", "simplr-logger": "^1.0.1", - "ts-extractor": "^2.0.0", + "ts-extractor": "^3.0.1", "typescript": "^2.6.2" }, "devDependencies": { - "@types/jest": "^21.1.8", - "@types/sinon": "^4.1.0", - "jest": "^21.2.1", + "@types/jest": "^21.1.9", + "@types/sinon": "^4.1.2", + "jest": "^22.0.3", "simplr-tslint": "0.0.1", "sinon": "^4.1.3", - "ts-jest": "^21.2.4", + "ts-jest": "^22.0.0", "tslint": "^5.8.0" }, "jest": { diff --git a/packages/ts-docs-gen/src/contracts/file-manager.ts b/packages/ts-docs-gen/src/contracts/file-manager.ts deleted file mode 100644 index 5caf6b4b..00000000 --- a/packages/ts-docs-gen/src/contracts/file-manager.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { PluginResult } from "./plugin"; -import { FileResult } from "./file-result"; - -export interface FileManager { - AddItem(itemResult: PluginResult, filePath: string): void; - ToFilesOutput(): FileResult[]; -} diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index 38f555a7..d7541d65 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -1,3 +1,4 @@ +import { ApiSourceFilePlugin } from "./plugins/api-source-file-plugin"; import { ApiVariablePlugin } from "./plugins/api-variable-plugin"; import { ApiEnumPlugin } from "./plugins/api-enum-plugin"; import { ApiFunctionPlugin } from "./plugins/api-function-plugin"; @@ -5,6 +6,7 @@ import { ApiTypePlugin } from "./plugins/api-type-plugin"; import { ApiNamespacePlugin } from "./plugins/api-namespace-plugin"; export const DefaultPlugins = [ + new ApiSourceFilePlugin(), new ApiVariablePlugin(), new ApiEnumPlugin(), new ApiFunctionPlugin(), diff --git a/packages/ts-docs-gen/src/file-manager.ts b/packages/ts-docs-gen/src/file-manager.ts index fce83990..41436a00 100644 --- a/packages/ts-docs-gen/src/file-manager.ts +++ b/packages/ts-docs-gen/src/file-manager.ts @@ -1,7 +1,7 @@ +import { Contracts } from "ts-extractor"; import { MarkdownGenerator } from "@simplrjs/markdown"; import * as path from "path"; -import { FileManager as FileManagerInterface } from "./contracts/file-manager"; import { Helpers } from "./utils/helpers"; import { PluginResult } from "./contracts/plugin"; import { FileResult } from "./contracts/file-result"; @@ -14,7 +14,7 @@ interface OutputData { type RenderedItemList = Array; -export class FileManager implements FileManagerInterface { +export class FileManager { /** * */ @@ -24,6 +24,16 @@ export class FileManager implements FileManagerInterface { */ private referenceToFile: Map = new Map(); + public AddEntryFile(itemResult: PluginResult): void { + const filePath = path.basename( + itemResult.ApiItem.Location.FileName, + path.extname(itemResult.ApiItem.Location.FileName + ) + ) + GeneratorHelpers.MARKDOWN_EXT; + + this.AddItem(itemResult, filePath); + } + public AddItem(itemResult: PluginResult, filePath: string): void { const items = this.filesList.get(filePath) || []; items.push(itemResult); @@ -37,13 +47,13 @@ export class FileManager implements FileManagerInterface { if (itemResult.Members != null) { for (const member of itemResult.Members) { const baseName = path.basename(filePath, path.extname(filePath)); - const targetFileNPath = path.join( + const targetFilePath = path.join( path.dirname(filePath), baseName, member.PluginResult.ApiItem.Name + GeneratorHelpers.MARKDOWN_EXT ).toLowerCase(); - this.AddItem(member.PluginResult, targetFileNPath); + this.AddItem(member.PluginResult, targetFilePath); } } } @@ -61,7 +71,7 @@ export class FileManager implements FileManagerInterface { const filePath = path.dirname(fileLocation); const referenceString = this.referenceToFile.get(referenceId); - const resolvePath = path.relative(filePath, referenceString || "#__error"); + const resolvePath = GeneratorHelpers.StandardisePath(path.relative(filePath, referenceString || "#__error")); linkDefinitions.push( MarkdownGenerator.LinkDefinition(referenceId, resolvePath) @@ -76,7 +86,7 @@ export class FileManager implements FileManagerInterface { const itemsResult = Helpers.Flatten(items.map(x => [x.Result, ""])); files.push({ - FileLocation: fileLocation, + FileLocation: GeneratorHelpers.StandardisePath(fileLocation), Result: [ ...linkDefinitions, ...itemsResult diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 9026d5cf..53eb754d 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -1,8 +1,11 @@ -import * as ts from "typescript"; -import { Contracts, ExtractDto } from "ts-extractor"; +import { Contracts, ExtractDto, TSHelpers } from "ts-extractor"; +import { LogLevel } from "simplr-logger"; import { MarkdownGenerator, MarkdownBuilder, Contracts as MarkdownContracts } from "@simplrjs/markdown"; +import * as path from "path"; + import { ApiItemReference } from "./contracts/api-item-reference"; import { ApiItemKindsAdditional } from "./contracts/plugin"; +import { Logger } from "./utils/logger"; export namespace GeneratorHelpers { export type TypeToStringDto = ReferenceDto; @@ -21,11 +24,6 @@ export namespace GeneratorHelpers { return Object.assign(Contracts.ApiItemKinds, ApiItemKindsAdditional); } - // TODO: reexport InternalSymbolName in ts-extractor. - export function IsTypeScriptInternalSymbolName(name: string): boolean { - return Object.values(ts.InternalSymbolName).indexOf(name) !== -1; - } - // TODO: implement type literal and function type. export function TypeDtoToMarkdownString(type: Contracts.TypeDto): TypeToStringDto { let references: string[] = []; @@ -66,7 +64,7 @@ export namespace GeneratorHelpers { } // Basic type with reference. - if (type.Name == null || IsTypeScriptInternalSymbolName(type.Name)) { + if (type.Name == null || TSHelpers.IsInternalSymbolName(type.Name)) { text = type.Text; } else { // FIXME: do not use flag string. Exclude Type parameters references. @@ -131,41 +129,64 @@ export namespace GeneratorHelpers { export function GetApiItemReferences( extractedData: ExtractDto, - itemsReference: Contracts.ApiItemReferenceTuple + itemsReference: Contracts.ApiItemReference[] ): ApiItemReference[] { - let list: ApiItemReference[] = []; + let overallReferences: ApiItemReference[] = []; - for (const [alias, references] of itemsReference) { - for (const referenceId of references) { + for (const item of itemsReference) { + for (const referenceId of item.Ids) { // Check if item is ExportSpecifier or ExportDeclaration. const apiItem = extractedData.Registry[referenceId]; switch (apiItem.ApiKind) { case Contracts.ApiItemKinds.Export: { - const referenceTuples = GetApiItemReferences(extractedData, apiItem.Members); - list = list.concat(referenceTuples); + if (apiItem.SourceFileId != null) { + const sourceFileReference = { Alias: apiItem.Name, Ids: [apiItem.SourceFileId] }; + const referencesList = GetApiItemReferences(extractedData, [sourceFileReference]); + overallReferences = overallReferences.concat(referencesList); + } break; } + case Contracts.ApiItemKinds.ImportSpecifier: case Contracts.ApiItemKinds.ExportSpecifier: { if (apiItem.ApiItems == null) { - console.warn(`ApiItems are missing in "${apiItem.Name}"?`); + LogWithApiItemPosition( + LogLevel.Warning, + apiItem, + `ApiItems are missing in "${apiItem.Name}"?` + ); break; } - const referenceTuples = GetApiItemReferences(extractedData, [[apiItem.Name, apiItem.ApiItems]]); - list = list.concat(referenceTuples); + + const apiItemReference = { Alias: apiItem.Name, Ids: apiItem.ApiItems }; + const referencesList = GetApiItemReferences(extractedData, [apiItemReference]); + overallReferences = overallReferences.concat(referencesList); + break; + } + case Contracts.ApiItemKinds.SourceFile: { + if (apiItem.Members == null) { + LogWithApiItemPosition( + LogLevel.Warning, + apiItem, + "Members are missing" + ); + } + + const referencesList = GetApiItemReferences(extractedData, apiItem.Members); + overallReferences = overallReferences.concat(referencesList); break; } default: { - list.push({ + overallReferences.push({ Id: referenceId, - Alias: alias + Alias: item.Alias }); } } } } - return list; + return overallReferences; } export function ApiVariableToString(item: Contracts.ApiVariableDto, alias?: string): string { @@ -298,21 +319,29 @@ export namespace GeneratorHelpers { return `${name}(${parametersString})`; } - export function GetApiItemsFromReferenceTuple( - items: Contracts.ApiItemReferenceTuple, + export function GetApiItemsFromReference( + items: Contracts.ApiItemReference[], extractedData: ExtractDto ): T[] { const apiItems: T[] = []; for (const itemReferences of items) { - const [, references] = itemReferences; - - for (const reference of references) { - const apiItem = extractedData.Registry[reference] as T; + for (const referenceId of itemReferences.Ids) { + const apiItem = extractedData.Registry[referenceId] as T; apiItems.push(apiItem); } } return apiItems; } + + export function LogWithApiItemPosition(logLevel: LogLevel, apiItem: Contracts.ApiItemDto, message: string): void { + const { FileName, Line, Character } = apiItem.Location; + const linePrefix = `${FileName}[${Line}:${Character + 1}]`; + Logger.Log(logLevel, `${linePrefix}: ${message}`); + } + + export function StandardisePath(pathString: string): string { + return pathString.split(path.sep).join("/"); + } } diff --git a/packages/ts-docs-gen/src/generator.ts b/packages/ts-docs-gen/src/generator.ts index 617a0369..d550516a 100644 --- a/packages/ts-docs-gen/src/generator.ts +++ b/packages/ts-docs-gen/src/generator.ts @@ -9,36 +9,30 @@ import { ApiDefaultPlugin } from "./plugins/api-default-plugin"; import { ApiItemReference } from "./contracts/api-item-reference"; import { PluginResult, PluginOptions, GetItemPluginResultHandler } from "./contracts/plugin"; import { FileResult } from "./contracts/file-result"; -import { GeneratorHelpers } from "./generator-helpers"; export class Generator { constructor(private configuration: GeneratorConfiguration) { this.fileManager = new FileManager(); const { ExtractedData } = this.configuration; - for (const entryFile of this.configuration.ExtractedData.EntryFiles) { - const apiItemsReferences = GeneratorHelpers.GetApiItemReferences(ExtractedData, entryFile.Members); + for (const entryFile of ExtractedData.EntryFiles) { + const sourceFile = ExtractedData.Registry[entryFile]; + const pluginResult + = this.renderApiItem({ Alias: sourceFile.Name, Id: entryFile }, sourceFile) as PluginResult; - for (const reference of apiItemsReferences) { - const renderedItem = this.getItemPluginResult(reference); - this.fileManager.AddItem(renderedItem, this.getFilePathFromEntryFile(entryFile)); - } + this.fileManager.AddEntryFile(pluginResult); } this.outputData = this.fileManager.ToFilesOutput(); } /** - * Reference check.... how Map Works here. + * FIXME: Reference check.... how Map Works here. */ private renderedItems: Map = new Map(); private fileManager: FileManager; private outputData: FileResult[]; - private getFilePathFromEntryFile(entryFile: Contracts.ApiSourceFileDto): string { - return path.basename(entryFile.Name, path.extname(entryFile.Name)) + ".md"; - } - public get OutputData(): ReadonlyArray { return this.outputData; } diff --git a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts index 481d6234..3be8ab98 100644 --- a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts @@ -32,7 +32,7 @@ export class ApiEnumPlugin implements Plugin { } ]; - const enumMembers = GeneratorHelpers.GetApiItemsFromReferenceTuple( + const enumMembers = GeneratorHelpers.GetApiItemsFromReference( data.ApiItem.Members, data.ExtractedData ); diff --git a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts index 1ce9adfd..62f07865 100644 --- a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts @@ -126,13 +126,13 @@ export class ApiFunctionPlugin implements Plugin { } ]; - const parameters = GeneratorHelpers.GetApiItemsFromReferenceTuple( + const parameters = GeneratorHelpers.GetApiItemsFromReference( data.ApiItem.Parameters, data.ExtractedData ); const resolvedParametersDto = this.resolveFunctionParameters(parameters); - const typeParameters = GeneratorHelpers.GetApiItemsFromReferenceTuple( + const typeParameters = GeneratorHelpers.GetApiItemsFromReference( data.ApiItem.TypeParameters, data.ExtractedData ); diff --git a/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts b/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts new file mode 100644 index 00000000..ed1de98b --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts @@ -0,0 +1,94 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; +import * as path from "path"; + +import { GeneratorHelpers } from "../generator-helpers"; +import { PluginMember, Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; + +interface RenderItems { + References: string[]; + Output: string[]; + Members: PluginMember[]; +} + +export class ApiSourceFilePlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.SourceFile]; + } + + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + // TODO: Move this to helpers. + private renderItems(data: PluginOptions): RenderItems { + const references = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); + const referencesList: string[] = []; + const members: PluginMember[] = []; + const builder = new MarkdownBuilder(); + + for (const reference of references) { + const apiItem = data.ExtractedData.Registry[reference.Id]; + + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Namespace: + case Contracts.ApiItemKinds.Class: { + + const renderedItem = data.GetItemPluginResult(reference); + members.push({ + Reference: reference, + PluginResult: renderedItem + }); + + builder + .Text(md => md.Header(md.Link(renderedItem.ApiItem.Name, reference.Id, true), 2)) + .EmptyLine(); + referencesList.push(reference.Id); + break; + } + default: { + const renderedItem = data.GetItemPluginResult(reference); + // Something to do with heading. Maybe heading reference registry? + builder + .Text(renderedItem.Result) + .EmptyLine(); + } + } + } + + return { + References: referencesList, + Output: builder.GetOutput(), + Members: members + }; + } + + public Render(data: PluginOptions): PluginResult { + const heading = path.basename(data.ApiItem.Name, path.extname(data.ApiItem.Name)); + const headings: PluginHeading[] = [ + { + Heading: heading, + ApiItemId: data.Reference.Id + } + ]; + + const renderedItems = this.renderItems(data); + const references: string[] = renderedItems.References; + + // Header + const builder = new MarkdownBuilder() + .Header(heading, 1) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Text(renderedItems.Output); + + return { + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: headings, + UsedReferences: references, + Result: builder.GetOutput(), + Members: renderedItems.Members + }; + } +} diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index c1d33630..a890da1a 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -5,8 +5,11 @@ Array [ Object { "FileLocation": "index.md", "Result": Array [ - "[ClassDeclaration-2]: index.md#class-earth", - "[ClassDeclaration-1]: index.md#class-world", + "[ClassDeclaration-0]: index/foo.md#class-foo", + "[ClassDeclaration-1]: index/world.md#class-world", + "[ClassDeclaration-2]: index/earth.md#class-earth", + "# index", + "", "## EnumList", "", "Simple list.", @@ -76,11 +79,11 @@ Array [ "", "string", "", - "## class: Foo", + "## [Foo][ClassDeclaration-0]", "", - "## class: World", + "## [World][ClassDeclaration-1]", "", - "## class: Earth", + "## [Earth][ClassDeclaration-2]", "", "## AnotherFoo(parameter1, parameter2)", "", @@ -353,6 +356,28 @@ Array [ "T", "", "", + "", + ], + }, + Object { + "FileLocation": "index/foo.md", + "Result": Array [ + "## class: Foo", + "", + ], + }, + Object { + "FileLocation": "index/world.md", + "Result": Array [ + "## class: World", + "", + ], + }, + Object { + "FileLocation": "index/earth.md", + "Result": Array [ + "## class: Earth", + "", ], }, ] diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap index 5ef537ea..97f1579d 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -4,15 +4,45 @@ exports[`simple-project-2 1`] = ` Array [ Object { "FileLocation": "index.md", + "Result": Array [ + "[ClassDeclaration-0]: foo/foo.md#class-foo", + "[ClassDeclaration-1]: index/foostart.md#class-foostart", + "# index", + "", + "## [Foo][ClassDeclaration-0]", + "", + "## [FooStart][ClassDeclaration-1]", + "", + "", + ], + }, + Object { + "FileLocation": "index/foo.md", "Result": Array [ "## class: Foo", "", + ], + }, + Object { + "FileLocation": "index/foostart.md", + "Result": Array [ "## class: FooStart", "", ], }, Object { "FileLocation": "foo.md", + "Result": Array [ + "[ClassDeclaration-0]: foo/foo.md#class-foo", + "# foo", + "", + "## [Foo][ClassDeclaration-0]", + "", + "", + ], + }, + Object { + "FileLocation": "foo/foo.md", "Result": Array [ "## class: Foo", "", diff --git a/tools/test-generator-cli/package.json b/tools/test-generator-cli/package.json index 6a86fc84..80e24bc6 100644 --- a/tools/test-generator-cli/package.json +++ b/tools/test-generator-cli/package.json @@ -9,6 +9,7 @@ "watch": "tsc -w", "pretest": "npm run build -- --noEmit", "test": "npm run tslint", + "test-ci": "npm test", "tslint": "tslint --project . --config ./tslint.json && echo Successfully passed tslint test." }, "keywords": [], From 65d11a1be0d229773217c3c8670ff37ab42b62b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Wed, 27 Dec 2017 17:23:22 +0200 Subject: [PATCH 55/61] Feature: Plugin result registry (#10) --- .../src/contracts/plugin-result-registry.ts | 11 ++++ packages/ts-docs-gen/src/contracts/plugin.ts | 2 + packages/ts-docs-gen/src/debug.ts | 2 +- packages/ts-docs-gen/src/file-manager.ts | 3 +- packages/ts-docs-gen/src/generator.ts | 20 ++++--- .../src/plugins/api-source-file-plugin.ts | 57 ++++++++++++------- .../src/registries/plugin-result-registry.ts | 36 ++++++++++++ .../simple-project-1.test.ts.snap | 2 + .../simple-project-2.test.ts.snap | 11 +--- 9 files changed, 101 insertions(+), 43 deletions(-) create mode 100644 packages/ts-docs-gen/src/contracts/plugin-result-registry.ts create mode 100644 packages/ts-docs-gen/src/registries/plugin-result-registry.ts diff --git a/packages/ts-docs-gen/src/contracts/plugin-result-registry.ts b/packages/ts-docs-gen/src/contracts/plugin-result-registry.ts new file mode 100644 index 00000000..3a956da9 --- /dev/null +++ b/packages/ts-docs-gen/src/contracts/plugin-result-registry.ts @@ -0,0 +1,11 @@ +import { PluginResult } from "./plugin"; +import { ApiItemReference } from "./api-item-reference"; + +export interface ReadonlyPluginResultRegistry { + GetItem(itemReference: ApiItemReference): PluginResult | undefined; + Exists(itemReference: ApiItemReference): boolean; +} + +export interface PluginResultRegistry extends ReadonlyPluginResultRegistry { + AddItem(itemReference: ApiItemReference, pluginResult: PluginResult): void; +} diff --git a/packages/ts-docs-gen/src/contracts/plugin.ts b/packages/ts-docs-gen/src/contracts/plugin.ts index da7f3f7e..65710657 100644 --- a/packages/ts-docs-gen/src/contracts/plugin.ts +++ b/packages/ts-docs-gen/src/contracts/plugin.ts @@ -19,12 +19,14 @@ export interface PluginMember { } export type GetItemPluginResultHandler = (reference: ApiItemReference) => PluginResult; +export type IsPluginResultExistsHandler = (reference: ApiItemReference) => boolean; export interface PluginOptions { Reference: ApiItemReference; ApiItem: TKind; ExtractedData: ExtractDto; GetItemPluginResult: GetItemPluginResultHandler; + IsPluginResultExists: IsPluginResultExistsHandler; } export interface PluginResult { diff --git a/packages/ts-docs-gen/src/debug.ts b/packages/ts-docs-gen/src/debug.ts index 0392b129..147abc82 100644 --- a/packages/ts-docs-gen/src/debug.ts +++ b/packages/ts-docs-gen/src/debug.ts @@ -7,7 +7,7 @@ import { Generator } from "./generator"; async function Main(): Promise { const projectDirectory = path.join(process.cwd(), "./examples/simple/"); // const entryFiles = ["./index.ts", "./exported-const-variables.ts", "./exported-functions.ts"]; - const entryFiles = ["./index.ts", "./exported-functions.ts"]; + const entryFiles = ["./exported-functions.ts", "./index.ts"]; const configPromise = new GeneratorConfigurationBuilder(projectDirectory).Build(entryFiles); const config = await configPromise; diff --git a/packages/ts-docs-gen/src/file-manager.ts b/packages/ts-docs-gen/src/file-manager.ts index 41436a00..d5760681 100644 --- a/packages/ts-docs-gen/src/file-manager.ts +++ b/packages/ts-docs-gen/src/file-manager.ts @@ -64,8 +64,7 @@ export class FileManager { for (const [fileLocation, items] of this.filesList) { // Link definitions to file location. const linkDefinitions: string[] = []; - for (const item of items) { - + for (const item of items.reverse()) { item.UsedReferences .forEach(referenceId => { const filePath = path.dirname(fileLocation); diff --git a/packages/ts-docs-gen/src/generator.ts b/packages/ts-docs-gen/src/generator.ts index d550516a..ae8bcfbe 100644 --- a/packages/ts-docs-gen/src/generator.ts +++ b/packages/ts-docs-gen/src/generator.ts @@ -9,10 +9,13 @@ import { ApiDefaultPlugin } from "./plugins/api-default-plugin"; import { ApiItemReference } from "./contracts/api-item-reference"; import { PluginResult, PluginOptions, GetItemPluginResultHandler } from "./contracts/plugin"; import { FileResult } from "./contracts/file-result"; +import { PluginResultRegistry } from "./contracts/plugin-result-registry"; +import { PluginResultRegistry as PluginResultRegistryClass } from "./registries/plugin-result-registry"; export class Generator { constructor(private configuration: GeneratorConfiguration) { this.fileManager = new FileManager(); + this.pluginResultRegistry = new PluginResultRegistryClass(); const { ExtractedData } = this.configuration; for (const entryFile of ExtractedData.EntryFiles) { @@ -26,10 +29,7 @@ export class Generator { this.outputData = this.fileManager.ToFilesOutput(); } - /** - * FIXME: Reference check.... how Map Works here. - */ - private renderedItems: Map = new Map(); + private pluginResultRegistry: PluginResultRegistry; private fileManager: FileManager; private outputData: FileResult[]; @@ -53,14 +53,15 @@ export class Generator { } private getItemPluginResult: GetItemPluginResultHandler = (apiItemReference: ApiItemReference): PluginResult => { - const renderedItem = this.renderedItems.get(apiItemReference); + const renderedItem = this.pluginResultRegistry.GetItem(apiItemReference); if (renderedItem == null) { const { Registry } = this.configuration.ExtractedData; - const renderedData = this.renderApiItem(apiItemReference, Registry[apiItemReference.Id]); - this.renderedItems.set(apiItemReference, renderedData); - return renderedData; + const pluginResult = this.renderApiItem(apiItemReference, Registry[apiItemReference.Id]); + this.pluginResultRegistry.AddItem(apiItemReference, pluginResult); + + return pluginResult; } return renderedItem; @@ -76,7 +77,8 @@ export class Generator { ExtractedData: this.configuration.ExtractedData, Reference: apiItemReference, ApiItem: apiItem, - GetItemPluginResult: this.getItemPluginResult + GetItemPluginResult: this.getItemPluginResult, + IsPluginResultExists: reference => this.pluginResultRegistry.Exists(reference) }; for (const plugin of plugins) { diff --git a/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts b/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts index ed1de98b..03d86f4b 100644 --- a/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts @@ -7,6 +7,7 @@ import { PluginMember, Plugin, SupportedApiItemKindType, PluginOptions, PluginRe interface RenderItems { References: string[]; + Headings: PluginHeading[]; Output: string[]; Members: PluginMember[]; } @@ -23,41 +24,52 @@ export class ApiSourceFilePlugin implements Plugin { // TODO: Move this to helpers. private renderItems(data: PluginOptions): RenderItems { const references = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); - const referencesList: string[] = []; + let referencesList: string[] = []; + let headingsList: PluginHeading[] = []; const members: PluginMember[] = []; const builder = new MarkdownBuilder(); for (const reference of references) { const apiItem = data.ExtractedData.Registry[reference.Id]; - switch (apiItem.ApiKind) { - case Contracts.ApiItemKinds.Namespace: - case Contracts.ApiItemKinds.Class: { + if (data.IsPluginResultExists(reference)) { + builder + .Text(md => md.Header(md.Link(apiItem.Name, reference.Id, true), 2)) + .EmptyLine(); + referencesList.push(reference.Id); + } else { + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Namespace: + case Contracts.ApiItemKinds.Class: { - const renderedItem = data.GetItemPluginResult(reference); - members.push({ - Reference: reference, - PluginResult: renderedItem - }); + const renderedItem = data.GetItemPluginResult(reference); + members.push({ + Reference: reference, + PluginResult: renderedItem + }); - builder - .Text(md => md.Header(md.Link(renderedItem.ApiItem.Name, reference.Id, true), 2)) - .EmptyLine(); - referencesList.push(reference.Id); - break; - } - default: { - const renderedItem = data.GetItemPluginResult(reference); - // Something to do with heading. Maybe heading reference registry? - builder - .Text(renderedItem.Result) - .EmptyLine(); + builder + .Text(md => md.Header(md.Link(renderedItem.ApiItem.Name, reference.Id, true), 2)) + .EmptyLine(); + referencesList.push(reference.Id); + break; + } + default: { + const renderedItem = data.GetItemPluginResult(reference); + builder + .Text(renderedItem.Result) + .EmptyLine(); + + headingsList = headingsList.concat(renderedItem.Headings); + referencesList = referencesList.concat(renderedItem.UsedReferences); + } } } } return { References: referencesList, + Headings: headingsList, Output: builder.GetOutput(), Members: members }; @@ -65,7 +77,7 @@ export class ApiSourceFilePlugin implements Plugin { public Render(data: PluginOptions): PluginResult { const heading = path.basename(data.ApiItem.Name, path.extname(data.ApiItem.Name)); - const headings: PluginHeading[] = [ + let headings: PluginHeading[] = [ { Heading: heading, ApiItemId: data.Reference.Id @@ -74,6 +86,7 @@ export class ApiSourceFilePlugin implements Plugin { const renderedItems = this.renderItems(data); const references: string[] = renderedItems.References; + headings = headings.concat(renderedItems.Headings); // Header const builder = new MarkdownBuilder() diff --git a/packages/ts-docs-gen/src/registries/plugin-result-registry.ts b/packages/ts-docs-gen/src/registries/plugin-result-registry.ts new file mode 100644 index 00000000..d622c1db --- /dev/null +++ b/packages/ts-docs-gen/src/registries/plugin-result-registry.ts @@ -0,0 +1,36 @@ +import { ApiItemReference } from "../contracts/api-item-reference"; +import { PluginResult } from "../contracts/plugin"; +import { PluginResultRegistry as PluginResultRegistryInterface } from "../contracts/plugin-result-registry"; + +export class PluginResultRegistry implements PluginResultRegistryInterface { + private results: Map = new Map(); + + private getKey(itemReference: ApiItemReference): ApiItemReference | undefined { + for (const [reference] of this.results) { + if (itemReference.Alias === reference.Alias && + itemReference.Id === reference.Id) { + return reference; + } + } + + return undefined; + } + + public AddItem(itemReference: ApiItemReference, pluginResult: PluginResult): void { + const key = this.getKey(itemReference) || itemReference; + this.results.set(key, pluginResult); + } + + public GetItem(itemReference: ApiItemReference): PluginResult | undefined { + const realKey = this.getKey(itemReference); + if (realKey != null) { + return this.results.get(realKey); + } else { + return undefined; + } + } + + public Exists(itemReference: ApiItemReference): boolean { + return this.getKey(itemReference) != null; + } +} diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index a890da1a..53bab2b8 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -8,6 +8,8 @@ Array [ "[ClassDeclaration-0]: index/foo.md#class-foo", "[ClassDeclaration-1]: index/world.md#class-world", "[ClassDeclaration-2]: index/earth.md#class-earth", + "[ClassDeclaration-2]: index/earth.md#class-earth", + "[ClassDeclaration-1]: index/world.md#class-world", "# index", "", "## EnumList", diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap index 97f1579d..64b34875 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -5,7 +5,7 @@ Array [ Object { "FileLocation": "index.md", "Result": Array [ - "[ClassDeclaration-0]: foo/foo.md#class-foo", + "[ClassDeclaration-0]: index/foo.md#class-foo", "[ClassDeclaration-1]: index/foostart.md#class-foostart", "# index", "", @@ -33,7 +33,7 @@ Array [ Object { "FileLocation": "foo.md", "Result": Array [ - "[ClassDeclaration-0]: foo/foo.md#class-foo", + "[ClassDeclaration-0]: index/foo.md#class-foo", "# foo", "", "## [Foo][ClassDeclaration-0]", @@ -41,12 +41,5 @@ Array [ "", ], }, - Object { - "FileLocation": "foo/foo.md", - "Result": Array [ - "## class: Foo", - "", - ], - }, ] `; From 9ce856390a0d5ed2060c991c410a390de68662ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Fri, 29 Dec 2017 13:28:24 +0200 Subject: [PATCH 56/61] Feature: Class plugin (#11) --- .../examples/simple/docs/api/index.md | 21 +--- .../examples/simple/docs/api/index/hello.md | 71 +++++++++++ packages/ts-docs-gen/examples/simple/index.ts | 36 ++++-- packages/ts-docs-gen/src/contracts/plugin.ts | 9 +- packages/ts-docs-gen/src/default-plugins.ts | 10 +- packages/ts-docs-gen/src/generator-helpers.ts | 116 +++++++++++++++++- .../plugins/api-class-constructor-plugin.ts | 73 +++++++++++ .../src/plugins/api-class-method-plugin.ts | 77 ++++++++++++ .../src/plugins/api-class-plugin.ts | 93 ++++++++++++++ .../src/plugins/api-class-property-plugin.ts | 46 +++++++ .../simple-project-1.test.ts.snap | 42 +++++-- .../simple-project-2.test.ts.snap | 46 ++++++- 12 files changed, 593 insertions(+), 47 deletions(-) create mode 100644 packages/ts-docs-gen/examples/simple/docs/api/index/hello.md create mode 100644 packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-class-plugin.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index b028f9f1..a4736fe9 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,22 +1,5 @@ -[ModuleDeclaration-0]: index\foonamespace.md#foonamespace +[ClassDeclaration-0]: index/hello.md#hello # index -## MyFunction() - -```typescript -function MyFunction(): T -``` - -### Type parameters - -| Name | Constraint type | Default type | -| ---- | -------------------------------------------------------------- | ------------------------- | -| T | \{ myProperty: string; myPropertyTwo?: number \| undefined; \} | \{ myProperty: string; \} | - -### Return type - -T - - -## [FooNamespace][ModuleDeclaration-0] +## [Hello][ClassDeclaration-0] diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md new file mode 100644 index 00000000..cc6438ea --- /dev/null +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md @@ -0,0 +1,71 @@ +# Hello + +```typescript +class Hello +``` +## Constructor + +### constructor(arg) + +This is a constructor + +```typescript +constructor(arg: string) +``` +#### Parameters + +| Name | Type | Description | +| ---- | ------ | ---------------------- | +| arg | string | This is an argument ;) | + + +## Methods + +### GetFoo(arg) + +```typescript +public GetFoo(arg: number): string +``` +#### Parameters + +| Name | Type | +| ---- | ------ | +| arg | number | + + +### GetFoo(arg) + +```typescript +public GetFoo(arg: string): string +``` +#### Parameters + +| Name | Type | +| ---- | ------ | +| arg | string | + + +### GetFoo(arg) + +```typescript +public GetFoo(arg: string | number): string +``` +#### Parameters + +| Name | Type | +| ---- | ---------------- | +| arg | string \| number | + + +## Properties + +### Foo + +```typescript +public Foo: string; +``` + +### Type + +string + diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index e01fe1db..724fafda 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -79,11 +79,11 @@ // anotherProperty: number; // } -export function MyFunction(): T { - return { - myProperty: "sampleString" - } as T; -} +// export function MyFunction(): T { +// return { +// myProperty: "sampleString" +// } as T; +// } // export interface MyInterface { // (param1: TValue, param2: TValue): boolean; @@ -203,10 +203,26 @@ export function MyFunction { IsPluginResultExists: IsPluginResultExistsHandler; } -export interface PluginResult { - Reference: ApiItemReference; - ApiItem: TKind; +export interface PluginResultData { /** * All headings used in `Result` with ApiItemIds. */ @@ -47,6 +45,11 @@ export interface PluginResult { Members?: PluginMember[]; } +export interface PluginResult extends PluginResultData { + Reference: ApiItemReference; + ApiItem: TKind; +} + export interface Plugin { SupportedApiItemKinds(): SupportedApiItemKindType[]; CheckApiItem(item: TKind): boolean; diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index d7541d65..cf90c6a7 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -4,6 +4,10 @@ import { ApiEnumPlugin } from "./plugins/api-enum-plugin"; import { ApiFunctionPlugin } from "./plugins/api-function-plugin"; import { ApiTypePlugin } from "./plugins/api-type-plugin"; import { ApiNamespacePlugin } from "./plugins/api-namespace-plugin"; +import { ApiClassPlugin } from "./plugins/api-class-plugin"; +import { ApiClassConstructorPlugin } from "./plugins/api-class-constructor-plugin"; +import { ApiClassMethodPlugin } from "./plugins/api-class-method-plugin"; +import { ApiClassPropertyPlugin } from "./plugins/api-class-property-plugin"; export const DefaultPlugins = [ new ApiSourceFilePlugin(), @@ -11,5 +15,9 @@ export const DefaultPlugins = [ new ApiEnumPlugin(), new ApiFunctionPlugin(), new ApiTypePlugin(), - new ApiNamespacePlugin() + new ApiNamespacePlugin(), + new ApiClassPlugin(), + new ApiClassConstructorPlugin(), + new ApiClassMethodPlugin(), + new ApiClassPropertyPlugin() ]; diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 53eb754d..8b018276 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -4,7 +4,7 @@ import { MarkdownGenerator, MarkdownBuilder, Contracts as MarkdownContracts } fr import * as path from "path"; import { ApiItemReference } from "./contracts/api-item-reference"; -import { ApiItemKindsAdditional } from "./contracts/plugin"; +import { ApiItemKindsAdditional, PluginResultData } from "./contracts/plugin"; import { Logger } from "./utils/logger"; export namespace GeneratorHelpers { @@ -306,6 +306,43 @@ export namespace GeneratorHelpers { return `${apiItem.Name}${$extends}${defaultType}`; } + export function ClassToString( + apiItem: Contracts.ApiClassDto, + typeParameters?: Contracts.ApiTypeParameterDto[], + alias?: string + ): string { + const name = alias || apiItem.Name; + // Abstract + const abstract = apiItem.IsAbstract ? "abstract " : ""; + + // TypeParameters + let typeParametersString: string; + if (typeParameters != null && typeParameters.length > 0) { + const params: string[] = typeParameters.map(TypeParameterToString); + typeParametersString = `<${params.join(", ")}>`; + } else { + typeParametersString = ""; + } + + // Extends + let extendsString: string; + if (apiItem.Extends != null) { + extendsString = ` extends ${apiItem.Extends.Text}`; + } else { + extendsString = ""; + } + + // Implements + let implementsString: string; + if (apiItem.Implements != null && apiItem.Implements.length > 0) { + implementsString = ` implements ${apiItem.Implements.map(x => x.Text).join(", ")}`; + } else { + implementsString = ""; + } + + return `${abstract}class ${name}${typeParametersString}${extendsString}${implementsString}`; + } + export function ApiFunctionToSimpleString( alias: string, apiItem: Contracts.ApiFunctionDto, @@ -319,6 +356,66 @@ export namespace GeneratorHelpers { return `${name}(${parametersString})`; } + export function ApiClassMethodToString( + apiItem: Contracts.ApiClassMethodDto, + parameters: Contracts.ApiParameterDto[], + alias?: string + ): string { + const name = alias || apiItem.Name; + + const optional = apiItem.IsOptional ? "?" : ""; + const abstract = apiItem.IsAbstract ? " abstract" : ""; + const async = apiItem.IsAsync ? " async" : ""; + const $static = apiItem.IsStatic ? " static" : ""; + const functionHeader = CallableParametersToString(`${name}${optional}`, parameters, apiItem.ReturnType); + + return `${apiItem.AccessModifier}${$static}${abstract}${async} ${functionHeader}`.trim(); + } + + export function ApiClassPropertyToString(apiItem: Contracts.ApiClassPropertyDto, alias?: string): string { + const name = alias || apiItem.Name; + + const optional = apiItem.IsOptional ? "?" : ""; + const abstract = apiItem.IsAbstract ? " abstract" : ""; + const $static = apiItem.IsStatic ? " static" : ""; + + return `${apiItem.AccessModifier}${$static}${abstract} ${name}${optional}: ${apiItem.Type.Text};`; + } + + export function CallableParametersToSimpleString(text: string, parameters: Contracts.ApiParameterDto[]): string { + const parametersString = parameters + .map(x => x.Name) + .join(", "); + + return `${text}(${parametersString})`; + } + + export function CallableParametersToString( + text: string, + parameters: Contracts.ApiParameterDto[], + returnType?: Contracts.TypeDto + ): string { + // Parameters + let parametersString: string; + if (parameters != null && parameters.length > 0) { + parametersString = parameters + .map(x => `${x.Name}: ${x.Type.Text}`) + .join(", "); + } else { + parametersString = ""; + } + + // ReturnType + let returnTypeString: string; + if (returnType != null) { + returnTypeString = `: ${returnType.Text}`; + } else { + returnTypeString = ""; + } + + return `${text}(${parametersString})${returnTypeString}`; + } + export function GetApiItemsFromReference( items: Contracts.ApiItemReference[], extractedData: ExtractDto @@ -344,4 +441,21 @@ export namespace GeneratorHelpers { export function StandardisePath(pathString: string): string { return pathString.split(path.sep).join("/"); } + + export function MergePluginResultData(a: T, b: Partial): T { + a.Headings = a.Headings.concat(b.Headings || []); + a.Members = (a.Members || []).concat(b.Members || []); + a.Result = a.Result.concat(b.Result || []); + a.UsedReferences = a.UsedReferences.concat(b.UsedReferences || []); + + return a; + } + + export function GetDefaultPluginResultData(): PluginResultData { + return { + Headings: [], + Result: [], + UsedReferences: [] + }; + } } diff --git a/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts new file mode 100644 index 00000000..8d432fe0 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts @@ -0,0 +1,73 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; +import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginResultData } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; + +export class ApiClassConstructorPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.ClassConstructor]; + } + + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + private renderParameters(parameters: Contracts.ApiParameterDto[]): PluginResultData { + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + if (parameters.length === 0) { + return pluginResult; + } + + let referenceIds: string[] = []; + const header = ["Name", "Type", "Description"]; + + const content = parameters.map(parameter => { + const parameterTypeDto = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); + + referenceIds = referenceIds.concat(parameterTypeDto.References); + + return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), parameter.Metadata.DocumentationComment]; + }); + + const builder = new MarkdownBuilder() + .Header("Parameters", 4) + .EmptyLine() + .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) + .EmptyLine(); + + pluginResult.UsedReferences = referenceIds; + pluginResult.Result = builder.GetOutput(); + + return pluginResult; + } + + public Render(options: PluginOptions): PluginResult { + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + const builder = new MarkdownBuilder(); + + // Parameters + const apiParameters = GeneratorHelpers + .GetApiItemsFromReference(options.ApiItem.Parameters, options.ExtractedData); + const parameters = this.renderParameters(apiParameters); + + const heading = GeneratorHelpers.CallableParametersToSimpleString("constructor", apiParameters); + + pluginResult.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); + + builder + .Header(heading, 3) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .Code(GeneratorHelpers.CallableParametersToString("constructor", apiParameters), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .Text(parameters.Result); + + GeneratorHelpers.MergePluginResultData(pluginResult, parameters); + pluginResult.Result = builder.GetOutput(); + + return { + ApiItem: options.ApiItem, + Reference: options.Reference, + ...pluginResult + }; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts new file mode 100644 index 00000000..3f12685b --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts @@ -0,0 +1,77 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; +import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginResultData } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; + +export class ApiClassMethodPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.ClassMethod]; + } + + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + private renderParameters(parameters: Contracts.ApiParameterDto[]): PluginResultData { + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + if (parameters.length === 0) { + return pluginResult; + } + + let referenceIds: string[] = []; + const header = ["Name", "Type", "Description"]; + + const content = parameters.map(parameter => { + const parameterTypeDto = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); + + referenceIds = referenceIds.concat(parameterTypeDto.References); + + return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), parameter.Metadata.DocumentationComment]; + }); + + const builder = new MarkdownBuilder() + .Header("Parameters", 4) + .EmptyLine() + .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) + .EmptyLine(); + + pluginResult.UsedReferences = referenceIds; + pluginResult.Result = builder.GetOutput(); + + return pluginResult; + } + + public Render(options: PluginOptions): PluginResult { + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + const builder = new MarkdownBuilder(); + + // Parameters + const apiParameters = GeneratorHelpers + .GetApiItemsFromReference(options.ApiItem.Parameters, options.ExtractedData); + const parameters = this.renderParameters(apiParameters); + + const heading = GeneratorHelpers.CallableParametersToSimpleString(options.Reference.Alias, apiParameters); + + pluginResult.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); + + builder + .Header(heading, 3) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .Code(GeneratorHelpers.ApiClassMethodToString( + options.ApiItem, + apiParameters, + options.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .Text(parameters.Result); + + GeneratorHelpers.MergePluginResultData(pluginResult, parameters); + pluginResult.Result = builder.GetOutput(); + + return { + ApiItem: options.ApiItem, + Reference: options.Reference, + ...pluginResult + }; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-class-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-plugin.ts new file mode 100644 index 00000000..f69311c3 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-class-plugin.ts @@ -0,0 +1,93 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; +import * as path from "path"; + +import { GeneratorHelpers } from "../generator-helpers"; +import { + Plugin, + SupportedApiItemKindType, + PluginOptions, + PluginResult, + PluginResultData +} from "../contracts/plugin"; + +export class ApiClassPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Class]; + } + + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + private renderMembers(data: PluginOptions): PluginResultData { + const references = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); + const renderedItems = references.map(x => data.GetItemPluginResult(x)); + const pluginResultData = GeneratorHelpers.GetDefaultPluginResultData(); + const builder = new MarkdownBuilder(); + + const list: Array<[Contracts.ApiItemKinds, string]> = [ + [Contracts.ApiItemKinds.Index, "Index"], + [Contracts.ApiItemKinds.ClassConstructor, "Constructor"], + [Contracts.ApiItemKinds.ClassMethod, "Methods"], + [Contracts.ApiItemKinds.ClassProperty, "Properties"] + ]; + + for (const [kind, heading] of list) { + const pluginResultsByKind = renderedItems.filter(x => x.ApiItem.ApiKind === kind); + + if (pluginResultsByKind.length > 0) { + builder + .Header(heading, 2) + .EmptyLine(); + + for (const item of pluginResultsByKind) { + GeneratorHelpers.MergePluginResultData(pluginResultData, item); + + builder + .Text(item.Result) + .EmptyLine(); + } + } + } + + pluginResultData.Result = builder.GetOutput(); + return pluginResultData; + } + + public Render(data: PluginOptions): PluginResult { + const typeParameters = GeneratorHelpers + .GetApiItemsFromReference(data.ApiItem.TypeParameters, data.ExtractedData); + + const pluginResult: PluginResult = { + ApiItem: data.ApiItem, + Reference: data.Reference, + ...GeneratorHelpers.GetDefaultPluginResultData() + }; + const heading = path.basename(data.ApiItem.Name, path.extname(data.ApiItem.Name)); + pluginResult.Headings = [ + { + Heading: heading, + ApiItemId: data.Reference.Id + } + ]; + + // Header + const builder = new MarkdownBuilder() + .Header(heading, 1) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Code(GeneratorHelpers.ClassToString( + data.ApiItem, + typeParameters, + data.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS); + pluginResult.Result = builder.GetOutput(); + + // ApiMembers + const members = this.renderMembers(data); + GeneratorHelpers.MergePluginResultData(pluginResult, members); + + return pluginResult; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts new file mode 100644 index 00000000..1df3b160 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts @@ -0,0 +1,46 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; +import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; + +export class ApiClassPropertyPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.ClassProperty]; + } + + public CheckApiItem(item: Contracts.ApiItemDto): boolean { + return true; + } + + public Render(options: PluginOptions): PluginResult { + const pluginResultData = GeneratorHelpers.GetDefaultPluginResultData(); + const builder = new MarkdownBuilder(); + + const heading = options.Reference.Alias; + pluginResultData.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); + + const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(options.ApiItem.Type); + pluginResultData.UsedReferences = pluginResultData.UsedReferences.concat(typeStringDto.References); + + builder + .Header(heading, 3) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .Code(GeneratorHelpers.ApiClassPropertyToString( + options.ApiItem, + options.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine() + .Header("Type", 3) + .EmptyLine() + .Text(typeStringDto.Text); + + pluginResultData.Result = builder.GetOutput(); + + return { + ApiItem: options.ApiItem, + Reference: options.Reference, + ...pluginResultData + }; + } +} diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index 53bab2b8..3af0b655 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -5,11 +5,11 @@ Array [ Object { "FileLocation": "index.md", "Result": Array [ - "[ClassDeclaration-0]: index/foo.md#class-foo", - "[ClassDeclaration-1]: index/world.md#class-world", - "[ClassDeclaration-2]: index/earth.md#class-earth", - "[ClassDeclaration-2]: index/earth.md#class-earth", - "[ClassDeclaration-1]: index/world.md#class-world", + "[ClassDeclaration-0]: index/foo.md#foo", + "[ClassDeclaration-1]: index/world.md#world", + "[ClassDeclaration-2]: index/earth.md#earth", + "[ClassDeclaration-2]: index/earth.md#earth", + "[ClassDeclaration-1]: index/world.md#world", "# index", "", "## EnumList", @@ -364,21 +364,47 @@ Array [ Object { "FileLocation": "index/foo.md", "Result": Array [ - "## class: Foo", + "# Foo", + "", + "\`\`\`typescript", + "class Foo", + "\`\`\`", + "## Methods", + "", + "### HandleMessage(message)", + "", + "\`\`\`typescript", + "public HandleMessage(message: string): string", + "\`\`\`", + "#### Parameters", + "", + "| Name | Type |", + "| ------- | ------ |", + "| message | string |", + "", + "", "", ], }, Object { "FileLocation": "index/world.md", "Result": Array [ - "## class: World", + "# World", + "", + "\`\`\`typescript", + "class World", + "\`\`\`", "", ], }, Object { "FileLocation": "index/earth.md", "Result": Array [ - "## class: Earth", + "# Earth", + "", + "\`\`\`typescript", + "class Earth", + "\`\`\`", "", ], }, diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap index 64b34875..8897f5c1 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -5,8 +5,8 @@ Array [ Object { "FileLocation": "index.md", "Result": Array [ - "[ClassDeclaration-0]: index/foo.md#class-foo", - "[ClassDeclaration-1]: index/foostart.md#class-foostart", + "[ClassDeclaration-0]: index/foo.md#foo", + "[ClassDeclaration-1]: index/foostart.md#foostart", "# index", "", "## [Foo][ClassDeclaration-0]", @@ -19,21 +19,57 @@ Array [ Object { "FileLocation": "index/foo.md", "Result": Array [ - "## class: Foo", + "# Foo", + "", + "\`\`\`typescript", + "class Foo", + "\`\`\`", + "## Methods", + "", + "### GetMessage(message)", + "", + "\`\`\`typescript", + "public GetMessage(message: string): string", + "\`\`\`", + "#### Parameters", + "", + "| Name | Type |", + "| ------- | ------ |", + "| message | string |", + "", + "", "", ], }, Object { "FileLocation": "index/foostart.md", "Result": Array [ - "## class: FooStart", + "# FooStart", + "", + "\`\`\`typescript", + "class FooStart", + "\`\`\`", + "## Methods", + "", + "### HandleMessage(message)", + "", + "\`\`\`typescript", + "public HandleMessage(message: string): string", + "\`\`\`", + "#### Parameters", + "", + "| Name | Type |", + "| ------- | ------ |", + "| message | string |", + "", + "", "", ], }, Object { "FileLocation": "foo.md", "Result": Array [ - "[ClassDeclaration-0]: index/foo.md#class-foo", + "[ClassDeclaration-0]: index/foo.md#foo", "# foo", "", "## [Foo][ClassDeclaration-0]", From 59ae49e5990edcf6a240aaddcab746db39e1e313 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Tue, 2 Jan 2018 11:25:48 +0200 Subject: [PATCH 57/61] Feature: interface plugin (#12) --- common/config/rush/npm-shrinkwrap.json | 471 ++++++++++---- .../examples/simple/docs/api/index.md | 548 +++++++++++++++- .../examples/simple/docs/api/index/hello.md | 6 +- packages/ts-docs-gen/examples/simple/index.ts | 115 +++- packages/ts-docs-gen/package.json | 4 +- packages/ts-docs-gen/src/default-plugins.ts | 6 + packages/ts-docs-gen/src/generator-helpers.ts | 320 ++++++++- .../src/plugins/api-callable-plugin.ts | 97 +++ .../src/plugins/api-function-plugin.ts | 60 +- .../src/plugins/api-index-plugin.ts | 50 ++ .../src/plugins/api-interface-plugin.ts | 214 ++++++ .../simple-project-1.test.ts.snap | 613 +++++++++++++++++- .../tests/cases/simple-project-1/index.ts | 99 +++ 13 files changed, 2353 insertions(+), 250 deletions(-) create mode 100644 packages/ts-docs-gen/src/plugins/api-callable-plugin.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-index-plugin.ts create mode 100644 packages/ts-docs-gen/src/plugins/api-interface-plugin.ts diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index d181315d..ec5e0ec1 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.0.0-beta.35", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.35.tgz", - "integrity": "sha512-l0SE8cl9DUIY4hYAFAKTLX3F2Yr14Qri7uTsuI7iegB5E4KyQy4XY72L3VOxmj6kwR/RDQURoKYr2NzyETGo7A==", + "version": "7.0.0-beta.36", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz", + "integrity": "sha512-sW77BFwJ48YvQp3Gzz5xtAUiXuYOL2aMJKDwiaY3OcvdqBFurtYfOpSa4QrNyDxmOGRFSYzUpabU2m9QrlWE7w==", "requires": { "chalk": "2.3.0", "esutils": "2.0.2", @@ -16,7 +16,7 @@ }, "@rush-temp/test-generator-cli": { "version": "file:projects/test-generator-cli.tgz", - "integrity": "sha1-JJJ6MyfmltDVjIVMJwQ1+5PfnzY=", + "integrity": "sha1-poL86JfifvnYdj6kO8BwW/R5VEA=", "requires": { "@types/fs-extra": "4.0.7", "@types/handlebars": "4.0.36", @@ -33,19 +33,19 @@ }, "@rush-temp/ts-docs-gen": { "version": "file:projects/ts-docs-gen.tgz", - "integrity": "sha1-AGcTehH/O+/1KBdtdw3/lnlFnlQ=", + "integrity": "sha1-X6xmRRnm3HUhBtQEy5JoWktjvnQ=", "requires": { - "@simplrjs/markdown": "1.0.3", + "@simplrjs/markdown": "1.0.7", "@types/fs-extra": "5.0.0", - "@types/jest": "21.1.9", + "@types/jest": "21.1.10", "@types/sinon": "4.1.2", "fast-glob": "1.0.1", "fs-extra": "5.0.0", - "jest": "22.0.3", + "jest": "22.0.4", "simplr-logger": "1.0.1", "simplr-tslint": "0.0.1", "sinon": "4.1.3", - "ts-extractor": "3.0.1", + "ts-extractor": "3.0.3", "ts-jest": "22.0.0", "tslint": "5.8.0", "typescript": "2.6.2" @@ -72,9 +72,9 @@ } }, "@simplrjs/markdown": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.3.tgz", - "integrity": "sha512-QkC79ttUek7d9w1yysaETZnsD7WO7JOLCbAIX8kCAeZhMY/21ZRULWjb3Pl7SBm6QqqYTOnKl8rvikmbVaGtLA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@simplrjs/markdown/-/markdown-1.0.7.tgz", + "integrity": "sha512-QIIyLpb37GHpQD+7a5FCz/cxB2RVBp8mn2rSoFMkC0ZZAFIsw1UEmy7B9nPTPW923VNW5w9+4GnVqCUqkvCqfQ==", "requires": { "@types/string": "0.0.29", "string": "3.3.3" @@ -94,9 +94,9 @@ "integrity": "sha512-LjNiTX7TY7wtuC6y3QwC93hKMuqYhgV9A1uXBKNvZtVC8ZvyWAjZkJ5BvT0K7RKqORRYRLMrqCxpw5RgS+MdrQ==" }, "@types/jest": { - "version": "21.1.9", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.9.tgz", - "integrity": "sha512-81wGgp3KLAhcrDQBeGADeuH1SvOmgZty5XF/mdPBOSxjEgAT9rcLr4CQCk2cRRjZE8vzmx7S1SPL6D/Z8OOR6A==" + "version": "21.1.10", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.10.tgz", + "integrity": "sha512-qDyqzbcyNgW2RgWbl606xCYQ+5fK9khOW5+Hl3wH7RggVES0dB6GcZvpmPs/XIty5qpu1xYCwpiK+iRkJ3xFBw==" }, "@types/node": { "version": "8.5.2", @@ -124,16 +124,16 @@ "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" }, "acorn": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", - "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==" + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", + "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==" }, "acorn-globals": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz", "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", "requires": { - "acorn": "5.2.1" + "acorn": "5.3.0" } }, "ajv": { @@ -444,9 +444,9 @@ } }, "babel-jest": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-22.0.3.tgz", - "integrity": "sha512-vIJAdq0YuLwg5TF6DDvcSFYx+Cqb9f2pTzC3ZcpGUBeysUUzPxZ6J3WVvuFMzpxgHa23tDKlNivDN9C4jIAKUQ==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-22.0.4.tgz", + "integrity": "sha512-/Yt61fUpdFjetYlnpj280BPKEsPnK4mqzxDdo8DybPvrPNrLurbAF/WBjn2nnoi1Hc2Ippsf12/aOp8ys/Vl1A==", "requires": { "babel-plugin-istanbul": "4.1.5", "babel-preset-jest": "22.0.3" @@ -828,6 +828,42 @@ "is-descriptor": "0.1.6" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -1059,7 +1095,7 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "requires": { - "is-descriptor": "1.0.1" + "is-descriptor": "1.0.2" } }, "delayed-stream": { @@ -1126,9 +1162,9 @@ } }, "es6-promise": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz", - "integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng==" + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.2.tgz", + "integrity": "sha512-LSas5vsuA6Q4nEdf9wokY5/AJYXry98i0IzXsv49rYsgDGDNDPbqAYR1Pe23iFxygfbGZNR/5VrHXBCh2BhvUQ==" }, "escape-string-regexp": { "version": "1.0.5", @@ -1213,6 +1249,42 @@ "is-descriptor": "0.1.6" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -1313,9 +1385,9 @@ } }, "extglob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.2.tgz", - "integrity": "sha512-I0+eZBH+jFGL8F5BnIz2ON2nKCjTS3AS3H/5PeSmCp7UVC70Ym8IhdRiQly2juKYQ//f7z1aj1BRpQniFJoU1w==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.3.tgz", + "integrity": "sha512-AyptZexgu7qppEPq59DtN/XJGZDrLcVxSHai+4hdgMMS9EpF4GBvygcWWApno8lL9qSjVpYt7Raao28qzJX1ww==", "requires": { "array-unique": "0.3.2", "define-property": "1.0.0", @@ -1758,21 +1830,11 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } + "kind-of": "6.0.2" } }, "is-arrayish": { @@ -1815,21 +1877,11 @@ } }, "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "1.1.6" - } - } + "kind-of": "6.0.2" } }, "is-date-object": { @@ -1838,20 +1890,13 @@ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-descriptor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", - "integrity": "sha512-G3fFVFTqfaqu7r4YuSBHKBAuOaLz8Sy7ekklUpFEliaLMP1Y2ZjoN9jS62YWCAPQrQpMUQSitRlrzibbuCZjdA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "requires": { - "is-accessor-descriptor": "0.1.6", - "is-data-descriptor": "0.1.4", - "kind-of": "5.1.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - } + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" } }, "is-dotfile": { @@ -2110,11 +2155,11 @@ } }, "jest": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest/-/jest-22.0.3.tgz", - "integrity": "sha512-90H1wLqiNR3tLhQUgwhC6GWHfRCG+Da14m7vxD608Mt/QTKR0TA751D+QH09x5bvcrLfvxLtxArtA0VEC0ORow==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest/-/jest-22.0.4.tgz", + "integrity": "sha512-S0tmgK5psULvt/11QzgAZWGpY5y5TkMRzd3T21Q13JzTx37Vx6F0Nw022c9Kc/IbEy+AHkKkGFVO5QafE8MrDg==", "requires": { - "jest-cli": "22.0.3" + "jest-cli": "22.0.4" }, "dependencies": { "ansi-regex": { @@ -2175,9 +2220,9 @@ } }, "jest-cli": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.0.3.tgz", - "integrity": "sha512-aX71DL4q9aLxbSmYI8uuPVlXVRyREU4VbApOdiuD79oqqqSGYu9E5S1SLXRm/PB5lJPh5xd8bVRrdsrMVs2hyw==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.0.4.tgz", + "integrity": "sha512-f1lZRM13IwIINzjE3RebXQKtQLiKncpSrbJZ/aTZJXmzEWGdgSayW4ESyhU+xK3uGiJEUSzbHjwPY6nGJ8VbUA==", "requires": { "ansi-escapes": "3.0.0", "chalk": "2.3.0", @@ -2189,17 +2234,17 @@ "istanbul-lib-instrument": "1.9.1", "istanbul-lib-source-maps": "1.2.2", "jest-changed-files": "22.0.3", - "jest-config": "22.0.3", - "jest-environment-jsdom": "22.0.3", + "jest-config": "22.0.4", + "jest-environment-jsdom": "22.0.4", "jest-get-type": "22.0.3", "jest-haste-map": "22.0.3", "jest-message-util": "22.0.3", "jest-regex-util": "22.0.3", "jest-resolve-dependencies": "22.0.3", - "jest-runner": "22.0.3", - "jest-runtime": "22.0.3", + "jest-runner": "22.0.4", + "jest-runtime": "22.0.4", "jest-snapshot": "22.0.3", - "jest-util": "22.0.3", + "jest-util": "22.0.4", "jest-worker": "22.0.3", "micromatch": "2.3.11", "node-notifier": "5.1.2", @@ -2259,19 +2304,19 @@ } }, "jest-config": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-22.0.3.tgz", - "integrity": "sha512-omqyzFPhRm+YaHku+jPuqpSFJ0QD61G/hqR+m09r2IajJbaRjV9XDezCIOD+rJiQlAyfFfo+DAc+u1mLy2IEaA==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-22.0.4.tgz", + "integrity": "sha512-NcBeixqHjHDZO9+pUj+365LQV2s65d2f0/IrwlUyv0xaJovRNc6eDvoJ/r2UUlHnqjP3Go+R0ECUsXPXjk4SHw==", "requires": { "chalk": "2.3.0", "glob": "7.1.2", - "jest-environment-jsdom": "22.0.3", - "jest-environment-node": "22.0.3", + "jest-environment-jsdom": "22.0.4", + "jest-environment-node": "22.0.4", "jest-get-type": "22.0.3", - "jest-jasmine2": "22.0.3", + "jest-jasmine2": "22.0.4", "jest-regex-util": "22.0.3", - "jest-resolve": "22.0.3", - "jest-util": "22.0.3", + "jest-resolve": "22.0.4", + "jest-util": "22.0.4", "jest-validate": "22.0.3", "pretty-format": "22.0.3" } @@ -2296,22 +2341,22 @@ } }, "jest-environment-jsdom": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-22.0.3.tgz", - "integrity": "sha512-LrR9flT6I4IZKIA/dmoAiTmTzGi7W8sP5mCXbgsTjFop1Jh3rNluza/xnf6VfK/aOZvBglJIVYbKqGxtcm0KsQ==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-22.0.4.tgz", + "integrity": "sha512-vnjefLZlsNsmnjKcaXkx2IxTBNG40vfRVOdMfcfkPkq85JxFB7wzNtjLx+RIfiNpIZd04C1PXbF0aJIenY85Ng==", "requires": { "jest-mock": "22.0.3", - "jest-util": "22.0.3", + "jest-util": "22.0.4", "jsdom": "11.5.1" } }, "jest-environment-node": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-22.0.3.tgz", - "integrity": "sha512-Kk7FYtCQZ+CFwwCL1t3DJ/Lxvjoda4qRt/NJh/6jsAEWM7VcSBAzmmayA5JcMRpQQ4FRiUcLrvrKEfO01/Fgsw==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-22.0.4.tgz", + "integrity": "sha512-9vjNKb86UivvKCZCudMNixQgdMnOG7ql6iVYnaiK0CmvZ0WQD+mlM10NvgiWpRv4HstcnRL1pY/GSIHXAD6qXw==", "requires": { "jest-mock": "22.0.3", - "jest-util": "22.0.3" + "jest-util": "22.0.4" } }, "jest-get-type": { @@ -2415,9 +2460,9 @@ } }, "jest-jasmine2": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-22.0.3.tgz", - "integrity": "sha512-0Gz3pFZytCjbCKssBJWzx5NolNLg179gkT0Zfe+fWrJS9Ap9EH7eTB9UHoiT2O3lRNBfaYTzrXhOMgf4l/jCMg==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-22.0.4.tgz", + "integrity": "sha512-pn1XPHUkffHK6oNY1Dfl/+Rg0UuTdlg3aGDnjyK6dZzGEBeiH1uKuSgZEjy3Lj461l3atpzsQyw7ilXPyjFnUw==", "requires": { "callsites": "2.0.0", "chalk": "2.3.0", @@ -2453,7 +2498,7 @@ "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-22.0.3.tgz", "integrity": "sha512-AVBdCx7Oj5wBpMOH089lx7Zgwpdz9HbReA82HuVAlIT4kEQRvCy6Sl9yVWDGJwHTgB/OYQGkgmbv/P/K8TkWNw==", "requires": { - "@babel/code-frame": "7.0.0-beta.35", + "@babel/code-frame": "7.0.0-beta.36", "chalk": "2.3.0", "micromatch": "2.3.11", "slash": "1.0.0", @@ -2553,9 +2598,9 @@ "integrity": "sha512-mplC9chiAotES3ClzNhy0SJcfHB2DivooKJZW+2hDdvP8LLB+OUI+D6bJd7sncbKUsyFcmblEvpm/zz/hef7HA==" }, "jest-resolve": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-22.0.3.tgz", - "integrity": "sha512-UHpim1kXTXH5hlftIpVOUkh0n+wd36/QNuYgpZnzwX8PsB8DizBuaPJbl5VvorHBpRouz21Ty0K0QM1pPny9cw==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-22.0.4.tgz", + "integrity": "sha512-yoxHsX4MTT2Ra/dFia9VCunzsA/4jMBENMmLjREIUkCIP1edk/PZUOGVVf680Gw04CtmT5stETylcbmbL7hJBw==", "requires": { "browser-resolve": "1.11.2", "chalk": "2.3.0" @@ -2570,38 +2615,38 @@ } }, "jest-runner": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-22.0.3.tgz", - "integrity": "sha512-b/Eh+bPFLU09R0AULy4/IcUQ4Cgiao7YcmCehI7eailVj2xGQAfhmzSlhDpVIYmvoRZFyReOseihZXXRsdFafA==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-22.0.4.tgz", + "integrity": "sha512-srBkbqmiSB+jzSaG652fmi3kS6rV6wS/4fOG8dxxBg3dCqNQcM2/L3TI3ZK0SwIAcdGJh5Gybs8aDboT8K9Cdw==", "requires": { - "jest-config": "22.0.3", + "jest-config": "22.0.4", "jest-docblock": "22.0.3", "jest-haste-map": "22.0.3", - "jest-jasmine2": "22.0.3", + "jest-jasmine2": "22.0.4", "jest-leak-detector": "22.0.3", "jest-message-util": "22.0.3", - "jest-runtime": "22.0.3", - "jest-util": "22.0.3", + "jest-runtime": "22.0.4", + "jest-util": "22.0.4", "jest-worker": "22.0.3", "throat": "4.1.0" } }, "jest-runtime": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-22.0.3.tgz", - "integrity": "sha512-SSOiAde16JhEtVtNaWV2OmimmyxP8lmUdHxYde5rwv7iibkRy/o4QtalmmmH48oUxwy/epZVDaEyBKBA/iDFBg==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-22.0.4.tgz", + "integrity": "sha512-+7uEwf/4f8k1E/eViyGK6/M5yA4O3f6TdWViuqF9MV7vXwG2OVJu8YEZa5239nEnHJiwinXp4eZXX+HB4pQRPg==", "requires": { "babel-core": "6.26.0", - "babel-jest": "22.0.3", + "babel-jest": "22.0.4", "babel-plugin-istanbul": "4.1.5", "chalk": "2.3.0", "convert-source-map": "1.5.1", "graceful-fs": "4.1.11", - "jest-config": "22.0.3", + "jest-config": "22.0.4", "jest-haste-map": "22.0.3", "jest-regex-util": "22.0.3", - "jest-resolve": "22.0.3", - "jest-util": "22.0.3", + "jest-resolve": "22.0.4", + "jest-util": "22.0.4", "json-stable-stringify": "1.0.1", "micromatch": "2.3.11", "realpath-native": "1.0.0", @@ -2712,9 +2757,9 @@ } }, "jest-util": { - "version": "22.0.3", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-22.0.3.tgz", - "integrity": "sha512-iDnKIw4P+9433L7II90UGYZ4rQOatbbcjZO/+1+Fga+rNUF1wEijDfTDjGQil98smAquvB02RBrDgfbquUHLmg==", + "version": "22.0.4", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-22.0.4.tgz", + "integrity": "sha512-gNNPtcCFkVh7daKIl3/06eoQ90QXGXCyDOfyZ3IEyTWmHBdX3GvklcOtyGcdOvrYEubaZTfMcMKmEeo/6sRTog==", "requires": { "callsites": "2.0.0", "chalk": "2.3.0", @@ -2764,7 +2809,7 @@ "integrity": "sha512-89ztIZ03aYK9f1uUrLXLsZndRge/JnZjzjpaN+lrse3coqz+8PR/dX4WLHpbF5fIKTXhDjFODOJw2328lPJ90g==", "requires": { "abab": "1.0.4", - "acorn": "5.2.1", + "acorn": "5.3.0", "acorn-globals": "4.1.0", "array-equal": "1.0.0", "browser-process-hrtime": "0.1.2", @@ -3006,7 +3051,7 @@ "braces": "2.3.0", "define-property": "1.0.0", "extend-shallow": "2.0.1", - "extglob": "2.0.2", + "extglob": "2.0.3", "fragment-cache": "0.2.1", "kind-of": "6.0.2", "nanomatch": "1.2.6", @@ -3216,6 +3261,22 @@ "is-descriptor": "0.1.6" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + } + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -3643,7 +3704,7 @@ "integrity": "sha1-YUYwSGkKxqRVt1ti+nioj43IXlM=", "requires": { "call-me-maybe": "1.0.1", - "es6-promise": "4.1.1", + "es6-promise": "4.2.2", "glob-to-regexp": "0.3.0" } }, @@ -3957,6 +4018,42 @@ "is-descriptor": "0.1.6" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -4130,6 +4227,42 @@ "is-descriptor": "0.1.6" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -4419,6 +4552,42 @@ "is-descriptor": "0.1.6" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", @@ -4474,9 +4643,9 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, "ts-extractor": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-3.0.1.tgz", - "integrity": "sha512-ghuDQd1kVvQ+A7WbcclGXzSVukXVNKjwaB2AO/oeOYpkw1we7FkgGvVFFogtvo2jJyVBsBQDmKtB92UHcW9FsQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-3.0.3.tgz", + "integrity": "sha512-4izZ/Mn0UgyCYz4Cl+x0C1WVVpl0ez6BuCCB8RAwti6teujA1OxfsbZI2oL/vwS2DFYECtVlsjqnapUm3bBIHA==", "requires": { "@types/fs-extra": "5.0.0", "fs-extra": "5.0.0", @@ -4516,7 +4685,7 @@ "babel-preset-jest": "22.0.3", "cpx": "1.5.0", "fs-extra": "4.0.3", - "jest-config": "22.0.3", + "jest-config": "22.0.4", "pkg-dir": "2.0.0", "source-map-support": "0.5.0", "yargs": "10.0.3" @@ -4542,13 +4711,13 @@ "resolve": "1.5.0", "semver": "5.4.1", "tslib": "1.8.1", - "tsutils": "2.13.1" + "tsutils": "2.15.0" } }, "tsutils": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.13.1.tgz", - "integrity": "sha512-XMOEvc2TiYesVSOJMI7OYPnBMSgcvERuGW5Li/J+2A0TuH607BPQnOLQ82oSPZCssB8c9+QGi6qhTBa/f1xQRA==", + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.15.0.tgz", + "integrity": "sha512-kKb1mSqRMwF0GHKya5/hZsI2m7Flg4ONZDeYu4e6Gx+kYAu86zsLNCHcUmNWhCRaUcKshNI272hOzuaCQDzJ2g==", "requires": { "tslib": "1.8.1" } @@ -4667,6 +4836,42 @@ "is-descriptor": "0.1.6" } }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index a4736fe9..773f12df 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,5 +1,549 @@ -[ClassDeclaration-0]: index/hello.md#hello +[InterfaceDeclaration-1]: index.md#foo +[InterfaceDeclaration-2]: index.md#boo +[InterfaceDeclaration-4]: index.md#myconstrainttype +[InterfaceDeclaration-9]: index.md#dictionary +[InterfaceDeclaration-9]: index.md#dictionary +[InterfaceDeclaration-6]: index.md#objectsinterface +[InterfaceDeclaration-12]: index.md#monsterinterface # index -## [Hello][ClassDeclaration-0] +## interface ExtendedBar + +```typescript +interface ExtendedBar extends Foo, Boo { + OtherStuff: string[]; +} +``` + +### Extends + +[Foo][InterfaceDeclaration-1]<number> + +[Boo][InterfaceDeclaration-2] + +### Properties + +| Name | Type | +| ---------- | --------------------- | +| OtherStuff | Array<string> | + +## interface Foo + +```typescript +interface Foo { + Name: string; + Surname: string; + Type: TType; +} +``` + +### Type parameters + +| Name | +| ----- | +| TType | + +### Properties + +| Name | Type | +| ------- | ------ | +| Name | string | +| Surname | string | +| Type | TType | + +## interface Boo + +```typescript +interface Boo { + Boos: string[]; +} +``` + +### Properties + +| Name | Type | +| ---- | --------------------- | +| Boos | Array<string> | + +## interface AnotherInterface + +```typescript +interface AnotherInterface { + (param1: TValue, param2: TValue): boolean; +} +``` + +### Call + +```typescript +(param1: TValue, param2: TValue): boolean +``` + +Type parameters: + +| Name | +| ------ | +| TValue | + +Parameters: + +| Name | Type | +| ------ | ------ | +| param1 | TValue | +| param2 | TValue | + +Return type: + +true | false + +--- + + +## interface MyConstraintType + +```typescript +interface MyConstraintType { + myProperty: string; +} +``` + +### Properties + +| Name | Type | +| ---------- | ------ | +| myProperty | string | + +## interface MyDefaultType + +```typescript +interface MyDefaultType extends MyConstraintType { + anotherProperty: number; +} +``` + +### Extends + +[MyConstraintType][InterfaceDeclaration-4] + +### Properties + +| Name | Type | +| --------------- | ------ | +| anotherProperty | number | + +## interface ObjectsInterface + +```typescript +interface ObjectsInterface { + objectOne: Object; + objectTwo: Object; +} +``` + +### Properties + +| Name | Type | +| --------- | ------ | +| objectOne | Object | +| objectTwo | Object | + +## interface InterfaceWithCall + +```typescript +interface InterfaceWithCall { + (): { someProperty: T; }; +} +``` + +### Call + +```typescript +(): { someProperty: T; } +``` + +Type parameters: + +| Name | +| ---- | +| T | + +Return type: + +{ someProperty: T; } + +--- + + +## interface InterfaceWithConstraintType + +```typescript +interface InterfaceWithConstraintType extends Dictionary { + someProperty: string; +} +``` + +### Extends + +[Dictionary][InterfaceDeclaration-9]<string> + +### Properties + +| Name | Type | +| ------------ | ------ | +| someProperty | string | + +## interface InterfaceWithMethod + +```typescript +interface InterfaceWithMethod { + someMethodOne(): T; + someMethodTwo(): TReturn; +} +``` + +### Type parameters + +| Name | +| ---- | +| T | + +### Methods + +```typescript +someMethodOne(): T +``` + +Return type: + +T + +--- + +```typescript +someMethodTwo(): TReturn +``` + +Type parameters: + +| Name | +| ------- | +| TReturn | + +Return type: + +TReturn + +--- + + +## interface Dictionary + +```typescript +interface Dictionary { + new (): Dictionary; + [key: string]: TValue; +} +``` + +### Type parameters + +| Name | +| ------ | +| TValue | + +### Construct + +```typescript +new (): Dictionary +``` + +Return type: + +[Dictionary][InterfaceDeclaration-9]<TValue> + +--- + +### Index signatures + +```typescript +[key: string]: TValue +``` + +Index `key` - string + +Type - TValue + +--- + + +## interface MethodsInterface + +```typescript +interface MethodsInterface { + (arg: TValue): void; + someMethod(): string; +} +``` + +### Call + +```typescript +(arg: TValue): void +``` + +Type parameters: + +| Name | +| ------ | +| TValue | + +Parameters: + +| Name | Type | +| ---- | ------ | +| arg | TValue | + +Return type: + +void + +--- + +### Methods + +```typescript +someMethod(): string +``` + +Type parameters: + +| Name | +| ---- | +| T | + +Return type: + +string + +--- + + +## interface MonsterInterface + +Warning: Beta! + +Deprecated! + +Monster interface + +```typescript +interface MonsterInterface extends ObjectsInterface { + new (): MonsterInterface; + new (someParameter: string): string; + (): { someProperty: T; }; + (key?: string | undefined): { someProperty: T; }; + (key: number): { someProperty: T; }; + readonly [key: string]: TValue; + readonly objectOne?: TValue; + objectTwo: TValue; +} +``` + +### Type parameters + +| Name | Constraint type | Default type | +| ------ | --------------- | ------------ | +| TValue | Object | \{\} | + +### Extends + +[ObjectsInterface][InterfaceDeclaration-6] + +### Construct + +```typescript +new (): MonsterInterface +``` + +Type parameters: + +| Name | +| ---- | +| T | + +Return type: + +[MonsterInterface][InterfaceDeclaration-12]<T> + +--- + +```typescript +new (someParameter: string): string +``` + +Parameters: + +| Name | Type | +| ------------- | ------ | +| someParameter | string | + +Return type: + +string + +--- + +### Call + +```typescript +(): { someProperty: T; } +``` + +Type parameters: + +| Name | +| ---- | +| T | + +Return type: + +{ someProperty: T; } + +--- + +```typescript +(key?: string | undefined): { someProperty: T; } +``` + +Type parameters: + +| Name | +| ---- | +| T | + +Parameters: + +| Name | Type | Optional | +| ---- | ----------------------- | -------- | +| key | undefined | string | Yes | + +Return type: + +{ someProperty: T; } + +--- + +```typescript +(key: number): { someProperty: T; } +``` + +Type parameters: + +| Name | +| ---- | +| T | + +Parameters: + +| Name | Type | +| ---- | ------ | +| key | number | + +Return type: + +{ someProperty: T; } + +--- + +### Index signatures + +```typescript +readonly [key: string]: TValue +``` + +Readonly. + +Index `key` - string + +Type - TValue + +--- + +### Properties + +| Name | Type | +| --------- | ------ | +| objectOne | TValue | +| objectTwo | TValue | + +## interface SomeInterface + +```typescript +interface SomeInterface { + [key: string]: string | number; + [key: number]: string; +} +``` + +### Index signatures + +```typescript +[key: string]: string | number +``` + +Index `key` - string + +Type - string | number + +--- + +```typescript +[key: number]: string +``` + +Index `key` - number + +Type - string + +--- + + +## interface StringsDictionary + +```typescript +interface StringsDictionary { + [key: string]: string; +} +``` + +### Index signatures + +```typescript +[key: string]: string +``` + +Index `key` - string + +Type - string + +--- + + +## interface MyInterface + +```typescript +interface MyInterface { + MyPropertyOne: string; + MyPropertyTwo: Object; + MyPropertyThree: number; +} +``` + +### Properties + +| Name | Type | +| --------------- | ------ | +| MyPropertyOne | string | +| MyPropertyTwo | Object | +| MyPropertyThree | number | diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md index cc6438ea..82cfc54a 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md @@ -52,9 +52,9 @@ public GetFoo(arg: string | number): string ``` #### Parameters -| Name | Type | -| ---- | ---------------- | -| arg | string \| number | +| Name | Type | +| ---- | -------------------- | +| arg | string | number | ## Properties diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index 724fafda..4d793115 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -1,5 +1,94 @@ // tslint:disable +export interface ExtendedBar extends Foo, Boo { + OtherStuff: string[]; +} + +export interface Foo { + Name: string; + Surname: string; + Type: TType; +} + +export interface Boo { + Boos: string[]; +} + +export interface AnotherInterface { + (param1: TValue, param2: TValue): boolean; +} + +export interface MyConstraintType { + myProperty: string; +} + +export interface MyDefaultType extends MyConstraintType { + anotherProperty: number; +} + +export interface ObjectsInterface { + objectOne: Object; + objectTwo: Object; +} + +export interface InterfaceWithCall { + (): { someProperty: T }; +} + +export interface InterfaceWithConstraintType extends Dictionary { + someProperty: string; +} + +export interface InterfaceWithMethod { + someMethodOne(): T; + someMethodTwo(): TReturn; +} + +export interface Dictionary { + new(): Dictionary; + [key: string]: TValue; +} + +export interface MethodsInterface { + someMethod(): string; + (arg: TValue): void; +} + +/** + * Monster interface + * @beta + * @deprecated + */ +export interface MonsterInterface extends ObjectsInterface { + new (): MonsterInterface; + new(someParameter: string): string; + + readonly [key: string]: TValue; + + (): { someProperty: T }; + (key?: string): { someProperty: T }; + (key: number): { someProperty: T }; + + readonly objectOne: TValue; + objectTwo: TValue; +} + +export interface SomeInterface { + [key: string]: string | number; + [key: number]: string; +} + +export interface StringsDictionary { + [key: string]: string; +} + +export interface MyInterface { + MyPropertyOne: string; + MyPropertyTwo: Object; + MyPropertyThree: number; +} + + // import { Foo } from "./exported-functions"; // export class World { } @@ -211,18 +300,18 @@ // } // } -export class Hello { - /** - * This is a constructor - * @param arg This is an argument ;) - */ - constructor(arg: string) { } +// export class Hello { +// /** +// * This is a constructor +// * @param arg This is an argument ;) +// */ +// constructor(arg: string) { } - GetFoo(arg: number): string - GetFoo(arg: string): string - GetFoo(arg: string | number): string { - throw new Error("Method not implemented."); - } +// GetFoo(arg: number): string +// GetFoo(arg: string): string +// GetFoo(arg: string | number): string { +// throw new Error("Method not implemented."); +// } - public Foo: string; -} +// public Foo: string; +// } diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index 8a284c47..202da6e3 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -15,12 +15,12 @@ "engine": "node >= 7.5.0", "author": "simplrjs (https://github.com/simplrjs)", "dependencies": { - "@simplrjs/markdown": "^1.0.3", + "@simplrjs/markdown": "^1.0.7", "@types/fs-extra": "^5.0.0", "fast-glob": "^1.0.1", "fs-extra": "^5.0.0", "simplr-logger": "^1.0.1", - "ts-extractor": "^3.0.1", + "ts-extractor": "^3.0.3", "typescript": "^2.6.2" }, "devDependencies": { diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index cf90c6a7..decf9706 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -4,6 +4,9 @@ import { ApiEnumPlugin } from "./plugins/api-enum-plugin"; import { ApiFunctionPlugin } from "./plugins/api-function-plugin"; import { ApiTypePlugin } from "./plugins/api-type-plugin"; import { ApiNamespacePlugin } from "./plugins/api-namespace-plugin"; +import { ApiInterfacePlugin } from "./plugins/api-interface-plugin"; +import { ApiCallablePlugin } from "./plugins/api-callable-plugin"; +import { ApiIndexPlugin } from "./plugins/api-index-plugin"; import { ApiClassPlugin } from "./plugins/api-class-plugin"; import { ApiClassConstructorPlugin } from "./plugins/api-class-constructor-plugin"; import { ApiClassMethodPlugin } from "./plugins/api-class-method-plugin"; @@ -16,6 +19,9 @@ export const DefaultPlugins = [ new ApiFunctionPlugin(), new ApiTypePlugin(), new ApiNamespacePlugin(), + new ApiInterfacePlugin(), + new ApiCallablePlugin(), + new ApiIndexPlugin(), new ApiClassPlugin(), new ApiClassConstructorPlugin(), new ApiClassMethodPlugin(), diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 8b018276..a4a8d398 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -55,14 +55,6 @@ export namespace GeneratorHelpers { } case Contracts.TypeKinds.Basic: default: { - // Generics - if (type.Name != null && type.Generics != null) { - const generics = type.Generics.map(TypeDtoToMarkdownString); - references = references.concat(...generics.map(x => x.References)); - - text += `<${generics.map(x => x.Text).join(", ")}>`; - } - // Basic type with reference. if (type.Name == null || TSHelpers.IsInternalSymbolName(type.Name)) { text = type.Text; @@ -75,6 +67,14 @@ export namespace GeneratorHelpers { text = type.Name; } } + + // Generics + if (type.Name != null && type.Generics != null) { + const generics = type.Generics.map(TypeDtoToMarkdownString); + references = references.concat(...generics.map(x => x.References)); + + text += MarkdownGenerator.EscapeString(`<${generics.map(x => x.Text).join(", ")}>`); + } } } @@ -239,7 +239,8 @@ export namespace GeneratorHelpers { }; export const DEFAULT_TABLE_OPTIONS: MarkdownContracts.TableOptions = { - removeColumnIfEmpty: true + removeColumnIfEmpty: true, + removeRowIfEmpty: true }; export function FixSentence(sentence: string, punctuationMark: string = "."): string { @@ -261,49 +262,99 @@ export namespace GeneratorHelpers { return `type ${name} = ${item.Type.Text};`; } + export function TypeParametersToString(typeParameters?: Contracts.ApiTypeParameterDto[]): string { + if (typeParameters != null && typeParameters.length > 0) { + const params: string[] = typeParameters.map(TypeParameterToString); + return `<${params.join(", ")}>`; + } else { + return ""; + } + } + + export function TypeParameterToString(apiItem: Contracts.ApiTypeParameterDto): string { + const extendsString = apiItem.ConstraintType != null ? ` extends ${apiItem.ConstraintType.Text}` : ""; + const defaultType = apiItem.DefaultType != null ? ` = ${apiItem.DefaultType.Text}` : ""; + + return `${apiItem.Name}${extendsString}${defaultType}`; + } + /** - * From ApiFunction to build function head. + * Builds call declaration. * - * Return example: `function foo(arg: TValue): void` + * Return example: `(arg: TValue): void` */ - export function ApiFunctionToString( - apiItem: Contracts.ApiFunctionDto, + export function ApiCallToString( typeParameters?: Contracts.ApiTypeParameterDto[], parameters?: Contracts.ApiParameterDto[], - alias?: string + returnType?: Contracts.TypeDto ): string { - const name = alias || apiItem.Name; - // TypeParameters - let typeParametersString: string; - if (typeParameters != null && typeParameters.length > 0) { - const params: string[] = typeParameters.map(TypeParameterToString); - typeParametersString = `<${params.join(", ")}>`; - } else { - typeParametersString = ""; - } + const typeParametersString = TypeParametersToString(typeParameters); // Parameters let parametersString: string; if (parameters != null && parameters.length > 0) { parametersString = parameters - .map(x => `${x.Name}: ${x.Type.Text}`) + .map(ApiParameterToString) .join(", "); } else { parametersString = ""; } // ReturnType - const returnType = apiItem.ReturnType != null ? `: ${apiItem.ReturnType.Text}` : ""; + const returnTypeString = returnType != null ? `: ${returnType.Text}` : ""; - return `function ${name}${typeParametersString}(${parametersString})${returnType}`; + return `${typeParametersString}(${parametersString})${returnTypeString}`; } - export function TypeParameterToString(apiItem: Contracts.ApiTypeParameterDto): string { - const $extends = apiItem.ConstraintType != null ? ` extends ${apiItem.ConstraintType.Text}` : ""; - const defaultType = apiItem.DefaultType != null ? ` = ${apiItem.DefaultType.Text}` : ""; + // FIXME: `?` and `| undefined` in a single statement. + export function ApiParameterToString(apiItem: Contracts.ApiParameterDto): string { + const initializerString = apiItem.Initializer ? ` = ${apiItem.Initializer}` : ""; + const isOptionalString = apiItem.IsOptional ? "?" : ""; + return `${apiItem.Name}${isOptionalString}: ${apiItem.Type.Text}${initializerString}`; + } - return `${apiItem.Name}${$extends}${defaultType}`; + /** + * Builds function head from ApiFunction. + * + * Return example: `function foo(arg: TValue): void` + */ + export function ApiFunctionToString( + apiItem: Contracts.ApiFunctionDto, + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + alias?: string + ): string { + const name = alias || apiItem.Name; + const callString = ApiCallToString(typeParameters, parameters, apiItem.ReturnType); + + return `function ${name}${callString}`; + } + + /** + * Builds construct declaration. + * + * Return example: `new (arg: TValue): void` + */ + export function ApiConstructToString( + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + returnType?: Contracts.TypeDto + ): string { + const callString = ApiCallToString(typeParameters, parameters, returnType); + + return `new ${callString}`; + } + + export function ApiMethodToString( + name: string, + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + returnType?: Contracts.TypeDto + ): string { + const callString = ApiCallToString(typeParameters, parameters, returnType); + + return `${name}${callString}`; } export function ClassToString( @@ -418,14 +469,17 @@ export namespace GeneratorHelpers { export function GetApiItemsFromReference( items: Contracts.ApiItemReference[], - extractedData: ExtractDto + extractedData: ExtractDto, + apiItemKind?: Contracts.ApiItemKinds ): T[] { const apiItems: T[] = []; for (const itemReferences of items) { for (const referenceId of itemReferences.Ids) { const apiItem = extractedData.Registry[referenceId] as T; - apiItems.push(apiItem); + if (apiItemKind == null || apiItemKind != null && apiItem.ApiKind === apiItemKind) { + apiItems.push(apiItem); + } } } @@ -442,6 +496,208 @@ export namespace GeneratorHelpers { return pathString.split(path.sep).join("/"); } + export function ApiInterfaceToSimpleString(alias: string, apiItem: Contracts.ApiInterfaceDto): string { + const name = alias || apiItem.Name; + return `interface ${name}`; + } + + // TODO: optimize. + export function ApiInterfaceToString( + apiItem: Contracts.ApiInterfaceDto, + extractedData: ExtractDto + ): string[] { + const typeParameters = GetApiItemsFromReference(apiItem.TypeParameters, extractedData); + const typeParametersString = TypeParametersToString(typeParameters); + + let extendsString: string; + + if (apiItem.Extends.length === 0) { + extendsString = ""; + } else { + const typesExtended = apiItem.Extends + .map(x => x.Text) + .join(", "); + extendsString = ` extends ${typesExtended}`; + } + + const builder = new MarkdownBuilder() + .Text(`interface ${apiItem.Name}${typeParametersString}${extendsString} {`); + + const constructMembers = GetApiItemsFromReference( + apiItem.Members, + extractedData, + Contracts.ApiItemKinds.Construct + ); + constructMembers.forEach(member => { + const parameters = GetApiItemsFromReference(member.Parameters, extractedData); + const memberTypeParameters = GetApiItemsFromReference(member.TypeParameters, extractedData); + builder.Text(`${Tab(1)}${ApiConstructToString(memberTypeParameters, parameters, member.ReturnType)};`); + }); + + const callMembers = GetApiItemsFromReference( + apiItem.Members, + extractedData, + Contracts.ApiItemKinds.Call + ); + callMembers.forEach(member => { + const parameters = GetApiItemsFromReference(member.Parameters, extractedData); + const memberTypeParameters = GetApiItemsFromReference(member.TypeParameters, extractedData); + builder.Text(`${Tab(1)}${ApiCallToString(memberTypeParameters, parameters, member.ReturnType)};`); + }); + + const indexMembers = GetApiItemsFromReference( + apiItem.Members, + extractedData, + Contracts.ApiItemKinds.Index + ); + indexMembers.forEach(member => { + const parameter = extractedData.Registry[member.Parameter] as Contracts.ApiParameterDto; + builder.Text(`${Tab(1)}${ApiIndexToString(parameter, member.Type, member.IsReadonly)};`); + }); + + const methodMembers = GetApiItemsFromReference( + apiItem.Members, + extractedData, + Contracts.ApiItemKinds.Method + ); + methodMembers.forEach(member => { + const parameters = GetApiItemsFromReference(member.Parameters, extractedData); + const memberTypeParameters = GetApiItemsFromReference(member.TypeParameters, extractedData); + + builder.Text(`${Tab(1)}${ApiMethodToString(member.Name, memberTypeParameters, parameters, member.ReturnType)};`); + }); + + const propertyMembers = GetApiItemsFromReference( + apiItem.Members, + extractedData, + Contracts.ApiItemKinds.Property + ); + propertyMembers.forEach(member => { + builder.Text(`${Tab(1)}${ApiPropertyToString(member)};`); + }); + + builder.Text("}"); + + return builder.GetOutput(); + } + + export function ApiPropertyToString(apiItem: Contracts.ApiPropertyDto): string { + const isReadOnlyString = apiItem.IsReadonly ? "readonly " : ""; + const isOptionalString = apiItem.IsReadonly ? "?" : ""; + const returnTypeString = apiItem.Type.Text; + return `${isReadOnlyString}${apiItem.Name}${isOptionalString}: ${returnTypeString}`; + } + + // TODO: add description from @template jsdoc tag. + export function ApiTypeParametersTableToString(typeParameters: Contracts.ApiTypeParameterDto[]): ReferenceDto { + if (typeParameters.length === 0) { + return { + References: [], + Text: [] + }; + } + + let referenceIds: string[] = []; + const header = ["Name", "Constraint type", "Default type"]; + const content = typeParameters.map(typeParameter => { + let constraintType: string = ""; + let defaultType: string = ""; + + if (typeParameter.ConstraintType) { + const parsedConstraintType = TypeDtoToMarkdownString(typeParameter.ConstraintType); + + referenceIds = referenceIds.concat(parsedConstraintType.References); + constraintType = MarkdownGenerator.EscapeString(parsedConstraintType.Text); + } + + if (typeParameter.DefaultType) { + const parsedDefaultType = TypeDtoToMarkdownString(typeParameter.DefaultType); + + referenceIds = referenceIds.concat(parsedDefaultType.References); + defaultType = MarkdownGenerator.EscapeString(parsedDefaultType.Text); + } + + return [typeParameter.Name, constraintType, defaultType]; + }); + + return { + References: referenceIds, + Text: MarkdownGenerator.Table(header, content, DEFAULT_TABLE_OPTIONS) + }; + } + + export function IsApiItemKind( + itemKind: Contracts.ApiItemKinds, + apiItem: Contracts.ApiItemDto): apiItem is TKindDto { + return apiItem.ApiKind === itemKind; + } + + // TODO: implement description. + // TODO: implement IsSpread. + export function ApiParametersToTableString(parameters: Contracts.ApiParameterDto[]): ReferenceDto { + if (parameters.length === 0) { + return { + References: [], + Text: [] + }; + } + + let referenceIds: string[] = []; + const header = ["Name", "Type", "Optional", "Initial value", "Description"]; + + const content = parameters.map(parameter => { + const parameterTypeDto = TypeDtoToMarkdownString(parameter.Type); + + referenceIds = referenceIds.concat(parameterTypeDto.References); + + const isOptionalString = parameter.IsOptional ? "Yes" : ""; + const initializerString = parameter.Initializer || ""; + + return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), isOptionalString, initializerString]; + }); + + return { + Text: MarkdownGenerator.Table(header, content, DEFAULT_TABLE_OPTIONS), + References: referenceIds + }; + } + + export function ApiIndexToString(parameter: Contracts.ApiParameterDto, type: Contracts.TypeDto, readOnly: boolean = false): string { + const typeString = TypeDtoToMarkdownString(type).Text; + const parameterTypeString = TypeDtoToMarkdownString(parameter.Type).Text; + + const readOnlyString = readOnly ? "readonly " : ""; + + return `${readOnlyString}[${parameter.Name}: ${parameterTypeString}]: ${typeString}`; + } + + export function ApiPropertiesToTableString(properties: Contracts.ApiPropertyDto[]): ReferenceDto { + if (properties.length === 0) { + return { + References: [], + Text: [] + }; + } + + let referenceIds: string[] = []; + const header = ["Name", "Type", "Optional"]; + + const content = properties.map(property => { + const parameterTypeDto = TypeDtoToMarkdownString(property.Type); + + referenceIds = referenceIds.concat(parameterTypeDto.References); + + const isOptionalString = property.IsOptional ? "Yes" : ""; + + return [property.Name, parameterTypeDto.Text, isOptionalString]; + }); + + return { + Text: MarkdownGenerator.Table(header, content, DEFAULT_TABLE_OPTIONS), + References: referenceIds + }; + } + export function MergePluginResultData(a: T, b: Partial): T { a.Headings = a.Headings.concat(b.Headings || []); a.Members = (a.Members || []).concat(b.Members || []); diff --git a/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts new file mode 100644 index 00000000..73d144f8 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts @@ -0,0 +1,97 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +import { Plugin, SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; + +export type CallableApiItem = Contracts.ApiCallDto | Contracts.ApiMethodDto | Contracts.ApiConstructDto; + +export class ApiCallablePlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [ + GeneratorHelpers.ApiItemKinds.Construct, + GeneratorHelpers.ApiItemKinds.Call, + GeneratorHelpers.ApiItemKinds.Method + ]; + } + + public CheckApiItem(item: CallableApiItem): boolean { + return true; + } + + private resolveItemCode( + apiItem: CallableApiItem, + parameters: Contracts.ApiParameterDto[], + typeParameters: Contracts.ApiTypeParameterDto[] + ): string { + + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Construct: { + return GeneratorHelpers.ApiConstructToString(typeParameters, parameters, apiItem.ReturnType); + } + case Contracts.ApiItemKinds.Call: { + return GeneratorHelpers.ApiCallToString(typeParameters, parameters, apiItem.ReturnType); + } + case Contracts.ApiItemKinds.Method: { + return GeneratorHelpers.ApiMethodToString(apiItem.Name, typeParameters, parameters, apiItem.ReturnType); + } + } + } + + public Render(data: PluginOptions): PluginResult { + const usedReferences = []; + const parameters = GeneratorHelpers.GetApiItemsFromReference( + data.ApiItem.Parameters, + data.ExtractedData + ); + const typeParameters = GeneratorHelpers.GetApiItemsFromReference( + data.ApiItem.TypeParameters, + data.ExtractedData + ); + + const builder = new MarkdownBuilder() + .Code(this.resolveItemCode(data.ApiItem, parameters, typeParameters), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine(); + + if (typeParameters.length > 0) { + const table = GeneratorHelpers.ApiTypeParametersTableToString(typeParameters); + usedReferences.push(...table.References); + + builder + .Text("Type parameters:") + .EmptyLine() + .Text(table.Text) + .EmptyLine(); + } + + if (parameters.length > 0) { + const table = GeneratorHelpers.ApiParametersToTableString(parameters); + usedReferences.push(...table.References); + + builder + .Text("Parameters:") + .EmptyLine() + .Text(table.Text) + .EmptyLine(); + } + + if (data.ApiItem.ReturnType) { + const renderedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.ReturnType); + + builder + .Text("Return type:") + .EmptyLine() + .Text(renderedReturnType.Text); + + usedReferences.push(...renderedReturnType.References); + } + + return { + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: [], + Result: builder.GetOutput(), + UsedReferences: usedReferences + }; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts index 62f07865..00093db5 100644 --- a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts @@ -1,5 +1,5 @@ import { Contracts } from "ts-extractor"; -import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; +import { MarkdownBuilder } from "@simplrjs/markdown"; import { GeneratorHelpers } from "../generator-helpers"; import { SupportedApiItemKindType, Plugin, PluginResult, PluginOptions, PluginHeading } from "../contracts/plugin"; @@ -23,72 +23,34 @@ export class ApiFunctionPlugin implements Plugin { }; } - let referenceIds: string[] = []; - const header = ["Name", "Type", "Description"]; - - const content = parameters.map(parameter => { - const parameterTypeDto = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); - - referenceIds = referenceIds.concat(parameterTypeDto.References); - - return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text)]; - }); - - const text = new MarkdownBuilder() + const table = GeneratorHelpers.ApiParametersToTableString(parameters); + const builder = new MarkdownBuilder() .Header("Parameters", 3) .EmptyLine() - .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) - .EmptyLine() - .GetOutput(); + .Text(table.Text) + .EmptyLine(); return { - Text: text, - References: referenceIds + Text: builder.GetOutput(), + References: table.References }; } - // TODO: add description from @template jsdoc tag. private resolveFunctionTypeParameters(typeParameters: Contracts.ApiTypeParameterDto[]): GeneratorHelpers.ReferenceDto { - let referenceIds: string[] = []; - if (typeParameters.length === 0) { - return { - References: [], - Text: [] - }; + return { References: [], Text: [] }; } - const header = ["Name", "Constraint type", "Default type"]; - const content = typeParameters.map(typeParameter => { - let constraintType: string = ""; - let defaultType: string = ""; - - if (typeParameter.ConstraintType) { - const parsedConstraintType = GeneratorHelpers.TypeDtoToMarkdownString(typeParameter.ConstraintType); - - referenceIds = referenceIds.concat(parsedConstraintType.References); - constraintType = MarkdownGenerator.EscapeString(parsedConstraintType.Text); - } - - if (typeParameter.DefaultType) { - const parsedDefaultType = GeneratorHelpers.TypeDtoToMarkdownString(typeParameter.DefaultType); - - referenceIds = referenceIds.concat(parsedDefaultType.References); - defaultType = MarkdownGenerator.EscapeString(parsedDefaultType.Text); - } - - return [typeParameter.Name, constraintType, defaultType]; - }); - + const typeParametersTable = GeneratorHelpers.ApiTypeParametersTableToString(typeParameters); const text = new MarkdownBuilder() .Header("Type parameters", 3) .EmptyLine() - .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) + .Text(typeParametersTable.Text) .EmptyLine() .GetOutput(); return { - References: referenceIds, + References: typeParametersTable.References, Text: text }; } diff --git a/packages/ts-docs-gen/src/plugins/api-index-plugin.ts b/packages/ts-docs-gen/src/plugins/api-index-plugin.ts new file mode 100644 index 00000000..9f052af1 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-index-plugin.ts @@ -0,0 +1,50 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +import { Plugin, SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; + +export class ApiIndexPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Index]; + } + + public CheckApiItem(item: Contracts.ApiIndexDto): boolean { + return true; + } + + public Render(data: PluginOptions): PluginResult { + const parameter = data.ExtractedData.Registry[data.ApiItem.Parameter] as Contracts.ApiParameterDto; + + const parameterType = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); + const indexType = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); + + const indexDeclarationString = GeneratorHelpers.ApiIndexToString(parameter, data.ApiItem.Type, data.ApiItem.IsReadonly); + + const builder = new MarkdownBuilder() + .Code(indexDeclarationString, GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine(); + + if (data.ApiItem.IsReadonly) { + builder + .Text("Readonly.") + .EmptyLine(); + } + + builder + .Text(`Index \`${parameter.Name}\` - ${parameterType.Text}`) + .EmptyLine() + .Text(`Type - ${indexType.Text}`); + + return { + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: [], + Result: builder.GetOutput(), + UsedReferences: [ + ...parameterType.References, + ...indexType.References + ] + }; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts b/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts new file mode 100644 index 00000000..9eb58f63 --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts @@ -0,0 +1,214 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; +import { + Plugin, + SupportedApiItemKindType, + PluginResult, + PluginOptions, + GetItemPluginResultHandler, + PluginResultData +} from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; +import { ApiItemReference } from "../contracts/api-item-reference"; + +interface ExtractedItemDto { + Reference: ApiItemReference; + ApiItem: TApiItemDto; +} + +export class ApiInterfacePlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [GeneratorHelpers.ApiItemKinds.Interface]; + } + + public CheckApiItem(item: Contracts.ApiInterfaceDto): boolean { + return true; + } + + private renderTypeParameters(pluginOptions: PluginOptions): PluginResultData { + const typeParameters = GeneratorHelpers.GetApiItemsFromReference( + pluginOptions.ApiItem.TypeParameters, + pluginOptions.ExtractedData + ); + + if (typeParameters.length === 0) { + return GeneratorHelpers.GetDefaultPluginResultData(); + } + + const typeParametersTable = GeneratorHelpers.ApiTypeParametersTableToString(typeParameters); + const text = new MarkdownBuilder() + .Header("Type parameters", 3) + .EmptyLine() + .Text(typeParametersTable.Text) + .EmptyLine() + .GetOutput(); + + return { + Result: text, + UsedReferences: typeParametersTable.References, + Headings: [] + }; + } + + private renderConstraintTypes(apiItem: Contracts.ApiInterfaceDto): PluginResultData { + if (apiItem.Extends.length === 0) { + return GeneratorHelpers.GetDefaultPluginResultData(); + } + + const builder = new MarkdownBuilder() + .Header("Extends", 3) + .EmptyLine(); + + const references = []; + + for (const type of apiItem.Extends) { + const typeDto = GeneratorHelpers.TypeDtoToMarkdownString(type); + references.push(...typeDto.References); + + builder + .Text(typeDto.Text) + .EmptyLine(); + } + + return { + UsedReferences: references, + Result: builder.GetOutput(), + Headings: [] + }; + } + + private renderPropertyMembers(memberItems: ExtractedItemDto[]): PluginResultData { + const apiItems = memberItems.filter>( + this.isReferenceOfApiItemKind.bind(undefined, Contracts.ApiItemKinds.Property) + ).map(x => x.ApiItem); + + if (apiItems.length === 0) { + return GeneratorHelpers.GetDefaultPluginResultData(); + } + + const table = GeneratorHelpers.ApiPropertiesToTableString(apiItems); + const builder = new MarkdownBuilder() + .Header("Properties", 3) + .EmptyLine() + .Text(table.Text); + + return { + UsedReferences: table.References, + Result: builder.GetOutput(), + Headings: [] + }; + } + + private isReferenceOfApiItemKind( + itemKind: Contracts.ApiItemKinds, + extractedItem: ExtractedItemDto + ): extractedItem is ExtractedItemDto { + return extractedItem.ApiItem.ApiKind === itemKind; + } + + private renderMemberItemsGroup( + title: string, + apiItemKind: Contracts.ApiItemKinds, + memberItems: ExtractedItemDto[], + getPluginResult: GetItemPluginResultHandler + ): PluginResultData { + const items = memberItems.filter(this.isReferenceOfApiItemKind.bind(undefined, apiItemKind)); + + if (items.length === 0) { + return GeneratorHelpers.GetDefaultPluginResultData(); + } + + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + pluginResult.Result.push(MarkdownGenerator.Header(title, 3), ""); + + for (const item of items) { + const itemPluginResult = getPluginResult(item.Reference); + + GeneratorHelpers.MergePluginResultData(pluginResult, itemPluginResult); + pluginResult.Result.push("", MarkdownGenerator.HorizontalRule(), ""); + } + + return pluginResult; + } + + public Render(data: PluginOptions): PluginResult { + const alias = data.Reference.Alias; + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: [ + { + ApiItemId: data.Reference.Id, + Heading: alias + } + ] + }; + + const memberReferences = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); + const memberItems = memberReferences.map(itemReference => ({ + Reference: itemReference, + ApiItem: data.ExtractedData.Registry[itemReference.Id] + })); + + const interfaceString = GeneratorHelpers.ApiInterfaceToString(data.ApiItem, data.ExtractedData); + const builder = new MarkdownBuilder() + .Header(GeneratorHelpers.ApiInterfaceToSimpleString(alias, data.ApiItem), 2) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Code(interfaceString, GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .EmptyLine(); + + pluginResult.Result = builder.GetOutput(); + + // Type parameters + const typeParametersResult = this.renderTypeParameters(data); + GeneratorHelpers.MergePluginResultData(pluginResult, typeParametersResult); + + // Constraint types + const constraintTypesResult = this.renderConstraintTypes(data.ApiItem); + GeneratorHelpers.MergePluginResultData(pluginResult, constraintTypesResult); + + // Construct items + const constructMembersResult = this.renderMemberItemsGroup( + "Construct", + Contracts.ApiItemKinds.Construct, + memberItems, + data.GetItemPluginResult + ); + GeneratorHelpers.MergePluginResultData(pluginResult, constructMembersResult); + + // Call items + const callMembersResult = this.renderMemberItemsGroup( + "Call", + Contracts.ApiItemKinds.Call, + memberItems, + data.GetItemPluginResult + ); + GeneratorHelpers.MergePluginResultData(pluginResult, callMembersResult); + + // Index items + const indexMembersResult = this.renderMemberItemsGroup( + "Index signatures", + Contracts.ApiItemKinds.Index, + memberItems, + data.GetItemPluginResult + ); + GeneratorHelpers.MergePluginResultData(pluginResult, indexMembersResult); + + // Method items + const methodMembersResult = this.renderMemberItemsGroup( + "Methods", + Contracts.ApiItemKinds.Method, + memberItems, + data.GetItemPluginResult + ); + GeneratorHelpers.MergePluginResultData(pluginResult, methodMembersResult); + + // Property items + const propertyMembersResult = this.renderPropertyMembers(memberItems); + GeneratorHelpers.MergePluginResultData(pluginResult, propertyMembersResult); + + return pluginResult; + } +} diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index 3af0b655..e6ae0e08 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -5,6 +5,13 @@ Array [ Object { "FileLocation": "index.md", "Result": Array [ + "[InterfaceDeclaration-1]: index.md#foointerface", + "[InterfaceDeclaration-2]: index.md#boo", + "[InterfaceDeclaration-4]: index.md#myconstrainttype", + "[InterfaceDeclaration-9]: index.md#dictionary", + "[InterfaceDeclaration-9]: index.md#dictionary", + "[InterfaceDeclaration-6]: index.md#objectsinterface", + "[InterfaceDeclaration-12]: index.md#monsterinterface", "[ClassDeclaration-0]: index/foo.md#foo", "[ClassDeclaration-1]: index/world.md#world", "[ClassDeclaration-2]: index/earth.md#earth", @@ -12,6 +19,546 @@ Array [ "[ClassDeclaration-1]: index/world.md#world", "# index", "", + "## interface ExtendedBar", + "", + "\`\`\`typescript", + "interface ExtendedBar extends FooInterface, Boo {", + " OtherStuff: string[];", + "}", + "\`\`\`", + "", + "### Extends", + "", + "[FooInterface][InterfaceDeclaration-1]<number>", + "", + "[Boo][InterfaceDeclaration-2]", + "", + "### Properties", + "", + "| Name | Type |", + "| ---------- | --------------------- |", + "| OtherStuff | Array<string> |", + "", + "## interface FooInterface", + "", + "\`\`\`typescript", + "interface FooInterface {", + " Name: string;", + " Surname: string;", + " Type: TType;", + "}", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name |", + "| ----- |", + "| TType |", + "", + "### Properties", + "", + "| Name | Type |", + "| ------- | ------ |", + "| Name | string |", + "| Surname | string |", + "| Type | TType |", + "", + "## interface Boo", + "", + "\`\`\`typescript", + "interface Boo {", + " Boos: string[];", + "}", + "\`\`\`", + "", + "### Properties", + "", + "| Name | Type |", + "| ---- | --------------------- |", + "| Boos | Array<string> |", + "", + "## interface AnotherInterface", + "", + "\`\`\`typescript", + "interface AnotherInterface {", + " (param1: TValue, param2: TValue): boolean;", + "}", + "\`\`\`", + "", + "### Call", + "", + "\`\`\`typescript", + "(param1: TValue, param2: TValue): boolean", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ------ |", + "| TValue |", + "", + "Parameters:", + "", + "| Name | Type |", + "| ------ | ------ |", + "| param1 | TValue |", + "| param2 | TValue |", + "", + "Return type:", + "", + "true | false", + "", + "---", + "", + "", + "## interface MyConstraintType", + "", + "\`\`\`typescript", + "interface MyConstraintType {", + " myProperty: string;", + "}", + "\`\`\`", + "", + "### Properties", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| myProperty | string |", + "", + "## interface MyDefaultType", + "", + "\`\`\`typescript", + "interface MyDefaultType extends MyConstraintType {", + " anotherProperty: number;", + "}", + "\`\`\`", + "", + "### Extends", + "", + "[MyConstraintType][InterfaceDeclaration-4]", + "", + "### Properties", + "", + "| Name | Type |", + "| --------------- | ------ |", + "| anotherProperty | number |", + "", + "## interface ObjectsInterface", + "", + "\`\`\`typescript", + "interface ObjectsInterface {", + " objectOne: Object;", + " objectTwo: Object;", + "}", + "\`\`\`", + "", + "### Properties", + "", + "| Name | Type |", + "| --------- | ------ |", + "| objectOne | Object |", + "| objectTwo | Object |", + "", + "## interface InterfaceWithCall", + "", + "\`\`\`typescript", + "interface InterfaceWithCall {", + " (): { someProperty: T; };", + "}", + "\`\`\`", + "", + "### Call", + "", + "\`\`\`typescript", + "(): { someProperty: T; }", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ---- |", + "| T |", + "", + "Return type:", + "", + "{ someProperty: T; }", + "", + "---", + "", + "", + "## interface InterfaceWithConstraintType", + "", + "\`\`\`typescript", + "interface InterfaceWithConstraintType extends Dictionary {", + " someProperty: string;", + "}", + "\`\`\`", + "", + "### Extends", + "", + "[Dictionary][InterfaceDeclaration-9]<string>", + "", + "### Properties", + "", + "| Name | Type |", + "| ------------ | ------ |", + "| someProperty | string |", + "", + "## interface InterfaceWithMethod", + "", + "\`\`\`typescript", + "interface InterfaceWithMethod {", + " someMethodOne(): T;", + " someMethodTwo(): TReturn;", + "}", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name |", + "| ---- |", + "| T |", + "", + "### Methods", + "", + "\`\`\`typescript", + "someMethodOne(): T", + "\`\`\`", + "", + "Return type:", + "", + "T", + "", + "---", + "", + "\`\`\`typescript", + "someMethodTwo(): TReturn", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ------- |", + "| TReturn |", + "", + "Return type:", + "", + "TReturn", + "", + "---", + "", + "", + "## interface Dictionary", + "", + "\`\`\`typescript", + "interface Dictionary {", + " new (): Dictionary;", + " [key: string]: TValue;", + "}", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name |", + "| ------ |", + "| TValue |", + "", + "### Construct", + "", + "\`\`\`typescript", + "new (): Dictionary", + "\`\`\`", + "", + "Return type:", + "", + "[Dictionary][InterfaceDeclaration-9]<TValue>", + "", + "---", + "", + "### Index signatures", + "", + "\`\`\`typescript", + "[key: string]: TValue", + "\`\`\`", + "", + "Index \`key\` - string", + "", + "Type - TValue", + "", + "---", + "", + "", + "## interface MethodsInterface", + "", + "\`\`\`typescript", + "interface MethodsInterface {", + " (arg: TValue): void;", + " someMethod(): string;", + "}", + "\`\`\`", + "", + "### Call", + "", + "\`\`\`typescript", + "(arg: TValue): void", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ------ |", + "| TValue |", + "", + "Parameters:", + "", + "| Name | Type |", + "| ---- | ------ |", + "| arg | TValue |", + "", + "Return type:", + "", + "void", + "", + "---", + "", + "### Methods", + "", + "\`\`\`typescript", + "someMethod(): string", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ---- |", + "| T |", + "", + "Return type:", + "", + "string", + "", + "---", + "", + "", + "## interface MonsterInterface", + "", + "Warning: Beta!", + "", + "Deprecated!", + "", + "Monster interface", + "", + "\`\`\`typescript", + "interface MonsterInterface extends ObjectsInterface {", + " new (): MonsterInterface;", + " new (someParameter: string): string;", + " (): { someProperty: T; };", + " (key?: string | undefined): { someProperty: T; };", + " (key: number): { someProperty: T; };", + " readonly [key: string]: TValue;", + " readonly objectOne?: TValue;", + " objectTwo: TValue;", + "}", + "\`\`\`", + "", + "### Type parameters", + "", + "| Name | Constraint type | Default type |", + "| ------ | --------------- | ------------ |", + "| TValue | Object | \\\\{\\\\} |", + "", + "### Extends", + "", + "[ObjectsInterface][InterfaceDeclaration-6]", + "", + "### Construct", + "", + "\`\`\`typescript", + "new (): MonsterInterface", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ---- |", + "| T |", + "", + "Return type:", + "", + "[MonsterInterface][InterfaceDeclaration-12]<T>", + "", + "---", + "", + "\`\`\`typescript", + "new (someParameter: string): string", + "\`\`\`", + "", + "Parameters:", + "", + "| Name | Type |", + "| ------------- | ------ |", + "| someParameter | string |", + "", + "Return type:", + "", + "string", + "", + "---", + "", + "### Call", + "", + "\`\`\`typescript", + "(): { someProperty: T; }", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ---- |", + "| T |", + "", + "Return type:", + "", + "{ someProperty: T; }", + "", + "---", + "", + "\`\`\`typescript", + "(key?: string | undefined): { someProperty: T; }", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ---- |", + "| T |", + "", + "Parameters:", + "", + "| Name | Type | Optional |", + "| ---- | ----------------------- | -------- |", + "| key | undefined | string | Yes |", + "", + "Return type:", + "", + "{ someProperty: T; }", + "", + "---", + "", + "\`\`\`typescript", + "(key: number): { someProperty: T; }", + "\`\`\`", + "", + "Type parameters:", + "", + "| Name |", + "| ---- |", + "| T |", + "", + "Parameters:", + "", + "| Name | Type |", + "| ---- | ------ |", + "| key | number |", + "", + "Return type:", + "", + "{ someProperty: T; }", + "", + "---", + "", + "### Index signatures", + "", + "\`\`\`typescript", + "readonly [key: string]: TValue", + "\`\`\`", + "", + "Readonly.", + "", + "Index \`key\` - string", + "", + "Type - TValue", + "", + "---", + "", + "### Properties", + "", + "| Name | Type |", + "| --------- | ------ |", + "| objectOne | TValue |", + "| objectTwo | TValue |", + "", + "## interface SomeInterface", + "", + "\`\`\`typescript", + "interface SomeInterface {", + " [key: string]: string | number;", + " [key: number]: string;", + "}", + "\`\`\`", + "", + "### Index signatures", + "", + "\`\`\`typescript", + "[key: string]: string | number", + "\`\`\`", + "", + "Index \`key\` - string", + "", + "Type - string | number", + "", + "---", + "", + "\`\`\`typescript", + "[key: number]: string", + "\`\`\`", + "", + "Index \`key\` - number", + "", + "Type - string", + "", + "---", + "", + "", + "## interface StringsDictionary", + "", + "\`\`\`typescript", + "interface StringsDictionary {", + " [key: string]: string;", + "}", + "\`\`\`", + "", + "### Index signatures", + "", + "\`\`\`typescript", + "[key: string]: string", + "\`\`\`", + "", + "Index \`key\` - string", + "", + "Type - string", + "", + "---", + "", + "", + "## interface MyInterface", + "", + "\`\`\`typescript", + "interface MyInterface {", + " MyPropertyOne: string;", + " MyPropertyTwo: Object;", + " MyPropertyThree: number;", + "}", + "\`\`\`", + "", + "### Properties", + "", + "| Name | Type |", + "| --------------- | ------ |", + "| MyPropertyOne | string |", + "| MyPropertyTwo | Object |", + "| MyPropertyThree | number |", + "", "## EnumList", "", "Simple list.", @@ -101,10 +648,10 @@ Array [ "", "### Parameters", "", - "| Name | Type |", - "| ---------- | ------- |", - "| parameter1 | string |", - "| parameter2 | Promise |", + "| Name | Type |", + "| ---------- | -------------------- |", + "| parameter1 | string |", + "| parameter2 | Promise&\\\\#60;T&\\\\#62; |", "", "### Return type", "", @@ -119,7 +666,7 @@ Array [ "", "### Return type", "", - "Promise", + "Promise<void>", "", "", "## FunctionWithOneParameter(parameter)", @@ -279,16 +826,16 @@ Array [ "", "### Type parameters", "", - "| Name | Constraint type |", - "| ---- | --------------- |", - "| T | Array |", + "| Name | Constraint type |", + "| ---- | ------------------ |", + "| T | Array&\\\\#60;T&\\\\#62; |", "", "### Parameters", "", - "| Name | Type |", - "| ---------- | ------- |", - "| parameter1 | string |", - "| parameter2 | Promise |", + "| Name | Type |", + "| ---------- | -------------------- |", + "| parameter1 | string |", + "| parameter2 | Promise&\\\\#60;T&\\\\#62; |", "", "### Return type", "", @@ -303,7 +850,7 @@ Array [ "", "### Return type", "", - "Array", + "Array<string>", "", "", "## FunctionWithPrimitiveReturnType()", @@ -349,15 +896,49 @@ Array [ "", "### Type parameters", "", - "| Name | Constraint type | Default type |", - "| ---- | -------------------------------------------------------------- | ------------------------- |", - "| T | \\\\{ myProperty: string; myPropertyTwo?: number \\\\| undefined; \\\\} | \\\\{ myProperty: string; \\\\} |", + "| Name | Constraint type | Default type |", + "| ---- | ------------------------------------------------------------------ | ------------------------- |", + "| T | \\\\{ myProperty: string; myPropertyTwo?: number | undefined; \\\\} | \\\\{ myProperty: string; \\\\} |", "", "### Return type", "", "T", "", "", + "## FunctionWithInitializedNumberParameter(someParameter)", + "", + "\`\`\`typescript", + "function FunctionWithInitializedNumberParameter(someParameter: number = 12): number", + "\`\`\`", + "", + "### Parameters", + "", + "| Name | Type | Initial value |", + "| ------------- | ------ | ------------- |", + "| someParameter | number | 12 |", + "", + "### Return type", + "", + "number", + "", + "", + "## FunctionWithInitializedStringParameter(someParameter)", + "", + "\`\`\`typescript", + "function FunctionWithInitializedStringParameter(someParameter: string = \\"12\\"): string", + "\`\`\`", + "", + "### Parameters", + "", + "| Name | Type | Initial value |", + "| ------------- | ------ | ------------- |", + "| someParameter | string | \\"12\\" |", + "", + "### Return type", + "", + "string", + "", + "", "", ], }, diff --git a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts index eeaf5349..14e297b0 100644 --- a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts +++ b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts @@ -1,3 +1,94 @@ +// #region Interfaces +export interface ExtendedBar extends FooInterface, Boo { + OtherStuff: string[]; +} + +export interface FooInterface { + Name: string; + Surname: string; + Type: TType; +} + +export interface Boo { + Boos: string[]; +} + +export interface AnotherInterface { + (param1: TValue, param2: TValue): boolean; +} + +export interface MyConstraintType { + myProperty: string; +} + +export interface MyDefaultType extends MyConstraintType { + anotherProperty: number; +} + +export interface ObjectsInterface { + objectOne: Object; + objectTwo: Object; +} + +export interface InterfaceWithCall { + (): { someProperty: T }; +} + +export interface InterfaceWithConstraintType extends Dictionary { + someProperty: string; +} + +export interface InterfaceWithMethod { + someMethodOne(): T; + someMethodTwo(): TReturn; +} + +export interface Dictionary { + new(): Dictionary; + [key: string]: TValue; +} + +export interface MethodsInterface { + someMethod(): string; + (arg: TValue): void; +} + +/** + * Monster interface + * @beta + * @deprecated + */ +export interface MonsterInterface extends ObjectsInterface { + new (): MonsterInterface; + new(someParameter: string): string; + + readonly [key: string]: TValue; + + (): { someProperty: T }; + (key?: string): { someProperty: T }; + (key: number): { someProperty: T }; + + readonly objectOne: TValue; + objectTwo: TValue; +} + +export interface SomeInterface { + [key: string]: string | number; + [key: number]: string; +} + +export interface StringsDictionary { + [key: string]: string; +} + +export interface MyInterface { + MyPropertyOne: string; + MyPropertyTwo: Object; + MyPropertyThree: number; +} +// #endregion Interfaces + + // #region Enums /** * Simple list. @@ -137,4 +228,12 @@ export function MyFunction Date: Wed, 3 Jan 2018 10:39:58 +0200 Subject: [PATCH 58/61] Feature: Getters and setters (#14) --- common/config/rush/npm-shrinkwrap.json | 20 ++-- .../examples/simple/docs/api/index.md | 3 + .../examples/simple/docs/api/index/hello.md | 42 +++------ packages/ts-docs-gen/examples/simple/index.ts | 26 +++--- packages/ts-docs-gen/package.json | 6 +- packages/ts-docs-gen/src/default-plugins.ts | 4 +- packages/ts-docs-gen/src/generator-helpers.ts | 26 +++++- .../src/plugins/api-class-accessor-plugin.ts | 93 +++++++++++++++++++ .../src/plugins/api-class-plugin.ts | 43 ++++++--- 9 files changed, 194 insertions(+), 69 deletions(-) create mode 100644 packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index ec5e0ec1..04004c3b 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -16,7 +16,7 @@ }, "@rush-temp/test-generator-cli": { "version": "file:projects/test-generator-cli.tgz", - "integrity": "sha1-poL86JfifvnYdj6kO8BwW/R5VEA=", + "integrity": "sha1-6X6rHJJU5+82zdF9bZ62CZYrxzk=", "requires": { "@types/fs-extra": "4.0.7", "@types/handlebars": "4.0.36", @@ -33,11 +33,11 @@ }, "@rush-temp/ts-docs-gen": { "version": "file:projects/ts-docs-gen.tgz", - "integrity": "sha1-X6xmRRnm3HUhBtQEy5JoWktjvnQ=", + "integrity": "sha1-VpmYmmPCGxgpL+NQ/+Q7RbokkUI=", "requires": { "@simplrjs/markdown": "1.0.7", "@types/fs-extra": "5.0.0", - "@types/jest": "21.1.10", + "@types/jest": "22.0.0", "@types/sinon": "4.1.2", "fast-glob": "1.0.1", "fs-extra": "5.0.0", @@ -45,7 +45,7 @@ "simplr-logger": "1.0.1", "simplr-tslint": "0.0.1", "sinon": "4.1.3", - "ts-extractor": "3.0.3", + "ts-extractor": "3.1.1", "ts-jest": "22.0.0", "tslint": "5.8.0", "typescript": "2.6.2" @@ -94,9 +94,9 @@ "integrity": "sha512-LjNiTX7TY7wtuC6y3QwC93hKMuqYhgV9A1uXBKNvZtVC8ZvyWAjZkJ5BvT0K7RKqORRYRLMrqCxpw5RgS+MdrQ==" }, "@types/jest": { - "version": "21.1.10", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-21.1.10.tgz", - "integrity": "sha512-qDyqzbcyNgW2RgWbl606xCYQ+5fK9khOW5+Hl3wH7RggVES0dB6GcZvpmPs/XIty5qpu1xYCwpiK+iRkJ3xFBw==" + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-22.0.0.tgz", + "integrity": "sha512-YnvduQPdRtIfvBLqfs6am0iz/07sqd/VYyPoqLzyZAYGyjokJDiE+LCgqX13ef8PNOWG5+Opbcy9gn5ymSIHCg==" }, "@types/node": { "version": "8.5.2", @@ -4643,9 +4643,9 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, "ts-extractor": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-3.0.3.tgz", - "integrity": "sha512-4izZ/Mn0UgyCYz4Cl+x0C1WVVpl0ez6BuCCB8RAwti6teujA1OxfsbZI2oL/vwS2DFYECtVlsjqnapUm3bBIHA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/ts-extractor/-/ts-extractor-3.1.1.tgz", + "integrity": "sha512-5rU/I/f0JbbddHb0v1b5bJX+/b37VWP9vBpOQPAUVxDCV1eJ4MlKeVcgBAFajL76z9BxZVNXMHvyOtLUcEwHDw==", "requires": { "@types/fs-extra": "5.0.0", "fs-extra": "5.0.0", diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index 773f12df..ec6bea08 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -5,6 +5,7 @@ [InterfaceDeclaration-9]: index.md#dictionary [InterfaceDeclaration-6]: index.md#objectsinterface [InterfaceDeclaration-12]: index.md#monsterinterface +[ClassDeclaration-0]: index/hello.md#hello # index ## interface ExtendedBar @@ -547,3 +548,5 @@ interface MyInterface { | MyPropertyTwo | Object | | MyPropertyThree | number | +## [Hello][ClassDeclaration-0] + diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md index 82cfc54a..9c41c087 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md @@ -19,53 +19,35 @@ constructor(arg: string) | arg | string | This is an argument ;) | -## Methods - -### GetFoo(arg) - -```typescript -public GetFoo(arg: number): string -``` -#### Parameters - -| Name | Type | -| ---- | ------ | -| arg | number | - +## Properties -### GetFoo(arg) +### get Foo ```typescript -public GetFoo(arg: string): string +public get Foo: string; ``` -#### Parameters -| Name | Type | -| ---- | ------ | -| arg | string | +#### Type +string -### GetFoo(arg) +### set Foo ```typescript -public GetFoo(arg: string | number): string +public set Foo: string; ``` -#### Parameters -| Name | Type | -| ---- | -------------------- | -| arg | string | number | +#### Type +string -## Properties - -### Foo +### set Bar ```typescript -public Foo: string; +public static set Bar: string; ``` -### Type +#### Type string diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index 4d793115..80ef5a90 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -300,18 +300,18 @@ export interface MyInterface { // } // } -// export class Hello { -// /** -// * This is a constructor -// * @param arg This is an argument ;) -// */ -// constructor(arg: string) { } +export class Hello { + /** + * This is a constructor + * @param arg This is an argument ;) + */ + constructor(arg: string) { } -// GetFoo(arg: number): string -// GetFoo(arg: string): string -// GetFoo(arg: string | number): string { -// throw new Error("Method not implemented."); -// } + get Foo(): string { + throw new Error("Method not implemented."); + } -// public Foo: string; -// } + set Foo(arg: string) { } + + public static set Bar(arg: string) { } +} diff --git a/packages/ts-docs-gen/package.json b/packages/ts-docs-gen/package.json index 202da6e3..17b691b8 100644 --- a/packages/ts-docs-gen/package.json +++ b/packages/ts-docs-gen/package.json @@ -20,13 +20,13 @@ "fast-glob": "^1.0.1", "fs-extra": "^5.0.0", "simplr-logger": "^1.0.1", - "ts-extractor": "^3.0.3", + "ts-extractor": "^3.1.1", "typescript": "^2.6.2" }, "devDependencies": { - "@types/jest": "^21.1.9", + "@types/jest": "^22.0.0", "@types/sinon": "^4.1.2", - "jest": "^22.0.3", + "jest": "^22.0.4", "simplr-tslint": "0.0.1", "sinon": "^4.1.3", "ts-jest": "^22.0.0", diff --git a/packages/ts-docs-gen/src/default-plugins.ts b/packages/ts-docs-gen/src/default-plugins.ts index decf9706..4e17f40b 100644 --- a/packages/ts-docs-gen/src/default-plugins.ts +++ b/packages/ts-docs-gen/src/default-plugins.ts @@ -11,6 +11,7 @@ import { ApiClassPlugin } from "./plugins/api-class-plugin"; import { ApiClassConstructorPlugin } from "./plugins/api-class-constructor-plugin"; import { ApiClassMethodPlugin } from "./plugins/api-class-method-plugin"; import { ApiClassPropertyPlugin } from "./plugins/api-class-property-plugin"; +import { ApiClassAccessorPlugin } from "./plugins/api-class-accessor-plugin"; export const DefaultPlugins = [ new ApiSourceFilePlugin(), @@ -25,5 +26,6 @@ export const DefaultPlugins = [ new ApiClassPlugin(), new ApiClassConstructorPlugin(), new ApiClassMethodPlugin(), - new ApiClassPropertyPlugin() + new ApiClassPropertyPlugin(), + new ApiClassAccessorPlugin() ]; diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index a4a8d398..6b27b214 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -588,6 +588,26 @@ export namespace GeneratorHelpers { return `${isReadOnlyString}${apiItem.Name}${isOptionalString}: ${returnTypeString}`; } + export function ApiAccessorToString( + apiItem: Contracts.ApiGetAccessorDto | Contracts.ApiSetAccessorDto, + type: Contracts.TypeDto | undefined, + alias?: string + ): string { + const name = alias || apiItem.Name; + const abstract = apiItem.IsAbstract ? " abstract" : ""; + const $static = apiItem.IsStatic ? " static" : ""; + + const typeString = type != null ? type.Text : "???"; + let accessorType: string; + if (apiItem.ApiKind === Contracts.ApiItemKinds.SetAccessor) { + accessorType = "set"; + } else { + accessorType = "get"; + } + + return `${apiItem.AccessModifier}${$static}${abstract} ${accessorType} ${name}: ${typeString};`; + } + // TODO: add description from @template jsdoc tag. export function ApiTypeParametersTableToString(typeParameters: Contracts.ApiTypeParameterDto[]): ReferenceDto { if (typeParameters.length === 0) { @@ -698,7 +718,11 @@ export namespace GeneratorHelpers { }; } - export function MergePluginResultData(a: T, b: Partial): T { + export function MergePluginResultData(a: T, b: Partial | undefined): T { + if (b == null) { + return a; + } + a.Headings = a.Headings.concat(b.Headings || []); a.Members = (a.Members || []).concat(b.Members || []); a.Result = a.Result.concat(b.Result || []); diff --git a/packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts new file mode 100644 index 00000000..6974fc7d --- /dev/null +++ b/packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts @@ -0,0 +1,93 @@ +import { Contracts, ExtractDto } from "ts-extractor"; +import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginResultData } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +export type Kind = Contracts.ApiSetAccessorDto | Contracts.ApiGetAccessorDto; + +export class ApiClassAccessorPlugin implements Plugin { + public SupportedApiItemKinds(): SupportedApiItemKindType[] { + return [ + GeneratorHelpers.ApiItemKinds.GetAccessor, + GeneratorHelpers.ApiItemKinds.SetAccessor, + ]; + } + + public CheckApiItem(item: Kind): boolean { + return true; + } + + private getHeading(data: PluginOptions): string { + let accessorType: string; + if (data.ApiItem.ApiKind === Contracts.ApiItemKinds.SetAccessor) { + accessorType = "set"; + } else { + accessorType = "get"; + } + + return `${accessorType} ${data.Reference.Alias}`; + } + + private resolveType(apiItem: Kind, extractedData: ExtractDto): Contracts.TypeDto | undefined { + // Resolve type + let type: Contracts.TypeDto | undefined; + if (apiItem.ApiKind === Contracts.ApiItemKinds.GetAccessor) { + type = apiItem.Type; + } else if (apiItem.Parameter != null) { + const apiParameter = extractedData.Registry[apiItem.Parameter.Ids[0]] as Contracts.ApiParameterDto; + if (apiParameter != null) { + type = apiParameter.Type; + } + } + + return type; + } + + private renderTypeDto(type: Contracts.TypeDto | undefined): Partial | undefined { + if (type == null) { + return undefined; + } + + const result = GeneratorHelpers.TypeDtoToMarkdownString(type); + + const builder = new MarkdownBuilder() + .EmptyLine() + .Header("Type", 4) + .EmptyLine() + .Text(result.Text); + + return { + Result: builder.GetOutput(), + UsedReferences: result.References + }; + } + + public Render(data: PluginOptions): PluginResult { + const heading = this.getHeading(data); + const type = this.resolveType(data.ApiItem, data.ExtractedData); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: [ + { + ApiItemId: data.Reference.Id, + Heading: heading + } + ] + }; + + pluginResult.Result = new MarkdownBuilder() + .Header(heading, 3) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Code(GeneratorHelpers.ApiAccessorToString(data.ApiItem, type, data.Reference.Alias), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .GetOutput(); + + // Type + const typeResult = this.renderTypeDto(type); + GeneratorHelpers.MergePluginResultData(pluginResult, typeResult); + + return pluginResult; + } +} diff --git a/packages/ts-docs-gen/src/plugins/api-class-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-plugin.ts index f69311c3..e4b96580 100644 --- a/packages/ts-docs-gen/src/plugins/api-class-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-class-plugin.ts @@ -11,6 +11,11 @@ import { PluginResultData } from "../contracts/plugin"; +interface RenderMembers { + Heading: string; + Kinds: Contracts.ApiItemKinds[]; +} + export class ApiClassPlugin implements Plugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Class]; @@ -26,26 +31,42 @@ export class ApiClassPlugin implements Plugin { const pluginResultData = GeneratorHelpers.GetDefaultPluginResultData(); const builder = new MarkdownBuilder(); - const list: Array<[Contracts.ApiItemKinds, string]> = [ - [Contracts.ApiItemKinds.Index, "Index"], - [Contracts.ApiItemKinds.ClassConstructor, "Constructor"], - [Contracts.ApiItemKinds.ClassMethod, "Methods"], - [Contracts.ApiItemKinds.ClassProperty, "Properties"] + const list: RenderMembers[] = [ + { + Heading: "Index", + Kinds: [Contracts.ApiItemKinds.Index] + }, + { + Heading: "Constructor", + Kinds: [Contracts.ApiItemKinds.ClassConstructor] + }, + { + Heading: "Methods", + Kinds: [Contracts.ApiItemKinds.ClassMethod] + }, + { + Heading: "Properties", + Kinds: [ + Contracts.ApiItemKinds.ClassProperty, + Contracts.ApiItemKinds.GetAccessor, + Contracts.ApiItemKinds.SetAccessor, + ] + } ]; - for (const [kind, heading] of list) { - const pluginResultsByKind = renderedItems.filter(x => x.ApiItem.ApiKind === kind); + for (const memberKind of list) { + const pluginResultsByKind = renderedItems.filter(x => memberKind.Kinds.indexOf(x.ApiItem.ApiKind) !== -1); if (pluginResultsByKind.length > 0) { builder - .Header(heading, 2) + .Header(memberKind.Heading, 2) .EmptyLine(); - for (const item of pluginResultsByKind) { - GeneratorHelpers.MergePluginResultData(pluginResultData, item); + for (const member of pluginResultsByKind) { + GeneratorHelpers.MergePluginResultData(pluginResultData, member); builder - .Text(item.Result) + .Text(member.Result) .EmptyLine(); } } From c9bb9ff6919511bfad1e833cd1cea44d9bd75461 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Wed, 3 Jan 2018 11:12:21 +0200 Subject: [PATCH 59/61] Feature: generator helpers reconstruction (#13) * Generator helpers structure improved. * Plugins updated to match GeneratorHelpers. * Readonly fixed. * Fixed merge conflict. --- packages/ts-docs-gen/src/generator-helpers.ts | 877 +++++++++--------- .../plugins/api-class-constructor-plugin.ts | 4 +- .../src/plugins/api-class-method-plugin.ts | 7 +- .../src/plugins/api-enum-plugin.ts | 2 +- .../src/plugins/api-function-plugin.ts | 2 +- .../simple-project-1.test.ts.snap | 2 +- .../simple-project-2.test.ts.snap | 12 + .../tests/cases/simple-project-2/foo.ts | 4 +- 8 files changed, 461 insertions(+), 449 deletions(-) diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 6b27b214..5da4cfbb 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -6,6 +6,7 @@ import * as path from "path"; import { ApiItemReference } from "./contracts/api-item-reference"; import { ApiItemKindsAdditional, PluginResultData } from "./contracts/plugin"; import { Logger } from "./utils/logger"; +import { Helpers } from "./utils/helpers"; export namespace GeneratorHelpers { export type TypeToStringDto = ReferenceDto; @@ -15,15 +16,157 @@ export namespace GeneratorHelpers { Text: T; } + export enum JSDocTags { + Beta = "beta", + Deprecated = "deprecated", + Summary = "summary" + } + + // #region Defaults and constants + export const MARKDOWN_EXT = ".md"; export const ApiItemKinds: typeof ApiItemKindsAdditional & typeof Contracts.ApiItemKinds = Object.assign(ApiItemKindsAdditional, Contracts.ApiItemKinds); + export const DEFAULT_CODE_OPTIONS = { + lang: "typescript" + }; + + export const DEFAULT_TABLE_OPTIONS: MarkdownContracts.TableOptions = { + removeColumnIfEmpty: true, + removeRowIfEmpty: true + }; + + // #endregion Defaults and constants + + // #region General helpers + export function GetApiItemKinds(): typeof Contracts.ApiItemKinds & typeof ApiItemKindsAdditional { return Object.assign(Contracts.ApiItemKinds, ApiItemKindsAdditional); } + export function GetApiItemReferences( + extractedData: ExtractDto, + itemsReference: Contracts.ApiItemReference[] + ): ApiItemReference[] { + let overallReferences: ApiItemReference[] = []; + + for (const item of itemsReference) { + for (const referenceId of item.Ids) { + // Check if item is ExportSpecifier or ExportDeclaration. + const apiItem = extractedData.Registry[referenceId]; + + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Export: { + if (apiItem.SourceFileId != null) { + const sourceFileReference = { Alias: apiItem.Name, Ids: [apiItem.SourceFileId] }; + const referencesList = GetApiItemReferences(extractedData, [sourceFileReference]); + overallReferences = overallReferences.concat(referencesList); + } + break; + } + case Contracts.ApiItemKinds.ImportSpecifier: + case Contracts.ApiItemKinds.ExportSpecifier: { + if (apiItem.ApiItems == null) { + LogWithApiItemPosition( + LogLevel.Warning, + apiItem, + `ApiItems are missing in "${apiItem.Name}"?` + ); + break; + } + + const apiItemReference = { Alias: apiItem.Name, Ids: apiItem.ApiItems }; + const referencesList = GetApiItemReferences(extractedData, [apiItemReference]); + overallReferences = overallReferences.concat(referencesList); + break; + } + case Contracts.ApiItemKinds.SourceFile: { + if (apiItem.Members == null) { + LogWithApiItemPosition( + LogLevel.Warning, + apiItem, + "Members are missing" + ); + } + + const referencesList = GetApiItemReferences(extractedData, apiItem.Members); + overallReferences = overallReferences.concat(referencesList); + break; + } + default: { + overallReferences.push({ + Id: referenceId, + Alias: item.Alias + }); + } + } + } + } + + return overallReferences; + } + + export function GetApiItemsFromReference( + items: Contracts.ApiItemReference[], + extractedData: ExtractDto, + apiItemKind?: Contracts.ApiItemKinds + ): T[] { + const apiItems: T[] = []; + + for (const itemReferences of items) { + for (const referenceId of itemReferences.Ids) { + const apiItem = extractedData.Registry[referenceId] as T; + if (apiItemKind == null || apiItemKind != null && apiItem.ApiKind === apiItemKind) { + apiItems.push(apiItem); + } + } + } + + return apiItems; + } + + export function LogWithApiItemPosition(logLevel: LogLevel, apiItem: Contracts.ApiItemDto, message: string): void { + const { FileName, Line, Character } = apiItem.Location; + const linePrefix = `${FileName}[${Line}:${Character + 1}]`; + Logger.Log(logLevel, `${linePrefix}: ${message}`); + } + + export function StandardisePath(pathString: string): string { + return pathString.split(path.sep).join("/"); + } + + export function IsApiItemKind( + itemKind: Contracts.ApiItemKinds, + apiItem: Contracts.ApiItemDto): apiItem is TKindDto { + return apiItem.ApiKind === itemKind; + } + + export function MergePluginResultData(a: T, b: Partial | undefined): T { + if (b == null) { + return a; + } + + a.Headings = a.Headings.concat(b.Headings || []); + a.Members = (a.Members || []).concat(b.Members || []); + a.Result = a.Result.concat(b.Result || []); + a.UsedReferences = a.UsedReferences.concat(b.UsedReferences || []); + + return a; + } + + export function GetDefaultPluginResultData(): PluginResultData { + return { + Headings: [], + Result: [], + UsedReferences: [] + }; + } + // #endregion General helpers + + // #region Render helpers + // TODO: implement type literal and function type. export function TypeDtoToMarkdownString(type: Contracts.TypeDto): TypeToStringDto { let references: string[] = []; @@ -84,12 +227,6 @@ export namespace GeneratorHelpers { }; } - export enum JSDocTags { - Beta = "beta", - Deprecated = "deprecated", - Summary = "summary" - } - export function RenderApiItemMetadata(apiItem: Contracts.ApiItemDto): string[] { const builder = new MarkdownBuilder(); @@ -127,102 +264,6 @@ export namespace GeneratorHelpers { return builder.GetOutput(); } - export function GetApiItemReferences( - extractedData: ExtractDto, - itemsReference: Contracts.ApiItemReference[] - ): ApiItemReference[] { - let overallReferences: ApiItemReference[] = []; - - for (const item of itemsReference) { - for (const referenceId of item.Ids) { - // Check if item is ExportSpecifier or ExportDeclaration. - const apiItem = extractedData.Registry[referenceId]; - - switch (apiItem.ApiKind) { - case Contracts.ApiItemKinds.Export: { - if (apiItem.SourceFileId != null) { - const sourceFileReference = { Alias: apiItem.Name, Ids: [apiItem.SourceFileId] }; - const referencesList = GetApiItemReferences(extractedData, [sourceFileReference]); - overallReferences = overallReferences.concat(referencesList); - } - break; - } - case Contracts.ApiItemKinds.ImportSpecifier: - case Contracts.ApiItemKinds.ExportSpecifier: { - if (apiItem.ApiItems == null) { - LogWithApiItemPosition( - LogLevel.Warning, - apiItem, - `ApiItems are missing in "${apiItem.Name}"?` - ); - break; - } - - const apiItemReference = { Alias: apiItem.Name, Ids: apiItem.ApiItems }; - const referencesList = GetApiItemReferences(extractedData, [apiItemReference]); - overallReferences = overallReferences.concat(referencesList); - break; - } - case Contracts.ApiItemKinds.SourceFile: { - if (apiItem.Members == null) { - LogWithApiItemPosition( - LogLevel.Warning, - apiItem, - "Members are missing" - ); - } - - const referencesList = GetApiItemReferences(extractedData, apiItem.Members); - overallReferences = overallReferences.concat(referencesList); - break; - } - default: { - overallReferences.push({ - Id: referenceId, - Alias: item.Alias - }); - } - } - } - } - - return overallReferences; - } - - export function ApiVariableToString(item: Contracts.ApiVariableDto, alias?: string): string { - const name = alias != null ? alias : item.Name; - - return `${item.VariableDeclarationType} ${name}: ${item.Type.Text};`; - } - - export function ReconstructEnumCode(alias: string, memberItems: Contracts.ApiEnumMemberDto[]): string[] { - // Constructing enum body. - const membersStrings = memberItems.map((memberItem, index, array) => { - // Add an enum name - let memberString = `${GeneratorHelpers.Tab()} ${memberItem.Name}`; - - // Add an enum member value if it exists. - if (memberItem.Value) { - memberString += ` = ${memberItem.Value}`; - } - - // Add a comma if current item is not the last item - if (index !== memberItems.length - 1) { - memberString += ","; - } - - return memberString; - }); - - // Construct enum code output - return [ - `enum ${alias} {`, - ...membersStrings, - "}" - ]; - } - - // TODO: reconsider location const TAB_STRING = " "; export function Tab(size: number = 1): string { @@ -232,16 +273,6 @@ export namespace GeneratorHelpers { } return result; } - // --------------------------------------------------- - - export const DEFAULT_CODE_OPTIONS = { - lang: "typescript" - }; - - export const DEFAULT_TABLE_OPTIONS: MarkdownContracts.TableOptions = { - removeColumnIfEmpty: true, - removeRowIfEmpty: true - }; export function FixSentence(sentence: string, punctuationMark: string = "."): string { const trimmedSentence = sentence.trim(); @@ -256,250 +287,9 @@ export namespace GeneratorHelpers { return trimmedSentence + punctuationMark; } - export function ApiTypeToString(item: Contracts.ApiTypeDto, alias?: string): string { - const name = alias != null ? alias : item.Name; + // #endregion Render helpers - return `type ${name} = ${item.Type.Text};`; - } - - export function TypeParametersToString(typeParameters?: Contracts.ApiTypeParameterDto[]): string { - if (typeParameters != null && typeParameters.length > 0) { - const params: string[] = typeParameters.map(TypeParameterToString); - return `<${params.join(", ")}>`; - } else { - return ""; - } - } - - export function TypeParameterToString(apiItem: Contracts.ApiTypeParameterDto): string { - const extendsString = apiItem.ConstraintType != null ? ` extends ${apiItem.ConstraintType.Text}` : ""; - const defaultType = apiItem.DefaultType != null ? ` = ${apiItem.DefaultType.Text}` : ""; - - return `${apiItem.Name}${extendsString}${defaultType}`; - } - - /** - * Builds call declaration. - * - * Return example: `(arg: TValue): void` - */ - export function ApiCallToString( - typeParameters?: Contracts.ApiTypeParameterDto[], - parameters?: Contracts.ApiParameterDto[], - returnType?: Contracts.TypeDto - ): string { - // TypeParameters - const typeParametersString = TypeParametersToString(typeParameters); - - // Parameters - let parametersString: string; - if (parameters != null && parameters.length > 0) { - parametersString = parameters - .map(ApiParameterToString) - .join(", "); - } else { - parametersString = ""; - } - - // ReturnType - const returnTypeString = returnType != null ? `: ${returnType.Text}` : ""; - - return `${typeParametersString}(${parametersString})${returnTypeString}`; - } - - // FIXME: `?` and `| undefined` in a single statement. - export function ApiParameterToString(apiItem: Contracts.ApiParameterDto): string { - const initializerString = apiItem.Initializer ? ` = ${apiItem.Initializer}` : ""; - const isOptionalString = apiItem.IsOptional ? "?" : ""; - return `${apiItem.Name}${isOptionalString}: ${apiItem.Type.Text}${initializerString}`; - } - - /** - * Builds function head from ApiFunction. - * - * Return example: `function foo(arg: TValue): void` - */ - export function ApiFunctionToString( - apiItem: Contracts.ApiFunctionDto, - typeParameters?: Contracts.ApiTypeParameterDto[], - parameters?: Contracts.ApiParameterDto[], - alias?: string - ): string { - const name = alias || apiItem.Name; - const callString = ApiCallToString(typeParameters, parameters, apiItem.ReturnType); - - return `function ${name}${callString}`; - } - - /** - * Builds construct declaration. - * - * Return example: `new (arg: TValue): void` - */ - export function ApiConstructToString( - typeParameters?: Contracts.ApiTypeParameterDto[], - parameters?: Contracts.ApiParameterDto[], - returnType?: Contracts.TypeDto - ): string { - const callString = ApiCallToString(typeParameters, parameters, returnType); - - return `new ${callString}`; - } - - export function ApiMethodToString( - name: string, - typeParameters?: Contracts.ApiTypeParameterDto[], - parameters?: Contracts.ApiParameterDto[], - returnType?: Contracts.TypeDto - ): string { - const callString = ApiCallToString(typeParameters, parameters, returnType); - - return `${name}${callString}`; - } - - export function ClassToString( - apiItem: Contracts.ApiClassDto, - typeParameters?: Contracts.ApiTypeParameterDto[], - alias?: string - ): string { - const name = alias || apiItem.Name; - // Abstract - const abstract = apiItem.IsAbstract ? "abstract " : ""; - - // TypeParameters - let typeParametersString: string; - if (typeParameters != null && typeParameters.length > 0) { - const params: string[] = typeParameters.map(TypeParameterToString); - typeParametersString = `<${params.join(", ")}>`; - } else { - typeParametersString = ""; - } - - // Extends - let extendsString: string; - if (apiItem.Extends != null) { - extendsString = ` extends ${apiItem.Extends.Text}`; - } else { - extendsString = ""; - } - - // Implements - let implementsString: string; - if (apiItem.Implements != null && apiItem.Implements.length > 0) { - implementsString = ` implements ${apiItem.Implements.map(x => x.Text).join(", ")}`; - } else { - implementsString = ""; - } - - return `${abstract}class ${name}${typeParametersString}${extendsString}${implementsString}`; - } - - export function ApiFunctionToSimpleString( - alias: string, - apiItem: Contracts.ApiFunctionDto, - parametersApiItems: Contracts.ApiParameterDto[] - ): string { - const name = alias || apiItem.Name; - const parametersString = parametersApiItems - .map(x => x.Name) - .join(", "); - - return `${name}(${parametersString})`; - } - - export function ApiClassMethodToString( - apiItem: Contracts.ApiClassMethodDto, - parameters: Contracts.ApiParameterDto[], - alias?: string - ): string { - const name = alias || apiItem.Name; - - const optional = apiItem.IsOptional ? "?" : ""; - const abstract = apiItem.IsAbstract ? " abstract" : ""; - const async = apiItem.IsAsync ? " async" : ""; - const $static = apiItem.IsStatic ? " static" : ""; - const functionHeader = CallableParametersToString(`${name}${optional}`, parameters, apiItem.ReturnType); - - return `${apiItem.AccessModifier}${$static}${abstract}${async} ${functionHeader}`.trim(); - } - - export function ApiClassPropertyToString(apiItem: Contracts.ApiClassPropertyDto, alias?: string): string { - const name = alias || apiItem.Name; - - const optional = apiItem.IsOptional ? "?" : ""; - const abstract = apiItem.IsAbstract ? " abstract" : ""; - const $static = apiItem.IsStatic ? " static" : ""; - - return `${apiItem.AccessModifier}${$static}${abstract} ${name}${optional}: ${apiItem.Type.Text};`; - } - - export function CallableParametersToSimpleString(text: string, parameters: Contracts.ApiParameterDto[]): string { - const parametersString = parameters - .map(x => x.Name) - .join(", "); - - return `${text}(${parametersString})`; - } - - export function CallableParametersToString( - text: string, - parameters: Contracts.ApiParameterDto[], - returnType?: Contracts.TypeDto - ): string { - // Parameters - let parametersString: string; - if (parameters != null && parameters.length > 0) { - parametersString = parameters - .map(x => `${x.Name}: ${x.Type.Text}`) - .join(", "); - } else { - parametersString = ""; - } - - // ReturnType - let returnTypeString: string; - if (returnType != null) { - returnTypeString = `: ${returnType.Text}`; - } else { - returnTypeString = ""; - } - - return `${text}(${parametersString})${returnTypeString}`; - } - - export function GetApiItemsFromReference( - items: Contracts.ApiItemReference[], - extractedData: ExtractDto, - apiItemKind?: Contracts.ApiItemKinds - ): T[] { - const apiItems: T[] = []; - - for (const itemReferences of items) { - for (const referenceId of itemReferences.Ids) { - const apiItem = extractedData.Registry[referenceId] as T; - if (apiItemKind == null || apiItemKind != null && apiItem.ApiKind === apiItemKind) { - apiItems.push(apiItem); - } - } - } - - return apiItems; - } - - export function LogWithApiItemPosition(logLevel: LogLevel, apiItem: Contracts.ApiItemDto, message: string): void { - const { FileName, Line, Character } = apiItem.Location; - const linePrefix = `${FileName}[${Line}:${Character + 1}]`; - Logger.Log(logLevel, `${linePrefix}: ${message}`); - } - - export function StandardisePath(pathString: string): string { - return pathString.split(path.sep).join("/"); - } - - export function ApiInterfaceToSimpleString(alias: string, apiItem: Contracts.ApiInterfaceDto): string { - const name = alias || apiItem.Name; - return `interface ${name}`; - } + // #region Stringifiers // TODO: optimize. export function ApiInterfaceToString( @@ -581,11 +371,31 @@ export namespace GeneratorHelpers { return builder.GetOutput(); } + export function ApiTypeToString(item: Contracts.ApiTypeDto, alias?: string): string { + const name = alias != null ? alias : item.Name; + + return `type ${name} = ${item.Type.Text};`; + } + + export function ApiInterfaceToSimpleString(alias: string, apiItem: Contracts.ApiInterfaceDto): string { + const name = alias || apiItem.Name; + return `interface ${name}`; + } + + export function ApiIndexToString(parameter: Contracts.ApiParameterDto, type: Contracts.TypeDto, readOnly: boolean = false): string { + const typeString = TypeDtoToMarkdownString(type).Text; + const parameterTypeString = TypeDtoToMarkdownString(parameter.Type).Text; + + const readOnlyString = readOnly ? "readonly " : ""; + + return `${readOnlyString}[${parameter.Name}: ${parameterTypeString}]: ${typeString}`; + } + export function ApiPropertyToString(apiItem: Contracts.ApiPropertyDto): string { - const isReadOnlyString = apiItem.IsReadonly ? "readonly " : ""; - const isOptionalString = apiItem.IsReadonly ? "?" : ""; - const returnTypeString = apiItem.Type.Text; - return `${isReadOnlyString}${apiItem.Name}${isOptionalString}: ${returnTypeString}`; + const optional = apiItem.IsOptional ? "?" : ""; + const readOnly = apiItem.IsReadonly ? "readonly " : ""; + + return `${readOnly}${apiItem.Name}${optional}: ${apiItem.Type.Text}`; } export function ApiAccessorToString( @@ -608,134 +418,317 @@ export namespace GeneratorHelpers { return `${apiItem.AccessModifier}${$static}${abstract} ${accessorType} ${name}: ${typeString};`; } - // TODO: add description from @template jsdoc tag. - export function ApiTypeParametersTableToString(typeParameters: Contracts.ApiTypeParameterDto[]): ReferenceDto { - if (typeParameters.length === 0) { - return { - References: [], - Text: [] - }; - } + export function ApiClassPropertyToString(apiItem: Contracts.ApiClassPropertyDto, alias?: string): string { + const name = alias || apiItem.Name; - let referenceIds: string[] = []; - const header = ["Name", "Constraint type", "Default type"]; - const content = typeParameters.map(typeParameter => { - let constraintType: string = ""; - let defaultType: string = ""; + const optional = apiItem.IsOptional ? "?" : ""; + const readOnly = apiItem.IsReadonly ? " readonly" : ""; + const abstract = apiItem.IsAbstract ? " abstract" : ""; + const $static = apiItem.IsStatic ? " static" : ""; - if (typeParameter.ConstraintType) { - const parsedConstraintType = TypeDtoToMarkdownString(typeParameter.ConstraintType); + return `${apiItem.AccessModifier}${$static}${abstract}${readOnly} ${name}${optional}: ${apiItem.Type.Text};`; + } - referenceIds = referenceIds.concat(parsedConstraintType.References); - constraintType = MarkdownGenerator.EscapeString(parsedConstraintType.Text); - } + export function EnumToString(alias: string, memberItems: Contracts.ApiEnumMemberDto[]): string[] { + // Constructing enum body. + const membersStrings = memberItems.map((memberItem, index, array) => { + // Add an enum name + let memberString = `${GeneratorHelpers.Tab()} ${memberItem.Name}`; - if (typeParameter.DefaultType) { - const parsedDefaultType = TypeDtoToMarkdownString(typeParameter.DefaultType); + // Add an enum member value if it exists. + if (memberItem.Value) { + memberString += ` = ${memberItem.Value}`; + } - referenceIds = referenceIds.concat(parsedDefaultType.References); - defaultType = MarkdownGenerator.EscapeString(parsedDefaultType.Text); + // Add a comma if current item is not the last item + if (index !== memberItems.length - 1) { + memberString += ","; } - return [typeParameter.Name, constraintType, defaultType]; + return memberString; }); + // Construct enum code output + return [ + `enum ${alias} {`, + ...membersStrings, + "}" + ]; + } + + export function ApiVariableToString(item: Contracts.ApiVariableDto, alias?: string): string { + const name = alias != null ? alias : item.Name; + + return `${item.VariableDeclarationType} ${name}: ${item.Type.Text};`; + } + + export function ClassToString( + apiItem: Contracts.ApiClassDto, + typeParameters?: Contracts.ApiTypeParameterDto[], + alias?: string + ): string { + const name = alias || apiItem.Name; + // Abstract + const abstract = apiItem.IsAbstract ? "abstract " : ""; + + // TypeParameters + const typeParametersString: string = TypeParametersToString(typeParameters); + + // Extends + let extendsString: string; + if (apiItem.Extends != null) { + extendsString = ` extends ${apiItem.Extends.Text}`; + } else { + extendsString = ""; + } + + // Implements + let implementsString: string; + if (apiItem.Implements != null && apiItem.Implements.length > 0) { + implementsString = ` implements ${apiItem.Implements.map(x => x.Text).join(", ")}`; + } else { + implementsString = ""; + } + + return `${abstract}class ${name}${typeParametersString}${extendsString}${implementsString}`; + } + + export function TypeParametersToString(typeParameters?: Contracts.ApiTypeParameterDto[]): string { + if (typeParameters != null && typeParameters.length > 0) { + const params: string[] = typeParameters.map(TypeParameterToString); + return `<${params.join(", ")}>`; + } else { + return ""; + } + } + + export function TypeParameterToString(apiItem: Contracts.ApiTypeParameterDto): string { + const extendsString = apiItem.ConstraintType != null ? ` extends ${apiItem.ConstraintType.Text}` : ""; + const defaultType = apiItem.DefaultType != null ? ` = ${apiItem.DefaultType.Text}` : ""; + + return `${apiItem.Name}${extendsString}${defaultType}`; + } + + // #endregion Stringifiers + + // #region Tables + export function ApiPropertiesToTableString(properties: Contracts.ApiPropertyDto[]): ReferenceDto { + const headers = ["Name", "Type", "Optional"]; + return ApiItemsToTableString(headers, properties, ApiPropertyToTableRow); + } + + export function ApiPropertyToTableRow(property: Contracts.ApiPropertyDto): ReferenceDto { + const parameterTypeDto = TypeDtoToMarkdownString(property.Type); + const isOptionalString = property.IsOptional ? "Yes" : ""; + return { - References: referenceIds, - Text: MarkdownGenerator.Table(header, content, DEFAULT_TABLE_OPTIONS) + Text: [property.Name, parameterTypeDto.Text, isOptionalString], + References: parameterTypeDto.References }; } - export function IsApiItemKind( - itemKind: Contracts.ApiItemKinds, - apiItem: Contracts.ApiItemDto): apiItem is TKindDto { - return apiItem.ApiKind === itemKind; + export function ApiParametersToTableString(parameters: Contracts.ApiParameterDto[]): ReferenceDto { + const headers = ["Name", "Type", "Optional", "Initial value", "Description"]; + return ApiItemsToTableString(headers, parameters, ApiParameterToTableRow); } // TODO: implement description. // TODO: implement IsSpread. - export function ApiParametersToTableString(parameters: Contracts.ApiParameterDto[]): ReferenceDto { - if (parameters.length === 0) { - return { - References: [], - Text: [] - }; - } + export function ApiParameterToTableRow(parameter: Contracts.ApiParameterDto): ReferenceDto { + const parameterTypeDto = TypeDtoToMarkdownString(parameter.Type); + const isOptionalString = parameter.IsOptional ? "Yes" : ""; + const initializerString = parameter.Initializer || ""; + + return { + Text: [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), isOptionalString, initializerString], + References: parameterTypeDto.References + }; + } + export function ApiTypeParametersTableToString(typeParameters: Contracts.ApiTypeParameterDto[]): ReferenceDto { + const headers = ["Name", "Constraint type", "Default type"]; + return ApiItemsToTableString(headers, typeParameters, ApiTypeParameterToTableRow); + } + + // TODO: add description from @template jsdoc tag. + export function ApiTypeParameterToTableRow(typeParameter: Contracts.ApiTypeParameterDto): ReferenceDto { let referenceIds: string[] = []; - const header = ["Name", "Type", "Optional", "Initial value", "Description"]; + let constraintType: string = ""; + let defaultType: string = ""; - const content = parameters.map(parameter => { - const parameterTypeDto = TypeDtoToMarkdownString(parameter.Type); + if (typeParameter.ConstraintType) { + const parsedConstraintType = TypeDtoToMarkdownString(typeParameter.ConstraintType); - referenceIds = referenceIds.concat(parameterTypeDto.References); + referenceIds = referenceIds.concat(parsedConstraintType.References); + constraintType = MarkdownGenerator.EscapeString(parsedConstraintType.Text); + } - const isOptionalString = parameter.IsOptional ? "Yes" : ""; - const initializerString = parameter.Initializer || ""; + if (typeParameter.DefaultType) { + const parsedDefaultType = TypeDtoToMarkdownString(typeParameter.DefaultType); - return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), isOptionalString, initializerString]; - }); + referenceIds = referenceIds.concat(parsedDefaultType.References); + defaultType = MarkdownGenerator.EscapeString(parsedDefaultType.Text); + } return { - Text: MarkdownGenerator.Table(header, content, DEFAULT_TABLE_OPTIONS), + Text: [typeParameter.Name, constraintType, defaultType], References: referenceIds }; } - export function ApiIndexToString(parameter: Contracts.ApiParameterDto, type: Contracts.TypeDto, readOnly: boolean = false): string { - const typeString = TypeDtoToMarkdownString(type).Text; - const parameterTypeString = TypeDtoToMarkdownString(parameter.Type).Text; - - const readOnlyString = readOnly ? "readonly " : ""; - - return `${readOnlyString}[${parameter.Name}: ${parameterTypeString}]: ${typeString}`; - } - - export function ApiPropertiesToTableString(properties: Contracts.ApiPropertyDto[]): ReferenceDto { - if (properties.length === 0) { + export function ApiItemsToTableString( + headers: string[], + items: TApiDto[], + itemToString: (item: TApiDto) => ReferenceDto + ): ReferenceDto { + if (items.length === 0) { return { References: [], Text: [] }; } - let referenceIds: string[] = []; - const header = ["Name", "Type", "Optional"]; - - const content = properties.map(property => { - const parameterTypeDto = TypeDtoToMarkdownString(property.Type); - - referenceIds = referenceIds.concat(parameterTypeDto.References); - - const isOptionalString = property.IsOptional ? "Yes" : ""; - - return [property.Name, parameterTypeDto.Text, isOptionalString]; - }); + const rows = items.map(itemToString); + const content = rows.map(row => row.Text); + const referenceIds = Helpers.Flatten(rows.map(row => row.References)); return { - Text: MarkdownGenerator.Table(header, content, DEFAULT_TABLE_OPTIONS), + Text: MarkdownGenerator.Table(headers, content, DEFAULT_TABLE_OPTIONS), References: referenceIds }; } - export function MergePluginResultData(a: T, b: Partial | undefined): T { - if (b == null) { - return a; + //#endregion Tables + + // #region Call strings + /** + * Builds call declaration. + * + * Return example: `(arg: TValue): void`. + */ + export function ApiCallToString( + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + returnType?: Contracts.TypeDto + ): string { + // TypeParameters + const typeParametersString = TypeParametersToString(typeParameters); + + // Parameters + let parametersString: string; + if (parameters != null && parameters.length > 0) { + parametersString = parameters + .map(ApiParameterToString) + .join(", "); + } else { + parametersString = ""; } - a.Headings = a.Headings.concat(b.Headings || []); - a.Members = (a.Members || []).concat(b.Members || []); - a.Result = a.Result.concat(b.Result || []); - a.UsedReferences = a.UsedReferences.concat(b.UsedReferences || []); + // ReturnType + const returnTypeString = returnType != null ? `: ${returnType.Text}` : ""; - return a; + return `${typeParametersString}(${parametersString})${returnTypeString}`; } - export function GetDefaultPluginResultData(): PluginResultData { - return { - Headings: [], - Result: [], - UsedReferences: [] - }; + /** + * Builds ApiParameter string. + * + * Return example: `arg: TValue`. + */ + export function ApiParameterToString(apiItem: Contracts.ApiParameterDto): string { + // FIXME: `?` and `| undefined` in a single statement. + const initializerString = apiItem.Initializer ? ` = ${apiItem.Initializer}` : ""; + const isOptionalString = apiItem.IsOptional ? "?" : ""; + return `${apiItem.Name}${isOptionalString}: ${apiItem.Type.Text}${initializerString}`; + } + + export function ApiClassConstructorToString(parameters?: Contracts.ApiParameterDto[], returnType?: Contracts.TypeDto): string { + const callString = ApiCallToString(undefined, parameters, returnType); + return `constructor${callString}`; + } + + /** + * Builds function head from ApiFunction. + * + * Return example: `function foo(arg: TValue): void`. + */ + export function ApiFunctionToString( + apiItem: Contracts.ApiFunctionDto, + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + alias?: string + ): string { + const name = alias || apiItem.Name; + const callString = ApiCallToString(typeParameters, parameters, apiItem.ReturnType); + + return `function ${name}${callString}`; + } + + /** + * Builds construct declaration. + * + * Return example: `new (arg: TValue): void`. + */ + export function ApiConstructToString( + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + returnType?: Contracts.TypeDto + ): string { + const callString = ApiCallToString(typeParameters, parameters, returnType); + + return `new ${callString}`; + } + + /** + * Builds method declaration. + * + * Return example: `someMethod(arg: TValue): void`. + */ + export function ApiMethodToString( + name: string, + typeParameters?: Contracts.ApiTypeParameterDto[], + parameters?: Contracts.ApiParameterDto[], + returnType?: Contracts.TypeDto + ): string { + const callString = ApiCallToString(typeParameters, parameters, returnType); + + return `${name}${callString}`; + } + + /** + * Builds class method declaration. + * + * Return example: `public static SomeMethod(arg: TValue): void`. + */ + export function ApiClassMethodToString( + apiItem: Contracts.ApiClassMethodDto, + typeParameters: Contracts.ApiTypeParameterDto[], + parameters: Contracts.ApiParameterDto[], + alias?: string + ): string { + const name = alias || apiItem.Name; + + const optional = apiItem.IsOptional ? "?" : ""; + const abstract = apiItem.IsAbstract ? " abstract" : ""; + const async = apiItem.IsAsync ? " async" : ""; + const $static = apiItem.IsStatic ? " static" : ""; + const functionHeader = ApiMethodToString(`${name}${optional}`, typeParameters, parameters, apiItem.ReturnType); + + return `${apiItem.AccessModifier}${$static}${abstract}${async} ${functionHeader}`.trim(); } + + /** + * Build simplified method declaration + * + * Return example: `someMethod(parameter1, parameter2)`. + */ + export function MethodToSimpleString(text: string, parameters: Contracts.ApiParameterDto[]): string { + const parametersString = parameters + .map(x => x.Name) + .join(", "); + + return `${text}(${parametersString})`; + } + + // #endregion Call strings } diff --git a/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts index 8d432fe0..c2d3680e 100644 --- a/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts @@ -50,7 +50,7 @@ export class ApiClassConstructorPlugin implements Plugin(options.ApiItem.Parameters, options.ExtractedData); const parameters = this.renderParameters(apiParameters); - const heading = GeneratorHelpers.CallableParametersToSimpleString("constructor", apiParameters); + const heading = GeneratorHelpers.MethodToSimpleString("constructor", apiParameters); pluginResult.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); @@ -58,7 +58,7 @@ export class ApiClassConstructorPlugin implements Plugin .GetApiItemsFromReference(options.ApiItem.Parameters, options.ExtractedData); const parameters = this.renderParameters(apiParameters); - const heading = GeneratorHelpers.CallableParametersToSimpleString(options.Reference.Alias, apiParameters); + // Parameters + const apiTypeParameters = GeneratorHelpers + .GetApiItemsFromReference(options.ApiItem.TypeParameters, options.ExtractedData); + + const heading = GeneratorHelpers.MethodToSimpleString(options.Reference.Alias, apiParameters); pluginResult.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); @@ -60,6 +64,7 @@ export class ApiClassMethodPlugin implements Plugin .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) .Code(GeneratorHelpers.ApiClassMethodToString( options.ApiItem, + apiTypeParameters, apiParameters, options.Reference.Alias ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) diff --git a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts index 3be8ab98..783d1a87 100644 --- a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts @@ -41,7 +41,7 @@ export class ApiEnumPlugin implements Plugin { .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) .EmptyLine() - .Code(GeneratorHelpers.ReconstructEnumCode(data.Reference.Alias, enumMembers), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .Code(GeneratorHelpers.EnumToString(data.Reference.Alias, enumMembers), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() .Text(this.constructEnumTable(enumMembers)); diff --git a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts index 00093db5..99d4ea58 100644 --- a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts @@ -103,7 +103,7 @@ export class ApiFunctionPlugin implements Plugin { const resolvedReturnTypeDto = this.resolveReturnType(data.ApiItem.ReturnType); const builder = new MarkdownBuilder() - .Header(GeneratorHelpers.ApiFunctionToSimpleString(alias, data.ApiItem, parameters), 2) + .Header(GeneratorHelpers.MethodToSimpleString(alias || data.ApiItem.Name, parameters), 2) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) .Code(GeneratorHelpers.ApiFunctionToString( diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index e6ae0e08..e19511ab 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -356,7 +356,7 @@ Array [ " (key?: string | undefined): { someProperty: T; };", " (key: number): { someProperty: T; };", " readonly [key: string]: TValue;", - " readonly objectOne?: TValue;", + " readonly objectOne: TValue;", " objectTwo: TValue;", "}", "\`\`\`", diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap index 8897f5c1..a00154f2 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -38,6 +38,18 @@ Array [ "| message | string |", "", "", + "## Properties", + "", + "### defaultMessage", + "", + "\`\`\`typescript", + "private readonly defaultMessage: string;", + "\`\`\`", + "", + "### Type", + "", + "string", + "", "", ], }, diff --git a/packages/ts-docs-gen/tests/cases/simple-project-2/foo.ts b/packages/ts-docs-gen/tests/cases/simple-project-2/foo.ts index 38491e67..58ed1b72 100644 --- a/packages/ts-docs-gen/tests/cases/simple-project-2/foo.ts +++ b/packages/ts-docs-gen/tests/cases/simple-project-2/foo.ts @@ -1,5 +1,7 @@ export class Foo { public GetMessage(message: string): string { - return message; + return this.defaultMessage; } + + private readonly defaultMessage: string = "It's a default message."; } From b682f23f73da176c82951211efb127c3c9f75da3 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Wed, 3 Jan 2018 16:01:04 +0200 Subject: [PATCH 60/61] Feature: interface improvements (#15) --- .../examples/simple/docs/api/index.md | 109 ++++++------------ packages/ts-docs-gen/src/file-manager.ts | 1 + .../src/plugins/api-callable-plugin.ts | 7 +- .../src/plugins/api-interface-plugin.ts | 24 ++-- .../simple-project-1.test.ts.snap | 107 ++++++----------- .../tests/cases/simple-project-1/index.ts | 1 - 6 files changed, 83 insertions(+), 166 deletions(-) diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index ec6bea08..e3b4a381 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,10 +1,10 @@ -[InterfaceDeclaration-1]: index.md#foo -[InterfaceDeclaration-2]: index.md#boo -[InterfaceDeclaration-4]: index.md#myconstrainttype -[InterfaceDeclaration-9]: index.md#dictionary -[InterfaceDeclaration-9]: index.md#dictionary -[InterfaceDeclaration-6]: index.md#objectsinterface -[InterfaceDeclaration-12]: index.md#monsterinterface +[InterfaceDeclaration-1]: index.md#interface-foo +[InterfaceDeclaration-2]: index.md#interface-boo +[InterfaceDeclaration-4]: index.md#interface-myconstrainttype +[InterfaceDeclaration-9]: index.md#interface-dictionary +[InterfaceDeclaration-9]: index.md#interface-dictionary +[InterfaceDeclaration-6]: index.md#interface-objectsinterface +[InterfaceDeclaration-12]: index.md#interface-monsterinterface [ClassDeclaration-0]: index/hello.md#hello # index @@ -80,26 +80,23 @@ interface AnotherInterface { (param1: TValue, param2: TValue): boolean ``` -Type parameters: +**Type parameters:** | Name | | ------ | | TValue | -Parameters: +**Parameters:** | Name | Type | | ------ | ------ | | param1 | TValue | | param2 | TValue | -Return type: +**Return type:** true | false ---- - - ## interface MyConstraintType ```typescript @@ -162,19 +159,16 @@ interface InterfaceWithCall { (): { someProperty: T; } ``` -Type parameters: +**Type parameters:** | Name | | ---- | | T | -Return type: +**Return type:** { someProperty: T; } ---- - - ## interface InterfaceWithConstraintType ```typescript @@ -214,29 +208,24 @@ interface InterfaceWithMethod { someMethodOne(): T ``` -Return type: +**Return type:** T ---- - ```typescript someMethodTwo(): TReturn ``` -Type parameters: +**Type parameters:** | Name | | ------- | | TReturn | -Return type: +**Return type:** TReturn ---- - - ## interface Dictionary ```typescript @@ -258,12 +247,10 @@ interface Dictionary { new (): Dictionary ``` -Return type: +**Return type:** [Dictionary][InterfaceDeclaration-9]<TValue> ---- - ### Index signatures ```typescript @@ -274,9 +261,6 @@ Index `key` - string Type - TValue ---- - - ## interface MethodsInterface ```typescript @@ -292,43 +276,38 @@ interface MethodsInterface { (arg: TValue): void ``` -Type parameters: +**Type parameters:** | Name | | ------ | | TValue | -Parameters: +**Parameters:** | Name | Type | | ---- | ------ | | arg | TValue | -Return type: +**Return type:** void ---- - ### Methods ```typescript someMethod(): string ``` -Type parameters: +**Type parameters:** | Name | | ---- | | T | -Return type: +**Return type:** string ---- - - ## interface MonsterInterface Warning: Beta! @@ -345,7 +324,7 @@ interface MonsterInterface extends ObjectsInterface (key?: string | undefined): { someProperty: T; }; (key: number): { someProperty: T; }; readonly [key: string]: TValue; - readonly objectOne?: TValue; + readonly objectOne: TValue; objectTwo: TValue; } ``` @@ -366,96 +345,86 @@ interface MonsterInterface extends ObjectsInterface new (): MonsterInterface ``` -Type parameters: +**Type parameters:** | Name | | ---- | | T | -Return type: +**Return type:** [MonsterInterface][InterfaceDeclaration-12]<T> ---- - ```typescript new (someParameter: string): string ``` -Parameters: +**Parameters:** | Name | Type | | ------------- | ------ | | someParameter | string | -Return type: +**Return type:** string ---- - ### Call ```typescript (): { someProperty: T; } ``` -Type parameters: +**Type parameters:** | Name | | ---- | | T | -Return type: +**Return type:** { someProperty: T; } ---- - ```typescript (key?: string | undefined): { someProperty: T; } ``` -Type parameters: +**Type parameters:** | Name | | ---- | | T | -Parameters: +**Parameters:** | Name | Type | Optional | | ---- | ----------------------- | -------- | | key | undefined | string | Yes | -Return type: +**Return type:** { someProperty: T; } ---- - ```typescript (key: number): { someProperty: T; } ``` -Type parameters: +**Type parameters:** | Name | | ---- | | T | -Parameters: +**Parameters:** | Name | Type | | ---- | ------ | | key | number | -Return type: +**Return type:** { someProperty: T; } ---- - ### Index signatures ```typescript @@ -468,8 +437,6 @@ Index `key` - string Type - TValue ---- - ### Properties | Name | Type | @@ -496,8 +463,6 @@ Index `key` - string Type - string | number ---- - ```typescript [key: number]: string ``` @@ -506,9 +471,6 @@ Index `key` - number Type - string ---- - - ## interface StringsDictionary ```typescript @@ -527,9 +489,6 @@ Index `key` - string Type - string ---- - - ## interface MyInterface ```typescript diff --git a/packages/ts-docs-gen/src/file-manager.ts b/packages/ts-docs-gen/src/file-manager.ts index d5760681..60214a1c 100644 --- a/packages/ts-docs-gen/src/file-manager.ts +++ b/packages/ts-docs-gen/src/file-manager.ts @@ -14,6 +14,7 @@ interface OutputData { type RenderedItemList = Array; +// TODO: remove unused files before generating docs. export class FileManager { /** * diff --git a/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts index 73d144f8..0d77360b 100644 --- a/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts @@ -24,7 +24,6 @@ export class ApiCallablePlugin implements Plugin { parameters: Contracts.ApiParameterDto[], typeParameters: Contracts.ApiTypeParameterDto[] ): string { - switch (apiItem.ApiKind) { case Contracts.ApiItemKinds.Construct: { return GeneratorHelpers.ApiConstructToString(typeParameters, parameters, apiItem.ReturnType); @@ -58,7 +57,7 @@ export class ApiCallablePlugin implements Plugin { usedReferences.push(...table.References); builder - .Text("Type parameters:") + .Bold("Type parameters:") .EmptyLine() .Text(table.Text) .EmptyLine(); @@ -69,7 +68,7 @@ export class ApiCallablePlugin implements Plugin { usedReferences.push(...table.References); builder - .Text("Parameters:") + .Bold("Parameters:") .EmptyLine() .Text(table.Text) .EmptyLine(); @@ -79,7 +78,7 @@ export class ApiCallablePlugin implements Plugin { const renderedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.ReturnType); builder - .Text("Return type:") + .Bold("Return type:") .EmptyLine() .Text(renderedReturnType.Text); diff --git a/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts b/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts index 9eb58f63..6bc8c1b1 100644 --- a/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts @@ -37,10 +37,10 @@ export class ApiInterfacePlugin implements Plugin { const typeParametersTable = GeneratorHelpers.ApiTypeParametersTableToString(typeParameters); const text = new MarkdownBuilder() + .EmptyLine() .Header("Type parameters", 3) .EmptyLine() .Text(typeParametersTable.Text) - .EmptyLine() .GetOutput(); return { @@ -56,18 +56,17 @@ export class ApiInterfacePlugin implements Plugin { } const builder = new MarkdownBuilder() - .Header("Extends", 3) - .EmptyLine(); + .EmptyLine() + .Header("Extends", 3); const references = []; for (const type of apiItem.Extends) { const typeDto = GeneratorHelpers.TypeDtoToMarkdownString(type); references.push(...typeDto.References); - builder - .Text(typeDto.Text) - .EmptyLine(); + .EmptyLine() + .Text(typeDto.Text); } return { @@ -88,6 +87,7 @@ export class ApiInterfacePlugin implements Plugin { const table = GeneratorHelpers.ApiPropertiesToTableString(apiItems); const builder = new MarkdownBuilder() + .EmptyLine() .Header("Properties", 3) .EmptyLine() .Text(table.Text); @@ -119,13 +119,13 @@ export class ApiInterfacePlugin implements Plugin { } const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); - pluginResult.Result.push(MarkdownGenerator.Header(title, 3), ""); + pluginResult.Result.push("", MarkdownGenerator.Header(title, 3)); for (const item of items) { + pluginResult.Result.push(""); const itemPluginResult = getPluginResult(item.Reference); GeneratorHelpers.MergePluginResultData(pluginResult, itemPluginResult); - pluginResult.Result.push("", MarkdownGenerator.HorizontalRule(), ""); } return pluginResult; @@ -133,6 +133,7 @@ export class ApiInterfacePlugin implements Plugin { public Render(data: PluginOptions): PluginResult { const alias = data.Reference.Alias; + const header = GeneratorHelpers.ApiInterfaceToSimpleString(alias, data.ApiItem); const pluginResult: PluginResult = { ...GeneratorHelpers.GetDefaultPluginResultData(), ApiItem: data.ApiItem, @@ -140,7 +141,7 @@ export class ApiInterfacePlugin implements Plugin { Headings: [ { ApiItemId: data.Reference.Id, - Heading: alias + Heading: header } ] }; @@ -153,11 +154,10 @@ export class ApiInterfacePlugin implements Plugin { const interfaceString = GeneratorHelpers.ApiInterfaceToString(data.ApiItem, data.ExtractedData); const builder = new MarkdownBuilder() - .Header(GeneratorHelpers.ApiInterfaceToSimpleString(alias, data.ApiItem), 2) + .Header(header, 2) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(interfaceString, GeneratorHelpers.DEFAULT_CODE_OPTIONS) - .EmptyLine(); + .Code(interfaceString, GeneratorHelpers.DEFAULT_CODE_OPTIONS); pluginResult.Result = builder.GetOutput(); diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index e19511ab..e28c11a5 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -5,13 +5,13 @@ Array [ Object { "FileLocation": "index.md", "Result": Array [ - "[InterfaceDeclaration-1]: index.md#foointerface", - "[InterfaceDeclaration-2]: index.md#boo", - "[InterfaceDeclaration-4]: index.md#myconstrainttype", - "[InterfaceDeclaration-9]: index.md#dictionary", - "[InterfaceDeclaration-9]: index.md#dictionary", - "[InterfaceDeclaration-6]: index.md#objectsinterface", - "[InterfaceDeclaration-12]: index.md#monsterinterface", + "[InterfaceDeclaration-1]: index.md#interface-foointerface", + "[InterfaceDeclaration-2]: index.md#interface-boo", + "[InterfaceDeclaration-4]: index.md#interface-myconstrainttype", + "[InterfaceDeclaration-9]: index.md#interface-dictionary", + "[InterfaceDeclaration-9]: index.md#interface-dictionary", + "[InterfaceDeclaration-6]: index.md#interface-objectsinterface", + "[InterfaceDeclaration-12]: index.md#interface-monsterinterface", "[ClassDeclaration-0]: index/foo.md#foo", "[ClassDeclaration-1]: index/world.md#world", "[ClassDeclaration-2]: index/earth.md#earth", @@ -91,26 +91,23 @@ Array [ "(param1: TValue, param2: TValue): boolean", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ------ |", "| TValue |", "", - "Parameters:", + "**Parameters:**", "", "| Name | Type |", "| ------ | ------ |", "| param1 | TValue |", "| param2 | TValue |", "", - "Return type:", + "**Return type:**", "", "true | false", "", - "---", - "", - "", "## interface MyConstraintType", "", "\`\`\`typescript", @@ -173,19 +170,16 @@ Array [ "(): { someProperty: T; }", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ---- |", "| T |", "", - "Return type:", + "**Return type:**", "", "{ someProperty: T; }", "", - "---", - "", - "", "## interface InterfaceWithConstraintType", "", "\`\`\`typescript", @@ -225,29 +219,24 @@ Array [ "someMethodOne(): T", "\`\`\`", "", - "Return type:", + "**Return type:**", "", "T", "", - "---", - "", "\`\`\`typescript", "someMethodTwo(): TReturn", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ------- |", "| TReturn |", "", - "Return type:", + "**Return type:**", "", "TReturn", "", - "---", - "", - "", "## interface Dictionary", "", "\`\`\`typescript", @@ -269,12 +258,10 @@ Array [ "new (): Dictionary", "\`\`\`", "", - "Return type:", + "**Return type:**", "", "[Dictionary][InterfaceDeclaration-9]<TValue>", "", - "---", - "", "### Index signatures", "", "\`\`\`typescript", @@ -285,9 +272,6 @@ Array [ "", "Type - TValue", "", - "---", - "", - "", "## interface MethodsInterface", "", "\`\`\`typescript", @@ -303,43 +287,38 @@ Array [ "(arg: TValue): void", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ------ |", "| TValue |", "", - "Parameters:", + "**Parameters:**", "", "| Name | Type |", "| ---- | ------ |", "| arg | TValue |", "", - "Return type:", + "**Return type:**", "", "void", "", - "---", - "", "### Methods", "", "\`\`\`typescript", "someMethod(): string", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ---- |", "| T |", "", - "Return type:", + "**Return type:**", "", "string", "", - "---", - "", - "", "## interface MonsterInterface", "", "Warning: Beta!", @@ -377,96 +356,86 @@ Array [ "new (): MonsterInterface", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ---- |", "| T |", "", - "Return type:", + "**Return type:**", "", "[MonsterInterface][InterfaceDeclaration-12]<T>", "", - "---", - "", "\`\`\`typescript", "new (someParameter: string): string", "\`\`\`", "", - "Parameters:", + "**Parameters:**", "", "| Name | Type |", "| ------------- | ------ |", "| someParameter | string |", "", - "Return type:", + "**Return type:**", "", "string", "", - "---", - "", "### Call", "", "\`\`\`typescript", "(): { someProperty: T; }", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ---- |", "| T |", "", - "Return type:", + "**Return type:**", "", "{ someProperty: T; }", "", - "---", - "", "\`\`\`typescript", "(key?: string | undefined): { someProperty: T; }", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ---- |", "| T |", "", - "Parameters:", + "**Parameters:**", "", "| Name | Type | Optional |", "| ---- | ----------------------- | -------- |", "| key | undefined | string | Yes |", "", - "Return type:", + "**Return type:**", "", "{ someProperty: T; }", "", - "---", - "", "\`\`\`typescript", "(key: number): { someProperty: T; }", "\`\`\`", "", - "Type parameters:", + "**Type parameters:**", "", "| Name |", "| ---- |", "| T |", "", - "Parameters:", + "**Parameters:**", "", "| Name | Type |", "| ---- | ------ |", "| key | number |", "", - "Return type:", + "**Return type:**", "", "{ someProperty: T; }", "", - "---", - "", "### Index signatures", "", "\`\`\`typescript", @@ -479,8 +448,6 @@ Array [ "", "Type - TValue", "", - "---", - "", "### Properties", "", "| Name | Type |", @@ -507,8 +474,6 @@ Array [ "", "Type - string | number", "", - "---", - "", "\`\`\`typescript", "[key: number]: string", "\`\`\`", @@ -517,9 +482,6 @@ Array [ "", "Type - string", "", - "---", - "", - "", "## interface StringsDictionary", "", "\`\`\`typescript", @@ -538,9 +500,6 @@ Array [ "", "Type - string", "", - "---", - "", - "", "## interface MyInterface", "", "\`\`\`typescript", diff --git a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts index 14e297b0..4d7dd18d 100644 --- a/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts +++ b/packages/ts-docs-gen/tests/cases/simple-project-1/index.ts @@ -88,7 +88,6 @@ export interface MyInterface { } // #endregion Interfaces - // #region Enums /** * Simple list. From aa21abae339045959a2f663c33afb5da496bedcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20=C5=BDilinskas?= Date: Thu, 4 Jan 2018 18:27:40 +0200 Subject: [PATCH 61/61] Feature: Plugins upgrade (#16) --- .../simple/docs/api/exported-functions.md | 12 +- .../examples/simple/docs/api/index.md | 315 +++++-- .../simple/docs/api/index/foonamespace.md | 6 +- .../api/index/foonamespace/boonamespace.md | 6 +- .../boonamespace/boonamespace2.md | 6 +- .../examples/simple/docs/api/index/hello.md | 40 +- packages/ts-docs-gen/examples/simple/index.ts | 69 +- .../src/abstractions/base-plugin.ts | 83 ++ .../src/abstractions/container-plugin.ts | 115 +++ .../src/abstractions/function-like-plugin.ts | 55 ++ packages/ts-docs-gen/src/contracts/plugin.ts | 2 +- packages/ts-docs-gen/src/generator-helpers.ts | 27 +- .../src/plugins/api-callable-plugin.ts | 83 +- .../src/plugins/api-class-accessor-plugin.ts | 59 +- .../plugins/api-class-constructor-plugin.ts | 78 +- .../src/plugins/api-class-method-plugin.ts | 81 +- .../src/plugins/api-class-plugin.ts | 110 +-- .../src/plugins/api-class-property-plugin.ts | 45 +- .../src/plugins/api-default-plugin.ts | 51 +- .../src/plugins/api-enum-plugin.ts | 63 +- .../src/plugins/api-function-plugin.ts | 155 +-- .../src/plugins/api-index-plugin.ts | 61 +- .../src/plugins/api-interface-plugin.ts | 93 +- .../src/plugins/api-namespace-plugin.ts | 125 ++- .../src/plugins/api-source-file-plugin.ts | 138 +-- .../src/plugins/api-type-plugin.ts | 62 +- .../src/plugins/api-variable-plugin.ts | 53 +- .../simple-project-1.test.ts.snap | 884 ++++++++++-------- .../simple-project-2.test.ts.snap | 26 +- 29 files changed, 1553 insertions(+), 1350 deletions(-) create mode 100644 packages/ts-docs-gen/src/abstractions/base-plugin.ts create mode 100644 packages/ts-docs-gen/src/abstractions/container-plugin.ts create mode 100644 packages/ts-docs-gen/src/abstractions/function-like-plugin.ts diff --git a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md index ac02df3f..a613767a 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/exported-functions.md @@ -1,24 +1,26 @@ # exported-functions -## Foo() +## Functions + +### Foo() ```typescript function Foo(): string ``` -### Return type +**Return type** string +---------- -## Bar() +### Bar() ```typescript function Bar(): string ``` -### Return type +**Return type** string - diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index.md b/packages/ts-docs-gen/examples/simple/docs/api/index.md index e3b4a381..65aac989 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index.md @@ -1,14 +1,42 @@ -[InterfaceDeclaration-1]: index.md#interface-foo -[InterfaceDeclaration-2]: index.md#interface-boo -[InterfaceDeclaration-4]: index.md#interface-myconstrainttype -[InterfaceDeclaration-9]: index.md#interface-dictionary -[InterfaceDeclaration-9]: index.md#interface-dictionary -[InterfaceDeclaration-6]: index.md#interface-objectsinterface -[InterfaceDeclaration-12]: index.md#interface-monsterinterface +[InterfaceDeclaration-16]: index.md#props +[InterfaceDeclaration-16]: index.md#props +[InterfaceDeclaration-1]: index.md#foo +[InterfaceDeclaration-2]: index.md#boo +[InterfaceDeclaration-4]: index.md#myconstrainttype +[InterfaceDeclaration-9]: index.md#dictionary +[InterfaceDeclaration-9]: index.md#dictionary +[InterfaceDeclaration-6]: index.md#objectsinterface +[InterfaceDeclaration-12]: index.md#monsterinterface [ClassDeclaration-0]: index/hello.md#hello # index -## interface ExtendedBar +## Functions + +### Component(arg) + +```typescript +function Component(arg: T): void +``` + +**Type parameters** + +| Name | Constraint type | Default type | +| ---- | -------------------------------- | -------------------------------- | +| T | [Props][InterfaceDeclaration-16] | [Props][InterfaceDeclaration-16] | + +**Parameters** + +| Name | Type | +| ---- | ---- | +| arg | T | + +**Return type** + +void + +## Interfaces + +### ExtendedBar ```typescript interface ExtendedBar extends Foo, Boo { @@ -16,19 +44,21 @@ interface ExtendedBar extends Foo, Boo { } ``` -### Extends +**Extends** [Foo][InterfaceDeclaration-1]<number> [Boo][InterfaceDeclaration-2] -### Properties +**Properties** | Name | Type | | ---------- | --------------------- | | OtherStuff | Array<string> | -## interface Foo +---------- + +### Foo ```typescript interface Foo { @@ -38,13 +68,13 @@ interface Foo { } ``` -### Type parameters +**Type parameters** | Name | | ----- | | TType | -### Properties +**Properties** | Name | Type | | ------- | ------ | @@ -52,7 +82,9 @@ interface Foo { | Surname | string | | Type | TType | -## interface Boo +---------- + +### Boo ```typescript interface Boo { @@ -60,13 +92,15 @@ interface Boo { } ``` -### Properties +**Properties** | Name | Type | | ---- | --------------------- | | Boos | Array<string> | -## interface AnotherInterface +---------- + +### AnotherInterface ```typescript interface AnotherInterface { @@ -74,30 +108,32 @@ interface AnotherInterface { } ``` -### Call +#### Call ```typescript (param1: TValue, param2: TValue): boolean ``` -**Type parameters:** +**Type parameters** | Name | | ------ | | TValue | -**Parameters:** +**Parameters** | Name | Type | | ------ | ------ | | param1 | TValue | | param2 | TValue | -**Return type:** +**Return type** true | false -## interface MyConstraintType +---------- + +### MyConstraintType ```typescript interface MyConstraintType { @@ -105,13 +141,15 @@ interface MyConstraintType { } ``` -### Properties +**Properties** | Name | Type | | ---------- | ------ | | myProperty | string | -## interface MyDefaultType +---------- + +### MyDefaultType ```typescript interface MyDefaultType extends MyConstraintType { @@ -119,17 +157,19 @@ interface MyDefaultType extends MyConstraintType { } ``` -### Extends +**Extends** [MyConstraintType][InterfaceDeclaration-4] -### Properties +**Properties** | Name | Type | | --------------- | ------ | | anotherProperty | number | -## interface ObjectsInterface +---------- + +### ObjectsInterface ```typescript interface ObjectsInterface { @@ -138,14 +178,16 @@ interface ObjectsInterface { } ``` -### Properties +**Properties** | Name | Type | | --------- | ------ | | objectOne | Object | | objectTwo | Object | -## interface InterfaceWithCall +---------- + +### InterfaceWithCall ```typescript interface InterfaceWithCall { @@ -153,23 +195,25 @@ interface InterfaceWithCall { } ``` -### Call +#### Call ```typescript (): { someProperty: T; } ``` -**Type parameters:** +**Type parameters** | Name | | ---- | | T | -**Return type:** +**Return type** { someProperty: T; } -## interface InterfaceWithConstraintType +---------- + +### InterfaceWithConstraintType ```typescript interface InterfaceWithConstraintType extends Dictionary { @@ -177,17 +221,19 @@ interface InterfaceWithConstraintType extends Dictionary { } ``` -### Extends +**Extends** [Dictionary][InterfaceDeclaration-9]<string> -### Properties +**Properties** | Name | Type | | ------------ | ------ | | someProperty | string | -## interface InterfaceWithMethod +---------- + +### InterfaceWithMethod ```typescript interface InterfaceWithMethod { @@ -196,19 +242,19 @@ interface InterfaceWithMethod { } ``` -### Type parameters +**Type parameters** | Name | | ---- | | T | -### Methods +#### Methods ```typescript someMethodOne(): T ``` -**Return type:** +**Return type** T @@ -216,17 +262,19 @@ T someMethodTwo(): TReturn ``` -**Type parameters:** +**Type parameters** | Name | | ------- | | TReturn | -**Return type:** +**Return type** TReturn -## interface Dictionary +---------- + +### Dictionary ```typescript interface Dictionary { @@ -235,33 +283,34 @@ interface Dictionary { } ``` -### Type parameters +**Type parameters** | Name | | ------ | | TValue | -### Construct +#### Construct ```typescript new (): Dictionary ``` -**Return type:** +**Return type** [Dictionary][InterfaceDeclaration-9]<TValue> -### Index signatures +#### Index signatures ```typescript [key: string]: TValue ``` -Index `key` - string +* *Parameter* `key` - string +* *Type* TValue -Type - TValue +---------- -## interface MethodsInterface +### MethodsInterface ```typescript interface MethodsInterface { @@ -270,45 +319,47 @@ interface MethodsInterface { } ``` -### Call +#### Call ```typescript (arg: TValue): void ``` -**Type parameters:** +**Type parameters** | Name | | ------ | | TValue | -**Parameters:** +**Parameters** | Name | Type | | ---- | ------ | | arg | TValue | -**Return type:** +**Return type** void -### Methods +#### Methods ```typescript someMethod(): string ``` -**Type parameters:** +**Type parameters** | Name | | ---- | | T | -**Return type:** +**Return type** string -## interface MonsterInterface +---------- + +### MonsterInterface Warning: Beta! @@ -329,29 +380,29 @@ interface MonsterInterface extends ObjectsInterface } ``` -### Type parameters +**Type parameters** | Name | Constraint type | Default type | | ------ | --------------- | ------------ | -| TValue | Object | \{\} | +| TValue | Object | {} | -### Extends +**Extends** [ObjectsInterface][InterfaceDeclaration-6] -### Construct +#### Construct ```typescript new (): MonsterInterface ``` -**Type parameters:** +**Type parameters** | Name | | ---- | | T | -**Return type:** +**Return type** [MonsterInterface][InterfaceDeclaration-12]<T> @@ -359,29 +410,29 @@ new (): MonsterInterface new (someParameter: string): string ``` -**Parameters:** +**Parameters** | Name | Type | | ------------- | ------ | | someParameter | string | -**Return type:** +**Return type** string -### Call +#### Call ```typescript (): { someProperty: T; } ``` -**Type parameters:** +**Type parameters** | Name | | ---- | | T | -**Return type:** +**Return type** { someProperty: T; } @@ -389,19 +440,19 @@ string (key?: string | undefined): { someProperty: T; } ``` -**Type parameters:** +**Type parameters** | Name | | ---- | | T | -**Parameters:** +**Parameters** -| Name | Type | Optional | -| ---- | ----------------------- | -------- | -| key | undefined | string | Yes | +| Name | Type | +| ---- | ----------------------- | +| key | undefined | string | -**Return type:** +**Return type** { someProperty: T; } @@ -409,42 +460,41 @@ string (key: number): { someProperty: T; } ``` -**Type parameters:** +**Type parameters** | Name | | ---- | | T | -**Parameters:** +**Parameters** | Name | Type | | ---- | ------ | | key | number | -**Return type:** +**Return type** { someProperty: T; } -### Index signatures +#### Index signatures ```typescript readonly [key: string]: TValue ``` -Readonly. +* *Parameter* `key` - string +* *Type* TValue -Index `key` - string - -Type - TValue - -### Properties +**Properties** | Name | Type | | --------- | ------ | | objectOne | TValue | | objectTwo | TValue | -## interface SomeInterface +---------- + +### SomeInterface ```typescript interface SomeInterface { @@ -453,25 +503,25 @@ interface SomeInterface { } ``` -### Index signatures +#### Index signatures ```typescript [key: string]: string | number ``` -Index `key` - string - -Type - string | number +* *Parameter* `key` - string +* *Type* string | number ```typescript [key: number]: string ``` -Index `key` - number +* *Parameter* `key` - number +* *Type* string -Type - string +---------- -## interface StringsDictionary +### StringsDictionary ```typescript interface StringsDictionary { @@ -479,17 +529,18 @@ interface StringsDictionary { } ``` -### Index signatures +#### Index signatures ```typescript [key: string]: string ``` -Index `key` - string +* *Parameter* `key` - string +* *Type* string -Type - string +---------- -## interface MyInterface +### MyInterface ```typescript interface MyInterface { @@ -499,7 +550,7 @@ interface MyInterface { } ``` -### Properties +**Properties** | Name | Type | | --------------- | ------ | @@ -507,5 +558,75 @@ interface MyInterface { | MyPropertyTwo | Object | | MyPropertyThree | number | -## [Hello][ClassDeclaration-0] +---------- + +### Props + +```typescript +interface Props { + name: string; +} +``` + +**Properties** + +| Name | Type | +| ---- | ------ | +| name | string | + +## Enums + +### Uogos + +Warning: Beta! + +Deprecated! + +Some information +2nd line of some information +3rd line of some information +4th line of some information +5th line of some information + +> Some summary about this package version. + + +```typescript +enum Uogos { + Jokie = "jokie", + Braskes = "braskes" +} +``` + +**Members** + +| Name | Value | +| ------- | --------- | +| Jokie | "jokie" | +| Braskes | "braskes" | + +---------- + +### ConstSkaiciai + + +```typescript +const enum ConstSkaiciai { + PirmasC = 0, + AntrasC = 1, + TreciasC = 2 +} +``` + +**Members** + +| Name | Value | +| -------- | ----- | +| PirmasC | 0 | +| AntrasC | 1 | +| TreciasC | 2 | + +## Classes + +### [Hello][ClassDeclaration-0] diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace.md b/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace.md index 71b8bf76..c1c32a0e 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace.md @@ -1,5 +1,7 @@ -[ModuleDeclaration-1]: foonamespace\boonamespace.md#boonamespace +[ModuleDeclaration-1]: foonamespace/boonamespace.md#boonamespace # FooNamespace -## [BooNamespace][ModuleDeclaration-1] +## Namespaces + +### [BooNamespace][ModuleDeclaration-1] diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace.md b/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace.md index 30f8cf31..3ea42f39 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace.md @@ -1,5 +1,7 @@ -[ModuleDeclaration-2]: boonamespace\boonamespace2.md#boonamespace2 +[ModuleDeclaration-2]: boonamespace/boonamespace2.md#boonamespace2 # BooNamespace -## [BooNamespace2][ModuleDeclaration-2] +## Namespaces + +### [BooNamespace2][ModuleDeclaration-2] diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace/boonamespace2.md b/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace/boonamespace2.md index 42007d6d..a6a1066b 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace/boonamespace2.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/foonamespace/boonamespace/boonamespace2.md @@ -1,12 +1,14 @@ # BooNamespace2 -## Hello +## Variables + +### Hello ```typescript const Hello: "World!"; ``` -### Type +**Type** "World!" diff --git a/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md index 9c41c087..a7c0022e 100644 --- a/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md +++ b/packages/ts-docs-gen/examples/simple/docs/api/index/hello.md @@ -10,44 +10,40 @@ class Hello This is a constructor ```typescript -constructor(arg: string) +public constructor(arg: string) ``` -#### Parameters + +**Parameters** | Name | Type | Description | | ---- | ------ | ---------------------- | | arg | string | This is an argument ;) | +## Methods -## Properties - -### get Foo - -```typescript -public get Foo: string; -``` - -#### Type +### render(arg) -string +Warning: Beta! -### set Foo +Comment about Render ```typescript -public set Foo: string; +public render(arg: T): T ``` -#### Type +**Type parameters** -string +| Name | Constraint type | Default type | +| ---- | --------------- | ------------ | +| T | String | String | -### set Bar +**Parameters** -```typescript -public static set Bar: string; -``` +| Name | Type | Description | +| ---- | ---- | ---------------------- | +| arg | T | Argument comment here. | -#### Type +**Return type** -string +T diff --git a/packages/ts-docs-gen/examples/simple/index.ts b/packages/ts-docs-gen/examples/simple/index.ts index 80ef5a90..f3ac7c21 100644 --- a/packages/ts-docs-gen/examples/simple/index.ts +++ b/packages/ts-docs-gen/examples/simple/index.ts @@ -198,21 +198,21 @@ export interface MyInterface { // export const name = "some-kind-of-module"; // } -// /** -// * Some information -// * 2nd line of some information -// * 3rd line of some information -// * 4th line of some information -// * 5th line of some information -// * @summary Some summary about this package version. -// * @summary 2nd of some summary about this package version. -// * @deprecated -// * @beta -// */ -// export enum Uogos { -// Jokie = "jokie", -// Braskes = "braskes" -// } +/** + * Some information + * 2nd line of some information + * 3rd line of some information + * 4th line of some information + * 5th line of some information + * @summary Some summary about this package version. + * @summary 2nd of some summary about this package version. + * @deprecated + * @beta + */ +export enum Uogos { + Jokie = "jokie", + Braskes = "braskes" +} // export enum Skaiciai { // Nulis = 0, @@ -235,11 +235,11 @@ export interface MyInterface { // Trecias // } -// export const enum ConstSkaiciai { -// PirmasC = 0, -// AntrasC = 1, -// TreciasC = 2 -// } +export const enum ConstSkaiciai { + PirmasC = 0, + AntrasC = 1, + TreciasC = 2 +} // export const enum ConstSarasas { // /** @@ -292,13 +292,11 @@ export interface MyInterface { // */ // export type Hello = Uogos; -// export namespace FooNamespace { -// export namespace BooNamespace { -// export namespace BooNamespace2 { -// export const Hello = "World!"; -// } -// } -// } +export interface Props { + name: string; +} + +export function Component(arg: T): void { } export class Hello { /** @@ -307,11 +305,20 @@ export class Hello { */ constructor(arg: string) { } - get Foo(): string { - throw new Error("Method not implemented."); + /** + * Comment about Render + * @beta + * @param arg Argument comment here. + */ + public render(arg: T): T { + return arg; } - set Foo(arg: string) { } + // get Foo(): string { + // throw new Error("Method not implemented."); + // } + + // set Foo(arg: string) { } - public static set Bar(arg: string) { } + // public static set Bar(arg: string) { } } diff --git a/packages/ts-docs-gen/src/abstractions/base-plugin.ts b/packages/ts-docs-gen/src/abstractions/base-plugin.ts new file mode 100644 index 00000000..bbfaebb8 --- /dev/null +++ b/packages/ts-docs-gen/src/abstractions/base-plugin.ts @@ -0,0 +1,83 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginResultData } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; + +export abstract class BasePlugin implements Plugin { + public abstract SupportedApiItemKinds(): SupportedApiItemKindType[]; + + public CheckApiItem(item: TKind): boolean { + return true; + } + + // TODO: Escape string! + protected RenderTypeParameters(typeParameters: Contracts.ApiTypeParameterDto[]): PluginResultData | undefined { + if (typeParameters.length === 0) { + return undefined; + } + + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + const header = ["Name", "Constraint type", "Default type"]; + + const content = typeParameters.map(typeParameter => { + // ConstraintType + let constraintType: GeneratorHelpers.TypeToStringDto; + if (typeParameter.ConstraintType != null) { + constraintType = GeneratorHelpers.TypeDtoToMarkdownString(typeParameter.ConstraintType); + GeneratorHelpers.MergePluginResultData(pluginResult, { + UsedReferences: constraintType.References + }); + } else { + constraintType = { References: [], Text: "" }; + } + + // DefaultType + let defaultType: GeneratorHelpers.TypeToStringDto; + if (typeParameter.DefaultType != null) { + defaultType = GeneratorHelpers.TypeDtoToMarkdownString(typeParameter.DefaultType); + GeneratorHelpers.MergePluginResultData(pluginResult, { + UsedReferences: defaultType.References + }); + } else { + defaultType = { References: [], Text: "" }; + } + + return [ + typeParameter.Name, + constraintType.Text, + defaultType.Text + ]; + }); + + pluginResult.Result = new MarkdownBuilder() + .EmptyLine() + .Bold("Type parameters") + .EmptyLine() + .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) + .GetOutput(); + + return pluginResult; + } + + protected RenderType(type?: Contracts.TypeDto): PluginResultData | undefined { + if (type == null) { + return undefined; + } + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + + const parsedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(type); + + pluginResult.Result = new MarkdownBuilder() + .EmptyLine() + .Bold("Type") + .EmptyLine() + .Text(parsedReturnType.Text) + .GetOutput(); + + pluginResult.UsedReferences = parsedReturnType.References; + return pluginResult; + } + + public abstract Render(data: PluginOptions): PluginResult; +} diff --git a/packages/ts-docs-gen/src/abstractions/container-plugin.ts b/packages/ts-docs-gen/src/abstractions/container-plugin.ts new file mode 100644 index 00000000..b4efafab --- /dev/null +++ b/packages/ts-docs-gen/src/abstractions/container-plugin.ts @@ -0,0 +1,115 @@ +import { Contracts, ExtractDto } from "ts-extractor"; +import { MarkdownBuilder } from "@simplrjs/markdown"; +import { BasePlugin } from "./base-plugin"; +import { PluginOptions, PluginResultData } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; +import { ApiItemReference } from "../contracts/api-item-reference"; + +export interface ApiContainer extends Contracts.ApiBaseItemDto { + Members: Contracts.ApiItemReference[]; +} + +export interface ContainerMembersKindsGroup { + Heading: string; + Kinds: Contracts.ApiItemKinds[]; +} + +interface ContainerMembersReferencesGroup { + Heading: string; + References: ApiItemReference[]; +} + +export abstract class ContainerPlugin extends BasePlugin { + private getItemsReferenceByKind( + list: ContainerMembersKindsGroup[], + members: Contracts.ApiItemReference[], + extractedData: ExtractDto + ): ContainerMembersReferencesGroup[] { + const result: ContainerMembersReferencesGroup[] = []; + let membersReferences = GeneratorHelpers.GetApiItemReferences(extractedData, members); + + for (const item of list) { + // Filter item references by kind + const apiItemsReferenceByKind = membersReferences.filter(x => item.Kinds.indexOf(extractedData.Registry[x.Id].ApiKind) !== -1); + // Remove references that was used + membersReferences = membersReferences.filter(x => apiItemsReferenceByKind.indexOf(x) === -1); + + result.push({ + Heading: item.Heading, + References: apiItemsReferenceByKind + }); + } + + // TODO: Using ApiKind.Any to add everything to other if some kind is not supported. + if (membersReferences.length !== 0) { + result.push({ + Heading: "Other", + References: membersReferences + }); + } + + return result; + } + + protected RenderMembersGroups(list: ContainerMembersKindsGroup[], options: PluginOptions): PluginResultData { + const membersReferences = this.getItemsReferenceByKind(list, options.ApiItem.Members, options.ExtractedData); + const pluginResultData = GeneratorHelpers.GetDefaultPluginResultData(); + const builder = new MarkdownBuilder(); + + for (const { Heading, References } of membersReferences) { + if (References.length > 0) { + builder + .Header(Heading, 2) + .EmptyLine(); + + for (const reference of References) { + const apiItem = options.ExtractedData.Registry[reference.Id]; + + if (options.IsPluginResultExists(reference)) { + builder + .Text(md => md.Header(md.Link(apiItem.Name, reference.Id, true), 3)) + .EmptyLine(); + pluginResultData.UsedReferences.push(reference.Id); + } else { + switch (apiItem.ApiKind) { + case Contracts.ApiItemKinds.Namespace: + case Contracts.ApiItemKinds.Class: { + const renderedItem = options.GetItemPluginResult(reference); + pluginResultData.Members.push({ + Reference: reference, + PluginResult: renderedItem + }); + + builder + .Text(md => md.Header(md.Link(renderedItem.ApiItem.Name, reference.Id, true), 3)) + .EmptyLine(); + pluginResultData.UsedReferences.push(reference.Id); + break; + } + default: { + const renderedItem = options.GetItemPluginResult(reference); + builder + .Text(renderedItem.Result) + .EmptyLine(); + + GeneratorHelpers.MergePluginResultData(pluginResultData, { + Headings: renderedItem.Headings, + UsedReferences: renderedItem.UsedReferences + }); + } + } + } + + if ((References.indexOf(reference) + 1) !== References.length) { + builder + .HorizontalRule(undefined, 10) + .EmptyLine(); + } + } + } + } + + pluginResultData.Result = builder.GetOutput(); + return pluginResultData; + } +} diff --git a/packages/ts-docs-gen/src/abstractions/function-like-plugin.ts b/packages/ts-docs-gen/src/abstractions/function-like-plugin.ts new file mode 100644 index 00000000..0266acee --- /dev/null +++ b/packages/ts-docs-gen/src/abstractions/function-like-plugin.ts @@ -0,0 +1,55 @@ +import { Contracts } from "ts-extractor"; +import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; + +import { BasePlugin } from "./base-plugin"; +import { PluginResultData } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; + +export abstract class FunctionLikePlugin extends BasePlugin { + // TODO: Escape string! + protected RenderParameters(parameters: Contracts.ApiParameterDto[]): PluginResultData | undefined { + if (parameters.length === 0) { + return undefined; + } + + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + const header = ["Name", "Type", "Description"]; + + const content = parameters.map(parameter => { + const parameterTypeDto = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); + GeneratorHelpers.MergePluginResultData(pluginResult, { + UsedReferences: parameterTypeDto.References + }); + + return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), parameter.Metadata.DocumentationComment]; + }); + + pluginResult.Result = new MarkdownBuilder() + .EmptyLine() + .Bold("Parameters") + .EmptyLine() + .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) + .GetOutput(); + + return pluginResult; + } + + protected RenderReturnType(type?: Contracts.TypeDto): PluginResultData | undefined { + if (type == null) { + return undefined; + } + const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); + + const parsedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(type); + + pluginResult.Result = new MarkdownBuilder() + .EmptyLine() + .Bold("Return type") + .EmptyLine() + .Text(parsedReturnType.Text) + .GetOutput(); + + pluginResult.UsedReferences = parsedReturnType.References; + return pluginResult; + } +} diff --git a/packages/ts-docs-gen/src/contracts/plugin.ts b/packages/ts-docs-gen/src/contracts/plugin.ts index b35399db..1b6b4df3 100644 --- a/packages/ts-docs-gen/src/contracts/plugin.ts +++ b/packages/ts-docs-gen/src/contracts/plugin.ts @@ -42,7 +42,7 @@ export interface PluginResultData { * Plugin rendered result. */ Result: string[]; - Members?: PluginMember[]; + Members: PluginMember[]; } export interface PluginResult extends PluginResultData { diff --git a/packages/ts-docs-gen/src/generator-helpers.ts b/packages/ts-docs-gen/src/generator-helpers.ts index 5da4cfbb..562fed93 100644 --- a/packages/ts-docs-gen/src/generator-helpers.ts +++ b/packages/ts-docs-gen/src/generator-helpers.ts @@ -19,6 +19,7 @@ export namespace GeneratorHelpers { export enum JSDocTags { Beta = "beta", Deprecated = "deprecated", + Internal = "internal", Summary = "summary" } @@ -160,7 +161,8 @@ export namespace GeneratorHelpers { return { Headings: [], Result: [], - UsedReferences: [] + UsedReferences: [], + Members: [] }; } // #endregion General helpers @@ -233,6 +235,7 @@ export namespace GeneratorHelpers { // Optimise? const isBeta = apiItem.Metadata.JSDocTags.findIndex(x => x.name.toLowerCase() === JSDocTags.Beta) !== -1; const deprecated = apiItem.Metadata.JSDocTags.find(x => x.name.toLowerCase() === JSDocTags.Deprecated); + const internal = apiItem.Metadata.JSDocTags.find(x => x.name.toLowerCase() === JSDocTags.Internal); const summary = apiItem.Metadata.JSDocTags.find(x => x.name.toLowerCase() === JSDocTags.Summary); const jSDocComment = apiItem.Metadata.DocumentationComment; @@ -249,6 +252,13 @@ export namespace GeneratorHelpers { .EmptyLine(); } + if (internal != null) { + const message = Boolean(internal.text) ? `: ${internal.text}` : ""; + builder + .Bold(`Internal${message}`) + .EmptyLine(); + } + if (jSDocComment.length > 0) { builder .Text(jSDocComment) @@ -429,7 +439,10 @@ export namespace GeneratorHelpers { return `${apiItem.AccessModifier}${$static}${abstract}${readOnly} ${name}${optional}: ${apiItem.Type.Text};`; } - export function EnumToString(alias: string, memberItems: Contracts.ApiEnumMemberDto[]): string[] { + export function ApiEnumToString(apiItem: Contracts.ApiEnumDto, memberItems: Contracts.ApiEnumMemberDto[], alias?: string): string[] { + const name = alias || apiItem.Name; + const $const = apiItem.IsConst ? "const " : ""; + // Constructing enum body. const membersStrings = memberItems.map((memberItem, index, array) => { // Add an enum name @@ -450,7 +463,7 @@ export namespace GeneratorHelpers { // Construct enum code output return [ - `enum ${alias} {`, + `${$const}enum ${name} {`, ...membersStrings, "}" ]; @@ -642,9 +655,13 @@ export namespace GeneratorHelpers { return `${apiItem.Name}${isOptionalString}: ${apiItem.Type.Text}${initializerString}`; } - export function ApiClassConstructorToString(parameters?: Contracts.ApiParameterDto[], returnType?: Contracts.TypeDto): string { + export function ApiClassConstructorToString( + apiItem: Contracts.ApiClassConstructorDto, + parameters?: Contracts.ApiParameterDto[], + returnType?: Contracts.TypeDto + ): string { const callString = ApiCallToString(undefined, parameters, returnType); - return `constructor${callString}`; + return `${apiItem.AccessModifier} constructor${callString}`; } /** diff --git a/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts index 0d77360b..6075f2d9 100644 --- a/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-callable-plugin.ts @@ -1,12 +1,13 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; -import { Plugin, SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; import { GeneratorHelpers } from "../generator-helpers"; +import { FunctionLikePlugin } from "../abstractions/function-like-plugin"; export type CallableApiItem = Contracts.ApiCallDto | Contracts.ApiMethodDto | Contracts.ApiConstructDto; -export class ApiCallablePlugin implements Plugin { +export class ApiCallablePlugin extends FunctionLikePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [ GeneratorHelpers.ApiItemKinds.Construct, @@ -15,10 +16,6 @@ export class ApiCallablePlugin implements Plugin { ]; } - public CheckApiItem(item: CallableApiItem): boolean { - return true; - } - private resolveItemCode( apiItem: CallableApiItem, parameters: Contracts.ApiParameterDto[], @@ -37,60 +34,36 @@ export class ApiCallablePlugin implements Plugin { } } - public Render(data: PluginOptions): PluginResult { - const usedReferences = []; - const parameters = GeneratorHelpers.GetApiItemsFromReference( - data.ApiItem.Parameters, - data.ExtractedData - ); - const typeParameters = GeneratorHelpers.GetApiItemsFromReference( - data.ApiItem.TypeParameters, - data.ExtractedData - ); - - const builder = new MarkdownBuilder() - .Code(this.resolveItemCode(data.ApiItem, parameters, typeParameters), GeneratorHelpers.DEFAULT_CODE_OPTIONS) - .EmptyLine(); - - if (typeParameters.length > 0) { - const table = GeneratorHelpers.ApiTypeParametersTableToString(typeParameters); - usedReferences.push(...table.References); - - builder - .Bold("Type parameters:") - .EmptyLine() - .Text(table.Text) - .EmptyLine(); - } + public Render(options: PluginOptions): PluginResult { + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference + }; - if (parameters.length > 0) { - const table = GeneratorHelpers.ApiParametersToTableString(parameters); - usedReferences.push(...table.References); + // ApiParameters + const apiParameters = + GeneratorHelpers.GetApiItemsFromReference(options.ApiItem.Parameters, options.ExtractedData); + // ApiTypeParameters + const apiTypeParameters = + GeneratorHelpers.GetApiItemsFromReference(options.ApiItem.TypeParameters, options.ExtractedData); - builder - .Bold("Parameters:") - .EmptyLine() - .Text(table.Text) - .EmptyLine(); - } + pluginResult.Result = new MarkdownBuilder() + .Code(this.resolveItemCode(options.ApiItem, apiParameters, apiTypeParameters), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .GetOutput(); - if (data.ApiItem.ReturnType) { - const renderedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.ReturnType); + // TypeParameters + const typeParametersResult = this.RenderTypeParameters(apiTypeParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, typeParametersResult); - builder - .Bold("Return type:") - .EmptyLine() - .Text(renderedReturnType.Text); + // Parameters + const parametersResult = this.RenderParameters(apiParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, parametersResult); - usedReferences.push(...renderedReturnType.References); - } + // ReturnType + const returnTypeResult = this.RenderReturnType(options.ApiItem.ReturnType); + GeneratorHelpers.MergePluginResultData(pluginResult, returnTypeResult); - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: [], - Result: builder.GetOutput(), - UsedReferences: usedReferences - }; + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts index 6974fc7d..607b3437 100644 --- a/packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-class-accessor-plugin.ts @@ -1,11 +1,13 @@ import { Contracts, ExtractDto } from "ts-extractor"; -import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginResultData } from "../contracts/plugin"; -import { GeneratorHelpers } from "../generator-helpers"; import { MarkdownBuilder } from "@simplrjs/markdown"; +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; +import { GeneratorHelpers } from "../generator-helpers"; +import { BasePlugin } from "../abstractions/base-plugin"; + export type Kind = Contracts.ApiSetAccessorDto | Contracts.ApiGetAccessorDto; -export class ApiClassAccessorPlugin implements Plugin { +export class ApiClassAccessorPlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [ GeneratorHelpers.ApiItemKinds.GetAccessor, @@ -13,10 +15,6 @@ export class ApiClassAccessorPlugin implements Plugin { ]; } - public CheckApiItem(item: Kind): boolean { - return true; - } - private getHeading(data: PluginOptions): string { let accessorType: string; if (data.ApiItem.ApiKind === Contracts.ApiItemKinds.SetAccessor) { @@ -29,11 +27,14 @@ export class ApiClassAccessorPlugin implements Plugin { } private resolveType(apiItem: Kind, extractedData: ExtractDto): Contracts.TypeDto | undefined { - // Resolve type let type: Contracts.TypeDto | undefined; if (apiItem.ApiKind === Contracts.ApiItemKinds.GetAccessor) { + // GetAccessor + type = apiItem.Type; } else if (apiItem.Parameter != null) { + // SetAccessor + const apiParameter = extractedData.Registry[apiItem.Parameter.Ids[0]] as Contracts.ApiParameterDto; if (apiParameter != null) { type = apiParameter.Type; @@ -43,49 +44,35 @@ export class ApiClassAccessorPlugin implements Plugin { return type; } - private renderTypeDto(type: Contracts.TypeDto | undefined): Partial | undefined { - if (type == null) { - return undefined; - } - - const result = GeneratorHelpers.TypeDtoToMarkdownString(type); - - const builder = new MarkdownBuilder() - .EmptyLine() - .Header("Type", 4) - .EmptyLine() - .Text(result.Text); - - return { - Result: builder.GetOutput(), - UsedReferences: result.References - }; - } - - public Render(data: PluginOptions): PluginResult { - const heading = this.getHeading(data); - const type = this.resolveType(data.ApiItem, data.ExtractedData); + public Render(options: PluginOptions): PluginResult { + const heading = this.getHeading(options); + const type = this.resolveType(options.ApiItem, options.ExtractedData); const pluginResult: PluginResult = { ...GeneratorHelpers.GetDefaultPluginResultData(), - ApiItem: data.ApiItem, - Reference: data.Reference, + ApiItem: options.ApiItem, + Reference: options.Reference, Headings: [ { - ApiItemId: data.Reference.Id, + ApiItemId: options.Reference.Id, Heading: heading } ] }; + // Header pluginResult.Result = new MarkdownBuilder() .Header(heading, 3) .EmptyLine() - .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(GeneratorHelpers.ApiAccessorToString(data.ApiItem, type, data.Reference.Alias), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .Code(GeneratorHelpers.ApiAccessorToString( + options.ApiItem, + type, + options.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .GetOutput(); // Type - const typeResult = this.renderTypeDto(type); + const typeResult = this.RenderType(type); GeneratorHelpers.MergePluginResultData(pluginResult, typeResult); return pluginResult; diff --git a/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts index c2d3680e..f90ef37d 100644 --- a/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-class-constructor-plugin.ts @@ -1,73 +1,45 @@ import { Contracts } from "ts-extractor"; -import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; -import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginResultData } from "../contracts/plugin"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; import { GeneratorHelpers } from "../generator-helpers"; +import { FunctionLikePlugin } from "../abstractions/function-like-plugin"; -export class ApiClassConstructorPlugin implements Plugin { +export class ApiClassConstructorPlugin extends FunctionLikePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.ClassConstructor]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } - - private renderParameters(parameters: Contracts.ApiParameterDto[]): PluginResultData { - const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); - if (parameters.length === 0) { - return pluginResult; - } - - let referenceIds: string[] = []; - const header = ["Name", "Type", "Description"]; - - const content = parameters.map(parameter => { - const parameterTypeDto = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); - - referenceIds = referenceIds.concat(parameterTypeDto.References); - - return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), parameter.Metadata.DocumentationComment]; - }); - - const builder = new MarkdownBuilder() - .Header("Parameters", 4) - .EmptyLine() - .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) - .EmptyLine(); - - pluginResult.UsedReferences = referenceIds; - pluginResult.Result = builder.GetOutput(); - - return pluginResult; - } - public Render(options: PluginOptions): PluginResult { - const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); - const builder = new MarkdownBuilder(); - - // Parameters + // ApiParameters const apiParameters = GeneratorHelpers .GetApiItemsFromReference(options.ApiItem.Parameters, options.ExtractedData); - const parameters = this.renderParameters(apiParameters); const heading = GeneratorHelpers.MethodToSimpleString("constructor", apiParameters); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: options.Reference.Id + } + ] + }; - pluginResult.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); - - builder + // Header + pluginResult.Result = new MarkdownBuilder() .Header(heading, 3) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) - .Code(GeneratorHelpers.ApiClassConstructorToString(apiParameters), GeneratorHelpers.DEFAULT_CODE_OPTIONS) - .Text(parameters.Result); + .Code(GeneratorHelpers.ApiClassConstructorToString(options.ApiItem, apiParameters), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .GetOutput(); - GeneratorHelpers.MergePluginResultData(pluginResult, parameters); - pluginResult.Result = builder.GetOutput(); + // Parameters + const parametersResult = this.RenderParameters(apiParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, parametersResult); - return { - ApiItem: options.ApiItem, - Reference: options.Reference, - ...pluginResult - }; + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts index ea1759a7..5da07cf0 100644 --- a/packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-class-method-plugin.ts @@ -1,9 +1,11 @@ import { Contracts } from "ts-extractor"; -import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; -import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginResultData } from "../contracts/plugin"; +import { MarkdownBuilder } from "@simplrjs/markdown"; + +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; import { GeneratorHelpers } from "../generator-helpers"; +import { FunctionLikePlugin } from "../abstractions/function-like-plugin"; -export class ApiClassMethodPlugin implements Plugin { +export class ApiClassMethodPlugin extends FunctionLikePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.ClassMethod]; } @@ -12,53 +14,29 @@ export class ApiClassMethodPlugin implements Plugin return true; } - private renderParameters(parameters: Contracts.ApiParameterDto[]): PluginResultData { - const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); - if (parameters.length === 0) { - return pluginResult; - } - - let referenceIds: string[] = []; - const header = ["Name", "Type", "Description"]; - - const content = parameters.map(parameter => { - const parameterTypeDto = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); - - referenceIds = referenceIds.concat(parameterTypeDto.References); - - return [parameter.Name, MarkdownGenerator.EscapeString(parameterTypeDto.Text), parameter.Metadata.DocumentationComment]; - }); - - const builder = new MarkdownBuilder() - .Header("Parameters", 4) - .EmptyLine() - .Table(header, content, GeneratorHelpers.DEFAULT_TABLE_OPTIONS) - .EmptyLine(); - - pluginResult.UsedReferences = referenceIds; - pluginResult.Result = builder.GetOutput(); - - return pluginResult; - } - public Render(options: PluginOptions): PluginResult { - const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); - const builder = new MarkdownBuilder(); - // Parameters const apiParameters = GeneratorHelpers .GetApiItemsFromReference(options.ApiItem.Parameters, options.ExtractedData); - const parameters = this.renderParameters(apiParameters); - - // Parameters + // TypeParameters const apiTypeParameters = GeneratorHelpers .GetApiItemsFromReference(options.ApiItem.TypeParameters, options.ExtractedData); const heading = GeneratorHelpers.MethodToSimpleString(options.Reference.Alias, apiParameters); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: options.Reference.Id + } + ] + }; - pluginResult.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); - - builder + // Header + pluginResult.Result = new MarkdownBuilder() .Header(heading, 3) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) @@ -68,15 +46,20 @@ export class ApiClassMethodPlugin implements Plugin apiParameters, options.Reference.Alias ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) - .Text(parameters.Result); + .GetOutput(); - GeneratorHelpers.MergePluginResultData(pluginResult, parameters); - pluginResult.Result = builder.GetOutput(); + // TypeParameters + const typeParametersResult = this.RenderTypeParameters(apiTypeParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, typeParametersResult); - return { - ApiItem: options.ApiItem, - Reference: options.Reference, - ...pluginResult - }; + // Parameters + const parametersResult = this.RenderParameters(apiParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, parametersResult); + + // ReturnType + const returnTypeResult = this.RenderReturnType(options.ApiItem.ReturnType); + GeneratorHelpers.MergePluginResultData(pluginResult, returnTypeResult); + + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-class-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-plugin.ts index e4b96580..443c0227 100644 --- a/packages/ts-docs-gen/src/plugins/api-class-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-class-plugin.ts @@ -3,35 +3,46 @@ import { MarkdownBuilder } from "@simplrjs/markdown"; import * as path from "path"; import { GeneratorHelpers } from "../generator-helpers"; -import { - Plugin, - SupportedApiItemKindType, - PluginOptions, - PluginResult, - PluginResultData -} from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; +import { ContainerPlugin, ContainerMembersKindsGroup } from "../abstractions/container-plugin"; -interface RenderMembers { - Heading: string; - Kinds: Contracts.ApiItemKinds[]; -} - -export class ApiClassPlugin implements Plugin { +export class ApiClassPlugin extends ContainerPlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Class]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } + public Render(data: PluginOptions): PluginResult { + const heading = path.basename(data.ApiItem.Name, path.extname(data.ApiItem.Name)); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: data.Reference.Id + } + ] + }; - private renderMembers(data: PluginOptions): PluginResultData { - const references = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); - const renderedItems = references.map(x => data.GetItemPluginResult(x)); - const pluginResultData = GeneratorHelpers.GetDefaultPluginResultData(); - const builder = new MarkdownBuilder(); + // Resolve ApiItems from references. + const typeParameters = GeneratorHelpers + .GetApiItemsFromReference(data.ApiItem.TypeParameters, data.ExtractedData); - const list: RenderMembers[] = [ + // Header + pluginResult.Result = new MarkdownBuilder() + .Header(heading, 1) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Code(GeneratorHelpers.ClassToString( + data.ApiItem, + typeParameters, + data.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .GetOutput(); + + // ApiMembers + const memberKindsList: ContainerMembersKindsGroup[] = [ { Heading: "Index", Kinds: [Contracts.ApiItemKinds.Index] @@ -53,60 +64,7 @@ export class ApiClassPlugin implements Plugin { ] } ]; - - for (const memberKind of list) { - const pluginResultsByKind = renderedItems.filter(x => memberKind.Kinds.indexOf(x.ApiItem.ApiKind) !== -1); - - if (pluginResultsByKind.length > 0) { - builder - .Header(memberKind.Heading, 2) - .EmptyLine(); - - for (const member of pluginResultsByKind) { - GeneratorHelpers.MergePluginResultData(pluginResultData, member); - - builder - .Text(member.Result) - .EmptyLine(); - } - } - } - - pluginResultData.Result = builder.GetOutput(); - return pluginResultData; - } - - public Render(data: PluginOptions): PluginResult { - const typeParameters = GeneratorHelpers - .GetApiItemsFromReference(data.ApiItem.TypeParameters, data.ExtractedData); - - const pluginResult: PluginResult = { - ApiItem: data.ApiItem, - Reference: data.Reference, - ...GeneratorHelpers.GetDefaultPluginResultData() - }; - const heading = path.basename(data.ApiItem.Name, path.extname(data.ApiItem.Name)); - pluginResult.Headings = [ - { - Heading: heading, - ApiItemId: data.Reference.Id - } - ]; - - // Header - const builder = new MarkdownBuilder() - .Header(heading, 1) - .EmptyLine() - .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(GeneratorHelpers.ClassToString( - data.ApiItem, - typeParameters, - data.Reference.Alias - ), GeneratorHelpers.DEFAULT_CODE_OPTIONS); - pluginResult.Result = builder.GetOutput(); - - // ApiMembers - const members = this.renderMembers(data); + const members = this.RenderMembersGroups(memberKindsList, data); GeneratorHelpers.MergePluginResultData(pluginResult, members); return pluginResult; diff --git a/packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts b/packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts index 1df3b160..36144af9 100644 --- a/packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-class-property-plugin.ts @@ -1,28 +1,31 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; -import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; + +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; import { GeneratorHelpers } from "../generator-helpers"; +import { BasePlugin } from "../abstractions/base-plugin"; -export class ApiClassPropertyPlugin implements Plugin { +export class ApiClassPropertyPlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.ClassProperty]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } - public Render(options: PluginOptions): PluginResult { - const pluginResultData = GeneratorHelpers.GetDefaultPluginResultData(); - const builder = new MarkdownBuilder(); - const heading = options.Reference.Alias; - pluginResultData.Headings.push({ ApiItemId: options.Reference.Id, Heading: heading }); - - const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(options.ApiItem.Type); - pluginResultData.UsedReferences = pluginResultData.UsedReferences.concat(typeStringDto.References); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + ApiItemId: options.Reference.Id, + Heading: heading + } + ] + }; - builder + // Header + pluginResult.Result = new MarkdownBuilder() .Header(heading, 3) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) @@ -30,17 +33,11 @@ export class ApiClassPropertyPlugin implements Plugin { +export class ApiDefaultPlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Any]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } - - public Render(data: PluginOptions): PluginResult { - const heading = `${data.ApiItem.ApiKind}: ${data.Reference.Alias}`; - const headings: PluginHeading[] = [ - { - ApiItemId: data.Reference.Id, - Heading: heading - } - ]; + public Render(options: PluginOptions): PluginResult { + const heading = `${options.ApiItem.ApiKind}: ${options.Reference.Alias}`; + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: options.Reference.Id + } + ] + }; - const result: string[] = [ - MarkdownGenerator.Header(heading, 2) - ]; + pluginResult.Result = new MarkdownBuilder() + .Header(heading, 3) + .EmptyLine() + .Bold(`Warning: unsupported api item kind ${options.ApiItem.ApiKind}!`) + .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .GetOutput(); - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: headings, - UsedReferences: [], - Result: result, - }; + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts index 783d1a87..63148d96 100644 --- a/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-enum-plugin.ts @@ -2,11 +2,10 @@ import { Contracts } from "ts-extractor"; import { MarkdownGenerator, MarkdownBuilder } from "@simplrjs/markdown"; import { GeneratorHelpers } from "../generator-helpers"; -import { Plugin, SupportedApiItemKindType, PluginResult, PluginOptions, PluginHeading } from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; +import { BasePlugin } from "../abstractions/base-plugin"; -// TODO: const enums implementation. - -export class ApiEnumPlugin implements Plugin { +export class ApiEnumPlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Enum]; } @@ -15,7 +14,7 @@ export class ApiEnumPlugin implements Plugin { return true; } - private constructEnumTable(members: Contracts.ApiEnumMemberDto[]): string[] { + private renderEnumTable(members: Contracts.ApiEnumMemberDto[]): string[] { // Table header. const header = ["Name", "Value", "Description"]; const content = members.map(x => [x.Name, x.Value, x.Metadata.DocumentationComment]); @@ -23,34 +22,42 @@ export class ApiEnumPlugin implements Plugin { return MarkdownGenerator.Table(header, content, { removeColumnIfEmpty: true }); } - public Render(data: PluginOptions): PluginResult { - const heading: string = data.Reference.Alias; - const headings: PluginHeading[] = [ - { - ApiItemId: data.Reference.Id, - Heading: heading - } - ]; + public Render(options: PluginOptions): PluginResult { + const heading: string = options.Reference.Alias; + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: options.Reference.Id + } + ] + }; + // Enum members const enumMembers = GeneratorHelpers.GetApiItemsFromReference( - data.ApiItem.Members, - data.ExtractedData + options.ApiItem.Members, + options.ExtractedData ); - const builder = new MarkdownBuilder() - .Header(heading, 2) + + pluginResult.Result = new MarkdownBuilder() + .Header(heading, 3) .EmptyLine() - .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) .EmptyLine() - .Code(GeneratorHelpers.EnumToString(data.Reference.Alias, enumMembers), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .Code(GeneratorHelpers.ApiEnumToString( + options.ApiItem, + enumMembers, + options.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() - .Text(this.constructEnumTable(enumMembers)); - - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: headings, - UsedReferences: [], - Result: builder.GetOutput() - }; + .Bold("Members") + .EmptyLine() + .Text(this.renderEnumTable(enumMembers)) + .GetOutput(); + + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts index 99d4ea58..bee15bf0 100644 --- a/packages/ts-docs-gen/src/plugins/api-function-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-function-plugin.ts @@ -2,131 +2,60 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; import { GeneratorHelpers } from "../generator-helpers"; -import { SupportedApiItemKindType, Plugin, PluginResult, PluginOptions, PluginHeading } from "../contracts/plugin"; -import { ApiFunctionDto } from "ts-extractor/dist/contracts"; +import { SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; +import { FunctionLikePlugin } from "../abstractions/function-like-plugin"; -export class ApiFunctionPlugin implements Plugin { +export class ApiFunctionPlugin extends FunctionLikePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Function]; } - public CheckApiItem(item: ApiFunctionDto): boolean { - return true; - } - - // TODO: add description from @param jsdoc tag. - private resolveFunctionParameters(parameters: Contracts.ApiParameterDto[]): GeneratorHelpers.ReferenceDto { - if (parameters.length === 0) { - return { - References: [], - Text: [] - }; - } - - const table = GeneratorHelpers.ApiParametersToTableString(parameters); - const builder = new MarkdownBuilder() - .Header("Parameters", 3) - .EmptyLine() - .Text(table.Text) - .EmptyLine(); - - return { - Text: builder.GetOutput(), - References: table.References + public Render(options: PluginOptions): PluginResult { + // Parameters + const apiParameters = GeneratorHelpers + .GetApiItemsFromReference(options.ApiItem.Parameters, options.ExtractedData); + // TypeParameters + const apiTypeParameters = GeneratorHelpers + .GetApiItemsFromReference(options.ApiItem.TypeParameters, options.ExtractedData); + + const heading = GeneratorHelpers.MethodToSimpleString(options.Reference.Alias, apiParameters); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: options.Reference.Id + } + ] }; - } - - private resolveFunctionTypeParameters(typeParameters: Contracts.ApiTypeParameterDto[]): GeneratorHelpers.ReferenceDto { - if (typeParameters.length === 0) { - return { References: [], Text: [] }; - } - - const typeParametersTable = GeneratorHelpers.ApiTypeParametersTableToString(typeParameters); - const text = new MarkdownBuilder() - .Header("Type parameters", 3) - .EmptyLine() - .Text(typeParametersTable.Text) - .EmptyLine() - .GetOutput(); - - return { - References: typeParametersTable.References, - Text: text - }; - } - - private resolveReturnType(typeDto?: Contracts.TypeDto): GeneratorHelpers.ReferenceDto { - if (typeDto == null) { - return { - References: [], - Text: [] - }; - } - const parsedReturnType = GeneratorHelpers.TypeDtoToMarkdownString(typeDto); - - const text = new MarkdownBuilder() - .Header("Return type", 3) - .EmptyLine() - .Text(parsedReturnType.Text) + // Header + pluginResult.Result = new MarkdownBuilder() + .Header(heading, 3) .EmptyLine() + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .Code(GeneratorHelpers.ApiFunctionToString( + options.ApiItem, + apiTypeParameters, + apiParameters, + options.Reference.Alias + ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .GetOutput(); - return { - Text: text, - References: parsedReturnType.References - }; - } - - public Render(data: PluginOptions): PluginResult { - const alias = data.Reference.Alias; - - const headings: PluginHeading[] = [ - { - ApiItemId: data.Reference.Id, - Heading: alias - } - ]; + // TypeParameters + const typeParametersResult = this.RenderTypeParameters(apiTypeParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, typeParametersResult); - const parameters = GeneratorHelpers.GetApiItemsFromReference( - data.ApiItem.Parameters, - data.ExtractedData - ); - const resolvedParametersDto = this.resolveFunctionParameters(parameters); + // Parameters + const parametersResult = this.RenderParameters(apiParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, parametersResult); - const typeParameters = GeneratorHelpers.GetApiItemsFromReference( - data.ApiItem.TypeParameters, - data.ExtractedData - ); - const resolvedTypeParametersDto = this.resolveFunctionTypeParameters(typeParameters); + // ReturnType + const returnTypeResult = this.RenderReturnType(options.ApiItem.ReturnType); + GeneratorHelpers.MergePluginResultData(pluginResult, returnTypeResult); - const resolvedReturnTypeDto = this.resolveReturnType(data.ApiItem.ReturnType); - - const builder = new MarkdownBuilder() - .Header(GeneratorHelpers.MethodToSimpleString(alias || data.ApiItem.Name, parameters), 2) - .EmptyLine() - .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(GeneratorHelpers.ApiFunctionToString( - data.ApiItem, - typeParameters, - parameters, - data.Reference.Alias - ), GeneratorHelpers.DEFAULT_CODE_OPTIONS) - .EmptyLine() - .Text(resolvedTypeParametersDto.Text) - .Text(resolvedParametersDto.Text) - .Text(resolvedReturnTypeDto.Text); - - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: headings, - UsedReferences: [ - ...resolvedParametersDto.References, - ...resolvedTypeParametersDto.References, - ...resolvedReturnTypeDto.References - ], - Result: builder.GetOutput() - }; + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-index-plugin.ts b/packages/ts-docs-gen/src/plugins/api-index-plugin.ts index 9f052af1..d8b2b228 100644 --- a/packages/ts-docs-gen/src/plugins/api-index-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-index-plugin.ts @@ -1,50 +1,47 @@ import { Contracts } from "ts-extractor"; -import { MarkdownBuilder } from "@simplrjs/markdown"; +import { MarkdownBuilder, MarkdownGenerator as md } from "@simplrjs/markdown"; -import { Plugin, SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginResult, PluginOptions } from "../contracts/plugin"; import { GeneratorHelpers } from "../generator-helpers"; +import { BasePlugin } from "../abstractions/base-plugin"; -export class ApiIndexPlugin implements Plugin { +export class ApiIndexPlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Index]; } - public CheckApiItem(item: Contracts.ApiIndexDto): boolean { - return true; - } - - public Render(data: PluginOptions): PluginResult { - const parameter = data.ExtractedData.Registry[data.ApiItem.Parameter] as Contracts.ApiParameterDto; + public Render(options: PluginOptions): PluginResult { + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference + }; + // Parameter + const parameter = options.ExtractedData.Registry[options.ApiItem.Parameter] as Contracts.ApiParameterDto; + // Types const parameterType = GeneratorHelpers.TypeDtoToMarkdownString(parameter.Type); - const indexType = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); - - const indexDeclarationString = GeneratorHelpers.ApiIndexToString(parameter, data.ApiItem.Type, data.ApiItem.IsReadonly); + const indexType = GeneratorHelpers.TypeDtoToMarkdownString(options.ApiItem.Type); + GeneratorHelpers.MergePluginResultData(pluginResult, { + UsedReferences: [ + ...parameterType.References, + ...indexType.References + ] + }); + // Header + const indexDeclarationString = GeneratorHelpers.ApiIndexToString(parameter, options.ApiItem.Type, options.ApiItem.IsReadonly); const builder = new MarkdownBuilder() .Code(indexDeclarationString, GeneratorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine(); - if (data.ApiItem.IsReadonly) { - builder - .Text("Readonly.") - .EmptyLine(); - } - - builder - .Text(`Index \`${parameter.Name}\` - ${parameterType.Text}`) - .EmptyLine() - .Text(`Type - ${indexType.Text}`); + pluginResult.Result = builder + .UnorderedList([ + `${md.Italic("Parameter")} ${md.InlineCode(parameter.Name)} - ${parameterType.Text}`, + `${md.Italic("Type")} ${indexType.Text}` + ]) + .GetOutput(); - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: [], - Result: builder.GetOutput(), - UsedReferences: [ - ...parameterType.References, - ...indexType.References - ] - }; + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts b/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts index 6bc8c1b1..2d008c14 100644 --- a/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-interface-plugin.ts @@ -1,7 +1,7 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder, MarkdownGenerator } from "@simplrjs/markdown"; + import { - Plugin, SupportedApiItemKindType, PluginResult, PluginOptions, @@ -10,54 +10,26 @@ import { } from "../contracts/plugin"; import { GeneratorHelpers } from "../generator-helpers"; import { ApiItemReference } from "../contracts/api-item-reference"; +import { BasePlugin } from "../abstractions/base-plugin"; interface ExtractedItemDto { Reference: ApiItemReference; ApiItem: TApiItemDto; } -export class ApiInterfacePlugin implements Plugin { +export class ApiInterfacePlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Interface]; } - public CheckApiItem(item: Contracts.ApiInterfaceDto): boolean { - return true; - } - - private renderTypeParameters(pluginOptions: PluginOptions): PluginResultData { - const typeParameters = GeneratorHelpers.GetApiItemsFromReference( - pluginOptions.ApiItem.TypeParameters, - pluginOptions.ExtractedData - ); - - if (typeParameters.length === 0) { - return GeneratorHelpers.GetDefaultPluginResultData(); - } - - const typeParametersTable = GeneratorHelpers.ApiTypeParametersTableToString(typeParameters); - const text = new MarkdownBuilder() - .EmptyLine() - .Header("Type parameters", 3) - .EmptyLine() - .Text(typeParametersTable.Text) - .GetOutput(); - - return { - Result: text, - UsedReferences: typeParametersTable.References, - Headings: [] - }; - } - - private renderConstraintTypes(apiItem: Contracts.ApiInterfaceDto): PluginResultData { + private renderConstraintTypes(apiItem: Contracts.ApiInterfaceDto): PluginResultData | undefined { if (apiItem.Extends.length === 0) { - return GeneratorHelpers.GetDefaultPluginResultData(); + return undefined; } const builder = new MarkdownBuilder() .EmptyLine() - .Header("Extends", 3); + .Bold("Extends"); const references = []; @@ -70,32 +42,32 @@ export class ApiInterfacePlugin implements Plugin { } return { + ...GeneratorHelpers.GetDefaultPluginResultData(), UsedReferences: references, Result: builder.GetOutput(), - Headings: [] }; } - private renderPropertyMembers(memberItems: ExtractedItemDto[]): PluginResultData { + private renderPropertyMembers(memberItems: ExtractedItemDto[]): PluginResultData | undefined { const apiItems = memberItems.filter>( this.isReferenceOfApiItemKind.bind(undefined, Contracts.ApiItemKinds.Property) ).map(x => x.ApiItem); if (apiItems.length === 0) { - return GeneratorHelpers.GetDefaultPluginResultData(); + return undefined; } const table = GeneratorHelpers.ApiPropertiesToTableString(apiItems); const builder = new MarkdownBuilder() .EmptyLine() - .Header("Properties", 3) + .Bold("Properties") .EmptyLine() .Text(table.Text); return { + ...GeneratorHelpers.GetDefaultPluginResultData(), UsedReferences: table.References, Result: builder.GetOutput(), - Headings: [] }; } @@ -111,15 +83,15 @@ export class ApiInterfacePlugin implements Plugin { apiItemKind: Contracts.ApiItemKinds, memberItems: ExtractedItemDto[], getPluginResult: GetItemPluginResultHandler - ): PluginResultData { + ): PluginResultData | undefined { const items = memberItems.filter(this.isReferenceOfApiItemKind.bind(undefined, apiItemKind)); if (items.length === 0) { - return GeneratorHelpers.GetDefaultPluginResultData(); + return undefined; } const pluginResult = GeneratorHelpers.GetDefaultPluginResultData(); - pluginResult.Result.push("", MarkdownGenerator.Header(title, 3)); + pluginResult.Result.push("", MarkdownGenerator.Header(title, 4)); for (const item of items) { pluginResult.Result.push(""); @@ -131,42 +103,43 @@ export class ApiInterfacePlugin implements Plugin { return pluginResult; } - public Render(data: PluginOptions): PluginResult { - const alias = data.Reference.Alias; - const header = GeneratorHelpers.ApiInterfaceToSimpleString(alias, data.ApiItem); + public Render(options: PluginOptions): PluginResult { + const heading = options.Reference.Alias; const pluginResult: PluginResult = { ...GeneratorHelpers.GetDefaultPluginResultData(), - ApiItem: data.ApiItem, - Reference: data.Reference, + ApiItem: options.ApiItem, + Reference: options.Reference, Headings: [ { - ApiItemId: data.Reference.Id, - Heading: header + ApiItemId: options.Reference.Id, + Heading: heading } ] }; - const memberReferences = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); + const memberReferences = GeneratorHelpers.GetApiItemReferences(options.ExtractedData, options.ApiItem.Members); const memberItems = memberReferences.map(itemReference => ({ Reference: itemReference, - ApiItem: data.ExtractedData.Registry[itemReference.Id] + ApiItem: options.ExtractedData.Registry[itemReference.Id] })); - const interfaceString = GeneratorHelpers.ApiInterfaceToString(data.ApiItem, data.ExtractedData); + const interfaceString = GeneratorHelpers.ApiInterfaceToString(options.ApiItem, options.ExtractedData); const builder = new MarkdownBuilder() - .Header(header, 2) + .Header(heading, 3) .EmptyLine() - .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) .Code(interfaceString, GeneratorHelpers.DEFAULT_CODE_OPTIONS); pluginResult.Result = builder.GetOutput(); // Type parameters - const typeParametersResult = this.renderTypeParameters(data); + const apiTypeParameters = GeneratorHelpers + .GetApiItemsFromReference(options.ApiItem.TypeParameters, options.ExtractedData); + const typeParametersResult = this.RenderTypeParameters(apiTypeParameters); GeneratorHelpers.MergePluginResultData(pluginResult, typeParametersResult); // Constraint types - const constraintTypesResult = this.renderConstraintTypes(data.ApiItem); + const constraintTypesResult = this.renderConstraintTypes(options.ApiItem); GeneratorHelpers.MergePluginResultData(pluginResult, constraintTypesResult); // Construct items @@ -174,7 +147,7 @@ export class ApiInterfacePlugin implements Plugin { "Construct", Contracts.ApiItemKinds.Construct, memberItems, - data.GetItemPluginResult + options.GetItemPluginResult ); GeneratorHelpers.MergePluginResultData(pluginResult, constructMembersResult); @@ -183,7 +156,7 @@ export class ApiInterfacePlugin implements Plugin { "Call", Contracts.ApiItemKinds.Call, memberItems, - data.GetItemPluginResult + options.GetItemPluginResult ); GeneratorHelpers.MergePluginResultData(pluginResult, callMembersResult); @@ -192,7 +165,7 @@ export class ApiInterfacePlugin implements Plugin { "Index signatures", Contracts.ApiItemKinds.Index, memberItems, - data.GetItemPluginResult + options.GetItemPluginResult ); GeneratorHelpers.MergePluginResultData(pluginResult, indexMembersResult); @@ -201,7 +174,7 @@ export class ApiInterfacePlugin implements Plugin { "Methods", Contracts.ApiItemKinds.Method, memberItems, - data.GetItemPluginResult + options.GetItemPluginResult ); GeneratorHelpers.MergePluginResultData(pluginResult, methodMembersResult); diff --git a/packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts b/packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts index 056316c2..a20f0c92 100644 --- a/packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-namespace-plugin.ts @@ -1,92 +1,71 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; +import * as path from "path"; import { GeneratorHelpers } from "../generator-helpers"; -import { PluginMember, Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; +import { ContainerPlugin, ContainerMembersKindsGroup } from "../abstractions/container-plugin"; -interface RenderItems { - References: string[]; - Output: string[]; - Members: PluginMember[]; -} - -export class ApiNamespacePlugin implements Plugin { +export class ApiNamespacePlugin extends ContainerPlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Namespace]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } - - private renderItems(data: PluginOptions): RenderItems { - const references = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); - const referencesList: string[] = []; - const members: PluginMember[] = []; - const builder = new MarkdownBuilder(); - - for (const reference of references) { - const apiItem = data.ExtractedData.Registry[reference.Id]; - - switch (apiItem.ApiKind) { - case Contracts.ApiItemKinds.Namespace: - case Contracts.ApiItemKinds.Class: { - - const renderedItem = data.GetItemPluginResult(reference); - members.push({ - Reference: reference, - PluginResult: renderedItem - }); - - builder - .Text(md => md.Header(md.Link(renderedItem.ApiItem.Name, reference.Id, true), 2)) - .EmptyLine(); - referencesList.push(reference.Id); - break; - } - default: { - const renderedItem = data.GetItemPluginResult(reference); - // Something to do with heading. Maybe heading reference registry? - builder - .Text(renderedItem.Result) - .EmptyLine(); + public Render(data: PluginOptions): PluginResult { + const heading = path.basename(data.ApiItem.Name, path.extname(data.ApiItem.Name)); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: data.Reference.Id } - } - } - - return { - References: referencesList, - Output: builder.GetOutput(), - Members: members + ] }; - } - - public Render(data: PluginOptions): PluginResult { - const heading = data.Reference.Alias; - const headings: PluginHeading[] = [ - { - Heading: heading, - ApiItemId: data.Reference.Id - } - ]; - - const renderedItems = this.renderItems(data); - const references: string[] = renderedItems.References; // Header - const builder = new MarkdownBuilder() + pluginResult.Result = new MarkdownBuilder() .Header(heading, 1) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Text(renderedItems.Output); + .GetOutput(); - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: headings, - UsedReferences: references, - Result: builder.GetOutput(), - Members: renderedItems.Members - }; + // Members + const memberKindsList: ContainerMembersKindsGroup[] = [ + { + Heading: "Functions", + Kinds: [Contracts.ApiItemKinds.Function] + }, + { + Heading: "Interfaces", + Kinds: [Contracts.ApiItemKinds.Interface] + }, + { + Heading: "Types", + Kinds: [Contracts.ApiItemKinds.Type] + }, + { + Heading: "Enums", + Kinds: [Contracts.ApiItemKinds.Enum] + }, + { + Heading: "Classes", + Kinds: [Contracts.ApiItemKinds.Class] + }, + { + Heading: "Namespaces", + Kinds: [Contracts.ApiItemKinds.Namespace] + }, + { + Heading: "Variables", + Kinds: [Contracts.ApiItemKinds.Variable] + } + ]; + const renderedMembers = this.RenderMembersGroups(memberKindsList, data); + GeneratorHelpers.MergePluginResultData(pluginResult, renderedMembers); + + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts b/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts index 03d86f4b..fbc6c42f 100644 --- a/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-source-file-plugin.ts @@ -3,105 +3,69 @@ import { MarkdownBuilder } from "@simplrjs/markdown"; import * as path from "path"; import { GeneratorHelpers } from "../generator-helpers"; -import { PluginMember, Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; +import { ContainerPlugin, ContainerMembersKindsGroup } from "../abstractions/container-plugin"; -interface RenderItems { - References: string[]; - Headings: PluginHeading[]; - Output: string[]; - Members: PluginMember[]; -} - -export class ApiSourceFilePlugin implements Plugin { +export class ApiSourceFilePlugin extends ContainerPlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.SourceFile]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } - - // TODO: Move this to helpers. - private renderItems(data: PluginOptions): RenderItems { - const references = GeneratorHelpers.GetApiItemReferences(data.ExtractedData, data.ApiItem.Members); - let referencesList: string[] = []; - let headingsList: PluginHeading[] = []; - const members: PluginMember[] = []; - const builder = new MarkdownBuilder(); - - for (const reference of references) { - const apiItem = data.ExtractedData.Registry[reference.Id]; - - if (data.IsPluginResultExists(reference)) { - builder - .Text(md => md.Header(md.Link(apiItem.Name, reference.Id, true), 2)) - .EmptyLine(); - referencesList.push(reference.Id); - } else { - switch (apiItem.ApiKind) { - case Contracts.ApiItemKinds.Namespace: - case Contracts.ApiItemKinds.Class: { - - const renderedItem = data.GetItemPluginResult(reference); - members.push({ - Reference: reference, - PluginResult: renderedItem - }); - - builder - .Text(md => md.Header(md.Link(renderedItem.ApiItem.Name, reference.Id, true), 2)) - .EmptyLine(); - referencesList.push(reference.Id); - break; - } - default: { - const renderedItem = data.GetItemPluginResult(reference); - builder - .Text(renderedItem.Result) - .EmptyLine(); - - headingsList = headingsList.concat(renderedItem.Headings); - referencesList = referencesList.concat(renderedItem.UsedReferences); - } - } - } - } - - return { - References: referencesList, - Headings: headingsList, - Output: builder.GetOutput(), - Members: members - }; - } - public Render(data: PluginOptions): PluginResult { const heading = path.basename(data.ApiItem.Name, path.extname(data.ApiItem.Name)); - let headings: PluginHeading[] = [ - { - Heading: heading, - ApiItemId: data.Reference.Id - } - ]; - - const renderedItems = this.renderItems(data); - const references: string[] = renderedItems.References; - headings = headings.concat(renderedItems.Headings); + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: data.ApiItem, + Reference: data.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: data.Reference.Id + } + ] + }; // Header - const builder = new MarkdownBuilder() + pluginResult.Result = new MarkdownBuilder() .Header(heading, 1) .EmptyLine() .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Text(renderedItems.Output); + .GetOutput(); - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: headings, - UsedReferences: references, - Result: builder.GetOutput(), - Members: renderedItems.Members - }; + // Members + const memberKindsList: ContainerMembersKindsGroup[] = [ + { + Heading: "Functions", + Kinds: [Contracts.ApiItemKinds.Function] + }, + { + Heading: "Interfaces", + Kinds: [Contracts.ApiItemKinds.Interface] + }, + { + Heading: "Types", + Kinds: [Contracts.ApiItemKinds.Type] + }, + { + Heading: "Enums", + Kinds: [Contracts.ApiItemKinds.Enum] + }, + { + Heading: "Classes", + Kinds: [Contracts.ApiItemKinds.Class] + }, + { + Heading: "Namespaces", + Kinds: [Contracts.ApiItemKinds.Namespace] + }, + { + Heading: "Variables", + Kinds: [Contracts.ApiItemKinds.Variable] + } + ]; + const members = this.RenderMembersGroups(memberKindsList, data); + GeneratorHelpers.MergePluginResultData(pluginResult, members); + + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-type-plugin.ts b/packages/ts-docs-gen/src/plugins/api-type-plugin.ts index bd652f03..4e83a89e 100644 --- a/packages/ts-docs-gen/src/plugins/api-type-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-type-plugin.ts @@ -2,44 +2,46 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; import { GeneratorHelpers } from "../generator-helpers"; -import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; +import { BasePlugin } from "../abstractions/base-plugin"; -export class ApiTypePlugin implements Plugin { +export class ApiTypePlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Type]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } - - public Render(data: PluginOptions): PluginResult { - const heading = data.Reference.Alias; - const headings: PluginHeading[] = [ - { - Heading: heading, - ApiItemId: data.Reference.Id - } - ]; - const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); + public Render(options: PluginOptions): PluginResult { + const heading = options.Reference.Alias; + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: options.Reference.Id + } + ] + }; // Header - const builder = new MarkdownBuilder() - .Header(heading, 2) - .EmptyLine() - .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(GeneratorHelpers.ApiTypeToString(data.ApiItem), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + pluginResult.Result = new MarkdownBuilder() + .Header(heading, 3) .EmptyLine() - .Header("Type", 3) - .EmptyLine() - .Text(typeStringDto.Text); + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .Code(GeneratorHelpers.ApiTypeToString(options.ApiItem), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .GetOutput(); - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: headings, - UsedReferences: typeStringDto.References, - Result: builder.GetOutput() - }; + // TypeParameters + const apiTypeParameters = GeneratorHelpers + .GetApiItemsFromReference(options.ApiItem.TypeParameters, options.ExtractedData); + const typeParametersResult = this.RenderTypeParameters(apiTypeParameters); + GeneratorHelpers.MergePluginResultData(pluginResult, typeParametersResult); + + // Type + const typeResult = this.RenderType(options.ApiItem.Type); + GeneratorHelpers.MergePluginResultData(pluginResult, typeResult); + + return pluginResult; } } diff --git a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts index d2757500..1f01c288 100644 --- a/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts +++ b/packages/ts-docs-gen/src/plugins/api-variable-plugin.ts @@ -2,43 +2,42 @@ import { Contracts } from "ts-extractor"; import { MarkdownBuilder } from "@simplrjs/markdown"; import { GeneratorHelpers } from "../generator-helpers"; -import { Plugin, SupportedApiItemKindType, PluginOptions, PluginResult, PluginHeading } from "../contracts/plugin"; +import { SupportedApiItemKindType, PluginOptions, PluginResult } from "../contracts/plugin"; +import { BasePlugin } from "../abstractions/base-plugin"; -export class ApiVariablePlugin implements Plugin { +export class ApiVariablePlugin extends BasePlugin { public SupportedApiItemKinds(): SupportedApiItemKindType[] { return [GeneratorHelpers.ApiItemKinds.Variable]; } - public CheckApiItem(item: Contracts.ApiItemDto): boolean { - return true; - } + public Render(options: PluginOptions): PluginResult { + const heading: string = options.Reference.Alias; + const pluginResult: PluginResult = { + ...GeneratorHelpers.GetDefaultPluginResultData(), + ApiItem: options.ApiItem, + Reference: options.Reference, + Headings: [ + { + Heading: heading, + ApiItemId: options.Reference.Id + } + ] + }; - public Render(data: PluginOptions): PluginResult { - const heading = data.Reference.Alias; - const headings: PluginHeading[] = [ - { - Heading: heading, - ApiItemId: data.Reference.Id - } - ]; - const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(data.ApiItem.Type); + // Type + const typeStringDto = GeneratorHelpers.TypeDtoToMarkdownString(options.ApiItem.Type); - const builder = new MarkdownBuilder() - .Header(heading, 2) + pluginResult.Result = new MarkdownBuilder() + .Header(heading, 3) .EmptyLine() - .Text(GeneratorHelpers.RenderApiItemMetadata(data.ApiItem)) - .Code(GeneratorHelpers.ApiVariableToString(data.ApiItem), GeneratorHelpers.DEFAULT_CODE_OPTIONS) + .Text(GeneratorHelpers.RenderApiItemMetadata(options.ApiItem)) + .Code(GeneratorHelpers.ApiVariableToString(options.ApiItem), GeneratorHelpers.DEFAULT_CODE_OPTIONS) .EmptyLine() - .Header("Type", 3) + .Bold("Type") .EmptyLine() - .Text(typeStringDto.Text); + .Text(typeStringDto.Text) + .GetOutput(); - return { - ApiItem: data.ApiItem, - Reference: data.Reference, - Headings: headings, - Result: builder.GetOutput(), - UsedReferences: typeStringDto.References - }; + return pluginResult; } } diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap index e28c11a5..19bb8c47 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-1.test.ts.snap @@ -5,21 +5,345 @@ Array [ Object { "FileLocation": "index.md", "Result": Array [ - "[InterfaceDeclaration-1]: index.md#interface-foointerface", - "[InterfaceDeclaration-2]: index.md#interface-boo", - "[InterfaceDeclaration-4]: index.md#interface-myconstrainttype", - "[InterfaceDeclaration-9]: index.md#interface-dictionary", - "[InterfaceDeclaration-9]: index.md#interface-dictionary", - "[InterfaceDeclaration-6]: index.md#interface-objectsinterface", - "[InterfaceDeclaration-12]: index.md#interface-monsterinterface", + "[ClassDeclaration-2]: index/earth.md#earth", + "[ClassDeclaration-1]: index/world.md#world", + "[InterfaceDeclaration-1]: index.md#foointerface", + "[InterfaceDeclaration-2]: index.md#boo", + "[InterfaceDeclaration-4]: index.md#myconstrainttype", + "[InterfaceDeclaration-9]: index.md#dictionary", + "[InterfaceDeclaration-9]: index.md#dictionary", + "[InterfaceDeclaration-6]: index.md#objectsinterface", + "[InterfaceDeclaration-12]: index.md#monsterinterface", "[ClassDeclaration-0]: index/foo.md#foo", "[ClassDeclaration-1]: index/world.md#world", "[ClassDeclaration-2]: index/earth.md#earth", - "[ClassDeclaration-2]: index/earth.md#earth", - "[ClassDeclaration-1]: index/world.md#world", "# index", "", - "## interface ExtendedBar", + "## Functions", + "", + "### AnotherFoo(parameter1, parameter2)", + "", + "\`\`\`typescript", + "function AnotherFoo(parameter1: string, parameter2: Promise): string", + "\`\`\`", + "", + "**Type parameters**", + "", + "| Name | Constraint type |", + "| ---- | --------------- |", + "| T | Object |", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ---------- | -------------------- |", + "| parameter1 | string |", + "| parameter2 | Promise&\\\\#60;T&\\\\#62; |", + "", + "**Return type**", + "", + "string", + "", + "----------", + "", + "### GetFoo()", + "", + "\`\`\`typescript", + "function GetFoo(): Promise", + "\`\`\`", + "", + "**Return type**", + "", + "Promise<void>", + "", + "----------", + "", + "### FunctionWithOneParameter(parameter)", + "", + "\`\`\`typescript", + "function FunctionWithOneParameter(parameter: string): void", + "\`\`\`", + "", + "**Parameters**", + "", + "| Name | Type |", + "| --------- | ------ |", + "| parameter | string |", + "", + "**Return type**", + "", + "void", + "", + "----------", + "", + "### FunctionWithNoParameters()", + "", + "\`\`\`typescript", + "function FunctionWithNoParameters(): void", + "\`\`\`", + "", + "**Return type**", + "", + "void", + "", + "----------", + "", + "### FunctionWithMultipleParameters(parameter1, parameter2)", + "", + "\`\`\`typescript", + "function FunctionWithMultipleParameters(parameter1: string, parameter2: number): void", + "\`\`\`", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | number |", + "", + "**Return type**", + "", + "void", + "", + "----------", + "", + "### Bar(parameter1, parameter2)", + "", + "Warning: Beta!", + "", + "Deprecated!", + "", + "Some general comment about Bar function.", + "", + "\`\`\`typescript", + "function Bar(parameter1: string, parameter2: number): string", + "\`\`\`", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | number |", + "", + "**Return type**", + "", + "string", + "", + "----------", + "", + "### FunctionWithMultipleTypeParameters(parameter1, parameter2)", + "", + "Comment on Function with multiple type parameters.", + "", + "\`\`\`typescript", + "function FunctionWithMultipleTypeParameters(parameter1: T, parameter2: P): string", + "\`\`\`", + "", + "**Type parameters**", + "", + "| Name | Constraint type |", + "| ---- | --------------- |", + "| T | Object |", + "| P | |", + "", + "**Parameters**", + "", + "| Name | Type | Description |", + "| ---------- | ---- | --------------------- |", + "| parameter1 | T | Parameter one comment |", + "| parameter2 | P | Parameter two comment |", + "", + "**Return type**", + "", + "string", + "", + "----------", + "", + "### FunctionWithTypeParameterDefault(parameter1, parameter2)", + "", + "Some general comment about Function with type parameter default function.", + "", + "\`\`\`typescript", + "function FunctionWithTypeParameterDefault(parameter1: string, parameter2: T): string", + "\`\`\`", + "", + "**Type parameters**", + "", + "| Name | Constraint type | Default type |", + "| ---- | --------------- | ------------ |", + "| T | Object | {} |", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | T |", + "", + "**Return type**", + "", + "string", + "", + "----------", + "", + "### FunctionWithTypeParameterConstraint(parameter1, parameter2)", + "", + "Some general comment about AnotherBar function.", + "", + "\`\`\`typescript", + "function FunctionWithTypeParameterConstraint(parameter1: string, parameter2: T): string", + "\`\`\`", + "", + "**Type parameters**", + "", + "| Name | Constraint type |", + "| ---- | --------------- |", + "| T | Object |", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ---------- | ------ |", + "| parameter1 | string |", + "| parameter2 | T |", + "", + "**Return type**", + "", + "string", + "", + "----------", + "", + "### FunctionWithoutReturnType(parameter1, parameter2)", + "", + "\`\`\`typescript", + "function FunctionWithoutReturnType(parameter1: string, parameter2: Promise): string", + "\`\`\`", + "", + "**Type parameters**", + "", + "| Name | Constraint type |", + "| ---- | ---------------- |", + "| T | Array<T> |", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ---------- | -------------------- |", + "| parameter1 | string |", + "| parameter2 | Promise&\\\\#60;T&\\\\#62; |", + "", + "**Return type**", + "", + "string", + "", + "----------", + "", + "### FunctionWithGenericReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithGenericReturnType(): string[]", + "\`\`\`", + "", + "**Return type**", + "", + "Array<string>", + "", + "----------", + "", + "### FunctionWithPrimitiveReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithPrimitiveReturnType(): boolean", + "\`\`\`", + "", + "**Return type**", + "", + "true | false", + "", + "----------", + "", + "### FunctionWithUnionReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithUnionReturnType(): \\"something\\" | \\"nothing\\"", + "\`\`\`", + "", + "**Return type**", + "", + "\\"something\\" | \\"nothing\\"", + "", + "----------", + "", + "### FunctionWithIntersectionReturnType()", + "", + "\`\`\`typescript", + "function FunctionWithIntersectionReturnType(): Earth & World", + "\`\`\`", + "", + "**Return type**", + "", + "[Earth][ClassDeclaration-2] & [World][ClassDeclaration-1]", + "", + "----------", + "", + "### MyFunction()", + "", + "Function with TypeParameter as TypeLiteral.", + "", + "\`\`\`typescript", + "function MyFunction(): T", + "\`\`\`", + "", + "**Type parameters**", + "", + "| Name | Constraint type | Default type |", + "| ---- | ----------------------------------------------------------- | ----------------------- |", + "| T | { myProperty: string; myPropertyTwo?: number | undefined; } | { myProperty: string; } |", + "", + "**Return type**", + "", + "T", + "", + "----------", + "", + "### FunctionWithInitializedNumberParameter(someParameter)", + "", + "\`\`\`typescript", + "function FunctionWithInitializedNumberParameter(someParameter: number = 12): number", + "\`\`\`", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ------------- | ------ |", + "| someParameter | number |", + "", + "**Return type**", + "", + "number", + "", + "----------", + "", + "### FunctionWithInitializedStringParameter(someParameter)", + "", + "\`\`\`typescript", + "function FunctionWithInitializedStringParameter(someParameter: string = \\"12\\"): string", + "\`\`\`", + "", + "**Parameters**", + "", + "| Name | Type |", + "| ------------- | ------ |", + "| someParameter | string |", + "", + "**Return type**", + "", + "string", + "", + "## Interfaces", + "", + "### ExtendedBar", "", "\`\`\`typescript", "interface ExtendedBar extends FooInterface, Boo {", @@ -27,19 +351,21 @@ Array [ "}", "\`\`\`", "", - "### Extends", + "**Extends**", "", "[FooInterface][InterfaceDeclaration-1]<number>", "", "[Boo][InterfaceDeclaration-2]", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| ---------- | --------------------- |", "| OtherStuff | Array<string> |", "", - "## interface FooInterface", + "----------", + "", + "### FooInterface", "", "\`\`\`typescript", "interface FooInterface {", @@ -49,13 +375,13 @@ Array [ "}", "\`\`\`", "", - "### Type parameters", + "**Type parameters**", "", "| Name |", "| ----- |", "| TType |", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| ------- | ------ |", @@ -63,7 +389,9 @@ Array [ "| Surname | string |", "| Type | TType |", "", - "## interface Boo", + "----------", + "", + "### Boo", "", "\`\`\`typescript", "interface Boo {", @@ -71,13 +399,15 @@ Array [ "}", "\`\`\`", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| ---- | --------------------- |", "| Boos | Array<string> |", "", - "## interface AnotherInterface", + "----------", + "", + "### AnotherInterface", "", "\`\`\`typescript", "interface AnotherInterface {", @@ -85,30 +415,32 @@ Array [ "}", "\`\`\`", "", - "### Call", + "#### Call", "", "\`\`\`typescript", "(param1: TValue, param2: TValue): boolean", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ------ |", "| TValue |", "", - "**Parameters:**", + "**Parameters**", "", "| Name | Type |", "| ------ | ------ |", "| param1 | TValue |", "| param2 | TValue |", "", - "**Return type:**", + "**Return type**", "", "true | false", "", - "## interface MyConstraintType", + "----------", + "", + "### MyConstraintType", "", "\`\`\`typescript", "interface MyConstraintType {", @@ -116,13 +448,15 @@ Array [ "}", "\`\`\`", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| ---------- | ------ |", "| myProperty | string |", "", - "## interface MyDefaultType", + "----------", + "", + "### MyDefaultType", "", "\`\`\`typescript", "interface MyDefaultType extends MyConstraintType {", @@ -130,17 +464,19 @@ Array [ "}", "\`\`\`", "", - "### Extends", + "**Extends**", "", "[MyConstraintType][InterfaceDeclaration-4]", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| --------------- | ------ |", "| anotherProperty | number |", "", - "## interface ObjectsInterface", + "----------", + "", + "### ObjectsInterface", "", "\`\`\`typescript", "interface ObjectsInterface {", @@ -149,14 +485,16 @@ Array [ "}", "\`\`\`", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| --------- | ------ |", "| objectOne | Object |", "| objectTwo | Object |", "", - "## interface InterfaceWithCall", + "----------", + "", + "### InterfaceWithCall", "", "\`\`\`typescript", "interface InterfaceWithCall {", @@ -164,23 +502,25 @@ Array [ "}", "\`\`\`", "", - "### Call", + "#### Call", "", "\`\`\`typescript", "(): { someProperty: T; }", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ---- |", "| T |", "", - "**Return type:**", + "**Return type**", "", "{ someProperty: T; }", "", - "## interface InterfaceWithConstraintType", + "----------", + "", + "### InterfaceWithConstraintType", "", "\`\`\`typescript", "interface InterfaceWithConstraintType extends Dictionary {", @@ -188,17 +528,19 @@ Array [ "}", "\`\`\`", "", - "### Extends", + "**Extends**", "", "[Dictionary][InterfaceDeclaration-9]<string>", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| ------------ | ------ |", "| someProperty | string |", "", - "## interface InterfaceWithMethod", + "----------", + "", + "### InterfaceWithMethod", "", "\`\`\`typescript", "interface InterfaceWithMethod {", @@ -207,19 +549,19 @@ Array [ "}", "\`\`\`", "", - "### Type parameters", + "**Type parameters**", "", "| Name |", "| ---- |", "| T |", "", - "### Methods", + "#### Methods", "", "\`\`\`typescript", "someMethodOne(): T", "\`\`\`", "", - "**Return type:**", + "**Return type**", "", "T", "", @@ -227,17 +569,19 @@ Array [ "someMethodTwo(): TReturn", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ------- |", "| TReturn |", "", - "**Return type:**", + "**Return type**", "", "TReturn", "", - "## interface Dictionary", + "----------", + "", + "### Dictionary", "", "\`\`\`typescript", "interface Dictionary {", @@ -246,33 +590,34 @@ Array [ "}", "\`\`\`", "", - "### Type parameters", + "**Type parameters**", "", "| Name |", "| ------ |", "| TValue |", "", - "### Construct", + "#### Construct", "", "\`\`\`typescript", "new (): Dictionary", "\`\`\`", "", - "**Return type:**", + "**Return type**", "", "[Dictionary][InterfaceDeclaration-9]<TValue>", "", - "### Index signatures", + "#### Index signatures", "", "\`\`\`typescript", "[key: string]: TValue", "\`\`\`", "", - "Index \`key\` - string", + "* *Parameter* \`key\` - string", + "* *Type* TValue", "", - "Type - TValue", + "----------", "", - "## interface MethodsInterface", + "### MethodsInterface", "", "\`\`\`typescript", "interface MethodsInterface {", @@ -281,45 +626,47 @@ Array [ "}", "\`\`\`", "", - "### Call", + "#### Call", "", "\`\`\`typescript", "(arg: TValue): void", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ------ |", "| TValue |", "", - "**Parameters:**", + "**Parameters**", "", "| Name | Type |", "| ---- | ------ |", "| arg | TValue |", "", - "**Return type:**", + "**Return type**", "", "void", "", - "### Methods", + "#### Methods", "", "\`\`\`typescript", "someMethod(): string", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ---- |", "| T |", "", - "**Return type:**", + "**Return type**", "", "string", "", - "## interface MonsterInterface", + "----------", + "", + "### MonsterInterface", "", "Warning: Beta!", "", @@ -340,29 +687,29 @@ Array [ "}", "\`\`\`", "", - "### Type parameters", + "**Type parameters**", "", "| Name | Constraint type | Default type |", "| ------ | --------------- | ------------ |", - "| TValue | Object | \\\\{\\\\} |", + "| TValue | Object | {} |", "", - "### Extends", + "**Extends**", "", "[ObjectsInterface][InterfaceDeclaration-6]", "", - "### Construct", + "#### Construct", "", "\`\`\`typescript", "new (): MonsterInterface", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ---- |", "| T |", "", - "**Return type:**", + "**Return type**", "", "[MonsterInterface][InterfaceDeclaration-12]<T>", "", @@ -370,29 +717,29 @@ Array [ "new (someParameter: string): string", "\`\`\`", "", - "**Parameters:**", + "**Parameters**", "", "| Name | Type |", "| ------------- | ------ |", "| someParameter | string |", "", - "**Return type:**", + "**Return type**", "", "string", "", - "### Call", + "#### Call", "", "\`\`\`typescript", "(): { someProperty: T; }", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ---- |", "| T |", "", - "**Return type:**", + "**Return type**", "", "{ someProperty: T; }", "", @@ -400,19 +747,19 @@ Array [ "(key?: string | undefined): { someProperty: T; }", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ---- |", "| T |", "", - "**Parameters:**", + "**Parameters**", "", - "| Name | Type | Optional |", - "| ---- | ----------------------- | -------- |", - "| key | undefined | string | Yes |", + "| Name | Type |", + "| ---- | ----------------------- |", + "| key | undefined | string |", "", - "**Return type:**", + "**Return type**", "", "{ someProperty: T; }", "", @@ -420,42 +767,41 @@ Array [ "(key: number): { someProperty: T; }", "\`\`\`", "", - "**Type parameters:**", + "**Type parameters**", "", "| Name |", "| ---- |", "| T |", "", - "**Parameters:**", + "**Parameters**", "", "| Name | Type |", "| ---- | ------ |", "| key | number |", "", - "**Return type:**", + "**Return type**", "", "{ someProperty: T; }", "", - "### Index signatures", + "#### Index signatures", "", "\`\`\`typescript", "readonly [key: string]: TValue", "\`\`\`", "", - "Readonly.", - "", - "Index \`key\` - string", + "* *Parameter* \`key\` - string", + "* *Type* TValue", "", - "Type - TValue", - "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| --------- | ------ |", "| objectOne | TValue |", "| objectTwo | TValue |", "", - "## interface SomeInterface", + "----------", + "", + "### SomeInterface", "", "\`\`\`typescript", "interface SomeInterface {", @@ -464,25 +810,25 @@ Array [ "}", "\`\`\`", "", - "### Index signatures", + "#### Index signatures", "", "\`\`\`typescript", "[key: string]: string | number", "\`\`\`", "", - "Index \`key\` - string", - "", - "Type - string | number", + "* *Parameter* \`key\` - string", + "* *Type* string | number", "", "\`\`\`typescript", "[key: number]: string", "\`\`\`", "", - "Index \`key\` - number", + "* *Parameter* \`key\` - number", + "* *Type* string", "", - "Type - string", + "----------", "", - "## interface StringsDictionary", + "### StringsDictionary", "", "\`\`\`typescript", "interface StringsDictionary {", @@ -490,17 +836,18 @@ Array [ "}", "\`\`\`", "", - "### Index signatures", + "#### Index signatures", "", "\`\`\`typescript", "[key: string]: string", "\`\`\`", "", - "Index \`key\` - string", + "* *Parameter* \`key\` - string", + "* *Type* string", "", - "Type - string", + "----------", "", - "## interface MyInterface", + "### MyInterface", "", "\`\`\`typescript", "interface MyInterface {", @@ -510,7 +857,7 @@ Array [ "}", "\`\`\`", "", - "### Properties", + "**Properties**", "", "| Name | Type |", "| --------------- | ------ |", @@ -518,7 +865,9 @@ Array [ "| MyPropertyTwo | Object |", "| MyPropertyThree | number |", "", - "## EnumList", + "## Enums", + "", + "### EnumList", "", "Simple list.", "", @@ -531,13 +880,17 @@ Array [ "}", "\`\`\`", "", + "**Members**", + "", "| Name | Value | Description |", "| ------------ | ----- | ------------------------------ |", "| FirstOption | 0 | Description for First option. |", "| SecondOption | 1 | Description for Second option. |", "| ThirdOption | 2 | Description for Third option. |", "", - "## EnumListWithNumberValues", + "----------", + "", + "### EnumListWithNumberValues", "", "List with number values with no punctuation at the end of description", "", @@ -550,13 +903,17 @@ Array [ "}", "\`\`\`", "", + "**Members**", + "", "| Name | Value |", "| ------------ | ----- |", "| FirstOption | 1 |", "| SecondOption | 2 |", "| ThirdOption | 3 |", "", - "## EnumListWithStringValues", + "----------", + "", + "### EnumListWithStringValues", "", "Warning: Beta!", "", @@ -571,334 +928,39 @@ Array [ "}", "\`\`\`", "", + "**Members**", + "", "| Name | Value |", "| ------------ | -------- |", "| FirstOption | \\"first\\" |", "| SecondOption | \\"second\\" |", "| ThirdOption | \\"third\\" |", "", - "## SampleConst", - "", - "\`\`\`typescript", - "const SampleConst: string;", - "\`\`\`", - "", - "### Type", - "", - "string", - "", - "## [Foo][ClassDeclaration-0]", - "", - "## [World][ClassDeclaration-1]", - "", - "## [Earth][ClassDeclaration-2]", - "", - "## AnotherFoo(parameter1, parameter2)", - "", - "\`\`\`typescript", - "function AnotherFoo(parameter1: string, parameter2: Promise): string", - "\`\`\`", - "", - "### Type parameters", - "", - "| Name | Constraint type |", - "| ---- | --------------- |", - "| T | Object |", - "", - "### Parameters", - "", - "| Name | Type |", - "| ---------- | -------------------- |", - "| parameter1 | string |", - "| parameter2 | Promise&\\\\#60;T&\\\\#62; |", - "", - "### Return type", - "", - "string", - "", - "", - "## GetFoo()", - "", - "\`\`\`typescript", - "function GetFoo(): Promise", - "\`\`\`", - "", - "### Return type", - "", - "Promise<void>", - "", - "", - "## FunctionWithOneParameter(parameter)", - "", - "\`\`\`typescript", - "function FunctionWithOneParameter(parameter: string): void", - "\`\`\`", - "", - "### Parameters", - "", - "| Name | Type |", - "| --------- | ------ |", - "| parameter | string |", - "", - "### Return type", - "", - "void", - "", - "", - "## FunctionWithNoParameters()", - "", - "\`\`\`typescript", - "function FunctionWithNoParameters(): void", - "\`\`\`", - "", - "### Return type", - "", - "void", - "", - "", - "## FunctionWithMultipleParameters(parameter1, parameter2)", - "", - "\`\`\`typescript", - "function FunctionWithMultipleParameters(parameter1: string, parameter2: number): void", - "\`\`\`", - "", - "### Parameters", - "", - "| Name | Type |", - "| ---------- | ------ |", - "| parameter1 | string |", - "| parameter2 | number |", - "", - "### Return type", - "", - "void", - "", - "", - "## Bar(parameter1, parameter2)", - "", - "Warning: Beta!", - "", - "Deprecated!", - "", - "Some general comment about Bar function.", - "", - "\`\`\`typescript", - "function Bar(parameter1: string, parameter2: number): string", - "\`\`\`", - "", - "### Parameters", - "", - "| Name | Type |", - "| ---------- | ------ |", - "| parameter1 | string |", - "| parameter2 | number |", - "", - "### Return type", - "", - "string", - "", - "", - "## FunctionWithMultipleTypeParameters(parameter1, parameter2)", - "", - "Comment on Function with multiple type parameters.", - "", - "\`\`\`typescript", - "function FunctionWithMultipleTypeParameters(parameter1: T, parameter2: P): string", - "\`\`\`", - "", - "### Type parameters", - "", - "| Name | Constraint type |", - "| ---- | --------------- |", - "| T | Object |", - "| P | |", - "", - "### Parameters", + "## Classes", "", - "| Name | Type |", - "| ---------- | ---- |", - "| parameter1 | T |", - "| parameter2 | P |", + "### [Foo][ClassDeclaration-0]", "", - "### Return type", + "----------", "", - "string", - "", - "", - "## FunctionWithTypeParameterDefault(parameter1, parameter2)", - "", - "Some general comment about Function with type parameter default function.", - "", - "\`\`\`typescript", - "function FunctionWithTypeParameterDefault(parameter1: string, parameter2: T): string", - "\`\`\`", - "", - "### Type parameters", - "", - "| Name | Constraint type | Default type |", - "| ---- | --------------- | ------------ |", - "| T | Object | \\\\{\\\\} |", - "", - "### Parameters", - "", - "| Name | Type |", - "| ---------- | ------ |", - "| parameter1 | string |", - "| parameter2 | T |", - "", - "### Return type", - "", - "string", - "", - "", - "## FunctionWithTypeParameterConstraint(parameter1, parameter2)", - "", - "Some general comment about AnotherBar function.", - "", - "\`\`\`typescript", - "function FunctionWithTypeParameterConstraint(parameter1: string, parameter2: T): string", - "\`\`\`", - "", - "### Type parameters", - "", - "| Name | Constraint type |", - "| ---- | --------------- |", - "| T | Object |", - "", - "### Parameters", - "", - "| Name | Type |", - "| ---------- | ------ |", - "| parameter1 | string |", - "| parameter2 | T |", - "", - "### Return type", - "", - "string", - "", - "", - "## FunctionWithoutReturnType(parameter1, parameter2)", - "", - "\`\`\`typescript", - "function FunctionWithoutReturnType(parameter1: string, parameter2: Promise): string", - "\`\`\`", - "", - "### Type parameters", - "", - "| Name | Constraint type |", - "| ---- | ------------------ |", - "| T | Array&\\\\#60;T&\\\\#62; |", - "", - "### Parameters", - "", - "| Name | Type |", - "| ---------- | -------------------- |", - "| parameter1 | string |", - "| parameter2 | Promise&\\\\#60;T&\\\\#62; |", + "### [World][ClassDeclaration-1]", "", - "### Return type", + "----------", "", - "string", + "### [Earth][ClassDeclaration-2]", "", + "## Variables", "", - "## FunctionWithGenericReturnType()", + "### SampleConst", "", "\`\`\`typescript", - "function FunctionWithGenericReturnType(): string[]", - "\`\`\`", - "", - "### Return type", - "", - "Array<string>", - "", - "", - "## FunctionWithPrimitiveReturnType()", - "", - "\`\`\`typescript", - "function FunctionWithPrimitiveReturnType(): boolean", - "\`\`\`", - "", - "### Return type", - "", - "true | false", - "", - "", - "## FunctionWithUnionReturnType()", - "", - "\`\`\`typescript", - "function FunctionWithUnionReturnType(): \\"something\\" | \\"nothing\\"", - "\`\`\`", - "", - "### Return type", - "", - "\\"something\\" | \\"nothing\\"", - "", - "", - "## FunctionWithIntersectionReturnType()", - "", - "\`\`\`typescript", - "function FunctionWithIntersectionReturnType(): Earth & World", - "\`\`\`", - "", - "### Return type", - "", - "[Earth][ClassDeclaration-2] & [World][ClassDeclaration-1]", - "", - "", - "## MyFunction()", - "", - "Function with TypeParameter as TypeLiteral.", - "", - "\`\`\`typescript", - "function MyFunction(): T", - "\`\`\`", - "", - "### Type parameters", - "", - "| Name | Constraint type | Default type |", - "| ---- | ------------------------------------------------------------------ | ------------------------- |", - "| T | \\\\{ myProperty: string; myPropertyTwo?: number | undefined; \\\\} | \\\\{ myProperty: string; \\\\} |", - "", - "### Return type", - "", - "T", - "", - "", - "## FunctionWithInitializedNumberParameter(someParameter)", - "", - "\`\`\`typescript", - "function FunctionWithInitializedNumberParameter(someParameter: number = 12): number", - "\`\`\`", - "", - "### Parameters", - "", - "| Name | Type | Initial value |", - "| ------------- | ------ | ------------- |", - "| someParameter | number | 12 |", - "", - "### Return type", - "", - "number", - "", - "", - "## FunctionWithInitializedStringParameter(someParameter)", - "", - "\`\`\`typescript", - "function FunctionWithInitializedStringParameter(someParameter: string = \\"12\\"): string", + "const SampleConst: string;", "\`\`\`", "", - "### Parameters", - "", - "| Name | Type | Initial value |", - "| ------------- | ------ | ------------- |", - "| someParameter | string | \\"12\\" |", - "", - "### Return type", + "**Type**", "", "string", "", "", - "", ], }, Object { @@ -916,12 +978,16 @@ Array [ "\`\`\`typescript", "public HandleMessage(message: string): string", "\`\`\`", - "#### Parameters", + "", + "**Parameters**", "", "| Name | Type |", "| ------- | ------ |", "| message | string |", "", + "**Return type**", + "", + "string", "", "", ], diff --git a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap index a00154f2..376c2325 100644 --- a/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap +++ b/packages/ts-docs-gen/tests/cases/__tests__/__snapshots__/simple-project-2.test.ts.snap @@ -9,9 +9,13 @@ Array [ "[ClassDeclaration-1]: index/foostart.md#foostart", "# index", "", - "## [Foo][ClassDeclaration-0]", + "## Classes", "", - "## [FooStart][ClassDeclaration-1]", + "### [Foo][ClassDeclaration-0]", + "", + "----------", + "", + "### [FooStart][ClassDeclaration-1]", "", "", ], @@ -31,12 +35,16 @@ Array [ "\`\`\`typescript", "public GetMessage(message: string): string", "\`\`\`", - "#### Parameters", + "", + "**Parameters**", "", "| Name | Type |", "| ------- | ------ |", "| message | string |", "", + "**Return type**", + "", + "string", "", "## Properties", "", @@ -46,7 +54,7 @@ Array [ "private readonly defaultMessage: string;", "\`\`\`", "", - "### Type", + "**Type**", "", "string", "", @@ -68,12 +76,16 @@ Array [ "\`\`\`typescript", "public HandleMessage(message: string): string", "\`\`\`", - "#### Parameters", + "", + "**Parameters**", "", "| Name | Type |", "| ------- | ------ |", "| message | string |", "", + "**Return type**", + "", + "string", "", "", ], @@ -84,7 +96,9 @@ Array [ "[ClassDeclaration-0]: index/foo.md#foo", "# foo", "", - "## [Foo][ClassDeclaration-0]", + "## Classes", + "", + "### [Foo][ClassDeclaration-0]", "", "", ],