@@ -18,7 +18,17 @@ function Angular2App(defaults, options, additionalPaths) {
18
18
}
19
19
20
20
Angular2App . prototype . toTree = function ( ) {
21
- var sourceTree = 'src' ;
21
+ var sourceDir = 'src' ;
22
+
23
+ var sourceTree = new Funnel ( 'src' , {
24
+ destDir : 'src'
25
+ } ) ;
26
+
27
+ var typingsTree = new Funnel ( 'typings' , {
28
+ include : [ 'browser.d.ts' , 'browser/**' ] ,
29
+ destDir : 'typings'
30
+ } ) ;
31
+
22
32
var vendorNpmFiles = [
23
33
'systemjs/dist/system-polyfills.js' ,
24
34
'systemjs/dist/system.src.js' ,
@@ -31,28 +41,50 @@ Angular2App.prototype.toTree = function() {
31
41
'angular2/bundles/upgrade.dev.js'
32
42
] ;
33
43
44
+
45
+
34
46
if ( this . options && this . options . vendorNpmFiles ) {
35
47
vendorNpmFiles = vendorNpmFiles . concat ( this . options . vendorNpmFiles ) ;
36
48
}
37
49
38
- var tsConfigCompilerOptions = JSON . parse ( fs . readFileSync ( 'src/tsconfig.json' , 'utf-8' ) ) . compilerOptions ;
39
- tsConfigCompilerOptions . rootFilePaths = [ 'typings.d.ts' ] . concat ( this . additionalPaths )
40
- . map ( function ( name ) {
41
- return path . join ( process . cwd ( ) , sourceTree , name )
50
+ var tsconfig = JSON . parse ( fs . readFileSync ( 'src/tsconfig.json' , 'utf-8' ) ) ;
51
+ var tsConfigCompilerOptions = tsconfig . compilerOptions ;
52
+
53
+
54
+ // TODO(i): why do we need these additional paths? remove?
55
+ tsConfigCompilerOptions . rootFilePaths = this . additionalPaths . map ( function ( name ) {
56
+ return path . join ( process . cwd ( ) , sourceDir , name )
42
57
} ) ;
43
58
44
- var tsTree = compileWithTypescript ( sourceTree , tsConfigCompilerOptions ) ;
45
- var tsSrcTree = new Funnel ( sourceTree , {
59
+ // TODO(i): kill rootFilePaths in broccoli-typescript and use tsconfig.json#files instead
60
+ tsConfigCompilerOptions . rootFilePaths = tsConfigCompilerOptions . rootFilePaths .
61
+ concat ( tsconfig . files . map ( function ( p ) {
62
+ // TODO(i): this is a hack - for some reason we need to prefix all paths with srcDir because
63
+ // tsc's "rootDir" doesn't take effect when resolving "files" paths
64
+ return path . join ( sourceDir , p ) ;
65
+ } ) ) ;
66
+
67
+
68
+ var srcAndTypingsTree = mergeTrees ( [ sourceTree , typingsTree ] ) ;
69
+
70
+ var tsTree = compileWithTypescript ( srcAndTypingsTree , tsConfigCompilerOptions ) ;
71
+
72
+ tsTree = new Funnel ( tsTree , {
73
+ srcDir : 'src' ,
74
+ exclude : [ '*.d.ts' , 'tsconfig.json' ]
75
+ } ) ;
76
+
77
+ var tsSrcTree = new Funnel ( sourceDir , {
46
78
include : [ '**/*.ts' ] ,
47
79
allowEmpty : true
48
80
} ) ;
49
81
50
- var jsTree = new Funnel ( sourceTree , {
82
+ var jsTree = new Funnel ( sourceDir , {
51
83
include : [ '**/*.js' ] ,
52
84
allowEmpty : true
53
85
} ) ;
54
86
55
- var assetTree = new Funnel ( sourceTree , {
87
+ var assetTree = new Funnel ( sourceDir , {
56
88
include : [ '**/*.*' ] ,
57
89
exclude : [ '**/*.ts' , '**/*.js' ] ,
58
90
allowEmpty : true
0 commit comments