Commit Graph

5077 Commits

Author SHA1 Message Date
Tobias Bosch b07ea6b90e feat(compiler): add benchmarks
- compileEmptyTemplate
- compile25ElementsNoBindings
- compile25ElementsWithBindings

For the results see the PR #197.

Closes #197
2014-11-14 14:25:02 -08:00
Tobias Bosch aa9eeb80e7 fix(change_detection/lexer): support production mode
The Lexer uses the global `assert` function of Dart, which is not
yet available in JavaScript. Later on, all `assert` statements should
be automatically removed by Traceur.
2014-11-14 14:22:38 -08:00
vsavkin d7208b8429 feat(ElementInjector): add NgElement 2014-11-14 13:22:39 -08:00
vsavkin ac8351b7bc feat(ElementInjector): change ElementInjector so @parent and @ancestor do not include self. 2014-11-14 13:18:39 -08:00
vsavkin e15bcf0ffd refactor(ChangeDetector): pass formatters when instantiating a watch group 2014-11-14 13:16:55 -08:00
vsavkin 03410850b4 feat(change_detector): cleanup 2014-11-14 13:16:55 -08:00
vsavkin 34d76f1c73 feat(change_detector): add support for map literals 2014-11-14 13:16:55 -08:00
vsavkin 75fd98428a feat(change_detector): add support for array literals 2014-11-14 13:16:55 -08:00
vsavkin 0e6d52306b feat(change_detector): add support for ternary 2014-11-14 13:16:55 -08:00
vsavkin f38b94067a feat(change_detector): add support for negate 2014-11-14 13:16:55 -08:00
vsavkin 4e38e3a96c feat(change_detector): add support for method calls 2014-11-14 13:16:55 -08:00
vsavkin dcd905ae85 feat(change_detector): add support for formatters 2014-11-14 13:16:55 -08:00
vsavkin 79a9430f2c feat(change_detection): add support for binary operations and literals 2014-11-14 13:16:55 -08:00
Rado Kirov b8e3617a1d refactor(annotations): replace Module functions with plain lists.
Renames:
elementServices -> shadowDomServices.
2014-11-14 13:03:24 -08:00
Tobias Bosch 1b79c91320 fix(compiler, view): centralize TemplateElement checks and fix inconsistencies
Fixes #189
Closes #194
2014-11-14 11:04:18 -08:00
Tobias Bosch 5e0ff2cbb7 refactor(ElementBinder): Store componentDirective and templateDirective as well. 2014-11-13 17:36:45 -08:00
Tobias Bosch 352b6406ad fix(BaseException): Support stack traces in BaseException 2014-11-13 17:32:56 -08:00
Tobias Bosch 7308a3acc7 refactor(ElementInjector): support components
- Allow to access containing component directive instance from the shadow DOM.
- Allow to access app services of the app level injector of the component
  when the component is instantiated.
2014-11-13 17:32:52 -08:00
Tobias Bosch 7a70f8f92d feat(compiler): initial version of the compiler.
Supports:
- binds text nodes, element properties and directive properties
- locates decorator, component and template directives.
- inline templates of components

The compiler is built using a pipeline design,
see core/src/compiler/pipeline package.

