File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
- const importRegex = / \b i m p o r t \s + (?: \s ? ( .+ ) \} ? \s + f r o m \s + ) ? [ \' " ] ( [ ^ " \' ] + ) [ " \' ] / ;
1
+ const importRegex = / ^ i m p o r t \s + (?: \s ? ( .+ ) \} ? \s + f r o m \s + ) ? [ \' " ] ( [ ^ " \' ] + ) [ " \' ] / ;
2
2
const namedRegex = / ^ { .+ } $ / ;
3
3
4
4
let imports = { } ;
@@ -30,7 +30,7 @@ function detectImports(src) {
30
30
}
31
31
} ) ;
32
32
33
- let output = '' ;
33
+ let output = '\n ' ;
34
34
35
35
for ( let key in imports ) { /* jshint forin: false */
36
36
@@ -39,9 +39,9 @@ function detectImports(src) {
39
39
const { path, importType } = imports [ key ] ;
40
40
// eval(`var ${key};`);
41
41
if ( importType === 'named' ) {
42
- output += `global.${ key } = require('${ path } ').${ key } ;` ;
42
+ output += `global.${ key } = require('${ path } ').${ key } ;\n ` ;
43
43
} else {
44
- output += `global.${ key } = require('${ path } ')` ;
44
+ output += `global.${ key } = require('${ path } ');\n ` ;
45
45
}
46
46
47
47
} catch ( e ) { }
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " rewire-coderoad" ,
3
- "version" : " 3.1.0 " ,
3
+ "version" : " 3.1.1 " ,
4
4
"description" : " CodeRoad implementation to override 'require' in order to monkey-patch test globals" ,
5
5
"keywords" : [
6
6
" dependency" ,
30
30
},
31
31
"devDependencies" : {
32
32
"expect.js" : " ^0.3.1" ,
33
- "mocha" : " ^2.1.0 "
33
+ "mocha" : " ^3.0.2 "
34
34
},
35
35
"license" : " MIT" ,
36
36
"scripts" : {
You can’t perform that action at this time.
0 commit comments