Commit Graph

15571 Commits

Author SHA1 Message Date
Matias Niemelä 5651fa3a95 fix(ivy): ensure `window.ng.getDebugNode` returns debug info for component elements (#32780)
Prior to this patch the `window.ng.getDebugNode` method would fail to
return the debug information for an element that is a host element to
a component.

PR Close #32780
2019-09-23 14:32:42 -07:00
Judy Bogart 353368cccd docs: correct default for router extra option (#32702)
PR Close #32702
2019-09-23 14:24:19 -07:00
Matias Niemelä 7a00c676ec build(ivy): make sure animation_world prodserver and devserver work as expected (#32778)
PR Close #32778
2019-09-23 14:18:22 -07:00
Kapunahele Wong 04ddcfecd8 docs: edit copy on getting started step 1 (#32773)
PR Close #32773
2019-09-19 14:20:50 -07:00
Keen Yee Liau f3859ff2b9 test(language-service): remove MockData from MockTypescriptHost (#32752)
Remove MockData from the constructor parameters of MockTypescriptHost
since the entire Tour of Heroes (TOH) project is now loaded from disk.

Added a new method `reset()` to MockTypescriptHost that is necessary to
reset the state of the project before each spec if run to make sure
previous overrides are cleared.

PR Close #32752
2019-09-18 15:29:25 -07:00
Matias Niemelä 0450f39625 refactor(ivy): move all styling util code into `utils/styling_utils.ts` (#32731)
PR Close #32731
2019-09-18 15:06:39 -07:00
Matias Niemelä 5d12cb9fdf refactor(ivy): move `styling/interfaces.ts` to `interfaces/styling.ts` (#32731)
PR Close #32731
2019-09-18 15:06:39 -07:00
Matias Niemelä ec0aa88f4e refactor(ivy): move `styling/instructions.ts` to `instructions/styling.ts` (#32731)
PR Close #32731
2019-09-18 15:06:39 -07:00
Matias Niemelä f88f717094 refactor(ivy): remame `styling_next` directory to `styling` (#32731)
PR Close #32731
2019-09-18 15:06:39 -07:00
Matias Niemelä 0618bed83e refactor(ivy): combine styling testing files into one (#32731)
PR Close #32731
2019-09-18 15:06:38 -07:00
Keen Yee Liau 708ae4c8ef fix(language-service): Fix failing tests after merge (#32758)
https://github.com/angular/angular/pull/32653 and
https://github.com/angular/angular/pull/32592 created a conflict in test
that caused CI to turn red. This PR fixes the failing tests.

PR Close #32758
2019-09-18 14:37:36 -07:00
Kapunahele Wong 5c2e890d76 docs: edit copy on first step of getting started (#32751)
PR Close #32751
2019-09-18 13:36:59 -07:00
ayazhafiz 5ace90f04d test(language-service): add missing tests for templateUrls (#32592)
Add missing tests for duplicate, missing template diagnostics

PR Close #32592
2019-09-18 13:35:53 -07:00
Keen Yee Liau 9d8dc793da test(language-service): Create proper test project (#32653)
Language service uses a canonical "Tour of Heroes" project to test
various features, but the files are all contained in test_data.ts which
is hard to read and often contains errors that are difficult to catch
without proper IDE syntax highlighting. The directory structure is also
not clear from first glance.

This PR refactors the test project into standalone files in the proper
format.

Next up:
[ ] Update the interface of MockTypeScript to only accept scriptNames.
[ ] Remove test_data.ts

PR Close #32653
2019-09-18 13:07:01 -07:00
ayazhafiz 2846505dbd feat(language-service): expose determining the NgModule of a Directive (#32710)
This sets up the Language Service to support #32565.
This PR exposes a `getDirectiveModule` method on `TypeScriptServiceHost`
that returns the NgModule owning a Directive given the Directive's
TypeScript node or its Angular `StaticSymbol`. Both types are supported
to reduce extraneous helper methods.

PR Close #32710
2019-09-18 12:59:35 -07:00
Andrew Kushnir ab29874f09 release: cut the v9.0.0-next.7 release 2019-09-18 10:38:54 -07:00
Andrew Kushnir 9b0861c649 docs: release notes for the v8.2.7 release 2019-09-18 10:23:31 -07:00
Jason Bedard df1c456347 fix(bazel): ng_package(data) should support non-text files (#32721)
PR Close #32721
2019-09-17 15:58:42 -07:00
Pawel Kozlowski 05e1b3b312 perf(ivy): avoid unnecessary DOM reads in styling instructions (#32716)
Before this refactoring native node `classList` / `style` properties were
read even if not used. The reason for this was desire to avoid code duplication
between procedural and non-procedural renderers. Unfortunatelly for the case
which will be used by most users (a procedura renderer) the `classList` / `style`
properties were read twice, making the `setStyle` \ `setClass` functions the
most expensive ones (self time) in several benchmarks (large table, expanding
rows).

This refactoring adds a bit of code duplication in order to get better
runtime performance. The code duplication will be removed when we drop
checks for a procedural renderer.

PR Close #32716
2019-09-17 15:58:05 -07:00
Pawel Kozlowski 3ace25f4a1 perf(ivy): run the expandng rows benchmark with es2015 (#32716)
PR Close #32716
2019-09-17 15:58:05 -07:00
Matias Niemelä 4726ac2481 feat(ivy): expose `window.ng.getDebugNode` helper (#32727)
PR Close #32727
2019-09-17 15:46:07 -07:00
Joey Perrott 252966bcca ci: build bazel saucelabs tests remotely (#32719)
PR Close #32719
2019-09-17 15:14:17 -07:00
cexbrayat f1b1de9a3d fix(ivy): i18n - start generated placeholder name at `PH` (#32493)
Currently the expressions used in a template string are automatically named
`PH_1`, `PH_2`, etc. Whereas interpolations used in i18n templates generate
placeholders automatically named `INTERPOLATION`, `INTERPOLATION_1`, etc.

This commit aligns the behaviors by starting the generated placeholder
names for expressions at `PH`, then `PH_1`, etc.

It also documents this behavior in the documentation of `$localize` as
it was not mentioned before.

PR Close #32493
2019-09-17 15:13:30 -07:00
ayazhafiz 4c168ed9ba feat(language-service): provide diagnostics for invalid styleUrls (#32674)
Similar to diagnostics for invalid templateUrls, check that styleUrls
actually point to a valid Url.

Closes #32564.

PR Close #32674
2019-09-17 13:38:37 -07:00
Aristeidis Bampakos cd4021ba41 docs: Typo fixes in hierarchical DI guide (#32536)
Introduce minor typo fixes in the guide for hierarchical dependency injection

PR Close #32536
2019-09-17 13:37:53 -07:00
Matias Niemelä a0d04c628c fix(ivy): ensure that `window.ng` utilities are published when NgModules are used (#32725)
Prior to this patch if any backwards-compatible Angular code was using
Ivy then the built-in `window.ng` debug utilies would not be exposed.

PR Close #32725
2019-09-17 13:32:06 -07:00
Pete Bacon Darwin b741a1c3e7 fix(ivy): i18n - update the compiler to output `MessageId`s (#32594)
Now that the `$localize` translations are `MessageId` based the
compiler must render `MessageId`s in its generated `$localize` code.
This is because the `MessageId` used by the compiler is computed
from information that does not get passed through to the `$localize`
tagged string.

For example, the generated code for the following template

```html
<div id="static" i18n-title="m|d" title="introduction"></div>
```

will contain these localization statements

```ts
if (ngI18nClosureMode) {
  /**
    * @desc d
    * @meaning m
    */
  const MSG_EXTERNAL_8809028065680254561$$APP_SPEC_TS_1 = goog.getMsg("introduction");
  I18N_1 = MSG_EXTERNAL_8809028065680254561$$APP_SPEC_TS_1;
}
else {
  I18N_1 = $localize \`:m|d@@8809028065680254561:introduction\`;
}
```

Since `$localize` is not able to accurately regenerate the source-message
(and so the `MessageId`) from the generated code, it must rely upon the
`MessageId` being provided explicitly in the generated code.

The compiler now prepends all localized messages with a "metadata block"
containing the id (and the meaning and description if defined).

Note that this metadata block will also allow translation file extraction
from the compiled code - rather than relying on the legacy ViewEngine
extraction code. (This will be implemented post-v9).

Although these metadata blocks add to the initial code size, compile-time
inlining will completely remove these strings and so will not impact on
production bundle size.

PR Close #32594
2019-09-17 09:17:45 -07:00
Pete Bacon Darwin 357aa4a097 fix(ivy): i18n - use `MessageId` for matching translations (#32594)
As discussed in https://hackmd.io/33M5Wb-JT7-0fneA0JuHPA `SourceMessage`
strings are not sufficient for matching translations.

This commit updates `@angular/localize` to use `MessageId`s for translation
matching instead.

Also the run-time translation will now log a warning to the console if a
translation is missing.

BREAKING CHANGE:

Translations (loaded via the `loadTranslations()` function) must now use
`MessageId` for the translation key rather than the previous `SourceMessage`
string.

PR Close #32594
2019-09-17 09:17:44 -07:00
Pete Bacon Darwin 870d189433 refactor(ivy): i18n - run-time translation API to use message-id (#32594)
Previously the translation key used for translations was the `SourceMessage`
but it turns out that this is insufficient because "meaning" and "custom-id"
metadata affect the translation key.

Now run-time translation is keyed off the `MessageId`.

PR Close #32594
2019-09-17 09:17:44 -07:00
Pete Bacon Darwin c7abb7d196 feat(ivy): i18n - add syntax support for `$localize` metadata block (#32594)
This commit documents and extends the basic `$localize`
implementation to support adding a metadata block to the
start of a tagged message.

All the "pass-though" version does is to strip this block out,
similar to what it does to placeholder name blocks.

PR Close #32594
2019-09-17 09:17:44 -07:00
Pete Bacon Darwin fd62ed66e3 test(ivy): i18n - re-enable skipped tests (#32594)
The `packages/localize/test/utils` folder was not being
included in the unit tests because the glob for the spec
files was only looking in the top level folder.

PR Close #32594
2019-09-17 09:17:44 -07:00
Pete Bacon Darwin e5a3de575f fix(ngcc): support UMD global factory in comma lists (#32709)
Previously we were looking for a global factory call that looks like:

```ts
(factory((global.ng = global.ng || {}, global.ng.common = {}), global.ng.core))"
```

but in some cases it looks like:

```ts
(global = global || self, factory((global.ng = global.ng || {}, global.ng.common = {}), global.ng.core))"
```

Note the `global = global || self` at the start of the statement.

This commit makes the test when finding the global factory
function call resilient to being in a comma list.

PR Close #32709
2019-09-17 09:16:08 -07:00
Joey Perrott 894c4b5390 ci: use automatic selection strategies (#32678)
Removes the selection strategies for `AngularTemplateCompile` and `TypeScriptCompile` causing
them to use the automatic selection strategies instead.

PR Close #32678
2019-09-16 15:35:37 -07:00
Joey Perrott d9054803e3 ci: add assets to ng_module in playground todo (#32678)
PR Close #32678
2019-09-16 15:35:37 -07:00
Joey Perrott 4ff9c942c0 ci: use remote strategy for AngularTemplateCompile and TypeScriptCompile (#32678)
PR Close #32678
2019-09-16 15:35:37 -07:00
Joey Perrott 67d08b15e0 ci: fix name of lock-closed workflow (#32698)
PR Close #32698
2019-09-16 14:14:39 -07:00
Joey Perrott d2bf8fac5b ci: update schedule for locking inactive issues (#32698)
PR Close #32698
2019-09-16 14:14:39 -07:00
Matias Niemelä a2e890e4f7 refactor(ivy): get rid of styling cleanup functions outside of styling code (#32591)
Prior to this patch, each time `advance()` would run (or when a
templateFn or hostBindings code exits) then the core change detection
code would check to see whether the styling data needs to be reset. This
patch removes that functionality and places everything inside of the
scheduled styling exit function. This means that each time one or more
styling bindings run (even if the value hasn't changed) then an exit
function will be scheduled and that will do all the cleanup.

PR Close #32591
2019-09-16 14:12:48 -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
crisbeto e6ed4a21e4 perf(ivy): avoid repeat LView reads in property instructions (#32681)
Currently all property instructions eventually call into `elementPropertyInternal` which in turn calls to `getLView`, however all of the instructions already have access to the LView. These changes switch to passing in the LView as a parameter.

PR Close #32681
2019-09-16 10:51:48 -07:00
Judy Bogart 4c061271db docs: add autoprefixer backward compatability instruction (#32109)
PR Close #32109
2019-09-16 10:48:02 -07:00
Misko Hevery 52a6da043d fix(ivy): correct debug array names (#32691)
PR Close #32691
2019-09-16 09:35:58 -07:00
Pawel Kozlowski 1748aeb9c8 perf(ivy): convert all node-based benchmark to use a testing harness (#32699)
PR Close #32699
2019-09-16 09:31:15 -07:00
cran-cg f6d66671b6 fix(compiler-cli): fix typo in diagnostic template info. (#32684)
Fixes #32662

PR Close #32684
2019-09-16 08:59:48 -07:00
Joey Perrott 3a90a7cb43 ci: run ts-api-guardian test remotely on CI (#32677)
PR Close #32677
2019-09-13 15:13:44 -07:00
Paul Gschwendtner 8415460b12 test: add size-tracking test for core_all with view engine (#32676)
* adds a size-tracking bazel target for testing and tracking
of `@angular/core` with view engine.

PR Close #32676
2019-09-13 13:27:04 -07:00
Paul Gschwendtner 217db9b216 feat(bazel): support ts_library targets as entry-points for ng_package (#32610)
Within an Angular package, it can happen that there are
entry-points which do not contain features that belong into
an `@NgModule` or need metadata files to be generated.

For example: the `cdk`, `cdk/testing` and `cdk/coercion`
entry-points. Besides other entry-points in the `cdk`
package, those entry-points do not need metadata to
be generated and no not use the `ng_module` rule.

Currently the "ng_package" rule properly picks up such
entry-points and builds bundles, does downleveling etc.
The only thing it misses is that no `package.json` files
are generated for the entry-point. This means that consumers
will not be able to use these entry-points built with "ts_library"
(except accessing the individual bundlings explicitly).

The "ng_package" rule should follow the full APF specification
for such entry-points. Partially building bundles and doing the
downleveling is confusing and a breaking issue.

The motifivation of supporting this (besides making the
rule behavior consistent; the incomplete output is not
acceptable), is that using the "ng_module" rule does
not make sense to be used for non-Angular entry-points.

Especially since it depends on Angular packages to
be specified as Bazel action inputs just to compile
vanilla TypeScript with `@angular/compiler-cli`.

PR Close #32610
2019-09-13 13:23:55 -07:00
Joey Perrott be13e8b1e4 ci: update owners for /tools/size-tracking (#32615)
PR Close #32615
2019-09-13 13:23:07 -07:00
Andrew Scott bfb3995869 fix(ivy): DebugNode throws exceptions when querying some properties (#32622)
PR Close #32622
2019-09-13 10:13:08 -07:00
Andrew Kushnir 5328bb223a fix(ivy): avoid unnecessary i18n instructions generation for <ng-template> with structural directives (#32623)
If an <ng-template> contains a structural directive (for example *ngIf), Ngtsc generates extra template function with 1 template instruction call. When <ng-template> tag also contains i18n attribute on it, we generate i18nStart and i18nEnd instructions around it, which is unnecessary and breaking runtime. This commit adds a logic to make sure we do not generate i18n instructions in case only `template` is present.

PR Close #32623
2019-09-13 10:01:55 -07:00