UNPKG

2.82 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * The complete set of authors may be found at
7 * http://polymer.github.io/AUTHORS.txt
8 * The complete set of contributors may be found at
9 * http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at
12 * http://polymer.github.io/PATENTS.txt
13 */
14import { NodePath } from '@babel/traverse';
15import * as babel from '@babel/types';
16import * as doctrine from 'doctrine';
17import { Annotation, Tag } from 'doctrine';
18import { Demo } from '../index';
19import { Privacy } from '../model/model';
20import { ScannedReference, Warning } from '../model/model';
21import { JavaScriptDocument } from './javascript-document';
22export { Annotation, Tag } from 'doctrine';
23/**
24 * Given a JSDoc string (minus opening/closing comment delimiters), extract its
25 * description and tags.
26 */
27export declare function parseJsdoc(docs: string): doctrine.Annotation;
28/**
29 * removes leading *, and any space before it
30 */
31export declare function removeLeadingAsterisks(description: string): string;
32export declare function hasTag(jsdoc: Annotation | undefined, title: string): boolean;
33/**
34 * Finds the first JSDoc tag matching `title`.
35 */
36export declare function getTag(jsdoc: Annotation | undefined, title: string): Tag | undefined;
37export declare function unindent(text: string): string;
38export declare function isAnnotationEmpty(docs: Annotation | undefined): boolean;
39export declare function getPrivacy(jsdoc: Annotation | undefined): Privacy | undefined;
40/**
41 * Returns the mixin applications, in the form of ScannedReferences, for the
42 * jsdocs of class.
43 *
44 * The references are returned in presumed order of application - from furthest
45 * up the prototype chain to closest to the subclass.
46 */
47export declare function getMixinApplications(document: JavaScriptDocument, node: babel.Node, docs: Annotation, warnings: Warning[], path: NodePath): Array<ScannedReference<'element-mixin'>>;
48export declare function extractDemos(jsdoc: Annotation | undefined): Demo[];
49export declare function join(...jsdocs: Array<Annotation | undefined>): Annotation;
50/**
51 * Assume that if the same symbol is documented in multiple places, the longer
52 * description is probably the intended one.
53 *
54 * TODO(rictic): unify logic with join(...)'s above.
55 */
56export declare function pickBestDescription(...descriptions: Array<string | undefined>): string;
57/**
58 * Extracts the description from a jsdoc annotation and uses
59 * known descriptive tags if no explicit description is set.
60 */
61export declare function getDescription(jsdocAnn: Annotation): string | undefined;