This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const { convertSlashesInPath } = require("./projectHelpers");
3
3
module . exports = function ( source ) {
4
4
this . cacheable ( ) ;
5
5
const { modules } = this . query ;
6
- const imports = modules . map ( m => convertSlashesInPath ( m ) )
6
+ const imports = modules . map ( convertSlashesInPath )
7
7
. map ( m => `require("${ m } ");` ) . join ( "\n" ) ;
8
8
const augmentedSource = `
9
9
if (!global["__snapshot"]) {
Original file line number Diff line number Diff line change @@ -68,11 +68,7 @@ module.exports = function (source) {
68
68
parser . parse ( source ) ;
69
69
70
70
const moduleRegisters = namespaces
71
- . map ( function ( n ) {
72
- let obj = n ;
73
- obj . path = convertSlashesInPath ( n . path ) ;
74
- return obj ;
75
- } )
71
+ . map ( convertPath )
76
72
. map ( n =>
77
73
`global.registerModule("${ n . name } ", function() { return require("${ n . path } "); });`
78
74
)
@@ -89,6 +85,11 @@ module.exports = function (source) {
89
85
this . callback ( null , wrapped ) ;
90
86
}
91
87
88
+ function convertPath ( obj ) {
89
+ obj . path = convertSlashesInPath ( obj . path ) ;
90
+ return obj ;
91
+ }
92
+
92
93
function tryResolve ( path ) {
93
94
try {
94
95
return require . resolve ( path ) ;
You can’t perform that action at this time.
0 commit comments