Commit Graph

20695 Commits

Author SHA1 Message Date
Pete Bacon Darwin 0a4308f756 docs: fix typo in migration guide (#41447)
Also reformat the table to look nice :-)

PR Close #41447
2021-04-07 13:51:08 -07:00
Pete Bacon Darwin 14a64acb72 build(docs-infra): store search dictionary as a string (#41447)
Previously, the search index info file contained an array of strings that is
the dictionary of terms in the corpus.
Storing this as a space separated string reduces the size of the file.

PR Close #41447
2021-04-07 13:51:08 -07:00
Pete Bacon Darwin 65cd44e731 build(docs-infra): tidy up the generateKeywords processor (#41447)
The recent PR #41368 contained some changes that could be improved.

PR Close #41447
2021-04-07 13:51:08 -07:00
Joey Perrott c385e74454 build: rely on engines to prevent using npm for dependency install (#41477)
Rather than relying on a preinstall script, set `engine-strict` to `true` in a
project `.npmrc` file, relying on the `engines` having `npm` set to note that
yarn should be used instead.

---

Output from `npm install` changes from:
```
$ npm install

> angular-srcs@12.0.0-next.7 preinstall /usr/local/account/js/angular
> node tools/yarn/check-yarn.js

/usr/local/account/js/angular/tools/yarn/check-yarn.js:12
  throw new Error(
  ^

Error: Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/
    at Object.<anonymous> (/usr/local/account/js/angular/tools/yarn/check-yarn.js:12:9)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-srcs@12.0.0-next.7 preinstall: `node tools/yarn/check-yarn.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-srcs@12.0.0-next.7 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /usr/local/account/.npm/_logs/2021-04-06T22_54_02_292Z-debug.log
```
to
```
$ npm install
npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for angular-srcs@12.0.0-next.7: wanted: {"node":">=10.19.0 <13.0.0","yarn":">=1.22.4 <2","npm":"Plesae use yarn instead of NPM to install dependencies"} (current: {"node":"10.20.1","npm":"6.14.4"})
npm ERR! notsup Not compatible with your version of node/npm: angular-srcs@12.0.0-next.7
npm ERR! notsup Not compatible with your version of node/npm: angular-srcs@12.0.0-next.7
npm ERR! notsup Required: {"node":">=10.19.0 <13.0.0","yarn":">=1.22.4 <2","npm":"Plesae use yarn instead of NPM to install dependencies"}
npm ERR! notsup Actual:   {"npm":"6.14.4","node":"10.20.1"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /usr/local/account/.npm/_logs/2021-04-06T22_53_23_912Z-debug.log
```

PR Close #41477
2021-04-07 12:05:01 -07:00
Kristiyan Kostadinov ec27bd4ed1 feat(compiler): support nullish coalescing in templates (#41437)
Adds support for nullish coalescing expressions inside of Angular templates (e.g. `{{ a ?? b ?? c}}`).

Fixes #36528.

PR Close #41437
2021-04-07 12:04:28 -07:00
Kristiyan Kostadinov d641542587 refactor(core): remove deprecated rxjs signature usage in event emitter and make more minifier-friendly (#41450)
* We had a usage of `Observable.subscribe` that uses the deprecated signature with 3 arguments. These changes switch to the non-deprecated version that passes in an `Observer`.
* Avoids always creating a `complete` callback since it isn't required.
* We were repeating all of the internal callbacks twice: once for sync and once for async. These changes move them out into variables so that they're more minifier-friendly. The savings aren't huge (~100 bytes minified), but it doesn't add any maintenance effort on our end so I decided to add it.

PR Close #41450
2021-04-07 11:53:09 -07:00
Joey Perrott 7a49aa5136 build: add `dev-infra` and `docs-infra` as targetLabelExemptScopes (#41459)
Add these scopes to allow for use of features and breaking changes for the
scopes regardless of target labels.

PR Close #41459
2021-04-07 11:52:36 -07:00
Joey Perrott c7d86bca21 feat(dev-infra): add support for `targetLabelExemptScopes` for merging (#41459)
Add a property, `targetLabelExemptScopes`, to the merge configuration allowing certain
scopes to be exempted from requirements for features and breaking changes only included
in PRs targetting certain labels.

PR Close #41459
2021-04-07 11:52:35 -07:00
Joey Perrott 7dba0711c2 feat(dev-infra): prevent merges for PRs with invalid breaking changes or commit types (#41459)
Check commits in pull requests to ensure the pr can be merged into the target branch. Confirms
that prs targeting minor do not contain breaking changes, and prs targeting patch or lts do not
contain breaking changes or `feat` commits.

PR Close #41459
2021-04-07 11:52:35 -07:00
Joey Perrott 2d3539f4df refactor(dev-infra): use graphql to query PRs in merge tooling (#41459)
Migrate to use graqhql to query for PR information during the validation and
preperation portions of the pr merge tooling.

PR Close #41459
2021-04-07 11:52:35 -07:00
Zack DeRose 18d4446dc6 docs: add Zack DeRose to GDE resources (#41464)
PR Close #41464
2021-04-07 11:52:00 -07:00
Paul Muriel Biya-Bi 5a81490554 docs: use the right tag in the HeroesComponent's template snippet (#41473)
Based on the tutorial content of the Hero Editor, the tag to be used in
HeroesComponent's template snippet should be h2 and not h3.

PR Close #41473
2021-04-07 11:51:37 -07:00
Andrew Scott eda27c9a87
release: cut the v12.0.0-next.8 release (#41493) 2021-04-07 11:40:31 -07:00
atscott 4b8bbe2cf5 docs: cherry-pick the v11.2.9 release changelog 2021-04-07 11:35:21 -07:00
George Kalpakas ae6c195c87 docs: fix link URL in NG0100 error page (#41484)
Fixes #41474

PR Close #41484
2021-04-07 10:36:49 -07:00
Andrew Scott 8f12f47492 fix(compiler-cli): Allow analysis to continue with invalid style url (#41403)
Currently, we throw a FatalDiagnosticError when we fail to load a resource
(`templateUrl` or `styleUrl`) at various stages in the compiler. This prevents
analysis of the component from completing. This will result in in users not being
able to get any information in the component template when there is a missing
`styleUrl`, for example.

This commit simply tracks the diagnostic, marks the component as poisoned, and
continues merrily along. Environments configured to use poisoned data
(like the language service) will then be able to use other information from the analysis.

Fixes https://github.com/angular/vscode-ng-language-service/issues/1241

PR Close #41403
2021-04-07 09:42:21 -07:00
Joey Perrott f98f379dd8 fix(dev-infra): make scopes for `test` and `refactor` commit types optional (#41486)
As the `test` and `refactor` commit types are not used in release notes and there
are solid use cases for having multiple scopes/scopeless uses of these types, they
are made to be optional instead of required on commits.

PR Close #41486
2021-04-07 09:40:31 -07:00
Alan Agius c550bad49d fix(bazel): add missing dependency on `tslib` (#41480)
`@angular/bazel` depends on `tslib` https://unpkg.com/browse/@angular/bazel@11.2.8/src/api-extractor/index.js#L20

Related failure https://github.com/angular/universal/pull/2040

PR Close #41480
2021-04-07 09:39:49 -07:00
JounQin f60fb7d92b fix(compiler-cli): fix extending angularCompilerOptions from non relative extension less TypeScript configuration files (#41349)
support non rooted file of node package and relative path without json extension

close #41343

PR Close #41349
2021-04-07 09:37:44 -07:00
Joey Perrott dd66da1864 release: bump angular-in-web-memory-api package to 0.12.0 (#41487)
PR Close #41487
2021-04-07 09:35:17 -07:00
Joey Perrott 4a68e13d1b build: update package.json engines range for nodes in preparation for upgrade (#41472)
In preparation for upgrading to `node@14`, and dropping `node@10`, updating the engines
for local `package.json`s.

PR Close #41472
2021-04-06 12:46:31 -07:00
Alan Agius ff9253b4a6 ci: add cache for windows run (#41467)
Add CircleCI cache for windows runs

PR Close #41467
2021-04-06 12:44:48 -07:00
Alan Agius a35758113c ci: don't save node_modules directory (#41467)
Storing node_modules directory in cache causes a number of issues, such as increase in the laid out node_modules tree and also in some cases break module resolution. This is because modules are not hoisted correctly when running `yarn install`.

Example of related failures https://app.circleci.com/pipelines/github/angular/angular/30441/workflows/c1a16135-f5c9-478d-a298-d720c6657d52/jobs/952138

A better cache strategy would be to save yarn cache, more information can be found in https://circleci.com/docs/2.0/caching/#yarn-node.

PR Close #41467
2021-04-06 12:44:47 -07:00
George Kalpakas 4ae57cabd8 build: correctly publish `angular-in-memory-web-api` as CI build artifact (#41429)
Previously, the `angular-in-memory-web-api` package was built in
`dist/packages-dist/misc/angular-in-memory-web-api/`. This was different
from other Angular packages, which were placed directly in
`dist/packages-dist/`. This caused the `create-package-archives.sh`
script to create an invalid `misc.tgz` archive (i.e. treating the
`misc/` subdirectory as a package).
See, for example, the artifacts [here][1].

This commit changes the build scripts to have the
`angular-in-memory-web-api` package built in
`dist/angular-in-memory-web-api-dist/`, similar to how the `zone.js`
package is handled. It also updates the CircleCI config to correctly
publish the `angular-in-memory-web-api` package to CI build artifacts.

[1]: https://circleci.com/gh/angular/angular/951491

PR Close #41429
2021-04-06 10:22:54 -07:00
George Kalpakas e7179893f9 build: build `angular-in-memory-web-api` when building packages with Ivy (#41429)
This commit updates the `build-ivy-npm-packages.js` script to also build
the `angular-in-memory-web-api` package. This could be used if someone
wanted to test the Ivy packages in docs examples or an integration test.

PR Close #41429
2021-04-06 10:22:54 -07:00
George Kalpakas 3c48037d24 build: make the build scripts for the various packages consistent (#41429)
This commit makes the build scripts for the various packages (framework,
`@angular/dev-infra-private`, `angular-in-memory-web-api`, `zone.js`)
consistent. This makes it easier to maintain them (e.g. make similar
changes across all build scripts).

PR Close #41429
2021-04-06 10:22:54 -07:00
George Kalpakas a623bf4e70 build(docs-infra): enable linting for `ng-packages-installer` scripts (#41429)
This commit enables linting for the scripts in
`aio/tools/ng-packages-installer/`. It also makes the necessary changes
to the files to make linting pass.

PR Close #41429
2021-04-06 10:22:53 -07:00
George Kalpakas d42019d412 build(docs-infra): update `eslint` and `eslint-plugin-jasmine` to latest versions (#41429)
This commit updates the `eslint` and `eslint-plugin-jasmine` packages to
latest versions to take advantage of latest fixes and improvements.

PR Close #41429
2021-04-06 10:22:53 -07:00
josemontespg 575f537473 docs(router): make getCurrentNavigation() jsdoc more explicit (#41417)
Add additional clarification to the documentation for
`getCurrentNavigation`.

PR Close #41417
2021-04-06 10:05:17 -07:00
Joey Perrott c63d00e5b0 feat(dev-infra): update commit-message functions to properly type commits from git log (#41458)
For commits from git log entries additional fields are available such as the reference
hash and author name, update the utility functions in commit-message to include the
parsed fields.  Additionally define, per commit message type, whether to include the
commit in a release notes entry.

PR Close #41458
2021-04-06 10:04:53 -07:00
Joey Perrott ba3344ddbe feat(dev-infra): add utility method to GitClient to get latest SemVer tag (#41455)
Create a utility method for the latest git tag, sorted by committerdate, which
matches SemVer, representing the latest version released on the branch.

PR Close #41455
2021-04-06 10:04:31 -07:00
Kristiyan Kostadinov f7c294ee0f feat(core): support `forwardRef` in `providedIn` of `Injectable` declaration (#41426)
Adds support for using a `forwardRef` inside of the `providedIn` of an `Injectable` declaration.

Fixes #41205.

PR Close #41426
2021-04-06 10:03:38 -07:00
Arthur Ming acebe92bad build: install husky in `prepare` script instead of `postinstall` (#41405)
With typicode/husky#890, the recommended way to install husky is in the
`prepare` script instead of the `postinstall`. This commit moves
the husky installation to the `prepare` script to align with the new
recommendation.

PR Close #41405
2021-04-06 10:02:51 -07:00
Arthur Ming a6ca7907e5 build: update to husky@6 (#41405)
Upgrade husky from 5.0.1 to 6.0.0

PR Close #41405
2021-04-06 10:02:51 -07:00
Ahmed Ayed e05a6f3bb3 feat(common): add `historyGo` method to `Location` service (#38890)
Add new method `historyGo`, that will let
the user navigate to a specific page from session history identified by its
relative position to the current page.

We add some tests to `location_spec.ts` to validate the behavior of the
`historyGo` and `forward` methods.

Add more tests for `location_spec` to test `location.historyGo(0)`, `location.historyGo()`,
`location.historyGo(100)` and `location.historyGo(-100)`. We also add new tests for
`Integration` spec to validate the navigation when we using
`location#historyGo`.

Update the `historyGo` function docs

Note that this was made an optional function in the abstract classes to
avoid a breaking change. Because our location classes use `implements PlatformLocation`
rather than `extends PlatformLocation`, simply adding a default
implementation was not sufficient to make this a non-breaking change.
While we could fix the classes internal to Angular, this would still have been
a breaking change for any external developers who may have followed our
implementations as an example.

PR Close #38890
2021-04-06 09:25:58 -07:00
Alan Agius 3a823abcc5 refactor(compiler): remove dependency on fs-extra (#41445)
Currently, fs-extra is used to delete a directory recursively, but this is already available in native Node.JS. Hence, making this dependency redundant.

See: https://nodejs.org/docs/latest-v12.x/api/fs.html

PR Close #41445
2021-04-05 15:04:50 -07:00
George Kalpakas 44e7865698 docs: add release notes for v11.2.8 to CHANGELOG (#41453)
This commit cherry-picks the v11.2.8 release notes from
154129b9defa9295f4684c595d1981c9b3c970c5 onto master.

Fixes #41452

PR Close #41453
2021-04-05 12:43:39 -07:00
George Kalpakas 2a76d8419c build(docs-infra): upgrade cli command docs sources to 37b5f1c99 (#41444)
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](e240e5b7c...37b5f1c99):

**Modified**
- help/build.json
- help/extract-i18n.json

##
Relevant changes in
[commit range](ea073c560...37b5f1c99) since PR #41435:

**Modified**
- help/build.json

##
Closes #41435

PR Close #41444
2021-04-05 12:42:44 -07:00
George Kalpakas ee25034a77 build: update the recommended `Dockerfile` for VSCode remote development (#41396)
This commit updates the recommended `Dockerfile` for VSCode remote
development to take into account recent changes in our dev workflow
(updated Node.js version, vendored yarn, modified CircleCI config).

It also adds a note in the CircleCI config to keep the recommended
`Dockerfile` up-to-date with the Node.js version used on CI.

PR Close #41396
2021-04-05 12:41:34 -07:00
Joey Perrott 2cef385e43 feat(dev-infra): prevent `git push` from being called in dryRun mode (#41387)
Update GitClient to prevent the `push` command from being run in dryMode.

PR Close #41387
2021-04-05 08:57:13 -07:00
Joey Perrott f23406462b feat(dev-infra): create dry-run environment variable flag utils (#41387)
Create utility functions for adding a dry-run flag and checking the environment
for a dry run mode.

PR Close #41387
2021-04-05 08:57:13 -07:00
George Kalpakas 180c1b555f fix(docs-infra): avoid auto-linking generic word `state` (#41438)
Since `state` is a generic word, this commit adds it to the list of
ignored words for auto-linking to avoid incorrectly auto-linking to the
[state()][1] animation helper. For example, see `/ngsw/state` in the
[ServiceWorker in production][2] guide.

[1]: https://v10.angular.io/api/animations/state
[2]: https://v10.angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information

PR Close #41438
2021-04-05 08:56:43 -07:00
George Kalpakas ab47f417d6 test(core): fix `Function#name` shim used in IE11 (#41439)
Since IE11 does not support `Function#name`, we use a shim in tests that
parses the stringified function to extract the name. Previously, that
shim would cache the computed name on the function to speed up future
invocations. However, this resulted in incorrect values for functions
that "extended" other functions (such as the code generated by
TypeScript when downleveling ES2015 classes that extended other
classes).

To avoid issues such as #41416 (see also [internal discussion][1]), this
commit removes the caching of names. This is not expected to noticeably
affect performance, since (a) it is only used in tests, (b) it is only
used on browsers that do not natively support `Function#name` (i.e.
IE11) and (c) accessing function names is rare and inexpensive compared
to other operations that happen during testing.

[1]: https://angular-team.slack.com/archives/CB4UC1932/p1617285258058000

PR Close #41439
2021-04-05 08:56:17 -07:00
Philipp_Lypniakov fcd190aa9c docs: fix grammar mistake in `glossary.md` ("can exported" --> "can be exported") (#41440)
PR Close #41440
2021-04-05 08:17:26 -07:00
Charles Lyding 1de04b124e feat(compiler-cli): support transforming component style resources (#41307)
This change introduces a new hook on the `ResourceHost` interface named `transformResource`.
Resource transformation allows both external and inline resources to be transformed prior to
compilation by the AOT compiler. This provides support for tooling integrations to enable
features such as preprocessor support for inline styles.
Only style resources are currently supported. However, the infrastructure is in place to add
template support in the future.

PR Close #41307
2021-04-02 15:48:45 -07:00
Alan Agius dc655262be refactor(compiler): remove TypeScript 4.0 program reuse check (#41406)
We no longer support TS 4.0, hence this check is redundant.

PR Close #41406
2021-04-02 15:47:54 -07:00
Alan Agius 64b979e12b fix(dev-infra): exclude node_modules from circular dependency checks (#41407)
With this change we exclude node_modules from circular dependency checks.

PR Close #41407
2021-04-02 15:47:33 -07:00
Alan Agius cd2961a3d8 ci: add renovate (#41407)
With this change we add renovate to update dependencies in the following locations
- WORKSPACE
- integration/bazel/WORKSPACE
- package.json
- packages/**/package.json
- tools/ts-api-guardian/package.json
- aio/package.json

We also enable yarn workspaces so that dependencies in these packages are hoisting to the root and renovate doesn't created nested lock files.

Enabling auto updates is important, because quite often dependencies get out of date especially in the compiler-cli which depends on a number of external dependencies.

PR Close #41407
2021-04-02 15:47:33 -07:00
Gabrielle Crevecoeur 03a46afc91 docs: Including Visual Studio (#41414)
Uploading how to use the Angular Language Service in Visual Studio
PR Close #41414
2021-04-02 10:53:37 -07:00
mgechev 520ff69854 perf(core): add private hooks around user code executed by the runtime (#41255)
Introduces an **internal**, **experimental** `profiler` function, which
the runtime invokes around user code, including before and after:
- Running the template function of a component
- Executing a lifecycle hook
- Evaluating an output handler

The `profiler` function invokes a callback set with the global
`ng.ɵsetProfiler`. This API is **private** and **experimental** and
could be removed or changed at any time.

This implementation is cheap and available in production. It's cheap
because the `profiler` function is simple, which allows the JiT compiler
to inline it in the callsites. It also doesn't add up much to the
production bundle.

To listen for profiler events:

```ts
ng.ɵsetProfiler((event, ...args) => {
  // monitor user code execution
});
```

PR Close #41255
2021-04-02 10:34:23 -07:00