Commit graph

2371 commits

Author SHA1 Message Date
Paul Gschwendtner
890d06959b test: update ngtsc specs to work with es2015 output (#44505)
Updates the ngtsc specs to work with ES2015 output.

PR Close #44505
2022-01-05 23:20:20 +00:00
Paul Gschwendtner
c46d533b22 build: switch devmode output to es2015 (#44505)
To make our test output i.e. devmode output more aligned
with what we produce in the NPM packages, or to be more
aligned with what Angular applications will usually consume,
the devmode output is switched from ES5 to ES2015.

Additionally various tsconfigs (outside of Bazel) have been
updated to match with the other parts of the build. The rules
are:

ES2015 for test configurations, ES2020 for actual code that will
end up being shipped (this includes the IDE-only tsconfigs).

PR Close #44505
2022-01-05 23:20:20 +00:00
JoostK
d196cbc332 refactor(compiler): remove class related output AST types (#44411)
The Ivy compiler no longer generates classes so this commit removes
the supporting output nodes.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
8cadfe1f5b refactor(compiler): remove type-casting related output AST types (#44411)
The Ivy compiler no longer generates code for type-checking purposes
using the output AST types. Instead, it uses TypeScript AST nodes and
its printer for type-checking. This commit removes the type-related
output nodes.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
f352c2bed9 refactor(compiler): remove some unused output AST types (#44411)
This kind of output is no longer emitted into generated code, so the
supporting output AST is removed.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
1d39a5e6ac refactor(compiler): remove syntax error logic (#44411)
This code is no longer used now that ViewEngine has been removed.

PR Close #44411
2022-01-04 15:54:09 -08:00
Paul Gschwendtner
c8cd5d5f2c build: switch all instances from ng_rollup_bundle to app_bundle (#44490)
The `ng_rollup_bundle` rule has been replaced with a new rule called
`app_bundle`. This rule replicates the Angular v13 optimization
pipeline in the CLI, so that we can get better benchmarking results.
Also the rule is much simpler to maintain as it relies on ESbuild.

The old `ng_rollup_bundle` rule did rely on e.g. build-optimizer that no
longer has an effect on v13 Angular packages, so technically size
tests/symbol tests were no longer as correct as they were before. This
commit fixes that.

A couple of different changes and their explanation:

* Language-service will no longer use the benchmark rule for creating
  its NPM bundles! It will use plain `rollup_bundle`. ESBuild would have
  been nice but the language-service relies on AMD that ESBuild cannot
  generate (yet?)

* Service-worker ngsw-worker.js file was generated using the benchmark
  bundle rule. This is wrong. We will use a simple ESbuild rule in the
  future. The output is more predictable that way, and we can have a
  clear use of the benchmark bundle rule..

* A couple of benchmarks in `modules/` had to be updated to use e.g.
  `initTableUtils` calls. This is done because with the new rule, all
  files except for the entry-point are considered side-effect free. The
  utilities for benchmarks relied on side-effects in some
  transitively-loaded file (bad practice anyway IMO). We are now
  initializing the utilities using a proper init function that is
  exported...

PR Close #44490
2022-01-04 12:14:14 -08:00
Kristiyan Kostadinov
093fd39f93 refactor(compiler): clean up workarounds for TypeScript 4.5 (#44477)
Cleans up some of the temporary workarounds that were necessary in order to land support for TypeScript 4.5 since they're no longer necessary.

PR Close #44477
2021-12-14 16:14:02 -05:00
JoostK
e4839939b0 test(ngcc): don't use the workspace typescript version to generate integration test fixtures (#44448)
Now that ViewEngine libraries can no longer be created, the latest
TypeScript version that ngcc should be able to process is TypeScript 4.3,
i.e. the version of TypeScript that was supported in Angular 12.
However, ngcc's integration tests used the TypeScript version of the
workspace to create the JavaScript files from TypeScript sources on
demand. This introduces friction when upgrading the TypeScript version
within the workspace, as changes to TypeScript's emit format may affect
ngcc's ability to process it correctly.

The on demand creation of JavaScript files was convenient for authoring
tests, but it also helped to detect incompatibilities with newer
versions of TypeScript. Now that ngcc no longer has to process newer
versions of TypeScript, we want to pin the integration suite to use
JavaScript code as if it were compiled using TypeScript 4.3, i.e. a
version of TypeScript that is actually supported by ngcc.

This commit updates the integration test to inline all the generated
files directly in the tests, instead of compiling them on demand. This
was done by temporarily installing TypeScript 4.3 and using it to create
the `loadTestFiles` statement from the original TypeScript inputs.

An alternative could have been to install TypeScript 4.3 as an actual
dependency in the workspace and using that to continue compiling the
integration suite on demand, but this brings some overhead in package
installations (TypeScript is ~60MB) and the authoring aspect of ngcc
integration test is expected to diminish, now that ngcc's support is no
longer a moving target.

PR Close #44448
2021-12-14 16:08:28 -05:00
Paul Gschwendtner
98c5063cd8 build: update visibility for npm package targets to work with new integration test structure (#44238)
As mentioned in the previous commit, integration tests will be declared
in subpackages of `//integration`. For these tests to still rely on the
NPM packages from `HEAD`, we need to update the visibility.

PR Close #44238
2021-12-08 13:42:41 -05:00
George Kalpakas
41265919aa fix(ngcc): correctly resolve UMD dependencies (#44381)
Previously, when processing UMD, ngcc assumed that the `exports`
argument of the CommonJS factory call (if present) would be the first
argument of the call. This is generally true for the supported UMD
formats, but can change if ngcc prepends more imports (and thus factory
arguments) while processing the module. This could lead to errors when
trying to collect dependencies of an already processed module.
(This was accidentally broken in #44245 (commit 2bc3522e16).)

This commit fixes it by not making any assumptions about the position of
an `exports` argument in the CommonJS factory call.

Fixes #44380

PR Close #44381
2021-12-07 08:33:00 -05:00
Alex Rickabaugh
43db24302c refactor(compiler): delete View Engine components of @angular/compiler (#44368)
This commit finishes the removal of View Engine from the codebase, deleting
those pieces of @angular/compiler which were only used for VE.

Co-Authored-By: JoostK <joost.koehoorn@gmail.com>

PR Close #44368
2021-12-06 13:12:36 -05:00
JoostK
1922032786 refactor(compiler-cli): dismantle View Engine implementation of ngc (#44269)
This commit does a first-pass removal of the View Engine infrastructure
in compiler-cli. A more in-depth cleanup is necessary and large parts
of the View Engine compiler infrastructure remain within
`@angular/compiler`, this is just a first cleanup step.

PR Close #44269
2021-12-01 10:36:30 -08:00
JoostK
604636e70a refactor(compiler-cli): move version number helpers out of diagnostics subfolder (#44269)
As a preparation for the removal of the ViewEngine parts in
`compiler-cli`, this commit moves the version number helper functions
up one level such that the whole `diagnostics` subfolder can be removed.

PR Close #44269
2021-12-01 10:36:30 -08:00
Kristiyan Kostadinov
d56e3f43a1 feat(core): support TypeScript 4.5 (#44164)
Adds support for TypeScript 4.5. Includes the following changes:
* Bumping the package versions.
* Fixing a few calls to `createExportSpecifier` and `createImportSpecifier` that require an extra parameter.
* Adding some missing methods to the TS compiler hosts.
* Fixing an issue in the TS mocks for the ngcc tests where a regex was too agressive and was trying to match a path like `/node_modules/@typescript/lib-es5`.
* Accounting for type-only import specifiers when reporting DI errors (see #43620).

Fixes #43620.

PR Close #44164
2021-11-30 11:59:02 -05:00
Paul Gschwendtner
6c1573bc08 fix(compiler-cli): downlevel transform incorrectly extracting constructor parameters for nested classes (#44281)
The downlevel decorator transform (commonly used in the CLI and other
tooling of the ecosystem for enabling JIT ES2015+), is currently
incorrectly dealing with nested classes.

The transform will accidentally visit nested classes (in a constructor)
multiple times and generate duplicated instances of the `ctorParameters`
fields. This does not sound like an issue at first, but the duplicated
`ctorParameters` fields will miss significant type information that has
been elided by the first visit, resulting in generated code like the
following:

```js
      let MyClass = /* @__PURE__ */ __name(class MyClass extends UpgradeNg1ComponentAdapter {
        constructor(scope, injector3, elementRef) {
        }
      }, "MyClass");
      MyClass.ctorParameters = () => [
        { type: void 0, decorators: [{ type: Inject, args: [$SCOPE] }] },
        { type: Injector },
        { type: ElementRef }
      ];
      MyClass.ctorParameters = () => [
        { type: void 0 }, // <---- NOTE!
        { type: Injector },
        { type: ElementRef }
      ];
```

PR Close #44281
2021-11-30 11:56:05 -05:00
Paul Gschwendtner
a87fcaaabb test: re-add downlevel decorator transform test (#44281)
Re-adds the accidentally deleted downlevel decorator transform test.

PR Close #44281
2021-11-30 11:56:05 -05:00
George Kalpakas
8077695167 test(ngcc): use main property in test package.json files for UMD tests (#44245)
Previously, the mock packages created for `UmdDependencyHost`'s tests,
specified the entry-point as `esm2015`. This does not matter in tests,
since the packages are explicitly passed to the `UmdDependencyHost`
(while in reality the appropriate host would be determined based on the
name of the entry-point property - in this case, detecting the
entry-point as ES2015 and not UMD).

However, in order to avoid confusion, this commit updates the test
packages to use `main` (the default property used for the UMD format in
`package.json` files).

PR Close #44245
2021-11-29 12:38:06 -05:00
George Kalpakas
de0975c6d9 fix(ngcc): correctly report error when collecting dependencies of UMD module (#44245)
Previously, the ngcc `UmdReflectionHost` would throw a misleading error
when trying to collect dependencies of an invalidly formatted UMD
module. This happened because an error would be thrown while trying to
construct the error message for the actual error, by calling `getText()`
on certain TypeScript AST nodes. See
https://github.com/angular/angular/issues/44019#issuecomment-959954121
for a more in-depth explanation.

This commit ensures `getText()` can be safely called on TypeScript AST
nodes when collecting dependencies of UMD modules.

PR Close #44245
2021-11-29 12:38:06 -05:00
George Kalpakas
707bf41fa6 test(ngcc): run more tests against more supported UMD formats (#44245)
This commit utilizes the infrastructure added in the previous commit to
run more tests against more of the supported UMD formats. This shall
give us more confidence that all aspects of UMD processing work
correctly with the various formats.

PR Close #44245
2021-11-29 12:38:05 -05:00
George Kalpakas
557857a4f2 test(ngcc): use helper function for generating UMD modules for tests (#44245)
Previously, several ngcc test suites used their own helper to generate
test UMD modules.

This commit switches to using the same helper for generating UMD modules
across test suites. This improves DRYness (ensuring changes/fixes to the
UMD format need only be applied once) and makes it easier to test
different UMD formats in all test suites.

PR Close #44245
2021-11-29 12:38:05 -05:00
George Kalpakas
3c8a5d1c70 fix(ngcc): support the UMD wrapper function format emitted by Webpack (#44245)
Previously, ngcc could only handle UMD modules whose wrapper function
was implemented as a `ts.ConditionalExpression` (i.e. using a ternary
operator). This is the format emitted by popular bundlers, such as
Rollup.

This commit adds support for a different format, that uses `if/else`
statements, which is what is [emitted by Webpack][1].

[1]: https://webpack.js.org/configuration/output/#type-umd

Fixes #44019

PR Close #44245
2021-11-29 12:38:05 -05:00
George Kalpakas
e145b7a3f8 refactor(ngcc): make it easy to support more UMD wrapper function formats (#44245)
Previously, ngcc could only handle UMD modules whose wrapper function
was implemented as a `ts.ConditionalExpression` (i.e. using a ternary
operator). This is the format emitted by popular bundlers, such as
Rollup. However, this failed to account for a different format, using
`if/else` statements, such as the one [emitted by Webpack][1].

This commit prepares ngcc for supporting different UMD wrapper function
formats by decoupling the operation of parsing the wrapper function body
to capture the various factory function calls and that of operating on
the factory function calls (for example, to read or update their
arguments). In a subsequent commit, this will be used to add support for
the Webpack format.

[1]: https://webpack.js.org/configuration/output/#type-umd

PR Close #44245
2021-11-29 12:38:05 -05:00
Andrew Kushnir
b31973c176 test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120)
This commit removes special functions that were used to run tests in ViewEngine or Ivy only.
Since ViewEngine is deprecated and we no longer run ViewEngine tests on CI, we can cleanup
those special helpers and ViewEngine-only tests.

PR Close #44120
2021-11-24 19:42:39 +00:00
JoostK
d8e65776cb refactor(ngcc): remove Ivy switch marker transform (#43891)
ngcc used to rewrite `PRE_R3` markers to become `POST_R3` in order to
switch the runtime implementation in `@angular/core` from View Engine to
Ivy. Now that `@angular/core` is published as native Ivy package and the
runtime switch code has been removed, there is no need for ngcc to
perform this transform anymore.

PR Close #43891
2021-11-24 19:26:25 +00:00
JoostK
b2ac81d147 refactor(compiler-cli): remove Ivy switch transform (#43891)
Now that the core package has been cleaned up to no longer contain Ivy
switch code, the transform to switch the `PRE_R3` markers to become
`POST_R3` is deleted as well.

PR Close #43891
2021-11-24 19:26:25 +00:00
Alex Rickabaugh
8c71b9fc42 refactor: delete the View Engine runtime (#43884)
This commit removes the View Engine runtime. Itself, this change is
relatively straightforward, but it represents the final step in a multi-year
journey. It's only possible due to the hard work of many current and former
team members and collaborators, who are too numerous to list here.

Co-authored-by: Alan Agius <alan.agius4@gmail.com>
Co-authored-by: Andrew Kushnir <akushnir@google.com>
Co-authored-by: Andrew Scott <atscott01@gmail.com>
Co-authored-by: Andrew Seguin <andrewjs@google.com>
Co-authored-by: Cédric Exbrayat <cedric@ninja-squad.com>
Co-authored-by: Charles Lyding <19598772+clydin@users.noreply.github.com>
Co-authored-by: Dave Shevitz <dshevitz@google.com>
Co-authored-by: Doug Parker <dgp1130@users.noreply.github.com>
Co-authored-by: Dylan Hunn <dylhunn@gmail.com>
Co-authored-by: Emma Twersky <emmatwersky@google.com>
Co-authored-by: George Kalpakas <kalpakas.g@gmail.com>
Co-authored-by: Igor Minar <iminar@google.com>
Co-authored-by: Jeremy Elbourn <jelbourn@google.com>
Co-authored-by: Jessica Janiuk <jessicajaniuk@google.com>
Co-authored-by: JiaLiPassion <JiaLi.Passion@gmail.com>
Co-authored-by: Joey Perrott <josephperrott@gmail.com>
Co-authored-by: Joost Koehoorn <joost.koehoorn@gmail.com>
Co-authored-by: Kristiyan Kostadinov <crisbeto@abv.bg>
Co-authored-by: Madleina Scheidegger <mscheid@google.com>
Co-authored-by: Mark Thompson <2554588+MarkTechson@users.noreply.github.com>
Co-authored-by: Minko Gechev <mgechev@gmail.com>
Co-authored-by: Paul Gschwendtner <paulgschwendtner@gmail.com>
Co-authored-by: Pawel Kozlowski <pkozlowski.opensource@gmail.com>
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
Co-authored-by: Wagner Maciel <wagnermaciel@google.com>
Co-authored-by: Zach Arend <zachzach@google.com>

PR Close #43884
2021-11-23 21:10:06 +00:00
Alex Rickabaugh
bb9ff6003c test: remove view-engine-only tests (#43884)
This commit removes most tests that were designated as only covering View
Engine code. It also removes tag filters from CI and local commands to run
tests.

In a few cases (such as with the packages/compiler tests), this tag was
improperly applied, and certain test cases have been added back running in
Ivy mode.

This commit also empties `@angular/compiler/testing` as it is no longer
necessary (this is safe since compiler packages are not public API). It can
be deleted in the future.

PR Close #43884
2021-11-23 21:10:06 +00:00
Pete Bacon Darwin
24b635395f fix(ngcc): ensure that ngcc does not write a lock-file into node_modules package directories (#44228)
When executing, ngcc writes a lock-file that is used to coordinate multiple concurrent instances of ngcc.
Previously, this file was written at `node_modules/@angular/compiler-cli/ngcc`, or similar depending upon the bundling of the package.
But this causes problems for setups where `node_modules` package directories are expected to be read-only.
Now, the lock-file is written as `.ngcc_lock_file` into the top of the `node_modules`, which is an acceptable place to store transient files.

This change should help to unblock use of tools like pnpm and lerna, which can use symlinks to readonly package directories.

PR Close #44228
2021-11-22 17:55:13 +00:00
Kristiyan Kostadinov
48ca7dce4f fix(compiler-cli): interpret string concat calls (#44167)
These changes add support for interpreting `String.prototype.concat` calls. We need to support it, because in TypeScript 4.5 string template expressions are transpiled to `concat` calls, rather than string concatenations. See https://github.com/microsoft/TypeScript/pull/45304.

PR Close #44167
2021-11-19 19:30:59 +00:00
Pete Bacon Darwin
393efa54e6 fix(compiler): ensure that partially compiled queries can handle forward references (#44113)
When a partially compiled component or directive is "linked" in JIT mode, the body
of its declaration is evaluated by the JavaScript runtime. If a class is referenced
in a query (e.g. `ViewQuery` or `ContentQuery`) but its definition is later in the
file, then the reference must be wrapped in a `forwardRef()` call.

Previously, query predicates were not wrapped correctly in partial declarations
causing the code to crash at runtime. In AOT mode, this code is never evaluated
but instead transformed as part of the build, so this bug did not become apparent
until Angular Material started running JIT mode tests on its distributable output.

This change fixes this problem by noting when queries are wrapped in `forwardRef()`
calls and ensuring that this gets passed through to partial compilation declarations
and then suitably stripped during linking.

See https://github.com/angular/components/pull/23882 and https://github.com/angular/components/issues/23907

PR Close #44113
2021-11-10 18:25:16 +00:00
Pete Bacon Darwin
67fbec39cb refactor(compiler): rename R3ProviderExpression and associated helpers (#44113)
This interface will be used in other situations so this change renames it to be more general as `MaybeForwardRefExpression`.

PR Close #44113
2021-11-10 18:25:16 +00:00
Kristiyan Kostadinov
247c18dee0 fix(compiler-cli): handle pre-release versions when checking version (#44109)
Currently the TS version checking function interprets a version like `1.2.3-rc.5` as `1.2.NaN` which would allow it to bypass the version checking altogether.

These changes add a little bit more logic to ensure that such versions are handled correctly. There's also an error if we don't manage to parse the version string.

Also it seemed like we never actually ran the version check unit tests, because they didn't have a test target.

PR Close #44109
2021-11-09 20:54:45 +00:00
Pete Bacon Darwin
28ef5af03f refactor(ngcc): improve logging of progress (#43996)
This commit adds additional information to encourage developers to contact
the author of View Engine libraries and ask them to update to partial Ivy.

Fixes #42308

PR Close #43996
2021-11-09 18:10:18 +00:00
JoostK
2a2744721b fix(compiler-cli): ensure literal types are retained when strictNullInputTypes is disabled (#38305)
Consider the `NgModel` directive which has the `ngModelOptions` input:

```ts
class NgModel {
  @Input() ngModelOptions: { updateOn: 'blur'|'change'|'submit' };
}
```

In a template this may be set using an object literal as follows:

```html
<input ngModel [ngModelOptions]="{updateOn: 'blur'}">
```

This assignment should be accepted, as the object's type aligns with the
`ngModelOptions` input in `NgModel`. However, if the `strictNullInputTypes`
option is disabled this assignment would inadvertently produce an error:

```
Type '{ updateOn: string; }' is not assignable to type '{ updateOn: "blur"|"change"|"submit"; }'.
  Types of property 'updateOn' are incompatible.
    Type 'string' is not assignable to type '"blur"|"change"|"submit"'
```

This is due to the `'blur'` value being inferred to be of type `string`
instead of retaining its literal type. The non-null assertion operator
that is automatically inserted for input binding assignments when
`strictNullInputTypes` is disabled inhibits TypeScript from inferring
the string value as its literal type.

This commit fixes the issue by omitting the insertion of the non-null
operator for object literals and array literals.

PR Close #38305
2021-11-09 18:01:24 +00:00
Joey Perrott
491dd3dcee refactor(compiler-cli): use relative imports within the @angular/compiler-cli package (#44118)
Intrapackage imports should always be done via relative imports rather than using the external
import location.

PR Close #44118
2021-11-08 22:08:27 +00:00
JoostK
b249e24979 fix(compiler): generate correct code for safe method calls (#44088)
When a safe method call such as `person?.getName()` is used, the
compiler would generate invalid code if the argument list also contained
a safe method call. For example, the following code:

```
person?.getName(config?.get('title').enabled)
```

would generate

```
let tmp;
ctx.person == null ? null : ctx.person.getName((tmp = tmp) == null ?
null : tmp.enabled)
```

Notice how the call to `config.get('title')` has completely disappeared,
with `(tmp = tmp)` having taken its place.

The issue occurred due to how the argument list would be converted
from expression AST to output AST twice. First, the outer safe method
call would first convert its arguments list. This resulted in a
temporary being allocated for `config.get('title')`, which was stored in
the internal `_resultMap`. Only after the argument list has been
converted would the outer safe method call realize that it should be
guarded by a safe access of `person`, entering the `convertSafeAccess`
procedure to convert itself. This would convert the argument list once
again, but this time the `_resultMap` would already contain the
temporary `tmp` for `config?.get('title')`. Consequently, the safe
method in the argument list would be emitted as `tmp`.

This commit fixes the issue by ensuring that nodes are only converted
once.

Closes #44069

PR Close #44088
2021-11-08 17:31:36 +00:00
Pete Bacon Darwin
70d3805fd6 refactor: remove ɵloc and related code (#43913)
This code is not used in ivy - and probably was not being used
in View Engine either.

PR Close #43913
2021-10-28 11:19:12 -07:00
Paul Gschwendtner
4b641a914b build: enable code splitting for esbuild bundling of compiler-cli (#43932)
Enables code spitting for ESBuild bundling of the compiler-cli. When
we initially configured ESBuild as part of APF v13, we left this option
disabled as code splitting is marked experimental. The ESM splitting
mechanism in ESBuild seems very solid so far (judging subjectively
and by experience/reports in the ESBuild repo), so we should give
it a shot, in order to significantly reduce the size of the NPM package,
and simplify debugging (by not having duplicated code portions for all
the different entry points).

To clarify: Code splitting is helpful as we have multiple entry-points
that currently duplicate code. With code splitting these entry-points
would share common code instead.

PR Close #43932
2021-10-26 23:58:27 +00:00
JoostK
28a40f3396 refactor(compiler-cli): extract error documentation base url into separate file (#43527)
Prior refactorings caused unexpected g3 sync issues due to a patch that
changes the error documentation URL. This commit moves the base url into
a separate file to make this more apparent.

PR Close #43527
2021-10-26 18:22:32 +00:00
JoostK
5d678de4da fix(compiler-cli): avoid broken references in .d.ts files due to @internal markers (#43527)
The `ErrorCode` enum in the `error_code.ts` file is governed by public
api guards but the other top-level exports from that file are exempt
from public api documentation and are therefore marked as `@internal`.
However, TypeScript is configured with the `stripInternal` compiler
option such that declarations with `@internal` markers are not emitted
into the `.d.ts` files, but this means that the reexports in the barrel
file end up referring to missing declarations.

The `stripInternal` option is considered internal and its documentation
states to use at your own risk (as per https://github.com/microsoft/TypeScript/issues/45307).
Having the option enabled is desirable for us as it works well for
hiding class fields that are marked `@internal`, which is an effective
way to hide members from the .d.ts file. As a workaround for the issue
with top-level symbols, the declarations with `@internal` markers are
moved to dedicated files for which no public api guard is setup,
therefore allowing their `@internal` markers to be dropped.

Fixes #43097

PR Close #43527
2021-10-26 18:22:32 +00:00
George Kalpakas
6e37c938e2 fix(ngcc): support alternate UMD layout when adding new imports (#43931)
In #43879, `UmdReflectionHost` was updated to deal with the new UMD
format used by Rollup, where the parenthesis is around the wrapper
function and not the wrapper function call.
For reference, this caused failures in the `ngcc-validation` repo
([example 1][1], [example 2][2]).

This commit updates `UmdRenderingFormatter` to also handle both UMD
formats. In order to validate the change, this commit also updates the
`UmdRenderingFormatter` tests to run against both UMD formats.

[1]: https://circleci.com/gh/angular/ngcc-validation/65916
[2]: https://circleci.com/gh/angular/ngcc-validation/65758

PR Close #43931
2021-10-25 17:56:26 +00:00
JoostK
007b96eb2e test(compiler-cli): run i18n extraction tests using Ivy compiler (#43893)
This commit re-enables the `extract_i18n` test target and updates the
test to run with the Ivy compiler.

PR Close #43893
2021-10-19 16:26:21 -07:00
JoostK
52a6785a82 test(compiler-cli): run watch mode tests using Ivy compiler (#43893)
This commit re-enables the `perform_watch` test target and updates the
test to run with the Ivy compiler.

Additionally, this target was switched over to use Angular v12 packages
as input to the test, to allow the ViewEngine tests to continue working
with v13 packages which are Ivy-only. This commit reverts those changes
now that View Engine tests are disabled, as it's desirable to test
against local artifacts that are build within the monorepo instead of
depending on NPM packages.

PR Close #43893
2021-10-19 16:26:21 -07:00
Joey Perrott
fbd2e4f0cd ci: mark core/schematics/test:test and compiler-cli/test:perform_watch test as view engine only (#43862)
Both test targets fail because, at test time, they use the view engine compiler, even when bazel sets the
configuration to use ivy.

PR Close #43862
2021-10-19 10:06:55 -07:00
Doug Parker
737f71e3aa refactor(compiler-cli): throw an error when compiling with View Engine. (#43862)
The View Engine compiler now throws when constructed and will be removed shortly. Direct users should switch to `NgtscProgram` to build with [Ivy](https://angular.io/guide/ivy). The View Engine compiler is being removed, so this makes it throw an error to ensure no one accidentally depends on code being removed.

PR Close #43862
2021-10-19 10:06:55 -07:00
Joey Perrott
aef63e7ae5 build: remove "ivy-only" bazel tag (#43862)
Because all actions are assumed to be running on Ivy, things which only work on Ivy should not be marked as
Ivy only.

PR Close #43862
2021-10-19 10:06:55 -07:00
Joey Perrott
a365a1f0ff build: rename "no-ivy-aot" tag to "view-engine-only" (#43862)
Using the tag "view-engine-only" better describes the expected usage of bazel targets with the test. They can
only be run with view engine.

PR Close #43862
2021-10-19 10:06:55 -07:00
Joey Perrott
6212a60dcb build: remove test-ivy-aot yarn script (#43862)
Since building with ViewEngine is not longer desired on CI, removing the ivy vs non-ivy testing yarn scripts
is done, informing developers to instead use `yarn test` as all tests should be run using the Ivy complier.

PR Close #43862
2021-10-19 10:06:55 -07:00
Pete Bacon Darwin
ec8a565655 fix(ngcc): support alternate wrapper function layout for UMD (#43879)
Recently rollup, used by ng-packagr, changed the position of parentheses
around its generated UMD wrapper functions.

This commit ensures that ngcc can handle both.

Fixes #43870

PR Close #43879
2021-10-18 14:56:59 -07:00