Commit Graph

14404 Commits

Author SHA1 Message Date
Igor Minar bb47ad295a docs: navigation and org changes, misc edits (#26733)
Co-Authored-By: jenniferfell <jenniferfell.sf@gmail.com>

PR Close #26733
2019-04-25 10:55:43 -07:00
jenniferfell 169d51beb8 docs: changed wording for loadChildren per reviewer comments on PR (#26733)
PR Close #26733
2019-04-25 10:55:43 -07:00
jenniferfell 8b0ebe17b3 docs: clean up deprecation summary, remove outdated information and notes (#26733)
PR Close #26733
2019-04-25 10:55:43 -07:00
Andrew Kushnir a400429faa docs: temporary disable aio_monitoring job due to a version skew (#30102)
Redirects that were updated in 24c61cb63e break the aio_monitoring CircleCI job, since we run the tests against the production angular.io site (that doesn't have the latest redirects config yet).

This change temporary disables the aio_monitoring job to avoid failures for other PRs. The problem will be resolved and the job will be enabled in followup PRs.

PR Close #30102
2019-04-24 18:01:50 -07:00
jenniferfell e720675f8b docs(docs-infra): add jennifer to fw-docs-intro codeowners, add codeowners for schematics docs (#28992)
PR Close #28992
2019-04-24 17:12:05 -07:00
Alex Rickabaugh d316a18dc6 fix(ivy): don't include query fields in type constructors (#30094)
Previously, ngtsc included query fields in the list of fields which can
affect the type of a directive via its type constructor. This feature
however has yet to be built, and View Engine in default mode does not
do this inference.

This caused an unexpected bug where private query fields (which should be
an error but are allowed by View Engine) cause the type constructor
signature to be invalid. This commit fixes that issue by disabling the
logic to include query fields.

PR Close #30094
2019-04-24 17:10:21 -07:00
Alex Rickabaugh 79141f4424 fix(ivy): generate default 'any' types for type ctor generic params (#30094)
ngtsc generates type constructors which infer the type of a directive based
on its inputs. Previously, a bug existed where this inference would fail in
the case of 'any' input values. For example, the inference of NgForOf fails
when an 'any' is provided, as it causes TypeScript to attempt to solve:

T[] = any

In this case, T gets inferred as {}, the empty object type, which is not
desirable.

The fix is to assign generic types in type constructors a default type of
'any', which TypeScript uses instead of {} when inference fails.

PR Close #30094
2019-04-24 17:10:21 -07:00
Keen Yee Liau 28fd5ab12b fix(compiler): Fix compiler crash due to isSkipSelf of null (#30075)
PR Closes https://github.com/angular/angular/issues/27125

PR Close #30075
2019-04-24 17:06:53 -07:00
Alex Rickabaugh c61df39323 feat(router): deprecate loadChildren:string (#30073)
The proposed ES dynamic import() is now supported by the Angular CLI and the
larger toolchain. This renders the `loadChildren: string` API largely
redundant, as import() is far more natural, is less error-prone, and is
standards compliant. This commit deprecates the `string` form of
`loadChildren` in favor of dynamic import().

DEPRECATION:

When defining lazy-loaded route, Angular previously offered two options for
configuring the module to be loaded, both via the `loadChildren` parameter
of the route. Most Angular developers are familiar withthe `string` form of
this API. For example, the following route definition configures Angular to
load a `LazyModule` NgModule from `lazy-route/lazy.module.ts`:

```
[{
  path: 'lazy',
  loadChildren: 'lazy-route/lazy.module#LazyModule',
}]
```

This "magic string" configuration was previously necessary as there was
no dynamic module loading standard on the web. This has changed with the
pending standardization of dynamic `import()` expressions, which are now
supported in the Angular CLI and in web tooling in general. `import()`
offers a more natural and robust solution to dynamic module loading. The
above example can be rewritten to use dynamic `import()`:

```
[{
  path: 'lazy',
  loadChildren: () => import('./lazy-route/lazy.module').then(mod => mod.LazyModule),
}]
```

This form of lazy loading offers significant advantages in terms of:

* type checking via TypeScript
* simplicity of generated code
* future potential to run natively in supporting browsers
  (see: [caniuse: dynamic import()](https://caniuse.com/#feat=es6-module-dynamic-import))

As a result, Angular is deprecating the `loadChildren: string` syntax in
favor of ES dynamic `import()`. An automatic migration will run during
`ng upgrade` to convert your existing Angular code to the new syntax.

PR Close #30073
2019-04-24 17:06:05 -07:00
George Kalpakas abcb2cf9a0 refactor(upgrade): rename `module` constant to avoid webpack bug (#30058)
When targeting ES2015 (as is the default in cli@8), `const` is not
downleveled to `var` and thus declaring `const module` throws an error
due to webpack wrapping the code in a function call with a `module`
argument (even when compiling for the `web` environment).

Related: webpack/webpack#7369

Fixes #30050

PR Close #30058
2019-04-24 17:03:51 -07:00
Alex Eagle a9379e0ed2 docs(bazel): add aio/guide/bazel (#30042)
PR Close #30042
2019-04-24 17:01:59 -07:00
Filipe Silva 6da19599de docs: copy edits to Ivy opt-in (#29955)
PR Close #29955
2019-04-24 17:00:55 -07:00
Filipe Silva 46f547499d docs: remove enumeration of one in Ivy opt-in (#29955)
PR Close #29955
2019-04-24 17:00:55 -07:00
Filipe Silva 2864108510 docs: remove lazy route step from Ivy opt-in (#29955)
PR Close #29955
2019-04-24 17:00:55 -07:00
Filipe Silva e95f460f39 docs: remove aot step from Ivy opt-in (#29955)
PR Close #29955
2019-04-24 17:00:54 -07:00
jenniferfell 75a23ab623 docs: update deprecation practices, update release date, edits for readability and consistency (#29644)
PR Close #29644
2019-04-24 17:00:23 -07:00
Jason Aden 071ee64d91 refactor(common): rename LocationUpgradeService and remove angular/upgrade dependency (#30055)
PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden efdbbe1aa6 test(common): add fallback for URL parsing in older browsers (IE < Edge) (#30055)
PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden c0c8d2349c test: increase payload limits due to new additions in the angular/common/upgrade package (#30055)
PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden 4277600d5e feat(common): provide replacement for AngularJS $location service (#30055)
This commit provides a replacement for `$location`. The new service is written in Angular, and can be consumed into existing applications by using the downgraded version
of the provider.

Prior to this addition, applications upgrading from AngularJS to Angular could get into a situation where AngularJS wanted to control the URL, and would often parse or se
rialize the URL in a different way than Angular. Additionally, AngularJS was alerted to URL changes only through the `$digest` cycle. This provided a buggy feedback loop
from Angular to AngularJS.

With this new `LocationUpgradeProvider`, the `$location` methods and events are provided in Angular, and use Angular APIs to make updates to the URL. Additionally, change
s to the URL made by other parts of the Angular framework (such as the Router) will be listened for and will cause events to fire in AngularJS, but will no longer attempt
 to update the URL (since it was already updated by the Angular framework).

This centralizes URL reads and writes to Angular and should help provide an easier path to upgrading AngularJS applications to Angular.

PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden f185ff3792 build(common): add upgrade package dependency common/upgrade (#30055)
PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden ec455e1cf1 feat(common): add UrlCodec type for use with upgrade applications (#30055)
This abstract class (and AngularJSUrlCodec) are used for serializing and deserializing pieces of a URL string. AngularJS had a different way of doing this than Angular, and using this class in conjunction with the LocationUpgradeService an application can have control over how AngularJS URLs are serialized and deserialized.

PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden 825efa8721 fix(common): adjust MockPlatformLocation to set state to new object (#30055)
When using the `history` API, setting a new `state` and retrieving it does not pass a `===` test to the object used to set the state. In other words, `history.state` is always a copy. This change makes the `MockPlatformLocation` behave in the same way.

PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden 3a9cf3f2ba feat(common): add ability to track all location changes (#30055)
This feature adds an `onUrlChange` to Angular's `Location` class. This is useful to track all updates coming from anywhere in the framework. Without this method, it's difficult (or impossible) to track updates run through `location.go()` or `location.replaceState()` as the browser doesn't publish events when `history.pushState()` or `.replaceState()` are run.

PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden 152d99eef0 feat(common): add @angular/common/upgrade package for $location-related APIs (#30055)
AngularJS's `$location` service doesn't have a direct counterpart in Angular. This is largely because the `Location` service in Angular was pulled out of the `Router`, but was not purpose-built to stand on its own.

This commit adds a new `@angular/common/upgrade` package with the beginnings of a new `LocationUpgradeService`. This service will more closely match the API of AngularJS and provide a way to replace the `$location` service from AngularJS.

PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden b635fe80cc feat(common): add APIs to read component pieces of URL (#30055)
Without this change, the framework doesn't surface URL parts such as hostname, protocol, and port. This makes it difficult to rebuild a complete URL. This change provides new APIs to read these values.

PR Close #30055
2019-04-24 13:49:29 -07:00
Jason Aden b44b14368f feat(common): add ability to retrieve the state from Location service (#30055)
Previously there wasn't a way to retrieve `history.state` from the `Location` service. The only time the framework exposed this value was in navigation events. This meant if you weren't using the Angular router, there wasn't a way to get access to this `history.state` value other than going directly to the DOM.

This PR adds an API to retrieve the value of `history.state`. This will be useful and needed to provide a backwards-compatible `Location` service that can emulate AngularJS's `$location` service since we will need to be able to read the state data in order to produce AngularJS location transition events.

This feature will additionally be useful to any application that wants to access state data through Angular rather than going directly to the DOM APIs.

PR Close #30055
2019-04-24 13:49:28 -07:00
Jason Aden d0672c252e feat(common): add MockPlatformLocation to enable more robust testing of Location services (#30055)
Prior to this change we had a MockLocationStrategy to replace the Path and Hash Location Strategies. However, there wasn't a good way to test the PlatformLocation which is needed for doing things such as setting history.state, using back()/forward(), etc.

PR Close #30055
2019-04-24 13:49:28 -07:00
Alex Rickabaugh 3938563565 fix(ivy): don't reuse a ts.Program more than once in ngtsc (#30090)
ngtsc previously could attempt to reuse the main ts.Program twice. This
occurred when template type-checking was enabled and then an incremental
build was performed. This breaks a TypeScript invariant - ts.Programs can
only be reused once.

The creation of the template type-checking program reuses the main program,
rendering it moot. Then, on the next incremental build the main program
would be subject to reuse again, which would crash inside TypeScript.

This commit fixes the issue by reusing the template type-checking program
from the previous run on the next incremental build. Since under normal
circumstances the files in the type-checking program aren't changed, this
should be just as fast.

Testing strategy: a test is added in the incremental_spec which validates
that program reuse with type-checking turned on does not crash the compiler.

Fixes #30079

PR Close #30090
2019-04-24 11:41:21 -07:00
Dustin M. Eastway 00ea3983e3 docs(docs-infra): fix typo in the aio/tools/examples/README (#30041)
Remove an 'a' that was accidentally repeated twice in the aio/tools/examples/README.md file.

PR Close #30041
2019-04-24 11:33:23 -07:00
Kristiyan Kostadinov ae93ba1140 fix(ivy): don't throw error when evaluating function with more than one statement (#30061)
Resolves functions with more than one statement to unknown dynamic values, rather than throwing an error.

PR Close #30061
2019-04-24 11:32:56 -07:00
Kristiyan Kostadinov 2e21997016 perf(ivy): remove megamorphic read from renderStringify (#30082)
The `renderStringify` function is used in a lot of performance-sensitive places, however it contains a megamorphic read which is used primarily for error messages. These changes introduce a new function that can be used to stringify output for errors and removes the megamorphic read from `renderStringify`.

This PR resolves FW-1286.

PR Close #30082
2019-04-24 11:31:48 -07:00
Vani 24c61cb63e docs: add redirect link to deprecation summary page (#29951)
PR Close #29951
2019-04-24 11:07:14 -07:00
Andrew Kushnir d0ca7c792d docs: add Andrew Kushnir to Angular team (#30045)
PR Close #30045
2019-04-24 11:04:13 -07:00
George Kalpakas 6c88eb7477 ci: add `aio/content/examples/*` to `docs-infra` group (#30087)
This directory contains some top-level files (`.gitignore`,
`tsconfig.json`, `tslint.json`) that are related to the examples
infrastructure (building, linting, etc.).

They had previously no owner; now they are owned by the `docs-infra`
group.

PR Close #30087
2019-04-24 10:50:01 -07:00
Pete Bacon Darwin 0fa76219ac refactor(ivy): ngcc - simplify `NewEntryPointFileWriter` code (#30085)
The lines that compute the paths for this writer were confusing.
This commit simplifies and clarifies what is being computed.

PR Close #30085
2019-04-24 10:49:31 -07:00
Pete Bacon Darwin 6af9b8fb92 fix(ivy): ngcc - do not copy external files when writing bundles (#30085)
Only the JS files that are actually part of the entry-point
should be copied to the new entry-point folder in the
`NewEntryPointFileWriter`.

Previously some typings and external JS files were
being copied which was messing up the node_modules
structure.

Fixes https://github.com/angular/angular-cli/issues/14193

PR Close #30085
2019-04-24 10:49:31 -07:00
Keen Yee Liau 0b5f480eca fix(bazel): make name param in ng add optional (#30074)
PR Close #30074
2019-04-24 10:45:42 -07:00
Keen Yee Liau 2905bf5548 fix(bazel): Make sure only single copy of `@angular/bazel` is installed (#30072)
When `ng add` is invoked independently of `ng new`, a node installation
of `@angular/bazel` is performed by the CLI before invoking the
schematic. This step appends `@angular/bazel` to the `dependencies`
section of `package.json`. The schematics then appends the same package
to `devDependencies`.

This leads to the warning:

```
warning package.json: "dependencies" has dependency "@angular/bazel" with
range "^8.0.0-beta.13" that collides with a dependency in "devDependencies"
of the same name with version "~8.0.0-beta.12"
```

PR Close #30072
2019-04-24 10:44:42 -07:00
George Kalpakas e8d3246c6e build(docs-infra): upgrade RxJS in docs examples to 6.5.1 (#30048)
Related to #30043.

PR Close #30048
2019-04-24 10:41:37 -07:00
George Kalpakas 7e3137e7ed build(docs-infra): upgrade RxJS to 6.5.1 (#30048)
Related to #30043.

PR Close #30048
2019-04-24 10:41:37 -07:00
Kristiyan Kostadinov c7f1b0a97f fix(ivy): queries not being inherited from undecorated classes (#30015)
Fixes view and content queries not being inherited in Ivy, if the base class hasn't been annotated with an Angular decorator (e.g. `Component` or `Directive`).

Also reworks the way the `ngBaseDef` is created so that it is added at the same point as the queries, rather than inside of the `Input` and `Output` decorators.

This PR partially resolves FW-1275. Support for host bindings will be added in a follow-up, because this PR is somewhat large as it is.

PR Close #30015
2019-04-24 10:38:44 -07:00
jenniferfell 8ca208ff59 docs: remove outdated docs change log (#26102)
PR Close #26102
2019-04-23 15:19:10 -07:00
Judy Bogart 089bfdf95f docs: rewrite cli analytics config (#29821)
PR Close #29821
2019-04-23 15:13:49 -07:00
Kristiyan Kostadinov d92fb25161 feat(ivy): add injectable-pipe schematic (#29847)
Adds a schematic that will annotate all `Pipe` classes with `Injectable` so that they can be injected.

This PR resolves FW-1228.

PR Close #29847
2019-04-23 15:12:19 -07:00
Andrew Kushnir aaf8145c48 fix(ivy): support module.id as @NgModule's "id" field value (#30040)
Prior to this commit, the check that verifies correct "id" field type was too strict and didn't allow `module.id` as @NgModule's "id" field value. This change adds a special handling for `module.id` and uses it as id of @NgModule if specified.

PR Close #30040
2019-04-23 14:50:58 -07:00
Alan Agius 04d13429f0 build: fix api guardian error form npm (#30063)
built-in, relative, absolute, nested node_modules - Error: Cannot find module '../lib/cli'

built-in, relative, absolute, nested node_modules - Error: Cannot find module '../lib/cli'

This is because the transpiled lib files need to be added to the data.

PR Close #30063
2019-04-23 14:49:20 -07:00
Ben Lesh 230e32905c release: cut the v8.0.0-beta.14 release 2019-04-23 13:25:46 -07:00
JoostK c4dd2d115b fix(ivy): let ngtsc's shim host delegate `resolveModuleNames` method (#30068)
Now that ngtsc performs type checking using a dedicated `__ng_typecheck__.ts`
file, `NgtscProgram` always wraps its `ts.CompilerHost` in a shim host. This
shim fails to delegate `resolveModuleNames` so no custom module resolution
logic is considered. This introduces a problem for the CLI, as the compiler
host it passes kicks of ngcc for any imported module such that Ivy's
compatibility compiler runs automatically behind the scenes.

This commit adds delegation of the `resolveModuleNames` to fix the issue.

Fixes #30064

PR Close #30068
2019-04-23 13:05:25 -07:00
George Kalpakas 4ca95641ee build(docs-infra): upgrade cli command docs sources to 73c53266f (#30047)
Updating [angular#master](https://github.com/angular/angular/tree/master) from [cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in [commit range](7e7a1aa5e...73c53266f):

**Modified**
- help/build.json

##

PR Close #30047
2019-04-23 08:56:23 -07:00