File tree Expand file tree Collapse file tree 3 files changed +7
-37
lines changed Expand file tree Collapse file tree 3 files changed +7
-37
lines changed Original file line number Diff line number Diff line change 407
407
;
408
408
}
409
409
410
- Dependencies: NA
410
+ Dependencies: core-js/modules/es6.string.raw
411
411
412
412
` ;
413
413
Original file line number Diff line number Diff line change @@ -107,41 +107,6 @@ module.exports = function evaluate(
107
107
} ) ;
108
108
}
109
109
110
- // Collect the list of dependencies that we import
111
- const dependencies = requirements . reduce ( ( deps , req ) => {
112
- if ( t . isImportDeclaration ( req . path . parentPath ) ) {
113
- deps . push ( req . path . parentPath . node . source . value ) ;
114
- } else {
115
- req . path . traverse ( {
116
- CallExpression ( p ) {
117
- const { callee, arguments : args } = p . node ;
118
-
119
- let name ;
120
-
121
- if ( callee . name === 'require' && args . length === 1 ) {
122
- if (
123
- args [ 0 ] . type === 'Literal' ||
124
- args [ 0 ] . type === 'StringLiteral'
125
- ) {
126
- name = args [ 0 ] . value ;
127
- } else if (
128
- args [ 0 ] . type === 'TemplateLiteral' &&
129
- args [ 0 ] . quasis . length === 1
130
- ) {
131
- name = args [ 0 ] . quasis [ 0 ] . value . cooked ;
132
- }
133
- }
134
-
135
- if ( name ) {
136
- deps . push ( name ) ;
137
- }
138
- } ,
139
- } ) ;
140
- }
141
-
142
- return deps ;
143
- } , [ ] ) ;
144
-
145
110
const expression = t . expressionStatement (
146
111
t . assignmentExpression (
147
112
'=' ,
@@ -182,6 +147,7 @@ module.exports = function evaluate(
182
147
183
148
const m = new Module ( filename ) ;
184
149
150
+ m . dependencies = [ ] ;
185
151
m . transform =
186
152
typeof transformer !== 'undefined'
187
153
? transformer
@@ -278,6 +244,6 @@ module.exports = function evaluate(
278
244
279
245
return {
280
246
value : m . exports ,
281
- dependencies,
247
+ dependencies : ( ( m . dependencies : any ) : string [ ] ) ,
282
248
} ;
283
249
} ;
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ class Module {
81
81
82
82
extensions : string [ ] ;
83
83
84
+ dependencies : ?( string [ ] ) ;
85
+
84
86
transform : ?( text : string ) = > { code : string } ;
85
87
86
88
constructor ( filename : string ) {
@@ -159,6 +161,8 @@ class Module {
159
161
) ;
160
162
}
161
163
164
+ this . dependencies && this . dependencies . push ( id ) ;
165
+
162
166
let m = cache [ filename ] ;
163
167
164
168
if ( ! m ) {
You can’t perform that action at this time.
0 commit comments