Commit Graph

2746 Commits

Author SHA1 Message Date
Igor Minar 4f81a7c590 test(common): run @angular/common/http/testing tests under bazel (#27386)
PR Close #27386
2018-12-05 20:55:31 -08:00
Andrew Kushnir a315dedb85 fix(ivy): fix fixmeIvy invocations in "platform-browser" tests (#27498)
Some "platform-browser" tests were updated before `fixmeIvy` function contract was changed to `fixmeIvy(...).it(...)`, thus triggering failed tests to run on CI. This commit updates these cases to invoke `fixmeIvy` correctly.

PR Close #27498
2018-12-05 16:33:27 -08:00
Alex Rickabaugh f514ac3da2 test(ivy): enable //packages/router/test/aot_ngsummary_test in Ivy mode (#27483)
This commit enables the above test to run under --define=compile=aot.
To accomplish this, one import is rewritten from a strange form to the
correct absolute form.

FW-658 #resolve

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh 0ae8c08b3c build(ivy): expect factories and summaries in Ivy mode (#27483)
Previously, Bazel/Blaze were only expecting .ngfactory.js and .ngsummary.js
files to be generated in legacy mode. ngtsc was attempting to write those
files, but they ended up being ignored at the Bazel level.

This commit causes Bazel to expect these files, and rearranges the logic
a little bit as the name 'include_ng_files' is now incorrect.

FW-514 FW-737 #resolve

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh 276bdd1f3e fix(ivy): move the generation of ɵNonEmptyModule to shim construction (#27483)
ngfactory files have a ɵNonEmptyModule constant included if there are no
other exported factory symbols. Previously this extra export was added
dynamically in a TS transformer.

However, synthetically constructed exports don't get properly downleveled
during JS emit, and this generated constant caused issues with downstream
tests.

Instead, this commit configures the shim to always have this export to
begin with, and to filter it out if it's not required.

Testing strategy: covered by existing ngtsc_spec tests which verify the
presence of the ɵNonEmptyModule symbol.

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh d553ec2f36 fix(ivy): generate correct moduleNames for factories and summaries (#27483)
In ngtsc, files loaded into the ts.Program have a "module name", set via
ts.SourceFile.moduleName, which ends up being written into an AMD module
name triple-slash directive in the generated .js file.

For generated shim files (ngfactories, ngsummaries) that are constructed
synthetically, there was previously no moduleName set, which caused some
issues with downstream tests.

This commit adds logic to compute and set moduleNames for both generated
ngfactory and ngsummary shims.

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh dfdaaf6a0d fix(ivy): deduplicate directives in component scopes (#27462)
A previous fix to ngtsc opened the door for duplicate directives in
the 'directives' array of a component. This would happen if the directive
was declared in a module which was imported more than once within the
component's module.

This commit adds deduplication when the component's scope is materialized,
so declarations which arrive via more than one module import are coalesced.

PR Close #27462
2018-12-05 14:36:24 -08:00
Olivier Combe b82f62a11d test(ivy): enable ivy tests for platform-browser/animations (#27478)
PR Close #27478
2018-12-05 14:35:23 -08:00
Pawel Kozlowski 821fecb413 test(ivy): update root causes for @angular/core TestBed failures (#27479)
PR Close #27479
2018-12-05 11:24:06 -08:00
Alex Rickabaugh 8f425701e4 test(ivy): enable //packages/bazel/test/ngc-wrapped/... tests for Ivy (#27470)
This commit allows //packages/bazel/test/ngc-wrapped/... tests to run
under Ivy mode. To get them to pass, it addresses a problem with the
way the tests are configured: both test targets have sloppy .d.ts
dependencies configured, leading to many type errors being generated
in TypeScript for the .d.ts files.

Due to the way ngc directs TypeScript emit, it avoids type-checking
.d.ts files and thus this issue does not surface. ngtsc does a whole-
program emit which results in full .d.ts type-checking by default,
catching this configuration issue.

To fix this, skipLibCheck is added to the tsconfig.jsons for these
tests, which tells TypeScript to skip type-checking of the .d.ts files,
avoiding this problem in a similar way to ngc.

PR Close #27470
2018-12-05 10:46:51 -08:00
Alex Rickabaugh 0d8ab323a7 fix(ivy): add missing directoryExists() method to shim CompilerHost (#27470)
The method `ts.CompilerHost.directoryExists` is optional, and was not
previously handled by our ts.CompilerHost wrapper for factory and
summary shims (GeneratedShimsHostWrapper).

TypeScript checks for the existence of this method and silently ignores
things like typeRoots if it's not found. This commit adds proper handling
of directoryExists() to the shim.

A test is also added which verifies typeRoots behavior works when shims
are enabled.

PR Close #27470
2018-12-05 10:46:51 -08:00
Alex Rickabaugh 345bdd3db0 fix(ivy): generate empty ngfactory files if needed (#27470)
Previously the ngfactory shim generator in ngtsc would always write two
imports in the factory file shims:

1) an import to @angular/core
2) an import to the base file

If the base file has no exports, import #2 would be empty. This turns out
to cause issues downstream.

This commit changes the generated shim so if there are no exports in the
base file, the generated shim is empty too.

PR Close #27470
2018-12-05 10:46:51 -08:00
Jason Aden d70a7f3ac9 feat(router): add pathParamsOrQueryParamsChange mode for runGuardsAndResolvers (#27464)
This option means guards and resolvers will ignore changes to matrix parameters. Guards and resolvers will be rerun when the path changes, when path parameters change, or when query parameters change.

The primary use case for such a mode is when updating the UI and getting the URL to be in sync with local changes. For example, if displaying a sortable table, changing the sort direction is often handled by the table itself. But you would want to update the URL to be in sync with what's being displayed to the user. As long as the table sort direction is stored as a matrix parameter, you can use this option to update the URL without causing the overhead of re-running guards and resolvers.

Related to #26861 #18253

PR Close #27464
2018-12-05 10:43:29 -08:00
Ben Lesh cd858323f2 feat(ivy): Forward refs now supported (#27439)
Adds deferred execution of scope setting for modules such that forward refs can be supported in ivy. Design docs can be found at https://docs.google.com/document/d/11KTbybis9rt0cZgMKd1wo_IKb6y1PMU-RoTDVLTXK4Y/edit#

PR Close #27439
2018-12-05 10:41:24 -08:00
Olivier Combe 2bc39860bb feat(ivy): support inputs & outputs with aliases in component decorators (#27350)
PR Close #27350
2018-12-05 10:40:08 -08:00
Olivier Combe 1279a503a1 feat(ivy): add ng-reflect debug text for containers (#27350)
PR Close #27350
2018-12-05 10:40:08 -08:00
miginmrs 20cef5078d fix(router): process empty path segment when preceding a named outlet (#26243)
PR Close #10726

PR Close #26243
2018-12-05 10:39:30 -08:00
miginmrs ccc77ca441 fix(router): change processing url tree children condition (#26243)
stop adding next path of pathless activated route to the url

PR Close #26224

PR Close #26243
2018-12-05 10:39:30 -08:00
Misko Hevery f52600e261 test(ivy): add ability to find already passing tests (#27449)
PR Close #27449
2018-12-05 09:34:52 -08:00
Miško Hevery 4b9948c1be fix(core): More precise return type for `InjectableDecorator` (#27360)
closes #26942

PR Close #27360
2018-12-04 23:18:19 -08:00
Misko Hevery faca8b1382 test(ivy): remove symbol tests which are too big and not useful (#27446)
PR Close #27446
2018-12-04 23:17:52 -08:00
Andrew Kushnir a3ee08968e fix(ivy): compiler compliance tests actualized (#27473)
PR #27404 introduced additional test case to make sure we generate `elementStyling` instructions with proper set of arguments (first argument was missing in some cases). It looks like that PR was created before we updated host vars count calculation and the `allocHostVars` becomes unnecessary in the test cases introduced in PR #27404. This commit actualizes this test to get rid of unnecessary `allocHostVars` instruction.

PR Close #27473
2018-12-04 21:07:59 -08:00
Kristiyan Kostadinov b6dbcf93a0 test(ivy): add root cause on tree shakable providers test (#27465)
Adds the root cause on one of the failing NgModule tests.

PR Close #27465
2018-12-04 21:01:58 -08:00
Olivier Combe 9062b391a2 test(ivy): root cause analysis for platform-browser (#27460)
PR Close #27460
2018-12-04 20:02:33 -08:00
Olivier Combe c07afd9db1 test(ivy): enable ivy tests for platform-browser (#27460)
PR Close #27460
2018-12-04 20:02:33 -08:00
Pawel Kozlowski b25f06ee7c test(ivy): update root causes for @angular/core TestBed failures (#27459)
PR Close #27459
2018-12-04 20:02:21 -08:00
Marc Laval 8973f12ee4 fix(ivy): provided Injector should be instantiated by its factory (#27456)
(FW-777)

When an Injector is provided, R3Injector instantiates it by calling its
constructor instead of its factory, not resolving dependencies.
With this fix, the ngInjectorDef is checked and the factory is correctly
used if it is found.

PR Close #27456
2018-12-04 20:01:49 -08:00
Pete Bacon Darwin 486f69fcac test(upgrade): do not lock up browser when unit test fails (#27454)
Previously, if the two injectors are not the same, jasmine tried to
display an error message, but it got stuck in an infinite loop trying
to render the injectors that were different.

PR Close #27454
2018-12-04 20:01:37 -08:00
Pete Bacon Darwin 145121a75d test(upgrade): re-enable tests fixed in ivy (#27454)
PR Close #27454
2018-12-04 20:01:37 -08:00
Andrew Kushnir 130ae158c4 test(ivy): more precise TestBed failure causes for View/Content Queries (FW-670) (#27447)
PR Close #27447
2018-12-04 20:01:03 -08:00
Misko Hevery 295e0f65a1 refactor(ivy): remove old unused test case (#27442)
PR Close #27442
2018-12-04 20:00:17 -08:00
Jason Aden 0d4149c736 test(router): add test verifying guards re-run when parent path segments change (#27440)
Related to #26861

PR Close #27440
2018-12-04 19:59:53 -08:00
Kristiyan Kostadinov 862697d4bd fix(ivy): return new ViewRef when detaching view (#27437)
When detaching a view by its index via `ViewContainerRef.detach(index)`, in `ViewEngine` we used to return a new `ViewRef` ([for reference](https://github.com/angular/angular/blob/master/packages/core/src/view/refs.ts#L227)), however in Ivy we return the same `ViewRef` which means that its internal `_viewContainerRef` is never reset and we'll throw an error if the consumer tried to attach it to the `ApplicationRef`. These changes return a new `ViewRef` in order to match the original behavior.

These changes also add the same errors as `ViewEngine` when attempting to attach a view that is attached already. This was the original goal of this PR, however it ended up uncovering the issues with the `ViewRef`.

PR Close #27437
2018-12-04 19:59:37 -08:00
Olivier Combe 7f17c70fd0 test(ivy): add bundling test `todo_i18n` (#27420)
PR Close #27420
2018-12-04 19:59:12 -08:00
Marc Laval bd864fb274 feat(ivy): support WrappedValue in pipes (FW-726) (#27409)
PR Close #27409
2018-12-04 19:59:01 -08:00
Andrew Kushnir e31992c112 fix(ivy): missing first argument in `elementStyling` instruction inside `hostBindings` section (#27404)
The logic that generates first argument for the `elementStyling` instruction was missing the check that directive expression is specified. As a result, in some cases first argument was not added, thus making function invocation incorrect. Now the presence of directive expression is taken into account and the `null` expression is generated as needed.

PR Close #27404
2018-12-04 19:58:46 -08:00
Paul Gschwendtner c61a8b7b14 fix(bazel): do not throw if ts compile action does not create esm5 outputs (#27401)
In some applications, developers define a `ts_library` that just consists of `d.ts` files (e.g. to type `module.id`; see: https://github.com/angular/material2/blob/master/src/module-typings.d.ts), and expect the `esm5.bzl` file to not throw an error like:

```
  target.typescript.replay_params.outputs
struct' object has no attribute 'outputs'
```

The "replay_parameters" property will exist in that case, but is set to "None" because there is no action that should be replayed in favor of producing ES5 outputs. See: https://github.com/bazelbuild/rules_typescript/pull/326. Notice that this right now breaks similarly because an empty `struct()` is returned that does not have a property called `outputs`. [#326](https://github.com/bazelbuild/rules_typescript/pull/326) fixes that by being explicit that there is no _action_ at all.

PR Close #27401
2018-12-04 19:58:36 -08:00
Miško Hevery b2d6f43b49 fix(ivy): Implement remaining methods for DebugNode (#27387)
PR Close #27387
2018-12-04 19:58:25 -08:00
Andrew Kushnir f0b0d64453 fix(ivy): adding `projectDef` instructions to all templates where <ng-content> is present (FW-745) (#27384)
Prior to this change `projectDef` instructions were placed to root templates only, thus the necessary information (selectors) in nested templates was missing. This update adds the logic to insert `projectDef` instructions to all templates where <ng-content> is present.

PR Close #27384
2018-12-04 19:58:13 -08:00
Andrew Kushnir 8e644d99fc fix(ivy): taking "interpolation" config option into account (FW-723) (#27363)
PR Close #27363
2018-12-04 14:04:14 -08:00
Alex Rickabaugh 159788685a fix(ivy): resolve resources using TS module resolution semantics (#27357)
Previously ngtsc assumed resource files (templateUrl, styleUrls) would be
physically present in the file system relative to the .ts file which
referenced them. However, ngc previously resolved such references in the
context of ts.CompilerOptions.rootDirs. Material depends on this
functionality in its build.

This commit introduces resolution of resources by leveraging the TypeScript
module resolver, ts.resolveModuleName(). This resolver is used in a way
which will never succeed, but on failure will return a list of locations
checked. This list is then filtered to obtain the correct potential
locations of the resource.

PR Close #27357
2018-12-04 14:03:55 -08:00
Alex Rickabaugh cfb67edd85 feat(ivy): support styleUrls in ngtsc (#27357)
This commit adds support for resolution of styleUrls to ngtsc. Previously
this field was never read, and so components with styleUrls would appear
unstyled after compilation.

PR Close #27357
2018-12-04 14:03:54 -08:00
JoostK b5ed403bc4 fix(ivy): prevent ngtsc from synchronous compilation for in-flight resouces (#27357)
When a single resource is preloaded twice in ngtsc, the second request
would be recognized as in-flight in which case `undefined` would
be returned, which signals to the compilation that is can resume
synchronously. The compilation would then proceed immediately and call
`load`, only to find out that the request is still in-flight which is
not allowed.

This commit caches the Promise of the in-flight fetch requests, such
that subsequent preload requests can return the corresponding Promise
instance.

PR Close #27357
2018-12-04 14:03:54 -08:00
George Kalpakas 46bc910ecb test(elements): run tests with Ivy (#27300)
PR Close #27300
2018-12-04 14:03:44 -08:00
George Kalpakas 56f8c23adf test(ivy): add tests for `ComponentFactory#create()` fix in #27341 (#27300)
PR Close #27300
2018-12-04 14:03:44 -08:00
George Kalpakas 6cf3c2b682 docs(ivy): fix component definition description of `inputs` (#27300)
PR Close #27300
2018-12-04 14:03:44 -08:00
Paul Gschwendtner d3c08e74f6 fix(compiler-cli): flatModuleIndex files not generated on windows with multiple input files (#27200)
* Currently when building a `ng_module` with Bazel and having the flat module id option set, the flat module files are not being generated because `@angular/compiler-cli` does not properly determine the entry-point file.

Note that this logic is not necessarily specific to Bazel and the same problem can happen without Bazel if multiple TypeScript input files are specified while the `flatModuleIndex` option has been enabled.

PR Close #27200
2018-12-04 14:01:25 -08:00
Paul Gschwendtner 4f9374951d fix(bazel): ng_package cannot be run multiple times without clean (#27200)
Currently when building the `ng_package` multiple times, the old `ng_package` output will be copied over to the new `ng_package` content. Resulting in packages like `src/cdk/npm_package/npm_package/npm_package/AND_MORE`.

This happens because currently all TypeScript definition files are resolved from within the `binDir`. This is just wrong because it could then take up the `d.ts` files from the previous `ng_package` output. All typescript definitions that belong to the target package, should be resolved through Bazel and copied based on that computation.

Also fixes that `esm` files aren't written to the `ng_package` on Windows. This is because we try to flatten paths using the `path.delimiter` while the path is always using Posix delimiters (causing the paths to be incorrect)

PR Close #27200
2018-12-04 14:01:25 -08:00
Paul Gschwendtner 20a2bae1d3 fix(bazel): do not throw error when writing tsickle externs (#27200)
* Currently when building the ES5 and ES2015 output, `ngc_wrapped` will fail because it tries to write the `fs.openSync` the tsickle output file at the same time. This causes a runtime exception in Windows and can be fixed by just writing the externs for ES5 mode to the proper ES5 "output root".

PR Close #27200
2018-12-04 14:01:24 -08:00
Paul Gschwendtner 7d598801f0 fix(bazel): ng_package not generating UMD bundles on windows (#27200)
* Fixes that `ng_package` does not work generate UMD bundles on Windows because the `esm5/` files are not written to the output directory. This is because `rootDirs` and `rootDir` are posix paths and cause invalid relative paths when mixed with Windows backslash paths.

PR Close #27200
2018-12-04 14:01:24 -08:00
Marc Laval 0cf49c8de3 test(ivy): run router/upgrade tests with ivy on CI (#27410)
PR Close #27410
2018-12-03 14:54:20 -08:00
JoostK 6552471c49 fix(ivy): account for `useValue: undefined` providers in module injector (#27035)
PR Close #27035
2018-12-03 14:39:25 -08:00
JoostK 75723d5c89 feat(ivy): ngtsc support for static resolution of array.slice() (#27158)
For ngcc's processing of ES5 bundles, the spread syntax has been
downleveled from `[...ARRAY]` to become `ARRAY.slice()`. This commit
adds basic support for static resolution of such call.

PR Close #27158
2018-12-03 14:38:41 -08:00
Keen Yee Liau 06d4a0c46e feat(bazel): ng-new schematics with Bazel (#27277)
This commit creates a schematics for ng new command that builds
the project with Bazel.

PR Close #27277
2018-12-03 14:38:23 -08:00
Kristiyan Kostadinov 7ec05b4d8c fix(ivy): run initialializers in TestBed on init (#27355)
Fixes the initializers not being run by `TestBed` when creating a fixture.

PR Close #27355
2018-12-03 14:37:49 -08:00
Andrew Kushnir 8eb102ab10 fix(ivy): avoid counting style/class bindings in component/directive `hostBindings` (#27388)
PR Close #27388
2018-12-03 14:37:30 -08:00
Kara Erickson 2a39425e48 fix(ivy): temporary hack to set host styles and static classes (#27385)
PR Close #27385
2018-12-03 11:05:36 -08:00
Misko Hevery 7d89cff545 fix(ivy): Ensure ComponentFactory uses both injectors to retrieve rendererFactory (#27341)
PR Close #27341
2018-12-03 10:02:05 -08:00
Andrew Kushnir 6f5c124fe9 fix(ivy): proper accounting of host vars in case of inherited Directives (#27392)
Prior to this change, the number of host vars stored for directives with `hostBindings` in expando block was incorrect for inherited directives (in case both parent and child directive have `hostBindings` defined). Now if we identify that we already added a `hostBinding` into expando block, we just increase the corresponding number of host binding vars

PR Close #27392
2018-12-03 09:18:07 -08:00
Matias Niemelä a082f6484a fix(ivy): fix style prop instructions to account for zero-based values (#27270)
PR Close #27270
2018-12-03 08:23:23 -08:00
Christopher Dahm d84705121a test(common): add PercentPipe round and trim tests (#27365)
Add tests to cover the percent's decimal to be rounded and trimmed.
PR Close #27365
2018-12-03 08:22:25 -08:00
Christopher Dahm f3f2ef4a2a docs(common): update PercentPipe default maxFractionDigits value (#27365)
Change the docs to reflect the actual default value

Fixes #27079
PR Close #27365
2018-12-03 08:22:25 -08:00
Pawel Kozlowski a1470c94a6 test(ivy): update root causes for @angular/core TestBed failures (#27419)
PR Close #27419
2018-12-03 08:19:56 -08:00
Alex Eagle f5f323dae0 build: only stamp version info when releasing (#27362)
Also build releases into a dedicated output_base so you can't
accidentally publish with outdated version stamp.

Bump the version of rules_nodejs so we don't need to create the
symlink_prefixes for the .publish command to work.

PR Close #27362
2018-11-30 16:08:23 -08:00
Marc Laval 35e02ad5e0 test(ivy): add root causes for router TestBed failures (#27325)
PR Close #27325
2018-11-30 14:58:22 -08:00
Marc Laval a566e52ca4 test(ivy): run more router tests in CI (#27325)
PR Close #27325
2018-11-30 14:58:22 -08:00
Andrew Kushnir 01fd0cd878 fix(ivy): proper accounting of bound vars in i18nExp fns (FW-747) (#27338)
The problem was caused by missing `allocateBindingSlots` that led to incorrect # of vars defined for components and as a result, causing errors at runtime. Now all `bind` operation are accounted for and the number of `vars` is correct.

PR Close #27338
2018-11-30 14:04:55 -08:00
Andrew Kushnir 973ebdc0ea fix(ivy): avoid creating self-closing i18n instructions in case we have styling instructions (#27330)
The problem was caused by the self-closing i18n instruction that was generated in case we have styling instructions defined for a component. As a result, that caused problems at runtime. This update adds extra check to avoid creating self-closing i18n instructions (create i18nStart and i18nEnd instructions instead) when styling instructions are present.

PR Close #27330
2018-11-30 14:04:00 -08:00
Andrew Kushnir a088b8c203 feat(ivy): introduce "allocHostVars" instruction as a replacement for "hostVars" field (FW-692) (#27299)
PR Close #27299
2018-11-30 14:03:12 -08:00
Pete Bacon Darwin 912b0529c1 feat(ivy): ngcc - render private declaration exports (#26906)
Ngcc will now render additional exports for classes that are referenced in
`NgModule` decorated classes, but which were not publicly exported
from an entry-point of the package.

This is important because when ngtsc compiles libraries processed by ngcc
it needs to be able to publcly access decorated classes that are referenced
by `NgModule` decorated classes in order to build templates that use these
classes.

Doing this re-exporting is not without its risks. There are chances that
the class is not exported correctly: there may already be similarly named
exports from the entry-point or the class may be being aliased. But there
is not much more we can do from the point of view of ngcc to workaround
such scenarios. Generally, packages should have been built so that this
approach works.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin bf3ac41e36 feat(ivy): ngcc - add `PrivateDeclarationsAnalyzer` (#26906)
This analyzer searches the source for declared classes that are not
exported publicly from the entry-point.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin b55e1c2ba9 refactor(ivy): ngcc - encapsulate variables into "bundles" (#26906)
There are a number of variables that need to be passed around
the program, in particular to the renderers, which benefit from being
stored in well defined objects.

The new `EntryPointBundle` structure is a specific format of an entry-point
and contains the compiled `BundleProgram` objects for the source and typings,
if appropriate.

This change helps with future refactoring, where we may need to add new
properties to this object. It allows us to maintain more stable APIs between
the constituent parts of ngcc, rather than passing lots of primitive values
around throughout the program.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 64f6820660 refactor(ivy): ngcc - subclasses do not need to declare `protected` variables (#26906)
These variables are already declared as protected in the super class, and
so it is redundant to do it again in the subclasses.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 4526b3ef50 refactor(ivy): ngcc - remove unused code (#26906)
PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 49c73bc170 style(ivy): ngcc - fix typos (#26906)
PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 4a70b669be feat(ivy): register references from NgModule annotations (#26906)
The `NgModuleDecoratorHandler` can now register all the references that
it finds in the `NgModule` metadata, such as `declarations`, `imports`,
`exports` etc.

This information can then be used by ngcc to work out if any of these
references are internal only and need to be manually exported from a
library's entry-point.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin b93c1dffa1 style(ivy): ngcc - fix misspelled method (#26906)
PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 84ce45ca16 refactor(ivy): ngcc - make `EntryPoint` an interface rather than a type (#26906)
By inverting the relationship between `EntryPointPaths` and
`EntryPointFormat` we can have interfaces rather than types.

Thanks to @gkalpak for this idea.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 0c6e1f4a1b fix(ivy): ngcc - support typings (d.ts) classes that are not publicly exported (#26906)
If a decorated class is not publicly exported via an entry-point then the
previous approach to finding the associated typings file failed.

Now we ensure that we extract all the class declarations from the
dtsTypings program, even if they are not exported from the entry-point.
This is achieved by also parsing statements of each source file, rather
than just parsing classes that are exported from the entry-point.

Because we now look at all the files, it is possible for there to be multiple
class declarations with the same local name. In this case, only the first
declaration with a given name is added to the map; subsequent classes are
ignored.

We are most interested in classes that are publicly exported from the
entry-point, so these are added to the map first, to ensure that they are
not ignored.

PR Close #26906
2018-11-30 14:02:03 -08:00
Alex Rickabaugh 64a34616d8 fix(ivy): support string tokens in dependency injection (#27383)
In Angular, it used to be an accepted practice to use strings as dependency
injection tokens. E.g. {provide: 'test', useValue: 'provided'}. However,
the Ivy node injection system did not support this. The Ivy DI system
attempts to patch a Bloom bit index onto each type registered with it, and
this patch operation does not work for a string token.

This commit adds string token support to the bloom filter system by
reserving bit 0 for string tokens. This eliminates the need for each string
token to store its own Bloom bit, at the expense of slightly more expensive
lookups of string tokens.

PR Close #27383
2018-11-30 14:00:23 -08:00
Pawel Kozlowski c96dea27ce test(ivy): turn ivy test selectors into real functions (#27372)
Having real functions allows me to bypass individual checks, ex.:

```
export function fixmeIvy(reason: string): boolean {
  return true;
}
```

This is useful for situation where I want to see if previously disabled tests
were fixed (ex. some PRs merged). In this case I don't want to run tests that
I know are not passing (obsolete / modified).

PR Close #27372
2018-11-30 13:59:47 -08:00
Pawel Kozlowski 1fa5478fef test(ivy): update root causes for @angular/core TestBed failures (#27370)
PR Close #27370
2018-11-30 13:41:21 -08:00
Igor Minar eb17502a7c fix(bazel): ng_package should correctly map to source maps in secondary entry-points (#27313)
This fixes the issue with broken source maps for @angular/common/http/testing.

Fixes #25510

PR Close #27313
2018-11-30 13:40:00 -08:00
Greg Magolan c8a8dcfc6e build(bazel): update handling of rules_nodejs transitive deps (#27264)
BREAKING CHANGES:

Bazel users: rules_angular_dependencies() will no longer install transitive dependencies of build_bazel_rules_nodejs and build_bazel_rules_typescript. User WORKSPACE files will now need to install rules_nodejs and rules_typescript transitive deps directly:

```
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()

load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies")
rules_nodejs_dependencies()
```

PR Close #27264
2018-11-30 13:35:51 -08:00
Jason Aden d40af0c137 feat(router): add a Navigation type available during navigation (#27198)
Provides target URLs, Navigation, and `NavigationExtras` data.

FW-613

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 73f6ed9be1 feat(router): allow passing `state` to routerLink directives (#27198)
This value will get written to the `history.state` entry.

FW-613 (related)
Related to #24617

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 67f4a5d4bd feat(router): allow passing state to `NavigationExtras` (#27198)
This value will get written to the `history.state` entry.

FW-613 (related)

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 26842491c6 feat(router): restore whole object when navigating back to a page managed by Angular router (#27198)
PR Close #27198
2018-11-30 13:34:55 -08:00
Igor Minar 1b84b11cf5 Revert "fix(forms): apply unicode flag to pattern attribute when supported (#20819)" (#27375)
This reverts commit 3c34b8b4f1.

breaks google3 see http://cl/223526995

PR Close #27375
2018-11-30 10:49:27 -08:00
Igor Minar 63e125986c Revert "test(forms): add test on applying unicode flag (#20819)" (#27375)
This reverts commit 619b8ab822.

breaks google3 see http://cl/223526995

PR Close #27375
2018-11-30 10:49:27 -08:00
Igor Minar 1439071b7e Revert "docs(forms): take words suggestion (#20819)" (#27375)
This reverts commit e024f2f8b7.

breaks google3 see http://cl/223526995

PR Close #27375
2018-11-30 10:49:27 -08:00
Igor Minar 32c5be97b0 fix(platform-server): add @angular/http to the list of peerDependencies (#27307)
Fixes #26154

PR Close #27307
2018-11-30 10:02:44 -08:00
Andrew Kushnir aedc343003 feat(ivy): updated translation const names (that include message ids) (#27185)
PR Close #27185
2018-11-30 10:00:54 -08:00
ryo.s 9129f9ac9b docs: fix typo (#27294)
PR Close #27294
2018-11-29 22:15:27 -08:00
Alex Rickabaugh 412e47d311 fix(ivy): support multiple directives with the same selector (#27298)
Previously the concept of multiple directives with the same selector was
not supported by ngtsc. This is due to the treatment of directives for a
component as a Map from selector to the directive, which is an erroneous
representation.

Now the directives for a component are stored as an array which supports
multiple directives with the same selector.

Testing strategy: a new ngtsc_spec test asserts that multiple directives
with the same selector are matched on an element.

PR Close #27298
2018-11-29 21:35:28 -08:00
Brandon Roberts c331fc6f0c docs(forms): update API reference for common APIs and template-driven directives (#27033)
PR Close #27033
2018-11-29 21:33:07 -08:00
Igor Minar 2389a68ea3 test(platform-server): import ivyEnabled from @angular/private/testing (#27302)
PR Close #27302
2018-11-29 21:32:49 -08:00
Igor Minar 81a5ceb6d4 test(ivy): add/remove fixmes with root causes for packages/bazel/test/ng_package:core_package (#27302)
PR Close #27302
2018-11-29 21:32:49 -08:00
Igor Minar ed36c68cdb test(ivy): add `obsoleteInIvy`, `modifiedInIvy`, and `ivyEnabled` test selectors (#27302)
See inline docs for description of these functions.

PR Close #27302
2018-11-29 21:32:49 -08:00
Igor Minar 88c30e231a test(ivy): add/remove fixmes in packages/bazel/test/ngc-wrapped (#27302)
PR Close #27302
2018-11-29 21:32:49 -08:00
Andrew Kushnir eb99753e4a test(ivy): enable @angular/service-worker targets to run on CI (#27310)
PR Close #27310
2018-11-29 21:32:19 -08:00
Alex Rickabaugh 4effb89ae8 test(ivy): update //packages/compiler tests for Ivy (#27301)
Most of the specs in these tests are not relevant to Ivy:

//packages/compiler/test:test
//packages/compiler/test:test_web_chromium-local

However, a few test pieces of the compiler infrastructure that are used in
Ivy, and new BUILD.bazel files are created to separate them from the above
disabled targets:

//packages/compiler/test/css_parser:css_parser
//packages/compiler/test/css_parser:css_parser_web
//packages/compiler/test/expression_parser:expression_parser
//packages/compiler/test/expression_parser:expression_parser_web
//packages/compiler/test/ml_parser:ml_parser
//packages/compiler/test/ml_parser:ml_parser_web
//packages/compiler/test/selector:selector
//packages/compiler/test/selector:selector_web

PR Close #27301
2018-11-29 21:31:35 -08:00
Alex Rickabaugh 49537458ea test(ivy): update //packages/compiler-cli tests for Ivy (#27301)
These tests are not relevant to Ivy:

//packages/compiler-cli/test/diagnostics:check_types
//packages/compiler-cli/test/diagnostics:expression_diagnostics
//packages/compiler-cli/test/transformers:test
//packages/compiler-cli/test:extract_i18n

The //packages/compiler-cli/test:ngtools_api test has 2 specs, one of
which passes and the other of which depends on ngtsc supporting lazy
routes. It's now disabled with fixmeIvy().

PR Close #27301
2018-11-29 21:31:35 -08:00
Pete Bacon Darwin 140217546d test(upgrade): re-enable tests that have been fixed (#27305)
The fix in #27223 unblocks these tests

PR Close #27305
2018-11-29 21:29:27 -08:00
Ben Lesh 65775a36d7 refactor(ivy): add fixmeIvy blocks to ivy failing tests (#27311)
PR Close #27311
2018-11-29 21:29:07 -08:00
Ben Lesh 6e89b1c1cd refactor(ivy): updates imports so tests will run in Bazel with ivy AOT (#27311)
PR Close #27311
2018-11-29 21:29:07 -08:00
Kristiyan Kostadinov 23bc8edf24 test: move remaining fixmeIvy to test level (#27354)
Moves all of the remaning `describe`-level fixme instances to the `it` level.

PR Close #27354
2018-11-29 21:28:01 -08:00
Misko Hevery 816ec0b1c3 refactor(ivy): treate LView as the primary global state (#27282)
- rename `LViewData` to `LView` (to be consistent with `TView`)
- Remove `getRenderer`, `getRendererFactory`, `getTview`, `getCurrentQueries`,

PR Close #27282
2018-11-29 21:26:15 -08:00
Miško Hevery 4354fce2bb build: Replace iteration over depsets with an explicit .to_list() call. (#27336)
PR Close #27336
2018-11-29 21:22:39 -08:00
Pawel Kozlowski 8ceea0f238 test(ivy): update root causes for @angular/core TestBed failures (#27351)
PR Close #27351
2018-11-29 21:21:13 -08:00
Igor Minar e024f2f8b7 docs(forms): take words suggestion (#20819)
Co-Authored-By: JLHwung <JLHwung@users.noreply.github.com>

PR Close #20819
2018-11-29 21:19:37 -08:00
Huáng Jùnliàng 619b8ab822 test(forms): add test on applying unicode flag (#20819)
PR Close #20819
2018-11-29 21:19:37 -08:00
Huáng Jùnliàng dde1d67232 test(platform-browser): add supportsRegExUnicodeFlag method (#20819)
PR Close #20819
2018-11-29 21:19:37 -08:00
Huáng Jùnliàng 3c34b8b4f1 fix(forms): apply unicode flag to pattern attribute when supported (#20819)
Both Firefox and Chrome have applied unicode flag to the `pattern` content attribute of INPUT element.
See https://www.chromestatus.com/feature/4753420745441280

PR Close #20819
2018-11-29 21:19:37 -08:00
Jason Aden 11a8bd8aca fix(router): update URL after redirects when urlHandlingStrategy='eager' (#27356)
fixes #27076

PR Close #27356
2018-11-29 14:46:32 -08:00
Andrew Kushnir d819c00fee fix(ivy): take preserveWhitespaces config option into account (FW-650) (#27197)
PR Close #27197
2018-11-28 11:41:49 -08:00
Andrew Kushnir 7773d7f552 fix(ivy): add polyfill for goog.getMsg to unblock tests (FW-663) (#27218)
PR Close #27218
2018-11-28 11:40:56 -08:00
Pawel Kozlowski 3074f0e436 test(ivy): update root causes for @angular/common TestBed failures (#27322)
PR Close #27322
2018-11-28 11:39:14 -08:00
Pawel Kozlowski 7076773360 test(ivy): update root causes for @angular/core TestBed failures (#27321)
PR Close #27321
2018-11-28 11:38:51 -08:00
Misko Hevery 39e426cde3 fix(ivy): TestBed.get(Compiler) throws "Error: Runtime compiler is not loaded" (#27223)
BREAKING CHANGE:

The public API for `DebugNode` was accidentally too broad. This change removes
1. Public constructor. Since `DebugNode` is a way for Angular to communicate information
   on to the developer there is no reason why the developer should ever need to
   Instantiate the `DebugNode`
2. We are also removing `removeChild`, `addChild`, `insertBefore`, and `insertChildAfter`.
   All of these methods are used by Angular to constructor the correct `DebugNode` tree.
   There is no reason why the developer should ever be constructing a `DebugNode` tree
   And these methods should have never been made public.
3. All properties have been change to `readonly` since `DebugNode` is used by Angular
   to communicate to developer and there is no reason why these APIs should be writable.

While technically breaking change we don’t expect anyone to be effected by this change.

PR Close #27223
2018-11-27 13:42:23 -08:00
Miško Hevery 60e403bf6d build: ts-api-guardian should support interface with value types (#27223)
This fixes an issue where a value would hide the type.

```
export interface Foo {
  someMethod(): void;
}

export const Foo: Function = ...;
```

In the above example the `Foo` constant will hide the `interface Foo` symbol.
This change properly saves the interface in addition to the type.

PR Close #27223
2018-11-27 13:42:23 -08:00
Alex Rickabaugh 23b06af940 fix(core): export a value for InjectFlags (#27279)
A recent commit (probably 2c7386c) has changed the import graph of the
DI types in core, and somehow results in the ngc compiler deciding to
re-export core DI types from application factories which tangentially
use inject(). This is not really surprising; ngc's import graph can be
very unstable.

However, this results in a re-export of InjectFlags surviving JS
compilation. InjectFlags was a const enum, akin to an interface in TS,
with no runtime repesentation. This causes a warning to be emitted by
Webpack when it sees the re-export of InjectFlags.

This commit avoids the issue by removing 'const' from the declaration
of InjectFlags, causing it to have a runtime value. This is a temporary
fix. The real fix will be for ngc to no longer write exports of const
enums.

Testing strategy: manually verified. Due to the problem only manifesting
when recompiling after a change and then running Webpack, there is no
existing framework via which this could be easily tested with an
integration test. Additionally, the potential for this issue is gone in
Ivy, so this solution is only temporarily needed.

Fixes #27251.

PR Close #27279
2018-11-27 13:40:39 -08:00
Igor Minar 78e3a4c97c test(ivy): root-case //packages/compiler-cli/integrationtest/bazel/injector_def/ivy_build/app/test:test (#27278)
PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar 5d82c73da6 fix(ivy): @NgModule() should not require an metadata object (#27278)
There is no test in this diff because I'm making an already failing test pass.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar 1cca27d823 fix(ivy): @Inject should not overwrite an existing ngInjectableDef (#27278)
There is no test in this diff because I've made a failing test pass.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar d35d164ece test(ivy): add fixme to a failing testbed test (#27278)
PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar f7ba4b2ff9 fix(ivy): remove obsolete ng_module code for global and jit mode (#27278)
These paths are no longer needed / used.

I had to disable one jit mode spec because it fails now that we actually run it.
I root caused the jit test failure as missing forwardRef support. See FW-645.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar 572fd7a79a build(ivy): remove the remains of ivy-jit mode (#27278)
This stuff is obsolete and shouldn't be here because we removed the JIT mode on CI.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar 04f902fca5 ci(ivy): //packages/platform-browser-dynamic/test:test now works in jit (#27278)
PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar d1227ec800 ci(ivy): packages/core/test/render3 now passes with ivy aot (#27278)
PR Close #27278
2018-11-27 10:30:58 -08:00
Kristiyan Kostadinov 4622d0b23a fix(ivy): detach ViewRef from ApplicationRef on destroy (#27276)
Currently we store the `_appRef` when a `ViewRef` is attached, however we don't use it for anything. These changes use it to detach the view from the `ApplicationRef` when it is destroyed. These changes also fix that the `ComponentRef` doesn't remove its `ViewRef` on destroy.

PR Close #27276
2018-11-27 10:24:53 -08:00
Pawel Kozlowski 0487fbe236 fix(ivy): throw a descriptive error when trying to insert / move destroyed view (#27289)
PR Close #27289
2018-11-27 10:23:14 -08:00
Kara Erickson d0e8020506 fix(ivy): blueprints should be synced whenever they are off (#27281)
PR Close #27281
2018-11-27 10:22:03 -08:00
Kara Erickson a7ba05ad82 fix(ivy): fix directive instantiation at slots above 2^12 (#27280)
PR Close #27280
2018-11-27 10:20:02 -08:00
Olivier Combe d62da4da12 test(platform-server): add root causes for TestBed tests failures (#27268)
PR Close #27268
2018-11-27 10:18:51 -08:00
Olivier Combe b09e03b28d test(platform-server): don't set `document` to undefined for ivy tests (#27268)
PR Close #27268
2018-11-27 10:18:51 -08:00
Olivier Combe 2fce701ced feat(ivy): enable ng-reflect debug attributes (#27268)
PR Close #27268
2018-11-27 10:18:51 -08:00
Olivier Combe 32157115da fix(ivy): register `ModuleWithProviders` when deduplicating imported modules (#27268)
PR Close #27268
2018-11-27 10:18:51 -08:00
Marc Laval c2f30542e7 fix(ivy): should support components without selector (#27169)
PR Close #27169
2018-11-27 10:17:35 -08:00
JoostK d767e0b2c0 fix(ivy): consider providers for view/content queries (#27156)
In ViewEngine it is possible to query for a token that is provided by
a directive that is in scope. See StackBlitz for example:
https://stackblitz.com/edit/ng-viewengine-viewchild-providers

Material uses this pattern with its `MatFormFieldControl` setup, see
https://bit.ly/2zgCUxD for documentation.

PR Close #27156
2018-11-27 10:16:57 -08:00
Trotyl Yu 1db53da0d3 fix(common): expose request url in network error (#27143)
closes #27029

PR Close #27143
2018-11-27 10:16:22 -08:00
Pete Bacon Darwin 330ecfbed0 ci(upgrade): remove `fixme-ivy-aot` tag (#27132)
PR Close #27132
2018-11-26 09:25:08 -08:00
Pete Bacon Darwin bc0fbfc93e test(upgrade): disable failing ngUpgrade tests when in ivy mode (#27132)
PR Close #27132
2018-11-26 09:25:08 -08:00
Pete Bacon Darwin a4462c24fa fix(upgrade): don't rely upon the runtime to resolve forward refs (#27132)
The way that `UpgradeAdapter` needs to be setup, you often find that
you must pass a `forwardRef` for an `NgModule.import`. Pre-ivy, this
gets resolved at runtime, but until this is implemented in ivy, we can
workaround it by resolving it in the `UpgradeAdapter` upfront.

This should be backward-compatible since by the time we actually
create the dynamic `NgModule` that has the import, the imported
class should be defined.

PR Close #27132
2018-11-26 09:25:08 -08:00
Pete Bacon Darwin 69c7488927 test(upgrade): add dependency on `fixmeIvy()` method (#27132)
PR Close #27132
2018-11-26 09:25:07 -08:00
Pawel Kozlowski 9e5223eaba test(core): add more root causes for TestBed tests failures (#27236)
PR Close #27236
2018-11-26 09:24:32 -08:00
Pawel Kozlowski 3c9ad1d231 fix(ivy): inject null for missing attributes (#27237)
PR Close #27237
2018-11-26 09:23:56 -08:00
Andrew Kushnir dc300c5c41 feat(ivy): render flags support in host bindings function (FW-649) (#27204)
PR Close #27204
2018-11-21 15:33:47 -08:00
JoostK 0d9b27ff26 fix(ivy): let ngcc transform @angular/core typings with relative imports (#27055)
PR Close #27055
2018-11-21 09:20:11 -08:00
JoostK c8c8648abf fix(ivy): prevent ngcc from referencing missing ɵsetClassMetadata (#27055)
When ngtsc compiles @angular/core, it rewrites core imports to the
r3_symbols.ts file that exposes all internal symbols under their
external name. When creating the FESM bundle, the r3_symbols.ts file
causes the external symbol names to be rewritten to their internal name.

Under ngcc compilations of FESM bundles, the indirection of
r3_symbols.ts is no longer in place such that the external names are
retained in the bundle. Previously, the external name `ɵdefineNgModule`
was explicitly declared internally to resolve this issue, but the
recently added `setClassMetadata` was not declared as such, causing
runtime errors.

Instead of relying on the r3_symbols.ts file to perform the rewrite of
the external modules to their internal variants, the translation is
moved into the `ImportManager` during the compilation itself. This
avoids the need for providing the external name manually.

PR Close #27055
2018-11-21 09:20:11 -08:00