| Index: pkg/polymer/lib/src/build/import_inliner.dart
|
| diff --git a/pkg/polymer/lib/src/build/import_inliner.dart b/pkg/polymer/lib/src/build/import_inliner.dart
|
| index cf3b7d931e3c6ad44e52c0f90bc95b0d30f83bb2..ed7929b2d8ad72a3d54b3b29a6bfb6bc07e6ec90 100644
|
| --- a/pkg/polymer/lib/src/build/import_inliner.dart
|
| +++ b/pkg/polymer/lib/src/build/import_inliner.dart
|
| @@ -7,6 +7,7 @@ library polymer.src.build.import_inliner;
|
|
|
| import 'dart:async';
|
| import 'dart:convert';
|
| +import 'dart:collection' show LinkedHashSet;
|
|
|
| import 'package:analyzer/analyzer.dart';
|
| import 'package:analyzer/src/generated/ast.dart';
|
| @@ -30,7 +31,7 @@ class _HtmlInliner extends PolymerTransformer {
|
| final BuildLogger logger;
|
| final AssetId docId;
|
| final seen = new Set<AssetId>();
|
| - final scriptIds = <AssetId>[];
|
| + final scriptIds = new LinkedHashSet<AssetId>();
|
| final inlinedStylesheetIds = new Set<AssetId>();
|
| final extractedFiles = new Set<AssetId>();
|
| bool experimentalBootstrap = false;
|
| @@ -94,7 +95,7 @@ class _HtmlInliner extends PolymerTransformer {
|
| docId.addExtension('._data'),
|
| JSON.encode({
|
| 'experimental_bootstrap': experimentalBootstrap,
|
| - 'script_ids': scriptIds,
|
| + 'script_ids': scriptIds.toList(),
|
| }, toEncodable: (id) => id.serialize())));
|
|
|
| // Write out the logs collected by our [BuildLogger].
|
| @@ -241,6 +242,13 @@ class _HtmlInliner extends PolymerTransformer {
|
| var src = script.attributes['src'];
|
| var srcId = uriToAssetId(docId, src, logger, script.sourceSpan);
|
|
|
| + // No duplicates allowed!
|
| + if (scriptIds.contains(srcId)) {
|
| + logger.warning(SCRIPT_INCLUDED_MORE_THAN_ONCE.create({'url': src}),
|
| + span: script.sourceSpan);
|
| + return true;
|
| + }
|
| +
|
| // We check for extractedFiles because 'hasInput' below is only true for
|
| // assets that existed before this transformer runs (hasInput is false
|
| // for files created by [_extractScripts]).
|
|
|