@@ -34,6 +34,10 @@ const sourceFilePathBlacklist = [
34
34
// exceptions but we simply ignore those files from this rule.
35
35
/ [ / \\ ] p a c k a g e s [ / \\ ] l a n g u a g e - s e r v i c e [ / \\ ] / ,
36
36
37
+ // Compiler CLI is never part of a browser (there's a browser-rollup but it's managed
38
+ // separately.
39
+ / [ / \\ ] p a c k a g e s [ / \\ ] c o m p i l e r - c l i [ / \\ ] / ,
40
+
37
41
// service-worker is a special package that has more than one rollup config. It confuses
38
42
// this lint rule and we simply ignore those files.
39
43
/ [ / \\ ] p a c k a g e s [ / \\ ] s e r v i c e - w o r k e r [ / \\ ] / ,
@@ -61,11 +65,26 @@ function _pathShouldBeLinted(path: string) {
61
65
}
62
66
63
67
68
+ /**
69
+ * .--. _________________
70
+ * {\ / q {\ / globalGlobalMap /
71
+ * { `\ \ (-(~` <__________________/
72
+ * { '.{`\ \ \ )
73
+ * {'-{ ' \ .-""'-. \ \
74
+ * {._{'.' \/ '.) \
75
+ * {_.{. {` |
76
+ * {._{ ' { ;'-=-. |
77
+ * {-.{.' { ';-=-.` /
78
+ * {._.{.; '-=- .'
79
+ * {_.-' `'.__ _,-'
80
+ * |||`
81
+ * .='==,
82
+ */
64
83
interface RollupMatchInfo {
65
84
filePath : string ;
66
85
globals : { [ packageName : string ] : string } ;
67
86
}
68
- const rollupConfigMap = new Map < string , RollupMatchInfo > ( ) ;
87
+ const globalGlobalRollupMap = new Map < string , RollupMatchInfo > ( ) ;
69
88
70
89
71
90
export class Rule extends AbstractRule {
@@ -85,22 +104,22 @@ export class Rule extends AbstractRule {
85
104
let match : RollupMatchInfo ;
86
105
87
106
while ( p . startsWith ( process . cwd ( ) ) ) {
88
- if ( rollupConfigMap . has ( p ) ) {
107
+ if ( globalGlobalRollupMap . has ( p ) ) {
89
108
// We already resolved for this directory, just return it.
90
- match = rollupConfigMap . get ( p ) ;
109
+ match = globalGlobalRollupMap . get ( p ) ;
91
110
break ;
92
111
}
93
112
94
113
const allFiles = fs . readdirSync ( p ) ;
95
114
const maybeRollupPath = allFiles . find ( x => _isRollupPath ( path . join ( p , x ) ) ) ;
96
115
if ( maybeRollupPath ) {
97
116
const rollupFilePath = path . join ( p , maybeRollupPath ) ;
98
- const rollupConfig = require ( rollupFilePath ) . default ;
117
+ const rollupConfig = require ( rollupFilePath ) ;
99
118
match = { filePath : rollupFilePath , globals : rollupConfig && rollupConfig . globals } ;
100
119
101
120
// Update all paths that we checked along the way.
102
- checkedPaths . forEach ( path => rollupConfigMap . set ( path , match ) ) ;
103
- rollupConfigMap . set ( rollupFilePath , match ) ;
121
+ checkedPaths . forEach ( path => globalGlobalRollupMap . set ( path , match ) ) ;
122
+ globalGlobalRollupMap . set ( rollupFilePath , match ) ;
104
123
break ;
105
124
}
106
125
0 commit comments