306 Commits

Author SHA1 Message Date
Tobias Bosch
8db77f2405 refactor(build): simplify and modularize
simplify:
- use same html file for dart and JS
- build benchmarks automatically when doing `gulp build`
- centralize configuration

modularize:
- move all build tasks into separate node.js modules under
  `tools/build`.

changes:
- the `build` folder is now the `dist` folder

Closes 
2014-12-05 16:30:36 -08:00
Tommy Odom
f088e9ef15 feat(transpiler): Transform for..of to Dart as for..in
fixes 
2014-12-03 10:48:48 +01:00
Misko Hevery
044625a098 chore: Make field declarations explicit
This used to be valid code:

```
class Foo {
  constructor() {
    this.bar = ‘string’;
  }
}
```

This will now fail since ‘bar’ is not explicitly
defined as a field. We now have to write:

```
class Foo {
  bar:string; // << REQUIRED
  constructor() {
    this.bar = ‘string’;
  }
}
```
2014-11-24 16:35:39 -08:00
Victor Berchet
f864aa1f8e fix(class fields): handle untyped fields 2014-11-19 23:12:14 +01:00
Vojta Jina
c68e78075a feat(transiler/dart): re-export imported vars
```
import {Foo} from ‘./foo’;
var localVar = true;
export {Foo, localVar};

===>

import ‘./foo’ show Foo;
export ‘./foo’ show Foo;
var localVar = true;
```

Closes 
2014-11-12 07:01:14 -08:00
Vojta Jina
c5153175b6 fix(transpiler/dart): re-exporting only some bindings
```
export {Foo, Bar} from ‘./foo’;
==>
export ‘./foo’ show Foo, Bar;
```
2014-11-12 07:01:14 -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
Tommy Odom
93f6d26f68 feat(transpiler): Transform template strings to triple quoted Dart strings 2014-11-10 16:49:51 -08:00
Rado Kirov
4f416694a5 bug(transpiler): Support optional arguments in annotations.
Clean-up: move annotaitons out of fixtures/annotations, since we have
the @CONST annotation in the transpiler already.
2014-11-10 13:47:30 -08:00
Vojta Jina
d16d6a02ab feat(transpiler): class fields for Dart 2014-11-07 10:29:48 -08:00
Tommy Odom
8e6326f838 feat(transpiler): allow @CONST annotation on class
Closes 
2014-11-05 15:44:34 -08:00
Vojta Jina
7d0a83a24c chore(gulp-traceur): better error reporting
Use original filename when printing errors (instead of the output).
2014-11-05 11:42:23 -08:00
Vojta Jina
1dc5a22f07 chore: source maps for Karma/Gulp
For Karma, the source mapa are inlined inside each source file.
For `build/*` output, separate `*.map` file is created.

This changes the API of `tools/transpiler/index.js`. I believe this API
is only used in `gulp-traceur.js` and `karma-traceur-preprocessor.js`.
Instead of returning the transpiled string, `compile()` returns a result
object such as:
```js
{
  js: ‘transpiled code’,
  sourceMap: null || {}
}
```

Closes 
2014-11-05 11:19:02 -08:00
Marc Laval
e1c84e02f8 chore: adds Windows support for build
Closes 
2014-10-28 21:04:30 -07:00
Victor Berchet
94958e084e fix(super): super() now means call the proto of the current function.
See https://github.com/google/traceur-
compiler/commit/6732e5eddf203ae02bcfb8faea837590bf32c061
2014-10-27 22:26:38 +01:00
vsavkin
035dc5ba44 feat(transpiler): add support for getters 2014-10-16 16:11:18 -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
ee1e54cf0a feat(transpiler): add support for named params to new expressions 2014-10-12 17:21:50 -04:00
Misko Hevery
a9896ed391 design: view instantiation test 2014-10-10 20:54:33 -07:00
Vojta Jina
2d19e7122b refactor(transpiler): instanceof 2014-10-09 15:22:21 -07:00
Vojta Jina
c7e9d10f0b test(transpiler): add spec for instanceof 2014-10-09 15:22:20 -07:00
Vojta Jina
85ee62cb0d chore(transpiler): show filepath when error happens 2014-10-09 15:17:53 -07:00
Vojta Jina
94e556465b fix(transpiler): only call transform/visit when defined
Our custom ParseTree classes should not expect that every
transformer/visitor defines the methods to transform/visit them.
2014-10-09 15:08:30 -07:00
Victor Berchet
d1b90e125b feat(transpiler): add support for arrow functions
fixes 
2014-10-09 14:44:07 -07:00
vsavkin
1214f423b4 feat(transpiler): implement optional params 2014-10-09 14:27:32 -07:00
Victor Berchet
5818c3bf28 refactor(named parameters): mimic original traceur architecture 2014-10-08 12:53:55 +02:00
Vojta Jina
38340ce8d9 test(transpiler): add a cycle import spec 2014-10-07 17:35:22 -07:00
Vojta Jina
6efb7f9017 transpiler: normalize Dart library name
`file2module` was used for normalizing paths where `-` is fine.
This normalizes non-word characters only when generating the Dart
library name.
2014-10-07 17:35:22 -07: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
vsavkin
b2199632c7 feat(injector): initial implementaion of dynamic injector 2014-10-03 15:35:33 -04:00
Victor Berchet
089a2f1b62 feat(transpiler): constructor and typed field semantics
fixes  (constructor and typed field semantics)
fixes  (Should we infer class property types from ctor args ?)
fixes  (number (js) should map to num (dart))

Closes 
2014-10-02 21:02:47 -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 
2014-10-02 16:10:08 -07:00
vsavkin
64fe73e20d feat(transpiler): handle named params 2014-10-02 17:31:04 -04:00
Chirayu Krishnappa
78d758b4bb fixes to get tests green with karma dart 2014-10-01 19:58:22 -07:00
Chirayu Krishnappa
c7feaba1cb feat(DartWriter): support string interpolation 2014-10-01 17:06:17 -07:00
Victor Berchet
cff47d4f8e fix(DartWriter): number (js) maps to num (dart) 2014-10-01 11:22:47 -07:00
Victor Berchet
64d3cc68f0 refactor(transpiler): split the monolithic dart transformer
fixes 

The new architecture conforms with the Traceur architecture.
2014-09-30 16:15:35 +02:00
Tobias Bosch
1907c590c8 refactor: removed stale build file 2014-09-29 14:21:38 -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
Tobias Bosch
39c03e67e6 refactor: rename js2dart to transpiler 2014-09-26 17:44:42 -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
Tobias Bosch
7e3005e705 fix(js2dart): make tests work again 2014-09-26 09:54:32 -07:00
Victor Berchet
a75a3d0b31 refactor(js2dart): use the parent functionalities as mush as possible
Closes 
2014-09-26 09:54:24 -07:00
Victor Berchet
2cc1a4c354 refactor(js2dart): refactor dart library statement
fixes 
closes 
2014-09-26 09:39:37 -07:00
Misko Hevery
87dd88ff0c fix: correct library not to have lib and dart in name. 2014-09-26 09:23:04 -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 
Closes 
Closes 
2014-09-25 17:56:05 -07:00
Misko Hevery
b42111a608 design: added record interface 2014-09-25 16:53:32 -07:00
Tobias Bosch
97f6ceb27b moved submodules into this project 2014-09-25 14:30:10 -07:00
Tobias Bosch
61ceed5bf6 moved submodules into the repo 2014-09-25 14:29:51 -07:00