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

Side by Side Diff: lib/src/codegen/html_codegen.dart

Issue 1131143002: Angular workarounds (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase on latest Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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 library dev_compiler.src.codegen.html_codegen; 5 library dev_compiler.src.codegen.html_codegen;
6 6
7 import 'package:html/dom.dart'; 7 import 'package:html/dom.dart';
8 import 'package:html/parser.dart' show parseFragment; 8 import 'package:html/parser.dart' show parseFragment;
9 import 'package:logging/logging.dart' show Logger; 9 import 'package:logging/logging.dart' show Logger;
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 parseFragment('<script src="$jsUrl"></script>\n'); 83 parseFragment('<script src="$jsUrl"></script>\n');
84 84
85 /// A tag that loads the .css code. 85 /// A tag that loads the .css code.
86 Node _cssInclude(String cssUrl) => 86 Node _cssInclude(String cssUrl) =>
87 parseFragment('<link rel="stylesheet" href="$cssUrl">\n'); 87 parseFragment('<link rel="stylesheet" href="$cssUrl">\n');
88 88
89 /// A script tag that invokes the main function on the entry point library. 89 /// A script tag that invokes the main function on the entry point library.
90 Node _invokeMain(String mainLibraryName) { 90 Node _invokeMain(String mainLibraryName) {
91 var code = mainLibraryName == null 91 var code = mainLibraryName == null
92 ? 'console.error("dev_compiler error: main was not generated");' 92 ? 'console.error("dev_compiler error: main was not generated");'
93 : '$mainLibraryName.main();'; 93 // TODO(vsm): Can we simplify this?
94 // See: https://github.com/dart-lang/dev_compiler/issues/164
95 : '_isolate_helper.startRootIsolate($mainLibraryName.main, []);';
94 return parseFragment('<script>$code</script>\n'); 96 return parseFragment('<script>$code</script>\n');
95 } 97 }
96 98
97 /// Convert the outputPath to include the hash in it. This function is the 99 /// Convert the outputPath to include the hash in it. This function is the
98 /// reverse of what the server does to determine whether a request needs to have 100 /// reverse of what the server does to determine whether a request needs to have
99 /// cache headers added to it. 101 /// cache headers added to it.
100 _addHash(String outPath, String hash) { 102 _addHash(String outPath, String hash) {
101 return path.join('cached', hash, outPath); 103 return path.join('cached', hash, outPath);
102 } 104 }
103 105
104 final _log = new Logger('dev_compiler.src.codegen.html_codegen'); 106 final _log = new Logger('dev_compiler.src.codegen.html_codegen');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698