From 04a0a29aa4367fb9bd28cc30ec8c69c65fc658cd Mon Sep 17 00:00:00 2001 From: Joe DeBruycker Date: Tue, 12 Mar 2019 12:41:26 -0600 Subject: [PATCH 001/231] chore(deps): update yargs to 12.0.2 (#1214) Removes potential security vulnerability: https://snyk.io/test/npm/yargs/9.0.1 --- package.json | 2 +- yarn.lock | 109 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 95 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 6db78d086..5d54838b5 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "vinyl": "^2.1.0", "vinyl-fs": "^3.0.2", "vue-template-compiler": "^2.5.16", - "yargs": "^9.0.1" + "yargs": "^12.0.2" }, "devDependencies": { "babel-core": "^7.0.0-bridge.0", diff --git a/yarn.lock b/yarn.lock index 1e56dcf8b..78243fa62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1462,6 +1462,10 @@ camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" +camelcase@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.2.0.tgz#e7522abda5ed94cc0489e1b8466610e88404cf45" + caniuse-lite@^1.0.30000884: version "1.0.30000885" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000885.tgz#e889e9f8e7e50e769f2a49634c932b8aee622984" @@ -1936,7 +1940,7 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^6.0.5: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" dependencies: @@ -2053,7 +2057,7 @@ decamelize-keys@^1.0.0: decamelize "^1.1.0" map-obj "^1.0.0" -decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2: +decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -2486,6 +2490,18 @@ execa@^0.9.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" @@ -2873,6 +2889,12 @@ get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + dependencies: + pump "^3.0.0" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -3329,6 +3351,10 @@ invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" +invert-kv@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" + ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" @@ -4256,6 +4282,12 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" +lcid@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" + dependencies: + invert-kv "^2.0.0" + lead@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lead/-/lead-1.0.0.tgz#6f14f99a37be3a9dd784f5495690e5903466ee42" @@ -4501,6 +4533,12 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" +map-age-cleaner@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + dependencies: + p-defer "^1.0.0" + map-cache@^0.2.0, map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -4587,6 +4625,14 @@ mem@^1.1.0: dependencies: mimic-fn "^1.0.0" +mem@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-4.1.0.tgz#aeb9be2d21f47e78af29e4ac5978e8afa2ca5b8a" + dependencies: + map-age-cleaner "^0.1.1" + mimic-fn "^1.0.0" + p-is-promise "^2.0.0" + meow@^3.3.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" @@ -5104,6 +5150,14 @@ os-locale@^2.0.0: lcid "^1.0.0" mem "^1.1.0" +os-locale@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" + dependencies: + execa "^1.0.0" + lcid "^2.0.0" + mem "^4.0.0" + os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -5115,6 +5169,10 @@ osenv@^0.1.4: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + p-event@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-event/-/p-event-2.1.0.tgz#74de477a4e6b3aa8267240c7099e78ac52cb4db4" @@ -5125,6 +5183,10 @@ p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" +p-is-promise@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.0.0.tgz#7554e3d572109a87e1f3f53f6a7d85d1b194f4c5" + p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -5422,6 +5484,13 @@ pump@^2.0.0: end-of-stream "^1.1.0" once "^1.3.1" +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + pumpify@^1.3.5: version "1.5.1" resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" @@ -7093,6 +7162,10 @@ y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" +"y18n@^3.2.1 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" @@ -7101,6 +7174,13 @@ yallist@^3.0.0, yallist@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" +yargs-parser@^11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" @@ -7130,27 +7210,26 @@ yargs@^11.0.0: y18n "^3.2.1" yargs-parser "^9.0.2" -yargs@^8.0.1: - version "8.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" +yargs@^12.0.2: + version "12.0.5" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" + cliui "^4.0.0" + decamelize "^1.2.0" + find-up "^3.0.0" get-caller-file "^1.0.1" - os-locale "^2.0.0" - read-pkg-up "^2.0.0" + os-locale "^3.0.0" require-directory "^2.1.1" require-main-filename "^1.0.1" set-blocking "^2.0.0" string-width "^2.0.0" which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" + y18n "^3.2.1 || ^4.0.0" + yargs-parser "^11.1.1" -yargs@^9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" +yargs@^8.0.1: + version "8.0.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" dependencies: camelcase "^4.1.0" cliui "^3.2.0" From 15bbc063da8c22bc562236ab3b860b4621e66b27 Mon Sep 17 00:00:00 2001 From: "Yicheng (Jerry) Gong" Date: Tue, 12 Mar 2019 11:42:43 -0700 Subject: [PATCH 002/231] Adding additional cli option, markdown-toc-max-depth for configuring markdown-toc maxDepth (#1215) --- declarations/comment.js | 1 + docs/USAGE.md | 2 ++ src/commands/shared_options.js | 6 ++++++ src/output/markdown_ast.js | 6 +++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/declarations/comment.js b/declarations/comment.js index 3a375077d..741900d02 100644 --- a/declarations/comment.js +++ b/declarations/comment.js @@ -14,6 +14,7 @@ type DocumentationConfig = { parseExtension: Array, noReferenceLinks?: boolean, markdownToc?: boolean, + markdownTocMaxDepth?: number, documentExported?: boolean, resolve?: string, hljs?: Object diff --git a/docs/USAGE.md b/docs/USAGE.md index 14960f983..16789baf6 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -29,6 +29,8 @@ Options: they change [boolean] --markdown-toc include a table of contents in markdown output [boolean] [default: true] + --markdown-toc-max-depth specifies the max depth of the table of contents in markdown output + [number] [default: 6] --shallow shallow mode turns off dependency resolution, only processing the specified files (or the main script specified in package.json) diff --git a/src/commands/shared_options.js b/src/commands/shared_options.js index b8c326306..5dc92fd54 100644 --- a/src/commands/shared_options.js +++ b/src/commands/shared_options.js @@ -123,5 +123,11 @@ module.exports.sharedOutputOptions = { describe: 'include a table of contents in markdown output', default: true, type: 'boolean' + }, + 'markdown-toc-max-depth': { + describe: + 'specifies the max depth of the table of contents in markdown output', + default: 6, + type: 'number' } }; diff --git a/src/output/markdown_ast.js b/src/output/markdown_ast.js index d612b9358..e029819ed 100644 --- a/src/output/markdown_ast.js +++ b/src/output/markdown_ast.js @@ -371,7 +371,11 @@ function buildMarkdownAST(comments, config) { ); const pluginRemark = remark(); - if (config.markdownToc) pluginRemark.use(toc, { tight: true }); + if (config.markdownToc) + pluginRemark.use(toc, { + tight: true, + maxDepth: config.markdownTocMaxDepth + }); if (config.noReferenceLinks !== true) pluginRemark.use(links); root = pluginRemark.run(root); From a4d45833a5c0de58fccb9d70432ec1ee06425dd8 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 12 Mar 2019 11:43:32 -0700 Subject: [PATCH 003/231] chore(release): 9.3.1 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e3bbc621..426e067db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [9.3.1](https://github.com/documentationjs/documentation/compare/v9.3.0...v9.3.1) (2019-03-12) + + + # [9.3.0](https://github.com/documentationjs/documentation/compare/v9.2.1...v9.3.0) (2019-02-27) diff --git a/package.json b/package.json index 5d54838b5..f7e99c05b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "9.3.0", + "version": "9.3.1", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From f3511f9905cb60c61ec95fb19fb8744eb936f063 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 12 Mar 2019 11:47:13 -0700 Subject: [PATCH 004/231] chore(deps): Update highlight.js --- yarn.lock | 732 +++--------------------------------------------------- 1 file changed, 29 insertions(+), 703 deletions(-) diff --git a/yarn.lock b/yarn.lock index 78243fa62..a684d2264 100644 --- a/yarn.lock +++ b/yarn.lock @@ -831,14 +831,6 @@ dependencies: any-observable "^0.3.0" -"@types/node@^10.11.7": - version "10.12.27" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.27.tgz#eb3843f15d0ba0986cc7e4d734d2ee8b50709ef8" - -"@types/semver@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" - JSONStream@^1.0.3: version "1.3.4" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.4.tgz#615bb2adb0cd34c8f4c447b5f6512fa1d8f16a2e" @@ -853,10 +845,6 @@ JSONStream@^1.0.4: jsonparse "^1.2.0" through ">=2.2.7 <3" -abab@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" - abab@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f" @@ -865,12 +853,6 @@ abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" -acorn-globals@^1.0.4: - version "1.0.9" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-1.0.9.tgz#55bb5e98691507b74579d0513413217c380c54cf" - dependencies: - acorn "^2.1.0" - acorn-globals@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.0.tgz#e3b6f8da3c1552a95ae627571f7dd6923bb54103" @@ -888,17 +870,13 @@ acorn-walk@^6.0.1: version "6.1.1" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" -acorn@^2.1.0, acorn@^2.4.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" - acorn@^5.0.3, acorn@^5.2.1, acorn@^5.5.3, acorn@^5.6.0: version "5.7.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" acorn@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.0.tgz#b0a3be31752c97a0f7013c5f4903b71a05db6818" + version "6.1.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" ajv-keywords@^3.0.0: version "3.2.0" @@ -914,18 +892,14 @@ ajv@^6.0.1, ajv@^6.5.3: uri-js "^4.2.2" ajv@^6.5.5: - version "6.9.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.9.2.tgz#4927adb83e7f48e5a32b45729744c71ec39c9c7b" + version "6.10.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - ansi-escapes@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" @@ -1048,10 +1022,6 @@ arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" -asn1@0.1.11: - version "0.1.11" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.1.11.tgz#559be18376d08a4ec4dbe80877d27818639b2df7" - asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" @@ -1062,10 +1032,6 @@ assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" -assert-plus@^0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.1.5.tgz#ee74009413002d84cec7219c6ac811812e723160" - assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" @@ -1082,24 +1048,12 @@ async-limiter@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" -async@0.8.x: - version "0.8.0" - resolved "https://registry.yarnpkg.com/async/-/async-0.8.0.tgz#ee65ec77298c2ff1456bc4418a052d0f06435112" - async@^2.1.4, async@^2.5.0: version "2.6.2" resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381" dependencies: lodash "^4.17.11" -async@~0.2.6: - version "0.2.10" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" - -async@~0.9.0: - version "0.9.2" - resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -1108,10 +1062,6 @@ atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" -aws-sign2@~0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.5.0.tgz#c57103f7a17fc037f02d7c2e64b602ea223f7d63" - aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -1314,10 +1264,6 @@ binary-extensions@^1.0.0: version "1.12.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14" -bluebird@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" - body@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/body/-/body-5.1.0.tgz#e4ba0ce410a46936323367609ecb4e6553125069" @@ -1327,13 +1273,7 @@ body@^5.1.0: raw-body "~1.1.0" safe-json-parse "~1.0.1" -boom@0.4.x: - version "0.4.2" - resolved "https://registry.yarnpkg.com/boom/-/boom-0.4.2.tgz#7a636e9ded4efcefb19cef4947a3c67dfaee911b" - dependencies: - hoek "0.9.x" - -brace-expansion@^1.0.0, brace-expansion@^1.1.7: +brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" dependencies: @@ -1450,10 +1390,6 @@ camelcase-keys@^4.0.0: map-obj "^2.0.0" quick-lru "^1.0.0" -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" - camelcase@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" @@ -1574,12 +1510,6 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -clean-css@2.2.x: - version "2.2.23" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-2.2.23.tgz#0590b5478b516c4903edc2d89bd3fdbdd286328c" - dependencies: - commander "2.2.x" - cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" @@ -1603,13 +1533,6 @@ cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" -cli@0.6.x: - version "0.6.6" - resolved "https://registry.yarnpkg.com/cli/-/cli-0.6.6.tgz#02ad44a380abf27adac5e6f0cdd7b043d74c53e3" - dependencies: - exit "0.1.2" - glob "~ 3.2.1" - cliui@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" @@ -1681,30 +1604,16 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -combined-stream@~0.0.4: - version "0.0.7" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-0.0.7.tgz#0137e657baa5a7541c57ac37ac5fc07d73b4dc1f" - dependencies: - delayed-stream "0.0.5" - comma-separated-tokens@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-1.0.5.tgz#b13793131d9ea2d2431cf5b507ddec258f0ce0db" dependencies: trim "0.0.1" -commander@2.2.x: - version "2.2.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.2.0.tgz#175ad4b9317f3ff615f201c1e57224f55a3e91df" - commander@^2.14.1, commander@^2.9.0: version "2.18.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.18.0.tgz#2bf063ddee7c7891176981a2cc798e5754bc6970" -commander@^2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" - commander@~2.17.1: version "2.17.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" @@ -1741,19 +1650,6 @@ concat-stream@~1.5.0: readable-stream "~2.0.0" typedarray "~0.0.5" -config-chain@^1.1.12: - version "1.1.12" - resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" - dependencies: - ini "^1.3.4" - proto-list "~1.2.1" - -console-browserify@1.1.x: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" - dependencies: - date-now "^0.1.4" - console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" @@ -1950,38 +1846,16 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cryptiles@0.2.x: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-0.2.2.tgz#ed91ff1f17ad13d3748288594f8a48a0d26f325c" - dependencies: - boom "0.4.x" - -csslint@0.10.x: - version "0.10.0" - resolved "https://registry.yarnpkg.com/csslint/-/csslint-0.10.0.tgz#3a6a04e7565c8e9d19beb49767c7ec96e8365805" - dependencies: - parserlib "~0.2.2" - -cssom@0.3.x, "cssom@>= 0.3.0 < 0.4.0", "cssom@>= 0.3.2 < 0.4.0": +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.6" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.6.tgz#f85206cee04efa841f3c5982a74ba96ab20d65ad" -"cssstyle@>= 0.2.36 < 0.3.0": - version "0.2.37" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" - dependencies: - cssom "0.3.x" - cssstyle@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.2.1.tgz#3aceb2759eaf514ac1a21628d723d6043a819495" dependencies: cssom "0.3.x" -ctype@0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/ctype/-/ctype-0.5.3.tgz#82c18c2461f74114ef16c135224ad0b9144ca12f" - currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" @@ -2022,10 +1896,6 @@ date-fns@^1.27.2: version "1.29.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" -date-now@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" - dateformat@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" @@ -2046,10 +1916,6 @@ debug@^3.1.0: dependencies: ms "^2.1.1" -debug@~0.7.0: - version "0.7.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39" - decamelize-keys@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" @@ -2057,7 +1923,7 @@ decamelize-keys@^1.0.0: decamelize "^1.1.0" map-obj "^1.0.0" -decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: +decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -2124,21 +1990,6 @@ del@^2.0.2: pinkie-promise "^2.0.0" rimraf "^2.2.8" -del@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" - dependencies: - globby "^6.1.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - p-map "^1.1.1" - pify "^3.0.0" - rimraf "^2.2.8" - -delayed-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-0.0.5.tgz#d4b1f43a93e8296dfe02694f4680bc37a313c73f" - delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -2205,36 +2056,12 @@ documentation-schema@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/documentation-schema/-/documentation-schema-0.0.1.tgz#6ee05b47b08a04d024132d75893d378a36572209" -dom-serializer@0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" - dependencies: - domelementtype "^1.3.0" - entities "^1.1.1" - -domelementtype@1, domelementtype@^1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" - domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" dependencies: webidl-conversions "^4.0.2" -domhandler@2.3: - version "2.3.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" - dependencies: - domelementtype "1" - -domutils@1.5: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - dependencies: - dom-serializer "0" - domelementtype "1" - dot-prop@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177" @@ -2270,17 +2097,6 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -editorconfig@^0.15.2: - version "0.15.2" - resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.2.tgz#047be983abb9ab3c2eefe5199cb2b7c5689f0702" - dependencies: - "@types/node" "^10.11.7" - "@types/semver" "^5.5.0" - commander "^2.19.0" - lru-cache "^4.1.3" - semver "^5.6.0" - sigmund "^1.0.1" - electron-to-chromium@^1.3.62: version "1.3.70" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.70.tgz#ded377256d92d81b4257d36c65aa890274afcfd2" @@ -2299,14 +2115,6 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -entities@1.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" - -entities@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" - error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -2343,7 +2151,7 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" -escodegen@^1.6.1, escodegen@^1.9.1: +escodegen@^1.9.1: version "1.11.1" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510" dependencies: @@ -2506,7 +2314,7 @@ exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" -exit@0.1.2, exit@0.1.x, exit@^0.1.2: +exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -2562,10 +2370,6 @@ extend@^3.0.0, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" -extend@~2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-2.0.2.tgz#1b74985400171b85554894459c978de6ef453ab7" - external-editor@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" @@ -2698,16 +2502,6 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -findup-sync@~0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-0.2.1.tgz#e0a90a450075c49466ee513732057514b81e878c" - dependencies: - glob "~4.3.0" - -flagged-respawn@~0.3.0: - version "0.3.2" - resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-0.3.2.tgz#ff191eddcd7088a675b2610fffc976be9b8074b5" - flat-cache@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" @@ -2734,22 +2528,10 @@ for-own@^0.1.4: dependencies: for-in "^1.0.1" -forever-agent@~0.5.0: - version "0.5.2" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.5.2.tgz#6d0e09c4921f94a27f63d3b49c5feff1ea4c5130" - forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" -form-data@~0.1.0: - version "0.1.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-0.1.4.tgz#91abd788aba9702b1aabfa8bc01031a2ac9e3b12" - dependencies: - async "~0.9.0" - combined-stream "~0.0.4" - mime "~1.2.11" - form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -2830,31 +2612,6 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -gear-lib@^0.9.2: - version "0.9.2" - resolved "https://registry.yarnpkg.com/gear-lib/-/gear-lib-0.9.2.tgz#bc8d461ebc81ecaffe99c1da82abe0f56eb93540" - dependencies: - async "0.8.x" - csslint "0.10.x" - gear ">= 0.8.x" - glob "3.2.x" - handlebars "2.0.x" - jshint "2.5.x" - jslint "0.3.x" - knox "0.8.x" - less "1.7.x" - mime "1.2.x" - uglify-js "2.4.x" - -"gear@>= 0.8.x", gear@^0.9.7: - version "0.9.7" - resolved "https://registry.yarnpkg.com/gear/-/gear-0.9.7.tgz#1ead19eee639319d8e2e655494c61bd8956e777f" - dependencies: - async "0.8.x" - liftoff "2.0.x" - minimist "0.1.x" - mkdirp "0.5.x" - get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" @@ -2989,14 +2746,7 @@ glob-stream@^6.1.0: to-absolute-glob "^2.0.0" unique-stream "^2.0.2" -glob@3.2.x, "glob@~ 3.2.1", glob@~3.2.8: - version "3.2.11" - resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.11.tgz#4a973f635b9190f715d10987d5c00fd2815ebe3d" - dependencies: - inherits "2" - minimatch "0.3" - -glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: +glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" dependencies: @@ -3007,15 +2757,6 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@~4.3.0: - version "4.3.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-4.3.5.tgz#80fbb08ca540f238acce5d11d1e9bc41e75173d3" - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "^2.0.1" - once "^1.3.0" - globals-docs@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/globals-docs/-/globals-docs-2.4.0.tgz#f2c647544eb6161c7c38452808e16e693c2dafbb" @@ -3039,16 +2780,6 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - graceful-fs@^4.0.0, graceful-fs@^4.1.6: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -3057,24 +2788,10 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.15" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" -graceful-fs@~3.0.2: - version "3.0.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.11.tgz#7613c778a1afea62f25c630a086d7f3acbbdd818" - dependencies: - natives "^1.1.0" - growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" -handlebars@2.0.x: - version "2.0.0" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-2.0.0.tgz#6e9d7f8514a3467fa5e9f82cc158ecfc1d5ac76f" - dependencies: - optimist "~0.3" - optionalDependencies: - uglify-js "~2.3" - handlebars@^4.0.2, handlebars@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.0.tgz#0d6a6f34ff1f63cecec8423aa4169827bf787c3a" @@ -3180,37 +2897,13 @@ hast-util-whitespace@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.1.tgz#d67da2c87637b1ce1d85dd15b270ba057930149a" -hawk@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-1.1.1.tgz#87cd491f9b46e4e2aeaca335416766885d2d1ed9" - dependencies: - boom "0.4.x" - cryptiles "0.2.x" - hoek "0.9.x" - sntp "0.2.x" - he@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" highlight.js@^9.15.5: - version "9.15.5" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.5.tgz#636ac5a95b9309c6a0a28c3707e8d3e6d2c7d729" - dependencies: - bluebird "^3.5.3" - commander "^2.19.0" - del "^3.0.0" - gear "^0.9.7" - gear-lib "^0.9.2" - glob "^7.1.3" - js-beautify "^1.8.9" - jsdom "9.2.1" - lodash "^4.17.11" - tiny-worker "^2.1.2" - -hoek@0.9.x: - version "0.9.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-0.9.1.tgz#3d322462badf07716ea7eb85baf88079cddce505" + version "9.15.6" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.6.tgz#72d4d8d779ec066af9a17cb14360c3def0aa57c4" home-or-tmp@^2.0.0: version "2.0.0" @@ -3233,28 +2926,10 @@ html-void-elements@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-1.0.3.tgz#956707dbecd10cf658c92c5d27fee763aa6aa982" -htmlparser2@3.8.x: - version "3.8.3" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.8.3.tgz#996c28b191516a8be86501a7d79757e5c70c1068" - dependencies: - domelementtype "1" - domhandler "2.3" - domutils "1.5" - entities "1.0" - readable-stream "1.1" - http-parser-js@>=0.4.0: version "0.4.13" resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.13.tgz#3bd6d6fde6e3172c9334c3b33b6c193d80fe1137" -http-signature@~0.10.0: - version "0.10.1" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-0.10.1.tgz#4fbdac132559aa8323121e540779c0a012b27e66" - dependencies: - asn1 "0.1.11" - assert-plus "^0.1.5" - ctype "0.5.3" - http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" @@ -3271,7 +2946,7 @@ husky@^0.14.3: normalize-path "^1.0.0" strip-indent "^2.0.0" -iconv-lite@0.4.24, iconv-lite@^0.4.13, iconv-lite@^0.4.24, iconv-lite@^0.4.4: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" dependencies: @@ -3319,7 +2994,7 @@ inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -ini@^1.3.2, ini@^1.3.3, ini@^1.3.4, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.3, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" @@ -3355,10 +3030,6 @@ invert-kv@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" -ip-regex@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" - is-absolute@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576" @@ -3679,10 +3350,6 @@ is-wsl@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -4058,16 +3725,6 @@ jest@^23.0.0: import-local "^1.0.0" jest-cli "^23.6.0" -js-beautify@^1.8.9: - version "1.8.9" - resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.8.9.tgz#08e3c05ead3ecfbd4f512c3895b1cda76c87d523" - dependencies: - config-chain "^1.1.12" - editorconfig "^0.15.2" - glob "^7.1.3" - mkdirp "~0.5.0" - nopt "~4.0.1" - js-levenshtein@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.3.tgz#3ef627df48ec8cf24bacf05c0f184ff30ef413c5" @@ -4088,8 +3745,8 @@ js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.9.0: esprima "^4.0.0" js-yaml@^3.7.0: - version "3.12.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.1.tgz#295c8632a18a23e054cf5c9d3cecafe678167600" + version "3.12.2" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.2.tgz#ef1d067c5a9d9cb65bd72f285b5d8105c77f14fc" dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -4098,28 +3755,6 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" -jsdom@9.2.1: - version "9.2.1" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.2.1.tgz#061cbccc6e563d14493f653af92eadc3c0d39910" - dependencies: - abab "^1.0.0" - acorn "^2.4.0" - acorn-globals "^1.0.4" - array-equal "^1.0.0" - cssom ">= 0.3.0 < 0.4.0" - cssstyle ">= 0.2.36 < 0.3.0" - escodegen "^1.6.1" - iconv-lite "^0.4.13" - nwmatcher ">= 1.3.7 < 2.0.0" - parse5 "^1.5.1" - request "^2.55.0" - sax "^1.1.4" - symbol-tree ">= 3.1.0 < 4.0.0" - tough-cookie "^2.2.0" - webidl-conversions "^3.0.1" - whatwg-url "^3.0.0" - xml-name-validator ">= 2.0.1 < 3.0.0" - jsdom@^11.5.1: version "11.12.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" @@ -4163,27 +3798,6 @@ jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" -jshint@2.5.x: - version "2.5.11" - resolved "https://registry.yarnpkg.com/jshint/-/jshint-2.5.11.tgz#e2d95858bbb1aa78300108a2e81099fb095622e0" - dependencies: - cli "0.6.x" - console-browserify "1.1.x" - exit "0.1.x" - htmlparser2 "3.8.x" - minimatch "1.0.x" - shelljs "0.3.x" - strip-json-comments "1.0.x" - underscore "1.6.x" - -jslint@0.3.x: - version "0.3.4" - resolved "https://registry.yarnpkg.com/jslint/-/jslint-0.3.4.tgz#fb768ac8de0641fcc570c87ca1fbd28e293c8d75" - dependencies: - nopt "~1.0.0" - optionalDependencies: - glob "~3.2.8" - json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -4206,7 +3820,7 @@ json-stable-stringify@^1.0.0: dependencies: jsonify "~0.0.0" -json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.0, json-stringify-safe@~5.0.1: +json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -4261,15 +3875,6 @@ kleur@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/kleur/-/kleur-2.0.2.tgz#b704f4944d95e255d038f0cb05fb8a602c55a300" -knox@0.8.x: - version "0.8.10" - resolved "https://registry.yarnpkg.com/knox/-/knox-0.8.10.tgz#6a2edcdac1d2ae379d1e1994d559b95c283b2588" - dependencies: - debug "~0.7.0" - mime "*" - stream-counter "~0.1.0" - xml2js "0.2.x" - lazystream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4" @@ -4298,17 +3903,6 @@ left-pad@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" -less@1.7.x: - version "1.7.5" - resolved "https://registry.yarnpkg.com/less/-/less-1.7.5.tgz#4f220cf7288a27eaca739df6e4808a2d4c0d5756" - optionalDependencies: - clean-css "2.2.x" - graceful-fs "~3.0.2" - mime "~1.2.11" - mkdirp "~0.5.0" - request "~2.40.0" - source-map "0.1.x" - leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" @@ -4320,16 +3914,6 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -liftoff@2.0.x: - version "2.0.3" - resolved "https://registry.yarnpkg.com/liftoff/-/liftoff-2.0.3.tgz#fbab25362a506ac28a3db0c55cde9562fbd70456" - dependencies: - extend "~2.0.0" - findup-sync "~0.2.0" - flagged-respawn "~0.3.0" - minimist "~1.1.0" - resolve "~1.1.0" - lint-staged@^7.2.0: version "7.3.0" resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.3.0.tgz#90ff33e5ca61ed3dbac35b6f6502dbefdc0db58d" @@ -4516,11 +4100,7 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lru-cache@2: - version "2.7.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" - -lru-cache@^4.0.1, lru-cache@^4.1.3: +lru-cache@^4.0.1: version "4.1.5" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" dependencies: @@ -4718,18 +4298,6 @@ mime-types@^2.1.12, mime-types@~2.1.19: dependencies: mime-db "~1.38.0" -mime-types@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-1.0.2.tgz#995ae1392ab8affcbfcb2641dd054e943c0d5dce" - -mime@*: - version "2.4.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.0.tgz#e051fd881358585f3279df333fe694da0bcffdd6" - -mime@1.2.x, mime@~1.2.11: - version "1.2.11" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10" - mime@^2.2.0: version "2.3.1" resolved "https://registry.yarnpkg.com/mime/-/mime-2.3.1.tgz#b1621c54d63b97c47d3cfe7f7215f7d64517c369" @@ -4738,26 +4306,6 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" -minimatch@0.3: - version "0.3.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.3.0.tgz#275d8edaac4f1bb3326472089e7949c8394699dd" - dependencies: - lru-cache "2" - sigmund "~1.0.0" - -minimatch@1.0.x: - version "1.0.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-1.0.0.tgz#e0dd2120b49e1b724ce8d714c520822a9438576d" - dependencies: - lru-cache "2" - sigmund "~1.0.0" - -minimatch@^2.0.1: - version "2.0.10" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-2.0.10.tgz#8d087c39c6b38c001b97fca7ce6d0e1e80afbac7" - dependencies: - brace-expansion "^1.0.0" - minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -4775,10 +4323,6 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@0.1.x: - version "0.1.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.1.0.tgz#99df657a52574c21c9057497df742790b2b4c0de" - minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -4787,10 +4331,6 @@ minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" -minimist@~1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.1.3.tgz#3bedfd91a92d39016fcfaa1c681e8faa1a1efda8" - minipass@^2.2.1, minipass@^2.3.4: version "2.3.5" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" @@ -4811,7 +4351,7 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -4876,10 +4416,6 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" -natives@^1.1.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.6.tgz#a603b4a498ab77173612b9ea1acdec4d980f00bb" - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -4931,23 +4467,13 @@ node-releases@^1.0.0-alpha.11: dependencies: semver "^5.3.0" -node-uuid@~1.4.0: - version "1.4.8" - resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.8.tgz#b040eb0923968afabf8d32fb1f17f1167fdab907" - -nopt@^4.0.1, nopt@~4.0.1: +nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" dependencies: abbrev "1" osenv "^0.1.4" -nopt@~1.0.0: - version "1.0.10" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" - dependencies: - abbrev "1" - normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -5021,18 +4547,10 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" -"nwmatcher@>= 1.3.7 < 2.0.0": - version "1.4.4" - resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.4.tgz#2285631f34a95f0d0395cd900c96ed39b58f346e" - nwsapi@^2.0.7: version "2.1.1" resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.1.tgz#08d6d75e69fd791bdea31507ffafe8c843b67e9c" -oauth-sign@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.3.0.tgz#cb540f93bb2b22a7d5941691a288d60e8ea9386e" - oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" @@ -5115,12 +4633,6 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optimist@~0.3, optimist@~0.3.5: - version "0.3.7" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.3.7.tgz#c90941ad59e4273328923074d2cf2e7cbc6ec0d9" - dependencies: - wordwrap "~0.0.2" - optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" @@ -5291,14 +4803,6 @@ parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" -parse5@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" - -parserlib@~0.2.2: - version "0.2.5" - resolved "https://registry.yarnpkg.com/parserlib/-/parserlib-0.2.5.tgz#85907dd8605aa06abb3dd295d50bb2b8fa4dd117" - pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" @@ -5461,10 +4965,6 @@ property-information@^4.0.0: dependencies: xtend "^4.0.1" -proto-list@~1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" - protocols@^1.1.0, protocols@^1.4.0: version "1.4.6" resolved "https://registry.yarnpkg.com/protocols/-/protocols-1.4.6.tgz#f8bb263ea1b5fd7a7604d26b8be39bd77678bf8a" @@ -5515,10 +5015,6 @@ qs@^6.4.0, qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" -qs@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-1.0.2.tgz#50a93e2b5af6691c31bcea5dae78ee6ea1903768" - quick-lru@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" @@ -5599,15 +5095,6 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -readable-stream@1.1: - version "1.1.13" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@~2.3.6: version "2.3.6" resolved "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -5620,15 +5107,6 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@~1.0.2: - version "1.0.34" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readable-stream@~2.0.0: version "2.0.6" resolved "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" @@ -5872,7 +5350,7 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@^2.55.0, request@^2.87.0: +request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" dependencies: @@ -5897,25 +5375,6 @@ request@^2.55.0, request@^2.87.0: tunnel-agent "^0.6.0" uuid "^3.3.2" -request@~2.40.0: - version "2.40.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.40.0.tgz#4dd670f696f1e6e842e66b4b5e839301ab9beb67" - dependencies: - forever-agent "~0.5.0" - json-stringify-safe "~5.0.0" - mime-types "~1.0.1" - node-uuid "~1.4.0" - qs "~1.0.0" - optionalDependencies: - aws-sign2 "~0.5.0" - form-data "~0.1.0" - hawk "1.1.1" - http-signature "~0.10.0" - oauth-sign "~0.3.0" - stringstream "~0.0.4" - tough-cookie ">=0.12.0" - tunnel-agent "~0.4.0" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -5955,7 +5414,7 @@ resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" -resolve@1.1.7, resolve@~1.1.0: +resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -5993,13 +5452,7 @@ right-pad@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" -rimraf@^2.2.8: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -rimraf@^2.5.4, rimraf@^2.6.1: +rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" dependencies: @@ -6054,11 +5507,7 @@ sane@^2.0.0: optionalDependencies: fsevents "^1.2.3" -sax@0.5.x: - version "0.5.8" - resolved "https://registry.yarnpkg.com/sax/-/sax-0.5.8.tgz#d472db228eb331c2506b0e8c15524adb939d12c1" - -sax@^1.1.4, sax@^1.2.4: +sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -6066,7 +5515,7 @@ semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" -"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: version "5.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" @@ -6106,18 +5555,10 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -shelljs@0.3.x: - version "0.3.0" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.3.0.tgz#3596e6307a781544f591f37da618360f31db57b1" - shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" -sigmund@^1.0.1, sigmund@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -6167,12 +5608,6 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -sntp@0.2.x: - version "0.2.4" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-0.2.4.tgz#fb885f18b0f3aad189f824862536bceeec750900" - dependencies: - hoek "0.9.x" - source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" @@ -6190,8 +5625,8 @@ source-map-support@^0.4.15: source-map "^0.5.6" source-map-support@^0.5.6: - version "0.5.10" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.10.tgz#2214080bc9d51832511ee2bab96e3c2f9353120c" + version "0.5.11" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.11.tgz#efac2ce0800355d026326a0ca23e162aeac9a4e2" dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -6200,18 +5635,6 @@ source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" -source-map@0.1.34: - version "0.1.34" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.34.tgz#a7cfe89aec7b1682c3b198d0acfb47d7d090566b" - dependencies: - amdefine ">=0.0.4" - -source-map@0.1.x, source-map@~0.1.7: - version "0.1.43" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" - dependencies: - amdefine ">=0.0.4" - source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -6333,12 +5756,6 @@ stream-combiner2@^1.1.1: duplexer2 "~0.1.0" readable-stream "^2.0.2" -stream-counter@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/stream-counter/-/stream-counter-0.1.0.tgz#a035e429361fb57f361606e17fcd8a8b9677327b" - dependencies: - readable-stream "~1.0.2" - stream-shift@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" @@ -6400,10 +5817,6 @@ stringify-object@^3.2.2: is-obj "^1.0.1" is-regexp "^1.0.0" -stringstream@~0.0.4: - version "0.0.6" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.6.tgz#7880225b0d4ad10e30927d167a1d6f2fd3b33a72" - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -6440,10 +5853,6 @@ strip-indent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" -strip-json-comments@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" - strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -6474,7 +5883,7 @@ symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" -"symbol-tree@>= 3.1.0 < 4.0.0", symbol-tree@^3.2.2: +symbol-tree@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" @@ -6559,10 +5968,6 @@ tiny-lr@^1.1.0: object-assign "^4.1.0" qs "^6.4.0" -tiny-worker@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/tiny-worker/-/tiny-worker-2.1.2.tgz#6feb363b87885582fdc6d91b37fe00dd612b84f2" - tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -6616,15 +6021,7 @@ to-through@^2.0.0: dependencies: through2 "^2.0.3" -tough-cookie@>=0.12.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" - dependencies: - ip-regex "^2.1.0" - psl "^1.1.28" - punycode "^2.1.1" - -tough-cookie@^2.2.0, tough-cookie@^2.3.3, tough-cookie@^2.3.4: +tough-cookie@^2.3.3, tough-cookie@^2.3.4: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" dependencies: @@ -6644,10 +6041,6 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - trim-lines@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/trim-lines/-/trim-lines-1.1.1.tgz#da738ff58fa74817588455e30b11b85289f2a396" @@ -6690,10 +6083,6 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tunnel-agent@~0.4.0: - version "0.4.3" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" - tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" @@ -6708,15 +6097,6 @@ typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -uglify-js@2.4.x: - version "2.4.24" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.4.24.tgz#fad5755c1e1577658bb06ff9ab6e548c95bebd6e" - dependencies: - async "~0.2.6" - source-map "0.1.34" - uglify-to-browserify "~1.0.0" - yargs "~3.5.4" - uglify-js@^3.1.4: version "3.4.9" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" @@ -6724,26 +6104,10 @@ uglify-js@^3.1.4: commander "~2.17.1" source-map "~0.6.1" -uglify-js@~2.3: - version "2.3.6" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.3.6.tgz#fa0984770b428b7a9b2a8058f46355d14fef211a" - dependencies: - async "~0.2.6" - optimist "~0.3.5" - source-map "~0.1.7" - -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" - unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" -underscore@1.6.x: - version "1.6.0" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8" - unherit@^1.0.4: version "1.1.1" resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.1.tgz#132748da3e88eab767e08fabfbb89c5e9d28628c" @@ -7017,10 +6381,6 @@ watch@~0.18.0: exec-sh "^0.2.0" minimist "^1.2.0" -webidl-conversions@^3.0.0, webidl-conversions@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" @@ -7046,13 +6406,6 @@ whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" -whatwg-url@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-3.1.0.tgz#7bdcae490f921aef6451fb6739ec6bbd8e907bf6" - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - whatwg-url@^6.4.1: version "6.5.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" @@ -7085,18 +6438,10 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2 || 2" -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" - word-wrap@^1.0.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" @@ -7140,20 +6485,10 @@ x-is-string@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/x-is-string/-/x-is-string-0.1.0.tgz#474b50865af3a49a9c4657f05acd145458f77d82" -"xml-name-validator@>= 2.0.1 < 3.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" - xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" -xml2js@0.2.x: - version "0.2.8" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.2.8.tgz#9b81690931631ff09d1957549faf54f4f980b3c2" - dependencies: - sax "0.5.x" - xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" @@ -7244,12 +6579,3 @@ yargs@^8.0.1: which-module "^2.0.0" y18n "^3.2.1" yargs-parser "^7.0.0" - -yargs@~3.5.4: - version "3.5.4" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.5.4.tgz#d8aff8f665e94c34bd259bdebd1bfaf0ddd35361" - dependencies: - camelcase "^1.0.2" - decamelize "^1.0.0" - window-size "0.1.0" - wordwrap "0.0.2" From 746d0a96e19a28e1052b318e3446c07803dac149 Mon Sep 17 00:00:00 2001 From: Dougal Graham Date: Wed, 13 Mar 2019 01:48:46 +0700 Subject: [PATCH 005/231] feat: Support custom babel config (#1205) BREAKING CHANGE: this may change babel configuration loading, and is a major change to the documentation.js approach to Babel. --- src/commands/shared_options.js | 6 +++ src/input/dependency.js | 70 ++++++++++++++++------------------ 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/commands/shared_options.js b/src/commands/shared_options.js index 5dc92fd54..6383c2fd9 100644 --- a/src/commands/shared_options.js +++ b/src/commands/shared_options.js @@ -2,6 +2,12 @@ * Adds shared options to any command that runs documentation */ module.exports.sharedInputOptions = { + babel: { + describe: + 'path to babelrc or babel.options.js to override default babel config', + type: 'string', + default: null + }, shallow: { describe: 'shallow mode turns off dependency resolution, ' + diff --git a/src/input/dependency.js b/src/input/dependency.js index 5e7669274..e8f4f99b1 100644 --- a/src/input/dependency.js +++ b/src/input/dependency.js @@ -5,6 +5,35 @@ const concat = require('concat-stream'); const moduleFilters = require('../module_filters'); const smartGlob = require('../smart_glob.js'); +const STANDARD_BABEL_CONFIG = { + sourceMaps: false, + compact: false, + cwd: path.resolve(__dirname, '../../'), + presets: ['@babel/preset-react', '@babel/preset-env', '@babel/preset-flow'], + plugins: [ + // Stage 0 + '@babel/plugin-proposal-function-bind', + // Stage 1 + '@babel/plugin-proposal-export-default-from', + '@babel/plugin-proposal-logical-assignment-operators', + '@babel/plugin-proposal-optional-chaining', + ['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }], + ['@babel/plugin-proposal-nullish-coalescing-operator', { loose: false }], + '@babel/plugin-proposal-do-expressions', + // Stage 2 + ['@babel/plugin-proposal-decorators', { legacy: true }], + '@babel/plugin-proposal-function-sent', + '@babel/plugin-proposal-export-namespace-from', + '@babel/plugin-proposal-numeric-separator', + '@babel/plugin-proposal-throw-expressions', + // Stage 3 + '@babel/plugin-syntax-dynamic-import', + '@babel/plugin-syntax-import-meta', + ['@babel/plugin-proposal-class-properties', { loose: false }], + '@babel/plugin-proposal-json-strings' + ] +}; + /** * Returns a readable stream of dependencies, given an array of entry * points and an object of options to provide to module-deps. @@ -17,6 +46,9 @@ const smartGlob = require('../smart_glob.js'); * @returns results */ function dependencyStream(indexes, config) { + const babelConfig = config.babel + ? { configFile: path.resolve(__dirname, '../../../../', config.babel) } + : STANDARD_BABEL_CONFIG; const md = mdeps({ /** * Determine whether a module should be included in documentation @@ -28,43 +60,7 @@ function dependencyStream(indexes, config) { .concat(config.requireExtension || []) .map(ext => '.' + ext.replace(/^\./, '')) .concat(['.mjs', '.js', '.json', '.es6', '.jsx']), - transform: [ - babelify.configure({ - sourceMaps: false, - compact: false, - cwd: path.resolve(__dirname, '../../'), - presets: [ - '@babel/preset-react', - '@babel/preset-env', - '@babel/preset-flow' - ], - plugins: [ - // Stage 0 - '@babel/plugin-proposal-function-bind', - // Stage 1 - '@babel/plugin-proposal-export-default-from', - '@babel/plugin-proposal-logical-assignment-operators', - '@babel/plugin-proposal-optional-chaining', - ['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }], - [ - '@babel/plugin-proposal-nullish-coalescing-operator', - { loose: false } - ], - '@babel/plugin-proposal-do-expressions', - // Stage 2 - ['@babel/plugin-proposal-decorators', { legacy: true }], - '@babel/plugin-proposal-function-sent', - '@babel/plugin-proposal-export-namespace-from', - '@babel/plugin-proposal-numeric-separator', - '@babel/plugin-proposal-throw-expressions', - // Stage 3 - '@babel/plugin-syntax-dynamic-import', - '@babel/plugin-syntax-import-meta', - ['@babel/plugin-proposal-class-properties', { loose: false }], - '@babel/plugin-proposal-json-strings' - ] - }) - ], + transform: [babelify.configure(babelConfig)], postFilter: moduleFilters.externals(indexes, config), resolve: config.resolve === 'node' && From 13abb9e8fa2b68a7caab69b737e934d60f744522 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 12 Mar 2019 11:51:52 -0700 Subject: [PATCH 006/231] chore(release): 10.0.0-alpha.0 --- CHANGELOG.md | 16 ++++++++++++++++ package.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 426e067db..f4f828d2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [10.0.0-alpha.0](https://github.com/documentationjs/documentation/compare/v9.3.1...v10.0.0-alpha.0) (2019-03-12) + + +### Features + +* Support custom babel config ([#1205](https://github.com/documentationjs/documentation/issues/1205)) ([746d0a9](https://github.com/documentationjs/documentation/commit/746d0a9)) + + +### BREAKING CHANGES + +* this may change babel configuration loading, and is a +major change to the documentation.js approach to Babel. + + + ## [9.3.1](https://github.com/documentationjs/documentation/compare/v9.3.0...v9.3.1) (2019-03-12) diff --git a/package.json b/package.json index f7e99c05b..8ad0a98f1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "9.3.1", + "version": "10.0.0-alpha.0", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From 70081238fb986646e77ecdb65bd938ce0096f5f3 Mon Sep 17 00:00:00 2001 From: Harry <41309736+harrego@users.noreply.github.com> Date: Sat, 16 Mar 2019 17:47:37 +0000 Subject: [PATCH 007/231] docsL Added promises to "recipes" documentation (#1220) * Added promises to recipes docs * Syntax correction --- docs/RECIPES.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/RECIPES.md b/docs/RECIPES.md index 5133e6f0f..7d96eb3c8 100644 --- a/docs/RECIPES.md +++ b/docs/RECIPES.md @@ -174,3 +174,25 @@ The first documentation describes how you can call getTheTime without any arguments, and the second describes how you can call getTheTime with an argument. `documentation` will output two documented functions when you use this style. + +## Promises + +Promises have become a widely used feature in modern JavaScript. They are +documented in a similar manner to arrays: + +```js +/** + * Find a person's phone number in the database + * @param {string} name person's name + * @returns {Promise} promise with the phone number + */ +function findPersonAge(name) { + return new Promise((resolve, reject) => { + db.find({ name: name }) + .then(object => resolve(object.age)) + .catch(err => reject(err)) + }) +} +``` + +Multiple parameters within the `resolve` can be documented like so: `Promise`. From 64ef671d993922821daf8e18d7dc28cdeaa1614a Mon Sep 17 00:00:00 2001 From: Alessandro Grosselle Date: Sat, 16 Mar 2019 18:48:22 +0100 Subject: [PATCH 008/231] feat: Support classPrivateProperties in parser Fixes #1216 --- src/parsers/parse_to_ast.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/parse_to_ast.js b/src/parsers/parse_to_ast.js index 186e3172f..b4d366f09 100644 --- a/src/parsers/parse_to_ast.js +++ b/src/parsers/parse_to_ast.js @@ -8,6 +8,7 @@ const opts = { 'exportDefaultFrom', 'optionalChaining', 'classConstructorCall', + 'classPrivateProperties', 'classProperties', ['decorators', { decoratorsBeforeExport: false }], 'doExpressions', From 03e721f95e04342bdbd24dd7b7d7250d3ebb7057 Mon Sep 17 00:00:00 2001 From: yhor1e Date: Sun, 17 Mar 2019 07:57:15 +0900 Subject: [PATCH 009/231] docs: Fix THEMING.md line number (#1223) --- docs/THEMING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/THEMING.md b/docs/THEMING.md index 4069507e8..636170bab 100644 --- a/docs/THEMING.md +++ b/docs/THEMING.md @@ -29,7 +29,7 @@ for some ideas. - Copy contents of `default_theme` folder (noted above) into a new folder in your project. One way to do it is to create a new git repository with the folder contents and add this line to your `package.json` `devDependencies` section: `"docjs-theme": "my-gh-username/reponame"`. That way when you install dependencies, your new theme will be in the projects `node_modules` folder. -- In the folder you created, replace `require('../')` on lines 10 and 11 of `index.js` with `require('documentation')` and save. +- In the folder you created, replace `require('../')` on lines 8 and 9 of `index.js` with `require('documentation')` and save. - You can now make changes that will show up when you generate your docs using your theme. Example `package.json` `scripts` entry: `"documentation build index.js -f html -o docs --theme node_modules/docjs-theme"` From d1ee0f3983a6cbfb59903aba1bc253118159a211 Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Thu, 18 Apr 2019 09:37:48 -0700 Subject: [PATCH 010/231] Merge explicit and inferred param defaults (#1230) --- __tests__/lib/infer/__snapshots__/params.js.snap | 15 +++++++++++++++ __tests__/lib/infer/params.js | 11 +++++++++++ src/infer/params.js | 4 +++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/__tests__/lib/infer/__snapshots__/params.js.snap b/__tests__/lib/infer/__snapshots__/params.js.snap index 0c7e8dd46..5df1ccc9d 100644 --- a/__tests__/lib/infer/__snapshots__/params.js.snap +++ b/__tests__/lib/infer/__snapshots__/params.js.snap @@ -217,6 +217,21 @@ Array [ ] `; +exports[`inferParams 8`] = ` +Array [ + Object { + "default": "4", + "lineNumber": 1, + "name": "x", + "title": "param", + "type": Object { + "name": "number", + "type": "NameExpression", + }, + }, +] +`; + exports[`mergeTrees 1`] = ` Object { "errors": Array [ diff --git a/__tests__/lib/infer/params.js b/__tests__/lib/infer/params.js index 7647e8d3f..1a7e238df 100644 --- a/__tests__/lib/infer/params.js +++ b/__tests__/lib/infer/params.js @@ -191,4 +191,15 @@ test('inferParams', function() { } `).params ).toEqual([]); + + expect( + evaluate( + ` + /** Test + * @param x + */ + function f(x: number = 4) {} + ` + ).params + ).toMatchSnapshot(); }); diff --git a/src/infer/params.js b/src/infer/params.js index 23754920a..c48a52e93 100644 --- a/src/infer/params.js +++ b/src/infer/params.js @@ -338,7 +338,9 @@ function combineTags(inferredTag, explicitTag) { let defaultValue; if (!explicitTag.type) { type = inferredTag.type; - } else if (!explicitTag.default && inferredTag.default) { + } + + if (!explicitTag.default && inferredTag.default) { defaultValue = inferredTag.default; } From d31c3b70d6a21710e07c865b866e4f931a67c30e Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Wed, 17 Apr 2019 20:45:41 -0700 Subject: [PATCH 011/231] feat: Support async functions --- __tests__/__snapshots__/test.js.snap | 1 + __tests__/lib/infer/kind.js | 19 ++++++++++++------- __tests__/lib/parse.js | 8 ++++++++ src/infer/kind.js | 3 +++ src/parse.js | 1 + 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 9f4ff1567..d496a23b5 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -9823,6 +9823,7 @@ It takes a ", "todos": Array [], }, Object { + "async": true, "augments": Array [], "context": Object { "loc": Object { diff --git a/__tests__/lib/infer/kind.js b/__tests__/lib/infer/kind.js index 854bfc953..448e85354 100644 --- a/__tests__/lib/infer/kind.js +++ b/__tests__/lib/infer/kind.js @@ -82,13 +82,12 @@ test('inferKind', function() { ).kind ).toBe('function'); - expect( - inferKind( - toComment( - '/** Export default function */' + 'export default function foo() {}' - ) - ).kind - ).toBe('function'); + const asyncFunction = inferKind( + toComment('/** Async function */' + 'async function foo() {}') + ); + + expect(asyncFunction.kind).toBe('function'); + expect(asyncFunction.async).toBe(true); expect( inferKind(toComment('class Foo { /** set b */ set b(v) { } }')).kind @@ -106,6 +105,12 @@ test('inferKind', function() { 'function' ); + const asyncMethod = inferKind( + toComment('class Foo { /** b */ async b(v) { } }') + ); + expect(asyncMethod.kind).toBe('function'); + expect(asyncMethod.async).toBe(true); + expect( inferKind( toComment(function() { diff --git a/__tests__/lib/parse.js b/__tests__/lib/parse.js index 6853ba364..7ebfae7a8 100644 --- a/__tests__/lib/parse.js +++ b/__tests__/lib/parse.js @@ -72,6 +72,14 @@ test('parse - @arg', function() {}); test('parse - @argument', function() {}); +test('parse - @async', function() { + expect( + evaluate(function() { + /** @async */ + })[0].async + ).toBe(true); +}); + test('parse - @augments', function() { expect( evaluate(function() { diff --git a/src/infer/kind.js b/src/infer/kind.js index 0314ffd69..303ce1c3c 100644 --- a/src/infer/kind.js +++ b/src/infer/kind.js @@ -25,6 +25,9 @@ function inferKind(comment) { comment.kind = 'class'; } else { comment.kind = 'function'; + if (node.async) { + comment.async = true; + } } } else if (t.isTypeAlias(node)) { comment.kind = 'typedef'; diff --git a/src/parse.js b/src/parse.js index ae9f91e94..880a79558 100644 --- a/src/parse.js +++ b/src/parse.js @@ -23,6 +23,7 @@ const flatteners = { alias: flattenName, arg: synonym('param'), argument: synonym('param'), + async: flattenBoolean, /** * Parse tag * @private From 8e3cd479060b879a2c47ed6a6ba8b55de2ab9a2d Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Wed, 17 Apr 2019 21:17:05 -0700 Subject: [PATCH 012/231] feat: Support generator functions --- __tests__/__snapshots__/index.js.snap | 2 + __tests__/__snapshots__/test.js.snap | 165 ++++++++++++++++++++++++++ __tests__/lib/infer/kind.js | 13 ++ __tests__/lib/parse.js | 56 +++++++++ src/infer/kind.js | 3 + src/parse.js | 24 +++- 6 files changed, 262 insertions(+), 1 deletion(-) diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 109f90e23..0ff049c8b 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -90,6 +90,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -177,6 +178,7 @@ exports[`build 3`] = ` \\"sees\\": [], \\"throws\\": [], \\"todos\\": [], + \\"yields\\": [], \\"name\\": \\"name\\", \\"members\\": { \\"global\\": [], diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index d496a23b5..a99ae50ee 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -176,6 +176,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -277,6 +278,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -453,6 +455,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -554,6 +557,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -797,6 +801,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -969,6 +974,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -1141,6 +1147,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -1322,6 +1329,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -3072,6 +3080,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -3244,6 +3253,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -3336,6 +3346,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -3816,6 +3827,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -3993,6 +4005,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -4092,6 +4105,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -4672,6 +4686,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -4782,6 +4797,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -4982,6 +4998,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -5001,6 +5018,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5058,6 +5076,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5149,6 +5168,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5207,6 +5227,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5271,6 +5292,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [ @@ -5331,6 +5353,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5389,6 +5412,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5453,6 +5477,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], }, @@ -5481,6 +5506,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5536,6 +5562,7 @@ Array [ "name": "boolean", "type": "NameExpression", }, + "yields": Array [], }, Object { "augments": Array [], @@ -5585,6 +5612,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5704,6 +5732,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5794,6 +5823,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5851,6 +5881,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5914,6 +5945,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -5969,6 +6001,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -6026,6 +6059,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], }, @@ -6043,6 +6077,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -6094,6 +6129,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -6145,6 +6181,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -6200,6 +6237,7 @@ Array [ "name": "number", "type": "NameExpression", }, + "yields": Array [], }, Object { "augments": Array [], @@ -6255,6 +6293,7 @@ Array [ "name": "string", "type": "NameExpression", }, + "yields": Array [], }, Object { "augments": Array [], @@ -6310,6 +6349,7 @@ Array [ "name": "string", "type": "NameExpression", }, + "yields": Array [], }, Object { "augments": Array [], @@ -6371,6 +6411,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -6461,6 +6502,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], }, @@ -6478,6 +6520,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -6590,6 +6633,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -6680,6 +6724,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], }, @@ -6697,6 +6742,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -7609,6 +7655,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -7666,6 +7713,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -7754,6 +7802,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -7923,6 +7972,7 @@ have any parameter descriptions.", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -8062,6 +8112,7 @@ have any parameter descriptions.", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -8329,6 +8380,7 @@ have any parameter descriptions.", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -8530,6 +8582,7 @@ class A { "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -8639,6 +8692,7 @@ class A { "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -8766,6 +8820,7 @@ class A { "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -8880,6 +8935,7 @@ as a property.", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [ @@ -8991,6 +9047,7 @@ as a property.", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], }, @@ -9162,6 +9219,7 @@ class A { ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -9334,6 +9392,7 @@ class A { ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -9595,6 +9654,7 @@ It takes a ", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -9706,6 +9766,7 @@ It takes a ", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -9821,6 +9882,7 @@ It takes a ", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "async": true, @@ -9924,6 +9986,7 @@ It takes a ", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -10096,6 +10159,7 @@ It takes a ", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -10205,6 +10269,7 @@ It takes a ", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "access": "protected", @@ -10314,6 +10379,7 @@ It takes a ", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "access": "public", @@ -10423,6 +10489,7 @@ It takes a ", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -10523,6 +10590,7 @@ It takes a ", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -10701,6 +10769,7 @@ It takes a ", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -10821,6 +10890,7 @@ It takes a ", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -13459,6 +13529,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -13664,6 +13735,7 @@ Array [ "name": "string", "type": "NameExpression", }, + "yields": Array [], }, ], "static": Array [], @@ -13704,6 +13776,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -13834,6 +13907,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -14461,6 +14535,7 @@ Array [ "name": "boolean", "type": "NameExpression", }, + "yields": Array [], }, Object { "augments": Array [], @@ -14590,6 +14665,7 @@ Array [ "name": "string", "type": "NameExpression", }, + "yields": Array [], }, ], "static": Array [], @@ -14609,6 +14685,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -14879,6 +14956,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -15124,6 +15202,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -15224,6 +15303,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -15396,6 +15476,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -15986,6 +16067,7 @@ Array [ "name": "Object", "type": "NameExpression", }, + "yields": Array [], }, ] `; @@ -16471,6 +16553,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -16813,6 +16896,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -17083,6 +17167,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -17142,6 +17227,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -17265,6 +17351,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -17594,6 +17681,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -17775,6 +17863,7 @@ Array [ }, "type": "FunctionType", }, + "yields": Array [], }, Object { "augments": Array [], @@ -17912,6 +18001,7 @@ Array [ }, "type": "FunctionType", }, + "yields": Array [], }, Object { "augments": Array [], @@ -18049,6 +18139,7 @@ Array [ }, "type": "FunctionType", }, + "yields": Array [], }, ] `; @@ -18619,6 +18710,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -18638,6 +18730,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -18854,6 +18947,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -18913,6 +19007,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -19249,6 +19344,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -19675,6 +19771,7 @@ and ", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -20370,6 +20467,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -20692,6 +20790,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -20989,6 +21088,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -21240,6 +21340,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -21491,6 +21592,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -21525,6 +21627,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -22176,6 +22279,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -22262,6 +22366,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -22832,6 +22937,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [ @@ -23011,6 +23117,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], }, @@ -23042,6 +23149,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -23703,6 +23811,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -24412,6 +24521,7 @@ Array [ "throws": Array [], "todos": Array [], "version": "1.0.0", + "yields": Array [], }, ] `; @@ -25061,6 +25171,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -25303,6 +25414,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -26206,6 +26318,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -27105,6 +27218,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -27577,6 +27691,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -28686,6 +28801,7 @@ still work in the markdown table.", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -28973,6 +29089,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -29194,6 +29311,7 @@ Array [ ], "type": "RecordType", }, + "yields": Array [], }, ] `; @@ -29597,6 +29715,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -29798,6 +29917,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -29922,6 +30042,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -30188,6 +30309,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -30207,6 +30329,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -30405,6 +30528,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], }, @@ -30422,6 +30546,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -30879,6 +31004,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -31429,6 +31555,7 @@ The latter is preferable in case of large GeoJSON files.", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -31679,6 +31806,7 @@ values specified in code.", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -31852,6 +31980,7 @@ or any type information we could infer from annotations.", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -32217,6 +32346,7 @@ iterator destructure (RestElement)", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -34903,6 +35033,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -35101,6 +35232,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -35210,6 +35342,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -35357,6 +35490,7 @@ that doesn't crash anything!", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -35376,6 +35510,7 @@ that doesn't crash anything!", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -35575,6 +35710,7 @@ that doesn't crash anything!", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -35695,6 +35831,7 @@ that doesn't crash anything!", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -35714,6 +35851,7 @@ that doesn't crash anything!", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -35816,6 +35954,7 @@ that doesn't crash anything!", "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -36435,6 +36574,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -36820,6 +36960,7 @@ plus 3.", ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -37083,6 +37224,7 @@ plus 3.", "name": "Function", "type": "NameExpression", }, + "yields": Array [], }, ] `; @@ -37741,6 +37883,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -38178,6 +38321,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -38508,6 +38652,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -38566,6 +38711,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -38624,6 +38770,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -38682,6 +38829,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -38701,6 +38849,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -38792,6 +38941,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -38850,6 +39000,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -38908,6 +39059,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -38966,6 +39118,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -38985,6 +39138,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -39036,6 +39190,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -39087,6 +39242,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -39285,6 +39441,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -39393,6 +39550,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -39526,6 +39684,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -39666,6 +39825,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -39698,6 +39858,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, Object { "augments": Array [], @@ -39838,6 +39999,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ], "static": Array [], @@ -39870,6 +40032,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -40285,6 +40448,7 @@ Array [ ], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; @@ -40538,6 +40702,7 @@ Array [ "tags": Array [], "throws": Array [], "todos": Array [], + "yields": Array [], }, ] `; diff --git a/__tests__/lib/infer/kind.js b/__tests__/lib/infer/kind.js index 448e85354..64212772c 100644 --- a/__tests__/lib/infer/kind.js +++ b/__tests__/lib/infer/kind.js @@ -89,6 +89,13 @@ test('inferKind', function() { expect(asyncFunction.kind).toBe('function'); expect(asyncFunction.async).toBe(true); + const generatorFunction = inferKind( + toComment('/** Generator function */' + 'function *foo() {}') + ); + + expect(generatorFunction.kind).toBe('function'); + expect(generatorFunction.generator).toBe(true); + expect( inferKind(toComment('class Foo { /** set b */ set b(v) { } }')).kind ).toBe('member'); @@ -111,6 +118,12 @@ test('inferKind', function() { expect(asyncMethod.kind).toBe('function'); expect(asyncMethod.async).toBe(true); + const generatorMethod = inferKind( + toComment('class Foo { /** b */ *b(v) { } }') + ); + expect(generatorMethod.kind).toBe('function'); + expect(generatorMethod.generator).toBe(true); + expect( inferKind( toComment(function() { diff --git a/__tests__/lib/parse.js b/__tests__/lib/parse.js index 7ebfae7a8..6eb7f643f 100644 --- a/__tests__/lib/parse.js +++ b/__tests__/lib/parse.js @@ -460,6 +460,14 @@ test('parse - @function', function() { ).toBeUndefined(); }); +test('parse - @generator', function() { + expect( + evaluate(function() { + /** @generator */ + })[0].generator + ).toBe(true); +}); + test('parse - @global', function() { expect( evaluate(function() { @@ -1050,6 +1058,54 @@ test('parse - @version', function() {}); test('parse - @virtual', function() {}); +test('parse - @yield', function() { + expect( + evaluate(function() { + /** @yield test */ + })[0].yields[0] + ).toEqual({ + title: 'yields', + description: remark().parse('test') + }); + + expect( + evaluate(function() { + /** @yield {number} test */ + })[0].yields[0] + ).toEqual({ + description: remark().parse('test'), + title: 'yields', + type: { + name: 'number', + type: 'NameExpression' + } + }); +}); + +test('parse - @yields', function() { + expect( + evaluate(function() { + /** @yields test */ + })[0].yields[0] + ).toEqual({ + title: 'yields', + description: remark().parse('test') + }); + + expect( + evaluate(function() { + /** @yields {number} test */ + })[0].yields[0] + ).toEqual({ + description: remark().parse('test'), + title: 'yields', + type: { + name: 'number', + type: 'NameExpression' + } + }); +}); + test('parse - unknown tag', function() { expect( evaluate(function() { diff --git a/src/infer/kind.js b/src/infer/kind.js index 303ce1c3c..5ab86850e 100644 --- a/src/infer/kind.js +++ b/src/infer/kind.js @@ -28,6 +28,9 @@ function inferKind(comment) { if (node.async) { comment.async = true; } + if (node.generator) { + comment.generator = true; + } } } else if (t.isTypeAlias(node)) { comment.kind = 'typedef'; diff --git a/src/parse.js b/src/parse.js index 880a79558..c67d180a8 100644 --- a/src/parse.js +++ b/src/parse.js @@ -158,6 +158,7 @@ const flatteners = { fires: todo, func: synonym('function'), function: flattenKindShorthand, + generator: flattenBoolean, /** * Parse tag * @private @@ -401,7 +402,27 @@ const flatteners = { result.variation = tag.variation; }, version: flattenDescription, - virtual: synonym('abstract') + virtual: synonym('abstract'), + yield: synonym('yields'), + /** + * Parse tag + * @private + * @param {Object} result target comment + * @param {Object} tag the tag + * @returns {undefined} has side-effects + */ + yields(result, tag) { + const yields = { + description: parseMarkdown(tag.description), + title: 'yields' + }; + + if (tag.type) { + yields.type = tag.type; + } + + result.yields.push(yields); + } }; /** @@ -593,6 +614,7 @@ function parseJSDoc(comment, loc, context) { result.sees = []; result.throws = []; result.todos = []; + result.yields = []; if (result.description) { result.description = parseMarkdown(result.description); From 7947e974d818dd3338fc1e61c39944b08276a39f Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Wed, 17 Apr 2019 21:47:11 -0700 Subject: [PATCH 013/231] feat: Add flow inference for generators --- __tests__/lib/infer/return.js | 22 ++++++++++++++++++++++ src/infer/return.js | 19 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/__tests__/lib/infer/return.js b/__tests__/lib/infer/return.js index 979d640b0..6c7be8135 100644 --- a/__tests__/lib/infer/return.js +++ b/__tests__/lib/infer/return.js @@ -41,4 +41,26 @@ test('inferReturn', function() { name: 'string', type: 'NameExpression' }); + const generatorFn = evaluate( + '/** */function *a(): Generator {}' + ); + expect(generatorFn.generator).toBe(true); + expect(generatorFn.yields).toEqual([ + { + title: 'yields', + type: { + name: 'Foo', + type: 'NameExpression' + } + } + ]); + expect(generatorFn.returns).toEqual([ + { + title: 'returns', + type: { + name: 'Bar', + type: 'NameExpression' + } + } + ]); }); diff --git a/src/infer/return.js b/src/infer/return.js index c192307a5..0cb929194 100644 --- a/src/infer/return.js +++ b/src/infer/return.js @@ -30,10 +30,27 @@ function inferReturn(comment) { } if (t.isFunction(fn) && fn.returnType && fn.returnType.typeAnnotation) { - const returnType = flowDoctrine(fn.returnType.typeAnnotation); + let returnType = flowDoctrine(fn.returnType.typeAnnotation); if (comment.returns && comment.returns.length > 0) { comment.returns[0].type = returnType; } else { + if ( + fn.generator && + returnType.type === 'TypeApplication' && + returnType.expression.name === 'Generator' && + returnType.applications.length === 3 + ) { + comment.generator = true; + comment.yields = [ + { + title: 'yields', + type: returnType.applications[0] + } + ]; + + returnType = returnType.applications[1]; + } + comment.returns = [ { title: 'returns', From 15235339f315504a1829583aa066308fd0242037 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 18 Apr 2019 09:43:50 -0700 Subject: [PATCH 014/231] chore(deps): Update doctrine --- package.json | 2 +- yarn.lock | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8ad0a98f1..3ced2d893 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "chokidar": "^2.0.4", "concat-stream": "^1.6.0", "disparity": "^2.0.0", - "doctrine-temporary-fork": "2.0.1", + "doctrine-temporary-fork": "2.1.0", "get-port": "^4.0.0", "git-url-parse": "^10.0.1", "github-slugger": "1.2.0", diff --git a/yarn.lock b/yarn.lock index a684d2264..0aa6355a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2040,9 +2040,10 @@ disparity@^2.0.0: ansi-styles "^2.0.1" diff "^1.3.2" -doctrine-temporary-fork@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/doctrine-temporary-fork/-/doctrine-temporary-fork-2.0.1.tgz#23f0b6275c65f48893324b02338178e496b2e4bf" +doctrine-temporary-fork@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine-temporary-fork/-/doctrine-temporary-fork-2.1.0.tgz#36f2154f556ee4f1e60311d391cd23de5187ed57" + integrity sha512-nliqOv5NkE4zMON4UA6AMJE6As35afs8aYXATpU4pTUdIKiARZwrJVEP1boA3Rx1ZXHVkwxkhcq4VkqvsuRLsA== dependencies: esutils "^2.0.2" From c5af10878897636ccdb40fef686a03ff64e90d9a Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 18 Apr 2019 09:44:35 -0700 Subject: [PATCH 015/231] chore(deps): Update husky --- package.json | 8 +++- yarn.lock | 104 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 99 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 3ced2d893..50a8184ec 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "eslint": "^5.0.1", "eslint-config-prettier": "^3.0.1", "fs-extra": "^7.0.0", - "husky": "^0.14.3", + "husky": "^1.3.1", "jest": "^23.0.0", "json-schema": "0.2.3", "lint-staged": "^7.2.0", @@ -110,7 +110,6 @@ "scripts": { "build": "npm run doc", "release": "standard-version", - "precommit": "lint-staged", "prepublish": "npm run build", "format": "prettier --write '{src,__tests__,declarations,bin,default_theme}/**/*.js'", "doc": "node ./bin/documentation.js build src/index.js -f md --access=public > docs/NODE_API.md", @@ -145,5 +144,10 @@ "ignore": [ "remote-origin-url" ] + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } } } diff --git a/yarn.lock b/yarn.lock index 0aa6355a8..07fd53a21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1361,12 +1361,26 @@ cached-path-relative@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.1.tgz#d09c4b52800aa4c078e2dd81a869aac90d2e54e7" +caller-callsite@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" + integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= + dependencies: + callsites "^2.0.0" + caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" dependencies: callsites "^0.2.0" +caller-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" + integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= + dependencies: + caller-callsite "^2.0.0" + callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" @@ -1497,6 +1511,11 @@ ci-info@^1.5.0: version "1.6.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" @@ -1828,6 +1847,16 @@ cosmiconfig@^5.0.2: js-yaml "^3.9.0" parse-json "^4.0.0" +cosmiconfig@^5.0.7: + version "5.2.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.0.tgz#45038e4d28a7fe787203aede9c25bca4a08b12c8" + integrity sha512-nxt+Nfc3JAqf4WIWd0jXLjTJZmsPLrA9DDc4nRw2KFJQJK7DNooqSXrNI7tzLG50CF8axczly5UV929tBmh/7g== + dependencies: + import-fresh "^2.0.0" + is-directory "^0.3.1" + js-yaml "^3.13.0" + parse-json "^4.0.0" + cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" @@ -2939,13 +2968,21 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -husky@^0.14.3: - version "0.14.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" +husky@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-1.3.1.tgz#26823e399300388ca2afff11cfa8a86b0033fae0" + integrity sha512-86U6sVVVf4b5NYSZ0yvv88dRgBSSXXmHaiq5pP4KDj5JVzdwKgBjEtUPOm8hcoytezFwbU+7gotXNhpHdystlg== dependencies: - is-ci "^1.0.10" - normalize-path "^1.0.0" - strip-indent "^2.0.0" + cosmiconfig "^5.0.7" + execa "^1.0.0" + find-up "^3.0.0" + get-stdin "^6.0.0" + is-ci "^2.0.0" + pkg-dir "^3.0.0" + please-upgrade-node "^3.1.1" + read-pkg "^4.0.1" + run-node "^1.0.0" + slash "^2.0.0" iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" @@ -2963,6 +3000,14 @@ ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" +import-fresh@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" + integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= + dependencies: + caller-path "^2.0.0" + resolve-from "^3.0.0" + import-local@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" @@ -3093,6 +3138,13 @@ is-ci@^1.0.10: dependencies: ci-info "^1.5.0" +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -3745,6 +3797,14 @@ js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.9.0: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^3.13.0: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + js-yaml@^3.7.0: version "3.12.2" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.2.tgz#ef1d067c5a9d9cb65bd72f285b5d8105c77f14fc" @@ -4484,10 +4544,6 @@ normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" - normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -4900,7 +4956,14 @@ pkg-dir@^2.0.0: dependencies: find-up "^2.1.0" -please-upgrade-node@^3.0.2: +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" dependencies: @@ -5096,6 +5159,15 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" +read-pkg@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237" + integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc= + dependencies: + normalize-package-data "^2.3.2" + parse-json "^4.0.0" + pify "^3.0.0" + readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@~2.3.6: version "2.3.6" resolved "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -5469,6 +5541,11 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +run-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== + rxjs@^6.1.0: version "6.3.2" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.2.tgz#6a688b16c4e6e980e62ea805ec30648e1c60907f" @@ -5572,6 +5649,11 @@ slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" From 6d95e8f4dd3478b9a8ada9d2ac42fcec9d4c2bda Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 18 Apr 2019 09:49:11 -0700 Subject: [PATCH 016/231] chore(release): 10.0.0 --- CHANGELOG.md | 13 +++++++++++++ package.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4f828d2d..2651dbf13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [10.0.0](https://github.com/documentationjs/documentation/compare/v10.0.0-alpha.0...v10.0.0) (2019-04-18) + + +### Features + +* Add flow inference for generators ([7947e97](https://github.com/documentationjs/documentation/commit/7947e97)) +* Support async functions ([d31c3b7](https://github.com/documentationjs/documentation/commit/d31c3b7)) +* Support classPrivateProperties in parser ([64ef671](https://github.com/documentationjs/documentation/commit/64ef671)), closes [#1216](https://github.com/documentationjs/documentation/issues/1216) +* Support generator functions ([8e3cd47](https://github.com/documentationjs/documentation/commit/8e3cd47)) + + + # [10.0.0-alpha.0](https://github.com/documentationjs/documentation/compare/v9.3.1...v10.0.0-alpha.0) (2019-03-12) diff --git a/package.json b/package.json index 50a8184ec..c2843043c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "10.0.0-alpha.0", + "version": "10.0.0", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From 3773e02949ef1a190d9631f5632ccfded48e0fd4 Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Thu, 18 Apr 2019 11:25:55 -0700 Subject: [PATCH 017/231] feat: TypeScript support & inference --- __tests__/__snapshots__/index.js.snap | 2 + __tests__/__snapshots__/test.js.snap | 814 +++++++++++++++--- __tests__/fixture/class.input.js | 1 + __tests__/fixture/interface.input.js | 2 + __tests__/fixture/vue.input.vue | 1 + .../lib/infer/__snapshots__/params.js.snap | 296 +++++++ __tests__/lib/infer/access.js | 63 +- __tests__/lib/infer/augments.js | 26 +- __tests__/lib/infer/implements.js | 57 ++ __tests__/lib/infer/kind.js | 63 ++ __tests__/lib/infer/membership.js | 178 ++++ __tests__/lib/infer/name.js | 6 + __tests__/lib/infer/params.js | 83 ++ __tests__/lib/infer/properties.js | 69 +- __tests__/lib/infer/return.js | 103 ++- __tests__/lib/infer/type.js | 196 ++++- __tests__/lib/parse.js | 29 +- __tests__/lib/parsers/parse_to_ast.js | 2 +- __tests__/lib/ts_doctrine.js | 407 +++++++++ declarations/comment.js | 7 +- src/extractors/exported.js | 2 +- src/index.js | 2 + src/infer/access.js | 12 +- src/infer/augments.js | 2 +- src/infer/finders.js | 2 +- src/infer/implements.js | 38 + src/infer/kind.js | 30 +- src/infer/membership.js | 98 ++- src/infer/params.js | 59 +- src/infer/properties.js | 24 +- src/infer/return.js | 78 +- src/infer/type.js | 36 +- src/parse.js | 17 +- src/parsers/javascript.js | 2 +- src/parsers/parse_to_ast.js | 54 +- src/ts_doctrine.js | 178 ++++ src/type_annotation.js | 21 + 37 files changed, 2789 insertions(+), 271 deletions(-) create mode 100644 __tests__/lib/infer/implements.js create mode 100644 __tests__/lib/ts_doctrine.js create mode 100644 src/infer/implements.js create mode 100644 src/ts_doctrine.js create mode 100644 src/type_annotation.js diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 0ff049c8b..bcf9e7aa9 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -58,6 +58,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": SourceLocation { "end": Position { "column": 9, @@ -172,6 +173,7 @@ exports[`build 3`] = ` }, \\"augments\\": [], \\"examples\\": [], + \\"implements\\": [], \\"params\\": [], \\"properties\\": [], \\"returns\\": [], diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index a99ae50ee..e67531100 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -74,6 +74,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "loc": SourceLocation { "end": Position { "column": 3, @@ -244,8 +245,14 @@ Array [ }, "type": "root", }, - "errors": Array [], + "errors": Array [ + Object { + "commentLineNumber": 0, + "message": "@memberof reference to .props not found", + }, + ], "examples": Array [], + "implements": Array [], "loc": SourceLocation { "end": Position { "column": 7, @@ -256,6 +263,7 @@ Array [ "line": 10, }, }, + "memberof": ".props", "members": Object { "events": Array [], "global": Array [], @@ -264,16 +272,18 @@ Array [ "static": Array [], }, "name": "myNumber", - "namespace": "myNumber", + "namespace": ".myNumber", "params": Array [], "path": Array [ Object { "kind": undefined, "name": "myNumber", + "scope": "static", }, ], "properties": Array [], "returns": Array [], + "scope": "static", "sees": Array [], "tags": Array [], "throws": Array [], @@ -291,7 +301,7 @@ Array [ "loc": SourceLocation { "end": Position { "column": 1, - "line": 19, + "line": 20, }, "start": Position { "column": 0, @@ -353,6 +363,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": SourceLocation { "end": Position { "column": 3, @@ -462,12 +473,12 @@ Array [ "context": Object { "loc": SourceLocation { "end": Position { - "column": 3, - "line": 17, + "column": 1, + "line": 19, }, "start": Position { - "column": 2, - "line": 14, + "column": 0, + "line": 10, }, }, }, @@ -478,9 +489,9 @@ Array [ Object { "position": Position { "end": Object { - "column": 17, + "column": 6, "line": 1, - "offset": 16, + "offset": 5, }, "indent": Array [], "start": Object { @@ -490,14 +501,14 @@ Array [ }, }, "type": "text", - "value": "This is a number", + "value": "props", }, ], "position": Position { "end": Object { - "column": 17, + "column": 6, "line": 1, - "offset": 16, + "offset": 5, }, "indent": Array [], "start": Object { @@ -511,9 +522,9 @@ Array [ ], "position": Object { "end": Object { - "column": 17, + "column": 6, "line": 1, - "offset": 16, + "offset": 5, }, "start": Object { "column": 1, @@ -523,36 +534,157 @@ Array [ }, "type": "root", }, - "errors": Array [], + "errors": Array [ + Object { + "commentLineNumber": 0, + "message": "@memberof reference to vue.input not found", + }, + ], "examples": Array [], + "implements": Array [], "loc": SourceLocation { "end": Position { - "column": 5, - "line": 13, + "column": 12, + "line": 9, }, "start": Position { - "column": 2, - "line": 11, + "column": 0, + "line": 9, }, }, + "memberof": "vue.input", "members": Object { "events": Array [], "global": Array [], "inner": Array [], "instance": Array [], - "static": Array [], + "static": Array [ + Object { + "augments": Array [], + "context": Object { + "loc": SourceLocation { + "end": Position { + "column": 3, + "line": 18, + }, + "start": Position { + "column": 2, + "line": 15, + }, + }, + }, + "description": Object { + "children": Array [ + Object { + "children": Array [ + Object { + "position": Position { + "end": Object { + "column": 17, + "line": 1, + "offset": 16, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "This is a number", + }, + ], + "position": Position { + "end": Object { + "column": 17, + "line": 1, + "offset": 16, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + ], + "position": Object { + "end": Object { + "column": 17, + "line": 1, + "offset": 16, + }, + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", + }, + "errors": Array [], + "examples": Array [], + "implements": Array [], + "loc": SourceLocation { + "end": Position { + "column": 5, + "line": 14, + }, + "start": Position { + "column": 2, + "line": 12, + }, + }, + "memberof": "vue.input.props", + "members": Object { + "events": Array [], + "global": Array [], + "inner": Array [], + "instance": Array [], + "static": Array [], + }, + "name": "myNumber", + "namespace": ".props.myNumber", + "params": Array [], + "path": Array [ + Object { + "kind": undefined, + "name": "props", + "scope": "static", + }, + Object { + "kind": undefined, + "name": "myNumber", + "scope": "static", + }, + ], + "properties": Array [], + "returns": Array [], + "scope": "static", + "sees": Array [], + "tags": Array [], + "throws": Array [], + "todos": Array [], + "yields": Array [], + }, + ], }, - "name": "myNumber", - "namespace": "myNumber", + "name": "props", + "namespace": ".props", "params": Array [], "path": Array [ Object { "kind": undefined, - "name": "myNumber", + "name": "props", + "scope": "static", }, ], "properties": Array [], "returns": Array [], + "scope": "static", "sees": Array [], "tags": Array [], "throws": Array [], @@ -768,6 +900,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": SourceLocation { "end": Position { @@ -871,6 +1004,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": SourceLocation { "end": Position { @@ -1044,6 +1178,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": SourceLocation { "end": Position { @@ -1226,6 +1361,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": SourceLocation { "end": Position { @@ -2899,6 +3035,7 @@ Array [ // result is 6", }, ], + "implements": Array [], "kind": "function", "loc": SourceLocation { "end": Position { @@ -3150,6 +3287,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": SourceLocation { "end": Position { @@ -3277,6 +3415,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -3499,11 +3638,11 @@ Array [ "loc": Object { "end": Object { "column": 1, - "line": 8, + "line": 9, }, "start": Object { "column": 0, - "line": 6, + "line": 7, }, }, }, @@ -3561,11 +3700,23 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [ + Object { + "description": null, + "lineNumber": 3, + "name": "MyInterface", + "title": "implements", + "type": Object { + "name": "MyInterface", + "type": "NameExpression", + }, + }, + ], "kind": "class", "loc": Object { "end": Object { "column": 3, - "line": 5, + "line": 6, }, "start": Object { "column": 0, @@ -3583,11 +3734,11 @@ Array [ "loc": Object { "end": Object { "column": 2, - "line": 17, + "line": 18, }, "start": Object { "column": 0, - "line": 15, + "line": 16, }, }, }, @@ -3645,15 +3796,16 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { "column": 3, - "line": 14, + "line": 15, }, "start": Object { "column": 0, - "line": 10, + "line": 11, }, }, "memberof": "MyClass", @@ -3835,11 +3987,11 @@ Array [ "loc": Object { "end": Object { "column": 47, - "line": 23, + "line": 24, }, "start": Object { "column": 0, - "line": 23, + "line": 24, }, }, }, @@ -3897,15 +4049,16 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { "column": 3, - "line": 22, + "line": 23, }, "start": Object { "column": 0, - "line": 19, + "line": 20, }, }, "memberof": "MyClass", @@ -4073,7 +4226,7 @@ Array [ }, "type": "root", }, - "lineNumber": 3, + "lineNumber": 4, "name": "howMany", "title": "property", "type": Object { @@ -4093,8 +4246,18 @@ Array [ "type": null, }, Object { - "description": "how many things it contains", + "description": null, "lineNumber": 3, + "name": "MyInterface", + "title": "implements", + "type": Object { + "name": "MyInterface", + "type": "NameExpression", + }, + }, + Object { + "description": "how many things it contains", + "lineNumber": 4, "name": "howMany", "title": "property", "type": Object { @@ -4653,6 +4816,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -4761,6 +4925,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -4925,6 +5090,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -4958,6 +5124,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -5037,6 +5204,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -5095,6 +5263,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -5128,6 +5297,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -5187,6 +5357,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -5246,6 +5417,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -5313,6 +5485,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -5372,6 +5545,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -5431,6 +5605,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -5525,6 +5700,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -5581,6 +5757,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 18, @@ -5682,6 +5859,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -5751,6 +5929,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 2, @@ -5784,6 +5963,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -5842,6 +6022,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -5900,6 +6081,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -5964,6 +6146,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 10, @@ -6020,6 +6203,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -6096,6 +6280,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -6148,6 +6333,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -6200,6 +6386,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -6256,6 +6443,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -6312,6 +6500,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -6368,6 +6557,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -6430,6 +6620,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 2, @@ -6463,6 +6654,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -6590,6 +6782,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -6652,6 +6845,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 3, @@ -6685,6 +6879,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -7624,6 +7819,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 2, @@ -7679,6 +7875,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 7, @@ -7771,6 +7968,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 18, @@ -7906,6 +8104,7 @@ have any parameter descriptions.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -8046,6 +8245,7 @@ have any parameter descriptions.", "description": "destructure([1, 2, 3])", }, ], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -8182,6 +8382,7 @@ have any parameter descriptions.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -8458,6 +8659,7 @@ class A { }", }, ], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -8542,6 +8744,7 @@ class A { }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -8652,6 +8855,7 @@ class A { }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -8762,6 +8966,7 @@ class A { }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -8895,6 +9100,7 @@ as a property.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -9007,6 +9213,7 @@ as a property.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -9289,6 +9496,7 @@ class A { }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -9551,6 +9759,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -9724,6 +9933,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -9836,6 +10046,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -9953,6 +10164,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -10056,6 +10268,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -10229,6 +10442,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -10340,6 +10554,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -10450,6 +10665,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -10559,6 +10775,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 3, @@ -10660,6 +10877,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -10839,6 +11057,7 @@ It takes a ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -13496,6 +13715,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -13599,6 +13819,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -13683,6 +13904,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 7, @@ -13846,6 +14068,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -14397,6 +14620,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -14481,6 +14705,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -14605,6 +14830,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "member", "loc": Object { "end": Object { @@ -14911,6 +15137,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -15093,6 +15320,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -15272,6 +15500,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 3, @@ -15373,6 +15602,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -15872,6 +16102,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "event", "loc": Object { "end": Object { @@ -16444,6 +16675,7 @@ Array [ "description": "foo(1);", }, ], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -16863,6 +17095,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -17064,6 +17297,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -17186,6 +17420,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -17302,6 +17537,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -17648,6 +17884,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "constant", "loc": Object { "end": Object { @@ -17815,6 +18052,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 9, @@ -17933,6 +18171,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -18071,6 +18310,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -18586,6 +18826,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -18670,6 +18911,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -18914,6 +19156,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -18966,6 +19209,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -19169,6 +19413,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -19596,6 +19841,7 @@ and ", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -20353,7 +20599,7 @@ Array [ "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 9, }, "start": Object { "column": 0, @@ -20415,6 +20661,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "interface", "loc": Object { "end": Object { @@ -20430,7 +20677,238 @@ Array [ "events": Array [], "global": Array [], "inner": Array [], - "instance": Array [], + "instance": Array [ + Object { + "augments": Array [], + "context": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + }, + "description": Object { + "children": Array [ + Object { + "children": Array [ + Object { + "position": Object { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "This is prop 1", + }, + ], + "position": Object { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + ], + "position": Object { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", + }, + "errors": Array [], + "examples": Array [], + "implements": Array [], + "kind": "member", + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "memberof": "Foo", + "members": Object { + "events": Array [], + "global": Array [], + "inner": Array [], + "instance": Array [], + "static": Array [], + }, + "name": "prop1", + "namespace": "Foo#prop1", + "params": Array [], + "path": Array [ + Object { + "kind": "interface", + "name": "Foo", + }, + Object { + "kind": "member", + "name": "prop1", + "scope": "instance", + }, + ], + "properties": Array [], + "returns": Array [], + "scope": "instance", + "sees": Array [], + "tags": Array [], + "throws": Array [], + "todos": Array [], + "type": Object { + "name": "number", + "type": "NameExpression", + }, + "yields": Array [], + }, + Object { + "augments": Array [], + "context": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + }, + "description": Object { + "children": Array [ + Object { + "children": Array [ + Object { + "position": Object { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "This is prop 2", + }, + ], + "position": Object { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + ], + "position": Object { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", + }, + "errors": Array [], + "examples": Array [], + "implements": Array [], + "kind": "member", + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "memberof": "Foo", + "members": Object { + "events": Array [], + "global": Array [], + "inner": Array [], + "instance": Array [], + "static": Array [], + }, + "name": "prop2", + "namespace": "Foo#prop2", + "params": Array [], + "path": Array [ + Object { + "kind": "interface", + "name": "Foo", + }, + Object { + "kind": "member", + "name": "prop2", + "scope": "instance", + }, + ], + "properties": Array [], + "returns": Array [], + "scope": "instance", + "sees": Array [], + "tags": Array [], + "throws": Array [], + "todos": Array [], + "type": Object { + "name": "string", + "type": "NameExpression", + }, + "yields": Array [], + }, + ], "static": Array [], }, "name": "Foo", @@ -20442,26 +20920,7 @@ Array [ "name": "Foo", }, ], - "properties": Array [ - Object { - "lineNumber": 5, - "name": "prop1", - "title": "property", - "type": Object { - "name": "number", - "type": "NameExpression", - }, - }, - Object { - "lineNumber": 6, - "name": "prop2", - "title": "property", - "type": Object { - "name": "string", - "type": "NameExpression", - }, - }, - ], + "properties": Array [], "returns": Array [], "sees": Array [], "tags": Array [], @@ -20548,7 +21007,7 @@ Object { "children": Array [ Object { "type": "text", - "value": "Properties", + "value": "prop1", }, ], "depth": 3, @@ -20556,85 +21015,123 @@ Object { }, Object { "children": Array [ + Object { + "position": Position { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "This is prop 1", + }, + ], + "position": Position { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "Type: ", + }, Object { "children": Array [ Object { - "children": Array [ - Object { - "type": "inlineCode", - "value": "prop1", - }, - Object { - "type": "text", - "value": " ", - }, - Object { - "children": Array [ - Object { - "children": Array [ - Object { - "type": "text", - "value": "number", - }, - ], - "identifier": "1", - "referenceType": "full", - "type": "linkReference", - }, - ], - "type": "strong", - }, - Object { - "type": "text", - "value": " ", - }, - ], - "type": "paragraph", + "type": "text", + "value": "number", }, ], - "type": "listItem", + "identifier": "1", + "referenceType": "full", + "type": "linkReference", + }, + ], + "type": "paragraph", + }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "prop2", + }, + ], + "depth": 3, + "type": "heading", + }, + Object { + "children": Array [ + Object { + "position": Position { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "This is prop 2", + }, + ], + "position": Position { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "Type: ", }, Object { "children": Array [ Object { - "children": Array [ - Object { - "type": "inlineCode", - "value": "prop2", - }, - Object { - "type": "text", - "value": " ", - }, - Object { - "children": Array [ - Object { - "children": Array [ - Object { - "type": "text", - "value": "string", - }, - ], - "identifier": "2", - "referenceType": "full", - "type": "linkReference", - }, - ], - "type": "strong", - }, - Object { - "type": "text", - "value": " ", - }, - ], - "type": "paragraph", + "type": "text", + "value": "string", }, ], - "type": "listItem", + "identifier": "2", + "referenceType": "full", + "type": "linkReference", }, ], - "ordered": false, - "type": "list", + "type": "paragraph", }, Object { "identifier": "1", @@ -20757,6 +21254,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -20966,6 +21464,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -21050,6 +21549,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 19, @@ -21158,6 +21658,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -21410,6 +21911,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -22175,6 +22677,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -22298,6 +22801,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -22670,6 +23174,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -22755,6 +23260,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -23009,6 +23515,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -23642,6 +24149,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -24190,6 +24698,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "license": "BSD", "loc": Object { @@ -25062,6 +25571,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -25241,6 +25751,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -25860,6 +26371,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -26874,6 +27386,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -27237,6 +27750,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 3, @@ -28692,6 +29206,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 3, @@ -29042,6 +29557,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 3, @@ -29232,6 +29748,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -29573,6 +30090,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -29785,6 +30303,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -29987,6 +30506,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -30112,6 +30632,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -30196,6 +30717,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -30399,6 +30921,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 3, @@ -30483,6 +31006,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -30655,6 +31179,7 @@ Array [ "description": "var address = new Address6('2001::/32');", }, ], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -31109,6 +31634,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -31630,6 +32156,7 @@ values specified in code.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "constant", "loc": Object { "end": Object { @@ -31881,6 +32408,7 @@ or any type information we could infer from annotations.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -32055,6 +32583,7 @@ iterator destructure (RestElement)", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35000,6 +35529,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35199,6 +35729,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35302,6 +35833,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35361,6 +35893,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -35450,6 +35983,7 @@ that doesn't crash anything!", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35580,6 +36114,7 @@ that doesn't crash anything!", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35664,6 +36199,7 @@ that doesn't crash anything!", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35780,6 +36316,7 @@ that doesn't crash anything!", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -35921,6 +36458,7 @@ that doesn't crash anything!", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -36471,6 +37009,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -36783,6 +37322,7 @@ plus 3.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -37030,6 +37570,7 @@ plus 3.", }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "typedef", "loc": Object { "end": Object { @@ -37780,6 +38321,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -38140,6 +38682,7 @@ Array [ // result is 6", }, ], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -38579,6 +39122,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -38612,6 +39156,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -38671,6 +39216,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -38730,6 +39276,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -38789,6 +39336,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -38868,6 +39416,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -38901,6 +39450,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -38960,6 +39510,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -39019,6 +39570,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -39078,6 +39630,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -39157,6 +39710,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -39209,6 +39763,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { @@ -39401,6 +39956,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "constant", "loc": Object { "end": Object { @@ -39516,6 +40072,7 @@ Array [ }, ], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 5, @@ -39643,6 +40200,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "module", "loc": Object { "end": Object { @@ -39703,6 +40261,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -39787,6 +40346,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 31, @@ -39877,6 +40437,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -39961,6 +40522,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "loc": Object { "end": Object { "column": 36, @@ -40317,6 +40879,7 @@ Array [ }, "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "class", "loc": Object { "end": Object { @@ -40651,6 +41214,7 @@ Array [ "description": "", "errors": Array [], "examples": Array [], + "implements": Array [], "kind": "function", "loc": Object { "end": Object { diff --git a/__tests__/fixture/class.input.js b/__tests__/fixture/class.input.js index df1268ee7..15fed4af0 100644 --- a/__tests__/fixture/class.input.js +++ b/__tests__/fixture/class.input.js @@ -1,6 +1,7 @@ /** * This is my class, a demo thing. * @class MyClass + * @implements {MyInterface} * @property {number} howMany how many things it contains */ function MyClass() { diff --git a/__tests__/fixture/interface.input.js b/__tests__/fixture/interface.input.js index 9bc49bbba..092060378 100644 --- a/__tests__/fixture/interface.input.js +++ b/__tests__/fixture/interface.input.js @@ -2,6 +2,8 @@ * This is my interface. */ interface Foo extends Bar, Baz { + /** This is prop 1 */ prop1: number, + /** This is prop 2 */ prop2: string } diff --git a/__tests__/fixture/vue.input.vue b/__tests__/fixture/vue.input.vue index db991fccd..94c625aa5 100644 --- a/__tests__/fixture/vue.input.vue +++ b/__tests__/fixture/vue.input.vue @@ -10,6 +10,7 @@ */ export default { +/** props */ props: { /** diff --git a/__tests__/lib/infer/__snapshots__/params.js.snap b/__tests__/lib/infer/__snapshots__/params.js.snap index 5df1ccc9d..7c8878daf 100644 --- a/__tests__/lib/infer/__snapshots__/params.js.snap +++ b/__tests__/lib/infer/__snapshots__/params.js.snap @@ -1,5 +1,256 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`inferParams (typescript) 1`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, +] +`; + +exports[`inferParams (typescript) 2`] = ` +Array [ + Object { + "anonymous": true, + "name": "$0", + "properties": Array [ + Object { + "lineNumber": 1, + "name": "$0.0", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, + Object { + "lineNumber": 1, + "name": "$0.1", + "title": "param", + }, + Object { + "anonymous": true, + "name": "$0.2", + "properties": Array [ + Object { + "lineNumber": 1, + "name": "$0.2.c", + "title": "param", + }, + ], + "title": "param", + "type": Object { + "name": "Object", + "type": "NameExpression", + }, + }, + ], + "title": "param", + "type": Object { + "name": "Array", + "type": "NameExpression", + }, + }, +] +`; + +exports[`inferParams (typescript) 3`] = ` +Array [ + Object { + "default": "4", + "lineNumber": 1, + "name": "x", + "title": "param", + "type": Object { + "name": "number", + "type": "NameExpression", + }, + }, +] +`; + +exports[`inferParams (typescript) 4`] = ` +Array [ + Object { + "lineNumber": 3, + "name": "opts", + "title": "param", + "type": Object { + "fields": Array [ + Object { + "key": "x", + "type": "FieldType", + "value": Object { + "name": "string", + "type": "NameExpression", + }, + }, + ], + "type": "RecordType", + }, + }, +] +`; + +exports[`inferParams (typescript) 5`] = ` +Array [ + Object { + "lineNumber": 3, + "name": "opts", + "title": "param", + "type": Object { + "fields": Array [ + Object { + "key": "foo", + "type": "FieldType", + "value": Object { + "name": "string", + "type": "NameExpression", + }, + }, + ], + "type": "RecordType", + }, + }, +] +`; + +exports[`inferParams (typescript) 6`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "expression": Object { + "name": "string", + "type": "NameExpression", + }, + "type": "RestType", + }, + }, +] +`; + +exports[`inferParams (typescript) 7`] = ` +Array [ + Object { + "expression": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, + "type": "OptionalType", + }, +] +`; + +exports[`inferParams (typescript) 8`] = ` +Array [ + Object { + "expression": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, + "type": "OptionalType", + }, +] +`; + +exports[`inferParams (typescript) 9`] = ` +Array [ + Object { + "expression": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, + "type": "OptionalType", + }, +] +`; + +exports[`inferParams (typescript) 10`] = ` +Array [ + Object { + "expression": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, + "type": "OptionalType", + }, +] +`; + +exports[`inferParams (typescript) 11`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "v", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, +] +`; + +exports[`inferParams (typescript) 12`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "v", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, +] +`; + +exports[`inferParams (typescript) 13`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "v", + "title": "param", + "type": Object { + "expression": Object { + "name": "string", + "type": "NameExpression", + }, + "type": "RestType", + }, + }, +] +`; + exports[`inferParams 1`] = ` Array [ Object { @@ -232,6 +483,51 @@ Array [ ] `; +exports[`inferParams 9`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "v", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, +] +`; + +exports[`inferParams 10`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "v", + "title": "param", + "type": Object { + "name": "string", + "type": "NameExpression", + }, + }, +] +`; + +exports[`inferParams 11`] = ` +Array [ + Object { + "lineNumber": 1, + "name": "v", + "title": "param", + "type": Object { + "expression": Object { + "name": "string", + "type": "NameExpression", + }, + "type": "RestType", + }, + }, +] +`; + exports[`mergeTrees 1`] = ` Object { "errors": Array [ diff --git a/__tests__/lib/infer/access.js b/__tests__/lib/infer/access.js index 200d52b4d..21c154688 100644 --- a/__tests__/lib/infer/access.js +++ b/__tests__/lib/infer/access.js @@ -2,17 +2,18 @@ const parse = require('../../../src/parsers/javascript'); const inferName = require('../../../src/infer/name'); const inferAccess = require('../../../src/infer/access'); -function toComment(fn) { +function toComment(fn, filename) { return parse( { - source: '(' + fn.toString() + ')' + file: filename, + source: fn instanceof Function ? '(' + fn.toString() + ')' : fn }, {} )[0]; } -function evaluate(fn, re) { - return inferAccess(re)(inferName(toComment(fn))); +function evaluate(fn, re, filename) { + return inferAccess(re)(inferName(toComment(fn, filename))); } test('inferAccess', function() { @@ -43,4 +44,58 @@ test('inferAccess', function() { function name_() {} }, '_$').access ).toBe('private'); + + expect( + evaluate(` + class Test { + /** */ + private foo() {} + } + `, '_$', 'test.ts').access + ).toBe('private'); + + expect( + evaluate(` + class Test { + /** */ + protected foo() {} + } + `, '_$', 'test.ts').access + ).toBe('protected'); + + expect( + evaluate(` + class Test { + /** */ + public foo() {} + } + `, '_$', 'test.ts').access + ).toBe('public'); + + expect( + evaluate(` + class Test { + /** */ + public abstract foo(); + } + `, '_$', 'test.ts').access + ).toBe('public'); + + expect( + evaluate(` + class Test { + /** */ + readonly name: string; + } + `, '_$', 'test.ts').readonly + ).toBe(true); + + expect( + evaluate(` + interface Test { + /** */ + readonly name: string; + } + `, '_$', 'test.ts').readonly + ).toBe(true); }); diff --git a/__tests__/lib/infer/augments.js b/__tests__/lib/infer/augments.js index f409d27e1..dc60e357f 100644 --- a/__tests__/lib/infer/augments.js +++ b/__tests__/lib/infer/augments.js @@ -12,8 +12,8 @@ function toComment(fn, filename) { )[0]; } -function evaluate(code) { - return inferAugments(toComment(code)); +function evaluate(code, filename) { + return inferAugments(toComment(code, filename)); } test('inferAugments', function() { @@ -23,4 +23,26 @@ test('inferAugments', function() { title: 'augments' } ]); + + expect(evaluate('/** */interface A extends B, C {}').augments).toEqual([ + { + name: 'B', + title: 'extends' + }, + { + name: 'C', + title: 'extends' + } + ]); + + expect(evaluate('/** */interface A extends B, C {}', 'test.ts').augments).toEqual([ + { + name: 'B', + title: 'extends' + }, + { + name: 'C', + title: 'extends' + } + ]); }); diff --git a/__tests__/lib/infer/implements.js b/__tests__/lib/infer/implements.js new file mode 100644 index 000000000..5f0f8f045 --- /dev/null +++ b/__tests__/lib/infer/implements.js @@ -0,0 +1,57 @@ +/*eslint-disable no-unused-vars*/ +const inferImplements = require('../../../src/infer/implements'); +const parse = require('../../../src/parsers/javascript'); + +function toComment(fn, filename) { + return parse( + { + file: filename, + source: fn instanceof Function ? '(' + fn.toString() + ')' : fn + }, + {} + )[0]; +} + +function evaluate(code, filename) { + return inferImplements(toComment(code, filename)); +} + +test('inferImplements (flow)', function() { + expect(evaluate('/** */class A implements B {}').implements).toEqual([ + { + name: 'B', + title: 'implements' + } + ]); + + expect(evaluate('/** */class A implements B, C {}').implements).toEqual([ + { + name: 'B', + title: 'implements' + }, + { + name: 'C', + title: 'implements' + } + ]); +}); + +test('inferImplements (typescript)', function() { + expect(evaluate('/** */class A implements B {}', 'test.ts').implements).toEqual([ + { + name: 'B', + title: 'implements' + } + ]); + + expect(evaluate('/** */class A implements B, C {}', 'test.ts').implements).toEqual([ + { + name: 'B', + title: 'implements' + }, + { + name: 'C', + title: 'implements' + } + ]); +}); diff --git a/__tests__/lib/infer/kind.js b/__tests__/lib/infer/kind.js index 64212772c..3c73a7834 100644 --- a/__tests__/lib/infer/kind.js +++ b/__tests__/lib/infer/kind.js @@ -38,6 +38,10 @@ test('inferKind', function() { ).kind ).toBe('class'); + const abstractClass = inferKind(toComment('/** */ abstract class C {}', 'test.ts')); + expect(abstractClass.kind).toBe('class'); + expect(abstractClass.abstract).toBe(true); + expect( inferKind( toComment(function() { @@ -63,6 +67,11 @@ test('inferKind', function() { .kind ).toBe('interface'); + expect( + inferKind(toComment('/** Exported interface */' + 'interface myinter {}', 'test.ts')) + .kind + ).toBe('interface'); + expect( inferKind( toComment( @@ -124,6 +133,34 @@ test('inferKind', function() { expect(generatorMethod.kind).toBe('function'); expect(generatorMethod.generator).toBe(true); + const abstractMethod = inferKind(toComment('abstract class C { /** */ abstract foo(); }', 'test.ts')); + expect(abstractMethod.kind).toBe('function'); + expect(abstractMethod.abstract).toBe(true); + + expect(inferKind(toComment('interface Foo { /** b */ b(v): void; }')).kind).toBe( + 'function' + ); + + expect(inferKind(toComment('interface Foo { /** b */ b: string; }')).kind).toBe( + 'member' + ); + + expect(inferKind(toComment('interface Foo { /** b */ b(v): void; }', 'test.ts')).kind).toBe( + 'function' + ); + + expect(inferKind(toComment('interface Foo { /** b */ b: string; }', 'test.ts')).kind).toBe( + 'member' + ); + + expect(inferKind(toComment('/** */ enum Foo { A }', 'test.ts')).kind).toBe( + 'enum' + ); + + expect(inferKind(toComment('enum Foo { /** */ A }', 'test.ts')).kind).toBe( + 'member' + ); + expect( inferKind( toComment(function() { @@ -159,4 +196,30 @@ test('inferKind', function() { ) ).kind ).toBe('constant'); + + expect( + inferKind( + toComment( + '/** */' + 'type Foo = string' + ) + ).kind + ).toBe('typedef'); + + expect( + inferKind( + toComment( + '/** */' + 'type Foo = string', + 'test.ts' + ) + ).kind + ).toBe('typedef'); + + const namespace = inferKind( + toComment( + '/** */ namespace Test { /** */ export function foo() {} }', + 'test.ts' + ) + ); + + expect(namespace.kind).toBe('namespace'); }); diff --git a/__tests__/lib/infer/membership.js b/__tests__/lib/infer/membership.js index cccc71108..775ee224b 100644 --- a/__tests__/lib/infer/membership.js +++ b/__tests__/lib/infer/membership.js @@ -141,6 +141,23 @@ test('inferMembership - explicit', function() { scope: 'static' }); + expect( + pick( + evaluate(function() { + Foo.bar = { + baz: { + /** Test */ + test: 0 + } + }; + })[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo.bar.baz', + scope: 'static' + }); + expect( pick( evaluate(function() { @@ -308,6 +325,167 @@ test('inferMembership - explicit', function() { scope: 'static' }); + expect( + pick( + evaluate(` + /** @memberof bar */ + abstract class Foo { + /** */ + abstract baz(); + } + `, 'test.ts')[1], // [0] is an description for class Foo + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'bar.Foo', + scope: 'instance' + }); + + expect( + pick( + evaluate(` + /** @memberof bar */ + interface Foo { + /** */ + baz(): string; + } + `)[1], // [0] is an description for class Foo + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'bar.Foo', + scope: 'instance' + }); + + expect( + pick( + evaluate(` + /** @memberof bar */ + interface Foo { + /** */ + baz(): string; + } + `, 'test.ts')[1], // [0] is an description for class Foo + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'bar.Foo', + scope: 'instance' + }); + + expect( + pick( + evaluate(` + interface Foo { + bar: { + /** */ + baz: string; + } + } + `)[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo.bar', + scope: 'instance' + }); + + expect( + pick( + evaluate(` + interface Foo { + bar: { + /** */ + baz: string; + } + } + `, 'test.ts')[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo.bar', + scope: 'instance' + }); + + expect( + pick( + evaluate(` + type Foo = { + /** */ + bar: string; + } + `)[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo', + scope: 'static' + }); + + expect( + pick( + evaluate(` + type Foo = { + bar: { + /** */ + baz: string; + } + } + `)[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo.bar', + scope: 'static' + }); + + expect( + pick( + evaluate(` + type Foo = { + /** */ + bar: string; + } + `, 'test.ts')[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo', + scope: 'static' + }); + + expect( + pick( + evaluate(` + type Foo = { + bar: { + /** */ + baz: string; + } + } + `, 'test.ts')[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo.bar', + scope: 'static' + }); + + expect( + pick( + evaluate(` + enum Foo { + /** */ + A + } + `, 'test.ts')[0], + ['memberof', 'scope'] + ) + ).toEqual({ + memberof: 'Foo', + scope: 'static' + }); + expect( pick( evaluate(function() { diff --git a/__tests__/lib/infer/name.js b/__tests__/lib/infer/name.js index 0c91f4442..2ce859ebe 100644 --- a/__tests__/lib/infer/name.js +++ b/__tests__/lib/infer/name.js @@ -193,6 +193,12 @@ test('inferName', function() { expect(evaluate('/** Test */ export class Wizard {}').name).toBe('Wizard'); + expect(evaluate('/** Test */ interface Wizard {}').name).toBe('Wizard'); + expect(evaluate('/** Test */ interface Wizard {}', 'test.ts').name).toBe('Wizard'); + + expect(evaluate('/** Test */ enum Wizard {}', 'test.ts').name).toBe('Wizard'); + expect(evaluate('enum Wizard { /** Test */ A }', 'test.ts').name).toBe('A'); + expect( evaluate( '/** Test */ export default class Warlock {}', diff --git a/__tests__/lib/infer/params.js b/__tests__/lib/infer/params.js index 1a7e238df..ae3cf1ccc 100644 --- a/__tests__/lib/infer/params.js +++ b/__tests__/lib/infer/params.js @@ -202,4 +202,87 @@ test('inferParams', function() { ` ).params ).toMatchSnapshot(); + + expect( + evaluate(`interface Foo { /** b */ b(v: string): void; }`).params + ).toMatchSnapshot(); + + expect( + evaluate(`type Foo = { /** b */ b(v: string): void }`).params + ).toMatchSnapshot(); + + expect( + evaluate(`interface Foo { /** b */ b(...v: string): void; }`).params + ).toMatchSnapshot(); +}); + +test('inferParams (typescript)', function() { + expect( + evaluate(`/** Test */function f(a: string) {};`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate(`/** Test */function f([a: string, b, {c}]) {};`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate( + ` + /** Test + * @param x + */ + function f(x: number = 4) {} + ` + , 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate( + ` + /** Test */ + function f(opts: { x: string }) {} + ` , 'test.ts' + ).params + ).toMatchSnapshot(); + + expect( + evaluate( + ` + /** Test */ + function f(opts: { [foo]: string }) {} + ` , 'test.ts' + ).params + ).toMatchSnapshot(); + + expect( + evaluate(`/** Test */function f(...a: string) {};`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate(`/** Test */function f(a?: string) {};`).params + ).toMatchSnapshot(); + + expect( + evaluate(`/** Test */function f(a?: string) {};`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate(`/** Test */function f(a?: string);`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate(`abstract class Foo { /** */ abstract f(a?: string); }`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate(`interface Foo { /** b */ b(v: string): void; }`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate(`type Foo = { /** b */ b(v: string): void }`, 'test.ts').params + ).toMatchSnapshot(); + + expect( + evaluate(`interface Foo { /** b */ b(...v: string): void; }`, 'test.ts').params + ).toMatchSnapshot(); }); diff --git a/__tests__/lib/infer/properties.js b/__tests__/lib/infer/properties.js index cb4a98e57..1223b99d7 100644 --- a/__tests__/lib/infer/properties.js +++ b/__tests__/lib/infer/properties.js @@ -12,11 +12,11 @@ function toComment(fn, filename) { )[0]; } -function evaluate(code) { - return inferProperties(toComment(code)); +function evaluate(code, filename) { + return inferProperties(toComment(code, filename)); } -test('inferProperties', function() { +test('inferProperties (flow)', function() { expect(evaluate('/** */type a = { b: 1 };').properties).toEqual([ { lineNumber: 1, @@ -43,9 +43,30 @@ test('inferProperties', function() { } ]); - expect( - evaluate('/** */interface a { b: 1, c: { d: 2 } };').properties - ).toEqual([ + expect(evaluate('/** */type a = { b: { c: 2 } };').properties).toEqual([ + { + lineNumber: 1, + name: 'b', + title: 'property', + type: { + type: 'RecordType', + fields: [ + { + key: 'c', + type: 'FieldType', + value: { + type: 'NumericLiteralType', + value: 2 + } + } + ] + } + } + ]); +}); + +test('inferProperties (typescript)', function() { + expect(evaluate('/** */type a = { b: 1 };', 'test.ts').properties).toEqual([ { lineNumber: 1, name: 'b', @@ -54,32 +75,40 @@ test('inferProperties', function() { type: 'NumericLiteralType', value: 1 } - }, + } + ]); + + expect( + evaluate('/** @property {number} b */ type a = { b: 1 };', 'test.ts').properties + ).toEqual([ + { + lineNumber: 0, + name: 'b', + title: 'property', + type: { + name: 'number', + type: 'NameExpression' + } + } + ]); + + expect(evaluate('/** */type a = { b: { c: 2 } };', 'test.ts').properties).toEqual([ { lineNumber: 1, - name: 'c', + name: 'b', title: 'property', type: { + type: 'RecordType', fields: [ { - key: 'd', + key: 'c', type: 'FieldType', value: { type: 'NumericLiteralType', value: 2 } } - ], - type: 'RecordType' - } - }, - { - lineNumber: 1, - name: 'c.d', - title: 'property', - type: { - type: 'NumericLiteralType', - value: 2 + ] } } ]); diff --git a/__tests__/lib/infer/return.js b/__tests__/lib/infer/return.js index 6c7be8135..ad87c69ad 100644 --- a/__tests__/lib/infer/return.js +++ b/__tests__/lib/infer/return.js @@ -12,11 +12,11 @@ function toComment(fn, filename) { )[0]; } -function evaluate(code) { - return inferReturn(toComment(code)); +function evaluate(code, filename) { + return inferReturn(toComment(code, filename)); } -test('inferReturn', function() { +test('inferReturn (flow)', function() { expect(evaluate('/** */function a(): number {}').returns).toEqual([ { title: 'returns', @@ -63,4 +63,101 @@ test('inferReturn', function() { } } ]); + + expect( + evaluate('interface Foo { /** */ bar(): string; }').returns[0].type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect( + evaluate('type Foo = { /** */ bar(): string; }').returns[0].type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); +}); + +test('inferReturn (typescript)', function() { + expect(evaluate('/** */function a(): number {}', 'test.ts').returns).toEqual([ + { + title: 'returns', + type: { + name: 'number', + type: 'NameExpression' + } + } + ]); + expect(evaluate('/** */var a = function(): number {}', 'test.ts').returns).toEqual([ + { + title: 'returns', + type: { + name: 'number', + type: 'NameExpression' + } + } + ]); + expect( + evaluate('/** @returns {string} */function a(): number {}', 'test.ts').returns[0].type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); + const generatorFn = evaluate( + '/** */function *a(): IterableIterator {}', + 'test.ts' + ); + expect(generatorFn.generator).toBe(true); + expect(generatorFn.yields).toEqual([ + { + title: 'yields', + type: { + name: 'Foo', + type: 'NameExpression' + } + } + ]); + expect(generatorFn.returns).toEqual([ + { + title: 'returns', + type: { + type: 'VoidLiteral' + } + } + ]); + + expect(evaluate('/** */function a(): number;', 'test.ts').returns).toEqual([ + { + title: 'returns', + type: { + name: 'number', + type: 'NameExpression' + } + } + ]); + + expect(evaluate('abstract class Test { /** */abstract a(): number; }', 'test.ts').returns).toEqual([ + { + title: 'returns', + type: { + name: 'number', + type: 'NameExpression' + } + } + ]); + + expect( + evaluate('interface Foo { /** */ bar(): string; }', 'test.ts').returns[0].type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect( + evaluate('type Foo = { /** */ bar(): string; }', 'test.ts').returns[0].type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); }); diff --git a/__tests__/lib/infer/type.js b/__tests__/lib/infer/type.js index f95ad8af9..19ea0dc18 100644 --- a/__tests__/lib/infer/type.js +++ b/__tests__/lib/infer/type.js @@ -2,20 +2,21 @@ const parse = require('../../../src/parsers/javascript'); const inferKind = require('../../../src/infer/kind'); const inferType = require('../../../src/infer/type'); -function toComment(code) { +function toComment(fn, filename) { return parse( { - source: code + file: filename, + source: fn instanceof Function ? '(' + fn.toString() + ')' : fn }, {} )[0]; } -function evaluate(code) { - return inferType(inferKind(toComment(code))); +function evaluate(code, filename) { + return inferType(inferKind(toComment(code, filename))); } -test('inferType', function() { +test('inferType (flow)', function() { expect(evaluate('/** @typedef {T} V */').type).toEqual({ name: 'T', type: 'NameExpression' @@ -101,6 +102,16 @@ test('inferType', function() { type: 'NameExpression' }); + expect(evaluate('class Foo { /** */ get b(): string { } }').type).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect(evaluate('class Foo { /** */ set b(s: string) { } }').type).toEqual({ + name: 'string', + type: 'NameExpression' + }); + expect(evaluate('/** */' + 'const x = 42;').type).toEqual({ name: 'number', type: 'NameExpression' @@ -115,4 +126,179 @@ test('inferType', function() { name: 'boolean', type: 'NameExpression' }); + + expect( + evaluate('interface Foo { /** */ bar: string; }').type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect( + evaluate('type Foo = { /** */ bar: string; }').type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); +}); + +test('inferType (typescript)', function() { + expect(evaluate('/** @typedef {T} V */', 'test.ts').type).toEqual({ + name: 'T', + type: 'NameExpression' + }); + + expect(evaluate('/** */' + 'type V = T', 'test.ts').type).toEqual({ + name: 'T', + type: 'NameExpression' + }); + + expect(evaluate('/** @typedef {Array} V */', 'test.ts').type).toEqual({ + applications: [ + { + name: 'T', + type: 'NameExpression' + } + ], + expression: { + name: 'Array', + type: 'NameExpression' + }, + type: 'TypeApplication' + }); + + expect(evaluate('/** */' + "type V = {a:number,'b':string}", 'test.ts').type).toEqual({ + fields: [ + { + key: 'a', + type: 'FieldType', + value: { + name: 'number', + type: 'NameExpression' + } + }, + { + key: 'b', + type: 'FieldType', + value: { + name: 'string', + type: 'NameExpression' + } + } + ], + type: 'RecordType' + }); + + expect(evaluate('/** */' + 'type V = Array', 'test.ts').type).toEqual({ + applications: [ + { + name: 'T', + type: 'NameExpression' + } + ], + expression: { + name: 'Array', + type: 'NameExpression' + }, + type: 'TypeApplication' + }); + + expect(evaluate('/** */' + 'var x: number', 'test.ts').type).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect(evaluate('/** */' + 'let x: number', 'test.ts').type).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect(evaluate('/** */' + 'const x: number = 42;', 'test.ts').type).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect(evaluate('let x,' + '/** */' + 'y: number', 'test.ts').type).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect(evaluate('class C {' + '/** */' + 'x: number;' + '}', 'test.ts').type).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect(evaluate('class Foo { /** */ get b(): string { } }', 'test.ts').type).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect(evaluate('class Foo { /** */ set b(s: string) { } }', 'test.ts').type).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect(evaluate('abstract class Foo { /** */ abstract get b(): string; }', 'test.ts').type).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect(evaluate('abstract class Foo { /** */ abstract set b(s: string); }', 'test.ts').type).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect(evaluate('/** */' + 'const x = 42;', 'test.ts').type).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect(evaluate('/** */' + 'const x = "abc";', 'test.ts').type).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect(evaluate('/** */' + 'const x = true;', 'test.ts').type).toEqual({ + name: 'boolean', + type: 'NameExpression' + }); + + expect( + evaluate('interface Foo { /** */ bar: string; }', 'test.ts').type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect( + evaluate('type Foo = { /** */ bar: string; }', 'test.ts').type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect( + evaluate('enum Foo { /** */ A }', 'test.ts').type + ).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect( + evaluate('enum Foo { /** */ A = 2 }', 'test.ts').type + ).toEqual({ + name: 'number', + type: 'NameExpression' + }); + + expect( + evaluate('enum Foo { /** */ A = "test" }', 'test.ts').type + ).toEqual({ + name: 'string', + type: 'NameExpression' + }); + + expect( + evaluate('enum Foo { /** */ A = foo }', 'test.ts').type + ).toBe(undefined); }); diff --git a/__tests__/lib/parse.js b/__tests__/lib/parse.js index 6eb7f643f..333d2db1e 100644 --- a/__tests__/lib/parse.js +++ b/__tests__/lib/parse.js @@ -302,7 +302,22 @@ test('parse - description', function() { test('parse - @emits', function() {}); -test('parse - @enum', function() {}); +test('parse - @enum', function() { + expect( + pick( + evaluate(function() { + /** @enum {string} */ + })[0], + ['kind', 'type'] + ) + ).toEqual({ + kind: 'enum', + type: { + type: 'NameExpression', + name: 'string' + } + }); +}); test('parse - @event', function() { expect( @@ -494,7 +509,13 @@ test('parse - @ignore', function() { ).toBe(true); }); -test('parse - @implements', function() {}); +test('parse - @implements', function() { + expect( + evaluate(function() { + /** @implements {Foo} */ + })[0].implements[0].name + ).toEqual('Foo'); +}); test('parse - @inheritdoc', function() {}); @@ -518,8 +539,8 @@ test('parse - @interface', function() { expect( evaluate(function() { /** @interface */ - })[0].interface - ).toEqual(true); + })[0].kind + ).toEqual('interface'); expect( evaluate(function() { diff --git a/__tests__/lib/parsers/parse_to_ast.js b/__tests__/lib/parsers/parse_to_ast.js index 675e64dfc..324fb49f1 100644 --- a/__tests__/lib/parsers/parse_to_ast.js +++ b/__tests__/lib/parsers/parse_to_ast.js @@ -18,6 +18,6 @@ describe('flow comments', () => { }); test('valid js', () => { - expect(() => parseToAst(src)).not.toThrowError(); + expect(() => parseToAst(src, 'test.js')).not.toThrowError(); }); }); diff --git a/__tests__/lib/ts_doctrine.js b/__tests__/lib/ts_doctrine.js new file mode 100644 index 000000000..ec52f34e0 --- /dev/null +++ b/__tests__/lib/ts_doctrine.js @@ -0,0 +1,407 @@ +const tsDoctrine = require('../../src/ts_doctrine.js'); +const parse = require('../../src/parsers/javascript'); +const TSTYPE_TYPES = require('@babel/types').TSTYPE_TYPES; + +function toComment(fn, filename) { + return parse( + { + file: filename || 'test.ts', + source: fn instanceof Function ? '(' + fn.toString() + ')' : fn + }, + {} + )[0]; +} + +test('tsDoctrine', function() { + const types = TSTYPE_TYPES.slice(); + + function toDoctrineType(flowType) { + const annotation = toComment( + '/** add */function add(a: ' + flowType + ' ) { }' + ).context.ast.node.params[0].typeAnnotation.typeAnnotation; + if (types.indexOf(annotation.type) !== -1) { + types.splice(types.indexOf(annotation.type), 1); + } + return tsDoctrine(annotation); + } + + expect(toDoctrineType('number')).toEqual({ + type: 'NameExpression', + name: 'number' + }); + + expect(toDoctrineType('string')).toEqual({ + type: 'NameExpression', + name: 'string' + }); + + expect(toDoctrineType('boolean')).toEqual({ + type: 'NameExpression', + name: 'boolean' + }); + + expect(toDoctrineType('symbol')).toEqual({ + type: 'NameExpression', + name: 'symbol' + }); + + expect(toDoctrineType('object')).toEqual({ + type: 'NameExpression', + name: 'object' + }); + + expect(toDoctrineType('any')).toEqual({ + type: 'AllLiteral' + }); + + expect(toDoctrineType('this')).toEqual({ + type: 'NameExpression', + name: 'this' + }); + + expect(toDoctrineType('never')).toEqual({ + type: 'NameExpression', + name: 'never' + }); + + expect(toDoctrineType('(y:Foo) => Bar')).toEqual({ + type: 'FunctionType', + params: [ + { + type: 'ParameterType', + name: 'y', + expression: { + type: 'NameExpression', + name: 'Foo' + } + } + ], + result: { + type: 'NameExpression', + name: 'Bar' + } + }); + + expect(toDoctrineType('new (y:Foo) => Bar')).toEqual({ + type: 'FunctionType', + params: [ + { + type: 'ParameterType', + name: 'y', + expression: { + type: 'NameExpression', + name: 'Foo' + } + } + ], + result: { + type: 'NameExpression', + name: 'Bar' + } + }); + + expect(toDoctrineType('(...y: Foo) => Bar')).toEqual({ + type: 'FunctionType', + params: [ + { + type: 'RestType', + expression: { + type: 'ParameterType', + name: 'y', + expression: { + type: 'NameExpression', + name: 'Foo' + } + } + } + ], + result: { + type: 'NameExpression', + name: 'Bar' + } + }); + + expect(toDoctrineType('number | string')).toEqual({ + type: 'UnionType', + elements: [ + { + type: 'NameExpression', + name: 'number' + }, + { + type: 'NameExpression', + name: 'string' + } + ] + }); + + expect(toDoctrineType('(number | string)')).toEqual({ + type: 'UnionType', + elements: [ + { + type: 'NameExpression', + name: 'number' + }, + { + type: 'NameExpression', + name: 'string' + } + ] + }); + + expect(toDoctrineType('Object')).toEqual({ + type: 'NameExpression', + name: 'Object' + }); + + expect(toDoctrineType('namedType.propertyOfType')).toEqual({ + type: 'NameExpression', + name: 'namedType.propertyOfType' + }); + + expect(toDoctrineType('Array')).toEqual({ + applications: [ + { + type: 'NameExpression', + name: 'namedType.propertyOfType' + } + ], + expression: { + name: 'Array', + type: 'NameExpression' + }, + type: 'TypeApplication' + }); + + expect(toDoctrineType('Array>')).toEqual({ + applications: [ + { + applications: [ + { + name: 'boolean', + type: 'NameExpression' + } + ], + expression: { + type: 'NameExpression', + name: 'namedType.propertyOfType' + }, + type: 'TypeApplication' + } + ], + expression: { + name: 'Array', + type: 'NameExpression' + }, + type: 'TypeApplication' + }); + + expect(toDoctrineType('{ a: foo.bar }')).toEqual({ + fields: [ + { + key: 'a', + type: 'FieldType', + value: { + name: 'foo.bar', + type: 'NameExpression' + } + } + ], + type: 'RecordType' + }); + + expect(toDoctrineType('{ a: { b: foo.bar } }')).toEqual({ + fields: [ + { + key: 'a', + type: 'FieldType', + value: { + type: 'RecordType', + fields: [ + { + key: 'b', + type: 'FieldType', + value: { + name: 'foo.bar', + type: 'NameExpression' + } + } + ] + } + } + ], + type: 'RecordType' + }); + + expect(toDoctrineType('{ a: 1 }')).toEqual({ + type: 'RecordType', + fields: [ + { + type: 'FieldType', + key: 'a', + value: { + type: 'NumericLiteralType', + value: 1 + } + } + ] + }); + + expect(toDoctrineType('{ a?: string }')).toEqual({ + type: 'RecordType', + fields: [ + { + type: 'FieldType', + key: 'a', + value: { + type: 'OptionalType', + expression: { + name: 'string', + type: 'NameExpression' + } + } + } + ] + }); + + expect(toDoctrineType('unknown')).toEqual({ + type: 'AllLiteral' + }); + + expect(toDoctrineType('Array')).toEqual({ + type: 'NameExpression', + name: 'Array' + }); + + expect(toDoctrineType('Array')).toEqual({ + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [ + { + type: 'NameExpression', + name: 'number' + } + ] + }); + + expect(toDoctrineType('number[]')).toEqual({ + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [ + { + type: 'NameExpression', + name: 'number' + } + ] + }); + + expect(toDoctrineType('[]')).toEqual({ + type: 'ArrayType', + elements: [] + }); + + expect(toDoctrineType('[number]')).toEqual({ + type: 'ArrayType', + elements: [ + { + type: 'NameExpression', + name: 'number' + } + ] + }); + + expect(toDoctrineType('[string, boolean]')).toEqual({ + type: 'ArrayType', + elements: [ + { + type: 'NameExpression', + name: 'string' + }, + { + type: 'NameExpression', + name: 'boolean' + } + ] + }); + + expect(toDoctrineType('[string, ...boolean]')).toEqual({ + type: 'ArrayType', + elements: [ + { + type: 'NameExpression', + name: 'string' + }, + { + type: 'RestType', + expression: { + type: 'NameExpression', + name: 'boolean' + } + } + ] + }); + + expect(toDoctrineType('(y:any) => any')).toEqual({ + type: 'FunctionType', + params: [ + { + expression: { type: 'AllLiteral' }, + name: 'y', + type: 'ParameterType' + } + ], + result: { type: 'AllLiteral' } + }); + + expect(toDoctrineType('undefined')).toEqual({ + type: 'UndefinedLiteral' + }); + + expect(toDoctrineType('"value"')).toEqual({ + type: 'StringLiteralType', + value: 'value' + }); + + expect(toDoctrineType('1')).toEqual({ + type: 'NumericLiteralType', + value: 1 + }); + + expect(toDoctrineType('true')).toEqual({ + type: 'BooleanLiteralType', + value: true + }); + + expect(toDoctrineType('false')).toEqual({ + type: 'BooleanLiteralType', + value: false + }); + + expect(toDoctrineType('null')).toEqual({ + type: 'NullLiteral' + }); + + expect(toDoctrineType('void')).toEqual({ + type: 'VoidLiteral' + }); + + expect(types).toEqual([ + 'TSTypePredicate', + 'TSTypeQuery', + 'TSOptionalType', // handled - not top-level. + 'TSRestType', // handled - not top-level. + 'TSIntersectionType', // no equivalent in doctrine... + 'TSConditionalType', + 'TSInferType', + 'TSTypeOperator', + 'TSIndexedAccessType', + 'TSMappedType', + 'TSExpressionWithTypeArguments' + ]); +}); diff --git a/declarations/comment.js b/declarations/comment.js index 741900d02..e3f0bfbe4 100644 --- a/declarations/comment.js +++ b/declarations/comment.js @@ -68,7 +68,8 @@ type CommentTag = { default?: any, lineNumber?: number, type?: DoctrineType, - properties?: Array + properties?: Array, + readonly?: boolean }; type Comment = { @@ -77,6 +78,7 @@ type Comment = { augments: Array, examples: Array, + implements: Array, params: Array, properties: Array, returns: Array, @@ -98,6 +100,9 @@ type Comment = { memberof?: string, scope?: Scope, access?: Access, + readonly?: boolean, + abstract?: boolean, + generator?: boolean, alias?: string, copyright?: string, diff --git a/src/extractors/exported.js b/src/extractors/exported.js index 14ae00b13..9a11323af 100644 --- a/src/extractors/exported.js +++ b/src/extractors/exported.js @@ -182,7 +182,7 @@ function getCachedData(dataCache, filePath) { let value = dataCache.get(path); if (!value) { const input = fs.readFileSync(path, 'utf-8'); - const ast = parseToAst(input); + const ast = parseToAst(input, filePath); value = { data: { file: path, diff --git a/src/index.js b/src/index.js index 49490e1f2..d3b002ab2 100644 --- a/src/index.js +++ b/src/index.js @@ -13,6 +13,7 @@ const hierarchy = require('./hierarchy'); const inferName = require('./infer/name'); const inferKind = require('./infer/kind'); const inferAugments = require('./infer/augments'); +const inferImplements = require('./infer/implements'); const inferParams = require('./infer/params'); const inferProperties = require('./infer/properties'); const inferMembership = require('./infer/membership'); @@ -89,6 +90,7 @@ function buildInternal(inputsAndConfig) { inferName, inferAccess(config.inferPrivate), inferAugments, + inferImplements, inferKind, nest, inferParams, diff --git a/src/infer/access.js b/src/infer/access.js index cbde55a70..a4f12494b 100644 --- a/src/infer/access.js +++ b/src/infer/access.js @@ -10,13 +10,23 @@ function inferAccessWithPattern(pattern) { const re = pattern && new RegExp(pattern); /** - * Infers access (only private atm) from the name. + * Infers access from TypeScript annotations, and from the name (only private atm). * * @name inferAccess * @param {Object} comment parsed comment * @returns {Object} comment with access inferred */ return function inferAccess(comment) { + // Support typescript access modifiers + const ast = comment.context.ast; + if (ast && ast.node.accessibility) { + comment.access = ast.node.accessibility; + } + + if (ast && ast.node.readonly) { + comment.readonly = true; + } + // This needs to run after inferName beacuse we infer the access based on // the name. if ( diff --git a/src/infer/augments.js b/src/infer/augments.js index 577da7f31..2045c5d68 100644 --- a/src/infer/augments.js +++ b/src/infer/augments.js @@ -31,7 +31,7 @@ function inferAugments(comment) { name: generate(path.node.superClass).code }); } - } else if (path.isInterfaceDeclaration()) { + } else if ((path.isInterfaceDeclaration() || path.isTSInterfaceDeclaration()) && path.node.extends) { /* * extends is an array of interface identifiers or * qualified type identifiers, so we generate code diff --git a/src/infer/finders.js b/src/infer/finders.js index 1240d0b5e..0226b56e4 100644 --- a/src/infer/finders.js +++ b/src/infer/finders.js @@ -26,7 +26,7 @@ function findTarget(path) { } else if (t.isExpressionStatement(path)) { // foo.x = TARGET path = path.get('expression').get('right'); - } else if (t.isObjectProperty(path)) { + } else if (t.isObjectProperty(path) || t.isObjectTypeProperty(path)) { // var foo = { x: TARGET }; object property path = path.get('value'); } else if (t.isClassProperty(path) && path.get('value').node) { diff --git a/src/infer/implements.js b/src/infer/implements.js new file mode 100644 index 000000000..c98015385 --- /dev/null +++ b/src/infer/implements.js @@ -0,0 +1,38 @@ +const generate = require('@babel/generator').default; +const findTarget = require('./finders').findTarget; + +/** + * Infers an `augments` tag from an ES6 class declaration + * + * @param {Object} comment parsed comment + * @returns {Object} comment with kind inferred + */ +function inferImplements(comment) { + if (comment.implements.length) { + return comment; + } + + const path = findTarget(comment.context.ast); + if (!path) { + return comment; + } + + if (path.isClass() && path.node.implements) { + /* + * A interface can be a single name, like React, + * or a MemberExpression like React.Component, + * so we generate code from the AST rather than assuming + * we can access a name like `path.node.implements.name` + */ + path.node.implements.forEach(impl => { + comment.implements.push({ + title: 'implements', + name: generate(impl).code + }); + }); + } + + return comment; +} + +module.exports = inferImplements; diff --git a/src/infer/kind.js b/src/infer/kind.js index 5ab86850e..e1cab5faf 100644 --- a/src/infer/kind.js +++ b/src/infer/kind.js @@ -18,7 +18,16 @@ function inferKind(comment) { if (t.isClassDeclaration(node)) { comment.kind = 'class'; - } else if (t.isFunction(node)) { + if (node.abstract) { + comment.abstract = true; + } + } else if ( + t.isFunction(node) || + t.isTSDeclareMethod(node) || + t.isTSDeclareFunction(node) || + t.isFunctionTypeAnnotation(node) || + t.isTSMethodSignature(node) + ) { if (node.kind === 'get' || node.kind === 'set') { comment.kind = 'member'; } else if (node.id && node.id.name && !!/^[A-Z]/.exec(node.id.name)) { @@ -31,10 +40,13 @@ function inferKind(comment) { if (node.generator) { comment.generator = true; } + if (node.abstract) { + comment.abstract = true; + } } - } else if (t.isTypeAlias(node)) { + } else if (t.isTypeAlias(node) || t.isTSTypeAliasDeclaration(node)) { comment.kind = 'typedef'; - } else if (t.isInterfaceDeclaration(node)) { + } else if (t.isInterfaceDeclaration(node) || t.isTSInterfaceDeclaration(node)) { comment.kind = 'interface'; } else if (t.isVariableDeclaration(node)) { if (node.kind === 'const') { @@ -53,11 +65,21 @@ function inferKind(comment) { } else if (t.isExpressionStatement(node)) { // module.exports = function() {} findKind(node.expression.right); - } else if (t.isClassProperty(node)) { + } else if (t.isClassProperty(node) || t.isTSPropertySignature(node) || t.isTSEnumMember(node)) { comment.kind = 'member'; } else if (t.isProperty(node)) { // { foo: function() {} } findKind(node.value); + } else if (t.isTSModuleDeclaration(node)) { + comment.kind = 'namespace'; + } else if (t.isObjectTypeProperty(node)) { + if (t.isFunctionTypeAnnotation(node.value)) { + findKind(node.value); + } else { + comment.kind = 'member'; + } + } else if (t.isTSEnumDeclaration(node)) { + comment.kind = 'enum'; } } diff --git a/src/infer/membership.js b/src/infer/membership.js index 92b06f0ae..29a955c70 100644 --- a/src/infer/membership.js +++ b/src/infer/membership.js @@ -341,7 +341,7 @@ module.exports = function() { // class Foo { prop: T } // var Foo = class { prop: T } if ( - (path.isClassMethod() || path.isClassProperty()) && + (path.isClassMethod() || path.isClassProperty() || path.isTSDeclareMethod()) && path.parentPath.isClassBody() && path.parentPath.parentPath.isClass() ) { @@ -359,7 +359,7 @@ module.exports = function() { } const declarationNode = path.parentPath.parentPath.node; - if (!declarationNode.id) { + if (!declarationNode.id && !declarationNode.key) { // export default function () {} // export default class {} // Use module name instead. @@ -392,39 +392,81 @@ module.exports = function() { objectParent = path.parentPath.parentPath; } else if (path.isObjectMethod() && path.parentPath.isObjectExpression()) { objectParent = path.parentPath; + } else if (path.isObjectTypeProperty() || path.isTSTypeElement()) { + objectParent = path.parentPath; } // Confirm that the thing being documented is a property of an object. if (objectParent) { - // The @lends comment is sometimes attached to the first property rather than - // the object expression itself. - const lendsIdentifiers = - findLendsIdentifiers(objectParent) || - findLendsIdentifiers(objectParent.get('properties')[0]); - - if (lendsIdentifiers) { - return inferMembershipFromIdentifiers(comment, lendsIdentifiers); - } else if (objectParent.parentPath.isAssignmentExpression()) { - // Foo = { ... }; - // Foo.prototype = { ... }; - // Foo.bar = { ... }; - return inferMembershipFromIdentifiers( - comment, - extractIdentifiers(objectParent.parentPath.get('left')) - ); - } else if (objectParent.parentPath.isVariableDeclarator()) { - // var Foo = { ... }; - return inferMembershipFromIdentifiers(comment, [ - objectParent.parentPath.get('id').node.name - ]); - } else if (objectParent.parentPath.isExportDefaultDeclaration()) { - // export default { ... }; - return inferMembershipFromIdentifiers(comment, [ - inferModuleName(currentModule || comment) - ]); + // Collect all keys of parent nested object keys, e.g. {foo: bar: {baz: 1}} + const objectKeys = []; + + while (!objectParent.isStatement()) { + if (objectParent.isObjectProperty() || objectParent.isObjectTypeProperty() || objectParent.isTSPropertySignature()) { + objectKeys.unshift(objectParent.node.key.name); + } + + // The @lends comment is sometimes attached to the first property rather than + // the object expression itself. + const lendsIdentifiers = + findLendsIdentifiers(objectParent) || + findLendsIdentifiers(objectParent.get('properties')[0]); + + if (lendsIdentifiers) { + return inferMembershipFromIdentifiers(comment, [...lendsIdentifiers, ...objectKeys]); + } else if (objectParent.parentPath.isAssignmentExpression()) { + // Foo = { ... }; + // Foo.prototype = { ... }; + // Foo.bar = { ... }; + return inferMembershipFromIdentifiers( + comment, + [...extractIdentifiers(objectParent.parentPath.get('left')), ...objectKeys] + ); + } else if (objectParent.parentPath.isVariableDeclarator()) { + // var Foo = { ... }; + return inferMembershipFromIdentifiers(comment, [ + objectParent.parentPath.get('id').node.name, + ...objectKeys + ]); + } else if (objectParent.parentPath.isExportDefaultDeclaration()) { + // export default { ... }; + return inferMembershipFromIdentifiers(comment, [ + inferModuleName(currentModule || comment), + ...objectKeys + ]); + } else if (objectParent.parentPath.isTypeAlias() || objectParent.parentPath.isTSTypeAliasDeclaration()) { + // type X = { ... } + return inferMembershipFromIdentifiers(comment, [ + objectParent.parentPath.node.id.name, + ...objectKeys + ]); + } else if (objectParent.parentPath.isInterfaceDeclaration() || objectParent.parentPath.isTSInterfaceDeclaration()) { + // interface Foo { ... } + return inferMembershipFromIdentifiers( + comment, + [ + ...inferClassMembership(objectParent.parentPath), + ...objectKeys + ], + 'instance' + ); + } + + objectParent = objectParent.parentPath; } } + // TypeScript enums + // enum Foo { A } + if (path.isTSEnumMember()) { + const enumPath = path.parentPath; + return inferMembershipFromIdentifiers( + comment, + [enumPath.node.id.name], + 'static' + ); + } + // var function Foo() { // function bar() {} // return { bar: bar }; diff --git a/src/infer/params.js b/src/infer/params.js index c48a52e93..491bc6a95 100644 --- a/src/infer/params.js +++ b/src/infer/params.js @@ -2,7 +2,7 @@ const t = require('@babel/types'); const generate = require('@babel/generator').default; const _ = require('lodash'); const finders = require('./finders'); -const flowDoctrine = require('../flow_doctrine'); +const typeAnnotation = require('../type_annotation'); /** * Infers param tags by reading function parameter names @@ -37,7 +37,13 @@ function inferParams(comment) { } } - if (!t.isFunction(path)) { + if ( + !t.isFunction(path) && + !t.isTSDeclareFunction(path) && + !t.isTSDeclareMethod(path) && + !t.isFunctionTypeAnnotation(path) && + !t.isTSMethodSignature(path) + ) { return comment; } @@ -45,11 +51,39 @@ function inferParams(comment) { return comment; } - return inferAndCombineParams(path.node.params, comment); + let params = t.isTSMethodSignature(path) ? path.node.parameters : path.node.params; + + // Flow function annotations separate rest parameters into a different list + if (t.isFunctionTypeAnnotation(path) && path.node.rest) { + params = params.concat(path.node.rest); + } + + const result = inferAndCombineParams(params, comment); + + // Wrap flow rest parameter with a RestType + if (t.isFunctionTypeAnnotation(path) && path.node.rest) { + const rest = result.params[result.params.length - 1]; + rest.type = { + type: 'RestType', + expression: rest.type + }; + } + + return result; } function inferAndCombineParams(params, comment) { - const inferredParams = params.map((param, i) => paramToDoc(param, '', i)); + const inferredParams = params.map((param, i) => { + const doc = paramToDoc(param, '', i); + if (param.optional) { + return { + type: 'OptionalType', + expression: doc + }; + } + + return doc; + }); const paramsToMerge = comment.params; if (comment.constructorComment) { paramsToMerge.push.apply(paramsToMerge, comment.constructorComment.params); @@ -129,7 +163,7 @@ function paramToDoc(param, prefix, i) { title: 'param', name: autoName, anonymous: true, - type: (param.typeAnnotation && flowDoctrine(param)) || { + type: (param.typeAnnotation && typeAnnotation(param.typeAnnotation)) || { type: 'NameExpression', name: 'Object' }, @@ -145,7 +179,7 @@ function paramToDoc(param, prefix, i) { title: 'param', name: prefixedName, anonymous: true, - type: (param.typeAnnotation && flowDoctrine(param)) || { + type: (param.typeAnnotation && typeAnnotation(param.typeAnnotation)) || { type: 'NameExpression', name: 'Object' }, @@ -169,7 +203,7 @@ function paramToDoc(param, prefix, i) { title: 'param', name: autoName, anonymous: true, - type: (param.typeAnnotation && flowDoctrine(param)) || { + type: (param.typeAnnotation && typeAnnotation(param.typeAnnotation)) || { type: 'NameExpression', name: 'Array' }, @@ -211,7 +245,7 @@ function paramToDoc(param, prefix, i) { type: 'RestType' }; if (param.typeAnnotation) { - type.expression = flowDoctrine(param.typeAnnotation.typeAnnotation); + type.expression = typeAnnotation(param.typeAnnotation); } return { title: 'param', @@ -220,6 +254,13 @@ function paramToDoc(param, prefix, i) { type }; } + case 'FunctionTypeParam': // flow interface method signature + return { + title: 'param', + name: prefix ? prefix + '.' + param.name.name : param.name.name, + lineNumber: param.loc.start.line, + type: param.typeAnnotation ? typeAnnotation(param.typeAnnotation) : undefined + }; default: { // (a) const newParam = { @@ -230,7 +271,7 @@ function paramToDoc(param, prefix, i) { // Flow/TS annotations if (param.typeAnnotation && param.typeAnnotation.typeAnnotation) { - newParam.type = flowDoctrine(param.typeAnnotation.typeAnnotation); + newParam.type = typeAnnotation(param.typeAnnotation.typeAnnotation); } return newParam; diff --git a/src/infer/properties.js b/src/infer/properties.js index e7f609967..6d9d1be93 100644 --- a/src/infer/properties.js +++ b/src/infer/properties.js @@ -1,4 +1,4 @@ -const flowDoctrine = require('../flow_doctrine'); +const typeAnnotation = require('../type_annotation'); const findTarget = require('./finders').findTarget; function prefixedName(name, prefix) { @@ -9,7 +9,14 @@ function prefixedName(name, prefix) { } function propertyToDoc(property, prefix) { - let type = flowDoctrine(property.value); + let type; + if (property.type === 'ObjectTypeProperty') { // flow + type = typeAnnotation(property.value); + } else if (property.type === 'TSPropertySignature') { // typescript + type = typeAnnotation(property.typeAnnotation); + } else if (property.type === 'TSMethodSignature') { // typescript + type = typeAnnotation(property); + } const name = property.key.name || property.key.value; if (property.optional) { type = { @@ -38,16 +45,13 @@ function inferProperties(comment) { comment.properties.forEach(prop => explicitProperties.add(prop.name)); function inferProperties(value, prefix) { - if (value.type === 'ObjectTypeAnnotation') { - value.properties.forEach(function(property) { + if (value.type === 'ObjectTypeAnnotation' || value.type === 'TSTypeLiteral') { + const properties = value.properties || value.members || value.body || []; + properties.forEach(function(property) { if (!explicitProperties.has(prefixedName(property.key.name, prefix))) { comment.properties = comment.properties.concat( propertyToDoc(property, prefix) ); - // Nested type parameters - if (property.value.type === 'ObjectTypeAnnotation') { - inferProperties(property.value, prefix.concat(property.key.name)); - } } }); } @@ -58,8 +62,8 @@ function inferProperties(comment) { if (path) { if (path.isTypeAlias()) { inferProperties(path.node.right, []); - } else if (path.isInterfaceDeclaration()) { - inferProperties(path.node.body, []); + } else if (path.isTSTypeAliasDeclaration()) { + inferProperties(path.node.typeAnnotation, []); } } diff --git a/src/infer/return.js b/src/infer/return.js index 0cb929194..98c952834 100644 --- a/src/infer/return.js +++ b/src/infer/return.js @@ -1,6 +1,20 @@ const findTarget = require('./finders').findTarget; const t = require('@babel/types'); -const flowDoctrine = require('../flow_doctrine'); +const typeAnnotation = require('../type_annotation'); + +// TypeScript does not currently support typing the return value of a generator function. +// This is coming in TypeScript 3.3 - https://github.com/Microsoft/TypeScript/pull/30790 +const TS_GENERATORS = { + Iterator: 1, + Iterable: 1, + IterableIterator: 1 +}; + +const FLOW_GENERATORS = { + Iterator: 1, + Iterable: 1, + Generator: 3 +}; /** * Infers returns tags by using Flow return type annotations @@ -29,28 +43,50 @@ function inferReturn(comment) { fn = fn.init; } - if (t.isFunction(fn) && fn.returnType && fn.returnType.typeAnnotation) { - let returnType = flowDoctrine(fn.returnType.typeAnnotation); - if (comment.returns && comment.returns.length > 0) { - comment.returns[0].type = returnType; - } else { - if ( - fn.generator && - returnType.type === 'TypeApplication' && - returnType.expression.name === 'Generator' && - returnType.applications.length === 3 - ) { - comment.generator = true; + const fnReturnType = getReturnType(fn); + if (fnReturnType) { + let returnType = typeAnnotation(fnReturnType); + let yieldsType = null; + + if (fn.generator && returnType.type === 'TypeApplication') { + comment.generator = true; + let numArgs; + + if (t.isFlow(fnReturnType)) { + numArgs = FLOW_GENERATORS[returnType.expression.name]; + } else if (t.isTSTypeAnnotation(fnReturnType)) { + numArgs = TS_GENERATORS[returnType.expression.name]; + } + + if (returnType.applications.length === numArgs) { + yieldsType = returnType.applications[0]; + + if (numArgs > 1) { + returnType = returnType.applications[1]; + } else { + returnType = { + type: 'VoidLiteral' + }; + } + } + } + + if (yieldsType) { + if (comment.yields && comment.yields.length > 0) { + comment.yields[0].type = yieldsType; + } else { comment.yields = [ { title: 'yields', - type: returnType.applications[0] + type: yieldsType } ]; - - returnType = returnType.applications[1]; } + } + if (comment.returns && comment.returns.length > 0) { + comment.returns[0].type = returnType; + } else { comment.returns = [ { title: 'returns', @@ -62,4 +98,14 @@ function inferReturn(comment) { return comment; } +function getReturnType(fn) { + if (t.isFunction(fn) || t.isTSDeclareFunction(fn) || t.isTSDeclareMethod(fn) || t.isFunctionTypeAnnotation(fn)) { + return fn.returnType; + } + + if (t.isTSMethodSignature(fn)) { + return fn.typeAnnotation; + } +} + module.exports = inferReturn; diff --git a/src/infer/type.js b/src/infer/type.js index 963a4dff1..0dfb45917 100644 --- a/src/infer/type.js +++ b/src/infer/type.js @@ -1,6 +1,5 @@ const findTarget = require('./finders').findTarget; -const flowDoctrine = require('../flow_doctrine'); -const t = require('@babel/types'); +const typeAnnotation = require('../type_annotation'); const constTypeMapping = { BooleanLiteral: { type: 'BooleanTypeAnnotation' }, @@ -9,7 +8,7 @@ const constTypeMapping = { }; /** - * Infers type tags by using Flow type annotations + * Infers type tags by using Flow/TypeScript type annotations * * @name inferType * @param {Object} comment parsed comment @@ -20,7 +19,8 @@ function inferType(comment) { return comment; } - const path = findTarget(comment.context.ast); + const ast = comment.context.ast; + const path = findTarget(ast); if (!path) { return comment; } @@ -35,17 +35,37 @@ function inferType(comment) { } break; case 'ClassProperty': + case 'TSTypeAliasDeclaration': + case 'TSPropertySignature': type = n.typeAnnotation; break; + case 'ClassMethod': + case 'TSDeclareMethod': + if (n.kind === 'get') { + type = n.returnType; + } else if (n.kind === 'set' && n.params[0]) { + type = n.params[0].typeAnnotation; + } + break; case 'TypeAlias': type = n.right; break; + case 'TSEnumMember': + if (n.initializer) { + if (constTypeMapping[n.initializer.type]) { + type = constTypeMapping[n.initializer.type]; + } + } else { + type = constTypeMapping.NumericLiteral; + } + break; + default: + if (ast.isObjectTypeProperty() && !ast.node.method) { + type = ast.node.value; + } } if (type) { - if (t.isTypeAnnotation(type)) { - type = type.typeAnnotation; - } - comment.type = flowDoctrine(type); + comment.type = typeAnnotation(type); } return comment; } diff --git a/src/parse.js b/src/parse.js index c67d180a8..db5bd5621 100644 --- a/src/parse.js +++ b/src/parse.js @@ -82,7 +82,10 @@ const flatteners = { desc: synonym('description'), description: flattenMarkdownDescription, emits: synonym('fires'), - enum: todo, + enum(result, tag) { + result.kind = 'enum'; + result.type = tag.type; + }, /** * Parse tag * @private @@ -171,7 +174,14 @@ const flatteners = { hideconstructor: flattenBoolean, host: synonym('external'), ignore: flattenBoolean, - implements: todo, + implements(result, tag) { + // Match @extends/@augments above. + if (!tag.name && tag.type && tag.type.name) { + tag.name = tag.type.name; + } + + result.implements.push(tag); + }, inheritdoc: todo, /** * Parse tag @@ -199,7 +209,7 @@ const flatteners = { * @returns {undefined} has side-effects */ interface(result, tag) { - result.interface = true; + result.kind = 'interface'; if (tag.description) { result.name = tag.description; } @@ -608,6 +618,7 @@ function parseJSDoc(comment, loc, context) { result.augments = []; result.errors = []; result.examples = []; + result.implements = []; result.params = []; result.properties = []; result.returns = []; diff --git a/src/parsers/javascript.js b/src/parsers/javascript.js index 5e69a293d..6e9b6ad82 100644 --- a/src/parsers/javascript.js +++ b/src/parsers/javascript.js @@ -36,7 +36,7 @@ function parseJavaScript(data, config) { const visited = new Set(); const commentsByNode = new Map(); - const ast = parseToAst(data.source); + const ast = parseToAst(data.source, data.file); const addComment = _addComment.bind(null, visited, commentsByNode); return _.flatMap( diff --git a/src/parsers/parse_to_ast.js b/src/parsers/parse_to_ast.js index b4d366f09..5cf2a16b2 100644 --- a/src/parsers/parse_to_ast.js +++ b/src/parsers/parse_to_ast.js @@ -1,28 +1,36 @@ const babelParser = require('@babel/parser'); +const path = require('path'); -const opts = { - allowImportExportEverywhere: true, - sourceType: 'module', - plugins: [ - 'asyncGenerators', - 'exportDefaultFrom', - 'optionalChaining', - 'classConstructorCall', - 'classPrivateProperties', - 'classProperties', - ['decorators', { decoratorsBeforeExport: false }], - 'doExpressions', - 'exportExtensions', - 'flow', - 'functionBind', - 'functionSent', - 'jsx', - 'objectRestSpread', - 'dynamicImport', - 'logicalAssignment' - ] +const TYPESCRIPT_EXTS = { + '.ts': true, + '.tsx': true }; +function getParserOpts(file) { + return { + allowImportExportEverywhere: true, + sourceType: 'module', + plugins: [ + 'asyncGenerators', + 'exportDefaultFrom', + 'optionalChaining', + 'classConstructorCall', + 'classPrivateProperties', + 'classProperties', + ['decorators', { decoratorsBeforeExport: false }], + 'doExpressions', + 'exportExtensions', + TYPESCRIPT_EXTS[path.extname(file || '')] ? 'typescript' : 'flow', + 'functionBind', + 'functionSent', + 'jsx', + 'objectRestSpread', + 'dynamicImport', + 'logicalAssignment' + ] + }; +} + /** * Convert flow comment types into flow annotations so that * they end up in the final AST. If the source does not contain @@ -37,8 +45,8 @@ function commentToFlow(source) { .replace(/\/\*:\s*([^]+?)\s*\*\//g, ':$1'); } -function parseToAst(source) { - return babelParser.parse(commentToFlow(source), opts); +function parseToAst(source, file) { + return babelParser.parse(commentToFlow(source), getParserOpts(file)); } module.exports.commentToFlow = commentToFlow; module.exports.parseToAst = parseToAst; diff --git a/src/ts_doctrine.js b/src/ts_doctrine.js new file mode 100644 index 000000000..efc6c4f26 --- /dev/null +++ b/src/ts_doctrine.js @@ -0,0 +1,178 @@ +const generate = require('@babel/generator').default; + +const namedTypes = { + TSNumberKeyword: 'number', + TSBooleanKeyword: 'boolean', + TSStringKeyword: 'string', + TSSymbolKeyword: 'symbol', + TSThisType: 'this', + TSObjectKeyword: 'object', + TSNeverKeyword: 'never' +}; + +const oneToOne = { + TSAnyKeyword: 'AllLiteral', + TSUnknownKeyword: 'AllLiteral', + TSNullKeyword: 'NullLiteral', + TSUndefinedKeyword: 'UndefinedLiteral', + TSVoidKeyword: 'VoidLiteral' +}; + +function propertyToField(property) { + if (!property.typeAnnotation) return null; + + let type = tsDoctrine(property.typeAnnotation.typeAnnotation); + if (property.optional) { + // Doctrine does not support optional fields but it does have something called optional types + // (which makes no sense, but let's play along). + type = { + type: 'OptionalType', + expression: type + }; + } + return { + type: 'FieldType', + key: property.key.name || property.key.value, + value: type + }; +} + +/** + * Babel parses TypeScript annotations in JavaScript into AST nodes. documentation.js uses + * Babel to parse TypeScript. This method restructures those Babel-generated + * objects into objects that fit the output of Doctrine, the module we use + * to parse JSDoc annotations. This lets us use TypeScript annotations _as_ + * JSDoc annotations. + * + * @private + * @param {Object} type babel-parsed typescript type + * @returns {Object} doctrine compatible type + */ +function tsDoctrine(type) { + if (type.type in namedTypes) { + const doctrineType = { + type: 'NameExpression', + name: namedTypes[type.type] + }; + return doctrineType; + } + + // TODO: unhandled types + // TSIntersectionType, TSConditionalType, TSInferType, TSTypeOperator, TSIndexedAccessType + // TSMappedType, TSImportType, TSTypePredicate, TSTypeQuery, TSExpressionWithTypeArguments + + if (type.type in oneToOne) { + return { type: oneToOne[type.type] }; + } + + switch (type.type) { + case 'TSOptionalType': + return { + type: 'NullableType', + expression: tsDoctrine(type.typeAnnotation) + }; + case 'TSParenthesizedType': + return tsDoctrine(type.typeAnnotation); + case 'TSUnionType': + return { + type: 'UnionType', + elements: type.types.map(tsDoctrine) + }; + // [number] + // [string, boolean, number] + case 'TSTupleType': + return { + type: 'ArrayType', + elements: type.elementTypes.map(tsDoctrine) + }; + // number[] + case 'TSArrayType': + return { + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: 'Array' + }, + applications: [tsDoctrine(type.elementType)] + }; + // ...string + case 'TSRestType': + return { + type: 'RestType', + expression: tsDoctrine(type.typeAnnotation) + }; + // (y: number) => bool + case 'TSFunctionType': + case 'TSConstructorType': + case 'TSMethodSignature': + return { + type: 'FunctionType', + params: type.parameters.map(param => { + if (param.type === 'RestElement') { + return { + type: 'RestType', + expression: { + type: 'ParameterType', + name: param.argument.name, + expression: tsDoctrine(param.typeAnnotation.typeAnnotation) + } + }; + } + + return { + type: 'ParameterType', + name: param.name, + expression: tsDoctrine(param.typeAnnotation.typeAnnotation) + }; + }), + result: tsDoctrine(type.typeAnnotation.typeAnnotation) + }; + + case 'TSTypeReference': + if (type.typeParameters) { + return { + type: 'TypeApplication', + expression: { + type: 'NameExpression', + name: generate(type.typeName, { + compact: true + }).code + }, + applications: type.typeParameters.params.map(tsDoctrine) + }; + } + + return { + type: 'NameExpression', + name: generate(type.typeName, { + compact: true + }).code + }; + + case 'TSTypeLiteral': + if (type.members) { + return { + type: 'RecordType', + fields: type.members.map(propertyToField).filter(x => x) + }; + } + + return { + type: 'NameExpression', + name: generate(type.id, { + compact: true + }).code + }; + case 'TSLiteralType': + return { + type: `${type.literal.type}Type`, + value: type.literal.value + }; + default: + return { + type: 'AllLiteral' + }; + } +} + +module.exports = tsDoctrine; diff --git a/src/type_annotation.js b/src/type_annotation.js new file mode 100644 index 000000000..258bb2149 --- /dev/null +++ b/src/type_annotation.js @@ -0,0 +1,21 @@ +const t = require('@babel/types'); +const flowDoctrine = require('./flow_doctrine'); +const tsDoctrine = require('./ts_doctrine'); + +function typeAnnotation(type) { + if (t.isFlow(type)) { + if (t.isTypeAnnotation(type)) { + type = type.typeAnnotation; + } + + return flowDoctrine(type); + } + + if (t.isTSTypeAnnotation(type)) { + type = type.typeAnnotation; + } + + return tsDoctrine(type); +} + +module.exports = typeAnnotation; From e050d27fabb39f092faea157389732992103fda0 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 25 Apr 2019 08:07:31 -0700 Subject: [PATCH 018/231] chore: Run prettier --- src/infer/augments.js | 5 ++++- src/infer/implements.js | 2 +- src/infer/kind.js | 19 +++++++++++++------ src/infer/membership.js | 38 +++++++++++++++++++++++++------------- src/infer/params.js | 21 ++++++++++++++------- src/infer/properties.js | 14 ++++++++++---- src/infer/return.js | 7 ++++++- src/type_annotation.js | 6 +++--- 8 files changed, 76 insertions(+), 36 deletions(-) diff --git a/src/infer/augments.js b/src/infer/augments.js index 2045c5d68..affcbe8d4 100644 --- a/src/infer/augments.js +++ b/src/infer/augments.js @@ -31,7 +31,10 @@ function inferAugments(comment) { name: generate(path.node.superClass).code }); } - } else if ((path.isInterfaceDeclaration() || path.isTSInterfaceDeclaration()) && path.node.extends) { + } else if ( + (path.isInterfaceDeclaration() || path.isTSInterfaceDeclaration()) && + path.node.extends + ) { /* * extends is an array of interface identifiers or * qualified type identifiers, so we generate code diff --git a/src/infer/implements.js b/src/infer/implements.js index c98015385..eb93f00f6 100644 --- a/src/infer/implements.js +++ b/src/infer/implements.js @@ -28,7 +28,7 @@ function inferImplements(comment) { comment.implements.push({ title: 'implements', name: generate(impl).code - }); + }); }); } diff --git a/src/infer/kind.js b/src/infer/kind.js index e1cab5faf..8d8d7aad5 100644 --- a/src/infer/kind.js +++ b/src/infer/kind.js @@ -22,10 +22,10 @@ function inferKind(comment) { comment.abstract = true; } } else if ( - t.isFunction(node) || - t.isTSDeclareMethod(node) || - t.isTSDeclareFunction(node) || - t.isFunctionTypeAnnotation(node) || + t.isFunction(node) || + t.isTSDeclareMethod(node) || + t.isTSDeclareFunction(node) || + t.isFunctionTypeAnnotation(node) || t.isTSMethodSignature(node) ) { if (node.kind === 'get' || node.kind === 'set') { @@ -46,7 +46,10 @@ function inferKind(comment) { } } else if (t.isTypeAlias(node) || t.isTSTypeAliasDeclaration(node)) { comment.kind = 'typedef'; - } else if (t.isInterfaceDeclaration(node) || t.isTSInterfaceDeclaration(node)) { + } else if ( + t.isInterfaceDeclaration(node) || + t.isTSInterfaceDeclaration(node) + ) { comment.kind = 'interface'; } else if (t.isVariableDeclaration(node)) { if (node.kind === 'const') { @@ -65,7 +68,11 @@ function inferKind(comment) { } else if (t.isExpressionStatement(node)) { // module.exports = function() {} findKind(node.expression.right); - } else if (t.isClassProperty(node) || t.isTSPropertySignature(node) || t.isTSEnumMember(node)) { + } else if ( + t.isClassProperty(node) || + t.isTSPropertySignature(node) || + t.isTSEnumMember(node) + ) { comment.kind = 'member'; } else if (t.isProperty(node)) { // { foo: function() {} } diff --git a/src/infer/membership.js b/src/infer/membership.js index 29a955c70..ee69186c6 100644 --- a/src/infer/membership.js +++ b/src/infer/membership.js @@ -341,7 +341,9 @@ module.exports = function() { // class Foo { prop: T } // var Foo = class { prop: T } if ( - (path.isClassMethod() || path.isClassProperty() || path.isTSDeclareMethod()) && + (path.isClassMethod() || + path.isClassProperty() || + path.isTSDeclareMethod()) && path.parentPath.isClassBody() && path.parentPath.parentPath.isClass() ) { @@ -402,7 +404,11 @@ module.exports = function() { const objectKeys = []; while (!objectParent.isStatement()) { - if (objectParent.isObjectProperty() || objectParent.isObjectTypeProperty() || objectParent.isTSPropertySignature()) { + if ( + objectParent.isObjectProperty() || + objectParent.isObjectTypeProperty() || + objectParent.isTSPropertySignature() + ) { objectKeys.unshift(objectParent.node.key.name); } @@ -413,15 +419,18 @@ module.exports = function() { findLendsIdentifiers(objectParent.get('properties')[0]); if (lendsIdentifiers) { - return inferMembershipFromIdentifiers(comment, [...lendsIdentifiers, ...objectKeys]); + return inferMembershipFromIdentifiers(comment, [ + ...lendsIdentifiers, + ...objectKeys + ]); } else if (objectParent.parentPath.isAssignmentExpression()) { // Foo = { ... }; // Foo.prototype = { ... }; // Foo.bar = { ... }; - return inferMembershipFromIdentifiers( - comment, - [...extractIdentifiers(objectParent.parentPath.get('left')), ...objectKeys] - ); + return inferMembershipFromIdentifiers(comment, [ + ...extractIdentifiers(objectParent.parentPath.get('left')), + ...objectKeys + ]); } else if (objectParent.parentPath.isVariableDeclarator()) { // var Foo = { ... }; return inferMembershipFromIdentifiers(comment, [ @@ -434,20 +443,23 @@ module.exports = function() { inferModuleName(currentModule || comment), ...objectKeys ]); - } else if (objectParent.parentPath.isTypeAlias() || objectParent.parentPath.isTSTypeAliasDeclaration()) { + } else if ( + objectParent.parentPath.isTypeAlias() || + objectParent.parentPath.isTSTypeAliasDeclaration() + ) { // type X = { ... } return inferMembershipFromIdentifiers(comment, [ objectParent.parentPath.node.id.name, ...objectKeys ]); - } else if (objectParent.parentPath.isInterfaceDeclaration() || objectParent.parentPath.isTSInterfaceDeclaration()) { + } else if ( + objectParent.parentPath.isInterfaceDeclaration() || + objectParent.parentPath.isTSInterfaceDeclaration() + ) { // interface Foo { ... } return inferMembershipFromIdentifiers( comment, - [ - ...inferClassMembership(objectParent.parentPath), - ...objectKeys - ], + [...inferClassMembership(objectParent.parentPath), ...objectKeys], 'instance' ); } diff --git a/src/infer/params.js b/src/infer/params.js index 491bc6a95..4c5c0c15c 100644 --- a/src/infer/params.js +++ b/src/infer/params.js @@ -38,8 +38,8 @@ function inferParams(comment) { } if ( - !t.isFunction(path) && - !t.isTSDeclareFunction(path) && + !t.isFunction(path) && + !t.isTSDeclareFunction(path) && !t.isTSDeclareMethod(path) && !t.isFunctionTypeAnnotation(path) && !t.isTSMethodSignature(path) @@ -51,7 +51,9 @@ function inferParams(comment) { return comment; } - let params = t.isTSMethodSignature(path) ? path.node.parameters : path.node.params; + let params = t.isTSMethodSignature(path) + ? path.node.parameters + : path.node.params; // Flow function annotations separate rest parameters into a different list if (t.isFunctionTypeAnnotation(path) && path.node.rest) { @@ -163,7 +165,8 @@ function paramToDoc(param, prefix, i) { title: 'param', name: autoName, anonymous: true, - type: (param.typeAnnotation && typeAnnotation(param.typeAnnotation)) || { + type: (param.typeAnnotation && + typeAnnotation(param.typeAnnotation)) || { type: 'NameExpression', name: 'Object' }, @@ -179,7 +182,8 @@ function paramToDoc(param, prefix, i) { title: 'param', name: prefixedName, anonymous: true, - type: (param.typeAnnotation && typeAnnotation(param.typeAnnotation)) || { + type: (param.typeAnnotation && + typeAnnotation(param.typeAnnotation)) || { type: 'NameExpression', name: 'Object' }, @@ -203,7 +207,8 @@ function paramToDoc(param, prefix, i) { title: 'param', name: autoName, anonymous: true, - type: (param.typeAnnotation && typeAnnotation(param.typeAnnotation)) || { + type: (param.typeAnnotation && + typeAnnotation(param.typeAnnotation)) || { type: 'NameExpression', name: 'Array' }, @@ -259,7 +264,9 @@ function paramToDoc(param, prefix, i) { title: 'param', name: prefix ? prefix + '.' + param.name.name : param.name.name, lineNumber: param.loc.start.line, - type: param.typeAnnotation ? typeAnnotation(param.typeAnnotation) : undefined + type: param.typeAnnotation + ? typeAnnotation(param.typeAnnotation) + : undefined }; default: { // (a) diff --git a/src/infer/properties.js b/src/infer/properties.js index 6d9d1be93..5af742042 100644 --- a/src/infer/properties.js +++ b/src/infer/properties.js @@ -10,11 +10,14 @@ function prefixedName(name, prefix) { function propertyToDoc(property, prefix) { let type; - if (property.type === 'ObjectTypeProperty') { // flow + if (property.type === 'ObjectTypeProperty') { + // flow type = typeAnnotation(property.value); - } else if (property.type === 'TSPropertySignature') { // typescript + } else if (property.type === 'TSPropertySignature') { + // typescript type = typeAnnotation(property.typeAnnotation); - } else if (property.type === 'TSMethodSignature') { // typescript + } else if (property.type === 'TSMethodSignature') { + // typescript type = typeAnnotation(property); } const name = property.key.name || property.key.value; @@ -45,7 +48,10 @@ function inferProperties(comment) { comment.properties.forEach(prop => explicitProperties.add(prop.name)); function inferProperties(value, prefix) { - if (value.type === 'ObjectTypeAnnotation' || value.type === 'TSTypeLiteral') { + if ( + value.type === 'ObjectTypeAnnotation' || + value.type === 'TSTypeLiteral' + ) { const properties = value.properties || value.members || value.body || []; properties.forEach(function(property) { if (!explicitProperties.has(prefixedName(property.key.name, prefix))) { diff --git a/src/infer/return.js b/src/infer/return.js index 98c952834..8dc1ecdc4 100644 --- a/src/infer/return.js +++ b/src/infer/return.js @@ -99,7 +99,12 @@ function inferReturn(comment) { } function getReturnType(fn) { - if (t.isFunction(fn) || t.isTSDeclareFunction(fn) || t.isTSDeclareMethod(fn) || t.isFunctionTypeAnnotation(fn)) { + if ( + t.isFunction(fn) || + t.isTSDeclareFunction(fn) || + t.isTSDeclareMethod(fn) || + t.isFunctionTypeAnnotation(fn) + ) { return fn.returnType; } diff --git a/src/type_annotation.js b/src/type_annotation.js index 258bb2149..45884d691 100644 --- a/src/type_annotation.js +++ b/src/type_annotation.js @@ -7,10 +7,10 @@ function typeAnnotation(type) { if (t.isTypeAnnotation(type)) { type = type.typeAnnotation; } - - return flowDoctrine(type); + + return flowDoctrine(type); } - + if (t.isTSTypeAnnotation(type)) { type = type.typeAnnotation; } From fafea23bffb00b6b02022b0d65abde7083da3d9a Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 25 Apr 2019 08:15:48 -0700 Subject: [PATCH 019/231] chore(release): 10.1.0 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2651dbf13..4a5e6cff5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [10.1.0](https://github.com/documentationjs/documentation/compare/v10.0.0...v10.1.0) (2019-04-25) + + +### Features + +* TypeScript support & inference ([3773e02](https://github.com/documentationjs/documentation/commit/3773e02)) + + + # [10.0.0](https://github.com/documentationjs/documentation/compare/v10.0.0-alpha.0...v10.0.0) (2019-04-18) diff --git a/package.json b/package.json index c2843043c..5a4950f8f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "10.0.0", + "version": "10.1.0", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From 8fa141da77fdc8f9817db27abac0dff593277f52 Mon Sep 17 00:00:00 2001 From: Vincent Kocupyr Date: Tue, 7 May 2019 16:46:58 +0200 Subject: [PATCH 020/231] feat: Support exportNamespaceFrom in parser --- src/parsers/parse_to_ast.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parsers/parse_to_ast.js b/src/parsers/parse_to_ast.js index 5cf2a16b2..6b8065be7 100644 --- a/src/parsers/parse_to_ast.js +++ b/src/parsers/parse_to_ast.js @@ -13,6 +13,7 @@ function getParserOpts(file) { plugins: [ 'asyncGenerators', 'exportDefaultFrom', + 'exportNamespaceFrom', 'optionalChaining', 'classConstructorCall', 'classPrivateProperties', From fa1b0b51d2483ad757f1e18479cb530dec5384ec Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 7 May 2019 12:41:07 -0700 Subject: [PATCH 021/231] feat: Enable all parser plugins BREAKING CHANGE: this removes support for legacy decorators, because in one place we had legacy and in another we didn't. --- .prettierignore | 1 + __tests__/__snapshots__/test.js.snap | 153 ++++++++++++++++++++++++++- __tests__/fixture/es6.input.js | 15 +++ src/input/dependency.js | 4 +- src/parsers/parse_to_ast.js | 46 +++++--- 5 files changed, 200 insertions(+), 19 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..d826961de --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +__tests__/fixture diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index e67531100..4472a6bb5 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -11111,10 +11111,114 @@ It takes a ", "todos": Array [], "yields": Array [], }, + Object { + "augments": Array [], + "context": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 189, + }, + "start": Object { + "column": 0, + "line": 177, + }, + }, + }, + "description": Object { + "children": Array [ + Object { + "children": Array [ + Object { + "position": Object { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "babel parser plugins", + }, + ], + "position": Object { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + ], + "position": Object { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", + }, + "errors": Array [], + "examples": Array [], + "implements": Array [], + "kind": "class", + "loc": Object { + "end": Object { + "column": 27, + "line": 176, + }, + "start": Object { + "column": 0, + "line": 176, + }, + }, + "members": Object { + "events": Array [], + "global": Array [], + "inner": Array [], + "instance": Array [], + "static": Array [], + }, + "name": "A", + "namespace": "A", + "params": Array [], + "path": Array [ + Object { + "kind": "class", + "name": "A", + }, + ], + "properties": Array [], + "returns": Array [], + "sees": Array [], + "tags": Array [], + "throws": Array [], + "todos": Array [], + "yields": Array [], + }, ] `; -exports[`outputs es6.input.js markdown 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"`; +exports[`outputs es6.input.js markdown 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"`; exports[`outputs es6.input.js markdown AST 1`] = ` Object { @@ -13585,6 +13689,51 @@ It takes a ", ], "type": "paragraph", }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "A", + }, + ], + "depth": 2, + "type": "heading", + }, + Object { + "children": Array [ + Object { + "position": Position { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "babel parser plugins", + }, + ], + "position": Position { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, Object { "identifier": "1", "title": undefined, @@ -13638,7 +13787,7 @@ It takes a ", } `; -exports[`outputs es6.input.js no markdown TOC 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"`; +exports[`outputs es6.input.js no markdown TOC 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"`; exports[`outputs es6-class.input.js JSON 1`] = ` Array [ diff --git a/__tests__/fixture/es6.input.js b/__tests__/fixture/es6.input.js index dde95b11e..a300409a2 100644 --- a/__tests__/fixture/es6.input.js +++ b/__tests__/fixture/es6.input.js @@ -172,3 +172,18 @@ export function isArrayEqualWith( export function paramWithMemberType(a: atype.property): boolean { return true; } + +/** babel parser plugins */ +class A { + // classPrivateProperties + #b = 1; + // classPrivateMethods + #c(a, b) { + // numericSeparator + let y = 100_000; + // nullishCoalescingOperator + let x = a ?? b; + // logicalAssignment + return x &&= b?.b |> String.fromCharCode; + } +} diff --git a/src/input/dependency.js b/src/input/dependency.js index e8f4f99b1..b1348c405 100644 --- a/src/input/dependency.js +++ b/src/input/dependency.js @@ -3,6 +3,7 @@ const path = require('path'); const babelify = require('babelify'); const concat = require('concat-stream'); const moduleFilters = require('../module_filters'); +const { standardBabelParserPlugins } = require('../parsers/parse_to_ast'); const smartGlob = require('../smart_glob.js'); const STANDARD_BABEL_CONFIG = { @@ -10,6 +11,7 @@ const STANDARD_BABEL_CONFIG = { compact: false, cwd: path.resolve(__dirname, '../../'), presets: ['@babel/preset-react', '@babel/preset-env', '@babel/preset-flow'], + parserOpts: { plugins: standardBabelParserPlugins }, plugins: [ // Stage 0 '@babel/plugin-proposal-function-bind', @@ -21,7 +23,7 @@ const STANDARD_BABEL_CONFIG = { ['@babel/plugin-proposal-nullish-coalescing-operator', { loose: false }], '@babel/plugin-proposal-do-expressions', // Stage 2 - ['@babel/plugin-proposal-decorators', { legacy: true }], + ['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }], '@babel/plugin-proposal-function-sent', '@babel/plugin-proposal-export-namespace-from', '@babel/plugin-proposal-numeric-separator', diff --git a/src/parsers/parse_to_ast.js b/src/parsers/parse_to_ast.js index 6b8065be7..74b61d355 100644 --- a/src/parsers/parse_to_ast.js +++ b/src/parsers/parse_to_ast.js @@ -6,28 +6,42 @@ const TYPESCRIPT_EXTS = { '.tsx': true }; +const standardBabelParserPlugins = [ + 'asyncGenerators', + 'bigInt', + 'classProperties', + 'classConstructorCall', + 'classPrivateProperties', + 'classPrivateMethods', + 'doExpressions', + 'dynamicImport', + 'exportDefaultFrom', + 'exportNamespaceFrom', + 'exportExtensions', + 'functionBind', + 'functionSent', + 'jsx', + 'logicalAssignment', + 'nullishCoalescingOperator', + 'numericSeparator', + 'objectRestSpread', + 'optionalCatchBinding', + 'optionalChaining', + 'partialApplication', + ['pipelineOperator', { proposal: 'minimal' }], + 'throwExpressions' +]; + +module.exports.standardBabelParserPlugins = standardBabelParserPlugins; + function getParserOpts(file) { return { allowImportExportEverywhere: true, sourceType: 'module', plugins: [ - 'asyncGenerators', - 'exportDefaultFrom', - 'exportNamespaceFrom', - 'optionalChaining', - 'classConstructorCall', - 'classPrivateProperties', - 'classProperties', + ...standardBabelParserPlugins, ['decorators', { decoratorsBeforeExport: false }], - 'doExpressions', - 'exportExtensions', - TYPESCRIPT_EXTS[path.extname(file || '')] ? 'typescript' : 'flow', - 'functionBind', - 'functionSent', - 'jsx', - 'objectRestSpread', - 'dynamicImport', - 'logicalAssignment' + TYPESCRIPT_EXTS[path.extname(file || '')] ? 'typescript' : 'flow' ] }; } From 4ea3a95539513029fc1bafddad4e770934b7d019 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 7 May 2019 12:45:15 -0700 Subject: [PATCH 022/231] test: Fix markdown test snapshots --- __tests__/__snapshots__/test.js.snap | 2192 +++++++++++++++++++++++++- __tests__/test.js | 2 +- 2 files changed, 2143 insertions(+), 51 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 4472a6bb5..1f029f448 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -3490,7 +3490,28 @@ Array [ ] `; -exports[`outputs boolean-literal-type.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs boolean-literal-type.input.js markdown 1`] = ` +" + +### Table of Contents + +- [f][1] + - [Parameters][2] + +## f + +### Parameters + +- \`t\` **\`true\`** +- \`f\` **\`false\`** + +Returns **\\\\[\`true\`, \`false\`]** + +[1]: #f + +[2]: #parameters +" +`; exports[`outputs boolean-literal-type.input.js markdown AST 1`] = ` Object { @@ -4273,7 +4294,58 @@ Array [ ] `; -exports[`outputs class.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs class.input.js markdown 1`] = ` +" + +### Table of Contents + +- [MyClass][1] + - [Properties][2] + - [getFoo][3] + - [Parameters][4] + - [getUndefined][5] + +## MyClass + +This is my class, a demo thing. + +### Properties + +- \`howMany\` **[number][6]** how many things it contains + +### getFoo + +Get the number 42 + +#### Parameters + +- \`getIt\` **[boolean][7]** whether to get the number + +Returns **[number][6]** forty-two + +### getUndefined + +Get undefined + +Returns **[undefined][8]** does not return anything. + +[1]: #myclass + +[2]: #properties + +[3]: #getfoo + +[4]: #parameters + +[5]: #getundefined + +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean + +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined +" +`; exports[`outputs class.input.js markdown AST 1`] = ` Object { @@ -4967,7 +5039,27 @@ Array [ ] `; -exports[`outputs default-export-function.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs default-export-function.input.js markdown 1`] = ` +" + +### Table of Contents + +- [default-export-function.input][1] +- [bar][2] + +## default-export-function.input + +i am foo + +## bar + +i am foo's son + +[1]: #default-export-functioninput + +[2]: #bar +" +`; exports[`outputs default-export-function.input.js markdown AST 1`] = ` Object { @@ -6942,7 +7034,239 @@ Array [ ] `; -exports[`outputs document-exported.input.js markdown 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"`; +exports[`outputs document-exported.input.js markdown 1`] = ` +" + +### Table of Contents + +- [z][1] + - [zMethod][2] +- [x][3] + - [Parameters][4] +- [Class][5] + - [Parameters][6] + - [classMethod][7] + - [classGetter][8] + - [classSetter][9] + - [Parameters][10] + - [staticMethod][11] + - [staticGetter][12] + - [staticSetter][13] + - [Parameters][14] +- [T5][15] +- [y2Default][16] +- [y4][17] + - [Parameters][18] +- [object][19] + - [method][20] + - [getter][21] + - [setter][22] + - [Parameters][23] + - [prop][24] + - [func][25] +- [f1][26] +- [f3][27] +- [T][28] +- [T2][29] +- [T4][30] +- [f4][31] + - [Parameters][32] +- [o1][33] + - [om1][34] +- [f5][35] + - [Parameters][36] +- [o2][37] + - [om2][38] + +## z + +### zMethod + +## x + +### Parameters + +- \`yparam\` + +## Class + +### Parameters + +- \`a\` **[string][39]** + +### classMethod + +### classGetter + +### classSetter + +#### Parameters + +- \`v\` + +### staticMethod + +### staticGetter + +### staticSetter + +#### Parameters + +- \`v\` + +## T5 + +Type: [boolean][40] + +## y2Default + +## y4 + +Description of y3 + +### Parameters + +- \`p\` **[number][41]** + +Returns **void** + +## object + +### method + +### getter + +### setter + +#### Parameters + +- \`v\` + +### prop + +### func + +## f1 + +## f3 + +## T + +Type: [number][41] + +## T2 + +Type: [string][39] + +## T4 + +Type: [string][39] + +## f4 + +### Parameters + +- \`x\` **X** + +## o1 + +### om1 + +## f5 + +f5 comment + +### Parameters + +- \`y\` **Y** + +## o2 + +### om2 + +[1]: #z + +[2]: #zmethod + +[3]: #x + +[4]: #parameters + +[5]: #class + +[6]: #parameters-1 + +[7]: #classmethod + +[8]: #classgetter + +[9]: #classsetter + +[10]: #parameters-2 + +[11]: #staticmethod + +[12]: #staticgetter + +[13]: #staticsetter + +[14]: #parameters-3 + +[15]: #t5 + +[16]: #y2default + +[17]: #y4 + +[18]: #parameters-4 + +[19]: #object + +[20]: #method + +[21]: #getter + +[22]: #setter + +[23]: #parameters-5 + +[24]: #prop + +[25]: #func + +[26]: #f1 + +[27]: #f3 + +[28]: #t + +[29]: #t2 + +[30]: #t4 + +[31]: #f4 + +[32]: #parameters-6 + +[33]: #o1 + +[34]: #om1 + +[35]: #f5 + +[36]: #parameters-7 + +[37]: #o2 + +[38]: #om2 + +[39]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[40]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean + +[41]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs document-exported.input.js markdown AST 1`] = ` Object { @@ -7915,7 +8239,23 @@ Array [ ] `; -exports[`outputs document-exported-export-default-object.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs document-exported-export-default-object.input.js markdown 1`] = ` +" + +### Table of Contents + +- [document-exported-export-default-object.input][1] +- [x][2] + +## document-exported-export-default-object.input + +## x + +[1]: #document-exported-export-default-objectinput + +[2]: #x +" +`; exports[`outputs document-exported-export-default-object.input.js markdown AST 1`] = ` Object { @@ -8005,7 +8345,18 @@ Array [ ] `; -exports[`outputs document-exported-export-default-value.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs document-exported-export-default-value.input.js markdown 1`] = ` +" + +### Table of Contents + +- [document-exported-export-default-value.input][1] + +## document-exported-export-default-value.input + +[1]: #document-exported-export-default-valueinput +" +`; exports[`outputs document-exported-export-default-value.input.js markdown AST 1`] = ` Object { @@ -11218,7 +11569,300 @@ It takes a ", ] `; -exports[`outputs es6.input.js markdown 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"`; +exports[`outputs es6.input.js markdown 1`] = ` +" + +### Table of Contents + +- [destructure][1] + - [Parameters][2] +- [destructure][3] + - [Parameters][4] + - [Examples][5] +- [multiply][6] + - [Parameters][7] +- [Sink][8] + - [Parameters][9] + - [Examples][10] + - [staticProp][11] + - [empty][12] + - [classprop][13] + - [Parameters][14] + - [aGetter][15] + - [hello][16] +- [makeABasket][17] +- [makeASink][18] +- [functionWithRest][19] + - [Parameters][20] +- [functionWithRestAndType][21] + - [Parameters][22] +- [foo][23] +- [es6.input][24] +- [veryImportantTransform][25] + - [Parameters][26] +- [iAmProtected][27] +- [iAmPublic][28] +- [execute][29] +- [isArrayEqualWith][30] + - [Parameters][31] +- [paramWithMemberType][32] + - [Parameters][33] +- [A][34] + +## destructure + +This function destructures with defaults. It should not +have any parameter descriptions. + +### Parameters + +- \`$0\` **[Object][35]** (optional, default \`{}\`) + - \`$0.phoneNumbers\` (optional, default \`[]\`) + - \`$0.emailAddresses\` (optional, default \`[]\`) + - \`$0.params\` **...any** + +## destructure + +Similar, but with an array + +### Parameters + +- \`$0\` **[Array][36]** + - \`$0.0\` + - \`$0.1\` + - \`$0.2\` + +### Examples + +\`\`\`javascript +destructure([1, 2, 3]) +\`\`\` + +## multiply + +This function returns the number one. + +### Parameters + +- \`a\` **[Array][36]<[Number][37]>** an array of numbers +- \`b\` + +Returns **[Number][37]** numberone + +## Sink + +This is a sink + +### Parameters + +- \`height\` **[number][37]** the height of the thing +- \`width\` **[number][37]** the width of the thing + +### Examples + +\`\`\`javascript +@abc +class A { + @bind + say() {} +} +\`\`\` + +### staticProp + +This is a property of the sink. + +### empty + +Is it empty + +### classprop + +This uses the class property transform + +#### Parameters + +- \`a\` **[number][37]** + +Returns **[string][38]** + +### aGetter + +This is a getter method: it should be documented +as a property. + +### hello + +This method says hello + +## makeABasket + +This method returns a basket. The type should not be linked. + +Returns **Basket** a basket + +## makeASink + +This method returns a [sink][8]. The type should be linked. +It takes a [number][39] which should also be linked. + +Returns **[Sink][40]** a sink + +## functionWithRest + +This function takes rest params + +### Parameters + +- \`someParams\` **...any** + +## functionWithRestAndType + +So does this one, with types + +### Parameters + +- \`someParams\` **...[number][37]** + +## foo + +This is an async method + +## es6.input + +This function returns the number one. + +Returns **[Number][37]** numberone + +## veryImportantTransform + +This tests our support of optional parameters in ES6 + +### Parameters + +- \`foo\` (optional, default \`'bar'\`) + +## iAmProtected + +A protected function + +## iAmPublic + +A public function + +## execute + +This is re-exported + +## isArrayEqualWith + +Regression check for #498 + +### Parameters + +- \`array1\` **[Array][36]<T>** +- \`array2\` **[Array][36]<T>** +- \`compareFunction\` **function (a: T, b: T): [boolean][41]** (optional, default \`(a:T,b:T):boolean=>a===b\`) + +Returns **[boolean][41]** + +## paramWithMemberType + +Regression check for #749 + +### Parameters + +- \`a\` **atype.property** + +Returns **[boolean][41]** + +## A + +babel parser plugins + +[1]: #destructure + +[2]: #parameters + +[3]: #destructure-1 + +[4]: #parameters-1 + +[5]: #examples + +[6]: #multiply + +[7]: #parameters-2 + +[8]: #sink + +[9]: #parameters-3 + +[10]: #examples-1 + +[11]: #staticprop + +[12]: #empty + +[13]: #classprop + +[14]: #parameters-4 + +[15]: #agetter + +[16]: #hello + +[17]: #makeabasket + +[18]: #makeasink + +[19]: #functionwithrest + +[20]: #parameters-5 + +[21]: #functionwithrestandtype + +[22]: #parameters-6 + +[23]: #foo + +[24]: #es6input + +[25]: #veryimportanttransform + +[26]: #parameters-7 + +[27]: #iamprotected + +[28]: #iampublic + +[29]: #execute + +[30]: #isarrayequalwith + +[31]: #parameters-8 + +[32]: #paramwithmembertype + +[33]: #parameters-9 + +[34]: #a + +[35]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object + +[36]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array + +[37]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[38]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[39]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[40]: #sink + +[41]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +" +`; exports[`outputs es6.input.js markdown AST 1`] = ` Object { @@ -14284,7 +14928,66 @@ Array [ ] `; -exports[`outputs es6-class.input.js markdown 1`] = `"[object Object],[object Object],[object Object]"`; +exports[`outputs es6-class.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Foo][1] +- [Bar][2] + - [Parameters][3] + - [bar][4] +- [Baz][5] + - [Parameters][6] + +## Foo + +**Extends React.Component** + +This is my component. This is from issue #458 + +## Bar + +Does nothing. This is from issue #556 + +### Parameters + +- \`str\` **[string][7]** + +### bar + +A useless property + +Type: [string][7] + +## Baz + +This class has fully inferred constructor parameters. + +### Parameters + +- \`n\` **[number][8]** +- \`l\` **[Array][9]<[string][7]>** + +[1]: #foo + +[2]: #bar + +[3]: #parameters + +[4]: #bar-1 + +[5]: #baz + +[6]: #parameters-1 + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array +" +`; exports[`outputs es6-class.input.js markdown AST 1`] = ` Object { @@ -15065,7 +15768,42 @@ Array [ ] `; -exports[`outputs es6-class-property.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs es6-class-property.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Issue906][1] + - [readWriteProp][2] + - [readOnlyProp][3] + +## Issue906 + +This is for issue 906. + +### readWriteProp + +This is a read-write property. + +Type: [boolean][4] + +### readOnlyProp + +This is a read-only property. + +Type: [string][5] + +[1]: #issue906 + +[2]: #readwriteprop + +[3]: #readonlyprop + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +" +`; exports[`outputs es6-class-property.input.js markdown AST 1`] = ` Object { @@ -15337,7 +16075,25 @@ Array [ ] `; -exports[`outputs es6-default2.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs es6-default2.input.js markdown 1`] = ` +" + +### Table of Contents + +- [es6-default2.input][1] + - [Parameters][2] + +## es6-default2.input + +### Parameters + +- \`thisIsTheArgument\` + +[1]: #es6-default2input + +[2]: #parameters +" +`; exports[`outputs es6-default2.input.js markdown AST 1`] = ` Object { @@ -15860,7 +16616,47 @@ Array [ ] `; -exports[`outputs es6-import.input.js markdown 1`] = `"[object Object],[object Object],[object Object]"`; +exports[`outputs es6-import.input.js markdown 1`] = ` +" + +### Table of Contents + +- [multiplyTwice][1] + - [Parameters][2] +- [es6-ext][3] +- [simple.input][4] + +## multiplyTwice + +This function returns the number one. + +### Parameters + +- \`a\` + +Returns **[Number][5]** numberone + +## es6-ext + +This is the default export frogs! + +## simple.input + +This function returns the number one. + +Returns **[number][5]** numberone + +[1]: #multiplytwice + +[2]: #parameters + +[3]: #es6-ext + +[4]: #simpleinput + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs es6-import.input.js markdown AST 1`] = ` Object { @@ -16452,7 +17248,34 @@ Array [ ] `; -exports[`outputs event.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs event.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Map#mousemove][1] + - [Properties][2] + +## Map#mousemove + +Mouse event + +Type: [Object][3] + +### Properties + +- \`point\` **Point** the pixel location of the event +- \`originalEvent\` **[Event][4]** the original DOM event + +[1]: #mapmousemove + +[2]: #properties + +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object + +[4]: https://developer.mozilla.org/docs/Web/API/Event +" +`; exports[`outputs event.input.js markdown AST 1`] = ` Object { @@ -16939,7 +17762,36 @@ Array [ ] `; -exports[`outputs example-caption.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs example-caption.input.js markdown 1`] = ` +" + +### Table of Contents + +- [foo][1] + - [Examples][2] + +## foo + +This function returns the number one. + +### Examples + +demonstrates how to run foo + + +\`\`\`javascript +foo(1); +\`\`\` + +Returns **[Number][3]** numberone + +[1]: #foo + +[2]: #examples + +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs example-caption.input.js markdown AST 1`] = ` Object { @@ -17283,7 +18135,20 @@ Array [ ] `; -exports[`outputs external.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs external.input.js markdown 1`] = ` +" + +### Table of Contents + +- [foo][1] + +## foo + +I am in \`external.input.js\`. + +[1]: #foo +" +`; exports[`outputs external.input.js markdown AST 1`] = ` Object { @@ -17741,7 +18606,43 @@ Array [ ] `; -exports[`outputs factory.input.js markdown 1`] = `"[object Object],[object Object],[object Object]"`; +exports[`outputs factory.input.js markdown 1`] = ` +" + +### Table of Contents + +- [area][1] +- [area][2] +- [data][3] + - [Parameters][4] + +## area + +an area chart generator + +Returns **[area][5]** chart + +## area + +## data + +Sets the chart data. + +### Parameters + +- \`_\` + +[1]: #area + +[2]: #area-1 + +[3]: #data + +[4]: #parameters + +[5]: #area +" +`; exports[`outputs factory.input.js markdown AST 1`] = ` Object { @@ -18072,7 +18973,20 @@ Array [ ] `; -exports[`outputs flow-optional-chaining.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs flow-optional-chaining.input.js markdown 1`] = ` +" + +### Table of Contents + +- [value][1] + +## value + +value + +[1]: #value +" +`; exports[`outputs flow-optional-chaining.input.js markdown AST 1`] = ` Object { @@ -18533,7 +19447,48 @@ Array [ ] `; -exports[`outputs flow-unnamed-params.input.js markdown 1`] = `"[object Object],[object Object],[object Object]"`; +exports[`outputs flow-unnamed-params.input.js markdown 1`] = ` +" + +### Table of Contents + +- [x2][1] +- [T][2] +- [T2][3] + +## x2 + +x2 + +Type: function (a: [T][4]): [string][5] + +## T + +T + +Type: function ([Array][6]<[string][5]>): {num: [number][7]} + +## T2 + +T2 + +Type: function (a: [Array][6]<[string][5]>): {num: [number][7]} + +[1]: #x2 + +[2]: #t + +[3]: #t2 + +[4]: #t + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs flow-unnamed-params.input.js markdown AST 1`] = ` Object { @@ -19126,7 +20081,27 @@ Array [ ] `; -exports[`outputs infer-private.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs infer-private.input.js markdown 1`] = ` +" + +### Table of Contents + +- [C][1] + - [m][2] + +## C + +C description + +### m + +m description + +[1]: #c + +[2]: #m +" +`; exports[`outputs infer-private.input.js markdown AST 1`] = ` Object { @@ -19405,7 +20380,27 @@ Array [ ] `; -exports[`outputs inheritance.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs inheritance.input.js markdown 1`] = ` +" + +### Table of Contents + +- [SpecialArray][1] +- [Foo][2] + +## SpecialArray + +**Extends Array** + +With ES6, built-in types are extensible! + +## Foo + +[1]: #specialarray + +[2]: #foo +" +`; exports[`outputs inheritance.input.js markdown AST 1`] = ` Object { @@ -20171,7 +21166,56 @@ and ", ] `; -exports[`outputs inline-link.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs inline-link.input.js markdown 1`] = ` +" + +### Table of Contents + +- [addOne][1] + - [Parameters][2] +- [inline-link.input][3] + - [Parameters][4] + +## addOne + +Adds one to a number + +### Parameters + +- \`a\` **[number][5]** the input + +Returns **[number][5]** the output + +## inline-link.input + +This function returns the number one. Internally, this uses +[addOne][1] to do the math. This demonstrates +[Addition][6] +and [https://en.wikipedia.org/wiki/Addition][6] + +This link refers to nothing: [nothing][7] + +### Parameters + +- \`a\` **[number][5]** the input + +Returns **[number][5]** numberone + +[1]: #addone + +[2]: #parameters + +[3]: #inline-linkinput + +[4]: #parameters-1 + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[6]: https://en.wikipedia.org/wiki/Addition + +[7]: nothing +" +`; exports[`outputs inline-link.input.js markdown AST 1`] = ` Object { @@ -21080,7 +22124,44 @@ Array [ ] `; -exports[`outputs interface.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs interface.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Foo][1] + - [prop1][2] + - [prop2][3] + +## Foo + +**Extends Bar, Baz** + +This is my interface. + +### prop1 + +This is prop 1 + +Type: [number][4] + +### prop2 + +This is prop 2 + +Type: [string][5] + +[1]: #foo + +[2]: #prop1 + +[3]: #prop2 + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +" +`; exports[`outputs interface.input.js markdown AST 1`] = ` Object { @@ -21442,7 +22523,20 @@ Array [ ] `; -exports[`outputs internal.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs internal.input.js markdown 1`] = ` +" + +### Table of Contents + +- [foo][1] + +## foo + +I am in \`external.input.js\`. + +[1]: #foo +" +`; exports[`outputs internal.input.js markdown AST 1`] = ` Object { @@ -22283,7 +23377,63 @@ Array [ ] `; -exports[`outputs lends.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs lends.input.js markdown 1`] = ` +" + +### Table of Contents + +- [TheClass][1] + - [my-field][2] + - [foo][3] + - [Parameters][4] + - [bar][5] + - [Parameters][6] + +## TheClass + +**Extends Augmented** + +A neat layout view + +### my-field + +My field + +### foo + +My neat function + +#### Parameters + +- \`word\` **[string][7]** your word + +Returns **[string][7]** your word but one better + +### bar + +My neat function + +#### Parameters + +- \`word\` **[string][7]** your word + +Returns **[string][7]** your word but one better + +[1]: #theclass + +[2]: #my-field + +[3]: #foo + +[4]: #parameters + +[5]: #bar + +[6]: #parameters-1 + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +" +`; exports[`outputs lends.input.js markdown AST 1`] = ` Object { @@ -23024,7 +24174,37 @@ Array [ ] `; -exports[`outputs literal_types.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs literal_types.input.js markdown 1`] = ` +" + +### Table of Contents + +- [f][1] + - [Parameters][2] +- [g][3] + - [Parameters][4] + +## f + +### Parameters + +- \`x\` **(\`\\"a\\"\` \\\\| \`\\"b\\"\` \\\\| \`\\"\\"\` \\\\| \`0\` \\\\| \`-42\` \\\\| \`3.14\`)** + +## g + +### Parameters + +- \`x\` **(\`\\"a\\"\` \\\\| \`\\"b\\"\` \\\\| \`\\"\\"\` \\\\| \`0\` \\\\| \`-42\` \\\\| \`3.14\`)** + +[1]: #f + +[2]: #parameters + +[3]: #g + +[4]: #parameters-1 +" +`; exports[`outputs literal_types.input.js markdown AST 1`] = ` Object { @@ -23810,7 +24990,51 @@ Array [ ] `; -exports[`outputs memberedclass.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs memberedclass.input.js markdown 1`] = ` +" + +### Table of Contents + +- [MyClass][1] + - [getFoo][2] + - [Parameters][3] + - [getUndefined][4] + +## MyClass + +This is my class, a demo thing. + +### getFoo + +Get the number 42 + +#### Parameters + +- \`getIt\` **[boolean][5]** whether to get the number + +Returns **[number][6]** forty-two + +### getUndefined + +Get undefined + +Returns **[undefined][7]** does not return anything. + +[1]: #myclass + +[2]: #getfoo + +[3]: #parameters + +[4]: #getundefined + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean + +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined +" +`; exports[`outputs memberedclass.input.js markdown AST 1`] = ` Object { @@ -24473,7 +25697,31 @@ Array [ ] `; -exports[`outputs merge-infered-type.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs merge-infered-type.input.js markdown 1`] = ` +" + +### Table of Contents + +- [addFive][1] + - [Parameters][2] + +## addFive + +Add five to \`x\`. + +### Parameters + +- \`x\` **[number][3]** The number to add five to. + +Returns **[number][3]** x plus five. + +[1]: #addfive + +[2]: #parameters + +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs merge-infered-type.input.js markdown AST 1`] = ` Object { @@ -25184,7 +26432,40 @@ Array [ ] `; -exports[`outputs meta.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs meta.input.js markdown 1`] = ` +" + +### Table of Contents + +- [meta.input][1] + +## meta.input + +- **See: [github][2]** +- **See: TestCase** +- **See: [markdown link][3]** + +This function returns the number one. + +Returns **[number][4]** numberone + +**Meta** + +- **version**: 1.0.0 +- **since**: 2.0.0 +- **copyright**: Tom MacWright + +- **license**: BSD + +[1]: #metainput + +[2]: http://github.com/ + +[3]: http://foo.com/ + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs meta.input.js markdown AST 1`] = ` Object { @@ -26079,7 +27360,49 @@ Array [ ] `; -exports[`outputs multisignature.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs multisignature.input.js markdown 1`] = ` +" + +### Table of Contents + +- [getTheTime][1] + - [Parameters][2] +- [getTheTime][3] + - [Parameters][4] + +## getTheTime + +Get the time + +### Parameters + +- \`time\` + +Returns **[Date][5]** the current date + +## getTheTime + +Set the time + +### Parameters + +- \`time\` **[Date][5]** the current time + +Returns **[undefined][6]** nothing + +[1]: #getthetime + +[2]: #parameters + +[3]: #getthetime-1 + +[4]: #parameters-1 + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date + +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined +" +`; exports[`outputs multisignature.input.js markdown AST 1`] = ` Object { @@ -26984,7 +28307,40 @@ Array [ ] `; -exports[`outputs nearby_params.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs nearby_params.input.js markdown 1`] = ` +" + +### Table of Contents + +- [sessions.create][1] + - [Parameters][2] + +## sessions.create + +Attempt to establish a cookie-based session in exchange for credentials. + +### Parameters + +- \`credentials\` **[object][3]** + - \`credentials.name\` **[string][4]** Login username. Also accepted as \`username\` or \`email\`. + - \`credentials.password\` **[string][4]** Login password +- \`callback\` **[function][5]?** Gets passed \`(err, { success:Boolean })\`. + +Returns **[Promise][6]** promise, to be resolved on success or rejected on failure + +[1]: #sessionscreate + +[2]: #parameters + +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function + +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise +" +`; exports[`outputs nearby_params.input.js markdown AST 1`] = ` Object { @@ -28359,7 +29715,62 @@ Array [ ] `; -exports[`outputs nest_params.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs nest_params.input.js markdown 1`] = ` +" + +### Table of Contents + +- [foo][1] + - [Parameters][2] +- [foo][3] + - [Parameters][4] + - [Properties][5] + +## foo + +### Parameters + +- \`employees\` **[Array][6]<[Object][7]>** The employees who are responsible for the project. + - \`employees[].name\` **[string][8]** The name of an employee. + - \`employees[].department\` **[string][8]** The employee's department. +- \`type\` **[string][8]** The employee's type. (optional, default \`minion\`) + +## foo + +### Parameters + +- \`options\` **[Object][7]** some options + - \`options.much\` **[number][9]** how much +- \`bar\` **[number][9]** something else + +### Properties + +- \`theTime\` **[Object][7]** the current time + - \`theTime.hours\` **[number][9]** + - \`theTime.minutes\` **[number][9]** + - \`theTime.seconds\` **[number][9]** + +Returns **[Object][7]** foo something else + +[1]: #foo + +[2]: #parameters + +[3]: #foo-1 + +[4]: #parameters-1 + +[5]: #properties + +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object + +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs nest_params.input.js markdown AST 1`] = ` Object { @@ -29470,7 +30881,28 @@ still work in the markdown table.", ] `; -exports[`outputs newline-in-description.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs newline-in-description.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Parameters][1] + +## + +A function. + +### Parameters + +- \`a\` **[Number][2]** The input to the function. + I should be able to continue the description on a new line, and have it + still work in the markdown table. + +[1]: #parameters + +[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs newline-in-description.input.js markdown AST 1`] = ` Object { @@ -29759,7 +31191,26 @@ Array [ ] `; -exports[`outputs no-name.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs no-name.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Parameters][1] + +## + +Set the time + +### Parameters + +- \`bar\` **[number][2]** + +[1]: #parameters + +[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs no-name.input.js markdown AST 1`] = ` Object { @@ -29982,7 +31433,32 @@ Array [ ] `; -exports[`outputs optional-record-field-type.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs optional-record-field-type.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Record][1] + - [Properties][2] + +## Record + +Type: {opt: [number][3]?, req: [string][4]} + +### Properties + +- \`opt\` **[number][3]?** +- \`req\` **[string][4]** + +[1]: #record + +[2]: #properties + +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +" +`; exports[`outputs optional-record-field-type.input.js markdown AST 1`] = ` Object { @@ -33029,7 +34505,213 @@ iterator destructure (RestElement)", ] `; -exports[`outputs params.input.js markdown 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"`; +exports[`outputs params.input.js markdown 1`] = ` +" + +### Table of Contents + +- [addThem][1] + - [Parameters][2] +- [fishesAndFoxes][3] + - [Parameters][4] +- [withDefault][5] + - [Parameters][6] +- [Foo][7] + - [method][8] + - [Parameters][9] +- [TraditionalObject][10] + - [traditionalMethod][11] + - [Parameters][12] +- [Address6][13] + - [Parameters][14] + - [Examples][15] +- [GeoJSONSource][16] + - [Parameters][17] +- [myfunc][18] + - [Parameters][19] +- [foo][20] + - [Parameters][21] +- [rotate][22] + - [Parameters][23] + +## addThem + +This function returns the number one. + +### Parameters + +- \`a\` +- \`b\` **[number][24]** the second param +- \`c\` +- \`$3\` **[Object][25]** + - \`$3.d\` + - \`$3.e\` + - \`$3.f\` + +## fishesAndFoxes + +This method has partially inferred params + +### Parameters + +- \`options\` **[Object][25]** + - \`options.fishes\` **[String][26]** number of kinds of fish + - \`options.foxes\` + +## withDefault + +This method has a type in the description and a default in the code + +### Parameters + +- \`x\` **[number][24]** (optional, default \`2\`) + +## Foo + +This is foo's documentation + +### method + +The method + +#### Parameters + +- \`x\` **[number][24]** Param to method + +## TraditionalObject + +Traditional object + +### traditionalMethod + +This method should acquire the param x + +#### Parameters + +- \`x\` + +## Address6 + +Represents an IPv6 address + +This tests our support of optional parameters + +### Parameters + +- \`address\` **[string][26]** An IPv6 address string +- \`groups\` **[number][24]** How many octets to parse (optional, default \`8\`) +- \`third\` **[number][24]?** A third argument +- \`foo\` **[Array][27]** to properly be parsed (optional, default \`[1]\`) + +### Examples + +\`\`\`javascript +var address = new Address6('2001::/32'); +\`\`\` + +## GeoJSONSource + +Create a GeoJSON data source instance given an options object + +This tests our support of nested parameters + +### Parameters + +- \`options\` **[Object][25]?** optional options + - \`options.data\` **([Object][25] \\\\| [string][26])** A GeoJSON data object or URL to it. + The latter is preferable in case of large GeoJSON files. + - \`options.maxzoom\` **[number][24]** Maximum zoom to preserve detail at. (optional, default \`14\`) + - \`options.buffer\` **[number][24]?** Tile buffer on each side. + - \`options.tolerance\` **[number][24]?** Simplification tolerance (higher means simpler). + +## myfunc + +This tests our support for parameters with explicit types but with default +values specified in code. + +### Parameters + +- \`x\` **[number][24]** an argument (optional, default \`123\`) + +Returns **[number][24]** some + +## foo + +This tests our support of JSDoc param tags without type information, +or any type information we could infer from annotations. + +### Parameters + +- \`address\` An IPv6 address string + +## rotate + +This tests our support for iterator rest inside an +iterator destructure (RestElement) + +### Parameters + +- \`input\` **[Array][27]** + - \`input.0\` **any** head of iterator + - \`input.xs\` **...any** body of iterator + +Returns **[Array][27]<any>** rotated such that the last element was the first + +[1]: #addthem + +[2]: #parameters + +[3]: #fishesandfoxes + +[4]: #parameters-1 + +[5]: #withdefault + +[6]: #parameters-2 + +[7]: #foo + +[8]: #method + +[9]: #parameters-3 + +[10]: #traditionalobject + +[11]: #traditionalmethod + +[12]: #parameters-4 + +[13]: #address6 + +[14]: #parameters-5 + +[15]: #examples + +[16]: #geojsonsource + +[17]: #parameters-6 + +[18]: #myfunc + +[19]: #parameters-7 + +[20]: #foo-1 + +[21]: #parameters-8 + +[22]: #rotate + +[23]: #parameters-9 + +[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object + +[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array +" +`; exports[`outputs params.input.js markdown AST 1`] = ` Object { @@ -35717,7 +37399,20 @@ Array [ ] `; -exports[`outputs react-jsx.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs react-jsx.input.js markdown 1`] = ` +" + +### Table of Contents + +- [apples][1] + +## apples + +apples + +[1]: #apples +" +`; exports[`outputs react-jsx.input.js markdown AST 1`] = ` Object { @@ -35778,7 +37473,12 @@ Object { exports[`outputs require-json.input.js JSON 1`] = `Array []`; -exports[`outputs require-json.input.js markdown 1`] = `""`; +exports[`outputs require-json.input.js markdown 1`] = ` +" + +### Table of Contents +" +`; exports[`outputs require-json.input.js markdown AST 1`] = ` Object { @@ -35794,7 +37494,12 @@ Object { exports[`outputs require-json-no-extension.input.js JSON 1`] = `Array []`; -exports[`outputs require-json-no-extension.input.js markdown 1`] = `""`; +exports[`outputs require-json-no-extension.input.js markdown 1`] = ` +" + +### Table of Contents +" +`; exports[`outputs require-json-no-extension.input.js markdown AST 1`] = ` Object { @@ -36646,7 +38351,83 @@ that doesn't crash anything!", ] `; -exports[`outputs sections.input.js markdown 1`] = `"[object Object],[object Object],[object Object],[object Object],[object Object]"`; +exports[`outputs sections.input.js markdown 1`] = ` +" + +### Table of Contents + +- [first][1] +- [first][2] +- [AClass][3] + - [second][4] +- [second][5] + - [foo][6] + - [Parameters][7] + - [bar][8] + - [Parameters][9] +- [third][10] + +## first + +This function is first + +## first + +forgot a memberof here... sure hope that doesn't crash anything! + +## AClass + +### second + +shares a name with a top level item referenced in the TOC... sure hope +that doesn't crash anything! + +## second + +This class has some members + +### foo + +second::foo + +#### Parameters + +- \`pork\` + +### bar + +second::bar + +#### Parameters + +- \`beans\` +- \`rice\` + +## third + +This function is third + +[1]: #first + +[2]: #first-1 + +[3]: #aclass + +[4]: #second + +[5]: #second-1 + +[6]: #foo + +[7]: #parameters + +[8]: #bar + +[9]: #parameters-1 + +[10]: #third +" +`; exports[`outputs sections.input.js markdown AST 1`] = ` Object { @@ -37267,7 +39048,24 @@ Array [ ] `; -exports[`outputs simple.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs simple.input.js markdown 1`] = ` +" + +### Table of Contents + +- [simple.input][1] + +## simple.input + +This function returns the number one. + +Returns **[number][2]** numberone + +[1]: #simpleinput + +[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs simple.input.js markdown AST 1`] = ` Object { @@ -37919,7 +39717,54 @@ plus 3.", ] `; -exports[`outputs simple-callback.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs simple-callback.input.js markdown 1`] = ` +" + +### Table of Contents + +- [takesSimpleCallback][1] + - [Parameters][2] +- [simpleCallback][3] + - [Parameters][4] + +## takesSimpleCallback + +This takes a number and a callback and calls the callback with the number +plus 3. + +### Parameters + +- \`n\` **[Number][5]** The number. +- \`cb\` **[simpleCallback][6]** The callback. + +## simpleCallback + +This callback takes an error and a number. + +Type: [Function][7] + +### Parameters + +- \`err\` **[Error][8]?** The error. +- \`n\` **[Number][5]** The number. + +[1]: #takessimplecallback + +[2]: #parameters + +[3]: #simplecallback + +[4]: #parameters-1 + +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[6]: #simplecallback + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function + +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error +" +`; exports[`outputs simple-callback.input.js markdown AST 1`] = ` Object { @@ -38579,7 +40424,24 @@ Array [ ] `; -exports[`outputs simple-hashbang.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs simple-hashbang.input.js markdown 1`] = ` +" + +### Table of Contents + +- [simple-hashbang.input][1] + +## simple-hashbang.input + +This function returns the number one. + +Returns **[Number][2]** numberone + +[1]: #simple-hashbanginput + +[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs simple-hashbang.input.js markdown AST 1`] = ` Object { @@ -38710,7 +40572,12 @@ Object { exports[`outputs simple-private.input.js JSON 1`] = `Array []`; -exports[`outputs simple-private.input.js markdown 1`] = `""`; +exports[`outputs simple-private.input.js markdown 1`] = ` +" + +### Table of Contents +" +`; exports[`outputs simple-private.input.js markdown AST 1`] = ` Object { @@ -38726,7 +40593,12 @@ Object { exports[`outputs simple-singlestar.input.js JSON 1`] = `Array []`; -exports[`outputs simple-singlestar.input.js markdown 1`] = `""`; +exports[`outputs simple-singlestar.input.js markdown 1`] = ` +" + +### Table of Contents +" +`; exports[`outputs simple-singlestar.input.js markdown AST 1`] = ` Object { @@ -38742,7 +40614,12 @@ Object { exports[`outputs simple-triplestar.input.js JSON 1`] = `Array []`; -exports[`outputs simple-triplestar.input.js markdown 1`] = `""`; +exports[`outputs simple-triplestar.input.js markdown 1`] = ` +" + +### Table of Contents +" +`; exports[`outputs simple-triplestar.input.js markdown AST 1`] = ` Object { @@ -39018,7 +40895,41 @@ Array [ ] `; -exports[`outputs simple-two.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs simple-two.input.js markdown 1`] = ` +" + +### Table of Contents + +- [returnTwo][1] + - [Parameters][2] + - [Examples][3] + +## returnTwo + +This function returns the number plus two. + +### Parameters + +- \`a\` **[Number][4]** the number + +### Examples + +\`\`\`javascript +var result = returnTwo(4); +// result is 6 +\`\`\` + +Returns **[Number][4]** numbertwo + +[1]: #returntwo + +[2]: #parameters + +[3]: #examples + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +" +`; exports[`outputs simple-two.input.js markdown AST 1`] = ` Object { @@ -39951,7 +41862,73 @@ Array [ ] `; -exports[`outputs sort-order-alpha.input.js markdown 1`] = `"[object Object],[object Object],[object Object],[object Object]"`; +exports[`outputs sort-order-alpha.input.js markdown 1`] = ` +" + +### Table of Contents + +- [C][1] + - [A][2] + - [a][3] + - [B][4] + - [b][5] +- [D][6] + - [A][7] + - [a][8] + - [B][9] + - [b][10] +- [a][11] +- [b][12] + +## C + +### A + +### a + +### B + +### b + +## D + +### A + +### a + +### B + +### b + +## a + +## b + +[1]: #c + +[2]: #a + +[3]: #a-1 + +[4]: #b + +[5]: #b-1 + +[6]: #d + +[7]: #a-2 + +[8]: #a-3 + +[9]: #b-2 + +[10]: #b-3 + +[11]: #a-4 + +[12]: #b-4 +" +`; exports[`outputs sort-order-alpha.input.js markdown AST 1`] = ` Object { @@ -40261,7 +42238,25 @@ Array [ ] `; -exports[`outputs string-literal-key.input.js markdown 1`] = `"[object Object],[object Object]"`; +exports[`outputs string-literal-key.input.js markdown 1`] = ` +" + +### Table of Contents + +- [MyContainerObject][1] +- [foo][2] + +## MyContainerObject + +## foo + +The foo property + +[1]: #mycontainerobject + +[2]: #foo +" +`; exports[`outputs string-literal-key.input.js markdown AST 1`] = ` Object { @@ -40748,7 +42743,56 @@ Array [ ] `; -exports[`outputs this-class.input.js markdown 1`] = `"[object Object],[object Object],[object Object]"`; +exports[`outputs this-class.input.js markdown 1`] = ` +" + +### Table of Contents + +- [bookshelf][1] +- [Book][2] + - [Parameters][3] + - [title][4] +- [BookShelf][5] + - [Parameters][6] + - [title][7] + +## bookshelf + +## Book + +### Parameters + +- \`title\` + +### title + +The title of the book. + +## BookShelf + +### Parameters + +- \`title\` + +### title + +The title of the bookshelf. + +[1]: #bookshelf + +[2]: #book + +[3]: #parameters + +[4]: #title + +[5]: #bookshelf-1 + +[6]: #parameters-1 + +[7]: #title-1 +" +`; exports[`outputs this-class.input.js markdown AST 1`] = ` Object { @@ -41165,7 +43209,31 @@ Array [ ] `; -exports[`outputs type_application.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs type_application.input.js markdown 1`] = ` +" + +### Table of Contents + +- [Address6][1] + - [Parameters][2] + +## Address6 + +Represents an IPv6 address + +### Parameters + +- \`address\` **[Array][3]<[string][4]>** An IPv6 address string + +[1]: #address6 + +[2]: #parameters + +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +" +`; exports[`outputs type_application.input.js markdown AST 1`] = ` Object { @@ -41420,7 +43488,31 @@ Array [ ] `; -exports[`outputs var-function-param-return.input.js markdown 1`] = `"[object Object]"`; +exports[`outputs var-function-param-return.input.js markdown 1`] = ` +" + +### Table of Contents + +- [f][1] + - [Parameters][2] + +## f + +### Parameters + +- \`x\` **[number][3]** + +Returns **[boolean][4]** + +[1]: #f + +[2]: #parameters + +[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number + +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +" +`; exports[`outputs var-function-param-return.input.js markdown AST 1`] = ` Object { diff --git a/__tests__/test.js b/__tests__/test.js index 7d470411d..63fa3361a 100644 --- a/__tests__/test.js +++ b/__tests__/test.js @@ -129,7 +129,7 @@ describe('outputs', function() { const md = await outputMarkdown(_.cloneDeep(result), { markdownToc: true }); - expect(result.toString()).toMatchSnapshot(); + expect(md.toString()).toMatchSnapshot(); }); if (file.match(/es6.input.js/)) { From ca17de55fff3eb54c1f38837573f95675572010e Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 8 May 2019 14:45:26 -0700 Subject: [PATCH 023/231] fix: Fix parsing of optional parameters with annotations --- __tests__/__snapshots__/test.js.snap | 257 +++++++++++++++++- .../fixture/flow-unnamed-params.input.js | 3 + .../lib/infer/__snapshots__/params.js.snap | 48 ++-- src/infer/params.js | 4 +- 4 files changed, 279 insertions(+), 33 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 1f029f448..5e529f069 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -19444,6 +19444,136 @@ Array [ }, "yields": Array [], }, + Object { + "augments": Array [], + "context": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 16, + }, + "start": Object { + "column": 0, + "line": 16, + }, + }, + }, + "description": Object { + "children": Array [ + Object { + "children": Array [ + Object { + "position": Object { + "end": Object { + "column": 3, + "line": 1, + "offset": 2, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "T3", + }, + ], + "position": Object { + "end": Object { + "column": 3, + "line": 1, + "offset": 2, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + ], + "position": Object { + "end": Object { + "column": 3, + "line": 1, + "offset": 2, + }, + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", + }, + "errors": Array [], + "examples": Array [], + "implements": Array [], + "kind": "typedef", + "loc": Object { + "end": Object { + "column": 9, + "line": 15, + }, + "start": Object { + "column": 0, + "line": 15, + }, + }, + "members": Object { + "events": Array [], + "global": Array [], + "inner": Array [], + "instance": Array [], + "static": Array [], + }, + "name": "T3", + "namespace": "T3", + "params": Array [], + "path": Array [ + Object { + "kind": "typedef", + "name": "T3", + }, + ], + "properties": Array [], + "returns": Array [], + "sees": Array [], + "tags": Array [], + "throws": Array [], + "todos": Array [], + "type": Object { + "params": Array [ + Object { + "expression": Object { + "name": "string", + "type": "NameExpression", + }, + "name": "a", + "type": "ParameterType", + }, + ], + "result": Object { + "fields": Array [ + Object { + "key": "num", + "type": "FieldType", + "value": Object { + "name": "number", + "type": "NameExpression", + }, + }, + ], + "type": "RecordType", + }, + "type": "FunctionType", + }, + "yields": Array [], + }, ] `; @@ -19455,24 +19585,31 @@ exports[`outputs flow-unnamed-params.input.js markdown 1`] = ` - [x2][1] - [T][2] - [T2][3] +- [T3][4] ## x2 x2 -Type: function (a: [T][4]): [string][5] +Type: function (a: [T][5]): [string][6] ## T T -Type: function ([Array][6]<[string][5]>): {num: [number][7]} +Type: function ([Array][7]<[string][6]>): {num: [number][8]} ## T2 T2 -Type: function (a: [Array][6]<[string][5]>): {num: [number][7]} +Type: function (a: [Array][7]<[string][6]>): {num: [number][8]} + +## T3 + +T3 + +Type: function (a: [string][6]): {num: [number][8]} [1]: #x2 @@ -19480,13 +19617,15 @@ Type: function (a: [Array][6]<[string][5]>): {num: [number][7]} [3]: #t2 -[4]: #t +[4]: #t3 -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[5]: #t -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array -[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number " `; @@ -19831,6 +19970,110 @@ Object { ], "type": "paragraph", }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "T3", + }, + ], + "depth": 2, + "type": "heading", + }, + Object { + "children": Array [ + Object { + "position": Position { + "end": Object { + "column": 3, + "line": 1, + "offset": 2, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "text", + "value": "T3", + }, + ], + "position": Position { + "end": Object { + "column": 3, + "line": 1, + "offset": 2, + }, + "indent": Array [], + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "paragraph", + }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "Type: ", + }, + Object { + "type": "text", + "value": "function (", + }, + Object { + "type": "text", + "value": "a: ", + }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "string", + }, + ], + "identifier": "2", + "referenceType": "full", + "type": "linkReference", + }, + Object { + "type": "text", + "value": ")", + }, + Object { + "type": "text", + "value": ": ", + }, + Object { + "type": "text", + "value": "{", + }, + Object { + "type": "text", + "value": "num: ", + }, + Object { + "children": Array [ + Object { + "type": "text", + "value": "number", + }, + ], + "identifier": "4", + "referenceType": "full", + "type": "linkReference", + }, + Object { + "type": "text", + "value": "}", + }, + ], + "type": "paragraph", + }, Object { "identifier": "1", "title": undefined, diff --git a/__tests__/fixture/flow-unnamed-params.input.js b/__tests__/fixture/flow-unnamed-params.input.js index 113e2968e..f99d777ae 100644 --- a/__tests__/fixture/flow-unnamed-params.input.js +++ b/__tests__/fixture/flow-unnamed-params.input.js @@ -11,3 +11,6 @@ type T = (string[]) => { num: number }; /** T2 */ type T2 = (a: string[]) => { num: number }; + +/** T3 */ +type T3 = (a?: string) => { num: number }; diff --git a/__tests__/lib/infer/__snapshots__/params.js.snap b/__tests__/lib/infer/__snapshots__/params.js.snap index 7c8878daf..498783741 100644 --- a/__tests__/lib/infer/__snapshots__/params.js.snap +++ b/__tests__/lib/infer/__snapshots__/params.js.snap @@ -141,16 +141,16 @@ Array [ exports[`inferParams (typescript) 7`] = ` Array [ Object { - "expression": Object { - "lineNumber": 1, - "name": "a", - "title": "param", - "type": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "expression": Object { "name": "string", "type": "NameExpression", }, + "type": "OptionalType", }, - "type": "OptionalType", }, ] `; @@ -158,16 +158,16 @@ Array [ exports[`inferParams (typescript) 8`] = ` Array [ Object { - "expression": Object { - "lineNumber": 1, - "name": "a", - "title": "param", - "type": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "expression": Object { "name": "string", "type": "NameExpression", }, + "type": "OptionalType", }, - "type": "OptionalType", }, ] `; @@ -175,16 +175,16 @@ Array [ exports[`inferParams (typescript) 9`] = ` Array [ Object { - "expression": Object { - "lineNumber": 1, - "name": "a", - "title": "param", - "type": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "expression": Object { "name": "string", "type": "NameExpression", }, + "type": "OptionalType", }, - "type": "OptionalType", }, ] `; @@ -192,16 +192,16 @@ Array [ exports[`inferParams (typescript) 10`] = ` Array [ Object { - "expression": Object { - "lineNumber": 1, - "name": "a", - "title": "param", - "type": Object { + "lineNumber": 1, + "name": "a", + "title": "param", + "type": Object { + "expression": Object { "name": "string", "type": "NameExpression", }, + "type": "OptionalType", }, - "type": "OptionalType", }, ] `; diff --git a/src/infer/params.js b/src/infer/params.js index 4c5c0c15c..dc67c0b81 100644 --- a/src/infer/params.js +++ b/src/infer/params.js @@ -78,9 +78,9 @@ function inferAndCombineParams(params, comment) { const inferredParams = params.map((param, i) => { const doc = paramToDoc(param, '', i); if (param.optional) { - return { + doc.type = { type: 'OptionalType', - expression: doc + expression: doc.type }; } From c6c832976bc47dc3b8cccdae8c43fbc24f67744d Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 8 May 2019 14:50:08 -0700 Subject: [PATCH 024/231] chore(release): 11.0.0 --- CHANGELOG.md | 22 ++++++++++++++++++++++ package.json | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5e6cff5..c3f0db420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,28 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [11.0.0](https://github.com/documentationjs/documentation/compare/v10.1.0...v11.0.0) (2019-05-08) + + +### Bug Fixes + +* Fix parsing of optional parameters with annotations ([ca17de5](https://github.com/documentationjs/documentation/commit/ca17de5)) + + +### Features + +* Enable all parser plugins ([fa1b0b5](https://github.com/documentationjs/documentation/commit/fa1b0b5)) +* Support exportNamespaceFrom in parser ([8fa141d](https://github.com/documentationjs/documentation/commit/8fa141d)) + + +### BREAKING CHANGES + +* this removes support for legacy decorators, because +in one place we had legacy and in another we didn't. + + + # [10.1.0](https://github.com/documentationjs/documentation/compare/v10.0.0...v10.1.0) (2019-04-25) diff --git a/package.json b/package.json index 5a4950f8f..c2bd6c3da 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "10.1.0", + "version": "11.0.0", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From e8734dd56d0515d05a7ace59e452f981b0fa2249 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Fri, 24 May 2019 00:29:15 +0900 Subject: [PATCH 025/231] docs: Update URLs to prevent redirects (#1244) --- docs/GETTING_STARTED.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 7b3d6584f..d6841c109 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -102,7 +102,7 @@ say @augments or @extends and they'll do the same thing. ## Development Process If you're contributing documentation to a large project, there -are tools to help: [eslint's valid-jsdoc](http://eslint.org/docs/rules/valid-jsdoc) rule +are tools to help: [eslint's valid-jsdoc](https://eslint.org/docs/rules/valid-jsdoc) rule lets you confirm the presence of, and validate, JSDoc comments as part of an automated style check. @@ -126,7 +126,7 @@ try [using a plugin for JSDoc](https://github.com/documentationjs/documentation/ ## Flow type annotations -Alternatively, [Flow](http://flowtype.org/) type annotations allows for a more compact syntax: +Alternatively, [Flow](https://flow.org/) type annotations allows for a more compact syntax: ```js /** From 725f6bbc68817f8e55d37f0e482a846b0a90f8cf Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Fri, 31 May 2019 04:52:04 +0900 Subject: [PATCH 026/231] docs: fix link to basscss.com (#1245) --- src/default_theme/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/default_theme/README.md b/src/default_theme/README.md index 230c64f1f..c5e7d125d 100644 --- a/src/default_theme/README.md +++ b/src/default_theme/README.md @@ -4,7 +4,7 @@ This is the default theme for [documentationjs](https://github.com/documentationjs): it consists of underscore templates and a few assets: a [highlight.js](https://highlightjs.org/) -theme and [basscss](http://www.basscss.com/) as a basic CSS framework. +theme and [basscss](https://basscss.com/) as a basic CSS framework. This is bundled by default in documentation: it is the default theme. From f0ed12e84fb64e2b34423022c2060301e4fca9a1 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Fri, 7 Jun 2019 00:44:10 +0900 Subject: [PATCH 027/231] docs: fix a couple of URLs to prevent redirects (#1249) --- docs/TROUBLESHOOTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index 72c029ee2..5c8397aec 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -17,8 +17,8 @@ might not understand it. If: ## Error: watch ENOSPC Linux systems can have a low limit of 'watchable files'. To increase this -limit, follow [the advice in this StackOverflow answer](http://stackoverflow.com/a/17437601/229001). +limit, follow [the advice in this StackOverflow answer](https://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc/17437601#17437601). ## Error: EMFILE: too many open files -You'll need to increase the `ulimit` maximum for your system: [here's a StackOverflow issue explaining how](http://unix.stackexchange.com/questions/108174/how-to-persist-ulimit-settings-in-osx-mavericks). +You'll need to increase the `ulimit` maximum for your system: [here's a StackOverflow issue explaining how](https://unix.stackexchange.com/questions/108174/how-to-persistently-control-maximum-system-resource-consumption-on-mac). From 7d12421336169a222926a9b7f5df8b3179ee0cb2 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Fri, 7 Jun 2019 01:44:40 +0900 Subject: [PATCH 028/231] docs: HTTPS link to remark.js.org (#1251) --- docs/THEMING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/THEMING.md b/docs/THEMING.md index 636170bab..052f6dc2a 100644 --- a/docs/THEMING.md +++ b/docs/THEMING.md @@ -37,6 +37,6 @@ for some ideas. The default Markdown generator for documentation.js isn't customizable - instead of a plain-text theme, it's generated by creating an AST and then rendering -it with [remark](http://remark.js.org/). If you need something extra in Markdown, +it with [remark](https://remark.js.org/). If you need something extra in Markdown, you can either rally for that thing to be included in the default theme, or you can hack around it by using an HTML theme that outputs Markdown. From 9ba3fd1f90773340719c85f9b2770cdf437905f5 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Fri, 7 Jun 2019 01:45:18 +0900 Subject: [PATCH 029/231] chore: Update split.js (#1250) --- src/default_theme/assets/split.js | 1312 +++++++++++++++++------------ 1 file changed, 754 insertions(+), 558 deletions(-) diff --git a/src/default_theme/assets/split.js b/src/default_theme/assets/split.js index fc492d2e6..71f9a60bd 100644 --- a/src/default_theme/assets/split.js +++ b/src/default_theme/assets/split.js @@ -1,586 +1,782 @@ -/*! Split.js - v1.3.5 */ -// https://github.com/nathancahill/Split.js -// Copyright (c) 2017 Nathan Cahill; Licensed MIT - -(function(global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory()) - : typeof define === 'function' && define.amd - ? define(factory) - : (global.Split = factory()); -})(this, function() { - 'use strict'; - // The programming goals of Split.js are to deliver readable, understandable and - // maintainable code, while at the same time manually optimizing for tiny minified file size, - // browser compatibility without additional requirements, graceful fallback (IE8 is supported) - // and very few assumptions about the user's page layout. - var global = window; - var document = global.document; - - // Save a couple long function names that are used frequently. - // This optimization saves around 400 bytes. - var addEventListener = 'addEventListener'; - var removeEventListener = 'removeEventListener'; - var getBoundingClientRect = 'getBoundingClientRect'; - var NOOP = function() { - return false; - }; - - // Figure out if we're in IE8 or not. IE8 will still render correctly, - // but will be static instead of draggable. - var isIE8 = global.attachEvent && !global[addEventListener]; - - // This library only needs two helper functions: - // - // The first determines which prefixes of CSS calc we need. - // We only need to do this once on startup, when this anonymous function is called. - // - // Tests -webkit, -moz and -o prefixes. Modified from StackOverflow: - // http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167 - var calc = - ['', '-webkit-', '-moz-', '-o-'] - .filter(function(prefix) { - var el = document.createElement('div'); - el.style.cssText = 'width:' + prefix + 'calc(9px)'; - - return !!el.style.length; - }) - .shift() + 'calc'; - - // The second helper function allows elements and string selectors to be used - // interchangeably. In either case an element is returned. This allows us to - // do `Split([elem1, elem2])` as well as `Split(['#id1', '#id2'])`. - var elementOrSelector = function(el) { - if (typeof el === 'string' || el instanceof String) { - return document.querySelector(el); - } - - return el; - }; - - // The main function to initialize a split. Split.js thinks about each pair - // of elements as an independant pair. Dragging the gutter between two elements - // only changes the dimensions of elements in that pair. This is key to understanding - // how the following functions operate, since each function is bound to a pair. - // - // A pair object is shaped like this: - // - // { - // a: DOM element, - // b: DOM element, - // aMin: Number, - // bMin: Number, - // dragging: Boolean, - // parent: DOM element, - // isFirst: Boolean, - // isLast: Boolean, - // direction: 'horizontal' | 'vertical' - // } - // - // The basic sequence: - // - // 1. Set defaults to something sane. `options` doesn't have to be passed at all. - // 2. Initialize a bunch of strings based on the direction we're splitting. - // A lot of the behavior in the rest of the library is paramatized down to - // rely on CSS strings and classes. - // 3. Define the dragging helper functions, and a few helpers to go with them. - // 4. Loop through the elements while pairing them off. Every pair gets an - // `pair` object, a gutter, and special isFirst/isLast properties. - // 5. Actually size the pair elements, insert gutters and attach event listeners. - var Split = function(ids, options) { - if (options === void 0) options = {}; - - var dimension; - var clientDimension; - var clientAxis; - var position; - var paddingA; - var paddingB; - var elements; - - // All DOM elements in the split should have a common parent. We can grab - // the first elements parent and hope users read the docs because the - // behavior will be whacky otherwise. - var parent = elementOrSelector(ids[0]).parentNode; - var parentFlexDirection = global.getComputedStyle(parent).flexDirection; - - // Set default options.sizes to equal percentages of the parent element. - var sizes = - options.sizes || - ids.map(function() { - return 100 / ids.length; - }); - - // Standardize minSize to an array if it isn't already. This allows minSize - // to be passed as a number. - var minSize = options.minSize !== undefined ? options.minSize : 100; - var minSizes = Array.isArray(minSize) - ? minSize - : ids.map(function() { - return minSize; - }); - var gutterSize = options.gutterSize !== undefined ? options.gutterSize : 10; - var snapOffset = options.snapOffset !== undefined ? options.snapOffset : 30; - var direction = options.direction || 'horizontal'; - var cursor = - options.cursor || - (direction === 'horizontal' ? 'ew-resize' : 'ns-resize'); - var gutter = - options.gutter || - function(i, gutterDirection) { +/*! Split.js - v1.5.11 */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.Split = factory()); +}(this, (function () { 'use strict'; + + // The programming goals of Split.js are to deliver readable, understandable and + // maintainable code, while at the same time manually optimizing for tiny minified file size, + // browser compatibility without additional requirements, graceful fallback (IE8 is supported) + // and very few assumptions about the user's page layout. + var global = window; + var document = global.document; + + // Save a couple long function names that are used frequently. + // This optimization saves around 400 bytes. + var addEventListener = 'addEventListener'; + var removeEventListener = 'removeEventListener'; + var getBoundingClientRect = 'getBoundingClientRect'; + var gutterStartDragging = '_a'; + var aGutterSize = '_b'; + var bGutterSize = '_c'; + var HORIZONTAL = 'horizontal'; + var NOOP = function () { return false; }; + + // Figure out if we're in IE8 or not. IE8 will still render correctly, + // but will be static instead of draggable. + var isIE8 = global.attachEvent && !global[addEventListener]; + + // Helper function determines which prefixes of CSS calc we need. + // We only need to do this once on startup, when this anonymous function is called. + // + // Tests -webkit, -moz and -o prefixes. Modified from StackOverflow: + // http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167 + var calc = (['', '-webkit-', '-moz-', '-o-'] + .filter(function (prefix) { + var el = document.createElement('div'); + el.style.cssText = "width:" + prefix + "calc(9px)"; + + return !!el.style.length + }) + .shift()) + "calc"; + + // Helper function checks if its argument is a string-like type + var isString = function (v) { return typeof v === 'string' || v instanceof String; }; + + // Helper function allows elements and string selectors to be used + // interchangeably. In either case an element is returned. This allows us to + // do `Split([elem1, elem2])` as well as `Split(['#id1', '#id2'])`. + var elementOrSelector = function (el) { + if (isString(el)) { + var ele = document.querySelector(el); + if (!ele) { + throw new Error(("Selector " + el + " did not match a DOM element")) + } + return ele + } + + return el + }; + + // Helper function gets a property from the properties object, with a default fallback + var getOption = function (options, propName, def) { + var value = options[propName]; + if (value !== undefined) { + return value + } + return def + }; + + var getGutterSize = function (gutterSize, isFirst, isLast, gutterAlign) { + if (isFirst) { + if (gutterAlign === 'end') { + return 0 + } + if (gutterAlign === 'center') { + return gutterSize / 2 + } + } else if (isLast) { + if (gutterAlign === 'start') { + return 0 + } + if (gutterAlign === 'center') { + return gutterSize / 2 + } + } + + return gutterSize + }; + + // Default options + var defaultGutterFn = function (i, gutterDirection) { var gut = document.createElement('div'); - gut.className = 'gutter gutter-' + gutterDirection; - return gut; - }; - var elementStyle = - options.elementStyle || - function(dim, size, gutSize) { + gut.className = "gutter gutter-" + gutterDirection; + return gut + }; + + var defaultElementStyleFn = function (dim, size, gutSize) { var style = {}; - if (typeof size !== 'string' && !(size instanceof String)) { - if (!isIE8) { - style[dim] = calc + '(' + size + '% - ' + gutSize + 'px)'; - } else { - style[dim] = size + '%'; - } + if (!isString(size)) { + if (!isIE8) { + style[dim] = calc + "(" + size + "% - " + gutSize + "px)"; + } else { + style[dim] = size + "%"; + } } else { - style[dim] = size; + style[dim] = size; } - return style; - }; - var gutterStyle = - options.gutterStyle || - function(dim, gutSize) { - return (obj = {}), (obj[dim] = gutSize + 'px'), obj; + return style + }; + + var defaultGutterStyleFn = function (dim, gutSize) { var obj; - }; - // 2. Initialize a bunch of strings based on the direction we're splitting. - // A lot of the behavior in the rest of the library is paramatized down to - // rely on CSS strings and classes. - if (direction === 'horizontal') { - dimension = 'width'; - clientDimension = 'clientWidth'; - clientAxis = 'clientX'; - position = 'left'; - paddingA = 'paddingLeft'; - paddingB = 'paddingRight'; - } else if (direction === 'vertical') { - dimension = 'height'; - clientDimension = 'clientHeight'; - clientAxis = 'clientY'; - position = 'top'; - paddingA = 'paddingTop'; - paddingB = 'paddingBottom'; - } + return (( obj = {}, obj[dim] = (gutSize + "px"), obj )); + }; - // 3. Define the dragging helper functions, and a few helpers to go with them. - // Each helper is bound to a pair object that contains it's metadata. This - // also makes it easy to store references to listeners that that will be - // added and removed. - // - // Even though there are no other functions contained in them, aliasing - // this to self saves 50 bytes or so since it's used so frequently. - // - // The pair object saves metadata like dragging state, position and - // event listener references. - - function setElementSize(el, size, gutSize) { - // Split.js allows setting sizes via numbers (ideally), or if you must, - // by string, like '300px'. This is less than ideal, because it breaks - // the fluid layout that `calc(% - px)` provides. You're on your own if you do that, - // make sure you calculate the gutter size by hand. - var style = elementStyle(dimension, size, gutSize); - - // eslint-disable-next-line no-param-reassign - Object.keys(style).forEach(function(prop) { - return (el.style[prop] = style[prop]); - }); - } - - function setGutterSize(gutterElement, gutSize) { - var style = gutterStyle(dimension, gutSize); - - // eslint-disable-next-line no-param-reassign - Object.keys(style).forEach(function(prop) { - return (gutterElement.style[prop] = style[prop]); - }); - } - - // Actually adjust the size of elements `a` and `b` to `offset` while dragging. - // calc is used to allow calc(percentage + gutterpx) on the whole split instance, - // which allows the viewport to be resized without additional logic. - // Element a's size is the same as offset. b's size is total size - a size. - // Both sizes are calculated from the initial parent percentage, - // then the gutter size is subtracted. - function adjust(offset) { - var a = elements[this.a]; - var b = elements[this.b]; - var percentage = a.size + b.size; - - a.size = (offset / this.size) * percentage; - b.size = percentage - (offset / this.size) * percentage; - - setElementSize(a.element, a.size, this.aGutterSize); - setElementSize(b.element, b.size, this.bGutterSize); - } - - // drag, where all the magic happens. The logic is really quite simple: + // The main function to initialize a split. Split.js thinks about each pair + // of elements as an independant pair. Dragging the gutter between two elements + // only changes the dimensions of elements in that pair. This is key to understanding + // how the following functions operate, since each function is bound to a pair. // - // 1. Ignore if the pair is not dragging. - // 2. Get the offset of the event. - // 3. Snap offset to min if within snappable range (within min + snapOffset). - // 4. Actually adjust each element in the pair to offset. + // A pair object is shaped like this: // - // --------------------------------------------------------------------- - // | | <- a.minSize || b.minSize -> | | - // | | | <- this.snapOffset || this.snapOffset -> | | | - // | | | || | | | - // | | | || | | | - // --------------------------------------------------------------------- - // | <- this.start this.size -> | - function drag(e) { - var offset; - - if (!this.dragging) { - return; - } - - // Get the offset of the event from the first side of the - // pair `this.start`. Supports touch events, but not multitouch, so only the first - // finger `touches[0]` is counted. - if ('touches' in e) { - offset = e.touches[0][clientAxis] - this.start; - } else { - offset = e[clientAxis] - this.start; - } - - // If within snapOffset of min or max, set offset to min or max. - // snapOffset buffers a.minSize and b.minSize, so logic is opposite for both. - // Include the appropriate gutter sizes to prevent overflows. - if (offset <= elements[this.a].minSize + snapOffset + this.aGutterSize) { - offset = elements[this.a].minSize + this.aGutterSize; - } else if ( - offset >= - this.size - (elements[this.b].minSize + snapOffset + this.bGutterSize) - ) { - offset = this.size - (elements[this.b].minSize + this.bGutterSize); - } - - // Actually adjust the size. - adjust.call(this, offset); - - // Call the drag callback continously. Don't do anything too intensive - // in this callback. - if (options.onDrag) { - options.onDrag(); - } - } - - // Cache some important sizes when drag starts, so we don't have to do that - // continously: + // { + // a: DOM element, + // b: DOM element, + // aMin: Number, + // bMin: Number, + // dragging: Boolean, + // parent: DOM element, + // direction: 'horizontal' | 'vertical' + // } // - // `size`: The total size of the pair. First + second + first gutter + second gutter. - // `start`: The leading side of the first element. + // The basic sequence: // - // ------------------------------------------------ - // | aGutterSize -> ||| | - // | ||| | - // | ||| | - // | ||| <- bGutterSize | - // ------------------------------------------------ - // | <- start size -> | - function calculateSizes() { - // Figure out the parent size minus padding. - var a = elements[this.a].element; - var b = elements[this.b].element; - - this.size = - a[getBoundingClientRect]()[dimension] + - b[getBoundingClientRect]()[dimension] + - this.aGutterSize + - this.bGutterSize; - this.start = a[getBoundingClientRect]()[position]; - } - - // stopDragging is very similar to startDragging in reverse. - function stopDragging() { - var self = this; - var a = elements[self.a].element; - var b = elements[self.b].element; - - if (self.dragging && options.onDragEnd) { - options.onDragEnd(); - } - - self.dragging = false; - - // Remove the stored event listeners. This is why we store them. - global[removeEventListener]('mouseup', self.stop); - global[removeEventListener]('touchend', self.stop); - global[removeEventListener]('touchcancel', self.stop); - - self.parent[removeEventListener]('mousemove', self.move); - self.parent[removeEventListener]('touchmove', self.move); - - // Delete them once they are removed. I think this makes a difference - // in memory usage with a lot of splits on one page. But I don't know for sure. - delete self.stop; - delete self.move; - - a[removeEventListener]('selectstart', NOOP); - a[removeEventListener]('dragstart', NOOP); - b[removeEventListener]('selectstart', NOOP); - b[removeEventListener]('dragstart', NOOP); - - a.style.userSelect = ''; - a.style.webkitUserSelect = ''; - a.style.MozUserSelect = ''; - a.style.pointerEvents = ''; - - b.style.userSelect = ''; - b.style.webkitUserSelect = ''; - b.style.MozUserSelect = ''; - b.style.pointerEvents = ''; - - self.gutter.style.cursor = ''; - self.parent.style.cursor = ''; - } - - // startDragging calls `calculateSizes` to store the inital size in the pair object. - // It also adds event listeners for mouse/touch events, - // and prevents selection while dragging so avoid the selecting text. - function startDragging(e) { - // Alias frequently used variables to save space. 200 bytes. - var self = this; - var a = elements[self.a].element; - var b = elements[self.b].element; - - // Call the onDragStart callback. - if (!self.dragging && options.onDragStart) { - options.onDragStart(); - } - - // Don't actually drag the element. We emulate that in the drag function. - e.preventDefault(); - - // Set the dragging property of the pair object. - self.dragging = true; - - // Create two event listeners bound to the same pair object and store - // them in the pair object. - self.move = drag.bind(self); - self.stop = stopDragging.bind(self); - - // All the binding. `window` gets the stop events in case we drag out of the elements. - global[addEventListener]('mouseup', self.stop); - global[addEventListener]('touchend', self.stop); - global[addEventListener]('touchcancel', self.stop); - - self.parent[addEventListener]('mousemove', self.move); - self.parent[addEventListener]('touchmove', self.move); - - // Disable selection. Disable! - a[addEventListener]('selectstart', NOOP); - a[addEventListener]('dragstart', NOOP); - b[addEventListener]('selectstart', NOOP); - b[addEventListener]('dragstart', NOOP); - - a.style.userSelect = 'none'; - a.style.webkitUserSelect = 'none'; - a.style.MozUserSelect = 'none'; - a.style.pointerEvents = 'none'; - - b.style.userSelect = 'none'; - b.style.webkitUserSelect = 'none'; - b.style.MozUserSelect = 'none'; - b.style.pointerEvents = 'none'; - - // Set the cursor, both on the gutter and the parent element. - // Doing only a, b and gutter causes flickering. - self.gutter.style.cursor = cursor; - self.parent.style.cursor = cursor; - - // Cache the initial sizes of the pair. - calculateSizes.call(self); - } - - // 5. Create pair and element objects. Each pair has an index reference to - // elements `a` and `b` of the pair (first and second elements). - // Loop through the elements while pairing them off. Every pair gets a - // `pair` object, a gutter, and isFirst/isLast properties. - // - // Basic logic: - // - // - Starting with the second element `i > 0`, create `pair` objects with - // `a = i - 1` and `b = i` - // - Set gutter sizes based on the _pair_ being first/last. The first and last - // pair have gutterSize / 2, since they only have one half gutter, and not two. - // - Create gutter elements and add event listeners. - // - Set the size of the elements, minus the gutter sizes. - // - // ----------------------------------------------------------------------- - // | i=0 | i=1 | i=2 | i=3 | - // | | isFirst | | isLast | - // | pair 0 pair 1 pair 2 | - // | | | | | - // ----------------------------------------------------------------------- - var pairs = []; - elements = ids.map(function(id, i) { - // Create the element object. - var element = { - element: elementOrSelector(id), - size: sizes[i], - minSize: minSizes[i] - }; - - var pair; - - if (i > 0) { - // Create the pair object with it's metadata. - pair = { - a: i - 1, - b: i, - dragging: false, - isFirst: i === 1, - isLast: i === ids.length - 1, - direction: direction, - parent: parent - }; - - // For first and last pairs, first and last gutter width is half. - pair.aGutterSize = gutterSize; - pair.bGutterSize = gutterSize; - - if (pair.isFirst) { - pair.aGutterSize = gutterSize / 2; + // 1. Set defaults to something sane. `options` doesn't have to be passed at all. + // 2. Initialize a bunch of strings based on the direction we're splitting. + // A lot of the behavior in the rest of the library is paramatized down to + // rely on CSS strings and classes. + // 3. Define the dragging helper functions, and a few helpers to go with them. + // 4. Loop through the elements while pairing them off. Every pair gets an + // `pair` object and a gutter. + // 5. Actually size the pair elements, insert gutters and attach event listeners. + var Split = function (idsOption, options) { + if ( options === void 0 ) options = {}; + + var ids = idsOption; + var dimension; + var clientAxis; + var position; + var positionEnd; + var clientSize; + var elements; + + // Allow HTMLCollection to be used as an argument when supported + if (Array.from) { + ids = Array.from(ids); + } + + // All DOM elements in the split should have a common parent. We can grab + // the first elements parent and hope users read the docs because the + // behavior will be whacky otherwise. + var firstElement = elementOrSelector(ids[0]); + var parent = firstElement.parentNode; + var parentStyle = getComputedStyle ? getComputedStyle(parent) : null; + var parentFlexDirection = parentStyle ? parentStyle.flexDirection : null; + + // Set default options.sizes to equal percentages of the parent element. + var sizes = getOption(options, 'sizes') || ids.map(function () { return 100 / ids.length; }); + + // Standardize minSize to an array if it isn't already. This allows minSize + // to be passed as a number. + var minSize = getOption(options, 'minSize', 100); + var minSizes = Array.isArray(minSize) ? minSize : ids.map(function () { return minSize; }); + + // Get other options + var expandToMin = getOption(options, 'expandToMin', false); + var gutterSize = getOption(options, 'gutterSize', 10); + var gutterAlign = getOption(options, 'gutterAlign', 'center'); + var snapOffset = getOption(options, 'snapOffset', 30); + var dragInterval = getOption(options, 'dragInterval', 1); + var direction = getOption(options, 'direction', HORIZONTAL); + var cursor = getOption( + options, + 'cursor', + direction === HORIZONTAL ? 'col-resize' : 'row-resize' + ); + var gutter = getOption(options, 'gutter', defaultGutterFn); + var elementStyle = getOption( + options, + 'elementStyle', + defaultElementStyleFn + ); + var gutterStyle = getOption(options, 'gutterStyle', defaultGutterStyleFn); + + // 2. Initialize a bunch of strings based on the direction we're splitting. + // A lot of the behavior in the rest of the library is paramatized down to + // rely on CSS strings and classes. + if (direction === HORIZONTAL) { + dimension = 'width'; + clientAxis = 'clientX'; + position = 'left'; + positionEnd = 'right'; + clientSize = 'clientWidth'; + } else if (direction === 'vertical') { + dimension = 'height'; + clientAxis = 'clientY'; + position = 'top'; + positionEnd = 'bottom'; + clientSize = 'clientHeight'; + } + + // 3. Define the dragging helper functions, and a few helpers to go with them. + // Each helper is bound to a pair object that contains its metadata. This + // also makes it easy to store references to listeners that that will be + // added and removed. + // + // Even though there are no other functions contained in them, aliasing + // this to self saves 50 bytes or so since it's used so frequently. + // + // The pair object saves metadata like dragging state, position and + // event listener references. + + function setElementSize(el, size, gutSize, i) { + // Split.js allows setting sizes via numbers (ideally), or if you must, + // by string, like '300px'. This is less than ideal, because it breaks + // the fluid layout that `calc(% - px)` provides. You're on your own if you do that, + // make sure you calculate the gutter size by hand. + var style = elementStyle(dimension, size, gutSize, i); + + Object.keys(style).forEach(function (prop) { + // eslint-disable-next-line no-param-reassign + el.style[prop] = style[prop]; + }); + } + + function setGutterSize(gutterElement, gutSize, i) { + var style = gutterStyle(dimension, gutSize, i); + + Object.keys(style).forEach(function (prop) { + // eslint-disable-next-line no-param-reassign + gutterElement.style[prop] = style[prop]; + }); } - if (pair.isLast) { - pair.bGutterSize = gutterSize / 2; + function getSizes() { + return elements.map(function (element) { return element.size; }) } - // if the parent has a reverse flex-direction, switch the pair elements. - if ( - parentFlexDirection === 'row-reverse' || - parentFlexDirection === 'column-reverse' - ) { - var temp = pair.a; - pair.a = pair.b; - pair.b = temp; + // Supports touch events, but not multitouch, so only the first + // finger `touches[0]` is counted. + function getMousePosition(e) { + if ('touches' in e) { return e.touches[0][clientAxis] } + return e[clientAxis] } - } - - // Determine the size of the current element. IE8 is supported by - // staticly assigning sizes without draggable gutters. Assigns a string - // to `size`. - // - // IE9 and above - if (!isIE8) { - // Create gutter elements for each pair. - if (i > 0) { - var gutterElement = gutter(i, direction); - setGutterSize(gutterElement, gutterSize); - - gutterElement[addEventListener]( - 'mousedown', - startDragging.bind(pair) - ); - gutterElement[addEventListener]( - 'touchstart', - startDragging.bind(pair) - ); - - parent.insertBefore(gutterElement, element.element); - - pair.gutter = gutterElement; + + // Actually adjust the size of elements `a` and `b` to `offset` while dragging. + // calc is used to allow calc(percentage + gutterpx) on the whole split instance, + // which allows the viewport to be resized without additional logic. + // Element a's size is the same as offset. b's size is total size - a size. + // Both sizes are calculated from the initial parent percentage, + // then the gutter size is subtracted. + function adjust(offset) { + var a = elements[this.a]; + var b = elements[this.b]; + var percentage = a.size + b.size; + + a.size = (offset / this.size) * percentage; + b.size = percentage - (offset / this.size) * percentage; + + setElementSize(a.element, a.size, this[aGutterSize], a.i); + setElementSize(b.element, b.size, this[bGutterSize], b.i); + } + + // drag, where all the magic happens. The logic is really quite simple: + // + // 1. Ignore if the pair is not dragging. + // 2. Get the offset of the event. + // 3. Snap offset to min if within snappable range (within min + snapOffset). + // 4. Actually adjust each element in the pair to offset. + // + // --------------------------------------------------------------------- + // | | <- a.minSize || b.minSize -> | | + // | | | <- this.snapOffset || this.snapOffset -> | | | + // | | | || | | | + // | | | || | | | + // --------------------------------------------------------------------- + // | <- this.start this.size -> | + function drag(e) { + var offset; + var a = elements[this.a]; + var b = elements[this.b]; + + if (!this.dragging) { return } + + // Get the offset of the event from the first side of the + // pair `this.start`. Then offset by the initial position of the + // mouse compared to the gutter size. + offset = + getMousePosition(e) - + this.start + + (this[aGutterSize] - this.dragOffset); + + if (dragInterval > 1) { + offset = Math.round(offset / dragInterval) * dragInterval; + } + + // If within snapOffset of min or max, set offset to min or max. + // snapOffset buffers a.minSize and b.minSize, so logic is opposite for both. + // Include the appropriate gutter sizes to prevent overflows. + if (offset <= a.minSize + snapOffset + this[aGutterSize]) { + offset = a.minSize + this[aGutterSize]; + } else if ( + offset >= + this.size - (b.minSize + snapOffset + this[bGutterSize]) + ) { + offset = this.size - (b.minSize + this[bGutterSize]); + } + + // Actually adjust the size. + adjust.call(this, offset); + + // Call the drag callback continously. Don't do anything too intensive + // in this callback. + getOption(options, 'onDrag', NOOP)(); + } + + // Cache some important sizes when drag starts, so we don't have to do that + // continously: + // + // `size`: The total size of the pair. First + second + first gutter + second gutter. + // `start`: The leading side of the first element. + // + // ------------------------------------------------ + // | aGutterSize -> ||| | + // | ||| | + // | ||| | + // | ||| <- bGutterSize | + // ------------------------------------------------ + // | <- start size -> | + function calculateSizes() { + // Figure out the parent size minus padding. + var a = elements[this.a].element; + var b = elements[this.b].element; + + var aBounds = a[getBoundingClientRect](); + var bBounds = b[getBoundingClientRect](); + + this.size = + aBounds[dimension] + + bBounds[dimension] + + this[aGutterSize] + + this[bGutterSize]; + this.start = aBounds[position]; + this.end = aBounds[positionEnd]; + } + + function innerSize(element) { + // Return nothing if getComputedStyle is not supported (< IE9) + // Or if parent element has no layout yet + if (!getComputedStyle) { return null } + + var computedStyle = getComputedStyle(element); + + if (!computedStyle) { return null } + + var size = element[clientSize]; + + if (size === 0) { return null } + + if (direction === HORIZONTAL) { + size -= + parseFloat(computedStyle.paddingLeft) + + parseFloat(computedStyle.paddingRight); + } else { + size -= + parseFloat(computedStyle.paddingTop) + + parseFloat(computedStyle.paddingBottom); + } + + return size + } + + // When specifying percentage sizes that are less than the computed + // size of the element minus the gutter, the lesser percentages must be increased + // (and decreased from the other elements) to make space for the pixels + // subtracted by the gutters. + function trimToMin(sizesToTrim) { + // Try to get inner size of parent element. + // If it's no supported, return original sizes. + var parentSize = innerSize(parent); + if (parentSize === null) { + return sizesToTrim + } + + if (minSizes.reduce(function (a, b) { return a + b; }, 0) > parentSize) { + return sizesToTrim + } + + // Keep track of the excess pixels, the amount of pixels over the desired percentage + // Also keep track of the elements with pixels to spare, to decrease after if needed + var excessPixels = 0; + var toSpare = []; + + var pixelSizes = sizesToTrim.map(function (size, i) { + // Convert requested percentages to pixel sizes + var pixelSize = (parentSize * size) / 100; + var elementGutterSize = getGutterSize( + gutterSize, + i === 0, + i === sizesToTrim.length - 1, + gutterAlign + ); + var elementMinSize = minSizes[i] + elementGutterSize; + + // If element is too smal, increase excess pixels by the difference + // and mark that it has no pixels to spare + if (pixelSize < elementMinSize) { + excessPixels += elementMinSize - pixelSize; + toSpare.push(0); + return elementMinSize + } + + // Otherwise, mark the pixels it has to spare and return it's original size + toSpare.push(pixelSize - elementMinSize); + return pixelSize + }); + + // If nothing was adjusted, return the original sizes + if (excessPixels === 0) { + return sizesToTrim + } + + return pixelSizes.map(function (pixelSize, i) { + var newPixelSize = pixelSize; + + // While there's still pixels to take, and there's enough pixels to spare, + // take as many as possible up to the total excess pixels + if (excessPixels > 0 && toSpare[i] - excessPixels > 0) { + var takenPixels = Math.min( + excessPixels, + toSpare[i] - excessPixels + ); + + // Subtract the amount taken for the next iteration + excessPixels -= takenPixels; + newPixelSize = pixelSize - takenPixels; + } + + // Return the pixel size adjusted as a percentage + return (newPixelSize / parentSize) * 100 + }) + } + + // stopDragging is very similar to startDragging in reverse. + function stopDragging() { + var self = this; + var a = elements[self.a].element; + var b = elements[self.b].element; + + if (self.dragging) { + getOption(options, 'onDragEnd', NOOP)(getSizes()); + } + + self.dragging = false; + + // Remove the stored event listeners. This is why we store them. + global[removeEventListener]('mouseup', self.stop); + global[removeEventListener]('touchend', self.stop); + global[removeEventListener]('touchcancel', self.stop); + global[removeEventListener]('mousemove', self.move); + global[removeEventListener]('touchmove', self.move); + + // Clear bound function references + self.stop = null; + self.move = null; + + a[removeEventListener]('selectstart', NOOP); + a[removeEventListener]('dragstart', NOOP); + b[removeEventListener]('selectstart', NOOP); + b[removeEventListener]('dragstart', NOOP); + + a.style.userSelect = ''; + a.style.webkitUserSelect = ''; + a.style.MozUserSelect = ''; + a.style.pointerEvents = ''; + + b.style.userSelect = ''; + b.style.webkitUserSelect = ''; + b.style.MozUserSelect = ''; + b.style.pointerEvents = ''; + + self.gutter.style.cursor = ''; + self.parent.style.cursor = ''; + document.body.style.cursor = ''; } - } - - // Set the element size to our determined size. - // Half-size gutters for first and last elements. - if (i === 0 || i === ids.length - 1) { - setElementSize(element.element, element.size, gutterSize / 2); - } else { - setElementSize(element.element, element.size, gutterSize); - } - - var computedSize = element.element[getBoundingClientRect]()[dimension]; - - if (computedSize < element.minSize) { - element.minSize = computedSize; - } - - // After the first iteration, and we have a pair object, append it to the - // list of pairs. - if (i > 0) { - pairs.push(pair); - } - - return element; - }); - - function setSizes(newSizes) { - newSizes.forEach(function(newSize, i) { - if (i > 0) { - var pair = pairs[i - 1]; - var a = elements[pair.a]; - var b = elements[pair.b]; - - a.size = newSizes[i - 1]; - b.size = newSize; - - setElementSize(a.element, a.size, pair.aGutterSize); - setElementSize(b.element, b.size, pair.bGutterSize); + + // startDragging calls `calculateSizes` to store the inital size in the pair object. + // It also adds event listeners for mouse/touch events, + // and prevents selection while dragging so avoid the selecting text. + function startDragging(e) { + // Right-clicking can't start dragging. + if ('button' in e && e.button !== 0) { + return + } + + // Alias frequently used variables to save space. 200 bytes. + var self = this; + var a = elements[self.a].element; + var b = elements[self.b].element; + + // Call the onDragStart callback. + if (!self.dragging) { + getOption(options, 'onDragStart', NOOP)(getSizes()); + } + + // Don't actually drag the element. We emulate that in the drag function. + e.preventDefault(); + + // Set the dragging property of the pair object. + self.dragging = true; + + // Create two event listeners bound to the same pair object and store + // them in the pair object. + self.move = drag.bind(self); + self.stop = stopDragging.bind(self); + + // All the binding. `window` gets the stop events in case we drag out of the elements. + global[addEventListener]('mouseup', self.stop); + global[addEventListener]('touchend', self.stop); + global[addEventListener]('touchcancel', self.stop); + global[addEventListener]('mousemove', self.move); + global[addEventListener]('touchmove', self.move); + + // Disable selection. Disable! + a[addEventListener]('selectstart', NOOP); + a[addEventListener]('dragstart', NOOP); + b[addEventListener]('selectstart', NOOP); + b[addEventListener]('dragstart', NOOP); + + a.style.userSelect = 'none'; + a.style.webkitUserSelect = 'none'; + a.style.MozUserSelect = 'none'; + a.style.pointerEvents = 'none'; + + b.style.userSelect = 'none'; + b.style.webkitUserSelect = 'none'; + b.style.MozUserSelect = 'none'; + b.style.pointerEvents = 'none'; + + // Set the cursor at multiple levels + self.gutter.style.cursor = cursor; + self.parent.style.cursor = cursor; + document.body.style.cursor = cursor; + + // Cache the initial sizes of the pair. + calculateSizes.call(self); + + // Determine the position of the mouse compared to the gutter + self.dragOffset = getMousePosition(e) - self.end; } - }); - } - - function destroy() { - pairs.forEach(function(pair) { - pair.parent.removeChild(pair.gutter); - elements[pair.a].element.style[dimension] = ''; - elements[pair.b].element.style[dimension] = ''; - }); - } - - if (isIE8) { - return { - setSizes: setSizes, - destroy: destroy - }; - } - - return { - setSizes: setSizes, - getSizes: function getSizes() { - return elements.map(function(element) { - return element.size; + + // adjust sizes to ensure percentage is within min size and gutter. + sizes = trimToMin(sizes); + + // 5. Create pair and element objects. Each pair has an index reference to + // elements `a` and `b` of the pair (first and second elements). + // Loop through the elements while pairing them off. Every pair gets a + // `pair` object and a gutter. + // + // Basic logic: + // + // - Starting with the second element `i > 0`, create `pair` objects with + // `a = i - 1` and `b = i` + // - Set gutter sizes based on the _pair_ being first/last. The first and last + // pair have gutterSize / 2, since they only have one half gutter, and not two. + // - Create gutter elements and add event listeners. + // - Set the size of the elements, minus the gutter sizes. + // + // ----------------------------------------------------------------------- + // | i=0 | i=1 | i=2 | i=3 | + // | | | | | + // | pair 0 pair 1 pair 2 | + // | | | | | + // ----------------------------------------------------------------------- + var pairs = []; + elements = ids.map(function (id, i) { + // Create the element object. + var element = { + element: elementOrSelector(id), + size: sizes[i], + minSize: minSizes[i], + i: i, + }; + + var pair; + + if (i > 0) { + // Create the pair object with its metadata. + pair = { + a: i - 1, + b: i, + dragging: false, + direction: direction, + parent: parent, + }; + + pair[aGutterSize] = getGutterSize( + gutterSize, + i - 1 === 0, + false, + gutterAlign + ); + pair[bGutterSize] = getGutterSize( + gutterSize, + false, + i === ids.length - 1, + gutterAlign + ); + + // if the parent has a reverse flex-direction, switch the pair elements. + if ( + parentFlexDirection === 'row-reverse' || + parentFlexDirection === 'column-reverse' + ) { + var temp = pair.a; + pair.a = pair.b; + pair.b = temp; + } + } + + // Determine the size of the current element. IE8 is supported by + // staticly assigning sizes without draggable gutters. Assigns a string + // to `size`. + // + // IE9 and above + if (!isIE8) { + // Create gutter elements for each pair. + if (i > 0) { + var gutterElement = gutter(i, direction, element.element); + setGutterSize(gutterElement, gutterSize, i); + + // Save bound event listener for removal later + pair[gutterStartDragging] = startDragging.bind(pair); + + // Attach bound event listener + gutterElement[addEventListener]( + 'mousedown', + pair[gutterStartDragging] + ); + gutterElement[addEventListener]( + 'touchstart', + pair[gutterStartDragging] + ); + + parent.insertBefore(gutterElement, element.element); + + pair.gutter = gutterElement; + } + } + + setElementSize( + element.element, + element.size, + getGutterSize( + gutterSize, + i === 0, + i === ids.length - 1, + gutterAlign + ), + i + ); + + // After the first iteration, and we have a pair object, append it to the + // list of pairs. + if (i > 0) { + pairs.push(pair); + } + + return element }); - }, - collapse: function collapse(i) { - if (i === pairs.length) { - var pair = pairs[i - 1]; - calculateSizes.call(pair); + function adjustToMin(element) { + var isLast = element.i === pairs.length; + var pair = isLast ? pairs[element.i - 1] : pairs[element.i]; - if (!isIE8) { - adjust.call(pair, pair.size - pair.bGutterSize); - } - } else { - var pair$1 = pairs[i]; + calculateSizes.call(pair); - calculateSizes.call(pair$1); + var size = isLast + ? pair.size - element.minSize - pair[bGutterSize] + : element.minSize + pair[aGutterSize]; - if (!isIE8) { - adjust.call(pair$1, pair$1.aGutterSize); - } + adjust.call(pair, size); + } + + elements.forEach(function (element) { + var computedSize = element.element[getBoundingClientRect]()[dimension]; + + if (computedSize < element.minSize) { + if (expandToMin) { + adjustToMin(element); + } else { + // eslint-disable-next-line no-param-reassign + element.minSize = computedSize; + } + } + }); + + function setSizes(newSizes) { + var trimmed = trimToMin(newSizes); + trimmed.forEach(function (newSize, i) { + if (i > 0) { + var pair = pairs[i - 1]; + + var a = elements[pair.a]; + var b = elements[pair.b]; + + a.size = trimmed[i - 1]; + b.size = newSize; + + setElementSize(a.element, a.size, pair[aGutterSize], a.i); + setElementSize(b.element, b.size, pair[bGutterSize], b.i); + } + }); + } + + function destroy(preserveStyles, preserveGutter) { + pairs.forEach(function (pair) { + if (preserveGutter !== true) { + pair.parent.removeChild(pair.gutter); + } else { + pair.gutter[removeEventListener]( + 'mousedown', + pair[gutterStartDragging] + ); + pair.gutter[removeEventListener]( + 'touchstart', + pair[gutterStartDragging] + ); + } + + if (preserveStyles !== true) { + var style = elementStyle( + dimension, + pair.a.size, + pair[aGutterSize] + ); + + Object.keys(style).forEach(function (prop) { + elements[pair.a].element.style[prop] = ''; + elements[pair.b].element.style[prop] = ''; + }); + } + }); + } + + if (isIE8) { + return { + setSizes: setSizes, + destroy: destroy, + } + } + + return { + setSizes: setSizes, + getSizes: getSizes, + collapse: function collapse(i) { + adjustToMin(elements[i]); + }, + destroy: destroy, + parent: parent, + pairs: pairs, } - }, - destroy: destroy }; - }; - return Split; -}); + return Split; + +}))); From b6901b4197311098f0a29fc3a44a0eeeed2cc3c5 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Sat, 8 Jun 2019 02:03:42 +0900 Subject: [PATCH 030/231] refactor: remove unnecessary trailing slash (#1254) --- src/default_theme/index._ | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/default_theme/index._ b/src/default_theme/index._ index 896d412a4..1d6b35f9f 100644 --- a/src/default_theme/index._ +++ b/src/default_theme/index._ @@ -1,14 +1,14 @@ - + <%- config['project-name'] %> <%- config['project-version'] %> | Documentation<% if (config['project-description']) { %> '><% } %> - - - - <% if (config['favicon']) { %> + + + + <% if (config['favicon']) { %> ' rel='icon' ><% } %> From 14298bb681a7860dcb7278c17ae1084ea02db4ad Mon Sep 17 00:00:00 2001 From: David Kartnaller Date: Wed, 12 Jun 2019 21:06:52 +0200 Subject: [PATCH 031/231] fix: toc with children getting displayed as "note" (#1253) --- src/default_theme/index._ | 2 +- src/default_theme/note._ | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/default_theme/index._ b/src/default_theme/index._ index 1d6b35f9f..2577a1859 100644 --- a/src/default_theme/index._ +++ b/src/default_theme/index._ @@ -95,7 +95,7 @@
<% docs.forEach(function(s) { %> - <% if (s.kind === 'note') { %> + <% if (s.kind === 'note' && !s.children) { %>
<%=renderNote({ note: s })%>
<% } else { %> <%= renderSection({ diff --git a/src/default_theme/note._ b/src/default_theme/note._ index 10b836d5c..cebebc13c 100644 --- a/src/default_theme/note._ +++ b/src/default_theme/note._ @@ -1,12 +1,10 @@ -<% if (!note.children) { %> -
+
-

- <%- note.name %> -

+

+ <%- note.name %> +

- <% if (note.description) { %> - <%= md(note.description) %> - <% } %> -
-<% } %> \ No newline at end of file + <% if (note.description) { %> + <%= md(note.description) %> + <% } %> +
\ No newline at end of file From f1110303ca58e4498b0e4a7daf1c2ef81e8bebad Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 12 Jun 2019 12:07:06 -0700 Subject: [PATCH 032/231] chore(release): 11.0.1 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3f0db420..a36520c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [11.0.1](https://github.com/documentationjs/documentation/compare/v11.0.0...v11.0.1) (2019-06-12) + + +### Bug Fixes + +* toc with children getting displayed as "note" ([#1253](https://github.com/documentationjs/documentation/issues/1253)) ([14298bb](https://github.com/documentationjs/documentation/commit/14298bb)) + + + # [11.0.0](https://github.com/documentationjs/documentation/compare/v10.1.0...v11.0.0) (2019-05-08) diff --git a/package.json b/package.json index c2bd6c3da..5d67b6339 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "11.0.0", + "version": "11.0.1", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From 4fd8552dbbc5ad1c366df1f84587b27b441b8885 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 9 Jul 2019 21:52:01 -0700 Subject: [PATCH 033/231] deps: Upgrade vfile --- __tests__/__snapshots__/test.js.snap | 10 +- package.json | 4 +- src/lint.js | 2 +- yarn.lock | 193 ++++++++++++++++++++++----- 4 files changed, 167 insertions(+), 42 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 5e529f069..81879b012 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -1530,14 +1530,14 @@ exports[`html nested.input.js 1`] = ` " - + | Documentation - - - - + + + +
diff --git a/package.json b/package.json index 5d67b6339..786bde770 100644 --- a/package.json +++ b/package.json @@ -65,8 +65,8 @@ "tiny-lr": "^1.1.0", "unist-builder": "^1.0.2", "unist-util-visit": "^1.3.0", - "vfile": "^3.0.0", - "vfile-reporter": "^5.0.0", + "vfile": "^4.0.0", + "vfile-reporter": "^6.0.0", "vfile-sort": "^2.1.0", "vinyl": "^2.1.0", "vinyl-fs": "^3.0.2", diff --git a/src/lint.js b/src/lint.js index 8e5efcad8..269101123 100644 --- a/src/lint.js +++ b/src/lint.js @@ -77,7 +77,7 @@ function formatLint(comments) { new VFile({ path: p }); - vFiles[p].warn(error.message, { + vFiles[p].message(error.message, { line: comment.loc.start.line + (error.commentLineNumber || 0) }); }); diff --git a/yarn.lock b/yarn.lock index 07fd53a21..5c6b223de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -831,6 +831,11 @@ dependencies: any-observable "^0.3.0" +"@types/unist@^2.0.0", "@types/unist@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" + integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ== + JSONStream@^1.0.3: version "1.3.4" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.4.tgz#615bb2adb0cd34c8f4c447b5f6512fa1d8f16a2e" @@ -920,6 +925,11 @@ ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + ansi-styles@^2.0.1, ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -927,6 +937,7 @@ ansi-styles@^2.0.1, ansi-styles@^2.2.1: ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" @@ -1241,6 +1252,7 @@ bail@^1.0.0: balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base@^0.11.1: version "0.11.2" @@ -1276,6 +1288,7 @@ body@^5.1.0: brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -1444,7 +1457,7 @@ chalk@^1.0.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" dependencies: @@ -1452,7 +1465,7 @@ chalk@^2.0.0, chalk@^2.0.1: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1: +chalk@^2.1.0, chalk@^2.3.1: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: @@ -1610,12 +1623,14 @@ collection-visit@^1.0.0: color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.7" @@ -1651,6 +1666,7 @@ component-emitter@^1.2.1: concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= concat-stream@^1.4.10, concat-stream@^1.6.0: version "1.6.2" @@ -2139,6 +2155,11 @@ elegant-spinner@^1.0.1: version "6.1.1" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.1.tgz#c6cd0ec1b0642e2a3c67a1137efc5e796da4f88e" +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + end-of-stream@^1.0.0, end-of-stream@^1.1.0: version "1.4.1" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" @@ -2180,6 +2201,7 @@ es-to-primitive@^1.2.0: escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= escodegen@^1.9.1: version "1.11.1" @@ -2606,6 +2628,7 @@ fs-mkdirp-stream@^1.0.0: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@^1.2.2: version "1.2.4" @@ -2776,7 +2799,7 @@ glob-stream@^6.1.0: to-absolute-glob "^2.0.0" unique-stream "^2.0.2" -glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: +glob@^7.0.3, glob@^7.1.1, glob@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" dependencies: @@ -2787,6 +2810,18 @@ glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.2: + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + globals-docs@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/globals-docs/-/globals-docs-2.4.0.tgz#f2c647544eb6161c7c38452808e16e693c2dafbb" @@ -2856,6 +2891,7 @@ has-flag@^1.0.0: has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= has-symbols@^1.0.0: version "1.0.0" @@ -3032,11 +3068,17 @@ indent-string@^3.0.0: inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" @@ -3229,6 +3271,11 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-generator-fn@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-1.0.0.tgz#969d49e1bb3329f6bb7f09089be26578b2ddd46a" @@ -4117,7 +4164,12 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "~3.0.0" -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1: +lodash@^4.17.10: + version "4.17.13" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.13.tgz#0bdc3a6adc873d2f4e0c4bac285df91b64fc7b93" + integrity sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA== + +lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" @@ -4360,8 +4412,9 @@ mime-types@^2.1.12, mime-types@~2.1.19: mime-db "~1.38.0" mime@^2.2.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.3.1.tgz#b1621c54d63b97c47d3cfe7f7215f7d64517c369" + version "2.4.4" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" + integrity sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== mimic-fn@^1.0.0: version "1.2.0" @@ -4370,6 +4423,7 @@ mimic-fn@^1.0.0: minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" @@ -4419,8 +4473,9 @@ mkdirp@^0.5.0, mkdirp@^0.5.1: minimist "0.0.8" mock-fs@^4.4.2: - version "4.7.0" - resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.7.0.tgz#9f17e219cacb8094f4010e0a8c38589e2b33c299" + version "4.10.1" + resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.10.1.tgz#50a07a20114a6cdb119f35762f61f46266a1e323" + integrity sha512-w22rOL5ZYu6HbUehB5deurghGM0hS/xBVyHMGKOuQctkk93J9z9VEOhDsiWrXOprVNQpP9uzGKdl8v9mFspKuw== modify-values@^1.0.0: version "1.0.1" @@ -4615,6 +4670,7 @@ oauth-sign@~0.9.0: object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object-copy@^0.1.0: version "0.1.0" @@ -4670,6 +4726,7 @@ object.pick@^1.3.0: once@^1.3.0, once@^1.3.1, once@^1.3.2, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" @@ -4881,6 +4938,7 @@ path-exists@^3.0.0: path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" @@ -4937,8 +4995,9 @@ pify@^3.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" pify@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.0.tgz#db04c982b632fd0df9090d14aaf1c8413cadb695" + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== pinkie-promise@^2.0.0: version "2.0.1" @@ -4990,8 +5049,9 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" prettier@^1.10.2: - version "1.14.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" + version "1.18.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" + integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== pretty-format@^23.6.0: version "23.6.0" @@ -5873,6 +5933,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string-width@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.1.0.tgz#ba846d1daa97c3c596155308063e075ed1c99aff" + integrity sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^5.2.0" + string_decoder@0.10, string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" @@ -5912,6 +5981,13 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-bom@3.0.0, strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" @@ -5956,9 +6032,17 @@ supports-color@^3.1.2: dependencies: has-flag "^1.0.0" -supports-color@^5.3.0, supports-color@^5.4.0: +supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== dependencies: has-flag "^3.0.0" @@ -6244,20 +6328,32 @@ unique-stream@^2.0.2: json-stable-stringify "^1.0.0" through2-filter "^2.0.0" -unist-builder@^1.0.1, unist-builder@^1.0.2: +unist-builder@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/unist-builder/-/unist-builder-1.0.3.tgz#ab0f9d0f10936b74f3e913521955b0478e0ff036" dependencies: object-assign "^4.1.0" +unist-builder@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unist-builder/-/unist-builder-1.0.4.tgz#e1808aed30bd72adc3607f25afecebef4dd59e17" + integrity sha512-v6xbUPP7ILrT15fHGrNyHc1Xda8H3xVhP7/HAIotHOhVPjH5dCXA097C3Rry1Q2O+HbOLCao4hfPB+EYEjHgVg== + dependencies: + object-assign "^4.1.0" + unist-util-generated@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/unist-util-generated/-/unist-util-generated-1.1.2.tgz#8b993f9239d8e560be6ee6e91c3f7b7208e5ce25" -unist-util-is@^2.0.0, unist-util-is@^2.1.2: +unist-util-is@^2.0.0: version "2.1.2" resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-2.1.2.tgz#1193fa8f2bfbbb82150633f3a8d2eb9a1c1d55db" +unist-util-is@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-3.0.0.tgz#d9e84381c2468e82629e4a5be9d7d05a2dd324cd" + integrity sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A== + unist-util-position@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/unist-util-position/-/unist-util-position-3.0.1.tgz#8e220c24658239bf7ddafada5725ed0ea1ebbc26" @@ -6272,18 +6368,33 @@ unist-util-stringify-position@^1.0.0, unist-util-stringify-position@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz#3f37fcf351279dcbca7480ab5889bb8a832ee1c6" -unist-util-visit-parents@^2.0.0: +unist-util-stringify-position@^2.0.0: version "2.0.1" - resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-2.0.1.tgz#63fffc8929027bee04bfef7d2cce474f71cb6217" + resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-2.0.1.tgz#de2a2bc8d3febfa606652673a91455b6a36fb9f3" + integrity sha512-Zqlf6+FRI39Bah8Q6ZnNGrEHUhwJOkHde2MHVk96lLyftfJJckaPslKgzhVcviXj8KcE9UJM9F+a4JEiBUTYgA== dependencies: - unist-util-is "^2.1.2" + "@types/unist" "^2.0.2" -unist-util-visit@^1.0.0, unist-util-visit@^1.1.0, unist-util-visit@^1.3.0: +unist-util-visit-parents@^2.0.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz#25e43e55312166f3348cae6743588781d112c1e9" + integrity sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g== + dependencies: + unist-util-is "^3.0.0" + +unist-util-visit@^1.0.0, unist-util-visit@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.4.0.tgz#1cb763647186dc26f5e1df5db6bd1e48b3cc2fb1" dependencies: unist-util-visit-parents "^2.0.0" +unist-util-visit@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.4.1.tgz#4724aaa8486e6ee6e26d7ff3c8685960d560b1e3" + integrity sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw== + dependencies: + unist-util-visit-parents "^2.0.0" + universalify@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" @@ -6357,19 +6468,30 @@ vfile-message@^1.0.0: dependencies: unist-util-stringify-position "^1.1.1" -vfile-reporter@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/vfile-reporter/-/vfile-reporter-5.0.0.tgz#c2bcb87a6161cbd3b41671c2aa21b8c006f4acce" +vfile-message@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.1.tgz#951881861c22fc1eb39f873c0b93e336a64e8f6d" + integrity sha512-KtasSV+uVU7RWhUn4Lw+wW1Zl/nW8JWx7JCPps10Y9JRRIDeDXf8wfBLoOSsJLyo27DqMyAi54C6Jf/d6Kr2Bw== + dependencies: + "@types/unist" "^2.0.2" + unist-util-stringify-position "^2.0.0" + +vfile-reporter@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/vfile-reporter/-/vfile-reporter-6.0.0.tgz#753119f51dec9289b7508b457afc0cddf5e07f2e" + integrity sha512-8Is0XxFxWJUhPJdOg3CyZTqd3ICCWg6r304PuBl818ZG91h4FMS3Q+lrOPS+cs5/DZK3H0+AkJdH0J8JEwKtDA== dependencies: repeat-string "^1.5.0" - string-width "^2.0.0" - supports-color "^5.4.0" - unist-util-stringify-position "^1.0.0" + string-width "^4.0.0" + supports-color "^6.0.0" + unist-util-stringify-position "^2.0.0" + vfile-sort "^2.1.2" vfile-statistics "^1.1.0" -vfile-sort@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/vfile-sort/-/vfile-sort-2.1.1.tgz#03acdc8a4d7870ecf0e35499f095ddd9d14cbc41" +vfile-sort@^2.1.0, vfile-sort@^2.1.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/vfile-sort/-/vfile-sort-2.2.1.tgz#74e714f9175618cdae96bcaedf1a3dc711d87567" + integrity sha512-5dt7xEhC44h0uRQKhbM2JAe0z/naHphIZlMOygtMBM9Nn0pZdaX5fshhwWit9wvsuP8t/wp43nTDRRErO1WK8g== vfile-statistics@^1.1.0: version "1.1.1" @@ -6384,14 +6506,16 @@ vfile@^2.0.0: unist-util-stringify-position "^1.0.0" vfile-message "^1.0.0" -vfile@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/vfile/-/vfile-3.0.0.tgz#e0995335fdafbefe0c3d59a42868d413c0409031" +vfile@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/vfile/-/vfile-4.0.1.tgz#fc3d43a1c71916034216bf65926d5ee3c64ed60c" + integrity sha512-lRHFCuC4SQBFr7Uq91oJDJxlnftoTLQ7eKIpMdubhYcVMho4781a8MWXLy3qZrZ0/STD1kRiKc0cQOHm4OkPeA== dependencies: + "@types/unist" "^2.0.0" is-buffer "^2.0.0" replace-ext "1.0.0" - unist-util-stringify-position "^1.0.0" - vfile-message "^1.0.0" + unist-util-stringify-position "^2.0.0" + vfile-message "^2.0.0" vinyl-fs@^3.0.2: version "3.0.3" @@ -6543,6 +6667,7 @@ wrap-ansi@^2.0.0: wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= write-file-atomic@^2.1.0: version "2.4.2" From 2b035fd996043bf68aaf1a17e65b26bb368afa41 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 9 Jul 2019 21:54:14 -0700 Subject: [PATCH 034/231] test: Remove Node 8 support We need to upgrade vfile-reporter to fix TypeScript, and it includes a module, string-width, that requires Node 8. And it's probably time: so, we're now requiring Node 8. --- .circleci/config.yml | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc2eff3a7..b4b076fae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,6 @@ workflows: version: 2 node-multi-build: jobs: - - node-v6 - node-v8 - node-v10 diff --git a/package.json b/package.json index 786bde770..4ca6b79fd 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ } }, "engines": { - "node": ">=4" + "node": ">=8" }, "lint-staged": { "*.js": [ From 8f36e757002253d12ebadddac7d6699e5ea2a52f Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Sat, 8 Jun 2019 13:05:43 +0900 Subject: [PATCH 035/231] Formatted with Prettier BREAKING CHANGE: The next release will require Node 8 --- src/default_theme/assets/style.css | 33 ++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/default_theme/assets/style.css b/src/default_theme/assets/style.css index 5265ea1fa..0618f4376 100644 --- a/src/default_theme/assets/style.css +++ b/src/default_theme/assets/style.css @@ -26,7 +26,7 @@ h4 { } a { - color: #1184CE; + color: #1184ce; text-decoration: none; } @@ -51,12 +51,12 @@ a:hover { } section:target h3 { - font-weight:700; + font-weight: 700; } .documentation td, .documentation th { - padding: .25rem .25rem; + padding: 0.25rem 0.25rem; } h1:hover .anchorjs-link, @@ -82,13 +82,16 @@ h4:hover .anchorjs-link { } } -.pre, pre, code, .code { - font-family: Source Code Pro,Menlo,Consolas,Liberation Mono,monospace; +.pre, +pre, +code, +.code { + font-family: Source Code Pro, Menlo, Consolas, Liberation Mono, monospace; font-size: 14px; } .fill-light { - background: #F9F9F9; + background: #f9f9f9; } .width2 { @@ -100,10 +103,10 @@ h4:hover .anchorjs-link { display: block; width: 100%; height: 2rem; - padding: .5rem; + padding: 0.5rem; margin-bottom: 1rem; border: 1px solid #ccc; - font-size: .875rem; + font-size: 0.875rem; border-radius: 3px; box-sizing: border-box; } @@ -115,15 +118,19 @@ table { .prose table th, .prose table td { text-align: left; - padding:8px; - border:1px solid #ddd; + padding: 8px; + border: 1px solid #ddd; } -.prose table th:nth-child(1) { border-right: none; } -.prose table th:nth-child(2) { border-left: none; } +.prose table th:nth-child(1) { + border-right: none; +} +.prose table th:nth-child(2) { + border-left: none; +} .prose table { - border:1px solid #ddd; + border: 1px solid #ddd; } .prose-big { From 778d84cb6cc2e815579f9dd76497ad69f1f47192 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 9 Jul 2019 21:59:56 -0700 Subject: [PATCH 036/231] chore(release): 12.0.0 --- CHANGELOG.md | 13 +++++++++++++ package.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a36520c2e..245b95897 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [12.0.0](https://github.com/documentationjs/documentation/compare/v11.0.1...v12.0.0) (2019-07-10) + + +* Formatted with Prettier ([8f36e75](https://github.com/documentationjs/documentation/commit/8f36e75)) + + +### BREAKING CHANGES + +* The next release will require Node 8 + + + ## [11.0.1](https://github.com/documentationjs/documentation/compare/v11.0.0...v11.0.1) (2019-06-12) diff --git a/package.json b/package.json index 4ca6b79fd..d6219e7b0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "11.0.1", + "version": "12.0.0", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From 821a15e6bbb01d59da1a0e1e6e3d88f29ad63dda Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 10 Jul 2019 10:04:02 -0700 Subject: [PATCH 037/231] fix: Crash when called with no inputs. yargs now variadic positional arguments undefined instead of [] --- src/commands/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/build.js b/src/commands/build.js index ce09d86e7..c4397626b 100644 --- a/src/commands/build.js +++ b/src/commands/build.js @@ -43,7 +43,7 @@ module.exports.handler = function build(argv) { let watcher; argv._handled = true; - if (!argv.input.length) { + if (!(argv.input && argv.input.length)) { try { argv.input = [ JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8')) From 798d32ee26417738d21d2a6d34133f79d5dc8892 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 10 Jul 2019 10:06:32 -0700 Subject: [PATCH 038/231] chore(release): 12.0.1 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 245b95897..6277ed5d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [12.0.1](https://github.com/documentationjs/documentation/compare/v12.0.0...v12.0.1) (2019-07-10) + + +### Bug Fixes + +* Crash when called with no inputs. yargs now variadic positional arguments undefined instead of [] ([821a15e](https://github.com/documentationjs/documentation/commit/821a15e)) + + + # [12.0.0](https://github.com/documentationjs/documentation/compare/v11.0.1...v12.0.0) (2019-07-10) diff --git a/package.json b/package.json index d6219e7b0..eb61021a8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.0.0", + "version": "12.0.1", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From 226a666d1e1f465e357d21fdd36735dfdec55fba Mon Sep 17 00:00:00 2001 From: Ben Turner <7623873+ben-turner@users.noreply.github.com> Date: Tue, 16 Jul 2019 14:37:41 -0700 Subject: [PATCH 039/231] deps: Remove unmaintained dependency: disparity (#1264) * Remove unmaintained dependency: disparity The dependency disparity has not been updated for 4 years and is using a very old version of the diff package which has a security alert. This alert is not relevant to the current usage of the package, however it does generate noise when installing. Additionally, it seems unwise to be relying on unmaintained packages. This commit replaces disparity with diff and adds some code to color the output which is based on disparity's logic. * Use chalk to color diff output instead of ansi-styles --- package.json | 2 +- src/commands/readme.js | 40 +++++++++++++++++++++++++++++++++------- yarn.lock | 16 +++++----------- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index eb61021a8..d91f99a30 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "chalk": "^2.3.0", "chokidar": "^2.0.4", "concat-stream": "^1.6.0", - "disparity": "^2.0.0", + "diff": "^4.0.1", "doctrine-temporary-fork": "2.1.0", "get-port": "^4.0.0", "git-url-parse": "^10.0.1", diff --git a/src/commands/readme.js b/src/commands/readme.js index a7591b8d3..11e81d351 100644 --- a/src/commands/readme.js +++ b/src/commands/readme.js @@ -5,7 +5,7 @@ const documentation = require('../'); const sharedOptions = require('./shared_options'); const inject = require('mdast-util-inject'); const chalk = require('chalk'); -const disparity = require('disparity'); +const diff = require('diff'); const getReadmeFile = require('../get-readme-file'); module.exports.command = 'readme [input..]'; @@ -94,22 +94,48 @@ module.exports.handler = function readme(argv) { .process(readmeContent) ) .then(file => { - const diffOutput = disparity.unified(readmeContent, file.contents, { - paths: [argv.readmeFile, argv.readmeFile] - }); - if (!diffOutput.length) { + const diffRaw = diff.createPatch( + '', + readmeContent, + file.contents, + '', + '' + ); + if (!diffRaw.length) { log(`${argv.readmeFile} is up to date.`); process.exit(0); } + // Replace diff headers with real values + const cleanedDiff = diffRaw + .replace(/^([^\n]+)\n([^\n]+)\n/m, '') + .replace(/^---.*/gm, `--- ${argv.readmeFile}\tremoved`) + .replace(/^\+\+\+.*/gm, `+++ ${argv.readmeFile}\tadded`); + + // Includes newlines for easier joins + const diffLines = cleanedDiff.split(/^/m); + const diffHeader = diffLines + .slice(0, 2) + .join('') + .replace(/[^\n\r]+/g, chalk.yellow('$&')); + const diffBody = diffLines + .slice(2) + .join('') + .replace(/^-[^\n\r]*/gm, chalk.red('$&')) + .replace(/^\+[^\n\r]*/gm, chalk.green('$&')) + .replace(/^@@.+@@/gm, chalk.magenta('$&')); + if (argv.d) { log( chalk.bold(`${argv.readmeFile} needs the following updates:`), - `\n${diffOutput}` + `\n${diffHeader}${diffBody}` ); process.exit(1); } else { - log(chalk.bold(`Updating ${argv.readmeFile}`), `\n${diffOutput}`); + log( + chalk.bold(`Updating ${argv.readmeFile}`), + `\n${diffHeader}${diffBody}` + ); } fs.writeFileSync(argv.readmeFile, file.contents); diff --git a/yarn.lock b/yarn.lock index 5c6b223de..284f472b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -930,7 +930,7 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== -ansi-styles@^2.0.1, ansi-styles@^2.2.1: +ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -2070,20 +2070,14 @@ detective@^4.0.0: acorn "^5.2.1" defined "^1.0.0" -diff@^1.3.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" - diff@^3.2.0: version "3.5.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" -disparity@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/disparity/-/disparity-2.0.0.tgz#57ddacb47324ae5f58d2cc0da886db4ce9eeb718" - dependencies: - ansi-styles "^2.0.1" - diff "^1.3.2" +diff@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== doctrine-temporary-fork@2.1.0: version "2.1.0" From 4d9938518451aca3614ada2d7a76956cc6ae848a Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 16 Jul 2019 14:38:36 -0700 Subject: [PATCH 040/231] chore(release): 12.0.2 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6277ed5d4..b9d278c74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [12.0.2](https://github.com/documentationjs/documentation/compare/v12.0.1...v12.0.2) (2019-07-16) + + + ## [12.0.1](https://github.com/documentationjs/documentation/compare/v12.0.0...v12.0.1) (2019-07-10) diff --git a/package.json b/package.json index d91f99a30..845e248a5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.0.1", + "version": "12.0.2", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From f9039e9614019ca4960ab01137f3948ab65ff8d4 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 22 Jul 2019 14:01:43 -0700 Subject: [PATCH 041/231] fix: Allow skipped array arguments in destructuring. Fixes #1247 (#1266) --- __tests__/__snapshots__/test.js.snap | 39 +++++++++++++++++++++++----- __tests__/fixture/es6.input.js | 6 ++--- src/infer/params.js | 5 +++- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 81879b012..e16e3e75a 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -8529,7 +8529,7 @@ have any parameter descriptions.", "context": Object { "loc": Object { "end": Object { - "column": 34, + "column": 36, "line": 16, }, "start": Object { @@ -8593,7 +8593,7 @@ have any parameter descriptions.", "errors": Array [], "examples": Array [ Object { - "description": "destructure([1, 2, 3])", + "description": "destructure([0, 1, 2, 3])", }, ], "implements": Array [], @@ -8623,7 +8623,6 @@ have any parameter descriptions.", "name": "$0", "properties": Array [ Object { - "lineNumber": 16, "name": "$0.0", "title": "param", }, @@ -8637,6 +8636,11 @@ have any parameter descriptions.", "name": "$0.2", "title": "param", }, + Object { + "lineNumber": 16, + "name": "$0.3", + "title": "param", + }, ], "title": "param", "type": Object { @@ -8656,7 +8660,7 @@ have any parameter descriptions.", "sees": Array [], "tags": Array [ Object { - "description": "destructure([1, 2, 3])", + "description": "destructure([0, 1, 2, 3])", "lineNumber": 2, "title": "example", }, @@ -11631,11 +11635,12 @@ Similar, but with an array - \`$0.0\` - \`$0.1\` - \`$0.2\` + - \`$0.3\` ### Examples \`\`\`javascript -destructure([1, 2, 3]) +destructure([0, 1, 2, 3]) \`\`\` ## multiply @@ -12271,6 +12276,28 @@ have any parameter descriptions.", ], "type": "listItem", }, + Object { + "children": Array [ + Object { + "children": Array [ + Object { + "type": "inlineCode", + "value": "$0.3", + }, + Object { + "type": "text", + "value": " ", + }, + Object { + "type": "text", + "value": " ", + }, + ], + "type": "paragraph", + }, + ], + "type": "listItem", + }, ], "ordered": false, "type": "list", @@ -12295,7 +12322,7 @@ have any parameter descriptions.", Object { "lang": "javascript", "type": "code", - "value": "destructure([1, 2, 3])", + "value": "destructure([0, 1, 2, 3])", }, Object { "children": Array [ diff --git a/__tests__/fixture/es6.input.js b/__tests__/fixture/es6.input.js index a300409a2..7e27ec7a4 100644 --- a/__tests__/fixture/es6.input.js +++ b/__tests__/fixture/es6.input.js @@ -11,9 +11,9 @@ function destructure({ /** * Similar, but with an array * @example - * destructure([1, 2, 3]) + * destructure([0, 1, 2, 3]) */ -function destructure([a, b, c]) {} +function destructure([, a, b, c]) {} /** * This function returns the number one. @@ -184,6 +184,6 @@ class A { // nullishCoalescingOperator let x = a ?? b; // logicalAssignment - return x &&= b?.b |> String.fromCharCode; + return (x &&= b?.b |> String.fromCharCode); } } diff --git a/src/infer/params.js b/src/infer/params.js index dc67c0b81..93a1ae034 100644 --- a/src/infer/params.js +++ b/src/infer/params.js @@ -273,7 +273,10 @@ function paramToDoc(param, prefix, i) { const newParam = { title: 'param', name: prefix ? prefixedName : param.name, - lineNumber: param.loc.start.line + // A skipped array argument like ([, a]); + // looks like { name: '0', indexed: true }, and thus has no location, + // so we allow location to be undefined here. + lineNumber: param.loc ? param.loc.start.line : undefined }; // Flow/TS annotations From a1a2310321e8081aa78ddd7958e79b0a68a122db Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 22 Jul 2019 14:01:57 -0700 Subject: [PATCH 042/231] chore(release): 12.0.3 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9d278c74..e8f05ae93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [12.0.3](https://github.com/documentationjs/documentation/compare/v12.0.2...v12.0.3) (2019-07-22) + + +### Bug Fixes + +* Allow skipped array arguments in destructuring. Fixes [#1247](https://github.com/documentationjs/documentation/issues/1247) ([#1266](https://github.com/documentationjs/documentation/issues/1266)) ([f9039e9](https://github.com/documentationjs/documentation/commit/f9039e9)) + + + ## [12.0.2](https://github.com/documentationjs/documentation/compare/v12.0.1...v12.0.2) (2019-07-16) diff --git a/package.json b/package.json index 845e248a5..e8f0590f6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.0.2", + "version": "12.0.3", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From ec36b41aa972a2d92126c368d839e3a7f20f941b Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Thu, 1 Aug 2019 02:40:22 +0300 Subject: [PATCH 043/231] feat: Add git submodules support to github linking (#1270) * add git submodules support in github linking * more reliable submodule origin parsing --- __tests__/lib/git/find_git.js | 20 +++++++++++++++----- __tests__/lib/git/url_prefix.js | 25 +++++++++++++++++++------ __tests__/utils.js | 26 ++++++++++++++++++++++++++ package.json | 2 +- src/git/find_git.js | 23 +++++++++++++++-------- src/git/url_prefix.js | 24 ++++++++++++++++++------ src/github.js | 15 ++++++++------- yarn.lock | 14 +------------- 8 files changed, 103 insertions(+), 46 deletions(-) diff --git a/__tests__/lib/git/find_git.js b/__tests__/lib/git/find_git.js index 8619ac986..dd9886669 100644 --- a/__tests__/lib/git/find_git.js +++ b/__tests__/lib/git/find_git.js @@ -5,12 +5,22 @@ const findGit = require('../../../src/git/find_git'); test('findGit', function() { mock(mockRepo.master); + const root = + path.parse(__dirname).root + path.join('my', 'repository', 'path'); + const masterPaths = findGit(path.join(root, 'index.js')); + mock.restore(); - const root = path.parse(__dirname).root; - - expect( - findGit(root + path.join('my', 'repository', 'path', 'index.js')) - ).toBe(root + path.join('my', 'repository', 'path', '.git')); + expect(masterPaths).toEqual({ + git: path.join(root, '.git'), + root + }); + mock(mockRepo.submodule); + const submodulePaths = findGit(path.join(root, 'index.js')); mock.restore(); + + expect(submodulePaths).toEqual({ + git: path.join(path.dirname(root), '.git', 'modules', 'path'), + root + }); }); diff --git a/__tests__/lib/git/url_prefix.js b/__tests__/lib/git/url_prefix.js index 0a917352f..2a7f53e75 100644 --- a/__tests__/lib/git/url_prefix.js +++ b/__tests__/lib/git/url_prefix.js @@ -5,20 +5,33 @@ const parsePackedRefs = getGithubURLPrefix.parsePackedRefs; test('getGithubURLPrefix', function() { mock(mockRepo.master); - - expect(getGithubURLPrefix('/my/repository/path/')).toBe( - 'https://github.com/foo/bar/blob/this_is_the_sha/' - ); - + const masterUrl = getGithubURLPrefix({ + git: '/my/repository/path/.git', + root: '/my/repository/path' + }); mock.restore(); + expect(masterUrl).toBe('https://github.com/foo/bar/blob/this_is_the_sha/'); + mock(mockRepo.detached); + const detachedUrl = getGithubURLPrefix({ + git: '/my/repository/path/.git', + root: '/my/repository/path' + }); + mock.restore(); - expect(getGithubURLPrefix('/my/repository/path/')).toBe( + expect(detachedUrl).toBe( 'https://github.com/foo/bar/blob/e4cb2ffe677571d0503e659e4e64e01f45639c62/' ); + mock(mockRepo.submodule); + const submoduleUrl = getGithubURLPrefix({ + git: '/my/repository/.git/modules/path', + root: '/my/repository/path' + }); mock.restore(); + + expect(submoduleUrl).toBe('https://github.com/foo/bar/blob/this_is_the_sha/'); }); test('parsePackedRefs', function() { diff --git a/__tests__/utils.js b/__tests__/utils.js index 874093df1..aec4d2c5c 100644 --- a/__tests__/utils.js +++ b/__tests__/utils.js @@ -74,6 +74,32 @@ module.exports.mockRepo = { } } }, + submodule: { + '/my': { + repository: { + path: { + '.git': 'gitdir: ../.git/modules/path', + 'index.js': 'module.exports = 42;' + }, + '.git': { + config: + '[submodule "path"]\n' + + 'url = https://github.com/foo/bar\n' + + 'active = true', + modules: { + path: { + HEAD: 'ref: refs/heads/master', + refs: { + heads: { + master: 'this_is_the_sha' + } + } + } + } + } + } + } + }, malformed: { '/my': { repository: { diff --git a/package.json b/package.json index e8f0590f6..859d915ea 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "glob": "^7.1.2", "globals-docs": "^2.4.0", "highlight.js": "^9.15.5", + "ini": "^1.3.5", "js-yaml": "^3.10.0", "lodash": "^4.17.10", "mdast-util-inject": "^1.1.0", @@ -58,7 +59,6 @@ "remark-html": "^8.0.0", "remark-reference-links": "^4.0.1", "remark-toc": "^5.0.0", - "remote-origin-url": "0.4.0", "resolve": "^1.8.1", "stream-array": "^1.1.2", "strip-json-comments": "^2.0.1", diff --git a/src/git/find_git.js b/src/git/find_git.js index 6a56a11f8..426b9091d 100644 --- a/src/git/find_git.js +++ b/src/git/find_git.js @@ -5,18 +5,25 @@ const fs = require('fs'); * Given a full path to a single file, iterate upwards through the filesystem * to find a directory with a .git file indicating that it is a git repository * @param filename any file within a repository - * @returns repository path + * @returns repository root & its .git folder paths */ function findGit(filename) { - const paths = filename.split(path.sep); - for (let i = paths.length; i > 0; i--) { - const p = path.resolve( - paths.slice(0, i).join(path.sep) + path.sep + '.git' - ); - if (fs.existsSync(p)) { - return p; + let root = path.resolve(filename); + while (root) { + root = path.dirname(root); + let git = path.join(root, '.git'); + if (!fs.existsSync(git)) continue; + + if (fs.statSync(git).isFile()) { + // git submodule + const matches = fs.readFileSync(git, 'utf8').match(/gitdir: (.*)/); + if (!matches) return null; + git = path.join(root, matches[1]); } + + return { root, git }; } + return null; } module.exports = findGit; diff --git a/src/git/url_prefix.js b/src/git/url_prefix.js index aedf19ae4..64bd4f0aa 100644 --- a/src/git/url_prefix.js +++ b/src/git/url_prefix.js @@ -1,7 +1,7 @@ const fs = require('fs'); const path = require('path'); const gitUrlParse = require('git-url-parse'); -const getRemoteOrigin = require('remote-origin-url'); +const ini = require('ini'); /** * Sometimes git will [pack refs](https://git-scm.com/docs/git-pack-refs) @@ -32,15 +32,15 @@ function parsePackedRefs(packedRefs, branchName) { * @returns {string} base HTTPS url of the GitHub repository * @throws {Error} if the root is not a git repo */ -function getGithubURLPrefix(root) { +function getGithubURLPrefix({ git, root }) { let sha; try { - const head = fs.readFileSync(path.join(root, '.git', 'HEAD'), 'utf8'); + const head = fs.readFileSync(path.join(git, 'HEAD'), 'utf8'); const branch = head.match(/ref: (.*)/); if (branch) { const branchName = branch[1]; - const branchFileName = path.join(root, '.git', branchName); - const packedRefsName = path.join(root, '.git', 'packed-refs'); + const branchFileName = path.join(git, branchName); + const packedRefsName = path.join(git, 'packed-refs'); if (fs.existsSync(branchFileName)) { sha = fs.readFileSync(branchFileName, 'utf8'); } else if (fs.existsSync(packedRefsName)) { @@ -57,7 +57,19 @@ function getGithubURLPrefix(root) { sha = head; } if (sha) { - const parsed = gitUrlParse(getRemoteOrigin.sync(root)); + let origin; + if (git.indexOf(root) === 0) { + const config = ini.parse( + fs.readFileSync(path.join(git, 'config'), 'utf8') + ); + origin = config['remote "origin"'].url; + } else { + const config = ini.parse( + fs.readFileSync(path.join(git, '..', '..', 'config'), 'utf8') + ); + origin = config[`submodule "${path.basename(git)}"`].url; + } + const parsed = gitUrlParse(origin); parsed.git_suffix = false; // eslint-disable-line return parsed.toString('https') + '/blob/' + sha.trim() + '/'; } diff --git a/src/github.js b/src/github.js index 46c497837..3edb435ad 100644 --- a/src/github.js +++ b/src/github.js @@ -10,15 +10,16 @@ const getGithubURLPrefix = require('./git/url_prefix'); * @returns {Object} comment with github inferred */ module.exports = function(comment) { - const repoPath = findGit(comment.context.file); - const root = repoPath ? path.dirname(repoPath) : '.'; - const urlPrefix = getGithubURLPrefix(root); - const fileRelativePath = comment.context.file - .replace(root + path.sep, '') - .split(path.sep) - .join('/'); + const paths = findGit(comment.context.file); + + const urlPrefix = paths && getGithubURLPrefix(paths); if (urlPrefix) { + const fileRelativePath = comment.context.file + .replace(paths.root + path.sep, '') + .split(path.sep) + .join('/'); + let startLine; let endLine; diff --git a/yarn.lock b/yarn.lock index 284f472b1..02e1f4a60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3076,7 +3076,7 @@ inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -ini@^1.3.2, ini@^1.3.3, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.5, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" @@ -4868,12 +4868,6 @@ parse-filepath@^1.0.2: map-cache "^0.2.0" path-root "^0.1.1" -parse-git-config@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/parse-git-config/-/parse-git-config-0.2.0.tgz#272833fdd15fea146fb75d336d236b963b6ff706" - dependencies: - ini "^1.3.3" - parse-github-repo-url@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz#9e7d8bb252a6cb6ba42595060b7bf6df3dbc1f50" @@ -5420,12 +5414,6 @@ remark@^9.0.0: remark-stringify "^5.0.0" unified "^6.0.0" -remote-origin-url@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/remote-origin-url/-/remote-origin-url-0.4.0.tgz#4d3e2902f34e2d37d1c263d87710b77eb4086a30" - dependencies: - parse-git-config "^0.2.0" - remove-bom-buffer@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz#c2bf1e377520d324f623892e33c10cac2c252b53" From 43cd57d3fa1155c6e93b760b0ff7704e26b70f69 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 31 Jul 2019 16:40:43 -0700 Subject: [PATCH 044/231] chore(release): 12.1.0 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8f05ae93..d304ffc5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +# [12.1.0](https://github.com/documentationjs/documentation/compare/v12.0.3...v12.1.0) (2019-07-31) + + +### Features + +* Add git submodules support to github linking ([#1270](https://github.com/documentationjs/documentation/issues/1270)) ([ec36b41](https://github.com/documentationjs/documentation/commit/ec36b41)) + + + ## [12.0.3](https://github.com/documentationjs/documentation/compare/v12.0.2...v12.0.3) (2019-07-22) diff --git a/package.json b/package.json index 859d915ea..eda9c7105 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.0.3", + "version": "12.1.0", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From 27a29be207eb3bab963f6cfc2b9c09267ee91de8 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 2 Aug 2019 01:38:33 +0300 Subject: [PATCH 045/231] fix: Git submodule support for repo names with a dot (#1271) --- __tests__/lib/git/find_git.js | 12 +++++++++--- __tests__/lib/git/url_prefix.js | 4 ++-- __tests__/utils.js | 8 ++++---- src/git/url_prefix.js | 18 ++++++++++++------ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/__tests__/lib/git/find_git.js b/__tests__/lib/git/find_git.js index dd9886669..d5f089947 100644 --- a/__tests__/lib/git/find_git.js +++ b/__tests__/lib/git/find_git.js @@ -16,11 +16,17 @@ test('findGit', function() { }); mock(mockRepo.submodule); - const submodulePaths = findGit(path.join(root, 'index.js')); + const submoduleRoot = path.join(root, '..', 'my.submodule'); + const submodulePaths = findGit(path.join(submoduleRoot, 'index.js')); mock.restore(); expect(submodulePaths).toEqual({ - git: path.join(path.dirname(root), '.git', 'modules', 'path'), - root + git: path.join( + path.dirname(submoduleRoot), + '.git', + 'modules', + 'my.submodule' + ), + root: submoduleRoot }); }); diff --git a/__tests__/lib/git/url_prefix.js b/__tests__/lib/git/url_prefix.js index 2a7f53e75..22be4bf6b 100644 --- a/__tests__/lib/git/url_prefix.js +++ b/__tests__/lib/git/url_prefix.js @@ -26,8 +26,8 @@ test('getGithubURLPrefix', function() { mock(mockRepo.submodule); const submoduleUrl = getGithubURLPrefix({ - git: '/my/repository/.git/modules/path', - root: '/my/repository/path' + git: '/my/repository/.git/modules/my.submodule', + root: '/my/repository/my.submodule' }); mock.restore(); diff --git a/__tests__/utils.js b/__tests__/utils.js index aec4d2c5c..001e3b4a7 100644 --- a/__tests__/utils.js +++ b/__tests__/utils.js @@ -77,17 +77,17 @@ module.exports.mockRepo = { submodule: { '/my': { repository: { - path: { - '.git': 'gitdir: ../.git/modules/path', + 'my.submodule': { + '.git': 'gitdir: ../.git/modules/my.submodule', 'index.js': 'module.exports = 42;' }, '.git': { config: - '[submodule "path"]\n' + + '[submodule "my.submodule"]\n' + 'url = https://github.com/foo/bar\n' + 'active = true', modules: { - path: { + 'my.submodule': { HEAD: 'ref: refs/heads/master', refs: { heads: { diff --git a/src/git/url_prefix.js b/src/git/url_prefix.js index 64bd4f0aa..0e0737bef 100644 --- a/src/git/url_prefix.js +++ b/src/git/url_prefix.js @@ -59,14 +59,10 @@ function getGithubURLPrefix({ git, root }) { if (sha) { let origin; if (git.indexOf(root) === 0) { - const config = ini.parse( - fs.readFileSync(path.join(git, 'config'), 'utf8') - ); + const config = parseGitConfig(path.join(git, 'config')); origin = config['remote "origin"'].url; } else { - const config = ini.parse( - fs.readFileSync(path.join(git, '..', '..', 'config'), 'utf8') - ); + const config = parseGitConfig(path.join(git, '..', '..', 'config')); origin = config[`submodule "${path.basename(git)}"`].url; } const parsed = gitUrlParse(origin); @@ -78,5 +74,15 @@ function getGithubURLPrefix({ git, root }) { } } +function parseGitConfig(configPath) { + const str = fs + .readFileSync(configPath, 'utf8') + .replace( + /\[(\S+) "(.+)"\]/g, + (match, key, value) => `[${key} "${value.split('.').join('\\.')}"]` + ); + return ini.parse(str); +} + module.exports = getGithubURLPrefix; module.exports.parsePackedRefs = parsePackedRefs; From 29c19ffc5db6f914e7e143751ae424127e54edc9 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 1 Aug 2019 15:38:49 -0700 Subject: [PATCH 046/231] chore(release): 12.1.1 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d304ffc5c..dfd20c7e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [12.1.1](https://github.com/documentationjs/documentation/compare/v12.1.0...v12.1.1) (2019-08-01) + + +### Bug Fixes + +* Git submodule support for repo names with a dot ([#1271](https://github.com/documentationjs/documentation/issues/1271)) ([27a29be](https://github.com/documentationjs/documentation/commit/27a29be)) + + + # [12.1.0](https://github.com/documentationjs/documentation/compare/v12.0.3...v12.1.0) (2019-07-31) diff --git a/package.json b/package.json index eda9c7105..e9f49eeae 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.1.0", + "version": "12.1.1", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From b2c317533c281607cc6688894ef0c232cd1a38c7 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Wed, 14 Aug 2019 02:01:23 +0900 Subject: [PATCH 047/231] editorconfig rules should apply to CSS too (#1275) helps maintain consistency. --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 443b276cc..597e75449 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -[**.js] +[*.{js,css}] indent_style = space indent_size = 2 trim_trailing_whitespace = true From 1548574e438d7023299bddc28327a7a29e296ae9 Mon Sep 17 00:00:00 2001 From: Piotr Zduniak Date: Mon, 9 Sep 2019 18:20:42 +0200 Subject: [PATCH 048/231] Fix a crash in ts_doctrine.js (#1278) --- src/ts_doctrine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ts_doctrine.js b/src/ts_doctrine.js index efc6c4f26..19723401b 100644 --- a/src/ts_doctrine.js +++ b/src/ts_doctrine.js @@ -32,7 +32,7 @@ function propertyToField(property) { } return { type: 'FieldType', - key: property.key.name || property.key.value, + key: property.key ? property.key.name || property.key.value : '', value: type }; } From 3e0958b033efc409163af244c618b09eca940792 Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Mon, 9 Sep 2019 18:21:39 +0200 Subject: [PATCH 049/231] fix: check for empty diff (#1273) * Fix check for empty diff Compare to the result of the latest diff module: https://runkit.com/embed/y4qzdzzz05qr No diff gives this result: ``` Index: =================================================================== --- +++ ``` * Actually check the right thing in the fix as well --- src/commands/readme.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/readme.js b/src/commands/readme.js index 11e81d351..00813c63c 100644 --- a/src/commands/readme.js +++ b/src/commands/readme.js @@ -101,7 +101,7 @@ module.exports.handler = function readme(argv) { '', '' ); - if (!diffRaw.length) { + if (diffRaw.split('\n').length === 5) { log(`${argv.readmeFile} is up to date.`); process.exit(0); } From 635e52e38211853a92266cef439ed158f0fa97cf Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 9 Sep 2019 09:24:11 -0700 Subject: [PATCH 050/231] chore(release): 12.1.2 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd20c7e0..ca2c54669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [12.1.2](https://github.com/documentationjs/documentation/compare/v12.1.1...v12.1.2) (2019-09-09) + + +### Bug Fixes + +* check for empty diff ([#1273](https://github.com/documentationjs/documentation/issues/1273)) ([3e0958b](https://github.com/documentationjs/documentation/commit/3e0958b)) + + + ## [12.1.1](https://github.com/documentationjs/documentation/compare/v12.1.0...v12.1.1) (2019-08-01) diff --git a/package.json b/package.json index e9f49eeae..6c8a0493f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.1.1", + "version": "12.1.2", "author": "Tom MacWright", "bin": { "documentation": "./bin/documentation.js" From e7da906b849251c2432d4c4acd61d07cf0dcfb63 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Wed, 11 Sep 2019 02:02:41 +0900 Subject: [PATCH 051/231] HTTPS link to daringfireball.net (#1280) --- src/output/markdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output/markdown.js b/src/output/markdown.js index 8b00fac08..252f50d4e 100644 --- a/src/output/markdown.js +++ b/src/output/markdown.js @@ -3,7 +3,7 @@ const markdownAST = require('./markdown_ast'); /** * Formats documentation as - * [Markdown](http://daringfireball.net/projects/markdown/). + * [Markdown](https://daringfireball.net/projects/markdown/). * * @param {Array} comments parsed comments * @param {Object} args Options that can customize the output From acf3cfb059e34597b9cc5e68ee98d589276a1442 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Wed, 11 Sep 2019 02:02:49 +0900 Subject: [PATCH 052/231] fix filenames typo (#1279) --- src/smart_glob.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smart_glob.js b/src/smart_glob.js index a5ace50b1..31d5c0cee 100644 --- a/src/smart_glob.js +++ b/src/smart_glob.js @@ -80,7 +80,7 @@ function resolveFileGlobPatterns(patterns, extensions) { } /** - * Build a list of absolute filesnames on which ESLint will act. + * Build a list of absolute filenames on which ESLint will act. * Ignored files are excluded from the results, as are duplicates. * * @param globPatterns Glob patterns. From 3ecc358e588df09f125bb70f4de608f050c855ad Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Fri, 11 Oct 2019 03:26:38 +0900 Subject: [PATCH 053/231] HTTPS link to https://eslint.org/docs/rules/valid-jsdoc.html (#1287) --- docs/FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index 9f52e8256..e90a5c28a 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -52,7 +52,7 @@ documentation. * The JSDoc syntax exposes a powerful, standardized type syntax to, for example, express parameter types like 'an array of strings'. as `Array`, and to support custom object types with inter-linking -* The [eslint valid-jsdoc rule](http://eslint.org/docs/rules/valid-jsdoc.html) +* The [eslint valid-jsdoc rule](https://eslint.org/docs/rules/valid-jsdoc.html) makes it possible to require documentation as part of your linting step, ensuring that new code doesn't lower documentation coverage. From bbc988e9fde00f50b2b42128e4c713a688be44b9 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 11 Oct 2019 12:58:05 -0700 Subject: [PATCH 054/231] Patch 11 (#1289) * specify page lang in HTML template Good practise to include this. REF: https://www.w3.org/International/questions/qa-html-language-declarations * Update snapshot --- __tests__/__snapshots__/test.js.snap | 2 +- src/default_theme/index._ | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index e16e3e75a..620e7a0d8 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -1528,7 +1528,7 @@ Returns **[Number][3]** numberone exports[`html nested.input.js 1`] = ` " - + | Documentation diff --git a/src/default_theme/index._ b/src/default_theme/index._ index 2577a1859..caefed9a3 100644 --- a/src/default_theme/index._ +++ b/src/default_theme/index._ @@ -1,5 +1,5 @@ - + <%- config['project-name'] %> <%- config['project-version'] %> | Documentation<% if (config['project-description']) { %> From 3506ef28baceaccec516af4cf43c4b9d7ad482b4 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Tue, 15 Oct 2019 00:55:07 +0900 Subject: [PATCH 055/231] Fix beacuse typo (#1292) --- src/infer/access.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infer/access.js b/src/infer/access.js index a4f12494b..264fff9a4 100644 --- a/src/infer/access.js +++ b/src/infer/access.js @@ -27,7 +27,7 @@ function inferAccessWithPattern(pattern) { comment.readonly = true; } - // This needs to run after inferName beacuse we infer the access based on + // This needs to run after inferName because we infer the access based on // the name. if ( re && From c1e4dbe923d37314169c755cc812658e4c473330 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Tue, 15 Oct 2019 00:56:41 +0900 Subject: [PATCH 056/231] Update RECIPES.md (#1291) Fix links to HTTPS to prevent redirects Fix hierachical typo --- docs/RECIPES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/RECIPES.md b/docs/RECIPES.md index 7d96eb3c8..16255f212 100644 --- a/docs/RECIPES.md +++ b/docs/RECIPES.md @@ -98,7 +98,7 @@ names with the parent object. Here's an example: ```js /** - * This method has hierachical params + * This method has hierarchical params * @param {Object} animals different kinds of animals * @param {String} animals.fishes number of kinds of fish */ @@ -113,8 +113,8 @@ explicit syntax is required. ## Object Factories -Libraries like [d3](http://d3js.org/) eschew JavaScript's `new` operator -in favor of the ['object factory' or 'module pattern'](http://www.macwright.org/2012/06/04/the-module-pattern.html). +Libraries like [d3](https://d3js.org) eschew JavaScript's `new` operator +in favor of the ['object factory' or 'module pattern'](https://macwright.org/2012/06/04/the-module-pattern.html). The factory function is a normal function that yields an object. That object has properties. In this case, we don't use the `@class` tag because From d5b5e3ccff83c0001ced44c69c6dd2fc2066d0bb Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Tue, 15 Oct 2019 01:02:30 +0900 Subject: [PATCH 057/231] Update CODE_OF_CONDUCT.md (#1290) Update to latest version from: https://www.contributor-covenant.org/version/1/4/code-of-conduct.md --- CODE_OF_CONDUCT.md | 78 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 65c05c574..c06638aef 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,22 +1,76 @@ -# Contributor Code of Conduct +# Contributor Covenant Code of Conduct -As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. +## Our Pledge -We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment -* Publishing other's private information, such as physical or electronic addresses, without explicit permission -* Other unethical or unprofessional conduct. +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team. All complaints will be reviewed and +investigated and will result in a response that is deemed necessary and appropriate +to the circumstances. The project team is obligated to maintain confidentiality with +regard to the reporter of an incident. Further details of specific enforcement +policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. +## Attribution -This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. +[homepage]: https://www.contributor-covenant.org -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) \ No newline at end of file +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq From 6e6298255bc738ae6ab21c19eb390f4845f6358a Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Wed, 16 Oct 2019 00:25:39 +0900 Subject: [PATCH 058/231] Add homepage to package.json (#1282) This PR adds "homepage": "https://documentation.js.org" to package.json REF: https://docs.npmjs.com/files/package.json#homepage --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 6c8a0493f..605005233 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "description": "a documentation generator", "version": "12.1.2", "author": "Tom MacWright", + "homepage": "https://documentation.js.org", "bin": { "documentation": "./bin/documentation.js" }, From 344e8045ff87ed36199ee122de1725f219c245a4 Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Mon, 4 Nov 2019 17:51:28 +0100 Subject: [PATCH 059/231] fix: upgrade git-url-parse to fix a parsing issue (#1296) --- package.json | 2 +- yarn.lock | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 605005233..e406273de 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "diff": "^4.0.1", "doctrine-temporary-fork": "2.1.0", "get-port": "^4.0.0", - "git-url-parse": "^10.0.1", + "git-url-parse": "^11.1.2", "github-slugger": "1.2.0", "glob": "^7.1.2", "globals-docs": "^2.4.0", diff --git a/yarn.lock b/yarn.lock index 02e1f4a60..c68bbdad1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2733,18 +2733,20 @@ git-semver-tags@^1.3.0, git-semver-tags@^1.3.6: meow "^4.0.0" semver "^5.5.0" -git-up@^2.0.0: - version "2.0.10" - resolved "https://registry.yarnpkg.com/git-up/-/git-up-2.0.10.tgz#20fe6bafbef4384cae253dc4f463c49a0c3bd2ec" +git-up@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.1.tgz#cb2ef086653640e721d2042fe3104857d89007c0" + integrity sha512-LFTZZrBlrCrGCG07/dm1aCjjpL1z9L3+5aEeI9SBhAqSc+kiA9Or1bgZhQFNppJX6h/f5McrvJt1mQXTFm6Qrw== dependencies: is-ssh "^1.3.0" - parse-url "^1.3.0" + parse-url "^5.0.0" -git-url-parse@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/git-url-parse/-/git-url-parse-10.0.1.tgz#75f153b24ac7297447fc583cf9fac23a5ae687c1" +git-url-parse@^11.1.2: + version "11.1.2" + resolved "https://registry.yarnpkg.com/git-url-parse/-/git-url-parse-11.1.2.tgz#aff1a897c36cc93699270587bea3dbcbbb95de67" + integrity sha512-gZeLVGY8QVKMIkckncX+iCq2/L8PlwncvDFKiWkBn9EtCfYDbliRTTp6qzyQ1VMdITUfq7293zDzfpjdiGASSQ== dependencies: - git-up "^2.0.0" + git-up "^4.0.0" gitconfiglocal@^1.0.0: version "1.0.0" @@ -4599,6 +4601,11 @@ normalize-path@^2.0.1, normalize-path@^2.1.1: dependencies: remove-trailing-separator "^1.0.1" +normalize-url@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" + integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== + now-and-later@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/now-and-later/-/now-and-later-2.0.0.tgz#bc61cbb456d79cb32207ce47ca05136ff2e7d6ee" @@ -4894,11 +4901,22 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" -parse-url@^1.3.0: - version "1.3.11" - resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-1.3.11.tgz#57c15428ab8a892b1f43869645c711d0e144b554" +parse-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.1.tgz#0ec769704949778cb3b8eda5e994c32073a1adff" + integrity sha512-d7yhga0Oc+PwNXDvQ0Jv1BuWkLVPXcAoQ/WREgd6vNNoKYaW52KI+RdOFjI63wjkmps9yUE8VS4veP+AgpQ/hA== + dependencies: + is-ssh "^1.3.0" + protocols "^1.4.0" + +parse-url@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-5.0.1.tgz#99c4084fc11be14141efa41b3d117a96fcb9527f" + integrity sha512-flNUPP27r3vJpROi0/R3/2efgKkyXqnXwyP1KQ2U0SfFRgdizOdWfvrrvJg1LuOoxs7GQhmxJlq23IpQ/BkByg== dependencies: is-ssh "^1.3.0" + normalize-url "^3.3.0" + parse-path "^4.0.0" protocols "^1.4.0" parse5@4.0.0: From 6b9e5ce2579bc285647a62086447c05588c209b6 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Nov 2019 08:51:52 -0800 Subject: [PATCH 060/231] chore(release): 12.1.3 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca2c54669..0ef946bd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [12.1.3](https://github.com/documentationjs/documentation/compare/v12.1.2...v12.1.3) (2019-11-04) + + +### Bug Fixes + +* upgrade git-url-parse to fix a parsing issue ([#1296](https://github.com/documentationjs/documentation/issues/1296)) ([344e804](https://github.com/documentationjs/documentation/commit/344e804)) + + + ## [12.1.2](https://github.com/documentationjs/documentation/compare/v12.1.1...v12.1.2) (2019-09-09) diff --git a/package.json b/package.json index e406273de..f06f96aaf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.1.2", + "version": "12.1.3", "author": "Tom MacWright", "homepage": "https://documentation.js.org", "bin": { From 6cdd5cc44526d2d57673daa3815737aa157d8724 Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Thu, 14 Nov 2019 18:29:57 -0800 Subject: [PATCH 061/231] build: Reduce npm package by removing development files (#1298) --- .npmignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.npmignore b/.npmignore index 7895e9330..7c3ebf56a 100644 --- a/.npmignore +++ b/.npmignore @@ -7,3 +7,9 @@ circle.yml coverage __tests__ +.circleci +.github +.prettierignore +.prettierrc +CODE_OF_CONDUCT.md +ISSUE_TEMPLATE.md From e0eefde467bc13d45b2a7295d5d69cfbf3d7780e Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 14 Nov 2019 18:31:36 -0800 Subject: [PATCH 062/231] chore(release): 12.1.4 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ef946bd6..256abd76c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [12.1.4](https://github.com/documentationjs/documentation/compare/v12.1.3...v12.1.4) (2019-11-15) + + + ## [12.1.3](https://github.com/documentationjs/documentation/compare/v12.1.2...v12.1.3) (2019-11-04) diff --git a/package.json b/package.json index f06f96aaf..4cb47e5a4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "documentation", "description": "a documentation generator", - "version": "12.1.3", + "version": "12.1.4", "author": "Tom MacWright", "homepage": "https://documentation.js.org", "bin": { From d0f7eeb783d87794dea0636040afffee7082f9a5 Mon Sep 17 00:00:00 2001 From: Zearin Date: Sun, 9 Feb 2020 14:15:00 -0500 Subject: [PATCH 063/231] docs: Minor tweaks to formatting and phrasing. (#1303) --- docs/GETTING_STARTED.md | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index d6841c109..3394b3988 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -7,7 +7,7 @@ in the JSDoc format. **But don't worry! Even though it's embedded in your code, JSDoc is not code. It's a simple and standard syntax for writing documentation. You don't need to be a developer to use it.** -Before you continue, make sure `documentation` is on your system (do `npm install -g documentation`, if not installed). +Before you continue, make sure `documentation` is on your system. (If it's not installed, run `npm install -g documentation`.) Now, let's dive in. @@ -31,7 +31,7 @@ function addOne(input) { The comment before the `addOne` function is a JSDoc comment. Note that it begins with `/**` instead of `/*`. JSDoc requires this. -If you were to write a comment like +If you were to write a comment like this: ```js // --- INVALID - this is ignored by JSDOC --- @@ -40,7 +40,7 @@ If you were to write a comment like // @returns {number} that number, plus one. ``` -the comment would be ignored by `documentation` because it uses `//` syntax instead of `/**`. +...the comment would be ignored by `documentation`, because it uses `//` syntax instead of `/**`. It's not valid JSDoc syntax. Let's break down the earlier JSDoc example: @@ -64,8 +64,7 @@ On the second line: * `{number}` is **a type**. It says that the input to this function is a JavaScript "number". It could also say `{string}`, `{Object}`, `{Date}`, or any other JavaScript built-in type. And if you - defined a custom class, like `FooClass`, you can use it as a type too by - saying `{FooClass}`. + defined a custom class, like `FooClass`, you can use it as a type, too! Just say `{FooClass}`. * `input` is the name of the input variable. It matches what the code says right below it (`function addOne(input)`). * `any number` is the description of the input. @@ -82,7 +81,7 @@ This is the syntax that describes an optional parameter: * @param {number} [input=5] any number ``` -If an input is omitted, the default value of 5 will be passed to the function. +If an input is omitted, the default value of `5` will be passed to the function. ## What `documentation` does, so you don't have to @@ -90,14 +89,14 @@ If an input is omitted, the default value of 5 will be passed to the function. you want to read the code for yourself, here's a summary of its magic: **Inference**: JSDoc lets you specify absolutely everything about your code: -use @name to say what something is called, @kind for whether it's a function -or a class, @param for its parameters, and so on. But writing all of that +use `@name` to say what something is called, `@kind` for whether it's a function +or a class, `@param` for its parameters, and so on. But writing all of that explicitly is tedious, so where it can, `documentation` automatically -populates @name, @kind, and @memberof tags based on its reading of the +populates `@name`, `@kind`, and `@memberof` tags based on its reading of the code. **Normalization**: JSDoc has multiple words for the same thing: you can -say @augments or @extends and they'll do the same thing. +say `@augments` or `@extends` and they'll do the same thing. ## Development Process @@ -108,17 +107,18 @@ automated style check. ## The Tags -[usejsdoc.com](http://usejsdoc.org/index.html) covers all available tags in the -JSDoc syntax, and is a great reference. The most commonly used tags -are: - -* @param - input given to a function as an argument -* @returns - output value of a function -* @name - explicitly set the documented name of a function, class, or variable -* @private - you can use @private to document - code and not have it included in the generated documentation, - maybe it's not part of the public API. There's also @public and @protected -* @example - you can use the @example tag to add inline code examples with your +[**`usejsdoc.com`**](http://usejsdoc.org) covers all available tags in the +JSDoc syntax, and is a great reference. + +The most commonly used tags are: + +* `@param` - input given to a function as an argument +* `@returns` - output value of a function +* `@name` - explicitly set the documented name of a function, class, or variable +* `@private` - you can use `@private` to document + code and not have it included in the generated documentation; + maybe it's not part of the public API. There's also `@public` and `@protected` +* `@example` - you can use the `@example` tag to add inline code examples with your documentation If your text editor does not highlight JSDoc tags, @@ -126,7 +126,7 @@ try [using a plugin for JSDoc](https://github.com/documentationjs/documentation/ ## Flow type annotations -Alternatively, [Flow](https://flow.org/) type annotations allows for a more compact syntax: +Alternatively, [Flow](https://flow.org) type annotations allows for a more compact syntax: ```js /** From 36da108c2f3b14a966b04754b3a53a3069f80bcc Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Tue, 17 Mar 2020 12:59:05 +0900 Subject: [PATCH 064/231] HTTPS link to daringfireball.net/projects/markdown/ (#1297) --- docs/NODE_API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/NODE_API.md b/docs/NODE_API.md index a366b2497..9cc0659f3 100644 --- a/docs/NODE_API.md +++ b/docs/NODE_API.md @@ -228,4 +228,4 @@ Returns **[Promise][21]<[string][18]>** [22]: https://developer.mozilla.org/docs/Web/API/Comment/Comment -[23]: http://daringfireball.net/projects/markdown/ +[23]: https://daringfireball.net/projects/markdown/ From 7b82bcded98df43e07f8a3086244e33cc860f585 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Tue, 17 Mar 2020 12:59:17 +0900 Subject: [PATCH 065/231] update jsdoc.app URL in GETTING_STARTED.md (#1304) --- docs/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 3394b3988..c8e320785 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -107,7 +107,7 @@ automated style check. ## The Tags -[**`usejsdoc.com`**](http://usejsdoc.org) covers all available tags in the +[**`jsdoc.app`**](https://jsdoc.app/) covers all available tags in the JSDoc syntax, and is a great reference. The most commonly used tags are: From 761aaee419e0960e3963a76217cc5bba392e6ac6 Mon Sep 17 00:00:00 2001 From: Nilesh Arnaiya <10388565+NileshArnaiya@users.noreply.github.com> Date: Tue, 17 Mar 2020 09:46:56 +0530 Subject: [PATCH 066/231] Update GETTING_STARTED.md (#1294) * Update GETTING_STARTED.md * Update GETTING_STARTED.md * Update GETTING_STARTED.md Co-authored-by: Tom MacWright --- docs/GETTING_STARTED.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index c8e320785..1fc98ffe8 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -62,7 +62,7 @@ On the second line: * `@param` is **a tag**: This tag indicates that we'll be documenting a function's parameter. * `{number}` is **a type**. It says that the input to this function is - a JavaScript "number". It could also say `{string}`, + a JavaScript "number." It could also say `{string}`, `{Object}`, `{Date}`, or any other JavaScript built-in type. And if you defined a custom class, like `FooClass`, you can use it as a type, too! Just say `{FooClass}`. * `input` is the name of the input variable. It matches what the code @@ -96,7 +96,7 @@ populates `@name`, `@kind`, and `@memberof` tags based on its reading of the code. **Normalization**: JSDoc has multiple words for the same thing: you can -say `@augments` or `@extends` and they'll do the same thing. +say `@augments` or `@extends`, and they'll do the same thing. ## Development Process @@ -108,17 +108,16 @@ automated style check. ## The Tags [**`jsdoc.app`**](https://jsdoc.app/) covers all available tags in the -JSDoc syntax, and is a great reference. - -The most commonly used tags are: - -* `@param` - input given to a function as an argument -* `@returns` - output value of a function -* `@name` - explicitly set the documented name of a function, class, or variable -* `@private` - you can use `@private` to document - code and not have it included in the generated documentation; - maybe it's not part of the public API. There's also `@public` and `@protected` -* `@example` - you can use the `@example` tag to add inline code examples with your +JSDoc syntax, and is a great reference. The most commonly used tags +are: + +* @param - input is given to a function as an argument +* @returns - output value of a function +* @name - explicitly set the documented name of a function, class, or variable +* @private - you can use @private to document + code and not have it included in the generated documentation, + maybe it's not part of the public API. There's also @public and @protected +* @example - you can use the @example tag to add inline code examples with your documentation If your text editor does not highlight JSDoc tags, From efc421655b3b2dc6ee62c1cab036ba5e7f941132 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 16 Mar 2020 21:23:53 -0700 Subject: [PATCH 067/231] Patch 5 (#1311) * disable spellcheck, autocorrect and autocapitalize on the filter input the text entered here are likely to be functions and technical terms and as such spellcheck, autocapitalize and autocorrect would better be disabled. * Update test snapshot Co-authored-by: Christian Oliff --- __tests__/__snapshots__/test.js.snap | 3 +++ src/default_theme/index._ | 3 +++ 2 files changed, 6 insertions(+) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 620e7a0d8..249da3923 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -1549,6 +1549,9 @@ exports[`html nested.input.js 1`] = ` placeholder='Filter' id='filter-input' class='col12 block input' + spellcheck='false' + autocapitalize='off' + autocorrect='off' type='text' />
    diff --git a/src/default_theme/index._ b/src/default_theme/index._ index caefed9a3..ead8c2dfc 100644 --- a/src/default_theme/index._ +++ b/src/default_theme/index._ @@ -21,6 +21,9 @@ placeholder='Filter' id='filter-input' class='col12 block input' + spellcheck='false' + autocapitalize='off' + autocorrect='off' type='text' />
      From 48bb7a283e782b2398e7b4061b5edbcf3367bb87 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 30 Mar 2020 23:34:33 -0700 Subject: [PATCH 068/231] feat: support for the @see tag in Markdown & HTML * add @see ref support for parsing to html * edit tests * fix markdown issue with @see ref * edit related title so it would not generate with see ref every time * edit tests * Fix tests Co-authored-by: Vladimir Berezovsky --- __tests__/__snapshots__/test.js.snap | 453 +++++++++------------------ __tests__/fixture/meta.input.js | 2 - __tests__/lib/parse.js | 24 +- src/default_theme/section._ | 9 + src/output/markdown_ast.js | 2 +- src/parse.js | 11 +- 6 files changed, 182 insertions(+), 319 deletions(-) diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap index 249da3923..5e3e5ff02 100644 --- a/__tests__/__snapshots__/test.js.snap +++ b/__tests__/__snapshots__/test.js.snap @@ -1805,6 +1805,8 @@ exports[`html nested.input.js 1`] = ` + +
      Static Members
      @@ -1881,6 +1883,8 @@ This is a [link to something that does not exist]DoesNot
      @@ -1950,6 +1954,8 @@ the referenced class type

      + +
    @@ -2028,6 +2034,8 @@ the referenced class type

    + +
@@ -2089,6 +2097,8 @@ the referenced class type

+ +
Example
@@ -2148,6 +2158,8 @@ k.isArrayOfBuffers(); + + @@ -2206,6 +2218,8 @@ k.isArrayOfBuffers(); + +
Example

this shows you how to getFoo

@@ -2321,6 +2335,8 @@ k.isArrayOfBuffers(); + + @@ -2423,6 +2439,8 @@ k.isArrayOfBuffers(); + + @@ -2477,6 +2495,8 @@ k.isArrayOfBuffers(); + + @@ -2562,6 +2582,8 @@ k.isArrayOfBuffers(); + + @@ -2620,6 +2642,8 @@ like a
klass

+ + @@ -2689,6 +2713,8 @@ like a klass

+ + @@ -2747,6 +2773,8 @@ like a klass. This needs a @@ -2788,6 +2816,8 @@ like a klass. This needs a klass. This needs a klass. This needs a klass. This needs a <% } %> + <% if (section.sees && section.sees.length) { %> +
Related
+ <% section.sees.forEach(function(see) { %> + <% if (see.description) { %> + <%= md(see.description, true) %> + <% }%> + <% }) %> + <% } %> + <% if (section.throws && section.throws.length) { %>
Throws