Commit Graph

1912 Commits

Author SHA1 Message Date
Greg Magolan f82b6b2ed7 build(bazel): fix typos in comments (#25172)
PR Close #25172
2018-07-27 17:20:58 -07:00
Pete Bacon Darwin a87d44c187 refactor(ivy): do not deep import from ngtsc into ngcc (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 43d0e3dd72 feat(ivy): implement initial ngcc package transformer (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 5b32aa4486 feat(ivy): implement esm2015 and esm5 ngcc file renderers (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 844d510d3f feat(ivy): implement ngcc `Analyzer` (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 2f70e90493 feat(ivy): implement esm2015 and esm5 file parsers (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 45cf5b5dad feat(ivy): implement esm2015 and esm5 reflection hosts (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 4ad2f11919 test(ivy): implement ngcc specific version of `makeProgram` (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin d7aa20d912 feat(ivy): ngcc project skeleton (#24897)
PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 07e6de5788 test(ivy): allow `makeProgram` to be more configurable (#24897)
This supports use cases needed by ngcc, where the compilation
needs to be configured for JavaScript differently to normal TypeScript.

PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 6f1685ab98 fix(ivy): allow `FunctionExpression` to indicate a method declaration (#24897)
In some code formats (e.g. ES5) methods can actually be function
expressions. For example:

```js
function MyClass() {}
// this static method is declared as a function expression
MyClass.staticMethod = function() { ... };
```

PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin 67588ec606 refactor(ivy): allow `ImportManager` to have configurable prefix (#24897)
The ngcc compiler will want to specify its own prefix when rendering
definitions.

PR Close #24897
2018-07-27 17:15:31 -07:00
Pete Bacon Darwin ee2c050521 fix(ivy): make ngtsc `ClassMember` `node` and `declaration` optional (#24897)
Not all code formats have associated nodes and declarations for class members.

PR Close #24897
2018-07-27 17:15:30 -07:00
Pete Bacon Darwin 185b932138 refactor(ivy): `TypeScriptReflectionHost.isClass` cannot be a type discriminator (#24897)
The `ReflectionHost` interface that is being implemented only expects a
return value of `boolean`.

Moreover, if you want to extend this class to support non-TS code formats,
e.g. ES5, the result of this call returning true does not mean that the `node`
is a `ClassDeclaration`. It could be a `VariableDeclaration`.

PR Close #24897
2018-07-27 17:15:30 -07:00
Pete Bacon Darwin 5e98421d33 style(ivy): remove underscore from TypeScriptReflectionHost._getDeclarationOfSymbol (#24897)
The linter complains that non-private members must be marked
with `@internal` if they start with an underscore.

PR Close #24897
2018-07-27 17:15:30 -07:00
Victor Berchet 8e65891985 build(ivy): fix ci failures (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 7f59170f77 refactor(ivy): use `element()` where applicable in di_spec (#25166)
For future ref
Search `elementStart\(([^)]+)\);\s*\n\s*elementEnd\(\);`
Replace `element($1)`

PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 9ea112473b refactor(ivy): use bit operations in node injector (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 16f0ac38b8 refactor(ivy): simplify node injector imports (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 15df853622 fix(ivy): walk the node injector tree and then the module injector tree (#25166)
- `directiveInjector()` is used to inject anything in the directive / component
/ pipe factories so adding `InjectionToken<T>` as a supported token type.
- `getOrCreateInjectable()` should search first in the node injector tree and
then in the module injector tree (was either or before the PR).

PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet d3c0915598 docs(ivy): clarify injector API docs (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
Sarun Intaralawan ce98634dfd build(compiler-cli): update tsickle dependency to support TypeScript 2.9 (#25152)
The original range (`^0.30.0`) does not match `0.32.1`, which enables support for TypeScript 2.9.

Close #25141

PR Close #25152
2018-07-27 11:25:28 -07:00
George Kalpakas 342678486d test: fix typings for `DoneFn` (#25163)
This also fixes CI tests, which were accidentally broken in #24663.

PR Close #25163
2018-07-27 11:13:32 -07:00
Greg Magolan 1d051c5841 build(bazel): use bazel managed node_modules for downstream angular from source build support (#24663)
PR Close #24663
2018-07-26 17:02:21 -07:00
George Wilde 323faf954b docs(router): Removed unneeded trailing text. (#24894)
PR Close #24894
2018-07-26 17:01:02 -07:00
Alex Rickabaugh 3169edd77a fix(ivy): don't crash in listLazyRoutes() (#25080)
This commit replaces the "not implemented" error when calling
listLazyRoutes() with an empty result, which will allow testing
in the CLI before listLazyRoutes() is implemented.

PR Close #25080
2018-07-26 16:38:10 -07:00
Alex Rickabaugh 8de304c15a fix(ivy): wait for preanalyze promises in loadNgStructureAsync() (#25080)
loadNgStructureAsync() for ngtsc has a bug where it returns a
Promise<Promise[]> instead of awaiting the entire array of Promises.

This commit uses Promise.all() to await the whole set.

PR Close #25080
2018-07-26 16:38:09 -07:00
Alex Rickabaugh 0d1d5898e3 fix(bazel): allow compile_strategy to be (privately) imported (#25080)
compile_strategy() is used to decide whether to build Angular code
using ngc (legacy) or ngtsc (local). In order for g3 BUILD rules
to switch properly and allow testing of Ivy in g3, they need to
import this function.

This commit removes the _ prefix which allows the function to be
imported.

PR Close #25080
2018-07-26 16:38:09 -07:00
Alex Rickabaugh 6fe865b080 fix(ivy): don't use a custom ts.CompilerHost for ngtsc (#25080)
ngtsc used to have a custom ts.CompilerHost which delegated to the plain
ts.CompilerHost. There's no need for this wrapper class and it causes
issues with CLI integration, so delete it.

PR Close #25080
2018-07-26 16:38:09 -07:00
Alex Rickabaugh e0c0c44d99 fix(ivy): allow relative imports of .d.ts files (#25080)
ngtsc used to assume that all .d.ts dependencies (that is, third party
packages) were imported via an absolute module path. It turns out this
assumption isn't valid; some build tools allow relative imports of
other compilation units.

In the absolute case, ngtsc assumes (and still does) that all referenced
types are available through the entrypoint from which an @NgModule was
imported. This commit adds support for relative imports, in which case
ngtsc will use relative path resolution to determine the imports.

PR Close #25080
2018-07-26 16:38:09 -07:00
Alex Rickabaugh 13a0d527f6 fix(ivy): correctly write cross-file references (#25080)
There is a bug in the existing handling for cross-file references.
Suppose there are two files, module.ts and component.ts.

component.ts declares two components, one of which uses the other.
In the Ivy model, this means the component will get a directives:
reference to the other in its defineComponent call.

That reference is generated by looking at the declared components
of the module (in module.ts). However, the way ngtsc tracks this
reference, it ends up comparing the identifier of the component
in module.ts with the component.ts file, detecting they're not in
the same file, and generating a relative import.

This commit changes ngtsc to track all identifiers of a reference,
including the one by which it is declared. This allows toExpression()
to correctly decide that a local reference is okay in component.ts.

PR Close #25080
2018-07-26 16:38:09 -07:00
Alex Rickabaugh ed7aa1c3e5 fix(ivy): force new imports for .d.ts files (#25080)
When ngtsc encounters a reference to a type (for example, a Component
type listed in an NgModule declarations array), it traces the import
of that type and attempts to determine the best way to refer to it.

In the event the type is defined in the same file where a reference
is being generated, the identifier of the type is used. If the type
was imported, ngtsc has a choice. It can use the identifier from the
original import, or it can write a new import to the module where the
type came from.

ngtsc has a bug currently when it elects to rely on the user's import.
When writing a .d.ts file, the user's import may have been elided as
the type was not referred to from the type side of the program. Thus,
in .d.ts files ngtsc must always assume the import may not exist, and
generate a new one.

In .js output the import is guaranteed to still exist, so it's
preferable for ngtsc to continue using the existing import if one is
available.

This commit changes how @angular/compiler writes type definitions, and
allows it to use a different expression to write a type definition than
is used to write the value. This allows ngtsc to specify that types in
type definitions should always be imported. A corresponding change to
the staticallyResolve() Reference system allows the choice of which
type of import to use when generating an Expression from a Reference.

PR Close #25080
2018-07-26 16:38:09 -07:00
Alex Rickabaugh f902b5ec59 feat(ivy): resolve forwardRef() for queries (#25080)
@ContentChild[ren] and @ViewChild[ren] can contain a forwardRef() to a
type. This commit allows ngtsc to unwrap the forward reference and
deal with the node inside.

It includes two modes of support for forward reference resolution -
a foreign function resolver which understands deeply nested forward
references in expressions that are being statically evaluated, and
an unwrapForwardRef() function which deals only with top-level nodes.

Both will be useful in the future, but for now only unwrapForwardRef()
is used.

PR Close #25080
2018-07-26 16:38:09 -07:00
Miško Hevery e1c6fd5453 Revert "feat(core): add support for using async/await with Jasmine" (#25096)
This reverts commit f6829aba55e07609e312b4f67dbc9dbbf36e4e46.

PR Close #25096
2018-07-25 11:44:56 -07:00
Adrien Samson 968f153491 fix(router): Fix _lastPathIndex in deeply nested empty paths (#22394)
PR Close #22394
2018-07-25 11:27:28 -07:00
Pawel Kozlowski 1e28495c89 fix(ivy): update compiler with latest runtime for view queries (#25061)
PR Close #25061
2018-07-25 10:39:30 -07:00
Johan CHOUQUET 0bcf20c9fa docs(animations): typo fix in the comments (#22652)
PR Close #22652
2018-07-25 10:13:18 -07:00
Olivier Combe 1ceddb6290 fix(ivy): support re-order embedded templates (#24805)
PR Close #24805
2018-07-24 16:41:05 -07:00
Olivier Combe 22731a7588 refactor(ivy): split i18nInterpolation into 8 functions (#24805)
PR Close #24805
2018-07-24 16:41:05 -07:00
Olivier Combe 72dd10f78f refactor(ivy): cleanup runtime i18n code (#24805)
Fixes #24785

PR Close #24805
2018-07-24 16:41:05 -07:00
Wei Huang 2cb0f68a7b test(bazel): allow no sandbox for protractor tests (#24906)
It specifies --no-sandbox flag when running the protractor tests as
root. This is needed for running the tests inside a docker container.

PR Close #24906
2018-07-24 08:28:03 -07:00
Greg Magolan e38b2b502c build(bazel): //modules/benchmarks/src/largetable/render3:perf bazel protractor test (#24788)
PR Close #24788
2018-07-24 08:26:16 -07:00
Marc Laval 445b9a5627 feat(ivy): support ViewContainerRef.createComponent() (#24997)
PR Close #24997
2018-07-24 08:23:23 -07:00
cexbrayat be3cca4fd5
docs: tests for number/percent/currency pipe (#25028)
Will avoid errors in examples like the one fixed in #24661

Closes #25028
2018-07-23 13:18:23 -07:00
Matias Niemelä 169e9dd2c8 feat(ivy): bridge compile instructions to include sanitization helpers (#24938)
PR Close #24938
2018-07-23 08:49:52 -07:00
Pawel Kozlowski 13f3157823 fix(ivy): update content query compilation to latest runtime (#24957)
PR Close #24957
2018-07-23 08:45:50 -07:00
Vikram Subramanian 6b859daea4 fix(core): stop reusing provider definitions across NgModuleRef instances (#25022)
Fixes #25018.

Instantiating a NgModuleRef from NgModuleFactory reuses the NgModuleDefinition if it is already present. However the NgModuleDefinition has a providers array which modified when tree shakable providers are instantiated. This corrupts the provider definitions the next time the same factory is used to create a new NgModuleRef - Two provider definitions can end up with the same index anf the injector could potentially return a completely wrong object for a provider token.

This scenario is more likely on the server where the same NgModuleFactory is reused across requests.

The fix clones the cached NgModuleDefinition so that any tree shakable providers added later do not affect the cached copy.

PR Close #25022
2018-07-23 08:13:29 -07:00
Judy Bogart 7960d1879d
docs: technical review incorporated (#24744)
closes #24744
2018-07-20 12:40:00 -07:00
Judy Bogart f1ab394218
docs: add api doc to commonly queried elements 2018-07-20 12:39:10 -07:00
Alex Eagle 86203736e9 fix(service-worker): don't include sourceMappingURL in ngsw-worker (#24877)
Fixes #23596

PR Close #24877
2018-07-20 11:49:46 -07:00