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

Side by Side Diff: pkg/polymer/lib/src/build/import_inliner.dart

Issue 223553008: Only pass an AssetId to isPrimary and declareOutputs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix script_compactor Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// Transfomer that inlines polymer-element definitions from html imports. 5 /// Transfomer that inlines polymer-element definitions from html imports.
6 library polymer.src.build.import_inliner; 6 library polymer.src.build.import_inliner;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:convert'; 9 import 'dart:convert';
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 /// 237 ///
238 /// This transformer assumes that all script tags point to external files. To 238 /// This transformer assumes that all script tags point to external files. To
239 /// support script tags with inlined code, use this transformer after running 239 /// support script tags with inlined code, use this transformer after running
240 /// [InlineCodeExtractor] on an earlier phase. 240 /// [InlineCodeExtractor] on an earlier phase.
241 class ImportInliner extends Transformer { 241 class ImportInliner extends Transformer {
242 final TransformOptions options; 242 final TransformOptions options;
243 243
244 ImportInliner(this.options); 244 ImportInliner(this.options);
245 245
246 /// Only run on entry point .html files. 246 /// Only run on entry point .html files.
247 Future<bool> isPrimary(Asset input) => 247 // TODO(nweiz): This should just take an AssetId when barback <0.13.0 support
248 new Future.value(options.isHtmlEntryPoint(input.id)); 248 // is dropped.
249 Future<bool> isPrimary(idOrAsset) {
250 var id = idOrAsset is AssetId ? idOrAsset : idOrAsset.id;
251 return new Future.value(options.isHtmlEntryPoint(id));
252 }
249 253
250 Future apply(Transform transform) => 254 Future apply(Transform transform) =>
251 new _HtmlInliner(options, transform).apply(); 255 new _HtmlInliner(options, transform).apply();
252 } 256 }
253 257
254 const TYPE_DART_APP = 'application/dart'; 258 const TYPE_DART_APP = 'application/dart';
255 const TYPE_DART_COMPONENT = 'application/dart;component=1'; 259 const TYPE_DART_COMPONENT = 'application/dart;component=1';
256 const TYPE_JS = 'text/javascript'; 260 const TYPE_JS = 'text/javascript';
257 261
258 /// Internally adjusts urls in the html that we are about to inline. 262 /// Internally adjusts urls in the html that we are about to inline.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 ]; 391 ];
388 392
389 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end); 393 _getSpan(SourceFile file, AstNode node) => file.span(node.offset, node.end);
390 394
391 const COMPONENT_WARNING = 395 const COMPONENT_WARNING =
392 'More than one Dart script per HTML document is not supported, but in the ' 396 'More than one Dart script per HTML document is not supported, but in the '
393 'near future Dartium will execute each tag as a separate isolate. If this ' 397 'near future Dartium will execute each tag as a separate isolate. If this '
394 'code is meant to load definitions that are part of the same application ' 398 'code is meant to load definitions that are part of the same application '
395 'you should switch it to use the "application/dart;component=1" mime-type ' 399 'you should switch it to use the "application/dart;component=1" mime-type '
396 'instead.'; 400 'instead.';
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/build_filter.dart ('k') | pkg/polymer/lib/src/build/mirrors_remover.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698