Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

RFC: Refactor the bootstrap process in 4.0.0 #357

Closed
matanlurey opened this issue Apr 24, 2017 · 0 comments
Closed

RFC: Refactor the bootstrap process in 4.0.0 #357

matanlurey opened this issue Apr 24, 2017 · 0 comments

Comments

@matanlurey
Copy link
Contributor

matanlurey commented Apr 24, 2017

~~~We alternatively could also rename it to just `bootstrap`, or similar.~~~

Some background:

* The runtime (reflective) compiler is being completely removed. Compilation is required.
* Right now there are two bootstrap methods, one uses `dart:mirrors`.
* DDC has no support for `dart:mirrors`, and it is highly discouraged for dart2js.

_Internal users, you use a different build process, so please ignore anything remarking pub transformers. Thanks!_

## Don't require importing platform/*.dart

Both `bootstrap` and `bootstrapStatic` should be exported by `angular2.dart`. This removes having to remember or understand why they are in separate files, which doesn't make sense in AngularDart, especially after the runtime compiler is deleted.

## Changes to bootstrap(...)

`bootstrap` should be a no-op function that throws a runtime exception if used. For example:

```dart
Future<ComponentRef> bootstrap(Type appComponentType, [List providers]) {
  throw new UnsupportedError('Using the AngularDart transformer is required. See <url>.');
}
```

Once transformed, it will actually refer to `bootstrapStatic`, i.e.:

```dart
import 'package:angular2/angular2.dart';

void main() {
  bootstrap(HelloWorldComponent);
}
```

Gets re-written to:

```dart
import 'package:angular2/angular2.dart';
import 'main.template.dart' as ng;

void main() {
  bootstrapStatic(HelloWorldComponent, [], ng.initReflector);
}
```

Users can also hand-write the transformed output if they prefer to.
@matanlurey matanlurey added this to the V4 Beta milestone Apr 24, 2017
@matanlurey matanlurey changed the title Include bootstrapStatic by default in angular2.dart RFC: Refactor the bootstrap process in 4.0.0 May 11, 2017
@matanlurey matanlurey assigned matanlurey and unassigned matanlurey May 25, 2017
@leonsenft leonsenft self-assigned this May 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants