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

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

Issue 29823005: fixes to polymer, gets tests back to a stable state (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 /** Common methods used by transfomers. */ 5 /** Common methods used by transfomers. */
6 library polymer.src.build.common; 6 library polymer.src.build.common;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
(...skipping 20 matching lines...) Expand all
31 logger.warning(e.message, span: e.span); 31 logger.warning(e.message, span: e.span);
32 } 32 }
33 } 33 }
34 return document; 34 return document;
35 } 35 }
36 36
37 /** Additional options used by polymer transformers */ 37 /** Additional options used by polymer transformers */
38 class TransformOptions { 38 class TransformOptions {
39 List<String> entryPoints; 39 List<String> entryPoints;
40 40
41 TransformOptions([entryPoints]) 41 /**
42 * True to enable Content Security Policy.
43 * This means the HTML page will include *.dart.precompiled.js
44 *
45 * This flag has no effect unless [directlyIncludeJS] is enabled.
46 */
47 bool contentSecurityPolicy;
48
49 /**
50 * True to include the compiled JavaScript directly from the HTML page.
51 * If enabled this will remove "packages/browser/dart.js" and replace
52 * `type="application/dart"` scripts with equivalent *.dart.js files.
53 *
54 * If [contentSecurityPolicy] enabled, this will reference files
55 * named *.dart.precompiled.js.
56 */
57 bool directlyIncludeJS;
Siggi Cherem (dart-lang) 2013/10/21 21:07:42 should we make any (or all) of these fields final?
Jennifer Messerly 2013/10/21 21:42:56 can't. it is set from elsewhere.
58
59 TransformOptions({entryPoints, this.contentSecurityPolicy: false,
60 this.directlyIncludeJS: true})
42 : entryPoints = entryPoints == null ? null 61 : entryPoints = entryPoints == null ? null
43 : entryPoints.map(_systemToAssetPath).toList(); 62 : entryPoints.map(_systemToAssetPath).toList();
44 63
45 /** Whether an asset with [id] is an entry point HTML file. */ 64 /** Whether an asset with [id] is an entry point HTML file. */
46 bool isHtmlEntryPoint(AssetId id) { 65 bool isHtmlEntryPoint(AssetId id) {
47 if (id.extension != '.html') return false; 66 if (id.extension != '.html') return false;
48 67
49 // Note: [id.path] is a relative path from the root of a package. 68 // Note: [id.path] is a relative path from the root of a package.
50 if (entryPoints == null) { 69 if (entryPoints == null) {
51 return id.path.startsWith('web/') || id.path.startsWith('test/'); 70 return id.path.startsWith('web/') || id.path.startsWith('test/');
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return builder.relative(builder.join('/', id.path), 172 return builder.relative(builder.join('/', id.path),
154 from: builder.join('/', builder.dirname(sourceId.path))); 173 from: builder.join('/', builder.dirname(sourceId.path)));
155 } 174 }
156 175
157 176
158 /** Convert system paths to asset paths (asset paths are posix style). */ 177 /** Convert system paths to asset paths (asset paths are posix style). */
159 String _systemToAssetPath(String assetPath) { 178 String _systemToAssetPath(String assetPath) {
160 if (path.Style.platform != path.Style.windows) return assetPath; 179 if (path.Style.platform != path.Style.windows) return assetPath;
161 return path.posix.joinAll(path.split(assetPath)); 180 return path.posix.joinAll(path.split(assetPath));
162 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698