Integration tests to show how the compiler, change_detection and DI work
together:
core/test/compiler/integration_spec.js
2014-11-11 17:55:50 -08:00
Sekib Omazic 62efb56b0a fix(lang): fix small typo. 2014-11-11 16:59:29 -08:00
Sekib Omazic 398571e3e4 docs(di): simple typo 2014-11-10 17:07:57 -08:00
vsavkin 90fd1a9227 refactor(Parser): cleanup 2014-11-07 16:21:12 -08:00
Alxandr cb276fe412 Fixed small typo in example
Closes #165
2014-11-07 16:20:38 -08:00
Vojta Jina d16d6a02ab feat(transpiler): class fields for Dart 2014-11-07 10:29:48 -08:00
Vojta Jina b4ff802e28 feat(deps): update Traceur 0.0.74 2014-11-07 10:29:48 -08:00
vsavkin a1c6f1bbe9 refactor(Key): extract KeyRegistry to remove the need in `Key.clear` 2014-11-06 10:56:45 -08:00
vsavkin 9448d78aa8 refactor(ProtoElementInjector): change `instantiate` to take positional args 2014-11-06 10:13:07 -08:00
vsavkin b5f6417635 refactor(ElementInjector): use `index` instead of the `elementInjector` field to instantiate element injectors 2014-11-06 10:03:20 -08:00
vsavkin 7908533336 refactor(Parser): cleanup 2014-11-06 09:59:22 -08:00
vsavkin 693489ce38 refactor(Parser): cleanup 2014-11-06 09:11:13 -08:00
vsavkin 7b777b1f71 feat(Parser): add support for method invocations 2014-11-06 09:11:13 -08:00
vsavkin 977bc77c96 feat(Parser): improve error handling 2014-11-06 09:11:13 -08:00
vsavkin ac060ed405 feat(Parser): add support for arrays and maps 2014-11-06 09:11:13 -08:00
vsavkin 8cc008bda1 feat(Parser): add support for assignments 2014-11-06 09:11:13 -08:00
Victor Berchet 0a766f4654 feat(Change Detection): Implement map changes 2014-11-05 14:02:03 -08:00
Victor Berchet 1bd304e7ab feat(Change Detection): Implement collection changes 2014-11-05 13:30:44 -08:00
Vojta Jina 2b7738c12c fix(example): make it work 2014-11-05 11:19:02 -08:00
vsavkin 18cdab7450 refactor(parser): clean up tests 2014-11-04 16:08:01 -08:00
vsavkin 03c779321f cleanup(parser): add type annotations to all AST classes 2014-11-04 15:56:43 -08:00
vsavkin 52b3838a21 feat(parser): split parse into parseBinding and parseAction 2014-11-04 15:51:56 -08:00
vsavkin 00bc9e5d56 feat(parser): add support for formatters 2014-11-04 10:47:33 -08:00
vsavkin 8a829d346b feat(parser): throw when expected an identifier 2014-11-04 09:21:28 -08:00
vsavkin c41f59c794 feat(parser): change Parser to return null when one of the operands is null 2014-11-04 09:06:46 -08:00
vsavkin a7fe25d93f feat(parser): add support for ternary operator 2014-11-03 17:25:16 -08:00
Rado Kirov 965fa1a985 feat(parser): adds basic expressions to the parser.
Mostly copy pasta from angular.dart.

