@@ -25,28 +25,13 @@ module.exports = function format( assets ) {
25
25
out = out + ` ${ chalk . blue ( pkg . name ) } ${ chalk . dim ( 'is issued by' ) } \n`
26
26
27
27
if ( pkg . externalIssuers . length > 0 ) {
28
- pkg . externalIssuers . sort ( ( a , b ) => {
29
- if ( containsNodeModules ( a . name ) && ! containsNodeModules ( b . name ) ) {
30
- return 1
31
- }
32
-
33
- if ( ! containsNodeModules ( a . name ) && containsNodeModules ( b . name ) ) {
34
- return - 1
35
- }
36
-
37
- if ( containsAt ( a . name ) && ! containsAt ( b . name ) ) {
38
- return - 1
39
- }
40
-
41
- if ( ! containsAt ( a . name ) && containsAt ( b . name ) ) {
42
- return 1
43
- }
44
-
45
- return a . name . replace ( atReg , '' ) . localeCompare ( b . name . replace ( atReg , '' ) )
46
- } )
28
+ pkg . externalIssuers . sort ( ( a , b ) => sortIssuer ( a . name , b . name ) )
47
29
48
30
out = out + pkg . externalIssuers . map ( issuer => {
49
- return `\n → ${ prettyPath ( issuer . name ) } `
31
+ return `\n → ` + prettyPath ( issuer . trace [ 0 ] ) +
32
+ issuer . trace . slice ( 1 ) . map ( ( parentIssuer , i ) => {
33
+ return '\n\n' + ' ' . repeat ( i * 2 + 5 ) + chalk . dim ( ' ↳ ' ) + prettyPath ( parentIssuer )
34
+ } ) . join ( '' )
50
35
} ) . join ( '\n' )
51
36
} else {
52
37
out = out + `\n → ${ chalk . bold ( 'Self' ) } ${ chalk . dim ( '( As Entrypoint )' ) } `
@@ -74,3 +59,23 @@ function containsNodeModules( path ) {
74
59
function containsAt ( path ) {
75
60
return path . includes ( '@' )
76
61
}
62
+
63
+ function sortIssuer ( aName , bName ) {
64
+ if ( containsNodeModules ( aName ) && ! containsNodeModules ( bName ) ) {
65
+ return 1
66
+ }
67
+
68
+ if ( ! containsNodeModules ( aName ) && containsNodeModules ( bName ) ) {
69
+ return - 1
70
+ }
71
+
72
+ if ( containsAt ( aName ) && ! containsAt ( bName ) ) {
73
+ return - 1
74
+ }
75
+
76
+ if ( ! containsAt ( aName ) && containsAt ( bName ) ) {
77
+ return 1
78
+ }
79
+
80
+ return aName . replace ( atReg , '' ) . localeCompare ( bName . replace ( atReg , '' ) )
81
+ }
0 commit comments