1
+ var os = require ( 'os' ) ;
1
2
var path = require ( 'path' ) ;
2
3
3
- function getRequireLoader ( filePath , moduleName ) {
4
+ module . exports . getRequireLoader = function ( filePath , moduleName ) {
4
5
var result = [
5
6
'loadChildren: () => new Promise(function (resolve) {\n' ,
6
7
' (require as any).ensure([], function (require) {\n' ,
@@ -10,9 +11,9 @@ function getRequireLoader(filePath, moduleName) {
10
11
] ;
11
12
12
13
return result . join ( '' ) ;
13
- }
14
+ } ;
14
15
15
- function getSystemLoader ( filePath , moduleName ) {
16
+ module . exports . getSystemLoader = function ( filePath , moduleName ) {
16
17
var result = [
17
18
'loadChildren: () => System.import(\'' + filePath + '\')\n' ,
18
19
' .then(function(module) {\n' ,
@@ -21,12 +22,18 @@ function getSystemLoader(filePath, moduleName) {
21
22
] ;
22
23
23
24
return result . join ( '' ) ;
24
- }
25
+ } ;
25
26
26
- function getFilename ( resourcePath ) {
27
+ module . exports . getFilename = function ( resourcePath ) {
27
28
var filename = path . basename ( resourcePath ) ;
28
29
29
30
return path . basename ( resourcePath , path . extname ( filename ) ) ;
30
- }
31
+ } ;
31
32
32
- module . exports = { getRequireLoader, getSystemLoader, getFilename } ;
33
+ module . exports . normalizeFilePath = function ( filePath ) {
34
+ if ( os . platform ( ) === 'win32' ) {
35
+ return newPath . replace ( / \/ / g, '\\\\' ) ;
36
+ }
37
+
38
+ return filePath ;
39
+ }
0 commit comments