| 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 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 212 } |
| 213 | 213 |
| 214 class DevServer { | 214 class DevServer { |
| 215 final ServerCompiler compiler; | 215 final ServerCompiler compiler; |
| 216 final String outDir; | 216 final String outDir; |
| 217 final String host; | 217 final String host; |
| 218 final int port; | 218 final int port; |
| 219 final String _entryPath; | 219 final String _entryPath; |
| 220 | 220 |
| 221 factory DevServer(CompilerOptions options) { | 221 factory DevServer(CompilerOptions options) { |
| 222 assert(options.inputs.length == 1); | 222 assert(options.inputs.isNotEmpty); |
| 223 | 223 |
| 224 var fileResolvers = createFileResolvers(options.sourceOptions); | 224 var fileResolvers = createFileResolvers(options.sourceOptions); |
| 225 if (options.sourceOptions.useImplicitHtml) { | 225 if (options.sourceOptions.useImplicitHtml) { |
| 226 fileResolvers.insert(0, _createImplicitEntryResolver(options.inputs[0])); | 226 fileResolvers.insert(0, _createImplicitEntryResolver(options.inputs[0])); |
| 227 } | 227 } |
| 228 | 228 |
| 229 var context = createAnalysisContextWithSources(options.sourceOptions, | 229 var context = createAnalysisContextWithSources(options.sourceOptions, |
| 230 fileResolvers: fileResolvers); | 230 fileResolvers: fileResolvers); |
| 231 | 231 |
| 232 var entryPath = path.basename(options.inputs[0]); | 232 var entryPath = path.basename(options.inputs[0]); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 331 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 332 var src = resolver.resolveAbsolute(uri, actualUri); | 332 var src = resolver.resolveAbsolute(uri, actualUri); |
| 333 return src.exists() ? src : null; | 333 return src.exists() ? src : null; |
| 334 } | 334 } |
| 335 | 335 |
| 336 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); | 336 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); |
| 337 } | 337 } |
| 338 | 338 |
| 339 final _log = new Logger('dev_compiler.src.server'); | 339 final _log = new Logger('dev_compiler.src.server'); |
| 340 final _earlyErrorResult = new CheckerResults(const [], true); | 340 final _earlyErrorResult = new CheckerResults(const [], true); |
| OLD | NEW |