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

Unified Diff: samples/third_party/dromaeo/lib/transformer.dart

Issue 1576153002: Remove the Dromaeo and TodoMVC samples. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/third_party/dromaeo/.gitignore ('k') | samples/third_party/dromaeo/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/third_party/dromaeo/lib/transformer.dart
diff --git a/samples/third_party/dromaeo/lib/transformer.dart b/samples/third_party/dromaeo/lib/transformer.dart
deleted file mode 100644
index fa50ea3d87b07162273774f261fab355e8e5c1a9..0000000000000000000000000000000000000000
--- a/samples/third_party/dromaeo/lib/transformer.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-library dromaeo.transformer;
-
-import 'dart:async';
-import 'package:barback/barback.dart';
-
-/// Transformer used by `pub build` and `pub serve` to rewrite dromaeo html
-/// files to run performance tests.
-class DromaeoTransformer extends Transformer {
-
- final BarbackSettings settings;
-
- DromaeoTransformer.asPlugin(this.settings);
-
- /// The index.html file and the tests/dom-*-html.html files are the ones we
- /// apply this transform to.
- Future<bool> isPrimary(AssetId id) {
- var reg = new RegExp('(tests/dom-.+-html\.html\$)|(index\.html\$)');
- return new Future.value(reg.hasMatch(id.path));
- }
-
- Future apply(Transform transform) {
- Asset primaryAsset = transform.primaryInput;
- AssetId primaryAssetId = primaryAsset.id;
-
- return primaryAsset.readAsString().then((String fileContents) {
- var filename = primaryAssetId.toString();
- var outputFileContents = fileContents;
-
- if (filename.endsWith('index.html')) {
- var index = outputFileContents.indexOf(
- '<script src="packages/browser/dart.js">');
- outputFileContents = outputFileContents.substring(0, index) +
- '<script src="packages/browser_controller' +
- '/perf_test_controller.js"></script>\n' +
- outputFileContents.substring(index);
- transform.addOutput(new Asset.fromString(new AssetId.parse(
- primaryAssetId.toString().replaceAll('.html', '-dart.html')),
- outputFileContents));
- }
-
- outputFileContents = _sourceJsNotDart(outputFileContents);
- // Rename the script to take the JavaScript source.
- transform.addOutput(new Asset.fromString(new AssetId.parse(
- _appendJs(primaryAssetId.toString())),
- outputFileContents));
- });
- }
-
- String _appendJs(String path) => path.replaceAll('.html', '-js.html');
-
- /// Given an html file that sources a Dart file, rewrite the html to instead
- /// source the compiled JavaScript file.
- String _sourceJsNotDart(String fileContents) {
- var dartScript = new RegExp(
- '<script type="application/dart" src="([\\w-]+)\.dart">');
- var match = dartScript.firstMatch(fileContents);
- return fileContents.replaceAll(dartScript, '<script type="text/javascript"'
- ' src="${match.group(1)+ ".dart.js"}" defer>');
- }
-}
« no previous file with comments | « samples/third_party/dromaeo/.gitignore ('k') | samples/third_party/dromaeo/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698