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

RFC: Refactor the bootstrap process in 4.0.0 #357

@matanlurey

Description

@matanlurey
~~~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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions