From 856d31d22784f7d37bf430cf640bd0d65c2bf05b Mon Sep 17 00:00:00 2001 From: Ignacio Carbajo Date: Sun, 10 Feb 2019 22:51:51 +0800 Subject: [PATCH 1/4] Apply updates from @kolyan-r --- package.json | 20 ++++++-------------- src/SourcefileUrlMapPlugin.ts | 13 ++++++++----- tsconfig.json | 4 ++-- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 276fb2f..44a0ab9 100644 --- a/package.json +++ b/package.json @@ -1,38 +1,30 @@ { "author": "Gerard Delmàs", - "name": "typedoc-plugin-sourcefile-url", "version": "1.0.3", "description": "typedoc plugin to set custom source file URL links", - "homepage": "https://github.com/gdelmas/typedoc-plugin-sourcefile-url", "bugs": "https://github.com/gdelmas/typedoc-plugin-sourcefile-url/issues", "repository": { - "type" : "git", - "url" : "https://github.com/gdelmas/typedoc-plugin-sourcefile-url.git" + "type": "git", + "url": "https://github.com/gdelmas/typedoc-plugin-sourcefile-url.git" }, "license": "MIT", - "keywords": [ "typedocplugin", "typedoc", "bitbucket", "gitlab" ], - - "peerDependencies": { - "typedoc": "^0.5.10" + "typedoc": "^0.14.0", + "typescript": "^3.2.0" }, - "devDependencies": { - "typedoc": "^0.5.10", - "typescript": "^2.1.5" + "typedoc": "^0.14.0", + "typescript": "^3.2.0" }, - - "main": "dist/main.js", - "scripts": { "build": "tsc", "prepublish": "npm run build" diff --git a/src/SourcefileUrlMapPlugin.ts b/src/SourcefileUrlMapPlugin.ts index f890989..51a216a 100644 --- a/src/SourcefileUrlMapPlugin.ts +++ b/src/SourcefileUrlMapPlugin.ts @@ -1,8 +1,7 @@ import * as Path from 'path' import * as FS from 'fs-extra' -import {Component} from 'typedoc/dist/lib/utils/component' -import {ConverterComponent} from 'typedoc/dist/lib/converter/components' -import {Converter} from 'typedoc/dist/lib/converter/converter' +import {Component, ConverterComponent} from 'typedoc/dist/lib/converter/components'; +import {Converter} from 'typedoc/dist/lib/converter/converter'; import {Context} from 'typedoc/dist/lib/converter/context' import {SourceReference} from 'typedoc/dist/lib/models/sources/file' import {Options} from 'typedoc/dist/lib/utils/options/options' @@ -19,7 +18,9 @@ export class SourcefileUrlMapPlugin extends ConverterComponent { public initialize(): void { - this.listenTo(this.owner, Converter.EVENT_BEGIN, this.onBegin) + this.listenTo(this.owner, { + [Converter.EVENT_BEGIN]: this.onBegin + }) } private onBegin(): void @@ -49,7 +50,9 @@ export class SourcefileUrlMapPlugin extends ConverterComponent { } // register handler - this.listenTo(this.owner, Converter.EVENT_RESOLVE_END, this.onEndResolve) + this.listenTo(this.owner, { + [Converter.EVENT_RESOLVE_END]: this.onEndResolve, + }) } catch ( e ) { console.error('typedoc-plugin-sourcefile-url: ' + e.message) diff --git a/tsconfig.json b/tsconfig.json index 7f0f005..222e1ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "experimentalDecorators": true, "allowJs": true, "noImplicitAny": true, @@ -18,4 +18,4 @@ "exclude": [ "node_modules" ] -} \ No newline at end of file +} From 286d54f69eeff7a7058ca0b91f12b480fa358514 Mon Sep 17 00:00:00 2001 From: Ignacio Carbajo Date: Sun, 10 Feb 2019 23:09:14 +0800 Subject: [PATCH 2/4] Support new option --- README.md | 2 + package-lock.json | 377 ++++++++++++++++++++++++++++++++++ package.json | 2 +- src/SourcefileUrlMapPlugin.ts | 5 +- src/main.js | 3 +- 5 files changed, 386 insertions(+), 3 deletions(-) create mode 100644 package-lock.json diff --git a/README.md b/README.md index e6e2728..419df10 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ The `your-sourcefile-map.json` structure is: There can be one or more mapping rules. For each *Defined in* only the first rule that matches is applied. In the above example the last rule would match all source files that did not start with `modules/module-one`. This compares to the *Simple Prefix* option. +If you need to pass a custom string to indicate the line numeber in the url (defaults to `#L`), you can pass the `--sourcefile-url-lines-str` option. + --- The options are mutually exclusive. It is not possible to use `--sourcefile-url-prefix` and `--sourcefile-url-map` at the same time. diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9148139 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,377 @@ +{ + "name": "typedoc-plugin-sourcefile-url", + "version": "1.0.4", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/fs-extra": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.4.tgz", + "integrity": "sha512-DsknoBvD8s+RFfSGjmERJ7ZOP1HI0UZRA3FSI+Zakhrc/Gy26YQsLI+m5V5DHxroHRJqCDLKJp7Hixn8zyaF7g==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/handlebars": { + "version": "4.0.40", + "resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.40.tgz", + "integrity": "sha512-sGWNtsjNrLOdKha2RV1UeF8+UbQnPSG7qbe5wwbni0mw4h2gHXyPFUMOC+xwGirIiiydM/HSqjDO4rk6NFB18w==", + "dev": true + }, + "@types/highlight.js": { + "version": "9.12.3", + "resolved": "https://registry.npmjs.org/@types/highlight.js/-/highlight.js-9.12.3.tgz", + "integrity": "sha512-pGF/zvYOACZ/gLGWdQH8zSwteQS1epp68yRcVLJMgUck/MjEn/FBYmPub9pXT8C1e4a8YZfHo1CKyV8q1vKUnQ==", + "dev": true + }, + "@types/lodash": { + "version": "4.14.120", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.120.tgz", + "integrity": "sha512-jQ21kQ120mo+IrDs1nFNVm/AsdFxIx2+vZ347DbogHJPd/JzKNMOqU6HCYin1W6v8l5R9XSO2/e9cxmn7HAnVw==", + "dev": true + }, + "@types/marked": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@types/marked/-/marked-0.4.2.tgz", + "integrity": "sha512-cDB930/7MbzaGF6U3IwSQp6XBru8xWajF5PV2YZZeV8DyiliTuld11afVztGI9+yJZ29il5E+NpGA6ooV/Cjkg==", + "dev": true + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/node": { + "version": "10.12.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.24.tgz", + "integrity": "sha512-GWWbvt+z9G5otRBW8rssOFgRY87J9N/qbhqfjMZ+gUuL6zoL+Hm6gP/8qQBG4jjimqdaNLCehcVapZ/Fs2WjCQ==", + "dev": true + }, + "@types/shelljs": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.2.tgz", + "integrity": "sha512-vVp7BCQn0yUQgpiohrdxAhHdm/bTlXshB4HG3LEBq1PgvjKiyeYHohIPIv0QBt/jipb140iMS5Xy1iR6qKovKw==", + "dev": true, + "requires": { + "@types/glob": "*", + "@types/node": "*" + } + }, + "async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "dev": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", + "dev": true + }, + "handlebars": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz", + "integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==", + "dev": true, + "requires": { + "async": "^2.5.0", + "optimist": "^0.6.1", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" + } + }, + "highlight.js": { + "version": "9.14.2", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.14.2.tgz", + "integrity": "sha512-Nc6YNECYpxyJABGYJAyw7dBAYbXEuIzwzkqoJnwbc1nIpCiN+3ioYf0XrBnLiyyG0JLuJhpPtt2iTSbXiKLoyA==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "marked": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", + "integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "resolve": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "shelljs": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", + "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "typedoc": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.14.2.tgz", + "integrity": "sha512-aEbgJXV8/KqaVhcedT7xG6d2r+mOvB5ep3eIz1KuB5sc4fDYXcepEEMdU7XSqLFO5hVPu0nllHi1QxX2h/QlpQ==", + "dev": true, + "requires": { + "@types/fs-extra": "^5.0.3", + "@types/handlebars": "^4.0.38", + "@types/highlight.js": "^9.12.3", + "@types/lodash": "^4.14.110", + "@types/marked": "^0.4.0", + "@types/minimatch": "3.0.3", + "@types/shelljs": "^0.8.0", + "fs-extra": "^7.0.0", + "handlebars": "^4.0.6", + "highlight.js": "^9.13.1", + "lodash": "^4.17.10", + "marked": "^0.4.0", + "minimatch": "^3.0.0", + "progress": "^2.0.0", + "shelljs": "^0.8.2", + "typedoc-default-themes": "^0.5.0", + "typescript": "3.2.x" + }, + "dependencies": { + "typescript": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.4.tgz", + "integrity": "sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==", + "dev": true + } + } + }, + "typedoc-default-themes": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz", + "integrity": "sha1-bcJDPnjti+qOiHo6zeLzF4W9Yic=", + "dev": true + }, + "typescript": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3.tgz", + "integrity": "sha512-Y21Xqe54TBVp+VDSNbuDYdGw0BpoR/Q6wo/+35M8PAU0vipahnyduJWirxxdxjsAkS7hue53x2zp8gz7F05u0A==", + "dev": true + }, + "uglify-js": { + "version": "3.4.9", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", + "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "dev": true, + "optional": true, + "requires": { + "commander": "~2.17.1", + "source-map": "~0.6.1" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/package.json b/package.json index 44a0ab9..daaca5c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "author": "Gerard Delmàs", "name": "typedoc-plugin-sourcefile-url", - "version": "1.0.3", + "version": "1.0.4", "description": "typedoc plugin to set custom source file URL links", "homepage": "https://github.com/gdelmas/typedoc-plugin-sourcefile-url", "bugs": "https://github.com/gdelmas/typedoc-plugin-sourcefile-url/issues", diff --git a/src/SourcefileUrlMapPlugin.ts b/src/SourcefileUrlMapPlugin.ts index 51a216a..7998fd1 100644 --- a/src/SourcefileUrlMapPlugin.ts +++ b/src/SourcefileUrlMapPlugin.ts @@ -15,6 +15,7 @@ interface Mapping { export class SourcefileUrlMapPlugin extends ConverterComponent { private mappings: Mapping[] | undefined + private linesStr: string | undefined public initialize(): void { @@ -30,6 +31,8 @@ export class SourcefileUrlMapPlugin extends ConverterComponent { const mapRelativePath = options.getValue('sourcefile-url-map') const urlPrefix = options.getValue('sourcefile-url-prefix') + this.linesStr = options.getValue('sourcefile-url-lines-str') || '#L' + if ( (typeof mapRelativePath !== 'string') && (typeof urlPrefix !== 'string') ) { return } @@ -127,7 +130,7 @@ export class SourcefileUrlMapPlugin extends ConverterComponent { if ( reflection.sources ) { reflection.sources.forEach((source: SourceReference) => { if (source.file && source.file.url) { - source.url = source.file.url + '#L' + source.line + source.url = source.file.url + this.linesStr + source.line } }) } diff --git a/src/main.js b/src/main.js index d18128f..6d8755f 100644 --- a/src/main.js +++ b/src/main.js @@ -5,6 +5,7 @@ module.exports = function(PluginHost) { app.options.addDeclaration({name: 'sourcefile-url-map'}); app.options.addDeclaration({name: 'sourcefile-url-prefix'}); + app.options.addDeclaration({name: 'sourcefile-url-lines-str'}); app.converter.addComponent('sourcefile-url', plugin.SourcefileUrlMapPlugin); -}; \ No newline at end of file +}; From 0dff1e75a51cd7bf68d8e3c2cf6ca56242ff1298 Mon Sep 17 00:00:00 2001 From: Ignacio Carbajo Date: Sun, 10 Feb 2019 23:19:32 +0800 Subject: [PATCH 3/4] Update version due to new version requirement --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index daaca5c..e57ca1c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "author": "Gerard Delmàs", "name": "typedoc-plugin-sourcefile-url", - "version": "1.0.4", + "version": "2.0.0", "description": "typedoc plugin to set custom source file URL links", "homepage": "https://github.com/gdelmas/typedoc-plugin-sourcefile-url", "bugs": "https://github.com/gdelmas/typedoc-plugin-sourcefile-url/issues", From 16c5f52269330c2c26432c7ac0d86da55b00c512 Mon Sep 17 00:00:00 2001 From: Ignacio Carbajo Date: Wed, 6 Mar 2019 00:49:05 +0800 Subject: [PATCH 4/4] Remove unnecessary change --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 6d8755f..37b79f4 100644 --- a/src/main.js +++ b/src/main.js @@ -8,4 +8,4 @@ module.exports = function(PluginHost) { app.options.addDeclaration({name: 'sourcefile-url-lines-str'}); app.converter.addComponent('sourcefile-url', plugin.SourcefileUrlMapPlugin); -}; +}; \ No newline at end of file