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 compiler; | 5 library compiler; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection' show SplayTreeMap; | 8 import 'dart:collection' show SplayTreeMap; |
9 import 'dart:json' as json; | 9 import 'dart:convert'; |
10 import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, Ur
iBasedDirective; | 10 import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, Ur
iBasedDirective; |
11 import 'package:csslib/visitor.dart' show StyleSheet, treeToDebugString; | 11 import 'package:csslib/visitor.dart' show StyleSheet, treeToDebugString; |
12 import 'package:html5lib/dom.dart'; | 12 import 'package:html5lib/dom.dart'; |
13 import 'package:html5lib/parser.dart'; | 13 import 'package:html5lib/parser.dart'; |
14 import 'package:source_maps/span.dart' show Span; | 14 import 'package:source_maps/span.dart' show Span; |
15 | 15 |
16 import 'analyzer.dart'; | 16 import 'analyzer.dart'; |
17 import 'code_printer.dart'; | 17 import 'code_printer.dart'; |
18 import 'dart_parser.dart'; | 18 import 'dart_parser.dart'; |
19 import 'emitters.dart'; | 19 import 'emitters.dart'; |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 if (printer == null) return; | 754 if (printer == null) return; |
755 | 755 |
756 var libPath = _pathMapper.outputLibraryPath(lib); | 756 var libPath = _pathMapper.outputLibraryPath(lib); |
757 var dir = path.dirname(libPath); | 757 var dir = path.dirname(libPath); |
758 var filename = path.basename(libPath); | 758 var filename = path.basename(libPath); |
759 printer.add('\n//# sourceMappingURL=$filename.map'); | 759 printer.add('\n//# sourceMappingURL=$filename.map'); |
760 printer.build(libPath); | 760 printer.build(libPath); |
761 var sourcePath = dartCodeUrl != null ? dartCodeUrl.resolvedPath : null; | 761 var sourcePath = dartCodeUrl != null ? dartCodeUrl.resolvedPath : null; |
762 output.add(new OutputFile(libPath, printer.text, source: sourcePath)); | 762 output.add(new OutputFile(libPath, printer.text, source: sourcePath)); |
763 // Fix-up the paths in the source map file | 763 // Fix-up the paths in the source map file |
764 var sourceMap = json.parse(printer.map); | 764 var sourceMap = JSON.decode(printer.map); |
765 var urls = sourceMap['sources']; | 765 var urls = sourceMap['sources']; |
766 for (int i = 0; i < urls.length; i++) { | 766 for (int i = 0; i < urls.length; i++) { |
767 urls[i] = path.relative(urls[i], from: dir); | 767 urls[i] = path.relative(urls[i], from: dir); |
768 } | 768 } |
769 output.add(new OutputFile(path.join(dir, '$filename.map'), | 769 output.add(new OutputFile(path.join(dir, '$filename.map'), |
770 json.stringify(sourceMap))); | 770 JSON.encode(sourceMap))); |
771 } | 771 } |
772 | 772 |
773 _time(String logMessage, String filePath, callback(), | 773 _time(String logMessage, String filePath, callback(), |
774 {bool printTime: false}) { | 774 {bool printTime: false}) { |
775 var message = new StringBuffer(); | 775 var message = new StringBuffer(); |
776 message.write(logMessage); | 776 message.write(logMessage); |
777 var filename = path.basename(filePath); | 777 var filename = path.basename(filePath); |
778 for (int i = (60 - logMessage.length - filename.length); i > 0 ; i--) { | 778 for (int i = (60 - logMessage.length - filename.length); i > 0 ; i--) { |
779 message.write(' '); | 779 message.write(' '); |
780 } | 780 } |
(...skipping 28 matching lines...) Expand all Loading... |
809 | 809 |
810 import 'package:web_ui/watcher.dart' as watcher; | 810 import 'package:web_ui/watcher.dart' as watcher; |
811 import '$userMainImport' as userMain; | 811 import '$userMainImport' as userMain; |
812 | 812 |
813 main() { | 813 main() { |
814 watcher.useObservers = $useObservers; | 814 watcher.useObservers = $useObservers; |
815 userMain.main(); | 815 userMain.main(); |
816 userMain.init_autogenerated(); | 816 userMain.init_autogenerated(); |
817 } | 817 } |
818 """; | 818 """; |
OLD | NEW |