File tree 3 files changed +16
-13
lines changed
3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 23
23
"@commitlint/cli" : " ^8.0.0" ,
24
24
"@commitlint/config-conventional" : " ^8.0.0" ,
25
25
"@types/babel__core" : " ^7.1.2" ,
26
+ "@types/doctrine" : " ^0.0.3" ,
26
27
"@types/jest" : " ^24.0.15" ,
27
28
"@types/lodash" : " ^4.14.136" ,
28
29
"@types/node" : " ^12.6.2" ,
41
42
"@babel/plugin-syntax-class-properties" : " ^7.2.0" ,
42
43
"@babel/plugin-syntax-jsx" : " ^7.2.0" ,
43
44
"@babel/types" : " ^7.5.0" ,
45
+ "doctrine" : " ^3.0.0" ,
44
46
"lodash" : " ^4.17.14" ,
45
47
"typescript" : " 3.5.2" ,
46
48
"uuid" : " ^3.3.2"
Original file line number Diff line number Diff line change 1
1
import * as ts from 'typescript' ;
2
2
import * as t from './types' ;
3
+ import * as doctrine from 'doctrine' ;
3
4
4
5
/**
5
6
* Options that specify how the parser should act
@@ -441,19 +442,7 @@ export function parseFromProgram(
441
442
if ( comments && comments . length === 1 ) {
442
443
const commentNode = comments [ 0 ] ;
443
444
if ( ts . isJSDoc ( commentNode ) ) {
444
- let commentText = commentNode . comment ? commentNode . comment : '' ;
445
- if ( commentNode . tags ) {
446
- const tags = commentNode . tags
447
- . map ( tag =>
448
- tag
449
- . getText ( )
450
- . replace ( / \* * $ / , '' )
451
- . trim ( ) ,
452
- )
453
- . reduce ( ( prev , curr ) => `${ prev } \n${ curr } ` ) ;
454
- commentText = commentText ? `${ commentText } \n${ tags } ` : tags ;
455
- }
456
- return commentText ;
445
+ return doctrine . unwrapComment ( commentNode . getText ( ) ) . trim ( ) ;
457
446
}
458
447
}
459
448
}
Original file line number Diff line number Diff line change 471
471
dependencies :
472
472
" @babel/types" " ^7.3.0"
473
473
474
+ " @types/doctrine@^0.0.3 " :
475
+ version "0.0.3"
476
+ resolved "https://registry.yarnpkg.com/@types/doctrine/-/doctrine-0.0.3.tgz#e892d293c92c9c1d3f9af72c15a554fbc7e0895a"
477
+ integrity sha1-6JLSk8ksnB0/mvcsFaVU+8fgiVo=
478
+
474
479
" @types/istanbul-lib-coverage@*" , "@types/istanbul-lib-coverage@^2.0.0":
475
480
version "2.0.1"
476
481
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
@@ -1498,6 +1503,13 @@ diff-sequences@^24.3.0:
1498
1503
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975"
1499
1504
integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw==
1500
1505
1506
+ doctrine@^3.0.0 :
1507
+ version "3.0.0"
1508
+ resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
1509
+ integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==
1510
+ dependencies :
1511
+ esutils "^2.0.2"
1512
+
1501
1513
domexception@^1.0.1 :
1502
1514
version "1.0.1"
1503
1515
resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90"
You can’t perform that action at this time.
0 commit comments