Commit Graph

71 Commits

Author SHA1 Message Date
kutyel e4e74ae65c chore: rename modules/examples to modules/playground
The directory contains code authored in a style that makes it transpilable to dart. As such, these are not idiomatic examples of Angular 2 usage.

The main purpose of this directory is to enable experimentation with Angular within the angular/angular repository.

Closes #4342

Closes #4639
2015-10-18 11:48:43 +00:00
Tobias Bosch 6436f96fd1 fix(transformers): show nice error message when an invalid uri is found
Closes #4731
2015-10-14 10:20:29 -07:00
Tim Blasi efddc9069c fix(dart/transform): Parse directives agnostic of annotation order
Now that we can specify `directives` in either `@View` or `@Component`,
we will try to parse from both.

Previously, we would trash any `directives` parsed in the first
annotation upon encountering the second annotation. This ensures that we
maintain that list of `directives` regardless of annotation ordering.
2015-10-14 10:17:14 -07:00
Tim Blasi 5a505975bf fix(dart/transform): Handle empty .ng_deps.dart files
Handle the situation where a `.dart` file generates a `.ng_meta.json`
file but does not register any reflective information.

An example of this would be a file that defines a const list that looks
like a directive alias. The transformer keeps track of this, and creates
a `.ng_meta.json` file but never creates a `.ng_deps.dart` file, which
can result in other files being linked to it and it not defining an
`initReflector` method.
2015-10-14 01:34:55 +00:00
Tim Blasi 115ad4d062 refactor(dart/transform): Allow inlining only using `inline_views`
Remove the `inliner_for_test` standalone transformer and make inlining
available via the `inline_views` parameter to the main angular2
transformer.
2015-10-13 18:06:59 -07:00
Sam Rawlins eb2c15786e refactor: Update multiple ctors warning with a space and grammar
Add a space before the word "using" and make spelling of
constructor/ctor consistent

Closes #3923
2015-10-13 02:35:43 +00:00
Yegor Jbanov 04b3dee667 fix(css): when compiling CSS, leave absolute imports alone
Closes #4592
2015-10-08 16:39:32 +00:00
Tim Blasi 811d4c03bd fix(dart/transform): Run DeferredRewriter in the correct phase
`DeferredRewriter` depends on the presence of `.ng_deps.dart` files,
which do not yet exist in the phase where it was previously run.

Update the transformer phases to fix this and add an integration test to
prevent regression.
2015-10-07 17:10:23 -07:00
Tim Blasi fcc6f2c561 refactor(dart/transform): Generate `inputs` setters in `TemplateCompiler` step
Move generation of setters for `inputs` from `BindGenerator` into
`TemplateCompiler`.
2015-10-07 12:29:35 -07:00
Tim Blasi c94f239536 fix(dart/transform): Write correct ng_deps without deferred imports
Previously, the presence of a `deferred` import would cause us to output
incomplete `.ng_deps.dart` code.

Closes #4587
2015-10-07 11:21:59 -07:00
Tim Blasi 07572652ff feat(dart/transform): Track timing of transform tasks 2015-10-07 17:44:48 +00:00
vsavkin dea6a4593b cleanup(core): making @View optional
Closes #4566
2015-10-07 02:16:42 +00:00
vsavkin a2e7ae568e feat(transformers): update transformers to handle components without @View 2015-10-07 02:16:42 +00:00
Tim Blasi ba6e0e11fa fix(dart/transform): Sanitize generated library names
Sanitize generated library names by removing unsafe characters and
ensuring that Dart keywords do not appear as library segments.
2015-10-06 16:18:58 -07:00
Tim Blasi 4ac29621f4 refactor(dart/transform): Compose NgDepsModel & NgMeta phases
Link `NgDeps` & `NgMeta` data in the same phase to avoid unnecessary asset
creation & reading.

Remove `NgMeta#exports` and instead use `NgDeps#exports` to link `NgMeta` files
in `ng_meta_linker.dart`.
2015-10-06 16:18:58 -07:00
Tim Blasi 349416ea53 test(dart/transform): e2e test inliner_for_test
Add an e2e test for the `inliner_for_test` transformer.
2015-10-05 20:18:15 +00:00
Tobias Bosch 0b3e4fa090 refactor(core): move `ViewEncapsulation` and `ViewType` to the right places
Closes #4526
2015-10-05 11:22:21 -07:00
Tim Blasi decdbea7d7 fix(dart/transformer): Correctly handle const object annotations
Previously, annotations which were const objects (as opposed to const
instance creation expressions) were incorrectly output as instance
creation expressions.

