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 | 4 |
5 /// Development server that compiles Dart to JS on the fly. | 5 /// Development server that compiles Dart to JS on the fly. |
6 library dev_compiler.src.server; | 6 library dev_compiler.src.server; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return new _ExistingSourceUriResolver(new ResourceUriResolver(provider)); | 292 return new _ExistingSourceUriResolver(new ResourceUriResolver(provider)); |
293 } | 293 } |
294 | 294 |
295 /// A UriResolver that continues to the next one if it fails to find an existing | 295 /// A UriResolver that continues to the next one if it fails to find an existing |
296 /// source file. This is unlike normal URI resolvers, that always return | 296 /// source file. This is unlike normal URI resolvers, that always return |
297 /// something, even if it is a non-existing file. | 297 /// something, even if it is a non-existing file. |
298 class _ExistingSourceUriResolver implements UriResolver { | 298 class _ExistingSourceUriResolver implements UriResolver { |
299 final UriResolver resolver; | 299 final UriResolver resolver; |
300 _ExistingSourceUriResolver(this.resolver); | 300 _ExistingSourceUriResolver(this.resolver); |
301 | 301 |
302 Source resolveAbsolute(Uri uri) { | 302 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
303 var src = resolver.resolveAbsolute(uri); | 303 var src = resolver.resolveAbsolute(uri, actualUri); |
304 return src.exists() ? src : null; | 304 return src.exists() ? src : null; |
305 } | 305 } |
306 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); | 306 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); |
307 } | 307 } |
308 | 308 |
309 final _log = new Logger('dev_compiler.src.server'); | 309 final _log = new Logger('dev_compiler.src.server'); |
310 final _earlyErrorResult = new CheckerResults(const [], null, true); | 310 final _earlyErrorResult = new CheckerResults(const [], null, true); |
OLD | NEW |