summaryrefslogtreecommitdiffhomepage
path: root/typedoc-plugin-external-module-name/getRawComment.js
diff options
context:
space:
mode:
Diffstat (limited to 'typedoc-plugin-external-module-name/getRawComment.js')
-rw-r--r--typedoc-plugin-external-module-name/getRawComment.js49
1 files changed, 0 insertions, 49 deletions
diff --git a/typedoc-plugin-external-module-name/getRawComment.js b/typedoc-plugin-external-module-name/getRawComment.js
deleted file mode 100644
index 1bc208f..0000000
--- a/typedoc-plugin-external-module-name/getRawComment.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Monkey patches getJSDocCommentRanges to make `getRawComment` return a
- * comment for a module even if there is only one comment
- *
- * @see https://github.com/christopherthielen/typedoc-plugin-external-module-name/issues/6
- * @see https://github.com/TypeStrong/typedoc/blob/master/src/lib/converter/factories/comment.ts
- */
-(function (factory) {
- if (typeof module === "object" && typeof module.exports === "object") {
- var v = factory(require, exports);
- if (v !== undefined) module.exports = v;
- }
- else if (typeof define === "function" && define.amd) {
- define(["require", "exports", "typedoc/dist/lib/ts-internal", "typedoc/dist/lib/converter/factories/comment", "./typedocVersionCompatibility"], factory);
- }
-})(function (require, exports) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- const _ts = require("typedoc/dist/lib/ts-internal");
- const comment_1 = require("typedoc/dist/lib/converter/factories/comment");
- const typedocVersionCompatibility_1 = require("./typedocVersionCompatibility");
- const useMonkeyPatchedGetRawComment = typedocVersionCompatibility_1.isTypedocVersion('< 0.16.0');
- function monkeyPatch() {
- const realGetJSDocCommentRanges = _ts.getJSDocCommentRanges;
- function patchedGetJSDocCommentRanges() {
- const result = realGetJSDocCommentRanges.apply(this, arguments);
- if (result && result.length === 1) {
- result.push(null);
- }
- return result;
- }
- const tsinternal = _ts;
- tsinternal.getJSDocCommentRanges = patchedGetJSDocCommentRanges;
- return function unMonkeyPatch() {
- tsinternal.getJSDocCommentRanges = realGetJSDocCommentRanges;
- };
- }
- const getRawComment = useMonkeyPatchedGetRawComment ? monkeyPatchedGetRawComment : comment_1.getRawComment;
- exports.getRawComment = getRawComment;
- function monkeyPatchedGetRawComment(node) {
- let unpatch = monkeyPatch();
- try {
- return comment_1.getRawComment(node);
- }
- finally {
- unpatch();
- }
- }
-});