Before:
```
const override() // A const instance creation expression
```

After
```
override // A const instance
```

Closes #4481
2015-10-03 00:27:52 +00:00
vsavkin c9901c5fe0 feat(core): support properties and events in addition to inputs and outputs to make transition easier
Closes #4482
2015-10-02 23:23:15 +00:00
Tim Blasi 5ea6dc844c refactor(dart/transform): Remove reflection_entry_points
`reflection_entry_points` was deprecated on Aug 26 and is no longer used
by the transformer. Remove its deprecation message.

Closes #3856
2015-10-02 22:31:02 +00:00
Tobias Bosch 6b5d345a2b refactor(core): adjust imports for move files to the right place
- render/xhr_* -> compiler/xhr_*
- render/event_config -> linker/event_config
- render/dom/schema -> compiler/schema
- render/dom/compiler/* -> compiler/*
- render/dom/view/shared_styles_host -> render/dom/shared_styles_host
2015-10-02 13:38:51 -07:00
Tobias Bosch e8e57cdd73 refactor(core): adjust imports for rename angular2/src/compiler -> angular2/src/core/compiler 2015-10-02 08:59:43 -07:00
Tobias Bosch 6248a5e846 refactor(core): move core/compiler to core/linker, adjust imports 2015-10-02 08:42:12 -07:00
Tobias Bosch d21c7bdf90 refactor(compiler): remove unused code
BREAKING CHANGE:
- Removes `ChangeDetection`, use a binding for `ChangeDetectorGenConfig` instead
  to configure change detection.
- `RenderElementRef.renderBoundElementIndex` was renamed to `RenderElementRef.boundElementIndex`.
- Removes `ViewLoader`, use `XHRImpl` instead.
2015-10-01 22:27:41 -07:00
Tobias Bosch b154f1a44f refactor(analyzer): remove analyzer code
This now lives under https://github.com/angular/angular2-dart-analyzer
2015-10-01 18:48:28 -07:00
Tobias Bosch 76247b7097 refactor(compiler): use the new compiler everywhere
Closes #3605

BREAKING CHANGE:
- we don't mark an element as bound any more if it only contains text bindings
  E.g. <div>{{hello}}</div>
  This changes the indices when using `DebugElement.componentViewChildren` / `DebugElement.children`.
- `@Directive.compileChildren` was removed,
  `ng-non-bindable` is now builtin and not a directive any more
- angular no more adds the `ng-binding` class to elements with bindings
- directives are now ordered as they are listed in the View.directives regarding change detection.
  Previously they had an undefined order.
- the `Renderer` interface has new methods `createProtoView` and `registerComponentTemplate`. See `DomRenderer` for default implementations.
- reprojection with `ng-content` is now all or nothing per `ng-content` element
- angular2 transformer can't be used in tests that modify directive metadata.
  Use `angular2/src/transform/inliner_for_test` transformer instead.
2015-10-01 18:48:27 -07:00
Tobias Bosch 30ca0434a2 refactor(transformer): apply properties/events rename 2015-10-01 18:48:27 -07:00
Yegor Jbanov 841f8789fd refactor(transformer): precompile stylesheets
Part of #3605
2015-10-01 18:48:27 -07:00
Tim Blasi 52236bd765 refactor(transformer): use the new compiler
Part of #3605
2015-10-01 18:48:26 -07:00
vsavkin adbfd29fd7 feat(core): renames Property into Input and Event into Output
BREACKING CHANGE:

Before: @Directive({properties: ['one'], events: ['two']})
After: @Directive({inputs: ['one'], outputs: ['two']})

Before: @Component({properties: ['one'], events: ['two']})
After: @Componet({inputs: ['one'], outputs: ['two']})

Before: class A {@Property() one; @Event() two;}
After: class A {@Input() one; @Output() two;}
2015-10-01 04:36:23 +00:00
Tim Blasi 1f2302e39e fix(dart/transform): Fix transformer output declaration
Ensure that the transformers are properly declaring all consumed
outputs. In particular, when a transformer overwrites an output, make
sure the transformer calls `consumePrimary` followed by `addOutput` for
that file.

Prevent `DirectiveLinker` from consuming `.ng_deps.json` files. When we
do this, barback incorrectly calculates the available assets for that
phase, resulting in broken builds.
2015-09-28 12:20:21 -07:00
vsavkin 589ce31dfc feat(transformers): record setters for query fields
Closes #4344
2015-09-25 23:34:42 +00:00
Tim Blasi e7d65ad96f fix(dart/transform): Handle export cycles
Currently, an export cycle in dart inputs will cause the transformer to
hang indefinitely on the `DirectiveMetadataExtractor` step.

Closes #4370
2015-09-25 23:08:45 +00:00
Tim Blasi 820b30c181 refactor(dart/transform): Use protos to run & test directive_linker
Use the proto ng_deps model objects internally and while testing the directive
linker rather than reading & comparing Dart code.
2015-09-22 13:40:07 -07:00
Tim Blasi 2acc1ad08b feat(dart/transform): Declare transformer outputs
Update transformers to declare a superset of their outputs. This helps
barback compute the Asset graph and can lead to faster transformation.
2015-09-17 16:00:03 -07:00
Tobias Bosch 457b689bf0 feat(compiler): add TemplateCompiler
TemplateCompiler is the entry point to the new compiler

Related to #3605
Closes #4220
2015-09-17 04:24:15 +00:00
Tim Blasi 64e8f93f32 feat(dart/transform): Record property metadata
Update the transformer to generate code registering annotations on class
properties, getters, and setters.

Closes #1800, #3267, #4003
2015-09-16 08:54:35 -07:00
Tim Blasi 267121ee17 refactor(dart/transform): Test directive processor using protos
Directly test the `NgDepsModel` object created by the
`DirectiveProcessor` rather than string comparing output Dart code.
2015-09-15 13:56:44 -07:00
Tim Blasi e889ec8335 refactor(dart/transform): Use a protobufs representation during transform
To simplify processing and testing in the future, use protobufs to
represent of `.ng_deps.dart` files rather than always dealing
directly in Dart code.

This update does not actually use the protobuf representation, but this
is a step towards moving all phases to parse and use protobufs rather than
Dart code.
2015-09-15 08:39:07 -07:00
Tim Blasi cb4ff7491a chore(dart/transform): Integrate protoc into gulp build
This change detects if the user has `protoc` available and, if so, uses
it to generate `.pb.dart` files. If not, pre-built files are used
instead.
2015-09-15 08:39:07 -07:00
Jason Teplitz 787d1f955f fix(Typings): Remove public exports added in 1926335b85
Closes #4147
2015-09-11 19:16:57 -07:00
vsavkin f6cc573687 fix(exception_handler): fix error messages of wrapped exceptions
Closes #4117
2015-09-10 22:26:56 +00:00
Jason Teplitz 1926335b85 fix(Typings): Output public constructors in .d.ts files
Closes #3926.

Closes #3963
2015-09-10 01:37:43 +00:00
Tobias Bosch 12dd44f7f6 feat(compiler): add change detector generation
Runtime and Codegen.

Part of #3605
Closes #4057
2015-09-10 00:59:34 +00:00
Tim Blasi 28a29f5557 refactor(dart/transform): Make implementation details private 2015-09-08 15:47:15 -07:00
vsavkin a8bdb693b9 feat(pipes): add support for pure pipes
By default, pipes are pure. This means that an instance of a pipe will be reused and the pipe will be called only when its arguments change.

BREAKING CHANGE

Before:

@Pipe({name: 'date'}) class DatePipe {} defines an impure pipe.

After:

@Pipe({name: 'date'}) class DatePipe {} defines a pure pipe.
@Pipe({name: 'date', pure: false}) class DatePipe {} defines an impure pipe.

Closes #3966
2015-09-08 16:24:27 +00:00
Jeff Cross f14b212dc9 refactor: export core APIs from angular2/core
This change moves many APIs to the angular2/core export.

This change also automatically adds FORM_BINDINGS in
the application root injector.

BREAKING CHANGE:
    Many dependencies that were previously exported from specific
    APIs are now exported from angular2/core. Affected exports, which
    should now be included from angular2/core include:

    angular2/forms
    angular2/di
    angular2/directives
    angular2/change_detection
    angular2/bootstrap (except for dart users)
    angular2/render
    angular2/metadata
    angular2/debug
    angular2/pipes
Closes #3977
2015-09-05 07:01:34 +00:00
Jeff Cross 841aa1af5b fix(annotation_matcher): fix typo with Directive matchers 2015-09-05 07:01:34 +00:00
Victor Berchet 3d38ec8aac refactor(Lifecycle hooks): move the hooks to their own module (lifecycle_hooks)
BREAKING CHANGE

Lifecycle hooks now live in the `angular2/lifecycle_hooks` module.
They previously lived in the `metadata` module.
2015-09-05 01:02:33 +00:00
Tim Blasi ef88e0f804 refactor(transformers): extract lifecycle hooks from the interfaces 2015-09-05 01:02:33 +00:00