Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: lib/src/server/server.dart

Issue 1530133003: Support source maps in server mode (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Address comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/codegen/js_printer.dart ('k') | test/codegen/expect/collection/src/unmodifiable_wrappers.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/server/server.dart
diff --git a/lib/src/server/server.dart b/lib/src/server/server.dart
index df162c7901df507c079cd6f03b158f5b7e5eb87b..555bcedf1ca60a23e51e3f0324e50589c6738530 100644
--- a/lib/src/server/server.dart
+++ b/lib/src/server/server.dart
@@ -134,6 +134,7 @@ class ServerCompiler extends AbstractCompiler {
}
void _buildDartLibrary(DartSourceNode node) {
+ print('Compiling ${node.uri}');
var source = node.source;
// TODO(sigmund): find out from analyzer team if there is a better way
context.applyChanges(new ChangeSet()..changedSource(source));
@@ -253,10 +254,22 @@ class DevServer {
var out = new Directory(outDir);
if (!await out.exists()) await out.create(recursive: true);
+ var mainHandler =
+ shelf_static.createStaticHandler(outDir, defaultDocument: _entryPath);
+ var sourceHandler = shelf_static.createStaticHandler(compiler.inputBaseDir,
+ serveFilesOutsidePath: true);
+ var topLevelHandler = (shelf.Request request) {
+ var path = request.url.path;
+ if (path.endsWith('.dart')) {
+ return sourceHandler(request);
+ } else {
+ return mainHandler(request);
+ }
+ };
+
var handler = const shelf.Pipeline()
.addMiddleware(rebuildAndCache)
- .addHandler(shelf_static.createStaticHandler(outDir,
- defaultDocument: _entryPath));
+ .addHandler(topLevelHandler);
await shelf.serve(handler, host, port);
print('Serving $_entryPath at http://$host:$port/');
// Give the compiler a head start. This is not needed for correctness,
@@ -267,7 +280,6 @@ class DevServer {
}
shelf.Handler rebuildAndCache(shelf.Handler handler) => (request) {
- print('requested $GREEN_COLOR${request.url}$NO_COLOR');
// Trigger recompile only when requesting the HTML page.
var segments = request.url.pathSegments;
bool isEntryPage = segments.length == 0 || segments[0] == _entryPath;
« no previous file with comments | « lib/src/codegen/js_printer.dart ('k') | test/codegen/expect/collection/src/unmodifiable_wrappers.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698