OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.translate_uri; | 5 library fasta.translate_uri; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'package:front_end/file_system.dart'; | 9 import 'package:front_end/file_system.dart'; |
10 import 'package:package_config/packages_file.dart' as packages_file show parse; | 10 import 'package:package_config/packages_file.dart' as packages_file show parse; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 sdk.resolve("lib/_internal/js_runtime/lib/js_primitives.dart"), | 68 sdk.resolve("lib/_internal/js_runtime/lib/js_primitives.dart"), |
69 "_metadata": sdk.resolve("lib/html/html_common/metadata.dart"), | 69 "_metadata": sdk.resolve("lib/html/html_common/metadata.dart"), |
70 "_native_typed_data": | 70 "_native_typed_data": |
71 sdk.resolve("lib/_internal/js_runtime/lib/native_typed_data.dart"), | 71 sdk.resolve("lib/_internal/js_runtime/lib/native_typed_data.dart"), |
72 "_vmservice": sdk.resolve("lib/vmservice/vmservice.dart"), | 72 "_vmservice": sdk.resolve("lib/vmservice/vmservice.dart"), |
73 "async": sdk.resolve("lib/async/async.dart"), | 73 "async": sdk.resolve("lib/async/async.dart"), |
74 "collection": sdk.resolve("lib/collection/collection.dart"), | 74 "collection": sdk.resolve("lib/collection/collection.dart"), |
75 "convert": sdk.resolve("lib/convert/convert.dart"), | 75 "convert": sdk.resolve("lib/convert/convert.dart"), |
76 "core": sdk.resolve("lib/core/core.dart"), | 76 "core": sdk.resolve("lib/core/core.dart"), |
77 "developer": sdk.resolve("lib/developer/developer.dart"), | 77 "developer": sdk.resolve("lib/developer/developer.dart"), |
78 "html": sdk.resolve("lib/html/dartium/html_dartium.dart"), | 78 "html": sdk.resolve("lib/html/dart2js/html_dart2js.dart"), |
79 "html_common": sdk.resolve("lib/html/html_common/html_common.dart"), | 79 "html_common": |
| 80 sdk.resolve("lib/html/html_common/html_common_dart2js.dart"), |
80 "indexed_db": | 81 "indexed_db": |
81 sdk.resolve("lib/indexed_db/dartium/indexed_db_dartium.dart"), | 82 sdk.resolve("lib/indexed_db/dart2js/indexed_db_dart2js.dart"), |
82 "io": sdk.resolve("lib/io/io.dart"), | 83 "io": sdk.resolve("lib/io/io.dart"), |
83 "isolate": sdk.resolve("lib/isolate/isolate.dart"), | 84 "isolate": sdk.resolve("lib/isolate/isolate.dart"), |
84 "js": sdk.resolve("lib/js/dartium/js_dartium.dart"), | 85 "js": sdk.resolve("lib/js/dart2js/js_dart2js.dart"), |
85 "js_util": sdk.resolve("lib/js_util/dartium/js_util_dartium.dart"), | 86 "js_util": sdk.resolve("lib/js_util/dart2js/js_util_dart2js.dart"), |
86 "math": sdk.resolve("lib/math/math.dart"), | 87 "math": sdk.resolve("lib/math/math.dart"), |
87 "mirrors": sdk.resolve("lib/mirrors/mirrors.dart"), | 88 "mirrors": sdk.resolve("lib/mirrors/mirrors.dart"), |
88 "nativewrappers": sdk.resolve("lib/html/dartium/nativewrappers.dart"), | 89 "nativewrappers": sdk.resolve("lib/html/dartium/nativewrappers.dart"), |
89 "profiler": sdk.resolve("lib/profiler/profiler.dart"), | 90 "profiler": sdk.resolve("lib/profiler/profiler.dart"), |
90 "svg": sdk.resolve("lib/svg/dartium/svg_dartium.dart"), | 91 "svg": sdk.resolve("lib/svg/dart2js/svg_dart2js.dart"), |
91 "typed_data": sdk.resolve("lib/typed_data/typed_data.dart"), | 92 "typed_data": sdk.resolve("lib/typed_data/typed_data.dart"), |
92 "vmservice_io": sdk.resolve("lib/vmservice_io/vmservice_io.dart"), | 93 "vmservice_io": sdk.resolve("lib/vmservice_io/vmservice_io.dart"), |
93 "web_audio": | 94 "web_audio": |
94 sdk.resolve("lib/web_audio/dartium/web_audio_dartium.dart"), | 95 sdk.resolve("lib/web_audio/dart2js/web_audio_dart2js.dart"), |
95 "web_gl": sdk.resolve("lib/web_gl/dartium/web_gl_dartium.dart"), | 96 "web_gl": sdk.resolve("lib/web_gl/dart2js/web_gl_dart2js.dart"), |
96 "web_sql": sdk.resolve("lib/web_sql/dartium/web_sql_dartium.dart"), | 97 "web_sql": sdk.resolve("lib/web_sql/dart2js/web_sql_dart2js.dart"), |
97 }; | 98 }; |
98 } | 99 } |
99 uri ??= Uri.base.resolve(".packages"); | 100 uri ??= Uri.base.resolve(".packages"); |
100 | 101 |
101 List<int> bytes; | 102 List<int> bytes; |
102 try { | 103 try { |
103 bytes = await fileSystem.entityForUri(uri).readAsBytes(); | 104 bytes = await fileSystem.entityForUri(uri).readAsBytes(); |
104 } on FileSystemException catch (e) { | 105 } on FileSystemException catch (e) { |
105 inputError(uri, -1, e.message); | 106 inputError(uri, -1, e.message); |
106 } | 107 } |
107 | 108 |
108 Map<String, Uri> packages = const <String, Uri>{}; | 109 Map<String, Uri> packages = const <String, Uri>{}; |
109 try { | 110 try { |
110 packages = packages_file.parse(bytes, uri); | 111 packages = packages_file.parse(bytes, uri); |
111 } on FormatException catch (e) { | 112 } on FormatException catch (e) { |
112 return inputError(uri, e.offset, e.message); | 113 return inputError(uri, e.offset, e.message); |
113 } | 114 } |
114 return new TranslateUri(packages, dartLibraries); | 115 return new TranslateUri(packages, dartLibraries); |
115 } | 116 } |
116 } | 117 } |
OLD | NEW |