init
This commit is contained in:
		
							
								
								
									
										48
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
import { DocParagraph } from '../nodes';
 | 
			
		||||
/**
 | 
			
		||||
 * Helper functions that transform DocNode trees.
 | 
			
		||||
 */
 | 
			
		||||
export declare class DocNodeTransforms {
 | 
			
		||||
    /**
 | 
			
		||||
     * trimSpacesInParagraphNodes() collapses extra spacing characters from plain text nodes.
 | 
			
		||||
     *
 | 
			
		||||
     * @remarks
 | 
			
		||||
     * This is useful when emitting HTML, where any number of spaces are equivalent
 | 
			
		||||
     * to a single space.  It's also useful when emitting Markdown, where spaces
 | 
			
		||||
     * can be misinterpreted as an indented code block.
 | 
			
		||||
     *
 | 
			
		||||
     * For example, we might transform this:
 | 
			
		||||
     *
 | 
			
		||||
     * ```
 | 
			
		||||
     * nodes: [
 | 
			
		||||
     *   { kind: PlainText, text: "   Here   are some   " },
 | 
			
		||||
     *   { kind: SoftBreak }
 | 
			
		||||
     *   { kind: PlainText, text: "   words" },
 | 
			
		||||
     *   { kind: SoftBreak }
 | 
			
		||||
     *   { kind: InlineTag, text: "{\@inheritDoc}" },
 | 
			
		||||
     *   { kind: PlainText, text: "to process." },
 | 
			
		||||
     *   { kind: PlainText, text: "  " },
 | 
			
		||||
     *   { kind: PlainText, text: "  " }
 | 
			
		||||
     * ]
 | 
			
		||||
     * ```
 | 
			
		||||
     *
 | 
			
		||||
     * ...to this:
 | 
			
		||||
     *
 | 
			
		||||
     * ```
 | 
			
		||||
     * nodes: [
 | 
			
		||||
     *   { kind: PlainText, text: "Here are some " },
 | 
			
		||||
     *   { kind: PlainText, text: "words " },
 | 
			
		||||
     *   { kind: InlineTag, text: "{\@inheritDoc}" },
 | 
			
		||||
     *   { kind: PlainText, text: "to process." }
 | 
			
		||||
     * ]
 | 
			
		||||
     * ```
 | 
			
		||||
     *
 | 
			
		||||
     * Note that in this example, `"words "` is not merged with the preceding node because
 | 
			
		||||
     * its DocPlainText.excerpt cannot span multiple lines.
 | 
			
		||||
     *
 | 
			
		||||
     * @param docParagraph - a DocParagraph containing nodes to be transformed
 | 
			
		||||
     * @returns The transformed child nodes.
 | 
			
		||||
     */
 | 
			
		||||
    static trimSpacesInParagraph(docParagraph: DocParagraph): DocParagraph;
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=DocNodeTransforms.d.ts.map
 | 
			
		||||
							
								
								
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.d.ts.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.d.ts.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"DocNodeTransforms.d.ts","sourceRoot":"","sources":["../../src/transforms/DocNodeTransforms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;WACW,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY;CAG9E"}
 | 
			
		||||
							
								
								
									
										54
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
import { TrimSpacesTransform } from './TrimSpacesTransform';
 | 
			
		||||
/**
 | 
			
		||||
 * Helper functions that transform DocNode trees.
 | 
			
		||||
 */
 | 
			
