fix(transformer): fix 'pub build' in examples
This commit is contained in:
parent
749d043258
commit
62589293aa
|
@ -269,6 +269,11 @@ class AnnotationsTransformVisitor extends ToSourceVisitor {
|
|||
writer.print("template: r'''");
|
||||
writer.asyncPrint(_readOrEmptyString(url));
|
||||
writer.print("'''");
|
||||
|
||||
// We keep the templateUrl in case the body of the template includes
|
||||
// relative urls that might be inlined later on (e.g. @import
|
||||
// directives or url() css values in style tags).
|
||||
writer.print(", templateUrl: r'$url'");
|
||||
return null;
|
||||
} else {
|
||||
logger.warning('template url is not a String $url');
|
||||
|
|
|
@ -122,7 +122,7 @@ class _CodegenState {
|
|||
localNames.map((name) => '_${name}_pipe').toList();
|
||||
|
||||
void _writeToBuf(StringBuffer buf) {
|
||||
buf.write('''
|
||||
buf.write('''\n
|
||||
class $_changeDetectorTypeName extends $_BASE_CLASS {
|
||||
final dynamic $_DISPATCHER_ACCESSOR;
|
||||
$_GEN_PREFIX.PipeRegistry $_PIPE_REGISTRY_ACCESSOR;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart.ng_deps.dart;
|
||||
library examples.src.hello_world.absolute_url_expression_files.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
|
@ -16,6 +16,7 @@ void initReflector(reflector) {
|
|||
const Component(selector: 'hello-app'),
|
||||
const View(
|
||||
template: r'''{{greeting}}''',
|
||||
templateUrl: r'package:other_package/template.html',
|
||||
styles: const [r'''.greeting { .color: blue; }''',])
|
||||
]
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart;
|
||||
library examples.src.hello_world.absolute_url_expression_files;
|
||||
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
|
|
@ -124,8 +124,8 @@ void _testNgDeps(String name, String inputPath,
|
|||
if (output == null) {
|
||||
expect(await reader.hasInput(expectedId)).toBeFalse();
|
||||
} else {
|
||||
expect(formatter.format(output)).toEqual(
|
||||
(await reader.readAsString(expectedId)).replaceAll('\r\n', '\n'));
|
||||
var input = await reader.readAsString(expectedId);
|
||||
expect(formatter.format(output)).toEqual(formatter.format(input));
|
||||
}
|
||||
|
||||
if (expectedLogs != null) {
|
||||
|
|
|
@ -16,6 +16,7 @@ void initReflector(reflector) {
|
|||
const Component(selector: 'hello-app'),
|
||||
const View(
|
||||
template: r'''{{greeting}}''',
|
||||
templateUrl: r'template.html',
|
||||
styles: const [
|
||||
r'''.greeting { .color: blue; }''',
|
||||
r'''.hello { .color: red; }''',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library test.transform.directive_processor.url_expression_files.hello.ng_deps.dart;
|
||||
library test.transform.directive_processor.invalid_url_files.hello.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
|
@ -14,7 +14,10 @@ void initReflector(reflector) {
|
|||
'parameters': const [],
|
||||
'annotations': const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: r'''''', styles: const [r'''''', r'''''',])
|
||||
const View(
|
||||
template: r'''''',
|
||||
templateUrl: r'/bad/absolute/url.html',
|
||||
styles: const [r'''''', r'''''',])
|
||||
]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library test.transform.directive_processor.url_expression_files.hello;
|
||||
library test.transform.directive_processor.invalid_url_files.hello;
|
||||
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart.ng_deps.dart;
|
||||
library examples.src.hello_world.multiple_style_urls_files.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
|
@ -16,6 +16,7 @@ void initReflector(reflector) {
|
|||
const Component(selector: 'hello-app'),
|
||||
const View(
|
||||
template: r'''{{greeting}}''',
|
||||
templateUrl: r'template.html',
|
||||
styles: const [
|
||||
r'''.greeting { .color: blue; }''',
|
||||
r'''.hello { .color: red; }''',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart;
|
||||
library examples.src.hello_world.multiple_style_urls_files;
|
||||
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart.ng_deps.dart;
|
||||
library examples.src.hello_world.multiple_style_urls_not_inlined_files.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart;
|
||||
library examples.src.hello_world.multiple_style_urls_not_inlined_files;
|
||||
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart.ng_deps.dart;
|
||||
library examples.src.hello_world.split_url_expression_files.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
|
@ -14,7 +14,7 @@ void initReflector(reflector) {
|
|||
'parameters': const [],
|
||||
'annotations': const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: r'''{{greeting}}''')
|
||||
const View(template: r'''{{greeting}}''', templateUrl: r'template.html')
|
||||
]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart;
|
||||
library examples.src.hello_world.split_url_expression_files;
|
||||
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart.ng_deps.dart;
|
||||
library examples.src.hello_world.url_expression_files.ng_deps.dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
|
@ -14,7 +14,7 @@ void initReflector(reflector) {
|
|||
'parameters': const [],
|
||||
'annotations': const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: r'''{{greeting}}''')
|
||||
const View(template: r'''{{greeting}}''', templateUrl: r'template.html')
|
||||
]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library examples.src.hello_world.index_common_dart;
|
||||
library examples.src.hello_world.url_expression_files;
|
||||
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Directive, View, NgElement;
|
||||
|
|
|
@ -123,7 +123,8 @@ void allTests() {
|
|||
});
|
||||
});
|
||||
testPhases(config.name, [[transform]], config.assetPathToInputPath,
|
||||
config.assetPathToExpectedOutputPath, []);
|
||||
config.assetPathToExpectedOutputPath, [],
|
||||
StringFormatter.noNewlinesOrSurroundingWhitespace);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ dependency_overrides:
|
|||
path: ../angular2_material
|
||||
transformers:
|
||||
- angular2:
|
||||
# The build currently fails on material files because there is not yet
|
||||
# support for transforming cross-package urls.
|
||||
$exclude: 'web/src/material/**'
|
||||
entry_points:
|
||||
- web/src/hello_world/index_common.dart
|
||||
- web/src/todo/index.dart
|
||||
|
|
|
@ -181,11 +181,13 @@ label[for='toggle-all'] {
|
|||
}
|
||||
|
||||
#todo-list li .toggle:after {
|
||||
content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#ededed" stroke-width="3"/></svg>');
|
||||
/*encoded url: 'data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#ededed" stroke-width="3"/></svg>'*/
|
||||
content: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22%2F%3E%3C%2Fsvg%3E');
|
||||
}
|
||||
|
||||
#todo-list li .toggle:checked:after {
|
||||
content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#bddad5" stroke-width="3"/><path fill="#5dc2af" d="M72 25L42 71 27 56l-4 4 20 20 34-52z"/></svg>');
|
||||
/*encoded url: 'data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#bddad5" stroke-width="3"/><path fill="#5dc2af" d="M72 25L42 71 27 56l-4 4 20 20 34-52z"/></svg>'*/
|
||||
content: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22%2F%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22%2F%3E%3C%2Fsvg%3E');
|
||||
}
|
||||
|
||||
#todo-list li label {
|
||||
|
|
Loading…
Reference in New Issue