Remove GetterFactory in favor for ClosureMap (which has basically the same
implementation).
2014-10-31 14:32:12 -07:00
Rado Kirov 8c566dcfb5 feat(elementBinder): introduce element binder.
It is a plain-old-data class to seperate the protoInjector from the
textNodes and elementBinding data.
2014-10-30 14:59:32 -07:00
Rado Kirov 91f50b67b7 feat(view): hook watch group instantiation in the view. 2014-10-29 17:04:56 -07:00
vsavkin 01e6c7b70c feat(Parser): implement Parser
Add a simple parser implementation that supports only field reads.
2014-10-29 18:29:34 -04:00
vsavkin acd7035347 feat(test_lib): change test_lib.dart to structurally compare objects 2014-10-29 18:25:32 -04:00
vsavkin 9bd65abb32 feat(ElementInjector): throw when encounter a cyclic dependency 2014-10-29 17:52:51 -04:00
Rado Kirov b0c9d05ea7 feat(view): add onChange implementation to view. 2014-10-29 13:32:20 -07:00
Tobias Bosch 08d4a37c06 feat(selector): initial version of the selector 2014-10-28 14:46:55 -07:00
Tobias Bosch d0c870fb32 feat(facade/collection): add StringMap support 2014-10-28 14:46:38 -07:00
Tobias Bosch d4c099de8c feat(facade/lang): add math and regexp support 2014-10-28 14:46:09 -07:00
Tobias Bosch cc115d58ca fix(facade/lang): use strict equality for performance 2014-10-28 14:45:50 -07:00
Victor Berchet c90a7114d3 feat(ChangeDetector): Add support for chained properties 2014-10-28 11:33:09 +01:00
Victor Berchet 63494a74bf chore(pubspec): fix a typo 2014-10-28 11:17:00 +01:00
vsavkin c11ca944d4 perf(ElementInjector): add a benchmark measuring the instantiation of element injectors without using reflection 2014-10-27 17:56:05 -04:00
vsavkin e3b772425e feat(ElementInjector): change ElementInjector to accept bindings or types 2014-10-27 17:56:05 -04:00
vsavkin 31831eee5e feat(View): implement ProtoView.instantiate 2014-10-27 17:18:35 -04:00
vsavkin 79d270c3dd feat(ElementInjector): add support for "special" objects 2014-10-27 14:14:56 -04:00
vsavkin e3548b497f feat(ElementInjector): implement ElementInjector 2014-10-27 10:16:50 -04:00
vsavkin ea0df352be feat(di): add metadata to Key 2014-10-27 10:04:12 -04:00
vsavkin 2a4b63b614 refactor(collection): use Map instead of Object 2014-10-18 17:50:55 -04:00
vsavkin 1f4caa8773 feat(benchmark): add a simple benchmark for the di module 2014-10-18 17:06:23 -04:00
vsavkin 2f732c6b84 docs(di): add docs to di module 2014-10-14 08:11:44 -04:00
vsavkin 1a7d5160f2 use Promise instead of Future 2014-10-12 17:47:52 -04:00
vsavkin f524a89cb6 feat(injector): add support for default bindings 2014-10-12 17:29:02 -04:00
vsavkin b71cd9f380 refactor(di): use boolean instead of bool 2014-10-12 17:15:58 -04:00
vsavkin 92b2559109 refactor(di): cleanup 2014-10-12 17:06:41 -04:00
vsavkin c3d9b5c91e refactor(di): simplify Injector API 2014-10-12 17:06:41 -04:00
vsavkin f0870791f6 refactor(di): cleanup to make dartanalyzer happy 2014-10-12 17:06:41 -04:00
vsavkin 97667e2591 refactor(di): make use of optional parameters 2014-10-12 17:06:41 -04:00
vsavkin 3f3fb7017e refactor(injector): implement support for nested bindings 2014-10-12 17:06:41 -04:00
vsavkin 0b60f8494d style(di): add new lines 2014-10-12 17:06:41 -04:00
vsavkin d313cac42f refactor(injector): change toFactory to use reflector to construct dependencies 2014-10-12 17:06:40 -04:00
vsavkin 06a221671c refactor(injector): cleanup 2014-10-12 17:06:40 -04:00
vsavkin 9b411372df feat(injector): change injector to recover from errors
So it can instantiate an object after a failed attempt.
2014-10-12 17:06:40 -04:00
vsavkin b9d03e6635 refactor(di): move Dependency from key.js to binding.js 2014-10-12 17:06:40 -04:00
Misko Hevery a9896ed391 design: view instantiation test 2014-10-10 20:54:33 -07:00
Victor Berchet 5527a1b1a4 feature(change detection): implement barebone ChangeDetector
fixes #39
2014-10-08 11:11:56 +02:00
Vojta Jina cfc5fdc60d chore: use es6-module-loader
Switch Traceur to use modules=“instantiate” and use es6-module-loader.
This setup supports cyclic dependencies.
2014-10-07 17:35:22 -07:00
Chirayu Krishnappa e4ce69dcc7 test(scanner): port the rest of the lexer tests from AngularDart
Closes #64
2014-10-07 16:47:50 -07:00
vsavkin 5162b3c0ca refactor(reflector): cleanup 2014-10-07 10:42:27 -04:00
vsavkin 7d566adea0 style(reflector): formatting 2014-10-07 10:34:07 -04:00
vsavkin 187c4aa33c refactor(injector): uses one instance of reflector instead of creating a new instance every time 2014-10-07 10:29:32 -04:00
vsavkin ab4f86a0cb refactor(injector): cleanup 2014-10-07 10:03:06 -04:00
vsavkin ea22cc4c7a refactor(injector): add @FIELD annotations to Key and Dependency 2014-10-07 09:39:52 -04:00
vsavkin df09a7c817 refactor(injector): add bool and int annotations 2014-10-07 09:37:45 -04:00
vsavkin 971e31fcd3 feat(facade): add bool type 2014-10-07 09:37:23 -04:00
vsavkin 4e0c368c03 refactor(injector): remove DIError 2014-10-07 09:21:00 -04:00
vsavkin 62004e22e0 feat(injector): change injector to show the full path when error happens in a constructor (async) 2014-10-07 09:04:11 -04:00
vsavkin e7666d0612 feat(injector): handle async cyclic dependencies 2014-10-06 16:24:12 -04:00
vsavkin a0176273c5 feat(injector): implement InjectLazy 2014-10-06 15:03:05 -04:00
vsavkin e02cdfe733 feat(injector): handle in-progress async construction 2014-10-06 15:03:05 -04:00
vsavkin 4d6c7481ad feat(injector): handle construction errors
- Detect cyclic deps
- Handle initialization errors
2014-10-06 15:03:05 -04:00
vsavkin 14af5a0a42 feat(injector): implement async dependencies 2014-10-06 15:02:41 -04:00
vsavkin a814d48bbc refactor(injector): use @CONST to create the Inject annotation 2014-10-03 20:34:37 -04:00
vsavkin f63a5dd158 refactor(injector): change reflector to collect the resolving path only when an error occurs 2014-10-03 19:54:53 -04:00
vsavkin 15305b6cd7 refactor(facade): instantiate a fixed length array 2014-10-03 16:31:12 -04:00
vsavkin a85812f688 refactor(injector): rename humanize into stringify 2014-10-03 16:29:59 -04:00
vsavkin b2199632c7 feat(injector): initial implementaion of dynamic injector 2014-10-03 15:35:33 -04:00
Misko Hevery 6c8da62c1b fix: Enabled annotation support for Dart 2014-10-02 21:48:46 -07:00
Misko Hevery cbd429640f chore: remove hello test 2014-10-02 21:02:48 -07:00
Victor Berchet 089a2f1b62 feat(transpiler): constructor and typed field semantics
fixes #11 (constructor and typed field semantics)
fixes #42 (Should we infer class property types from ctor args ?)
fixes #17 (number (js) should map to num (dart))

