1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.getCssDocsForSymbol = void 0;
|
4 | const jest_docblock_1 = require("jest-docblock");
|
5 | function getCssDocsForSymbol(meta, symbol) {
|
6 | let commentNode;
|
7 | if (symbol._kind === 'class' || symbol._kind === 'element') {
|
8 | commentNode =
|
9 | meta.simpleSelectors[symbol.name] && meta.simpleSelectors[symbol.name].node.prev();
|
10 | }
|
11 | else if (symbol._kind === 'var') {
|
12 | commentNode = symbol.node.prev();
|
13 | }
|
14 | if (commentNode && commentNode.type === 'comment') {
|
15 | const { comments, pragmas } = jest_docblock_1.parseWithComments(jest_docblock_1.extract(commentNode.toString()));
|
16 | const res = {
|
17 | description: comments,
|
18 | tags: {},
|
19 | };
|
20 | for (const [pragmaName, pragmaValue] of Object.entries(pragmas)) {
|
21 | res.tags[pragmaName] = Array.isArray(pragmaValue) ? pragmaValue.join(' ') : pragmaValue;
|
22 | }
|
23 | return res;
|
24 | }
|
25 | return null;
|
26 | }
|
27 | exports.getCssDocsForSymbol = getCssDocsForSymbol;
|
28 |
|
\ | No newline at end of file |