OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library web_components.test.build.import_crawler_test; | 4 library web_components.test.build.import_crawler_test; |
5 | 5 |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:barback/barback.dart'; | 7 import 'package:barback/barback.dart'; |
8 import 'package:code_transformers/tests.dart'; | 8 import 'package:code_transformers/tests.dart'; |
9 import 'package:code_transformers/messages/build_logger.dart'; | 9 import 'package:code_transformers/messages/build_logger.dart'; |
10 import 'package:html5lib/dom.dart' show Document; | 10 import 'package:html5lib/dom.dart' show Document; |
(...skipping 16 matching lines...) Expand all Loading... |
27 if (_preParseDocument) { | 27 if (_preParseDocument) { |
28 return primaryInput.readAsString().then((html) { | 28 return primaryInput.readAsString().then((html) { |
29 var document = parseHtml(html, primaryInput.id.path); | 29 var document = parseHtml(html, primaryInput.id.path); |
30 return crawlDocument(transform, logger, document); | 30 return crawlDocument(transform, logger, document); |
31 }); | 31 }); |
32 } else { | 32 } else { |
33 return crawlDocument(transform, logger); | 33 return crawlDocument(transform, logger); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 Future crawlDocument( | 37 Future crawlDocument(Transform transform, BuildLogger logger, |
38 Transform transform, BuildLogger logger, [Document document]) { | 38 [Document document]) { |
39 var primaryInput = transform.primaryInput; | 39 var primaryInput = transform.primaryInput; |
40 var crawler = new ImportCrawler( | 40 var crawler = new ImportCrawler(transform, primaryInput.id, logger, |
41 transform, primaryInput.id, logger, primaryDocument: document); | 41 primaryDocument: document); |
42 return crawler.crawlImports().then((docs) { | 42 return crawler.crawlImports().then((docs) { |
43 documents = docs; | 43 documents = docs; |
44 transform.addOutput(new Asset.fromString( | 44 transform.addOutput(new Asset.fromString( |
45 new AssetId('a', 'web/result.txt'), '${documents.keys}')); | 45 new AssetId('a', 'web/result.txt'), '${documents.keys}')); |
46 }); | 46 }); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 main() { | 50 main() { |
51 useCompactVMConfiguration(); | 51 useCompactVMConfiguration(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 <link rel="import" href="three/zap.html"> | 108 <link rel="import" href="three/zap.html"> |
109 <div>a|lib/one/two/baz.html</div>''', | 109 <div>a|lib/one/two/baz.html</div>''', |
110 'a|lib/one/two/three/zap.html': ''' | 110 'a|lib/one/two/three/zap.html': ''' |
111 <div>a|lib/one/two/three/zap.html</div>''', | 111 <div>a|lib/one/two/three/zap.html</div>''', |
112 }, { | 112 }, { |
113 'a|web/result.txt': | 113 'a|web/result.txt': |
114 '(a|lib/one/two/three/zap.html, a|lib/one/two/baz.html, ' | 114 '(a|lib/one/two/three/zap.html, a|lib/one/two/baz.html, ' |
115 'a|lib/one/bar.html, a|lib/foo.html, a|web/index.html)', | 115 'a|lib/one/bar.html, a|lib/foo.html, a|web/index.html)', |
116 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); | 116 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
117 } | 117 } |
OLD | NEW |