Closes #45
2014-10-02 21:02:47 -07:00
Misko Hevery fd0c2d8063 design: added selector interface 2014-10-02 20:39:27 -07:00
Tobias Bosch 33af1d0b39 chore(build): execute `pub get` only if a pubspec.yaml changed and run `dart analyzer` on all dart files
`pub get` is now only executed when the `pubspec.yaml` in the `modules`
folder is different than the `pubspec.yaml` in the `build/dart` folder.

Generates the file `build/dart/_analyzer.dart` that imports all modules
to run `dart analyzer` against all of them. The build will fail whenever
there are errors, warnings or hints in `dart analyzer`.

Changes the sources so that `dart analyzer` does not report any
error, warning or hint.

Closes #40
2014-10-02 16:10:08 -07:00
Misko Hevery f9923ea7db test: add example test for change_detection 2014-10-01 22:17:14 -07:00
Chirayu Krishnappa 78d758b4bb fixes to get tests green with karma dart 2014-10-01 19:58:22 -07:00
Chirayu Krishnappa d7d52aaef2 refactor(lexer): rename to scanner, use ints, etc. 2014-10-01 17:06:17 -07:00
Chirayu Krishnappa 3482fb1291 feat(facade/lang): support int 2014-10-01 17:06:17 -07:00
Chirayu Krishnappa c85ab3a5a4 feat(lexer): initial (wip) implementation. 2014-10-01 12:50:44 -07:00
Misko Hevery 69210e4fde design: add test change_detection 2014-09-30 17:02:33 -07:00
Misko Hevery e3254d4a7d design: update change_detection 2014-09-30 15:57:05 -07:00
Tobias Bosch c79f0c3472 refactor: simplify and make tests work in JS and Dart
* remove `wraps` syntax enhancements for imports
  and support new `import * as module from ...` syntax

  - default imports are the wrong construct for importing
    everything from a module

