Commit Graph

381 Commits

Author SHA1 Message Date
Olivier Combe 9e7668f16b fix(common): remove deprecated support for intl API (#29250)
BREAKING CHANGE:
In v5, we deprecated support for the intl API in order to improve the browser support. We are now removing these deprecated APIs for v9. See the original change here for more info on why: #18284.

PR Close #29250
2019-10-17 20:44:17 -04:00
Kara Erickson 86104b82b8 refactor(core): rename ngInjectableDef to ɵprov (#33151)
Injectable defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngInjectableDef to "prov" (for "provider", since injector defs
are known as "inj"). This is because property names cannot
be minified by Uglify without turning on property mangling
(which most apps have turned off) and are thus size-sensitive.

PR Close #33151
2019-10-16 16:36:19 -04:00
Judy Bogart 8321bd8a74 docs: clarify http header api doc (#33038)
PR Close #33038
2019-10-14 23:45:45 +00:00
Kara Erickson 0de2a5e408 refactor(core): rename ngFactoryDef to ɵfac (#33116)
Factory defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngFactoryDef to fac. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.

Note that the other "defs" (ngPipeDef, etc) will be
prefixed and shortened in follow-up PRs, in an attempt to
limit how large and conflict-y this change is.

PR Close #33116
2019-10-14 20:27:25 +00:00
Alan Agius e2d5bc2514 feat: change tslib from direct dependency to peerDependency (#32167)
BREAKING CHANGE:

We no longer directly have a direct depedency on `tslib`. Instead it is now listed a `peerDependency`.

Users not using the CLI will need to manually install `tslib` via;
```
yarn add tslib
```
or
```
npm install tslib --save
```

PR Close #32167
2019-10-14 16:34:47 +00:00
Kara Erickson 1a67d70bf8 refactor(core): rename ngDirectiveDef to ɵdir (#33110)
Directive defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngDirectiveDef to dir. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.

Note that the other "defs" (ngFactoryDef, etc) will be
prefixed and shortened in follow-up PRs, in an attempt to
limit how large and conflict-y this change is.

PR Close #33110
2019-10-14 16:20:11 +00:00
Miško Hevery 0c69ec20c2 fix: google3 sync which requires type hints (#33108)
PR Close #33108
2019-10-11 12:09:20 -07:00
Danny Skoog 6ab5f3648a refactor: utilize type narrowing (#33075)
PR Close #33075
2019-10-10 15:18:44 -07:00
FaustmannChr be54c580bf docs(common): Fixes typo (#33003)
PR Close #33003
2019-10-10 13:55:40 -07:00
Paul Gschwendtner c1bb88603e fix(common): expand type for "ngForOf" input to work with strict null checks (#31371)
Currently the `ngForOf` input accepts `null` or `undefined` as valid
values. Although when using strict template input type checking
(which will be supported by `ngtsc`), passing `null` or `undefined`
with strict null checks enabled causes a type check failure because
the type for the `ngForOf` input becomes too strict if strict null checks
are enabled. The type of the input needs to be expanded to also accept
`null` or `undefined` to behave consistently regardless of the
`strictNullChecks` flag.

This is necessary because whenever strict input type checking is enabled
by default, most of the Angular projects that use `*ngFor` with the async pipe
will either need to disable template type checking or strict null checks
because the `async` pipe returns `null` if the observable hasn't been
emitted yet.

See for example how this affects the `angular/components` repository and
how much bloat the workaround involves: https://github.com/angular/components/pull/16373/files#r296942696.

PR Close #31371
2019-10-07 11:01:22 -07:00
Alison Gale efbce7501b test(upgrade): add unit tests for AngularJSUrlCodec's parse method (#32976)
Add unit test coverage for new logic added in #32874 and for existing
logic that was untested.

test(upgrade): add unit tests for AngularJSUrlCodec's parse method

Add additional coverage and fix spacing

test(upgrade): add unit tests for AngularJSUrlCodec's parse method

Add unit test coverage for new logic added in #32874 and for existing
logic that was untested.

test(upgrade): add unit tests for AngularJSUrlCodec's parse method

Add additional coverage and fix spacing

test(upgrade): add unit tests for AngularJSUrlCodec's parse method

Add unit test coverage for new logic added in #32874 and for existing
logic that was untested.

test(upgrade): add unit tests for AngularJSUrlCodec's parse method

Add unit test coverage for new logic added in #32874 and for existing
logic that was untested.

test(upgrade): add unit tests for AngularJSUrlCodec's parse method

Add additional coverage and fix spacing

test(upgrade): add unit tests for AngularJSUrlCodec's parse method

Add unit test coverage for new logic added in #32874 and for existing
logic that was untested.

PR Close #32976
2019-10-03 09:55:26 -07:00
crisbeto 4e35e348af refactor(ivy): generate ngFactoryDef for injectables (#32433)
With #31953 we moved the factories for components, directives and pipes into a new field called `ngFactoryDef`, however I decided not to do it for injectables, because they needed some extra logic. These changes set up the `ngFactoryDef` for injectables as well.

For reference, the extra logic mentioned above is that for injectables we have two code paths:

1. For injectables that don't configure how they should be instantiated, we create a `factory` that proxies to `ngFactoryDef`:

```
// Source
@Injectable()
class Service {}

// Output
class Service {
  static ngInjectableDef = defineInjectable({
    factory: () => Service.ngFactoryFn(),
  });

  static ngFactoryFn: (t) => new (t || Service)();
}
```

2. For injectables that do configure how they're created, we keep the `ngFactoryDef` and generate the factory based on the metadata:

```
// Source
@Injectable({
  useValue: DEFAULT_IMPL,
})
class Service {}

// Output
export class Service {
  static ngInjectableDef = defineInjectable({
    factory: () => DEFAULT_IMPL,
  });

  static ngFactoryFn: (t) => new (t || Service)();
}
```

PR Close #32433
2019-10-02 13:04:26 -07:00
Alison Gale 39e8ceb2cd fix(upgrade): fix AngularJsUrlCodec to support Safari (#32959)
Safari throws an error when the new URL() constructor is called with an
undefined base. This change checks whether the base is undefined and
then calls the corresponding version of the URL constructor.

fix(upgrade): simplify solution by replacing undefined with ''

Co-Authored-By: Pete Bacon Darwin <pete@bacondarwin.com>

Simplify solution by replacing undefined with ''

Co-Authored-By: Pete Bacon Darwin <pete@bacondarwin.com>

fix(upgrade): Avoid passing an empty string as the base as well.

Browsers other than Safari may have issues with the empty string.

PR Close #32959
2019-10-02 10:00:47 -07:00
Alan Agius 66658c447f feat: update rxjs peerDependencies minimum requirment to 6.5.3 (#32812)
PR Close #32812
2019-10-01 14:56:45 -07:00
Judy Bogart 9e7aa60ae7 docs: clarify http response type (#32817)
PR Close #32817
2019-10-01 11:00:36 -07:00
Matias Niemelä 4f41473048 refactor(ivy): remove styling state storage and introduce direct style writing (#32591)
This patch is a final major refactor in styling Angular.

This PR includes three main fixes:

All temporary state taht is persisted between template style/class application
and style/class application in host bindings is now removed.
Removes the styling() and stylingApply() instructions.
Introduces a "direct apply" mode that is used apply prop-based
style/class in the event that there are no map-based bindings as
well as property collisions.

PR Close #32259

PR Close #32591
2019-09-16 14:12:48 -07:00
Matias Niemelä 53dbff66d7 revert: refactor(ivy): remove styling state storage and introduce direct style writing (#32259)
This reverts commit 15aeab1620.
2019-09-11 15:24:10 -07:00
Matias Niemelä 15aeab1620 refactor(ivy): remove styling state storage and introduce direct style writing (#32259) (#32596)
This patch is a final major refactor in styling Angular.

This PR includes three main fixes:

All temporary state taht is persisted between template style/class application
and style/class application in host bindings is now removed.
Removes the styling() and stylingApply() instructions.
Introduces a "direct apply" mode that is used apply prop-based
style/class in the event that there are no map-based bindings as
well as property collisions.

PR Close #32259

PR Close #32596
2019-09-11 16:27:10 -04:00
Matias Niemelä c84c27f7f4 revert: refactor(ivy): remove styling state storage and introduce direct style writing (#32259) 2019-09-10 18:08:05 -04:00
Matias Niemelä 3b37469735 refactor(ivy): remove styling state storage and introduce direct style writing (#32259)
This patch is a final major refactor in styling Angular.

This PR includes three main fixes:

All temporary state taht is persisted between template style/class application
and style/class application in host bindings is now removed.
Removes the styling() and stylingApply() instructions.
Introduces a "direct apply" mode that is used apply prop-based
style/class in the event that there are no map-based bindings as
well as property collisions.

PR Close #32259
2019-09-10 15:54:58 -04:00
Carlos Ortiz García 9166baf709 refactor(core): Migrate TestBed.get to TestBed.inject (#32382)
This is cleanup/followup for PR #32200

PR Close #32382
2019-09-09 19:10:54 -04:00
Kara Erickson 89434e09c2 refactor(core): move Meta methods that only have one version from DomAdapter (#32408)
PR Close #32408
2019-09-03 11:59:39 -07:00
Kara Erickson 1a7c79746d refactor(core): move misc methods that only have one version from DomAdapter (#32408)
PR Close #32408
2019-09-03 11:59:39 -07:00
Kara Erickson c207ad80fd refactor(core): move DomAdapter style methods to ServerRenderer (#32408)
PR Close #32408
2019-09-03 11:59:39 -07:00
Kara Erickson 970b58b13f refactor(core): move server-only DomAdapter methods into ServerRenderer (#32408)
PR Close #32408
2019-09-03 11:59:39 -07:00
Mansour Fall f5bec3ff50 feat(common): HttpParams fromObject accepts ReadonlyArray<string> (#31072)
Fixes #28452

PR Close #31072
2019-08-30 12:55:02 -07:00
Misko Hevery 1537791f06 perf(core): Make `PlatformLocation` tree-shakable (#32154)
Convert `PlatformLocation` into a tree-shakable provider.

PR Close #32154
2019-08-29 21:51:56 -07:00
Misko Hevery 8a47b48912 refactor: Move `dom_adapter.ts` to `@angular/common` (#32154)
This work is needed in preparation for turning tokens into tree-shakable injectables.

PR Close #32154
2019-08-29 21:51:56 -07:00
Kara Erickson 30dabdf8fc refactor(core): remove testing-only DOM manipulation utils from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:30 -07:00
Kara Erickson ede5786d1e refactor(core): remove testing-only style utils from DomAdapters (#32291)
PR Close #32291
2019-08-28 17:10:29 -07:00
Kristiyan Kostadinov c885178d5f refactor(ivy): move directive, component and pipe factories to ngFactoryFn (#31953)
Reworks the compiler to output the factories for directives, components and pipes under a new static field called `ngFactoryFn`, instead of the usual `factory` property in their respective defs. This should eventually allow us to inject any kind of decorated class (e.g. a pipe).

**Note:** these changes are the first part of the refactor and they don't include injectables. I decided to leave injectables for a follow-up PR, because there's some more cases we need to handle when it comes to their factories. Furthermore, directives, components and pipes make up most of the compiler output tests that need to be refactored and it'll make follow-up PRs easier to review if the tests are cleaned up now.

This is part of the larger refactor for FW-1468.

PR Close #31953
2019-08-27 13:57:00 -07:00
Kristiyan Kostadinov c2868de25a fix(ivy): ngTemplateOutlet error when switching between null and template value (#32160)
Fixes an error that is thrown by `ngTemplateOutlet` under Ivy when switching from a template to null and back to a template. The error is thrown because the reference to the previous ViewRef is never cleared and the directive tries to detach a view that has already been detached.

Fixes #32060.

PR Close #32160
2019-08-19 10:13:10 -07:00
Alison Gale 5064dc75ac fix(common): update $locationShim to notify onChange listeners before emitting AngularJS events (#32037)
The $locationShim has onChange listeners to allow for synchronization logic between
AngularJS and Angular. When the AngularJS routing events are emitted first, this can
cause Angular code to be out of sync. Notifying the listeners earlier solves the
problem.

PR Close #32037
2019-08-13 14:23:57 -07:00
Judy Bogart b25f925311 docs: edit location doc (#32042)
PR Close #32042
2019-08-13 11:37:13 -07:00
Judy Bogart c68371ed14 docs: format currency api (#32107)
PR Close #32107
2019-08-12 15:16:15 -07:00
WreckItRalph fa699f65d7 docs: updated doc for timezone param in DatePipe (#31827)
PR Close #31827
2019-08-05 13:00:26 -07:00
Sachin 18bc4eda9f docs: updated doc for timezone param in DatePipe (#31827)
PR Close #31827
2019-08-05 13:00:26 -07:00
Olivier Combe 5296c04f61 fix(ivy): set LOCALE_ID when using the injector (#31566)
In `BrowserModule` the value of `LOCALE_ID` is defined in the `APPLICATION_MODULE_PROVIDERS` after `APP_INITIALIZER` has run.
This PR ensures that `LOCALE_ID` is also set for ivy at the same moment which allows the application to fetch the locale from a backend (for example).

Fixes #31465

FW-1436 #resolve

PR Close #31566
2019-07-26 14:04:47 -07:00
Igor Minar 6ece7db37a build: TypeScript 3.5 upgrade (#31615)
https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#typescript-35

PR Close #31615
2019-07-25 17:05:23 -07:00
Judy Bogart 27997a16c0 docs: http api doc edit (#31613)
PR Close #31613
2019-07-23 21:12:25 -07:00
Kara Erickson 215ef3c5f4 fix(ivy): ensure NgClass does not overwrite other dir data (#31788)
We currently have a handwritten version of the Ivy directive def for NgClass so
we can switch between Ivy and View Engine behavior. This generated code needs to
be kept up-to-date with what the Ivy compiler generates.

PR 30742 recently changed `classMap` such that it now requires allocation of
host binding slots. This means that the `allocHostVars()` function must be
called in the NgClass directive def to match compiler output, but the
handwritten directive def was not updated. This caused a bug where NgClass
was inappropriately overwriting data for other directives because space was
not allocated for its values.

PR Close #31788
2019-07-22 16:56:27 -07:00
Paul Gschwendtner 647d7bdd88 refactor: fix typescript strict flag failures in all tests (#30993)
Fixes all TypeScript failures caused by enabling the `--strict`
flag for test source files. We also want to enable the strict
options for tests as the strictness enforcement improves the
overall codehealth, unveiled common issues and additionally it
allows us to enable `strict` in the `tsconfig.json` that is picked
up by IDE's.

PR Close #30993
2019-07-18 14:21:26 -07:00
Paul Gschwendtner 0139b11227 refactor(common): ensure compatibility with typescript strict flag (#30993)
As part of FW-1265, the `@angular/common` package is made compatible
with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR Close #30993
2019-07-18 14:21:26 -07:00
Judy Bogart ab86a58f27 docs: remove inappropriate link (#31091)
PR Close #31091
2019-06-19 15:31:56 -07:00
Paul Gschwendtner 3998335188 build: update buildifier to version that supports windows (#31112)
* Updates buildifier to a version that also comes with windows binaries.
* Fixes a few new formatting/lint warnings
* Removes the `args-order` warning because it is no longer a warning.. and is now part of the formatter.

PR Close #31112
2019-06-18 12:09:41 -07:00
Alex Rickabaugh a4b4f35533 feat(ivy): require 'token' for ngInjectableDef (#30855)
The compiler generates a 'token' field when it emits an ngInjectableDef,
but this field was not required by defineInjectable or the InjectableDef
interface, nor was it added by InjectionToken.

This commit makes 'token' required and adds it where missing.

PR Close #30855
2019-06-11 14:27:16 -07:00
Alex Eagle ef0b2cc74d build: convert entry_point to label (#30627)
PR Close #30627
2019-06-11 00:03:11 +00:00
Santosh Yadav 5c18f23788 fix(common): expose the `HttpUploadProgressEvent` interface as public API (#30852)
Fixes #30814

PR Close #30852
2019-06-07 08:47:47 -07:00
crisbeto b51d8dd438 fix(ivy): error for empty bindings on ng-template (#30829)
Fixes Ivy throwing an error if it runs into an empty property binding on an `ng-template` (e.g. `<ng-template [something]=""></ng-template>`) by not generating an update instruction for it.

Fixes #30801.
This PR resoves FW-1356.

PR Close #30829
2019-06-05 21:26:13 -07:00
Alex Eagle 337b6fe003 build: remove unreferenced tsconfig-build.json files (#30858)
These are no longer needed since Bazel generates a tsconfig for each compilation

PR Close #30858
2019-06-05 09:03:36 -07:00