Index: pkg/polymer/lib/src/build/common.dart |
diff --git a/pkg/polymer/lib/src/build/common.dart b/pkg/polymer/lib/src/build/common.dart |
index 94abdd7b88deda2c95b58871847e7e06a6bf005a..bcde554030e4896273a70c5e164dc13049c62395 100644 |
--- a/pkg/polymer/lib/src/build/common.dart |
+++ b/pkg/polymer/lib/src/build/common.dart |
@@ -2,7 +2,7 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-/** Common methods used by transfomers. */ |
+/// Common methods used by transfomers. |
library polymer.src.build.common; |
import 'dart:async'; |
@@ -15,10 +15,8 @@ import 'package:path/path.dart' as path; |
import 'package:observe/transformer.dart' show ObservableTransformer; |
import 'package:source_maps/span.dart' show Span; |
-/** |
- * Parses an HTML file [contents] and returns a DOM-like tree. Adds emitted |
- * error/warning to [logger]. |
- */ |
+/// Parses an HTML file [contents] and returns a DOM-like tree. Adds emitted |
+/// error/warning to [logger]. |
Document _parseHtml(String contents, String sourcePath, TransformLogger logger, |
{bool checkDocType: true}) { |
// TODO(jmesserly): make HTTP encoding configurable |
@@ -36,38 +34,30 @@ Document _parseHtml(String contents, String sourcePath, TransformLogger logger, |
return document; |
} |
-/** Additional options used by polymer transformers */ |
+/// Additional options used by polymer transformers |
class TransformOptions { |
- /** |
- * List of entrypoints paths. The paths are relative to the package root and |
- * are represented using posix style, which matches the representation used in |
- * asset ids in barback. If null, anything under 'web/' or 'test/' is |
- * considered an entry point. |
- */ |
+ /// List of entrypoints paths. The paths are relative to the package root and |
+ /// are represented using posix style, which matches the representation used |
+ /// in asset ids in barback. If null, anything under 'web/' or 'test/' is |
+ /// considered an entry point. |
final List<String> entryPoints; |
- /** |
- * True to enable Content Security Policy. |
- * This means the HTML page will include *.dart.precompiled.js |
- * |
- * This flag has no effect unless [directlyIncludeJS] is enabled. |
- */ |
+ /// True to enable Content Security Policy. |
+ /// This means the HTML page will include *.dart.precompiled.js |
+ /// |
+ /// This flag has no effect unless [directlyIncludeJS] is enabled. |
final bool contentSecurityPolicy; |
- /** |
- * True to include the compiled JavaScript directly from the HTML page. |
- * If enabled this will remove "packages/browser/dart.js" and replace |
- * `type="application/dart"` scripts with equivalent *.dart.js files. |
- * |
- * If [contentSecurityPolicy] enabled, this will reference files |
- * named *.dart.precompiled.js. |
- */ |
+ /// True to include the compiled JavaScript directly from the HTML page. |
+ /// If enabled this will remove "packages/browser/dart.js" and replace |
+ /// `type="application/dart"` scripts with equivalent *.dart.js files. |
+ /// |
+ /// If [contentSecurityPolicy] enabled, this will reference files |
+ /// named *.dart.precompiled.js. |
final bool directlyIncludeJS; |
- /** |
- * Run transformers to create a releasable app. For example, include the |
- * minified versions of the polyfills rather than the debug versions. |
- */ |
+ /// Run transformers to create a releasable app. For example, include the |
+ /// minified versions of the polyfills rather than the debug versions. |
final bool releaseMode; |
TransformOptions({entryPoints, this.contentSecurityPolicy: false, |
@@ -75,7 +65,7 @@ class TransformOptions { |
: entryPoints = entryPoints == null ? null |
: entryPoints.map(_systemToAssetPath).toList(); |
- /** Whether an asset with [id] is an entry point HTML file. */ |
+ /// Whether an asset with [id] is an entry point HTML file. |
bool isHtmlEntryPoint(AssetId id) { |
if (id.extension != '.html') return false; |
@@ -88,7 +78,7 @@ class TransformOptions { |
} |
} |
-/** Mixin for polymer transformers. */ |
+/// Mixin for polymer transformers. |
abstract class PolymerTransformer { |
TransformOptions get options; |
@@ -111,17 +101,15 @@ abstract class PolymerTransformer { |
}); |
} |
- /** |
- * Gets the appropriate URL to use in a [Span] to produce messages |
- * (e.g. warnings) for users. This will attempt to format the URL in the most |
- * useful way: |
- * |
- * - If the asset is within the primary package, then use the [id.path], |
- * the user will know it is a file from their own code. |
- * - If the asset is from another package, then use [assetUrlFor], this will |
- * likely be a "package:" url to the file in the other package, which is |
- * enough for users to identify where the error is. |
- */ |
+ /// Gets the appropriate URL to use in a [Span] to produce messages |
+ /// (e.g. warnings) for users. This will attempt to format the URL in the most |
+ /// useful way: |
+ /// |
+ /// - If the asset is within the primary package, then use the [id.path], |
+ /// the user will know it is a file from their own code. |
+ /// - If the asset is from another package, then use [assetUrlFor], this will |
+ /// likely be a "package:" url to the file in the other package, which is |
+ /// enough for users to identify where the error is. |
String spanUrlFor(AssetId id, Transform transform) { |
var primaryId = transform.primaryInput.id; |
bool samePackage = id.package == primaryId.package; |
@@ -135,16 +123,14 @@ abstract class PolymerTransformer { |
String toString() => 'polymer ($runtimeType)'; |
} |
-/** Transformer phases which should be applied to the Polymer package. */ |
+/// Transformer phases which should be applied to the Polymer package. |
List<List<Transformer>> get phasesForPolymer => |
[[new ObservableTransformer(['lib/src/instance.dart'])]]; |
-/** |
- * Create an [AssetId] for a [url] seen in the [source] asset. By default this |
- * is used to resolve relative urls that occur in HTML assets, including |
- * cross-package urls of the form "packages/foo/bar.html". Dart-style "package:" |
- * urls are not resolved unless [source] is Dart file (has a .dart extension). |
- */ |
+/// Create an [AssetId] for a [url] seen in the [source] asset. By default this |
+/// is used to resolve relative urls that occur in HTML assets, including |
+/// cross-package urls of the form "packages/foo/bar.html". Dart "package:" |
+/// urls are not resolved unless [source] is Dart file (has a .dart extension). |
// TODO(sigmund): delete once this is part of barback (dartbug.com/12610) |
AssetId resolve(AssetId source, String url, TransformLogger logger, Span span, |
{bool allowAbsolute: false}) { |
@@ -228,10 +214,8 @@ AssetId _extractOtherPackageId(int index, List segments, |
path.url.join(folder, path.url.joinAll(segments.sublist(index + 2)))); |
} |
-/** |
- * Generate the import url for a file described by [id], referenced by a file |
- * with [sourceId]. |
- */ |
+/// Generate the import url for a file described by [id], referenced by a file |
+/// with [sourceId]. |
// TODO(sigmund): this should also be in barback (dartbug.com/12610) |
String assetUrlFor(AssetId id, AssetId sourceId, TransformLogger logger, |
{bool allowAssetUrl: false}) { |
@@ -261,7 +245,7 @@ String assetUrlFor(AssetId id, AssetId sourceId, TransformLogger logger, |
} |
-/** Convert system paths to asset paths (asset paths are posix style). */ |
+/// Convert system paths to asset paths (asset paths are posix style). |
String _systemToAssetPath(String assetPath) { |
if (path.Style.platform != path.Style.windows) return assetPath; |
return path.posix.joinAll(path.split(assetPath)); |