OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Transfomer used for pub-serve and pub-deploy. | 5 /// Transfomer used for pub-serve and pub-deploy. |
6 library polymer.transformer; | 6 library polymer.transformer; |
7 | 7 |
8 import 'package:barback/barback.dart'; | 8 import 'package:barback/barback.dart'; |
9 import 'package:observe/transformer.dart'; | 9 import 'package:observe/transformer.dart'; |
10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
11 | 11 |
12 import 'src/build/build_filter.dart'; | 12 import 'src/build/build_filter.dart'; |
13 import 'src/build/common.dart'; | 13 import 'src/build/common.dart'; |
| 14 import 'src/build/index_page_builder.dart'; |
14 import 'src/build/import_inliner.dart'; | 15 import 'src/build/import_inliner.dart'; |
15 import 'src/build/linter.dart'; | 16 import 'src/build/linter.dart'; |
16 import 'src/build/build_log_combiner.dart'; | 17 import 'src/build/build_log_combiner.dart'; |
17 import 'src/build/polyfill_injector.dart'; | 18 import 'src/build/polyfill_injector.dart'; |
18 import 'src/build/script_compactor.dart'; | 19 import 'src/build/script_compactor.dart'; |
19 | 20 |
20 /// The Polymer transformer, which internally runs several phases that will: | 21 /// The Polymer transformer, which internally runs several phases that will: |
21 /// * Extract inlined script tags into their separate files | 22 /// * Extract inlined script tags into their separate files |
22 /// * Apply the observable transformer on every Dart script. | 23 /// * Apply the observable transformer on every Dart script. |
23 /// * Inline imported html files | 24 /// * Inline imported html files |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 /// Create deploy phases for Polymer. Note that inlining HTML Imports | 112 /// Create deploy phases for Polymer. Note that inlining HTML Imports |
112 /// comes first (other than linter, if [options.linter] is enabled), which | 113 /// comes first (other than linter, if [options.linter] is enabled), which |
113 /// allows the rest of the HTML-processing phases to operate only on HTML that | 114 /// allows the rest of the HTML-processing phases to operate only on HTML that |
114 /// is actually imported. | 115 /// is actually imported. |
115 List<List<Transformer>> createDeployPhases( | 116 List<List<Transformer>> createDeployPhases( |
116 TransformOptions options, {String sdkDir}) { | 117 TransformOptions options, {String sdkDir}) { |
117 // TODO(sigmund): this should be done differently. We should lint everything | 118 // TODO(sigmund): this should be done differently. We should lint everything |
118 // that is reachable and have the option to lint the rest (similar to how | 119 // that is reachable and have the option to lint the rest (similar to how |
119 // dart2js can analyze reachable code or entire libraries). | 120 // dart2js can analyze reachable code or entire libraries). |
120 var phases = options.lint ? [[new Linter(options)]] : []; | 121 var phases = options.lint ? [[new Linter(options)]] : []; |
121 return phases..addAll([ | 122 phases.addAll([ |
122 [new ImportInliner(options)], | 123 [new ImportInliner(options)], |
123 [new ObservableTransformer()], | 124 [new ObservableTransformer()], |
124 [new ScriptCompactor(options, sdkDir: sdkDir)], | 125 [new ScriptCompactor(options, sdkDir: sdkDir)], |
125 [new PolyfillInjector(options)], | 126 [new PolyfillInjector(options)], |
126 [new BuildFilter(options)], | 127 [new BuildFilter(options)], |
127 [new BuildLogCombiner(options)], | 128 [new BuildLogCombiner(options)], |
128 ]); | 129 ]); |
| 130 if (!options.releaseMode) { |
| 131 phases.add([new IndexPageBuilder(options)]); |
| 132 } |
| 133 return phases; |
129 } | 134 } |
130 | 135 |
131 final RegExp _PACKAGE_PATH_REGEX = new RegExp(r'packages\/([^\/]+)\/(.*)'); | 136 final RegExp _PACKAGE_PATH_REGEX = new RegExp(r'packages\/([^\/]+)\/(.*)'); |
OLD | NEW |