OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library files; | 5 library files; |
6 | 6 |
7 import 'package:html5lib/dom.dart'; | 7 import 'package:html5lib/dom.dart'; |
8 import 'file_system/path.dart'; | 8 import 'file_system/path.dart'; |
9 import 'info.dart'; | 9 import 'info.dart'; |
10 | 10 |
11 /** An input file to process by the template compiler. */ | 11 /** An input file to process by the template compiler. */ |
12 class SourceFile { | 12 class SourceFile { |
| 13 static const int HTML = 1; |
| 14 static const int DART = 2; |
| 15 static const int STYLESHEET = 3; |
| 16 |
13 final Path path; | 17 final Path path; |
| 18 final int type; |
14 | 19 |
15 final bool isDart; | |
16 Document document; | 20 Document document; |
| 21 |
| 22 /** Dart code or contents of a linked style sheet. */ |
17 String code; | 23 String code; |
18 | 24 |
19 SourceFile(this.path, {this.isDart: false}); | 25 SourceFile(this.path, {this.type: HTML}); |
| 26 |
| 27 bool get isDart => type == DART; |
| 28 bool get isHtml => type == HTML; |
| 29 bool get isStyleSheet => type == STYLESHEET; |
20 | 30 |
21 String toString() => "<#SourceFile $path>"; | 31 String toString() => "<#SourceFile $path>"; |
22 } | 32 } |
23 | 33 |
24 /** An output file to generated by the template compiler. */ | 34 /** An output file to generated by the template compiler. */ |
25 class OutputFile { | 35 class OutputFile { |
26 final Path path; | 36 final Path path; |
27 final String contents; | 37 final String contents; |
28 | 38 |
29 /** | 39 /** |
30 * Path to the source file that was transformed into this OutputFile, `null` | 40 * Path to the source file that was transformed into this OutputFile, `null` |
31 * for files that are generated and do not correspond to an input | 41 * for files that are generated and do not correspond to an input |
32 * [SourceFile]. | 42 * [SourceFile]. |
33 */ | 43 */ |
34 final Path source; | 44 final Path source; |
35 | 45 |
36 OutputFile(this.path, this.contents, {Path source}) | 46 OutputFile(this.path, this.contents, {Path source}) |
37 : source = source; | 47 : source = source; |
38 } | 48 } |
OLD | NEW |