init
This commit is contained in:
81
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/PlainTextEmitter.js
generated
vendored
Normal file
81
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/PlainTextEmitter.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PlainTextEmitter = void 0;
|
||||
var nodes_1 = require("../nodes");
|
||||
/**
|
||||
* Renders a DocNode tree as plain text, without any rich text formatting or markup.
|
||||
*/
|
||||
var PlainTextEmitter = /** @class */ (function () {
|
||||
function PlainTextEmitter() {
|
||||
}
|
||||
PlainTextEmitter.hasAnyTextContent = function (nodeOrNodes, requiredCharacters) {
|
||||
if (requiredCharacters === undefined || requiredCharacters < 1) {
|
||||
requiredCharacters = 1; // default
|
||||
}
|
||||
var nodes;
|
||||
if (nodeOrNodes instanceof nodes_1.DocNode) {
|
||||
nodes = [nodeOrNodes];
|
||||
}
|
||||
else {
|
||||
nodes = nodeOrNodes;
|
||||
}
|
||||
var foundCharacters = PlainTextEmitter._scanTextContent(nodes, requiredCharacters, 0);
|
||||
return foundCharacters >= requiredCharacters;
|
||||
};
|
||||
PlainTextEmitter._scanTextContent = function (nodes, requiredCharacters, foundCharacters) {
|
||||
for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
|
||||
var node = nodes_2[_i];
|
||||
switch (node.kind) {
|
||||
case nodes_1.DocNodeKind.FencedCode:
|
||||
var docFencedCode = node;
|
||||
foundCharacters += PlainTextEmitter._countNonSpaceCharacters(docFencedCode.code);
|
||||
break;
|
||||
case nodes_1.DocNodeKind.CodeSpan:
|
||||
var docCodeSpan = node;
|
||||
foundCharacters += PlainTextEmitter._countNonSpaceCharacters(docCodeSpan.code);
|
||||
break;
|
||||
case nodes_1.DocNodeKind.EscapedText:
|
||||
var docEscapedText = node;
|
||||
foundCharacters += PlainTextEmitter._countNonSpaceCharacters(docEscapedText.decodedText);
|
||||
break;
|
||||
case nodes_1.DocNodeKind.LinkTag:
|
||||
var docLinkTag = node;
|
||||
foundCharacters += PlainTextEmitter._countNonSpaceCharacters(docLinkTag.linkText || '');
|
||||
break;
|
||||
case nodes_1.DocNodeKind.PlainText:
|
||||
var docPlainText = node;
|
||||
foundCharacters += PlainTextEmitter._countNonSpaceCharacters(docPlainText.text);
|
||||
break;
|
||||
}
|
||||
if (foundCharacters >= requiredCharacters) {
|
||||
break;
|
||||
}
|
||||
foundCharacters += PlainTextEmitter._scanTextContent(node.getChildNodes(), requiredCharacters, foundCharacters);
|
||||
if (foundCharacters >= requiredCharacters) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return foundCharacters;
|
||||
};
|
||||
PlainTextEmitter._countNonSpaceCharacters = function (s) {
|
||||
var count = 0;
|
||||
var length = s.length;
|
||||
var i = 0;
|
||||
while (i < length) {
|
||||
switch (s.charCodeAt(i)) {
|
||||
case 32: // space
|
||||
case 9: // tab
|
||||
case 13: // CR
|
||||
case 10: // LF
|
||||
break;
|
||||
default:
|
||||
++count;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return count;
|
||||
};
|
||||
return PlainTextEmitter;
|
||||
}());
|
||||
exports.PlainTextEmitter = PlainTextEmitter;
|
||||
//# sourceMappingURL=PlainTextEmitter.js.map
|
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/PlainTextEmitter.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/PlainTextEmitter.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
38
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/StringBuilder.js
generated
vendored
Normal file
38
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/StringBuilder.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StringBuilder = void 0;
|
||||
/**
|
||||
* This class allows a large text string to be constructed incrementally by appending small chunks. The final
|
||||
* string can be obtained by calling StringBuilder.toString().
|
||||
*
|
||||
* @remarks
|
||||
* A naive approach might use the `+=` operator to append strings: This would have the downside of copying
|
||||
* the entire string each time a chunk is appended, resulting in `O(n^2)` bytes of memory being allocated
|
||||
* (and later freed by the garbage collector), and many of the allocations could be very large objects.
|
||||
* StringBuilder avoids this overhead by accumulating the chunks in an array, and efficiently joining them
|
||||
* when `getText()` is finally called.
|
||||
*/
|
||||
var StringBuilder = /** @class */ (function () {
|
||||
function StringBuilder() {
|
||||
this._chunks = [];
|
||||
}
|
||||
/** {@inheritdoc IStringBuilder.append} */
|
||||
StringBuilder.prototype.append = function (text) {
|
||||
this._chunks.push(text);
|
||||
};
|
||||
/** {@inheritdoc IStringBuilder.toString} */
|
||||
StringBuilder.prototype.toString = function () {
|
||||
if (this._chunks.length === 0) {
|
||||
return '';
|
||||
}
|
||||
if (this._chunks.length > 1) {
|
||||
var joined = this._chunks.join('');
|
||||
this._chunks.length = 1;
|
||||
this._chunks[0] = joined;
|
||||
}
|
||||
return this._chunks[0];
|
||||
};
|
||||
return StringBuilder;
|
||||
}());
|
||||
exports.StringBuilder = StringBuilder;
|
||||
//# sourceMappingURL=StringBuilder.js.map
|
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/StringBuilder.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/StringBuilder.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"StringBuilder.js","sourceRoot":"","sources":["../../src/emitters/StringBuilder.ts"],"names":[],"mappings":";;;AAwBA;;;;;;;;;;GAUG;AACH;IAGE;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,0CAA0C;IACnC,8BAAM,GAAb,UAAc,IAAY;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,4CAA4C;IACrC,gCAAQ,GAAf;QACE,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7B,OAAO,EAAE,CAAC;SACX;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,IAAM,MAAM,GAAW,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC7C,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACxB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;SAC1B;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACH,oBAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,sCAAa","sourcesContent":["/**\r\n * An interface for a builder object that allows a large text string to be constructed incrementally by appending\r\n * small chunks.\r\n *\r\n * @remarks\r\n *\r\n * {@link StringBuilder} is the default implementation of this contract.\r\n */\r\nexport interface IStringBuilder {\r\n /**\r\n * Append the specified text to the buffer.\r\n */\r\n append(text: string): void;\r\n\r\n /**\r\n * Returns a single string containing all the text that was appended to the buffer so far.\r\n *\r\n * @remarks\r\n *\r\n * This is a potentially expensive operation.\r\n */\r\n toString(): string;\r\n}\r\n\r\n/**\r\n * This class allows a large text string to be constructed incrementally by appending small chunks. The final\r\n * string can be obtained by calling StringBuilder.toString().\r\n *\r\n * @remarks\r\n * A naive approach might use the `+=` operator to append strings: This would have the downside of copying\r\n * the entire string each time a chunk is appended, resulting in `O(n^2)` bytes of memory being allocated\r\n * (and later freed by the garbage collector), and many of the allocations could be very large objects.\r\n * StringBuilder avoids this overhead by accumulating the chunks in an array, and efficiently joining them\r\n * when `getText()` is finally called.\r\n */\r\nexport class StringBuilder implements IStringBuilder {\r\n private _chunks: string[];\r\n\r\n public constructor() {\r\n this._chunks = [];\r\n }\r\n\r\n /** {@inheritdoc IStringBuilder.append} */\r\n public append(text: string): void {\r\n this._chunks.push(text);\r\n }\r\n\r\n /** {@inheritdoc IStringBuilder.toString} */\r\n public toString(): string {\r\n if (this._chunks.length === 0) {\r\n return '';\r\n }\r\n\r\n if (this._chunks.length > 1) {\r\n const joined: string = this._chunks.join('');\r\n this._chunks.length = 1;\r\n this._chunks[0] = joined;\r\n }\r\n\r\n return this._chunks[0];\r\n }\r\n}\r\n"]}
|
379
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/TSDocEmitter.js
generated
vendored
Normal file
379
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/TSDocEmitter.js
generated
vendored
Normal file
@ -0,0 +1,379 @@
|
||||
"use strict";
|
||||
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TSDocEmitter = void 0;
|
||||
var DocNode_1 = require("../nodes/DocNode");
|
||||
var DocNodeTransforms_1 = require("../transforms/DocNodeTransforms");
|
||||
var StandardTags_1 = require("../details/StandardTags");
|
||||
var LineState;
|
||||
(function (LineState) {
|
||||
LineState[LineState["Closed"] = 0] = "Closed";
|
||||
LineState[LineState["StartOfLine"] = 1] = "StartOfLine";
|
||||
LineState[LineState["MiddleOfLine"] = 2] = "MiddleOfLine";
|
||||
})(LineState || (LineState = {}));
|
||||
/**
|
||||
* Renders a DocNode tree as a code comment.
|
||||
*/
|
||||
var TSDocEmitter = /** @class */ (function () {
|
||||
function TSDocEmitter() {
|
||||
this.eol = '\n';
|
||||
// Whether to emit the /** */ framing
|
||||
this._emitCommentFraming = true;
|
||||
// This state machine is used by the writer functions to generate the /** */ framing around the emitted lines
|
||||
this._lineState = LineState.Closed;
|
||||
// State for _ensureLineSkipped()
|
||||
this._previousLineHadContent = false;
|
||||
// Normally a paragraph is precede by a blank line (unless it's the first thing written).
|
||||
// But sometimes we want the paragraph to be attached to the previous element, e.g. when it's part of
|
||||
// an "@param" block. Setting _hangingParagraph=true accomplishes that.
|
||||
this._hangingParagraph = false;
|
||||
}
|
||||
TSDocEmitter.prototype.renderComment = function (output, docComment) {
|
||||
this._emitCommentFraming = true;
|
||||
this._renderCompleteObject(output, docComment);
|
||||
};
|
||||
TSDocEmitter.prototype.renderHtmlTag = function (output, htmlTag) {
|
||||
this._emitCommentFraming = false;
|
||||
this._renderCompleteObject(output, htmlTag);
|
||||
};
|
||||
TSDocEmitter.prototype.renderDeclarationReference = function (output, declarationReference) {
|
||||
this._emitCommentFraming = false;
|
||||
this._renderCompleteObject(output, declarationReference);
|
||||
};
|
||||
TSDocEmitter.prototype._renderCompleteObject = function (output, docNode) {
|
||||
this._output = output;
|
||||
this._lineState = LineState.Closed;
|
||||
this._previousLineHadContent = false;
|
||||
this._hangingParagraph = false;
|
||||
this._renderNode(docNode);
|
||||
this._writeEnd();
|
||||
};
|
||||
TSDocEmitter.prototype._renderNode = function (docNode) {
|
||||
var _this = this;
|
||||
if (docNode === undefined) {
|
||||
return;
|
||||
}
|
||||
switch (docNode.kind) {
|
||||
case DocNode_1.DocNodeKind.Block:
|
||||
var docBlock = docNode;
|
||||
this._ensureLineSkipped();
|
||||
this._renderNode(docBlock.blockTag);
|
||||
if (docBlock.blockTag.tagNameWithUpperCase === StandardTags_1.StandardTags.returns.tagNameWithUpperCase) {
|
||||
this._writeContent(' ');
|
||||
this._hangingParagraph = true;
|
||||
}
|
||||
this._renderNode(docBlock.content);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.BlockTag:
|
||||
var docBlockTag = docNode;
|
||||
if (this._lineState === LineState.MiddleOfLine) {
|
||||
this._writeContent(' ');
|
||||
}
|
||||
this._writeContent(docBlockTag.tagName);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.CodeSpan:
|
||||
var docCodeSpan = docNode;
|
||||
this._writeContent('`');
|
||||
this._writeContent(docCodeSpan.code);
|
||||
this._writeContent('`');
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.Comment:
|
||||
var docComment = docNode;
|
||||
this._renderNodes(__spreadArrays([
|
||||
docComment.summarySection,
|
||||
docComment.remarksBlock,
|
||||
docComment.privateRemarks,
|
||||
docComment.deprecatedBlock,
|
||||
docComment.params,
|
||||
docComment.typeParams,
|
||||
docComment.returnsBlock
|
||||
], docComment.customBlocks, docComment.seeBlocks, [
|
||||
docComment.inheritDocTag
|
||||
]));
|
||||
if (docComment.modifierTagSet.nodes.length > 0) {
|
||||
this._ensureLineSkipped();
|
||||
this._renderNodes(docComment.modifierTagSet.nodes);
|
||||
}
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.DeclarationReference:
|
||||
var docDeclarationReference = docNode;
|
||||
this._writeContent(docDeclarationReference.packageName);
|
||||
this._writeContent(docDeclarationReference.importPath);
|
||||
if (docDeclarationReference.packageName !== undefined ||
|
||||
docDeclarationReference.importPath !== undefined) {
|
||||
this._writeContent('#');
|
||||
}
|
||||
this._renderNodes(docDeclarationReference.memberReferences);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.ErrorText:
|
||||
var docErrorText = docNode;
|
||||
this._writeContent(docErrorText.text);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.EscapedText:
|
||||
var docEscapedText = docNode;
|
||||
this._writeContent(docEscapedText.encodedText);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.FencedCode:
|
||||
var docFencedCode = docNode;
|
||||
this._ensureAtStartOfLine();
|
||||
this._writeContent('```');
|
||||
this._writeContent(docFencedCode.language);
|
||||
this._writeNewline();
|
||||
this._writeContent(docFencedCode.code);
|
||||
this._writeContent('```');
|
||||
this._writeNewline();
|
||||
this._writeNewline();
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.HtmlAttribute:
|
||||
var docHtmlAttribute = docNode;
|
||||
this._writeContent(docHtmlAttribute.name);
|
||||
this._writeContent(docHtmlAttribute.spacingAfterName);
|
||||
this._writeContent('=');
|
||||
this._writeContent(docHtmlAttribute.spacingAfterEquals);
|
||||
this._writeContent(docHtmlAttribute.value);
|
||||
this._writeContent(docHtmlAttribute.spacingAfterValue);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.HtmlEndTag:
|
||||
var docHtmlEndTag = docNode;
|
||||
this._writeContent('</');
|
||||
this._writeContent(docHtmlEndTag.name);
|
||||
this._writeContent('>');
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.HtmlStartTag:
|
||||
var docHtmlStartTag = docNode;
|
||||
this._writeContent('<');
|
||||
this._writeContent(docHtmlStartTag.name);
|
||||
this._writeContent(docHtmlStartTag.spacingAfterName);
|
||||
var needsSpace = docHtmlStartTag.spacingAfterName === undefined || docHtmlStartTag.spacingAfterName.length === 0;
|
||||
for (var _i = 0, _a = docHtmlStartTag.htmlAttributes; _i < _a.length; _i++) {
|
||||
var attribute = _a[_i];
|
||||
if (needsSpace) {
|
||||
this._writeContent(' ');
|
||||
}
|
||||
this._renderNode(attribute);
|
||||
needsSpace = attribute.spacingAfterValue === undefined || attribute.spacingAfterValue.length === 0;
|
||||
}
|
||||
this._writeContent(docHtmlStartTag.selfClosingTag ? '/>' : '>');
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.InheritDocTag:
|
||||
var docInheritDocTag_1 = docNode;
|
||||
this._renderInlineTag(docInheritDocTag_1, function () {
|
||||
if (docInheritDocTag_1.declarationReference) {
|
||||
_this._writeContent(' ');
|
||||
_this._renderNode(docInheritDocTag_1.declarationReference);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.InlineTag:
|
||||
var docInlineTag_1 = docNode;
|
||||
this._renderInlineTag(docInlineTag_1, function () {
|
||||
if (docInlineTag_1.tagContent.length > 0) {
|
||||
_this._writeContent(' ');
|
||||
_this._writeContent(docInlineTag_1.tagContent);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.LinkTag:
|
||||
var docLinkTag_1 = docNode;
|
||||
this._renderInlineTag(docLinkTag_1, function () {
|
||||
if (docLinkTag_1.urlDestination !== undefined || docLinkTag_1.codeDestination !== undefined) {
|
||||
if (docLinkTag_1.urlDestination !== undefined) {
|
||||
_this._writeContent(' ');
|
||||
_this._writeContent(docLinkTag_1.urlDestination);
|
||||
}
|
||||
else if (docLinkTag_1.codeDestination !== undefined) {
|
||||
_this._writeContent(' ');
|
||||
_this._renderNode(docLinkTag_1.codeDestination);
|
||||
}
|
||||
}
|
||||
if (docLinkTag_1.linkText !== undefined) {
|
||||
_this._writeContent(' ');
|
||||
_this._writeContent('|');
|
||||
_this._writeContent(' ');
|
||||
_this._writeContent(docLinkTag_1.linkText);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.MemberIdentifier:
|
||||
var docMemberIdentifier = docNode;
|
||||
if (docMemberIdentifier.hasQuotes) {
|
||||
this._writeContent('"');
|
||||
this._writeContent(docMemberIdentifier.identifier); // todo: encoding
|
||||
this._writeContent('"');
|
||||
}
|
||||
else {
|
||||
this._writeContent(docMemberIdentifier.identifier);
|
||||
}
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.MemberReference:
|
||||
var docMemberReference = docNode;
|
||||
if (docMemberReference.hasDot) {
|
||||
this._writeContent('.');
|
||||
}
|
||||
if (docMemberReference.selector) {
|
||||
this._writeContent('(');
|
||||
}
|
||||
if (docMemberReference.memberSymbol) {
|
||||
this._renderNode(docMemberReference.memberSymbol);
|
||||
}
|
||||
else {
|
||||
this._renderNode(docMemberReference.memberIdentifier);
|
||||
}
|
||||
if (docMemberReference.selector) {
|
||||
this._writeContent(':');
|
||||
this._renderNode(docMemberReference.selector);
|
||||
this._writeContent(')');
|
||||
}
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.MemberSelector:
|
||||
var docMemberSelector = docNode;
|
||||
this._writeContent(docMemberSelector.selector);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.MemberSymbol:
|
||||
var docMemberSymbol = docNode;
|
||||
this._writeContent('[');
|
||||
this._renderNode(docMemberSymbol.symbolReference);
|
||||
this._writeContent(']');
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.Section:
|
||||
var docSection = docNode;
|
||||
this._renderNodes(docSection.nodes);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.Paragraph:
|
||||
var trimmedParagraph = DocNodeTransforms_1.DocNodeTransforms.trimSpacesInParagraph(docNode);
|
||||
if (trimmedParagraph.nodes.length > 0) {
|
||||
if (this._hangingParagraph) {
|
||||
// If it's a hanging paragraph, then don't skip a line
|
||||
this._hangingParagraph = false;
|
||||
}
|
||||
else {
|
||||
this._ensureLineSkipped();
|
||||
}
|
||||
this._renderNodes(trimmedParagraph.nodes);
|
||||
this._writeNewline();
|
||||
}
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.ParamBlock:
|
||||
var docParamBlock = docNode;
|
||||
this._ensureLineSkipped();
|
||||
this._renderNode(docParamBlock.blockTag);
|
||||
this._writeContent(' ');
|
||||
this._writeContent(docParamBlock.parameterName);
|
||||
this._writeContent(' - ');
|
||||
this._hangingParagraph = true;
|
||||
this._renderNode(docParamBlock.content);
|
||||
this._hangingParagraph = false;
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.ParamCollection:
|
||||
var docParamCollection = docNode;
|
||||
this._renderNodes(docParamCollection.blocks);
|
||||
break;
|
||||
case DocNode_1.DocNodeKind.PlainText:
|
||||
var docPlainText = docNode;
|
||||
this._writeContent(docPlainText.text);
|
||||
break;
|
||||
}
|
||||
};
|
||||
TSDocEmitter.prototype._renderInlineTag = function (docInlineTagBase, writeInlineTagContent) {
|
||||
this._writeContent('{');
|
||||
this._writeContent(docInlineTagBase.tagName);
|
||||
writeInlineTagContent();
|
||||
this._writeContent('}');
|
||||
};
|
||||
TSDocEmitter.prototype._renderNodes = function (docNodes) {
|
||||
for (var _i = 0, docNodes_1 = docNodes; _i < docNodes_1.length; _i++) {
|
||||
var docNode = docNodes_1[_i];
|
||||
this._renderNode(docNode);
|
||||
}
|
||||
};
|
||||
// Calls _writeNewline() only if we're not already at the start of a new line
|
||||
TSDocEmitter.prototype._ensureAtStartOfLine = function () {
|
||||
if (this._lineState === LineState.MiddleOfLine) {
|
||||
this._writeNewline();
|
||||
}
|
||||
};
|
||||
// Calls _writeNewline() if needed to ensure that we have skipped at least one line
|
||||
TSDocEmitter.prototype._ensureLineSkipped = function () {
|
||||
this._ensureAtStartOfLine();
|
||||
if (this._previousLineHadContent) {
|
||||
this._writeNewline();
|
||||
}
|
||||
};
|
||||
// Writes literal text content. If it contains newlines, they will automatically be converted to
|
||||
// _writeNewline() calls, to ensure that "*" is written at the start of each line.
|
||||
TSDocEmitter.prototype._writeContent = function (content) {
|
||||
if (content === undefined || content.length === 0) {
|
||||
return;
|
||||
}
|
||||
var splitLines = content.split(/\r?\n/g);
|
||||
if (splitLines.length > 1) {
|
||||
var firstLine = true;
|
||||
for (var _i = 0, splitLines_1 = splitLines; _i < splitLines_1.length; _i++) {
|
||||
var line = splitLines_1[_i];
|
||||
if (firstLine) {
|
||||
firstLine = false;
|
||||
}
|
||||
else {
|
||||
this._writeNewline();
|
||||
}
|
||||
this._writeContent(line);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this._lineState === LineState.Closed) {
|
||||
if (this._emitCommentFraming) {
|
||||
this._output.append('/**' + this.eol + ' *');
|
||||
}
|
||||
this._lineState = LineState.StartOfLine;
|
||||
}
|
||||
if (this._lineState === LineState.StartOfLine) {
|
||||
if (this._emitCommentFraming) {
|
||||
this._output.append(' ');
|
||||
}
|
||||
}
|
||||
this._output.append(content);
|
||||
this._lineState = LineState.MiddleOfLine;
|
||||
this._previousLineHadContent = true;
|
||||
};
|
||||
// Starts a new line, and inserts "/**" or "*" as appropriate.
|
||||
TSDocEmitter.prototype._writeNewline = function () {
|
||||
if (this._lineState === LineState.Closed) {
|
||||
if (this._emitCommentFraming) {
|
||||
this._output.append('/**' + this.eol + ' *');
|
||||
}
|
||||
this._lineState = LineState.StartOfLine;
|
||||
}
|
||||
this._previousLineHadContent = this._lineState === LineState.MiddleOfLine;
|
||||
if (this._emitCommentFraming) {
|
||||
this._output.append(this.eol + ' *');
|
||||
}
|
||||
else {
|
||||
this._output.append(this.eol);
|
||||
}
|
||||
this._lineState = LineState.StartOfLine;
|
||||
this._hangingParagraph = false;
|
||||
};
|
||||
// Closes the comment, adding the final "*/" delimiter
|
||||
TSDocEmitter.prototype._writeEnd = function () {
|
||||
if (this._lineState === LineState.MiddleOfLine) {
|
||||
if (this._emitCommentFraming) {
|
||||
this._writeNewline();
|
||||
}
|
||||
}
|
||||
if (this._lineState !== LineState.Closed) {
|
||||
if (this._emitCommentFraming) {
|
||||
this._output.append('/' + this.eol);
|
||||
}
|
||||
this._lineState = LineState.Closed;
|
||||
}
|
||||
};
|
||||
return TSDocEmitter;
|
||||
}());
|
||||
exports.TSDocEmitter = TSDocEmitter;
|
||||
//# sourceMappingURL=TSDocEmitter.js.map
|
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/TSDocEmitter.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/TSDocEmitter.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/__tests__/TSDocEmitter.test.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/tsdoc/lib-commonjs/emitters/__tests__/TSDocEmitter.test.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user