* moved tests from transpiler to jasmine and karma

  - transpiler tests are included when running karma in main project folder
  - transpiler is reloaded after every test run in karma,
    so no need to restart karma when the transpiler has been changed.
  - removed own gulp build for transpiler and `postinstall.sh`
    as they are no more needed.
  - transpiler tests are now executed in Dart AND JavaScript (used to be executed
    only in Dart), which allowed to catch some bugs (see the bug with the
    import specification above).

* made tests work in dart as well by using the following hack:

  - dependencies are loaded from the `build` folder, which makes
    running `gulp build` necessary before running karma for dart
  - for this to work,
    the dependencies are included in main `pubspec.yaml` of project
  - reason for the hack: `karma-dart` loads all `packages` urls
    directly from disc (should rather use the karma file list)

* added explicit annotations `FIELD`, `ABSTRACT`, ... to `facade/lang.*`

  - needed for now that we can run tests and don't get errors for undefined
    annotations.

* added `README.md` with details about the build and tests
2014-09-28 21:50:38 -07:00
Misko Hevery 817c005845 test: added simple View test 2014-09-28 20:02:32 -07:00
Misko Hevery 9c7c7e8acf design: simplified view interfaces 2014-09-28 16:30:13 -07:00
Tobias Bosch d42fa07863 fix(examples): make todo example run again 2014-09-26 17:38:38 -07:00
Tobias Bosch c8cf03f200 refactor: move rtts-assert into `modules` directory
The rtts assertion lib is only needed for js, 
but it should be treated like any other module (e.g. facade, …)
2014-09-26 17:36:57 -07:00
Vojta Jina c3b442ea53 chore: karma with JS, Dart
Note: karma with dart is still not working
because of how `karma-dart` loads `package:…` dependencies.

Usage:
```
karma start karma-js.conf.js
karma start karma-dart.conf.js
```

Make sure to set `DARTIUM_BIN` env variable.

Refactors `js2dart`:
- live outside of the traceur module (`tools/js2dart/index.js`)
  so it can be reused by gulp and karma
- automatically build the sources in memory,
  so that `js2dart` can be used without running `gulp build` first
- provide a way to specify the moduleName of a compilation run
  independently of the input filename. This helps error messages
  and source maps (not yet enabled) to report the correct file name

Changes project setup:
- add module `test_lib` that contains the primitives for tests
  (e.g. `describe`, `it`, …)
- clean up some sources that had errors in them
- module names in transpiled js and dart files don’t contain
  `lib`, `test` nor `src` any more (e.g. `di/di`).
2014-09-26 16:53:54 -07:00
Misko Hevery 6335fc407c design: add changed detection API 2014-09-26 15:12:55 -07:00
Tobias Bosch 100d66222c build: execute `pub get` and `dart analyzer`
When chaining a `pubspec.yaml` we automatically run `pub get`.

In `gulp build` we also run `dartanalyzer` for all files
that have the pattern:

`<module>/lib/<module>.dart`

Closes #13
Closes #5
Closes #2
2014-09-25 17:56:05 -07:00
Misko Hevery b42111a608 design: added record interface 2014-09-25 16:53:32 -07:00
Misko Hevery 8afa421d75 first chunk of interfaces that are valid via dart analyzer 2014-09-25 13:51:50 -07:00
Tobias Bosch 57b3297bf6 refactor: always use js2dart traceur and make examples run again 2014-09-24 20:20:59 -07:00
Misko Hevery 6e4477fc08 WIP 2014-09-19 23:03:36 +00:00
Tobias Bosch afa7616464 build - refactor 2014-09-19 13:59:28 -07:00