File tree Expand file tree Collapse file tree 8 files changed +66
-13
lines changed Expand file tree Collapse file tree 8 files changed +66
-13
lines changed Original file line number Diff line number Diff line change 7
7
"path" : " fixtures/-default/package/bar.js" ,
8
8
"declarations" : [
9
9
{
10
- "kind" : " function" ,
11
- "name" : " bar"
10
+ "kind" : " class" ,
11
+ "description" : " " ,
12
+ "name" : " default" ,
13
+ "cssParts" : [
14
+ {
15
+ "name" : " foo"
16
+ }
17
+ ],
18
+ "members" : [
19
+ {
20
+ "kind" : " field" ,
21
+ "name" : " propertyDecorator" ,
22
+ "type" : {
23
+ "text" : " string"
24
+ },
25
+ "default" : " hi"
26
+ },
27
+ {
28
+ "kind" : " field" ,
29
+ "name" : " mobileopen" ,
30
+ "privacy" : " public" ,
31
+ "default" : " false"
32
+ }
33
+ ],
34
+ "attributes" : [
35
+ {
36
+ "name" : " propertyDecorator" ,
37
+ "type" : {
38
+ "text" : " string"
39
+ },
40
+ "default" : " hi" ,
41
+ "fieldName" : " propertyDecorator"
42
+ },
43
+ {
44
+ "name" : " mobileopen" ,
45
+ "fieldName" : " mobileopen"
46
+ }
47
+ ],
48
+ "superclass" : {
49
+ "name" : " LitElement"
50
+ },
51
+ "customElement" : true
12
52
}
13
53
],
14
54
"exports" : [
15
55
{
16
56
"kind" : " js" ,
17
- "name" : " bar" ,
57
+ "name" : " default" ,
58
+ "declaration" : {
59
+ "name" : " default" ,
60
+ "module" : " fixtures/-default/package/bar.js"
61
+ }
62
+ },
63
+ {
64
+ "kind" : " custom-element-definition" ,
65
+ "name" : " top-bar" ,
18
66
"declaration" : {
19
- "name" : " bar " ,
67
+ "name" : " TopBar " ,
20
68
"module" : " fixtures/-default/package/bar.js"
21
69
}
22
70
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @custom-elements-manifest/analyzer" ,
3
- "version" : " 0.2.2 " ,
3
+ "version" : " 0.2.3 " ,
4
4
"description" : " " ,
5
5
"license" : " MIT" ,
6
6
"type" : " module" ,
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ export function classJsDocPlugin() {
13
13
analyzePhase ( { ts, node, moduleDoc} ) {
14
14
switch ( node . kind ) {
15
15
case ts . SyntaxKind . ClassDeclaration :
16
- const className = node ?. name ?. text ;
16
+ const hasDefaultModifier = node ?. modifiers ?. some ( mod => ts . SyntaxKind . DefaultKeyword === mod . kind ) ;
17
+ const className = hasDefaultModifier ? 'default' : node ?. name ?. getText ( ) ;
17
18
const classDoc = moduleDoc ?. declarations ?. find ( declaration => declaration . name === className ) ;
18
19
19
20
/**
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ export function attrDecoratorPlugin() {
8
8
analyzePhase ( { ts, node, moduleDoc} ) {
9
9
switch ( node . kind ) {
10
10
case ts . SyntaxKind . ClassDeclaration :
11
- const className = node ?. name ?. text ;
11
+ const hasDefaultModifier = node ?. modifiers ?. some ( mod => ts . SyntaxKind . DefaultKeyword === mod . kind ) ;
12
+ const className = hasDefaultModifier ? 'default' : node ?. name ?. getText ( ) ;
12
13
const classDoc = moduleDoc ?. declarations ?. find ( declaration => declaration . name === className ) ;
13
14
14
15
/**
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ export function propertyDecoratorPlugin() {
14
14
analyzePhase ( { ts, node, moduleDoc} ) {
15
15
switch ( node . kind ) {
16
16
case ts . SyntaxKind . ClassDeclaration :
17
- const className = node ?. name ?. getText ( ) ;
17
+ const hasDefaultModifier = node ?. modifiers ?. some ( mod => ts . SyntaxKind . DefaultKeyword === mod . kind ) ;
18
+ const className = hasDefaultModifier ? 'default' : node ?. name ?. getText ( ) ;
18
19
const currClass = moduleDoc ?. declarations ?. find ( declaration => declaration . name === className ) ;
19
20
20
21
/**
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ export function staticPropertiesPlugin() {
13
13
analyzePhase ( { ts, node, moduleDoc} ) {
14
14
switch ( node . kind ) {
15
15
case ts . SyntaxKind . ClassDeclaration :
16
- const className = node ?. name ?. getText ( ) ;
16
+ const hasDefaultModifier = node ?. modifiers ?. some ( mod => ts . SyntaxKind . DefaultKeyword === mod . kind ) ;
17
+ const className = hasDefaultModifier ? 'default' : node ?. name ?. getText ( ) ;
17
18
const currClass = moduleDoc ?. declarations ?. find ( declaration => declaration . name === className ) ;
18
19
19
20
node ?. members ?. forEach ( member => {
@@ -39,7 +40,8 @@ export function staticPropertiesPlugin() {
39
40
if ( attributeName ) {
40
41
attribute . name = attributeName ;
41
42
}
42
- currClass ?. attributes . push ( attribute ) ;
43
+
44
+ currClass . attributes = [ ...( currClass ?. attributes || [ ] ) , attribute ]
43
45
}
44
46
45
47
currClass ?. members . push ( classMember ) ;
Original file line number Diff line number Diff line change @@ -16,14 +16,14 @@ export function stencilPlugin() {
16
16
* Add tagName to classDoc, extracted from `@Component({tag: 'foo-bar'})` decorator
17
17
* Add custom-element-definition to exports
18
18
*/
19
- const className = node ?. name ?. getText ( ) ;
20
-
21
19
const componentDecorator = node ?. decorators ?. find ( decorator ( 'Component' ) ) ?. expression ;
22
20
23
21
const tagName = componentDecorator ?. arguments ?. [ 0 ] ?. properties ?. find ( prop => {
24
22
return prop ?. name ?. getText ( ) === 'tag'
25
23
} ) ?. initializer ?. text ;
26
24
25
+ const hasDefaultModifier = node ?. modifiers ?. some ( mod => ts . SyntaxKind . DefaultKeyword === mod . kind ) ;
26
+ const className = hasDefaultModifier ? 'default' : node ?. name ?. getText ( ) ;
27
27
const currClass = moduleDoc ?. declarations ?. find ( declaration => declaration . name === className ) ;
28
28
if ( tagName ) {
29
29
currClass . tagName = tagName ;
You can’t perform that action at this time.
0 commit comments