diff --git a/downstream_projects.json b/downstream_projects.json index ce9dd772..140a9e3c 100644 --- a/downstream_projects.json +++ b/downstream_projects.json @@ -9,8 +9,7 @@ "typedoc-0.11.1": "./test/typedoc-0.11.1", "typedoc-0.12.0": "./test/typedoc-0.12.0", "typedoc-0.13.0": "./test/typedoc-0.13.0", - "typedoc-0.14.0": "./test/typedoc-0.14.0", - "typedoc-latest": "./test/typedoc-latest" + "typedoc-0.14.2": "./test/typedoc-0.14.2" }, "nohoist": ["**/typedoc-plugin-external-module-name"] } diff --git a/package.json b/package.json index 711b6aee..de0392a8 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "author": "Chris Thielen", "license": "MIT", "peerDependencies": { - "typedoc": ">=0.7 <1.0" + "typedoc": ">=0.7.0 <0.15.0" }, "devDependencies": { "@types/handlebars": "^4.0.37", @@ -28,8 +28,7 @@ "husky": "^2.2.0", "prettier": "^1.13.7", "pretty-quick": "^1.4.1", - "typedoc": "~0.11.1", - "typescript": "~2.7.2" + "typedoc": "~0.14.0" }, "husky": { "hooks": { diff --git a/plugin.ts b/plugin.ts index 7183718e..8b25d260 100644 --- a/plugin.ts +++ b/plugin.ts @@ -2,7 +2,7 @@ import { Component, ConverterComponent } from 'typedoc/dist/lib/converter/compon import { Context } from 'typedoc/dist/lib/converter/context'; import { Converter } from 'typedoc/dist/lib/converter/converter'; import { CommentPlugin } from 'typedoc/dist/lib/converter/plugins/CommentPlugin'; -import { Comment } from 'typedoc/dist/lib/models'; +import { Comment, ProjectReflection } from 'typedoc/dist/lib/models'; import { Reflection, ReflectionKind } from 'typedoc/dist/lib/models/reflections/abstract'; import { ContainerReflection } from 'typedoc/dist/lib/models/reflections/container'; import { DeclarationReflection } from 'typedoc/dist/lib/models/reflections/declaration'; @@ -75,6 +75,7 @@ export class ExternalModuleNamePlugin extends ConverterComponent { this.moduleRenames.push({ renameTo: match[1], preferred: preferred != null, + symbolId: context.getSymbolID(node.symbol), reflection: reflection, }); } @@ -134,9 +135,11 @@ export class ExternalModuleNamePlugin extends ConverterComponent { } item.reflection.parent = parent; parent.children.push(renaming); + updateSymbolMapping(context.project, item.symbolId, parent.id); return; } + updateSymbolMapping(context.project, item.symbolId, mergeTarget.id); if (!mergeTarget.children) { mergeTarget.children = []; } @@ -168,6 +171,15 @@ export class ExternalModuleNamePlugin extends ConverterComponent { } } +/** + * When we delete reflections, update the symbol mapping in order to fix: + * https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/313 + * https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/193 + */ +function updateSymbolMapping(project: ProjectReflection, symbolId: number, mappedReflectionId: number) { + project.symbolMapping[symbolId] = mappedReflectionId; +} + function isEmptyComment(comment: Comment) { return !comment || (!comment.text && !comment.shortText && (!comment.tags || comment.tags.length === 0)); } @@ -175,5 +187,6 @@ function isEmptyComment(comment: Comment) { interface ModuleRename { renameTo: string; preferred: boolean; + symbolId: number; reflection: ContainerReflection; } diff --git a/yarn.lock b/yarn.lock index 5ab79a52..34044408 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6,12 +6,6 @@ version "1.2.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86" -"@types/fs-extra@5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-5.0.1.tgz#cd856fbbdd6af2c11f26f8928fd8644c9e9616c9" - dependencies: - "@types/node" "*" - "@types/fs-extra@^5.0.3": version "5.0.4" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-5.0.4.tgz#b971134d162cc0497d221adde3dbb67502225599" @@ -27,10 +21,6 @@ "@types/minimatch" "*" "@types/node" "*" -"@types/handlebars@4.0.36": - version "4.0.36" - resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.36.tgz#ff57c77fa1ab6713bb446534ddc4d979707a3a79" - "@types/handlebars@^4.0.37", "@types/handlebars@^4.0.38": version "4.1.0" resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.1.0.tgz#3fcce9bf88f85fe73dc932240ab3fb682c624850" @@ -38,28 +28,16 @@ dependencies: handlebars "*" -"@types/highlight.js@9.12.2": - version "9.12.2" - resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-9.12.2.tgz#6ee7cd395effe5ec80b515d3ff1699068cd0cd1d" - "@types/highlight.js@^9.12.3": version "9.12.3" resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-9.12.3.tgz#b672cfaac25cbbc634a0fd92c515f66faa18dbca" integrity sha512-pGF/zvYOACZ/gLGWdQH8zSwteQS1epp68yRcVLJMgUck/MjEn/FBYmPub9pXT8C1e4a8YZfHo1CKyV8q1vKUnQ== -"@types/lodash@4.14.104": - version "4.14.104" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.104.tgz#53ee2357fa2e6e68379341d92eb2ecea4b11bb80" - "@types/lodash@^4.14.110": version "4.14.119" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.119.tgz#be847e5f4bc3e35e46d041c394ead8b603ad8b39" integrity sha512-Z3TNyBL8Vd/M9D9Ms2S3LmFq2sSMzahodD6rCS9V2N44HUMINb75jNkSuwAx7eo2ufqTdfOdtGQpNbieUjPQmw== -"@types/marked@0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.3.0.tgz#583c223dd33385a1dda01aaf77b0cd0411c4b524" - "@types/marked@^0.4.0": version "0.4.2" resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.4.2.tgz#64a89e53ea37f61cc0f3ee1732c555c2dbf6452f" @@ -78,13 +56,6 @@ resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== -"@types/shelljs@0.7.8": - version "0.7.8" - resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.8.tgz#4b4d6ee7926e58d7bca448a50ba442fd9f6715bd" - dependencies: - "@types/glob" "*" - "@types/node" "*" - "@types/shelljs@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.8.1.tgz#133e874b5fb816a2e1c8647839c82d76760b1191" @@ -670,14 +641,6 @@ fs-extra@^4.0.2: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -807,6 +770,17 @@ handlebars@*, handlebars@^4.0.2, handlebars@^4.0.6: optionalDependencies: uglify-js "^3.1.4" +handlebars@^4.5.3: + version "4.7.2" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.2.tgz#01127b3840156a0927058779482031afe0e730d7" + integrity sha512-4PwqDL2laXtTWZghzzCtunQUTLbo31pcCJrd/B/9JP8XbhVzpS5ZXuKqlOzsd1rtcaLo4KqAn8nl8mkknS4MHw== + dependencies: + neo-async "^2.6.0" + optimist "^0.6.1" + source-map "^0.6.1" + optionalDependencies: + uglify-js "^3.1.4" + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -817,14 +791,12 @@ has@^1.0.1: dependencies: function-bind "^1.1.1" -highlight.js@^9.0.0: - version "9.12.0" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" - highlight.js@^9.13.1: - version "9.13.1" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.13.1.tgz#054586d53a6863311168488a0f58d6c505ce641e" - integrity sha512-Sc28JNQNDzaH6PORtRLMvif9RSn1mYuOoX3omVjnb0+HbpPygU2ALBI0R/wsiqCb4/fcp07Gdo8g+fhtFrQl6A== + version "9.17.1" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.17.1.tgz#14a4eded23fd314b05886758bb906e39dd627f9a" + integrity sha512-TA2/doAur5Ol8+iM3Ov7qy3jYcr/QiJ2eDTdRF4dfbjG7AaaB99J5G+zSl11ljbl6cIcahgPY6SKb3sC3EJ0fw== + dependencies: + handlebars "^4.5.3" hosted-git-info@^2.1.4: version "2.6.0" @@ -1126,7 +1098,7 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "^3.0.0" -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.5, lodash@^4.2.1: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.2.1: version "4.17.14" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== @@ -1160,10 +1132,6 @@ map-obj@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9" -marked@^0.3.17: - version "0.3.19" - resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" - marked@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/marked/-/marked-0.4.0.tgz#9ad2c2a7a1791f10a852e0112f77b571dce10c66" @@ -1260,6 +1228,11 @@ multimatch@^3.0.0: arrify "^1.0.1" minimatch "^3.0.4" +neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== + nice-try@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" @@ -1971,7 +1944,7 @@ typedoc-plugin-ui-router@2.0.0: resolved "https://registry.yarnpkg.com/typedoc-plugin-ui-router/-/typedoc-plugin-ui-router-2.0.0.tgz#e498885d9dfd48cd6d5b819ee35b183dabe16bbd" integrity sha512-okp4VXtjE99UszKVALhDeIjWBkMq8ZOuW1mbW51EqbOGi0gw4QBdXiAD6Bu7XT80j5yxy1gpf+2Syi+s3IoiKw== -typedoc@0.14.2: +typedoc@0.14.2, typedoc@~0.14.0: version "0.14.2" resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.14.2.tgz#769f457f4f9e4bdb8b5f3b177c86b6a31d8c3dc3" integrity sha512-aEbgJXV8/KqaVhcedT7xG6d2r+mOvB5ep3eIz1KuB5sc4fDYXcepEEMdU7XSqLFO5hVPu0nllHi1QxX2h/QlpQ== @@ -1994,36 +1967,10 @@ typedoc@0.14.2: typedoc-default-themes "^0.5.0" typescript "3.2.x" -typedoc@~0.11.1: - version "0.11.1" - resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.11.1.tgz#9f033887fd2218c769e1045feb88a1efed9f12c9" - dependencies: - "@types/fs-extra" "5.0.1" - "@types/handlebars" "4.0.36" - "@types/highlight.js" "9.12.2" - "@types/lodash" "4.14.104" - "@types/marked" "0.3.0" - "@types/minimatch" "3.0.3" - "@types/shelljs" "0.7.8" - fs-extra "^5.0.0" - handlebars "^4.0.6" - highlight.js "^9.0.0" - lodash "^4.17.5" - marked "^0.3.17" - minimatch "^3.0.0" - progress "^2.0.0" - shelljs "^0.8.1" - typedoc-default-themes "^0.5.0" - typescript "2.7.2" - -typescript@2.7.2, typescript@~2.7.2: - version "2.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" - typescript@3.2.x: - version "3.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" - integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== + version "3.2.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d" + integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg== uglify-js@^3.1.4: version "3.4.9"