		||||
var DocNodeTransforms = /** @class */ (function () {
 | 
			
		||||
    function DocNodeTransforms() {
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * trimSpacesInParagraphNodes() collapses extra spacing characters from plain text nodes.
 | 
			
		||||
     *
 | 
			
		||||
     * @remarks
 | 
			
		||||
     * This is useful when emitting HTML, where any number of spaces are equivalent
 | 
			
		||||
     * to a single space.  It's also useful when emitting Markdown, where spaces
 | 
			
		||||
     * can be misinterpreted as an indented code block.
 | 
			
		||||
     *
 | 
			
		||||
     * For example, we might transform this:
 | 
			
		||||
     *
 | 
			
		||||
     * ```
 | 
			
		||||
     * nodes: [
 | 
			
		||||
     *   { kind: PlainText, text: "   Here   are some   " },
 | 
			
		||||
     *   { kind: SoftBreak }
 | 
			
		||||
     *   { kind: PlainText, text: "   words" },
 | 
			
		||||
     *   { kind: SoftBreak }
 | 
			
		||||
     *   { kind: InlineTag, text: "{\@inheritDoc}" },
 | 
			
		||||
     *   { kind: PlainText, text: "to process." },
 | 
			
		||||
     *   { kind: PlainText, text: "  " },
 | 
			
		||||
     *   { kind: PlainText, text: "  " }
 | 
			
		||||
     * ]
 | 
			
		||||
     * ```
 | 
			
		||||
     *
 | 
			
		||||
     * ...to this:
 | 
			
		||||
     *
 | 
			
		||||
     * ```
 | 
			
		||||
     * nodes: [
 | 
			
		||||
     *   { kind: PlainText, text: "Here are some " },
 | 
			
		||||
     *   { kind: PlainText, text: "words " },
 | 
			
		||||
     *   { kind: InlineTag, text: "{\@inheritDoc}" },
 | 
			
		||||
     *   { kind: PlainText, text: "to process." }
 | 
			
		||||
     * ]
 | 
			
		||||
     * ```
 | 
			
		||||
     *
 | 
			
		||||
     * Note that in this example, `"words "` is not merged with the preceding node because
 | 
			
		||||
     * its DocPlainText.excerpt cannot span multiple lines.
 | 
			
		||||
     *
 | 
			
		||||
     * @param docParagraph - a DocParagraph containing nodes to be transformed
 | 
			
		||||
     * @returns The transformed child nodes.
 | 
			
		||||
     */
 | 
			
		||||
    DocNodeTransforms.trimSpacesInParagraph = function (docParagraph) {
 | 
			
		||||
        return TrimSpacesTransform.transform(docParagraph);
 | 
			
		||||
    };
 | 
			
		||||
    return DocNodeTransforms;
 | 
			
		||||
}());
 | 
			
		||||
export { DocNodeTransforms };
 | 
			
		||||
//# sourceMappingURL=DocNodeTransforms.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/DocNodeTransforms.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"DocNodeTransforms.js","sourceRoot":"","sources":["../../src/transforms/DocNodeTransforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;GAEG;AACH;IAAA;IA4CA,CAAC;IA3CC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACW,uCAAqB,GAAnC,UAAoC,YAA0B;QAC5D,OAAO,mBAAmB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC;IACH,wBAAC;AAAD,CAAC,AA5CD,IA4CC","sourcesContent":["import { TrimSpacesTransform } from './TrimSpacesTransform';\r\nimport { DocParagraph } from '../nodes';\r\n\r\n/**\r\n * Helper functions that transform DocNode trees.\r\n */\r\nexport class DocNodeTransforms {\r\n  /**\r\n   * trimSpacesInParagraphNodes() collapses extra spacing characters from plain text nodes.\r\n   *\r\n   * @remarks\r\n   * This is useful when emitting HTML, where any number of spaces are equivalent\r\n   * to a single space.  It's also useful when emitting Markdown, where spaces\r\n   * can be misinterpreted as an indented code block.\r\n   *\r\n   * For example, we might transform this:\r\n   *\r\n   * ```\r\n   * nodes: [\r\n   *   { kind: PlainText, text: \"   Here   are some   \" },\r\n   *   { kind: SoftBreak }\r\n   *   { kind: PlainText, text: \"   words\" },\r\n   *   { kind: SoftBreak }\r\n   *   { kind: InlineTag, text: \"{\\@inheritDoc}\" },\r\n   *   { kind: PlainText, text: \"to process.\" },\r\n   *   { kind: PlainText, text: \"  \" },\r\n   *   { kind: PlainText, text: \"  \" }\r\n   * ]\r\n   * ```\r\n   *\r\n   * ...to this:\r\n   *\r\n   * ```\r\n   * nodes: [\r\n   *   { kind: PlainText, text: \"Here are some \" },\r\n   *   { kind: PlainText, text: \"words \" },\r\n   *   { kind: InlineTag, text: \"{\\@inheritDoc}\" },\r\n   *   { kind: PlainText, text: \"to process.\" }\r\n   * ]\r\n   * ```\r\n   *\r\n   * Note that in this example, `\"words \"` is not merged with the preceding node because\r\n   * its DocPlainText.excerpt cannot span multiple lines.\r\n   *\r\n   * @param docParagraph - a DocParagraph containing nodes to be transformed\r\n   * @returns The transformed child nodes.\r\n   */\r\n  public static trimSpacesInParagraph(docParagraph: DocParagraph): DocParagraph {\r\n    return TrimSpacesTransform.transform(docParagraph);\r\n  }\r\n}\r\n"]}
 | 
			
		||||
							
								
								
									
										8
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
import { DocParagraph } from '../nodes';
 | 
			
		||||
/**
 | 
			
		||||
 * Implementation of DocNodeTransforms.trimSpacesInParagraphNodes()
 | 
			
		||||
 */
 | 
			
		||||
export declare class TrimSpacesTransform {
 | 
			
		||||
    static transform(docParagraph: DocParagraph): DocParagraph;
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=TrimSpacesTransform.d.ts.map
 | 
			
		||||
							
								
								
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.d.ts.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.d.ts.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"TrimSpacesTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/TrimSpacesTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsC,MAAM,UAAU,CAAC;AAE5E;;GAEG;AACH,qBAAa,mBAAmB;WAChB,SAAS,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY;CA8FlE"}
 | 
			
		||||
							
								
								
									
										87
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
			
		||||
import { DocParagraph, DocNodeKind, DocPlainText } from '../nodes';
 | 
			
		||||
/**
 | 
			
		||||
 * Implementation of DocNodeTransforms.trimSpacesInParagraphNodes()
 | 
			
		||||
 */
 | 
			
		||||
var TrimSpacesTransform = /** @class */ (function () {
 | 
			
		||||
    function TrimSpacesTransform() {
 | 
			
		||||
    }
 | 
			
		||||
    TrimSpacesTransform.transform = function (docParagraph) {
 | 
			
		||||
        var transformedNodes = [];
 | 
			
		||||
        // Whether the next nonempty node to be added needs a space before it
 | 
			
		||||
        var pendingSpace = false;
 | 
			
		||||
        // The DocPlainText node that we're currently accumulating
 | 
			
		||||
        var accumulatedTextChunks = [];
 | 
			
		||||
        var accumulatedNodes = [];
 | 
			
		||||
        // We always trim leading whitespace for a paragraph.  This flag gets set to true
 | 
			
		||||
        // as soon as nonempty content is encountered.
 | 
			
		||||
        var finishedSkippingLeadingSpaces = false;
 | 
			
		||||
        for (var _i = 0, _a = docParagraph.nodes; _i < _a.length; _i++) {
 | 
			
		||||
            var node = _a[_i];
 | 
			
		||||
            switch (node.kind) {
 | 
			
		||||
                case DocNodeKind.PlainText:
 | 
			
		||||
                    var docPlainText = node;
 | 
			
		||||
                    var text = docPlainText.text;
 | 
			
		||||
                    var startedWithSpace = /^\s/.test(text);
 | 
			
		||||
                    var endedWithSpace = /\s$/.test(text);
 | 
			
		||||
                    var collapsedText = text.replace(/\s+/g, ' ').trim();
 | 
			
		||||
                    if (startedWithSpace && finishedSkippingLeadingSpaces) {
 | 
			
		||||
                        pendingSpace = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (collapsedText.length > 0) {
 | 
			
		||||
                        if (pendingSpace) {
 | 
			
		||||
                            accumulatedTextChunks.push(' ');
 | 
			
		||||
                            pendingSpace = false;
 | 
			
		||||
                        }
 | 
			
		||||
                        accumulatedTextChunks.push(collapsedText);
 | 
			
		||||
                        accumulatedNodes.push(node);
 | 
			
		||||
                        finishedSkippingLeadingSpaces = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (endedWithSpace && finishedSkippingLeadingSpaces) {
 | 
			
		||||
                        pendingSpace = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    break;
 | 
			
		||||
                case DocNodeKind.SoftBreak:
 | 
			
		||||
                    if (finishedSkippingLeadingSpaces) {
 | 
			
		||||
                        pendingSpace = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    accumulatedNodes.push(node);
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    if (pendingSpace) {
 | 
			
		||||
                        accumulatedTextChunks.push(' ');
 | 
			
		||||
                        pendingSpace = false;
 | 
			
		||||
                    }
 | 
			
		||||
                    // Push the accumulated text
 | 
			
		||||
                    if (accumulatedTextChunks.length > 0) {
 | 
			
		||||
                        // TODO: We should probably track the accumulatedNodes somehow, e.g. so we can map them back to the
 | 
			
		||||
                        // original excerpts.  But we need a developer scenario before we can design this API.
 | 
			
		||||
                        transformedNodes.push(new DocPlainText({
 | 
			
		||||
                            configuration: docParagraph.configuration,
 | 
			
		||||
                            text: accumulatedTextChunks.join('')
 | 
			
		||||
                        }));
 | 
			
		||||
                        accumulatedTextChunks.length = 0;
 | 
			
		||||
                        accumulatedNodes.length = 0;
 | 
			
		||||
                    }
 | 
			
		||||
                    transformedNodes.push(node);
 | 
			
		||||
                    finishedSkippingLeadingSpaces = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // Push the accumulated text
 | 
			
		||||
        if (accumulatedTextChunks.length > 0) {
 | 
			
		||||
            transformedNodes.push(new DocPlainText({
 | 
			
		||||
                configuration: docParagraph.configuration,
 | 
			
		||||
                text: accumulatedTextChunks.join('')
 | 
			
		||||
            }));
 | 
			
		||||
            accumulatedTextChunks.length = 0;
 | 
			
		||||
            accumulatedNodes.length = 0;
 | 
			
		||||
        }
 | 
			
		||||
        var transformedParagraph = new DocParagraph({
 | 
			
		||||
            configuration: docParagraph.configuration
 | 
			
		||||
        });
 | 
			
		||||
        transformedParagraph.appendNodes(transformedNodes);
 | 
			
		||||
        return transformedParagraph;
 | 
			
		||||
    };
 | 
			
		||||
    return TrimSpacesTransform;
 | 
			
		||||
}());
 | 
			
		||||
export { TrimSpacesTransform };
 | 
			
		||||
//# sourceMappingURL=TrimSpacesTransform.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user