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 + ) ? [ \' " ] ( [ ^ " \' ] + ) [ " \' ] / ;
22const namedRegex = / ^ { .+ } $ / ;
33
44let imports = { } ;
@@ -30,7 +30,7 @@ function detectImports(src) {
3030 }
3131 } ) ;
3232
33- let output = '' ;
33+ let output = '\n ' ;
3434
3535 for ( let key in imports ) { /* jshint forin: false */
3636
@@ -39,9 +39,9 @@ function detectImports(src) {
3939 const { path, importType } = imports [ key ] ;
4040 // eval(`var ${key};`);
4141 if ( importType === 'named' ) {
42- output += `global.${ key } = require('${ path } ').${ key } ;` ;
42+ output += `global.${ key } = require('${ path } ').${ key } ;\n ` ;
4343 } else {
44- output += `global.${ key } = require('${ path } ')` ;
44+ output += `global.${ key } = require('${ path } ');\n ` ;
4545 }
4646
4747 } catch ( e ) { }
Original file line number Diff line number Diff line change 11{
22 "name" : " rewire-coderoad" ,
3- "version" : " 3.1.0 " ,
3+ "version" : " 3.1.1 " ,
44 "description" : " CodeRoad implementation to override 'require' in order to monkey-patch test globals" ,
55 "keywords" : [
66 " dependency" ,
3030 },
3131 "devDependencies" : {
3232 "expect.js" : " ^0.3.1" ,
33- "mocha" : " ^2.1.0 "
33+ "mocha" : " ^3.0.2 "
3434 },
3535 "license" : " MIT" ,
3636 "scripts" : {
You can’t perform that action at this time.
0 commit comments