Commit Graph

19610 Commits

Author SHA1 Message Date
JoostK 935b2ff99f refactor(compiler-cli): allow query metadata to be omitted (#39707)
The metadata specification of queries allows for the boolean properties
`first`, `descendants` and `static` to be missing, but the linker did
not account for their omission.

This fix is tested in subsequent commits that implement compilation of
components, at which point this will be covered by the compliance tests.

PR Close #39707
2020-11-24 13:05:41 -08:00
JoostK e79ce386fc refactor(compiler-cli): allow visiting call expressions without an active linker (#39707)
The compilation result of components may have inserted template
functions into the constant pool, which would be inserted into the Babel
AST upon program exit. Babel will then proceed with visiting this newly
inserted subtree, but we have already cleaned up the linker instance
when exiting the program. Any call expressions within the template
functions would then fail to be processed, as a file linker would no
longer be available.

Since the inserted AST subtree is known not to contain yet more partial
declarations, it is safe to skip visiting call expressions when no
file linker is available.

PR Close #39707
2020-11-24 13:05:40 -08:00
JoostK 8348556b77 test(compiler-cli): workaround for performance cliff in TypeScript (#39707)
The type checker had to do extensive work in resolving the
`NodePath.get` method call for the `NodePath` that had an intersection
type of `ts.VariableDeclarator&{init:t.Expression}`. The `NodePath.get`
method is typed using a conditional type which became expensive to
compute with this intersection type. As a workaround, the original
`init` property is explicitly omitted which avoids the performance
cliff. This brings down the compile time by 15s.

PR Close #39707
2020-11-24 13:05:38 -08:00
JoostK bfa20e11a6 test(compiler-cli): fix documentation and JSON schema references in compliance tests (#39707)
The JSON schema reference was off-by-one, preventing IDEs from finding
the file and offering suggestions and documentation. Additionally the
name of the golden file was slightly off.

PR Close #39707
2020-11-24 13:05:37 -08:00
Srashti Jain 266959e745 docs: added Srashti Jain to GDE resources (#39150)
PR Close #39150
2020-11-24 13:04:04 -08:00
Michael Gerullis 39a47c21f9 docs(core): update links to schema.json of @schematics/angular (#39827)
closes #39796

PR Close #39827
2020-11-24 10:50:30 -08:00
Mitchell Wills a1b6ad07a8 fix(core): Allow passing AbstractType to the inject function (#37958)
This is a type only change that replaces `Type<T>|InjectionToken<T>` with
`Type<T>|AbstractType<T>|InjectionToken<T>` in the injector.

PR Close #37958
2020-11-24 10:42:21 -08:00
JoostK 453b32f4b9 fix(compiler-cli): report error when a reference target is missing instead of crashing (#39805)
If a template declares a reference to a missing target then referring to
that reference from elsewhere in the template would crash the template
type checker, due to a regression introduced in #38618. This commit
fixes the crash by ensuring that the invalid reference will resolve to
a variable of type any.

Fixes #39744

PR Close #39805
2020-11-24 08:46:37 -08:00
INFRAGISTICS\tiliev b5c0f9d7d1 feat(platform-browser): add doubletap HammerJS support (#26362)
Enables `doubletap` support in HammerJS.

PR Close  #23954

PR Close #26362
2020-11-24 08:45:49 -08:00
mchl18 0050b550e4 docs(core): fix typo (#39825)
PR Close #39825
2020-11-24 08:42:17 -08:00
Kapunahele Wong 2c275f6d7a docs: archive template expression operators doc, move pipes precedence section (#39170)
Archives most of the content in the template expression operators doc.
The pipes precedence section that was originally in
template expression operators moves into the pipes doc
with some editing and an addition of a ternary example.

PR Close #39170
2020-11-24 08:41:18 -08:00
mgechev 88fbc06677 docs: add an exception for accepting contributions (#39611)
PR Close #39611
2020-11-24 08:40:22 -08:00
zuckjet e7b67b9d67 docs(core): fix typo for getting component definition function (#39823)
PR Close #39823
2020-11-24 08:39:05 -08:00
George Kalpakas 6046419f6c fix(service-worker): correctly handle failed cache-busted request (#39786)
Since 5be4edfa17, a failing cache-busted
network request (such as requests for fetching uncached assets) will
cause the ServiceWorker to incorrectly enter a degraded
`EXISTING_CLIENTS_ONLY` mode. A failing network request could be caused
by many reasons, including the client or server being offline, and does
not necessarily signify a broken ServiceWorker state.

This commit fixes the logic in `cacheBustedFetchFromNetwork()` to
correctly handle errors in network requests.
For more details on the problem and the implemented fix see #39775.

Fixes #39775

PR Close #39786
2020-11-23 14:59:55 -08:00
Joey Perrott 5a49465ce0 fix(dev-infra): verify the version of generated build artifacts (#39789)
Verify the version of the generated build artifacts to ensure that
the version published to NPM is the version we expect.

PR Close #39789
2020-11-23 12:08:21 -08:00
Joey Perrott d65c2e351f build: define the package building function for ng-dev release tooling (#39711)
The packages are built during the release process on demand via a function
defined locally in the ng-dev config.

PR Close #39711
2020-11-23 12:07:39 -08:00
Joey Perrott 726d7c123c ci: migrate rebase-pr CI script to the circleci directory (#39592)
Migrate the rebase-pr script used on CI out of tools and into the circleci
directory.  Additionally removes its support for running in the local
repository as this is now better handled by `ng-dev pr rebase <pr-number>`.

PR Close #39592
2020-11-23 12:07:04 -08:00
Gautier Pelloux-Prayer 938abc03bc docs(http): Add mention to default value 'OK' for statusText. #23334 (#23494)
PR Close #23494
2020-11-23 08:31:24 -08:00
Bjarki 2ae3fa009e refactor(compiler): remove unnecessary trustConstantScript function (#39554)
Script tags, inline event handlers and other script contexts are
forbidden or stripped from Angular templates by the compiler. In the
context of Trusted Types, this leaves no sinks that require use of a
TrustedScript. This means that trustConstantScript is never used, and
can be removed.

PR Close #39554
2020-11-23 08:29:09 -08:00
Bjarki 4916870dff fix(compiler): only promote Trusted Types to constants when necessary (#39554)
Previously all constant values of security-sensitive attributes and
properties were promoted to Trusted Types. While this is not inherently
bad, it is also not optimal.

Use the newly added Trusted Types schema to restrict promotion to
constants that are in a Trusted Types-relevant context.

PR Close #39554
2020-11-23 08:29:08 -08:00
Bjarki c8a99ef458 fix(compiler): disallow i18n of security-sensitive attributes (#39554)
To minimize security risk (XSS in particular) in the i18n pipeline,
disallow i18n translation of attributes that are Trusted Types sinks.
Add integration tests to ensure that such sinks cannot be translated.

PR Close #39554
2020-11-23 08:29:06 -08:00
Bjarki bb70a9bda4 feat(compiler): support error reporting in I18nMetaVisitor (#39554)
Make it possible to report errors from the I18nMetaVisitor parser.

PR Close #39554
2020-11-23 08:29:05 -08:00
Bjarki 358c50e226 feat(compiler): add schema for Trusted Types sinks (#39554)
Create a schema with an associated function to classify Trusted Types
sinks.

Piggyback a typo fix.

PR Close #39554
2020-11-23 08:29:04 -08:00
David-Emmanuel DIVERNOIS c7f4abf18a feat(common): allow any Subscribable in async pipe (#39627)
As only methods from the Subscribable interface are currently used in the
implementation of the async pipe, it makes sense to make it explicit so
that it works successfully with any other implementation instead of
only Observable.

PR Close #39627
2020-11-23 08:28:11 -08:00
Kapunahele Wong 0870af1740 docs: edit start-data.md (#39628)
PR Close #39628
2020-11-23 08:26:23 -08:00
Krivokhizhin Anton b668768c0a test(forms): verify that an object is not a boxed value if only `disabled` field is present (#39801)
The value of a `FormControl` is treated in a special way (called boxed values) when it's an object with exactly
2 fields: `value` and `disabled`. This commit adds a test which verifies that an object is not treated as a boxed
value when `disabled` field is present, but `value` is missing.

PR Close #39801
2020-11-23 08:25:08 -08:00
Marcono1234 3e1e5a15ba docs: update links to use HTTPS as protocol (#39718)
PR Close #39718
2020-11-20 12:52:16 -08:00
Kristiyan Kostadinov 1a26f6da6e fix(core): migration error if program contains files outside of the project (#39790)
Currently all of our migrations are set up to find the tsconfig paths within a project,
create a `Program` out of each and migrate the files inside of the `Program`. The
problem is that the `Program` can include files outside of the project and the CLI
APIs that we use to interact with the file system assume that all files are within
the project.

These changes consolidate the logic, that determines whether a file can be migrated,
in a single place and add an extra check to exclude files outside of the root.

Fixes #39778.

PR Close #39790
2020-11-20 12:51:19 -08:00
Joey Perrott b1ebfb1cab feat(dev-infra): support squashing fixups in the `ng-dev pr rebase` command (#39747)
Adding support for squashing fixup commits during when rebasing can allow
for rebasing to better unblock things like merging.

PR Close #39747
2020-11-20 12:49:43 -08:00
Joey Perrott 881b77ef46 refactor(dev-infra): move `parseCommitMessagesForRange` into the parse file (#39747)
When attempting to actually rely on `parseCommitMessagesForRange`, it became apparent
that the function really belongs in the parse file, rather than utils.

PR Close #39747
2020-11-20 12:49:42 -08:00
andyg3 e2ce9af115 docs: update /deep/ to ::ng-deep in component styles example (#32398)
Update example because ::ng-deep is the preferred syntax.

PR Close #32398
2020-11-20 12:48:14 -08:00
Kara Erickson ff0a90e4a8 fix(core): meta addTag() adds incorrect attribute for httpEquiv (#32531)
Meta::addTag() adds a meta tag with httpEquiv attribute instead of http-equiv when
MetaDefinition contains httpEquiv property.

PR Close #32531
2020-11-20 09:26:08 -08:00
Kapunahele Wong 156f9f30ae docs: edit di providers doc (#39403)
Edits copy and removes tokens and treeshaking
sections to reduce content duplication and keep
info focused. Moves provideParent() from di-navtree
to di providers.

PR Close #39403
2020-11-20 09:24:51 -08:00
Keen Yee Liau 9aaa86967d build(language-service): include sources for Ivy LS (#39748)
We need to expose the declaration files for Ivy sources so that they can
be consumed by the Angular language server (`@angular/language-server`).

PR Close #39748
2020-11-20 09:23:45 -08:00
Andrew Scott c33a8235d9 fix(router): correctly handle string command in outlets (#39728)
There are many places where examples use just a string for the command
in outlets. When using nested outlets, we do not correctly handle
this case, as the types and algorithm always expect an array.
This PR updates the `createUrlTree` algorithm to account for the
possibility of a string literal as the command for an outlet.

Fixes #18928

PR Close #39728
2020-11-20 08:38:31 -08:00
Pete Bacon Darwin 969ad329de refactor(compiler): tidy up interpolation splitting (#39717)
When parsing for i18n messages, interpolated strings are
split into `Text` and `Placeholder` pieces.  The method that
does this `_visitTextWithInterpolation()` was becoming too
complex. This commit refactors that method along with some
associated functions that it uses.

PR Close #39717
2020-11-20 08:35:56 -08:00
Pete Bacon Darwin 0462a616c3 fix(compiler): ensure that placeholders have the correct sourceSpan (#39717)
When the `preserveWhitespaces` is not true, the template parser will
process the parsed AST nodes to remove excess whitespace. Since the
generated `goog.getMsg()` statements rely upon the AST nodes after
this whitespace is removed, the i18n extraction must make a second pass.

Previously this resulted in innacurrate source-spans for the i18n text and
placeholder nodes that were extracted in the second pass.

This commit fixes this by reusing the source-spans from the first pass
when extracting the nodes in the second pass.

Fixes #39671

PR Close #39717
2020-11-20 08:35:55 -08:00
Pete Bacon Darwin 6b38c44a22 test(compiler-cli): add source-mapping test helper (#39717)
This helper improves the message given when an expectation
fails in a source-mapping test.

PR Close #39717
2020-11-20 08:35:54 -08:00
JiaLiPassion 1cba56e11f refactor(core): remove unused fakeAsyncFallback and asyncFallback (#37879)
`zone.js` 0.8.25 introduces `zone-testing` bundle and move all `fakeAsync/async` logic
from `@angular/core/testing` to `zone.js` package. But in case some user still using the old
version of `zone.js`, an old version of `fakeAsync/async` logic were still kept inside `@angular/core/testing`
package as `fallback` logic. Since now `Angular8+` already use `zone.js 0.9+`, so
those fallback logic is removed.

PR Close #37879
2020-11-20 08:34:59 -08:00
Serginho 66d863febe fix(animations): getAnimationStyle causes exceptions in older browsers (#29709)
PR #29709 getAnimationStyle causes exceptions in older browsers

PR Close #29709
2020-11-20 08:33:19 -08:00
cexbrayat 5fa767363d fix(router): remove duplicated getOutlet function (#39764)
The codebase currently contains two `getOutlet` functions,
and they can end up in the bundle of an application.
A recent commit 6fbe21941d tipped us off
as it introduced several `noop` occurrences in the golden symbol files.
After investigating with @petebacondarwin,
we decided to remove the duplicated functions.

This probably shaves only a few bytes,
but this commit removes the duplicated functions,
by always using the one in `router/src/utils/config`.

PR Close #39764
2020-11-20 08:31:14 -08:00
Jacob Foshee fe1ada86e8 docs: add missing return to example storage.service.ts (#31434)
While JavaScript does support implicit returns, it seems TypeScript will not infer the function return type from
the implicit return of the last statement (at least not in TS 3.4.3). So, when the `return` is missing from the
`get` function the implicit type of the function is `void`. So for the `get` function to be usable it needs to an
explicit return.

PR Close #31434
2020-11-20 08:28:56 -08:00
Will Mendes 17d5266cdb docs: add ngx-skeleton-loader module into resources page (#39352)
PR Close #39352
2020-11-19 12:27:38 -08:00
WilliamKoza b1d300dc26 fix(common): Prefer to use pageXOffset / pageYOffset instance of scrollX / scrollY (#28262)
This fix ensures a better cross-browser compatibility.
This fix has been used for angular.io.

PR Close #28262
2020-11-19 12:22:03 -08:00
Sonu Kapoor be998e830b refactor(core): move `injectAttributeImpl` to avoid cycles (#37085)
This commit moves the `injectAttributeImpl` and other dependent code
to avoid circular dependencies.

PR Close #37085
2020-11-19 12:19:42 -08:00
Sonu Kapoor f5cbf0bb54 fix(core): support `Attribute` DI decorator in `deps` section of a token (#37085)
This commit fixes a bug when `Attribute` DI decorator is used in the
`deps` section of a token that uses a factory function. The problem
appeared because the `Attribute` DI decorator was not handled correctly
while injecting factory function attributes.

Closes #36479

PR Close #37085
2020-11-19 12:19:41 -08:00
Issei Horie a965589eb8 feat(core): adds get method to QueryList (#36907)
This commit adds get method to QueryList.
The method returns an item of the internal results by index number.

PR Close #29467

PR Close #36907
2020-11-19 12:18:30 -08:00
Bjarki ce604b909b test(core): rename ivy-trusted-types integration test to trusted-types (#39614)
Since there won't be a ViewEngine-specific integration test, we don't
need the Ivy prefix.

PR Close #39614
2020-11-19 12:16:41 -08:00
Bjarki 569086a974 test(core): add e2e tests to ivy-trusted-types integration test (#39614)
Make sure that all Trusted Types-relevant sinks that can appear in an
Angular template (e.g. not <script>, since it's forbidden) continue to
work as expected with correct sanitization semantics, without
introducing Trusted Types violations.

PR Close #39614
2020-11-19 12:16:39 -08:00
Bjarki c2298512b3 test(core): enforce Trusted Types in ivy-trusted-types integration test (#39614)
Enforce Trusted Types in the ivy-trusted-types integration test by
setting an appropriate CSP header in the project's angular.json.

PR Close #39614
2020-11-19 12:16:38 -08:00