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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 final String _entryPath; | 203 final String _entryPath; |
204 | 204 |
205 factory DevServer(CompilerOptions options) { | 205 factory DevServer(CompilerOptions options) { |
206 assert(options.inputs.length == 1); | 206 assert(options.inputs.length == 1); |
207 | 207 |
208 var fileResolvers = createFileResolvers(options.sourceOptions); | 208 var fileResolvers = createFileResolvers(options.sourceOptions); |
209 if (options.sourceOptions.useImplicitHtml) { | 209 if (options.sourceOptions.useImplicitHtml) { |
210 fileResolvers.insert(0, _createImplicitEntryResolver(options.inputs[0])); | 210 fileResolvers.insert(0, _createImplicitEntryResolver(options.inputs[0])); |
211 } | 211 } |
212 | 212 |
213 var context = createAnalysisContextWithSources( | 213 var context = createAnalysisContextWithSources(options.sourceOptions, |
214 options.strongOptions, options.sourceOptions, | |
215 fileResolvers: fileResolvers); | 214 fileResolvers: fileResolvers); |
216 | 215 |
217 var entryPath = path.basename(options.inputs[0]); | 216 var entryPath = path.basename(options.inputs[0]); |
218 var extension = path.extension(entryPath); | 217 var extension = path.extension(entryPath); |
219 if (extension != '.html' && !options.sourceOptions.useImplicitHtml) { | 218 if (extension != '.html' && !options.sourceOptions.useImplicitHtml) { |
220 print('error: devc in server mode requires an HTML or Dart entry point.'); | 219 print('error: devc in server mode requires an HTML or Dart entry point.'); |
221 exit(1); | 220 exit(1); |
222 } | 221 } |
223 | 222 |
224 // TODO(sigmund): allow running without a dir, but keep output in memory? | 223 // TODO(sigmund): allow running without a dir, but keep output in memory? |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 301 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
303 var src = resolver.resolveAbsolute(uri, actualUri); | 302 var src = resolver.resolveAbsolute(uri, actualUri); |
304 return src.exists() ? src : null; | 303 return src.exists() ? src : null; |
305 } | 304 } |
306 | 305 |
307 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); | 306 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); |
308 } | 307 } |
309 | 308 |
310 final _log = new Logger('dev_compiler.src.server'); | 309 final _log = new Logger('dev_compiler.src.server'); |
311 final _earlyErrorResult = new CheckerResults(const [], true); | 310 final _earlyErrorResult = new CheckerResults(const [], true); |
OLD | NEW |