1
+ 'use strict' ;
1
2
var fs = require ( 'fs' ) ;
2
3
var path = require ( 'path' ) ;
3
4
@@ -12,28 +13,38 @@ var BroccoliSass = require('broccoli-sass');
12
13
var broccoliAutoprefixer = require ( 'broccoli-autoprefixer' ) ;
13
14
14
15
const BroccoliTs2Dart = require ( './tools/broccoli/broccoli-ts2dart' ) . default ;
15
- const BroccoliDestCopy = require ( './tools/broccoli/broccoli-dest-copy' ) . default ;
16
16
const BroccoliDartFmt = require ( './tools/broccoli/broccoli-dartfmt' ) . default ;
17
17
const BroccoliFunnel = require ( 'broccoli-funnel' ) ;
18
- const BroccoliSource = require ( 'broccoli-source' ) ;
19
18
20
19
var autoprefixerOptions = require ( './build/autoprefixer-options' ) ;
21
20
21
+ /**
22
+ * Almost the same as using a plain string for a tree; but unlike a plain
23
+ * string, Broccoli won't watch this. Used only internally.
24
+ */
25
+ class UnwatchedTree {
26
+ constructor ( dir ) { this . dir = dir ; }
27
+ read ( ) { return this . dir ; }
28
+ cleanup ( ) { /* DoNothing */ }
29
+ }
30
+
31
+
22
32
module . exports = function ( defaults ) {
23
33
var demoAppCssTree = new BroccoliSass ( [ 'src/demo-app' ] , './demo-app.scss' , 'demo-app/demo-app.css' ) ;
24
34
var demoCssTree = getCssTree ( 'demo-app' ) ;
25
35
var componentCssTree = getCssTree ( 'components' ) ;
26
36
var mainCssTree = new BroccoliSass ( [ 'src' , 'src/core/style' ] , './main.scss' , 'main.css' ) ;
27
- var angularAppTree = new Angular2App ( defaults ) ;
37
+ var angularAppTree = new Angular2App ( defaults , {
38
+ vendorNpmFiles : [ ]
39
+ } ) ;
28
40
29
41
var dartAppTree = getDartTree ( 'src/' ) ;
30
-
31
42
return mergeTrees ( [
32
43
angularAppTree . toTree ( ) ,
33
44
componentCssTree ,
34
45
mainCssTree ,
35
46
demoAppCssTree ,
36
- demoCssTree ,
47
+ demoCssTree
37
48
] . concat ( dartAppTree || [ ] ) ) ;
38
49
} ;
39
50
@@ -50,15 +61,16 @@ function getDartTree(root) {
50
61
return null ;
51
62
}
52
63
53
- const ts2dart = new BroccoliTs2Dart ( root , {
64
+ const ts2dart = new BroccoliTs2Dart ( [ root ] , {
54
65
generateLibraryName : true ,
55
66
generateSourceMap : false ,
56
67
translateBuiltins : true ,
57
- typingsRoot : '../../typings/browser/ambient/' ,
58
- additionalFiles : [ path . join ( process . cwd ( ) , root , 'typings.d.ts' ) ] ,
68
+ basePath : path . join ( __dirname , root ) ,
69
+ typingsRoot : '../typings/browser/ambient/' ,
70
+ additionalFiles : [ path . join ( process . cwd ( ) , root , 'typings.d.ts' ) ]
59
71
} ) ;
60
72
61
- const formatter = new BroccoliDartFmt ( ts2dart , { dartSDK } ) ;
73
+ const formatter = new BroccoliDartFmt ( [ ts2dart ] , { dartSDK } ) ;
62
74
63
75
const dartSources = new BroccoliFunnel ( root , {
64
76
include : [ '**/*.dart' ] ,
@@ -70,16 +82,16 @@ function getDartTree(root) {
70
82
formatter
71
83
] ) ;
72
84
73
- const pubSpecTree = new BroccoliFunnel ( new BroccoliSource . UnwatchedDir ( '.' ) , {
85
+ const pubSpecTree = new BroccoliFunnel ( new UnwatchedTree ( '.' ) , {
74
86
files : [ 'pubspec.yaml' ] ,
75
- destDir : 'dart' ,
87
+ destDir : 'dart'
76
88
} ) ;
77
89
78
90
// Publishes the Dart files and pubspec inside a
79
91
return mergeTrees ( [
80
- dartSources ,
81
92
pubSpecTree ,
82
- new BroccoliDestCopy ( formatter , 'dart/lib' ) ,
93
+ new BroccoliFunnel ( formatter , { destDir : 'dart/lib' } ) ,
94
+ allDartFiles
83
95
] ) ;
84
96
}
85
97
0 commit comments