Commit Graph

92 Commits

Author SHA1 Message Date
Igor Minar 44de10e2db feat: mark angular packages as side-effect free (#22785)
This flag is picked up by webpack v4 and used for more agressive optimizations.

Our code is already side-effect free, because that's what we needed for build-optimizer to work.

PR Close #22785
2018-03-15 14:52:40 -07:00
Alex Eagle 88b3198c80 feat(bazel): change ng_package rule to APF v6 (#22782)
Angular Package Format v6 stops bundling files in the esm5 and esm2015
directories, now that Webpack 4 can tree-shake per-file.

Adds some missing files like package.json to make packages closer to
what we publish today.

Refactor ng_package to be a type of npm_package and re-use the packaging
action from that rule.

PR Close #22782
2018-03-15 11:38:31 -07:00
Alex Eagle 1e6cc42a01 test: migrate remaining public-api tests to Bazel (#22639)
We now create npm packages to cover all the public api assertions in tools/public_api_guard.
We no longer depend on ts-api-guardian from npm - it is now stale since the repository was archived.
There is no longer a gulp task to enforce or accept the public API, this is in CircleCI as part of running all bazel test targets.

PR Close #22639
2018-03-09 09:11:40 -08:00
Igor Minar 489fec1299 feat: update tslib to 1.9.0 (#22667)
BREAKING CHANGE: after this change, npm and yarn will issue incompatible peerDependencies warning

We don't expect this to actually break an application, but the application/library package.json
will need to be updated to provide tslib 1.9.0 or higher.

PR Close #22667
2018-03-08 16:42:34 -08:00
Hans Larsen 288851c41e release: add ng update package group metadata to angular (#22482)
"ng update" supports having multiple packages as part of a group which should be updated together, meaning that e.g. calling "ng update @angular/core" would be equivalent to updating all packages of the group (that are part of the package.json already).

In order to support the grouping feature, the package.json of the version the user is updating to needs to include an "ng-update" key that points to this metadata.

The entire specification for the update workflow can be found here: 2e8b12a4ef/docs/specifications/update.md

PR Close #22482
2018-02-28 14:57:53 -08:00
George Kalpakas 8a85888773 fix(upgrade): correctly destroy nested downgraded component (#22400)
Previously, when a downgraded component was destroyed in a way that did
not trigger the `$destroy` event on the element (e.g. when a parent
element was removed from the DOM by Angular, not AngularJS), the
`ComponentRef` was not destroyed and unregistered.
This commit fixes it by listening for the `$destroy` event on both the
element and the scope.

Fixes #22392

PR Close #22400
2018-02-27 18:41:02 -08:00
George Kalpakas 13ab91e05d fix(upgrade): fix empty transclusion content with AngularJS@>=1.5.8 (#22167)
The function provided by `ngUpgrade` as `parentBoundTranscludeFn` when
upgrading a component with transclusion, will break in AngularJS v1.5.8+
if no transclusion content is provided. The reason is that AngularJS
will try to destroy the transclusion scope (which would not be needed
any more). But since the transcluded content comes from Angular, not
AngularJS, there is no transclusion scope to destroy.
This commit fixes it by providing a dummy scope object with a no-op
`$destroy()` method.

Fixes #22175

PR Close #22167
2018-02-25 10:06:14 -08:00
George Kalpakas f089bf5333 fix(upgrade): correctly handle `=` bindings in `@angular/upgrade` (#22167)
Previously, having a `=` binding on an upgraded components would result
in setting the corresponding property to an EventEmitter function. This
should only happen for `&` bindings.
This commit rstrores the correct behavior.

Note:
The issue was only present in the dynamic version of `ngUpgrade`. The
static version worked as expected.
The error did not show up in tests, because in AngularJS v1.5.x a
function would be serialized to an empty string in interpolations, thus
making them indistinguishable from uninitialized properties (in the
view). The serialization behavior changed in AngularJS v1.6.x, making
the errors visible.

PR Close #22167
2018-02-25 10:06:14 -08:00
George Kalpakas 8e1e040f72 test(upgrade): run tests against multiple AngularJS versions (#22167)
Fixes #19332

PR Close #22167
2018-02-25 10:06:14 -08:00
George Kalpakas 28240625e6 refactor(upgrade): use correct paths for imports (#22167)
`packages/upgrade/static/src` is anymlink to `packages/upgrade/src`.
Still, using the correct paths (e.g. using
`@angular/upgrade/static/src/...` for `@angula/upgrade/static` specs
ensures that the module loader (e.g. SystemJS) can map the imports to
the same instances.

PR Close #22167
2018-02-25 10:06:14 -08:00
Alex Eagle a069e08354 refactor(bazel): convert most ts_library to ng_module (#22176)
This is necessary so we can produce ng metadata for our packages that are published as libraries

PR Close #22176
2018-02-15 14:08:53 -08:00
Adrien Boullé 020338230f style: fix typos boostrap to bootstrap (#21917)
PR Close #21917
2018-02-15 09:54:00 -08:00
Matias Niemelä 831592c381 Revert "style: fix typos boostrap to bootstrap (#21917)"
This reverts commit 363498b6b4.
2018-02-14 22:56:44 -05:00
Adrien Boullé 363498b6b4 style: fix typos boostrap to bootstrap (#21917)
PR Close #21917
2018-02-14 18:21:52 -05:00
Alex Eagle c4f02e21dd build: move repeated tsconfig attributes to a macro (#20964)
This helps ensure we use the same tsconfig.json file for all compilations.
Next steps are to make it the same tsconfig.json file used by the editor

PR Close #20964
2018-01-10 12:30:19 -08:00
Miško Hevery 83c1383701 build: upgrade circle/build into large class (more ram) (#21053)
PR Close #21053
2017-12-22 13:10:51 -08:00
Miško Hevery ae97920fe2 build: move _testing_init into tools; limit web_test concurrency (#21053)
PR Close #21053
2017-12-22 13:10:51 -08:00
Misko Hevery bdee1f4a25 build(upgrade): enable bazel tests for upgrade (#21053)
Added missing angular-mocks dependency.

PR Close #21053
2017-12-22 13:10:51 -08:00
Misko Hevery 3d50fd7cac build: add bazel test rules for remainder of packages (#21053)
PR Close #21053
2017-12-22 13:10:51 -08:00
Misko Hevery 47e251a80a build: remove `main()` from specs (#21053)
PR Close #21053
2017-12-22 13:10:51 -08:00
vsavkin 057513536b fix(upgrade): replaces get/setAngularLib with get/setAngularJSGlobal
The current names are confusing because Angular should refer to the latest version of the framework.
2017-12-18 12:10:01 -08:00
Olivier Combe b7738e1fe5 feat(core): add source to `StaticInjectorError` message (#20817)
Closes #19302
PR Close #20817
2017-12-12 11:56:06 -08:00
Alex Eagle ef534c0cc1 build: upgrade bazel rules to latest (#20768)
Add enough BUILD files to make it possible to
`bazel build packages/core/test`

Also re-format BUILD.bazel files with Buildifier.
Add a CI lint check that they stay formatted.

PR Close #20768
2017-12-07 11:27:50 -08:00
Alex Eagle 5ec1717c58 fix: Update test code to type-check under TS 2.5 (#20175)
PR Close #20175
2017-11-15 18:12:16 -06:00
Victor Berchet f0764016f9
revert: feat(core): add source to `StaticInjectorError` message (#19482) (#20171)
This reverts commit faa621218e.
2017-11-03 14:51:06 -07:00
Olivier Combe faa621218e feat(core): add source to `StaticInjectorError` message (#19482) 2017-11-03 11:14:05 -07:00
Hans Larsen b6abcb2500 refactor: make all rollup config ES5 compatible (#20028)
So they can be required by other Node scripts.

PR Close #20028
2017-10-30 23:09:17 -04:00
George Kalpakas eef7d8aa11 fix(upgrade): call `ngOnInit()` after `ngOnChanges()` (on components with inputs)
Fixes #18913
2017-10-02 16:01:07 -07:00
George Kalpakas 617b3d2ba5 fix(upgrade): correctly run change detection when `propagateDigest` is false 2017-10-02 16:01:07 -07:00
George Kalpakas 546eb7d851 test(upgrade): ensure AngularJS is bootstraped inside the Angular zone in tests 2017-10-02 16:01:07 -07:00
George Kalpakas 29dbc3b67c refactor(upgrade): remove redundant call to `appRef.detach()`
Once  a `ViewRef` is attached to the `ApplicationRef`, destroying the corresponding `ComponentRef` will automatically detach the `ViewRef`.
2017-10-02 16:01:07 -07:00
George Kalpakas 4e6aa9c2db fix(upgrade): ensure downgraded components are destroyed in the Angular zone 2017-10-02 16:01:07 -07:00
Alex Eagle 82e49230ff build: Give names to the AMD modules nested in Angular UMD distro (#19425) 2017-09-28 09:29:22 -07:00
Olivier Combe 0f5c70d563 build: update npm dependencies (#19328)
PR Close #19328
2017-09-22 13:20:52 -07:00
Miško Hevery 344a5ca545 feat(core): support for bootstrap with custom zone (#17672)
PR Close #17672
2017-09-21 16:51:48 -07:00
Chuck Jazdzewski f96142cd7c build: remove references to `tsc-wrapped` (#19298)
With this commit `ngc` is used instead of `tsc-wrapped` for
collecting metadata and tsickle rewriting and `tsc-wrapped`
is removed from the repository.

`@angular/tsc-wrapped@5` is now deprecated and is no longer
used, updated, or maintained as part as of Angular 5.x.x.

`@angular/tsc-wrapped@4` is still maintained and required by
Angular 4.x.x and will be maintained as long as 4.x.x is in
LTS.

PR Close #19298
2017-09-21 13:55:52 -07:00
George Kalpakas 4586fccae4 refactor(upgrade): use correct property name (#19180)
It doesn't make any difference in this case, because the we only check the
property for truthfulness (and being undefined has the same effect as being set
to false).

PR Close #19180
2017-09-20 16:18:53 -07:00
Jason Aden 15e8d50313 build: roll up to named .js files rather than 'index.js' (#19190)
PR Close #19190
2017-09-19 16:59:18 -07:00
Yi Qi 97cc6caa33 fix(upgrade): add testability hook to downgraded component
Add testability hook to downgraded component so that protractor can wait for asynchronous call to complete.
Add unregisterApplication() and unregisterAllApplications() to testability registry for cleaning up testability and unit test.
2017-09-12 16:59:27 -04:00
Tobias Bosch ca5aebaa6b refactor: update angular to support TypeScript 2.4
Detailed updates:
- rxjs@5.0.x
- tsickle@0.24.x
- typescript@2.4.x
- @bazel/typescript@0.10.0
- protractor@5.1.x
- selenium-webdriver@3.0.x

BREAKING CHANGE:
- the Angular compiler now requires TypeScript 2.4.x.
2017-09-12 10:31:30 -07:00
Rado Kirov b6833d1bbd fix(upgrade): remove code setting id attribute.
The id was leftover from previous iterations of ngUpgrade and is
no longer needed. Moreover, setting it can clash with CSS usage of id.

Fixes #18446
2017-09-07 14:22:07 -04:00
Georgios Kalpakas 450a13dea0 fix(upgrade): deprecate the dynamic version of `ngUpgrade` 2017-09-01 12:23:11 -05:00
Jason Aden fd701b07f0 build: publish tree of files rather than FESMs (#18541)
* Remove now unnecessary portions of build.
* Add a compilePackageES5 method to build ES5 from sources
* Rework all package.json and rollup config files to new format
* Remove "extends" from tsconfig-build.json files and fixup compilation roots

PR Close #18541
2017-08-31 15:34:50 -07:00
Miško Hevery cac130eff9 perf(core): Remove decorator DSL which depends on Reflect
BREAKING CHANGE

It is no longer possible to declare classes in this format.

```
Component({...}).
Class({
  constructor: function() {...}
})
```

This format would only work with JIT and with ES5. This mode doesn’t
allow build tools like Webpack to process and optimize the code, which
results in prohibitively large bundles. We are removing this API
because we are trying to ensure that everyone is on the fast path by
default, and it is not possible to get on the fast path using the ES5
DSL. The replacement is to use TypeScript and `@Decorator` format.

```
@Component({...})
class {
  constructor() {...}
}
```
2017-08-11 09:27:07 -07:00
Miško Hevery fcadbf4bf6 perf: switch angular to use StaticInjector instead of ReflectiveInjector
This change allows ReflectiveInjector to be tree shaken resulting
in not needed Reflect polyfil and smaller bundles.

Code savings for HelloWorld using Closure:

Reflective: bundle.js:  105,864(34,190 gzip)
    Static: bundle.js:  154,889(33,555 gzip)
                            645( 2%)

BREAKING CHANGE:

`platformXXXX()` no longer accepts providers which depend on reflection.
Specifically the method signature when from `Provider[]` to
`StaticProvider[]`.

Example:
Before:
```
[
  MyClass,
  {provide: ClassA, useClass: SubClassA}
]

```

After:
```
[
  {provide: MyClass, deps: [Dep1,...]},
  {provide: ClassA, useClass: SubClassA, deps: [Dep1,...]}
]
```

NOTE: This only applies to platform creation and providers for the JIT
compiler. It does not apply to `@Compotent` or `@NgModule` provides
declarations.

Benchpress note: Previously Benchpress also supported reflective
provides, which now require static providers.

DEPRECATION:

- `ReflectiveInjector` is now deprecated as it will be remove. Use
  `Injector.create` as a replacement.

closes #18496
2017-08-07 15:42:34 -07:00
Chuck Jazdzewski ea07856cc5 refactor(upgrade): compile upgrade cleanly with TypeScript 2.4 (#18461) 2017-08-02 16:28:04 -07:00
Marc Laval 6a88659c9a test(upgrade): fix an IE9 timer issue in downgrade module tests (#18482) 2017-08-02 16:09:38 -07:00
Georgios Kalpakas 43c33d5663 fix(upgrade): ensure downgraded components are created in the Angular zone (#18209)
PR Close #18209
2017-07-20 16:25:11 -05:00
Georgios Kalpakas 6d7799fce9 test(upgrade): fail tests when there are AngularJS errors (#18209) 2017-07-20 16:25:07 -05:00
Georgios Kalpakas d31dc7b2b3 fix(upgrade): throw error if trying to get injector before setting (#18209)
Previously, `undefined` would be returned.
This change makes it easier to identify incorrect uses/bugs.
(Discussed in https://github.com/angular/angular/pull/18213#issuecomment-316191308.)
2017-07-20 16:24:45 -05:00