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

Side by Side Diff: lib/build/script_compactor.dart

Issue 950883003: fix bug in scriptcompactors bootstrap and added transform function which can be used by other trans… (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « CHANGELOG.md ('k') | lib/build/web_components.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 library web_components.build.script_compactor; 4 library web_components.build.script_compactor;
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:barback/barback.dart'; 8 import 'package:barback/barback.dart';
9 import 'package:code_transformers/assets.dart'; 9 import 'package:code_transformers/assets.dart';
10 import 'package:code_transformers/messages/build_logger.dart'; 10 import 'package:code_transformers/messages/build_logger.dart';
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 buffer.writeln(); 112 buffer.writeln();
113 var i = 0; 113 var i = 0;
114 for (var script in importScripts) { 114 for (var script in importScripts) {
115 var path = _importPath(script, primaryInput); 115 var path = _importPath(script, primaryInput);
116 buffer.writeln("import '$path' as i$i;"); 116 buffer.writeln("import '$path' as i$i;");
117 i++; 117 i++;
118 } 118 }
119 var mainScriptPath = _importPath(mainScript, primaryInput); 119 var mainScriptPath = _importPath(mainScript, primaryInput);
120 buffer.writeln("import '$mainScriptPath' as i$i;"); 120 buffer.writeln("import '$mainScriptPath' as i$i;");
121 buffer.writeln(); 121 buffer.writeln();
122 buffer.writeln('void main() => i$i.main();'); 122 buffer.writeln('void main() { i$i.main(); }');
Siggi Cherem (dart-lang) 2015/02/23 18:15:16 since this is not formatted automatically, maybe a
jakemac 2015/02/23 18:19:16 I am inclined to just leave it, this fits on one l
123 123
124 var bootstrap = new Asset.fromString(bootstrapId, '$buffer'); 124 var bootstrap = new Asset.fromString(bootstrapId, '$buffer');
125 transform.addOutput(bootstrap); 125 transform.addOutput(bootstrap);
126 return bootstrap; 126 return bootstrap;
127 } 127 }
128 128
129 /// Split inline scripts into their own files. We need to do this for dart2js 129 /// Split inline scripts into their own files. We need to do this for dart2js
130 /// to be able to compile them. 130 /// to be able to compile them.
131 /// 131 ///
132 /// This also validates that there weren't any duplicate scripts. 132 /// This also validates that there weren't any duplicate scripts.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (parts[0] == 'lib') { 252 if (parts[0] == 'lib') {
253 parts[0] = id.package; 253 parts[0] = id.package;
254 return 'package:${path.url.joinAll(parts)}'; 254 return 'package:${path.url.joinAll(parts)}';
255 } 255 }
256 return path.url.relative(id.path, from: path.url.dirname(primaryInput.path)); 256 return path.url.relative(id.path, from: path.url.dirname(primaryInput.path));
257 } 257 }
258 258
259 // Constant and final variables 259 // Constant and final variables
260 final _invalidLibCharsRegex = new RegExp('[^a-z0-9_]'); 260 final _invalidLibCharsRegex = new RegExp('[^a-z0-9_]');
261 final _numRegex = new RegExp('[0-9]'); 261 final _numRegex = new RegExp('[0-9]');
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/build/web_components.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698